Skip to content

Commit c17a404

Browse files
authored
Merge pull request #14 from im4codes/dev
Dev
2 parents 9ea2e95 + c80c104 commit c17a404

289 files changed

Lines changed: 31722 additions & 5123 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
with:
2525
node-version: ${{ env.NODE_VERSION_PRIMARY }}
2626
cache: 'npm'
27-
- run: npm ci
27+
- run: ./scripts/ci-npm-ci.sh .
2828
- run: npm run lint
2929

3030
# ── Typecheck (daemon + server) ───────────────────────────────────────────
@@ -38,7 +38,7 @@ jobs:
3838
with:
3939
node-version: ${{ env.NODE_VERSION_PRIMARY }}
4040
cache: 'npm'
41-
- run: npm ci
41+
- run: ./scripts/ci-npm-ci.sh .
4242
- name: Install server deps
4343
run: ./scripts/ci-npm-ci.sh server
4444
- name: Daemon
@@ -74,7 +74,7 @@ jobs:
7474
with:
7575
node-version: ${{ matrix.node }}
7676
cache: 'npm'
77-
- run: npm ci
77+
- run: ./scripts/ci-npm-ci.sh .
7878
- run: npm run build
7979
- run: npm run test:unit
8080

@@ -87,7 +87,7 @@ jobs:
8787
with:
8888
node-version: ${{ env.NODE_VERSION_PRIMARY }}
8989
cache: 'npm'
90-
- run: npm ci
90+
- run: ./scripts/ci-npm-ci.sh .
9191
- name: Cache embedding model
9292
uses: actions/cache@v4
9393
with:
@@ -114,7 +114,7 @@ jobs:
114114
run: brew install tmux
115115
- name: Prime tmux server
116116
run: tmux new-session -d -s init && tmux kill-session -t init
117-
- run: npm ci
117+
- run: ./scripts/ci-npm-ci.sh .
118118
- run: npm run build
119119
- run: npm run test:unit
120120

@@ -129,10 +129,10 @@ jobs:
129129
with:
130130
node-version: ${{ env.NODE_VERSION_PRIMARY }}
131131
cache: 'npm'
132-
- run: npm ci
132+
- run: bash ./scripts/ci-npm-ci.sh .
133133
- run: npm run build
134134
- name: Run Windows-specific unit tests
135-
run: npx vitest run test/agent/wezterm.test.ts test/daemon/hook-send.test.ts test/daemon/env-injection.test.ts test/cli/send.test.ts test/util/windows-daemon.test.ts test/util/windows-upgrade-script.test.ts test/util/windows-launch-artifacts.test.ts test/util/windows-launch-artifacts.cmd-parse.test.ts test/util/windows-stale-watchdog-cleanup.test.ts
135+
run: npx vitest run test/agent/wezterm.test.ts test/daemon/hook-send.test.ts test/daemon/env-injection.test.ts test/cli/send.test.ts test/util/windows-daemon.test.ts test/util/windows-upgrade-script.test.ts test/util/windows-launch-artifacts.test.ts test/util/windows-launch-artifacts.cmd-parse.test.ts test/util/windows-stale-watchdog-cleanup.test.ts test/util/postinstall-sharp-repair.test.ts
136136
env:
137137
IMCODES_MUX: wezterm
138138

@@ -145,7 +145,7 @@ jobs:
145145
with:
146146
node-version: ${{ env.NODE_VERSION_PRIMARY }}
147147
cache: 'npm'
148-
- run: npm ci
148+
- run: bash ./scripts/ci-npm-ci.sh .
149149
- run: npm run build
150150
- name: Run Windows ConPTY / startup regression tests
151151
run: npx vitest run test/agent/conpty.test.ts test/agent/drivers/drivers.test.ts test/util/windows-daemon.test.ts test/util/windows-upgrade-script.test.ts test/util/windows-launch-artifacts.test.ts test/util/windows-launch-artifacts.cmd-parse.test.ts test/util/windows-stale-watchdog-cleanup.test.ts
@@ -160,7 +160,7 @@ jobs:
160160
with:
161161
node-version: ${{ env.NODE_VERSION_PRIMARY }}
162162
cache: 'npm'
163-
- run: npm ci
163+
- run: ./scripts/ci-npm-ci.sh .
164164
- run: ./scripts/ci-npm-ci.sh web
165165
- run: cd web && npx vitest run --config vitest.unit.config.ts
166166

@@ -173,7 +173,7 @@ jobs:
173173
with:
174174
node-version: ${{ env.NODE_VERSION_PRIMARY }}
175175
cache: 'npm'
176-
- run: npm ci
176+
- run: ./scripts/ci-npm-ci.sh .
177177
- run: ./scripts/ci-npm-ci.sh web
178178
- run: cd web && npx vitest run --config vitest.components.config.ts
179179

