@lynn123411/dsh-notify-user 0.5.6 → 0.5.8
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 +9 -7
- package/cordis.patch.yml +0 -8
- package/lib/client.js +280 -103
- package/lib/client.js.map +3 -3
- package/lib/index.js +1 -2
- package/lib/index.js.map +2 -2
- package/package.json +28 -28
package/lib/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts", "../src/config.ts", "../src/shared/config.ts", "../src/nudge.ts", "../src/client/row-model.ts"],
|
|
4
|
-
"sourcesContent": ["import { defineTool } from '@deepseek-ai/dsh-tools';\nimport { AgentToolRegistry } from '@deepseek-ai/dsh-tools/pipeline';\nimport type { ToolDefinition } from '@deepseek-ai/dsh-tools';\nimport type { Context } from '@deepseek-ai/cordis';\nimport type { Agent } from '@deepseek-ai/dsh-agent';\nimport type { Session } from '@deepseek-ai/dsh-session';\nimport type {} from '@deepseek-ai/dsh-settings';\nimport { isEnabledFor, nudgeAfterOf, type PluginConfig } from './config.js';\nimport { createNudgeController, installNudge, isSubagentSession } from './nudge.js';\nimport { NOTIFY_TOOL_NAME, SUMMARY_ONLY_FIELD } from './shared/config.js';\nimport { parseUpdate } from './client/row-model.js';\n\n/**\n * @lynn123411/dsh-notify-user \u2014\u2014 \u6A21\u578B\u5728\u5E72\u6D3B\u9014\u4E2D\u4E3B\u52A8\u6C47\u62A5\u8FDB\u5EA6\uFF0C\u4E45\u4E0D\u6C47\u62A5\u5C31\u50AC\u4E00\u6761\u3002\n *\n * \u5BBF\u4E3B\u534A\u8FB9\u505A\u4E09\u4EF6\u4E8B\uFF1A\u6CE8\u518C `notify_user` \u5DE5\u5177\u3001\u628A\u50AC\u529E\u72B6\u6001\u673A\u63A5\u5230\u4E09\u6761\u5BBF\u4E3B\u4E8B\u4EF6\u4E0A\u3001\n * \u58F0\u660E\u672C\u884C\u7684\u914D\u7F6E\u5F62\u72B6\u5E76\u5173\u6389\u5185\u6838\u6309 schema \u81EA\u52A8\u751F\u6210\u7684\u8BBE\u7F6E\u9875\uFF08\u914D\u7F6E\u754C\u9762\u5728\u6D4F\u89C8\u5668\n * \u534A\u8FB9\u7684\u63D2\u4EF6\u9875\u5361\u7247\u4E0A\uFF09\u3002\u6D4F\u89C8\u5668\u534A\u8FB9\u4E0E\u5B83\u540C\u6302\u4E00\u6761 root loader \u884C\uFF08\u89C1 cordis.patch.yml\uFF09\u3002\n *\n * \u4E3B\u52A8\u6C47\u62A5\u6309\u4F1A\u8BDD\u5F00\u5173\uFF1A\u4F1A\u8BDD\u81EA\u5DF1\u7684\u9009\u62E9\u4F18\u5148\uFF0C\u6CA1\u6709\u5C31\u7528\u914D\u7F6E\u91CC\u7684\u9ED8\u8BA4\u503C\u3002\u5173\u6389\u7684\u4F1A\u8BDD\n * \u65E2\u4E0D\u50AC\uFF0C\u4E5F\u4E0D\u7ED9\u5B83\u63D0\u4F9B `notify_user` \u5DE5\u5177\u3002\n\n */\n\n/** \u7A33\u5B9A Cordis loader \u540D\uFF1A\u4E0E cordis.patch.yml \u90A3\u6761\u884C\u7684 id\u3001\u914D\u7F6E\u547D\u540D\u7A7A\u95F4\u540C\u5B57\u9762\u91CF\u3002 */\nexport const name = 'dsh-notify-user';\n\n/** \u5DE5\u5177\u6CE8\u518C\u8868\u4E0E\u5DF2\u6709 Agent \u6E05\u5355\u3002 */\nexport const inject = ['tools', 'agents'];\n\nexport { Config } from './config.js';\n\ndeclare module '@deepseek-ai/cordis' {\n interface Events {\n /**\n * \u914D\u7F6E\u7684 volatile \u5B57\u6BB5\u88AB\u5408\u5E76\u8FDB\u8FD0\u884C\u4E2D\u7684\u63D2\u4EF6\u65F6\u53D1\u51FA\uFF0C\u53EA\u53D1\u7ED9\u62E5\u6709\u5B83\u7684 fiber\u3002\n * \u5F62\u72B6\u7167\u6284 `@deepseek-ai/cordis-plugin-loader` \u7684 `lib/types/index.d.ts`\u3002\n */\n 'loader/volatile-update'(paths: readonly (readonly string[])[]): void;\n }\n}\n\n/** \u6807\u9898\u53C2\u6570\u7684\u63CF\u8FF0\uFF1A\u4E24\u79CD\u6A21\u5F0F\u5171\u7528\u3002 */\nconst TITLE_PARAMETER = {\n type: 'string',\n description: \"One line the user can take in at a glance: the conclusion or current phase, in the user's language, under 60 characters, plain text.\",\n} as const;\n\n/** \u6B63\u6587\u53C2\u6570\u7684\u63CF\u8FF0\uFF1A\u53EA\u5728\u4E0D\u62A5\u6458\u8981\u65F6\u51FA\u73B0\u3002 */\nconst MESSAGE_PARAMETER = {\n type: 'string',\n required: true,\n description: \"The details behind the title, without repeating it: a short paragraph plus a few bullet points of light Markdown, in the user's language, under 1000 characters.\",\n} as const;\n\n/** \u5DE5\u5177\u8F93\u51FA\uFF1A\u4E24\u79CD\u6A21\u5F0F\u5171\u7528\u3002 */\nconst OUTPUT = {\n schema: {\n type: 'object' as const,\n additionalProperties: false,\n properties: {\n ok: {\n type: 'boolean' as const,\n description: 'Whether the update was recorded.',\n },\n },\n },\n render: () => [{ type: 'text' as const, text: 'Update shown in the conversation.' }],\n // \u539F\u751F\u8C03\u7528\u7A97\u53E3\u622A\u65AD\u540E\u5361\u7247\u4ECD\u80FD\u753B\uFF1BPTC \u4E0B\u5185\u6838\u628A\u540C\u4E00\u4EFD meta \u5199\u8FDB tool/ptc-dispatch\u3002\n presentationMeta: (args: unknown) => {\n const update = parseUpdate(args);\n const meta: Record<string, string> = { message: update?.message ?? '' };\n if (update?.title !== undefined) meta['title'] = update.title;\n return meta;\n },\n};\n\n/** \u6B63\u5E38\u6A21\u5F0F\u7684\u5DE5\u5177\u63CF\u8FF0\u3002 */\nconst DETAILED_DESCRIPTION = 'Send the user a short progress update without ending your turn. Use it when you have been working through several tool calls, when you finish a stage or change direction, or when you find something the user should know before you finish. Do not use it for the final answer: findings that belong in the reply still go in the reply.';\n\n/** \u53EA\u62A5\u6458\u8981\u65F6\u7684\u5DE5\u5177\u63CF\u8FF0\uFF1A\u53EA\u8981\u4E00\u884C\u6807\u9898\u3002 */\nconst SUMMARY_ONLY_DESCRIPTION = 'Send the user a one-line progress update without ending your turn. Use it when you have been working through several tool calls, when you finish a stage or change direction, or when you find something the user should know before you finish. Write only the title: one line the user can take in at a glance. Do not use it for the final answer: findings that belong in the reply still go in the reply.';\n\n/**\n * \u9020\u4E00\u4EFD `notify_user` \u5B9A\u4E49\u3002\n * @param summaryOnly - \u53EA\u62A5\u6458\u8981\u65F6\u53C2\u6570\u53EA\u5269\u6807\u9898\u3001\u63CF\u8FF0\u53EA\u8981\u6C42\u4E00\u884C\u3002\n * @returns \u8FD9\u4E00\u6B21\u6CE8\u518C\u7528\u7684\u5DE5\u5177\u5B9A\u4E49\u3002\n */\nfunction notifyTool(summaryOnly: boolean): ToolDefinition {\n return defineTool({\n name: NOTIFY_TOOL_NAME,\n description: summaryOnly ? SUMMARY_ONLY_DESCRIPTION : DETAILED_DESCRIPTION,\n parameters: summaryOnly\n ? { title: { ...TITLE_PARAMETER, required: true } }\n : { title: TITLE_PARAMETER, message: MESSAGE_PARAMETER },\n output: OUTPUT,\n isConcurrencySafe: () => true,\n async execute() {\n return { ok: true };\n },\n });\n}\n\n/**\n * \u63D2\u4EF6\u672C\u4F53\u3002\n * @param ctx - \u5BBF\u4E3B\u63D2\u4EF6\u4E0A\u4E0B\u6587\uFF08`tools` \u7531 inject \u58F0\u660E\uFF09\u3002\n * @param config - \u672C\u884C\u7684\u914D\u7F6E\uFF1B\u9608\u503C\u6BCF\u6B21\u73B0\u8BFB\uFF0C\u6539\u914D\u7F6E\u4E0D\u91CD\u6302\u63D2\u4EF6\u3002\n */\nexport function apply(ctx: Context, config: PluginConfig): void {\n /** \u8FD9\u4E2A\u4F1A\u8BDD\u662F\u5426\u5F00\u542F\u4E3B\u52A8\u6C47\u62A5\uFF1B\u50AC\u529E\u4E0E\u5DE5\u5177\u53EF\u7528\u6027\u95EE\u7684\u662F\u540C\u4E00\u4E2A\u95EE\u9898\u3002 */\n const enabledIn = (session: Session): boolean => !isSubagentSession(session) && isEnabledFor(config, session.header.id);\n\n const controller = createNudgeController({\n readThreshold: () => nudgeAfterOf(config),\n readProseResets: () => config.resetOnProse.get(),\n readSummaryOnly: () => config.summaryOnly.get(),\n readEnabled: enabledIn,\n });\n installNudge(ctx, controller, NOTIFY_TOOL_NAME);\n\n // \u50AC\u529E\u9608\u503C\u53EA\u63A7\u5236\u6CE8\u5165\u63D0\u9192\uFF1B\u5DE5\u5177\u53EA\u53D7\u4F1A\u8BDD\u5F00\u5173\u9650\u5236\u3002\n const registry = new AgentToolRegistry();\n let disposeTool = registry.register(notifyTool(config.summaryOnly.get()));\n ctx.effect(() => () => disposeTool());\n ctx.tools.include(registry);\n const sync = (agent: Agent): void => registry.set(agent, enabledIn(agent.session) ? [NOTIFY_TOOL_NAME] : []);\n const syncAll = (): void => { for (const agent of ctx.agents.list()) sync(agent); };\n ctx.on('agent/created', ({ agent }) => { sync(agent); });\n syncAll();\n\n // \u53EA\u62A5\u6458\u8981\u53EA\u6539\u5DE5\u5177\u9762\uFF0C\u4E0D\u91CD\u6302\u63D2\u4EF6\uFF1A\u914D\u7F6E\u5408\u5E76\u8FDB\u6765\u540E\u6362\u4E00\u4EFD\u5B9A\u4E49\u3002\n ctx.on('loader/volatile-update', (paths) => {\n if (paths.some(path => path[0] === SUMMARY_ONLY_FIELD)) {\n disposeTool();\n disposeTool = registry.register(notifyTool(config.summaryOnly.get()));\n }\n if (paths.some(path => path[0] === 'defaultEnabled' || path[0] === 'sessionOverrides')) syncAll();\n });\n\n // \u914D\u7F6E\u754C\u9762\u5728\u63D2\u4EF6\u9875\u7684\u5361\u7247\u4E0A\uFF0C\u5173\u6389\u5185\u6838\u6309 Config schema \u81EA\u52A8\u751F\u6210\u7684\u90A3\u4EFD\u8BBE\u7F6E\u9875\u3002\n // \u8D70\u53EF\u9009\u6CE8\u5165\uFF1A\u6CA1\u6709 settings \u670D\u52A1\u7684\u7EC4\u5408\u7167\u5E38\u52A0\u8F7D\uFF0C\u53EA\u662F\u5C11\u4E00\u6761\u7B56\u7565\u3002\n ctx.inject(['settings'], (scoped) => {\n scoped.effect(() => scoped.settings.configure({ auto: false }, ctx.fiber));\n });\n}\n", "import z from '@deepseek-ai/schemastery';\nimport type { Volatile } from '@deepseek-ai/cordis';\nimport {\n CARD_PLACEMENTS,\n DEFAULT_BODY_EXPANDED_BY_DEFAULT,\n DEFAULT_CARD_PLACEMENT,\n DEFAULT_COLLAPSIBLE,\n DEFAULT_ENABLED,\n DEFAULT_NUDGE_AFTER,\n DEFAULT_RESET_ON_PROSE,\n DEFAULT_SHOW_TIME,\n DEFAULT_SUMMARY_ONLY,\n DEFAULT_SUMMARY_RENDER,\n MAX_NUDGE_AFTER,\n SUMMARY_RENDERS,\n enabledFor,\n type SessionOverrides,\n} from './shared/config.js';\n\n/** \u5BBF\u4E3B\u62FF\u5230\u7684\u914D\u7F6E\uFF1A`.volatile()` \u7684\u5B57\u6BB5\u662F\u7A33\u5B9A\u5F15\u7528\uFF0C\u8BFB\u5F53\u524D\u503C\u8981 `.get()`\u3002 */\nexport interface PluginConfig {\n nudgeAfter: Volatile<number>;\n resetOnProse: Volatile<boolean>;\n collapsible: Volatile<boolean>;\n summaryOnly: Volatile<boolean>;\n summaryRender: Volatile<string>;\n bodyExpandedByDefault: Volatile<boolean>;\n showTime: Volatile<boolean>;\n cardPlacement: Volatile<string>;\n defaultEnabled: Volatile<boolean>;\n sessionOverrides: Volatile<SessionOverrides>;\n}\n\n/** \u914D\u7F6E\u5F62\u72B6\uFF1Bvolatile \u8BA9\u6539\u914D\u7F6E\u4E0D\u91CD\u6302\u8FD9\u6761 loader entry\uFF0C\u5F53\u524D\u4F1A\u8BDD\u4E0B\u4E00\u6B65\u5C31\u7528\u65B0\u503C\u3002 */\nexport const Config = z.object({\n nudgeAfter: z.number().min(0).max(MAX_NUDGE_AFTER).default(DEFAULT_NUDGE_AFTER).volatile(),\n resetOnProse: z.boolean().default(DEFAULT_RESET_ON_PROSE).volatile(),\n collapsible: z.boolean().default(DEFAULT_COLLAPSIBLE).volatile(),\n summaryOnly: z.boolean().default(DEFAULT_SUMMARY_ONLY).volatile(),\n summaryRender: z.union(SUMMARY_RENDERS.map(value => z.const(value)))\n .default(DEFAULT_SUMMARY_RENDER)\n .volatile(),\n bodyExpandedByDefault: z.boolean().default(DEFAULT_BODY_EXPANDED_BY_DEFAULT).volatile(),\n showTime: z.boolean().default(DEFAULT_SHOW_TIME).volatile(),\n cardPlacement: z.union(CARD_PLACEMENTS.map(value => z.const(value)))\n .default(DEFAULT_CARD_PLACEMENT)\n .volatile(),\n defaultEnabled: z.boolean().default(DEFAULT_ENABLED).volatile(),\n sessionOverrides: z.dict(z.boolean()).default({}).volatile(),\n});\n\n/**\n * \u8BFB\u5F53\u524D\u9608\u503C\u3002\n * @param config - \u672C\u884C\u7684\u914D\u7F6E\u3002\n * @returns 0 \u8868\u793A\u5173\u95ED\u50AC\u529E\uFF1B\u975E\u6709\u9650\u503C\u6309\u9ED8\u8BA4\u7B97\u3002\n */\nexport function nudgeAfterOf(config: PluginConfig): number {\n const value = config.nudgeAfter.get();\n if (!Number.isFinite(value)) return DEFAULT_NUDGE_AFTER;\n return Math.min(MAX_NUDGE_AFTER, Math.max(0, Math.floor(value)));\n}\n\n/**\n * \u8BFB\u4E00\u4E2A\u4F1A\u8BDD\u662F\u5426\u5F00\u542F\u4E3B\u52A8\u6C47\u62A5\u3002\n * @param config - \u672C\u884C\u7684\u914D\u7F6E\u3002\n * @param sessionId - \u4F1A\u8BDD id\u3002\n * @returns \u4F1A\u8BDD\u6709\u81EA\u5DF1\u7684\u9009\u62E9\u5C31\u7528\u5B83\uFF0C\u5426\u5219\u7528\u914D\u7F6E\u91CC\u7684\u9ED8\u8BA4\u503C\u3002\n */\nexport function isEnabledFor(config: PluginConfig, sessionId: string): boolean {\n return enabledFor(config.sessionOverrides.get(), config.defaultEnabled.get(), sessionId);\n}\n", "/**\n * \u5BBF\u4E3B\u4E0E\u6D4F\u89C8\u5668\u4E24\u534A\u8FB9\u5171\u7528\u7684\u914D\u7F6E\u5B57\u9762\u91CF\uFF1A\u6539\u4E00\u5904\u4E24\u8FB9\u4E00\u8D77\u8D70\uFF0C\u907F\u514D\u300C\u4E24\u5904\u5404\u5199\u4E00\u4EFD\u300D\u3002\n * \u8FD9\u91CC\u53EA\u653E\u7EAF\u503C\uFF0C\u4E0D\u78B0 schemastery \u4E0E cordis\uFF0C\u6D4F\u89C8\u5668 bundle \u53EF\u4EE5\u76F4\u63A5\u5185\u8054\u3002\n */\n\n/** \u672C\u63D2\u4EF6\u5728 profile \u91CC\u7684 loader \u884C id\uFF0C\u4E5F\u662F\u8BBE\u7F6E\u7684\u547D\u540D\u7A7A\u95F4\u3002 */\nexport const SETTINGS_NAMESPACE = 'dsh-notify-user';\n\n/** \u6C47\u62A5\u5DE5\u5177\u7684\u540D\u5B57\uFF1A\u5BBF\u4E3B\u6CE8\u518C\u3001\u5BA2\u6237\u7AEF\u8BA4\u9886\u3001\u50AC\u529E\u6E05\u96F6\u90FD\u7528\u8FD9\u4E00\u4E2A\u5B57\u9762\u91CF\u3002 */\nexport const NOTIFY_TOOL_NAME = 'notify_user';\n\n/** \u50AC\u529E\u9608\u503C\uFF1A\u8FDE\u7EED\u591A\u5C11\u6B21\u6839\u5DE5\u5177\u8C03\u7528\u6CA1\u6709\u6C47\u62A5\u65F6\u50AC\u4E00\u6B21\u3002 */\nexport const DEFAULT_NUDGE_AFTER = 10;\n\n/** \u9608\u503C\u4E0A\u9650\uFF1B0 \u662F\u5173\u95ED\u50AC\u529E\uFF0C\u5176\u4F59\u6309\u6B21\u6570\u7B97\u3002 */\nexport const MAX_NUDGE_AFTER = 100;\n\n/** \u52A9\u624B\u6D88\u606F\u91CC\u7684\u6563\u6587\u56DE\u590D\u7B97\u4E0D\u7B97\u4E00\u6B21\u6C47\u62A5\uFF1A\u9ED8\u8BA4\u7B97\u3002 */\nexport const DEFAULT_RESET_ON_PROSE = true;\n\n/** \u8FDB\u5EA6\u5361\u9ED8\u8BA4\u5E26\u6298\u53E0\u6309\u94AE\u3002 */\nexport const DEFAULT_COLLAPSIBLE = true;\n\n/** \u6A21\u578B\u53EA\u5199\u4E00\u884C\u6807\u9898\u3001\u5361\u7247\u53EA\u753B\u6807\u9898\u884C\uFF1A\u9ED8\u8BA4\u5173\uFF0C\u6A21\u578B\u5199\u6807\u9898\u4E0E\u6B63\u6587\u3002 */\nexport const DEFAULT_SUMMARY_ONLY = false;\n\n/** \u7ED3\u6784\u5316\u6B63\u6587\u6A21\u5F0F\u4E0B\u5361\u7247\u662F\u5426\u9ED8\u8BA4\u5C55\u5F00\uFF1A\u9ED8\u8BA4\u5173\uFF0C\u70B9\u6807\u9898\u5C55\u5F00\u3002 */\nexport const DEFAULT_BODY_EXPANDED_BY_DEFAULT = false;\n\n/** \u6807\u9898\u884C\u53F3\u4FA7\u7684\u6C47\u62A5\u65F6\u95F4\uFF1A\u9ED8\u8BA4\u4E0D\u663E\u793A\uFF0C\u6807\u9898\u884C\u53EA\u7559\u5706\u70B9\u4E0E\u6807\u9898\u3002 */\nexport const DEFAULT_SHOW_TIME = false;\n\n/** \u914D\u7F6E\u91CC\u300C\u53EA\u62A5\u6458\u8981\u300D\u7684\u5B57\u6BB5\u540D\uFF1A\u5BBF\u4E3B\u91CD\u6CE8\u518C\u5DE5\u5177\u65F6\u6309\u5B83\u8BA4\u8DEF\u5F84\u3002 */\nexport const SUMMARY_ONLY_FIELD = 'summaryOnly';\n\n/** \u53EA\u62A5\u6458\u8981\u65F6\u7684\u5448\u73B0\u65B9\u5F0F\uFF1A\u8FDB\u5EA6\u5361\uFF0C\u6216\u6309\u666E\u901A\u6BB5\u843D\u6E32\u67D3\u3002 */\nexport const SUMMARY_RENDERS = ['card', 'prose'] as const;\n\n/** \u53EA\u62A5\u6458\u8981\u65F6\u9ED8\u8BA4\u4ECD\u753B\u8FDB\u5EA6\u5361\u3002 */\nexport const DEFAULT_SUMMARY_RENDER = 'card';\n\n/** \u6458\u8981\u5448\u73B0\u65B9\u5F0F\u3002 */\nexport type SummaryRender = typeof SUMMARY_RENDERS[number];\n\n/** \u8FDB\u5EA6\u5361\u5728\u5BF9\u8BDD\u6D41\u91CC\u7684\u4F4D\u7F6E\uFF1A\u6B65\u9AA4\u7EC4\u8FB9\u754C\uFF0C\u6216\u8DDF\u968F\u5DE5\u5177\u884C\u3002 */\nexport const CARD_PLACEMENTS = ['boundary', 'inline'] as const;\n\n/** \u8FDB\u5EA6\u5361\u4F4D\u7F6E\u3002 */\nexport type CardPlacement = typeof CARD_PLACEMENTS[number];\n\n/** \u9ED8\u8BA4\u628A\u8FDB\u5EA6\u5361\u653E\u5728\u6B65\u9AA4\u7EC4\u8FB9\u754C\u3002 */\nexport const DEFAULT_CARD_PLACEMENT: CardPlacement = 'boundary';\n\n/** \u4F1A\u8BDD\u6CA1\u6709\u81EA\u5DF1\u7684\u9009\u62E9\u65F6\uFF0C\u4E3B\u52A8\u6C47\u62A5\u9ED8\u8BA4\u5F00\u7740\u3002 */\nexport const DEFAULT_ENABLED = true;\n\n/**\n * \u6309\u4F1A\u8BDD\u7684\u9009\u62E9\uFF1A\u53EA\u8BB0\u4E0E\u9ED8\u8BA4\u503C\u4E0D\u540C\u7684\u90A3\u4E9B\u4F1A\u8BDD\uFF0C\u7F3A\u4E00\u6761\u8868\u793A\u8DDF\u968F\u9ED8\u8BA4\u503C\u3002\n * \u952E\u662F\u4F1A\u8BDD id\uFF0C\u503C\u662F\u90A3\u4E2A\u4F1A\u8BDD\u5F00\u5173\u7684\u843D\u5B9A\u503C\u3002\n */\nexport type SessionOverrides = Readonly<Record<string, boolean>>;\n\n/**\n * \u4E00\u4E2A\u4F1A\u8BDD\u662F\u5426\u5F00\u542F\u4E3B\u52A8\u6C47\u62A5\uFF1A\u4F1A\u8BDD\u6709\u81EA\u5DF1\u7684\u9009\u62E9\u5C31\u7528\u5B83\uFF0C\u5426\u5219\u7528\u9ED8\u8BA4\u503C\u3002\n * @param overrides - \u6309\u4F1A\u8BDD\u7684\u9009\u62E9\u3002\n * @param fallback - \u4F1A\u8BDD\u6CA1\u6709\u81EA\u5DF1\u7684\u9009\u62E9\u65F6\u7528\u7684\u9ED8\u8BA4\u503C\u3002\n * @param sessionId - \u4F1A\u8BDD id\u3002\n * @returns \u8FD9\u4E2A\u4F1A\u8BDD\u662F\u5426\u5F00\u542F\u4E3B\u52A8\u6C47\u62A5\u3002\n */\nexport function enabledFor(\n overrides: SessionOverrides | undefined,\n fallback: boolean,\n sessionId: string,\n): boolean {\n const explicit = overrides?.[sessionId];\n return typeof explicit === 'boolean' ? explicit : fallback;\n}\n\n/**\n * \u7B97\u51FA\u5199\u5165\u4E00\u4E2A\u4F1A\u8BDD\u7684\u9009\u62E9\u4E4B\u540E\u7684\u90A3\u4EFD\u5B57\u5178\u3002\n *\n * \u5207\u56DE\u9ED8\u8BA4\u503C\u5C31\u5220\u6389\u90A3\u6761\uFF1A\u5B57\u5178\u91CC\u53EA\u7559\u4E0E\u9ED8\u8BA4\u503C\u4E0D\u540C\u7684\u4F1A\u8BDD\uFF0C\u914D\u7F6E\u4E0D\u4F1A\u968F\u4F1A\u8BDD\u6570\u4E00\u76F4\u957F\u3002\n * @param overrides - \u5F53\u524D\u7684\u9009\u62E9\u3002\n * @param sessionId - \u6539\u7684\u662F\u54EA\u4E2A\u4F1A\u8BDD\u3002\n * @param enabled - \u8FD9\u4E2A\u4F1A\u8BDD\u6539\u6210\u5F00\u8FD8\u662F\u5173\u3002\n * @param fallback - \u9ED8\u8BA4\u503C\uFF1B\u6539\u6210\u7684\u503C\u4E0E\u5B83\u76F8\u540C\u65F6\u4E0D\u7559\u8BB0\u5F55\u3002\n * @returns \u65B0\u7684\u9009\u62E9\uFF1B\u6CA1\u6709\u53D8\u5316\u65F6\u8FD4\u56DE\u540C\u4E00\u4E2A\u5BF9\u8C61\uFF0C\u8C03\u7528\u65B9\u636E\u6B64\u8DF3\u8FC7\u5199\u5165\u3002\n */\nexport function overridesAfterWrite(\n overrides: SessionOverrides | undefined,\n sessionId: string,\n enabled: boolean,\n fallback: boolean,\n): SessionOverrides {\n const current = overrides ?? {};\n const hasEntry = Object.hasOwn(current, sessionId);\n if (enabled === fallback) {\n if (!hasEntry) return current;\n const next = { ...current };\n delete next[sessionId];\n return next;\n }\n if (hasEntry && current[sessionId] === enabled) return current;\n return { ...current, [sessionId]: enabled };\n}\n", "import { createUserMessage } from '@deepseek-ai/dsh-llm';\nimport type { ContentBlock, ContextFormed } from '@deepseek-ai/dsh-llm';\nimport type { PreStepDecision } from '@deepseek-ai/dsh-agent';\nimport type { Session, UserMessage } from '@deepseek-ai/dsh-session';\nimport type { ToolExecution, ToolExecutionResult } from '@deepseek-ai/dsh-tools';\nimport type { Context } from '@deepseek-ai/cordis';\n\n/**\n * \u50AC\u529E\uFF1A\u6A21\u578B\u8FDE\u7EED\u591A\u6B21\u6839\u5DE5\u5177\u8C03\u7528\u6CA1\u6709\u6C47\u62A5\u65F6\uFF0C\u5728\u4E0B\u4E00\u6B65\u4E4B\u524D\u6CE8\u5165\u4E00\u6761\u63D0\u9192\u3002\n *\n * \u8BA1\u6570\u5355\u4F4D\u662F**\u6839\u8C03\u7528**\uFF1A\u539F\u751F\u6A21\u5F0F\u4E0B\u6BCF\u6B21\u6A21\u578B\u76F4\u63A5\u53D1\u8D77\u7684\u8C03\u7528\u5404\u7B97\u4E00\u6B21\uFF0CPTC \u6A21\u5F0F\u4E0B\n * \u53EA\u6709 `run_code` \u5404\u7B97\u4E00\u6B21\uFF0C\u7A0B\u5E8F\u5185\u90E8\u7684\u5B50\u8C03\u7528\u4E0D\u7B97\u2014\u2014\u4E00\u4E2A\u7A0B\u5E8F\u91CC\u7684\u51E0\u5341\u4E2A\u5B50\u8C03\u7528\u662F\n * \u540C\u4E00\u4E2A\u6A21\u578B\u52A8\u4F5C\uFF0C\u7B97\u8FDB\u53BB\u4F1A\u8BA9\u50AC\u529E\u5728\u4E00\u4E2A\u7A0B\u5E8F\u4E4B\u540E\u5C31\u89E6\u53D1\u3002\n *\n * \u6E05\u96F6\u6709\u56DB\u6761\u8DEF\uFF0C\u8BA1\u6570\u952E\u90FD\u662F**\u4F1A\u8BDD**\uFF08`agent.session`\uFF09\uFF1A\n * `notify_user` \u6210\u529F\u65F6\u6E05\u96F6\uFF0C\u65E0\u8BBA\u662F\u6839\u8C03\u7528\u8FD8\u662F PTC \u5B50\u8C03\u7528\uFF0C\u4E0E\u8BA1\u6570\u5355\u4F4D\u65E0\u5173\uFF1B\u52A9\u624B\u6D88\u606F\u91CC\u5199\u4E86\n * \u6563\u6587\u6B63\u6587\u4E5F\u6E05\u96F6\uFF08\u5F00\u5173\u89C1 `resetOnProse`\uFF09\uFF1B\u65B0\u56DE\u5408\uFF08`step === 1`\uFF09\u6216\u7528\u6237\u63D2\u8BDD\u4E5F\u6E05\u96F6\n * \u2014\u2014\u56DE\u5408\u8FB9\u754C\u53D6\u5BBF\u4E3B\u7ED9\u7684 `step`\uFF0C\u4E0D\u6309\u6D88\u606F\u6765\u6E90\u679A\u4E3E\u3002\n *\n * \u4F1A\u8BDD\u5173\u6389\u4E3B\u52A8\u6C47\u62A5\u65F6\uFF08`readEnabled` \u4E3A\u5047\uFF09\u4E0D\u50AC\uFF0C\u8BA1\u6570\u4E5F\u4E00\u5E76\u6E05\u96F6\uFF1A\u91CD\u65B0\u6253\u5F00\u65F6\u4ECE\u96F6\n * \u5F00\u59CB\u7B97\uFF0C\u4E0D\u4F1A\u4E00\u5F00\u5C31\u50AC\u3002\n *\n * \u6CE8\u5165\u8D70 `agent/pre-step` \u7684 `enter.messages`\uFF1A\u6D88\u606F\u843D\u8FDB\u8BE5\u6B65\u7684 user \u6279\u6B21\u5E76\u88AB\u65E5\u5FD7\n * \u8BB0\u5F55\uFF0C\u6765\u6E90\u4E0D\u662F `user`\uFF0C\u6240\u4EE5\u5BF9\u8BDD\u6D41\u91CC\u753B\u6210\u4E00\u884C context \u800C\u4E0D\u662F\u7528\u6237\u53D1\u8A00\u3002\n */\n\ndeclare module '@deepseek-ai/dsh-llm' {\n interface MessageSourceMap {\n 'notify-user-nudge': { kind: 'notify-user-nudge' } & ContextFormed;\n }\n}\n\n/** \u6CE8\u5165\u6D88\u606F\u7684\u6765\u6E90\u6807\u8BB0\uFF1B`form: 'notice'` \u8BA9\u5B83\u5728\u5BF9\u8BDD\u6D41\u91CC\u53EA\u5360\u4E00\u884C\u3002 */\nconst NUDGE_SOURCE = { kind: 'notify-user-nudge' } as const;\n\n/**\n * \u50AC\u529E\u6B63\u6587\uFF1A\u53EA\u7ED9\u6307\u4EE4\uFF0C\u4E0D\u66FF\u6A21\u578B\u5199\u66F4\u65B0\u3002\n * @param count - \u8DDD\u4E0A\u6B21\u6C47\u62A5\u7684\u6839\u5DE5\u5177\u8C03\u7528\u6B21\u6570\u3002\n * @param summaryOnly - \u53EA\u62A5\u6458\u8981\u65F6\u53EA\u8981\u6C42\u4E00\u884C\u6807\u9898\uFF0C\u4E0D\u518D\u8981\u7ED3\u6784\u5316\u6B63\u6587\u3002\n * @returns \u6CE8\u5165\u7ED9\u6A21\u578B\u7684\u90A3\u6BB5\u8BDD\u3002\n */\nexport function renderNudge(count: number, summaryOnly = false): string {\n const head = `You have gone ${String(count)} tool calls without a notify_user update \u2014 the user has seen no progress from you since. `;\n if (summaryOnly) {\n return head + 'Send one now: a one-line title with what you have concluded so far, batched with your next tool calls.';\n }\n return head\n + 'Send one now: a one-line title with what you have concluded so far, and a structured, chat-style message '\n + '(a well structured paragraph with a few bullet points, under ~1000 characters) with the details and what you will do next, '\n + 'batched with your next tool calls.';\n}\n\n/**\n * \u4E00\u6761\u52A9\u624B\u6D88\u606F\u91CC\u6709\u6CA1\u6709\u6563\u6587\u3002\n *\n * \u53EA\u8BA4\u975E\u7A7A\u767D\u7684 `text` \u5757\uFF1A`reasoning` \u662F\u601D\u8003\u8FC7\u7A0B\uFF0C\u4E0D\u4E0A\u5C4F\uFF0C\u4E0D\u7B97\u6C47\u62A5\u3002\n * @param content - \u52A9\u624B\u6D88\u606F\u7684\u5185\u5BB9\u5757\u3002\n * @returns \u6709\u53EF\u89C1\u6B63\u6587\u65F6\u4E3A\u771F\u3002\n */\nexport function hasProse(content: readonly ContentBlock[]): boolean {\n return content.some(block => block.type === 'text' && block.text.trim() !== '');\n}\n\n/** \u4E00\u884C\u6458\u8981\uFF1Acontext \u884C\u6298\u53E0\u65F6\u663E\u793A\u7684\u90A3\u53E5\u3002 */\nexport function nudgeSummary(count: number): string {\n return `${String(count)} tool calls without a notify_user update`;\n}\n\n/** \u6BCF\u4E2A\u4F1A\u8BDD\u7684\u50AC\u529E\u72B6\u6001\u673A\uFF1B\u7EAF\u5185\u5B58\uFF0C\u4E0D\u78B0 cordis\u3002 */\nexport interface NudgeController {\n /** \u6A21\u578B\u6C47\u62A5\u8FC7\u4E86\uFF1A\u6E05\u96F6\u3002 */\n notify(session: Session): void;\n /** \u6A21\u578B\u5199\u4E86\u4E00\u6BB5\u6563\u6587\u56DE\u590D\uFF1A\u5F00\u5173\u6253\u5F00\u65F6\u6E05\u96F6\u3002 */\n prose(session: Session): void;\n /** \u4E00\u6B21\u6839\u5DE5\u5177\u8C03\u7528\uFF1A\u8BA1\u6570 +1\u3002 */\n toolCall(session: Session): void;\n /**\n * \u4E00\u6B65\u5F00\u59CB\u524D\u95EE\u4E00\u6B21\u8981\u4E0D\u8981\u50AC\u3002\n * @param session - \u8FD9\u4E00\u6B65\u6240\u5C5E\u7684\u4F1A\u8BDD\u3002\n * @param freshInput - \u8FD9\u4E00\u6B65\u662F\u5426\u91CD\u65B0\u8BA1\u65F6\uFF1A\u65B0\u56DE\u5408\u7684\u7B2C\u4E00\u6B65\uFF0C\u6216\u6536\u4EF6\u7BB1\u91CC\u6709\u7528\u6237\u63D2\u8BDD\u3002\n * @returns \u8981\u6CE8\u5165\u7684\u6D88\u606F\uFF1B\u4E0D\u50AC\u65F6 `null`\u3002\n */\n step(session: Session, freshInput: boolean): UserMessage | null;\n}\n\n/** \u9020\u4E00\u4E2A\u50AC\u529E\u72B6\u6001\u673A\u8981\u73B0\u8BFB\u7684\u4E09\u4EF6\u4E8B\u3002 */\nexport interface NudgeOptions {\n /** \u73B0\u8BFB\u9608\u503C\uFF1B0 \u8868\u793A\u5173\u95ED\u3002 */\n readThreshold: () => number;\n /** \u73B0\u8BFB\u300C\u6563\u6587\u56DE\u590D\u7B97\u4E0D\u7B97\u6C47\u62A5\u300D\u3002 */\n readProseResets: () => boolean;\n /** \u73B0\u8BFB\u300C\u53EA\u62A5\u6458\u8981\u300D\uFF1A\u50AC\u529E\u6587\u6848\u8DDF\u7740\u53D8\u3002 */\n readSummaryOnly: () => boolean;\n /** \u73B0\u8BFB\u8FD9\u4E2A\u4F1A\u8BDD\u662F\u5426\u5F00\u542F\u4E3B\u52A8\u6C47\u62A5\u3002 */\n readEnabled: (session: Session) => boolean;\n}\n\n/**\n * \u9020\u4E00\u4E2A\u50AC\u529E\u72B6\u6001\u673A\u3002\n * @param options - \u9608\u503C\u4E0E\u6563\u6587\u5F00\u5173\u7684\u73B0\u8BFB\u51FD\u6570\u3002\n * @returns \u72B6\u6001\u673A\u3002\n */\nexport function createNudgeController(options: NudgeOptions): NudgeController {\n const counts = new WeakMap<Session, number>();\n\n return {\n notify(session) {\n counts.set(session, 0);\n },\n prose(session) {\n if (!options.readProseResets()) return;\n counts.set(session, 0);\n },\n toolCall(session) {\n if (!options.readEnabled(session) || options.readThreshold() <= 0) {\n counts.delete(session);\n return;\n }\n counts.set(session, (counts.get(session) ?? 0) + 1);\n },\n step(session, freshInput) {\n // \u5173\u6389\u7684\u4F1A\u8BDD\u4E0D\u50AC\uFF0C\u4E5F\u4E0D\u7559\u8BA1\u6570\uFF1A\u91CD\u65B0\u6253\u5F00\u65F6\u4ECE\u96F6\u5F00\u59CB\uFF0C\u4E0D\u4F1A\u4E00\u5F00\u5C31\u50AC\u3002\n if (!options.readEnabled(session)) {\n counts.set(session, 0);\n return null;\n }\n const threshold = options.readThreshold();\n if (freshInput || threshold <= 0) {\n counts.set(session, 0);\n return null;\n }\n const count = counts.get(session) ?? 0;\n if (count < threshold) return null;\n counts.set(session, 0);\n return createUserMessage({\n content: [{ type: 'text', text: renderNudge(count, options.readSummaryOnly()) }],\n source: { ...NUDGE_SOURCE, form: 'notice', summary: nudgeSummary(count) },\n });\n },\n };\n}\n\n/**\n * \u5224\u65AD\u4E00\u4E2A\u4F1A\u8BDD\u662F\u4E0D\u662F\u5B50\u4EE3\u7406\u7684\u3002\n * @param session - \u5F85\u5224\u5B9A\u7684\u4F1A\u8BDD\u3002\n * @returns \u5B50\u4EE3\u7406\u4F1A\u8BDD\u4E3A\u771F\u3002\n */\nexport function isSubagentSession(session: Session): boolean {\n return session.header.origin === 'subagent';\n}\n\n/**\n * \u628A\u72B6\u6001\u673A\u63A5\u5230\u5BBF\u4E3B\u7684\u4E09\u6761\u4E8B\u4EF6\u4E0A\u3002\n *\n * `tools/result` \u662F\u7EAF\u89C2\u5BDF\u4E8B\u4EF6\uFF08\u65E0 `next`\uFF09\uFF0C\u53EA\u5728\u7ED3\u679C\u843D\u5B9A\u540E\u8BFB\u4E00\u6B21\uFF1A\u6210\u529F\u7684 `notify_user` \u6E05\u96F6\uFF0C\n * \u5176\u4F59**\u6839\u8C03\u7528**\u8BA1\u6570\u3002\u6D3E\u53D1\u524D\u5C31\u88AB\u53D6\u6D88\u7684\u8C03\u7528\uFF08`ABORTED_BEFORE_DISPATCH`\uFF09\u6CA1\u771F\u6B63\u6267\u884C\uFF0C\n * \u4E0E\u65E7\u53E3\u5F84\u4E00\u81F4\u3001\u4E0D\u8BA1\u6570\u3002\n * `session/event` \u662F\u843D\u76D8\u540E\u7684 append \u5E7F\u64AD\uFF1A`assistant/message` \u5E26\u975E\u7A7A\u767D\u6B63\u6587\u65F6\u6E05\u96F6\u3002\n * \u5931\u8D25\u3001\u91CD\u8BD5\u3001\u53D6\u6D88\u7684\u5C1D\u8BD5\u843D\u6210 `assistant/attempt`\uFF0C\u7528\u6237\u770B\u4E0D\u5230\uFF0C\u4E0D\u6E05\u96F6\u3002\n * `agent/pre-step` \u5728\u59D4\u6258\u4E0B\u6E38\u4E4B\u540E\uFF0C\u53EA\u5F80 `enter` \u51B3\u7B56\u7684\u6D88\u606F\u5217\u8868\u672B\u5C3E\u8FFD\u52A0\u4E00\u6761\uFF1B\n * \u65B0\u56DE\u5408\u4E0E\u7528\u6237\u63D2\u8BDD\u5728\u8FD9\u91CC\u6E05\u96F6\u3002\n * @param ctx - \u5BBF\u4E3B\u63D2\u4EF6\u4E0A\u4E0B\u6587\u3002\n * @param controller - \u50AC\u529E\u72B6\u6001\u673A\u3002\n * @param toolName - \u6C47\u62A5\u5DE5\u5177\u7684\u540D\u5B57\uFF1B\u7ED3\u679C\u4E8B\u4EF6\u91CC\u786E\u8BA4\u6210\u529F\u65F6\u6E05\u96F6\u3002\n */\nexport function installNudge(ctx: Context, controller: NudgeController, toolName: string): void {\n ctx.on('tools/result', (exec: Readonly<ToolExecution>, result: Readonly<ToolExecutionResult>): undefined => {\n // \u53D6\u6D88\u53D1\u751F\u5728\u6D3E\u53D1\u524D\uFF1A\u8FD9\u6B21\u8C03\u7528\u6CA1\u6709\u771F\u6B63\u6267\u884C\uFF0C\u4E0D\u5F53\u4F5C\u4E00\u6B21\u300C\u6CA1\u6C47\u62A5\u7684\u5DE5\u5177\u8C03\u7528\u300D\u3002\n if (result.isError && result.error.info?.code === 'ABORTED_BEFORE_DISPATCH') return undefined;\n const session = exec.agent?.session;\n if (session !== undefined && !isSubagentSession(session)) {\n if (exec.name === toolName && !result.isError) controller.notify(session);\n else if (exec.parent === undefined) controller.toolCall(session);\n }\n return undefined;\n });\n\n ctx.on('session/event', (session, event): void => {\n if (isSubagentSession(session)) return;\n if (event.type !== 'assistant/message') return;\n if (!hasProse(event.data.message.content)) return;\n controller.prose(session);\n });\n\n ctx.on('agent/pre-step', async ({ agent, messages, step }, next): Promise<PreStepDecision> => {\n if (isSubagentSession(agent.session)) return next();\n const downstream = await next();\n // \u53EA\u5728\u771F\u6B63\u8FDB\u5165\u8FD9\u4E00\u6B65\u4E4B\u540E\u624D\u52A8\u72B6\u6001\u673A\uFF1A\u4E0B\u6E38 reject \u65F6\u8FD9\u4E00\u6B65\u4E0D\u6210\u7ACB\uFF0C\n // \u5148\u6E05\u96F6\u4F1A\u628A\u8FD9\u6B21\u50AC\u529E\u541E\u6389\u3002\n if (downstream.kind !== 'enter') return downstream;\n // \u56DE\u5408\u8FB9\u754C\u53D6\u5BBF\u4E3B\u7ED9\u7684 `step`\uFF1A\u7B2C\u4E00\u6B65\u5C31\u662F\u65B0\u56DE\u5408\uFF0C\u4E0D\u8BBA\u5B83\u7531\u7528\u6237\u3001\u5B9A\u65F6\u63D0\u9192\u3001\n // \u961F\u53CB\u6D88\u606F\u8FD8\u662F webhook \u89E6\u53D1\u3002\u7528\u6237\u63D2\u8BDD\uFF08steer\uFF09\u843D\u5728\u56DE\u5408\u4E2D\u9014\uFF0C\u6309\u6765\u6E90\u5355\u72EC\u8BA4\u3002\n const freshInput = step === 1 || messages.some((message) => message.source.kind === 'user');\n const notice = controller.step(agent.session, freshInput);\n if (notice === null) return downstream;\n return { ...downstream, messages: [...downstream.messages, notice] };\n });\n}\n", "/**\n * \u8FDB\u5EA6\u5361\u7684\u6570\u636E\u89C6\u56FE\uFF1A\u4ECE\u4E00\u6761\u5DE5\u5177\u8C03\u7528\uFF08\u6216\u5B83\u7684\u7ED3\u679C\uFF09\u91CC\u8BFB\u51FA\u6807\u9898\u4E0E\u6B63\u6587\u3002\n *\n * \u53EA\u8BFB\u65E5\u5FD7\u91CC\u5DF2\u6709\u7684\u4E1C\u897F\uFF0C\u4E0D\u78B0\u5B9E\u65F6\u72B6\u6001\uFF0C\u6240\u4EE5\u76F4\u64AD\u4E0E\u91CD\u653E\u753B\u51FA\u6765\u4E00\u6837\uFF1A\n * - \u539F\u751F\u8C03\u7528\u7684 result \u76F8\u4F4D\u5E26 `meta`\uFF08`output.presentationMeta` \u7684\u4EA7\u7269\uFF09\uFF1B\n * - PTC \u5B50\u8C03\u7528\u7684\u8282\u70B9\u540C\u6837\u5E26 `meta`\uFF08\u7531 `tool/ptc-dispatch` \u4F9B\u7ED9\uFF09\uFF1B\n * - \u7A97\u53E3\u622A\u65AD\u65F6 `call` \u53EF\u80FD\u662F null\uFF0C\u9000\u56DE `argsRaw`\u3002\n *\n * \u8FD9\u4E2A\u6587\u4EF6\u662F\u7EAF\u6570\u636E\u903B\u8F91\uFF08\u4E0D\u78B0 DOM\u3001\u4E0D\u78B0 React\uFF09\uFF0C\u5BBF\u4E3B\u534A\u8FB9\u7684 `presentationMeta`\n * \u4E5F import \u8FD9\u91CC\u7684 `parseUpdate`\u2014\u2014\u4E24\u8FB9\u8BFB\u7684\u662F\u540C\u4E00\u4EFD\u65E5\u5FD7\uFF0C\u5F62\u72B6\u53EA\u80FD\u6709\u4E00\u5904\u5B9A\u4E49\u3002\n */\n\n/** \u4E00\u6B21\u6C47\u62A5\u7684\u5185\u5BB9\uFF1B\u6807\u9898\u53EF\u4EE5\u6CA1\u6709\u3002 */\nexport interface Update {\n title?: string;\n message: string;\n}\n\n/** \u4E00\u5F20\u8FDB\u5EA6\u5361\u8981\u753B\u7684\u4E1C\u897F\uFF1A\u5DE5\u5177\u884C\u4E0E\u5BF9\u8BDD\u8282\u70B9\u4E24\u79CD\u5EA7\u4F4D\u90FD\u6574\u7406\u6210\u8FD9\u4E2A\u5F62\u72B6\u3002 */\nexport interface NotifyCardData {\n readonly title?: string;\n readonly message: string;\n readonly time: number;\n readonly settled: boolean;\n readonly failure?: { readonly detail: string };\n}\n\n/** \u5931\u8D25\u53EA\u663E\u793A\u5BBF\u4E3B\u7684\u9519\u8BEF\u5185\u5BB9\uFF1B\u6CA1\u6709\u6587\u672C\u65F6\u4F7F\u7528\u7ED3\u6784\u5316\u9519\u8BEF\u3002 */\nexport function failureOf(\n content: readonly { readonly type: string; readonly text?: string }[],\n error?: { readonly name: string; readonly code: string; readonly reason?: string },\n): NonNullable<NotifyCardData['failure']> {\n const text = content.flatMap(block => block.type === 'text' && block.text?.trim() ? [block.text] : []).join('\\n');\n const detail = text || (error === undefined ? '' : error.reason || `${error.name}: ${error.code}`);\n return { detail };\n}\n\n/**\n * \u4ECE\u4EFB\u610F\u5BF9\u8C61\u91CC\u8BFB\u6C47\u62A5\u5185\u5BB9\u2014\u2014\u5BBF\u4E3B\u534A\u8FB9\u6295\u5F71 `presentationMeta` \u4E5F\u8D70\u8FD9\u4E00\u4EFD\uFF0C\n * \u4E24\u8FB9\u8BFB\u7684\u662F\u540C\u4E00\u4EFD\u65E5\u5FD7\uFF0C\u5F62\u72B6\u53EA\u80FD\u6709\u4E00\u5904\u5B9A\u4E49\u3002\n * @param value - \u6A21\u578B\u53C2\u6570\u6216\u6301\u4E45\u5316\u7684 `meta`\u3002\n * @returns \u8BFB\u5F97\u5230\u65F6\u8FD4\u56DE\u5185\u5BB9\uFF1B\u4E24\u8005\u90FD\u7A7A\u65F6\u8FD4\u56DE null\u3002\n */\nexport function parseUpdate(value: unknown): Update | null {\n if (typeof value !== 'object' || value === null) return null;\n const record = value as Record<string, unknown>;\n const message = typeof record['message'] === 'string' ? record['message'] : '';\n const title = typeof record['title'] === 'string' && record['title'].length > 0 ? record['title'] : undefined;\n if (message.length === 0 && title === undefined) return null;\n return title === undefined ? { message } : { title, message };\n}\n\n/**\n * \u4ECE\u4E00\u6BB5 JSON \u53C2\u6570\u91CC\u8BFB\u6C47\u62A5\u5185\u5BB9\u3002\n * @param raw - \u6A21\u578B\u4EA7\u51FA\u7684\u53C2\u6570 JSON \u6587\u672C\uFF1B\u6D41\u5F0F\u9636\u6BB5\u53EF\u80FD\u662F\u622A\u65AD\u7684\u524D\u7F00\u3002\n * @returns \u8BFB\u5F97\u5230\u65F6\u8FD4\u56DE\u5185\u5BB9\uFF0C\u5426\u5219 null\u3002\n */\nexport function parseArgs(raw: string | undefined): Update | null {\n if (typeof raw !== 'string' || raw.length === 0) return null;\n try {\n return parseUpdate(JSON.parse(raw));\n } catch {\n // \u6D41\u5F0F\u9636\u6BB5\u53EF\u80FD\u62FF\u5230\u622A\u65AD\u7684 JSON \u524D\u7F00\uFF1B\u8FD9\u4E00\u5E27\u6CA1\u6709\u5185\u5BB9\u53EF\u753B\u3002\n return null;\n }\n}\n\n/**\n * \u8BFB\u4E00\u6761\u5DE5\u5177\u8C03\u7528\u91CC\u7684\u6C47\u62A5\u5185\u5BB9\u3002\n * @param block - toolview \u7684 `block`\uFF08start \u76F8\u4F4D\u6216 result \u76F8\u4F4D\uFF09\u3002\n * @returns \u6C47\u62A5\u5185\u5BB9\uFF1B\u8BFB\u4E0D\u5230\u65F6\u7ED9\u4E00\u4E2A\u7A7A\u6B63\u6587\uFF0C\u5361\u7247\u4ECD\u4F1A\u753B\u6807\u9898\u515C\u5E95\u3002\n */\nexport function readUpdate(block: unknown): Update {\n if (typeof block !== 'object' || block === null) return { message: '' };\n const record = block as Record<string, unknown>;\n const fromMeta = parseUpdate(record['meta']);\n if (fromMeta !== null) return fromMeta;\n const call = record['call'];\n if (typeof call === 'object' && call !== null) {\n const fromCall = parseArgs((call as Record<string, unknown>)['argsRaw'] as string | undefined);\n if (fromCall !== null) return fromCall;\n }\n return parseArgs(record['argsRaw'] as string | undefined) ?? { message: '' };\n}\n\n/**\n * \u5361\u7247\u6807\u9898\uFF1A\u6A21\u578B\u7ED9\u7684\u6807\u9898\u4F18\u5148\uFF0C\u5426\u5219\u53D6\u6B63\u6587\u9996\u884C\uFF0C\u518D\u5426\u5219\u7528\u515C\u5E95\u6587\u6848\u3002\n * @param update - \u6C47\u62A5\u5185\u5BB9\u3002\n * @param fallback - \u6CA1\u6709\u6807\u9898\u4E5F\u6CA1\u6709\u6B63\u6587\u65F6\u663E\u793A\u7684\u90A3\u53E5\u3002\n * @returns \u4E00\u884C\u6807\u9898\u3002\n */\nexport function titleOf(update: Update, fallback: string): string {\n if (update.title !== undefined) return update.title;\n const first = update.message\n .split('\\n')\n .map((line) => line.trim())\n .find((line) => line.length > 0);\n if (first === undefined) return fallback;\n return first.length > 60 ? `${first.slice(0, 59)}\u2026` : first;\n}\n\n/**\n * \u5361\u7247\u53F3\u4E0A\u89D2\u7684\u65F6\u95F4\uFF1A`MM-DD HH:mm`\uFF0C\u4E0E\u53C2\u8003\u91CC\u7684\u8FDB\u5EA6\u5361\u4E00\u81F4\u3002\n * @param ms - Unix \u6BEB\u79D2\uFF1B\u7F3A\u7701\u6216\u975E\u6CD5\u65F6\u8FD4\u56DE null\u3002\n * @returns \u683C\u5F0F\u5316\u540E\u7684\u65F6\u95F4\uFF0C\u6216 null\u3002\n */\nexport function formatClock(ms: unknown): string | null {\n if (typeof ms !== 'number' || !Number.isFinite(ms)) return null;\n const date = new Date(ms);\n const pad = (value: number): string => String(value).padStart(2, '0');\n return `${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}`;\n}\n"],
|
|
5
|
-
"mappings": ";AAAA,SAAS,kBAAkB;AAC3B,SAAS,yBAAyB;;;ACDlC,OAAO,OAAO;;;
|
|
4
|
+
"sourcesContent": ["import { defineTool } from '@deepseek-ai/dsh-tools';\nimport { AgentToolRegistry } from '@deepseek-ai/dsh-tools/pipeline';\nimport type { ToolDefinition } from '@deepseek-ai/dsh-tools';\nimport type { Context } from '@deepseek-ai/cordis';\nimport type { Agent } from '@deepseek-ai/dsh-agent';\nimport type { Session } from '@deepseek-ai/dsh-session';\nimport type {} from '@deepseek-ai/dsh-settings';\nimport { isEnabledFor, nudgeAfterOf, type PluginConfig } from './config.js';\nimport { createNudgeController, installNudge, isSubagentSession } from './nudge.js';\nimport { NOTIFY_TOOL_NAME, SUMMARY_ONLY_FIELD } from './shared/config.js';\nimport { parseUpdate } from './client/row-model.js';\n\n\nexport const name = 'dsh-notify-user';\n\nexport const inject = ['tools', 'agents'];\n\nexport { Config } from './config.js';\n\ndeclare module '@deepseek-ai/cordis' {\n interface Events {\n 'loader/volatile-update'(paths: readonly (readonly string[])[]): void;\n }\n}\n\nconst TITLE_PARAMETER = {\n type: 'string',\n description: \"One line the user can take in at a glance: the conclusion or current phase, in the user's language, under 60 characters, plain text.\",\n} as const;\n\nconst MESSAGE_PARAMETER = {\n type: 'string',\n required: true,\n description: \"The details behind the title, without repeating it: a short paragraph plus a few bullet points of light Markdown, in the user's language, under 1000 characters.\",\n} as const;\n\nconst OUTPUT = {\n schema: {\n type: 'object' as const,\n additionalProperties: false,\n properties: {\n ok: {\n type: 'boolean' as const,\n description: 'Whether the update was recorded.',\n },\n },\n },\n render: () => [{ type: 'text' as const, text: 'Update shown in the conversation.' }],\n presentationMeta: (args: unknown) => {\n const update = parseUpdate(args);\n const meta: Record<string, string> = { message: update?.message ?? '' };\n if (update?.title !== undefined) meta['title'] = update.title;\n return meta;\n },\n};\n\nconst DETAILED_DESCRIPTION = 'Send the user a short progress update without ending your turn. Use it when you have been working through several tool calls, when you finish a stage or change direction, or when you find something the user should know before you finish. Do not use it for the final answer: findings that belong in the reply still go in the reply.';\n\nconst SUMMARY_ONLY_DESCRIPTION = 'Send the user a one-line progress update without ending your turn. Use it when you have been working through several tool calls, when you finish a stage or change direction, or when you find something the user should know before you finish. Write only the title: one line the user can take in at a glance. Do not use it for the final answer: findings that belong in the reply still go in the reply.';\n\nfunction notifyTool(summaryOnly: boolean): ToolDefinition {\n return defineTool({\n name: NOTIFY_TOOL_NAME,\n description: summaryOnly ? SUMMARY_ONLY_DESCRIPTION : DETAILED_DESCRIPTION,\n parameters: summaryOnly\n ? { title: { ...TITLE_PARAMETER, required: true } }\n : { title: TITLE_PARAMETER, message: MESSAGE_PARAMETER },\n output: OUTPUT,\n isConcurrencySafe: () => true,\n async execute() {\n return { ok: true };\n },\n });\n}\n\nexport function apply(ctx: Context, config: PluginConfig): void {\n const enabledIn = (session: Session): boolean => !isSubagentSession(session) && isEnabledFor(config, session.header.id);\n\n const controller = createNudgeController({\n readThreshold: () => nudgeAfterOf(config),\n readProseResets: () => config.resetOnProse.get(),\n readSummaryOnly: () => config.summaryOnly.get(),\n readEnabled: enabledIn,\n });\n installNudge(ctx, controller, NOTIFY_TOOL_NAME);\n\n const registry = new AgentToolRegistry();\n let disposeTool = registry.register(notifyTool(config.summaryOnly.get()));\n ctx.effect(() => () => disposeTool());\n ctx.tools.include(registry);\n const sync = (agent: Agent): void => registry.set(agent, enabledIn(agent.session) ? [NOTIFY_TOOL_NAME] : []);\n const syncAll = (): void => { for (const agent of ctx.agents.list()) sync(agent); };\n ctx.on('agent/created', ({ agent }) => { sync(agent); });\n syncAll();\n\n ctx.on('loader/volatile-update', (paths) => {\n if (paths.some(path => path[0] === SUMMARY_ONLY_FIELD)) {\n disposeTool();\n disposeTool = registry.register(notifyTool(config.summaryOnly.get()));\n }\n if (paths.some(path => path[0] === 'defaultEnabled' || path[0] === 'sessionOverrides')) syncAll();\n });\n\n ctx.inject(['settings'], (scoped) => {\n scoped.effect(() => scoped.settings.configure({ auto: false }, ctx.fiber));\n });\n}\n", "import z from '@deepseek-ai/schemastery';\nimport type { Volatile } from '@deepseek-ai/cordis';\nimport {\n CARD_PLACEMENTS,\n DEFAULT_BODY_EXPANDED_BY_DEFAULT,\n DEFAULT_CARD_PLACEMENT,\n DEFAULT_COLLAPSIBLE,\n DEFAULT_ENABLED,\n DEFAULT_NUDGE_AFTER,\n DEFAULT_RESET_ON_PROSE,\n DEFAULT_SHOW_TIME,\n DEFAULT_SUMMARY_ONLY,\n DEFAULT_SUMMARY_RENDER,\n MAX_NUDGE_AFTER,\n SUMMARY_RENDERS,\n enabledFor,\n type SessionOverrides,\n} from './shared/config.js';\n\nexport interface PluginConfig {\n nudgeAfter: Volatile<number>;\n resetOnProse: Volatile<boolean>;\n collapsible: Volatile<boolean>;\n summaryOnly: Volatile<boolean>;\n summaryRender: Volatile<string>;\n bodyExpandedByDefault: Volatile<boolean>;\n showTime: Volatile<boolean>;\n cardPlacement: Volatile<string>;\n defaultEnabled: Volatile<boolean>;\n sessionOverrides: Volatile<SessionOverrides>;\n}\n\nexport const Config = z.object({\n nudgeAfter: z.number().min(0).max(MAX_NUDGE_AFTER).default(DEFAULT_NUDGE_AFTER).volatile(),\n resetOnProse: z.boolean().default(DEFAULT_RESET_ON_PROSE).volatile(),\n collapsible: z.boolean().default(DEFAULT_COLLAPSIBLE).volatile(),\n summaryOnly: z.boolean().default(DEFAULT_SUMMARY_ONLY).volatile(),\n summaryRender: z.union(SUMMARY_RENDERS.map(value => z.const(value)))\n .default(DEFAULT_SUMMARY_RENDER)\n .volatile(),\n bodyExpandedByDefault: z.boolean().default(DEFAULT_BODY_EXPANDED_BY_DEFAULT).volatile(),\n showTime: z.boolean().default(DEFAULT_SHOW_TIME).volatile(),\n cardPlacement: z.union(CARD_PLACEMENTS.map(value => z.const(value)))\n .default(DEFAULT_CARD_PLACEMENT)\n .volatile(),\n defaultEnabled: z.boolean().default(DEFAULT_ENABLED).volatile(),\n sessionOverrides: z.dict(z.boolean()).default({}).volatile(),\n});\n\nexport function nudgeAfterOf(config: PluginConfig): number {\n const value = config.nudgeAfter.get();\n if (!Number.isFinite(value)) return DEFAULT_NUDGE_AFTER;\n return Math.min(MAX_NUDGE_AFTER, Math.max(0, Math.floor(value)));\n}\n\nexport function isEnabledFor(config: PluginConfig, sessionId: string): boolean {\n return enabledFor(config.sessionOverrides.get(), config.defaultEnabled.get(), sessionId);\n}\n", "\nexport const SETTINGS_NAMESPACE = 'dsh-notify-user';\n\nexport const NOTIFY_TOOL_NAME = 'notify_user';\n\nexport const DEFAULT_NUDGE_AFTER = 10;\n\nexport const MAX_NUDGE_AFTER = 100;\n\nexport const DEFAULT_RESET_ON_PROSE = true;\n\nexport const DEFAULT_COLLAPSIBLE = true;\n\nexport const DEFAULT_SUMMARY_ONLY = false;\n\nexport const DEFAULT_BODY_EXPANDED_BY_DEFAULT = false;\n\nexport const DEFAULT_SHOW_TIME = false;\n\nexport const SUMMARY_ONLY_FIELD = 'summaryOnly';\n\nexport const SUMMARY_RENDERS = ['card', 'prose'] as const;\n\nexport const DEFAULT_SUMMARY_RENDER = 'card';\n\nexport type SummaryRender = typeof SUMMARY_RENDERS[number];\n\nexport const CARD_PLACEMENTS = ['boundary', 'inline'] as const;\n\nexport type CardPlacement = typeof CARD_PLACEMENTS[number];\n\nexport const DEFAULT_CARD_PLACEMENT: CardPlacement = 'boundary';\n\nexport const DEFAULT_ENABLED = true;\n\nexport type SessionOverrides = Readonly<Record<string, boolean>>;\n\nexport function enabledFor(\n overrides: SessionOverrides | undefined,\n fallback: boolean,\n sessionId: string,\n): boolean {\n const explicit = overrides !== undefined && Object.hasOwn(overrides, sessionId) ? overrides[sessionId] : undefined;\n return typeof explicit === 'boolean' ? explicit : fallback;\n}\n", "import { createUserMessage } from '@deepseek-ai/dsh-llm';\nimport type { ContentBlock, ContextFormed } from '@deepseek-ai/dsh-llm';\nimport type { PreStepDecision } from '@deepseek-ai/dsh-agent';\nimport type { Session, UserMessage } from '@deepseek-ai/dsh-session';\nimport type { ToolExecution, ToolExecutionResult } from '@deepseek-ai/dsh-tools';\nimport type { Context } from '@deepseek-ai/cordis';\n\n\ndeclare module '@deepseek-ai/dsh-llm' {\n interface MessageSourceMap {\n 'notify-user-nudge': { kind: 'notify-user-nudge' } & ContextFormed;\n }\n}\n\nconst NUDGE_SOURCE = { kind: 'notify-user-nudge' } as const;\n\nexport function renderNudge(count: number, summaryOnly = false): string {\n const head = `You have gone ${String(count)} tool calls without a notify_user update \u2014 the user has seen no progress from you since. `;\n if (summaryOnly) {\n return head + 'Send one now: a one-line title with what you have concluded so far, batched with your next tool calls.';\n }\n return head\n + 'Send one now: a one-line title with what you have concluded so far, and a structured, chat-style message '\n + '(a well structured paragraph with a few bullet points, under ~1000 characters) with the details and what you will do next, '\n + 'batched with your next tool calls.';\n}\n\nexport function hasProse(content: readonly ContentBlock[]): boolean {\n return content.some(block => block.type === 'text' && block.text.trim() !== '');\n}\n\nexport function nudgeSummary(count: number): string {\n return `${String(count)} tool calls without a notify_user update`;\n}\n\nexport interface NudgeController {\n notify(session: Session): void;\n prose(session: Session): void;\n toolCall(session: Session): void;\n step(session: Session, freshInput: boolean): UserMessage | null;\n}\n\nexport interface NudgeOptions {\n readThreshold: () => number;\n readProseResets: () => boolean;\n readSummaryOnly: () => boolean;\n readEnabled: (session: Session) => boolean;\n}\n\nexport function createNudgeController(options: NudgeOptions): NudgeController {\n const counts = new WeakMap<Session, number>();\n\n return {\n notify(session) {\n counts.set(session, 0);\n },\n prose(session) {\n if (!options.readProseResets()) return;\n counts.set(session, 0);\n },\n toolCall(session) {\n if (!options.readEnabled(session) || options.readThreshold() <= 0) {\n counts.delete(session);\n return;\n }\n counts.set(session, (counts.get(session) ?? 0) + 1);\n },\n step(session, freshInput) {\n if (!options.readEnabled(session)) {\n counts.set(session, 0);\n return null;\n }\n const threshold = options.readThreshold();\n if (freshInput || threshold <= 0) {\n counts.set(session, 0);\n return null;\n }\n const count = counts.get(session) ?? 0;\n if (count < threshold) return null;\n counts.set(session, 0);\n return createUserMessage({\n content: [{ type: 'text', text: renderNudge(count, options.readSummaryOnly()) }],\n source: { ...NUDGE_SOURCE, form: 'notice', summary: nudgeSummary(count) },\n });\n },\n };\n}\n\nexport function isSubagentSession(session: Session): boolean {\n return session.header.origin === 'subagent';\n}\n\nexport function installNudge(ctx: Context, controller: NudgeController, toolName: string): void {\n ctx.on('tools/result', (exec: Readonly<ToolExecution>, result: Readonly<ToolExecutionResult>): undefined => {\n if (result.isError && result.error.info?.code === 'ABORTED_BEFORE_DISPATCH') return undefined;\n const session = exec.agent?.session;\n if (session !== undefined && !isSubagentSession(session)) {\n if (exec.name === toolName && !result.isError) controller.notify(session);\n else if (exec.parent === undefined) controller.toolCall(session);\n }\n return undefined;\n });\n\n ctx.on('session/event', (session, event): void => {\n if (isSubagentSession(session)) return;\n if (event.type !== 'assistant/message') return;\n if (!hasProse(event.data.message.content)) return;\n controller.prose(session);\n });\n\n ctx.on('agent/pre-step', async ({ agent, messages, step }, next): Promise<PreStepDecision> => {\n if (isSubagentSession(agent.session)) return next();\n const downstream = await next();\n if (downstream.kind !== 'enter') return downstream;\n const freshInput = step === 1 || messages.some((message) => message.source.kind === 'user');\n const notice = controller.step(agent.session, freshInput);\n if (notice === null) return downstream;\n return { ...downstream, messages: [...downstream.messages, notice] };\n });\n}\n", "\nexport interface Update {\n title?: string;\n message: string;\n}\n\nexport interface NotifyCardData {\n readonly title?: string;\n readonly message: string;\n readonly time: number;\n readonly settled: boolean;\n readonly failure?: { readonly detail: string };\n}\n\nexport function failureOf(\n content: readonly { readonly type: string; readonly text?: string }[],\n error?: { readonly name: string; readonly code: string; readonly reason?: string },\n): NonNullable<NotifyCardData['failure']> {\n const text = content.flatMap(block => block.type === 'text' && block.text?.trim() ? [block.text] : []).join('\\n');\n const detail = text || (error === undefined ? '' : error.reason || `${error.name}: ${error.code}`);\n return { detail };\n}\n\nexport function parseUpdate(value: unknown): Update | null {\n if (typeof value !== 'object' || value === null) return null;\n const record = value as Record<string, unknown>;\n const message = typeof record['message'] === 'string' ? record['message'] : '';\n const title = typeof record['title'] === 'string' && record['title'].length > 0 ? record['title'] : undefined;\n if (message.length === 0 && title === undefined) return null;\n return title === undefined ? { message } : { title, message };\n}\n\nexport function parseArgs(raw: string | undefined): Update | null {\n if (typeof raw !== 'string' || raw.length === 0) return null;\n try {\n return parseUpdate(JSON.parse(raw));\n } catch {\n return null;\n }\n}\n\nexport function readUpdate(block: unknown): Update {\n if (typeof block !== 'object' || block === null) return { message: '' };\n const record = block as Record<string, unknown>;\n const fromMeta = parseUpdate(record['meta']);\n if (fromMeta !== null) return fromMeta;\n const call = record['call'];\n if (typeof call === 'object' && call !== null) {\n const fromCall = parseArgs((call as Record<string, unknown>)['argsRaw'] as string | undefined);\n if (fromCall !== null) return fromCall;\n }\n return parseArgs(record['argsRaw'] as string | undefined) ?? { message: '' };\n}\n\nexport function titleOf(update: Update, fallback: string): string {\n if (update.title !== undefined) return update.title;\n const first = update.message\n .split('\\n')\n .map((line) => line.trim())\n .find((line) => line.length > 0);\n if (first === undefined) return fallback;\n return first.length > 60 ? `${first.slice(0, 59)}\u2026` : first;\n}\n\nexport function formatClock(ms: unknown): string | null {\n if (typeof ms !== 'number' || !Number.isFinite(ms)) return null;\n const date = new Date(ms);\n const pad = (value: number): string => String(value).padStart(2, '0');\n return `${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}`;\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,kBAAkB;AAC3B,SAAS,yBAAyB;;;ACDlC,OAAO,OAAO;;;ACGP,IAAM,mBAAmB;AAEzB,IAAM,sBAAsB;AAE5B,IAAM,kBAAkB;AAExB,IAAM,yBAAyB;AAE/B,IAAM,sBAAsB;AAE5B,IAAM,uBAAuB;AAE7B,IAAM,mCAAmC;AAEzC,IAAM,oBAAoB;AAE1B,IAAM,qBAAqB;AAE3B,IAAM,kBAAkB,CAAC,QAAQ,OAAO;AAExC,IAAM,yBAAyB;AAI/B,IAAM,kBAAkB,CAAC,YAAY,QAAQ;AAI7C,IAAM,yBAAwC;AAE9C,IAAM,kBAAkB;AAIxB,SAAS,WACd,WACA,UACA,WACS;AACT,QAAM,WAAW,cAAc,UAAa,OAAO,OAAO,WAAW,SAAS,IAAI,UAAU,SAAS,IAAI;AACzG,SAAO,OAAO,aAAa,YAAY,WAAW;AACpD;;;ADZO,IAAM,SAAS,EAAE,OAAO;AAAA,EAC7B,YAAY,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,eAAe,EAAE,QAAQ,mBAAmB,EAAE,SAAS;AAAA,EACzF,cAAc,EAAE,QAAQ,EAAE,QAAQ,sBAAsB,EAAE,SAAS;AAAA,EACnE,aAAa,EAAE,QAAQ,EAAE,QAAQ,mBAAmB,EAAE,SAAS;AAAA,EAC/D,aAAa,EAAE,QAAQ,EAAE,QAAQ,oBAA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": "@lynn123411/dsh-notify-user",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.8",
|
|
4
4
|
"description": "给模型一条不结束本轮就能向用户汇报进度的通道;连续多次工具调用没汇报时,插件会催它发一条。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -56,37 +56,37 @@
|
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@deepseek-ai/cordis": "^4.2.0-alpha.
|
|
60
|
-
"@deepseek-ai/dsh-client-ui-primitives": ">=0.2.3-alpha.
|
|
61
|
-
"@deepseek-ai/dsh-llm": ">=0.2.3-alpha.
|
|
62
|
-
"@deepseek-ai/dsh-tools": ">=0.2.3-alpha.
|
|
63
|
-
"@deepseek-ai/schemastery": "^3.20.0-alpha.
|
|
59
|
+
"@deepseek-ai/cordis": "^4.2.0-alpha.3",
|
|
60
|
+
"@deepseek-ai/dsh-client-ui-primitives": ">=0.2.3-alpha.4",
|
|
61
|
+
"@deepseek-ai/dsh-llm": ">=0.2.3-alpha.4",
|
|
62
|
+
"@deepseek-ai/dsh-tools": ">=0.2.3-alpha.4",
|
|
63
|
+
"@deepseek-ai/schemastery": "^3.20.0-alpha.3",
|
|
64
64
|
"react": "^19.3.1"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@deepseek-ai/cordis": "^4.2.0-alpha.
|
|
67
|
+
"@deepseek-ai/cordis": "^4.2.0-alpha.3",
|
|
68
68
|
"@deepseek-ai/cordis-plugin-group": "1.2.0-alpha.2",
|
|
69
69
|
"@deepseek-ai/cordis-plugin-include": "1.2.0-alpha.2",
|
|
70
|
-
"@deepseek-ai/dsh-agent": ">=0.2.3-alpha.
|
|
71
|
-
"@deepseek-ai/dsh-client-config": ">=0.2.3-alpha.
|
|
72
|
-
"@deepseek-ai/dsh-client-locale": ">=0.2.3-alpha.
|
|
73
|
-
"@deepseek-ai/dsh-client-store": ">=0.2.3-alpha.
|
|
74
|
-
"@deepseek-ai/dsh-client-ui-chat": ">=0.2.3-alpha.
|
|
75
|
-
"@deepseek-ai/dsh-client-ui-conversation": ">=0.2.3-alpha.
|
|
76
|
-
"@deepseek-ai/dsh-client-ui-model-selection": ">=0.2.3-alpha.
|
|
77
|
-
"@deepseek-ai/dsh-client-ui-plugin-manager": ">=0.2.3-alpha.
|
|
78
|
-
"@deepseek-ai/dsh-client-ui-primitives": ">=0.2.3-alpha.
|
|
79
|
-
"@deepseek-ai/dsh-client-ui-renderer": ">=0.2.3-alpha.
|
|
80
|
-
"@deepseek-ai/dsh-client-ui-session": ">=0.2.3-alpha.
|
|
81
|
-
"@deepseek-ai/dsh-client-ui-settings": ">=0.2.3-alpha.
|
|
82
|
-
"@deepseek-ai/dsh-client-ui-slots": ">=0.2.3-alpha.
|
|
83
|
-
"@deepseek-ai/dsh-client-ui-tool": ">=0.2.3-alpha.
|
|
84
|
-
"@deepseek-ai/dsh-llm": ">=0.2.3-alpha.
|
|
85
|
-
"@deepseek-ai/dsh-session": ">=0.2.3-alpha.
|
|
86
|
-
"@deepseek-ai/dsh-settings": ">=0.2.3-alpha.
|
|
87
|
-
"@deepseek-ai/dsh-system-prompt": ">=0.2.3-alpha.
|
|
88
|
-
"@deepseek-ai/dsh-tools": ">=0.2.3-alpha.
|
|
89
|
-
"@deepseek-ai/schemastery": "^3.20.0-alpha.
|
|
70
|
+
"@deepseek-ai/dsh-agent": ">=0.2.3-alpha.4",
|
|
71
|
+
"@deepseek-ai/dsh-client-config": ">=0.2.3-alpha.4",
|
|
72
|
+
"@deepseek-ai/dsh-client-locale": ">=0.2.3-alpha.4",
|
|
73
|
+
"@deepseek-ai/dsh-client-store": ">=0.2.3-alpha.4",
|
|
74
|
+
"@deepseek-ai/dsh-client-ui-chat": ">=0.2.3-alpha.4",
|
|
75
|
+
"@deepseek-ai/dsh-client-ui-conversation": ">=0.2.3-alpha.4",
|
|
76
|
+
"@deepseek-ai/dsh-client-ui-model-selection": ">=0.2.3-alpha.4",
|
|
77
|
+
"@deepseek-ai/dsh-client-ui-plugin-manager": ">=0.2.3-alpha.4",
|
|
78
|
+
"@deepseek-ai/dsh-client-ui-primitives": ">=0.2.3-alpha.4",
|
|
79
|
+
"@deepseek-ai/dsh-client-ui-renderer": ">=0.2.3-alpha.4",
|
|
80
|
+
"@deepseek-ai/dsh-client-ui-session": ">=0.2.3-alpha.4",
|
|
81
|
+
"@deepseek-ai/dsh-client-ui-settings": ">=0.2.3-alpha.4",
|
|
82
|
+
"@deepseek-ai/dsh-client-ui-slots": ">=0.2.3-alpha.4",
|
|
83
|
+
"@deepseek-ai/dsh-client-ui-tool": ">=0.2.3-alpha.4",
|
|
84
|
+
"@deepseek-ai/dsh-llm": ">=0.2.3-alpha.4",
|
|
85
|
+
"@deepseek-ai/dsh-session": ">=0.2.3-alpha.4",
|
|
86
|
+
"@deepseek-ai/dsh-settings": ">=0.2.3-alpha.4",
|
|
87
|
+
"@deepseek-ai/dsh-system-prompt": ">=0.2.3-alpha.4",
|
|
88
|
+
"@deepseek-ai/dsh-tools": ">=0.2.3-alpha.4",
|
|
89
|
+
"@deepseek-ai/schemastery": "^3.20.0-alpha.3",
|
|
90
90
|
"@types/node": "^22.20.0",
|
|
91
91
|
"@types/react": "~19.3.0",
|
|
92
92
|
"esbuild": "^0.25.0",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"typescript": "^6.0.0"
|
|
97
97
|
},
|
|
98
98
|
"engines": {
|
|
99
|
-
"dsh": ">=0.2.3-alpha.
|
|
99
|
+
"dsh": ">=0.2.3-alpha.4",
|
|
100
100
|
"node": "^22.19 || >=24"
|
|
101
101
|
},
|
|
102
102
|
"packageManager": "pnpm@11.7.0",
|