@intentic/sandbox-contract 1.369.0 → 1.371.0
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/dist/contracts/agent.contract.d.ts +9 -0
- package/dist/contracts/agent.contract.d.ts.map +1 -1
- package/dist/contracts/agents.contract.d.ts +2 -0
- package/dist/contracts/agents.contract.d.ts.map +1 -1
- package/dist/contracts/ci.contract.d.ts +2 -0
- package/dist/contracts/ci.contract.d.ts.map +1 -1
- package/dist/contracts/runner.contract.d.ts +29 -0
- package/dist/contracts/runner.contract.d.ts.map +1 -1
- package/dist/contracts/sessions.contract.d.ts +1 -0
- package/dist/contracts/sessions.contract.d.ts.map +1 -1
- package/dist/contracts/system.contract.d.ts +3 -0
- package/dist/contracts/system.contract.d.ts.map +1 -1
- package/dist/events/agent-events.d.ts +16 -0
- package/dist/events/agent-events.d.ts.map +1 -1
- package/dist/events/agent-events.js +2 -0
- package/dist/events/agent-events.js.map +1 -1
- package/dist/events/agent-transcript.d.ts +1 -0
- package/dist/events/agent-transcript.d.ts.map +1 -1
- package/dist/events/agent-words.d.ts +1 -0
- package/dist/events/agent-words.d.ts.map +1 -1
- package/dist/events/agent-words.js +9 -1
- package/dist/events/agent-words.js.map +1 -1
- package/dist/events/refusal-incidents.d.ts +13 -0
- package/dist/events/refusal-incidents.d.ts.map +1 -0
- package/dist/events/refusal-incidents.js +57 -0
- package/dist/events/refusal-incidents.js.map +1 -0
- package/dist/events/sandbox-notice.d.ts +27 -0
- package/dist/events/sandbox-notice.d.ts.map +1 -1
- package/dist/events/sandbox-notice.js +15 -0
- package/dist/events/sandbox-notice.js.map +1 -1
- package/dist/events/system-events.d.ts +2 -0
- package/dist/events/system-events.d.ts.map +1 -1
- package/dist/events/system-events.js +1 -0
- package/dist/events/system-events.js.map +1 -1
- package/dist/events/transcript.d.ts +6 -0
- package/dist/events/transcript.d.ts.map +1 -1
- package/dist/events/transcript.js +1 -0
- package/dist/events/transcript.js.map +1 -1
- package/dist/index.d.ts +47 -30
- package/dist/index.d.ts.map +1 -1
- package/dist/models/plan-pools.d.ts +6 -5
- package/dist/models/plan-pools.d.ts.map +1 -1
- package/dist/models/plan-pools.js +10 -6
- package/dist/models/plan-pools.js.map +1 -1
- package/dist/protocol/sse.d.ts.map +1 -1
- package/dist/protocol/sse.js +35 -17
- package/dist/protocol/sse.js.map +1 -1
- package/dist/schemas/ci.d.ts +2 -0
- package/dist/schemas/ci.d.ts.map +1 -1
- package/dist/schemas/ci.js +10 -0
- package/dist/schemas/ci.js.map +1 -1
- package/dist/schemas/providers/plan-limits.js +1 -1
- package/dist/schemas/providers/plan-limits.js.map +1 -1
- package/dist/schemas/providers/switched.d.ts +30 -0
- package/dist/schemas/providers/switched.d.ts.map +1 -0
- package/dist/schemas/providers/switched.js +45 -0
- package/dist/schemas/providers/switched.js.map +1 -0
- package/dist/schemas/workspace/name-order.d.ts +9 -0
- package/dist/schemas/workspace/name-order.d.ts.map +1 -0
- package/dist/schemas/workspace/name-order.js +4 -0
- package/dist/schemas/workspace/name-order.js.map +1 -0
- package/dist/state/fix-stance.d.ts.map +1 -1
- package/dist/state/fix-stance.js +8 -0
- package/dist/state/fix-stance.js.map +1 -1
- package/dist/text/notice-rows.d.ts +7 -1
- package/dist/text/notice-rows.d.ts.map +1 -1
- package/dist/text/notice-rows.js +15 -0
- package/dist/text/notice-rows.js.map +1 -1
- package/dist/text/transcript-fold.d.ts.map +1 -1
- package/dist/text/transcript-fold.js +4 -5
- package/dist/text/transcript-fold.js.map +1 -1
- package/package.json +5 -5
- package/src/events/agent-events.ts +3 -0
- package/src/events/agent-words.test.ts +7 -0
- package/src/events/agent-words.ts +14 -1
- package/src/events/refusal-incidents.ts +109 -0
- package/src/events/sandbox-notice.ts +23 -0
- package/src/events/system-events.ts +4 -0
- package/src/events/transcript.ts +1 -0
- package/src/models/plan-pools.test.ts +13 -0
- package/src/models/plan-pools.ts +30 -10
- package/src/protocol/sse.test.ts +45 -1
- package/src/protocol/sse.ts +38 -19
- package/src/schemas/ci.ts +14 -0
- package/src/schemas/providers/plan-limits.ts +1 -1
- package/src/schemas/providers/switched.test.ts +46 -0
- package/src/schemas/providers/switched.ts +72 -0
- package/src/schemas/workspace/name-order.test.ts +30 -0
- package/src/schemas/workspace/name-order.ts +18 -0
- package/src/state/fix-stance.test.ts +15 -0
- package/src/state/fix-stance.ts +11 -0
- package/src/text/notice-rows.ts +28 -3
- package/src/text/transcript-fold.test.ts +115 -1
- package/src/text/transcript-fold.ts +6 -7
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { TranscriptRow } from "./transcript.js";
|
|
2
|
+
import { type SandboxNotice, sandboxNoticeOf } from "./sandbox-notice.js";
|
|
3
|
+
|
|
4
|
+
/* ONE PROBLEM, ONE ROW. A turn refused before it ran leaves a row per attempt: the refusal, the "Sent again" its re-send
|
|
5
|
+
opens with, the same refusal again, and at last the move that got it through. Each row is true, and together they
|
|
6
|
+
read as a pile: one disabled organization drew nine of them on 2026-10-28, with the provider's sentence twice and a
|
|
7
|
+
bright press that would have sent the message into the same wall a third time. This finds those runs, so a reader
|
|
8
|
+
draws each one as a single row (its last: the move that resolved it, the re-send in flight, or the refusal still
|
|
9
|
+
standing) with every attempt behind its details.
|
|
10
|
+
|
|
11
|
+
The rows stay as they are in the record: the run is found again wherever it is drawn, so nothing about a stored
|
|
12
|
+
transcript, a rewind index or a fork changes. Only rows next to each other fold. A row between them (the person's
|
|
13
|
+
own message, a rebase, a different refusal) ends the run, since it is part of the story the reader is owed. */
|
|
14
|
+
|
|
15
|
+
/** One refused attempt an incident folds: when it was refused, and the provider's own sentence for it. */
|
|
16
|
+
export interface IncidentAttempt {
|
|
17
|
+
readonly at?: number;
|
|
18
|
+
readonly said: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** A run of rows saying one refusal. The row at `to` is the one drawn; the rows from `from` up to it fold into it. */
|
|
22
|
+
export interface TranscriptIncident {
|
|
23
|
+
readonly from: number;
|
|
24
|
+
readonly to: number;
|
|
25
|
+
// Oldest first, one per refusal the run holds.
|
|
26
|
+
readonly attempts: readonly IncidentAttempt[];
|
|
27
|
+
// The run ended on the move (or a person's switch) that got the turn through, rather than on a refusal or a re-send.
|
|
28
|
+
readonly resolved: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
type Refusal = Extract<SandboxNotice, { code: "kept" | "undelivered" | "failed" }>;
|
|
32
|
+
|
|
33
|
+
const REFUSALS: ReadonlySet<string> = new Set(["kept", "undelivered", "failed"]);
|
|
34
|
+
|
|
35
|
+
// The row's notice code where it is one of `codes`.
|
|
36
|
+
const codeOf = (row: TranscriptRow, codes: ReadonlySet<string>): string | undefined => {
|
|
37
|
+
const code = row.role === "notice" ? row.noticeCode?.code : undefined;
|
|
38
|
+
return code !== undefined && codes.has(code) ? code : undefined;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const RESUMED: ReadonlySet<string> = new Set(["resumed"]);
|
|
42
|
+
const MOVED: ReadonlySet<string> = new Set(["accountMoved"]);
|
|
43
|
+
|
|
44
|
+
// A refusal, the kind of row that repeats once per press: one that ran nothing (kept, or handed back undelivered), or a
|
|
45
|
+
// coded failure with nothing run between it and the next (a provider refusing an account it no longer serves comes
|
|
46
|
+
// back as one of these, account-not-entitled). A memory hold is not one: it is asked once a spell, and draws a row of
|
|
47
|
+
// its own (NoticeMemory in the editor).
|
|
48
|
+
const refusalOf = (row: TranscriptRow): Refusal | undefined => {
|
|
49
|
+
// The code alone first: a reader asks this of every row on every frame of a streamed turn, and parsing a row's facts
|
|
50
|
+
// is only worth it for the few that can be one.
|
|
51
|
+
const notice = codeOf(row, REFUSALS) === undefined ? undefined : sandboxNoticeOf(row);
|
|
52
|
+
if (notice?.code !== "kept" && notice?.code !== "undelivered" && (notice?.code !== "failed" || notice.params.error === undefined)) {
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
const memory = notice.params.error === "sandbox-memory-low" || (notice.code === "kept" && notice.params.memory === true);
|
|
56
|
+
return memory ? undefined : notice;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
// The same refusal again: the same failure code, or for a failure nobody coded, the same words.
|
|
60
|
+
const sameRefusal = (first: Refusal, again: Refusal): boolean =>
|
|
61
|
+
first.params.error === undefined ? again.params.error === undefined && again.params.message === first.params.message : again.params.error === first.params.error;
|
|
62
|
+
|
|
63
|
+
// The re-send of a turn nothing of which ran, as its opening row says it.
|
|
64
|
+
const resent = (row: TranscriptRow): boolean => {
|
|
65
|
+
const notice = codeOf(row, RESUMED) === undefined ? undefined : sandboxNoticeOf(row);
|
|
66
|
+
return notice?.code === "resumed" && (notice.params.reason === "door" || notice.params.reason === "refused");
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const movedOn = (row: TranscriptRow): boolean => codeOf(row, MOVED) !== undefined;
|
|
70
|
+
|
|
71
|
+
const attemptOf = (row: TranscriptRow, refusal: Refusal): IncidentAttempt =>
|
|
72
|
+
row.openedAt === undefined ? { said: refusal.params.message } : { at: row.openedAt, said: refusal.params.message };
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Every run of rows that says one refusal, in order. `resolves` names the reader's own rows that end one (the editor's
|
|
76
|
+
* line for an account a person switched to); the sandbox's own move (`accountMoved`) always does. A lone refusal is no
|
|
77
|
+
* run, and is drawn as itself.
|
|
78
|
+
*/
|
|
79
|
+
export const transcriptIncidents = <R extends TranscriptRow>(rows: readonly R[], resolves: (row: R) => boolean = () => false): TranscriptIncident[] => {
|
|
80
|
+
const found: TranscriptIncident[] = [];
|
|
81
|
+
let index = 0;
|
|
82
|
+
while (index < rows.length) {
|
|
83
|
+
const first = refusalOf(rows[index]!);
|
|
84
|
+
if (first === undefined) {
|
|
85
|
+
index += 1;
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
const attempts = [attemptOf(rows[index]!, first)];
|
|
89
|
+
let to = index;
|
|
90
|
+
let resolved = false;
|
|
91
|
+
for (let next = index + 1; next < rows.length && !resolved; next += 1) {
|
|
92
|
+
const row = rows[next]!;
|
|
93
|
+
const again = refusalOf(row);
|
|
94
|
+
if (again !== undefined && sameRefusal(first, again)) {
|
|
95
|
+
attempts.push(attemptOf(row, again));
|
|
96
|
+
} else if (movedOn(row) || resolves(row)) {
|
|
97
|
+
resolved = true;
|
|
98
|
+
} else if (!resent(row)) {
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
to = next;
|
|
102
|
+
}
|
|
103
|
+
if (to > index) {
|
|
104
|
+
found.push({ from: index, to, attempts, resolved });
|
|
105
|
+
}
|
|
106
|
+
index = to + 1;
|
|
107
|
+
}
|
|
108
|
+
return found;
|
|
109
|
+
};
|
|
@@ -124,6 +124,29 @@ export const SandboxNoticeSchema = z.discriminatedUnion("code", [
|
|
|
124
124
|
summarized: z.boolean(),
|
|
125
125
|
}),
|
|
126
126
|
}),
|
|
127
|
+
// A turn that went out on another provider, account, loop or model than the conversation's turn before it
|
|
128
|
+
// (schemas/providers/switched.ts SwitchedSchema): `segment` what changed, `provider` the one it runs on now (an id),
|
|
129
|
+
// `model` its model's id, `account` what the account is called in the sandbox, `loop` what its loop is called, and
|
|
130
|
+
// `fresh` false where it went on in the same session on another model.
|
|
131
|
+
z.object({
|
|
132
|
+
code: z.literal("switched"),
|
|
133
|
+
params: z.object({
|
|
134
|
+
segment: z.enum(["provider", "account", "loop", "model"]),
|
|
135
|
+
provider: z.string(),
|
|
136
|
+
model: z.string().optional(),
|
|
137
|
+
account: z.string().optional(),
|
|
138
|
+
loop: z.string().optional(),
|
|
139
|
+
fresh: z.boolean(),
|
|
140
|
+
}),
|
|
141
|
+
}),
|
|
142
|
+
// The conversation moved to another account of its provider before its turn ran (the daemon's turn-plan.ts), why:
|
|
143
|
+
// the account could not serve it (`refused`: its plan or organization does not allow it), the people it works for may
|
|
144
|
+
// not use it (`reach`), or its cache had expired and another account had clearly more room (`cold`). `from` and `to`
|
|
145
|
+
// are the accounts' own names, never ids; `said` is the provider's own sentence a refusal came with.
|
|
146
|
+
z.object({
|
|
147
|
+
code: z.literal("accountMoved"),
|
|
148
|
+
params: z.object({ why: z.enum(["refused", "reach", "cold"]), from: z.string(), to: z.string(), said: z.string().optional() }),
|
|
149
|
+
}),
|
|
127
150
|
// An agent's own dependency install starting: into its conversation's own copy (`ownCopy`) or the main tree; the
|
|
128
151
|
// workspace root (`root`) and up to three project folders named (`projects`, each with its slash, already joined),
|
|
129
152
|
// and how many `more` were not named.
|
|
@@ -75,6 +75,10 @@ export const HelloSchema = z.object({
|
|
|
75
75
|
// (_devices/local-files), whose `routes` are the few a folder has rather than a daemon's missing ones. Absent reads
|
|
76
76
|
// as a sandbox, which every daemon before this field was.
|
|
77
77
|
surface: z.enum(["sandbox", "folder"]).optional(),
|
|
78
|
+
// True when this daemon writes a `switched` notice (schemas/providers/switched.ts) on every turn that goes out on
|
|
79
|
+
// another provider, account, loop or model than the turn before it, so the conversation's record says so for every
|
|
80
|
+
// window. Absent is a daemon from before the field, whose editor must keep drawing the divider itself.
|
|
81
|
+
recordsSwitches: z.boolean().optional(),
|
|
78
82
|
});
|
|
79
83
|
export type Hello = z.infer<typeof HelloSchema>;
|
|
80
84
|
|
package/src/events/transcript.ts
CHANGED
|
@@ -239,6 +239,7 @@ export const TranscriptAgentWordsSchema = z.object({
|
|
|
239
239
|
from: z.string().describe("The sending conversation's id."),
|
|
240
240
|
title: z.string().optional().describe("The sender's title, when it had one."),
|
|
241
241
|
failed: z.boolean().optional().describe("A child's report on a turn that failed rather than finished."),
|
|
242
|
+
machine: z.string().optional().describe("The runner a child's turn ran on; absent for a child that ran in this sandbox."),
|
|
242
243
|
sent: z.string().describe("The whole prompt the model received, disclosed under the row."),
|
|
243
244
|
});
|
|
244
245
|
export type TranscriptAgentWords = z.infer<typeof TranscriptAgentWordsSchema>;
|
|
@@ -449,6 +449,19 @@ test("an account at the line is tried after an unmeasured one and before a spent
|
|
|
449
449
|
expect(roomiestAccount([entry("line", atLine), entry("low", { kind: "ready", room: 2 })])?.id).toBe("low");
|
|
450
450
|
});
|
|
451
451
|
|
|
452
|
+
// The 2026-10-27/28 account: switched off, served for an evening (most room on its reading), switched off again.
|
|
453
|
+
test("an account its organisation keeps switching off goes behind every steady one of its tier, never behind a worse tier", () => {
|
|
454
|
+
const entry = (id: string, state: AccountState, flapping?: boolean) => ({ id, state, flapping });
|
|
455
|
+
const flapping = entry("flapping", { kind: "ready", room: 90 }, true);
|
|
456
|
+
expect(preferredAccount([flapping, entry("steady", { kind: "ready", room: 5 })])?.id).toBe("steady");
|
|
457
|
+
expect(roomiestAccount([flapping, entry("steady", { kind: "ready", room: 5 }, false)])?.id).toBe("steady");
|
|
458
|
+
expect(preferredAccount([flapping, entry("unread", { kind: "unknown" }), entry("line", { kind: "ready", room: 0 })])?.id).toBe("flapping");
|
|
459
|
+
expect(roomiestAccount([flapping, entry("line", { kind: "ready", room: 0 })])?.id).toBe("flapping");
|
|
460
|
+
// Among flapping accounts, room decides again.
|
|
461
|
+
expect(preferredAccount([flapping, entry("roomier", { kind: "ready", room: 95 }, true)])?.id).toBe("roomier");
|
|
462
|
+
expect(preferredAccount([entry("off", { kind: "unknown" }, true), entry("on", { kind: "unknown" })])?.id).toBe("on");
|
|
463
|
+
});
|
|
464
|
+
|
|
452
465
|
// A reading covers what its pools gate, and nothing more: a model no pool names is unknown, never covered by the rest.
|
|
453
466
|
test("names the served models no pool covers, and none when a pool gates every model", () => {
|
|
454
467
|
const sliced = usage(window({ kind: "google:3p-weekly", utilization: 100, gates: { models: ["claude", "gpt"] } }));
|
package/src/models/plan-pools.ts
CHANGED
|
@@ -561,20 +561,40 @@ const preference = (state: AccountState): number => {
|
|
|
561
561
|
}
|
|
562
562
|
};
|
|
563
563
|
|
|
564
|
-
/**
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
564
|
+
/** What a pick reads of an account: its verdict, and whether its organisation keeps switching it off. */
|
|
565
|
+
interface RankedAccount {
|
|
566
|
+
readonly state: AccountState;
|
|
567
|
+
// Refused its entitlement twice or more in the last week (the daemon's usage/entitlement-history.ts). Absent: steady.
|
|
568
|
+
readonly flapping?: boolean | undefined;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
/* A FLAPPING ACCOUNT RANKS BEHIND EVERY STEADY ONE OF ITS TIER, whatever its room, for the week after it serves again.
|
|
572
|
+
Claude account d8561075…'s organisation switched Claude Code off at 2026-10-27 08:44, let it serve from 21:17 to
|
|
573
|
+
00:39, and switched it off again at 10-28 08:48. Each time it served, the answered turn settled its refusal, its
|
|
574
|
+
reading showed the most room, and the pick put the next turns back on it until it was refused again. The tier still
|
|
575
|
+
comes first: a flapping account with proven room beats an unmeasured, spent or blocked one. */
|
|
576
|
+
const ranksAbove = (next: RankedAccount, best: RankedAccount): boolean => {
|
|
577
|
+
const tier = preference(next.state) - preference(best.state);
|
|
578
|
+
if (tier !== 0) {
|
|
579
|
+
return tier < 0;
|
|
580
|
+
}
|
|
581
|
+
if ((next.flapping === true) !== (best.flapping === true)) {
|
|
582
|
+
return best.flapping === true;
|
|
583
|
+
}
|
|
584
|
+
return next.state.kind === "ready" && best.state.kind === "ready" && next.state.room > best.state.room;
|
|
585
|
+
};
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* The account an unnamed turn runs on: ready by most room, then unmeasured, then at the line, then spent, blocked only
|
|
589
|
+
* when that is all there is; within each, a flapping account after the steady ones. Ties keep the caller's order.
|
|
590
|
+
*/
|
|
591
|
+
export const preferredAccount = <T extends RankedAccount>(entries: readonly T[]): T | undefined =>
|
|
592
|
+
entries.reduce<T | undefined>((best, next) => (best === undefined || ranksAbove(next, best) ? next : best), undefined);
|
|
573
593
|
|
|
574
594
|
/**
|
|
575
595
|
* The roomiest account with proven room, or none: what a move off a refused account may land on. Ties keep the caller's
|
|
576
596
|
* order. An account at the line is left out: a move there could be refused in turn, and two such accounts would hand the
|
|
577
597
|
* turn back and forth.
|
|
578
598
|
*/
|
|
579
|
-
export const roomiestAccount = <T extends
|
|
599
|
+
export const roomiestAccount = <T extends RankedAccount>(entries: readonly T[]): T | undefined =>
|
|
580
600
|
preferredAccount(entries.filter((entry) => entry.state.kind === "ready" && entry.state.room > 0));
|
package/src/protocol/sse.test.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parseSseText, type SseEvent, sseData, sseEvents, sseFrames, sseJson } from "./sse.js";
|
|
1
|
+
import { createSseParser, parseSseText, type SseEvent, sseData, sseEvents, sseFrames, sseJson } from "./sse.js";
|
|
2
2
|
|
|
3
3
|
const encoder = new TextEncoder();
|
|
4
4
|
|
|
@@ -96,3 +96,47 @@ it("ends an event stream that goes silent past the idle window", async () => {
|
|
|
96
96
|
it("sseJson reads a parsed event's data", () => {
|
|
97
97
|
expect([sseJson(parseSseText(`data: [1]\n\n`)[0]!), sseJson(parseSseText(`: c\n\n`)[0]!)]).toEqual([[1], undefined]);
|
|
98
98
|
});
|
|
99
|
+
|
|
100
|
+
it("preserves events and raw text at every chunk boundary, including a pending CR at EOF", () => {
|
|
101
|
+
for (const text of [
|
|
102
|
+
`\uFEFF: hello\r\nid: 7\revent: turn\ndata: first\r\ndata: second\r\n\r\ndata: last`,
|
|
103
|
+
`data: first\r\rdata: second\r`,
|
|
104
|
+
`data: first\r\n\r\n`,
|
|
105
|
+
`\r\r\n\n`,
|
|
106
|
+
]) {
|
|
107
|
+
const expected = parseSseText(text);
|
|
108
|
+
for (let cut = 0; cut <= text.length; cut += 1) {
|
|
109
|
+
const events: SseEvent[] = [];
|
|
110
|
+
const parser = createSseParser((event) => events.push(event));
|
|
111
|
+
parser.feed(text.slice(0, cut));
|
|
112
|
+
parser.feed(``);
|
|
113
|
+
parser.feed(text.slice(cut));
|
|
114
|
+
parser.end();
|
|
115
|
+
expect(events).toEqual(expected);
|
|
116
|
+
}
|
|
117
|
+
expect(expected.map((event) => event.raw).join(``)).toBe(text);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it("collects a long data line from many fragments, then resets for the next event", () => {
|
|
122
|
+
const value = `a𐐀b`.repeat(20_000);
|
|
123
|
+
const text = `data: ${value}\r\n\r\ndata: next\n\n`;
|
|
124
|
+
const events: SseEvent[] = [];
|
|
125
|
+
const parser = createSseParser((event) => events.push(event));
|
|
126
|
+
for (let at = 0; at < text.length; at += 13) {
|
|
127
|
+
parser.feed(text.slice(at, at + 13));
|
|
128
|
+
}
|
|
129
|
+
parser.end();
|
|
130
|
+
|
|
131
|
+
expect(events.map((event) => event.data)).toEqual([value, `next`]);
|
|
132
|
+
expect(events.map((event) => event.raw).join(``)).toBe(text);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it("keeps every data line of a large multiline event and starts the next event cleanly", () => {
|
|
136
|
+
const values = Array.from({ length: 16_000 }, (_, index) => `value ${index}`);
|
|
137
|
+
const raw = `${values.map((value) => `data: ${value}\n`).join(``)}\n`;
|
|
138
|
+
const events = parseSseText(`${raw}data: next\n\n`);
|
|
139
|
+
|
|
140
|
+
expect(events.map((event) => event.data)).toEqual([values.join(`\n`), `next`]);
|
|
141
|
+
expect(events[0]?.raw).toBe(raw);
|
|
142
|
+
});
|
package/src/protocol/sse.ts
CHANGED
|
@@ -42,9 +42,10 @@ const fresh = (): Pending => ({ raw: ``, name: undefined, data: undefined, retry
|
|
|
42
42
|
// Every block is dispatched, a comment-only one too, so a reader forwarding the stream loses nothing; a reader of
|
|
43
43
|
// messages skips the ones whose `data` is undefined.
|
|
44
44
|
export const createSseParser = (dispatch: (event: SseEvent) => void): SseParser => {
|
|
45
|
-
|
|
46
|
-
//
|
|
47
|
-
|
|
45
|
+
// Keep an incomplete line in pieces: concatenating it on each feed makes the next regexp flatten and copy all
|
|
46
|
+
// earlier chunks again. Only scan new text, and join a line once its terminator arrives.
|
|
47
|
+
const fragments: string[] = [];
|
|
48
|
+
let pendingCr = false;
|
|
48
49
|
let started = false;
|
|
49
50
|
let lastId: string | undefined;
|
|
50
51
|
let pending = fresh();
|
|
@@ -58,7 +59,8 @@ export const createSseParser = (dispatch: (event: SseEvent) => void): SseParser
|
|
|
58
59
|
if (name === `event`) {
|
|
59
60
|
pending.name = value;
|
|
60
61
|
} else if (name === `data`) {
|
|
61
|
-
pending.data
|
|
62
|
+
pending.data ??= [];
|
|
63
|
+
pending.data.push(value);
|
|
62
64
|
} else if (name === `id` && !value.includes(`\0`)) {
|
|
63
65
|
lastId = value;
|
|
64
66
|
} else if (name === `retry` && /^\d+$/.test(value)) {
|
|
@@ -79,20 +81,31 @@ export const createSseParser = (dispatch: (event: SseEvent) => void): SseParser
|
|
|
79
81
|
field(colon < 0 ? text : text.slice(0, colon), colon < 0 ? `` : text.slice(colon + (text.charAt(colon + 1) === ` ` ? 2 : 1)));
|
|
80
82
|
};
|
|
81
83
|
|
|
82
|
-
const
|
|
84
|
+
const finishLine = (text: string, terminator: string): void => {
|
|
85
|
+
let whole = text;
|
|
86
|
+
if (fragments.length > 0) {
|
|
87
|
+
whole = fragments.join(``) + text;
|
|
88
|
+
fragments.length = 0;
|
|
89
|
+
}
|
|
90
|
+
line(whole, terminator);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const lines = (text: string): void => {
|
|
83
94
|
const terminators = /\r\n|\r|\n/gu;
|
|
84
|
-
terminators.lastIndex = scanned;
|
|
85
95
|
let start = 0;
|
|
86
|
-
for (let found = terminators.exec(
|
|
87
|
-
// A `\r`
|
|
88
|
-
if (found[0] === `\r` && found.index ===
|
|
89
|
-
|
|
96
|
+
for (let found = terminators.exec(text); found !== null; found = terminators.exec(text)) {
|
|
97
|
+
// A trailing `\r` may be the first half of a `\r\n` still in flight.
|
|
98
|
+
if (found[0] === `\r` && found.index === text.length - 1) {
|
|
99
|
+
fragments.push(text.slice(start, found.index));
|
|
100
|
+
pendingCr = true;
|
|
101
|
+
return;
|
|
90
102
|
}
|
|
91
|
-
|
|
103
|
+
finishLine(text.slice(start, found.index), found[0]);
|
|
92
104
|
start = found.index + found[0].length;
|
|
93
105
|
}
|
|
94
|
-
|
|
95
|
-
|
|
106
|
+
if (start < text.length) {
|
|
107
|
+
fragments.push(text.slice(start));
|
|
108
|
+
}
|
|
96
109
|
};
|
|
97
110
|
|
|
98
111
|
return {
|
|
@@ -106,14 +119,20 @@ export const createSseParser = (dispatch: (event: SseEvent) => void): SseParser
|
|
|
106
119
|
next = next.slice(1);
|
|
107
120
|
}
|
|
108
121
|
}
|
|
109
|
-
|
|
110
|
-
|
|
122
|
+
if (pendingCr && next !== ``) {
|
|
123
|
+
pendingCr = false;
|
|
124
|
+
const lf = next.startsWith(`\n`);
|
|
125
|
+
finishLine(``, lf ? `\r\n` : `\r`);
|
|
126
|
+
next = lf ? next.slice(1) : next;
|
|
127
|
+
}
|
|
128
|
+
lines(next);
|
|
111
129
|
},
|
|
112
130
|
end: () => {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
131
|
+
if (pendingCr) {
|
|
132
|
+
pendingCr = false;
|
|
133
|
+
finishLine(``, `\r`);
|
|
134
|
+
} else if (fragments.length > 0) {
|
|
135
|
+
finishLine(``, ``);
|
|
117
136
|
}
|
|
118
137
|
if (pending.raw !== ``) {
|
|
119
138
|
emit();
|
package/src/schemas/ci.ts
CHANGED
|
@@ -239,6 +239,20 @@ export const CiFixParamSchema = CiRunParamSchema.extend({
|
|
|
239
239
|
.describe(
|
|
240
240
|
"Open the conversation even when every failed job died in its runner's own setup, which is the fleet's fault and nothing an agent on the code can repair. Left out, such a run is refused with that sentence.",
|
|
241
241
|
),
|
|
242
|
+
// The run button's booking (useAgentRunPick `booking`): the chosen model's allowance is spent, so the press schedules
|
|
243
|
+
// the fix for its reopen instead of sending it into a refusal. AgentTurn's own two fields, read the same way.
|
|
244
|
+
sendAt: z
|
|
245
|
+
.number()
|
|
246
|
+
.int()
|
|
247
|
+
.positive()
|
|
248
|
+
.optional()
|
|
249
|
+
.describe(
|
|
250
|
+
"Hold the fix until then (epoch milliseconds) instead of starting it now: the reopen of the allowance the chosen model would be refused by. The conversation opens at once with its task waiting in the queue, drawn as scheduled, and starts by itself then. Ignored when already past; at most a month ahead.",
|
|
251
|
+
),
|
|
252
|
+
sendAtReopen: z
|
|
253
|
+
.literal(true)
|
|
254
|
+
.optional()
|
|
255
|
+
.describe("Says `sendAt` is the reopen of a spent allowance rather than a time you chose, so every window says the fix waits on an allowance. Only with `sendAt`."),
|
|
242
256
|
});
|
|
243
257
|
export type CiFixParam = z.infer<typeof CiFixParamSchema>;
|
|
244
258
|
// The fix route opens an isolated conversation (fleet card + chat tab) seeded with the failure context.
|
|
@@ -528,7 +528,7 @@ export const SwitchAccountSchema = z.object({
|
|
|
528
528
|
.boolean()
|
|
529
529
|
.optional()
|
|
530
530
|
.describe(
|
|
531
|
-
"
|
|
531
|
+
"Whether the provider session goes with the move: the model keeps everything, and re-reads all of it once on the other account. Left out, it goes, as `true`. `false` opens a fresh session seeded from the record instead.",
|
|
532
532
|
),
|
|
533
533
|
handoff: HandoffModeSchema.optional().describe(
|
|
534
534
|
"How the held turn continues the conversation on the new account: `carry`, `trim` or `summary` (see `limitHandoff`). Wins over `carry`. Leave it out for the held turn's own pick, else the sandbox's setting.",
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type Switched, switchedLine, switchedNotice } from "./switched.js";
|
|
2
|
+
|
|
3
|
+
// The row a turn's switch leaves in the record names the part that changed, and says whether the session went with it.
|
|
4
|
+
|
|
5
|
+
describe("switchedLine", () => {
|
|
6
|
+
it("names the provider, account or loop a fresh session started on", () => {
|
|
7
|
+
expect(switchedLine({ segment: "provider", provider: "codex", model: "gpt-5-codex", fresh: true })).toBe(
|
|
8
|
+
"Switched to Codex: this message started a fresh session, with the conversation so far carried over.",
|
|
9
|
+
);
|
|
10
|
+
expect(switchedLine({ segment: "account", provider: "claude", account: "Work", fresh: true })).toBe(
|
|
11
|
+
"Switched to the Work account: this message started a fresh session, with the conversation so far carried over.",
|
|
12
|
+
);
|
|
13
|
+
expect(switchedLine({ segment: "loop", provider: "kimi", loop: "Claude Code", fresh: true })).toBe(
|
|
14
|
+
"Switched to running through Claude Code: this message started a fresh session, with the conversation so far carried over.",
|
|
15
|
+
);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("says an account it has no name for as another of the provider's, never as the provider it was already on", () => {
|
|
19
|
+
expect(switchedLine({ segment: "account", provider: "claude", fresh: true })).toBe(
|
|
20
|
+
"Switched to another Claude account: this message started a fresh session, with the conversation so far carried over.",
|
|
21
|
+
);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("says a model switch kept the session, or that it opened a fresh one where there was none to keep", () => {
|
|
25
|
+
expect(switchedLine({ segment: "model", provider: "claude", model: "claude-sonnet-5", fresh: false })).toBe(
|
|
26
|
+
"Switched to Claude Sonnet 5: same session, so the model re-reads the conversation once.",
|
|
27
|
+
);
|
|
28
|
+
expect(switchedLine({ segment: "model", provider: "claude", model: "claude-sonnet-5", fresh: true })).toBe(
|
|
29
|
+
"Switched to Claude Sonnet 5: this message started a fresh session, with the conversation so far carried over.",
|
|
30
|
+
);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
describe("switchedNotice", () => {
|
|
35
|
+
it("carries every fact it has, and leaves off the ones it does not", () => {
|
|
36
|
+
const all: Switched = { segment: "account", provider: "claude", model: "claude-opus-5-5", account: "Work", loop: "Claude Code", fresh: true };
|
|
37
|
+
expect(switchedNotice(all)).toStrictEqual({
|
|
38
|
+
code: "switched",
|
|
39
|
+
params: { segment: "account", provider: "claude", model: "claude-opus-5-5", account: "Work", loop: "Claude Code", fresh: true },
|
|
40
|
+
});
|
|
41
|
+
expect(switchedNotice({ segment: "model", provider: "claude", fresh: false })).toStrictEqual({
|
|
42
|
+
code: "switched",
|
|
43
|
+
params: { segment: "model", provider: "claude", fresh: false },
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AgentProviderSchema } from "../agent.js";
|
|
3
|
+
import { providerLabel } from "../../models/agent-catalog.js";
|
|
4
|
+
import { humanizeModelId } from "../../models/model-label.js";
|
|
5
|
+
import { providerSpec } from "../../models/provider-specs.js";
|
|
6
|
+
import type { SandboxNotice } from "../../events/sandbox-notice.js";
|
|
7
|
+
|
|
8
|
+
// WHEN A CONVERSATION CHANGES WHAT IT RUNS ON. A turn that goes out on another provider, account, loop or model than the
|
|
9
|
+
// conversation's turn before it says so once, as it starts, and the record keeps that as a row of its own: every
|
|
10
|
+
// window, device and reload then shows the same history. A window's own divider, drawn as a person picks, is only a
|
|
11
|
+
// preview of this, and it has been wrong (a stale window drew a switch that never happened). The daemon reads the
|
|
12
|
+
// switch off the conversation's record before and after the turn's `begin` (its agent/run/turn/turn-switch.ts).
|
|
13
|
+
//
|
|
14
|
+
// Provider, account and loop each retire the session, since a session lives on the runtime and account that minted it
|
|
15
|
+
// (the daemon's conversations/registry/routing.ts): the turn opens a fresh one, seeded from the record. A model alone
|
|
16
|
+
// keeps the session, and the new model reads the whole conversation once, on a cold cache. Effort, thinking and fast
|
|
17
|
+
// mode are no switch.
|
|
18
|
+
|
|
19
|
+
// What changed, named by the first of these that did.
|
|
20
|
+
export const SWITCH_SEGMENTS = ["provider", "account", "loop", "model"] as const;
|
|
21
|
+
export const SwitchSegmentSchema = z.enum(SWITCH_SEGMENTS);
|
|
22
|
+
export type SwitchSegment = z.infer<typeof SwitchSegmentSchema>;
|
|
23
|
+
|
|
24
|
+
export const SwitchedSchema = z.object({
|
|
25
|
+
segment: SwitchSegmentSchema.describe("What changed: the provider, else the account, else the loop, else the model."),
|
|
26
|
+
provider: AgentProviderSchema.describe("The provider the turn now runs on."),
|
|
27
|
+
model: z.string().optional().describe("The model the turn now runs on, by id. Absent where the conversation names none."),
|
|
28
|
+
account: z.string().optional().describe("What the account the turn now runs on is called in the sandbox. Absent where the sandbox has no name for it."),
|
|
29
|
+
loop: z.string().optional().describe("What the loop the turn now runs through is called (Claude Code, Codex, OpenCode)."),
|
|
30
|
+
fresh: z
|
|
31
|
+
.boolean()
|
|
32
|
+
.describe("Whether the turn opened a fresh session seeded from the record; false where it went on in the same session on another model."),
|
|
33
|
+
});
|
|
34
|
+
export type Switched = z.infer<typeof SwitchedSchema>;
|
|
35
|
+
|
|
36
|
+
export const switchedNotice = (event: Switched): Extract<SandboxNotice, { code: "switched" }> => {
|
|
37
|
+
const params: Extract<SandboxNotice, { code: "switched" }>["params"] = { segment: event.segment, provider: event.provider, fresh: event.fresh };
|
|
38
|
+
if (event.model !== undefined) {
|
|
39
|
+
params.model = event.model;
|
|
40
|
+
}
|
|
41
|
+
if (event.account !== undefined) {
|
|
42
|
+
params.account = event.account;
|
|
43
|
+
}
|
|
44
|
+
if (event.loop !== undefined) {
|
|
45
|
+
params.loop = event.loop;
|
|
46
|
+
}
|
|
47
|
+
return { code: "switched", params };
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/** What a provider's accounts are filed under ("Claude", "ChatGPT"), which an account the sandbox has no name for is said as. */
|
|
51
|
+
export const accountsLabel = (provider: string): string => providerSpec(provider)?.accountLabel ?? providerLabel(provider);
|
|
52
|
+
|
|
53
|
+
// What it switched to, named by the part that changed: an account switch said as "Switched to Claude Code" would name
|
|
54
|
+
// the provider the chat was already on.
|
|
55
|
+
const switchedTo = (event: Switched): string => {
|
|
56
|
+
switch (event.segment) {
|
|
57
|
+
case "provider":
|
|
58
|
+
return `Switched to ${providerLabel(event.provider)}`;
|
|
59
|
+
case "account":
|
|
60
|
+
return event.account === undefined ? `Switched to another ${accountsLabel(event.provider)} account` : `Switched to the ${event.account} account`;
|
|
61
|
+
case "loop":
|
|
62
|
+
return event.loop === undefined ? "Switched to another loop" : `Switched to running through ${event.loop}`;
|
|
63
|
+
case "model":
|
|
64
|
+
return event.model === undefined ? "Switched to another model" : `Switched to ${humanizeModelId(event.model)}`;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/** The transcript's line for a turn that switched what it runs on, in the English the record keeps. */
|
|
69
|
+
export const switchedLine = (event: Switched): string =>
|
|
70
|
+
`${switchedTo(event)}: ${
|
|
71
|
+
event.fresh ? "this message started a fresh session, with the conversation so far carried over." : "same session, so the model re-reads the conversation once."
|
|
72
|
+
}`;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { compareListed, compareNames } from "./name-order.js";
|
|
2
|
+
|
|
3
|
+
const sorted = (names: readonly string[]): string[] => names.toSorted(compareNames);
|
|
4
|
+
|
|
5
|
+
describe(`compareNames`, () => {
|
|
6
|
+
it(`puts numbers in counting order`, () => {
|
|
7
|
+
expect(sorted([`shot-10.png`, `shot-2.png`, `shot-1.png`])).toEqual([`shot-1.png`, `shot-2.png`, `shot-10.png`]);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it(`folds case, so a capitalised name sits among its letter`, () => {
|
|
11
|
+
expect(sorted([`zeta.md`, `README.md`, `alpha.md`])).toEqual([`alpha.md`, `README.md`, `zeta.md`]);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it(`breaks a tie between names that collate alike by code point`, () => {
|
|
15
|
+
expect(sorted([`readme.md`, `README.md`])).toEqual([`README.md`, `readme.md`]);
|
|
16
|
+
expect(compareNames(`a`, `a`)).toBe(0);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
describe(`compareListed`, () => {
|
|
21
|
+
it(`lists folders first, each kind in natural order`, () => {
|
|
22
|
+
const entries = [
|
|
23
|
+
{ name: `b10`, dir: false },
|
|
24
|
+
{ name: `src`, dir: true },
|
|
25
|
+
{ name: `b2`, dir: false },
|
|
26
|
+
{ name: `assets`, dir: true },
|
|
27
|
+
];
|
|
28
|
+
expect(entries.toSorted(compareListed).map((entry) => entry.name)).toEqual([`assets`, `src`, `b2`, `b10`]);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// The one order a folder's entries are listed in, by the daemon's walk, the desktop app's folder server, the browser's
|
|
2
|
+
// provisional rows and the home alike: a folder that read `file1, file10, file2` in the tree and `file1, file2, file10`
|
|
3
|
+
// in the home was two orders for one folder. Natural, as every desktop file manager sorts (`shot-2` before `shot-10`),
|
|
4
|
+
// and case-folded, so `README.md` sits among the r's.
|
|
5
|
+
//
|
|
6
|
+
// A fixed locale, not the reader's: the daemon sorts with whatever locale its process happens to start under, and the
|
|
7
|
+
// browser re-sorts a listing when a provisional row joins it, so two different collations would shuffle the rows the
|
|
8
|
+
// moment a paste landed. English collation still files an accented letter beside its base letter.
|
|
9
|
+
const collator = new Intl.Collator(`en`, { numeric: true, sensitivity: `base` });
|
|
10
|
+
|
|
11
|
+
/** Natural, case-insensitive name order; names that collate alike fall back to code-point order, so it is total. */
|
|
12
|
+
export const compareNames = (left: string, right: string): number => collator.compare(left, right) || (left < right ? -1 : left > right ? 1 : 0);
|
|
13
|
+
|
|
14
|
+
/** Folders before files, then natural name order: how every listing of a folder is laid out. */
|
|
15
|
+
export const compareListed = (
|
|
16
|
+
left: { readonly name: string; readonly dir: boolean },
|
|
17
|
+
right: { readonly name: string; readonly dir: boolean },
|
|
18
|
+
): number => (left.dir === right.dir ? compareNames(left.name, right.name) : left.dir ? -1 : 1);
|
|
@@ -106,6 +106,21 @@ test("a spent allowance reads as a wait rather than an error", () => {
|
|
|
106
106
|
expect(stance.ongoing).toBe(true);
|
|
107
107
|
});
|
|
108
108
|
|
|
109
|
+
// A Fix pressed on a model with no allowance left opens its conversation at once, the task booked for the reopen: idle,
|
|
110
|
+
// nothing changed, and not an ending, since nothing has run yet.
|
|
111
|
+
test("an attempt whose task is booked for later reads as scheduled, not as one that changed nothing", () => {
|
|
112
|
+
const stance = fixStance(agent({ status: `idle`, next: { kind: `send`, at: 5_000, count: 1 } }));
|
|
113
|
+
expect(stance.kind).toBe(`waiting`);
|
|
114
|
+
expect(stance.label).toBe(`Scheduled`);
|
|
115
|
+
expect(stance.retry).toBe(false);
|
|
116
|
+
expect(stance.ongoing).toBe(true);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
test("a fix held for review still says so with a message booked beside it", () => {
|
|
120
|
+
const stance = fixStance(agent({ status: `ready`, diff: { files: 1, insertions: 3, deletions: 0 }, next: { kind: `send`, at: 5_000, count: 1 } }));
|
|
121
|
+
expect(stance.kind).toBe(`ready`);
|
|
122
|
+
});
|
|
123
|
+
|
|
109
124
|
test("a stopped turn says so, and offers the press again", () => {
|
|
110
125
|
const stance = fixStance(agent({ status: `stopped` }));
|
|
111
126
|
expect(stance.label).toBe(`Stopped`);
|
package/src/state/fix-stance.ts
CHANGED
|
@@ -74,6 +74,14 @@ const WAITING: FixStance = {
|
|
|
74
74
|
hint: "The fix agent's allowance is spent. Nothing is owed: the turn goes again when the provider's window reopens.",
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
+
const SCHEDULED: FixStance = {
|
|
78
|
+
kind: "waiting",
|
|
79
|
+
ongoing: true,
|
|
80
|
+
retry: false,
|
|
81
|
+
label: "Scheduled",
|
|
82
|
+
hint: "The fix agent is booked to start by itself, most often when its model's allowance reopens. Nothing is owed; open it to send it sooner or change when it goes.",
|
|
83
|
+
};
|
|
84
|
+
|
|
77
85
|
// True only for a clean finish (`ready`, or `idle` with a diff); a crashed turn with files also has a diff, but that
|
|
78
86
|
// belongs in the ending's hint, not here.
|
|
79
87
|
const holdingWork = (agent: AgentSummary): boolean =>
|
|
@@ -134,6 +142,9 @@ const RULES: readonly ((agent: AgentSummary) => FixStance | undefined)[] = [
|
|
|
134
142
|
(agent) => (awaitsWake(agent) ? WORKING : undefined),
|
|
135
143
|
(agent) => (holdingWork(agent) ? READY : undefined),
|
|
136
144
|
(agent) => (agent.status === "landed" ? LANDED : undefined),
|
|
145
|
+
// Its task waits in the queue booked for later (a Fix pressed on a model with no allowance left, booked for the
|
|
146
|
+
// reopen): it has not run since, so a card with nothing changed is not an ending. A fix held or landed says so first.
|
|
147
|
+
(agent) => (agent.next?.kind === "send" ? SCHEDULED : undefined),
|
|
137
148
|
];
|
|
138
149
|
|
|
139
150
|
export const fixStance = (agent: AgentSummary): FixStance => {
|