@trydreamstate/cli 1.3.7 → 1.3.11

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 (56) hide show
  1. package/agent-plugin/.claude-plugin/plugin.json +1 -1
  2. package/agent-plugin/.codex-plugin/plugin.json +1 -1
  3. package/agent-plugin/skills/crm/SKILL.md +2 -0
  4. package/agent-plugin/skills/diagnostics/SKILL.md +7 -1
  5. package/agent-plugin/skills/facebook-posts/SKILL.md +46 -0
  6. package/agent-plugin/skills/instagram-posts/SKILL.md +56 -0
  7. package/agent-plugin/skills/list-building/SKILL.md +3 -0
  8. package/agent-plugin/skills/list-building/column-authoring.md +6 -0
  9. package/agent-plugin/skills/list-building/incoming-people.md +32 -0
  10. package/agent-plugin/skills/list-building/sourcing.md +14 -0
  11. package/agent-plugin/skills/outreach/SKILL.md +8 -0
  12. package/agent-plugin/skills/outreach/enrollment.md +5 -1
  13. package/agent-plugin/skills/plays/SKILL.md +15 -0
  14. package/agent-plugin/skills/social/SKILL.md +4 -0
  15. package/agent-plugin/skills/tiktok-posts/SKILL.md +51 -0
  16. package/agent-plugin/skills/visibility/SKILL.md +4 -0
  17. package/agent-plugin/skills/workflows/SKILL.md +2 -0
  18. package/agent-plugin/skills/workflows/lifecycle-and-enrollment.md +2 -0
  19. package/agent-plugin/skills/youtube-posts/SKILL.md +49 -0
  20. package/dist/client.d.ts +6 -1
  21. package/dist/client.d.ts.map +1 -1
  22. package/dist/client.js +35 -11
  23. package/dist/commandTable.d.ts +2 -2
  24. package/dist/commandTable.d.ts.map +1 -1
  25. package/dist/commandTable.js +5 -2
  26. package/dist/commands/genericPack.d.ts +13 -0
  27. package/dist/commands/genericPack.d.ts.map +1 -0
  28. package/dist/commands/genericPack.js +31 -0
  29. package/dist/commands/knowledge.d.ts +2 -0
  30. package/dist/commands/knowledge.d.ts.map +1 -0
  31. package/dist/commands/knowledge.js +6 -0
  32. package/dist/commands/shared.d.ts +3 -1
  33. package/dist/commands/shared.d.ts.map +1 -1
  34. package/dist/commands/shared.js +14 -5
  35. package/dist/commands/tables.d.ts +2 -0
  36. package/dist/commands/tables.d.ts.map +1 -0
  37. package/dist/commands/tables.js +6 -0
  38. package/dist/commands/unibox.d.ts +2 -0
  39. package/dist/commands/unibox.d.ts.map +1 -0
  40. package/dist/commands/unibox.js +6 -0
  41. package/dist/gatedRun.d.ts.map +1 -1
  42. package/dist/gatedRun.js +105 -35
  43. package/dist/generated/packVerbs.generated.json +332 -4
  44. package/dist/index.d.ts +2 -1
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +47 -6
  47. package/dist/money.d.ts +2 -1
  48. package/dist/money.d.ts.map +1 -1
  49. package/dist/money.js +22 -5
  50. package/dist/runWait.d.ts +1 -1
  51. package/dist/runWait.d.ts.map +1 -1
  52. package/dist/runWait.js +37 -5
  53. package/dist/turnCache.d.ts +5 -1
  54. package/dist/turnCache.d.ts.map +1 -1
  55. package/dist/turnCache.js +5 -3
  56. package/package.json +1 -1
package/dist/runWait.js CHANGED
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RUN_WAIT_TIMEOUT_EXIT_CODE = void 0;
4
4
  exports.waitForRun = waitForRun;
5
+ const client_1 = require("./client");
5
6
  const errors_1 = require("./errors");
6
7
  const TERMINAL_STATUSES = new Set([
7
8
  'succeeded', 'completed', 'completed_with_errors', 'failed', 'cancelled', 'canceled', 'partially_completed',
@@ -42,6 +43,26 @@ function timedOutEnvelope(value, timeoutSeconds) {
42
43
  },
43
44
  };
44
45
  }
