@trydreamstate/cli 1.2.0 → 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.
Files changed (77) hide show
  1. package/README.md +11 -1
  2. package/agent-plugin/.agents/plugins/marketplace.json +20 -0
  3. package/agent-plugin/.claude-plugin/marketplace.json +16 -0
  4. package/agent-plugin/.grok-plugin/marketplace.json +16 -0
  5. package/agent-plugin/plugins/dreamstate/.claude-plugin/plugin.json +21 -0
  6. package/agent-plugin/plugins/dreamstate/.codex-plugin/plugin.json +41 -0
  7. package/agent-plugin/plugins/dreamstate/.mcp.json +8 -0
  8. package/agent-plugin/plugins/dreamstate/skills/crm/SKILL.md +75 -0
  9. package/agent-plugin/plugins/dreamstate/skills/diagnostics/SKILL.md +72 -0
  10. package/agent-plugin/plugins/dreamstate/skills/dreamstate/SKILL.md +16 -0
  11. package/agent-plugin/plugins/dreamstate/skills/first-win/SKILL.md +57 -0
  12. package/agent-plugin/plugins/dreamstate/skills/inbox-replies/SKILL.md +61 -0
  13. package/agent-plugin/plugins/dreamstate/skills/knowledge/SKILL.md +48 -0
  14. package/agent-plugin/plugins/dreamstate/skills/linkedin-posts/SKILL.md +79 -0
  15. package/agent-plugin/plugins/dreamstate/skills/linkedin-warm-signals/SKILL.md +65 -0
  16. package/agent-plugin/plugins/dreamstate/skills/list-building/SKILL.md +105 -0
  17. package/agent-plugin/plugins/dreamstate/skills/list-building/column-authoring.md +37 -0
  18. package/agent-plugin/plugins/dreamstate/skills/list-building/readback.md +15 -0
  19. package/agent-plugin/plugins/dreamstate/skills/list-building/sourcing.md +31 -0
  20. package/agent-plugin/plugins/dreamstate/skills/outreach/SKILL.md +77 -0
  21. package/agent-plugin/plugins/dreamstate/skills/outreach/channels.md +5 -0
  22. package/agent-plugin/plugins/dreamstate/skills/outreach/deliverability-and-caps.md +17 -0
  23. package/agent-plugin/plugins/dreamstate/skills/outreach/enrollment.md +17 -0
  24. package/agent-plugin/plugins/dreamstate/skills/outreach/message-copy.md +41 -0
  25. package/agent-plugin/plugins/dreamstate/skills/outreach/replies.md +5 -0
  26. package/agent-plugin/plugins/dreamstate/skills/outreach/steps-and-timing.md +13 -0
  27. package/agent-plugin/plugins/dreamstate/skills/outreach/stop-and-suppression.md +7 -0
  28. package/agent-plugin/plugins/dreamstate/skills/plays/SKILL.md +81 -0
  29. package/agent-plugin/plugins/dreamstate/skills/reddit-posts/SKILL.md +65 -0
  30. package/agent-plugin/plugins/dreamstate/skills/skill-authoring/SKILL.md +65 -0
  31. package/agent-plugin/plugins/dreamstate/skills/social/SKILL.md +69 -0
  32. package/agent-plugin/plugins/dreamstate/skills/visibility/SKILL.md +60 -0
  33. package/agent-plugin/plugins/dreamstate/skills/visibility/probes.md +15 -0
  34. package/agent-plugin/plugins/dreamstate/skills/visibility/query-sets.md +17 -0
  35. package/agent-plugin/plugins/dreamstate/skills/visibility/search-evidence.md +15 -0
  36. package/agent-plugin/plugins/dreamstate/skills/visibility/technical.md +16 -0
  37. package/agent-plugin/plugins/dreamstate/skills/workflows/SKILL.md +43 -0
  38. package/agent-plugin/plugins/dreamstate/skills/workflows/durable-runs.md +19 -0
  39. package/agent-plugin/plugins/dreamstate/skills/workflows/graph-authoring.md +9 -0
  40. package/agent-plugin/plugins/dreamstate/skills/workflows/lifecycle-and-enrollment.md +11 -0
  41. package/agent-plugin/plugins/dreamstate/skills/workflows/live-replies.md +5 -0
  42. package/agent-plugin/plugins/dreamstate/skills/workflows/recipe-routing.md +5 -0
  43. package/agent-plugin/plugins/dreamstate/skills/worksheet-tidy/SKILL.md +61 -0
  44. package/agent-plugin/plugins/dreamstate/skills/writing/SKILL.md +84 -0
  45. package/agent-plugin/plugins/dreamstate/skills/writing/briefs.md +35 -0
  46. package/agent-plugin/plugins/dreamstate/skills/writing/drafting.md +39 -0
  47. package/agent-plugin/plugins/dreamstate/skills/writing/publishing.md +74 -0
  48. package/agent-plugin/plugins/dreamstate/skills/writing/revision-and-voice.md +31 -0
  49. package/agent-plugin/plugins/dreamstate/skills/x-posts/SKILL.md +73 -0
  50. package/dist/client.d.ts +3 -1
  51. package/dist/client.d.ts.map +1 -1
  52. package/dist/client.js +126 -41
  53. package/dist/commands/sequences.d.ts +1 -1
  54. package/dist/commands/sequences.d.ts.map +1 -1
  55. package/dist/commands/sequences.js +3 -3
  56. package/dist/commands/shared.d.ts +2 -1
  57. package/dist/commands/shared.d.ts.map +1 -1
  58. package/dist/commands/shared.js +98 -20
  59. package/dist/commands/workflows.d.ts +1 -1
  60. package/dist/commands/workflows.d.ts.map +1 -1
  61. package/dist/commands/workflows.js +9 -9
  62. package/dist/config.d.ts +10 -0
  63. package/dist/config.d.ts.map +1 -1
  64. package/dist/config.js +95 -2
  65. package/dist/index.d.ts +51 -1
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.js +421 -67
  68. package/dist/pluginInstaller.d.ts +22 -0
  69. package/dist/pluginInstaller.d.ts.map +1 -0
  70. package/dist/pluginInstaller.js +122 -0
  71. package/dist/runWait.d.ts +9 -0
  72. package/dist/runWait.d.ts.map +1 -0
  73. package/dist/runWait.js +76 -0
  74. package/dist/skillInstaller.d.ts +1 -0
  75. package/dist/skillInstaller.d.ts.map +1 -1
  76. package/dist/skillInstaller.js +18 -0
  77. package/package.json +3 -2
