@yankeguo/dsh-tool-devlead 0.2.2 → 0.2.4

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/README.md CHANGED
@@ -1,17 +1,20 @@
1
1
  # @yankeguo/dsh-tool-devlead
2
2
 
3
- The eleven model-facing `devlead_*` tools and the conditional DevLead system-prompt section.
3
+ The thirteen model-facing `devlead_*` tools and the conditional DevLead system-prompt section.
4
4
 
5
5
  The tools are registered with `when: ({ agent }) => ctx.devLead.isEnabled(agent)`, so an ordinary
6
6
  Session never sees them. They become visible only after a human enables DevLead mode with
7
- `/devlead on` or the UI switch.
7
+ `/devlead on` or the composer-toolbar toggle (shown in both states).
8
8
 
9
9
  ## Tools
10
10
 
11
11
  - `devlead_list_workspaces`
12
+ - `devlead_list_models` (compact Host model catalog for dispatch pinning)
13
+ - `devlead_list_agent_presets` (Host Agent preset roster: id, name/description, default marker, broken reason)
12
14
  - `devlead_use_workspace`
13
15
  - `devlead_list_sessions`
14
- - `devlead_create_session` (optional `isolation: "none" | "worktree"`)
16
+ - `devlead_create_session` (optional `isolation: "none" | "worktree"`; creation-time
17
+ `provider`/`model`/`reasoning_effort` and `agent_teams`)
15
18
  - `devlead_get_session`
16
19
  - `devlead_prompt_session`
17
20
  - `devlead_watch_session`
@@ -20,14 +23,36 @@ Session never sees them. They become visible only after a human enables DevLead
20
23
  - `devlead_archive_session` (DSH archive; `stop_running` asks the Host to stop running work)
21
24
  - `devlead_unarchive_session` (restore to the recorded Workspace position)
22
25
 
23
- Every tool except `devlead_list_workspaces` requires a live calling Agent (`exec.agent`) and an
24
- enabled DevLead mode. Since 0.2.0 `devlead_use_workspace` forwards the live Agent to the core
26
+ Every tool requires an enabled DevLead mode; every tool except `devlead_list_workspaces` also
27
+ requires a live calling Agent (`exec.agent`). Since 0.2.0 `devlead_use_workspace` forwards the live Agent to the core
25
28
  `useWorkspace(agent, { path, title?, create? }, signal)`; `create` defaults to `false` (a missing
26
29
  directory is `DEVLEAD_DIRECTORY_MISSING`), and `create: true` is only for a human-explicit request
27
30
  to create the directory. Domain failures are translated to `HarnessError` with a stable
28
31
  `DEVLEAD_*` code. Tool outputs are canonical JSON validated against their declared output
29
32
  schemas.
30
33
 
