@trydreamstate/cli 1.3.6 → 1.3.8

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 (76) hide show
  1. package/README.md +1 -1
  2. package/agent-plugin/.claude-plugin/plugin.json +1 -1
  3. package/agent-plugin/.codex-plugin/plugin.json +1 -1
  4. package/agent-plugin/skills/crm/SKILL.md +2 -2
  5. package/agent-plugin/skills/diagnostics/SKILL.md +1 -1
  6. package/agent-plugin/skills/dreamstate/SKILL.md +4 -4
  7. package/agent-plugin/skills/facebook-posts/SKILL.md +46 -0
  8. package/agent-plugin/skills/first-win/SKILL.md +6 -6
  9. package/agent-plugin/skills/inbox-replies/SKILL.md +1 -1
  10. package/agent-plugin/skills/instagram-posts/SKILL.md +56 -0
  11. package/agent-plugin/skills/knowledge/SKILL.md +1 -1
  12. package/agent-plugin/skills/linkedin-posts/SKILL.md +1 -1
  13. package/agent-plugin/skills/linkedin-warm-signals/SKILL.md +1 -1
  14. package/agent-plugin/skills/list-building/SKILL.md +5 -2
  15. package/agent-plugin/skills/list-building/column-authoring.md +4 -0
  16. package/agent-plugin/skills/list-building/incoming-people.md +32 -0
  17. package/agent-plugin/skills/list-building/sourcing.md +8 -1
  18. package/agent-plugin/skills/outreach/SKILL.md +2 -1
  19. package/agent-plugin/skills/outreach/channels.md +3 -1
  20. package/agent-plugin/skills/outreach/enrollment.md +2 -0
  21. package/agent-plugin/skills/outreach/replies.md +2 -0
  22. package/agent-plugin/skills/outreach/steps-and-timing.md +5 -1
  23. package/agent-plugin/skills/plays/SKILL.md +1 -1
  24. package/agent-plugin/skills/reddit-posts/SKILL.md +1 -1
  25. package/agent-plugin/skills/skill-authoring/SKILL.md +6 -6
  26. package/agent-plugin/skills/social/SKILL.md +5 -1
  27. package/agent-plugin/skills/tiktok-posts/SKILL.md +51 -0
  28. package/agent-plugin/skills/visibility/SKILL.md +5 -1
  29. package/agent-plugin/skills/workflows/SKILL.md +3 -1
  30. package/agent-plugin/skills/workflows/lifecycle-and-enrollment.md +2 -0
  31. package/agent-plugin/skills/worksheet-tidy/SKILL.md +2 -2
  32. package/agent-plugin/skills/writing/SKILL.md +1 -1
  33. package/agent-plugin/skills/writing/publishing.md +1 -1
  34. package/agent-plugin/skills/writing/revision-and-voice.md +1 -1
  35. package/agent-plugin/skills/x-posts/SKILL.md +1 -1
  36. package/agent-plugin/skills/youtube-posts/SKILL.md +49 -0
  37. package/dist/agentGuidance.generated.json +4 -4
  38. package/dist/client.d.ts +6 -1
  39. package/dist/client.d.ts.map +1 -1
  40. package/dist/client.js +35 -11
  41. package/dist/commandTable.d.ts +2 -2
  42. package/dist/commandTable.d.ts.map +1 -1
  43. package/dist/commandTable.js +5 -2
  44. package/dist/commands/genericPack.d.ts +13 -0
  45. package/dist/commands/genericPack.d.ts.map +1 -0
  46. package/dist/commands/genericPack.js +31 -0
  47. package/dist/commands/knowledge.d.ts +2 -0
  48. package/dist/commands/knowledge.d.ts.map +1 -0
  49. package/dist/commands/knowledge.js +6 -0
  50. package/dist/commands/shared.d.ts +3 -1
  51. package/dist/commands/shared.d.ts.map +1 -1
  52. package/dist/commands/shared.js +14 -5
  53. package/dist/commands/tables.d.ts +2 -0
  54. package/dist/commands/tables.d.ts.map +1 -0
  55. package/dist/commands/tables.js +6 -0
  56. package/dist/commands/unibox.d.ts +2 -0
  57. package/dist/commands/unibox.d.ts.map +1 -0
  58. package/dist/commands/unibox.js +6 -0
  59. package/dist/gatedRun.d.ts.map +1 -1
  60. package/dist/gatedRun.js +145 -54
  61. package/dist/generated/packVerbs.generated.json +332 -4
  62. package/dist/index.d.ts +2 -1
  63. package/dist/index.d.ts.map +1 -1
  64. package/dist/index.js +31 -3
  65. package/dist/money.d.ts +2 -1
  66. package/dist/money.d.ts.map +1 -1
  67. package/dist/money.js +22 -5
  68. package/dist/runWait.d.ts +1 -1
  69. package/dist/runWait.d.ts.map +1 -1
  70. package/dist/runWait.js +37 -5
  71. package/dist/tablesImport.d.ts.map +1 -1
  72. package/dist/tablesImport.js +15 -1
  73. package/dist/turnCache.d.ts +5 -1
  74. package/dist/turnCache.d.ts.map +1 -1
  75. package/dist/turnCache.js +5 -3
  76. package/package.json +3 -2
@@ -3,7 +3,7 @@ name: skill-authoring
3
3
  description: "Read, edit and create this workspace's skills, the editable Markdown playbooks agents and people follow, keeping each one short, revision safe and in the workspace's own words. Use it when the user wants to change how a skill works, capture a repeatable practice as a new skill, or fix a skill that reports issues. It does not change what an agent is allowed to do (a skill grants nothing) and does not edit Company Context pages (knowledge does)."
4
4
  ---
5
5
 
6
- Run this through the Dreamstate MCP tools: `packs_get` for the pack's capabilities, `tools_get` for the exact input schema, then `tools_run`. Anything that writes, spends credits or reaches a person: dry_run first, then live with the quote_hash the dry_run returned, a max_credits ceiling and an idempotency_key. max_credits 0 is valid only when that quote is 0. A larger paid run, or a live external send above the server's recipient threshold, also needs the user's yes before you send approved: true; never send it on your own. `max_rows` is a param of `tables.columns.run` and `tables.table_sources.run`, not of `tools_run`. `max_live_sends` is a param of the external-send sequence capabilities (`sequence.sequences.activate_audience`, `sequence.sequences.resume`, and the rest of that family), sent inside `params`, not a gating input of `tools_run`. The paid-run consent rule is one sentence in the MCP server instructions, rendered from consentRule.json and PAID_RUN_APPROVAL_THRESHOLDS: rows and credits, with no provider prices. If the server asks you to sign in, approve it in the browser.
6
+ Run this through the Dreamstate MCP tools: `packs_get` for the pack's capabilities, `tools_get` for the exact input schema, then `tools_run`. Anything that writes, spends credits or reaches a person: dry_run first, then live with the quote_hash the dry_run returned, a max_credits ceiling and an idempotency_key. max_credits 0 is valid only when that quote is 0. A larger paid run, a live external send above the server's recipient threshold, or a run that turns on a recurring trigger, also needs approved: true with the same quote_hash, after reviewing the preview. Free formulas need no paid-run approval; row execution caps still apply. `max_rows` is a param of `tables.columns.run` and `tables.table_sources.run`, not of `tools_run`. `max_live_sends` goes inside `params` only when the fetched capability schema declares it (for example, a one-contact workflow run). Sequence start, resume, launch and enrollment do not accept it; they have no lifetime send ceiling. The paid-run consent rule is one sentence in the MCP server instructions, rendered from consentRule.json and PAID_RUN_APPROVAL_THRESHOLDS: rows and credits, with no provider prices. If the server asks you to sign in, approve it in the browser.
7
7
 
