@khorsheed/dsh-local-agent-kimi 0.1.0-rc.8 → 0.2.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # 变更记录
2
2
 
3
+ ## 0.2.0-rc.1(2026-09-30)
4
+
5
+ - **家族折叠:委派工具收进本包**。新增 `./tool` 组合入口(`src/tool.ts`)——`subagent_kimi` 委派工具由 agent 预设点名 `name: '@khorsheed/dsh-local-agent-kimi/tool'` 按会话授予,Config 两字段(`provider` / `toolName`)全部可选、默认即本包取值,预设行无需配置;行 id `tool-subagent-kimi` 不变。bundle patch 不再插 profile 根工具行,本包自挂载恰好一行(provider 行),插件清单一个 provider 一张卡。实现共享自家族核 `@khorsheed/dsh-local-agent` 的 `./tool-factory` 导出;对 `@khorsheed/dsh-local-agent-tool-subagent` 的依赖移除(该包退役)。
6
+
3
7
  ## 0.1.0-rc.8(2026-09-30)
4
8
 
5
9
  家族同版联动:加宽 `@deepseek-ai/dsh-*` peer 区间以覆盖宿主 0.2.0(0.2.0 的兼容闸会禁用 peer 区间不覆盖宿主版本的已装插件)。无功能变更。
package/README.en.md CHANGED
@@ -10,7 +10,7 @@ Getting the model to hand a whole chunk of work to another coding agent used to
10
10
 
11
11
  ## Features
12
12
 
13
- - **Delegate from any preset** — the `subagent_kimi` tool mounts at the profile root; standard/code/minimal/cordis and future presets need no per-preset variants.
13
+ - **Per-session delegation grant** — the `subagent_kimi` tool is this package's `./tool` composition entry, granted to the sessions of an agent preset that names it (e.g. dev mode); sessions on other presets never see it.
14
14
  - **Scoped home** — config, credentials, and sessions live under `$DSH_HOME/local-agent/kimi`, never in your `~/.kimi-code`.
15
15
  - **Device-code login** — `/kimi login` shows the auth URL in the session; `/kimi logout` clears scoped credentials for a fresh account.
16
16
  - **Resumable delegations** — pass back the self-described `resume` handle to continue the same Kimi session, with real per-round usage and timing.
@@ -108,7 +108,7 @@ The rich directory uses native ACP session model/configuration metadata when a l
108
108
 
109
109
  **Scoped home and login.** Every Kimi process the bundle starts runs with `KIMI_CODE_HOME=$DSH_HOME/local-agent/kimi`. Login is device-code only: `/kimi login` surfaces the authorization URL and code in the session, the CLI polls in the background, and credentials land in the scoped home. `/kimi logout` removes the scoped credentials and OAuth cache (the kimi CLI has no logout command). On first boot the scoped home is provisioned with a `config.toml` — the user's own config with every `api_key` blanked, or a minimal managed config when the user has none — because the CLI refuses to authenticate without provider and model definitions; an existing config is never overwritten.
110
110
 