34
+ `devlead_list_models` reports the compact Host model catalog (default selection, providers,
35
+ models, reasoning efforts, and provider failures). `devlead_list_agent_presets` reports the
36
+ Host's actual preset roster: the ids accepted by `devlead_create_session`'s `preset`, published
37
+ name/description, the `default` marker (the effective default: `selectedDefault` when configured,
38
+ otherwise the base default), and a `broken` reason for a preset that cannot compose a Session. A
39
+ Host that composes no roster returns `available: false` with a reason; the tool never invents
40
+ preset ids. The `preset` argument is always a Host-defined id; omitted or blank values fall back
41
+ to the plugin `defaultAgentPreset`, then the Host default/selectedDefault, and an invalid or
42
+ unusable id fails creation with a structured error instead of being silently ignored.
43
+
44
+ `devlead_create_session` inherits the Host default model unless the human explicitly asked for a
45
+ route or the brief needs cost/capability routing or reproducibility; when pinning, call
46
+ `devlead_list_models` first and pass `provider` + `model` (optional `reasoning_effort`). Agent
47
+ Teams is the lead's judgment for complex, multi-step,
48
+ or parallel work (`agent_teams: true`); simple linear work omits it, and an explicit human on/off
49
+ is obeyed. The model is validated before the Session exists, the selection is recorded on the
50
+ child Session only (never through the controller's profile-default-writing path), and omitted
51
+ settings leave the Host default untouched; both settings are creation-time only. Agent Teams
52
+ requires DSH 0.2.2-rc.2 or newer with the Agent Teams service composed; on an rc.1 or otherwise
53
+ Team-less Host, `agent_teams: true` fails with `DEVLEAD_TEAM_UNAVAILABLE` and no Session is
54
+ created, so omit it (or pass `false`) and continue.
55
+
31
56
  The closing tools are non-destructive and judgment-based: their descriptions and the policy text
32
57
  allow autonomous, reasonable wrap-up closes (finished Sessions the lead created or dispatched,
33
58
  clearly stale/duplicate/empty or self-created Workspace registrations, or a human "tidy up" request),
@@ -57,11 +82,19 @@ supported platform.
57
82
 
58
83
  ## 中文
59
84
 
60
- `@yankeguo/dsh-tool-devlead` 提供 11 个模型工具 `devlead_*` 与条件 system prompt,只在 DevLead
61
- 模式开启时可见。除 `devlead_list_workspaces` 外都需要 live 调用者;0.2.0 起
85
+ `@yankeguo/dsh-tool-devlead` 提供 13 个模型工具 `devlead_*` 与条件 system prompt,只在 DevLead
86
+ 模式开启时可见。所有工具都要求 DevLead 模式开启;除 `devlead_list_workspaces` 外还需要 live
87
+ 调用者(`exec.agent`)。0.2.0 起
62
88
  `devlead_use_workspace` 把 live Agent 转发给 core 的 `useWorkspace(agent, request, signal)`,
63
89
  `create` 默认 `false`(缺目录报 `DEVLEAD_DIRECTORY_MISSING`,只有人类明确要求建目录时才传
64
- `true`)。领域错误翻译为稳定的 `DEVLEAD_*` code。关闭类工具(remove / archive / unarchive)
90
+ `true`)。`devlead_create_session` 还支持创建时指定 `provider`+`model`(可选
91
+ `reasoning_effort`)与 `agent_teams`:模型在创建前按 Host 当前 provider 目录校验,只记录在该
92
+ 子 Session 上(不走会改写 profile 默认模型的 controller 路径),省略时不动 Host 默认,且均为
93
+ 仅创建时生效。`devlead_list_agent_presets` 返回 Host 的真实 preset roster(id、名称/描述、
94
+ `default` 有效默认标记、`broken` 原因;Host 未组合 roster 时返回 `available: false` 与原因,
95
+ 不虚构 id)。`preset` 是 Host 定义的 id;省略/空白先回退插件 `defaultAgentPreset`,再回退
96
+ Host 默认/selectedDefault;无效 id 在创建阶段返回结构化错误,不会被静默忽略。领域错误翻译为
97
+ 稳定的 `DEVLEAD_*` code。关闭类工具(remove / archive / unarchive)
65
98
  都不是破坏性操作,且采用判断式自主:合理收尾时可自行关闭自己创建/派发且已完成的 Session、
66
99
  明显陈旧/重复/空置或由自己创建的 Workspace 注册;但不得关闭人类正在使用/对话的 Session 或
67
100
  Workspace、不得用关闭掩盖失败,并且每次自主关闭都要汇报原因与影响面。remove 只注销 Workspace、