8
8
  # Skill Authoring
9
9
 
@@ -28,17 +28,17 @@ Every change lands on the current revision and is reported back. Never overwrite
28
28
  ## Edit
29
29
 
30
30
  1. Read the skill with skills_get immediately before writing.
31
- 2. Follow its `edit` descriptor: read the named tool's schema with tools_get, then run it with tools_run, passing the document, the revision from that read and the complete new Markdown in the named content field. The save replaces the whole page, so send the full text, frontmatter included.
31
+ 2. Search the document write capability with tools_search, read its exact schema with tools_get, then run it with tools_run. Supply the document identity, current revision and complete new Markdown in the fields that schema declares. A whole-page save includes frontmatter and unchanged sections.
32
32
  3. Change only what the user asked for. Keep the frontmatter name equal to the folder name.
33
33
  4. On a revision conflict, someone else saved first. Re-read, merge your change into their text and save again on the new revision. Never resend the old text over theirs.
34
- 5. When `edit` is null an existing starter skill is still a repo default for this workspace. Read skills_list again shortly; the workspace copy appears once seeding finishes. This applies only to starter skills, never to a skill you just created.
34
+ 5. If the skill has no writable workspace document yet, read skills_list again after starter seeding finishes. Never invent a document identity or overwrite a different skill.
35
35
 
36
36
  ## Create
37
37
 
38
38
  1. Check skills_list query first; if a skill already covers the need, add a section to it instead.
39
- 2. Follow the `create` descriptor from skills_list, step by step, with tools_get then tools_run for each step. Send every param the descriptor fills in exactly as given. The first step names `parent_folder_id` explicitly and returns the new folder id that the second step needs.
39
+ 2. Search folder and document creation capabilities with tools_search. Read each schema with tools_get before using tools_run. Resolve the workspace skills root from skills_list, create the skill folder there, then use its returned identity to create SKILL.md.
40
40
  3. Use a kebab-case id such as `pricing-objections` for the folder, and write SKILL.md with frontmatter `name` (the same id) and `description` (one sentence: what it does, when to use it, what it does not cover). A skill is plain Markdown and grants no tools, so it needs no tool list.
41
- 4. Run the descriptor's `verify` read: skills_get with the new id. The skill is created only when that read returns it. Fix every issue it reports.
41
+ 4. Read skills_get with the new id. The skill is created only when that read returns it. Fix every issue it reports.
42
42
  5. Skills are read live, so there is no indexing delay. If skills_get says not found, the skill does not exist yet: never report it created or verified.
43
43
 
44
44
  ## Shape of a good skill
@@ -50,7 +50,7 @@ Every change lands on the current revision and is reported back. Never overwrite
50
50
  ## Guardrails
51
51
 
52
52
  - Never delete or rewrite a starter skill unless the user asked for that. Prefer adding a new skill or a new section.
53
- - Remove a skill only on an explicit request, following its `remove` descriptor; say that it can be restored from trash.
53
+ - Remove a skill only on an explicit request. Search the document trash capability, read its schema and use the document identity from a fresh read; say that it can be restored from trash.
54
54
  - A skill cannot widen what an agent may do. Do not write one that claims to approve spend, sends or permissions.
55
55
  - Do not copy secrets, credentials or customer personal data into a skill.
56
56
 
@@ -3,7 +3,7 @@ name: social
3
3
  description: "Own a short-form social post for its whole life across connected channels. Read the channel registry and learned brand voice, draft and revise, submit for review, approve, schedule or reschedule, publish now, unschedule, and archive."
4
4
  ---
5
5
 
6
- Run this through the Dreamstate MCP tools: `packs_get` for the pack's capabilities, `tools_get` for the exact input schema, then `tools_run`. Anything that writes, spends credits or reaches a person: dry_run first, then live with the quote_hash the dry_run returned, a max_credits ceiling and an idempotency_key. max_credits 0 is valid only when that quote is 0. A larger paid run, or a live external send above the server's recipient threshold, also needs the user's yes before you send approved: true; never send it on your own. `max_rows` is a param of `tables.columns.run` and `tables.table_sources.run`, not of `tools_run`. `max_live_sends` is a param of the external-send sequence capabilities (`sequence.sequences.activate_audience`, `sequence.sequences.resume`, and the rest of that family), sent inside `params`, not a gating input of `tools_run`. The paid-run consent rule is one sentence in the MCP server instructions, rendered from consentRule.json and PAID_RUN_APPROVAL_THRESHOLDS: rows and credits, with no provider prices. If the server asks you to sign in, approve it in the browser.
6
+ Run this through the Dreamstate MCP tools: `packs_get` for the pack's capabilities, `tools_get` for the exact input schema, then `tools_run`. Anything that writes, spends credits or reaches a person: dry_run first, then live with the quote_hash the dry_run returned, a max_credits ceiling and an idempotency_key. max_credits 0 is valid only when that quote is 0. A larger paid run, a live external send above the server's recipient threshold, or a run that turns on a recurring trigger, also needs approved: true with the same quote_hash, after reviewing the preview. Free formulas need no paid-run approval; row execution caps still apply. `max_rows` is a param of `tables.columns.run` and `tables.table_sources.run`, not of `tools_run`. `max_live_sends` goes inside `params` only when the fetched capability schema declares it (for example, a one-contact workflow run). Sequence start, resume, launch and enrollment do not accept it; they have no lifetime send ceiling. The paid-run consent rule is one sentence in the MCP server instructions, rendered from consentRule.json and PAID_RUN_APPROVAL_THRESHOLDS: rows and credits, with no provider prices. If the server asks you to sign in, approve it in the browser.
7
7
 
8
8
  # Social
9
9
 
@@ -16,6 +16,10 @@ Run this through the Dreamstate MCP tools: `packs_get` for the pack's capabiliti
16
16
  - Articles and landing copy: [`writing`].
17
17
  The `social` pack lists the tools and their exact inputs.
18
18
 
19
+ ## Published-post scoring
20
+
21
+ For published-post review, read `visibility.analytics.post_score_get` for one post or `visibility.analytics.post_scores_list` for a date range. Scores compare each author account with its own same-platform recent baseline at 24h and 7d. A `not_enough_history` label means fewer than three prior posts, not poor performance. These reads use stored snapshots and never refresh a provider.
22
+
19
23
  ## Delete and archive
20
24
 
21
25
  When user says delete a social post or draft, delete it permanently from Dreamstate. Show deletion impact first unless user already explicitly asked to delete. Delete removes local drafts, scheduled deliveries, and published-post records. Scheduled posts are unscheduled first. It never deletes provider posts from LinkedIn or X. When user says archive, archive only. Never say deletion is unavailable.
