toolroll 0.9.115 → 0.9.117
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/CHANGELOG.md +55 -0
- package/README.md +43 -26
- package/dist/acp-agents.js +14 -1
- package/dist/acp-client.js +19 -1
- package/dist/agent-change-check.js +60 -0
- package/dist/agent-change-schema.js +19 -0
- package/dist/agent-detect.js +11 -1
- package/dist/agent-fence.js +39 -10
- package/dist/agent-network-request.js +108 -0
- package/dist/agent-requests.js +105 -0
- package/dist/approval-summary.js +3 -3
- package/dist/backup.js +17 -1
- package/dist/batch-checks.js +81 -18
- package/dist/browser/terminal.js +41 -41
- package/dist/browser/workspace.css +2 -2
- package/dist/browser/workspace.js +36 -36
- package/dist/builder.js +3 -1
- package/dist/candidate-materialize.js +119 -0
- package/dist/central-enrollment-contract.js +156 -0
- package/dist/central-recovery-stage.js +329 -0
- package/dist/chat-actions.js +101 -2
- package/dist/chat-channel.js +40 -0
- package/dist/check-only-standing.js +13 -0
- package/dist/check-only.js +25 -13
- package/dist/check-recovery-hold.js +199 -0
- package/dist/check-recovery-index-schema.js +3 -0
- package/dist/check-screenshots.js +83 -0
- package/dist/cli.js +125 -6
- package/dist/codex-limits.js +4 -0
- package/dist/connect-cli.js +257 -11
- package/dist/contracts/chat-actions.js +4 -0
- package/dist/contracts/console-api.js +15 -4
- package/dist/contracts/engine-api.js +344 -2
- package/dist/contracts/lead-tools.js +56 -2
- package/dist/contracts/provider.js +1 -1
- package/dist/contracts/route.js +1 -1
- package/dist/contracts/terminal-connection.js +50 -0
- package/dist/converse.js +80 -4
- package/dist/device-pair.js +280 -0
- package/dist/direct-chat-artifacts.js +347 -0
- package/dist/direct-chat-catalog.js +311 -0
- package/dist/direct-chat-fence.js +96 -0
- package/dist/direct-chat-git.js +343 -0
- package/dist/direct-chat-laptop.js +19 -0
- package/dist/direct-chat-schema.js +181 -0
- package/dist/direct-chat-ship.js +861 -0
- package/dist/direct-chat-workspace.js +389 -0
- package/dist/direct-chat.js +2107 -0
- package/dist/doctor.js +1 -1
- package/dist/easy-start.js +18 -0
- package/dist/egress.js +25 -4
- package/dist/engine-chat.js +454 -0
- package/dist/engine-reads.js +141 -13
- package/dist/exec.js +4 -3
- package/dist/flexible-agents.js +8 -16
- package/dist/flexible-authority-end.js +2 -0
- package/dist/flexible-interactive-schema.js +133 -0
- package/dist/flexible-interactive.js +94 -0
- package/dist/flexible-session.js +117 -49
- package/dist/flexible-ship.js +87 -7
- package/dist/flexible-sign-in.js +10 -0
- package/dist/flexible-start.js +21 -3
- package/dist/flexible-thread.js +2 -3
- package/dist/flexible-turns.js +26 -5
- package/dist/flexible.js +13 -0
- package/dist/flow-triggers.js +13 -4
- package/dist/flows-ui.js +54 -20
- package/dist/handoff-cli.js +630 -0
- package/dist/invoke.js +55 -13
- package/dist/lead-contract.js +5 -4
- package/dist/lead-doors.js +80 -1
- package/dist/lead-progress.js +9 -0
- package/dist/lead-tools.js +682 -10
- package/dist/lead.js +37 -9
- package/dist/live-bus.js +11 -0
- package/dist/live-terminal.js +132 -12
- package/dist/local-handoff.js +363 -0
- package/dist/local-owner-acts.js +264 -2
- package/dist/local-owner.js +16 -1
- package/dist/multiplayer-handoff.js +528 -0
- package/dist/multiplayer-presence.js +471 -0
- package/dist/names.js +17 -4
- package/dist/needs-you.js +10 -0
- package/dist/operate.js +280 -19
- package/dist/policy.js +2 -2
- package/dist/project-delete-ui.js +18 -11
- package/dist/project-delete.js +65 -4
- package/dist/project-tools.js +1 -1
- package/dist/prompt.js +1 -1
- package/dist/provider-connection.js +2 -0
- package/dist/provider-home.js +251 -8
- package/dist/provider.js +3 -2
- package/dist/publish.js +119 -64
- package/dist/pull-request-flow.js +35 -14
- package/dist/read-executor-worker.js +1 -1
- package/dist/read-executor.js +95 -1
- package/dist/restore-retirement.js +152 -0
- package/dist/result-follow-ups.js +116 -37
- package/dist/route-change.js +44 -4
- package/dist/scope.js +62 -5
- package/dist/serve.js +49 -5
- package/dist/server/chat.js +94 -13
- package/dist/server/console.css +9 -9
- package/dist/server/direct-chat.js +583 -0
- package/dist/server/engine-api.js +219 -21
- package/dist/server/flows.js +47 -13
- package/dist/server/found-repos.js +25 -0
- package/dist/server/guards.js +20 -6
- package/dist/server/live.js +81 -23
- package/dist/server/pages.js +67 -13
- package/dist/server/people-tokens.js +47 -6
- package/dist/server/remote.js +29 -0
- package/dist/server/render-results.js +6 -2
- package/dist/server/render-settings.js +4 -2
- package/dist/server/render-tasks.js +18 -17
- package/dist/server/route-table.js +69 -2
- package/dist/server/settings.js +22 -7
- package/dist/server/task-views.js +15 -3
- package/dist/server/tasks.js +39 -2
- package/dist/server/terminals.js +185 -11
- package/dist/settings-proofs.js +1 -1
- package/dist/spend-report.js +2 -2
- package/dist/spend.js +3 -3
- package/dist/store.js +600 -59
- package/dist/subagent-admin.js +23 -10
- package/dist/subagent-backup-schema.js +36 -0
- package/dist/subagent-backup.js +92 -0
- package/dist/subagent-week.js +2 -2
- package/dist/subagent-work.js +70 -47
- package/dist/subagents-ui.js +6 -2
- package/dist/subagents.js +5 -2
- package/dist/subscription-chat.js +36 -5
- package/dist/subscription-usage.js +233 -0
- package/dist/task-live.js +2 -1
- package/dist/teardown-git.js +34 -4
- package/dist/terminal-connection.js +159 -0
- package/dist/terminal-safety.js +114 -0
- package/dist/tui/darwin-arm64/toolroll-tui +0 -0
- package/dist/tui/darwin-x64/toolroll-tui +0 -0
- package/dist/tui/linux-arm64/toolroll-tui +0 -0
- package/dist/tui/linux-x64/toolroll-tui +0 -0
- package/dist/tui-contract.js +1 -1
- package/dist/tui-launch.js +32 -1
- package/dist/workspace-identity-schema.js +21 -0
- package/package.json +4 -2
package/dist/flexible.js
CHANGED
|
@@ -364,3 +364,16 @@ export function flexibleSettingsView(store, repo, viewer) {
|
|
|
364
364
|
return { repo, standing, canChange: viewer.canChange,
|
|
365
365
|
proposal: proposed.ok ? { terms: proposed.terms, digest: proposed.digest } : { problem: proposed.message.replace(/ Nothing changed\.$/, "") } };
|
|
366
366
|
}
|
|
367
|
+
export function flexibleRuntime(store, thread) {
|
|
368
|
+
const row = store.handle.prepare("SELECT runtime FROM flexible_thread_runtime WHERE thread = ?").get(thread);
|
|
369
|
+
if (row === undefined)
|
|
370
|
+
return "stream-json";
|
|
371
|
+
if (row["runtime"] !== "stream-json" && row["runtime"] !== "interactive")
|
|
372
|
+
throw new Error("unreadable thread runtime");
|
|
373
|
+
return row["runtime"];
|
|
374
|
+
}
|
|
375
|
+
export function recordFlexibleRuntime(store, thread, runtime) {
|
|
376
|
+
const changed = store.handle.prepare("UPDATE flexible_thread_runtime SET runtime = ?, chosen = 1 WHERE thread = ?").run(runtime, thread);
|
|
377
|
+
if (Number(changed.changes) !== 1)
|
|
378
|
+
throw new Error("missing thread runtime");
|
|
379
|
+
}
|
package/dist/flow-triggers.js
CHANGED
|
@@ -479,6 +479,12 @@ export function removeFlowTrigger(store, trigger, now, dir, by) {
|
|
|
479
479
|
function polled(config) {
|
|
480
480
|
return config.kind === "email" || ((config.kind === "github" || config.kind === "linear") && config.delivery === "poll");
|
|
481
481
|
}
|
|
482
|
+
export function canCheckTrigger(config) {
|
|
483
|
+
return polled(config) || (config.kind === "schedule" && config.script !== undefined) || config.kind === "plane-review";
|
|
484
|
+
}
|
|
485
|
+
export function canPressTrigger(trigger) {
|
|
486
|
+
return trigger.state === "active" && triggerConfigOf(trigger)?.kind === "button";
|
|
487
|
+
}
|
|
482
488
|
function startZone(config, definition) {
|
|
483
489
|
return config.zone !== null && definition.stages.some(one => one.id === config.zone) ? config.zone : definition.start;
|
|
484
490
|
}
|
|
@@ -620,16 +626,19 @@ export async function runFlowTriggers(store, repo, now, io) {
|
|
|
620
626
|
}
|
|
621
627
|
export async function checkFlowTriggerNow(store, trigger, now, io) {
|
|
622
628
|
const config = triggerConfigOf(trigger);
|
|
623
|
-
|
|
629
|
+
const refused = { ok: false, said: "Only GitHub, Linear and email triggers that are checked, schedules that run a script, and plane reviews can be run now." };
|
|
630
|
+
if (config === null || !canCheckTrigger(config))
|
|
631
|
+
return refused;
|
|
632
|
+
if (config.kind === "schedule" && config.script !== undefined) {
|
|
624
633
|
const fired = await fireScript(store, trigger, config, now, io, false);
|
|
625
634
|
return { ok: fired.ok, said: fired.said };
|
|
626
635
|
}
|
|
627
|
-
if (config
|
|
636
|
+
if (config.kind === "plane-review") {
|
|
628
637
|
const fired = await firePlaneReview(store, trigger, config, now, false);
|
|
629
638
|
return { ok: true, said: fired.said };
|
|
630
639
|
}
|
|
631
|
-
if (
|
|
632
|
-
return
|
|
640
|
+
if (!polled(config))
|
|
641
|
+
return refused;
|
|
633
642
|
const checked = await checkTrigger(store, trigger, config, now, io);
|
|
634
643
|
return { ok: checked.ok, said: checked.said };
|
|
635
644
|
}
|
package/dist/flows-ui.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { liveAttemptOf, steerControlsFor } from "./steer-controls.js";
|
|
2
2
|
import { draftFor, flowDefinitionOf, NO_REPLY_MOVE_ON } from "./flow-engine.js";
|
|
3
3
|
import { describeStandingOrder } from "./flow-schedule.js";
|
|
4
|
-
import { describeTrigger, triggerHeadline, FLOW_TRIGGER_KINDS, FLOW_TRIGGER_WORDS, githubRepoOf, HOOK_PATH, hookReady, planeStatusLink, readHooksBase, readLinearKey, senderOf, takesDeliveries, triggerConfigOf } from "./flow-triggers.js";
|
|
4
|
+
import { canCheckTrigger, canPressTrigger, describeTrigger, triggerHeadline, FLOW_TRIGGER_KINDS, FLOW_TRIGGER_WORDS, githubRepoOf, HOOK_PATH, hookReady, planeStatusLink, readHooksBase, readLinearKey, senderOf, takesDeliveries, triggerConfigOf } from "./flow-triggers.js";
|
|
5
5
|
import { SENDER_WORDS } from "./webhook-signing.js";
|
|
6
6
|
import { READER_CAPTURED } from "./webhook-readers.js";
|
|
7
7
|
import { hostOf, linkWords, provedWords, snapshotOf } from "./task-source.js";
|
|
@@ -21,7 +21,7 @@ import { labelOf, nameOf } from "./subagent-admin.js";
|
|
|
21
21
|
import { callWords, receiptWords } from "./subagent-tools.js";
|
|
22
22
|
import { undoFor } from "./subagent-week.js";
|
|
23
23
|
import { flowCardTaskLine } from "./flow-card-task.js";
|
|
24
|
-
import { unattendedViewOf } from "./flow-unattended.js";
|
|
24
|
+
import { activeUnattendedGrant, unattendedViewOf } from "./flow-unattended.js";
|
|
25
25
|
import { browserViewOf } from "./flow-browser.js";
|
|
26
26
|
import { readFlowSecrets } from "./flow-secrets.js";
|
|
27
27
|
import { html, htmlString, joinHtml, postForm } from "./html.js";
|
|
@@ -73,21 +73,28 @@ function nextWords(at, now) {
|
|
|
73
73
|
const hours = Math.round(minutes / 60);
|
|
74
74
|
return hours < 24 ? `in ${hours} h` : `in ${Math.round(hours / 24)} day${Math.round(hours / 24) === 1 ? "" : "s"}`;
|
|
75
75
|
}
|
|
76
|
+
function oneTriggerWords(store, trigger) {
|
|
77
|
+
const config = triggerConfigOf(trigger);
|
|
78
|
+
if (config === null)
|
|
79
|
+
return null;
|
|
80
|
+
return config.kind === "button" ? `When someone presses ${config.label}` : triggerHeadline(config, store).name;
|
|
81
|
+
}
|
|
76
82
|
function triggerWords(store, triggers) {
|
|
77
83
|
const shown = triggers.filter(one => one.state === "active");
|
|
78
84
|
const pick = shown.length > 0 ? shown : triggers.filter(one => one.state === "paused");
|
|
79
|
-
const words = pick.flatMap(one => {
|
|
80
|
-
const config = triggerConfigOf(one);
|
|
81
|
-
if (config === null)
|
|
82
|
-
return [];
|
|
83
|
-
return [config.kind === "button" ? `When someone presses ${config.label}` : triggerHeadline(config, store).name];
|
|
84
|
-
});
|
|
85
|
+
const words = pick.flatMap(one => { const said = oneTriggerWords(store, one); return said === null ? [] : [said]; });
|
|
85
86
|
if (words.length === 0)
|
|
86
87
|
return "Cards added by hand";
|
|
87
88
|
return words.length === 1 ? words[0] : `${words[0]} and ${words.length - 1} more`;
|
|
88
89
|
}
|
|
89
90
|
const FLOW_LIST_GROUPS = [["needs", "Needs you"], ["running", "Running"], ["on", "Turned on"], ["paused", "Paused"]];
|
|
90
|
-
|
|
91
|
+
export const AUTOMATIONS_MAX = 100;
|
|
92
|
+
export const AUTOMATION_OUTCOME_MAX = 200;
|
|
93
|
+
const isoOrNull = (at) => {
|
|
94
|
+
const ms = at === null ? NaN : Date.parse(at);
|
|
95
|
+
return Number.isFinite(ms) ? new Date(ms).toISOString() : null;
|
|
96
|
+
};
|
|
97
|
+
function automationFacts(store, flow, now) {
|
|
91
98
|
const cards = store.flowCards(flow.id, false);
|
|
92
99
|
const definition = flowDefinitionOf(flow);
|
|
93
100
|
const kindOf = (card) => definition?.stages.find(one => one.id === card.stage)?.kind ?? "";
|
|
@@ -96,23 +103,50 @@ function flowListRow(store, flow, now, options) {
|
|
|
96
103
|
const active = triggers.filter(one => one.state === "active");
|
|
97
104
|
const button = active.flatMap(one => { const config = triggerConfigOf(one); return config?.kind === "button" ? [{ id: one.id, label: config.label }] : []; })[0];
|
|
98
105
|
const trouble = troubleWords(flowInsights(store, flow, now, 7)) ?? nightlyHealthOf(store, flow);
|
|
99
|
-
const starts = triggerWords(store, triggers);
|
|
100
106
|
const next = active.map(one => one.nextAt).filter((one) => one !== null).sort()[0];
|
|
101
|
-
const
|
|
107
|
+
const group = waiting.length > 0 ? "needs" : cards.length > 0 ? "running" : active.length > 0 ? "on" : "paused";
|
|
108
|
+
const grant = triggers.some(one => one.state === "paused") ? activeUnattendedGrant(store, flow.id, now) : null;
|
|
109
|
+
const covered = new Set(grant?.terms.triggers.map(one => one.id) ?? []);
|
|
110
|
+
const wire = triggers.map(one => {
|
|
111
|
+
const config = triggerConfigOf(one);
|
|
112
|
+
const state = one.state === "active" ? "active" : "paused";
|
|
113
|
+
const nextAt = isoOrNull(one.nextAt);
|
|
114
|
+
return {
|
|
115
|
+
id: one.id, kind: one.kind, words: oneTriggerWords(store, one) ?? one.kind, state, nextAt, lastAt: isoOrNull(one.lastAt),
|
|
116
|
+
lastOutcome: one.lastOutcome === null ? null : one.lastOutcome.slice(0, AUTOMATION_OUTCOME_MAX), failures: one.failures,
|
|
117
|
+
canPress: canPressTrigger(one), canCheck: state === "active" && config !== null && canCheckTrigger(config),
|
|
118
|
+
label: config?.kind === "button" ? config.label : null, questions: config?.kind === "button" ? [...config.questions] : null,
|
|
119
|
+
resumeRunsNow: state === "paused" && nextAt !== null && Date.parse(nextAt) <= now.getTime() && covered.has(one.id),
|
|
120
|
+
};
|
|
121
|
+
});
|
|
122
|
+
const automation = {
|
|
123
|
+
id: flow.id, name: flow.name, project: projectName(flow.repo) || null, group, starts: triggerWords(store, triggers), nextAt: next === undefined ? null : isoOrNull(next),
|
|
124
|
+
waiting: waiting.length, inProgress: cards.length, trouble, triggers: wire,
|
|
125
|
+
};
|
|
126
|
+
return { automation, firstWaiting: waiting[0] === undefined ? null : { card: waiting[0], choose: kindOf(waiting[0]) === "choose" }, button, active };
|
|
127
|
+
}
|
|
128
|
+
export function automationsOf(store, flows, now) {
|
|
129
|
+
return flows.slice(0, AUTOMATIONS_MAX).map(flow => automationFacts(store, flow, now).automation);
|
|
130
|
+
}
|
|
131
|
+
function flowListRow(store, flow, now, options) {
|
|
132
|
+
const { automation: facts, firstWaiting, button, active } = automationFacts(store, flow, now);
|
|
133
|
+
const { trouble, starts, waiting } = facts;
|
|
134
|
+
const next = active.map(one => one.nextAt).filter((one) => one !== null).sort()[0];
|
|
135
|
+
const meta = html `${options.showProject ? html `<span>${projectName(flow.repo)}</span>` : ""}${next !== undefined && active.length > 0 && waiting === 0 ? html `<span class="k-num">Next ${nextWords(next, now)}</span>` : ""}`;
|
|
102
136
|
const start = button !== undefined && options.canAct ? btn(button.label, { sm: true, href: `/flows/${flow.id}?start=${button.id}` }) : html ``;
|
|
103
137
|
const plural = (n, one) => `${n} ${one}${n === 1 ? "" : "s"}`;
|
|
104
138
|
const tail = trouble === null ? "" : ` · ${trouble}`;
|
|
105
|
-
if (
|
|
106
|
-
const first =
|
|
107
|
-
const ask =
|
|
108
|
-
const said = waiting
|
|
139
|
+
if (facts.group === "needs" && firstWaiting !== null) {
|
|
140
|
+
const first = firstWaiting.card;
|
|
141
|
+
const ask = firstWaiting.choose ? chip("Choose", "ask") : chip("Approve", "ask");
|
|
142
|
+
const said = waiting === 1 ? `${first.title} waits for your decision` : `${plural(waiting, "card")} wait for your decision`;
|
|
109
143
|
return { group: "needs", row: row({ href: `/flows/${flow.id}`, chip: ask, title: flow.name, desc: `${starts} · ${said}${tail}`, meta, wait: true,
|
|
110
144
|
action: btn("Review", { sm: true, href: `/flows/${flow.id}?card=${first.id}`, attrs: { "aria-label": `Review ${first.title}` } }), attrs: { "data-flow": flow.id } }) };
|
|
111
145
|
}
|
|
112
|
-
if (
|
|
113
|
-
return { group: "running", row: row({ href: `/flows/${flow.id}`, chip: status("running"), title: flow.name, desc: `${starts} · ${plural(
|
|
146
|
+
if (facts.group === "running") {
|
|
147
|
+
return { group: "running", row: row({ href: `/flows/${flow.id}`, chip: status("running"), title: flow.name, desc: `${starts} · ${plural(facts.inProgress, "card")} in progress${tail}`, meta, action: start, attrs: { "data-flow": flow.id } }) };
|
|
114
148
|
}
|
|
115
|
-
if (
|
|
149
|
+
if (facts.group === "on") {
|
|
116
150
|
const failing = active.find(one => one.failures > 0);
|
|
117
151
|
const last = active.filter(one => one.lastAt !== null).sort((a, b) => (b.lastAt ?? "").localeCompare(a.lastAt ?? ""))[0];
|
|
118
152
|
const chipNow = failing !== undefined || trouble !== null ? status("failed") : last === undefined ? chip("Not run yet", "", { dot: false }) : status("finished");
|
|
@@ -120,7 +154,7 @@ function flowListRow(store, flow, now, options) {
|
|
|
120
154
|
: last === undefined ? "not run yet" : `last ran ${agoWords(last.lastAt, now)}${last.lastOutcome ? `: ${last.lastOutcome}` : ""}`;
|
|
121
155
|
return { group: "on", row: row({ href: `/flows/${flow.id}`, chip: chipNow, title: flow.name, desc: `${starts} · ${lastWords}${tail}`, meta, action: start, attrs: { "data-flow": flow.id } }) };
|
|
122
156
|
}
|
|
123
|
-
const paused = triggers.length > 0;
|
|
157
|
+
const paused = facts.triggers.length > 0;
|
|
124
158
|
return { group: "paused", row: row({ href: `/flows/${flow.id}`, chip: chip(paused ? "Paused" : "Off", "", { dot: false }), title: flow.name,
|
|
125
159
|
desc: paused ? `${starts} · paused${tail}` : `${starts} · nothing starts it on its own${tail}`, meta, attrs: { "data-flow": flow.id } }) };
|
|
126
160
|
}
|
|
@@ -334,7 +368,7 @@ export function flowView(store, flow, viewer, selectedCard, setup = { dir: null,
|
|
|
334
368
|
zone: title(config?.zone ?? definition?.start ?? ""), zoneId: config?.zone ?? definition?.start ?? "", state: trigger.state, status: trigger.lastOutcome, statusLink: planeStatusLink(config, trigger.lastOutcome), statusAt: trigger.lastAt, failing: trigger.failures > 0,
|
|
335
369
|
button: config?.kind === "button" ? { label: config.label, questions: config.questions } : null,
|
|
336
370
|
hook: config !== null && takesDeliveries(config) ? hookView(trigger, config, setup.dir) : null,
|
|
337
|
-
checkable:
|
|
371
|
+
checkable: config !== null && canCheckTrigger(config),
|
|
338
372
|
shared: config?.kind === "button" && trigger.hookHash !== null,
|
|
339
373
|
...(config?.kind === "schedule" && config.order !== undefined ? { order: describeStandingOrder(config.order, flow.repo, config.schedule) } : {}),
|
|
340
374
|
};
|