package/lib/index.js CHANGED
@@ -71,18 +71,40 @@ function optionalPositiveInteger(value, field) {
71
71
  function defaultedLimit(value, field, fallback) {
72
72
  return optionalPositiveInteger(value, field) ?? fallback;
73
73
  }
74
+ function modelSelectionRequest(args) {
75
+ const provider = optionalText(args.provider);
76
+ const model = optionalText(args.model);
77
+ const reasoningEffort = optionalText(args.reasoning_effort);
78
+ if (provider === void 0 && model === void 0) {
79
+ if (reasoningEffort !== void 0) {
80
+ throw new DevLeadToolInputError("reasoning_effort requires provider and model");
81
+ }
82
+ return void 0;
83
+ }
84
+ if (provider === void 0 || model === void 0) {
85
+ throw new DevLeadToolInputError("provider and model must be provided together");
86
+ }
87
+ return {
88
+ provider,
89
+ model,
90
+ ...reasoningEffort === void 0 ? {} : { reasoningEffort }
91
+ };
92
+ }
74
93
  function createSessionRequest(args) {
75
94
  const workspace = optionalWorkspaceRef(args.workspace);
76
95
  const prompt = args.prompt === void 0 ? void 0 : requirePrompt(args.prompt);
77
96
  const title = optionalText(args.title);
78
97
  const preset = optionalText(args.preset);
79
98
  const isolation = optionalIsolationMode(args.isolation);
99
+ const model = modelSelectionRequest(args);
80
100
  return {
81
101
  ...workspace === void 0 ? {} : { workspace },
82
102
  ...prompt === void 0 ? {} : { prompt },
83
103
  ...title === void 0 ? {} : { title },
84
104
  ...preset === void 0 ? {} : { preset },
85
105
  ...isolation === void 0 ? {} : { isolation },
106
+ ...model === void 0 ? {} : { model },
107
+ ...args.agent_teams === void 0 ? {} : { agentTeams: args.agent_teams },
86
108
  watch: args.watch ?? true
87
109
  };
88
110
  }
@@ -92,8 +114,8 @@ import { HarnessError as HarnessError2 } from "@deepseek-ai/dsh-llm";
92
114
  import { isDevLeadError } from "@yankeguo/dsh-devlead";
93
115
  function translateToolError(error) {
94
116
  if (error instanceof HarnessError2) return error;
95
- if (error instanceof DevLeadToolInputError) return new HarnessError2(error.message, error.code);
96
- if (isDevLeadError(error)) return new HarnessError2(error.message, error.code);
117
+ if (error instanceof DevLeadToolInputError) return new HarnessError2(error.message, error.code, { cause: error });
118
+ if (isDevLeadError(error)) return new HarnessError2(error.message, error.code, { cause: error });
97
119
  return error;
98
120
  }
99
121
  async function runTool(body) {
@@ -116,7 +138,7 @@ Role boundary:
116
138
 
117
139
  Workflow:
118
140
  - List known Workspaces with devlead_list_workspaces. Register a repository directory with devlead_use_workspace using an absolute path; registering an already-registered path is idempotent. A missing directory is never created by default: set create true only when the human explicitly asked to create that directory.
119
- - Dispatch work with devlead_create_session: pass workspace (the owning Workspace's id or registered path; omit it only when the work truly belongs to this session's directory, in which case the new Session lives there) and a self-contained prompt that states the background, the target result, the open questions the Session must confirm or refine, the deliverables, how to verify them, and what not to touch, plus an optional title and Agent preset. A brief with open questions is expected: the Session owns the deeper investigation, not only the edits. The new Session is watched by default and runs independently; it does not see this conversation, so restate every fact it needs.
141
+ - Dispatch work with devlead_create_session: pass workspace (the owning Workspace's id or registered path; omit it only when the work truly belongs to this session's directory, in which case the new Session lives there) and a self-contained prompt that states the background, the target result, the open questions the Session must confirm or refine, the deliverables, how to verify them, and what not to touch, plus an optional title/preset. Preset is a Host-defined Agent preset id: call devlead_list_agent_presets before setting it; omit or leave it blank to inherit the plugin defaultAgentPreset, then the Host default/selectedDefault. An unknown or unusable preset fails creation with a structured error, so never guess an id. Models inherit the Host default: pass provider/model/reasoning_effort only when the human explicitly asked, or the brief needs cost/capability routing or reproducibility; call devlead_list_models first. Agent Teams is your judgment: complex, multi-step, or parallel work that benefits from subagents may set agent_teams true; simple linear work omits it; obey an explicit human on/off; report the choice and why. Team availability depends on the Host composition and DSH version (0.2.2-rc.2+); if unavailable, continue without Team instead of retrying or blocking. Both apply at creation only and never change the profile default. A brief with open questions is expected: the Session owns the deeper investigation, not only the edits. The new Session is watched by default and runs independently; it does not see this conversation, so restate every fact it needs.
120
142
  - Prefer an existing Session: if the owning Workspace already has a live Session working on the request, continue that Session with devlead_prompt_session instead of opening a duplicate.
121
143
  - Inspect progress with devlead_list_sessions and devlead_get_session. The listing carries live, running, watched, archived, and lastTurn; the single-Session detail adds lastTransition, lastError, and lastAssistant when the Host can read the log. Read those fields rather than guessing.
122
144
  - Continue a Session with devlead_prompt_session: the prompt is admitted as a user message attributed to you, and a cold Session is resumed first. Archived Sessions are rejected.
@@ -130,7 +152,7 @@ Waiting after dispatch: dispatch is asynchronous, so never wait for a child Sess
130
152
 
131
153
  Reporting: before you finish a turn, tell the human which Workspaces and Sessions you created, changed, or closed (and why you closed them), what each child was asked to do, how its latest turn ended (completed, failed, blocked, cancelled), whether you did any implementation work directly in this session and under what human authorization, and anything that needs their decision. Review each delivery by reading the actual diff or commits and the verification output, not only the child's summary; if a further acceptance run is needed, ask the Session to run it and report the output. Never claim a child finished or succeeded without reading it first. Report tool error codes and what you attempted instead of hiding failures.
132
154
 
133
- Only the human can turn DevLead mode on or off (with /devlead on or /devlead off, or the status strip switch); no tool can enable it, so never try to.`;
155
+ Only the human can turn DevLead mode on or off (with /devlead on or /devlead off, or the composer-toolbar toggle shown in both states); no tool can enable it, so never try to.`;
134
156
  var WORKTREE_ISOLATION_POLICY = `Checkout isolation: this Host composes the experimental Git worktree service, so devlead_create_session accepts isolation:'worktree' as a best-effort request. Use it for a write-type Session that may run concurrently with another live Session in the same checkout: two write Sessions sharing one working tree interleave their hunks and corrupt each other's work. The isolated Session keeps its Workspace membership and header cwd, while its files live on a new branch checked out at <checkout root>/.agents/worktrees/<name>. Uncommitted files in the checkout are NOT copied into the worktree, so commit or stash them, or verify the checkout is clean, before dispatching. You own the merge: review the branch diff and merge or cherry-pick that branch (or dispatch the merge to a Session) before reporting the work as delivered. If the result reports isolation status unavailable or failed, the Session stayed in the shared checkout, so serialize write Sessions instead.`;
135
157
  var SERIAL_WRITES_POLICY = `Checkout isolation: no Git worktree isolation is available in this Host composition, so never let two write Sessions run in the same checkout concurrently: their edits would interleave in one shared working tree. Dispatch write Sessions serially, one at a time per checkout, and wait for each to settle before starting the next.`;
136
158
  function devLeadPolicy(options) {
@@ -154,6 +176,12 @@ function present(title, kind, rawInput) {
154
176
  function presentListWorkspacesCall() {
155
177
  return present("List DevLead workspaces", "search");
156
178
  }
179
+ function presentListModelsCall() {
180
+ return present("List DevLead models", "read");
181
+ }
182
+ function presentListAgentPresetsCall() {
183
+ return present("List DevLead Agent presets", "read");
184
+ }
157
185
  function presentUseWorkspaceCall(args) {
158
186
  return present("Register DevLead workspace", "other", firstText(args.path));
159
187
  }
@@ -258,6 +286,18 @@ var SESSION_VIEW_SCHEMA = {
258
286
  createdAt: { type: "integer", description: "Epoch milliseconds of Session creation, when known." }
259
287
  }
260
288
  };
289
+ var MODEL_SELECTION_SCHEMA = {
290
+ type: "object",
291
+ additionalProperties: false,
292
+ properties: {
293
+ provider: { type: "string", required: true, description: "Registered provider route." },
294
+ model: { type: "string", required: true, description: "Provider-owned model id." },
295
+ reasoningEffort: {
296
+ type: "string",
297
+ description: "Adapter-owned reasoning effort, present only when one was explicitly requested."
298
+ }
299
+ }
300
+ };
261
301
  var ISOLATION_SCHEMA = {
262
302
  type: "object",
263
303
  additionalProperties: false,
@@ -385,7 +425,12 @@ var CREATE_SESSION_OUTPUT = jsonOutput({
385
425
  session: required(SESSION_VIEW_SCHEMA),
386
426
  workspace: required(WORKSPACE_VIEW_SCHEMA),
387
427
  prompted: { type: "boolean", required: true },
388
- isolation: required(ISOLATION_SCHEMA)
428
+ isolation: required(ISOLATION_SCHEMA),
429
+ model: MODEL_SELECTION_SCHEMA,
430
+ agentTeams: {
431
+ type: "boolean",
432
+ description: "Agent Teams mode applied to the new Session, present only when explicitly requested."
433
+ }
389
434
  }
390
435
  });
391
436
  var GET_SESSION_OUTPUT = jsonOutput({
@@ -421,6 +466,125 @@ var NOTIFICATIONS_OUTPUT = jsonOutput({
421
466
  watched: required({ type: "array", items: { type: "string" } })
422
467
  }
423
468
  });
469
+ var MODEL_EFFORT_SCHEMA = {
470
+ type: "object",
471
+ additionalProperties: false,
472
+ properties: {
473
+ id: { type: "string", required: true, description: "Effort id accepted by reasoning_effort." },
474
+ name: { type: "string", required: true, description: "Human-readable effort name." }
475
+ }
476
+ };
477
+ var MODEL_VIEW_SCHEMA = {
478
+ type: "object",
479
+ additionalProperties: false,
480
+ properties: {
481
+ id: { type: "string", required: true, description: "Model id accepted by model." },
482
+ name: { type: "string", required: true, description: "Human-readable model name." },
483
+ reasoning: {
484
+ type: "object",
485
+ additionalProperties: false,
486
+ properties: {
487
+ efforts: {
488
+ type: "array",
489
+ required: true,
490
+ items: MODEL_EFFORT_SCHEMA,
491
+ description: "Reasoning efforts the model accepts."
492
+ },
493
+ defaultEffort: {
494
+ type: "string",
495
+ description: "Effort the adapter uses when the caller omits one."
496
+ }
497
+ }
498
+ }
499
+ }
500
+ };
501
+ var MODEL_PROVIDER_VIEW_SCHEMA = {
502
+ type: "object",
503
+ additionalProperties: false,
504
+ properties: {
505
+ id: { type: "string", required: true, description: "Provider route accepted by provider." },
506
+ name: { type: "string", required: true, description: "Human-readable provider name." },
507
+ models: {
508
+ type: "array",
509
+ required: true,
510
+ items: MODEL_VIEW_SCHEMA,
511
+ description: "Models the provider currently advertises."
512
+ }
513
+ }
514
+ };
515
+ var MODEL_CATALOG_FAILURE_SCHEMA = {
516
+ type: "object",
517
+ additionalProperties: false,
518
+ properties: {
519
+ id: { type: "string", required: true, description: "Provider route whose lookup failed." },
520
+ name: { type: "string", required: true, description: "Human-readable provider name." },
521
+ message: { type: "string", required: true, description: "Failure detail." }
522
+ }
523
+ };
524
+ var MODEL_CATALOG_SCHEMA = {
525
+ type: "object",
526
+ additionalProperties: false,
527
+ properties: {
528
+ default: required(MODEL_SELECTION_SCHEMA),
529
+ routableProviders: {
530
+ type: "array",
531
+ required: true,
532
+ items: { type: "string" },
533
+ description: "Provider routes with at least one available model."
534
+ },
535
+ providers: {
536
+ type: "array",
537
+ required: true,
538
+ items: MODEL_PROVIDER_VIEW_SCHEMA,
539
+ description: "Provider groups and their models."
540
+ },
541
+ failures: {
542
+ type: "array",
543
+ required: true,
544
+ items: MODEL_CATALOG_FAILURE_SCHEMA,
545
+ description: "Providers whose catalog lookup failed."
546
+ }
547
+ }
548
+ };
549
+ var AGENT_PRESET_VIEW_SCHEMA = {
550
+ type: "object",
551
+ additionalProperties: false,
552
+ properties: {
553
+ id: {
554
+ type: "string",
555
+ required: true,
556
+ description: "Host-defined preset id accepted by devlead_create_session preset."
557
+ },
558
+ name: { type: "string", description: "Display name the preset publishes." },
559
+ description: { type: "string", description: "One-sentence purpose the preset publishes." },
560
+ default: {
561
+ type: "boolean",
562
+ required: true,
563
+ description: "Whether Sessions naming no preset use this one (selected default when configured)."
564
+ },
565
+ broken: { type: "string", description: "Why this preset cannot compose a Session; absent when usable." }
566
+ }
567
+ };
568
+ var AGENT_PRESET_CATALOG_SCHEMA = {
569
+ type: "object",
570
+ additionalProperties: false,
571
+ properties: {
572
+ available: {
573
+ type: "boolean",
574
+ required: true,
575
+ description: "Whether the Host composes an Agent preset roster service."
576
+ },
577
+ presets: {
578
+ type: "array",
579
+ required: true,
580
+ items: AGENT_PRESET_VIEW_SCHEMA,
581
+ description: "Declared presets in Host roster order; empty when unavailable or empty."
582
+ },
583
+ reason: { type: "string", description: "Why the roster is unavailable; present only with available false." }
584
+ }
585
+ };
586
+ var LIST_MODELS_OUTPUT = jsonOutput(MODEL_CATALOG_SCHEMA);
587
+ var LIST_AGENT_PRESETS_OUTPUT = jsonOutput(AGENT_PRESET_CATALOG_SCHEMA);
424
588
  var REMOVE_WORKSPACE_OUTPUT = jsonOutput({
425
589
  type: "object",
426
590
  additionalProperties: false,
@@ -459,12 +623,21 @@ var UNARCHIVE_SESSION_OUTPUT = jsonOutput({
459
623
  }
460
624
  }
461
625
  });
626
+ function modelSelectionValue(selection) {
627
+ return {
628
+ provider: selection.provider,
629
+ model: selection.model,
630
+ ...selection.reasoningEffort === void 0 ? {} : { reasoningEffort: selection.reasoningEffort }
631
+ };
632
+ }
462
633
  function createdSessionValue(created) {
463
634
  return {
464
635
  session: sessionValue(created.session),
465
636
  workspace: workspaceValue(created.workspace),
466
637
  prompted: created.prompted,
467
- isolation: isolationValue(created.isolation)
638
+ isolation: isolationValue(created.isolation),
639
+ ...created.model === void 0 ? {} : { model: modelSelectionValue(created.model) },
640
+ ...created.agentTeams === void 0 ? {} : { agentTeams: created.agentTeams }
468
641
  };
469
642
  }
470
643
  function promptedSessionValue(prompted) {
@@ -481,6 +654,44 @@ function watchMutationValue(mutation) {
481
654
  sessions: [...mutation.sessions]
482
655
  };
483
656
  }
657
+ function agentPresetCatalogValue(catalog) {
658
+ return {
659
+ available: catalog.available,
660
+ presets: catalog.presets.map((preset) => ({
661
+ id: preset.id,
662
+ default: preset.default,
663
+ ...preset.name === void 0 ? {} : { name: preset.name },
664
+ ...preset.description === void 0 ? {} : { description: preset.description },
665
+ ...preset.broken === void 0 ? {} : { broken: preset.broken }
666
+ })),
667
+ ...catalog.reason === void 0 ? {} : { reason: catalog.reason }
668
+ };
669
+ }
670
+ function modelCatalogValue(catalog) {
671
+ return {
672
+ default: modelSelectionValue(catalog.default),
673
+ routableProviders: [...catalog.routableProviders],
674
+ providers: catalog.providers.map((provider) => ({
675
+ id: provider.id,
676
+ name: provider.name,
677
+ models: provider.models.map((model) => ({
678
+ id: model.id,
679
+ name: model.name,
680
+ ...model.reasoning === void 0 ? {} : {
681
+ reasoning: {
682
+ efforts: model.reasoning.efforts.map((effort) => ({ id: effort.id, name: effort.name })),
683
+ ...model.reasoning.defaultEffort === void 0 ? {} : { defaultEffort: model.reasoning.defaultEffort }
684
+ }
685
+ }
686
+ }))
687
+ })),
688
+ failures: catalog.failures.map((failure) => ({
689
+ id: failure.id,
690
+ name: failure.name,
691
+ message: failure.message
692
+ }))
693
+ };
694
+ }
484
695
  function removedWorkspaceValue(removed) {
485
696
  return {
486
697
  workspace: workspaceValue(removed.workspace),
@@ -506,10 +717,12 @@ var name = "tool-devlead";
506
717
  var inject = ["devLead", "tools", "systemPrompt"];
507
718
  var DEFAULT_NOTIFICATIONS_LIMIT = 20;
508
719
  var SESSION_ARGUMENT_DESCRIPTION = 'Session id: the full id, a unique id prefix, or the uuid prefix without the "session-" prefix (for example e59ab350); it resolves only when unique.';
720
+ var LIST_MODELS_DESCRIPTION = "List the model routes this Host can dispatch to: the Host default selection, routable providers, each provider's models with their reasoning efforts and default effort, and any provider whose catalog could not be loaded. Call this before pinning provider/model/reasoning_effort on devlead_create_session. Most dispatches should omit the model parameters and inherit the Host default; only pin a model when the human explicitly asked, or the brief needs cost/capability routing or reproducibility.";
721
+ var LIST_AGENT_PRESETS_DESCRIPTION = "List the Agent preset roster this Host currently defines for Session creation. Each entry carries the id accepted by devlead_create_session preset, its published name/description when available, a default marker (the Host effective default: selectedDefault when configured, otherwise its base default), and a broken reason when the preset cannot compose a Session. Call this before setting preset and never assume a fixed list; standard and ptc are examples on some Hosts, not a complete vocabulary. An unknown or unusable preset fails creation with a structured error rather than being silently ignored. If the Host composes no roster, the result reports available false with a reason; omitting preset then falls back to the plugin defaultAgentPreset, then the Host default.";
509
722
  var LIST_WORKSPACES_DESCRIPTION = "List every registered DSH Workspace: its title, canonical directory path, live directory status, and the Sessions the registry accounts to it. Use it first to decide which Workspace owns a request, before registering a new Workspace or dispatching a Session.";
510
723
  var USE_WORKSPACE_DESCRIPTION = "Register a repository directory as a DSH Workspace so Sessions can be created in it. The path must be absolute, and an already-registered path is reused with its existing title. A missing directory is an error by default: set create to true only when the human explicitly asked to create that directory.";
511
724
  var LIST_SESSIONS_DESCRIPTION = "List DSH Sessions this DevLead Session can address: whether each is live, running, watched, or archived, plus latest-turn facts when the Host knows them. Watched and running rows come first. Optionally restrict to one Workspace or to the watched set; use devlead_get_session for a log detail with the latest turn outcome and assistant excerpt. Inspect it after a wake-up or when the human explicitly asks, not as a polling loop while waiting for a dispatched Session.";
512
- var CREATE_SESSION_DESCRIPTION = "Create an ordinary DSH Session in a Workspace and optionally start it with a prompt. The Session is a real Session the human can open and take over, not a subagent. It runs independently, so after this call end the turn instead of waiting: never sleep, never poll devlead_get_session, devlead_list_sessions, or devlead_notifications, and never call wait_agent to wait for it. A watched Session is the default, and its settled turn starts a new turn of this lead session with the wake-up message. Use it to dispatch the owning Workspace's work to that Session instead of doing the work yourself from this lead session; the brief may carry open questions, because the Session owns the deeper investigation and the implementation.";
725
+ var CREATE_SESSION_DESCRIPTION = "Create an ordinary DSH Session in a Workspace and optionally start it with a prompt. The child inherits the Host default model unless you explicitly pin provider/model (plus optional reasoning_effort); pin only when the human explicitly asked, or the brief needs cost/capability routing or reproducibility, and call devlead_list_models first so provider/model/effort are real. Agent Teams is your judgment: complex, multi-step, or parallel work that benefits from subagent collaboration may set agent_teams true; simple linear work should omit it; obey an explicit human on/off. Agent Teams requires DSH 0.2.2-rc.2 or newer with the Agent Teams service composed; when the Host reports it unavailable, continue without Team mode instead of retrying or blocking. Never change the Host/profile default, and do not upgrade or downgrade a model on your own. Both settings are creation-time only; the model is validated before the Session is created. Use devlead_list_agent_presets before pinning a preset: omitted or blank follows the plugin defaultAgentPreset, then the Host default/selectedDefault, and an unknown or unusable preset fails creation with a structured error rather than being silently ignored. The Session is a real Session the human can open and take over, not a subagent. It runs independently, so after this call end the turn instead of waiting: never sleep, never poll devlead_get_session, devlead_list_sessions, or devlead_notifications, and never call wait_agent to wait for it. A watched Session is the default, and its settled turn starts a new turn of this lead session with the wake-up message. Use it to dispatch the owning Workspace's work to that Session instead of doing the work yourself from this lead session; the brief may carry open questions, because the Session owns the deeper investigation and the implementation.";
513
726
  var GET_SESSION_DESCRIPTION = 'Read one Session in detail: whether it is live and running, whether it is archived, and, when the Host can read the Session log, the latest turn number and outcome plus the latest error and assistant excerpts. Address it by full id, a unique id prefix, or the uuid prefix without the "session-" prefix. Use it to inspect state after a wake-up or when the human explicitly asks, not to poll while waiting for a dispatched Session.';
514
727
  var PROMPT_SESSION_DESCRIPTION = "Admit a follow-up prompt into an existing Session, resuming a cold Session first. The prompt is attributed to this DevLead Session. Archived Sessions are rejected. The Session is watched by default, so after this call end the turn instead of waiting: its settled turn starts a new turn of this lead session with the wake-up message.";
515
728
  var WATCH_SESSION_DESCRIPTION = "Add one Session to, or remove it from, this DevLead Session's watch set. Only watched Sessions produce wake-up notifications, so unwatch work that no longer needs attention. A Session cannot watch itself.";
@@ -535,6 +748,32 @@ function apply(ctx) {
535
748
  }));
536
749
  }
537
750
  }), { when: ({ agent }) => ctx.devLead.isEnabled(agent) });