@@ -0,0 +1,51 @@
1
+ ---
2
+ name: tiktok-posts
3
+ description: "Write and revise TikTok video scripts and captions: the first two seconds, on-screen text, a caption up to 2,200 characters, and 3 to 5 hashtags. Use it for the copy of any post going to TikTok. It does not cover scheduling, publishing or automations (social does)."
4
+ ---
5
+
6
+ Run this through the Dreamstate MCP tools: `packs_get` for the pack's capabilities, `tools_get` for the exact input schema, then `tools_run`. Anything that writes, spends credits or reaches a person: dry_run first, then live with the quote_hash the dry_run returned, a max_credits ceiling and an idempotency_key. max_credits 0 is valid only when that quote is 0. A larger paid run, a live external send above the server's recipient threshold, or a run that turns on a recurring trigger, also needs approved: true with the same quote_hash, after reviewing the preview. Free formulas need no paid-run approval; row execution caps still apply. `max_rows` is a param of `tables.columns.run` and `tables.table_sources.run`, not of `tools_run`. `max_live_sends` goes inside `params` only when the fetched capability schema declares it (for example, a one-contact workflow run). Sequence start, resume, launch and enrollment do not accept it; they have no lifetime send ceiling. The paid-run consent rule is one sentence in the MCP server instructions, rendered from consentRule.json and PAID_RUN_APPROVAL_THRESHOLDS: rows and credits, with no provider prices. If the server asks you to sign in, approve it in the browser.
7
+
8
+ # TikTok posts
9
+
10
+ ## Boundary
11
+
12
+ - Owns: TikTok video script and caption copy.
13
+ - The `social` pack lists the tools and their exact inputs.
14
+
15
+ Post lifecycle, review, and publishing stay with the social skill. Voice comes from the account's past posts and the workspace brand voice.
16
+
17
+ ## Before scheduling
18
+
19
+ Confirm all of these. If one is missing, say so and do not schedule.
20
+
21
+ - The TikTok account is connected.
22
+ - Video media is present. A script with no video is not ready.
23
+ - A privacy option is chosen: who can view the video. The stored field is privacy_level, nested under tiktok specifics. Do not leave it blank, and do not guess a value the account did not offer.
24
+ - The caption is at or under 2,200 characters and the hashtags are in range.
25
+
26
+ ## The first 2 seconds
27
+
28
+ Open on the point. The first words and the first on-screen line are the same idea. No "hey guys", no logo sting, no context before the claim.
29
+
30
+ ## Script
31
+
32
+ - Hook, then the beats, then one close.
33
+ - On-screen text is a short line, not a paragraph.
34
+ - One idea. If the script needs a second idea, it is a second video.
35
+
36
+ ## Caption
37
+
38
+ - Hard limit: 2,200 characters.
39
+ - 3 to 5 relevant hashtags at the end. Do not pad. If fewer than 3 are honest, use only those.
40
+ - The caption adds a reason to watch or to reply. It does not paste the script.
41
+ - No em dashes, en dashes, or double hyphens.
42
+
43
+ ## Editing
44
+
45
+ Change only what was asked. A new hook does not license a new caption or a new privacy choice.
46
+
47
+ ## Check it works
48
+
49
+ Read the saved draft back. Confirm the account, the video, the privacy option, the caption limit, the hashtag count, and that nothing contains an em dash.
50
+
51
+ Paid and outward runs follow the paid-run consent rule.
@@ -3,7 +3,7 @@ name: visibility
3
3
  description: "Get found by search engines and answer engines. Pick the query set, gather crawl, index, mention and citation evidence, fix pages, then measure the change."
4
4
  ---
5
5
 
6
- Run this through the Dreamstate MCP tools: `packs_get` for the pack's capabilities, `tools_get` for the exact input schema, then `tools_run`. Anything that writes, spends credits or reaches a person: dry_run first, then live with the quote_hash the dry_run returned, a max_credits ceiling and an idempotency_key. max_credits 0 is valid only when that quote is 0. A larger paid run, or a live external send above the server's recipient threshold, also needs the user's yes before you send approved: true; never send it on your own. `max_rows` is a param of `tables.columns.run` and `tables.table_sources.run`, not of `tools_run`. `max_live_sends` is a param of the external-send sequence capabilities (`sequence.sequences.activate_audience`, `sequence.sequences.resume`, and the rest of that family), sent inside `params`, not a gating input of `tools_run`. The paid-run consent rule is one sentence in the MCP server instructions, rendered from consentRule.json and PAID_RUN_APPROVAL_THRESHOLDS: rows and credits, with no provider prices. If the server asks you to sign in, approve it in the browser.
6
+ Run this through the Dreamstate MCP tools: `packs_get` for the pack's capabilities, `tools_get` for the exact input schema, then `tools_run`. Anything that writes, spends credits or reaches a person: dry_run first, then live with the quote_hash the dry_run returned, a max_credits ceiling and an idempotency_key. max_credits 0 is valid only when that quote is 0. A larger paid run, a live external send above the server's recipient threshold, or a run that turns on a recurring trigger, also needs approved: true with the same quote_hash, after reviewing the preview. Free formulas need no paid-run approval; row execution caps still apply. `max_rows` is a param of `tables.columns.run` and `tables.table_sources.run`, not of `tools_run`. `max_live_sends` goes inside `params` only when the fetched capability schema declares it (for example, a one-contact workflow run). Sequence start, resume, launch and enrollment do not accept it; they have no lifetime send ceiling. The paid-run consent rule is one sentence in the MCP server instructions, rendered from consentRule.json and PAID_RUN_APPROVAL_THRESHOLDS: rows and credits, with no provider prices. If the server asks you to sign in, approve it in the browser.
7
7
 
8
8
  # Visibility
9
9
 
@@ -47,6 +47,10 @@ Prompt visibility is citations or qualifying mentions divided by completed runs
47
47
 
48
48
  The tracked query set is a revisioned instrument: changing a prompt's wording breaks the comparison, so change it deliberately and disclose the break.
49
49
 
50
+ ## GEO answer worksheet
51
+
52
+ Use `source.geo_ai_answers` for a `content` worksheet when prompts need direct ChatGPT and Google AI Overview evidence. Bind prompts, brand details and competitors. It creates one row per prompt, engine and day. Rerunning same day is free, so read existing rows before starting another run.
53
+
50
54
  ## Handoff to writing
51
55
 
52
56
  A brief names the target query and intent, the evidence window and property, current and previous performance, the destination page or a new page, observed competing results, the conversion goal, internal links, and evidence gaps. When an existing page owns the intent, request a revision instead of a duplicate.
@@ -3,7 +3,7 @@ name: workflows
3
3
  description: "Best practices for building and running automations that are not outreach sequences: frame the job, smallest graph, validate after every change, runtime inputs, safe recovery of failed runs."
4
4
  ---
5
5
 
