kimi-code/packages/agent-core/test/agent
7Sageer 02d77b20d9
feat(agent-core-v2): let plugins contribute system prompt instructions via the manifest systemPrompt field (#2314)
* feat(agent-core-v2): let plugins contribute system prompt instructions via the manifest systemPrompt field

* feat(agent-core-v2): add systemPromptPath to load plugin system prompt from a file

* docs: explain plugin system prompt templates

* fix(agent-core-v2): refresh plugin system prompts after changes

* fix(agent-core-v2): freeze restored profile bindings and converge plugin contributions at session scope

- restore no longer re-renders or re-persists prompts: a resumed agent
  keeps its replayed profile binding (prompt and tool set) as persisted
- a new Session-level convergence point reloads plugin skills into the
  session skill catalog before fanning out to every live agent prompt,
  and every catalog-kind plugin mutation awaits the whole pipeline;
  MCP-only toggles carry a distinct change kind and skip it
- live refreshes after a restart re-resolve the bound profile by name
  and rebind the full slice (prompt, disallowed tools, active tools)
  atomically, warning and keeping the persisted state when the profile
  is gone; renders reuse the first-render timestamp and unchanged
  prompts are not re-persisted, so convergence never churns the wire
- cap plugin system-prompt contributions (32 KB per field/file, 64 KB
  aggregate per prompt build) with manifest diagnostics and warnings
- bump the changeset to minor: this is a new user-facing capability

* fix(agent-core-v2): register the new session domain and dedupe the missing-profile warning

- add sessionPluginContribution to the domain-layer registry so
  lint:domain stays green
- emit system-prompt-refresh-profile-missing once per profile name,
  matching the service's other deduped warnings
- document the convergence timeout escape hatch and the klient
  exclusion of enabledSystemPrompts

* fix(agent-core-v2): dedupe the plugin budget warning and surface section read failures

- emit plugin-sections-oversized once per skipped-plugin signature
- let enabledSystemPrompts failures propagate to the refresh catch
  (keeps the current prompt and warns) instead of silently rendering
  and persisting a prompt without plugin instructions
- cover the convergence timeout cut-off with a fake-timers test
- clarify that the first-render timestamp anchors per process

* fix(agent-core-v2): serialize session convergence and restore onDidReload timing

- run at most one convergence per session and bound each change's wait
  by the timeout, so a fan-out emitter never interleaves deliveries
  after a timed-out convergence
- fire onDidReload as soon as the reload commits again, keeping hook
  reloads independent of prompt convergence
- sign the plugin budget warning with an unambiguous key

* docs(agent-core-v2): align convergence wording with the serialized semantics

- the timeout retry promise only holds once stalled work clears
- note the per-session serial delivery cost model on the plugin change
  contract and the dual-queue invariant on the service

* fix(agent-core-v2): keep empty plugin sections byte-neutral in the prompt template

- place ${plugin_sections} on the same template line as
  ${skills_section} so prompts without either block render exactly as
  before this feature
- note on the change contract that waitUntil work must not call back
  into plugin mutations, and spell out the per-session convergence
  order in the user docs

* fix(agent-core-v2): pin a fork's profile so refresh triggers never rebind it

- applyBindingSnapshot left the fork with no pinned profile, which
  routed in-process forks into the post-restart catalog rebind and
  could reset an inherited tool set; forks now inherit the source
  agent's pinned profile object
- pin the first-render timestamp reuse with a ${now}-embedding test
  and document the anchored ${now} semantics
- tighten the plugin docs budget and resume-refresh wording

* fix(agent-core-v2): join in-flight convergence during agent bootstrap

- an agent created while a plugin convergence is in flight now waits
  for it, and a restored agent refreshes once after it, so a plugin
  mutation never straddles an agent's bootstrap
- warn on a non-string systemPrompt field and strip a UTF-8 BOM from
  systemPromptPath files before trimming
- correct the consumption-surface wording (every CLI surface on the
  experimental flag, not just kimi -p), the per-session queueing note,
  and the single-plugin combined budget clause

* fix(agent-core-v2): bound the bootstrap convergence join by the timeout

A permanently wedged convergence kept convergeTail pending forever,
and the unconditional settled() wait in bindBootstrap would have
blocked every later agent creation in that session; the join now
races the shared convergence timeout and continues (a restored agent
still refreshes once, which never touches the tail), and the timeout
constant moves to the contract for reuse

* fix(agent-core-v2): close the convergence race against in-progress restores

- a convergence fan-out could land while an agent's wire log is still
  replaying, dispatching a replay-visible config record whose effect
  the rest of the replay then overwrites; refreshSystemPrompt now
  skips while the wire restore is in progress
- convergence completion is tracked by a generation counter; bootstrap
  compares it (after a bounded join) and refreshes a restored agent
  exactly once when a round completed after its creation began,
  replacing the wasConverging flag that could miss both windows

* fix(agent-core-v2): bound each convergence so a wedged participant cannot stop the pipeline

- the fan-out now races the convergence timeout, so convergeTail always
  settles: a permanently hung refresh delays its round (blocked entries
  drain oldest-first on later changes) instead of killing the session's
  convergence for good
- warn when agent bootstrap stops waiting on a stalled convergence
- diagnose a blank systemPromptPath and pin the plugin-root escape
  guard with traversal, absolute-path, and symlink tests

* fix(agent-core-v2): bound the skill reload, preserve user-tool overlays, roll the prompt clock daily

- the convergence's skill-reload segment now races the same timeout as
  the fan-out, so no segment of the pipeline can wedge a session for
  good; it continues with the previous catalog and retries next change
- a cold rebind that resets the tool set replays session-added user
  tools onto the new base instead of dropping them for the rest of the
  process
- the rendered timestamp re-anchors when the UTC date rolls over, so
  long-lived processes keep a fresh clock while steady-state renders
  stay byte-stable within a day
- the plugin budget warning dedupes per plugin id, and the docs note
  that systemPromptPath content is frozen until the next reload

* feat(agent-core-v2): converge cold plugin changes on resume through a drift-free gate

- restore replays the persisted binding untouched, then bootstrap
  refreshes only when drift-free inputs changed while the session was
  cold: the catalog profile's tool set/denylist, or the plugin-sections
  baseline persisted alongside the prompt on the existing bind/update
  payloads; directory-listing and date drift wait for live triggers,
  so quiet resumes append no replay-visible records
- the rendered timestamp is day-precision (UTC date at 00:00,
  re-anchored on rollover), keeping steady-state renders byte-stable
  across resumes and sessions on the same day
- consolidate both timeout helpers onto a shared raceOutcome, and drop
  the generation counter the gate supersedes
- align the plugin-sections precedence prose with the AGENTS.md
  disclaimer (no self-granted authority, system instructions win on
  conflict)

* fix(agent-core-v2): bound the restored-prompt gate and land the sections baseline

- the gate's plugin-sections read now races the convergence timeout, so
  agent creation never blocks behind an unrelated plugin mutation
- refreshes serialize per agent through a tail, so overlapping triggers
  cannot write prompts out of order
- when plugin sections change but a plugin-free custom prompt does not,
  the new baseline lands as a sections-only update instead of making
  every later resume re-render in vain
- align the system prompt's Date and Time paragraph with the
  day-precision anchored timestamp

* Update plugin system-prompt instructions in changeset

Live sessions pick up plugin changes, while the default TUI and `kimi -p` paths ignore these fields.

Signed-off-by: 7Sageer <sag77r@hotmail.com>

* refactor(agent-core-v2): keep plugin skill reload user-driven

Plugin mutations still converge live agent prompts, but the session
skill catalog goes back to refreshing only on explicit plugin reload,
as before: the prompt feature does not need skill convergence, and the
pre-existing manual-reload semantics stay uniform across all plugin
contributions. Removes the convergence-driven skill reload, the
reloadSource de-privatization, and their tests; restores the
PluginSkillSource onDidReload forwarding and its catalog tests.

* refactor(agent-core-v2): apply plugin system-prompt changes only on explicit reload

Drop the live convergence machinery (the plugin onDidChange barrier,
the sessionPluginContribution fan-out, the restored-prompt drift gate,
and the day-precision render clock) so plugin system-prompt sections
take effect at the same point as every other plugin contribution:
/plugins reload or a new session. The profile now refreshes when the
session skill catalog re-pulls its plugin source on reload, reading
both the skill list and the prompt sections fresh.

* feat(agent-core): let plugins contribute system prompt instructions via the manifest systemPrompt field

* chore(agent-core-v2): remove inline implementation comment

* docs: clarify plugin prompt refresh semantics

---------

Signed-off-by: 7Sageer <sag77r@hotmail.com>
2026-07-29 20:30:07 +08:00
..
background feat(config): add env overrides for loop control and background task limits (#1993) 2026-07-21 19:49:00 +08:00
compaction fix: gate always-thinking inference to OpenAI wires, plus catalog review follow-ups (#2036) 2026-07-22 13:43:10 +08:00
config fix: gate always-thinking inference to OpenAI wires, plus catalog review follow-ups (#2036) 2026-07-22 13:43:10 +08:00
context fix(agent-core): drop vacuous assistant messages that permanently wedge sessions (#1968) 2026-07-21 11:04:55 +08:00
cron docs(cron): drop references to the non-existent kimi resume command (#2050) 2026-07-22 16:59:08 +08:00
harness feat: attach trace_id to telemetry events (#1724) 2026-07-16 09:14:12 +08:00
injection fix: clarify goal blocked audit guidance (#1481) 2026-07-07 22:29:40 +08:00
permission feat(goal): support guided goal authoring (#839) 2026-06-18 18:48:23 +08:00
records feat(agent-core): custom agent files and secondary model on the v1 engine (#2232) 2026-07-29 12:06:26 +08:00
turn fix(agent-core): count validation-rejected tool calls toward the repeat breaker (#2313) 2026-07-28 18:39:26 +08:00
basic.test.ts feat: send prompt-attached videos directly with the prompt (#1999) 2026-07-22 13:46:00 +08:00
bg-idle-notification-repro.test.ts fix: preserve long tool output (#1062) 2026-06-24 14:42:11 +08:00
config-state.test.ts fix: echo thinking under the reasoning field the endpoint actually uses (#2104) 2026-07-23 21:15:00 +08:00
config.test.ts feat(agent-core-v2): let plugins contribute system prompt instructions via the manifest systemPrompt field (#2314) 2026-07-29 20:30:07 +08:00
context.test.ts refactor: move tool-result metadata into a structured note side channel (#1437) 2026-07-07 11:40:27 +08:00
dynamic-tools.test.ts feat(agent-core): progressive tool disclosure via select_tools (#1369) 2026-07-06 15:51:08 +08:00
goal-outcome.test.ts fix: polish goal lifecycle messaging (#555) 2026-06-09 11:47:00 +08:00
goal.test.ts fix(agent-core): harden goal-mode budget and outcome flow (#1456) 2026-07-07 15:23:57 +08:00
image-caption-injection.test.ts fix(agent-core): route image-compression captions through hidden system reminders (#1348) 2026-07-03 16:21:10 +08:00
kosong-llm.test.ts feat: record model response id in wire logs (#1349) 2026-07-03 17:15:04 +08:00
llm-request-recorder.test.ts fix: resolve and synchronize thinking effort (#1625) 2026-07-14 16:37:03 +08:00
permission.test.ts feat: attach trace_id to telemetry events (#1724) 2026-07-16 09:14:12 +08:00
plan.test.ts feat: auto-background timed-out foreground bash commands (#1591) 2026-07-13 21:08:21 +08:00
question.test.ts feat(agent-core): ModelProvider interface and SingleModelProvider (#167) 2026-05-28 22:27:09 +08:00
resume.test.ts fix(tui): keep long sessions responsive and bound resumed history (#1976) 2026-07-21 15:20:12 +08:00
skill-prompt.test.ts fix: surface skill directory in the loaded-skill context block (#785) 2026-06-15 22:29:00 +08:00
skill-tool-manager.test.ts fix: surface skill directory in the loaded-skill context block (#785) 2026-06-15 22:29:00 +08:00
tool-result-render.test.ts refactor: move tool-result metadata into a structured note side channel (#1437) 2026-07-07 11:40:27 +08:00
tool-select.e2e.test.ts feat(agent-core): custom agent files and secondary model on the v1 engine (#2232) 2026-07-29 12:06:26 +08:00
tool.test.ts feat(agent-core): custom agent files and secondary model on the v1 engine (#2232) 2026-07-29 12:06:26 +08:00
turn.test.ts feat(agent-core): custom agent files and secondary model on the v1 engine (#2232) 2026-07-29 12:06:26 +08:00
usage.test.ts Kimi For Coding 2026-05-22 15:54:50 +08:00