46
+ function pollingFailureWithReceipt(error, receipt) {
47
+ if (!(error instanceof client_1.CliError))
48
+ return error;
49
+ const existingDetails = error.details;
50
+ const details = existingDetails && typeof existingDetails === 'object' && !Array.isArray(existingDetails)
51
+ ? { ...existingDetails, admitted_receipt: receipt }
52
+ : {
53
+ ...(existingDetails === undefined ? {} : { polling_error_details: existingDetails }),
54
+ admitted_receipt: receipt,
55
+ };
56
+ return new client_1.CliError(error.message, error.code, error.status, {
57
+ details,
58
+ ...(error.retryAfter === undefined ? {} : { retryAfter: error.retryAfter }),
59
+ ...(error.traceId === undefined ? {} : { traceId: error.traceId }),
60
+ ...(error.idempotencyKey === undefined ? {} : { idempotencyKey: error.idempotencyKey }),
61
+ ...(error.retryable === undefined ? {} : { retryable: error.retryable }),
62
+ ...(error.repair === undefined ? {} : { repair: error.repair }),
63
+ ...(error.meta === undefined ? {} : { meta: error.meta }),
64
+ });
65
+ }
45
66
  async function waitForRun(client, initial, timeoutSeconds, sleep) {
46
67
  let value = initial;
47
68
  let run = runFromEnvelope(value);
@@ -50,13 +71,24 @@ async function waitForRun(client, initial, timeoutSeconds, sleep) {
50
71
  const deadline = Date.now() + timeoutSeconds * 1_000;
51
72
  let delay = 500;
52
73
  while (Date.now() < deadline) {
74
+ const remainingBeforeSleep = deadline - Date.now();
53
75
  try {
54
- await sleep(Math.min(delay, Math.max(0, deadline - Date.now())));
55
- value = await client.getRun(run.id);
76
+ await sleep(Math.min(delay, remainingBeforeSleep));
77
+ const remainingBeforeRead = deadline - Date.now();
78
+ // Sleeping may consume the whole budget. Do not start a read that the
79
+ // command has no time left to receive.
80
+ if (remainingBeforeRead <= 0)
81
+ break;
82
+ value = await client.getRun(run.id, remainingBeforeRead);
56
83
  }
57
- catch {
58
- // The admitted receipt is durable. Keep it printable when polling is interrupted.
59
- return { value: timedOutEnvelope(value, timeoutSeconds), timedOut: true };
84
+ catch (error) {
85
+ // The deliberately deadline-bounded read can be aborted at the deadline.
86
+ // That is the wait timing out, rather than a new transport failure.
87
+ if (error instanceof client_1.CliError && error.code === 'request_timeout' && Date.now() >= deadline)
88
+ break;
89
+ // A failed read does not mean the wait elapsed. Preserve the admitted
90
+ // receipt beside the original failure so callers can read it back.
91
+ throw pollingFailureWithReceipt(error, value);
60
92
  }
61
93
  run = runFromEnvelope(value);
62
94
  if (!run || TERMINAL_STATUSES.has(run.status))
@@ -1,9 +1,11 @@
1
1
  export declare const TURN_REUSE_MS: number;
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. */
2
+ /** The quote a supported rehearsal returned, and the exact input it priced. maximum_credits is absent on entries written before the field existed: treat that as unknown, not free. rows and credits are the printed price; absent means not stated. */
3
3
  export type CachedQuote = {
4
4
  quote_hash: string;
5
5
  fingerprint: string;
6
6
  maximum_credits?: number | null;
7
+ rows?: number | null;
8
+ credits?: string | null;
7
9
  };
8
10
  type CacheWarning = (error: NodeJS.ErrnoException) => void;
9
11
  export declare function turnCachePath(credentialsPath: string): string;
@@ -16,6 +18,8 @@ export declare function reusableTurn(path: string, baseUrl: string, apiKey: stri
16
18
  token: string;
17
19
  quote_hash: string | null;
18
20
  maximum_credits: number | null;
21
+ rows?: number | null;
22
+ credits?: string | null;
19
23
  } | null>;
20
24
  export declare function rememberTurnToken(path: string, baseUrl: string, apiKey: string, capabilityId: string, token: string, now?: number, onWarning?: CacheWarning, quote?: CachedQuote): Promise<void>;
21
25
  export declare function forgetTurnToken(path: string, baseUrl: string, apiKey: string, capabilityId: string, onWarning?: CacheWarning): Promise<void>;
@@ -1 +1 @@
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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AAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,YAAY,GAC5F,OAAO,CAAC,IAAI,CAAC,CAMf"}
package/dist/turnCache.js CHANGED
@@ -9,12 +9,12 @@ exports.forgetTurnToken = forgetTurnToken;
9
9
  const node_crypto_1 = require("node:crypto");
10
10
  const promises_1 = require("node:fs/promises");
11
11
  const node_path_1 = require("node:path");
12
- // A paid capability's live call needs the quote_hash of a dry_run of the same
13
- // input, and the quote is bound to the dry run's tool_turn_token: only a live
12
+ // A quote-bound capability's live call needs the quote_hash of a supported rehearsal of
13
+ // the same input, and the quote is bound to the rehearsal's tool_turn_token: only a live
14
14
  // call carrying the SAME token and that quote_hash can spend. Each CLI
15
15
  // invocation is a new process, so fetching a fresh token per run made every paid
16
16
  // capability unrunnable from the CLI (2026-09-23: tables.table_sources.run
17
- // refused four times in a row). The cache therefore keeps the dry run's turn
17
+ // refused four times in a row). The cache therefore keeps the rehearsal's turn
18
18
  // token together with its quote_hash and a fingerprint of the exact input that
19
19
  // was priced, so a later `--live` of the same input can echo it and a changed
20
20
  // input never inherits a price it was not shown.
@@ -68,6 +68,8 @@ async function reusableTurn(path, baseUrl, apiKey, capabilityId, fingerprint, no
68
68
  token: entry.token,
69
69
  quote_hash: quote ? quote.quote_hash : null,
70
70
  maximum_credits: quote && typeof quote.maximum_credits === 'number' ? quote.maximum_credits : null,
71
+ ...(quote && quote.rows !== undefined ? { rows: quote.rows } : {}),
72
+ ...(quote && quote.credits !== undefined ? { credits: quote.credits } : {}),
71
73
  };
72
74
  }
73
75
  async function rememberTurnToken(path, baseUrl, apiKey, capabilityId, token, now = Date.now(), onWarning, quote) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trydreamstate/cli",
3
- "version": "1.3.7",
3
+ "version": "1.3.11",
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",