6
- Run this through the Dreamstate MCP tools: `packs_get` for the pack's capabilities, `tools_get` for the exact input schema, then `tools_run`. Anything that writes, spends credits or reaches a person: dry_run first, then live with the quote_hash the dry_run returned, a max_credits ceiling and an idempotency_key. max_credits 0 is valid only when that quote is 0. A larger paid run, or a live external send above the server's recipient threshold, also needs the user's yes before you send approved: true; never send it on your own. `max_rows` is a param of `tables.columns.run` and `tables.table_sources.run`, not of `tools_run`. `max_live_sends` is a param of the external-send sequence capabilities (`sequence.sequences.activate_audience`, `sequence.sequences.resume`, and the rest of that family), sent inside `params`, not a gating input of `tools_run`. The paid-run consent rule is one sentence in the MCP server instructions, rendered from consentRule.json and PAID_RUN_APPROVAL_THRESHOLDS: rows and credits, with no provider prices. If the server asks you to sign in, approve it in the browser.
6
+ Run this through the Dreamstate MCP tools: `packs_get` for the pack's capabilities, `tools_get` for the exact input schema, then `tools_run`. Anything that writes, spends credits or reaches a person: dry_run first, then live with the quote_hash the dry_run returned, a max_credits ceiling and an idempotency_key. max_credits 0 is valid only when that quote is 0. A larger paid run, a live external send above the server's recipient threshold, or a run that turns on a recurring trigger, also needs approved: true with the same quote_hash, after reviewing the preview. Free formulas need no paid-run approval; row execution caps still apply. `max_rows` is a param of `tables.columns.run` and `tables.table_sources.run`, not of `tools_run`. `max_live_sends` goes inside `params` only when the fetched capability schema declares it (for example, a one-contact workflow run). Sequence start, resume, launch and enrollment do not accept it; they have no lifetime send ceiling. The paid-run consent rule is one sentence in the MCP server instructions, rendered from consentRule.json and PAID_RUN_APPROVAL_THRESHOLDS: rows and credits, with no provider prices. If the server asks you to sign in, approve it in the browser.
7
7
 
8
8
  # Workflows
9
9
 
@@ -20,6 +20,8 @@ Best practices for building and running automations. The workflow pack lists the
20
20
 
21
21
  1. Build new unless asked. A new request gets a new automation built from scratch. When the user names an existing one to change, resolve that name among existing automations by listing workflows and sequences with that name as the search text, then change the match. A named thing that is not a workflow or sequence may be a task, a record or a worksheet; check those only after automations come back empty. A step inside a workflow, such as a task step, is edited in that workflow's graph, not in the task list.
22
22
  1a. "Enroll these in a workflow" is never a missing input. Use a workflow whose table trigger is the worksheet the user is looking at, or one they named; otherwise build a new draft for that worksheet (worksheet rows trigger plus fitting steps, a follow-up task per person by default), validate, and enroll. Never ask which workflow. Filters on any worksheet column narrow who enrolls; with no filter every row enrolls. When the user said who should enroll, filter on the columns that hold it and report how many enrolled and how many were held back.
23
+
24
+ Social account post and AI answer worksheets hold content rows, never an audience or subject. To reach authors, send unique author URLs to a people worksheet first.
23
25
  2. Frame the job before building: what triggers it, who or what it acts on, what it changes, what it costs, when it stops and how often it runs.
24
26
  2a. Use a blueprint when one does exactly what you need; otherwise build your own. Workflow blueprints already cover common jobs: CRM syncs, list and do-not-contact syncs, routers, digests and signal monitors. List blueprints of the workflow kind, read what the closest one creates and what it still needs, install it, then adapt it to this request. Installing never needs answers or connections; the result names what is still to pick, so say that. Build from scratch only when no blueprint fits, and say which one came closest.
25
27
  3. Ask one clarifying question only when a required input is missing. Otherwise build with sensible defaults and say what you assumed.
@@ -9,3 +9,5 @@ Enrollment, activation and delivery are different events. Read the result after
9
9
  Preview first. Activation stores `params.max_credits` on `workflow.workflows.activate`: read exact `required_caps.max_credits` from preview, then resend that value unchanged. This persisted per-delivery ceiling is a declared domain input, not run `max_credits`; put run gating fields at door. Live enrollment takes no send cap: every eligible selected row is enrolled. Never guess it or ask user to approve it.
10
10
 
11
11
  An active worksheet trigger snapshots its saved view on periodic ticks and idempotently enrolls rows that arrive later; draft, paused, and inactive workflows never refill.
12
+
13
+ "Enroll in a workflow" means the worksheet the user is looking at, or just built, and it is not a question to send back. Reuse a workflow only when its table trigger is that worksheet or the user named it. Otherwise compose a new draft for this audience: a worksheet rows trigger on that worksheet plus steps that fit what the list was built for (a follow-up task per person is a safe default), validate, then enroll the worksheet into it. Never enroll into another worksheet's workflow, and never stop to ask which workflow when none was named.
@@ -3,7 +3,7 @@ name: worksheet-tidy
3
3
  description: "Review a workbook worksheet's structure and values, including duplicate or overlapping columns, column order, types and formatting, columns to hide, criteria and run conditions that never vary, and suspicious values, then apply reversible fixes. Use it when a worksheet has grown messy, before sharing it, or before enrolling it into a sequence. It does not merge CRM records across the workspace, rebuild the list's source (list-building does) or explain failed runs (diagnostics does)."
4
4
  ---
5
5
 
6
- Run this through the Dreamstate MCP tools: `packs_get` for the pack's capabilities, `tools_get` for the exact input schema, then `tools_run`. Anything that writes, spends credits or reaches a person: dry_run first, then live with the quote_hash the dry_run returned, a max_credits ceiling and an idempotency_key. max_credits 0 is valid only when that quote is 0. A larger paid run, or a live external send above the server's recipient threshold, also needs the user's yes before you send approved: true; never send it on your own. `max_rows` is a param of `tables.columns.run` and `tables.table_sources.run`, not of `tools_run`. `max_live_sends` is a param of the external-send sequence capabilities (`sequence.sequences.activate_audience`, `sequence.sequences.resume`, and the rest of that family), sent inside `params`, not a gating input of `tools_run`. The paid-run consent rule is one sentence in the MCP server instructions, rendered from consentRule.json and PAID_RUN_APPROVAL_THRESHOLDS: rows and credits, with no provider prices. If the server asks you to sign in, approve it in the browser.
6
+ Run this through the Dreamstate MCP tools: `packs_get` for the pack's capabilities, `tools_get` for the exact input schema, then `tools_run`. Anything that writes, spends credits or reaches a person: dry_run first, then live with the quote_hash the dry_run returned, a max_credits ceiling and an idempotency_key. max_credits 0 is valid only when that quote is 0. A larger paid run, a live external send above the server's recipient threshold, or a run that turns on a recurring trigger, also needs approved: true with the same quote_hash, after reviewing the preview. Free formulas need no paid-run approval; row execution caps still apply. `max_rows` is a param of `tables.columns.run` and `tables.table_sources.run`, not of `tools_run`. `max_live_sends` goes inside `params` only when the fetched capability schema declares it (for example, a one-contact workflow run). Sequence start, resume, launch and enrollment do not accept it; they have no lifetime send ceiling. The paid-run consent rule is one sentence in the MCP server instructions, rendered from consentRule.json and PAID_RUN_APPROVAL_THRESHOLDS: rows and credits, with no provider prices. If the server asks you to sign in, approve it in the browser.
7
7
 
8
8
  # Worksheet Tidy
9
9
 
@@ -12,7 +12,7 @@ Run this through the Dreamstate MCP tools: `packs_get` for the pack's capabiliti
12
12
  - Owns: reversible worksheet structure and value fixes.
