wicked-crew 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/audit.d.ts +57 -0
- package/dist/api/audit.d.ts.map +1 -0
- package/dist/api/audit.js +115 -0
- package/dist/api/audit.js.map +1 -0
- package/dist/api/auth.d.ts +192 -0
- package/dist/api/auth.d.ts.map +1 -0
- package/dist/api/auth.js +515 -0
- package/dist/api/auth.js.map +1 -0
- package/dist/api/gate-cache.d.ts +8 -0
- package/dist/api/gate-cache.d.ts.map +1 -1
- package/dist/api/gate-cache.js +10 -0
- package/dist/api/gate-cache.js.map +1 -1
- package/dist/api/open-path.d.ts +18 -0
- package/dist/api/open-path.d.ts.map +1 -0
- package/dist/api/open-path.js +79 -0
- package/dist/api/open-path.js.map +1 -0
- package/dist/api/routes.d.ts +112 -1
- package/dist/api/routes.d.ts.map +1 -1
- package/dist/api/routes.js +435 -16
- package/dist/api/routes.js.map +1 -1
- package/dist/api/seat-health.d.ts +55 -0
- package/dist/api/seat-health.d.ts.map +1 -0
- package/dist/api/seat-health.js +273 -0
- package/dist/api/seat-health.js.map +1 -0
- package/dist/api/seat-signin.d.ts +27 -0
- package/dist/api/seat-signin.d.ts.map +1 -0
- package/dist/api/seat-signin.js +143 -0
- package/dist/api/seat-signin.js.map +1 -0
- package/dist/api/server.d.ts +111 -3
- package/dist/api/server.d.ts.map +1 -1
- package/dist/api/server.js +236 -11
- package/dist/api/server.js.map +1 -1
- package/dist/cli/index.js +97 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/mcp.d.ts +14 -0
- package/dist/cli/mcp.d.ts.map +1 -0
- package/dist/cli/mcp.js +119 -0
- package/dist/cli/mcp.js.map +1 -0
- package/dist/core/adapter.d.ts +64 -1
- package/dist/core/adapter.d.ts.map +1 -1
- package/dist/core/adapter.js +162 -4
- package/dist/core/adapter.js.map +1 -1
- package/dist/core/types.d.ts +23 -361
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js +11 -4
- package/dist/core/types.js.map +1 -1
- package/dist/interactive/bridge-pool.d.ts +71 -0
- package/dist/interactive/bridge-pool.d.ts.map +1 -0
- package/dist/interactive/bridge-pool.js +187 -0
- package/dist/interactive/bridge-pool.js.map +1 -0
- package/dist/interactive/bridge-root.d.ts +36 -0
- package/dist/interactive/bridge-root.d.ts.map +1 -0
- package/dist/interactive/bridge-root.js +48 -0
- package/dist/interactive/bridge-root.js.map +1 -0
- package/dist/interactive/draft-events.d.ts +144 -0
- package/dist/interactive/draft-events.d.ts.map +1 -0
- package/dist/interactive/draft-events.js +490 -0
- package/dist/interactive/draft-events.js.map +1 -0
- package/dist/interactive/edit-events.d.ts +172 -0
- package/dist/interactive/edit-events.d.ts.map +1 -0
- package/dist/interactive/edit-events.js +530 -0
- package/dist/interactive/edit-events.js.map +1 -0
- package/dist/interactive/ledger.d.ts +39 -0
- package/dist/interactive/ledger.d.ts.map +1 -0
- package/dist/interactive/ledger.js +93 -0
- package/dist/interactive/ledger.js.map +1 -0
- package/dist/interactive/proxy-routes.d.ts +39 -0
- package/dist/interactive/proxy-routes.d.ts.map +1 -0
- package/dist/interactive/proxy-routes.js +189 -0
- package/dist/interactive/proxy-routes.js.map +1 -0
- package/dist/interactive/ws-relay.d.ts +85 -0
- package/dist/interactive/ws-relay.d.ts.map +1 -0
- package/dist/interactive/ws-relay.js +191 -0
- package/dist/interactive/ws-relay.js.map +1 -0
- package/dist/projects/activity.d.ts +29 -0
- package/dist/projects/activity.d.ts.map +1 -0
- package/dist/projects/activity.js +172 -0
- package/dist/projects/activity.js.map +1 -0
- package/dist/projects/charter.d.ts +28 -0
- package/dist/projects/charter.d.ts.map +1 -0
- package/dist/projects/charter.js +53 -0
- package/dist/projects/charter.js.map +1 -0
- package/dist/projects/events.d.ts +55 -0
- package/dist/projects/events.d.ts.map +1 -0
- package/dist/projects/events.js +141 -0
- package/dist/projects/events.js.map +1 -0
- package/dist/projects/membership-index.d.ts +25 -0
- package/dist/projects/membership-index.d.ts.map +1 -0
- package/dist/projects/membership-index.js +46 -0
- package/dist/projects/membership-index.js.map +1 -0
- package/dist/projects/routes.d.ts +90 -0
- package/dist/projects/routes.d.ts.map +1 -0
- package/dist/projects/routes.js +388 -0
- package/dist/projects/routes.js.map +1 -0
- package/dist/projects/settings.d.ts +32 -0
- package/dist/projects/settings.d.ts.map +1 -0
- package/dist/projects/settings.js +64 -0
- package/dist/projects/settings.js.map +1 -0
- package/dist/qe/acceptance.d.ts +137 -0
- package/dist/qe/acceptance.d.ts.map +1 -0
- package/dist/qe/acceptance.js +249 -0
- package/dist/qe/acceptance.js.map +1 -0
- package/dist/qe/gate-events.d.ts +111 -0
- package/dist/qe/gate-events.d.ts.map +1 -0
- package/dist/qe/gate-events.js +168 -0
- package/dist/qe/gate-events.js.map +1 -0
- package/dist/qe/ledger.d.ts +100 -0
- package/dist/qe/ledger.d.ts.map +1 -0
- package/dist/qe/ledger.js +154 -0
- package/dist/qe/ledger.js.map +1 -0
- package/dist/studio/assets/index-CCwXa1cn.js +428 -0
- package/dist/studio/assets/index-HWxo0h41.css +32 -0
- package/dist/studio/index.html +2 -2
- package/package.json +10 -4
- package/dist/studio/assets/index-DaaUU8Ep.css +0 -32
- package/dist/studio/assets/index-Fu5DRC00.js +0 -423
package/dist/cli/mcp.js
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `wicked-crew mcp` — stdio MCP server that proxies the wicked-crew daemon's
|
|
3
|
+
* run-lifecycle surface. One tool per verb; all calls are 1:1 HTTP passthroughs
|
|
4
|
+
* to a running daemon. The MCP server is stateless: it carries NO in-process
|
|
5
|
+
* adapter and does NOT open the engine DB.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* wicked-crew mcp [--port <n>] # connects to daemon at 127.0.0.1:<port>
|
|
9
|
+
*
|
|
10
|
+
* The daemon must already be running (`wicked-crew serve`). Governance semantics,
|
|
11
|
+
* repo-scoping, and run authority all live in the daemon — no new authority here.
|
|
12
|
+
*/
|
|
13
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
14
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
15
|
+
import { z } from 'zod';
|
|
16
|
+
// ─── Crew daemon client ───────────────────────────────────────────────────────
|
|
17
|
+
class CrewClient {
|
|
18
|
+
base;
|
|
19
|
+
constructor(port) {
|
|
20
|
+
this.base = `http://127.0.0.1:${port}/api/v1`;
|
|
21
|
+
}
|
|
22
|
+
async get(path) {
|
|
23
|
+
const res = await fetch(`${this.base}${path}`);
|
|
24
|
+
if (!res.ok)
|
|
25
|
+
throw new Error(`GET ${path} → ${res.status}: ${await res.text()}`);
|
|
26
|
+
return res.json();
|
|
27
|
+
}
|
|
28
|
+
async post(path, body) {
|
|
29
|
+
const res = await fetch(`${this.base}${path}`, {
|
|
30
|
+
method: 'POST',
|
|
31
|
+
headers: { 'Content-Type': 'application/json' },
|
|
32
|
+
body: JSON.stringify(body),
|
|
33
|
+
});
|
|
34
|
+
if (!res.ok)
|
|
35
|
+
throw new Error(`POST ${path} → ${res.status}: ${await res.text()}`);
|
|
36
|
+
return res.json();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
// ─── Tool result helpers ──────────────────────────────────────────────────────
|
|
40
|
+
function ok(data) {
|
|
41
|
+
return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
|
|
42
|
+
}
|
|
43
|
+
// ─── MCP server ──────────────────────────────────────────────────────────────
|
|
44
|
+
export async function runMcpServer(port) {
|
|
45
|
+
const client = new CrewClient(port);
|
|
46
|
+
// Probe the daemon before advertising ourselves — fail loudly if unreachable.
|
|
47
|
+
// Capture the version from the health response so serverInfo stays in sync with the daemon.
|
|
48
|
+
let daemonVersion = '0.0.0';
|
|
49
|
+
try {
|
|
50
|
+
const health = await client.get('/health');
|
|
51
|
+
if (typeof health.version === 'string')
|
|
52
|
+
daemonVersion = health.version;
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
throw new Error(`[wicked-crew mcp] Cannot reach daemon at port ${port}. ` +
|
|
56
|
+
`Start it first with: wicked-crew serve --port ${port}`);
|
|
57
|
+
}
|
|
58
|
+
const server = new McpServer({ name: 'wicked-crew', version: daemonVersion });
|
|
59
|
+
// ── launch_run ─────────────────────────────────────────────────────────────
|
|
60
|
+
server.tool('launch_run', 'Launch a new governed workflow run on the wicked-crew daemon. ' +
|
|
61
|
+
'Returns the run ID which can be used with the other tools.', {
|
|
62
|
+
problem: z.string().min(1).describe('The task description / problem statement for the run'),
|
|
63
|
+
workflow: z.string().optional().describe('Workflow id (e.g. "feature", "bug", "survey-repo"). ' +
|
|
64
|
+
'Use list_workflows to see available ids.'),
|
|
65
|
+
repo: z.string().optional().describe('Registered repo reference (id returned by the daemon registry). ' +
|
|
66
|
+
'Required for workflows that need a code graph.'),
|
|
67
|
+
project_id: z.string().optional().describe('File the run into a project. The project must exist and be active.'),
|
|
68
|
+
}, async ({ problem, workflow, repo, project_id }) => {
|
|
69
|
+
const body = { problem };
|
|
70
|
+
if (workflow)
|
|
71
|
+
body['workflow'] = workflow;
|
|
72
|
+
if (repo)
|
|
73
|
+
body['repoRef'] = repo;
|
|
74
|
+
if (project_id)
|
|
75
|
+
body['projectId'] = project_id;
|
|
76
|
+
return ok(await client.post('/runs', body));
|
|
77
|
+
});
|
|
78
|
+
// ── run_status ─────────────────────────────────────────────────────────────
|
|
79
|
+
server.tool('run_status', 'Get the current status and unit details of a run. ' +
|
|
80
|
+
'Poll this after launch_run to track progress.', {
|
|
81
|
+
run_id: z.string().min(1).describe('The run ID returned by launch_run'),
|
|
82
|
+
}, async ({ run_id }) => ok(await client.get(`/runs/${run_id}`)));
|
|
83
|
+
// ── list_runs ──────────────────────────────────────────────────────────────
|
|
84
|
+
server.tool('list_runs', 'List all runs on the daemon, most-actionable first (awaiting gate/elicitation first, ' +
|
|
85
|
+
'then active, then completed).', {}, async () => ok(await client.get('/runs')));
|
|
86
|
+
// ── run_events ─────────────────────────────────────────────────────────────
|
|
87
|
+
server.tool('run_events', 'Return the durable event trail for a run. ' +
|
|
88
|
+
'Useful for inspecting exactly what happened during a governed workflow. ' +
|
|
89
|
+
'The daemon returns all events; `limit` truncates client-side (most-recent last).', {
|
|
90
|
+
run_id: z.string().min(1).describe('The run ID'),
|
|
91
|
+
limit: z.number().int().min(1).max(1000).optional().describe('Maximum number of events to return. Truncated from the tail (most-recent). Default: all.'),
|
|
92
|
+
}, async ({ run_id, limit }) => {
|
|
93
|
+
const data = await client.get(`/runs/${run_id}/events`);
|
|
94
|
+
const events = limit !== undefined ? data.events.slice(-limit) : data.events;
|
|
95
|
+
return ok({ ...data, returned: events.length, events });
|
|
96
|
+
});
|
|
97
|
+
// ── answer_gate ────────────────────────────────────────────────────────────
|
|
98
|
+
server.tool('answer_gate', 'Approve or reject the human gate on a run. ' +
|
|
99
|
+
'Use run_status to check if a run is awaiting a gate decision before calling this.', {
|
|
100
|
+
run_id: z.string().min(1).describe('The run ID'),
|
|
101
|
+
approve: z.boolean().describe('true to approve, false to reject'),
|
|
102
|
+
amend: z.string().optional().describe('Optional steering text appended to the next unit\'s prompt when approving'),
|
|
103
|
+
}, async ({ run_id, approve, amend }) => {
|
|
104
|
+
const body = { approve };
|
|
105
|
+
if (amend !== undefined)
|
|
106
|
+
body['amend'] = amend;
|
|
107
|
+
return ok(await client.post(`/runs/${run_id}/gate`, body));
|
|
108
|
+
});
|
|
109
|
+
// ── cancel_run ─────────────────────────────────────────────────────────────
|
|
110
|
+
server.tool('cancel_run', 'Cancel an active run. The run will be marked as failed immediately.', {
|
|
111
|
+
run_id: z.string().min(1).describe('The run ID to cancel'),
|
|
112
|
+
}, async ({ run_id }) => ok(await client.post(`/runs/${run_id}/cancel`, {})));
|
|
113
|
+
// ── list_workflows ─────────────────────────────────────────────────────────
|
|
114
|
+
server.tool('list_workflows', 'List all workflows available on the daemon, ' +
|
|
115
|
+
'including their phases and evidence-floor requirements.', {}, async () => ok(await client.get('/workflows')));
|
|
116
|
+
const transport = new StdioServerTransport();
|
|
117
|
+
await server.connect(transport);
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=mcp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/cli/mcp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,iFAAiF;AAEjF,MAAM,UAAU;IACG,IAAI,CAAS;IAE9B,YAAY,IAAY;QACtB,IAAI,CAAC,IAAI,GAAG,oBAAoB,IAAI,SAAS,CAAC;IAChD,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,IAAY;QACpB,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,GAAG,IAAI,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,GAAG,CAAC,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,OAAO,IAAI,MAAM,GAAG,CAAC,MAAM,KAAK,MAAM,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACjF,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;IACpB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,IAAY,EAAE,IAAa;QACpC,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,GAAG,IAAI,EAAE,EAAE;YAC7C,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;YAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;SAC3B,CAAC,CAAC;QACH,IAAI,CAAC,GAAG,CAAC,EAAE;YAA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AAE,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;QACnC,MAAM,IAAI,GAA4B,EAAE,OAAO,EAAE,CAAC;QAClD,IAAI,KAAK,KAAK,SAAS;YAAE,IAAI,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;QAC/C,OAAO,EAAE,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,SAAS,MAAM,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;IAC7D,CAAC,CACF,CAAC;IAEF,8EAA8E;IAC9E,MAAM,CAAC,IAAI,CACT,YAAY,EACZ,qEAAqE,EACrE;QACE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,sBAAsB,CAAC;KAC3D,EACD,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,SAAS,MAAM,SAAS,EAAE,EAAE,CAAC,CAAC,CAC1E,CAAC;IAEF,8EAA8E;IAC9E,MAAM,CAAC,IAAI,CACT,gBAAgB,EAChB,8CAA8C;QAC9C,yDAAyD,EACzD,EAAE,EACF,KAAK,IAAI,EAAE,CAAC,EAAE,CAAC,MAAM,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAC/C,CAAC;IAEF,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC"}
|
package/dist/core/adapter.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import type { CoreEvent, LaunchRunInput, RepoEntry, RepoOnboardRef, SessionView, RecordedEvent, GovernancePolicy, ConformanceRule, GovernanceClaim, CoverageReport, GraphKind, WorkflowDef, SystemSettings } from './types.js';
|
|
1
|
+
import type { CoreEvent, LaunchRunInput, RepoEntry, RepoOnboardRef, SessionView, RecordedEvent, GovernancePolicy, ConformanceRule, GovernanceClaim, CoverageReport, GraphKind, WorkflowDef, SystemSettings, Project, ProjectMember, InteractionRequest } from './types.js';
|
|
2
|
+
/** Where the daemon persists system settings. Exported so tests write fixtures to the ONE
|
|
3
|
+
* spelling of this path (the tests/ tree is audited against spelling core paths itself). */
|
|
4
|
+
export declare function settingsFilePath(): string;
|
|
2
5
|
/** Read user-registered workflow overlays from `dir` (the same dir `registerWorkflow` writes to).
|
|
3
6
|
*
|
|
4
7
|
* Skips: files whose id matches a built-in (those are `_writeBuiltinOverlay` artifacts written FOR
|
|
@@ -24,6 +27,14 @@ export declare const BUILTIN_WORKFLOWS: WorkflowDef[];
|
|
|
24
27
|
export declare class ChatUnsupportedError extends Error {
|
|
25
28
|
constructor(message: string);
|
|
26
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* The project surface (DES-PROJECT-001) is not available in this deployment — the installed
|
|
32
|
+
* wicked-core-ts predates 0.6.0. Typed for the same reason as `ChatUnsupportedError`: the routes
|
|
33
|
+
* answer 501 ("upgrade the engine") on this, never 400 ("fix your request").
|
|
34
|
+
*/
|
|
35
|
+
export declare class ProjectsUnsupportedError extends Error {
|
|
36
|
+
constructor(what: string);
|
|
37
|
+
}
|
|
27
38
|
/**
|
|
28
39
|
* `resolveElicitation` is not available in this deployment — the NAPI binding has not
|
|
29
40
|
* landed in the installed `wicked-core-ts` yet (DES-002 §4 P-1 stub).
|
|
@@ -107,6 +118,13 @@ export declare class CoreAdapter {
|
|
|
107
118
|
confirmGate(runId: string, approve: boolean, amend?: string): Promise<string>;
|
|
108
119
|
/** Cancel a run → the status token. */
|
|
109
120
|
cancelRun(runId: string): Promise<string>;
|
|
121
|
+
/**
|
|
122
|
+
* Archive (or unarchive) a TERMINAL run (crew#265) — write-off, not delete. Resolves `true`
|
|
123
|
+
* when the session existed, `false` for an unknown id (→ 404); REJECTS when the run is
|
|
124
|
+
* non-terminal (the route answers 409). Fail-closed on an old addon: method-presence guard,
|
|
125
|
+
* same doctrine as `injectWorkerMessage`.
|
|
126
|
+
*/
|
|
127
|
+
archiveRun(runId: string, archived: boolean, note?: string): Promise<boolean>;
|
|
110
128
|
/** Inject an operator message into a run's active PTY worker(s). target="all" or a CLI key. */
|
|
111
129
|
injectWorkerMessage(runId: string, message: string, target: string): Promise<string>;
|
|
112
130
|
/**
|
|
@@ -125,6 +143,51 @@ export declare class CoreAdapter {
|
|
|
125
143
|
sessionsDetail(): Promise<SessionView[]>;
|
|
126
144
|
/** A unit's captured transcript (string, or `null`). */
|
|
127
145
|
workOutput(unitId: string): Promise<string | null>;
|
|
146
|
+
/** True when the installed addon carries the project surface (0.6.0+). */
|
|
147
|
+
projectsSupported(): boolean;
|
|
148
|
+
private requireProjects;
|
|
149
|
+
projectCreate(name: string, description?: string): Promise<Project>;
|
|
150
|
+
projectUpdate(id: string, patch: {
|
|
151
|
+
name?: string | undefined;
|
|
152
|
+
description?: string | undefined;
|
|
153
|
+
status?: string | undefined;
|
|
154
|
+
}): Promise<Project>;
|
|
155
|
+
/** Every stored project (all statuses, newest first). The `default` project is NOT here — the
|
|
156
|
+
* route layer synthesizes it (ADR §7: computed, never stored). */
|
|
157
|
+
projectList(): Promise<Project[]>;
|
|
158
|
+
projectGet(id: string): Promise<Project | null>;
|
|
159
|
+
projectMembers(projectId: string): Promise<ProjectMember[]>;
|
|
160
|
+
/** Attach a member. `created:false` = the idempotent duplicate hit (emit no event for it). */
|
|
161
|
+
projectMemberAttach(projectId: string, kind: string, ref: string, meta?: Record<string, unknown>, attachedBy?: string): Promise<{
|
|
162
|
+
member: ProjectMember;
|
|
163
|
+
created: boolean;
|
|
164
|
+
}>;
|
|
165
|
+
/** Detach (tombstone). `false` = no such live member on that project (the route's 404). */
|
|
166
|
+
projectMemberDetach(projectId: string, memberId: string): Promise<boolean>;
|
|
167
|
+
/** The projects holding a live `(kind, ref)` membership — the run→project reverse read. */
|
|
168
|
+
memberProjects(kind: string, ref: string): Promise<string[]>;
|
|
169
|
+
/**
|
|
170
|
+
* Durable interaction requests (ADR §5.3), newest first — or `null` when this addon predates
|
|
171
|
+
* the binding (the `runEvents` convention: a missing capability must stay distinguishable from
|
|
172
|
+
* "no open prompts", or the caches' fallback chain misreports upgrades as empty inboxes).
|
|
173
|
+
*/
|
|
174
|
+
interactionRequests(sessionId?: string, status?: string): Promise<InteractionRequest[] | null>;
|
|
175
|
+
/** Capture a memory at a STRICT `kind:id[/…]` scope (the engine refuses malformed segments). */
|
|
176
|
+
captureMemory(content: string, scope: string): Promise<void>;
|
|
177
|
+
/** Memories within `scope`'s subtree, newest first — the ADR's memory.coverage probe. */
|
|
178
|
+
listMemories(scope: string, limit: number): Promise<{
|
|
179
|
+
content: string;
|
|
180
|
+
score: number;
|
|
181
|
+
tier: string;
|
|
182
|
+
}[]>;
|
|
183
|
+
/** Ingest a document (title + chunks) into the knowledge store. Returns the chunk count. */
|
|
184
|
+
ingestKnowledge(title: string, chunks: string[]): Promise<number>;
|
|
185
|
+
/** Recall up to `k` knowledge chunks relevant to `query`. */
|
|
186
|
+
recallKnowledge(query: string, k: number): Promise<{
|
|
187
|
+
content: string;
|
|
188
|
+
score: number;
|
|
189
|
+
source: string;
|
|
190
|
+
}[]>;
|
|
128
191
|
chatOpen(chatId: string, clis: string[], cwd?: string): Promise<{
|
|
129
192
|
cliKey: string;
|
|
130
193
|
ok: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/core/adapter.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACd,SAAS,EACT,cAAc,EACd,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,cAAc,EACd,SAAS,EACT,WAAW,EACX,cAAc,
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/core/adapter.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EAC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BlC;;;;;OAKG;IACG,gBAAgB,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC;IAiDzD;;;OAGG;IACG,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC;IAkBhG;;;;;OAKG;IACH,YAAY,CACV,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EAAE,GAAG,SAAS,EACzB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,OAAO,GAChB,OAAO,CAAC,MAAM,CAAC;IAIlB,2FAA2F;IAC3F,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIzD,mFAAmF;IACnF,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIvE,0FAA0F;IAC1F,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAMpC,WAAW,IAAI,OAAO,CAAC,cAAc,CAAC;IAsBtC,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC;IAS7E;;;OAGG;IACH,KAAK,IAAI,IAAI;CAMd"}
|
package/dist/core/adapter.js
CHANGED
|
@@ -43,7 +43,9 @@ function workflowOverlayDir() {
|
|
|
43
43
|
const home = process.env.HOME ?? process.env.USERPROFILE ?? '/tmp';
|
|
44
44
|
return join(home, '.config', 'wicked-core', 'workflows');
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
/** Where the daemon persists system settings. Exported so tests write fixtures to the ONE
|
|
47
|
+
* spelling of this path (the tests/ tree is audited against spelling core paths itself). */
|
|
48
|
+
export function settingsFilePath() {
|
|
47
49
|
return join(homedir(), '.config', 'wicked-core', 'settings.json');
|
|
48
50
|
}
|
|
49
51
|
/** Read user-registered workflow overlays from `dir` (the same dir `registerWorkflow` writes to).
|
|
@@ -109,6 +111,31 @@ function locateWickedCoreExe() {
|
|
|
109
111
|
// `subscribe` seam has a blast radius of exactly one file.
|
|
110
112
|
const require = createRequire(import.meta.url);
|
|
111
113
|
const { Core } = require('wicked-core-ts');
|
|
114
|
+
/**
|
|
115
|
+
* Does the installed wicked-core-ts addon understand `LaunchOptions.extraWriteRoots` (≥ 0.6.1)?
|
|
116
|
+
*
|
|
117
|
+
* A napi object silently IGNORES fields the addon doesn't declare, so passing the option to an
|
|
118
|
+
* older addon would launch a run whose boundary never widened — the worker then gets a boundary
|
|
119
|
+
* deny on the very deliverable path the caller declared (the crew#263 failure, resurrected
|
|
120
|
+
* silently). Fail CLOSED on version instead: same doctrine as the `projectId` guard below.
|
|
121
|
+
*/
|
|
122
|
+
function addonSupportsExtraWriteRoots() {
|
|
123
|
+
try {
|
|
124
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
125
|
+
const pkg = require('wicked-core-ts/package.json');
|
|
126
|
+
// Match only the numeric MAJOR.MINOR.PATCH prefix: `split('.').map(Number)` returns NaN on
|
|
127
|
+
// pre-release/build suffixes (`0.6.1-beta.1`), which would fail-closed a capable addon
|
|
128
|
+
// (Copilot). No match ⇒ unparseable ⇒ fail closed.
|
|
129
|
+
const m = /^(\d+)\.(\d+)\.(\d+)/.exec(pkg.version ?? '');
|
|
130
|
+
if (!m)
|
|
131
|
+
return false;
|
|
132
|
+
const [maj, min, pat] = [Number(m[1]), Number(m[2]), Number(m[3])];
|
|
133
|
+
return maj > 0 || min > 6 || (min === 6 && pat >= 1);
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
112
139
|
// ── Built-in workflow definitions (crew#44) ──────────────────────────────────
|
|
113
140
|
// Static mirrors of wicked-core workflow defs: feature, bug, migration, survey-repo,
|
|
114
141
|
// domain-graph-slice, memories, collab, onboarding, chat, and domain-extraction.
|
|
@@ -149,7 +176,7 @@ const CORE_SEEDED_WORKFLOWS = new Set(['feature', 'bug', 'migration', 'onboardin
|
|
|
149
176
|
* moves. This is display only: as of FINDING-049 these defs are never written to core's overlay dir
|
|
150
177
|
* (see CORE_SEEDED_WORKFLOWS), so a stale value here cannot reach the engine.
|
|
151
178
|
*/
|
|
152
|
-
const EVIDENCE_FLOOR_PIN = '
|
|
179
|
+
const EVIDENCE_FLOOR_PIN = 'e2e7af1db9e48454';
|
|
153
180
|
export const BUILTIN_WORKFLOWS = [
|
|
154
181
|
{
|
|
155
182
|
id: 'chat',
|
|
@@ -184,7 +211,7 @@ export const BUILTIN_WORKFLOWS = [
|
|
|
184
211
|
{ id: 'design', kind: 'recon', gate_type: 'strategy', gate: 'auto', executes_code: false, verified_evidence: false, required_deliverables: [], depends_on: ['clarify'], role: 'neutral', skill_ref: null, allowed_skills: [], validator_pin: null },
|
|
185
212
|
{ id: 'build', kind: 'build', gate_type: 'execution', gate: 'auto', executes_code: true, verified_evidence: false, required_deliverables: [], depends_on: ['design'], role: 'creator', skill_ref: null, allowed_skills: [], validator_pin: null },
|
|
186
213
|
{ id: 'adversarial-review', kind: 'review', gate_type: 'execution', gate: { human_confirm: { unconditional: false } }, executes_code: false, verified_evidence: false, required_deliverables: [], depends_on: ['build'], role: 'evaluator', skill_ref: null, allowed_skills: [], validator_pin: EVIDENCE_FLOOR_PIN },
|
|
187
|
-
{ id: 'test', kind: 'test', gate_type: 'execution', gate: { human_confirm_if: 'verdict_not_pass' }, executes_code: false, verified_evidence: true, required_deliverables: [], depends_on: ['build'], role: 'neutral', skill_ref: null, allowed_skills: [], validator_pin:
|
|
214
|
+
{ id: 'test', kind: 'test', gate_type: 'execution', gate: { human_confirm_if: 'verdict_not_pass' }, executes_code: false, verified_evidence: true, required_deliverables: [], depends_on: ['build'], role: 'neutral', skill_ref: null, allowed_skills: [], validator_pin: EVIDENCE_FLOOR_PIN },
|
|
188
215
|
{ id: 'review', kind: 'review', gate_type: 'execution', gate: 'auto', executes_code: false, verified_evidence: false, required_deliverables: [], depends_on: ['test'], role: 'neutral', skill_ref: null, allowed_skills: [], validator_pin: null },
|
|
189
216
|
],
|
|
190
217
|
},
|
|
@@ -278,7 +305,7 @@ export const BUILTIN_WORKFLOWS = [
|
|
|
278
305
|
{ id: 'survey', kind: 'recon', gate_type: null, gate: 'auto', executes_code: false, verified_evidence: false, required_deliverables: [], depends_on: [], role: 'neutral', skill_ref: 'wicked-garden-domain', allowed_skills: [], validator_pin: null },
|
|
279
306
|
{ id: 'analyze', kind: 'recon', gate_type: null, gate: 'auto', executes_code: false, verified_evidence: false, required_deliverables: [], depends_on: ['survey'], role: 'neutral', skill_ref: 'wicked-garden-domain', allowed_skills: [], validator_pin: null },
|
|
280
307
|
{ id: 'extract', kind: 'recon', gate_type: 'value', gate: 'auto', executes_code: false, verified_evidence: false, required_deliverables: [], depends_on: ['analyze'], role: 'creator', skill_ref: 'wicked-garden-domain-extractor', allowed_skills: [], validator_pin: null },
|
|
281
|
-
{ id: 'coverage', kind: 'test', gate_type: 'execution', gate: { human_confirm_if: 'verdict_not_pass' }, executes_code: false, verified_evidence: true, required_deliverables: ['coverage-report.json'], depends_on: ['extract'], role: 'evaluator', skill_ref: 'wicked-garden-domain-coverage', allowed_skills: [], validator_pin: '
|
|
308
|
+
{ id: 'coverage', kind: 'test', gate_type: 'execution', gate: { human_confirm_if: 'verdict_not_pass' }, executes_code: false, verified_evidence: true, required_deliverables: ['coverage-report.json'], depends_on: ['extract'], role: 'evaluator', skill_ref: 'wicked-garden-domain-coverage', allowed_skills: [], validator_pin: 'bfe4020a365c598b' },
|
|
282
309
|
// domain-graph is a DETERMINISTIC Tool that runs `wicked-core domain-graph`, which PERSISTS the
|
|
283
310
|
// domain/requirement/rule graph into the repo store (core#237) — not an LLM skill that could hit
|
|
284
311
|
// a non-persisting hermetic fallback. Mirrors wicked-core/workflows/domain-extraction.json.
|
|
@@ -304,6 +331,17 @@ export class ChatUnsupportedError extends Error {
|
|
|
304
331
|
this.name = 'ChatUnsupportedError';
|
|
305
332
|
}
|
|
306
333
|
}
|
|
334
|
+
/**
|
|
335
|
+
* The project surface (DES-PROJECT-001) is not available in this deployment — the installed
|
|
336
|
+
* wicked-core-ts predates 0.6.0. Typed for the same reason as `ChatUnsupportedError`: the routes
|
|
337
|
+
* answer 501 ("upgrade the engine") on this, never 400 ("fix your request").
|
|
338
|
+
*/
|
|
339
|
+
export class ProjectsUnsupportedError extends Error {
|
|
340
|
+
constructor(what) {
|
|
341
|
+
super(`${what} is not supported by this wicked-core build (needs wicked-core-ts >= 0.6.0)`);
|
|
342
|
+
this.name = 'ProjectsUnsupportedError';
|
|
343
|
+
}
|
|
344
|
+
}
|
|
307
345
|
/**
|
|
308
346
|
* `resolveElicitation` is not available in this deployment — the NAPI binding has not
|
|
309
347
|
* landed in the installed `wicked-core-ts` yet (DES-002 §4 P-1 stub).
|
|
@@ -490,6 +528,23 @@ export class CoreAdapter {
|
|
|
490
528
|
opts.humanConfirm = input.humanConfirm;
|
|
491
529
|
if (input.repoRef !== undefined)
|
|
492
530
|
opts.repoRef = input.repoRef;
|
|
531
|
+
if (input.projectId !== undefined) {
|
|
532
|
+
// Fail CLOSED on an old addon: silently dropping projectId would launch an unfiled run the
|
|
533
|
+
// caller believed was filed — the exact failure §2.2 exists to prevent.
|
|
534
|
+
if (typeof this.core.projectCreate !== 'function') {
|
|
535
|
+
throw new ProjectsUnsupportedError('Filing a run into a project');
|
|
536
|
+
}
|
|
537
|
+
opts.projectId = input.projectId;
|
|
538
|
+
}
|
|
539
|
+
if (input.extraWriteRoots !== undefined && input.extraWriteRoots.length > 0) {
|
|
540
|
+
// Fail CLOSED on an old addon (napi ignores undeclared fields): a silently-dropped
|
|
541
|
+
// widening resurrects the crew#263 boundary deny on the declared deliverable path.
|
|
542
|
+
if (!addonSupportsExtraWriteRoots()) {
|
|
543
|
+
throw new Error('extraWriteRoots needs wicked-core-ts >= 0.6.1; the installed addon would silently ' +
|
|
544
|
+
'ignore it and the run would be denied writing its own deliverable');
|
|
545
|
+
}
|
|
546
|
+
opts.extraWriteRoots = input.extraWriteRoots;
|
|
547
|
+
}
|
|
493
548
|
if (input.workflow !== undefined) {
|
|
494
549
|
opts.workflow = input.workflow;
|
|
495
550
|
// Ensure DROP-IN workflow definitions are present in the Rust overlay dir on first use.
|
|
@@ -524,6 +579,20 @@ export class CoreAdapter {
|
|
|
524
579
|
cancelRun(runId) {
|
|
525
580
|
return this.core.cancelRun(runId);
|
|
526
581
|
}
|
|
582
|
+
/**
|
|
583
|
+
* Archive (or unarchive) a TERMINAL run (crew#265) — write-off, not delete. Resolves `true`
|
|
584
|
+
* when the session existed, `false` for an unknown id (→ 404); REJECTS when the run is
|
|
585
|
+
* non-terminal (the route answers 409). Fail-closed on an old addon: method-presence guard,
|
|
586
|
+
* same doctrine as `injectWorkerMessage`.
|
|
587
|
+
*/
|
|
588
|
+
async archiveRun(runId, archived, note) {
|
|
589
|
+
const archive = this.core.archiveRun;
|
|
590
|
+
if (typeof archive !== 'function') {
|
|
591
|
+
throw new Error('Run archival needs wicked-core-ts >= 0.6.2; this build does not support it');
|
|
592
|
+
}
|
|
593
|
+
// JSON-encoded bool by contract (parse, never truthiness-test — 'false' is truthy).
|
|
594
|
+
return JSON.parse(await archive.call(this.core, runId, archived, note ?? null));
|
|
595
|
+
}
|
|
527
596
|
/** Inject an operator message into a run's active PTY worker(s). target="all" or a CLI key. */
|
|
528
597
|
injectWorkerMessage(runId, message, target) {
|
|
529
598
|
if (typeof this.core.injectWorkerMessage !== 'function') {
|
|
@@ -588,6 +657,87 @@ export class CoreAdapter {
|
|
|
588
657
|
async workOutput(unitId) {
|
|
589
658
|
return JSON.parse(await this.core.workOutput(unitId));
|
|
590
659
|
}
|
|
660
|
+
// ── Projects (DES-PROJECT-001) ──────────────────────────────────────────────
|
|
661
|
+
// 1:1 maps of the 0.6.0 engine surface. Writes ride the single-writer actor;
|
|
662
|
+
// reads are read-only store opens inside the addon. Every method throws
|
|
663
|
+
// ProjectsUnsupportedError on a pre-0.6.0 addon (routes answer 501).
|
|
664
|
+
/** True when the installed addon carries the project surface (0.6.0+). */
|
|
665
|
+
projectsSupported() {
|
|
666
|
+
return typeof this.core.projectCreate === 'function';
|
|
667
|
+
}
|
|
668
|
+
requireProjects(fn, what) {
|
|
669
|
+
if (typeof fn !== 'function')
|
|
670
|
+
throw new ProjectsUnsupportedError(what);
|
|
671
|
+
return fn;
|
|
672
|
+
}
|
|
673
|
+
async projectCreate(name, description) {
|
|
674
|
+
const fn = this.requireProjects(this.core.projectCreate, 'Creating a project');
|
|
675
|
+
return JSON.parse(await fn.call(this.core, name, description ?? null));
|
|
676
|
+
}
|
|
677
|
+
async projectUpdate(id, patch) {
|
|
678
|
+
const fn = this.requireProjects(this.core.projectUpdate, 'Updating a project');
|
|
679
|
+
return JSON.parse(await fn.call(this.core, id, patch.name ?? null, patch.description ?? null, patch.status ?? null));
|
|
680
|
+
}
|
|
681
|
+
/** Every stored project (all statuses, newest first). The `default` project is NOT here — the
|
|
682
|
+
* route layer synthesizes it (ADR §7: computed, never stored). */
|
|
683
|
+
async projectList() {
|
|
684
|
+
const fn = this.requireProjects(this.core.projectList, 'Listing projects');
|
|
685
|
+
return JSON.parse(await fn.call(this.core));
|
|
686
|
+
}
|
|
687
|
+
async projectGet(id) {
|
|
688
|
+
const fn = this.requireProjects(this.core.projectGet, 'Reading a project');
|
|
689
|
+
return JSON.parse(await fn.call(this.core, id));
|
|
690
|
+
}
|
|
691
|
+
async projectMembers(projectId) {
|
|
692
|
+
const fn = this.requireProjects(this.core.projectMembers, 'Listing project members');
|
|
693
|
+
return JSON.parse(await fn.call(this.core, projectId));
|
|
694
|
+
}
|
|
695
|
+
/** Attach a member. `created:false` = the idempotent duplicate hit (emit no event for it). */
|
|
696
|
+
async projectMemberAttach(projectId, kind, ref, meta, attachedBy) {
|
|
697
|
+
const fn = this.requireProjects(this.core.projectMemberAttach, 'Attaching a project member');
|
|
698
|
+
return JSON.parse(await fn.call(this.core, projectId, kind, ref, meta !== undefined ? JSON.stringify(meta) : null, attachedBy ?? null));
|
|
699
|
+
}
|
|
700
|
+
/** Detach (tombstone). `false` = no such live member on that project (the route's 404). */
|
|
701
|
+
async projectMemberDetach(projectId, memberId) {
|
|
702
|
+
const fn = this.requireProjects(this.core.projectMemberDetach, 'Detaching a project member');
|
|
703
|
+
return JSON.parse(await fn.call(this.core, projectId, memberId));
|
|
704
|
+
}
|
|
705
|
+
/** The projects holding a live `(kind, ref)` membership — the run→project reverse read. */
|
|
706
|
+
async memberProjects(kind, ref) {
|
|
707
|
+
const fn = this.requireProjects(this.core.memberProjects, 'Resolving a member’s projects');
|
|
708
|
+
return JSON.parse(await fn.call(this.core, kind, ref));
|
|
709
|
+
}
|
|
710
|
+
/**
|
|
711
|
+
* Durable interaction requests (ADR §5.3), newest first — or `null` when this addon predates
|
|
712
|
+
* the binding (the `runEvents` convention: a missing capability must stay distinguishable from
|
|
713
|
+
* "no open prompts", or the caches' fallback chain misreports upgrades as empty inboxes).
|
|
714
|
+
*/
|
|
715
|
+
async interactionRequests(sessionId, status) {
|
|
716
|
+
if (typeof this.core.interactionRequests !== 'function')
|
|
717
|
+
return null;
|
|
718
|
+
return JSON.parse(await this.core.interactionRequests(sessionId ?? null, status ?? null));
|
|
719
|
+
}
|
|
720
|
+
// ── The foundation record (ADR §3.2): charter writes + record probes ────────
|
|
721
|
+
/** Capture a memory at a STRICT `kind:id[/…]` scope (the engine refuses malformed segments). */
|
|
722
|
+
async captureMemory(content, scope) {
|
|
723
|
+
const fn = this.requireProjects(this.core.captureMemory, 'Capturing a memory');
|
|
724
|
+
await fn.call(this.core, content, scope);
|
|
725
|
+
}
|
|
726
|
+
/** Memories within `scope`'s subtree, newest first — the ADR's memory.coverage probe. */
|
|
727
|
+
async listMemories(scope, limit) {
|
|
728
|
+
const fn = this.requireProjects(this.core.listMemories, 'Listing memories');
|
|
729
|
+
return JSON.parse(await fn.call(this.core, scope, limit));
|
|
730
|
+
}
|
|
731
|
+
/** Ingest a document (title + chunks) into the knowledge store. Returns the chunk count. */
|
|
732
|
+
async ingestKnowledge(title, chunks) {
|
|
733
|
+
const fn = this.requireProjects(this.core.ingestKnowledge, 'Ingesting knowledge');
|
|
734
|
+
return JSON.parse(await fn.call(this.core, title, JSON.stringify(chunks)));
|
|
735
|
+
}
|
|
736
|
+
/** Recall up to `k` knowledge chunks relevant to `query`. */
|
|
737
|
+
async recallKnowledge(query, k) {
|
|
738
|
+
const fn = this.requireProjects(this.core.recallKnowledge, 'Recalling knowledge');
|
|
739
|
+
return JSON.parse(await fn.call(this.core, query, k));
|
|
740
|
+
}
|
|
591
741
|
// ── Chat sessions (core#134 / crew#165) ────────────────────────────────────
|
|
592
742
|
async chatOpen(chatId, clis, cwd) {
|
|
593
743
|
const raw = await this.core.chatOpen(chatId, JSON.stringify(clis), cwd ?? null);
|
|
@@ -1070,6 +1220,14 @@ export class CoreAdapter {
|
|
|
1070
1220
|
if (typeof v !== 'number' || !Number.isInteger(v) || v < 1 || v > 10000)
|
|
1071
1221
|
delete parsed.graphNodeLimit;
|
|
1072
1222
|
}
|
|
1223
|
+
// worker_config_root (seat sign-in): absolute path or "" (= engine default). A hand-edited
|
|
1224
|
+
// relative path is dropped rather than exported as WICKED_WORKER_HOME, where the engine
|
|
1225
|
+
// would resolve it against an arbitrary spawn cwd.
|
|
1226
|
+
if ('worker_config_root' in parsed) {
|
|
1227
|
+
const r = parsed.worker_config_root;
|
|
1228
|
+
if (typeof r !== 'string' || (r !== '' && !isAbsolute(r)))
|
|
1229
|
+
delete parsed.worker_config_root;
|
|
1230
|
+
}
|
|
1073
1231
|
return { ...DEFAULT_SETTINGS, ...parsed };
|
|
1074
1232
|
}
|
|
1075
1233
|
catch {
|