@@ -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
+ }
@@ -0,0 +1,9 @@
1
+ import type { DreamstateClient } from './client';
2
+ export declare const RUN_WAIT_TIMEOUT_EXIT_CODE = 8;
3
+ export declare function columnRunReturnsRunId(capabilityId: string): boolean;
4
+ export interface RunWaitResult {
5
+ value: unknown;
6
+ timedOut: boolean;
7
+ }
8
+ export declare function waitForRun(client: DreamstateClient, initial: unknown, timeoutSeconds: number, sleep: (milliseconds: number) => Promise<void>): Promise<RunWaitResult>;
9
+ //# sourceMappingURL=runWait.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runWait.d.ts","sourceRoot":"","sources":["../src/runWait.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAOjD,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAY5C,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAEnE;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;CACnB;AA+BD,wBAAsB,UAAU,CAC9B,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAC7C,OAAO,CAAC,aAAa,CAAC,CAmBxB"}
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RUN_WAIT_TIMEOUT_EXIT_CODE = void 0;
4
+ exports.columnRunReturnsRunId = columnRunReturnsRunId;
5
+ exports.waitForRun = waitForRun;
6
+ const TERMINAL_STATUSES = new Set([
7
+ 'succeeded', 'completed', 'completed_with_errors', 'failed', 'cancelled', 'canceled', 'partially_completed',
8
+ 'timed_out', 'rejected', 'awaiting_approval', 'awaiting_input', 'waiting', 'waiting_approval', 'approval_required',
9
+ ]);
10
+ exports.RUN_WAIT_TIMEOUT_EXIT_CODE = 8;
11
+ const COLUMN_RUN_HAND_OFF = new Set([
12
+ 'tables.columns.run',
13
+ 'tables.columns.run_all',
14
+ 'tables.columns.run_remaining',
15
+ ]);
16
+ // timing:async column runs. The tools response is the durable run id. Waiting
17
+ // folds every provider row into the command. Progress and final cells are
18
+ // runs_get and rows.query. Other mutations still wait so the next command can
19
+ // read steps[0].outputs.
20
+ function columnRunReturnsRunId(capabilityId) {
21
+ return COLUMN_RUN_HAND_OFF.has(capabilityId);
22
+ }
23
+ function runFromEnvelope(value) {
24
+ if (!value || typeof value !== 'object' || Array.isArray(value))
25
+ return null;
26
+ const data = value.data;
27
+ if (!data || typeof data !== 'object' || Array.isArray(data))
28
+ return null;
29
+ const run = data.run;
30
+ if (!run || typeof run !== 'object' || Array.isArray(run))
31
+ return null;
32
+ const { id, run_id: runId, status } = run;
33
+ const resolvedId = typeof id === 'string' ? id : typeof runId === 'string' ? runId : null;
34
+ return resolvedId && typeof status === 'string' ? { id: resolvedId, status } : null;
35
+ }
36
+ function timedOutEnvelope(value, timeoutSeconds) {
37
+ if (!value || typeof value !== 'object' || Array.isArray(value))
38
+ return value;
39
+ const envelope = value;
40
+ const meta = envelope.meta && typeof envelope.meta === 'object' && !Array.isArray(envelope.meta)
41
+ ? envelope.meta
42
+ : {};
43
+ return {
44
+ ...envelope,
45
+ meta: {
46
+ ...meta,
47
+ wait: {
48
+ timed_out: true,
49
+ note: `Run still active after ${timeoutSeconds} seconds. Read it with dreamstate runs get <run_id>.`,
50
+ },
51
+ },
52
+ };
53
+ }
54
+ async function waitForRun(client, initial, timeoutSeconds, sleep) {
55
+ let value = initial;
56
+ let run = runFromEnvelope(value);
57
+ if (!run || TERMINAL_STATUSES.has(run.status))
58
+ return { value, timedOut: false };
59
+ const deadline = Date.now() + timeoutSeconds * 1_000;
60
+ let delay = 500;
61
+ while (Date.now() < deadline) {
62
+ try {
63
+ await sleep(Math.min(delay, Math.max(0, deadline - Date.now())));
64
+ value = await client.getRun(run.id);
65
+ }
66
+ catch {
67
+ // The admitted receipt is durable. Keep it printable when polling is interrupted.
68
+ return { value: timedOutEnvelope(value, timeoutSeconds), timedOut: true };
69
+ }
70
+ run = runFromEnvelope(value);
71
+ if (!run || TERMINAL_STATUSES.has(run.status))
72
+ return { value, timedOut: false };
73
+ delay = Math.min(delay * 2, 3_000);
74
+ }
75
+ return { value: timedOutEnvelope(value, timeoutSeconds), timedOut: true };
76
+ }
@@ -22,6 +22,7 @@ export interface SkillInstallOptions {
22
22
  }
