@trydreamstate/cli 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -16
- package/agent-plugin/.claude-plugin/plugin.json +1 -1
- package/agent-plugin/.codex-plugin/plugin.json +1 -1
- package/agent-plugin/hooks/approve-readonly.sh +15 -0
- package/agent-plugin/hooks/hooks.json +17 -0
- package/agent-plugin/skills/crm/SKILL.md +2 -2
- package/agent-plugin/skills/diagnostics/SKILL.md +1 -1
- package/agent-plugin/skills/dreamstate/SKILL.md +13 -5
- package/agent-plugin/skills/first-win/SKILL.md +2 -2
- package/agent-plugin/skills/inbox-replies/SKILL.md +1 -1
- package/agent-plugin/skills/knowledge/SKILL.md +1 -1
- package/agent-plugin/skills/linkedin-posts/SKILL.md +1 -1
- package/agent-plugin/skills/linkedin-warm-signals/SKILL.md +2 -2
- package/agent-plugin/skills/list-building/SKILL.md +4 -4
- package/agent-plugin/skills/outreach/SKILL.md +1 -1
- package/agent-plugin/skills/outreach/steps-and-timing.md +1 -1
- package/agent-plugin/skills/plays/SKILL.md +2 -2
- package/agent-plugin/skills/reddit-posts/SKILL.md +1 -1
- package/agent-plugin/skills/skill-authoring/SKILL.md +1 -1
- package/agent-plugin/skills/social/SKILL.md +2 -2
- package/agent-plugin/skills/visibility/SKILL.md +2 -2
- package/agent-plugin/skills/workflows/SKILL.md +3 -3
- package/agent-plugin/skills/worksheet-tidy/SKILL.md +1 -1
- package/agent-plugin/skills/writing/SKILL.md +1 -1
- package/agent-plugin/skills/x-posts/SKILL.md +1 -1
- package/dist/agentGuidance.generated.json +35 -0
- package/dist/client.d.ts +31 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +115 -33
- package/dist/commandTable.d.ts +26 -0
- package/dist/commandTable.d.ts.map +1 -0
- package/dist/commandTable.js +54 -0
- package/dist/commands/sequences.d.ts +1 -1
- package/dist/commands/sequences.d.ts.map +1 -1
- package/dist/commands/sequences.js +37 -36
- package/dist/commands/shared.d.ts +4 -26
- package/dist/commands/shared.d.ts.map +1 -1
- package/dist/commands/shared.js +129 -127
- package/dist/commands/workflows.d.ts +1 -1
- package/dist/commands/workflows.d.ts.map +1 -1
- package/dist/commands/workflows.js +35 -41
- package/dist/errors.d.ts +78 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +117 -0
- package/dist/gatedRun.d.ts +81 -0
- package/dist/gatedRun.d.ts.map +1 -0
- package/dist/gatedRun.js +370 -0
- package/dist/idempotency.d.ts +38 -0
- package/dist/idempotency.d.ts.map +1 -0
- package/dist/idempotency.js +106 -0
- package/dist/index.d.ts +21 -35
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +372 -366
- package/dist/runWait.d.ts +2 -1
- package/dist/runWait.d.ts.map +1 -1
- package/dist/runWait.js +3 -1
- package/dist/schemaCoercion.d.ts +20 -0
- package/dist/schemaCoercion.d.ts.map +1 -0
- package/dist/schemaCoercion.js +123 -0
- package/dist/skillInstaller.d.ts +40 -0
- package/dist/skillInstaller.d.ts.map +1 -1
- package/dist/skillInstaller.js +108 -9
- package/dist/tableFilePreview.d.ts +14 -0
- package/dist/tableFilePreview.d.ts.map +1 -1
- package/dist/tableFilePreview.js +19 -8
- package/dist/tableFileReader.d.ts +26 -0
- package/dist/tableFileReader.d.ts.map +1 -0
- package/dist/tableFileReader.js +108 -0
- package/dist/tablesImport.d.ts +57 -0
- package/dist/tablesImport.d.ts.map +1 -0
- package/dist/tablesImport.js +263 -0
- package/dist/turnCache.d.ts +14 -1
- package/dist/turnCache.d.ts.map +1 -1
- package/dist/turnCache.js +25 -8
- package/package.json +3 -2
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAGA,eAAO,MAA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C,MAAM,EAAE,OAAO,CAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAGhF,SAAS,CAAC,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAGhE,OAAO,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAOpF,aAAa,CACX,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,iBAAiB,EACvB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,GAC7B,OAAO,CAAC,OAAO,CAAC;IAYnB,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAGpC,QAAQ,CAAC,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAG/D,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAG/E,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAW/F,OAAO,CAAC,cAAc;YAQR,OAAO;CAkJtB"}
|
package/dist/client.js
CHANGED
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DreamstateClient = exports.CliError = exports.TOOL_AND_RUN_REQUEST_TIMEOUT_MS = exports.DEFAULT_REQUEST_TIMEOUT_MS = exports.CLI_VERSION = void 0;
|
|
3
|
+
exports.DreamstateClient = exports.CliError = exports.TOOL_AND_RUN_REQUEST_TIMEOUT_MS = exports.DEFAULT_REQUEST_TIMEOUT_MS = exports.CLI_UPDATE_COMMAND = exports.CLI_VERSION = void 0;
|
|
4
|
+
exports.readServerReleaseInfo = readServerReleaseInfo;
|
|
5
|
+
exports.describeVersionSkew = describeVersionSkew;
|
|
4
6
|
exports.readToolEnvelopeTraceId = readToolEnvelopeTraceId;
|
|
5
7
|
exports.requestDeviceAuthorization = requestDeviceAuthorization;
|
|
6
8
|
exports.claimDeviceAuthorization = claimDeviceAuthorization;
|
|
7
|
-
const
|
|
9
|
+
const idempotency_1 = require("./idempotency");
|
|
10
|
+
const errors_1 = require("./errors");
|
|
8
11
|
exports.CLI_VERSION = require('../package.json').version;
|
|
12
|
+
/** Command that updates the CLI. One constant so every surface prints the same one. */
|
|
13
|
+
exports.CLI_UPDATE_COMMAND = 'npm install -g @trydreamstate/cli@latest';
|
|
9
14
|
exports.DEFAULT_REQUEST_TIMEOUT_MS = 15_000;
|
|
10
15
|
exports.TOOL_AND_RUN_REQUEST_TIMEOUT_MS = 60_000;
|
|
11
|
-
/**
|
|
12
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Next steps for server workspace refusals. The server's message is forwarded
|
|
18
|
+
* unchanged; the CLI's own guidance travels beside it as details.cli_hint, so
|
|
19
|
+
* an agent reading either surface sees the same message and a script can tell
|
|
20
|
+
* what the server said from what the CLI added.
|
|
21
|
+
*/
|
|
22
|
+
const WORKSPACE_ERROR_HINTS = {
|
|
13
23
|
workspace_required: 'No workspace is selected. Run dreamstate workspaces list, then dreamstate workspaces use <workspace> (or pass --workspace <id|slug>).',
|
|
14
24
|
workspace_forbidden: 'You are not a member of that workspace. Run dreamstate workspaces list to see the workspaces you can use, then dreamstate workspaces use <workspace>.',
|
|
15
25
|
workspace_scoped_credential: 'This key is bound to one workspace. Run dreamstate login for a user session that can switch, or remove --workspace and DREAMSTATE_WORKSPACE.',
|
|
@@ -24,6 +34,8 @@ class CliError extends Error {
|
|
|
24
34
|
/** The server's retry decision and repair, forwarded unchanged so the CLI never re-derives them. */
|
|
25
35
|
retryable;
|
|
26
36
|
repair;
|
|
37
|
+
/** The server's own envelope meta (trace_id, server_version, ...), kept whole so a refusal prints what the server said. */
|
|
38
|
+
meta;
|
|
27
39
|
constructor(message, code, status, options = {}) {
|
|
28
40
|
super(message);
|
|
29
41
|
this.name = 'CliError';
|
|
@@ -41,9 +53,48 @@ class CliError extends Error {
|
|
|
41
53
|
this.retryable = options.retryable;
|
|
42
54
|
if (options.repair !== undefined)
|
|
43
55
|
this.repair = options.repair;
|
|
56
|
+
else if (code in errors_1.CLI_LOCAL_ERROR_REPAIRS)
|
|
57
|
+
this.repair = errors_1.CLI_LOCAL_ERROR_REPAIRS[code];
|
|
58
|
+
if (options.meta !== undefined)
|
|
59
|
+
this.meta = options.meta;
|
|
44
60
|
}
|
|
45
61
|
}
|
|
46
62
|
exports.CliError = CliError;
|
|
63
|
+
function metaRecord(payload) {
|
|
64
|
+
const meta = payload && typeof payload === 'object' ? payload.meta : undefined;
|
|
65
|
+
return meta && typeof meta === 'object' && !Array.isArray(meta) ? meta : undefined;
|
|
66
|
+
}
|
|
67
|
+
function nonEmptyString(value) {
|
|
68
|
+
return typeof value === 'string' && value.trim() ? value.trim() : null;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Release identity from one response, preferring the JSON envelope and falling
|
|
72
|
+
* back to the X-Dreamstate-* headers. Success and error envelopes carry it
|
|
73
|
+
* alike (contract C2), so this runs on both.
|
|
74
|
+
*/
|
|
75
|
+
function readServerReleaseInfo(payload, headers) {
|
|
76
|
+
const meta = metaRecord(payload);
|
|
77
|
+
const header = (name) => nonEmptyString(typeof headers?.get === 'function' ? headers.get(name) : null);
|
|
78
|
+
return {
|
|
79
|
+
server_version: nonEmptyString(meta?.server_version) ?? header('X-Dreamstate-Server-Version'),
|
|
80
|
+
minimum_cli_version: nonEmptyString(meta?.minimum_cli_version) ?? header('X-Dreamstate-Minimum-Cli-Version'),
|
|
81
|
+
release_sha: nonEmptyString(meta?.release_sha) ?? header('X-Dreamstate-Release-Sha'),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function describeVersionSkew(info, cliVersion = exports.CLI_VERSION) {
|
|
85
|
+
if (info.minimum_cli_version && isVersionGreater(info.minimum_cli_version, cliVersion))
|
|
86
|
+
return 'cli_below_minimum';
|
|
87
|
+
if (info.server_version && isVersionGreater(info.server_version, cliVersion))
|
|
88
|
+
return 'cli_behind_server';
|
|
89
|
+
return info.server_version || info.minimum_cli_version ? 'compatible' : 'unknown';
|
|
90
|
+
}
|
|
91
|
+
function updateRequiredError(minimum, cliVersion, status, details, meta) {
|
|
92
|
+
return new CliError(`CLI ${minimum} or newer is required (this is ${cliVersion}). Run: ${exports.CLI_UPDATE_COMMAND}`, 'cli_update_required', status, {
|
|
93
|
+
details: { ...details, minimum_cli_version: minimum, cli_version: cliVersion, update_command: exports.CLI_UPDATE_COMMAND },
|
|
94
|
+
retryable: false,
|
|
95
|
+
...(meta ? { meta } : {}),
|
|
96
|
+
});
|
|
97
|
+
}
|
|
47
98
|
function isApiErrorBody(value) {
|
|
48
99
|
const error = value && typeof value === 'object' ? value.error : null;
|
|
49
100
|
if (!error || typeof error !== 'object')
|
|
@@ -182,6 +233,11 @@ class DreamstateClient {
|
|
|
182
233
|
workspace;
|
|
183
234
|
requestTimeoutMs;
|
|
184
235
|
onVersionWarning;
|
|
236
|
+
releaseInfo = { server_version: null, minimum_cli_version: null, release_sha: null };
|
|
237
|
+
/** Release identity from the most recent response, success or error. */
|
|
238
|
+
get serverInfo() {
|
|
239
|
+
return { ...this.releaseInfo };
|
|
240
|
+
}
|
|
185
241
|
constructor(options) {
|
|
186
242
|
this.apiKey = options.apiKey;
|
|
187
243
|
this.baseUrl = options.baseUrl.replace(/\/+$/, '');
|
|
@@ -240,25 +296,26 @@ class DreamstateClient {
|
|
|
240
296
|
listRuns(query = {}) {
|
|
241
297
|
return this.request(`/runs${queryString(query)}`, {}, exports.TOOL_AND_RUN_REQUEST_TIMEOUT_MS);
|
|
242
298
|
}
|
|
243
|
-
resumeRun(id, body, idempotencyKey) {
|
|
244
|
-
const key = idempotencyKey ?? (0, node_crypto_1.randomUUID)();
|
|
245
|
-
return this.request(`/runs/${encodeURIComponent(id)}/resume`, {
|
|
246
|
-
method: 'POST',
|
|
247
|
-
body: JSON.stringify(body),
|
|
248
|
-
headers: { 'Idempotency-Key': key },
|
|
249
|
-
}, exports.TOOL_AND_RUN_REQUEST_TIMEOUT_MS);
|
|
250
|
-
}
|
|
251
299
|
getRunEvents(id, query = {}) {
|
|
252
300
|
return this.request(`/runs/${encodeURIComponent(id)}/events${queryString(query)}`);
|
|
253
301
|
}
|
|
254
302
|
cancelRun(id, body, idempotencyKey) {
|
|
255
|
-
|
|
303
|
+
// A re-run of the same cancel presents the same key, so a cancel whose reply was
|
|
304
|
+
// lost replays instead of racing the run's own state version.
|
|
305
|
+
const key = idempotencyKey ?? (0, idempotency_1.deterministicIdempotencyKey)({ scope: 'runs.cancel', workspace: this.workspace, body: { run_id: id, ...body } });
|
|
256
306
|
return this.request(`/runs/${encodeURIComponent(id)}/cancel`, {
|
|
257
307
|
method: 'POST',
|
|
258
308
|
body: JSON.stringify(body),
|
|
259
|
-
|
|
309
|
+
headers: { 'Idempotency-Key': key },
|
|
260
310
|
});
|
|
261
311
|
}
|
|
312
|
+
noteServerInfo(info) {
|
|
313
|
+
this.releaseInfo = {
|
|
314
|
+
server_version: info.server_version ?? this.releaseInfo.server_version,
|
|
315
|
+
minimum_cli_version: info.minimum_cli_version ?? this.releaseInfo.minimum_cli_version,
|
|
316
|
+
release_sha: info.release_sha ?? this.releaseInfo.release_sha,
|
|
317
|
+
};
|
|
318
|
+
}
|
|
262
319
|
async request(path, init = {}, defaultTimeoutMs = exports.DEFAULT_REQUEST_TIMEOUT_MS, allowIncompatibleCli = false) {
|
|
263
320
|
const requestTimeoutMs = this.requestTimeoutMs ?? defaultTimeoutMs;
|
|
264
321
|
let response;
|
|
@@ -283,9 +340,9 @@ class DreamstateClient {
|
|
|
283
340
|
}
|
|
284
341
|
catch (error) {
|
|
285
342
|
if (controller.signal.aborted) {
|
|
286
|
-
throw new CliError(
|
|
343
|
+
throw new CliError(errors_1.CLI_LOCAL_ERROR_CODES.request_timeout, 'request_timeout', 0, { idempotencyKey, repair: errors_1.CLI_LOCAL_ERROR_REPAIRS.request_timeout });
|
|
287
344
|
}
|
|
288
|
-
throw new CliError(`Request failed: ${error instanceof Error ? error.message : String(error)}`, 'network_error', 0);
|
|
345
|
+
throw new CliError(`Request failed: ${error instanceof Error ? error.message : String(error)}`, 'network_error', 0, { repair: errors_1.CLI_LOCAL_ERROR_REPAIRS.network_error });
|
|
289
346
|
}
|
|
290
347
|
finally {
|
|
291
348
|
clearTimeout(timeout);
|
|
@@ -295,8 +352,12 @@ class DreamstateClient {
|
|
|
295
352
|
payload = await response.json();
|
|
296
353
|
}
|
|
297
354
|
catch {
|
|
298
|
-
|
|
355
|
+
this.noteServerInfo(readServerReleaseInfo(undefined, response.headers));
|
|
356
|
+
throw new CliError(`Dreamstate API returned invalid JSON (HTTP ${response.status})`, 'invalid_response', response.status, { idempotencyKey, repair: errors_1.CLI_LOCAL_ERROR_REPAIRS.invalid_response });
|
|
299
357
|
}
|
|
358
|
+
const info = readServerReleaseInfo(payload, response.headers);
|
|
359
|
+
this.noteServerInfo(info);
|
|
360
|
+
const meta = metaRecord(payload);
|
|
300
361
|
if (isApiErrorBody(payload)) {
|
|
301
362
|
const retryAfterValue = retryAfter(response, payload);
|
|
302
363
|
if (!retriedRateLimit &&
|
|
@@ -307,8 +368,31 @@ class DreamstateClient {
|
|
|
307
368
|
await waitForRetryAfter(retryAfterValue);
|
|
308
369
|
continue;
|
|
309
370
|
}
|
|
310
|
-
|
|
311
|
-
|
|
371
|
+
if (payload.error.code === 'cli_update_required') {
|
|
372
|
+
// The server refused before executing anything (contract C3). Its own
|
|
373
|
+
// message is kept; the update command rides beside it.
|
|
374
|
+
const minimum = info.minimum_cli_version ?? '';
|
|
375
|
+
throw new CliError(payload.error.message, 'cli_update_required', response.status, {
|
|
376
|
+
details: {
|
|
377
|
+
...(payload.error.details && typeof payload.error.details === 'object' ? payload.error.details : {}),
|
|
378
|
+
...(minimum ? { minimum_cli_version: minimum } : {}),
|
|
379
|
+
cli_version: exports.CLI_VERSION,
|
|
380
|
+
update_command: exports.CLI_UPDATE_COMMAND,
|
|
381
|
+
},
|
|
382
|
+
retryAfter: retryAfterValue,
|
|
383
|
+
traceId: readToolEnvelopeTraceId(payload),
|
|
384
|
+
idempotencyKey,
|
|
385
|
+
retryable: false,
|
|
386
|
+
...(payload.error.repair && typeof payload.error.repair === 'object' ? { repair: payload.error.repair } : {}),
|
|
387
|
+
...(meta ? { meta } : {}),
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
const hint = WORKSPACE_ERROR_HINTS[payload.error.code];
|
|
391
|
+
const serverDetails = payload.error.details;
|
|
392
|
+
throw new CliError(payload.error.message, payload.error.code, response.status, {
|
|
393
|
+
...(hint
|
|
394
|
+
? { details: { ...(serverDetails && typeof serverDetails === 'object' && !Array.isArray(serverDetails) ? serverDetails : {}), cli_hint: hint } }
|
|
395
|
+
: { details: serverDetails }),
|
|
312
396
|
retryAfter: retryAfterValue,
|
|
313
397
|
traceId: readToolEnvelopeTraceId(payload),
|
|
314
398
|
idempotencyKey,
|
|
@@ -318,25 +402,23 @@ class DreamstateClient {
|
|
|
318
402
|
...(payload.error.repair && typeof payload.error.repair === 'object'
|
|
319
403
|
? { repair: payload.error.repair }
|
|
320
404
|
: {}),
|
|
405
|
+
...(meta ? { meta } : {}),
|
|
321
406
|
});
|
|
322
407
|
}
|
|
323
408
|
if (!response.ok)
|
|
324
|
-
throw new CliError(`Dreamstate API request failed (HTTP ${response.status})`, 'request_failed', response.status);
|
|
325
|
-
const minimum =
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
throw new CliError(`CLI ${minimum} or newer is required. Run: npm install -g @trydreamstate/cli@latest`, 'cli_update_required', 0);
|
|
409
|
+
throw new CliError(`Dreamstate API request failed (HTTP ${response.status})`, 'request_failed', response.status, { idempotencyKey, ...(meta ? { meta } : {}) });
|
|
410
|
+
const minimum = info.minimum_cli_version;
|
|
411
|
+
if (!allowIncompatibleCli && minimum && isVersionGreater(minimum, exports.CLI_VERSION)) {
|
|
412
|
+
// A conforming server refuses first (C3), so reaching here means the
|
|
413
|
+
// request may already have executed. The body is kept in the error so a
|
|
414
|
+
// write's receipt is not lost behind the update notice.
|
|
415
|
+
throw updateRequiredError(minimum, exports.CLI_VERSION, 0, init.method && init.method !== 'GET' ? { response: payload } : undefined, meta);
|
|
332
416
|
}
|
|
333
|
-
const server =
|
|
334
|
-
|
|
335
|
-
: undefined;
|
|
336
|
-
if (typeof server === 'string' &&
|
|
417
|
+
const server = info.server_version;
|
|
418
|
+
if (server &&
|
|
337
419
|
isVersionGreater(server, exports.CLI_VERSION) &&
|
|
338
|
-
(
|
|
339
|
-
this.onVersionWarning?.(`Warning: CLI ${exports.CLI_VERSION} is behind server ${server}. Proceeding; server minimum is ${minimum ?? 'not declared'}
|
|
420
|
+
(!minimum || versionAtMost(minimum, exports.CLI_VERSION))) {
|
|
421
|
+
this.onVersionWarning?.(`Warning: CLI ${exports.CLI_VERSION} is behind server ${server}. Proceeding; server minimum is ${minimum ?? 'not declared'}. Update: ${exports.CLI_UPDATE_COMMAND}`);
|
|
340
422
|
}
|
|
341
423
|
return payload;
|
|
342
424
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CLI's own command table, for `dreamstate commands search`.
|
|
3
|
+
*
|
|
4
|
+
* `commands search` used to be an alias of `tools search`: it returned capability
|
|
5
|
+
* records, never a command a person could type. The table here is built from
|
|
6
|
+
* what the CLI really parses, with no second hand-kept list:
|
|
7
|
+
*
|
|
8
|
+
* - every `dreamstate ...` usage line the CLI prints (USAGE in index.ts), and
|
|
9
|
+
* - every sequences / workflows verb (the verb tables in commands/), with the
|
|
10
|
+
* capability each one runs.
|
|
11
|
+
*
|
|
12
|
+
* A capability with no verb is reached through `tools run`, which stays a
|
|
13
|
+
* catalog search (`tools search`); `commands search` reports those separately.
|
|
14
|
+
*/
|
|
15
|
+
export interface CliCommandEntry {
|
|
16
|
+
/** What to type, with the verb filled in: `dreamstate sequences publish`. */
|
|
17
|
+
command: string;
|
|
18
|
+
/** The full usage line or verb signature. */
|
|
19
|
+
usage: string;
|
|
20
|
+
summary: string;
|
|
21
|
+
/** The capability a verb runs, when it runs exactly one. */
|
|
22
|
+
capability_id?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare function cliCommandTable(usage: string): CliCommandEntry[];
|
|
25
|
+
export declare function searchCliCommands(term: string, usage: string, limit?: number): CliCommandEntry[];
|
|
26
|
+
//# sourceMappingURL=commandTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandTable.d.ts","sourceRoot":"","sources":["../src/commandTable.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,eAAe;IAC9B,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AA6BD,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,eAAe,EAAE,CAWhE;AAMD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,SAAK,GAAG,eAAe,EAAE,CAc5F"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cliCommandTable = cliCommandTable;
|
|
4
|
+
exports.searchCliCommands = searchCliCommands;
|
|
5
|
+
function verbUsage(pack, spec) {
|
|
6
|
+
const positionals = (spec.positional ?? []).map(({ name, optional }) => (optional ? `[${name}]` : `<${name}>`)).join(' ');
|
|
7
|
+
return ['dreamstate', pack, spec.verb, positionals, '[--canonical-field value]'].filter(Boolean).join(' ');
|
|
8
|
+
}
|
|
9
|
+
/** Usage lines of the form ` dreamstate <group> ...` printed by `dreamstate --help`. */
|
|
10
|
+
function usageEntries(usage) {
|
|
11
|
+
return usage.split('\n')
|
|
12
|
+
.filter((line) => line.startsWith(' dreamstate '))
|
|
13
|
+
.map((line) => line.trim())
|
|
14
|
+
.filter((line) => !/^dreamstate (sequences|workflows) <verb>/.test(line))
|
|
15
|
+
.map((line) => {
|
|
16
|
+
const words = line.split(/\s+/);
|
|
17
|
+
// `dreamstate tools run <capability_id> ...`: the typed command is the leading words
|
|
18
|
+
// before the first argument placeholder or flag.
|
|
19
|
+
const stop = words.findIndex((word, index) => index > 0 && /^[<\[-]/.test(word));
|
|
20
|
+
const command = (stop === -1 ? words : words.slice(0, stop)).join(' ');
|
|
21
|
+
return { command, usage: line, summary: '' };
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function cliCommandTable(usage) {
|
|
25
|
+
// Required lazily: the verb tables import the CLI entry point's helpers.
|
|
26
|
+
const { SEQUENCE_VERBS } = require('./commands/sequences');
|
|
27
|
+
const { WORKFLOW_VERBS } = require('./commands/workflows');
|
|
28
|
+
const verbs = (pack, specs) => specs.map((spec) => ({
|
|
29
|
+
command: `dreamstate ${pack} ${spec.verb}`,
|
|
30
|
+
usage: verbUsage(pack, spec),
|
|
31
|
+
summary: '',
|
|
32
|
+
capability_id: spec.capabilityId,
|
|
33
|
+
}));
|
|
34
|
+
return [...usageEntries(usage), ...verbs('sequences', SEQUENCE_VERBS), ...verbs('workflows', WORKFLOW_VERBS)];
|
|
35
|
+
}
|
|
36
|
+
function terms(value) {
|
|
37
|
+
return value.toLowerCase().split(/[^a-z0-9_]+/).filter((word) => word.length > 1);
|
|
38
|
+
}
|
|
39
|
+
function searchCliCommands(term, usage, limit = 20) {
|
|
40
|
+
const wanted = terms(term);
|
|
41
|
+
if (wanted.length === 0)
|
|
42
|
+
return [];
|
|
43
|
+
return cliCommandTable(usage)
|
|
44
|
+
.map((entry) => {
|
|
45
|
+
const haystack = new Set(terms(`${entry.command} ${entry.usage} ${entry.summary} ${entry.capability_id ?? ''}`));
|
|
46
|
+
const commandWords = new Set(terms(entry.command));
|
|
47
|
+
const score = wanted.reduce((total, word) => total + (commandWords.has(word) ? 3 : haystack.has(word) ? 1 : 0), 0);
|
|
48
|
+
return { entry, score };
|
|
49
|
+
})
|
|
50
|
+
.filter(({ score }) => score > 0)
|
|
51
|
+
.sort((left, right) => right.score - left.score || left.entry.command.localeCompare(right.entry.command))
|
|
52
|
+
.slice(0, limit)
|
|
53
|
+
.map(({ entry }) => entry);
|
|
54
|
+
}
|
|
@@ -3,5 +3,5 @@ import type { CliCommand } from '../index';
|
|
|
3
3
|
export declare const SEQUENCE_VERBS: PackVerbSpec[];
|
|
4
4
|
export declare const SEQUENCES_USAGE: string;
|
|
5
5
|
export declare const parseSequencesCommand: (argv: string[]) => CliCommand;
|
|
6
|
-
export declare function runSequencesCommand(
|
|
6
|
+
export declare function runSequencesCommand(context: Parameters<typeof runPackCommand>[0], command: CliCommand, stdout: NodeJS.WritableStream): Promise<void>;
|
|
7
7
|
//# sourceMappingURL=sequences.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequences.d.ts","sourceRoot":"","sources":["../../src/commands/sequences.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,cAAc,EAAe,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAC5G,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"sequences.d.ts","sourceRoot":"","sources":["../../src/commands/sequences.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,cAAc,EAAe,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAC5G,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAO3C,eAAO,MAAM,cAAc,EAAE,YAAY,EA8BxC,CAAC;AAEF,eAAO,MAAM,eAAe,QAA+C,CAAC;AAC5E,eAAO,MAAM,qBAAqB,gCAA4E,CAAC;AAC/G,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAG1J"}
|
|
@@ -3,44 +3,45 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.parseSequencesCommand = exports.SEQUENCES_USAGE = exports.SEQUENCE_VERBS = void 0;
|
|
4
4
|
exports.runSequencesCommand = runSequencesCommand;
|
|
5
5
|
const shared_1 = require("./shared");
|
|
6
|
+
const automation = [{ name: 'id', into: 'automation_id' }];
|
|
7
|
+
const sequence = [{ name: 'id', into: 'sequence_id' }];
|
|
8
|
+
// Route map only. `tools get` owns every remote parameter, type, requirement and
|
|
9
|
+
// description. Positionals are documented CLI aliases for canonical input fields.
|
|
6
10
|
exports.SEQUENCE_VERBS = [
|
|
7
|
-
{ verb: 'create-from-worksheet', capabilityId: 'sequence.sequences.create_from_worksheet'
|
|
8
|
-
{ verb: 'list', capabilityId: 'workflow.automations.list'
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
{ verb: '
|
|
12
|
-
{ verb: '
|
|
13
|
-
{ verb: '
|
|
14
|
-
{ verb: '
|
|
15
|
-
{ verb: '
|
|
16
|
-
{ verb: '
|
|
17
|
-
{ verb: '
|
|
18
|
-
{ verb: 'node-
|
|
19
|
-
{ verb: 'node-
|
|
20
|
-
{ verb: 'node-
|
|
21
|
-
{ verb: 'node-
|
|
22
|
-
{ verb: '
|
|
23
|
-
{ verb: '
|
|
24
|
-
{ verb: '
|
|
25
|
-
{ verb: '
|
|
26
|
-
{ verb: '
|
|
27
|
-
{ verb: '
|
|
28
|
-
{ verb: '
|
|
29
|
-
{ verb: '
|
|
30
|
-
{ verb: '
|
|
31
|
-
{ verb: '
|
|
32
|
-
{ verb: '
|
|
33
|
-
{ verb: '
|
|
34
|
-
{ verb: '
|
|
35
|
-
{ verb: '
|
|
36
|
-
{ verb: 'import', capabilityId: 'workflow.automations.import', summary: 'Import sequence as draft. Does not publish or send.', flags: { name: { type: 'string', into: 'name' }, document: { type: 'string', into: 'document', json: true, document: true } }, mutating: true },
|
|
11
|
+
{ verb: 'create-from-worksheet', capabilityId: 'sequence.sequences.create_from_worksheet' },
|
|
12
|
+
{ verb: 'list', capabilityId: 'workflow.automations.list' },
|
|
13
|
+
{ verb: 'init', capabilityId: 'workflow.automations.lint', local: 'init' },
|
|
14
|
+
{ verb: 'get', capabilityId: 'workflow.automations.get', positional: automation },
|
|
15
|
+
{ verb: 'create', capabilityId: 'workflow.automations.compose' },
|
|
16
|
+
{ verb: 'update', capabilityId: 'workflow.automations.update', positional: automation },
|
|
17
|
+
{ verb: 'lint', capabilityId: 'workflow.automations.lint', positional: automation },
|
|
18
|
+
{ verb: 'preview', capabilityId: 'workflow.automations.preview', positional: automation },
|
|
19
|
+
{ verb: 'variables', capabilityId: 'workflow.automations.variables_list', positional: automation },
|
|
20
|
+
{ verb: 'node-catalog', capabilityId: 'workflow.automations.node_catalog' },
|
|
21
|
+
{ verb: 'node-inspect', capabilityId: 'workflow.automations.node_inspect', positional: [{ name: 'id', into: 'automation_id', optional: true }] },
|
|
22
|
+
{ verb: 'node-add', capabilityId: 'workflow.automations.node_add', positional: automation },
|
|
23
|
+
{ verb: 'node-patch', capabilityId: 'workflow.automations.node_patch', positional: automation },
|
|
24
|
+
{ verb: 'node-remove', capabilityId: 'workflow.automations.node_remove', positional: automation },
|
|
25
|
+
{ verb: 'node-move', capabilityId: 'workflow.automations.node_move', positional: automation },
|
|
26
|
+
{ verb: 'field-options', capabilityId: 'workflow.automations.field_options', positional: [{ name: 'id', into: 'automation_id', optional: true }] },
|
|
27
|
+
{ verb: 'publish', capabilityId: 'sequence.sequences.publish', positional: sequence },
|
|
28
|
+
{ verb: 'enroll', capabilityId: 'sequence.sequences.enroll_selection', positional: sequence },
|
|
29
|
+
{ verb: 'enrollments', capabilityId: 'sequence.sequences.contacts_list', positional: sequence },
|
|
30
|
+
{ verb: 'launch', capabilityId: 'sequence.sequences.launch', positional: sequence },
|
|
31
|
+
{ verb: 'start', capabilityId: 'sequence.sequences.start', positional: sequence },
|
|
32
|
+
{ verb: 'pause', capabilityId: 'sequence.sequences.pause', positional: sequence },
|
|
33
|
+
{ verb: 'resume', capabilityId: 'sequence.sequences.resume', positional: sequence },
|
|
34
|
+
{ verb: 'stats', capabilityId: 'sequence.sequences.step_counts_get', positional: sequence },
|
|
35
|
+
{ verb: 'analytics', capabilityId: 'sequence.sequences.analytics_get', positional: sequence },
|
|
36
|
+
{ verb: 'duplicate', capabilityId: 'workflow.automations.duplicate', positional: automation },
|
|
37
|
+
{ verb: 'archive', capabilityId: 'workflow.automations.archive', positional: automation },
|
|
38
|
+
{ verb: 'export', capabilityId: 'workflow.automations.export', positional: automation },
|
|
39
|
+
{ verb: 'import', capabilityId: 'workflow.automations.import' },
|
|
37
40
|
];
|
|
38
41
|
exports.SEQUENCES_USAGE = (0, shared_1.renderPackUsage)('sequences', exports.SEQUENCE_VERBS);
|
|
39
42
|
exports.parseSequencesCommand = (0, shared_1.buildPackParser)('sequences', 'sequence', exports.SEQUENCE_VERBS, exports.SEQUENCES_USAGE);
|
|
40
|
-
async function runSequencesCommand(
|
|
41
|
-
if (command.command === 'pack' && command.verb === 'init')
|
|
42
|
-
(0, shared_1.runPackInit)('sequence', command, stdout);
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
await (0, shared_1.runPackCommand)(client, command, stdout, sleep);
|
|
43
|
+
async function runSequencesCommand(context, command, stdout) {
|
|
44
|
+
if (command.command === 'pack' && command.verb === 'init')
|
|
45
|
+
return (0, shared_1.runPackInit)('sequence', command, stdout);
|
|
46
|
+
await (0, shared_1.runPackCommand)(context, command, stdout);
|
|
46
47
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type { DreamstateClient } from '../client';
|
|
2
1
|
import { type CliCommand } from '../index';
|
|
2
|
+
import { type GatedRunContext } from '../gatedRun';
|
|
3
3
|
export interface PackVerbSpec {
|
|
4
4
|
verb: string;
|
|
5
5
|
capabilityId: string;
|
|
6
|
-
summary: string;
|
|
7
6
|
/**
|
|
8
7
|
* `optional: true` marks a positional the verb can do without. node-inspect and
|
|
9
8
|
* field-options answer two different questions: the contract for a node TYPE, which
|
|
@@ -16,29 +15,8 @@ export interface PackVerbSpec {
|
|
|
16
15
|
into: string;
|
|
17
16
|
optional?: boolean;
|
|
18
17
|
}[];
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
-
* --file knows where to put a file's contents. Without it --file bound to whichever
|
|
22
|
-
* json flag happened to be declared first, which on `sequences create` was
|
|
23
|
-
* `enrollment`: a whole sequence document arrived as the enrollment binding and the
|
|
24
|
-
* server refused it field by field. Flag order is not a contract, so the document
|
|
25
|
-
* flag has to say so itself.
|
|
26
|
-
*/
|
|
27
|
-
/**
|
|
28
|
-
* `number: true` marks a flag whose capability param is numeric. Every flag arrives
|
|
29
|
-
* from the shell as a string, so `--expected-version 1` was sent as "1" and refused
|
|
30
|
-
* with `params.expected_version: expected number; received string`: the optimistic
|
|
31
|
-
* concurrency check could not be satisfied from the CLI at all.
|
|
32
|
-
*/
|
|
33
|
-
flags?: Record<string, {
|
|
34
|
-
type: 'string' | 'boolean';
|
|
35
|
-
into: string;
|
|
36
|
-
json?: boolean;
|
|
37
|
-
document?: boolean;
|
|
38
|
-
number?: boolean;
|
|
39
|
-
required?: boolean;
|
|
40
|
-
}>;
|
|
41
|
-
mutating: boolean;
|
|
18
|
+
/** Local-only route; `init` accepts --name and --file without an API schema. */
|
|
19
|
+
local?: 'init';
|
|
42
20
|
}
|
|
43
21
|
export declare function buildPackParser(pack: 'sequences' | 'workflows', kind: 'sequence' | 'workflow', specs: PackVerbSpec[], usage: string): (argv: string[]) => CliCommand;
|
|
44
22
|
/**
|
|
@@ -49,6 +27,6 @@ export declare function buildPackParser(pack: 'sequences' | 'workflows', kind: '
|
|
|
49
27
|
*/
|
|
50
28
|
export declare function packScaffold(kind: 'sequence' | 'workflow', name: string): Record<string, unknown>;
|
|
51
29
|
export declare function runPackInit(kind: 'sequence' | 'workflow', command: CliCommand, stdout: NodeJS.WritableStream): void;
|
|
52
|
-
export declare function runPackCommand(
|
|
30
|
+
export declare function runPackCommand(context: GatedRunContext, command: CliCommand, stdout: NodeJS.WritableStream): Promise<void>;
|
|
53
31
|
export declare function renderPackUsage(pack: string, specs: PackVerbSpec[]): string;
|
|
54
32
|
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/commands/shared.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/commands/shared.ts"],"names":[],"mappings":"AAKA,OAAO,EAAc,KAAK,UAAU,EAAiC,MAAM,UAAU,CAAC;AAEtF,OAAO,EAA4B,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAO7E,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IACnC;;;;;;OAMG;IACH,UAAU,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;IAClE,gFAAgF;IAChF,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AA4CD,wBAAgB,eAAe,CAC7B,IAAI,EAAE,WAAW,GAAC,WAAW,EAAE,IAAI,EAAE,UAAU,GAAC,UAAU,EAAE,KAAK,EAAE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