toolroll 0.9.41 → 0.9.43

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 (89) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/chat-actions.js +1 -1
  3. package/dist/chat-approval.d.ts +45 -0
  4. package/dist/chat-approval.js +81 -0
  5. package/dist/chat-channel.js +5 -0
  6. package/dist/chat-decide.d.ts +18 -6
  7. package/dist/chat-decide.js +54 -20
  8. package/dist/chat-flow.js +2 -2
  9. package/dist/cli.js +4 -2
  10. package/dist/coding-types.d.ts +2 -24
  11. package/dist/coding-workspace.js +12 -11
  12. package/dist/contracts/cli.d.ts +736 -0
  13. package/dist/contracts/cli.js +223 -0
  14. package/dist/contracts/coding-activity.d.ts +64 -0
  15. package/dist/contracts/coding-activity.js +58 -0
  16. package/dist/contracts/console-api.d.ts +484 -0
  17. package/dist/contracts/console-api.js +274 -0
  18. package/dist/contracts/diff-stat.d.ts +58 -0
  19. package/dist/contracts/diff-stat.js +59 -0
  20. package/dist/contracts/integration-metadata.d.ts +99 -0
  21. package/dist/contracts/integration-metadata.js +101 -0
  22. package/dist/contracts/lead-tools.d.ts +11 -0
  23. package/dist/contracts/lead-tools.js +2 -0
  24. package/dist/contracts/model-catalog.d.ts +21 -0
  25. package/dist/contracts/model-catalog.js +14 -0
  26. package/dist/contracts/native-census.d.ts +42 -0
  27. package/dist/contracts/native-census.js +36 -0
  28. package/dist/contracts/observation-request.d.ts +37 -0
  29. package/dist/contracts/observation-request.js +25 -0
  30. package/dist/contracts/provider.d.ts +30 -0
  31. package/dist/contracts/provider.js +15 -0
  32. package/dist/contracts/recipes.d.ts +166 -0
  33. package/dist/contracts/recipes.js +52 -0
  34. package/dist/contracts/retention.d.ts +42 -0
  35. package/dist/contracts/retention.js +24 -0
  36. package/dist/contracts/storage.d.ts +23 -0
  37. package/dist/contracts/storage.js +10 -0
  38. package/dist/contracts/store-json.d.ts +315 -0
  39. package/dist/contracts/store-json.js +196 -0
  40. package/dist/contracts/trigger-payloads.d.ts +369 -0
  41. package/dist/contracts/trigger-payloads.js +144 -0
  42. package/dist/contracts/update-journal.d.ts +254 -0
  43. package/dist/contracts/update-journal.js +155 -0
  44. package/dist/contracts/verification-view.d.ts +93 -0
  45. package/dist/contracts/verification-view.js +43 -0
  46. package/dist/control-setup.d.ts +1 -1
  47. package/dist/desktop-update.d.ts +7 -40
  48. package/dist/desktop-update.js +36 -8
  49. package/dist/evidence.d.ts +3 -19
  50. package/dist/flow-engine.d.ts +2 -0
  51. package/dist/flow-engine.js +10 -2
  52. package/dist/flow-triggers.js +61 -60
  53. package/dist/flows-cli.d.ts +28 -0
  54. package/dist/flows-cli.js +43 -1
  55. package/dist/guides.js +2 -0
  56. package/dist/mate-contract.js +1 -1
  57. package/dist/mate-tools.js +43 -1
  58. package/dist/mcp-connect.js +37 -22
  59. package/dist/model-catalog.js +8 -6
  60. package/dist/observations.d.ts +2 -6
  61. package/dist/observations.js +13 -9
  62. package/dist/operate.js +55 -4
  63. package/dist/process-recovery-eligibility.d.ts +1 -1
  64. package/dist/process-recovery-native.d.ts +2 -13
  65. package/dist/process-recovery-native.js +8 -5
  66. package/dist/project-tools.d.ts +6 -24
  67. package/dist/project-tools.js +22 -18
  68. package/dist/provider.d.ts +3 -8
  69. package/dist/provider.js +15 -11
  70. package/dist/recipes.d.ts +3 -28
  71. package/dist/recipes.js +79 -52
  72. package/dist/retention.d.ts +4 -5
  73. package/dist/retention.js +5 -4
  74. package/dist/scope.d.ts +4 -2
  75. package/dist/serve.js +193 -30
  76. package/dist/storage.d.ts +2 -1
  77. package/dist/storage.js +12 -9
  78. package/dist/store.d.ts +11 -16
  79. package/dist/store.js +122 -160
  80. package/dist/surface.d.ts +6 -54
  81. package/dist/surface.js +10 -2
  82. package/dist/teammate-work.js +1 -1
  83. package/dist/telegram-flow.d.ts +41 -1
  84. package/dist/telegram-flow.js +96 -12
  85. package/dist/telegram.js +27 -3
  86. package/dist/toolroll-update.d.ts +8 -99
  87. package/dist/toolroll-update.js +28 -18
  88. package/dist/verification-evidence.js +27 -12
  89. package/package.json +1 -1