111
- **Mounting.** The bundle patch registers the `kimi` harness and mounts the `subagent_kimi` tool at the profile root; the `kimi-cli` one-shot provider spawns `kimi -p` under the scoped home. The family core (`local-agent` row, shared scoped-homes root) ships in `@khorsheed/dsh-local-agent`'s own patch, declared here as a dependency. The browser settings card ships with this package's own `./client` half, composing the family core's shared building blocks (the auth block, the model picker): a standalone install renders it on this package's plugin detail view, a family-bundle install renders it through the row-level configure entry on the bundle's detail view, and a 0.1.5 host renders it under Settings → Plugins → configurable plugins. The identity triangle stays consistent: the `cordis.patch.yml` row id, tsdown's `clientBundle('@khorsheed/dsh-local-agent-kimi')`, and `src/invariant.ts`'s `PACKAGE_NAME`; the invariant companion also pins one contract — a registered `kimi` harness must name `KIMI_CODE_HOME` as its scoped-home variable.
111
+ **Mounting.** The bundle patch registers the `kimi` harness (exactly one provider row); the `subagent_kimi` tool is this package's `./tool` composition entry (sharing the family core's `./tool-factory` implementation), granted per session by an agent preset that names it — the dev preset's `tool-subagent-kimi` row is the grant point. The `kimi-cli` one-shot provider spawns `kimi -p` under the scoped home. The family core (`local-agent` row, shared scoped-homes root) ships in `@khorsheed/dsh-local-agent`'s own patch, declared here as a dependency. The browser settings card ships with this package's own `./client` half, composing the family core's shared building blocks (the auth block, the model picker): a standalone install renders it on this package's plugin detail view, a family-bundle install renders it through the row-level configure entry on the bundle's detail view, and a 0.1.5 host renders it under Settings → Plugins → configurable plugins. The identity triangle stays consistent: the `cordis.patch.yml` row id, tsdown's `clientBundle('@khorsheed/dsh-local-agent-kimi')`, and `src/invariant.ts`'s `PACKAGE_NAME`; the invariant companion also pins one contract — a registered `kimi` harness must name `KIMI_CODE_HOME` as its scoped-home variable.
112
112
 
