@trydreamstate/cli 1.3.2 → 1.3.4

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.
Files changed (91) hide show
  1. package/README.md +36 -16
  2. package/agent-plugin/.claude-plugin/plugin.json +1 -1
  3. package/agent-plugin/.codex-plugin/plugin.json +1 -1
  4. package/agent-plugin/hooks/approve-readonly.sh +15 -0
  5. package/agent-plugin/hooks/hooks.json +17 -0
  6. package/agent-plugin/skills/crm/SKILL.md +2 -2
  7. package/agent-plugin/skills/diagnostics/SKILL.md +3 -1
  8. package/agent-plugin/skills/dreamstate/SKILL.md +15 -5
  9. package/agent-plugin/skills/first-win/SKILL.md +2 -2
  10. package/agent-plugin/skills/inbox-replies/SKILL.md +3 -1
  11. package/agent-plugin/skills/knowledge/SKILL.md +3 -5
  12. package/agent-plugin/skills/linkedin-posts/SKILL.md +3 -1
  13. package/agent-plugin/skills/linkedin-warm-signals/SKILL.md +2 -2
  14. package/agent-plugin/skills/list-building/SKILL.md +5 -10
  15. package/agent-plugin/skills/list-building/column-authoring.md +1 -1
  16. package/agent-plugin/skills/list-building/sourcing.md +2 -2
  17. package/agent-plugin/skills/outreach/SKILL.md +2 -2
  18. package/agent-plugin/skills/outreach/steps-and-timing.md +1 -1
  19. package/agent-plugin/skills/plays/SKILL.md +3 -3
  20. package/agent-plugin/skills/reddit-posts/SKILL.md +3 -1
  21. package/agent-plugin/skills/skill-authoring/SKILL.md +3 -1
  22. package/agent-plugin/skills/social/SKILL.md +4 -6
  23. package/agent-plugin/skills/visibility/SKILL.md +2 -6
  24. package/agent-plugin/skills/workflows/SKILL.md +3 -3
  25. package/agent-plugin/skills/workflows/lifecycle-and-enrollment.md +1 -1
  26. package/agent-plugin/skills/worksheet-tidy/SKILL.md +3 -1
  27. package/agent-plugin/skills/writing/SKILL.md +3 -5
  28. package/agent-plugin/skills/x-posts/SKILL.md +3 -1
  29. package/dist/agentGuidance.generated.json +35 -0
  30. package/dist/capabilityPosture.d.ts +12 -0
  31. package/dist/capabilityPosture.d.ts.map +1 -0
  32. package/dist/capabilityPosture.js +39 -0
  33. package/dist/client.d.ts +33 -2
  34. package/dist/client.d.ts.map +1 -1
  35. package/dist/client.js +155 -64
  36. package/dist/commandTable.d.ts +26 -0
  37. package/dist/commandTable.d.ts.map +1 -0
  38. package/dist/commandTable.js +54 -0
  39. package/dist/commands/sequences.d.ts +3 -2
  40. package/dist/commands/sequences.d.ts.map +1 -1
  41. package/dist/commands/sequences.js +17 -34
  42. package/dist/commands/shared.d.ts +4 -26
  43. package/dist/commands/shared.d.ts.map +1 -1
  44. package/dist/commands/shared.js +136 -158
  45. package/dist/commands/workflows.d.ts +3 -2
  46. package/dist/commands/workflows.d.ts.map +1 -1
  47. package/dist/commands/workflows.js +17 -39
  48. package/dist/errors.d.ts +74 -0
  49. package/dist/errors.d.ts.map +1 -0
  50. package/dist/errors.js +84 -0
  51. package/dist/gatedRun.d.ts +79 -0
  52. package/dist/gatedRun.d.ts.map +1 -0
  53. package/dist/gatedRun.js +346 -0
  54. package/dist/generated/packVerbs.generated.json +492 -0
  55. package/dist/generated/runContract.generated.d.ts +4 -0
  56. package/dist/generated/runContract.generated.d.ts.map +1 -0
  57. package/dist/generated/runContract.generated.js +7 -0
  58. package/dist/idempotency.d.ts +38 -0
  59. package/dist/idempotency.d.ts.map +1 -0
  60. package/dist/idempotency.js +106 -0
  61. package/dist/index.d.ts +22 -35
  62. package/dist/index.d.ts.map +1 -1
  63. package/dist/index.js +405 -378
  64. package/dist/registryManifest.d.ts +6 -0
  65. package/dist/registryManifest.d.ts.map +1 -0
  66. package/dist/registryManifest.js +66 -0
  67. package/dist/runContract.d.ts +10 -0
  68. package/dist/runContract.d.ts.map +1 -0
  69. package/dist/runContract.js +13 -0
  70. package/dist/runWait.d.ts +2 -2
  71. package/dist/runWait.d.ts.map +1 -1
  72. package/dist/runWait.js +3 -14
  73. package/dist/schemaCoercion.d.ts +20 -0
  74. package/dist/schemaCoercion.d.ts.map +1 -0
  75. package/dist/schemaCoercion.js +123 -0
  76. package/dist/skillInstaller.d.ts +40 -0
  77. package/dist/skillInstaller.d.ts.map +1 -1
  78. package/dist/skillInstaller.js +108 -9
  79. package/dist/tableFilePreview.d.ts +14 -0
  80. package/dist/tableFilePreview.d.ts.map +1 -1
  81. package/dist/tableFilePreview.js +19 -8
  82. package/dist/tableFileReader.d.ts +26 -0
  83. package/dist/tableFileReader.d.ts.map +1 -0
  84. package/dist/tableFileReader.js +108 -0
  85. package/dist/tablesImport.d.ts +57 -0
  86. package/dist/tablesImport.d.ts.map +1 -0
  87. package/dist/tablesImport.js +263 -0
  88. package/dist/turnCache.d.ts +14 -1
  89. package/dist/turnCache.d.ts.map +1 -1
  90. package/dist/turnCache.js +25 -8
  91. package/package.json +6 -3
