@eddyskywalker/dsh-chatgpt-subscription 0.46.1 → 0.48.0

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.
Files changed (104) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/README.md +22 -1
  3. package/lib/client.js +2639 -571
  4. package/lib/client.js.map +1 -1
  5. package/lib/index.js +15598 -5902
  6. package/lib/plan-mode-pipeline.js +419 -0
  7. package/lib/plan-mode.js +783 -0
  8. package/lib/tool-result-pruner.js +400 -0
  9. package/lib/types/client/hub/brand-icons.d.ts +1 -1
  10. package/lib/types/client/hub/brand-icons.d.ts.map +1 -1
  11. package/lib/types/client/hub/brand-svg.d.ts +4 -0
  12. package/lib/types/client/hub/brand-svg.d.ts.map +1 -1
  13. package/lib/types/client/hub/providers.d.ts.map +1 -1
  14. package/lib/types/client/index.d.ts +2 -0
  15. package/lib/types/client/index.d.ts.map +1 -1
  16. package/lib/types/client/locales-ru/index.d.ts.map +1 -1
  17. package/lib/types/client/locales-ru/progress-updates.d.ts.map +1 -1
  18. package/lib/types/client/locales-ru/workbuddy.d.ts +10 -0
  19. package/lib/types/client/locales-ru/workbuddy.d.ts.map +1 -0
  20. package/lib/types/client/progress-updates/locales.d.ts +23 -5
  21. package/lib/types/client/progress-updates/locales.d.ts.map +1 -1
  22. package/lib/types/client/progress-updates/settings-binding.d.ts +13 -1
  23. package/lib/types/client/progress-updates/settings-binding.d.ts.map +1 -1
  24. package/lib/types/client/progress-updates/settings-section.d.ts +1 -1
  25. package/lib/types/client/progress-updates/settings-section.d.ts.map +1 -1
  26. package/lib/types/client/workbuddy/WorkBuddyComposerQuota.d.ts +34 -0
  27. package/lib/types/client/workbuddy/WorkBuddyComposerQuota.d.ts.map +1 -0
  28. package/lib/types/client/workbuddy/WorkBuddySection.d.ts +91 -0
  29. package/lib/types/client/workbuddy/WorkBuddySection.d.ts.map +1 -0
  30. package/lib/types/client/workbuddy/locales.d.ts +768 -0
  31. package/lib/types/client/workbuddy/locales.d.ts.map +1 -0
  32. package/lib/types/client/workbuddy/styles.d.ts +21 -0
  33. package/lib/types/client/workbuddy/styles.d.ts.map +1 -0
  34. package/lib/types/client/workbuddy/useWorkBuddySection.d.ts +149 -0
  35. package/lib/types/client/workbuddy/useWorkBuddySection.d.ts.map +1 -0
  36. package/lib/types/compat.d.ts +1 -1
  37. package/lib/types/entry-plan-mode-pipeline.d.ts +206 -0
  38. package/lib/types/entry-plan-mode-pipeline.d.ts.map +1 -0
  39. package/lib/types/entry-plan-mode.d.ts +353 -0
  40. package/lib/types/entry-plan-mode.d.ts.map +1 -0
  41. package/lib/types/entry-tool-result-pruner.d.ts +255 -0
  42. package/lib/types/entry-tool-result-pruner.d.ts.map +1 -0
  43. package/lib/types/host/agent-preset.d.ts.map +1 -1
  44. package/lib/types/host/cache-warmup/contracts.d.ts +5 -1
  45. package/lib/types/host/cache-warmup/contracts.d.ts.map +1 -1
  46. package/lib/types/host/cache-warmup/install.d.ts.map +1 -1
  47. package/lib/types/host/cache-warmup/projection.d.ts.map +1 -1
  48. package/lib/types/host/cache-warmup/retrieval-intent.d.ts +18 -0
  49. package/lib/types/host/cache-warmup/retrieval-intent.d.ts.map +1 -0
  50. package/lib/types/host/cache-warmup/settings.d.ts +9 -2
  51. package/lib/types/host/cache-warmup/settings.d.ts.map +1 -1
  52. package/lib/types/host/common/capabilities.d.ts.map +1 -1
  53. package/lib/types/host/common/model-request-control.d.ts +1 -1
  54. package/lib/types/host/common/model-request-control.d.ts.map +1 -1
  55. package/lib/types/host/common/request-diagnostics.d.ts +1 -1
  56. package/lib/types/host/common/request-diagnostics.d.ts.map +1 -1
  57. package/lib/types/host/compaction-policy-guard.d.ts +58 -0
  58. package/lib/types/host/compaction-policy-guard.d.ts.map +1 -0
  59. package/lib/types/host/compaction-prompt.d.ts +129 -0
  60. package/lib/types/host/compaction-prompt.d.ts.map +1 -0
  61. package/lib/types/host/plan-mode-cache-guard.d.ts +16 -0
  62. package/lib/types/host/plan-mode-cache-guard.d.ts.map +1 -0
  63. package/lib/types/host/preset-sync.d.ts.map +1 -1
  64. package/lib/types/host/ptc-sdk-cache-guard.d.ts +80 -0
  65. package/lib/types/host/ptc-sdk-cache-guard.d.ts.map +1 -0
  66. package/lib/types/host/tool-result-pruner-guard.d.ts +34 -0
  67. package/lib/types/host/tool-result-pruner-guard.d.ts.map +1 -0
  68. package/lib/types/host/workbuddy/account-pool.d.ts +389 -0
  69. package/lib/types/host/workbuddy/account-pool.d.ts.map +1 -0
  70. package/lib/types/host/workbuddy/adapter.d.ts +249 -0
  71. package/lib/types/host/workbuddy/adapter.d.ts.map +1 -0
  72. package/lib/types/host/workbuddy/atrest.d.ts +98 -0
  73. package/lib/types/host/workbuddy/atrest.d.ts.map +1 -0
  74. package/lib/types/host/workbuddy/checkin.d.ts +150 -0
  75. package/lib/types/host/workbuddy/checkin.d.ts.map +1 -0
  76. package/lib/types/host/workbuddy/client.d.ts +214 -0
  77. package/lib/types/host/workbuddy/client.d.ts.map +1 -0
  78. package/lib/types/host/workbuddy/dsml.d.ts +55 -0
  79. package/lib/types/host/workbuddy/dsml.d.ts.map +1 -0
  80. package/lib/types/host/workbuddy/guardrails.d.ts +111 -0
  81. package/lib/types/host/workbuddy/guardrails.d.ts.map +1 -0
  82. package/lib/types/host/workbuddy/identity.d.ts +71 -0
  83. package/lib/types/host/workbuddy/identity.d.ts.map +1 -0
  84. package/lib/types/host/workbuddy/mapper.d.ts +238 -0
  85. package/lib/types/host/workbuddy/mapper.d.ts.map +1 -0
  86. package/lib/types/host/workbuddy/model-catalog.d.ts +217 -0
  87. package/lib/types/host/workbuddy/model-catalog.d.ts.map +1 -0
  88. package/lib/types/host/workbuddy/oauth.d.ts +47 -0
  89. package/lib/types/host/workbuddy/oauth.d.ts.map +1 -0
  90. package/lib/types/host/workbuddy/outbound-identity.d.ts +139 -0
  91. package/lib/types/host/workbuddy/outbound-identity.d.ts.map +1 -0
  92. package/lib/types/host/workbuddy/routes.d.ts +56 -0
  93. package/lib/types/host/workbuddy/routes.d.ts.map +1 -0
  94. package/lib/types/host/workbuddy/token-store.d.ts +370 -0
  95. package/lib/types/host/workbuddy/token-store.d.ts.map +1 -0
  96. package/lib/types/host/workbuddy/types.d.ts +179 -0
  97. package/lib/types/host/workbuddy/types.d.ts.map +1 -0
  98. package/lib/types/index.d.ts +35 -0
  99. package/lib/types/index.d.ts.map +1 -1
  100. package/lib/types/shared/workbuddy-contracts.d.ts +531 -0
  101. package/lib/types/shared/workbuddy-contracts.d.ts.map +1 -0
  102. package/package.json +14 -2
  103. package/presets/dispatch/README.md +57 -3
  104. package/presets/dispatch/agent.cordis.yml +63 -3