13
13
  - Sources, columns, criteria, and building lists: [`list-building`].
14
14
  - Explaining failed runs and spend: [`diagnostics`].
15
- - The `tables` pack lists the tools and their exact inputs. When user says delete, permanently delete named workbook, worksheet, view, row, or column after showing removal impact and receiving explicit approval. When user says archive, archive only. Never say permanent deletion is unavailable.
15
+ - The `tables` pack lists the tools and their exact inputs. When user says delete, permanently delete named workbook, worksheet, view, row, or column after reviewing removal impact and setting the commit field. When user says archive, archive only. Never say permanent deletion is unavailable.
16
16
 
17
17
  A tidy worksheet reads left to right like the reasoning behind the list: who the row is, what proves they fit, how well they fit, and how to reach them. Tidying makes that visible without destroying evidence.
18
18
 
@@ -3,7 +3,7 @@ name: writing
3
3
  description: "Draft, revise and publish articles and landing copy grounded in workspace context and a target query."
4
4
  ---
5
5
 
6
- Run this through the Dreamstate MCP tools: `packs_get` for the pack's capabilities, `tools_get` for the exact input schema, then `tools_run`. Anything that writes, spends credits or reaches a person: dry_run first, then live with the quote_hash the dry_run returned, a max_credits ceiling and an idempotency_key. max_credits 0 is valid only when that quote is 0. A larger paid run, or a live external send above the server's recipient threshold, also needs the user's yes before you send approved: true; never send it on your own. `max_rows` is a param of `tables.columns.run` and `tables.table_sources.run`, not of `tools_run`. `max_live_sends` is a param of the external-send sequence capabilities (`sequence.sequences.activate_audience`, `sequence.sequences.resume`, and the rest of that family), sent inside `params`, not a gating input of `tools_run`. The paid-run consent rule is one sentence in the MCP server instructions, rendered from consentRule.json and PAID_RUN_APPROVAL_THRESHOLDS: rows and credits, with no provider prices. If the server asks you to sign in, approve it in the browser.
6
+ Run this through the Dreamstate MCP tools: `packs_get` for the pack's capabilities, `tools_get` for the exact input schema, then `tools_run`. Anything that writes, spends credits or reaches a person: dry_run first, then live with the quote_hash the dry_run returned, a max_credits ceiling and an idempotency_key. max_credits 0 is valid only when that quote is 0. A larger paid run, a live external send above the server's recipient threshold, or a run that turns on a recurring trigger, also needs approved: true with the same quote_hash, after reviewing the preview. Free formulas need no paid-run approval; row execution caps still apply. `max_rows` is a param of `tables.columns.run` and `tables.table_sources.run`, not of `tools_run`. `max_live_sends` goes inside `params` only when the fetched capability schema declares it (for example, a one-contact workflow run). Sequence start, resume, launch and enrollment do not accept it; they have no lifetime send ceiling. The paid-run consent rule is one sentence in the MCP server instructions, rendered from consentRule.json and PAID_RUN_APPROVAL_THRESHOLDS: rows and credits, with no provider prices. If the server asks you to sign in, approve it in the browser.
7
7
 
8
8
  # Writing
9
9
 
@@ -12,7 +12,7 @@ Article creation, article updates, and native-article deliveries accept linkedin
12
12
 
13
13
  ## The state machine
14
14
 
15
- 1. Search the article surface for the operation that creates an article with its initial schedule. It creates the article, linked artifact, first version, and delivery scaffolding in one transaction. There is no separate bare-draft article creation path.
15
+ 1. Search the article surface for the operation that creates an article with its initial schedule. It creates the article, linked artifact, first version, and delivery scaffolding in one transaction. When the user only wants an empty draft to fill in later, search for the operation that creates an empty article draft instead; it schedules nothing.
16
16
  2. A scheduled drafting job may create or revise reviewable drafts, but it never delivers content. For outward delivery, show the exact final revision and destination, then act when the user asked or confirms.
17
17
  3. Revise through the article update operation using the current expected revision from an exact article read. On revision conflict, re-read and deliberately reapply. An in-flight delivery or slug collision is a state conflict to inspect, not a reason for blind retry. Treat prior review records as historical after any edit.
18
18
  4. Editorial submission moves the linked artifact into review. It does not schedule or deliver.
@@ -24,7 +24,7 @@ Before writing a first sentence, read 3-5 recently published pieces by searching
24
24
 
25
25
  ## Saved library outputs
26
26
 
27
- A saved output is a reusable library copy of generated post text, not a live calendar artifact and not a published post. Create, revise, list, and archive it through its own dedicated capabilities, discovered at runtime; archiving marks it inactive rather than hard-deleting it. Revising it can touch any of its editable fields on an active row, but it never schedules, publishes, enrolls, or sends anything. After updating, the library row is the source of truth; do not call a scheduling or publish capability just to "save" a library edit.
27
+ A saved output is a reusable library copy of generated post text, not a live calendar artifact and not a published post. Create, revise, list, and delete it through its own dedicated capabilities, discovered at runtime. Deleting removes the library copy for good and nothing restores it, so confirm with the user before deleting one they did not ask to remove. Revising it can touch any of its editable fields on an active row, but it never schedules, publishes, enrolls, or sends anything. After updating, the library row is the source of truth; do not call a scheduling or publish capability just to "save" a library edit.
28
28
 
29
29
  ## Landing copy specifics
30
30
 
@@ -3,7 +3,7 @@ name: x-posts
3
3
  description: "Write and revise X posts and threads: the first line, single post versus thread, weighted length and Premium limits, thread structure, post types, replies and links, and phrases to avoid. Use it for the copy of any post going to X. It does not cover scheduling, publishing or automations (social does)."
4
4
  ---
5
5
 
6
- Run this through the Dreamstate MCP tools: `packs_get` for the pack's capabilities, `tools_get` for the exact input schema, then `tools_run`. Anything that writes, spends credits or reaches a person: dry_run first, then live with the quote_hash the dry_run returned, a max_credits ceiling and an idempotency_key. max_credits 0 is valid only when that quote is 0. A larger paid run, or a live external send above the server's recipient threshold, also needs the user's yes before you send approved: true; never send it on your own. `max_rows` is a param of `tables.columns.run` and `tables.table_sources.run`, not of `tools_run`. `max_live_sends` is a param of the external-send sequence capabilities (`sequence.sequences.activate_audience`, `sequence.sequences.resume`, and the rest of that family), sent inside `params`, not a gating input of `tools_run`. The paid-run consent rule is one sentence in the MCP server instructions, rendered from consentRule.json and PAID_RUN_APPROVAL_THRESHOLDS: rows and credits, with no provider prices. If the server asks you to sign in, approve it in the browser.
6
+ Run this through the Dreamstate MCP tools: `packs_get` for the pack's capabilities, `tools_get` for the exact input schema, then `tools_run`. Anything that writes, spends credits or reaches a person: dry_run first, then live with the quote_hash the dry_run returned, a max_credits ceiling and an idempotency_key. max_credits 0 is valid only when that quote is 0. A larger paid run, a live external send above the server's recipient threshold, or a run that turns on a recurring trigger, also needs approved: true with the same quote_hash, after reviewing the preview. Free formulas need no paid-run approval; row execution caps still apply. `max_rows` is a param of `tables.columns.run` and `tables.table_sources.run`, not of `tools_run`. `max_live_sends` goes inside `params` only when the fetched capability schema declares it (for example, a one-contact workflow run). Sequence start, resume, launch and enrollment do not accept it; they have no lifetime send ceiling. The paid-run consent rule is one sentence in the MCP server instructions, rendered from consentRule.json and PAID_RUN_APPROVAL_THRESHOLDS: rows and credits, with no provider prices. If the server asks you to sign in, approve it in the browser.
7
7
 
