@hy-sde-org/dsh-tool-pi-durable 0.2.0-rc.2
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/LICENSE +21 -0
- package/cordis.patch.yml +20 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +67 -0
- package/dist/index.js.map +1 -0
- package/dist/prompt.d.ts +25 -0
- package/dist/prompt.d.ts.map +1 -0
- package/dist/prompt.js +30 -0
- package/dist/prompt.js.map +1 -0
- package/dist/tools.d.ts +56 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +148 -0
- package/dist/tools.js.map +1 -0
- package/package.json +70 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 hy-sde
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# @hy-sde-org/dsh-tool-pi-durable — model-facing durable-agent tools,
|
|
2
|
+
# delivered as ONE self-contained preset row.
|
|
3
|
+
#
|
|
4
|
+
# The tools resolve the `piDurableAgent` service published by the
|
|
5
|
+
# @hy-sde-org/dsh-pi-durable engine row (HOST plane). Without that service the
|
|
6
|
+
# tools still mount and every call fails loud with `[pi-durable-unavailable]`
|
|
7
|
+
# — mounting a preset must never break session creation over an optional host.
|
|
8
|
+
#
|
|
9
|
+
# All row ids carry the `hy-sde-` prefix to avoid clashing with any shipped
|
|
10
|
+
# row of the same name (a duplicate loader id fails the boot).
|
|
11
|
+
#
|
|
12
|
+
# Override per deployment by patching the row by id:
|
|
13
|
+
#
|
|
14
|
+
# - id: hy-sde-tool-pi-durable
|
|
15
|
+
# config:
|
|
16
|
+
# enabled: false
|
|
17
|
+
- insert:
|
|
18
|
+
- id: hy-sde-tool-pi-durable
|
|
19
|
+
name: '@hy-sde-org/dsh-tool-pi-durable'
|
|
20
|
+
config: {}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model-facing durable-agent tools over the host-provided `piDurableAgent`
|
|
3
|
+
* service (@hy-sde-org/dsh-pi-durable engine row): durable_agent_submit,
|
|
4
|
+
* durable_agent_write, durable_agent_status, durable_agent_history,
|
|
5
|
+
* durable_agent_fork, durable_agent_abort, and the `durable-agent` prompt
|
|
6
|
+
* section. The package contributes no durable state of its own — the
|
|
7
|
+
* composition constructs one engine and provides it under
|
|
8
|
+
* {@link SERVICE_PI_DURABLE}; this plugin consumes it.
|
|
9
|
+
*
|
|
10
|
+
* Agent-plane: this package mounts as a preset row and resolves the host
|
|
11
|
+
* service with `ctx.get` (optional service: without the engine the tools
|
|
12
|
+
* still mount, so a session never fails to create just because the engine is
|
|
13
|
+
* absent — and every call fails loud with `[pi-durable-unavailable]` until
|
|
14
|
+
* the host provides it).
|
|
15
|
+
* @module @hy-sde-org/dsh-tool-pi-durable
|
|
16
|
+
*/
|
|
17
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
18
|
+
import { type PiDurablePromptConfig } from './prompt.ts';
|
|
19
|
+
export { PI_DURABLE_PROMPT, PI_DURABLE_PROMPT_SECTION_NAME, buildPiDurablePromptSection } from './prompt.ts';
|
|
20
|
+
export type { PiDurablePromptConfig } from './prompt.ts';
|
|
21
|
+
export { MAX_RENDER_CHARS, cappedJson, piDurableToolDefinitions, type AnyPiDurableToolDefinition, type ForkToolArgs, type HistoryToolArgs, type PiDurableToolDefinition, type SubmitToolArgs, type WriteToolArgs, } from './tools.ts';
|
|
22
|
+
/** Plugin configuration. */
|
|
23
|
+
export interface Config extends PiDurablePromptConfig {
|
|
24
|
+
/** Disable the tool registrations and prompt section entirely (default false). */
|
|
25
|
+
enabled?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** Cordis plugin name for loader diagnostics. */
|
|
28
|
+
export declare const name = "tool-pi-durable";
|
|
29
|
+
/** Services consumed by this plugin (the engine facade is resolved opportunistically with `ctx.get`). */
|
|
30
|
+
export declare const inject: string[];
|
|
31
|
+
/**
|
|
32
|
+
* Register the six durable-agent tools and the `durable-agent` prompt
|
|
33
|
+
* section over the host-provided engine facade. Without the engine the tools
|
|
34
|
+
* still register but every call fails loud with `[pi-durable-unavailable]` —
|
|
35
|
+
* mounting a preset must never break session creation over an optional host.
|
|
36
|
+
* @param ctx - the agent-plane plugin context (injects `tools`, `systemPrompt`).
|
|
37
|
+
* @param config - resolved plugin configuration.
|
|
38
|
+
*/
|
|
39
|
+
export declare function apply(ctx: Context, config?: Config): void;
|
|
40
|
+
declare const _default: {
|
|
41
|
+
name: string;
|
|
42
|
+
inject: string[];
|
|
43
|
+
apply: typeof apply;
|
|
44
|
+
};
|
|
45
|
+
export default _default;
|
|
46
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAQlD,OAAO,EAA+B,KAAK,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAGrF,OAAO,EAAE,iBAAiB,EAAE,8BAA8B,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AAC5G,YAAY,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,EACL,gBAAgB,EAChB,UAAU,EACV,wBAAwB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,cAAc,EACnB,KAAK,aAAa,GACnB,MAAM,YAAY,CAAA;AAEnB,4BAA4B;AAC5B,MAAM,WAAW,MAAO,SAAQ,qBAAqB;IACnD,kFAAkF;IAClF,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,iDAAiD;AACjD,eAAO,MAAM,IAAI,oBAAoB,CAAA;AAErC,yGAAyG;AACzG,eAAO,MAAM,MAAM,UAA4B,CAAA;AAE/C;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,GAAE,MAAW,GAAG,IAAI,CA4B7D;;;;;;AAED,wBAAsC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model-facing durable-agent tools over the host-provided `piDurableAgent`
|
|
3
|
+
* service (@hy-sde-org/dsh-pi-durable engine row): durable_agent_submit,
|
|
4
|
+
* durable_agent_write, durable_agent_status, durable_agent_history,
|
|
5
|
+
* durable_agent_fork, durable_agent_abort, and the `durable-agent` prompt
|
|
6
|
+
* section. The package contributes no durable state of its own — the
|
|
7
|
+
* composition constructs one engine and provides it under
|
|
8
|
+
* {@link SERVICE_PI_DURABLE}; this plugin consumes it.
|
|
9
|
+
*
|
|
10
|
+
* Agent-plane: this package mounts as a preset row and resolves the host
|
|
11
|
+
* service with `ctx.get` (optional service: without the engine the tools
|
|
12
|
+
* still mount, so a session never fails to create just because the engine is
|
|
13
|
+
* absent — and every call fails loud with `[pi-durable-unavailable]` until
|
|
14
|
+
* the host provides it).
|
|
15
|
+
* @module @hy-sde-org/dsh-tool-pi-durable
|
|
16
|
+
*/
|
|
17
|
+
import { ToolArgsError, parameterSchemaSpecToJsonSchema, validateArgs, valueSchemaSpecToJsonSchema, } from '@deepseek-ai/dsh-tools';
|
|
18
|
+
import { SERVICE_PI_DURABLE } from '@hy-sde-org/dsh-pi-durable';
|
|
19
|
+
import { buildPiDurablePromptSection } from "./prompt.js";
|
|
20
|
+
import { piDurableToolDefinitions } from "./tools.js";
|
|
21
|
+
export { PI_DURABLE_PROMPT, PI_DURABLE_PROMPT_SECTION_NAME, buildPiDurablePromptSection } from "./prompt.js";
|
|
22
|
+
export { MAX_RENDER_CHARS, cappedJson, piDurableToolDefinitions, } from "./tools.js";
|
|
23
|
+
/** Cordis plugin name for loader diagnostics. */
|
|
24
|
+
export const name = 'tool-pi-durable';
|
|
25
|
+
/** Services consumed by this plugin (the engine facade is resolved opportunistically with `ctx.get`). */
|
|
26
|
+
export const inject = ['tools', 'systemPrompt'];
|
|
27
|
+
/**
|
|
28
|
+
* Register the six durable-agent tools and the `durable-agent` prompt
|
|
29
|
+
* section over the host-provided engine facade. Without the engine the tools
|
|
30
|
+
* still register but every call fails loud with `[pi-durable-unavailable]` —
|
|
31
|
+
* mounting a preset must never break session creation over an optional host.
|
|
32
|
+
* @param ctx - the agent-plane plugin context (injects `tools`, `systemPrompt`).
|
|
33
|
+
* @param config - resolved plugin configuration.
|
|
34
|
+
*/
|
|
35
|
+
export function apply(ctx, config = {}) {
|
|
36
|
+
if (config.enabled === false)
|
|
37
|
+
return;
|
|
38
|
+
const agent = ctx.get(SERVICE_PI_DURABLE);
|
|
39
|
+
const unavailable = agent === undefined
|
|
40
|
+
? 'the piDurableAgent service is not provided — mount the @hy-sde-org/dsh-pi-durable engine row (host plane) to publish it'
|
|
41
|
+
: undefined;
|
|
42
|
+
for (const def of piDurableToolDefinitions()) {
|
|
43
|
+
const parameters = parameterSchemaSpecToJsonSchema(def.parameters);
|
|
44
|
+
const outputSchema = valueSchemaSpecToJsonSchema(def.outputSchema);
|
|
45
|
+
ctx.tools.register({
|
|
46
|
+
name: def.name,
|
|
47
|
+
description: def.description,
|
|
48
|
+
parameters: parameters,
|
|
49
|
+
output: {
|
|
50
|
+
schema: outputSchema,
|
|
51
|
+
render: (args, value) => [{ type: 'text', text: def.render(args, value) }],
|
|
52
|
+
},
|
|
53
|
+
execute: async (args, _exec) => {
|
|
54
|
+
if (agent === undefined) {
|
|
55
|
+
throw new Error(`[pi-durable-unavailable] ${unavailable ?? 'the piDurableAgent service is not provided'}`);
|
|
56
|
+
}
|
|
57
|
+
const violations = validateArgs(def.parameters, args);
|
|
58
|
+
if (violations.length > 0)
|
|
59
|
+
throw new ToolArgsError(violations);
|
|
60
|
+
return await def.execute(args, agent);
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
ctx.systemPrompt.section(buildPiDurablePromptSection(config));
|
|
65
|
+
}
|
|
66
|
+
export default { name, inject, apply };
|
|
67
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EACL,aAAa,EACb,+BAA+B,EAC/B,YAAY,EACZ,2BAA2B,GAC5B,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,kBAAkB,EAAuB,MAAM,4BAA4B,CAA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EAAE,KAAc,CAAC,EAAE,CAAC;aAC7F;YACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;gBAC7B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;oBACxB,MAAM,IAAI,KAAK,CAAC,4BAA4B,WAAW,IAAI,4CAA4C,EAAE,CAAC,CAAA;gBAC5G,CAAC;gBACD,MAAM,UAAU,GAAG,YAAY,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;gBACrD,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC;oBAAE,MAAM,IAAI,aAAa,CAAC,UAAU,CAAC,CAAA;gBAC9D,OAAO,MAAM,GAAG,CAAC,OAAO,CAAC,IAAa,EAAE,KAAK,CAAC,CAAA;YAChD,CAAC;SACF,CAAC,CAAA;IACJ,CAAC;IACD,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,2BAA2B,CAAC,MAAM,CAAC,CAAC,CAAA;AAC/D,CAAC;AAED,eAAe,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAA"}
|
package/dist/prompt.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `durable-agent` system-prompt section: what the durable agent is, the
|
|
3
|
+
* submit-and-poll contract, and the fork model. Mirrors the tool-graph
|
|
4
|
+
* section pattern.
|
|
5
|
+
* @module @hy-sde-org/dsh-tool-pi-durable/prompt
|
|
6
|
+
*/
|
|
7
|
+
import type { PromptSection } from '@deepseek-ai/dsh-system-prompt';
|
|
8
|
+
/** Plugin configuration contributed by the prompt section. */
|
|
9
|
+
export interface PiDurablePromptConfig {
|
|
10
|
+
/** Disable the prompt section entirely (default false). */
|
|
11
|
+
enabled?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const PI_DURABLE_PROMPT_SECTION_NAME = "durable-agent";
|
|
14
|
+
/**
|
|
15
|
+
* The `durable-agent` section text: how to drive the durable agent from the
|
|
16
|
+
* host session.
|
|
17
|
+
*/
|
|
18
|
+
export declare const PI_DURABLE_PROMPT: string;
|
|
19
|
+
/**
|
|
20
|
+
* Build the `durable-agent` prompt section.
|
|
21
|
+
* @param config - section configuration.
|
|
22
|
+
* @returns the {@link PromptSection} to register.
|
|
23
|
+
*/
|
|
24
|
+
export declare function buildPiDurablePromptSection(config?: PiDurablePromptConfig): PromptSection;
|
|
25
|
+
//# sourceMappingURL=prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../src/prompt.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAEnE,8DAA8D;AAC9D,MAAM,WAAW,qBAAqB;IACpC,2DAA2D;IAC3D,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,eAAO,MAAM,8BAA8B,kBAAkB,CAAA;AAG7D;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAIpB,CAAA;AAEZ;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,GAAE,qBAA0B,GAAG,aAAa,CAM7F"}
|
package/dist/prompt.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `durable-agent` system-prompt section: what the durable agent is, the
|
|
3
|
+
* submit-and-poll contract, and the fork model. Mirrors the tool-graph
|
|
4
|
+
* section pattern.
|
|
5
|
+
* @module @hy-sde-org/dsh-tool-pi-durable/prompt
|
|
6
|
+
*/
|
|
7
|
+
export const PI_DURABLE_PROMPT_SECTION_NAME = 'durable-agent';
|
|
8
|
+
const SECTION_ORDER = 128;
|
|
9
|
+
/**
|
|
10
|
+
* The `durable-agent` section text: how to drive the durable agent from the
|
|
11
|
+
* host session.
|
|
12
|
+
*/
|
|
13
|
+
export const PI_DURABLE_PROMPT = [
|
|
14
|
+
'Durable agent: the host also runs a pi-durable agent conversation — its own transcript, its own coding tools (bash/read/write/edit), its own durable SQLite storage that survives host restarts. Drive it with durable_agent_submit (input, exactly-once per requestId), durable_agent_write (passive bookkeeping that never triggers a run), durable_agent_status, durable_agent_history, durable_agent_fork, and durable_agent_abort.',
|
|
15
|
+
'Submit, don\'t wait: durable_agent_submit returns after admission (submission id + status); the run continues in the background of the host process. Poll durable_agent_status, then read its transcript with durable_agent_history (page via nextCursor). Reuse a requestId to retry a submit safely — it deduplicates.',
|
|
16
|
+
'Fork, don\'t rerun: durable_agent_fork branches the conversation at any entry id from history — the fork inherits the transcript up to that entry, so you can retry a divergent branch without replaying it.',
|
|
17
|
+
].join('\n');
|
|
18
|
+
/**
|
|
19
|
+
* Build the `durable-agent` prompt section.
|
|
20
|
+
* @param config - section configuration.
|
|
21
|
+
* @returns the {@link PromptSection} to register.
|
|
22
|
+
*/
|
|
23
|
+
export function buildPiDurablePromptSection(config = {}) {
|
|
24
|
+
return {
|
|
25
|
+
name: PI_DURABLE_PROMPT_SECTION_NAME,
|
|
26
|
+
order: SECTION_ORDER,
|
|
27
|
+
text: config.enabled === false ? '' : PI_DURABLE_PROMPT,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../src/prompt.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAUH,MAAM,CAAC,MAAM,8BAA8B,GAAG,eAAe,CAAA;AAC7D,MAAM,aAAa,GAAG,GAAG,CAAA;AAEzB;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAW;IACvC,yaAAya;IACza,0TAA0T;IAC1T,8MAA8M;CAC/M,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAEZ;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CAAC,SAAgC,EAAE;IAC5E,OAAO;QACL,IAAI,EAAE,8BAA8B;QACpC,KAAK,EAAE,aAAa;QACpB,IAAI,EAAE,MAAM,CAAC,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,iBAAiB;KACxD,CAAA;AACH,CAAC"}
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host-agnostic durable-agent tool definitions over one
|
|
3
|
+
* {@link PiDurableAgent} service — the Cordis adapter in `index.ts` wires the
|
|
4
|
+
* live service; these definitions stay plain so tests can run without a host.
|
|
5
|
+
* @module @hy-sde-org/dsh-tool-pi-durable/tools
|
|
6
|
+
*/
|
|
7
|
+
import type { JsonValue } from '@hy-sde-org/dsh-pi-durable';
|
|
8
|
+
import type { ParameterSchemaSpec, ValueSchemaSpec } from '@deepseek-ai/dsh-tools';
|
|
9
|
+
import type { PiDurableAgent, RootSubmissionOutcome } from '@hy-sde-org/dsh-pi-durable';
|
|
10
|
+
/** One host-agnostic tool definition. */
|
|
11
|
+
export interface PiDurableToolDefinition<A, V> {
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly description: string;
|
|
14
|
+
readonly parameters: ParameterSchemaSpec;
|
|
15
|
+
readonly outputSchema: ValueSchemaSpec;
|
|
16
|
+
execute(args: A, agent: PiDurableAgent): Promise<V>;
|
|
17
|
+
render(args: A, value: V): string;
|
|
18
|
+
}
|
|
19
|
+
/** Max chars of JSON in one render; anything longer is truncated with a note. */
|
|
20
|
+
export declare const MAX_RENDER_CHARS = 12000;
|
|
21
|
+
/** Compact lossless-ish JSON with a hard cap. */
|
|
22
|
+
export declare function cappedJson(value: unknown): string;
|
|
23
|
+
/** Args of `durable_agent_submit`. */
|
|
24
|
+
export interface SubmitToolArgs {
|
|
25
|
+
readonly input: string;
|
|
26
|
+
readonly requestId?: string;
|
|
27
|
+
readonly whenBusy?: 'steer' | 'followUp' | 'reject';
|
|
28
|
+
}
|
|
29
|
+
/** Args of `durable_agent_write`. */
|
|
30
|
+
export interface WriteToolArgs {
|
|
31
|
+
readonly kind: string;
|
|
32
|
+
readonly data: JsonValue;
|
|
33
|
+
readonly requestId?: string;
|
|
34
|
+
}
|
|
35
|
+
/** Args of `durable_agent_history`. */
|
|
36
|
+
export interface HistoryToolArgs {
|
|
37
|
+
readonly limit?: number;
|
|
38
|
+
readonly cursor?: string;
|
|
39
|
+
}
|
|
40
|
+
/** Args of `durable_agent_fork`. */
|
|
41
|
+
export interface ForkToolArgs {
|
|
42
|
+
readonly entryId: string;
|
|
43
|
+
readonly instructions?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Build the six durable-agent tool definitions over one service facade.
|
|
47
|
+
* @returns the definitions in registration order.
|
|
48
|
+
*/
|
|
49
|
+
export declare function piDurableToolDefinitions(): readonly AnyPiDurableToolDefinition[];
|
|
50
|
+
/** Union of every tool definition (what the Cordis adapter iterates). */
|
|
51
|
+
export type AnyPiDurableToolDefinition = PiDurableToolDefinition<SubmitToolArgs, RootSubmissionOutcome> | PiDurableToolDefinition<WriteToolArgs, RootSubmissionOutcome> | PiDurableToolDefinition<Record<string, never>, Awaited<ReturnType<PiDurableAgent['status']>>> | PiDurableToolDefinition<HistoryToolArgs, Awaited<ReturnType<PiDurableAgent['history']>>> | PiDurableToolDefinition<ForkToolArgs, {
|
|
52
|
+
conversationId: string;
|
|
53
|
+
}> | PiDurableToolDefinition<Record<string, never>, {
|
|
54
|
+
ok: true;
|
|
55
|
+
}>;
|
|
56
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAClF,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AA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;AAID;;;GAGG;AACH,wBAAgB,wBAAwB,IAAI,SAAS,0BAA0B,EAAE,CAiIhF;AAED,yEAAyE;AACzE,MAAM,MAAM,0BAA0B,GAClC,uBAAuB,CAAC,cAAc,EAAE,qBAAqB,CAAC,GAC9D,uBAAuB,CAAC,aAAa,EAAE,qBAAqB,CAAC,GAC7D,uBAAuB,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAC7F,uBAAuB,CAAC,eAAe,EAAE,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GACxF,uBAAuB,CAAC,YAAY,EAAE;IAAE,cAAc,EAAE,MAAM,CAAA;CAAE,CAAC,GACjE,uBAAuB,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,CAAC,CAAA"}
|
package/dist/tools.js
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host-agnostic durable-agent tool definitions over one
|
|
3
|
+
* {@link PiDurableAgent} service — the Cordis adapter in `index.ts` wires the
|
|
4
|
+
* live service; these definitions stay plain so tests can run without a host.
|
|
5
|
+
* @module @hy-sde-org/dsh-tool-pi-durable/tools
|
|
6
|
+
*/
|
|
7
|
+
/** Max chars of JSON in one render; anything longer is truncated with a note. */
|
|
8
|
+
export const MAX_RENDER_CHARS = 12_000;
|
|
9
|
+
/** Compact lossless-ish JSON with a hard cap. */
|
|
10
|
+
export function cappedJson(value) {
|
|
11
|
+
const text = JSON.stringify(value, (_key, item) => item, 2) ?? 'null';
|
|
12
|
+
if (text.length <= MAX_RENDER_CHARS)
|
|
13
|
+
return text;
|
|
14
|
+
return `${text.slice(0, MAX_RENDER_CHARS)}\n… (truncated, ${text.length - MAX_RENDER_CHARS} more chars)`;
|
|
15
|
+
}
|
|
16
|
+
/** Short single-line projection of an entry for history listings. */
|
|
17
|
+
function entryLine(entry) {
|
|
18
|
+
const data = entry.data === undefined ? '·' : JSON.stringify(entry.data);
|
|
19
|
+
const clipped = data.length > 240 ? `${data.slice(0, 240)}…` : data;
|
|
20
|
+
return `- ${entry.id} kind=${entry.kind} data=${clipped}`;
|
|
21
|
+
}
|
|
22
|
+
/** One history item projected for {@link entryLine}. */
|
|
23
|
+
function entryView(entry) {
|
|
24
|
+
return entry.data === undefined
|
|
25
|
+
? { id: String(entry.id), kind: entry.kind }
|
|
26
|
+
: { id: String(entry.id), kind: entry.kind, data: entry.data };
|
|
27
|
+
}
|
|
28
|
+
const WHEN_BUSY_VALUES = new Set(['steer', 'followUp', 'reject']);
|
|
29
|
+
/**
|
|
30
|
+
* Build the six durable-agent tool definitions over one service facade.
|
|
31
|
+
* @returns the definitions in registration order.
|
|
32
|
+
*/
|
|
33
|
+
export function piDurableToolDefinitions() {
|
|
34
|
+
const submit = {
|
|
35
|
+
name: 'durable_agent_submit',
|
|
36
|
+
description: 'Submit user input to the durable agent (its own pi-durable conversation with its own transcript, coding tools, '
|
|
37
|
+
+ 'and model route). Exactly-once per requestId; the run continues in the background — poll durable_agent_status '
|
|
38
|
+
+ 'or durable_agent_history for progress. whenBusy: steer (default behavior of queued steering), followUp '
|
|
39
|
+
+ '(queue after the current run), reject (fail with ConversationBusy instead of queueing).',
|
|
40
|
+
parameters: {
|
|
41
|
+
input: { type: 'string', required: true, description: 'The user input for the durable agent.' },
|
|
42
|
+
requestId: { type: 'string', description: 'Deduplication key scoped to the conversation; reuse to retry safely.' },
|
|
43
|
+
whenBusy: { type: 'string', description: 'steer | followUp | reject (default followUp semantics).' },
|
|
44
|
+
},
|
|
45
|
+
outputSchema: { type: 'json' },
|
|
46
|
+
async execute(args, agent) {
|
|
47
|
+
if (args.whenBusy !== undefined && !WHEN_BUSY_VALUES.has(args.whenBusy)) {
|
|
48
|
+
throw new Error(`[pi-durable-invalid-when-busy] whenBusy must be one of steer | followUp | reject (got ${args.whenBusy})`);
|
|
49
|
+
}
|
|
50
|
+
return await agent.submitInput(args.input, {
|
|
51
|
+
...(args.requestId !== undefined ? { requestId: args.requestId } : {}),
|
|
52
|
+
...(args.whenBusy !== undefined ? { whenBusy: args.whenBusy } : {}),
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
render: (_args, value) => `Submitted to the durable agent: submission ${value.submissionId} (${String(value.record.status)}). `
|
|
56
|
+
+ 'The run continues in the background — check durable_agent_status, then durable_agent_history for its transcript.',
|
|
57
|
+
};
|
|
58
|
+
const write = {
|
|
59
|
+
name: 'durable_agent_write',
|
|
60
|
+
description: 'Admit a passive entry write into the durable agent conversation — durable bookkeeping (notes, artifacts, '
|
|
61
|
+
+ 'control state) that never triggers a generation run. Exactly-once per requestId.',
|
|
62
|
+
parameters: {
|
|
63
|
+
kind: { type: 'string', required: true, description: 'Application-defined entry kind (e.g. "note", "artifact").' },
|
|
64
|
+
data: { type: 'json', required: true, description: 'Lossless JSON payload stored with the entry.' },
|
|
65
|
+
requestId: { type: 'string', description: 'Deduplication key scoped to the conversation; reuse to retry safely.' },
|
|
66
|
+
},
|
|
67
|
+
outputSchema: { type: 'json' },
|
|
68
|
+
async execute(args, agent) {
|
|
69
|
+
return await agent.writeEntry(args.kind, args.data, args.requestId);
|
|
70
|
+
},
|
|
71
|
+
render: (_args, value) => `Durable write admitted: submission ${value.submissionId} (${String(value.record.status)}).\n${cappedJson(value.record)}`,
|
|
72
|
+
};
|
|
73
|
+
const status = {
|
|
74
|
+
name: 'durable_agent_status',
|
|
75
|
+
description: 'Point-in-time status of the durable agent engine: root conversation id, scheduling state, queued/placed '
|
|
76
|
+
+ 'submissions, and whether generation is configured. Read-only.',
|
|
77
|
+
parameters: {},
|
|
78
|
+
outputSchema: { type: 'json' },
|
|
79
|
+
async execute(_args, agent) {
|
|
80
|
+
return await agent.status();
|
|
81
|
+
},
|
|
82
|
+
render: (_args, value) => `Durable agent root ${value.rootConversationId}; scheduling ${value.inspection.scheduling}; `
|
|
83
|
+
+ `generation ${value.generationConfigured ? 'configured' : 'NOT configured (write-only)'}; `
|
|
84
|
+
+ `live submissions: ${value.inspection.submissions.length}.\n${cappedJson(value.inspection)}`,
|
|
85
|
+
};
|
|
86
|
+
const history = {
|
|
87
|
+
name: 'durable_agent_history',
|
|
88
|
+
description: 'Read the durable agent conversation history (newest-first fork-aware scan). Pass the nextCursor from an '
|
|
89
|
+
+ 'earlier call to page. Entry ids are the fork points accepted by durable_agent_fork. Read-only.',
|
|
90
|
+
parameters: {
|
|
91
|
+
limit: { type: 'number', description: 'Page size (default 20, max 200).' },
|
|
92
|
+
cursor: { type: 'string', description: 'Opaque nextCursor JSON from a previous page.' },
|
|
93
|
+
},
|
|
94
|
+
outputSchema: { type: 'json' },
|
|
95
|
+
async execute(args, agent) {
|
|
96
|
+
const limit = Math.min(Math.max(args.limit ?? 20, 1), 200);
|
|
97
|
+
let cursor;
|
|
98
|
+
if (args.cursor !== undefined) {
|
|
99
|
+
try {
|
|
100
|
+
const parsed = JSON.parse(args.cursor);
|
|
101
|
+
if (parsed !== null && typeof parsed === 'object' && !Array.isArray(parsed)) {
|
|
102
|
+
cursor = parsed;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
throw new Error('[pi-durable-invalid-cursor] cursor must be the JSON object returned as nextCursor');
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return await agent.history(limit, cursor);
|
|
110
|
+
},
|
|
111
|
+
render: (_args, value) => {
|
|
112
|
+
const lines = value.items.map(entry => entryLine(entryView(entry)));
|
|
113
|
+
const next = value.next === undefined ? '' : `\nnextCursor: ${JSON.stringify(value.next)}`;
|
|
114
|
+
return `Durable agent history (${value.items.length} entries, newest first):${next}\n${lines.join('\n') || '(empty)'}`;
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
const fork = {
|
|
118
|
+
name: 'durable_agent_fork',
|
|
119
|
+
description: 'Fork the durable agent conversation at an entry id (from durable_agent_history): the new conversation inherits '
|
|
120
|
+
+ 'history up to that entry and diverges from there. Optionally set instructions for the fork.',
|
|
121
|
+
parameters: {
|
|
122
|
+
entryId: { type: 'string', required: true, description: 'Entry id to fork at (inclusive parent).' },
|
|
123
|
+
instructions: { type: 'string', description: 'Agent instructions for the fork.' },
|
|
124
|
+
},
|
|
125
|
+
outputSchema: { type: 'json' },
|
|
126
|
+
async execute(args, agent) {
|
|
127
|
+
return await agent.forkFrom(args.entryId, {
|
|
128
|
+
...(args.instructions !== undefined ? { instructions: args.instructions } : {}),
|
|
129
|
+
});
|
|
130
|
+
},
|
|
131
|
+
render: (_args, value) => `Forked: new conversation ${value.conversationId}. Its history is readable via durable_agent_status on request; `
|
|
132
|
+
+ 'submit to the ROOT conversation stays on the root — fork submissions follow in a later revision.',
|
|
133
|
+
};
|
|
134
|
+
const abort = {
|
|
135
|
+
name: 'durable_agent_abort',
|
|
136
|
+
description: 'Abort the durable agent conversation scope: withdraw queued inputs, mark live tasks, and resolve when idle. '
|
|
137
|
+
+ 'Committed history stays durable.',
|
|
138
|
+
parameters: {},
|
|
139
|
+
outputSchema: { type: 'json' },
|
|
140
|
+
async execute(_args, agent) {
|
|
141
|
+
await agent.abortRoot();
|
|
142
|
+
return { ok: true };
|
|
143
|
+
},
|
|
144
|
+
render: (_args, value) => (value.ok ? 'Aborted the durable agent scope; committed history stays durable.' : 'not ok'),
|
|
145
|
+
};
|
|
146
|
+
return [submit, write, status, history, fork, abort];
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAiBH,iFAAiF;AACjF,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAA;AAEtC,iDAAiD;AACjD,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,MAAM,I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ChF,CAAC,CAAA;QACJ,CAAC;QACD,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CACvB,4BAA4B,KAAK,CAAC,cAAc,iEAAiE;cAC/G,kGAAkG;KACvG,CAAA;IAED,MAAM,KAAK,GAAiE;QAC1E,IAAI,EAAE,qBAAqB;QAC3B,WAAW,EACT,8GAA8G;cAC5G,kCAAkC;QACtC,UAAU,EAAE,EAAE;QACd,YAAY,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;QAC9B,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK;YACxB,MAAM,KAAK,CAAC,SAAS,EAAE,CAAA;YACvB,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAA;QACrB,CAAC;QACD,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,mEAAmE,CAAC,CAAC,CAAC,QAAQ,CAAC;KACtH,CAAA;IAED,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAA;AACtD,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hy-sde-org/dsh-tool-pi-durable",
|
|
3
|
+
"version": "0.2.0-rc.2",
|
|
4
|
+
"description": "Model-facing durable-agent tools for DeepSeek Harness (durable_agent_submit / write / status / history / fork / abort) over the @hy-sde-org/dsh-pi-durable engine service.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
14
|
+
"./package.json": "./package.json"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"cordis.patch.yml",
|
|
19
|
+
"README.md",
|
|
20
|
+
"LICENSE"
|
|
21
|
+
],
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": "^22.19.0 || >=24.0.0"
|
|
24
|
+
},
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "git+https://github.com/hy-sde/dsh-plugins.git",
|
|
31
|
+
"directory": "dsh-pi-durable/packages/tool-pi-durable"
|
|
32
|
+
},
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"dsh": {
|
|
35
|
+
"bundle": {
|
|
36
|
+
"patch": "./cordis.patch.yml"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"@deepseek-ai/cordis": "~4.0.4",
|
|
41
|
+
"@deepseek-ai/dsh-tools": "^0.2.0-rc.2",
|
|
42
|
+
"@earendil-works/pi-durable": "^1.0.0",
|
|
43
|
+
"@hy-sde-org/dsh-pi-durable": "^0.2.0-rc.2"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@deepseek-ai/cordis": "~4.0.4",
|
|
47
|
+
"@deepseek-ai/dsh-system-prompt": "^0.2.0-rc.2",
|
|
48
|
+
"@deepseek-ai/dsh-tools": "^0.2.0-rc.2",
|
|
49
|
+
"@earendil-works/pi-durable": "^1.0.0",
|
|
50
|
+
"@hy-sde-org/dsh-pi-durable": "0.2.0-rc.2",
|
|
51
|
+
"@types/node": "^24.13.3",
|
|
52
|
+
"typescript": "^5.9.3",
|
|
53
|
+
"vitest": "^3.2.7"
|
|
54
|
+
},
|
|
55
|
+
"keywords": [
|
|
56
|
+
"deepseek",
|
|
57
|
+
"agent",
|
|
58
|
+
"harness",
|
|
59
|
+
"dsh-plugin",
|
|
60
|
+
"pi-durable",
|
|
61
|
+
"durable-agent",
|
|
62
|
+
"tools"
|
|
63
|
+
],
|
|
64
|
+
"scripts": {
|
|
65
|
+
"clean": "rm -rf dist",
|
|
66
|
+
"build": "tsc -p tsconfig.build.json",
|
|
67
|
+
"check": "tsc -p tsconfig.json --noEmit",
|
|
68
|
+
"test": "vitest run"
|
|
69
|
+
}
|
|
70
|
+
}
|