@@ -10,6 +10,9 @@
10
10
  # 2. plan-mode — adds the grilling interview loop (design tree, frontier,
11
11
  # rounds) in front of planning, so a plan is never presented over unmet
12
12
  # requirements.
13
+ # 3. plan-mode-pipeline — enters Plan Mode the moment an L2 interview
14
+ # converges, so the plan is written inside Plan Mode and approved through
15
+ # exit_plan_mode instead of being pasted into a normal reply.
13
16
  #
14
17
  # Deliberately NOT configured here:
15
18
  # * `tool-subagent.config.agentOptions` — binding provider/model would defeat
@@ -161,6 +164,16 @@
161
164
  Fix the trigger condition on hard rejections instead of treating them as fallback grounds: on active child limit -> wait for existing children to settle and re-dispatch; on subagent model selection -> specify an explicit provider/model from the authorized routes listed in the error; on route-inheritance rejection -> switch to an explicit-route subagent tool or switch this session to an allowed model. Unless the condition is fixed, the same rejection will recur.
162
165
  Reset: fallback applies only to the current task. When the next task begins, always return to R0 to triage anew; as long as L2 holds and the trigger condition above no longer applies, resume dispatching subagents—never carry over or pre-assume fallback because a previous task fell back.
163
166
 
167
+ ## R9 · Plan Pipeline (Converged Interview -> Plan Mode -> Plan -> Approval)
168
+ The order is fixed: converge the interview, enter Plan Mode, write the plan there, and submit it for approval. A stage is never skipped and never reordered.
169
+ - Trigger: only when the task is L2 and the R-G interview has converged—the frontier is empty and the user has explicitly confirmed shared understanding. Call enter_plan_mode immediately once that holds, before any read-only exploration or planning for the task itself. Never call it for an L0/L1 task, and never call it while any frontier question is still open.
170
+ - Entry is the whole step: that step does nothing else. Read-only exploration and the decision-complete plan belong to the next turn, inside Plan Mode, and exit_plan_mode must be the sole and final tool call of the turn that submits the plan—the same wording the plan-mode section carries, so the two never disagree.
171
+ - Rejection: on "Keep planning", fold the feedback into the plan and submit it again via exit_plan_mode. A rejection is not an exit, so stay in Plan Mode.
172
+ - Abandon: call leave_plan_mode with a reason only when the user explicitly says no plan is wanted. It is not an approval exit—never use leave_plan_mode to bypass exit_plan_mode approval.
173
+ - Absent tool: when enter_plan_mode is missing from the tool list (an older harness generation, or the plugin row switched off), the degraded path is one ask_user_question asking the user to enter /plan, then continue under the configured plan-mode section. Never substitute a plan pasted into a normal reply.
174
+ - Relationship to R-G G5: convergence enters Plan Mode; a plan is never presented from ordinary mode instead of passing through enter_plan_mode and exit_plan_mode.
175
+ - Subagent: a child spawned from this session inherits this preset, so enter_plan_mode and leave_plan_mode are visible in its tool list—visibility is not permission, and it must treat both as unavailable. What the bridge can enforce depends on the harness generation: where the host exposes the live root set (agents.roots()), a call made by a live child is rejected with DELEGATED_CALLER, while an older generation cannot determine roots at all and the bridge lets the call through. Never rely on that rejection—a subagent neither enters Plan Mode on its own nor submits a plan, and it carries the open decision, including any request to enter Plan Mode, back to its dispatcher in every generation.
176
+
164
177
  ## Anti-Patterns (Any Occurrence Is a Violation)