23
23
  export declare function canonicalSkillsDirectory(homeDirectory?: string, project?: boolean, cwd?: string): string;
24
24
  export declare function skillInstallDirectory(agent: SkillInstallAgent, homeDirectory?: string, project?: boolean, cwd?: string): string;
25
+ export declare function detectInstalledSkillAgents(homeDirectory?: string): Promise<Array<'codex' | 'claude-code' | 'cursor'>>;
25
26
  export declare function renderSkillMarkdown(skill: HostedSkill, provenance: {
26
27
  workspaceId: string;
27
28
  indexVersion: string;
@@ -1 +1 @@
1
- {"version":3,"file":"skillInstaller.d.ts","sourceRoot":"","sources":["../src/skillInstaller.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,oBAAoB,+EAAgF,CAAC;AAClH,MAAM,MAAM,iBAAiB,GAAG,OAAO,oBAAoB,CAAC,MAAM,CAAC,CAAC;AAEpE,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IAChD,SAAS,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACtD;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACrC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAKD,wBAAgB,wBAAwB,CAAC,aAAa,SAAY,EAAE,OAAO,UAAQ,EAAE,GAAG,SAAgB,GAAG,MAAM,CAEhH;AAiBD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,iBAAiB,EAAE,aAAa,S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,EAAE,mBAAmB,GAAG,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,QAAQ,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CAgB1N;AAED,wBAAgB,WAAW,CAAC,SAAS,EAAE,OAAO,GAAG,WAAW,CAO3D;AAED,wBAAsB,sBAAsB,CAAC,MAAM,EAAE,SAAS,iBAAiB,EAAE,EAAE,aAAa,SAAY,EAAE,OAAO,UAAQ,EAAE,GAAG,SAAgB,GAAG,OAAO,CAAC,KAAK,CAAC;IAAE,KAAK,EAAE,iBAAiB,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAC;IAAC,mBAAmB,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAAC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,CAAC,CAkC1W"}
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.SKILL_INSTALL_AGENTS = void 0;
37
37
  exports.canonicalSkillsDirectory = canonicalSkillsDirectory;
38
38
  exports.skillInstallDirectory = skillInstallDirectory;
39
+ exports.detectInstalledSkillAgents = detectInstalledSkillAgents;
39
40
  exports.renderSkillMarkdown = renderSkillMarkdown;
40
41
  exports.installSkills = installSkills;
41
42
  exports.routerSkill = routerSkill;
@@ -72,6 +73,23 @@ function skillInstallDirectory(agent, homeDirectory = (0, node_os_1.homedir)(),
72
73
  return canonicalSkillsDirectory(homeDirectory, project, cwd);
73
74
  return (0, node_path_1.join)(project ? cwd : homeDirectory, ...segments);
74
75
  }
76
+ const LOGIN_SKILL_AGENT_DIRECTORIES = {
77
+ codex: '.codex',
78
+ 'claude-code': '.claude',
79
+ cursor: '.cursor',
80
+ };
81
+ async function detectInstalledSkillAgents(homeDirectory = (0, node_os_1.homedir)()) {
82
+ const agents = Object.entries(LOGIN_SKILL_AGENT_DIRECTORIES);
83
+ const present = await Promise.all(agents.map(async ([agent, directory]) => {
84
+ try {
85
+ return (await (0, promises_1.stat)((0, node_path_1.join)(homeDirectory, directory))).isDirectory() ? agent : null;
86
+ }
87
+ catch {
88
+ return null;
89
+ }
90
+ }));
91
+ return present.filter((agent) => agent !== null);
92
+ }
75
93
  function linksIntoCanonical(agent) {
76
94
  return AGENT_SKILL_DIRECTORIES[agent] !== null;
77
95
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trydreamstate/cli",
3
- "version": "1.2.0",
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",