Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
343 commits
Select commit Hold shift + click to select a range
d7104ed
Merge branch 'feat/plan-store-plan-files-on-the-bound-runti'
7Sageer Sep 17, 2026
12d0bb2
fix(agent-core-v2): keep per-agent runtime bindings durable across re…
7Sageer Sep 17, 2026
7cd157b
feat(agent-core-v2): surface hook execution errors and pin hooks to t…
7Sageer Sep 17, 2026
6db5c12
Merge branch 'feat/hooks-surface-execution-errors-pin-local'
7Sageer Sep 17, 2026
57ba563
Merge branch 'feat/runtimebinding-durable-per-agent-binding'
7Sageer Sep 17, 2026
763455f
Merge remote-tracking branch 'origin/main'
7Sageer Sep 17, 2026
dfd0691
Merge branch 'main' into feat/remote-runtime
7Sageer Sep 17, 2026
192d94f
fix(remote-exec): track connected-view reconnects in connectInflight …
7Sageer Sep 17, 2026
9feb182
Merge branch 'feat/remote-exec-codex-r3-await-connected-vie'
7Sageer Sep 17, 2026
fd3327d
refactor: rename the runtime execution-target concept to environment …
7Sageer Sep 17, 2026
9f8b8e7
refactor: sweep the remaining runtime vocabulary after review
7Sageer Sep 17, 2026
616b862
refactor: rename the last two execution-target locals in program.ts
7Sageer Sep 17, 2026
d8fb980
test: sweep the remaining execution-target runtime identifiers
7Sageer Sep 18, 2026
f25a5c3
Merge branch 'feat/rename-runtime-environment-repo-wide-cod'
7Sageer Sep 18, 2026
d996c8f
Merge branch 'main' into feat/remote-runtime
7Sageer Sep 18, 2026
6c6b3a3
feat: graduate remote environments to stable
7Sageer Sep 18, 2026
af48789
fix: show project environment launchers in the workspace trust prompt
7Sageer Sep 18, 2026
9ac4864
fix: reconcile remote environment declarations on workspace trust flips
7Sageer Sep 18, 2026
01474c4
fix: serialize project environment declaration writes into agent-core-v2
7Sageer Sep 18, 2026
b08cce7
fix: make kimi -p --environment work and tolerate missing remote proj…
7Sageer Sep 18, 2026
bfffa0e
fix: honor the --environment flag in TUI mode
7Sageer Sep 18, 2026
220ac20
fix: repaint environment dialogs on async errors instead of hanging o…
7Sageer Sep 18, 2026
c385fc5
fix: revert the environment binding on conversation undo
7Sageer Sep 18, 2026
c7e4cae
test: give the /environment command host mock a requestRender spy
7Sageer Sep 18, 2026
0ea7919
chore: sweep the remaining graduation hygiene leftovers
7Sageer Sep 18, 2026
ad2efc4
chore: brace the environment dialog requestRender arrows
7Sageer Sep 18, 2026
77893c3
Merge branch 'feat/graduate-remote-environments-to-stable-r'
7Sageer Sep 18, 2026
40ca1c6
feat: animate a spinner in the footer environment slot while connecting
7Sageer Sep 18, 2026
c380f20
Merge branch 'feat/connecting-spinner-in-the-tui-footer-env'
7Sageer Sep 18, 2026
c474998
test(agent-core-v2): dedup environment test construction with shared …
7Sageer Sep 18, 2026
0275504
test(agent-core-v2): dedup environment test fixtures across suites
7Sageer Sep 18, 2026
fa3ab91
test(agent-core-v2): delete multi-layer-pinned environment tests (sea…
7Sageer Sep 18, 2026
a4603b2
feat: reconnect a disconnected bound environment with Enter in /envir…
7Sageer Sep 18, 2026
585282a
test(agent-core-v2): adopt the shared environment stub in the remaini…
7Sageer Sep 18, 2026
8059c01
Merge branch 'feat/enter-reconnects-a-disconnected-bound-en'
7Sageer Sep 18, 2026
c2291ee
test(agent-core-v2): hoist sessionManager wiring disposal into afterEach
7Sageer Sep 18, 2026
ebcabee
Merge branch 'feat/dedup-agent-core-v2-environment-tests-to'
7Sageer Sep 18, 2026
ee87aa1
fix(agent-core-v2): route fs-domain not-found errors through shared p…
7Sageer Sep 18, 2026
4e2efe8
Merge branch 'feat/route-fs-domain-not-found-errors-through'
7Sageer Sep 18, 2026
f8ea9c6
fix(agent-core-v2): abstain permission policies on environment acquir…
7Sageer Sep 18, 2026
645f0fc
fix(kap-server): map environment errors to semantic codes in fs routes
7Sageer Sep 18, 2026
a29e4e3
Merge branch 'feat/permission-policies-abstain-on-environme'
7Sageer Sep 18, 2026
00d68f2
fix(kimi-code): null the status line gitBranch for remote-bound sessions
7Sageer Sep 18, 2026
c628596
Merge branch 'feat/semantic-fs-route-environment-errors-sta'
7Sageer Sep 18, 2026
40bee93
feat(kimi-code): default exec-server to stdio without --listen
7Sageer Sep 18, 2026
9bdc257
Merge branch 'feat/exec-server-defaults-to-stdio-without-li'
7Sageer Sep 18, 2026
1e1cfc5
fix(agent-core-v2): degrade agentsMdReminder quietly on environment a…
7Sageer Sep 18, 2026
11dbdbe
Merge branch 'feat/guard-agentsmdreminder-environment-acqui'
7Sageer Sep 18, 2026
e9e1acd
feat(agent-core-v2): inject AGENTS.md path reminder on first switch t…
7Sageer Sep 18, 2026
53e03ad
fix(agent-core-v2): soften project-context reminder SP wording
7Sageer Sep 18, 2026
472b472
Merge branch 'feat/project-context-path-reminder-on-first-s'
7Sageer Sep 18, 2026
0949bb6
feat(agent-core-v2): add experimental agent environment tools
7Sageer Sep 18, 2026
95e4214
fix(agent-core-v2): address review findings for agent environment tools
7Sageer Sep 18, 2026
86f596c
Merge branch 'feat/agent-environment-tool-group'
7Sageer Sep 18, 2026
82ec755
chore(agent-core-v2): tighten project context reminder text
7Sageer Sep 18, 2026
8c5e544
Merge branch 'feat/reminder-text-tighten'
7Sageer Sep 18, 2026
6e1bf38
refactor: isolate per-session cwd from the shared remote environment …
7Sageer Sep 18, 2026
7707892
docs: align remote environment resume behavior with per-session cwd i…
7Sageer Sep 18, 2026
44b4998
Merge branch 'feat/p1-separate-boundcwd-from-shared-record'
7Sageer Sep 18, 2026
1aec315
feat: connect remote environments on demand and root sessions at thei…
7Sageer Sep 18, 2026
e160115
test: fix bashTool spawn-cwd helper types for tsgo
7Sageer Sep 18, 2026
67df464
Merge branch 'feat/p2-explicit-request-params-and-on-demand'
7Sageer Sep 18, 2026
f9a8c6f
feat: clean up environment resources per session on session close
7Sageer Sep 18, 2026
4baa41d
Merge branch 'feat/p3-per-task-resource-cleanup'
7Sageer Sep 18, 2026
bf59835
Merge branch 'main' into feat/remote-runtime
7Sageer Sep 18, 2026
a558057
feat(remote-exec): time out stalled requests without dropping the con…
7Sageer Sep 18, 2026
447f989
Merge branch 'feat/p4-request-level-timeout-and-failure-dis'
7Sageer Sep 18, 2026
a738630
feat: reap idle remote environment connections after a configurable TTL
7Sageer Sep 18, 2026
96bd4a0
fix: keep idle connection reaping from disrupting active turns
7Sageer Sep 18, 2026
ef43bd4
Merge branch 'feat/p5-idle-connection-reaping'
7Sageer Sep 18, 2026
da1fa05
Merge branch 'main' into feat/remote-runtime
7Sageer Sep 18, 2026
bb300ed
fix: build cold-resumed session controllers on the persisted environment
7Sageer Sep 18, 2026
d8944c8
fix: release remote program generation leases while no controller use…
7Sageer Sep 18, 2026
5d323fd
fix: resolve subagent prompt context and file history on the bound en…
7Sageer Sep 18, 2026
87607f1
fix: resolve the sessionless fs suggest workspace from the environmen…
7Sageer Sep 18, 2026
eaa90d7
chore: changeset for the environment binding fixes
7Sageer Sep 18, 2026
cd56702
fix: degrade file-history reads to unreadable when a stamped environm…
7Sageer Sep 18, 2026
3d5c914
Merge branch 'feat/codex-r4-r5-fixes'
7Sageer Sep 18, 2026
933c702
Merge branch 'main' into feat/remote-runtime
7Sageer Sep 18, 2026
cd7106c
Merge origin/main into main
7Sageer Sep 19, 2026
9d39e38
Merge branch 'feat/resolve-main-origin-conflicts'
7Sageer Sep 19, 2026
8324ec1
Merge branch 'main' into feat/remote-runtime
7Sageer Sep 19, 2026
16ef9ab
feat(agent-core-v2): enable agent environment tools by default
7Sageer Sep 19, 2026
d8069ef
Merge branch 'feat/release-environment-tools-fix-pr3856-ci'
7Sageer Sep 19, 2026
1c5c440
docs: agent environment tools are default-on with opt-out
7Sageer Sep 19, 2026
65e229d
Merge branch 'feat/docs-agent-environment-tools-are-default'
7Sageer Sep 19, 2026
2f56bee
docs: list change_environment and connect in the tools reference
7Sageer Sep 19, 2026
f21c55b
Merge branch 'feat/docs-list-change-environment-connect-in'
7Sageer Sep 19, 2026
5fb727e
docs: add environment parameter to Agent tool entry in tools reference
7Sageer Sep 19, 2026
f12e1e8
docs: fix zh link spacing in Agent environment parameter entry
7Sageer Sep 19, 2026
b6a73bb
Merge branch 'feat/docs-agent-tool-entry-gains-the-environm'
7Sageer Sep 19, 2026
af7948f
Merge branch 'main' into feat/remote-runtime
7Sageer Sep 19, 2026
16154e9
fix(agent-core-v2): give union tool parameter schemas a top-level obj…
7Sageer Sep 19, 2026
428aeff
Merge branch 'feat/fix-connect-tool-parameters-schema-for-s'
7Sageer Sep 19, 2026
03e5743
fix(agent-core-v2): ask for environment switch confirmation only in m…
7Sageer Sep 19, 2026
d6f87d0
docs: environment switching asks only in Always Ask mode
7Sageer Sep 19, 2026
a019314
Merge branch 'feat/environment-switch-permission-policy-ask'
7Sageer Sep 19, 2026
4435ea2
Merge branch 'feat/docs-environment-switching-asks-only-in'
7Sageer Sep 19, 2026
435e183
fix: revert the environment binding on conversation undo
7Sageer Sep 19, 2026
2b45c47
fix: drop a parked environment switch once a newer switch commits
7Sageer Sep 19, 2026
ca6ffdc
Merge branch 'feat/fix-conversation-undo-does-not-revert-th'
7Sageer Sep 19, 2026
309614f
docs: environment switch takes effect on the next tool call
7Sageer Sep 19, 2026
d0d5e1d
Merge branch 'feat/docs-environment-switch-takes-effect-on'
7Sageer Sep 19, 2026
4715162
feat: split pending environment status from disconnected
7Sageer Sep 19, 2026
9d178f4
Merge branch 'feat/environment-status-split-pending-no-conn'
7Sageer Sep 19, 2026
deb894b
fix: update the footer environment slot after conversation undo
7Sageer Sep 19, 2026
7808420
docs: remove user confirmation note for environment connection and sw…
7Sageer Sep 19, 2026
4c26900
Merge branch 'feat/fix-real-undo-path-does-not-observably-r'
7Sageer Sep 19, 2026
5508cf3
Merge remote-tracking branch 'origin/feat/remote-runtime'
7Sageer Sep 19, 2026
6ee079a
fix(remote-exec): guard ExecBridge stdin EPIPE and resolve docker til…
7Sageer Sep 19, 2026
b427b02
Merge branch 'feat/fix-execbridge-stdin-epipe-crash-guard-d'
7Sageer Sep 19, 2026
1263745
feat(mcp): start stdio servers in remote environments with env overla…
7Sageer Sep 19, 2026
140256c
fix: make persisted environment binding resolution branch-aware via a…
7Sageer Sep 19, 2026
b4118b9
Merge branch 'feat/stdio-mcp-in-remote-environments-connect'
7Sageer Sep 19, 2026
09d1fa8
fix: align persisted binding journal projection with replay line numb…
7Sageer Sep 19, 2026
66b0958
Merge branch 'feat/fix-branch-aware-shared-environment-bind'
7Sageer Sep 19, 2026
397a432
feat(tui): background-connect --environment at startup and fail fast …
7Sageer Sep 19, 2026
1a60aa2
fix(agent-core-v2,remote-exec): stop leaking the host cwd into remote…
7Sageer Sep 19, 2026
71dd653
test(agent-core-v2): cover agent-scope workspace resolution and refre…
7Sageer Sep 19, 2026
ea30394
fix(tui): stop the event loop when startup fails after the trust prompt
7Sageer Sep 19, 2026
47dcf04
Merge branch 'feat/tui-environment-background-connect-start'
7Sageer Sep 19, 2026
212b986
fix: evict stale environment reminders from the model context on undo
7Sageer Sep 19, 2026
fbd5359
Merge branch 'feat/engine-system-prompt-cwd-leak-fix-honest'
7Sageer Sep 19, 2026
93e6147
Merge branch 'feat/fix-environment-binding-project-context'
7Sageer Sep 19, 2026
5f9e622
feat(agent-core-v2): fail change_environment fast while foreign tool …
7Sageer Sep 19, 2026
fb44413
Merge branch 'feat/change-environment-fails-fast-on-foreign'
7Sageer Sep 19, 2026
aa3876f
fix(agent-core-v2): harden non-local binding cwd fallback and explici…
7Sageer Sep 19, 2026
6ef9334
Merge branch 'feat/hardening-non-local-binding-cwd-never-fa'
7Sageer Sep 19, 2026
eff38ec
fix: await declaration reconciliation after workspace trust
7Sageer Sep 19, 2026
b703594
feat(agent-core-v2): reject environment switches in plan mode, dedupe…
7Sageer Sep 19, 2026
afacaae
Merge branch 'feat/fix-await-declaration-reconciliation-aft'
7Sageer Sep 19, 2026
014b6f7
Merge branch 'feat/dedup-f11-reject-environment-switches-in'
7Sageer Sep 19, 2026
c511828
refactor(agent-core-v2): harden host cwd contract, program fake deps,…
7Sageer Sep 19, 2026
9a06e8f
Merge branch 'feat/hardening-f12-f14-hostenvironmentinfo-cw'
7Sageer Sep 19, 2026
11df61f
fix: post-M90 CI regressions — watch-flag test opt-ins and ACP switch…
7Sageer Sep 19, 2026
8d3975d
Merge branch 'feat/fix-post-m90-ci-regressions-watch-flag-t'
7Sageer Sep 19, 2026
1190379
fix(kap-server): map environment route errors to declared codes and c…
7Sageer Sep 19, 2026
1003149
Merge branch 'feat/kap-server-environment-route-error-codes'
7Sageer Sep 19, 2026
aed2da7
fix(cli): load node-pty from SEA native assets to restore remote term…
7Sageer Sep 19, 2026
3b0a876
Merge branch 'feat/sea-executor-node-pty-loading-for-remote'
7Sageer Sep 19, 2026
8278fb1
chore: add changeset for standalone local terminal fix
7Sageer Sep 19, 2026
1f371bd
fix(agent-core-v2): degrade resume when the bound remote environment …
7Sageer Sep 19, 2026
b390879
feat(node-sdk): validate the local workDir before registering a works…
7Sageer Sep 19, 2026
2af57a7
docs: align remote environment resume and reconnect semantics
7Sageer Sep 19, 2026
2500f40
Merge branch 'feat/resume-degradation-for-unreachable-remot'
7Sageer Sep 19, 2026
acb1362
feat(remote-exec): replace executor auto-install with detection and i…
7Sageer Sep 19, 2026
51ee938
feat(remote-exec): add a pinned-hash verify step to the executor guid…
7Sageer Sep 19, 2026
ae31fce
Merge branch 'feat/replace-executor-auto-install-with-detec'
7Sageer Sep 19, 2026
8191774
fix(agent-core-v2): keep environment-bound tools callable across on-d…
7Sageer Sep 19, 2026
44aef23
chore: add changeset for environment tool reconnect fix
7Sageer Sep 19, 2026
58cd317
Merge branch 'feat/fix-c1-tool-unregistration-on-pending-c2'
7Sageer Sep 19, 2026
77bc6ec
feat(remote-exec): share executor connections across workspaces via a…
7Sageer Sep 19, 2026
8e6a8e9
chore: add changesets for the remote connection pool and half-open de…
7Sageer Sep 19, 2026
f986efc
Merge branch 'feat/remote-connection-pool-core-fingerprint'
7Sageer Sep 19, 2026
e66eebb
feat(remote-exec): coordinate reconnects pool-wide and vote on idle r…
7Sageer Sep 19, 2026
3692c82
fix(agent-core-v2): root remote stdio MCP cwd in the target environment
7Sageer Sep 19, 2026
d91551f
Merge branch 'feat/root-remote-mcp-stdiocwd-in-the-target-e'
7Sageer Sep 20, 2026
87b79a1
fix(remote-exec): re-validate the holder set after the reap vote
7Sageer Sep 20, 2026
54d20e5
Merge branch 'feat/pool-level-coordinated-reconnect-broadca'
7Sageer Sep 20, 2026
c4bf455
fix: chunk large remote readBytes and dispose tracked handles on term…
7Sageer Sep 20, 2026
260f01e
Merge branch 'feat/codex-n3-chunked-readbytes-n4-terminal-t'
7Sageer Sep 20, 2026
ce30f3c
test(agent-core-v2): give the mcpManagement probe fixture a valid hos…
7Sageer Sep 20, 2026
9512f20
fix(nix): add python3 to the kimi-code build inputs for node-gyp
7Sageer Sep 20, 2026
3563e4b
Merge branch 'feat/fix-ci-red-nix-python3-for-node-gyp-mcpm'
7Sageer Sep 20, 2026
446dada
fix(nix): point node-gyp at the store Node headers for the offline sa…
7Sageer Sep 20, 2026
279b2ff
Merge branch 'feat/nix-node-gyp-offline-headers-via-npm-con'
7Sageer Sep 20, 2026
ee80f41
fix(agent-core-v2): resolve workspace paths with the bound environmen…
7Sageer Sep 20, 2026
5dd5928
Merge branch 'feat/codex-r1-environment-path-resolution-win'
7Sageer Sep 20, 2026
5e4af4c
fix: environment path semantics for file history and bounded remote r…
7Sageer Sep 20, 2026
ab87dba
Merge branch 'feat/remote-leftovers-filehistory-env-path-ma'
7Sageer Sep 20, 2026
3147a1c
fix(agent-core-v2): serialize env switches, guard generation replacem…
7Sageer Sep 20, 2026
5b0dc25
Merge branch 'feat/correctness-serialize-env-switches-gener'
7Sageer Sep 20, 2026
2f7bd16
fix: tighten remote environment security boundaries
7Sageer Sep 20, 2026
f80ad67
chore: add changesets for launcher validation, frame guard, and confi…
7Sageer Sep 20, 2026
dfa62eb
Merge branch 'feat/security-boundary-command-launcher-env-s'
7Sageer Sep 20, 2026
fc81ddf
fix: environment binding correctness across REST, approvals, acp, and…
7Sageer Sep 20, 2026
4063f75
fix: reclaim remotely staged attachments on pre-enqueue prompt failures
7Sageer Sep 20, 2026
5b30e46
Merge branch 'feat/contract-tui-attachment-staging-cleanup'
7Sageer Sep 20, 2026
3cc4f9d
chore: add changeset for acp --environment rejection
7Sageer Sep 20, 2026
74d77f6
fix(remote-exec): bound output backpressure, cancel timed-out starts,…
7Sageer Sep 20, 2026
8593e16
Merge branch 'feat/robustness-backpressure-start-timeout-ca'
7Sageer Sep 20, 2026
fc88fef
refactor(remote-exec): drop idle connection reaping
7Sageer Sep 21, 2026
12523b6
fix(kimi-code): keep remote connection startup responsive
7Sageer Sep 21, 2026
1afea46
refactor: prune dead code from remote environments
7Sageer Sep 21, 2026
52a693e
fix(remote-exec): give the terminal connection-drop test its own conn…
7Sageer Sep 21, 2026
e04941c
fix(remote-exec): realpath the defaultCwd expectation for the macOS /…
7Sageer Sep 21, 2026
807fe58
fix(scripts): resolve node-pty from remote-exec after packages/servic…
7Sageer Sep 21, 2026
80e5acb
feat(agent-core-v2): default agent environment tools to off
7Sageer Sep 21, 2026
738aed9
fix(remote-exec): drop unused shQuote import
7Sageer Sep 21, 2026
c50e726
fix(agent-core-v2): wire session controllers to the local host filesy…
7Sageer Sep 21, 2026
7402613
fix(remote-exec): keep streaming descendant output after retention ev…
7Sageer Sep 21, 2026
6e086a5
refactor(remote-exec, agent-core-v2): prune speculative machinery fro…
7Sageer Sep 21, 2026
1fbed5e
refactor: simplify remote environment ownership and execution
7Sageer Sep 21, 2026
3817ea5
test(remote-exec): require native pty for terminal resize regression
7Sageer Sep 21, 2026
2483a9e
test: trim duplicated remote-environment test coverage
7Sageer Sep 21, 2026
614a7a0
fix(remote-exec): preserve complete directory listing semantics
7Sageer Sep 21, 2026
2b05981
refactor(cli): share SDK host lifecycle in print mode
7Sageer Sep 21, 2026
3425ef6
refactor(remote-exec, agent-core-v2): simplify remote environments
7Sageer Sep 21, 2026
82f8338
refactor: reconnect remote environments without replacing identity
7Sageer Sep 21, 2026
967e61b
chore: consolidate changesets into one
7Sageer Sep 21, 2026
8849b0d
chore: restore changesets owned by main
7Sageer Sep 22, 2026
d868376
fix(remote-exec): forward captured fs to the current connection after…
7Sageer Sep 22, 2026
1dddaad
fix(remote-exec): allow empty process arguments after argv[0]
7Sageer Sep 22, 2026
e27681d
fix(remote-exec): expire historical process groups
7Sageer Sep 22, 2026
26f0d8a
refactor: fold remote-exec into agent-core-v2 as src/remote
7Sageer Sep 22, 2026
4e9795b
refactor(agent-core-v2): fix human-kernel import boundary violations
7Sageer Sep 22, 2026
8a2afc4
fix(agent-core-v2,cli): open resumed remote sessions without waiting …
7Sageer Sep 22, 2026
2eac610
feat(cli): animate busy spinners in environment and resume dialogs
7Sageer Sep 22, 2026
7c27ca6
Merge branch 'main' into feat/remote-runtime
7Sageer Sep 22, 2026
41d67c3
fix(agent-core-v2): keep settled-result field name as reason under ox…
7Sageer Sep 22, 2026
c5e9cd9
test(agent-core-v2): regenerate tool-list snapshots for default-off e…
7Sageer Sep 22, 2026
e609d35
Merge branch 'main' into feat/remote-runtime
7Sageer Sep 23, 2026
d13d035
fix(remote): keep exec-server to filesystem and piped processes
7Sageer Sep 23, 2026
8a64cca
chore: restore the node-pty permission script path
7Sageer Sep 23, 2026
6e3ee9c
refactor: prune speculative layers and dead code from remote environm…
7Sageer Sep 23, 2026
3fb7512
Merge remote-tracking branch 'origin/feat/remote-runtime' into kiss/p…
7Sageer Sep 23, 2026
3ae1b8d
Merge remote-tracking branch 'origin/feat/remote-runtime' into kiss/p…
7Sageer Sep 23, 2026
78e888c
chore: match the node-pty permission script to main
7Sageer Sep 23, 2026
662f242
fix(tui): keep the current environment when /new starts a session
7Sageer Sep 23, 2026
1f4f43a
refactor(remote-exec): share one connection per environment id
7Sageer Sep 23, 2026
4b08d40
Merge remote-tracking branch 'origin/main' into feat/remote-runtime
7Sageer Sep 23, 2026
6980d5a
test(tui): type the createSession mock so call args are inspectable
7Sageer Sep 23, 2026
ec80df0
Merge remote-tracking branch 'origin/feat/remote-runtime' into feat/r…
7Sageer Sep 23, 2026
90b719a
test(cli): align session mocks and exec-server handshake with current…
7Sageer Sep 23, 2026
ebbd575
fix(tui): drop the remote environment disconnect transcript notice
7Sageer Sep 23, 2026
7eb9c22
fix(tui): show connecting feedback while /new waits on a remote envir…
7Sageer Sep 23, 2026
8474b86
Merge remote-tracking branch 'origin/main' into feat/remote-runtime
7Sageer Sep 23, 2026
d52ae77
fix: reduce remote session creation delays
7Sageer Sep 23, 2026
02ed96d
refactor: manage execution environments at app scope
7Sageer Sep 23, 2026
5b9c15e
fix: align print and wire views with app environments
7Sageer Sep 23, 2026
e61cdd0
fix: avoid repeated remote skill scans
7Sageer Sep 23, 2026
5981e53
fix(agent-core-v2,cli): wait for the environment connect when resumin…
7Sageer Sep 24, 2026
de7cb59
chore: drop the remote environments changeset
7Sageer Sep 24, 2026
2180584
feat(agent-core-v2): drop the agent environment tools and subagent en…
7Sageer Sep 28, 2026
5323ef9
feat(agent-core-v2,acp-server): narrow the environment binding servic…
7Sageer Sep 28, 2026
77db69e
feat(kap-server): drop the environment switch, reconnect, and declare…
7Sageer Sep 28, 2026
9fcd7df
feat(node-sdk,klient): drop the environment switch, declare, and sugg…
7Sageer Sep 28, 2026
69bbbcf
feat(kimi-code): drop the /environment manager and remote mention com…
7Sageer Sep 28, 2026
b4d2473
fix(agent-core-v2): repair the subagent spawn and swarm test after th…
7Sageer Sep 28, 2026
6b239db
test(agent-core-v2,kap-server): regenerate manifests and rebind envir…
7Sageer Sep 28, 2026
71376da
docs(node-sdk): drop removed environment switch methods from the clie…
7Sageer Sep 28, 2026
81ae8ed
Merge branch 'main' into feat/remote-env-phase1
7Sageer Sep 28, 2026
29f39f8
Merge branch 'main' into feat/remote-env-phase1
7Sageer Sep 28, 2026
7000467
refactor: prune dead environment code and simplify remote protocol
7Sageer Sep 29, 2026
3ec7e2e
refactor: simplify remote environment phase one
7Sageer Sep 29, 2026
a5d9755
refactor: prune unused environment surface and deduplicate helpers
7Sageer Sep 29, 2026
e5cd657
fix: accept runtime_id as a deprecated alias for environment targeting
7Sageer Sep 29, 2026
795276b
fix: validate local workspace roots and await provider attach before …
7Sageer Sep 29, 2026
f62ca41
refactor: persist environment binding in session meta
7Sageer Sep 29, 2026
b072693
Merge branch 'main' into feat/remote-env-phase1
7Sageer Sep 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions .changeset/disconnect-notice-no-manual-reconnect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@moonshot-ai/kimi-code": patch
---

Stop showing a transcript notice when a remote environment disconnects.
5 changes: 5 additions & 0 deletions .changeset/new-inherits-environment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@moonshot-ai/kimi-code": patch
---

Keep the current environment and working directory when `/new` starts a session.
5 changes: 5 additions & 0 deletions .changeset/remote-environment-share-by-id.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@moonshot-ai/kimi-code": patch
---

The same environment id shares one connection across workspaces. Reconnecting that id is process-wide; a different id stays up.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ node_modules/
dist/
dist-single/
dist-native/
dist-executor/
.tmp-api-extractor/
.contract-types-tmp/
.local/
Expand Down
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ This is a TypeScript monorepo built for agent-assisted development. Keep the roo
- `packages/transcript`: the isomorphic transcript rendering data layer — L1 agent-granular store, L2 idempotent operations, L3 `off/turn/block/delta` subscription granularity, L4 framework-free view registry, plus turn-cursor pagination. Pure TypeScript (browser-safe, no engine imports); the sole owner of the transcript contract types (`src/contract/`) and the op-batch sequencing contract.
- `packages/kap-server`: the Kimi Code server, backed by `@moonshot-ai/agent-core-v2`; exposes sessions over REST + WebSocket (`/api/v1` + `/api/v1/ws`), plus the `/api/v1/debug/*` reflection RPC surface (`--debug-endpoints`, loopback bind + bearer auth).
- `packages/remote-control`: the Kimi Remote Control tunnel client — registers this machine with the relay and forwards HTTP/WebSocket traffic to the local server, with a machine-wide single-instance lock; consumed by kap-server (the `/api/v1/remote-control` toggle) and by the CLI (`kimi web --remote-control`).
- `packages/agent-core-v2/src/remote`: the remote execution stack inside the engine — self-contained NDJSON line-framed RPC (codex exec-server dialect) between the local `ExecBridge` (ssh/docker/`command` launchers) and the light `kimi exec-server` executor, plus the fs/process RPC stubs behind the `Environment` interface; exported as `@moonshot-ai/agent-core-v2/remote` and `/remote/server`. The executor stays light — `src/remote/server` may import only node builtins, relative modules, `#/remote/protocol`, `#/os/interface` and `#/_base/execEnv` (enforced by the package's `lint:imports`); the CLI's only engine import is the dynamic `/remote/server` load in `src/cli/exec-server.ts`.
- `packages/klient`: the client SDK — a contract-driven facade over agent-core-v2 (`global.*` / `session(id).*` / `agent(id).*`, zod-validated); transport via subpath entry (`@moonshot-ai/klient/ipc|memory`, both return the same `Klient`); also hosts the e2e suites. See `packages/klient/AGENTS.md`.
- `packages/tree-sitter-bash`: a pure-TypeScript bash parser (no runtime deps, no wasm); `parse(source, { timeoutMs, maxNodes })` runs under a deterministic budget and returns a discriminated `ParseResult` — callers must treat aborted/hasError trees as "cannot analyze" and degrade. Parser only, no safety judgments; see the package README's "Known differences" section.
- `packages/minidb`: the embedded JSON document store (`MiniDb`) behind kap-server's search index — snapshot + WAL persistence with an exclusive write lock, a larger-than-RAM full-text layer, and persistent index generations. See `packages/minidb/AGENTS.md`.
Expand Down
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ Every PR opens with the [PR template](.github/pull_request_template.md). PR titl
- Auto-formatting via `pnpm lint:fix`.
- Follow existing local patterns when the lint rules do not cover a style choice.

## Engine Invariants

- Two filesystems exist side by side and must not be conflated. Anything workspace-related (project files, project config such as `AGENTS.md` and `.kimi-code/`, skill and instruction discovery, file the model can be told to read) always goes through the session's `environment.fs` — acquire it from the calling agent's environment lease, never from a node-local backend. The App-level `IHostFileSystem` is reserved for server-local data only: session storage, the search index, and the blob store.
- The same split applies to processes: workspace commands run through the environment's process service; App-level process backends are for host-local jobs (hooks, local MCP servers, server maintenance).

## Reporting Security Issues

Found a security issue? Please see [SECURITY.md](SECURITY.md) instead of opening a public issue.
Expand Down
2 changes: 1 addition & 1 deletion apps/kimi-code/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Main directories:
- `reverse-rpc` converts SDK approval/question requests into the data shape a UI panel/dialog needs, and converts the user's choice back into an SDK response.
- `theme` is the single source of truth for colors and styles. Components must not bypass the theme system and use chalk named colors directly.
- `utils` holds utility functions with no UI-state dependency. Logic that needs `TUIState` or a component instance must not live under app-level `src/utils`.
- `apps/kimi-code` may only use core capabilities through `@moonshot-ai/kimi-code-sdk`. Do not import engine packages directly in app code.
- `apps/kimi-code` may only use core capabilities through `@moonshot-ai/kimi-code-sdk`. Do not import engine packages directly in app code. Sole exception: the `exec-server` light entry dynamically imports `@moonshot-ai/agent-core-v2/remote/server` (see `src/cli/exec-server.ts`).

## TUI Coding Conventions

Expand Down
92 changes: 92 additions & 0 deletions apps/kimi-code/scripts/native/smoke.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,96 @@ async function ensureExecutableExists() {
}
}

// `kimi exec-server --listen stdio` is the remote-executor light entry: the
// SEA binary must answer the NDJSON handshake with the package version and a
// posix environment, keep stdout protocol-only, and exit 0 on stdin EOF.
async function runExecServerSmoke() {
const { spawn } = await import('node:child_process');
const startedAt = performance.now();
const child = spawn(executablePath, ['exec-server', '--listen', 'stdio'], {
cwd: appRoot,
stdio: ['pipe', 'pipe', 'pipe'],
});
let stderr = '';
child.stderr.setEncoding('utf-8');
child.stderr.on('data', (chunk) => {
stderr += chunk;
});

const pending = [];
const waiters = [];
let buffer = '';
child.stdout.setEncoding('utf-8');
child.stdout.on('data', (chunk) => {
buffer += chunk;
let index = buffer.indexOf('\n');
while (index >= 0) {
const line = buffer.slice(0, index).trim();
buffer = buffer.slice(index + 1);
if (line.length > 0) {
const parsed = JSON.parse(line);
const waiter = waiters.shift();
if (waiter !== undefined) waiter(parsed);
else pending.push(parsed);
}
index = buffer.indexOf('\n');
}
});

const nextFrame = () =>
new Promise((resolveFrame, rejectFrame) => {
const queued = pending.shift();
if (queued !== undefined) {
resolveFrame(queued);
return;
}
const timer = setTimeout(() => {
rejectFrame(new Error(`timed out waiting for a protocol frame; stderr so far:\n${stderr}`));
}, 30_000);
waiters.push((frame) => {
clearTimeout(timer);
resolveFrame(frame);
});
});

const send = (message) => child.stdin.write(`${JSON.stringify(message)}\n`);

try {
send({ method: 'initialize', id: 1, params: { clientName: 'native-smoke', clientVersion: expectedVersion } });
const initialize = await nextFrame();
const handshakeMs = performance.now() - startedAt;
const result = initialize.result ?? {};
if (initialize.id !== 1 || result.executorVersion !== expectedVersion) {
fail(`exec-server handshake mismatch: expected executorVersion ${expectedVersion}, got ${JSON.stringify(initialize)}`);
}
if (result.environment?.osKind === undefined || result.environment.osKind === 'windows') {
fail(`exec-server reported a non-posix environment: ${JSON.stringify(result.environment)}`);
}
send({ method: 'fs/getMetadata', id: 2, params: { path: '/' } });
const metadata = await nextFrame();
if (metadata.id !== 2 || metadata.result?.isDirectory !== true) {
fail(`exec-server fs/getMetadata mismatch: ${JSON.stringify(metadata)}`);
}
child.stdin.end();
const exitCode = await new Promise((resolveExit) => {
const timer = setTimeout(() => {
child.kill('SIGKILL');
resolveExit(null);
}, 30_000);
child.on('close', (code) => {
clearTimeout(timer);
resolveExit(code);
});
});
if (exitCode !== 0) {
fail(`exec-server did not exit 0 on stdin EOF (exit=${exitCode}).\n${stderr}`);
}
console.log(`exec-server smoke passed (handshake in ${handshakeMs.toFixed(0)}ms)`);
} finally {
child.kill('SIGKILL');
}
}

async function runKimi(args) {
try {
const { stdout, stderr } = await execFileAsync(executablePath, args, {
Expand Down Expand Up @@ -111,4 +201,6 @@ try {
await rm(smokeHome, { recursive: true, force: true });
}

await runExecServerSmoke();

console.log(`Native smoke passed: ${executablePath}`);
2 changes: 1 addition & 1 deletion apps/kimi-code/scripts/smoke.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async function ensureRuntimeAssetsExist() {
try {
await stat(webIndexPath);
} catch {
fail(`Runtime asset not found at ${webIndexPath}. Run \`pnpm build\` first.`);
fail(`Environment asset not found at ${webIndexPath}. Run \`pnpm build\` first.`);
}
}

Expand Down
25 changes: 25 additions & 0 deletions apps/kimi-code/src/cli/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { CLI_COMMAND_NAME } from '#/constant/app';
import { registerMigrateCommand, type MigrateCommandOptions } from '#/migration/index';
import { Command, InvalidArgumentError, Option } from 'commander';

import { EXEC_SERVER_COMMAND } from './exec-server';
import type { CLIOptions } from './options';
import { registerAcpCommand } from './sub/acp';
import { registerDoctorCommand } from './sub/doctor';
Expand All @@ -19,6 +20,7 @@ export type MigrateCommandHandler = (options: MigrateCommandOptions) => void;
export type PluginNodeRunnerHandler = (entry: string, args: readonly string[]) => void;
export type UpgradeCommandHandler = (yes: boolean) => void | Promise<void>;
export type UpdateDownloadHandler = (version: string, manual: boolean) => void;
export type ExecServerCommandHandler = (listen: string) => void;

export function createProgram(
version: string,
Expand All @@ -27,6 +29,7 @@ export function createProgram(
onPluginNodeRunner: PluginNodeRunnerHandler = () => {},
onUpgrade: UpgradeCommandHandler = () => {},
onUpdateDownload: UpdateDownloadHandler = () => {},
onExecServer: ExecServerCommandHandler = () => {},
): Command {
const program = new Command(CLI_COMMAND_NAME)
.description('The Starting Point for Next-Gen Agents')
Expand Down Expand Up @@ -117,6 +120,12 @@ export function createProgram(
)
.addOption(new Option('--yes').hideHelp().default(false))
.addOption(new Option('--auto-approve').hideHelp().default(false))
.addOption(
// The [environments] config layer resolves and validates the id (unknown
// id / missing defaultCwd → startup error). Hidden from help output.
new Option('--environment <id>', 'Bind the new session to the configured environment <id>.')
.hideHelp(),
)
.option('--plan', 'Start in plan mode.', false);

registerExportCommand(program);
Expand Down Expand Up @@ -159,6 +168,21 @@ export function createProgram(
onUpdateDownload(targetVersion, options.manual === true);
});

// Remote-executor entry (remote-environment spec §6). The exact argv shapes
// `exec-server` and `exec-server --listen stdio` are pre-dispatched in
// `src/main.ts` before this program is even loaded; this hidden command owns
// every other spelling (`--listen=stdio`, unsupported transports, excess
// args) so they still route to the executor or fail with a clean stderr
// error. `--listen` defaults to stdio, the only supported transport, so a
// bare invocation reaching this program agrees with the light path.
program
.command(EXEC_SERVER_COMMAND, { hidden: true })
.option('--listen <transport>', 'Transport to listen on. Only "stdio" is supported.', 'stdio')
.allowExcessArguments(false)
.action((options: { listen: string }) => {
onExecServer(options.listen);
});

program.argument('[args...]').action((args: string[]) => {
if (args.length > 0) {
program.error(`unknown command '${args[0]}'. See '${CLI_COMMAND_NAME} --help'.`);
Expand All @@ -184,6 +208,7 @@ export function createProgram(
agent: raw['agent'] as string | undefined,
agentFiles: raw['agentFile'] as string[],
addDirs: raw['addDir'] as string[],
environment: raw['environment'] as string | undefined,
};

onMain(opts);
Expand Down
88 changes: 88 additions & 0 deletions apps/kimi-code/src/cli/exec-server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/**
* `kimi exec-server` (equivalently `--listen stdio`) — the remote-executor
* light entry.
*
* This module is the argv pre-dispatch target of `src/main.ts` and must stay
* light: only node builtins plus `./build-info` / `./host-package`. The SDK
* mega-module (`@moonshot-ai/kimi-code-sdk`) would pull in full registration
* (config/OAuth/telemetry/session services) at import time, so the executor
* reaches its implementation exclusively through a dynamic import of
* `@moonshot-ai/agent-core-v2/remote/server` — the single engine subpath the
* CLI may touch, sanctioned as the exception to the "CLI consumes core
* capabilities only via the SDK" rule (remote-environment spec §6/§10). That
* subpath is import-graph-isolated from the engine root (enforced by
* agent-core-v2's check-import-boundaries), so the light-entry property
* holds. `test/cli/exec-server.test.ts` guards this import graph.
*
* Wire discipline: stdout carries protocol frames only; every diagnostic
* (usage errors, startup failures, executor logs) goes to stderr.
*/

import { readFileSync } from 'node:fs';

import { KIMI_BUILD_INFO } from './build-info';
import { getHostPackageJsonPath } from './host-package';

export const EXEC_SERVER_COMMAND = 'exec-server';

const EXEC_SERVER_ARGV_SHAPES: readonly (readonly string[])[] = [
[EXEC_SERVER_COMMAND],
[EXEC_SERVER_COMMAND, '--listen', 'stdio'],
];

/**
* Exact-shape match for the light path: the bare command or the explicit
* `--listen stdio` spelling (stdio is the only transport, so the flag is
* ceremony kept for compatibility). Node/tsx invoke as
* `[exec, script, ...args]`, the SEA binary as `[exec, exec, ...args]` (or
* `[exec, ...args]`), so each shape is accepted at either offset. Anything
* else named `exec-server` falls through to the full CLI, where the hidden
* Commander subcommand in `cli/commands.ts` owns validation and errors.
*/
export function isExecServerArgv(argv: readonly string[]): boolean {
return hasExecServerShape(argv.slice(1)) || hasExecServerShape(argv.slice(2));
}

function hasExecServerShape(args: readonly string[]): boolean {
return EXEC_SERVER_ARGV_SHAPES.some(
(shape) => shape.length === args.length && shape.every((arg, index) => arg === args[index]),
);
}

/**
* Executor version reported in the handshake (`executorVersion`): the host
* CLI package version, so the client's `MIN_EXECUTOR_VERSION` gate and the
* install/update guidance (spec D9) compare against the same version the
* binary ships as. Build-info wins when injected (SEA/native bundles);
* otherwise read the nearest package.json (npm dist, tsx dev).
*/
export function resolveExecutorVersion(): string {
if (KIMI_BUILD_INFO.version !== undefined) {
return KIMI_BUILD_INFO.version;
}
const pkg = JSON.parse(readFileSync(getHostPackageJsonPath(), 'utf-8')) as {
version: string;
};
return pkg.version;
}

/**
* Validate the transport and run the executor until the stdio connection
* closes. Returns the process exit code: 0 on clean shutdown, 1 on startup
* failure, 2 on an unsupported `--listen` transport.
*/
export async function runExecServerCommand(listen: string): Promise<number> {
if (listen !== 'stdio') {
process.stderr.write(`error: exec-server supports only "--listen stdio" (got "--listen ${listen}")\n`);
return 2;
}
try {
const { runExecServer } = await import('@moonshot-ai/agent-core-v2/remote/server');
return await runExecServer({ version: resolveExecutorVersion() });
} catch (error) {
process.stderr.write(
`error: exec-server failed to start: ${error instanceof Error ? error.message : String(error)}\n`,
);
return 1;
}
}
34 changes: 34 additions & 0 deletions apps/kimi-code/src/cli/host-package.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* Locate the host CLI's own package.json.
*
* Kept free of workspace imports so the exec-server light entry
* (`cli/exec-server.ts`) can resolve the package version without pulling in
* the SDK module graph.
*/

import { existsSync } from 'node:fs';
import { dirname, resolve } from 'node:path';

const MODULE_DIR = import.meta.dirname;

export function getHostPackageJsonPath(): string {
// Walk upwards from this file's directory until a `package.json` shows up,
// so both dev (`tsx src/main.ts` — this file in `src/cli/`, pkg 2 levels
// up) and prod (`node dist/main.mjs` — this code bundled into `dist/`,
// pkg 1 level up) resolve correctly.
let dir = MODULE_DIR;
for (let i = 0; i < 6; i += 1) {
const candidate = resolve(dir, 'package.json');
if (existsSync(candidate)) {
return candidate;
}
const parent = dirname(dir);
if (parent === dir) break;
dir = parent;
}
throw new Error(`Could not locate package.json near ${MODULE_DIR}`);
}

export function getHostPackageRoot(): string {
return dirname(getHostPackageJsonPath());
}
Loading
Loading