@@ -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
+ }
@@ -1,7 +1,8 @@
1
- import { runPackCommand, type PackVerbSpec } from './shared';
1
+ import { type PackVerbSpec } from './shared';
2
2
  import type { CliCommand } from '../index';
3
+ import type { GatedRunContext } from '../gatedRun';
3
4
  export declare const SEQUENCE_VERBS: PackVerbSpec[];
4
5
  export declare const SEQUENCES_USAGE: string;
5
6
  export declare const parseSequencesCommand: (argv: string[]) => CliCommand;
6
- export declare function runSequencesCommand(client: Parameters<typeof runPackCommand>[0], command: CliCommand, stdout: NodeJS.WritableStream, sleep?: Parameters<typeof runPackCommand>[3]): Promise<void>;
7
+ export declare function runSequencesCommand(context: GatedRunContext | undefined, command: CliCommand, stdout: NodeJS.WritableStream): Promise<void>;
7
8
  //# 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;AAE3C,eAAO,MAAM,cAAc,EAAE,YAAY,EA+BxC,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,MAAqD,CAAC;AACpF,eAAO,MAAM,qBAAqB,gCAA4E,CAAC;AAC/G,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,EAC5C,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,MAAM,CAAC,cAAc,EAC7B,KAAK,CAAC,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,GAC3C,OAAO,CAAC,IAAI,CAAC,CAMf"}