@@ -192,7 +192,7 @@ jobs:
192192
node-version: ${{ env.NODE_VERSION_SERVER }}
193193
cache: 'npm'
194194
cache-dependency-path: package-lock.json
195-
- run: npm ci
195+
- run: ./scripts/ci-npm-ci.sh .
196196
- run: ./scripts/ci-npm-ci.sh server
197197
- run: npm run test:server
198198
- name: Run server-native tests (auth-flow, proxy-addr — require server/node_modules)
@@ -241,7 +241,7 @@ jobs:
241241
run: sudo apt-get install -y tmux
242242
- name: Prime tmux server (ensures socket dir exists)
243243
run: tmux new-session -d -s init && tmux kill-session -t init
244-
- run: npm ci
244+
- run: ./scripts/ci-npm-ci.sh .
245245
- name: Install web deps (active timeline refresh e2e wrapper invokes web vitest)
246246
run: ./scripts/ci-npm-ci.sh web
247247
- name: Run pipe-pane e2e tests
@@ -261,7 +261,7 @@ jobs:
261261
with:
262262
node-version: ${{ env.NODE_VERSION_PRIMARY }}
263263
cache: 'npm'
264-
- run: npm ci
264+
- run: ./scripts/ci-npm-ci.sh .
265265
- name: Install & authenticate glab (optional — tests skip if unavailable)
266266
continue-on-error: true
267267
run: |
@@ -295,7 +295,7 @@ jobs:
295295
run: sudo apt-get install -y tmux
296296
- name: Prime tmux server
297297
run: tmux new-session -d -s init && tmux kill-session -t init
298-
- run: npm ci
298+
- run: ./scripts/ci-npm-ci.sh .
299299
- name: Install web deps (needed for tsx component tests)
300300
run: ./scripts/ci-npm-ci.sh web
301301
- name: Install server deps (needed for server route tests)
@@ -338,7 +338,7 @@ jobs:
338338
sed -i '/^always-auth=/d' "$NPM_CONFIG_USERCONFIG"
339339
fi
340340
- run: npm install -g npm@11.11.1
341-
- run: npm ci
341+
- run: ./scripts/ci-npm-ci.sh .
342342
- name: Install web deps
343343
run: ./scripts/ci-npm-ci.sh web
344344
- name: Install server deps
@@ -533,7 +533,7 @@ jobs:
533533
yes | sdkmanager --licenses
534534
sdkmanager "platforms;android-36" "build-tools;36.0.0" "platform-tools"
535535
536-
- run: npm ci
536+
- run: ./scripts/ci-npm-ci.sh .
537537

538538
- run: npm ci
539539
working-directory: web

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ The web project uses `i18next` with `react-i18next` for internationalization.
8888
- Main sessions and sub-sessions are the same session model. Treat them as equally important in behavior, queueing, timeline semantics, edit/undo, and lifecycle handling. Differences should come only from parent/attachment relationship and presentation constraints, not from weaker semantics for sub-sessions.
8989
- Agent types: Process = `'claude-code' | 'codex' | 'gemini' | 'opencode' | 'shell' | 'script'`, Transport = `'openclaw' | 'qwen'` — the `AgentType` union in `src/agent/detect.ts`.
9090
- **Pod-sticky routing (MANDATORY for daemon-dependent requests)**: The server runs multiple replicas. Each daemon connects to ONE pod via WebSocket. The ingress uses `:serverId` in the URL path to route requests to the pod holding that daemon's WS. Any endpoint that depends on the daemon (file transfer, session commands, Watch API) **MUST** include `:serverId` in the URL path (e.g., `/api/server/:serverId/...`). In-memory state (download tokens, WsBridge instances, terminal streams) is per-pod — requests without serverId routing will hit a random pod and fail.
91+
- **MANDATORY — Transport command liveness contract:** Daemon command receipt and urgent-control delivery MUST preserve current dev behavior. The daemon MUST NOT intercept `/compact`; `/compact` is an ordinary SDK-native message and is forwarded unchanged. Ordinary `session.send` ack is a daemon-receipt ack and MUST NOT wait for recall, live context bootstrap, memory lookup/enrichment, embedding, transport lock, pending relaunch, provider send-start, provider settlement, telemetry, or any background memory work. `/stop` and approval/feedback/control responses MUST use the priority path and MUST NOT be routed through or blocked by the ordinary send queue/locks.
9192
- Server secrets (`JWT_SIGNING_KEY`) are set via environment variables, never committed.
9293
- E2E tests require tmux. They are auto-skipped when `SKIP_TMUX_TESTS=1` or inside a Claude Code session (`CLAUDECODE` env var set).
9394
- **MANDATORY — Test session hygiene:** Any e2e/integration test that creates tmux sessions, main sessions, sub-sessions, or temporary projects/cwds **MUST** use naming/path patterns covered by `shared/test-session-guard.ts`. If a new test introduces a new naming family, you **MUST** update `shared/test-session-guard.ts` and its tests in the same change. Leaked test sessions must never persist to `~/.imcodes/sessions.json`, must never be written to the server DB, and must be cleaned from live terminal backends on daemon startup.

bench/memory-pipeline.bench.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { performance } from 'node:perf_hooks';
2+
import { redactSensitiveText } from '../src/util/redact-secrets.js';
3+
4+
function assertThreshold(name: string, value: number, threshold: number): void {
5+
if (value > threshold) {
6+
throw new Error(`${name} threshold failed: ${value.toFixed(2)}ms > ${threshold}ms`);
7+
}
8+
console.log(`${name}: ${value.toFixed(2)}ms <= ${threshold}ms`);
9+
}
10+
11+
// Assemble at runtime so GitHub secret-scanning doesn't see a literal
12+
// secret-shaped string in source — the redactor regex matches the joined
13+
// value the same way it would match a literal.
14+
const secret = 's' + 'k_' + 'live_' + '123456789012345678901234';
15+
const bearerToken = 'Bea' + 'rer ' + 'abcdefghijklmnopqrstuvwxyz1234567890';
16+
const text = (`prefix ${secret} ${bearerToken} `).repeat(16_000).slice(0, 1024 * 1024);
17+
const start = performance.now();
18+
const redacted = redactSensitiveText(text);
19+
const elapsed = performance.now() - start;
20+
if (redacted.includes(secret)) throw new Error('redaction benchmark leaked stripe key');
21+
assertThreshold('redaction 1MB', elapsed, 100);

0 commit comments

Comments
 (0)