751
+ ctx.tools.register(defineTool({
752
+ name: "devlead_list_models",
753
+ description: LIST_MODELS_DESCRIPTION,
754
+ parameters: {},
755
+ output: LIST_MODELS_OUTPUT,
756
+ presentCall: presentListModelsCall,
757
+ execute(_args, exec) {
758
+ return runTool(async () => {
759
+ const agent = requireAgent(exec.agent, "devlead_list_models");
760
+ return modelCatalogValue(await ctx.devLead.listModels(agent, exec.signal));
761
+ });
762
+ }
763
+ }), { when: ({ agent }) => ctx.devLead.isEnabled(agent) });
764
+ ctx.tools.register(defineTool({
765
+ name: "devlead_list_agent_presets",
766
+ description: LIST_AGENT_PRESETS_DESCRIPTION,
767
+ parameters: {},
768
+ output: LIST_AGENT_PRESETS_OUTPUT,
769
+ presentCall: presentListAgentPresetsCall,
770
+ execute(_args, exec) {
771
+ return runTool(async () => {
772
+ const agent = requireAgent(exec.agent, "devlead_list_agent_presets");
773
+ return agentPresetCatalogValue(await ctx.devLead.listAgentPresets(agent, exec.signal));
774
+ });
775
+ }
776
+ }), { when: ({ agent }) => ctx.devLead.isEnabled(agent) });
538
777
  ctx.tools.register(defineTool({
539
778
  name: "devlead_use_workspace",
540
779
  description: USE_WORKSPACE_DESCRIPTION,
@@ -587,7 +826,7 @@ function apply(ctx) {
587
826
  },
588
827
  limit: {
589
828
  type: "integer",
590
- description: "Maximum number of Session rows to return; the Host may return fewer when its listing cap is lower."
829
+ description: "Maximum number of Session rows to return; the Host may return fewer when its listing cap is lower. With watched_only, the whole watch set is returned even when it exceeds this limit, so no watched Session is hidden."
591
830
  }
592
831
  },
593
832
  output: LIST_SESSIONS_OUTPUT,
@@ -620,7 +859,7 @@ function apply(ctx) {
620
859
  },
621
860
  prompt: {
622
861
  type: "string",
623
- description: "Optional self-contained prompt the new Session starts with: background, target result, open questions to confirm, deliverables, verification, and boundaries. The child cannot see this conversation."
862
+ description: "Optional self-contained prompt the new Session starts with: background, target result, open questions to confirm, deliverables, verification, and boundaries. The child cannot see this conversation. When the prompt pins a model, call devlead_list_models first."
624
863
  },
625
864
  title: {
626
865
  type: "string",
@@ -632,12 +871,28 @@ function apply(ctx) {
632
871
  },
633
872
  preset: {
634
873
  type: "string",
635
- description: "Optional Agent preset id for the new Session."
874
+ description: "Optional Host-defined Agent preset id for the new Session; call devlead_list_agent_presets to read this Host's roster. Do not assume a fixed list (standard and ptc are examples on some Hosts). Omit or leave blank to inherit the plugin defaultAgentPreset, then the Host default/selectedDefault. An unknown or unusable preset fails creation with a structured error; it is never silently ignored."
636
875
  },
637
876
  isolation: {
638
877
  type: "string",
639
878
  enum: ["none", "worktree"],
640
879
  description: 'Optional checkout isolation for the new Session; defaults to "none". "worktree" asks for a best-effort isolated Git checkout of the owning Workspace for the new Session. It is applied only when the Host composes the experimental Git worktree service, and a non-active outcome (unavailable or failed) is returned in the isolation field of the result, never as an error.'
880
+ },
881
+ provider: {
882
+ type: "string",
883
+ description: "Optional model provider route for the new Session; requires model. Omit to inherit the Host default (recommended unless the human asked or the brief requires a specific route). Call devlead_list_models first when pinning; validated before the Session is created. Creation-time only."
884
+ },
885
+ model: {
886
+ type: "string",
887
+ description: "Optional model id for the new Session; requires provider. Omit to inherit the Host default. Use it only for explicit cost/capability routing or reproducibility, and call devlead_list_models first. Creation-time only; never changes the Host/profile default."
888
+ },
889
+ reasoning_effort: {
890
+ type: "string",
891
+ description: "Optional adapter reasoning effort for the new Session; requires provider and model. Omit to inherit the model's default effort (recommended unless the human asked). Call devlead_list_models for the supported effort ids."
892
+ },
893
+ agent_teams: {
894
+ type: "boolean",
895
+ description: "Agent Teams for the new Session: true for complex, multi-step, or parallel work that benefits from subagent collaboration, false to disable, omit for simple linear work (Host default). Obey an explicit human on/off. Creation-time only. true requires DSH 0.2.2-rc.2 or newer with the Agent Teams service composed; otherwise it fails with DEVLEAD_TEAM_UNAVAILABLE\u2014omit it and continue without Team mode."
641
896
  }
642
897
  },
643
898
  output: CREATE_SESSION_OUTPUT,
package/locale/en.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "DevLead Tools",
4
- "description": "Model-facing devlead_* tools available only in DevLead mode: list and use Workspaces, create and prompt Sessions, read session status, watch Sessions, and read notifications."
4
+ "description": "Model-facing devlead_* tools available only in DevLead mode: list and use Workspaces, list Host models and Agent presets, create (inherit or pin a model/Agent Teams) and read/prompt/archive/unarchive/watch Sessions, and read notifications."
5
5
  }
6
6
  }