package/dist/storage.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  import type { Store } from "./store.js";
2
+ import { type CheckoutCleanup } from "./contracts/storage.js";
2
3
  /** Settings → Storage: when a finished task's clean checkout is removed. One row, or none (the default). */
3
4
  export declare const CHECKOUT_CLEANUP_SCHEMA = "\nCREATE TABLE IF NOT EXISTS checkout_cleanup_setting (\n id INTEGER PRIMARY KEY CHECK (id = 1),\n cleanup TEXT NOT NULL CHECK (cleanup IN ('finished', '2d', '7d', 'never')),\n updated_by TEXT NOT NULL,\n updated_at TEXT NOT NULL\n);\n";
4
5
  /** What each storage sweep or clean-up by hand did (storage-sweep.ts): the latest few. */
5
6
  export declare const STORAGE_SWEEP_SCHEMA = "\nCREATE TABLE IF NOT EXISTS storage_sweep (\n id INTEGER PRIMARY KEY,\n at TEXT NOT NULL,\n source TEXT NOT NULL CHECK (source IN ('automatic', 'manual')),\n actor TEXT NOT NULL,\n result TEXT NOT NULL\n);\n";
6
- export type CheckoutCleanup = "finished" | "2d" | "7d" | "never";
7
+ export type { CheckoutCleanup } from "./contracts/storage.js";
7
8
  export declare const DEFAULT_CLEANUP: CheckoutCleanup;
