toolroll 0.9.52 → 0.9.54
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 +16 -0
- package/README.md +55 -80
- package/dist/agentconfig.d.ts +11 -36
- package/dist/agentconfig.js +3 -62
- package/dist/approval-policy.d.ts +1 -1
- package/dist/approval-policy.js +1 -1
- package/dist/board.d.ts +3 -19
- package/dist/board.js +4 -42
- package/dist/browser/workspace.js +18 -18
- package/dist/browser-workspace.d.ts +2 -1
- package/dist/builder.d.ts +9 -40
- package/dist/builder.js +50 -257
- package/dist/chat-actions.js +3 -14
- package/dist/chat-ask.js +8 -8
- package/dist/chat-controls.d.ts +0 -4
- package/dist/chat-controls.js +0 -1
- package/dist/chat-core.d.ts +171 -0
- package/dist/chat-core.js +288 -0
- package/dist/chat-decide.d.ts +10 -8
- package/dist/chat-decide.js +27 -24
- package/dist/chat-delivery-state.d.ts +51 -75
- package/dist/chat-delivery-state.js +140 -170
- package/dist/chat-delivery.d.ts +21 -4
- package/dist/chat-delivery.js +313 -195
- package/dist/chat-flow.d.ts +29 -1
- package/dist/chat-flow.js +24 -50
- package/dist/chat-messages.d.ts +319 -0
- package/dist/chat-messages.js +841 -0
- package/dist/chat-migration.d.ts +30 -0
- package/dist/chat-migration.js +802 -0
- package/dist/chat-quiet.d.ts +3 -0
- package/dist/chat-quiet.js +7 -2
- package/dist/chat-task-actions.d.ts +1 -1
- package/dist/chat-task-actions.js +0 -2
- package/dist/claim.d.ts +79 -244
- package/dist/claim.js +688 -1023
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +10 -2
- package/dist/contracts/chat-content.d.ts +71 -2
- package/dist/contracts/chat-content.js +22 -3
- package/dist/contracts/chat-tables.d.ts +11 -4
- package/dist/contracts/chat-tables.js +165 -87
- package/dist/contracts/cli.d.ts +0 -13
- package/dist/contracts/cli.js +0 -2
- package/dist/contracts/console-api.d.ts +5 -10
- package/dist/contracts/console-api.js +4 -10
- package/dist/contracts/discord-callback.js +2 -1
- package/dist/contracts/flow.d.ts +50 -0
- package/dist/contracts/flow.js +26 -1
- package/dist/contracts/lead-tools.d.ts +0 -13
- package/dist/contracts/lead-tools.js +3 -3
- package/dist/contracts/slack-callback.js +3 -2
- package/dist/contracts/store-json.d.ts +1 -29
- package/dist/contracts/store-json.js +4 -17
- package/dist/contracts/teams-callback.js +2 -1
- package/dist/converse.d.ts +1 -11
- package/dist/converse.js +6 -38
- package/dist/coordinator.d.ts +0 -1
- package/dist/coordinator.js +3 -5
- package/dist/demo.js +16 -26
- package/dist/desktop-update-gate.js +0 -1
- package/dist/desktop-update.js +1 -3
- package/dist/discord-chat.js +19 -38
- package/dist/discord-settings.js +4 -13
- package/dist/discord.js +4 -14
- package/dist/dispatch.d.ts +1 -1
- package/dist/dispatch.js +1 -1
- package/dist/dispose.d.ts +2 -3
- package/dist/dispose.js +17 -92
- package/dist/envelope.js +0 -3
- package/dist/exec.d.ts +0 -64
- package/dist/exec.js +3 -356
- package/dist/exhaustion.d.ts +22 -76
- package/dist/exhaustion.js +14 -140
- package/dist/export.js +8 -8
- package/dist/flow-engine.js +1 -1
- package/dist/flow-schedule.d.ts +154 -0
- package/dist/flow-schedule.js +321 -0
- package/dist/flow-share.js +1 -1
- package/dist/flow-triggers.d.ts +6 -1
- package/dist/flow-triggers.js +65 -10
- package/dist/flows-cli.js +8 -4
- package/dist/flows-ui.js +2 -0
- package/dist/flows.js +1 -1
- package/dist/guides.js +9 -29
- package/dist/invoke.d.ts +1 -24
- package/dist/invoke.js +17 -259
- package/dist/lead-status.js +2 -4
- package/dist/lead-voice.js +1 -1
- package/dist/mate-doors.d.ts +1 -2
- package/dist/mate-doors.js +12 -25
- package/dist/mate-tools.d.ts +2 -2
- package/dist/mate-tools.js +13 -24
- package/dist/modes.d.ts +19 -8
- package/dist/modes.js +24 -14
- package/dist/notification-rows.d.ts +30 -0
- package/dist/notification-rows.js +102 -0
- package/dist/operate-remote-arguments.js +2 -6
- package/dist/operate-remote.js +6 -7
- package/dist/operate.d.ts +0 -6
- package/dist/operate.js +226 -2248
- package/dist/phase-routing.d.ts +13 -23
- package/dist/phase-routing.js +13 -35
- package/dist/plan-auto.js +2 -2
- package/dist/plane-review.js +5 -11
- package/dist/planner-source.js +2 -1
- package/dist/policy.d.ts +1 -4
- package/dist/policy.js +0 -8
- package/dist/process-recovery-eligibility.js +2 -3
- package/dist/project-delete.js +24 -41
- package/dist/proposal.d.ts +4 -24
- package/dist/proposal.js +3 -88
- package/dist/provider-auth.d.ts +3 -3
- package/dist/provider-auth.js +4 -6
- package/dist/provider.d.ts +11 -25
- package/dist/provider.js +4 -36
- package/dist/push.js +1 -1
- package/dist/recipe-ui.js +6 -6
- package/dist/recipes.d.ts +3 -3
- package/dist/recipes.js +27 -23
- package/dist/result-shots.js +2 -2
- package/dist/retention.js +1 -1
- package/dist/run-closeout.d.ts +1 -1
- package/dist/run-closeout.js +1 -4
- package/dist/scope.d.ts +11 -65
- package/dist/scope.js +17 -82
- package/dist/serve.js +15 -24
- package/dist/server/chat.js +7 -30
- package/dist/server/flows.js +11 -10
- package/dist/server/guards.js +0 -1
- package/dist/server/pages-assets.js +1 -1
- package/dist/server/pages.js +0 -2
- package/dist/server/people-tokens.js +0 -4
- package/dist/server/route-table.d.ts +1 -1
- package/dist/server/route-table.js +2 -17
- package/dist/server/settings.js +6 -12
- package/dist/server/shared.d.ts +28 -212
- package/dist/server/shared.js +71 -780
- package/dist/server/task-views.js +9 -76
- package/dist/server/tasks.d.ts +1 -50
- package/dist/server/tasks.js +36 -946
- package/dist/setup-guide.d.ts +2 -2
- package/dist/slack-api.d.ts +5 -1
- package/dist/slack-api.js +2 -2
- package/dist/slack-chat.d.ts +9 -6
- package/dist/slack-chat.js +29 -53
- package/dist/slack-settings.js +6 -15
- package/dist/slack.js +6 -16
- package/dist/store.d.ts +200 -1702
- package/dist/store.js +811 -5439
- package/dist/surface.js +10 -24
- package/dist/task-composer.d.ts +1 -1
- package/dist/task-composer.js +1 -1
- package/dist/task-control.d.ts +3 -10
- package/dist/task-control.js +2 -7
- package/dist/teammate-desk.js +1 -1
- package/dist/teammate-question.js +12 -12
- package/dist/teammates-ui.js +1 -1
- package/dist/teams-chat.js +12 -9
- package/dist/teams-settings.js +2 -2
- package/dist/teams.js +4 -5
- package/dist/telegram-flow.js +5 -5
- package/dist/telegram-mate.d.ts +0 -3
- package/dist/telegram-mate.js +0 -1
- package/dist/telegram.js +4 -4
- package/dist/templates.d.ts +11 -7
- package/dist/templates.js +12 -9
- package/dist/toolroll-update.d.ts +20 -0
- package/dist/toolroll-update.js +104 -5
- package/dist/work-index.js +2 -6
- package/dist/workspace-revision.js +3 -1
- package/dist/workspace-ui.js +1 -1
- package/package.json +1 -1
- package/scripts/recovery-canary.mjs +3 -3
- package/dist/contest.d.ts +0 -318
- package/dist/contest.js +0 -753
- package/dist/held.d.ts +0 -150
- package/dist/held.js +0 -799
- package/dist/liveness.d.ts +0 -30
- package/dist/liveness.js +0 -42
- package/dist/pricing.d.ts +0 -45
- package/dist/pricing.js +0 -77
- package/dist/routine.d.ts +0 -228
- package/dist/routine.js +0 -764
- package/dist/slack-state.d.ts +0 -13
- package/dist/slack-state.js +0 -10
- package/dist/supervisor.mjs +0 -297
package/dist/liveness.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Attended-liveness semantics (Parity II Phase 1, S3) — the ONE definition
|
|
3
|
-
* every attended feature consumes. A browser proves presence only by
|
|
4
|
-
* RENEWING a heartbeat; absence is inferred only from renewal ceasing,
|
|
5
|
-
* never from observing a tab close (which is not reliably observable).
|
|
6
|
-
* Renewal can extend nothing past an absolute expiry and can never mint
|
|
7
|
-
* or broaden authority — it only keeps an already-signed authorization
|
|
8
|
-
* usable (strategy rulings 1c/12).
|
|
9
|
-
*
|
|
10
|
-
* The state contract, exact (spec finding 11/18):
|
|
11
|
-
* - "expired" iff now >= absoluteExpiryAt — checked FIRST; renewal is
|
|
12
|
-
* irrelevant past the absolute wall.
|
|
13
|
-
* - a null beat (never renewed) is "lapsed".
|
|
14
|
-
* - a FUTURE beat is "lapsed": strict means strict — a clock that claims
|
|
15
|
-
* tomorrow proves nothing about presence now.
|
|
16
|
-
* - "live" iff now - lastBeatAt <= 20s (one 15s beat + 5s jitter).
|
|
17
|
-
* - "grace" iff now - lastBeatAt <= 45s (one missed beat, forgiven —
|
|
18
|
-
* background-tab throttling survives grace, not live).
|
|
19
|
-
* - otherwise "lapsed".
|
|
20
|
-
*
|
|
21
|
-
* Session COOKIE lifetimes (12h idle / 7d absolute in serve.ts) are a
|
|
22
|
-
* different thing and are untouched by all of this.
|
|
23
|
-
*/
|
|
24
|
-
export declare const BEAT_MS = 15000;
|
|
25
|
-
/** live = one beat plus jitter. */
|
|
26
|
-
export declare const LIVE_MS = 20000;
|
|
27
|
-
/** grace = one whole missed beat beyond live, forgiven. */
|
|
28
|
-
export declare const GRACE_MS = 45000;
|
|
29
|
-
export type AttendedLiveness = "live" | "grace" | "lapsed" | "expired";
|
|
30
|
-
export declare function attendedLivenessState(lastBeatAt: number | null, now: number, absoluteExpiryAt: number): AttendedLiveness;
|
package/dist/liveness.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Attended-liveness semantics (Parity II Phase 1, S3) — the ONE definition
|
|
3
|
-
* every attended feature consumes. A browser proves presence only by
|
|
4
|
-
* RENEWING a heartbeat; absence is inferred only from renewal ceasing,
|
|
5
|
-
* never from observing a tab close (which is not reliably observable).
|
|
6
|
-
* Renewal can extend nothing past an absolute expiry and can never mint
|
|
7
|
-
* or broaden authority — it only keeps an already-signed authorization
|
|
8
|
-
* usable (strategy rulings 1c/12).
|
|
9
|
-
*
|
|
10
|
-
* The state contract, exact (spec finding 11/18):
|
|
11
|
-
* - "expired" iff now >= absoluteExpiryAt — checked FIRST; renewal is
|
|
12
|
-
* irrelevant past the absolute wall.
|
|
13
|
-
* - a null beat (never renewed) is "lapsed".
|
|
14
|
-
* - a FUTURE beat is "lapsed": strict means strict — a clock that claims
|
|
15
|
-
* tomorrow proves nothing about presence now.
|
|
16
|
-
* - "live" iff now - lastBeatAt <= 20s (one 15s beat + 5s jitter).
|
|
17
|
-
* - "grace" iff now - lastBeatAt <= 45s (one missed beat, forgiven —
|
|
18
|
-
* background-tab throttling survives grace, not live).
|
|
19
|
-
* - otherwise "lapsed".
|
|
20
|
-
*
|
|
21
|
-
* Session COOKIE lifetimes (12h idle / 7d absolute in serve.ts) are a
|
|
22
|
-
* different thing and are untouched by all of this.
|
|
23
|
-
*/
|
|
24
|
-
export const BEAT_MS = 15_000;
|
|
25
|
-
/** live = one beat plus jitter. */
|
|
26
|
-
export const LIVE_MS = 20_000;
|
|
27
|
-
/** grace = one whole missed beat beyond live, forgiven. */
|
|
28
|
-
export const GRACE_MS = 45_000;
|
|
29
|
-
export function attendedLivenessState(lastBeatAt, now, absoluteExpiryAt) {
|
|
30
|
-
if (now >= absoluteExpiryAt)
|
|
31
|
-
return "expired";
|
|
32
|
-
if (lastBeatAt === null)
|
|
33
|
-
return "lapsed";
|
|
34
|
-
if (lastBeatAt > now)
|
|
35
|
-
return "lapsed";
|
|
36
|
-
const age = now - lastBeatAt;
|
|
37
|
-
if (age <= LIVE_MS)
|
|
38
|
-
return "live";
|
|
39
|
-
if (age <= GRACE_MS)
|
|
40
|
-
return "grace";
|
|
41
|
-
return "lapsed";
|
|
42
|
-
}
|
package/dist/pricing.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pinned build-model prices (tournament design v3, stage 1; the round-3
|
|
3
|
-
* findings are the spec). Integer micro-dollars per SINGLE token, rounded
|
|
4
|
-
* UP from list prices, with the cache token classes priced separately —
|
|
5
|
-
* finding 24: a "one call" tail computed from rates alone bounds nothing;
|
|
6
|
-
* quantity must be pinned too, so every model row carries its context
|
|
7
|
-
* window and maximum output, and the tail is the worst legal call:
|
|
8
|
-
* every context token at the DEAREST input class plus every output token.
|
|
9
|
-
*
|
|
10
|
-
* Conservative by construction: reservations overcharge, never under.
|
|
11
|
-
* PRICE_VERSION is stamped into approved tournament terms — a price table
|
|
12
|
-
* edit never silently reprices an existing approval.
|
|
13
|
-
*/
|
|
14
|
-
export declare const BUILD_PRICE_VERSION = 1;
|
|
15
|
-
export type BuildModelPrice = {
|
|
16
|
-
/** Micro-dollars per token, ceil'd from list. */
|
|
17
|
-
inMicrousd: number;
|
|
18
|
-
outMicrousd: number;
|
|
19
|
-
cacheWriteMicrousd: number;
|
|
20
|
-
cacheReadMicrousd: number;
|
|
21
|
-
/** The pinned request envelope's quantity bounds (finding 24). */
|
|
22
|
-
contextTokens: number;
|
|
23
|
-
maxOutputTokens: number;
|
|
24
|
-
};
|
|
25
|
-
export declare function buildPriceOf(model: string): BuildModelPrice | null;
|
|
26
|
-
export declare const PRICED_BUILD_MODELS: readonly string[];
|
|
27
|
-
/**
|
|
28
|
-
* The non-spendable overrun reserve: the worst one API call the pinned
|
|
29
|
-
* envelope permits. Claude's native cap checks the budget AFTER each
|
|
30
|
-
* call, so the true maximum is budget + one full call — this is that
|
|
31
|
-
* call, priced at the dearest input class (finding 24's arithmetic).
|
|
32
|
-
* Held apart from the spendable budget and NEVER granted to a later
|
|
33
|
-
* invocation: each lineage invocation's native cap derives from
|
|
34
|
-
* max(spendable − accounted, 0) alone.
|
|
35
|
-
*/
|
|
36
|
-
export declare function oneCallTailMicrousd(model: string): number | null;
|
|
37
|
-
/** Settlement at pinned rates from a usage report that itemizes cache
|
|
38
|
-
* classes; absent classes count as zero, absent totals fail closed by
|
|
39
|
-
* returning null (the caller latches unknown spend, never guesses). */
|
|
40
|
-
export declare function settleBuildMicrousd(model: string, usage: {
|
|
41
|
-
inputTokens?: number;
|
|
42
|
-
outputTokens?: number;
|
|
43
|
-
cacheWriteTokens?: number;
|
|
44
|
-
cacheReadTokens?: number;
|
|
45
|
-
}): number | null;
|
package/dist/pricing.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pinned build-model prices (tournament design v3, stage 1; the round-3
|
|
3
|
-
* findings are the spec). Integer micro-dollars per SINGLE token, rounded
|
|
4
|
-
* UP from list prices, with the cache token classes priced separately —
|
|
5
|
-
* finding 24: a "one call" tail computed from rates alone bounds nothing;
|
|
6
|
-
* quantity must be pinned too, so every model row carries its context
|
|
7
|
-
* window and maximum output, and the tail is the worst legal call:
|
|
8
|
-
* every context token at the DEAREST input class plus every output token.
|
|
9
|
-
*
|
|
10
|
-
* Conservative by construction: reservations overcharge, never under.
|
|
11
|
-
* PRICE_VERSION is stamped into approved tournament terms — a price table
|
|
12
|
-
* edit never silently reprices an existing approval.
|
|
13
|
-
*/
|
|
14
|
-
export const BUILD_PRICE_VERSION = 1;
|
|
15
|
-
const PRICES = {
|
|
16
|
-
"claude-sonnet-5": {
|
|
17
|
-
inMicrousd: 3,
|
|
18
|
-
outMicrousd: 15,
|
|
19
|
-
cacheWriteMicrousd: 4, // 1.25x input, ceil'd
|
|
20
|
-
cacheReadMicrousd: 1, // 0.1x input, ceil'd up
|
|
21
|
-
contextTokens: 200_000,
|
|
22
|
-
maxOutputTokens: 64_000,
|
|
23
|
-
},
|
|
24
|
-
"claude-opus-5": {
|
|
25
|
-
inMicrousd: 15,
|
|
26
|
-
outMicrousd: 75,
|
|
27
|
-
cacheWriteMicrousd: 19,
|
|
28
|
-
cacheReadMicrousd: 2,
|
|
29
|
-
contextTokens: 200_000,
|
|
30
|
-
maxOutputTokens: 32_000,
|
|
31
|
-
},
|
|
32
|
-
"claude-haiku-4-5": {
|
|
33
|
-
inMicrousd: 1,
|
|
34
|
-
outMicrousd: 5,
|
|
35
|
-
cacheWriteMicrousd: 2,
|
|
36
|
-
cacheReadMicrousd: 1,
|
|
37
|
-
contextTokens: 200_000,
|
|
38
|
-
maxOutputTokens: 64_000,
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
export function buildPriceOf(model) {
|
|
42
|
-
return PRICES[model] ?? null;
|
|
43
|
-
}
|
|
44
|
-
export const PRICED_BUILD_MODELS = Object.keys(PRICES);
|
|
45
|
-
/**
|
|
46
|
-
* The non-spendable overrun reserve: the worst one API call the pinned
|
|
47
|
-
* envelope permits. Claude's native cap checks the budget AFTER each
|
|
48
|
-
* call, so the true maximum is budget + one full call — this is that
|
|
49
|
-
* call, priced at the dearest input class (finding 24's arithmetic).
|
|
50
|
-
* Held apart from the spendable budget and NEVER granted to a later
|
|
51
|
-
* invocation: each lineage invocation's native cap derives from
|
|
52
|
-
* max(spendable − accounted, 0) alone.
|
|
53
|
-
*/
|
|
54
|
-
export function oneCallTailMicrousd(model) {
|
|
55
|
-
const price = buildPriceOf(model);
|
|
56
|
-
if (price === null)
|
|
57
|
-
return null;
|
|
58
|
-
const dearestInput = Math.max(price.inMicrousd, price.cacheWriteMicrousd, price.cacheReadMicrousd);
|
|
59
|
-
return price.contextTokens * dearestInput + price.maxOutputTokens * price.outMicrousd;
|
|
60
|
-
}
|
|
61
|
-
/** Settlement at pinned rates from a usage report that itemizes cache
|
|
62
|
-
* classes; absent classes count as zero, absent totals fail closed by
|
|
63
|
-
* returning null (the caller latches unknown spend, never guesses). */
|
|
64
|
-
export function settleBuildMicrousd(model, usage) {
|
|
65
|
-
const price = buildPriceOf(model);
|
|
66
|
-
if (price === null)
|
|
67
|
-
return null;
|
|
68
|
-
const { inputTokens, outputTokens } = usage;
|
|
69
|
-
if (inputTokens === undefined || outputTokens === undefined)
|
|
70
|
-
return null;
|
|
71
|
-
if (!Number.isFinite(inputTokens) || !Number.isFinite(outputTokens) || inputTokens < 0 || outputTokens < 0)
|
|
72
|
-
return null;
|
|
73
|
-
return (inputTokens * price.inMicrousd +
|
|
74
|
-
outputTokens * price.outMicrousd +
|
|
75
|
-
(usage.cacheWriteTokens ?? 0) * price.cacheWriteMicrousd +
|
|
76
|
-
(usage.cacheReadTokens ?? 0) * price.cacheReadMicrousd);
|
|
77
|
-
}
|
package/dist/routine.d.ts
DELETED
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Routines: standing orders that fire on a schedule (Phase C).
|
|
3
|
-
*
|
|
4
|
-
* A routine is a pre-approved template — goal, exclusions, touches,
|
|
5
|
-
* requirements, schedule, budget — whose approval is what makes every
|
|
6
|
-
* instance legitimately automatic. The template's digest covers EVERY term
|
|
7
|
-
* that constrains the standing order, not just the scope trio: a schedule
|
|
8
|
-
* moved from weekly to hourly, or a budget quietly removed, changes what the
|
|
9
|
-
* operator agreed to exactly as much as a rewritten goal would.
|
|
10
|
-
*
|
|
11
|
-
* The schedule algebra lives here, pure, because its two failure modes are
|
|
12
|
-
* subtle enough to deserve names (Codex planning/routines review, finding
|
|
13
|
-
* 10): advancing one interval after downtime leaves the next firing in the
|
|
14
|
-
* past — a catch-up burst; advancing to `now + interval` drifts the cadence
|
|
15
|
-
* forever. The rule is ALIGNED advancement: the next occurrence strictly
|
|
16
|
-
* after now, anchored to the occurrence that just fired (for `every`) or to
|
|
17
|
-
* the clock itself (for `daily`). Missed slots while nothing was running
|
|
18
|
-
* fire ONCE — the overdue occurrence — and are never backfilled.
|
|
19
|
-
*/
|
|
20
|
-
import { type Routine, type Store } from "./store.js";
|
|
21
|
-
import { type ExecutionProfile, type AcceptanceCriterion } from "./scope.js";
|
|
22
|
-
import { type PhaseRoute } from "./phase-routing.js";
|
|
23
|
-
export type Schedule = {
|
|
24
|
-
kind: "every";
|
|
25
|
-
minutes: number;
|
|
26
|
-
} | {
|
|
27
|
-
kind: "daily";
|
|
28
|
-
hhmm: string;
|
|
29
|
-
timezone?: string;
|
|
30
|
-
}
|
|
31
|
-
/** v96: Monday to Friday. */
|
|
32
|
-
| {
|
|
33
|
-
kind: "weekdays";
|
|
34
|
-
hhmm: string;
|
|
35
|
-
timezone?: string;
|
|
36
|
-
} | {
|
|
37
|
-
kind: "weekly";
|
|
38
|
-
day: number;
|
|
39
|
-
hhmm: string;
|
|
40
|
-
timezone?: string;
|
|
41
|
-
};
|
|
42
|
-
export declare const WEEKDAYS: readonly ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
|
|
43
|
-
export declare function validTimezone(value: string): boolean;
|
|
44
|
-
/** Bounds a person would pick on purpose: 5 minutes to 7 days. */
|
|
45
|
-
export declare const MIN_EVERY_MINUTES = 5;
|
|
46
|
-
export declare const MAX_EVERY_MINUTES: number;
|
|
47
|
-
/**
|
|
48
|
-
* Existing daily schedules remain UTC. Calendar schedules may name an IANA
|
|
49
|
-
* timezone, whose wall-clock time stays fixed across daylight saving changes.
|
|
50
|
-
* No cron expressions in v1 — a schedule the operator cannot read at a
|
|
51
|
-
* glance is a schedule they cannot honestly approve.
|
|
52
|
-
*/
|
|
53
|
-
export declare function parseSchedule(text: string): Schedule | null;
|
|
54
|
-
export declare function scheduleText(schedule: Schedule): string;
|
|
55
|
-
/** The schedule, in words an operator agrees to. */
|
|
56
|
-
export declare function describeSchedule(schedule: Schedule): string;
|
|
57
|
-
/**
|
|
58
|
-
* The first occurrence after approval: the schedule starts counting from the
|
|
59
|
-
* yes, because "approved at 14:07, every 60 minutes" firing instantly would
|
|
60
|
-
* spend before the approver's hand left the keyboard.
|
|
61
|
-
*/
|
|
62
|
-
export declare function firstFireAt(schedule: Schedule, now: Date): string;
|
|
63
|
-
/**
|
|
64
|
-
* Aligned advancement: the smallest cadence occurrence STRICTLY after now.
|
|
65
|
-
* `anchor` is the occurrence that just fired (or was just skipped) — the
|
|
66
|
-
* cadence grid grows from it, so a pass that ran late does not tilt every
|
|
67
|
-
* later firing by its lateness.
|
|
68
|
-
*/
|
|
69
|
-
export declare function nextFireAt(schedule: Schedule, anchorIso: string, now: Date): string;
|
|
70
|
-
/** Every term the digest must bind — a change to any is a different order. */
|
|
71
|
-
export type RoutineTerms = {
|
|
72
|
-
repo: string;
|
|
73
|
-
goal: string;
|
|
74
|
-
outOfScope: string | null;
|
|
75
|
-
touches: string[];
|
|
76
|
-
/** v39: the signed rubric every instance's scope copies forward, byte
|
|
77
|
-
* for byte, at fire time — never re-authored per firing. */
|
|
78
|
-
acceptance: AcceptanceCriterion[];
|
|
79
|
-
requirements: string[];
|
|
80
|
-
schedule: string;
|
|
81
|
-
singleFlight: boolean;
|
|
82
|
-
costCeilingUsd: number | null;
|
|
83
|
-
/** Per-instance dollar cap in micro-USD (v16); null = only the backstop. */
|
|
84
|
-
budgetPerRunMicrousd?: number | null;
|
|
85
|
-
};
|
|
86
|
-
/**
|
|
87
|
-
* The exact standing order an operator agreed to, as 128 bits. Same shape
|
|
88
|
-
* and length as a scope digest, and for the same reason: approval binds to
|
|
89
|
-
* this value, and editing any term strands the old yes.
|
|
90
|
-
*/
|
|
91
|
-
export declare function routineDigestOf(terms: RoutineTerms, profile?: ExecutionProfile | null, route?: PhaseRoute | null): string;
|
|
92
|
-
export type RoutineProblem = {
|
|
93
|
-
field: string;
|
|
94
|
-
problem: string;
|
|
95
|
-
};
|
|
96
|
-
/** Instance ids are `<name>-YYYYMMDD-HHMM`, so the name must be an id stem. */
|
|
97
|
-
export declare const ROUTINE_NAME: RegExp;
|
|
98
|
-
/**
|
|
99
|
-
* Fail closed on every field at once, like plan parsing: an operator fixing
|
|
100
|
-
* a routine definition should learn everything wrong in one round.
|
|
101
|
-
*/
|
|
102
|
-
export declare function validateRoutineTerms(terms: RoutineTerms, options?: {
|
|
103
|
-
/** The STORED row's name (final authority closure): validated with the
|
|
104
|
-
* terms wherever a stored routine is read back, so a raw name this
|
|
105
|
-
* code never files — one no instance id could be stamped from — is
|
|
106
|
-
* as invalid as an empty rubric, and no door moves on it. */
|
|
107
|
-
name?: string;
|
|
108
|
-
}): RoutineProblem[];
|
|
109
|
-
/** The stored row's terms, for re-proving the digest against what is actually there. */
|
|
110
|
-
export declare function termsOf(routine: Routine): RoutineTerms;
|
|
111
|
-
/** The instance task id: the routine's name stamped with its scheduled slot. */
|
|
112
|
-
export declare function instanceId(name: string, scheduledForIso: string): string;
|
|
113
|
-
/** The rolling budget window: seven days, and every surface says so. */
|
|
114
|
-
export declare const BUDGET_WINDOW_MS: number;
|
|
115
|
-
export type ApproveRoutineResult = {
|
|
116
|
-
ok: true;
|
|
117
|
-
routine: Routine;
|
|
118
|
-
} | {
|
|
119
|
-
ok: false;
|
|
120
|
-
reason: "no-such-routine" | "profile-unresolved" | "changed" | "no-approvers" | "not-an-approver" | "requester";
|
|
121
|
-
};
|
|
122
|
-
/**
|
|
123
|
-
* A person agrees to the standing order — schedule, budget, and "each
|
|
124
|
-
* firing builds without asking" included, because the digest binds them.
|
|
125
|
-
* Same ceremony as a scope approval: credential re-proved inside the same
|
|
126
|
-
* transaction as the write, digest named rather than assumed.
|
|
127
|
-
*/
|
|
128
|
-
export declare function approveRoutine(store: Store, routineId: number, by: string, now: Date, sawDigest: string, token: string): ApproveRoutineResult;
|
|
129
|
-
export type FireOutcome = {
|
|
130
|
-
ok: true;
|
|
131
|
-
taskId: string;
|
|
132
|
-
scheduledFor: string;
|
|
133
|
-
} | {
|
|
134
|
-
ok: false;
|
|
135
|
-
reason: "no-such-routine" | "not-approved" | "paused" | "not-due" | "bad-schedule" | "slot-taken" | "single-flight" | "budget" | "unmeasured" | "route-unfrozen";
|
|
136
|
-
detail?: string;
|
|
137
|
-
};
|
|
138
|
-
export declare function fireRoutine(store: Store, routineId: number, now: Date, options?: {
|
|
139
|
-
manual?: boolean;
|
|
140
|
-
}): FireOutcome;
|
|
141
|
-
/**
|
|
142
|
-
* THE AGENTS A STANDING ORDER HOLDS (v48), as one honest word per state,
|
|
143
|
-
* read by every surface — the routine page, the CLI, the firing:
|
|
144
|
-
*
|
|
145
|
-
* frozen — approved, and the approval's snapshot reads back exact;
|
|
146
|
-
* pending — filed with an exact route, awaiting the yes (or the yes
|
|
147
|
-
* went stale on an edit);
|
|
148
|
-
* unfrozen — approved BEFORE agents were frozen: the approval stands
|
|
149
|
-
* on its terms but no firing can run until the agents are
|
|
150
|
-
* refreshed and the order approved again;
|
|
151
|
-
* unreadable — the row carries route or profile bytes that do not read
|
|
152
|
-
* back (corrupt): nothing approves or fires;
|
|
153
|
-
* unresolved — filed under a configuration that could not name an
|
|
154
|
-
* exact agent for every role (or whose route carries a
|
|
155
|
-
* stated problem): refresh once the agents are configured.
|
|
156
|
-
*
|
|
157
|
-
* `refresh` says whether the one recovery road — re-resolve the agents
|
|
158
|
-
* from today's configuration and approve again — applies.
|
|
159
|
-
*/
|
|
160
|
-
export type RoutineAgentsState = {
|
|
161
|
-
state: "frozen" | "pending" | "unfrozen" | "unreadable" | "unverified" | "unresolved";
|
|
162
|
-
approvable: boolean;
|
|
163
|
-
refresh: boolean;
|
|
164
|
-
problem: string | null;
|
|
165
|
-
};
|
|
166
|
-
/**
|
|
167
|
-
* THE ONE INTEGRITY PROJECTION (v48 authority repair): every question about a standing
|
|
168
|
-
* order's agents — what the page says, whether a yes may be minted,
|
|
169
|
-
* whether an approval may land, whether a firing may proceed — is answered
|
|
170
|
-
* from this one reading of the row, computed BEFORE any mutation and never
|
|
171
|
-
* from a column alone.
|
|
172
|
-
*
|
|
173
|
-
* approved the stamp exists, the digest column matches the stored terms'
|
|
174
|
-
* digest, and that digest re-derives from the stored terms,
|
|
175
|
-
* working profile, and working route (a column rewritten under
|
|
176
|
-
* a reused digest is not an approval).
|
|
177
|
-
* live the approval stands AND its frozen snapshot is whole: both
|
|
178
|
-
* snapshot columns read back, they hash with the stored terms to
|
|
179
|
-
* the very digest the approver signed, no leg states a problem,
|
|
180
|
-
* and the build and repair legs are the sealed profile's exact
|
|
181
|
-
* pairs. Only a live approval fires; nothing else does.
|
|
182
|
-
* agents the word every surface uses, with whether a yes could bind
|
|
183
|
-
* (`approvable`) and whether the one recovery road applies
|
|
184
|
-
* (`refresh`).
|
|
185
|
-
*/
|
|
186
|
-
export type RoutineIntegrity = {
|
|
187
|
-
approved: boolean;
|
|
188
|
-
live: boolean;
|
|
189
|
-
/** Why the approval is not live, when it is not — in words a page can show. */
|
|
190
|
-
liveProblem: string | null;
|
|
191
|
-
agents: RoutineAgentsState;
|
|
192
|
-
};
|
|
193
|
-
/** The FULL row (v48 integrity): every term the digest binds, both
|
|
194
|
-
* snapshot pairs, and the unreadable flags. There is no partial
|
|
195
|
-
* projection — a reading that skipped the re-derivation could call a
|
|
196
|
-
* rewritten row approved. */
|
|
197
|
-
type IntegrityRow = Routine;
|
|
198
|
-
export declare function routineIntegrity(routine: IntegrityRow): RoutineIntegrity;
|
|
199
|
-
/** The agents word every surface uses — one reading of the projection. */
|
|
200
|
-
export declare function routineAgentsState(routine: IntegrityRow): RoutineAgentsState;
|
|
201
|
-
export type RefreshRoutineResult = {
|
|
202
|
-
ok: true;
|
|
203
|
-
routine: Routine;
|
|
204
|
-
changed: boolean;
|
|
205
|
-
} | {
|
|
206
|
-
ok: false;
|
|
207
|
-
reason: "no-such-routine" | "unresolved";
|
|
208
|
-
problem: string;
|
|
209
|
-
};
|
|
210
|
-
/**
|
|
211
|
-
* THE RECOVERY ROAD (v48): re-resolve a standing order's agents — the
|
|
212
|
-
* four-role route and the profile that restates its build and repair legs
|
|
213
|
-
* — from today's configuration, and file them as the order's WORKING
|
|
214
|
-
* agents under a digest that binds them. Nothing is approved here: a
|
|
215
|
-
* refreshed order reads "edited — approve again", the approver reads the
|
|
216
|
-
* exact agents it now names and agrees to them with the password, and
|
|
217
|
-
* only that yes freezes the snapshot a firing copies. A routine whose
|
|
218
|
-
* terms already bind these exact agents is left byte-for-byte alone.
|
|
219
|
-
* A configuration that still cannot name an exact, runnable agent for
|
|
220
|
-
* every role answers with the words and changes nothing.
|
|
221
|
-
*/
|
|
222
|
-
export declare function refreshRoutineAgents(store: Store, routineId: number, now: Date): RefreshRoutineResult;
|
|
223
|
-
/** The standing order, in the words an operator has to agree to. */
|
|
224
|
-
export declare function describeRoutine(routine: Routine): string[];
|
|
225
|
-
/** The agents a standing order's approval freezes, in the same words the
|
|
226
|
-
* task page and chat use — or why it cannot say. */
|
|
227
|
-
export declare function routineAgentsWords(routine: Routine): string[];
|
|
228
|
-
export {};
|