@trydreamstate/cli 1.3.3 → 1.3.5
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 +14 -7
- 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 +2 -2
- package/agent-plugin/hooks/hooks.json +1 -1
- package/agent-plugin/skills/crm/SKILL.md +2 -2
- package/agent-plugin/skills/diagnostics/SKILL.md +3 -1
- package/agent-plugin/skills/dreamstate/SKILL.md +5 -3
- package/agent-plugin/skills/first-win/SKILL.md +2 -2
- package/agent-plugin/skills/inbox-replies/SKILL.md +3 -1
- package/agent-plugin/skills/knowledge/SKILL.md +3 -5
- package/agent-plugin/skills/linkedin-posts/SKILL.md +3 -1
- package/agent-plugin/skills/linkedin-warm-signals/SKILL.md +3 -3
- package/agent-plugin/skills/list-building/SKILL.md +4 -9
- package/agent-plugin/skills/list-building/column-authoring.md +3 -2
- package/agent-plugin/skills/list-building/sourcing.md +2 -2
- package/agent-plugin/skills/outreach/SKILL.md +3 -3
- package/agent-plugin/skills/plays/SKILL.md +3 -3
- package/agent-plugin/skills/reddit-posts/SKILL.md +3 -1
- package/agent-plugin/skills/skill-authoring/SKILL.md +3 -1
- package/agent-plugin/skills/social/SKILL.md +3 -5
- package/agent-plugin/skills/visibility/SKILL.md +2 -6
- package/agent-plugin/skills/workflows/SKILL.md +2 -2
- package/agent-plugin/skills/workflows/lifecycle-and-enrollment.md +1 -1
- package/agent-plugin/skills/worksheet-tidy/SKILL.md +3 -1
- package/agent-plugin/skills/writing/SKILL.md +3 -5
- package/agent-plugin/skills/x-posts/SKILL.md +3 -1
- package/dist/agentGuidance.generated.json +4 -4
- package/dist/capabilityPosture.d.ts +12 -0
- package/dist/capabilityPosture.d.ts.map +1 -0
- package/dist/capabilityPosture.js +39 -0
- package/dist/client.d.ts +9 -3
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +110 -63
- package/dist/commands/sequences.d.ts +3 -2
- package/dist/commands/sequences.d.ts.map +1 -1
- package/dist/commands/sequences.js +19 -37
- package/dist/commands/shared.d.ts.map +1 -1
- package/dist/commands/shared.js +22 -45
- package/dist/commands/workflows.d.ts +3 -2
- package/dist/commands/workflows.d.ts.map +1 -1
- package/dist/commands/workflows.js +19 -35
- package/dist/config.d.ts +5 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +12 -2
- package/dist/errors.d.ts +2 -6
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +10 -43
- package/dist/gatedRun.d.ts +2 -2
- package/dist/gatedRun.d.ts.map +1 -1
- package/dist/gatedRun.js +157 -60
- package/dist/generated/packVerbs.generated.json +492 -0
- package/dist/generated/runContract.generated.d.ts +4 -0
- package/dist/generated/runContract.generated.d.ts.map +1 -0
- package/dist/generated/runContract.generated.js +7 -0
- package/dist/index.d.ts +9 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +164 -59
- package/dist/money.d.ts +10 -0
- package/dist/money.d.ts.map +1 -0
- package/dist/money.js +75 -0
- package/dist/registryManifest.d.ts +6 -0
- package/dist/registryManifest.d.ts.map +1 -0
- package/dist/registryManifest.js +66 -0
- package/dist/runContract.d.ts +10 -0
- package/dist/runContract.d.ts.map +1 -0
- package/dist/runContract.js +13 -0
- package/dist/runWait.d.ts +0 -1
- package/dist/runWait.d.ts.map +1 -1
- package/dist/runWait.js +2 -13
- package/dist/turnCache.d.ts +3 -1
- package/dist/turnCache.d.ts.map +1 -1
- package/dist/turnCache.js +6 -2
- package/package.json +4 -2
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.lookupPosture = lookupPosture;
|
|
4
|
+
exports.rememberPosture = rememberPosture;
|
|
5
|
+
exports.noteRegistryHash = noteRegistryHash;
|
|
6
|
+
const node_fs_1 = require("node:fs");
|
|
7
|
+
const node_os_1 = require("node:os");
|
|
8
|
+
const node_path_1 = require("node:path");
|
|
9
|
+
function manifestPath(home = (0, node_os_1.homedir)()) {
|
|
10
|
+
return (0, node_path_1.join)(home, '.dreamstate', 'registry-manifest.json');
|
|
11
|
+
}
|
|
12
|
+
function empty() {
|
|
13
|
+
return { registry_hash: null, postures: {} };
|
|
14
|
+
}
|
|
15
|
+
function readManifest() {
|
|
16
|
+
try {
|
|
17
|
+
const parsed = JSON.parse((0, node_fs_1.readFileSync)(manifestPath(), 'utf8'));
|
|
18
|
+
const root = parsed && typeof parsed === 'object' && !Array.isArray(parsed) ? parsed : null;
|
|
19
|
+
if (!root)
|
|
20
|
+
return empty();
|
|
21
|
+
const postures = {};
|
|
22
|
+
const raw = root.postures && typeof root.postures === 'object' && !Array.isArray(root.postures)
|
|
23
|
+
? root.postures
|
|
24
|
+
: {};
|
|
25
|
+
for (const [id, value] of Object.entries(raw)) {
|
|
26
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
27
|
+
continue;
|
|
28
|
+
const posture = value;
|
|
29
|
+
postures[id] = { inlineRead: posture.inlineRead === true, returnsRunId: posture.returnsRunId === true };
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
registry_hash: typeof root.registry_hash === 'string' && root.registry_hash ? root.registry_hash : null,
|
|
33
|
+
postures,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return empty();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function writeManifest(manifest) {
|
|
41
|
+
try {
|
|
42
|
+
const path = manifestPath();
|
|
43
|
+
(0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(path), { recursive: true });
|
|
44
|
+
(0, node_fs_1.writeFileSync)(path, `${JSON.stringify(manifest)}\n`, 'utf8');
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
// Cache only. A request still runs when the home directory is not writable.
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function lookupPosture(capabilityId) {
|
|
51
|
+
return readManifest().postures[capabilityId] ?? null;
|
|
52
|
+
}
|
|
53
|
+
function rememberPosture(capabilityId, posture) {
|
|
54
|
+
const manifest = readManifest();
|
|
55
|
+
manifest.postures[capabilityId] = posture;
|
|
56
|
+
writeManifest(manifest);
|
|
57
|
+
}
|
|
58
|
+
/** Records the hash from a response. A change clears cached postures. */
|
|
59
|
+
function noteRegistryHash(hash) {
|
|
60
|
+
if (!hash)
|
|
61
|
+
return;
|
|
62
|
+
const manifest = readManifest();
|
|
63
|
+
if (manifest.registry_hash === hash)
|
|
64
|
+
return;
|
|
65
|
+
writeManifest({ registry_hash: hash, postures: manifest.registry_hash ? {} : manifest.postures });
|
|
66
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run-door constants. Frozen names are RUN_MODES, QUOTE_HASH_PATTERN and
|
|
3
|
+
* IDEMPOTENCY_KEY_MAX_LENGTH. The source is packages/types/src/agentSurface.ts.
|
|
4
|
+
* The published CLI cannot depend on the unpublished types package, so the
|
|
5
|
+
* values are generated into src/generated/runContract.generated.ts.
|
|
6
|
+
*/
|
|
7
|
+
import { IDEMPOTENCY_KEY_MAX_LENGTH, QUOTE_HASH_PATTERN, RUN_MODES } from './generated/runContract.generated';
|
|
8
|
+
export { IDEMPOTENCY_KEY_MAX_LENGTH, QUOTE_HASH_PATTERN, RUN_MODES };
|
|
9
|
+
export type RunMode = (typeof RUN_MODES)[number];
|
|
10
|
+
//# sourceMappingURL=runContract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runContract.d.ts","sourceRoot":"","sources":["../src/runContract.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,0BAA0B,EAC1B,kBAAkB,EAClB,SAAS,EACV,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,SAAS,EAAE,CAAC;AACrE,MAAM,MAAM,OAAO,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RUN_MODES = exports.QUOTE_HASH_PATTERN = exports.IDEMPOTENCY_KEY_MAX_LENGTH = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Run-door constants. Frozen names are RUN_MODES, QUOTE_HASH_PATTERN and
|
|
6
|
+
* IDEMPOTENCY_KEY_MAX_LENGTH. The source is packages/types/src/agentSurface.ts.
|
|
7
|
+
* The published CLI cannot depend on the unpublished types package, so the
|
|
8
|
+
* values are generated into src/generated/runContract.generated.ts.
|
|
9
|
+
*/
|
|
10
|
+
const runContract_generated_1 = require("./generated/runContract.generated");
|
|
11
|
+
Object.defineProperty(exports, "IDEMPOTENCY_KEY_MAX_LENGTH", { enumerable: true, get: function () { return runContract_generated_1.IDEMPOTENCY_KEY_MAX_LENGTH; } });
|
|
12
|
+
Object.defineProperty(exports, "QUOTE_HASH_PATTERN", { enumerable: true, get: function () { return runContract_generated_1.QUOTE_HASH_PATTERN; } });
|
|
13
|
+
Object.defineProperty(exports, "RUN_MODES", { enumerable: true, get: function () { return runContract_generated_1.RUN_MODES; } });
|
package/dist/runWait.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { DreamstateClient } from './client';
|
|
2
2
|
/** The wait ran out with the run still active; the latest run envelope is printed. */
|
|
3
3
|
export declare const RUN_WAIT_TIMEOUT_EXIT_CODE: number;
|
|
4
|
-
export declare function columnRunReturnsRunId(capabilityId: string): boolean;
|
|
5
4
|
export interface RunWaitResult {
|
|
6
5
|
value: unknown;
|
|
7
6
|
timedOut: boolean;
|
package/dist/runWait.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runWait.d.ts","sourceRoot":"","sources":["../src/runWait.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"runWait.d.ts","sourceRoot":"","sources":["../src/runWait.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAUjD,sFAAsF;AACtF,eAAO,MAAM,0BAA0B,EAAE,MAAyB,CAAC;AAEnE,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"}
|
package/dist/runWait.js
CHANGED
|
@@ -1,27 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RUN_WAIT_TIMEOUT_EXIT_CODE = void 0;
|
|
4
|
-
exports.columnRunReturnsRunId = columnRunReturnsRunId;
|
|
5
4
|
exports.waitForRun = waitForRun;
|
|
6
5
|
const errors_1 = require("./errors");
|
|
7
6
|
const TERMINAL_STATUSES = new Set([
|
|
8
7
|
'succeeded', 'completed', 'completed_with_errors', 'failed', 'cancelled', 'canceled', 'partially_completed',
|
|
9
8
|
'timed_out', 'rejected', 'awaiting_approval', 'awaiting_input', 'waiting', 'waiting_approval', 'approval_required',
|
|
9
|
+
// A rehearsal already finished. Polling it as if it were still running times the command out.
|
|
10
|
+
'dry_run_rehearsed', 'smoke_test_passed',
|
|
10
11
|
]);
|
|
11
12
|
/** The wait ran out with the run still active; the latest run envelope is printed. */
|
|
12
13
|
exports.RUN_WAIT_TIMEOUT_EXIT_CODE = errors_1.CLI_EXIT.TIMEOUT;
|
|
13
|
-
const COLUMN_RUN_HAND_OFF = new Set([
|
|
14
|
-
'tables.columns.run',
|
|
15
|
-
'tables.columns.run_all',
|
|
16
|
-
'tables.columns.run_remaining',
|
|
17
|
-
]);
|
|
18
|
-
// timing:async column runs. The tools response is the durable run id. Waiting
|
|
19
|
-
// folds every provider row into the command. Progress and final cells are
|
|
20
|
-
// runs_get and rows.query. Other mutations still wait so the next command can
|
|
21
|
-
// read steps[0].outputs.
|
|
22
|
-
function columnRunReturnsRunId(capabilityId) {
|
|
23
|
-
return COLUMN_RUN_HAND_OFF.has(capabilityId);
|
|
24
|
-
}
|
|
25
14
|
function runFromEnvelope(value) {
|
|
26
15
|
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
27
16
|
return null;
|
package/dist/turnCache.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export declare const TURN_REUSE_MS: number;
|
|
2
|
-
/** The quote a dry run returned, and the exact input it priced. */
|
|
2
|
+
/** The quote a dry run returned, and the exact input it priced. maximum_credits is absent on entries written before the field existed: treat that as unknown, not free. */
|
|
3
3
|
export type CachedQuote = {
|
|
4
4
|
quote_hash: string;
|
|
5
5
|
fingerprint: string;
|
|
6
|
+
maximum_credits?: number | null;
|
|
6
7
|
};
|
|
7
8
|
type CacheWarning = (error: NodeJS.ErrnoException) => void;
|
|
8
9
|
export declare function turnCachePath(credentialsPath: string): string;
|
|
@@ -14,6 +15,7 @@ export declare function reusableTurnToken(path: string, baseUrl: string, apiKey:
|
|
|
14
15
|
export declare function reusableTurn(path: string, baseUrl: string, apiKey: string, capabilityId: string, fingerprint: string, now?: number, onWarning?: CacheWarning): Promise<{
|
|
15
16
|
token: string;
|
|
16
17
|
quote_hash: string | null;
|
|
18
|
+
maximum_credits: number | null;
|
|
17
19
|
} | null>;
|
|
18
20
|
export declare function rememberTurnToken(path: string, baseUrl: string, apiKey: string, capabilityId: string, token: string, now?: number, onWarning?: CacheWarning, quote?: CachedQuote): Promise<void>;
|
|
19
21
|
export declare function forgetTurnToken(path: string, baseUrl: string, apiKey: string, capabilityId: string, onWarning?: CacheWarning): Promise<void>;
|
package/dist/turnCache.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"turnCache.d.ts","sourceRoot":"","sources":["../src/turnCache.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,aAAa,QAAa,CAAC;AAExC,
|
|
1
|
+
{"version":3,"file":"turnCache.d.ts","sourceRoot":"","sources":["../src/turnCache.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,aAAa,QAAa,CAAC;AAExC,2KAA2K;AAC3K,MAAM,MAAM,WAAW,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAGvG,KAAK,YAAY,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,cAAc,KAAK,IAAI,CAAC;AAE3D,wBAAgB,aAAa,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAE7D;AA2BD,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,SAAa,EAAE,SAAS,CAAC,EAAE,YAAY,GAC9G,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAGxB;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,SAAa,EAAE,SAAS,CAAC,EAAE,YAAY,GACnI,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAAG,IAAI,CAAC,CAW9F;AAED,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,SAAa,EAAE,SAAS,CAAC,EAAE,YAAY,EAC9H,KAAK,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,IAAI,CAAC,CAOf;AAED,wBAAsB,eAAe,CACnC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,YAAY,GAC5F,OAAO,CAAC,IAAI,CAAC,CAMf"}
|
package/dist/turnCache.js
CHANGED
|
@@ -62,9 +62,13 @@ async function reusableTurn(path, baseUrl, apiKey, capabilityId, fingerprint, no
|
|
|
62
62
|
if (!entry || typeof entry.token !== 'string' || now - entry.at >= exports.TURN_REUSE_MS)
|
|
63
63
|
return null;
|
|
64
64
|
const quote = entry.quote && entry.quote.fingerprint === fingerprint && typeof entry.quote.quote_hash === 'string'
|
|
65
|
-
? entry.quote
|
|
65
|
+
? entry.quote
|
|
66
66
|
: null;
|
|
67
|
-
return {
|
|
67
|
+
return {
|
|
68
|
+
token: entry.token,
|
|
69
|
+
quote_hash: quote ? quote.quote_hash : null,
|
|
70
|
+
maximum_credits: quote && typeof quote.maximum_credits === 'number' ? quote.maximum_credits : null,
|
|
71
|
+
};
|
|
68
72
|
}
|
|
69
73
|
async function rememberTurnToken(path, baseUrl, apiKey, capabilityId, token, now = Date.now(), onWarning, quote) {
|
|
70
74
|
const entries = await load(path, onWarning);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trydreamstate/cli",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.5",
|
|
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",
|
|
@@ -19,13 +19,15 @@
|
|
|
19
19
|
"README.md"
|
|
20
20
|
],
|
|
21
21
|
"scripts": {
|
|
22
|
-
"build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc && node scripts/build-agent-plugin.mjs",
|
|
22
|
+
"build": "node scripts/generate-pack-verbs.mjs --check && node scripts/generate-run-contract.mjs --check && node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc && node scripts/build-agent-plugin.mjs",
|
|
23
23
|
"test": "node scripts/build-agent-plugin.mjs --check && npm run build && jest --config jest.config.cjs --runInBand",
|
|
24
24
|
"type-check": "tsc --noEmit",
|
|
25
25
|
"pack:check": "npm pack --dry-run",
|
|
26
26
|
"pack:smoke": "npm run build && node scripts/pack-smoke.mjs",
|
|
27
27
|
"prepublishOnly": "npm run build && npm run type-check && npm test",
|
|
28
28
|
"verify:guidance": "node scripts/build-agent-plugin.mjs --check",
|
|
29
|
+
"verify:pack-verbs": "node scripts/generate-pack-verbs.mjs --check",
|
|
30
|
+
"verify:run-contract": "node scripts/generate-run-contract.mjs --check",
|
|
29
31
|
"verify:test-collection": "jest --config jest.config.cjs --runInBand --testNamePattern='^(?!)'",
|
|
30
32
|
"plugin:publish": "bash scripts/publish-plugin-repo.sh"
|
|
31
33
|
},
|