165
178
  1. Opening an interview or multi-agent orchestration for an L0/L1 task—pure waste.
166
179
  2. Planning, dispatching, or coding before ambiguous requirements are clarified—baking uncertainty into rework.
@@ -182,6 +195,8 @@
182
195
  18. Writing a task brief with a range where a cap belongs ("2–5 files", "1–2 questions", "a few attempts")—the strictest reading wins and the budget shrinks to its lower bound (R0, R5).
183
196
  19. Asking a subagent to restate its rules as a correctness check instead of verifying the ambiguous ones with one tool call—restatement reproduces the misreading (R5).
184
197
  20. Reporting a route as "authorized", or claiming per-task routing is in force, when the session recorded no allowlist (R2 [State: Unlisted]).
198
+ 21. Entering Plan Mode for an L0/L1 task, or before the R-G interview has converged—Plan Mode is the L2 planning stage, not a place to finish the interview (R9, R-G G5).
199
+ 22. Using leave_plan_mode to bypass exit_plan_mode approval—leaving Plan Mode abandons the plan, it does not approve it (R9).
185
200
 
186
201
  - id: agent-instructions
187
202
  name: '@deepseek-ai/dsh-agent-instructions'
@@ -263,9 +278,27 @@
263
278
  isolate:
264
279
  planMode: true
265
280
  config:
281
+ # This plugin's own fork of the plan-mode service, not the harness
282
+ # package: it keeps the official behaviour but never rebuilds the
283
+ # provider's content-prefix cache on entering or leaving Plan Mode.
284
+ # See src/entry-plan-mode.ts for the three differences.
266
285
  - id: plan-mode
267
- name: '@deepseek-ai/dsh-plan-mode'
286
+ name: '@eddyskywalker/dsh-chatgpt-subscription/plan-mode'
268
287
  config:
288
+ # The full four-paragraph guidance is kept intact on purpose: this fork
289
+ # delivers the section ONCE, as a trailing notice message appended at
290
+ # agent/pre-step (src/entry-plan-mode.ts), instead of re-rendering it
291
+ # into `systemPrompt` on EVERY step of Plan Mode. Its length is
292
+ # therefore no longer a per-step resident cost — the bytes are paid
293
+ # once on entry and then live in the conversation history, where a
294
+ # trailing append does not invalidate the cached prefix.
295
+ #
296
+ # It is still the ONLY guardrail on the manual /plan path — the degraded
297
+ # entry R9 keeps for an older harness or a switched-off plugin row —
298
+ # where no enter_plan_mode tool result ever arrives. So all four rules
299
+ # stay here in full: stay in Plan Mode until exit_plan_mode submits,
300
+ # explore read-only and settle requirements per R0/R-G, make the plan
301
+ # decision-complete, and make exit_plan_mode the sole and final call.
269
302
  section: |
270
303
  [Plan Mode] Plan Mode is active. Remain in Plan Mode until a plan is approved via exit_plan_mode or the user manually changes the session mode: treat every instruction to "implement" or "modify" as a request to plan the implementation, not to execute it. Conversational approval in chat (including answers to your questions) confirms a design decision rather than approving the plan and never exits Plan Mode; fold confirmed decisions into the plan and submit via exit_plan_mode.
271
304
 
@@ -275,9 +308,16 @@
275
308
 
276
309
  [Plan Approval] When ready, call exit_plan_mode with the complete plan Markdown starting with a # Title heading, making exit_plan_mode the sole and final tool call of that turn: implementation or dispatch happens only in subsequent turns after approval. Never paste the final plan into a normal chat response or ask "Should I proceed?" in prose or via ask_user_question. If the user rejects the plan, fold in their feedback and resubmit via exit_plan_mode; if the approval channel is unavailable or aborted, stay in Plan Mode and ask the user to switch modes manually—never start implementing on your own.
277
310
 
311
+ # Enters Plan Mode as soon as the R-G interview converges (R9). The row is
312
+ # this plugin's own subpath export, so it needs no harness package on any
313
+ # generation the plugin supports; the row's planModePipeline switch
314
+ # defaults to true, which is why no config block appears here.
315
+ - id: plan-mode-pipeline
316
+ name: '@eddyskywalker/dsh-chatgpt-subscription/plan-mode-pipeline'
317
+
278
318
  # ── compaction ──────────────────────────────────────────────────────────────
279
319
 
280
- # `compaction-basic` reads `toolResultPrune` through `ctx.get`, so the pruner must
320
+ # `compaction-basic` reads `toolResultPruner` through `ctx.get`, so the pruner must
281
321
  # share this realm rather than sit outside it.
282
322
  #
283
323
  # `tokenMeter` is deliberately NOT in this realm: the meter stays on the HOST
@@ -299,8 +339,28 @@
299
339
  - id: command-compact
300
340
  name: '@deepseek-ai/dsh-command-compact'
301
341
 
342
+ # The pruner is this plugin's own fork (src/entry-tool-result-pruner.ts),
343
+ # not the harness package: it is byte-compatible with the official
344
+ # `@deepseek-ai/dsh-compaction-tool-result-pruner` except that it skips
345
+ # cache-prefix providers instead of rewriting their history.
346
+ #
347
+ # The reason the official pruner used to be left out is the reason the fork
348
+ # exists: pruning rewrites a historical tool result, which invalidates the
349
+ # provider's content-prefix cache from that point to the end of the
350
+ # conversation — measured on a real 838k-token session, one pass removed
351
+ # ~418k tokens of context but charged ~414k full-price input tokens to
352
+ # rebuild the prefix. The fork therefore skips `kimi-code` whole-session
353
+ # (the host-level guard enforces that across presets too), so a
354
+ # cache-prefix provider never pays the rebuild.
355
+ #
356
+ # `toolResultPruner` is isolated with the group because `compaction-basic`
357
+ # reads the pruner through `ctx.get`: the instance must be reachable from
358
+ # the realm that owns the compaction service. `compaction-basic` treats a
359
+ # missing pruner as "skip the model-free pass" at both of its call sites, so
360
+ # an installation where this fork's export is absent keeps working — the
361
+ # sync disables that row instead of marking the preset unresolvable.
302
362
  - id: tool-result-pruner
303
- name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
363
+ name: '@eddyskywalker/dsh-chatgpt-subscription/tool-result-pruner'
304
364
  config:
305
365
  thresholdChars: 8192
306
366
  headChars: 4096