8
8
  # X posts
9
9
 
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: youtube-posts
3
+ description: "Write and revise YouTube titles, descriptions, and tags: a title of at most 100 characters, a description with chapters, and a tag list. Use it for the copy of any video going to YouTube. It does not cover scheduling, publishing or automations (social does)."
4
+ ---
5
+
6
+ Run this through the Dreamstate MCP tools: `packs_get` for the pack's capabilities, `tools_get` for the exact input schema, then `tools_run`. Anything that writes, spends credits or reaches a person: dry_run first, then live with the quote_hash the dry_run returned, a max_credits ceiling and an idempotency_key. max_credits 0 is valid only when that quote is 0. A larger paid run, a live external send above the server's recipient threshold, or a run that turns on a recurring trigger, also needs approved: true with the same quote_hash, after reviewing the preview. Free formulas need no paid-run approval; row execution caps still apply. `max_rows` is a param of `tables.columns.run` and `tables.table_sources.run`, not of `tools_run`. `max_live_sends` goes inside `params` only when the fetched capability schema declares it (for example, a one-contact workflow run). Sequence start, resume, launch and enrollment do not accept it; they have no lifetime send ceiling. The paid-run consent rule is one sentence in the MCP server instructions, rendered from consentRule.json and PAID_RUN_APPROVAL_THRESHOLDS: rows and credits, with no provider prices. If the server asks you to sign in, approve it in the browser.
7
+
8
+ # YouTube posts
9
+
10
+ ## Boundary
11
+
12
+ - Owns: YouTube title, description, chapters, and tags.
13
+ - The `social` pack lists the tools and their exact inputs.
14
+
15
+ Post lifecycle, review, and publishing stay with the social skill. Voice comes from the channel's past videos and the workspace brand voice.
16
+
17
+ ## Before scheduling
18
+
19
+ Confirm all of these. If one is missing, say so and do not schedule.
20
+
21
+ - The YouTube account is connected.
22
+ - Video media is present. A title with no video is not ready.
23
+ - The title is at or under 100 characters, the description has a chapters block, and the tags are present.
24
+
25
+ ## Title
26
+
27
+ At most 100 characters. Package it the way a video that outperforms its niche would: a specific claim, a real number, or a contrast. The title must still be true if it is the only text on the thumbnail. Never invent a number, name, or result.
28
+
29
+ ## Description
30
+
31
+ - Say what the viewer gets, in the channel's voice, before any links.
32
+ - A `CHAPTERS:` block. The first line is `0:00` plus the opening label. Later lines are timestamps you can justify from the video or the brief.
33
+ - Description stays at or under 5,000 characters.
34
+
35
+ ## Tags
36
+
37
+ One list, comma-separated, under 500 characters. Tags are search phrases for this video, not a hashtag dump in the title.
38
+
39
+ ## Editing
40
+
41
+ Change only the part that was asked. A sharper title does not license a new description.
42
+
43
+ ## Check it works
44
+
45
+ Read the saved draft back. Confirm the account, the video, the title length, the chapters, the tags, and that nothing contains an em dash.
46
+
47
+ No em dashes, en dashes, or double hyphens in the title, description, or tags.
48
+
49
+ Paid and outward runs follow the paid-run consent rule.
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "generated_by": "packages/cli/scripts/build-agent-plugin.mjs from apps/backend/src/services/mcp/consentRule.json; do not edit by hand",
3
3
  "consent": {
4
- "summary": "Anything that writes, spends credits or reaches a person: dry_run first, then live with the quote_hash the dry_run returned, a max_credits ceiling and an idempotency_key. max_credits 0 is valid only when that quote is 0. A larger paid run, or a live external send above the server's recipient threshold, also needs the user's yes before you send approved: true; never send it on your own.",
5
- "paid_run": "Anything that writes, spends credits or reaches a real person: run mode dry_run first, show the user the preview, the row count and the credit estimate, then run live with the quote_hash that dry_run returned, a max_credits ceiling and an idempotency_key. max_credits 0 is valid only when that quote is 0. A live paid run states max_rows; an external send states max_live_sends of at least the dry_run recipient_count. A quote returned by a refused live call is only a price, never a confirmation.",
6
- "human_approval": "A paid run above the server's row or provider-spend limit, a live external send above the server's recipient threshold, or a run that turns on a recurring trigger, also needs the user's yes. Ask them, and only then send approved: true with the same quote_hash. You are asserting that you asked a person; never send it on your own."
4
+ "summary": "Anything that writes, spends credits or reaches a person: dry_run first, then live with the quote_hash the dry_run returned, a max_credits ceiling and an idempotency_key. max_credits 0 is valid only when that quote is 0. A larger paid run, a live external send above the server's recipient threshold, or a run that turns on a recurring trigger, also needs approved: true with the same quote_hash, after reviewing the preview. Free formulas need no paid-run approval; row execution caps still apply.",
5
+ "paid_run": "For writes, credit spend or external effects: dry_run first, review the row count and credit estimate, then run live with the quote_hash that dry_run returned, a max_credits ceiling and an idempotency_key. max_credits 0 is valid only when that quote is 0. Supply max_rows or max_live_sends only when the fetched capability schema declares them; when an external send accepts max_live_sends, cover at least the dry_run recipient_count. Sequence lifecycle and enrollment calls have no lifetime send ceiling. A quote returned by a refused live call is only a price, never a confirmation.",
6
+ "human_approval": "A paid run above the server's row or provider-spend limit, a live external send above the server's recipient threshold, or a run that turns on a recurring trigger, also needs approved: true with the same quote_hash, after reviewing the preview. Free formulas need no paid-run approval; row execution caps still apply."
7
7
  },