8
9
  export declare const CLEANUP_CHOICES: readonly {
9
10
  value: CheckoutCleanup;
package/dist/storage.js CHANGED
@@ -11,6 +11,7 @@ import { spawnSync } from "node:child_process";
11
11
  import { lstatSync, readdirSync } from "node:fs";
12
12
  import { basename, dirname, join } from "node:path";
13
13
  import { DEPS_FOLDER, sharedCopies } from "./shared-deps.js";
14
+ import { checkoutCleanupSchema } from "./contracts/storage.js";
14
15
  /** Settings → Storage: when a finished task's clean checkout is removed. One row, or none (the default). */
15
16
  export const CHECKOUT_CLEANUP_SCHEMA = `
16
17
  CREATE TABLE IF NOT EXISTS checkout_cleanup_setting (
@@ -37,18 +38,20 @@ export const CLEANUP_CHOICES = [
37
38
  { value: "7d", label: "A week after that", days: 7 },
38
39
  { value: "never", label: "Never (only when you clean up)", days: null },
39
40
  ];
41
+ /** The other words each cleanup value may be typed as. */
42
+ const CLEANUP_ALIASES = {
43
+ finished: ["complete", "completed", "cancelled", "done", "0", "0d"],
44
+ "2d": ["2", "2 days", "2days"],
45
+ "7d": ["7", "7 days", "7days", "week", "a week", "1w"],
46
+ never: ["off"],
47
+ };
40
48
  /** `finished` (or complete, cancelled), `2d`, `7d` (or week, 1w), `never` (or off); undefined when it's none of those. */
41
49
  export function parseCleanup(text) {
42
50
  const value = text.trim().toLowerCase().replace(/\s+/g, " ");
43
- if (["finished", "complete", "completed", "cancelled", "done", "0", "0d"].includes(value))
44
- return "finished";
45
- if (["2d", "2", "2 days", "2days"].includes(value))
46
- return "2d";
47
- if (["7d", "7", "7 days", "7days", "week", "a week", "1w"].includes(value))
48
- return "7d";
49
- if (["never", "off"].includes(value))
50
- return "never";
51
- return undefined;
51
+ const named = checkoutCleanupSchema.safeParse(value);
52
+ if (named.success)
53
+ return named.data;
54
+ return checkoutCleanupSchema.options.find(one => CLEANUP_ALIASES[one].includes(value));
52
55
  }
53
56
  export function cleanupWords(cleanup) {
54
57
  return cleanup === "finished" ? "when its task is complete or cancelled"
package/dist/store.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { DecisionOption } from "./contracts/decision.js";
2
+ import { type SavedToolAction, type SavedToolRule } from "./contracts/store-json.js";
2
3
  import type { FlowCardChange, FlowCardFields } from "./contracts/flow-card.js";
3
4
  import { type Actor } from "./actor.js";
4
5
  import { type CriterionMatrixRow, type CriterionJudgementWord } from "./proof.js";
@@ -64,6 +65,13 @@ export declare const MATE_ASK_SCHEMA = "\nCREATE TABLE IF NOT EXISTS mate_ask (\
64
65
  * per option for one visit of one card, placed on the message it rides. A reply to that message is the note
65
66
  * (telegram_flow_prompt, mode send-back). The chat apps keep their buttons beside their messages (chat-delivery-state.ts). */
66
67
  export declare const FLOW_SEND_SCHEMA = "\nCREATE TABLE IF NOT EXISTS flow_send (\n card INTEGER NOT NULL REFERENCES flow_card(id),\n entry INTEGER NOT NULL,\n stage TEXT NOT NULL,\n person TEXT NOT NULL,\n content_json TEXT NOT NULL,\n created_at TEXT NOT NULL,\n PRIMARY KEY (card, entry)\n);\nCREATE TABLE IF NOT EXISTS telegram_flow_choice (\n token TEXT PRIMARY KEY,\n binding INTEGER NOT NULL REFERENCES telegram_binding(id) ON DELETE RESTRICT,\n card INTEGER NOT NULL REFERENCES flow_card(id),\n entry INTEGER NOT NULL,\n choice INTEGER NOT NULL,\n label TEXT NOT NULL,\n chat_id TEXT NOT NULL,\n message_id TEXT,\n created_at TEXT NOT NULL,\n expires_at TEXT NOT NULL,\n consumed_at TEXT\n);\nCREATE INDEX IF NOT EXISTS telegram_flow_choice_visit ON telegram_flow_choice (card, entry);\n";
68
+ /** An owner's lasting choice to approve plans and merges from their paired chat (chat-approval.ts), for all their
69
+ * projects (scope '*') or one (its path), with the limits they agreed to. Off unless a row says on; a project's own row
70
+ * outranks the all-projects one. `generation` is the account's at the change: a reset password ends it. */
71
+ export declare const CHAT_APPROVAL_SCHEMA = "\nCREATE TABLE IF NOT EXISTS chat_approval_setting (\n approver TEXT NOT NULL,\n scope TEXT NOT NULL,\n enabled INTEGER NOT NULL CHECK (enabled IN (0,1)),\n full_access INTEGER NOT NULL DEFAULT 0 CHECK (full_access IN (0,1)),\n attempt_cap_microusd INTEGER CHECK (attempt_cap_microusd IS NULL OR attempt_cap_microusd >= 0),\n generation INTEGER NOT NULL,\n digest TEXT NOT NULL,\n updated_by TEXT NOT NULL,\n updated_at TEXT NOT NULL,\n PRIMARY KEY (approver, scope)\n);\n";
72
+ /** The second tap on a flow decision in Telegram (telegram-flow.ts): Approve arms Yes and Cancel, bound to the binding,
73
+ * chat, message and exact visit of the card; Yes decides it once. */
74
+ export declare const TELEGRAM_FLOW_CONFIRM_SCHEMA = "\nCREATE TABLE IF NOT EXISTS telegram_flow_confirm (\n token TEXT PRIMARY KEY,\n binding INTEGER NOT NULL,\n chat_id TEXT NOT NULL,\n message_id TEXT NOT NULL,\n card INTEGER NOT NULL,\n entry INTEGER NOT NULL,\n phase TEXT NOT NULL CHECK (phase IN ('yes','cancel')),\n created_at TEXT NOT NULL,\n expires_at TEXT NOT NULL,\n consumed_at TEXT\n);\nCREATE INDEX IF NOT EXISTS telegram_flow_confirm_visit ON telegram_flow_confirm (card, entry);\n";
67
75
  export declare const CHAT_DECIDE_SCHEMA = "\nCREATE TABLE IF NOT EXISTS chat_decide_action (\n token TEXT PRIMARY KEY,\n channel TEXT NOT NULL,\n binding INTEGER NOT NULL,\n chat TEXT NOT NULL,\n message TEXT,\n act TEXT NOT NULL CHECK (act IN ('accept','changes','retry','approve','not-now','merge')),\n phase TEXT NOT NULL CHECK (phase IN ('offer','yes','cancel')),\n task_id TEXT NOT NULL,\n run INTEGER,\n digest TEXT NOT NULL,\n created_at TEXT NOT NULL,\n expires_at TEXT NOT NULL,\n consumed_at TEXT\n);\nCREATE INDEX IF NOT EXISTS chat_decide_action_message ON chat_decide_action (channel, chat, message);\nCREATE TABLE IF NOT EXISTS chat_decide_prompt (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n channel TEXT NOT NULL,\n binding INTEGER NOT NULL,\n chat TEXT NOT NULL,\n task_id TEXT NOT NULL,\n run INTEGER NOT NULL,\n digest TEXT NOT NULL,\n message TEXT,\n created_at TEXT NOT NULL,\n expires_at TEXT NOT NULL,\n consumed_at TEXT\n);\nCREATE INDEX IF NOT EXISTS chat_decide_prompt_open ON chat_decide_prompt (channel, binding, consumed_at);\n";
68
76
  export type MateAsk = {
69
77
  turn: number;
@@ -632,22 +640,9 @@ export type TeammateSuggestionRow = {
632
640
  createdAt: string;
633
641
  };
634
642
  /** v94: one action a project tool offers, as it described itself when listed. */
635
- export type ToolActionInfo = {
636
- name: string;
637
- about: string;
638
- input: Record<string, unknown> | null;
639
- readOnly: boolean;
640
- };
643
+ export type ToolActionInfo = SavedToolAction;
641
644
  /** v94: a teammate's rule for one action: do it, ask first, or never; "free" may ask first above a number in its input. */
642
- export type ToolRule = {
643
- use: "free" | "ask" | "never";
644
- limit?: {
645
- field: string;
646
- over: number;
647
- };
648
- /** v97: another action of the same tool that undoes this one, called with the same input when a person presses Undo. */
649
- undo?: string;
650
- };
645
+ export type ToolRule = SavedToolRule;
651
646
  export type TeammateGrantRow = {
652
647
  teammate: number;
653
648
  tool: string;
@@ -2286,7 +2281,7 @@ export declare class Store {
2286
2281
  * exactly what the signed digest was bound to. Returns false when the
2287
2282
  * scope vanished mid-ceremony. */
2288
2283
  sealScopeApproval(taskId: string, by: string, now: Date, mutation?: Mutation, basis?: {
2289
- kind: "mode";
2284
+ kind: "mode" | "chat";
2290
2285
  modeDigest: string;
2291
2286
  }, approverKind?: ApproverKind): boolean;
2292
2287
  /** Whether this task's scope carries a LIVE seal: approved, and the