113
113
  **Session records and transcripts.** `/kimi sessions` lists the scoped home's `session_index.jsonl` — this harness's delegations, never the user's personal sessions. `/kimi session <id>` reads that session's `wire.jsonl` and renders a readable transcript: user prompts, thinking, and assistant replies are tagged with their wire turn number (1-based, matching the child session's `turn/start` numbering), tool calls render with arguments and results paired to their calls (file-editing calls render patch-style, unknown content types keep a visible marker), and kimi's auto-permission `<system-reminder>` messages are filtered out. The settings card shows auth status and the scoped sessions narrowed to the current workspace; while a login is pending the status keeps re-probing until credentials land.
114
114
 
package/README.i18n.yaml CHANGED
@@ -2,5 +2,5 @@
2
2
  # last confirmed-consistent state. Both languages carry equal authority; after
3
3
  # editing either side, bring the other along and re-record with:
4
4
  # pnpm run verify-translation-pairing --write packages/local-agent-kimi/README.en.md
5
- packages/local-agent-kimi/README.en.md: 55a56e7b217fbfc9a0eb499c6d483e7ed78fad4b
6
- packages/local-agent-kimi/README.md: 9598f26d60e53ba2d8c934739c27ab419ecdbfcc
5
+ packages/local-agent-kimi/README.en.md: 5e809d7abbc8245e9c97de7298af20c3cbc02b52
6
+ packages/local-agent-kimi/README.md: d3004b6fbca63e164f6a35cd544d4681538d64c2
package/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  ## 特性
12
12
 
13
- - **任意 preset 都能委派**——`subagent_kimi` 工具挂在 profile 根,standard/code/minimal/cordis 及未来的 preset 都无需逐变体。
13
+ - **按会话授予的委派**——`subagent_kimi` 工具是本包的 `./tool` 组合入口,由点名它的 agent 预设(如开发模式)授予该预设的会话;其余预设的会话看不到它。
14
14
  - **作用域目录**——config、凭据、会话全部留在 `$DSH_HOME/local-agent/kimi`,与你自己的 `~/.kimi-code` 互不干扰。
15
15
  - **device-code 登录**——`/kimi login` 把授权 URL 呈现在会话中;`/kimi logout` 清除作用域凭据,换账号即重新登录。
16
16
  - **可续聊的委派**——把结果自述的 `resume` 句柄传回,即继续同一个 Kimi 会话,并按轮记录真实用量与耗时。
@@ -108,7 +108,7 @@ base_url = "https://your-router.example/v1"
108
108
 
109
109
  **作用域目录与登录。** 本包启动的每个 Kimi 进程都以 `KIMI_CODE_HOME=$DSH_HOME/local-agent/kimi` 运行。登录只走 device-code:`/kimi login` 把授权 URL 和验证码呈现在会话中,CLI 在后台轮询,凭据写入作用域目录。`/kimi logout` 删除作用域内的凭据与 OAuth 缓存(kimi CLI 没有 logout 命令)。首次启动时作用域目录会被预置一份 `config.toml`——把用户自己的 config 中所有 `api_key` 抹空后复制,用户没有 config 时则写入最小 managed config——因为没有 provider 与 model 定义 CLI 就拒绝认证;已存在的 config 永不覆盖。
110
110
 
111
- **挂载。** bundle patch 注册 `kimi` harness,并把 `subagent_kimi` 工具挂到 profile 根;`kimi-cli` 一次性 provider 在作用域目录下 spawn `kimi -p`。家族 core(`local-agent` 行,共享作用域目录根)随 `@khorsheed/dsh-local-agent` 自己的 patch 提供,本包把它声明为依赖。浏览器设置卡片由本包的 `./client` 半提供,复用家族 core 的共享构件(认证块、模型选择器):独立安装落在本包插件详情页,随家族 bundle 安装落在 bundle 详情的行级配置入口,0.1.5 宿主落在设置 → 插件 → 可配置插件。身份三角保持一致:`cordis.patch.yml` 的行 id、tsdown 的 `clientBundle('@khorsheed/dsh-local-agent-kimi')`、`src/invariant.ts` 的 `PACKAGE_NAME`;invariant 伴生插件还钉住一条契约——`kimi` harness 注册时作用域目录变量必须是 `KIMI_CODE_HOME`。
111
+ **挂载。** bundle patch 注册 `kimi` harness(恰好一行 provider 行);`subagent_kimi` 工具是本包的 `./tool` 组合入口(实现共享自家族核的 `./tool-factory` 导出),由点名它的 agent 预设按会话授予——dev 预设的 `tool-subagent-kimi` 行是授予点。`kimi-cli` 一次性 provider 在作用域目录下 spawn `kimi -p`。家族 core(`local-agent` 行,共享作用域目录根)随 `@khorsheed/dsh-local-agent` 自己的 patch 提供,本包把它声明为依赖。浏览器设置卡片由本包的 `./client` 半提供,复用家族 core 的共享构件(认证块、模型选择器):独立安装落在本包插件详情页,随家族 bundle 安装落在 bundle 详情的行级配置入口,0.1.5 宿主落在设置 → 插件 → 可配置插件。身份三角保持一致:`cordis.patch.yml` 的行 id、tsdown 的 `clientBundle('@khorsheed/dsh-local-agent-kimi')`、`src/invariant.ts` 的 `PACKAGE_NAME`;invariant 伴生插件还钉住一条契约——`kimi` harness 注册时作用域目录变量必须是 `KIMI_CODE_HOME`。
112
112
 
113
113
  **会话记录与转写。** `/kimi sessions` 列出作用域目录下的 `session_index.jsonl`——本 harness 的委派,绝不是用户的私人会话。`/kimi session <id>` 读取该会话的 `wire.jsonl` 渲染成可读转写:用户提示、思考与助手回复逐行标注 wire 轮次号(1 起,与子会话 `turn/start` 编号一致),工具调用带参数渲染、结果按调用配对(文件编辑类调用渲染成 patch 形态,不认识的内容类型保留可见标记),kimi 自动权限模式的 `<system-reminder>` 消息被过滤。设置卡片呈现认证状态与收窄到当前工作区的作用域会话;登录进行中时状态会持续重新探测,直到凭据落地。
114
114
 
package/cordis.patch.yml CHANGED
@@ -1,34 +1,24 @@
1
- # The dsh-local-agent-kimi bundle patch: register the Kimi harness and mount
2
- # its delegation tool. The family core row (`local-agent`, shared scoped-homes
3
- # root) lives in the framework bundle @khorsheed/dsh-local-agent's own patch.
4
- # This bundle declares that package as an npm dependency, which makes the
5
- # core's module resolvable — it does NOT mount the core row: `dsh plugin add`
6
- # reconciles only the profile's direct dependencies, so the core must be
7
- # installed explicitly alongside this bundle, or this provider stays pending.
8
- # No other patch inserts the core row id.
1
+ # The dsh-local-agent-kimi bundle patch: register the Kimi harness. The family
2
+ # core row (`local-agent`, shared scoped-homes root) lives in the framework
3
+ # bundle @khorsheed/dsh-local-agent's own patch. This bundle declares that
4
+ # package as an npm dependency, which makes the core's module resolvable — it
5
+ # does NOT mount the core row: `dsh plugin add` reconciles only the profile's
6
+ # direct dependencies, so the core must be installed explicitly alongside this
7
+ # bundle, or this provider stays pending. No other patch inserts the core row
8
+ # id.
9
9
  #
10
- # Two rows are inserted:
11
- # - local-agent-kimi: this bundle's plugin registers the `kimi` harness
12
- # (KIMI_CODE_HOME, `kimi login`, session_index records).
13
- # - tool-subagent-kimi: the family-owned delegation tool (schema
14
- # description/prompt plus optional resume) over the `kimi-cli` provider.
15
- # The toolName stays `subagent_kimi` — the same model-facing name the
16
- # official tool-subagent row used — so presets and prompts keep working,
17
- # while the family tool adds continuation: a later round may pass the dsh
18
- # child session id returned by the first delegation to continue the same
19
- # kimi conversation.
10
+ # Exactly ONE row is inserted: the provider (this bundle's plugin registers the
11
+ # `kimi` harness — KIMI_CODE_HOME, `kimi login`, session_index records). The
12
+ # `subagent_kimi` delegation tool is no longer a profile-root row: since the
13
+ # family fold it ships as this package's `./tool` composition entry
14
+ # (`name: '@khorsheed/dsh-local-agent-kimi/tool'` in an agent preset), granted
15
+ # per session — the dev preset's `tool-subagent-kimi` row is the grant point.
16
+ # The model-facing toolName stays `subagent_kimi` and the tool keeps its
17
+ # continuation parameter: a later round may pass the dsh child session id
18
+ # returned by the first delegation to continue the same kimi conversation.
20
19
  #
21
- # The subagent_kimi tool row mounts at the profile root, so every agent
22
- # preset (standard/code/minimal/cordis and future ones) can delegate without
23
- # per-preset variants. The provider starts no Kimi process until a tool call
24
- # or /kimi login.
20
+ # The provider starts no Kimi process until a tool call or /kimi login.
25
21
 
26
22
  - insert:
27
23
  - id: local-agent-kimi
28
24
  name: '@khorsheed/dsh-local-agent-kimi'
29
-
30
- - id: tool-subagent-kimi
31
- name: '@khorsheed/dsh-local-agent-tool-subagent'
32
- config:
33
- provider: kimi-cli
34
- toolName: subagent_kimi
package/lib/client.js CHANGED
@@ -243,30 +243,30 @@ window.__ModuleLoader__.load({
243
243
  document.head.appendChild(tag);
244
244
  }
245
245
  var ProviderAuthBlock_module_css_default = {
246
- "rowIdentity": "On5p7W_rowIdentity",
247
- "intro": "On5p7W_intro",
248
- "dotPending": "On5p7W_dotPending",
249
- "rowName": "On5p7W_rowName",
250
- "status": "On5p7W_status",
251
- "rowActions": "On5p7W_rowActions",
252
- "loginButton": "On5p7W_loginButton",
246
+ "rowPending": "On5p7W_rowPending",
247
+ "logoutButton": "On5p7W_logoutButton",
253
248
  "dotOn": "On5p7W_dotOn",
254
- "rosterError": "On5p7W_rosterError",
249
+ "loginButton": "On5p7W_loginButton",
250
+ "rows": "On5p7W_rows",
251
+ "intro": "On5p7W_intro",
255
252
  "promptText": "On5p7W_promptText",
253
+ "section": "On5p7W_section",
254
+ "rosterError": "On5p7W_rosterError",
256
255
  "loginPrompt": "On5p7W_loginPrompt",
257
256
  "dotOff": "On5p7W_dotOff",
258
- "section": "On5p7W_section",
259
- "rowHead": "On5p7W_rowHead",
260
257
  "rowCard": "On5p7W_rowCard",
258
+ "credentialDot": "On5p7W_credentialDot",
259
+ "status": "On5p7W_status",
260
+ "rowHead": "On5p7W_rowHead",
261
+ "dotPending": "On5p7W_dotPending",
261
262
  "codeInput": "On5p7W_codeInput",
262
- "retryButton": "On5p7W_retryButton",
263
- "rows": "On5p7W_rows",
263
+ "rowTag": "On5p7W_rowTag",
264
264
  "openPage": "On5p7W_openPage",
265
- "logoutButton": "On5p7W_logoutButton",
265
+ "rowName": "On5p7W_rowName",
266
+ "rowIdentity": "On5p7W_rowIdentity",
267
+ "retryButton": "On5p7W_retryButton",
266
268
  "title": "On5p7W_title",
267
- "credentialDot": "On5p7W_credentialDot",
268
- "rowTag": "On5p7W_rowTag",
269
- "rowPending": "On5p7W_rowPending"
269
+ "rowActions": "On5p7W_rowActions"
270
270
  };
271
271
  //#endregion
272
272
  //#region ../local-agent/src/client/ProviderAuthBlock.tsx
@@ -539,10 +539,10 @@ window.__ModuleLoader__.load({
539
539
  document.head.appendChild(tag);
540
540
  }
541
541
  var AuthStatusDot_module_css_default = {
542
- "dotOn": "OFjNUG_dotOn",
543
- "dotPending": "OFjNUG_dotPending",
542
+ "dotOff": "OFjNUG_dotOff",
544
543
  "credentialDot": "OFjNUG_credentialDot",
545
- "dotOff": "OFjNUG_dotOff"
544
+ "dotOn": "OFjNUG_dotOn",
545
+ "dotPending": "OFjNUG_dotPending"
546
546
  };
547
547
  //#endregion
548
548
  //#region ../local-agent/src/client/AuthStatusDot.tsx
@@ -568,40 +568,40 @@ window.__ModuleLoader__.load({
568
568
  document.head.appendChild(tag);
569
569
  }
570
570
  var SettingsCard_module_css_default = {
571
- "modelMenuUp": "apHkUa_modelMenuUp",
572
- "errorText": "apHkUa_errorText",
573
- "name": "apHkUa_name",
574
- "modelSave": "apHkUa_modelSave",
571
+ "chevron": "apHkUa_chevron",
572
+ "info": "apHkUa_info",
573
+ "saved": "apHkUa_saved",
574
+ "modelMenuChevronOpen": "apHkUa_modelMenuChevronOpen",
575
+ "modelMenu": "apHkUa_modelMenu",
576
+ "chevronOpen": "apHkUa_chevronOpen",
575
577
  "nameRow": "apHkUa_nameRow",
576
- "body": "apHkUa_body",
577
- "blockTitle": "apHkUa_blockTitle",
578
+ "headText": "apHkUa_headText",
578
579
  "header": "apHkUa_header",
579
- "modelItemDefault": "apHkUa_modelItemDefault",
580
- "modelItemCheck": "apHkUa_modelItemCheck",
581
- "modelMenuChevronOpen": "apHkUa_modelMenuChevronOpen",
582
- "chevron": "apHkUa_chevron",
580
+ "name": "apHkUa_name",
581
+ "modelMenuUp": "apHkUa_modelMenuUp",
583
582
  "knob": "apHkUa_knob",
584
- "modelItemLabel": "apHkUa_modelItemLabel",
583
+ "modelItemCurrent": "apHkUa_modelItemCurrent",
584
+ "modelItemDefault": "apHkUa_modelItemDefault",
585
585
  "block": "apHkUa_block",
586
+ "modelItemCheck": "apHkUa_modelItemCheck",
587
+ "row": "apHkUa_row",
588
+ "card": "apHkUa_card",
589
+ "description": "apHkUa_description",
586
590
  "hint": "apHkUa_hint",
587
- "switch": "apHkUa_switch",
591
+ "switchOn": "apHkUa_switchOn",
588
592
  "modelItem": "apHkUa_modelItem",
589
593
  "modelMenuButton": "apHkUa_modelMenuButton",
590
- "modelInput": "apHkUa_modelInput",
591
- "cardOpen": "apHkUa_cardOpen",
592
- "modelMenu": "apHkUa_modelMenu",
594
+ "switch": "apHkUa_switch",
595
+ "modelItemLabel": "apHkUa_modelItemLabel",
593
596
  "modelMenuChevron": "apHkUa_modelMenuChevron",
594
- "switchOn": "apHkUa_switchOn",
595
- "row": "apHkUa_row",
597
+ "modelSave": "apHkUa_modelSave",
596
598
  "modelField": "apHkUa_modelField",
597
- "info": "apHkUa_info",
598
- "chevronOpen": "apHkUa_chevronOpen",
599
- "card": "apHkUa_card",
600
- "modelItemCurrent": "apHkUa_modelItemCurrent",
601
- "headText": "apHkUa_headText",
599
+ "cardOpen": "apHkUa_cardOpen",
600
+ "blockTitle": "apHkUa_blockTitle",
601
+ "modelInput": "apHkUa_modelInput",
602
602
  "rowLabel": "apHkUa_rowLabel",
603
- "saved": "apHkUa_saved",
604
- "description": "apHkUa_description"
603
+ "errorText": "apHkUa_errorText",
604
+ "body": "apHkUa_body"
605
605
  };
606
606
  //#endregion
607
607
  //#region src/client/SettingsCard.tsx
package/lib/tool.js ADDED
@@ -0,0 +1,40 @@
1
+ import { mountSubagentDelegationTool, subagentToolConfigSchema } from "@khorsheed/dsh-local-agent/tool-factory";
2
+ //#region lib/types/tool.js
3
+ const PACKAGE_NAME = "@khorsheed/dsh-local-agent-kimi";
4
+ /** This entry's own defaults: a preset row needs no config. */
5
+ const DEFAULT_PROVIDER = "kimi-cli";
6
+ const DEFAULT_TOOL_NAME = "subagent_kimi";
7
+ /** Cordis plugin name used by loader diagnostics. */
8
+ const name = "local-agent-kimi-tool";
9
+ /**
10
+ * The family core's `localAgent` service is a declared inject (the
11
+ * owning-family companion exception to the community-service probe rule): a
12
+ * preset's standing scope mounts at registry-activation time, BEFORE the
13
+ * profile's later bundle rows provide the core, so a one-shot ctx.get probe
14
+ * at apply saw ABSENT there and nothing re-ran the row (rc.1 boot order; the
15
+ * worktrees `./tool` entry documents the incident). The declared inject pends
16
+ * the row until the core provides, then the body applies.
17
+ */
18
+ const inject = [
19
+ "tools",
20
+ "subagents",
21
+ "localAgent"
22
+ ];
23
+ const Config = subagentToolConfigSchema(DEFAULT_PROVIDER, DEFAULT_TOOL_NAME);
24
+ /**
25
+ * Plugin body: mount the delegation tool through the family factory, stamped
26
+ * with THIS package as the tool-origin owner (AGENTS.md § Tool origin
27
+ * tagging — the shared factory never hardcodes an owner).
28
+ * @param ctx - Cordis context (the preset's agent-plane mount).
29
+ * @param config - row config (schema defaults already applied; the `??`
30
+ * fallbacks cover a direct ctx.plugin caller that bypassed validation).
31
+ */
32
+ function apply(ctx, config) {
33
+ const resolved = {
34
+ provider: config.provider ?? DEFAULT_PROVIDER,
35
+ toolName: config.toolName ?? DEFAULT_TOOL_NAME
36
+ };
37
+ mountSubagentDelegationTool(ctx, resolved, PACKAGE_NAME);
38
+ }
39
+ //#endregion
40
+ export { Config, apply, inject, name };
@@ -0,0 +1,54 @@
1
+ /**
2
+ * The session-granted `subagent_kimi` delegation tool — this package's
3
+ * `./tool` composition entry (the worktrees 0.3.0 / room 0.2.0 fold pattern)
4
+ * for agent-preset compositions. The row provides NO service (the
5
+ * preset-mount isolate-realm rule forbids service rows); it registers the
6
+ * model-facing tool into the host tools registry through the family factory
7
+ * (`@khorsheed/dsh-local-agent/tool-factory`), delegating to the `kimi-cli`
8
+ * provider this package's main row registers at the profile root — the
9
+ * official tool-row shape (the shipped `tool-bash` rows work the same way).
10
+ * Granting is therefore per-session: a preset names the row
11
+ * (`- id: tool-subagent-kimi / name: '@khorsheed/dsh-local-agent-kimi/tool'`),
12
+ * its sessions get the tool; every other preset's sessions do not.
13
+ *
14
+ * This row used to mount at the profile ROOT from this package's own bundle
15
+ * patch, pointing at the shared `@khorsheed/dsh-local-agent-tool-subagent`
16
+ * companion package; the family fold retired that package (the factory moved
17
+ * into the family core) and moved the row here. The package's bundle patch
18
+ * now mounts ONLY the provider row — a profile-root tool row would grant
19
+ * every session, exactly what the fold removed.
20
+ *
21
+ * @module @khorsheed/dsh-local-agent-kimi/tool
22
+ */
23
+ import type { Context } from '@deepseek-ai/cordis';
24
+ import type z from '@deepseek-ai/schemastery';
25
+ /** Cordis plugin name used by loader diagnostics. */
26
+ export declare const name = "local-agent-kimi-tool";
27
+ /**
28
+ * The family core's `localAgent` service is a declared inject (the
29
+ * owning-family companion exception to the community-service probe rule): a
30
+ * preset's standing scope mounts at registry-activation time, BEFORE the
31
+ * profile's later bundle rows provide the core, so a one-shot ctx.get probe
32
+ * at apply saw ABSENT there and nothing re-ran the row (rc.1 boot order; the
33
+ * worktrees `./tool` entry documents the incident). The declared inject pends
34
+ * the row until the core provides, then the body applies.
35
+ */
36
+ export declare const inject: string[];
37
+ /** Config: every field optional, defaulting to THIS provider's own values. */
38
+ export interface Config {
39
+ /** The `ctx.subagents` provider name to delegate to (default `kimi-cli`). */
40
+ provider?: string;
41
+ /** Model-facing tool name (default `subagent_kimi`). */
42
+ toolName?: string;
43
+ }
44
+ export declare const Config: z;
45
+ /**
46
+ * Plugin body: mount the delegation tool through the family factory, stamped
47
+ * with THIS package as the tool-origin owner (AGENTS.md § Tool origin
48
+ * tagging — the shared factory never hardcodes an owner).
49
+ * @param ctx - Cordis context (the preset's agent-plane mount).
50
+ * @param config - row config (schema defaults already applied; the `??`
51
+ * fallbacks cover a direct ctx.plugin caller that bypassed validation).
52
+ */
53
+ export declare function apply(ctx: Context, config: Config): void;
54
+ //# sourceMappingURL=tool.d.ts.map
@@ -0,0 +1,34 @@
1
+ import { mountSubagentDelegationTool, subagentToolConfigSchema } from '@khorsheed/dsh-local-agent/tool-factory';
2
+ const PACKAGE_NAME = '@khorsheed/dsh-local-agent-kimi';
3
+ /** This entry's own defaults: a preset row needs no config. */
4
+ const DEFAULT_PROVIDER = 'kimi-cli';
5
+ const DEFAULT_TOOL_NAME = 'subagent_kimi';
6
+ /** Cordis plugin name used by loader diagnostics. */
7
+ export const name = 'local-agent-kimi-tool';
8
+ /**
9
+ * The family core's `localAgent` service is a declared inject (the
10
+ * owning-family companion exception to the community-service probe rule): a
11
+ * preset's standing scope mounts at registry-activation time, BEFORE the
12
+ * profile's later bundle rows provide the core, so a one-shot ctx.get probe
13
+ * at apply saw ABSENT there and nothing re-ran the row (rc.1 boot order; the
14
+ * worktrees `./tool` entry documents the incident). The declared inject pends
15
+ * the row until the core provides, then the body applies.
16
+ */
17
+ export const inject = ['tools', 'subagents', 'localAgent'];
18
+ // Bare `z` annotation per the shared helper's variance note.
19
+ export const Config = subagentToolConfigSchema(DEFAULT_PROVIDER, DEFAULT_TOOL_NAME);
20
+ /**
21
+ * Plugin body: mount the delegation tool through the family factory, stamped
22
+ * with THIS package as the tool-origin owner (AGENTS.md § Tool origin
23
+ * tagging — the shared factory never hardcodes an owner).
24
+ * @param ctx - Cordis context (the preset's agent-plane mount).
25
+ * @param config - row config (schema defaults already applied; the `??`
26
+ * fallbacks cover a direct ctx.plugin caller that bypassed validation).
27
+ */
28
+ export function apply(ctx, config) {
29
+ const resolved = {
30
+ provider: config.provider ?? DEFAULT_PROVIDER,
31
+ toolName: config.toolName ?? DEFAULT_TOOL_NAME,
32
+ };
33
+ mountSubagentDelegationTool(ctx, resolved, PACKAGE_NAME);
34
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@khorsheed/dsh-local-agent-kimi",
3
- "description": "Kimi Code harness for dsh-local-agent: scoped KIMI_CODE_HOME, one-shot kimi -p delegation visible in the 子代理 surface, session records and preset wiring",
3
+ "description": "Kimi Code harness for dsh-local-agent: scoped KIMI_CODE_HOME, one-shot kimi -p delegation visible in the 子代理 surface, session records and preset wiring; the session-granted `subagent_kimi` delegation tool ships as the package's `./tool` composition entry",
4
4
  "keywords": [
5
5
  "dsh",
6
6
  "dsh-plugin",
@@ -8,7 +8,7 @@
8
8
  "local-agent",
9
9
  "kimi"
10
10
  ],
11
- "version": "0.1.0-rc.8",
11
+ "version": "0.2.0-rc.1",
12
12
  "type": "module",
13
13
  "main": "lib/index.js",
14
14
  "types": "lib/types/index.d.ts",
@@ -25,6 +25,10 @@
25
25
  "types": "./lib/types/records.d.ts",
26
26
  "default": "./lib/records.js"
27
27
  },
28
+ "./tool": {
29
+ "types": "./lib/types/tool.d.ts",
30
+ "default": "./lib/tool.js"
31
+ },
28
32
  "./client": {
29
33
  "types": "./lib/types/client/index.d.ts",
30
34
  "default": "./lib/client.js"
@@ -65,8 +69,7 @@
65
69
  ],
66
70
  "license": "MIT",
67
71
  "dependencies": {
68
- "@khorsheed/dsh-local-agent": "^0.1.0-rc.8",
69
- "@khorsheed/dsh-local-agent-tool-subagent": "^0.1.0-rc.8"
72
+ "@khorsheed/dsh-local-agent": "^0.2.0-rc.1"
70
73
  },
71
74
  "peerDependencies": {
72
75
  "@deepseek-ai/cordis": "^4.0.1",