1
+ {"version":3,"file":"sequences.d.ts","sourceRoot":"","sources":["../../src/commands/sequences.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiE,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAC5G,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAInD,eAAO,MAAM,cAAc,EAAE,YAAY,EAMpC,CAAC;AAEN,eAAO,MAAM,eAAe,QAA+C,CAAC;AAC5E,eAAO,MAAM,qBAAqB,gCAA4E,CAAC;AAC/G,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,eAAe,GAAG,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAQjJ"}
@@ -1,46 +1,29 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.parseSequencesCommand = exports.SEQUENCES_USAGE = exports.SEQUENCE_VERBS = void 0;
4
7
  exports.runSequencesCommand = runSequencesCommand;
5
8
  const shared_1 = require("./shared");
6
- exports.SEQUENCE_VERBS = [
7
- { verb: 'create-from-worksheet', capabilityId: 'sequence.sequences.create_from_worksheet', summary: 'Create draft sequence from worksheet and enroll rows. Never publishes or sends.', flags: { worksheet: { type: 'string', into: 'worksheet_id' }, view: { type: 'string', into: 'view_id' }, name: { type: 'string', into: 'name' }, steps: { type: 'string', into: 'steps', json: true }, description: { type: 'string', into: 'description' }, timezone: { type: 'string', into: 'timezone' }, 'daily-cap': { type: 'string', into: 'daily_cap', number: true }, senders: { type: 'string', into: 'senders', json: true }, 'enrollment-filter': { type: 'string', into: 'enrollment_filter', json: true }, 'max-new-enrollments-per-day': { type: 'string', into: 'max_new_enrollments_per_day', number: true } }, mutating: true },
8
- { verb: 'list', capabilityId: 'workflow.automations.list', summary: 'List sequences in workspace.', flags: { limit: { type: 'string', into: 'limit' }, cursor: { type: 'string', into: 'cursor' }, lifecycle: { type: 'string', into: 'lifecycle' }, 'include-archived': { type: 'boolean', into: 'include_archived' }, search: { type: 'string', into: 'search' } }, mutating: false },
9
- // Local only: writes a starter document to disk and calls no API, so authoring can
10
- // begin from a file. capabilityId names the verb this scaffold is meant to feed.
11
- { verb: 'init', capabilityId: 'workflow.automations.lint', summary: 'Write a starter sequence document to a local file. Calls no API and changes nothing.', flags: { name: { type: 'string', into: 'name' }, file: { type: 'string', into: 'file' } }, mutating: false },
12
- { verb: 'get', capabilityId: 'workflow.automations.get', summary: 'Get one sequence.', positional: [{ name: 'id', into: 'automation_id' }], mutating: false },
13
- { verb: 'create', capabilityId: 'workflow.automations.compose', summary: 'Create draft sequence. Does not publish or send.', flags: { name: { type: 'string', into: 'name' }, description: { type: 'string', into: 'description' }, timezone: { type: 'string', into: 'timezone' }, enrollment: { type: 'string', into: 'enrollment', json: true }, 'daily-cap': { type: 'string', into: 'daily_cap' }, 'max-new-enrollments-per-day': { type: 'string', into: 'max_new_enrollments_per_day' }, senders: { type: 'string', into: 'senders', json: true }, steps: { type: 'string', into: 'steps', json: true }, 'on-duplicate-name': { type: 'string', into: 'on_duplicate_name' } }, mutating: true },
14
- { verb: 'update', capabilityId: 'workflow.automations.update', summary: 'Update sequence draft settings. Does not publish or send.', positional: [{ name: 'id', into: 'automation_id' }], flags: { patch: { type: 'string', into: 'patch', json: true }, 'expected-version': { type: 'string', into: 'expected_version', number: true } }, mutating: true },
15
- { verb: 'lint', capabilityId: 'workflow.automations.lint', summary: 'Lint sequence draft. Makes no changes.', positional: [{ name: 'id', into: 'automation_id' }], flags: { document: { type: 'string', into: 'document', json: true, document: true } }, mutating: false },
16
- { verb: 'preview', capabilityId: 'workflow.automations.preview', summary: 'Preview saved sequence. Creates no run and sends nothing.', positional: [{ name: 'id', into: 'automation_id' }], mutating: false },
17
- { verb: 'variables', capabilityId: 'workflow.automations.variables_list', summary: 'List template variables available in sequence.', positional: [{ name: 'id', into: 'automation_id' }], flags: { document: { type: 'string', into: 'document', json: true, document: true }, node: { type: 'string', into: 'node_id' }, query: { type: 'string', into: 'query' }, limit: { type: 'string', into: 'limit' } }, mutating: false },
18
- { verb: 'node-catalog', capabilityId: 'workflow.automations.node_catalog', summary: 'List available sequence node types.', flags: { query: { type: 'string', into: 'query' }, family: { type: 'string', into: 'family' }, 'include-blocked': { type: 'boolean', into: 'include_blocked' } }, mutating: false },
19
- { verb: 'node-inspect', capabilityId: 'workflow.automations.node_inspect', summary: 'Inspect sequence node type or saved node.', positional: [{ name: 'id', into: 'automation_id', optional: true }], flags: { node: { type: 'string', into: 'node_id' }, 'node-kind': { type: 'string', into: 'node_kind' }, subtype: { type: 'string', into: 'subtype' }, config: { type: 'string', into: 'config', json: true } }, mutating: false },
20
- { verb: 'node-add', capabilityId: 'workflow.automations.node_add', summary: 'Add node to sequence draft. Does not publish or send.', positional: [{ name: 'id', into: 'automation_id' }], flags: { node: { type: 'string', into: 'node', json: true }, 'after-node': { type: 'string', into: 'after_node_id' }, branch: { type: 'string', into: 'branch' }, 'expected-version': { type: 'string', into: 'expected_version', number: true } }, mutating: true },
21
- { verb: 'node-patch', capabilityId: 'workflow.automations.node_patch', summary: 'Patch sequence node. Does not publish or send.', positional: [{ name: 'id', into: 'automation_id' }], flags: { node: { type: 'string', into: 'node_id' }, fields: { type: 'string', into: 'fields', json: true }, 'expected-version': { type: 'string', into: 'expected_version', number: true } }, mutating: true },
22
- { verb: 'node-remove', capabilityId: 'workflow.automations.node_remove', summary: 'Remove node from sequence draft. Does not publish or send.', positional: [{ name: 'id', into: 'automation_id' }], flags: { node: { type: 'string', into: 'node_id' }, 'expected-version': { type: 'string', into: 'expected_version', number: true } }, mutating: true },
23
- { verb: 'node-move', capabilityId: 'workflow.automations.node_move', summary: 'Move sequence node. Does not publish or send.', positional: [{ name: 'id', into: 'automation_id' }], flags: { node: { type: 'string', into: 'node_id' }, 'after-node': { type: 'string', into: 'after_node_id' }, branch: { type: 'string', into: 'branch' }, 'expected-version': { type: 'string', into: 'expected_version', number: true } }, mutating: true },
24
- { verb: 'field-options', capabilityId: 'workflow.automations.field_options', summary: 'List options for sequence node fields.', positional: [{ name: 'id', into: 'automation_id', optional: true }], flags: { node: { type: 'string', into: 'node_id' }, 'node-kind': { type: 'string', into: 'node_kind' }, subtype: { type: 'string', into: 'subtype' }, 'field-key': { type: 'string', into: 'field_key' }, 'field-keys': { type: 'string', into: 'field_keys', json: true }, query: { type: 'string', into: 'query' }, limit: { type: 'string', into: 'limit' }, cursor: { type: 'string', into: 'cursor' }, 'field-context': { type: 'string', into: 'field_context', json: true } }, mutating: false },
25
- { verb: 'publish', capabilityId: 'sequence.sequences.publish', summary: 'Publish sequence draft. Does not enroll or send.', positional: [{ name: 'id', into: 'sequence_id' }], flags: { 'sequence-version-id': { type: 'string', into: 'sequence_version_id' }, 'latest-draft-version-id': { type: 'string', into: 'latest_draft_version_id' } }, mutating: true },
26
- { verb: 'enroll', capabilityId: 'sequence.sequences.enroll_selection', summary: 'Enroll rows into sequence. Spends no credits and sends nothing; dispatch only happens at launch.', positional: [{ name: 'id', into: 'sequence_id' }], flags: { worksheet: { type: 'string', into: 'worksheet_id' }, view: { type: 'string', into: 'view_id' }, 'enrollment-filter': { type: 'string', into: 'enrollment_filter', json: true }, 'enrollment-priority': { type: 'string', into: 'enrollment_priority', json: true }, 'enrollment-sort': { type: 'string', into: 'enrollment_sort', json: true }, 'max-live-sends': { type: 'string', into: 'max_live_sends' }, 'max-new-enrollments-per-day': { type: 'string', into: 'max_new_enrollments_per_day' } }, mutating: true },
27
- { verb: 'enrollments', capabilityId: 'sequence.sequences.contacts_list', summary: 'List people enrolled in sequence.', positional: [{ name: 'id', into: 'sequence_id' }], flags: { limit: { type: 'string', into: 'limit' }, cursor: { type: 'string', into: 'cursor' } }, mutating: false },
28
- { verb: 'launch', capabilityId: 'sequence.sequences.launch', summary: 'Launch published sequence dispatch.', positional: [{ name: 'id', into: 'sequence_id' }], flags: { 'max-live-sends': { type: 'string', into: 'max_live_sends' } }, mutating: true },
29
- { verb: 'pause', capabilityId: 'sequence.sequences.pause', summary: 'Pause sequence dispatch. Sends no new messages.', positional: [{ name: 'id', into: 'sequence_id' }], mutating: true },
30
- { verb: 'resume', capabilityId: 'sequence.sequences.resume', summary: 'Resume sequence dispatch.', positional: [{ name: 'id', into: 'sequence_id' }], flags: { 'max-live-sends': { type: 'string', into: 'max_live_sends' } }, mutating: true },
31
- { verb: 'stats', capabilityId: 'sequence.sequences.step_counts_get', summary: 'Get sequence step counts.', positional: [{ name: 'id', into: 'sequence_id' }], mutating: false },
32
- { verb: 'analytics', capabilityId: 'sequence.sequences.analytics_get', summary: 'Get sequence analytics.', positional: [{ name: 'id', into: 'sequence_id' }], flags: { 'window-days': { type: 'string', into: 'window_days', number: true } }, mutating: false },
33
- { verb: 'duplicate', capabilityId: 'workflow.automations.duplicate', summary: 'Duplicate sequence as draft. Does not publish or send.', positional: [{ name: 'id', into: 'automation_id' }], flags: { name: { type: 'string', into: 'name' }, 'expected-version': { type: 'string', into: 'expected_version', number: true } }, mutating: true },
34
- { verb: 'archive', capabilityId: 'workflow.automations.archive', summary: 'Archive sequence. Does not delete records or send.', positional: [{ name: 'id', into: 'automation_id' }], flags: { reason: { type: 'string', into: 'reason' }, 'expected-version': { type: 'string', into: 'expected_version', number: true } }, mutating: true },
35
- { verb: 'export', capabilityId: 'workflow.automations.export', summary: 'Export sequence definition. Makes no changes.', positional: [{ name: 'id', into: 'automation_id' }], mutating: false },
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 },
37
- ];
9
+ const errors_1 = require("../errors");
10
+ const packVerbs_generated_json_1 = __importDefault(require("../generated/packVerbs.generated.json"));
11
+ exports.SEQUENCE_VERBS = packVerbs_generated_json_1.default.verbs
12
+ .filter(({ command }) => command.startsWith('sequences '))
13
+ .map(({ command, capabilityId, positional, local }) => ({
14
+ verb: command.slice('sequences '.length), capabilityId,
15
+ ...(positional ? { positional } : {}),
16
+ ...(local === 'init' ? { local: 'init' } : {}),
17
+ }));
38
18
  exports.SEQUENCES_USAGE = (0, shared_1.renderPackUsage)('sequences', exports.SEQUENCE_VERBS);
