@picassohq/cli 0.0.0-stage → 1.0.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/agents/browser_agent.yaml +53 -0
- package/agents/code_reviewer.yaml +49 -0
- package/agents/codebase_investigator.yaml +70 -0
- package/agents/design_auditor.yaml +50 -0
- package/agents/devex_auditor.yaml +50 -0
- package/agents/doc_writer.yaml +54 -0
- package/agents/engineering_architect.yaml +51 -0
- package/agents/generalist.yaml +55 -0
- package/agents/migration_planner.yaml +51 -0
- package/agents/product_reviewer.yaml +48 -0
- package/agents/qa_operator.yaml +52 -0
- package/agents/release_engineer.yaml +50 -0
- package/agents/security_auditor.yaml +62 -0
- package/agents/test_writer.yaml +52 -0
- package/assets/first-light-lockup.png +0 -0
- package/assets/first-light-tagline.png +0 -0
- package/assets/house/README.md +26 -0
- package/assets/house/auraone-banner.png +0 -0
- package/assets/house/auraone-logo.png +0 -0
- package/assets/house/kiro-prism-banner.png +0 -0
- package/assets/house/kiro-prism-logo.png +0 -0
- package/assets/house/picasso-banner.png +0 -0
- package/assets/house/picasso-logo.png +0 -0
- package/assets/wordmark-app.png +0 -0
- package/assets/wordmark-tight.png +0 -0
- package/assets/wordmark.png +0 -0
- package/design/styles.css +1042 -0
- package/dist/build-info.json +37 -0
- package/dist/index.js +3062 -0
- package/goals/cli-hardening.yaml +40 -0
- package/goals/repo-maintenance.yaml +40 -0
- package/package.json +49 -4
- package/runtime/dsh/picasso-ecosystem.community.amendments.yml +24 -0
- package/runtime/dsh/picasso-ecosystem.community.json +185 -0
- package/runtime/dsh/picasso-ecosystem.community.patch.yml +40 -0
- package/runtime/dsh/picasso-ecosystem.cordis.patch.yml +143 -0
- package/runtime/dsh/picasso-isolation.patch.yml +25 -0
- package/runtime/dsh/picasso-providers.patch.yml +373 -0
- package/runtime/dsh/picasso-runtime.cordis.yml +738 -0
- package/runtime/dsh/picasso-sdk.patch.yml +204 -0
- package/runtime/engine-manifest.json +215 -0
- package/runtime/package.json +6 -0
- package/runtime/packages/picasso-cache-probe/cordis.patch.yml +5 -0
- package/runtime/packages/picasso-cache-probe/index.js +477 -0
- package/runtime/packages/picasso-cache-probe/package.json +38 -0
- package/runtime/packages/picasso-commands/cordis.patch.yml +4 -0
- package/runtime/packages/picasso-commands/fresh-review.js +573 -0
- package/runtime/packages/picasso-commands/index.js +497 -0
- package/runtime/packages/picasso-commands/package.json +28 -0
- package/runtime/packages/picasso-instructions/conflicts.js +115 -0
- package/runtime/packages/picasso-instructions/formats.js +145 -0
- package/runtime/packages/picasso-instructions/frontmatter.js +175 -0
- package/runtime/packages/picasso-instructions/glob.js +114 -0
- package/runtime/packages/picasso-instructions/globals.js +90 -0
- package/runtime/packages/picasso-instructions/imports.js +123 -0
- package/runtime/packages/picasso-instructions/index.js +326 -0
- package/runtime/packages/picasso-instructions/modes.js +64 -0
- package/runtime/packages/picasso-instructions/package.json +30 -0
- package/runtime/packages/picasso-instructions/parse.js +134 -0
- package/runtime/packages/picasso-instructions/report.js +161 -0
- package/runtime/packages/picasso-instructions/resolve.js +939 -0
- package/runtime/packages/picasso-instructions/scan.js +181 -0
- package/runtime/packages/picasso-instructions/settings.js +150 -0
- package/runtime/packages/picasso-instructions/skills.js +345 -0
- package/runtime/packages/picasso-lean-context/cordis.patch.yml +13 -0
- package/runtime/packages/picasso-lean-context/index.js +6280 -0
- package/runtime/packages/picasso-lean-context/package.json +26 -0
- package/runtime/packages/picasso-lean-context/read-image-recovery.js +306 -0
- package/runtime/packages/picasso-lean-context/timeline.js +418 -0
- package/runtime/packages/picasso-librarian/classify.js +146 -0
- package/runtime/packages/picasso-librarian/cordis.patch.yml +10 -0
- package/runtime/packages/picasso-librarian/index.js +878 -0
- package/runtime/packages/picasso-librarian/notes.js +159 -0
- package/runtime/packages/picasso-librarian/package.json +34 -0
- package/runtime/packages/picasso-librarian/state.js +478 -0
- package/runtime/packages/picasso-memory/index.js +1184 -0
- package/runtime/packages/picasso-memory/package.json +21 -0
- package/runtime/packages/picasso-model-router/connections.js +912 -0
- package/runtime/packages/picasso-model-router/cordis.patch.yml +17 -0
- package/runtime/packages/picasso-model-router/index.js +1083 -0
- package/runtime/packages/picasso-model-router/package.json +30 -0
- package/runtime/packages/picasso-options/cordis.patch.yml +4 -0
- package/runtime/packages/picasso-options/index.js +263 -0
- package/runtime/packages/picasso-options/package.json +28 -0
- package/runtime/packages/picasso-progress-reports/cordis.patch.yml +10 -0
- package/runtime/packages/picasso-progress-reports/index.js +267 -0
- package/runtime/packages/picasso-progress-reports/package.json +30 -0
- package/runtime/packages/picasso-progress-reports/report.js +235 -0
- package/runtime/packages/picasso-sdk-server/aside.js +142 -0
- package/runtime/packages/picasso-sdk-server/connections.js +38 -0
- package/runtime/packages/picasso-sdk-server/context-timeline.js +27 -0
- package/runtime/packages/picasso-sdk-server/egress-gate.js +520 -0
- package/runtime/packages/picasso-sdk-server/failure-policy.js +246 -0
- package/runtime/packages/picasso-sdk-server/file-input.js +169 -0
- package/runtime/packages/picasso-sdk-server/goal.js +131 -0
- package/runtime/packages/picasso-sdk-server/ignore-file.js +458 -0
- package/runtime/packages/picasso-sdk-server/ignore-plugin.js +12 -0
- package/runtime/packages/picasso-sdk-server/ignore-sandbox.js +122 -0
- package/runtime/packages/picasso-sdk-server/ignore-snapshot.js +131 -0
- package/runtime/packages/picasso-sdk-server/image-input.js +44 -0
- package/runtime/packages/picasso-sdk-server/index.js +891 -0
- package/runtime/packages/picasso-sdk-server/instructions.js +34 -0
- package/runtime/packages/picasso-sdk-server/jobs.js +113 -0
- package/runtime/packages/picasso-sdk-server/mcp-gate.js +51 -0
- package/runtime/packages/picasso-sdk-server/model-selection.js +162 -0
- package/runtime/packages/picasso-sdk-server/package.json +50 -0
- package/runtime/packages/picasso-sdk-server/picasso-records.js +50 -0
- package/runtime/packages/picasso-sdk-server/provider-reload.js +84 -0
- package/runtime/packages/picasso-sdk-server/queue.js +322 -0
- package/runtime/packages/picasso-sdk-server/requester.js +43 -0
- package/runtime/packages/picasso-sdk-server/rewind.js +108 -0
- package/runtime/packages/picasso-sdk-server/schedule.js +187 -0
- package/runtime/packages/picasso-sdk-server/session-grants.js +35 -0
- package/runtime/packages/picasso-sdk-server/session-state.js +118 -0
- package/runtime/packages/picasso-sdk-server/shell-paths.js +869 -0
- package/runtime/packages/picasso-sdk-server/stream-deltas.js +211 -0
- package/runtime/packages/picasso-sdk-server/team-tasks.js +451 -0
- package/runtime/packages/picasso-sdk-server/tool-output.js +128 -0
- package/runtime/packages/picasso-sdk-server/tools-list.js +51 -0
- package/runtime/packages/picasso-sdk-server/wave2-hooks.js +612 -0
- package/runtime/packages/picasso-sdk-server/workspace-archive.js +170 -0
- package/runtime/packages/picasso-sdk-server/workspace-restore.js +180 -0
- package/runtime/packages/picasso-web-search/backends.js +412 -0
- package/runtime/packages/picasso-web-search/config.js +121 -0
- package/runtime/packages/picasso-web-search/cordis.patch.yml +7 -0
- package/runtime/packages/picasso-web-search/failure.js +116 -0
- package/runtime/packages/picasso-web-search/format.js +42 -0
- package/runtime/packages/picasso-web-search/index.js +71 -0
- package/runtime/packages/picasso-web-search/package.json +38 -0
- package/runtime/packages/picasso-web-search/router.js +156 -0
- package/runtime/packages/picasso-x-reader/circle.js +324 -0
- package/runtime/packages/picasso-x-reader/command.js +169 -0
- package/runtime/packages/picasso-x-reader/cordis.patch.yml +8 -0
- package/runtime/packages/picasso-x-reader/index.js +170 -0
- package/runtime/packages/picasso-x-reader/package.json +39 -0
- package/runtime/packages/picasso-x-reader/read.js +370 -0
- package/runtime/packages/picasso-x-reader/rewrite.js +38 -0
- package/runtime/packages/picasso-x-reader/settings.js +131 -0
- package/runtime/packages/picasso-x-reader/urls.js +154 -0
- package/runtime/packages/picasso-x-reader/xmd.js +512 -0
- package/runtime/plugins/picasso-auth-bridge/index.js +380 -0
- package/runtime/plugins/picasso-auth-bridge/package.json +28 -0
- package/runtime/plugins/picasso-auto-approve/index.js +1003 -0
- package/runtime/plugins/picasso-auto-approve/package.json +28 -0
- package/runtime/plugins/picasso-browser/index.js +424 -0
- package/runtime/plugins/picasso-browser/package.json +28 -0
- package/runtime/plugins/picasso-checkpoints/evidence.js +210 -0
- package/runtime/plugins/picasso-checkpoints/index.js +885 -0
- package/runtime/plugins/picasso-checkpoints/package.json +29 -0
- package/runtime/plugins/picasso-commands/fresh-review.js +573 -0
- package/runtime/plugins/picasso-commands/index.js +497 -0
- package/runtime/plugins/picasso-commands/package.json +28 -0
- package/runtime/plugins/picasso-instructions/conflicts.js +115 -0
- package/runtime/plugins/picasso-instructions/formats.js +145 -0
- package/runtime/plugins/picasso-instructions/frontmatter.js +175 -0
- package/runtime/plugins/picasso-instructions/glob.js +114 -0
- package/runtime/plugins/picasso-instructions/globals.js +90 -0
- package/runtime/plugins/picasso-instructions/imports.js +123 -0
- package/runtime/plugins/picasso-instructions/index.js +326 -0
- package/runtime/plugins/picasso-instructions/modes.js +64 -0
- package/runtime/plugins/picasso-instructions/package.json +30 -0
- package/runtime/plugins/picasso-instructions/parse.js +134 -0
- package/runtime/plugins/picasso-instructions/report.js +161 -0
- package/runtime/plugins/picasso-instructions/resolve.js +939 -0
- package/runtime/plugins/picasso-instructions/scan.js +181 -0
- package/runtime/plugins/picasso-instructions/settings.js +150 -0
- package/runtime/plugins/picasso-instructions/skills.js +345 -0
- package/runtime/plugins/picasso-lean-context/index.js +6280 -0
- package/runtime/plugins/picasso-lean-context/package.json +26 -0
- package/runtime/plugins/picasso-lean-context/read-image-recovery.js +306 -0
- package/runtime/plugins/picasso-lean-context/timeline.js +418 -0
- package/runtime/plugins/picasso-librarian/classify.js +146 -0
- package/runtime/plugins/picasso-librarian/index.js +878 -0
- package/runtime/plugins/picasso-librarian/notes.js +159 -0
- package/runtime/plugins/picasso-librarian/package.json +34 -0
- package/runtime/plugins/picasso-librarian/state.js +478 -0
- package/runtime/plugins/picasso-lifecycle-hooks/index.js +186 -0
- package/runtime/plugins/picasso-lifecycle-hooks/package.json +25 -0
- package/runtime/plugins/picasso-mail/inbox.js +207 -0
- package/runtime/plugins/picasso-mail/index.js +293 -0
- package/runtime/plugins/picasso-mail/package.json +22 -0
- package/runtime/plugins/picasso-memory/index.js +1184 -0
- package/runtime/plugins/picasso-memory/package.json +21 -0
- package/runtime/plugins/picasso-model-router/connections.js +912 -0
- package/runtime/plugins/picasso-model-router/index.js +1083 -0
- package/runtime/plugins/picasso-model-router/package.json +30 -0
- package/runtime/plugins/picasso-options/index.js +263 -0
- package/runtime/plugins/picasso-options/package.json +28 -0
- package/runtime/plugins/picasso-progress-reports/index.js +267 -0
- package/runtime/plugins/picasso-progress-reports/package.json +30 -0
- package/runtime/plugins/picasso-progress-reports/report.js +235 -0
- package/runtime/plugins/picasso-provider-models/index.js +436 -0
- package/runtime/plugins/picasso-provider-models/package.json +28 -0
- package/runtime/plugins/picasso-repo-index/index.js +1850 -0
- package/runtime/plugins/picasso-repo-index/package.json +28 -0
- package/runtime/plugins/picasso-schedule-pause/index.js +344 -0
- package/runtime/plugins/picasso-schedule-pause/package.json +28 -0
- package/runtime/plugins/picasso-session-lifecycle/index.js +796 -0
- package/runtime/plugins/picasso-session-lifecycle/package.json +28 -0
- package/runtime/plugins/picasso-trackers/index.js +895 -0
- package/runtime/plugins/picasso-trackers/package.json +28 -0
- package/runtime/plugins/picasso-web-search/backends.js +412 -0
- package/runtime/plugins/picasso-web-search/config.js +121 -0
- package/runtime/plugins/picasso-web-search/failure.js +116 -0
- package/runtime/plugins/picasso-web-search/format.js +42 -0
- package/runtime/plugins/picasso-web-search/index.js +71 -0
- package/runtime/plugins/picasso-web-search/package.json +38 -0
- package/runtime/plugins/picasso-web-search/router.js +156 -0
- package/runtime/plugins/picasso-x-reader/circle.js +324 -0
- package/runtime/plugins/picasso-x-reader/command.js +169 -0
- package/runtime/plugins/picasso-x-reader/index.js +170 -0
- package/runtime/plugins/picasso-x-reader/package.json +39 -0
- package/runtime/plugins/picasso-x-reader/read.js +370 -0
- package/runtime/plugins/picasso-x-reader/rewrite.js +38 -0
- package/runtime/plugins/picasso-x-reader/settings.js +131 -0
- package/runtime/plugins/picasso-x-reader/urls.js +154 -0
- package/runtime/plugins/picasso-x-reader/xmd.js +512 -0
- package/runtime/relay/attachment-text.mjs +737 -0
- package/runtime/relay/companion/companion.css +126 -0
- package/runtime/relay/companion/companion.js +648 -0
- package/runtime/relay/companion/icon.svg +5 -0
- package/runtime/relay/companion/index.html +25 -0
- package/runtime/relay/companion/manifest.json +13 -0
- package/runtime/relay/companion/sw.js +41 -0
- package/runtime/relay/main.mjs +38580 -0
- package/runtime/relay/model-listing.mjs +614 -0
- package/runtime/relay/versions-routes.mjs +1400 -0
- package/runtime/verify-plugins.mjs +205 -0
- package/runtime-lock/package-lock.json +10779 -0
- package/runtime-lock/package.json +7 -0
- package/scripts/install-runtime.mjs +400 -0
- package/README.md +0 -3
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
// On-failure policy for approved tool calls (T4.5).
|
|
2
|
+
//
|
|
3
|
+
// dsh's approval seam has no failure branch: `approval/policy` is `ask` or
|
|
4
|
+
// `never`, the PresetSpec schema carries only a sandbox/approval bundle, and
|
|
5
|
+
// `tools/post-execute` can reshape a result but never re-dispatch the call.
|
|
6
|
+
// The runtime's own `tools/execute` waterfall is documented for exactly this —
|
|
7
|
+
// "around-dispatch for timeout, retry, or metrics" — so the policy lives here:
|
|
8
|
+
// a listener re-invokes `next()` to re-dispatch the same call, escalates a
|
|
9
|
+
// failure to a fresh `approval/request` ask, or cancels the agent with a
|
|
10
|
+
// durable `hook` cause.
|
|
11
|
+
//
|
|
12
|
+
// Declared two ways, evaluated per failing call:
|
|
13
|
+
//
|
|
14
|
+
// preset entries `onFailure` is not in PresetSpec, but the schemastery
|
|
15
|
+
// object is not strict — the key survives validation and
|
|
16
|
+
// `permissionPresets.resolve(name)` returns it. A string
|
|
17
|
+
// applies to every tool (`onFailure: ask`); a record keys
|
|
18
|
+
// policies by tool name with `*` as the fallback
|
|
19
|
+
// (`onFailure: { bash: 'retry:2', '*': 'ask' }`).
|
|
20
|
+
// PICASSO_ON_FAILURE deployment override, the same record grammar as a
|
|
21
|
+
// comma-separated spec: `bash=retry:2,edit=abort,ask`
|
|
22
|
+
// (a bare policy is the `*` fallback). `off` disables a
|
|
23
|
+
// rule.
|
|
24
|
+
//
|
|
25
|
+
// The session's preset declaration wins for the tools it names (it is the
|
|
26
|
+
// contract the user selected); the env spec covers what the preset leaves
|
|
27
|
+
// undeclared. Nothing applies without a matching declaration — today that is
|
|
28
|
+
// a no-op pipeline exactly as before.
|
|
29
|
+
//
|
|
30
|
+
// ask the failure escalates to a fresh approval ask ("retry?") through
|
|
31
|
+
// dsh's own ApprovalService, so the audit pair is logged and the
|
|
32
|
+
// TUI card answers it; an allow re-dispatches once, anything else
|
|
33
|
+
// returns the original failure.
|
|
34
|
+
// retry:N the call is re-dispatched at most N times (N clamped to
|
|
35
|
+
// MAX_ON_FAILURE_RETRIES); the last result stands.
|
|
36
|
+
// abort the failure is recorded (a `plugin:picasso/failure-policy`
|
|
37
|
+
// record) and the agent is cancelled with the durable `hook`
|
|
38
|
+
// cause, ending the turn honestly instead of looping.
|
|
39
|
+
import process from 'node:process';
|
|
40
|
+
|
|
41
|
+
/** Retries `retry:N` may schedule, however large N is written. */
|
|
42
|
+
export const MAX_ON_FAILURE_RETRIES = 2;
|
|
43
|
+
|
|
44
|
+
/** The plugin-record type `note` appends for every policy action (recorded on the session log). */
|
|
45
|
+
export const FAILURE_POLICY_RECORD = 'plugin:picasso/failure-policy';
|
|
46
|
+
|
|
47
|
+
const RETRY = /^retry(?::(\d+))?$/u;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* One declared policy → its normalized form.
|
|
51
|
+
* Accepts `'ask'`, `'abort'`, `'retry'` (= `retry:1`), `'retry:N'`,
|
|
52
|
+
* `'off'`/`'none'` (an explicit disable, useful per-tool against a `*`
|
|
53
|
+
* fallback) or `{ kind: 'retry', retries: N }`; anything else is undefined.
|
|
54
|
+
*/
|
|
55
|
+
export function parseOnFailure(value) {
|
|
56
|
+
if (typeof value === 'object' && value !== null) {
|
|
57
|
+
const kind = value.kind;
|
|
58
|
+
if (kind === 'ask' || kind === 'abort' || kind === 'off') return { kind };
|
|
59
|
+
if (kind === 'retry') {
|
|
60
|
+
const retries = Number(value.retries ?? 1);
|
|
61
|
+
return { kind: 'retry', retries: Number.isSafeInteger(retries) && retries > 0 ? retries : 1 };
|
|
62
|
+
}
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
if (typeof value !== 'string') return undefined;
|
|
66
|
+
const text = value.trim().toLowerCase();
|
|
67
|
+
if (text === 'ask') return { kind: 'ask' };
|
|
68
|
+
if (text === 'abort') return { kind: 'abort' };
|
|
69
|
+
if (text === 'off' || text === 'none' || text === 'never') return { kind: 'off' };
|
|
70
|
+
const retry = RETRY.exec(text);
|
|
71
|
+
if (retry !== null) {
|
|
72
|
+
const retries = retry[1] === undefined ? 1 : Number.parseInt(retry[1], 10);
|
|
73
|
+
return { kind: 'retry', retries: Number.isSafeInteger(retries) && retries > 0 ? retries : 1 };
|
|
74
|
+
}
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* An on-failure spec: comma-separated `tool=policy` entries (a bare policy is
|
|
80
|
+
* the `*` fallback), a record `{ tool: policy, '*': policy }`, or a bare
|
|
81
|
+
* policy string/record for every tool. Returns `{ rules, fallback }` where
|
|
82
|
+
* `rules` maps a tool name to its parsed policy (`{ kind: 'off' }` included —
|
|
83
|
+
* it names a real disable, not a miss).
|
|
84
|
+
*/
|
|
85
|
+
export function parseOnFailureSpec(spec) {
|
|
86
|
+
const rules = new Map();
|
|
87
|
+
let fallback;
|
|
88
|
+
const put = (tool, policy) => {
|
|
89
|
+
if (policy === undefined) return;
|
|
90
|
+
if (tool === '*') fallback = policy;
|
|
91
|
+
else rules.set(tool, policy);
|
|
92
|
+
};
|
|
93
|
+
if (typeof spec === 'string') {
|
|
94
|
+
for (const entry of spec.split(',')) {
|
|
95
|
+
const trimmed = entry.trim();
|
|
96
|
+
if (trimmed.length === 0) continue;
|
|
97
|
+
const eq = trimmed.indexOf('=');
|
|
98
|
+
if (eq < 0) {
|
|
99
|
+
put('*', parseOnFailure(trimmed));
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
const tool = trimmed.slice(0, eq).trim() || '*';
|
|
103
|
+
put(tool, parseOnFailure(trimmed.slice(eq + 1)));
|
|
104
|
+
}
|
|
105
|
+
} else if (spec !== null && typeof spec === 'object') {
|
|
106
|
+
const direct = parseOnFailure(spec);
|
|
107
|
+
if (direct !== undefined) {
|
|
108
|
+
fallback = direct;
|
|
109
|
+
} else {
|
|
110
|
+
for (const [tool, value] of Object.entries(spec)) {
|
|
111
|
+
if (tool === 'kind' || tool === 'retries') continue;
|
|
112
|
+
put(tool.trim() || '*', parseOnFailure(value));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return { rules, fallback };
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** The policy `spec` declares for `toolName`: the exact rule, else the `*` fallback. */
|
|
120
|
+
export function onFailureFor(spec, toolName) {
|
|
121
|
+
if (spec === undefined || spec === null) return undefined;
|
|
122
|
+
return spec.rules.get(toolName) ?? spec.fallback;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** The first content-block text of a failed result, bounded for a reason line. */
|
|
126
|
+
function failureText(result, limit = 160) {
|
|
127
|
+
const blocks = result?.content ?? result?.error?.content;
|
|
128
|
+
const text = Array.isArray(blocks)
|
|
129
|
+
? blocks.find((block) => typeof block?.text === 'string' && block.text.trim().length > 0)?.text.trim()
|
|
130
|
+
: undefined;
|
|
131
|
+
if (text === undefined || text.length === 0) return undefined;
|
|
132
|
+
return text.length <= limit ? text : `${text.slice(0, limit - 1)}…`;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** The human-readable escalation ask: what failed and what an allow would do. */
|
|
136
|
+
export function failureAskReason(exec, result) {
|
|
137
|
+
const detail = failureText(result);
|
|
138
|
+
return (
|
|
139
|
+
`Picasso on-failure policy: tool "${exec?.name ?? 'unknown'}" failed` +
|
|
140
|
+
`${detail === undefined ? '' : ` — ${detail}`}. Allow one retry of the same call?`
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* The `tools/execute` listener enforcing declared on-failure policies.
|
|
146
|
+
*
|
|
147
|
+
* `rules` is a `parseOnFailureSpec` result (PICASSO_ON_FAILURE).
|
|
148
|
+
* `presetSpec(session)` resolves the session preset's declared `onFailure`
|
|
149
|
+
* (index.js wires `permissionPresets.current` + `resolve`).
|
|
150
|
+
* `requestApproval(req)` asks dsh's ApprovalService (`ctx.approval.request`);
|
|
151
|
+
* a non-Promise return means the service is not mounted.
|
|
152
|
+
* `cancel(agent, reason)` aborts the turn (default `agent.cancel` `hook`).
|
|
153
|
+
* `note(session, event)` records a `plugin:picasso/failure-policy` record.
|
|
154
|
+
*/
|
|
155
|
+
export function createFailurePolicy({
|
|
156
|
+
rules,
|
|
157
|
+
presetSpec = () => undefined,
|
|
158
|
+
requestApproval = () => undefined,
|
|
159
|
+
cancel = (agent, reason) => agent?.cancel?.({ kind: 'hook', reason }),
|
|
160
|
+
note = () => undefined,
|
|
161
|
+
warn = () => undefined,
|
|
162
|
+
maxRetries = MAX_ON_FAILURE_RETRIES,
|
|
163
|
+
} = {}) {
|
|
164
|
+
// The preset is re-read per call: `/permission` switches change it mid-session.
|
|
165
|
+
const presetPolicyFor = (session) => {
|
|
166
|
+
let declared;
|
|
167
|
+
try {
|
|
168
|
+
declared = presetSpec(session);
|
|
169
|
+
} catch (error) {
|
|
170
|
+
warn(`Picasso on-failure preset lookup failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
171
|
+
declared = undefined;
|
|
172
|
+
}
|
|
173
|
+
return parseOnFailureSpec(declared);
|
|
174
|
+
};
|
|
175
|
+
/** The policy for one call: the preset's declaration first, then the env spec. */
|
|
176
|
+
const policyFor = (exec) => {
|
|
177
|
+
if (exec === undefined || typeof exec.name !== 'string') return undefined;
|
|
178
|
+
const preset = onFailureFor(presetPolicyFor(exec.agent?.session), exec.name);
|
|
179
|
+
if (preset !== undefined) return preset;
|
|
180
|
+
return onFailureFor(rules, exec.name);
|
|
181
|
+
};
|
|
182
|
+
const record = (exec, action) => {
|
|
183
|
+
try {
|
|
184
|
+
note(exec?.agent?.session, {
|
|
185
|
+
type: 'failure-policy/action',
|
|
186
|
+
action,
|
|
187
|
+
toolName: exec?.name,
|
|
188
|
+
...(typeof exec?.callId === 'string' ? { callId: exec.callId } : {}),
|
|
189
|
+
});
|
|
190
|
+
} catch (error) {
|
|
191
|
+
warn(`Picasso on-failure record failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
return {
|
|
195
|
+
policyFor,
|
|
196
|
+
async execute(exec, next) {
|
|
197
|
+
const policy = policyFor(exec);
|
|
198
|
+
if (policy === undefined || policy.kind === 'off') return next();
|
|
199
|
+
let result = await next();
|
|
200
|
+
if (policy.kind === 'retry') {
|
|
201
|
+
const retries = Math.min(policy.retries, maxRetries);
|
|
202
|
+
for (let attempt = 1; result?.isError === true && attempt <= retries; attempt += 1) {
|
|
203
|
+
record(exec, `retry ${attempt}/${retries}`);
|
|
204
|
+
result = await next();
|
|
205
|
+
}
|
|
206
|
+
return result;
|
|
207
|
+
}
|
|
208
|
+
if (result?.isError !== true) return result;
|
|
209
|
+
if (policy.kind === 'abort') {
|
|
210
|
+
record(exec, 'abort');
|
|
211
|
+
try {
|
|
212
|
+
cancel(exec?.agent, `Picasso on-failure policy aborted the turn after tool "${exec?.name ?? 'unknown'}" failed.`);
|
|
213
|
+
} catch (error) {
|
|
214
|
+
warn(`Picasso on-failure abort failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
215
|
+
}
|
|
216
|
+
return result;
|
|
217
|
+
}
|
|
218
|
+
// kind === 'ask': escalate the failure to a fresh approval ask.
|
|
219
|
+
let outcome;
|
|
220
|
+
try {
|
|
221
|
+
outcome = await requestApproval({
|
|
222
|
+
agent: exec.agent,
|
|
223
|
+
toolName: exec.name,
|
|
224
|
+
...(exec.callId === undefined ? {} : { callId: exec.callId }),
|
|
225
|
+
reason: failureAskReason(exec, result),
|
|
226
|
+
signal: exec.signal,
|
|
227
|
+
});
|
|
228
|
+
} catch (error) {
|
|
229
|
+
warn(`Picasso on-failure ask failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
230
|
+
return result;
|
|
231
|
+
}
|
|
232
|
+
if (outcome === undefined) {
|
|
233
|
+
warn(`Picasso on-failure policy wanted an approval ask for "${exec?.name ?? 'unknown'}" but no approval service is mounted; the failure stands.`);
|
|
234
|
+
return result;
|
|
235
|
+
}
|
|
236
|
+
if (outcome !== 'allowed-once') return result;
|
|
237
|
+
record(exec, 'ask: retry allowed');
|
|
238
|
+
return next();
|
|
239
|
+
},
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/** Parse `PICASSO_ON_FAILURE` once; undefined or empty means no env rules. */
|
|
244
|
+
export function envFailureRules(env = process.env) {
|
|
245
|
+
return parseOnFailureSpec(env.PICASSO_ON_FAILURE);
|
|
246
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
// Typed `type:"file"` prompt blocks (T4.1).
|
|
2
|
+
//
|
|
3
|
+
// The pinned runtime's `session/prompt` already accepts a durable file block —
|
|
4
|
+
// `SdkPromptContentBlock` is `ContentBlock | encoded-image` and dsh-llm's
|
|
5
|
+
// `ContentBlockMap` has `{ type: 'file', attachment: FileAttachmentRef }`; the
|
|
6
|
+
// SDK server's `durablePromptContent` passes every non-encoded-image block
|
|
7
|
+
// through verbatim. Request assembly then projects each file block to
|
|
8
|
+
// deterministic handle text (`projectFilesToText` → `fileHandleText`: name,
|
|
9
|
+
// byte size, and the read-only saved path) for EVERY route — files never reach
|
|
10
|
+
// a provider natively, so no model-capability gate applies (unlike images).
|
|
11
|
+
//
|
|
12
|
+
// What the stock SDK protocol lacks is a way to mint the `FileAttachmentRef`:
|
|
13
|
+
// only the Host's `fileUploads/upload` Remote method stages one, and that is
|
|
14
|
+
// not reachable over stdio. This module adds it:
|
|
15
|
+
//
|
|
16
|
+
// attachment/admit-file { sessionId, path } -> { ref }
|
|
17
|
+
// { sessionId, data, name? } -> { ref }
|
|
18
|
+
//
|
|
19
|
+
// `path` names a host filesystem file: relative paths resolve against the
|
|
20
|
+
// session's effective working directory, the bytes stream into the runtime
|
|
21
|
+
// attachment store (`ctx.attachments.saveFileStream`, buffered `saveFile` as
|
|
22
|
+
// fallback), and the stored leaf name is the path's basename. `data` is a
|
|
23
|
+
// canonical-base64 upload committed through `ctx.attachments.admitEncodedFile`
|
|
24
|
+
// (the same admission dsh's own endpoints share), with `name` as the display
|
|
25
|
+
// name. The returned `ref` ({ attachmentId, name, bytes }) is what
|
|
26
|
+
// `session/prompt` contentBlocks cite as `{ type: 'file', attachment: ref }`.
|
|
27
|
+
//
|
|
28
|
+
// A failed admission throws — the client keeps the mention text and falls
|
|
29
|
+
// back to inlining; nothing claims an attach that did not happen.
|
|
30
|
+
//
|
|
31
|
+
// Errors carry dsh's codes as a `code: message` prefix (the SDK transport only
|
|
32
|
+
// forwards the message): gateway/bad-request, attachment/unavailable,
|
|
33
|
+
// session/attachment-invalid.
|
|
34
|
+
|
|
35
|
+
import { createReadStream } from 'node:fs';
|
|
36
|
+
import { readFile, stat } from 'node:fs/promises';
|
|
37
|
+
import { basename, isAbsolute, resolve } from 'node:path';
|
|
38
|
+
|
|
39
|
+
export const FILE_METHODS = Object.freeze(['attachment/admit-file']);
|
|
40
|
+
|
|
41
|
+
export class FileInputError extends Error {
|
|
42
|
+
constructor(code, message, data = {}) {
|
|
43
|
+
super(`${code}: ${message}`);
|
|
44
|
+
this.name = 'FileInputError';
|
|
45
|
+
this.code = code;
|
|
46
|
+
this.data = data;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Whether prompt content (a string or blocks) carries a file block. */
|
|
51
|
+
export function hasFileBlock(content) {
|
|
52
|
+
return Array.isArray(content) && content.some((block) => block !== null && typeof block === 'object' && block.type === 'file');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* A durable `{ type: 'file' }` block's attachment reference, as `session/prompt`
|
|
57
|
+
* and `session/queue` carry it (`{ attachmentId: 'sha256:<hex>', name, bytes }`).
|
|
58
|
+
* The local store also requires `name` to be the sanitized leaf dsh minted —
|
|
59
|
+
* refs minted here always satisfy that; this check exists so foreign blocks a
|
|
60
|
+
* client fabricates report clearly instead of poisoning the session log.
|
|
61
|
+
*/
|
|
62
|
+
export function isFileBlock(block) {
|
|
63
|
+
const attachment = block?.attachment;
|
|
64
|
+
return (
|
|
65
|
+
block?.type === 'file' &&
|
|
66
|
+
attachment !== null &&
|
|
67
|
+
typeof attachment === 'object' &&
|
|
68
|
+
typeof attachment.attachmentId === 'string' &&
|
|
69
|
+
attachment.attachmentId.length > 0 &&
|
|
70
|
+
typeof attachment.name === 'string' &&
|
|
71
|
+
attachment.name.length > 0 &&
|
|
72
|
+
typeof attachment.bytes === 'number'
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* `attachment/admit-file` — stage one file into the runtime attachment store
|
|
78
|
+
* and return the durable `FileAttachmentRef` a prompt block cites.
|
|
79
|
+
* @param {object} deps
|
|
80
|
+
* @param {() => any} deps.attachments - dsh's attachment store (`ctx.attachments`); `undefined` is refused.
|
|
81
|
+
* @param {(sessionId: string) => string} [deps.cwdFor] - the session's effective cwd for relative `path` params (defaults to the process cwd).
|
|
82
|
+
*/
|
|
83
|
+
export function createFileInput({ attachments, cwdFor = () => process.cwd() }) {
|
|
84
|
+
const store = () => {
|
|
85
|
+
const service = attachments();
|
|
86
|
+
if (service === undefined || service === null) {
|
|
87
|
+
throw new FileInputError('attachment/unavailable', 'This runtime has no attachment store.');
|
|
88
|
+
}
|
|
89
|
+
return service;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const attachmentError = (error) =>
|
|
93
|
+
new FileInputError('session/attachment-invalid', error instanceof Error ? error.message : String(error), {
|
|
94
|
+
reason: typeof error?.code === 'string' ? error.code : 'ATTACHMENT_FAILED',
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
/** Verbatim buffered commit (`AttachmentStore.saveFile`). */
|
|
98
|
+
const commitBuffer = async (data, name) => {
|
|
99
|
+
const service = store();
|
|
100
|
+
if (typeof service.saveFile !== 'function') {
|
|
101
|
+
throw new FileInputError('attachment/unavailable', 'the runtime attachment store has no file intake');
|
|
102
|
+
}
|
|
103
|
+
try {
|
|
104
|
+
return await service.saveFile({ data, name });
|
|
105
|
+
} catch (error) {
|
|
106
|
+
throw attachmentError(error);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
/** Verbatim streamed commit (`AttachmentStore.saveFileStream`), buffered fallback. */
|
|
111
|
+
const commitStream = async (absolute, name) => {
|
|
112
|
+
const service = store();
|
|
113
|
+
if (typeof service.saveFileStream === 'function') {
|
|
114
|
+
try {
|
|
115
|
+
return await service.saveFileStream({ data: createReadStream(absolute), name });
|
|
116
|
+
} catch {
|
|
117
|
+
// Streamed intake may be rejected up front by a backend without it or
|
|
118
|
+
// fail mid-read — the buffered commit is the same content-addressed
|
|
119
|
+
// write, so retry before reporting a refusal.
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return commitBuffer(await readFile(absolute), name);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
const methods = {
|
|
126
|
+
async 'attachment/admit-file'(params) {
|
|
127
|
+
if (typeof params?.sessionId !== 'string' || params.sessionId.length === 0) {
|
|
128
|
+
throw new FileInputError('gateway/bad-request', 'a non-empty sessionId is required');
|
|
129
|
+
}
|
|
130
|
+
const hasPath = typeof params.path === 'string' && params.path.length > 0;
|
|
131
|
+
const hasData = typeof params.data === 'string' && params.data.length > 0;
|
|
132
|
+
if (hasPath === hasData) {
|
|
133
|
+
throw new FileInputError('gateway/bad-request', 'exactly one of `path` or `data` is required');
|
|
134
|
+
}
|
|
135
|
+
if (hasData) {
|
|
136
|
+
const service = store();
|
|
137
|
+
if (typeof service.admitEncodedFile !== 'function') {
|
|
138
|
+
throw new FileInputError('attachment/unavailable', 'the runtime attachment store has no file intake');
|
|
139
|
+
}
|
|
140
|
+
try {
|
|
141
|
+
const ref = await service.admitEncodedFile({
|
|
142
|
+
data: params.data,
|
|
143
|
+
...(typeof params.name === 'string' && params.name.length > 0 ? { name: params.name } : {}),
|
|
144
|
+
});
|
|
145
|
+
return { ref };
|
|
146
|
+
} catch (error) {
|
|
147
|
+
throw attachmentError(error);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
const absolute = isAbsolute(params.path) ? params.path : resolve(cwdFor(params.sessionId), params.path);
|
|
151
|
+
let info;
|
|
152
|
+
try {
|
|
153
|
+
info = await stat(absolute);
|
|
154
|
+
} catch {
|
|
155
|
+
throw new FileInputError('session/attachment-invalid', `cannot read file: ${params.path}`, { reason: 'FILE_UNREADABLE' });
|
|
156
|
+
}
|
|
157
|
+
if (!info.isFile()) {
|
|
158
|
+
throw new FileInputError('session/attachment-invalid', `not a file: ${params.path}`, { reason: 'FILE_UNREADABLE' });
|
|
159
|
+
}
|
|
160
|
+
try {
|
|
161
|
+
return { ref: await commitStream(absolute, basename(absolute)) };
|
|
162
|
+
} catch (error) {
|
|
163
|
+
throw error instanceof FileInputError ? error : attachmentError(error);
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
return { methods };
|
|
169
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// Client-invokable control over the engine's same-session goal (`ctx.goals`,
|
|
2
|
+
// @deepseek-ai/dsh-goal GoalService). The runtime's `/goal` command covers
|
|
3
|
+
// create / edit objective / pause / resume / clear; it cannot change the round
|
|
4
|
+
// cap or mark a goal complete, so a goal blocked at its round limit
|
|
5
|
+
// (`round-limit`) could only be cleared. These methods expose the service's own
|
|
6
|
+
// compare-and-set operations:
|
|
7
|
+
//
|
|
8
|
+
// goal/get { sessionId } -> { goal: GoalView | null }
|
|
9
|
+
// goal/update { sessionId, id, revision, action, objective?, maxGoalRounds?, resume? }
|
|
10
|
+
// -> { goal: GoalView | null }
|
|
11
|
+
// action edit objective and/or maxGoalRounds (phase unchanged);
|
|
12
|
+
// `resume: true` then resumes the edited revision, so
|
|
13
|
+
// raising the cap of a `round-limit` goal continues it.
|
|
14
|
+
// pause | resume | complete | clear
|
|
15
|
+
//
|
|
16
|
+
// `id` + `revision` are the current goal ref (`goal/get`); a stale ref refuses
|
|
17
|
+
// with `goal/stale-revision`. Every mutation goes through the service, so the
|
|
18
|
+
// durable `goal/change` record, the activation edge and the round driver are
|
|
19
|
+
// exactly what the `/goal` command and the model's `update_goal` produce.
|
|
20
|
+
// Errors carry codes as a `code: message` prefix (queue.js's convention).
|
|
21
|
+
|
|
22
|
+
export const GOAL_METHODS = Object.freeze(['goal/get', 'goal/update']);
|
|
23
|
+
|
|
24
|
+
const ACTIONS = new Set(['edit', 'pause', 'resume', 'complete', 'clear']);
|
|
25
|
+
|
|
26
|
+
export class GoalRpcError extends Error {
|
|
27
|
+
constructor(code, message) {
|
|
28
|
+
super(`${code}: ${message}`);
|
|
29
|
+
this.name = 'GoalRpcError';
|
|
30
|
+
this.code = code;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** The service's GoalError codes in the wire vocabulary. */
|
|
35
|
+
function wireCode(code) {
|
|
36
|
+
switch (code) {
|
|
37
|
+
case 'GOAL_STALE_REVISION':
|
|
38
|
+
return 'goal/stale-revision';
|
|
39
|
+
case 'GOAL_NOT_FOUND':
|
|
40
|
+
return 'goal/not-found';
|
|
41
|
+
case 'GOAL_INVALID_MAX_ROUNDS':
|
|
42
|
+
case 'GOAL_INVALID_OBJECTIVE':
|
|
43
|
+
case 'GOAL_INVALID_EDIT':
|
|
44
|
+
return 'gateway/bad-request';
|
|
45
|
+
default:
|
|
46
|
+
return 'goal/invalid-transition';
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** A detached plain view (the service already returns fresh objects). */
|
|
51
|
+
function viewOf(goal) {
|
|
52
|
+
return goal === undefined || goal === null ? null : { ...goal };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @param {object} deps
|
|
57
|
+
* @param {() => any} deps.goals - resolves the mounted GoalService (or undefined).
|
|
58
|
+
* @param {(sessionId: string) => any} deps.agentFor - the live-agent lookup.
|
|
59
|
+
*/
|
|
60
|
+
export function createGoalControl({ goals, agentFor }) {
|
|
61
|
+
const service = () => {
|
|
62
|
+
const resolved = goals();
|
|
63
|
+
if (resolved === undefined || typeof resolved.get !== 'function' || typeof resolved.edit !== 'function') {
|
|
64
|
+
throw new GoalRpcError('goal/unavailable', 'Goals are not available in this runtime.');
|
|
65
|
+
}
|
|
66
|
+
return resolved;
|
|
67
|
+
};
|
|
68
|
+
const requireAgent = (params, method) => {
|
|
69
|
+
if (typeof params?.sessionId !== 'string' || params.sessionId.length === 0) {
|
|
70
|
+
throw new GoalRpcError('gateway/bad-request', `${method} requires a non-empty sessionId`);
|
|
71
|
+
}
|
|
72
|
+
const agent = agentFor(params.sessionId);
|
|
73
|
+
if (agent === undefined) throw new GoalRpcError('session/not-found', `session "${params.sessionId}" not found (not attached)`);
|
|
74
|
+
return agent;
|
|
75
|
+
};
|
|
76
|
+
const guarded = (run) => {
|
|
77
|
+
try {
|
|
78
|
+
return run();
|
|
79
|
+
} catch (error) {
|
|
80
|
+
if (error instanceof GoalRpcError) throw error;
|
|
81
|
+
if (error instanceof Error && typeof error.code === 'string' && error.code.startsWith('GOAL_')) {
|
|
82
|
+
throw new GoalRpcError(wireCode(error.code), error.message);
|
|
83
|
+
}
|
|
84
|
+
throw error;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const methods = {
|
|
88
|
+
async 'goal/get'(params) {
|
|
89
|
+
const agent = requireAgent(params, 'goal/get');
|
|
90
|
+
return { goal: viewOf(guarded(() => service().get(agent))) };
|
|
91
|
+
},
|
|
92
|
+
async 'goal/update'(params) {
|
|
93
|
+
const agent = requireAgent(params, 'goal/update');
|
|
94
|
+
const action = params?.action;
|
|
95
|
+
if (!ACTIONS.has(action)) throw new GoalRpcError('gateway/bad-request', `goal/update action must be one of ${[...ACTIONS].join(', ')}`);
|
|
96
|
+
if (typeof params.id !== 'string' || !Number.isSafeInteger(params.revision)) {
|
|
97
|
+
throw new GoalRpcError('gateway/bad-request', 'goal/update requires the current goal id and revision');
|
|
98
|
+
}
|
|
99
|
+
const ref = { id: params.id, revision: params.revision };
|
|
100
|
+
const goals = service();
|
|
101
|
+
return guarded(() => {
|
|
102
|
+
switch (action) {
|
|
103
|
+
case 'edit': {
|
|
104
|
+
const request = {
|
|
105
|
+
...(typeof params.objective === 'string' ? { objective: params.objective } : {}),
|
|
106
|
+
...(params.maxGoalRounds === undefined ? {} : { maxGoalRounds: params.maxGoalRounds }),
|
|
107
|
+
};
|
|
108
|
+
const edited = goals.edit(agent, ref, request);
|
|
109
|
+
if (params.resume !== true) return { goal: viewOf(edited) };
|
|
110
|
+
// A goal already running armed has nothing to resume.
|
|
111
|
+
if (edited.phase === 'active' && edited.activation === 'armed') return { goal: viewOf(edited) };
|
|
112
|
+
return { goal: viewOf(goals.resume(agent, { id: edited.id, revision: edited.revision })) };
|
|
113
|
+
}
|
|
114
|
+
case 'pause':
|
|
115
|
+
return { goal: viewOf(goals.pause(agent, ref)) };
|
|
116
|
+
case 'resume':
|
|
117
|
+
return { goal: viewOf(goals.resume(agent, ref)) };
|
|
118
|
+
case 'complete':
|
|
119
|
+
return { goal: viewOf(goals.complete(agent, ref)) };
|
|
120
|
+
case 'clear':
|
|
121
|
+
goals.clear(agent, ref);
|
|
122
|
+
return { goal: null };
|
|
123
|
+
/* c8 ignore next 2 -- ACTIONS is checked above */
|
|
124
|
+
default:
|
|
125
|
+
throw new GoalRpcError('gateway/bad-request', `unknown action ${String(action)}`);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
return { methods };
|
|
131
|
+
}
|