8
8
  "router_steps": [
9
9
  {
@@ -24,7 +24,7 @@
24
24
  {
25
25
  "mcp": "tools_run",
26
26
  "cli": "dreamstate tools run <capability_id> --params '{...}' --mode <dry_run|live> --json",
27
- "text": "runs it with `capability_id` and `params`. The gating inputs (`mode`, `max_credits`, `idempotency_key`, `quote_hash`, `approved`) go on the run call itself, never inside `params`. `max_rows` is a param of `tables.columns.run` and `tables.table_sources.run`, not of `tools_run`. `max_live_sends` is a param of the external-send sequence capabilities (`sequence.sequences.activate_audience`, `sequence.sequences.resume`, and the rest of that family), sent inside `params`, not a gating input of `tools_run`."
27
+ "text": "runs it with `capability_id` and `params`. The gating inputs (`mode`, `max_credits`, `idempotency_key`, `quote_hash`, `approved`) go on the run call itself, never inside `params`. `max_rows` is a param of `tables.columns.run` and `tables.table_sources.run`, not of `tools_run`. `max_live_sends` goes inside `params` only when the fetched capability schema declares it (for example, a one-contact workflow run). Sequence start, resume, launch and enrollment do not accept it; they have no lifetime send ceiling."
28
28
  },
29
29
  {
30
30
  "mcp": "runs_get",
package/dist/client.d.ts CHANGED
@@ -147,7 +147,12 @@ export declare class DreamstateClient {
147
147
  listTools(query?: Record<string, unknown>): Promise<unknown>;
148
148
  getTool(capabilityId: string, query?: Record<string, unknown>): Promise<unknown>;
149
149
  runCapability(capabilityId: string, body: CapabilityRunBody, idempotencyKey?: string | null): Promise<unknown>;
150
- getRun(id: string): Promise<unknown>;
150
+ /**
151
+ * A waiter supplies its remaining deadline so a final poll, including a
152
+ * server-directed rate-limit retry, cannot outlive the command that asked
153
+ * for it. Other callers retain the normal run limit.
154
+ */
155
+ getRun(id: string, timeoutMs?: number): Promise<unknown>;
151
156
  listRuns(query?: Record<string, unknown>): Promise<unknown>;
152
157
  getRunEvents(id: string, query?: Record<string, unknown>): Promise<unknown>;
153
158
  cancelRun(id: string, body: Record<string, unknown>, idempotencyKey?: string): Promise<unknown>;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,EAAE,MAA2C,CAAC;AAEtE,uFAAuF;AACvF,eAAO,MAAM,kBAAkB,6CAA6C,CAAC;AAE7E;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IAChC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC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AAiB,EACvB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,GAC7B,OAAO,CAAC,OAAO,CAAC;IAYnB;;;;OAIG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IASxD,QAAQ,CAAC,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAG/D,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAG/E,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAW/F,OAAO,CAAC,cAAc;YAUR,OAAO;CA0HtB"}
package/dist/client.js CHANGED
@@ -160,11 +160,11 @@ function retryAfterDelayMs(value) {
160
160
  const dateMs = Date.parse(value);
161
161
  return Number.isNaN(dateMs) ? null : Math.max(0, dateMs - Date.now());
162
162
  }
163
- function waitForRetryAfter(value) {
163
+ function waitForRetryAfter(value, maximumDelayMs) {
164
164
  const delayMs = retryAfterDelayMs(value);
165
165
  if (delayMs === null)
166
166
  return Promise.resolve();
167
- return new Promise((resolve) => setTimeout(resolve, delayMs));
167
+ return new Promise((resolve) => setTimeout(resolve, maximumDelayMs === undefined ? delayMs : Math.min(delayMs, maximumDelayMs)));
168
168
  }
169
169
  function versionAtMost(current, target) {
170
170
  return !isVersionGreater(current, target);
@@ -371,8 +371,13 @@ class DreamstateClient {
371
371
  ...(key ? { headers: { 'Idempotency-Key': key } } : {}),
372
372
  }, exports.TOOL_AND_RUN_REQUEST_TIMEOUT_MS);
373
373
  }
374
- getRun(id) {
375
- return this.request(`/runs/${encodeURIComponent(id)}`, {}, exports.TOOL_AND_RUN_REQUEST_TIMEOUT_MS);
374
+ /**
375
+ * A waiter supplies its remaining deadline so a final poll, including a
376
+ * server-directed rate-limit retry, cannot outlive the command that asked
377
+ * for it. Other callers retain the normal run limit.
378
+ */
379
+ getRun(id, timeoutMs) {
380
+ return this.request(`/runs/${encodeURIComponent(id)}`, {}, exports.TOOL_AND_RUN_REQUEST_TIMEOUT_MS, false, timeoutMs);
376
381
  }
377
382
  listRuns(query = {}) {
378
383
  return this.request(`/runs${queryString(query)}`, {}, exports.TOOL_AND_RUN_REQUEST_TIMEOUT_MS);
@@ -399,14 +404,19 @@ class DreamstateClient {
399
404
  registry_hash: info.registry_hash ?? this.releaseInfo.registry_hash,
400
405
  };
401
406
  }
402
- async request(path, init = {}, defaultTimeoutMs = exports.DEFAULT_REQUEST_TIMEOUT_MS, allowIncompatibleCli = false) {
407
+ async request(path, init = {}, defaultTimeoutMs = exports.DEFAULT_REQUEST_TIMEOUT_MS, allowIncompatibleCli = false, timeoutOverrideMs) {
403
408
  const requestTimeoutMs = this.requestTimeoutMs ?? defaultTimeoutMs;
409
+ const deadlineAtMs = timeoutOverrideMs === undefined ? undefined : Date.now() + timeoutOverrideMs;
404
410
  let response;
405
411
  let retriedRateLimit = false;
406
412
  const idempotencyKey = new Headers(init.headers).get('Idempotency-Key') ?? undefined;
413
+ const timeoutError = () => new CliError(errors_1.CLI_LOCAL_ERROR_CODES.request_timeout, 'request_timeout', 0, { idempotencyKey, repair: errors_1.CLI_LOCAL_ERROR_REPAIRS.request_timeout });
407
414
  while (true) {
415
+ const remainingMs = deadlineAtMs === undefined ? undefined : deadlineAtMs - Date.now();
416
+ if (remainingMs !== undefined && remainingMs <= 0)
417
+ throw timeoutError();
408
418
  const controller = new AbortController();
409
- const timeout = setTimeout(() => controller.abort(), requestTimeoutMs);
419
+ const timeout = setTimeout(() => controller.abort(), remainingMs === undefined ? requestTimeoutMs : Math.min(requestTimeoutMs, remainingMs));
410
420
  try {
411
421
  response = await fetch(path.startsWith('http') ? path : `${this.baseUrl}${path}`, {
412
422
  ...init,
@@ -422,30 +432,44 @@ class DreamstateClient {
422
432
  });
423
433
  }
424
434
  catch (error) {
435
+ clearTimeout(timeout);
425
436
  if (controller.signal.aborted) {
426
- throw new CliError(errors_1.CLI_LOCAL_ERROR_CODES.request_timeout, 'request_timeout', 0, { idempotencyKey, repair: errors_1.CLI_LOCAL_ERROR_REPAIRS.request_timeout });
437
+ throw timeoutError();
427
438
  }
428
439
  throw new CliError(`Request failed: ${error instanceof Error ? error.message : String(error)}`, 'network_error', 0, { idempotencyKey, repair: errors_1.CLI_LOCAL_ERROR_REPAIRS.network_error });
429
440
  }
430
- finally {
431
- clearTimeout(timeout);
432
- }
433
441
  let payload;
434
442
  try {
435
443
  payload = await response.json();
436
444
  }
437
445
  catch {
446
+ if (controller.signal.aborted) {
447
+ throw timeoutError();
448
+ }
438
449
  this.noteServerInfo(readServerReleaseInfo(undefined, response.headers));
439
450
  throw new CliError(`Dreamstate API returned invalid JSON (HTTP ${response.status})`, 'invalid_response', response.status, { idempotencyKey, repair: errors_1.CLI_LOCAL_ERROR_REPAIRS.invalid_response });
440
451
  }
452
+ finally {
453
+ clearTimeout(timeout);
454
+ }
441
455
  const info = readServerReleaseInfo(payload, response.headers);
442
456
  this.noteServerInfo(info);
457
+ if (deadlineAtMs !== undefined && Date.now() >= deadlineAtMs)
458
+ throw timeoutError();
443
459
  const meta = metaRecord(payload);
444
460
  const envelopeError = errorEnvelope(payload);
445
461
  if (envelopeError && response.status === 429 && !retriedRateLimit) {
446
462
  const retryAfterValue = retryAfter(response, envelopeError);
447
- if (retryAfterValue && retryAfterDelayMs(retryAfterValue) !== null) {
463
+ const retryDelayMs = retryAfterValue ? retryAfterDelayMs(retryAfterValue) : null;
464
+ if (retryAfterValue && retryDelayMs !== null) {
448
465
  retriedRateLimit = true;
466
+ const remainingBeforeRetry = deadlineAtMs === undefined ? undefined : deadlineAtMs - Date.now();
467
+ if (remainingBeforeRetry !== undefined && remainingBeforeRetry <= 0)
468
+ throw timeoutError();
469
+ if (remainingBeforeRetry !== undefined && retryDelayMs >= remainingBeforeRetry) {
470
+ await waitForRetryAfter(retryAfterValue, remainingBeforeRetry);
471
+ throw timeoutError();
472
+ }
449
473
  await waitForRetryAfter(retryAfterValue);
450
474
  continue;
451
475
  }
@@ -6,8 +6,8 @@
6
6
  * what the CLI really parses, with no second hand-kept list:
7
7
  *
8
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.
9
+ * - every sequences / workflows / knowledge / unibox / tables verb (the verb
10
+ * tables in commands/), with the capability each one runs.
11
11
  *
12
12
  * A capability with no verb is reached through `tools run`, which stays a
13
13
  * catalog search (`tools search`); `commands search` reports those separately.
@@ -1 +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"}
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,CAchE;AAMD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,SAAK,GAAG,eAAe,EAAE,CAc5F"}
@@ -11,7 +11,7 @@ function usageEntries(usage) {
11
11
  return usage.split('\n')
12
12
  .filter((line) => line.startsWith(' dreamstate '))
13
13
  .map((line) => line.trim())
14
- .filter((line) => !/^dreamstate (sequences|workflows) <verb>/.test(line))
14
+ .filter((line) => !/^dreamstate (sequences|workflows|knowledge|unibox|tables) <verb>/.test(line))
15
15
  .map((line) => {
16
16
  const words = line.split(/\s+/);
17
17
  // `dreamstate tools run <capability_id> ...`: the typed command is the leading words
@@ -25,13 +25,16 @@ function cliCommandTable(usage) {
25
25
  // Required lazily: the verb tables import the CLI entry point's helpers.
26
26
  const { SEQUENCE_VERBS } = require('./commands/sequences');
27
27
  const { WORKFLOW_VERBS } = require('./commands/workflows');
28
+ const { KNOWLEDGE_VERBS } = require('./commands/knowledge');
29
+ const { UNIBOX_VERBS } = require('./commands/unibox');
30
+ const { TABLES_VERBS } = require('./commands/tables');
28
31
  const verbs = (pack, specs) => specs.map((spec) => ({
29
32
  command: `dreamstate ${pack} ${spec.verb}`,
30
33
  usage: verbUsage(pack, spec),
31
34
  summary: '',
32
35
  capability_id: spec.capabilityId,
33
36
  }));
34
- return [...usageEntries(usage), ...verbs('sequences', SEQUENCE_VERBS), ...verbs('workflows', WORKFLOW_VERBS)];
37
+ return [...usageEntries(usage), ...verbs('sequences', SEQUENCE_VERBS), ...verbs('workflows', WORKFLOW_VERBS), ...verbs('knowledge', KNOWLEDGE_VERBS), ...verbs('unibox', UNIBOX_VERBS), ...verbs('tables', TABLES_VERBS)];
35
38
  }
36
39
  function terms(value) {
37
40
  return value.toLowerCase().split(/[^a-z0-9_]+/).filter((word) => word.length > 1);
@@ -0,0 +1,13 @@
1
+ import { type PackVerbSpec } from './shared';
2
+ import type { CliCommand } from '../index';
3
+ import type { GatedRunContext } from '../gatedRun';
4
+ /** Pack groups that have no shared authoring kind and no local init scaffold. */
5
+ export type SimplePackName = 'knowledge' | 'unibox' | 'tables';
6
+ export interface PackSurface {
7
+ verbs: PackVerbSpec[];
8
+ usage: string;
9
+ parse: (argv: string[]) => CliCommand;
10
+ run: (context: GatedRunContext | undefined, command: CliCommand, stdout: NodeJS.WritableStream) => Promise<void>;
11
+ }
12
+ export declare function packSurface(pack: SimplePackName): PackSurface;
13
+ //# sourceMappingURL=genericPack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genericPack.d.ts","sourceRoot":"","sources":["../../src/commands/genericPack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoD,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAC/F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAInD,iFAAiF;AACjF,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE/D,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,UAAU,CAAC;IACtC,GAAG,EAAE,CAAC,OAAO,EAAE,eAAe,GAAG,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAClH;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,cAAc,GAAG,WAAW,CAoB7D"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.packSurface = packSurface;
7
+ const shared_1 = require("./shared");
8
+ const errors_1 = require("../errors");
9
+ const packVerbs_generated_json_1 = __importDefault(require("../generated/packVerbs.generated.json"));
10
+ function packSurface(pack) {
11
+ const prefix = pack + ' ';
12
+ const verbs = packVerbs_generated_json_1.default.verbs
13
+ .filter(({ command }) => command.startsWith(prefix))
14
+ .map(({ command, capabilityId, positional, local }) => ({
15
+ verb: command.slice(prefix.length),
16
+ capabilityId,
17
+ ...(positional ? { positional } : {}),
18
+ ...(local === 'init' ? { local: 'init' } : {}),
19
+ }));
20
+ const usage = (0, shared_1.renderPackUsage)(pack, verbs);
21
+ return {
22
+ verbs,
23
+ usage,
24
+ parse: (0, shared_1.buildPackParser)(pack, undefined, verbs, usage),
25
+ async run(context, command, stdout) {
26
+ if (!context)
27
+ throw new errors_1.CliUsageError(pack + ' commands require an authenticated session.');
28
+ await (0, shared_1.runPackCommand)(context, command, stdout);
29
+ },
30
+ };
31
+ }
@@ -0,0 +1,2 @@
1
+ export declare const KNOWLEDGE_VERBS: import("./shared").PackVerbSpec[], KNOWLEDGE_USAGE: string, parseKnowledgeCommand: (argv: string[]) => import("..").CliCommand, runKnowledgeCommand: (context: import("../gatedRun").GatedRunContext | undefined, command: import("..").CliCommand, stdout: NodeJS.WritableStream) => Promise<void>;
2
+ //# sourceMappingURL=knowledge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"knowledge.d.ts","sourceRoot":"","sources":["../../src/commands/knowledge.ts"],"names":[],"mappings":"AAEA,eAAO,MACE,eAAe,qCACf,eAAe,UACf,qBAAqB,+CACvB,mBAAmB,gJACE,CAAC"}