39
19
  exports.parseSequencesCommand = (0, shared_1.buildPackParser)('sequences', 'sequence', exports.SEQUENCE_VERBS, exports.SEQUENCES_USAGE);
40
- async function runSequencesCommand(client, command, stdout, sleep) {
20
+ async function runSequencesCommand(context, command, stdout) {
21
+ // init writes a local file and calls no API, so it has no gated context.
41
22
  if (command.command === 'pack' && command.verb === 'init') {
42
23
  (0, shared_1.runPackInit)('sequence', command, stdout);
43
24
  return;
44
25
  }
45
- await (0, shared_1.runPackCommand)(client, command, stdout, sleep);
26
+ if (!context)
27
+ throw new errors_1.CliUsageError('sequences commands other than init require an authenticated session.');
28
+ await (0, shared_1.runPackCommand)(context, command, stdout);
46
29
  }
@@ -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
- * `document: true` marks the ONE flag that carries a whole authored document, so
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(client: DreamstateClient, command: CliCommand, stdout: NodeJS.WritableStream, sleep?: (milliseconds: number) => Promise<void>): Promise<void>;
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":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAKlD,OAAO,EAA6B,KAAK,UAAU,EAAiC,MAAM,UAAU,CAAC;AAOrG,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IACpD;;;;;;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;;;;;;;OAOG;IACH;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,QAAQ,GAAC,SAAS,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAC7I,QAAQ,EAAE,OAAO,CAAC;CACnB;AAsBD,wBAAgB,eAAe,CAC7B,IAAI,EAAE,WAAW,GAAC,WAAW,EAAE,IAAI,EAAE,UAAU,GAAC,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,MAAM,GAC/F,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,UAAU,CAmHhC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