Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
75c7ec9
vendor: rebranded upstream 15cc4ab2 (v0.17.1, core fork point)
elkaix Aug 18, 2026
f12110e
vendor: rebranded upstream 541ddd2d8^ (last kimi-web source)
elkaix Aug 18, 2026
3be197b
chore: seed upstream vendor ancestry (equivalent of merge -s ours of …
elkaix Aug 18, 2026
55ffae4
vendor: rebranded upstream 3ded08084 (2026-08-18 HEAD)
elkaix Aug 18, 2026
0303432
chore: merge rebranded upstream f12110e95 (kimi-code @ 541ddd2d8^, 20…
elkaix Aug 18, 2026
9ef5579
chore: merge rebranded upstream 55ffae4cd (kimi-code @ 3ded08084, 202…
elkaix Aug 18, 2026
18a4ab7
chore: restore apps/vis as workspace member
elkaix Aug 18, 2026
b000fac
chore: restore vendor files dropped by silent delete/modify merges
elkaix Aug 18, 2026
4ee49f5
chore: make adopted packages exactly match the vendor snapshot
elkaix Aug 18, 2026
fe79f5f
fix: satisfy BlobPart under @types/node 26 in pythinker-files providers
elkaix Aug 18, 2026
251fce5
fix: node-26 type compatibility for adopted upstream code
elkaix Aug 18, 2026
e49795a
chore: stabilize the sync tree after the vendor merges
elkaix Aug 18, 2026
12a1199
refactor: converge apps/dashboard into apps/vis
elkaix Aug 18, 2026
69d5185
fix: re-port the web feature surface onto the adopted internals
elkaix Aug 18, 2026
b174289
test(web): restore the jsdom test environment and test devDependencies
elkaix Aug 18, 2026
2bc246d
test(web): reconcile the web test suite with the adopted upstream tree
elkaix Aug 18, 2026
3e37722
chore: repair the lint gate on the sync branch
elkaix Aug 18, 2026
9e2d40b
chore: refresh the flake pnpmDeps hash for the re-pinned lockfile
elkaix Aug 18, 2026
078de4c
fix(build): stage web assets from source instead of a committed bundle
elkaix Aug 18, 2026
adb1fd1
test: repair the full-suite gate on the sync branch
elkaix Aug 18, 2026
50a2b9a
feat: strip the managed account service (D5)
elkaix Aug 18, 2026
553a6bc
feat(oauth): restore OpenAI Codex login
elkaix Aug 18, 2026
80febde
feat(auth): wire OpenAI Codex login
elkaix Aug 18, 2026
acaf5f1
fix(vscode): reconcile adopted SDK contracts
elkaix Aug 18, 2026
020bff6
fix(web): restore Pythinker loading brand
elkaix Aug 18, 2026
36caa23
feat(agent-core): restore session advisor
elkaix Aug 18, 2026
e3f227b
fix(tui): preserve and collapse thinking effort
elkaix Aug 18, 2026
725658d
feat(tui): tint tool cards by state
elkaix Aug 18, 2026
9802a12
chore(e2e): retire redundant server package
elkaix Aug 18, 2026
80a6654
test(agent-core): align identity header assertions
elkaix Aug 18, 2026
7818325
feat(web): reconcile adopted app shell
elkaix Aug 18, 2026
be40362
fix(web): remove Kimi brand residue
elkaix Aug 18, 2026
f2d1c7d
fix(release): repair adopted changeset package
elkaix Aug 18, 2026
db83b41
fix(release): repair adopted changeset package
elkaix Aug 18, 2026
dc1c191
chore: repair the lint gate on the sync branch
elkaix Aug 18, 2026
c2ea6e8
chore: refresh the flake pnpmDeps hash for the re-pinned lockfile
elkaix Aug 18, 2026
562a3b2
fix(build): stage web assets from source instead of a committed bundle
elkaix Aug 18, 2026
363a215
chore: satisfy imported spelling checks
elkaix Aug 18, 2026
07d5069
fix(web): use Pythinker robot in sidebar brand
elkaix Aug 18, 2026
3d0e16b
docs: document upstream rebrand workflow
elkaix Aug 18, 2026
358fc13
merge: complete Pythinker upstream port
elkaix Aug 18, 2026
0ffc89a
docs: make upstream residue check self-safe
elkaix Aug 18, 2026
7c02566
merge: update upstream rebrand runbook
elkaix Aug 18, 2026
cfde70c
fix(build): repair upstream build gates
elkaix Aug 18, 2026
c078bbb
chore: keep source text English
elkaix Aug 18, 2026
97b29ee
fix(ui): use braille thinking indicator
elkaix Aug 18, 2026
f3765dd
fix(nix): refresh pnpm dependency hash
elkaix Aug 18, 2026
0d89e96
refactor(cli): remove redundant telemetry assignment
elkaix Aug 18, 2026
2043b23
ci: restore aggregate test check
elkaix Aug 18, 2026
583eed8
test(mcp): wait for confirmed stdio close
elkaix Aug 19, 2026
a931561
fix(web): match reference mode and settings controls
elkaix Aug 19, 2026
1509538
fix(ui): animate braille spinner and add empty-state logo
elkaix Aug 19, 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
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
70 changes: 70 additions & 0 deletions .agents/skills/agent-core-dev/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
name: agent-core-dev
description: Use when developing in packages/agent-core-v2 (the DI × Scope agent engine) — adding or modifying a domain Service, choosing a LifecycleScope, wiring DI dependencies, splitting a domain across scopes, owning or migrating a config section, gating behavior behind an experimental flag, raising coded errors, working on the permission system, writing DI/Scope tests, porting business logic from agent-core (v1) to v2, triaging a main-branch commit against v2, or exposing a v2 domain over server-v2 while keeping the /api/v1 wire contract compatible with released clients. Self-contained guide organized by development stage (orient → design → implement → test → verify) plus align workflows for v1→v2 migration, main-branch commit triage, and server-v2 wire exposure; each file carries the rules, examples, and red lines for its step.
---

# agent-core-dev

> Develop `packages/agent-core-v2` by lifecycle stage. This skill is **self-contained**: every rule, recipe, and red line lives in the stage files below — it does not delegate to `packages/agent-core-v2/docs/`.

`agent-core-v2` is the new agent engine built on the **DI × Scope** architecture (a port of `packages/agent-core`). Everything resolves through the container: a service declares an **identity**, its **dependencies**, and a **lifetime**; the container decides construction, singleton-per-scope, ordering, and disposal. The stage files restate the rules in imperative form so you can work without reading the source docs.

## Lifecycle at a glance

```text
Orient → Design → Implement → Test → Verify
│ │ │ │ │
│ │ │ │ └─ lint:imports · typecheck · test · dep graph · red lines
│ │ │ └─ test.md
│ │ └─ implement.md (+ errors.md · flags.md · permission.md)
│ └─ design.md
└─ orient.md
```

Stages are ordered but not strictly linear: a test failure (stage 4) that reveals a wrong scope sends you back to design (stage 2); a `CyclicDependencyError` sends you to `design.md` §dependency-direction and `implement.md` §cycles.

## Workflows

End-to-end procedures that span the stages. Reach for these before reading the stage files individually.

- [Align (port `agent-core` → `agent-core-v2`)](align.md): split a v1 class into semantic units, fix each unit's domain / scope / Service / dependencies, then migrate the logic and tests. Use when the task is "move feature X from v1 to v2" or "port `IXxxService` to v2".
- [Commit align (triage a `main` commit against v2)](commit-align.md): given one `main` commit hash + a short note, find the v1 logic it changed, check whether v2 already has the corresponding implementation, bucket it (aligned / partial / missing / not-applicable), and recommend a minimal fix. Use in the `pythinker-code-v2`-catching-up-to-`main` phase, for one commit at a time; escalate to [align.md](align.md) if the gap is a whole domain.
- [Server align (expose `agent-core-v2` over `server-v2`)](server-align.md): wire a v2 domain into `packages/kap-server` over `/api/v2` (native) and `/api/v1` (v1-compatible mirror), keep the wire schema byte-compatible with the established v1 contract by sharing the `@pymodel/protocol` schema, and isolate v1-only behavior in a `<domain>Legacy` edge adapter instead of distorting the native v2 Service. Use when the task is "expose the new v2 Service on the server", "add a route to the `/api/v1` surface", or "keep server-v2 wire-compatible with released v1 clients".

## Stages

- [Stage 1 — Orient](orient.md): the DI black box (identity / dependencies / lifetime), the four `LifecycleScope` tiers and visibility, and the no-comment convention. Read before touching business code.
- [Stage 2 — Design a service](design.md): pick a scope, split a domain across scopes, choose a calling style (direct call vs event vs hook), and direct dependencies. Decide *where things live and who knows whom* before coding.
- Topic: [Domain boundaries vs Scope](domain-boundaries.md) — keep `session` / `agent` / `turn` from becoming god objects; data-ownership test and their split conclusions.
- Topic: [Persistence layering](persistence.md) — the three-layer `Store → Storage → backend` model, naming Stores by access pattern, and which layer business code should depend on.
- Topic: [Edge exposure — `resource:action` + WS events](edge-exposure.md) — which Services are exposed over `/api/v2` (per-scope action map) and which events stream over WS; what to wrap in a facade.
- [Stage 3 — Implement](implement.md): the standard Service recipe and the DI building blocks — interface + identity, constructor injection, scoped registration, `Disposable`, eager vs delayed, `invokeFunction`, `createInstance`, child scopes, and the cycle-refactor playbook.
- Topic: [Service authoring](service-authoring.md) — file layout, naming, contract vs impl contents, interface style, constructor/field conventions, events, multi-Service domains, comment rules.
- Topic: [Config](config.md) — the section-registry model, App vs Session split, owning a config section, the TOML format, and the env overlay.
- Topic: [Errors](errors.md) — co-located `XxxError`, the central code registry, wire serialization, boundary translation.
- Topic: [Flags](flags.md) — `registerFlagDefinition`, `IFlagService.enabled(id)`, the `[experimental]` config section, resolution precedence.
- Topic: [Permission](permission.md) — risk-only chain-of-responsibility kernel, harness constraints and product reviews as domain `onBeforeExecuteTool` veto listeners (`veto` / `allow` / `pass` / cold `waitUntil` factories), shared `toolApproval` round-trip, policy registry + composer, `modes`/`agentTypes` metadata, `resolveExecution`/`accesses`.
- Topic: [Telemetry](telemetry.md) — emitting events via `ITelemetryService`, context propagation, and appender destinations (`ConsoleAppender` / `CloudAppender`).
- [Stage 4 — Test](test.md): resolve the system under test by interface, pick `TestInstantiationService` vs `createScopedTestHost`, shared stubs, service groups, teardown.
- [Stage 5 — Verify & submit](verify.md): `lint:imports`, `typecheck`, `test`, and the pre-submit checklist.

## How to use this skill

Jump to the stage you are in and read that one file; each is self-contained and ends with its own red lines. Skim the global red lines below before submitting — they catch most mistakes across every stage. The repo's source of truth remains the code in `packages/agent-core-v2/src/`; this skill codifies the same rules so you do not have to re-derive them.

## Global red lines

Invariants that hold across every stage. Each is expanded in the stage file noted.

1. No `new` on a class whose constructor carries `@IService` deps — inject with `@IX` or `accessor.get(IX)`. (implement.md)
2. `@IX` decorates constructor parameters only; parameter order depends on construction (static-first for `createInstance`, `@IX`-first for scoped services). (service-authoring.md)
3. Both interface and impl carry `_serviceBrand`; the `createDecorator` name is globally unique. (implement.md)
4. Parent scope never depends on child scope — short-lived may inject long-lived, never the reverse. (orient.md)
5. No cyclic dependencies — refactor (extract a third Service / use an event / re-scope); activation timing does not break dependency cycles. (design.md, implement.md)
6. `ServicesAccessor` is valid only during `invokeFunction` — never stash it for async use. (implement.md)
7. Scope follows state identity — no `Map<sessionId, …>` at `App` to fake per-session state. (design.md)
8. Foundational layers never know upstream ones; business code never depends on the edge layer (`gateway`/`rpc`). (design.md)
9. Throw coded errors; register codes centrally; branch on `code` across the wire, never `instanceof`. (errors.md)
10. Gate unreleased behavior behind a flag contributed via `registerFlagDefinition` and resolved through `IFlagService.enabled(id)`; no ad-hoc env toggles. (flags.md)
11. Tests resolve the SUT by interface; shared stubs live under `test/`, never `src/`. (test.md)
12. Config is the preference registry: only preferences that are persistable, schema'd, and user/operator-facing go in `IConfigService`. Domain-specific config (including env-only operational toggles) goes through `registerConfigSection` + `envOverlay`. Facts → `IBootstrapService`, and host invocation arguments (CLI flags, host identity headers, prompt identity) → `BootstrapInput.args` / `IBootstrapService.args` — never new per-domain runtime-options services; domain runtime state (cron/flags/model) never goes onto `IBootstrapService`; session state → Session scope; constants → code. Business domains never call `IBootstrapService.getEnv()` directly. (config.md)
Loading
Loading