@trydreamstate/cli 1.2.1 → 1.3.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/README.md +6 -0
- package/agent-plugin/.agents/plugins/marketplace.json +20 -0
- package/agent-plugin/.claude-plugin/marketplace.json +16 -0
- package/agent-plugin/.grok-plugin/marketplace.json +16 -0
- package/agent-plugin/plugins/dreamstate/.claude-plugin/plugin.json +21 -0
- package/agent-plugin/plugins/dreamstate/.codex-plugin/plugin.json +41 -0
- package/agent-plugin/plugins/dreamstate/.mcp.json +8 -0
- package/agent-plugin/plugins/dreamstate/skills/crm/SKILL.md +75 -0
- package/agent-plugin/plugins/dreamstate/skills/diagnostics/SKILL.md +72 -0
- package/agent-plugin/plugins/dreamstate/skills/dreamstate/SKILL.md +16 -0
- package/agent-plugin/plugins/dreamstate/skills/first-win/SKILL.md +57 -0
- package/agent-plugin/plugins/dreamstate/skills/inbox-replies/SKILL.md +61 -0
- package/agent-plugin/plugins/dreamstate/skills/knowledge/SKILL.md +48 -0
- package/agent-plugin/plugins/dreamstate/skills/linkedin-posts/SKILL.md +79 -0
- package/agent-plugin/plugins/dreamstate/skills/linkedin-warm-signals/SKILL.md +65 -0
- package/agent-plugin/plugins/dreamstate/skills/list-building/SKILL.md +105 -0
- package/agent-plugin/plugins/dreamstate/skills/list-building/column-authoring.md +37 -0
- package/agent-plugin/plugins/dreamstate/skills/list-building/readback.md +15 -0
- package/agent-plugin/plugins/dreamstate/skills/list-building/sourcing.md +31 -0
- package/agent-plugin/plugins/dreamstate/skills/outreach/SKILL.md +77 -0
- package/agent-plugin/plugins/dreamstate/skills/outreach/channels.md +5 -0
- package/agent-plugin/plugins/dreamstate/skills/outreach/deliverability-and-caps.md +17 -0
- package/agent-plugin/plugins/dreamstate/skills/outreach/enrollment.md +17 -0
- package/agent-plugin/plugins/dreamstate/skills/outreach/message-copy.md +41 -0
- package/agent-plugin/plugins/dreamstate/skills/outreach/replies.md +5 -0
- package/agent-plugin/plugins/dreamstate/skills/outreach/steps-and-timing.md +13 -0
- package/agent-plugin/plugins/dreamstate/skills/outreach/stop-and-suppression.md +7 -0
- package/agent-plugin/plugins/dreamstate/skills/plays/SKILL.md +81 -0
- package/agent-plugin/plugins/dreamstate/skills/reddit-posts/SKILL.md +65 -0
- package/agent-plugin/plugins/dreamstate/skills/skill-authoring/SKILL.md +65 -0
- package/agent-plugin/plugins/dreamstate/skills/social/SKILL.md +69 -0
- package/agent-plugin/plugins/dreamstate/skills/visibility/SKILL.md +60 -0
- package/agent-plugin/plugins/dreamstate/skills/visibility/probes.md +15 -0
- package/agent-plugin/plugins/dreamstate/skills/visibility/query-sets.md +17 -0
- package/agent-plugin/plugins/dreamstate/skills/visibility/search-evidence.md +15 -0
- package/agent-plugin/plugins/dreamstate/skills/visibility/technical.md +16 -0
- package/agent-plugin/plugins/dreamstate/skills/workflows/SKILL.md +43 -0
- package/agent-plugin/plugins/dreamstate/skills/workflows/durable-runs.md +19 -0
- package/agent-plugin/plugins/dreamstate/skills/workflows/graph-authoring.md +9 -0
- package/agent-plugin/plugins/dreamstate/skills/workflows/lifecycle-and-enrollment.md +11 -0
- package/agent-plugin/plugins/dreamstate/skills/workflows/live-replies.md +5 -0
- package/agent-plugin/plugins/dreamstate/skills/workflows/recipe-routing.md +5 -0
- package/agent-plugin/plugins/dreamstate/skills/worksheet-tidy/SKILL.md +61 -0
- package/agent-plugin/plugins/dreamstate/skills/writing/SKILL.md +84 -0
- package/agent-plugin/plugins/dreamstate/skills/writing/briefs.md +35 -0
- package/agent-plugin/plugins/dreamstate/skills/writing/drafting.md +39 -0
- package/agent-plugin/plugins/dreamstate/skills/writing/publishing.md +74 -0
- package/agent-plugin/plugins/dreamstate/skills/writing/revision-and-voice.md +31 -0
- package/agent-plugin/plugins/dreamstate/skills/x-posts/SKILL.md +73 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +123 -41
- package/dist/commands/shared.js +1 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +111 -28
- package/dist/pluginInstaller.d.ts +22 -0
- package/dist/pluginInstaller.d.ts.map +1 -0
- package/dist/pluginInstaller.js +122 -0
- package/package.json +3 -2
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AA8BA,OAAO,EAA0F,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAInK,OAAO,EAA0H,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAClL,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC;AAE9C,eAAO,MAAM,QAAQ;;;;;;;;;;;;CAA4J,CAAC;AA+ClL,MAAM,MAAM,UAAU,GAClB;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GACnB;IAAE,OAAO,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GAC7D;IAAE,OAAO,EAAE,SAAS,CAAA;CAAE,GACtB;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GACrH;IAAE,OAAO,EAAE,QAAQ,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GAC3C;IAAE,OAAO,EAAE,QAAQ,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GAC3C;IAAE,OAAO,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE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mDD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAavD;AAwBD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG;IAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAkB3F;AA6ID,wBAAsB,MAAM,CAAC,IAAI,GAAE,MAAM,EAA0B,EAAE,OAAO,GAAE,UAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CA4Y5G"}
|
package/dist/index.js
CHANGED
|
@@ -16,8 +16,10 @@ const node_crypto_1 = require("node:crypto");
|
|
|
16
16
|
const promises_1 = require("node:fs/promises");
|
|
17
17
|
const tableFilePreview_1 = require("./tableFilePreview");
|
|
18
18
|
const node_os_1 = require("node:os");
|
|
19
|
+
const node_path_1 = require("node:path");
|
|
19
20
|
const node_util_1 = require("node:util");
|
|
20
21
|
const config_1 = require("./config");
|
|
22
|
+
const pluginInstaller_1 = require("./pluginInstaller");
|
|
21
23
|
const turnCache_1 = require("./turnCache");
|
|
22
24
|
const runWait_1 = require("./runWait");
|
|
23
25
|
const client_1 = require("./client");
|
|
@@ -32,6 +34,7 @@ Usage:
|
|
|
32
34
|
dreamstate login [--no-skills]
|
|
33
35
|
dreamstate login [--profile <name>] --token <ds_user_...|ds_live_...> [--no-skills]
|
|
34
36
|
dreamstate logout
|
|
37
|
+
dreamstate install [--agents <claude codex grok>] [--json-output|--json]
|
|
35
38
|
dreamstate status [--json-output|--json]
|
|
36
39
|
dreamstate profiles <list|use|current|remove|env> [name] [--json-output|--json]
|
|
37
40
|
dreamstate whoami [--json-output|--json]
|
|
@@ -54,7 +57,7 @@ Usage:
|
|
|
54
57
|
dreamstate sequences <verb> [args] [flags]
|
|
55
58
|
dreamstate workflows <verb> [args] [flags]
|
|
56
59
|
dreamstate tables import --table-id <uuid> --file <path> [--format <csv|json|jsonl|xlsx>] [--preview] [--upsert-key <header>] [--background] [--json-output|--json]
|
|
57
|
-
dreamstate runs list [--json <query>] [--json-output|--json]
|
|
60
|
+
dreamstate runs list [--limit <n>] [--cursor <cursor>] [--json <query>] [--json-output|--json]
|
|
58
61
|
dreamstate runs get <run_id> [--json-output|--json]
|
|
59
62
|
dreamstate runs resume <run_id> --state-version <n> [--reason <text>] [--idempotency-key <key>] [--open] [--json-output|--json]
|
|
60
63
|
dreamstate runs events <run_id> [--json-output|--json]
|
|
@@ -298,13 +301,13 @@ function parseTools(argv) {
|
|
|
298
301
|
function parseTables(argv) {
|
|
299
302
|
const { values, positionals } = (0, node_util_1.parseArgs)({ args: argv, options: {
|
|
300
303
|
'table-id': { type: 'string' }, file: { type: 'string' }, format: { type: 'string' }, background: { type: 'boolean' },
|
|
301
|
-
preview: { type: 'boolean' }, 'upsert-key': { type: 'string' },
|
|
304
|
+
preview: { type: 'boolean' }, 'upsert-key': { type: 'string' }, 'row-kind': { type: 'string' }, 'keep-unmapped-columns': { type: 'string' },
|
|
302
305
|
'json-output': { type: 'boolean' }, help: { type: 'boolean', short: 'h' },
|
|
303
306
|
}, allowPositionals: true, strict: true });
|
|
304
307
|
if (values.help)
|
|
305
308
|
return { command: 'help' };
|
|
306
309
|
if (positionals.length !== 1 || positionals[0] !== 'import' || !values['table-id'] || !values.file) {
|
|
307
|
-
throw new CliUsageError('Usage: dreamstate tables import --table-id <uuid> --file <path> [--format <csv|json|jsonl|xlsx>] [--preview] [--upsert-key <header>] [--background]');
|
|
310
|
+
throw new CliUsageError('Usage: dreamstate tables import --table-id <uuid> --file <path> [--format <csv|json|jsonl|xlsx>] [--preview] [--upsert-key <header>] [--row-kind <person|company>] [--keep-unmapped-columns <true|false>] [--background]');
|
|
308
311
|
}
|
|
309
312
|
// --format is an override, not a requirement. Requiring it made the caller restate
|
|
310
313
|
// what the file path already says, and an omitted flag produced a usage error rather
|
|
@@ -315,6 +318,14 @@ function parseTables(argv) {
|
|
|
315
318
|
throw new CliUsageError('--format must be one of csv, json, jsonl, xlsx');
|
|
316
319
|
}
|
|
317
320
|
const upsertKey = values['upsert-key']?.trim();
|
|
321
|
+
const rowKind = values['row-kind'];
|
|
322
|
+
if (rowKind !== undefined && rowKind !== 'person' && rowKind !== 'company') {
|
|
323
|
+
throw new CliUsageError('--row-kind must be person or company');
|
|
324
|
+
}
|
|
325
|
+
const keepUnmappedColumns = values['keep-unmapped-columns'];
|
|
326
|
+
if (keepUnmappedColumns !== undefined && keepUnmappedColumns !== 'true' && keepUnmappedColumns !== 'false') {
|
|
327
|
+
throw new CliUsageError('--keep-unmapped-columns must be true or false');
|
|
328
|
+
}
|
|
318
329
|
return {
|
|
319
330
|
command: 'tables_import',
|
|
320
331
|
tableId: values['table-id'],
|
|
@@ -322,17 +333,38 @@ function parseTables(argv) {
|
|
|
322
333
|
...(format ? { format: format } : {}),
|
|
323
334
|
...(values.preview ? { preview: true } : {}),
|
|
324
335
|
...(upsertKey ? { upsertKey } : {}),
|
|
336
|
+
...(rowKind ? { rowKind } : {}),
|
|
337
|
+
...(keepUnmappedColumns === 'false' ? { keepUnmappedColumns: false } : {}),
|
|
325
338
|
background: Boolean(values.background),
|
|
326
339
|
...outputOption(values),
|
|
327
340
|
};
|
|
328
341
|
}
|
|
342
|
+
function runsListLimit(raw) {
|
|
343
|
+
const value = nonNegativeInteger(raw, '--limit');
|
|
344
|
+
if (value < 1 || value > 500)
|
|
345
|
+
throw new CliUsageError('--limit must be an integer from 1 to 500');
|
|
346
|
+
return value;
|
|
347
|
+
}
|
|
329
348
|
function parseRuns(argv) {
|
|
330
|
-
const { values, positionals } = (0, node_util_1.parseArgs)({ args: argv, options: { json: { type: 'string' }, reason: { type: 'string' }, 'state-version': { type: 'string' }, 'idempotency-key': { type: 'string' }, open: { type: 'boolean' }, 'json-output': { type: 'boolean' }, help: { type: 'boolean', short: 'h' } }, allowPositionals: true, strict: true });
|
|
349
|
+
const { values, positionals } = (0, node_util_1.parseArgs)({ args: argv, options: { json: { type: 'string' }, limit: { type: 'string' }, cursor: { type: 'string' }, reason: { type: 'string' }, 'state-version': { type: 'string' }, 'idempotency-key': { type: 'string' }, open: { type: 'boolean' }, 'json-output': { type: 'boolean' }, help: { type: 'boolean', short: 'h' } }, allowPositionals: true, strict: true });
|
|
331
350
|
if (values.help)
|
|
332
351
|
return { command: 'help' };
|
|
333
352
|
const output = outputOption(values);
|
|
334
|
-
if (positionals.length === 1 && positionals[0] === 'list')
|
|
335
|
-
|
|
353
|
+
if (positionals.length === 1 && positionals[0] === 'list') {
|
|
354
|
+
const query = values.json ? parseJsonObject(values.json) : {};
|
|
355
|
+
if (values.limit !== undefined)
|
|
356
|
+
query.limit = runsListLimit(values.limit);
|
|
357
|
+
if (values.cursor !== undefined) {
|
|
358
|
+
const cursor = values.cursor.trim();
|
|
359
|
+
if (!cursor)
|
|
360
|
+
throw new CliUsageError('--cursor must be a non-empty string');
|
|
361
|
+
query.cursor = cursor;
|
|
362
|
+
}
|
|
363
|
+
return { command: 'runs_list', query, ...output };
|
|
364
|
+
}
|
|
365
|
+
if (values.limit !== undefined || values.cursor !== undefined) {
|
|
366
|
+
throw new CliUsageError('--limit and --cursor are only valid on runs list');
|
|
367
|
+
}
|
|
336
368
|
const runId = requireOne(positionals, `dreamstate runs ${positionals[0] ?? '<get|events|cancel>'} <run_id>`);
|
|
337
369
|
if (positionals[0] === 'get')
|
|
338
370
|
return { command: 'runs_get', runId, ...output };
|
|
@@ -385,6 +417,18 @@ function parseCliArgs(argv) {
|
|
|
385
417
|
throw new CliUsageError('Use either --token or --api-key-file, not both.');
|
|
386
418
|
return { command: 'login', ...(values.token !== undefined ? { token: values.token } : {}), ...(values['api-key-file'] ? { apiKeyFile: values['api-key-file'] } : {}), ...(values.profile ? { profile: (0, config_1.validateProfileName)(values.profile) } : {}), ...(values['no-skills'] ? { noSkills: true } : {}), ...outputOption(values) };
|
|
387
419
|
}
|
|
420
|
+
if (group === 'install') {
|
|
421
|
+
const { values, positionals } = (0, node_util_1.parseArgs)({ args: spaceSeparatedAgents(rest), options: { agents: { type: 'string', multiple: true }, 'json-output': { type: 'boolean' }, help: { type: 'boolean', short: 'h' } }, allowPositionals: true, strict: true });
|
|
422
|
+
if (values.help)
|
|
423
|
+
return { command: 'help' };
|
|
424
|
+
if (positionals.length)
|
|
425
|
+
throw new CliUsageError('Usage: dreamstate install [--agents <claude codex grok>]');
|
|
426
|
+
const requested = values.agents ? [...new Set(values.agents.flatMap((raw) => csv(raw, '--agents')))] : [...pluginInstaller_1.PLUGIN_AGENTS];
|
|
427
|
+
const invalid = requested.filter((agent) => !pluginInstaller_1.PLUGIN_AGENTS.includes(agent));
|
|
428
|
+
if (invalid.length)
|
|
429
|
+
throw new CliUsageError(`--agents values must be one of: ${pluginInstaller_1.PLUGIN_AGENTS.join(', ')} (got: ${invalid.join(', ')})`);
|
|
430
|
+
return { command: 'install', agents: requested, ...outputOption(values) };
|
|
431
|
+
}
|
|
388
432
|
if (group === 'logout') {
|
|
389
433
|
const { values, positionals } = (0, node_util_1.parseArgs)({ args: rest, options: { 'json-output': { type: 'boolean' }, help: { type: 'boolean', short: 'h' } }, allowPositionals: true, strict: true });
|
|
390
434
|
if (values.help)
|
|
@@ -493,14 +537,6 @@ function toolTurnToken(value) {
|
|
|
493
537
|
return data.tool_turn_token;
|
|
494
538
|
throw new client_1.CliError('tools get did not return a tool_turn_token.', 'invalid_tool_turn_token', 0);
|
|
495
539
|
}
|
|
496
|
-
/**
|
|
497
|
-
* null suppresses Idempotency-Key. undefined lets runCapability mint one.
|
|
498
|
-
* A fresh random key never replays, but the server treats any Idempotency-Key
|
|
499
|
-
* as a replay request and refuses the inline read (isInlineReadEligible).
|
|
500
|
-
* Omit the key only when the fetched contract says mutates === false and
|
|
501
|
-
* idempotency_required is not true. Missing flags keep the auto key: a
|
|
502
|
-
* caller-supplied turn token skips tools get, and live writes still need one.
|
|
503
|
-
*/
|
|
504
540
|
/**
|
|
505
541
|
* Free sync reads. The server runs these on the inline read path when
|
|
506
542
|
* the body has no tool_turn_token and the request has no Idempotency-Key
|
|
@@ -532,17 +568,44 @@ const INLINE_READ_CAPABILITIES = new Set([
|
|
|
532
568
|
function omitsToolTurnForInlineTableRead(capabilityId) {
|
|
533
569
|
return INLINE_READ_CAPABILITIES.has(capabilityId);
|
|
534
570
|
}
|
|
535
|
-
function
|
|
536
|
-
|
|
571
|
+
function readIdempotencyContract(fetched) {
|
|
572
|
+
if (!fetched || typeof fetched !== 'object' || Array.isArray(fetched))
|
|
573
|
+
return null;
|
|
574
|
+
const root = fetched;
|
|
537
575
|
const data = root.data && typeof root.data === 'object' && !Array.isArray(root.data)
|
|
538
576
|
? root.data
|
|
539
|
-
:
|
|
540
|
-
const
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
577
|
+
: null;
|
|
578
|
+
const candidates = [data?.capability, root.capability, data, root];
|
|
579
|
+
for (const candidate of candidates) {
|
|
580
|
+
if (!candidate || typeof candidate !== 'object' || Array.isArray(candidate))
|
|
581
|
+
continue;
|
|
582
|
+
if ('mutates' in candidate || 'idempotency_required' in candidate) {
|
|
583
|
+
return candidate;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
return null;
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* Header value, or null when the request must not carry Idempotency-Key.
|
|
590
|
+
* Any key forces a read onto the durable run path (isInlineReadEligible).
|
|
591
|
+
* Send one only for an explicit key, or when the tools get contract says
|
|
592
|
+
* mutates or idempotency_required. Missing flags omit the key: a read whose
|
|
593
|
+
* contract does not set mutates must not be treated as a write.
|
|
594
|
+
*/
|
|
595
|
+
function capabilityIdempotencyKey(fetched, explicit) {
|
|
596
|
+
if (typeof explicit === 'string' && explicit.length > 0)
|
|
597
|
+
return explicit;
|
|
598
|
+
const contract = readIdempotencyContract(fetched);
|
|
599
|
+
if (contract?.mutates === true || contract?.idempotency_required === true)
|
|
600
|
+
return (0, node_crypto_1.randomUUID)();
|
|
601
|
+
return null;
|
|
602
|
+
}
|
|
603
|
+
function parameterIdempotencyKey(body) {
|
|
604
|
+
const params = body.params;
|
|
605
|
+
if (!params || typeof params !== 'object' || Array.isArray(params))
|
|
606
|
+
return undefined;
|
|
607
|
+
const key = params.idempotency_key;
|
|
608
|
+
return typeof key === 'string' && key.length > 0 ? key : undefined;
|
|
546
609
|
}
|
|
547
610
|
function code(error) {
|
|
548
611
|
return error && typeof error === 'object' && typeof error.code === 'string'
|
|
@@ -789,7 +852,10 @@ async function installHostedSkills(client, agents, runtime, options = {}) {
|
|
|
789
852
|
async function installLoginSkills(client, runtime, skip, stderr) {
|
|
790
853
|
if (skip)
|
|
791
854
|
return { skipped: 'disabled' };
|
|
792
|
-
const
|
|
855
|
+
const withPlugin = await (0, pluginInstaller_1.agentsWithDreamstatePlugin)(runtime.homeDirectory);
|
|
856
|
+
const agents = (await (0, skillInstaller_1.detectInstalledSkillAgents)(runtime.homeDirectory)).filter((agent) => !withPlugin.includes(agent));
|
|
857
|
+
if (!agents.length && withPlugin.length)
|
|
858
|
+
return { skipped: 'plugin_installed' };
|
|
793
859
|
if (!agents.length) {
|
|
794
860
|
stderr.write('Run dreamstate skills install to install Dreamstate skills.\n');
|
|
795
861
|
return { skipped: 'no_agents_detected' };
|
|
@@ -872,6 +938,19 @@ async function runCli(argv = process.argv.slice(2), runtime = {}) {
|
|
|
872
938
|
process.exitCode = exports.CLI_EXIT.SUCCESS;
|
|
873
939
|
return;
|
|
874
940
|
}
|
|
941
|
+
if (command.command === 'install') {
|
|
942
|
+
const installed = await (0, pluginInstaller_1.installAgentPlugin)({ agents: command.agents, bundleDirectory: (0, node_path_1.join)(__dirname, '..', 'agent-plugin'), homeDirectory: runtime.homeDirectory, run: runtime.runAgentCommand });
|
|
943
|
+
const done = installed.agents.filter((item) => item.status === 'installed').map((item) => item.agent);
|
|
944
|
+
const failed = installed.agents.filter((item) => item.status === 'failed');
|
|
945
|
+
if (failed.length || !done.length) {
|
|
946
|
+
throw new client_1.CliError(done.length ? 'Dreamstate plugin install failed for some agents.' : 'No supported agent was found. Install Claude Code, Codex or Grok Build, then rerun dreamstate install.', 'plugin_install_failed', 0, { details: installed });
|
|
947
|
+
}
|
|
948
|
+
const removedSkills = done.includes('claude') ? await (0, pluginInstaller_1.removeClaudeSkillCopies)(runtime.homeDirectory) : [];
|
|
949
|
+
stderr.write(`Dreamstate plugin installed for ${done.join(', ')}. Start a new session; the first Dreamstate tool call asks you to sign in.\n`);
|
|
950
|
+
print({ ok: true, data: { ...installed, removed_skill_copies: removedSkills }, meta: {} }, stdout, Boolean(command.jsonOutput));
|
|
951
|
+
process.exitCode = exports.CLI_EXIT.SUCCESS;
|
|
952
|
+
return;
|
|
953
|
+
}
|
|
875
954
|
if (command.command === 'logout') {
|
|
876
955
|
const path = runtimeCredentialsPath(runtime);
|
|
877
956
|
let removed = true;
|
|
@@ -1180,7 +1259,8 @@ async function runCli(argv = process.argv.slice(2), runtime = {}) {
|
|
|
1180
1259
|
const inlineRead = !command.turnToken && !pending && !command.idempotencyKey && omitsToolTurnForInlineTableRead(command.capabilityId);
|
|
1181
1260
|
const fetchedForRun = command.turnToken || pending || inlineRead ? null : await client.getTool(command.capabilityId);
|
|
1182
1261
|
let turnToken = command.turnToken ?? pending ?? (inlineRead ? undefined : toolTurnToken(fetchedForRun));
|
|
1183
|
-
|
|
1262
|
+
const callerParameterKey = parameterIdempotencyKey(command.body);
|
|
1263
|
+
let idempotencyKey = capabilityIdempotencyKey(fetchedForRun, callerParameterKey ?? command.idempotencyKey);
|
|
1184
1264
|
let recoveredInlineRead = false;
|
|
1185
1265
|
const run = () => client.runCapability(command.capabilityId, {
|
|
1186
1266
|
...command.body,
|
|
@@ -1198,7 +1278,7 @@ async function runCli(argv = process.argv.slice(2), runtime = {}) {
|
|
|
1198
1278
|
recoveredInlineRead = true;
|
|
1199
1279
|
const fetched = await client.getTool(command.capabilityId);
|
|
1200
1280
|
turnToken = toolTurnToken(fetched);
|
|
1201
|
-
idempotencyKey = command.idempotencyKey
|
|
1281
|
+
idempotencyKey = capabilityIdempotencyKey(fetched, callerParameterKey ?? command.idempotencyKey);
|
|
1202
1282
|
result = await run();
|
|
1203
1283
|
}
|
|
1204
1284
|
else if (command.body.mode !== 'live' || code(error) !== 'quote_required') {
|
|
@@ -1238,18 +1318,21 @@ async function runCli(argv = process.argv.slice(2), runtime = {}) {
|
|
|
1238
1318
|
// prepare handoff for caller-local files, while nearby upload capabilities
|
|
1239
1319
|
// can also match these words and made a real import fail after local work.
|
|
1240
1320
|
const importCapabilityId = 'tables.table_sources.csv_import_prepare';
|
|
1321
|
+
const importContract = await client.getTool(importCapabilityId);
|
|
1241
1322
|
result = await client.runCapability(importCapabilityId, {
|
|
1242
1323
|
// A mutation run needs the turn token its own get minted; without it
|
|
1243
1324
|
// an API-key import was refused after the local file work.
|
|
1244
|
-
tool_turn_token: toolTurnToken(
|
|
1325
|
+
tool_turn_token: toolTurnToken(importContract),
|
|
1245
1326
|
mode: 'live',
|
|
1246
1327
|
params: {
|
|
1247
1328
|
table_id: command.tableId,
|
|
1248
1329
|
file_path: command.file,
|
|
1249
1330
|
...(command.format ? { file_kind: command.format } : {}),
|
|
1250
1331
|
...(command.upsertKey ? { upsert_key: command.upsertKey } : {}),
|
|
1332
|
+
...(command.rowKind ? { row_kind: command.rowKind } : {}),
|
|
1333
|
+
...(command.keepUnmappedColumns === false ? { keep_unmapped_columns: false } : {}),
|
|
1251
1334
|
},
|
|
1252
|
-
});
|
|
1335
|
+
}, capabilityIdempotencyKey(importContract));
|
|
1253
1336
|
break;
|
|
1254
1337
|
}
|
|
1255
1338
|
case 'runs_list':
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const PLUGIN_AGENTS: readonly ["claude", "codex", "grok"];
|
|
2
|
+
export type PluginAgent = typeof PLUGIN_AGENTS[number];
|
|
3
|
+
export type RunAgentCommand = (command: string, args: string[]) => Promise<number | null>;
|
|
4
|
+
export interface PluginAgentResult {
|
|
5
|
+
agent: PluginAgent;
|
|
6
|
+
status: 'installed' | 'not_found' | 'failed';
|
|
7
|
+
failed_command?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function pluginMarketplaceDirectory(homeDirectory?: string): string;
|
|
10
|
+
export declare const runAgentCommand: RunAgentCommand;
|
|
11
|
+
export declare function installAgentPlugin(options: {
|
|
12
|
+
agents: readonly PluginAgent[];
|
|
13
|
+
bundleDirectory: string;
|
|
14
|
+
homeDirectory?: string;
|
|
15
|
+
run?: RunAgentCommand;
|
|
16
|
+
}): Promise<{
|
|
17
|
+
marketplace_directory: string;
|
|
18
|
+
agents: PluginAgentResult[];
|
|
19
|
+
}>;
|
|
20
|
+
export declare function agentsWithDreamstatePlugin(homeDirectory?: string): Promise<Array<'claude-code' | 'codex'>>;
|
|
21
|
+
export declare function removeClaudeSkillCopies(homeDirectory?: string): Promise<string[]>;
|
|
22
|
+
//# sourceMappingURL=pluginInstaller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pluginInstaller.d.ts","sourceRoot":"","sources":["../src/pluginInstaller.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,aAAa,sCAAuC,CAAC;AAClE,MAAM,MAAM,WAAW,GAAG,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;AAGvD,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;AAE1F,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,WAAW,CAAC;IACnB,MAAM,EAAE,WAAW,GAAG,WAAW,GAAG,QAAQ,CAAC;IAC7C,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAOD,wBAAgB,0BAA0B,CAAC,aAAa,SAAY,GAAG,MAAM,CAE5E;AAwBD,eAAO,MAAM,eAAe,EAAE,eAK5B,CAAC;AAEH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE;IAChD,MAAM,EAAE,SAAS,WAAW,EAAE,CAAC;IAC/B,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,GAAG,CAAC,EAAE,eAAe,CAAC;CACvB,GAAG,OAAO,CAAC;IAAE,qBAAqB,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,iBAAiB,EAAE,CAAA;CAAE,CAAC,CAiB1E;AAKD,wBAAsB,0BAA0B,CAAC,aAAa,SAAY,GAAG,OAAO,CAAC,KAAK,CAAC,aAAa,GAAG,OAAO,CAAC,CAAC,CAWnH;AAKD,wBAAsB,uBAAuB,CAAC,aAAa,SAAY,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAc1F"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runAgentCommand = exports.PLUGIN_AGENTS = void 0;
|
|
4
|
+
exports.pluginMarketplaceDirectory = pluginMarketplaceDirectory;
|
|
5
|
+
exports.installAgentPlugin = installAgentPlugin;
|
|
6
|
+
exports.agentsWithDreamstatePlugin = agentsWithDreamstatePlugin;
|
|
7
|
+
exports.removeClaudeSkillCopies = removeClaudeSkillCopies;
|
|
8
|
+
const node_child_process_1 = require("node:child_process");
|
|
9
|
+
const promises_1 = require("node:fs/promises");
|
|
10
|
+
const node_os_1 = require("node:os");
|
|
11
|
+
const node_path_1 = require("node:path");
|
|
12
|
+
exports.PLUGIN_AGENTS = ['claude', 'codex', 'grok'];
|
|
13
|
+
// The marketplace directory is named "dreamstate" because Grok Build names a
|
|
14
|
+
// local marketplace after its directory; Claude Code and Codex read the name
|
|
15
|
+
// from marketplace.json, which is also "dreamstate".
|
|
16
|
+
function pluginMarketplaceDirectory(homeDirectory = (0, node_os_1.homedir)()) {
|
|
17
|
+
return (0, node_path_1.join)(homeDirectory, '.dreamstate', 'marketplace', 'dreamstate');
|
|
18
|
+
}
|
|
19
|
+
// Each sequence is safe to rerun: a rerun refreshes the marketplace and moves
|
|
20
|
+
// an existing install to the version just copied.
|
|
21
|
+
function agentSteps(agent, marketplace) {
|
|
22
|
+
if (agent === 'claude')
|
|
23
|
+
return [
|
|
24
|
+
{ args: ['plugin', 'marketplace', 'add', marketplace] },
|
|
25
|
+
{ args: ['plugin', 'marketplace', 'update', 'dreamstate'] },
|
|
26
|
+
{ args: ['plugin', 'install', 'dreamstate@dreamstate'] },
|
|
27
|
+
{ args: ['plugin', 'update', 'dreamstate@dreamstate'] },
|
|
28
|
+
];
|
|
29
|
+
if (agent === 'codex')
|
|
30
|
+
return [
|
|
31
|
+
{ args: ['plugin', 'marketplace', 'add', marketplace] },
|
|
32
|
+
{ args: ['plugin', 'add', 'dreamstate@dreamstate'] },
|
|
33
|
+
];
|
|
34
|
+
return [
|
|
35
|
+
// Grok exits 1 when the source is already configured, which a rerun always hits.
|
|
36
|
+
{ args: ['plugin', 'marketplace', 'add', marketplace], tolerateFailure: true },
|
|
37
|
+
// --trust skips Grok's confirmation; running dreamstate install is the consent.
|
|
38
|
+
{ args: ['plugin', 'install', 'dreamstate@dreamstate', '--trust'] },
|
|
39
|
+
{ args: ['plugin', 'update', 'dreamstate'] },
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
const runAgentCommand = (command, args) => new Promise((resolve, reject) => {
|
|
43
|
+
// Agent output goes to stderr so stdout stays one JSON result.
|
|
44
|
+
const child = (0, node_child_process_1.spawn)(command, args, { stdio: ['inherit', process.stderr, 'inherit'] });
|
|
45
|
+
child.once('error', (error) => (error.code === 'ENOENT' ? resolve(null) : reject(error)));
|
|
46
|
+
child.once('close', (code) => resolve(code ?? 1));
|
|
47
|
+
});
|
|
48
|
+
exports.runAgentCommand = runAgentCommand;
|
|
49
|
+
async function installAgentPlugin(options) {
|
|
50
|
+
const marketplace = pluginMarketplaceDirectory(options.homeDirectory);
|
|
51
|
+
const run = options.run ?? exports.runAgentCommand;
|
|
52
|
+
// A stable copy outside the npm cache, so npx cleanups never break an install.
|
|
53
|
+
await (0, promises_1.rm)(marketplace, { recursive: true, force: true });
|
|
54
|
+
await (0, promises_1.cp)(options.bundleDirectory, marketplace, { recursive: true });
|
|
55
|
+
const results = [];
|
|
56
|
+
for (const agent of options.agents) {
|
|
57
|
+
let result = { agent, status: 'installed' };
|
|
58
|
+
for (const step of agentSteps(agent, marketplace)) {
|
|
59
|
+
const code = await run(agent, step.args);
|
|
60
|
+
if (code === null) {
|
|
61
|
+
result = { agent, status: 'not_found' };
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
if (code !== 0 && !step.tolerateFailure) {
|
|
65
|
+
result = { agent, status: 'failed', failed_command: [agent, ...step.args].join(' ') };
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
results.push(result);
|
|
70
|
+
}
|
|
71
|
+
return { marketplace_directory: marketplace, agents: results };
|
|
72
|
+
}
|
|
73
|
+
// Which skill-install agents already load Dreamstate skills from the plugin,
|
|
74
|
+
// read from each agent's own install record. Login skips those agents so the
|
|
75
|
+
// same skill is not loaded twice under two names.
|
|
76
|
+
async function agentsWithDreamstatePlugin(homeDirectory = (0, node_os_1.homedir)()) {
|
|
77
|
+
const found = [];
|
|
78
|
+
try {
|
|
79
|
+
const record = JSON.parse(await (0, promises_1.readFile)((0, node_path_1.join)(homeDirectory, '.claude', 'plugins', 'installed_plugins.json'), 'utf8'));
|
|
80
|
+
if (record.plugins && 'dreamstate@dreamstate' in record.plugins)
|
|
81
|
+
found.push('claude-code');
|
|
82
|
+
}
|
|
83
|
+
catch { /* not installed */ }
|
|
84
|
+
try {
|
|
85
|
+
const config = await (0, promises_1.readFile)((0, node_path_1.join)(homeDirectory, '.codex', 'config.toml'), 'utf8');
|
|
86
|
+
if (config.includes('[plugins."dreamstate@dreamstate"]'))
|
|
87
|
+
found.push('codex');
|
|
88
|
+
}
|
|
89
|
+
catch { /* not installed */ }
|
|
90
|
+
return found;
|
|
91
|
+
}
|
|
92
|
+
// Removes the dreamstate skills an earlier login linked into ~/.claude/skills,
|
|
93
|
+
// now that the plugin carries them. Only entries the CLI wrote are touched:
|
|
94
|
+
// symlinks into the shared skills directory, or copies stamped with provenance.
|
|
95
|
+
async function removeClaudeSkillCopies(homeDirectory = (0, node_os_1.homedir)()) {
|
|
96
|
+
const directory = (0, node_path_1.join)(homeDirectory, '.claude', 'skills');
|
|
97
|
+
let names;
|
|
98
|
+
try {
|
|
99
|
+
names = await (0, promises_1.readdir)(directory);
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
return [];
|
|
103
|
+
}
|
|
104
|
+
const removed = [];
|
|
105
|
+
for (const name of names.filter((item) => item === 'dreamstate' || item.startsWith('dreamstate-'))) {
|
|
106
|
+
const path = (0, node_path_1.join)(directory, name);
|
|
107
|
+
let owned = (await (0, promises_1.lstat)(path)).isSymbolicLink();
|
|
108
|
+
if (!owned) {
|
|
109
|
+
try {
|
|
110
|
+
owned = (await (0, promises_1.readFile)((0, node_path_1.join)(path, 'SKILL.md'), 'utf8')).includes('<!-- dreamstate provenance:');
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
owned = false;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
if (owned) {
|
|
117
|
+
await (0, promises_1.rm)(path, { recursive: true, force: true });
|
|
118
|
+
removed.push(path);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return removed;
|
|
122
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trydreamstate/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Live command-line client for the Dreamstate v1 API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,10 +15,11 @@
|
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
17
|
"dist",
|
|
18
|
+
"agent-plugin",
|
|
18
19
|
"README.md"
|
|
19
20
|
],
|
|
20
21
|
"scripts": {
|
|
21
|
-
"build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc",
|
|
22
|
+
"build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc && node scripts/build-agent-plugin.mjs",
|
|
22
23
|
"test": "npm run build && jest --config jest.config.cjs --runInBand",
|
|
23
24
|
"type-check": "tsc --noEmit",
|
|
24
25
|
"pack:check": "npm pack --dry-run",
|