package/locale/zh.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "DevLead 工具",
4
- "description": "仅在 DevLead 模式下可用的 devlead_* 模型工具:列出并使用 Workspace、创建会话并发送提示词、读取会话状态、监督会话以及读取通知。"
4
+ "description": "仅在 DevLead 模式下可用的 devlead_* 模型工具:列出并使用 Workspace,列出 Host 模型与 Agent preset,创建(继承或固定模型/Agent Teams)、读取、续写、归档、恢复与监督会话,并读取通知。"
5
5
  }
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yankeguo/dsh-tool-devlead",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "Model-facing DevLead tools: register and list DSH Workspaces, create and steer ordinary Sessions, read session status, watch state changes, and read the lead's notification feed.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -17,16 +17,16 @@
17
17
  ],
18
18
  "peerDependencies": {
19
19
  "@deepseek-ai/cordis": "~4.1.0",
20
- "@deepseek-ai/dsh-agent": "0.2.2-rc.1",
21
- "@deepseek-ai/dsh-llm": "0.2.2-rc.1",
22
- "@deepseek-ai/dsh-session": "0.2.2-rc.1",
23
- "@deepseek-ai/dsh-system-prompt": "0.2.2-rc.1",
24
- "@deepseek-ai/dsh-tools": "0.2.2-rc.1",
20
+ "@deepseek-ai/dsh-agent": ">=0.2.2-rc.1 <0.3.0",
21
+ "@deepseek-ai/dsh-llm": ">=0.2.2-rc.1 <0.3.0",
22
+ "@deepseek-ai/dsh-session": ">=0.2.2-rc.1 <0.3.0",
23
+ "@deepseek-ai/dsh-system-prompt": ">=0.2.2-rc.1 <0.3.0",
24
+ "@deepseek-ai/dsh-tools": ">=0.2.2-rc.1 <0.3.0",
25
25
  "@deepseek-ai/schemastery": "~3.19.0"
26
26
  },
27
27
  "dependencies": {
28
- "@yankeguo/dsh-devlead": "0.2.2",
29
- "@yankeguo/dsh-devlead-protocol": "0.2.2"
28
+ "@yankeguo/dsh-devlead": "0.2.4",
29
+ "@yankeguo/dsh-devlead-protocol": "0.2.4"
30
30
  },
31
31
  "engines": {
32
32
  "dsh": ">=0.2.2-rc.1 <0.3.0"