@intentic/sandbox-contract 1.420.0 → 1.421.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/runner.contract.d.ts +14 -0
- package/dist/contracts/runner.contract.d.ts.map +1 -1
- package/dist/contracts/settings.contract.d.ts +2 -0
- package/dist/contracts/settings.contract.d.ts.map +1 -1
- package/dist/events/agent-events.d.ts +5 -0
- package/dist/events/agent-events.d.ts.map +1 -1
- package/dist/events/agent-events.js +2 -1
- package/dist/events/agent-events.js.map +1 -1
- package/dist/events/sandbox-notice.d.ts +12 -0
- package/dist/events/sandbox-notice.d.ts.map +1 -1
- package/dist/events/sandbox-notice.js +5 -1
- package/dist/events/sandbox-notice.js.map +1 -1
- package/dist/models/account-moves.d.ts.map +1 -1
- package/dist/models/account-moves.js +9 -1
- package/dist/models/account-moves.js.map +1 -1
- package/dist/schemas/night-hours.d.ts +5 -1
- package/dist/schemas/night-hours.d.ts.map +1 -1
- package/dist/schemas/night-hours.js +24 -2
- package/dist/schemas/night-hours.js.map +1 -1
- package/dist/schemas/settings.d.ts +2 -0
- package/dist/schemas/settings.d.ts.map +1 -1
- package/dist/schemas/settings.js +1 -1
- package/dist/schemas/settings.js.map +1 -1
- package/dist/state/definition.d.ts +4 -0
- package/dist/state/definition.d.ts.map +1 -1
- package/dist/text/land-rows.d.ts +7 -4
- package/dist/text/land-rows.d.ts.map +1 -1
- package/dist/text/land-rows.js +8 -4
- package/dist/text/land-rows.js.map +1 -1
- package/dist/text/transcript-fold.d.ts.map +1 -1
- package/dist/text/transcript-fold.js +6 -4
- package/dist/text/transcript-fold.js.map +1 -1
- package/package.json +5 -5
- package/src/events/agent-events.ts +3 -1
- package/src/events/sandbox-notice.ts +13 -2
- package/src/models/account-moves.test.ts +9 -1
- package/src/models/account-moves.ts +20 -5
- package/src/schemas/night-hours.test.ts +32 -1
- package/src/schemas/night-hours.ts +46 -3
- package/src/schemas/settings.ts +1 -1
- package/src/text/land-rows.ts +18 -6
- package/src/text/transcript-fold.test.ts +17 -0
- package/src/text/transcript-fold.ts +8 -5
package/src/text/land-rows.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AgentEvent } from "../events/agent-events.js";
|
|
2
2
|
import type { TranscriptRow } from "../events/transcript.js";
|
|
3
|
-
import { noticeCode } from "../events/sandbox-notice.js";
|
|
3
|
+
import { noticeCode, type WorktreeSyncCause } from "../events/sandbox-notice.js";
|
|
4
4
|
|
|
5
5
|
// The notices a turn's work leaves as it moves: an install starting, the branch rebased onto the workspace while it
|
|
6
6
|
// waited, and where the finished work went (landed, held, conflicted, or into a parent's checkout).
|
|
@@ -50,12 +50,24 @@ export const installRow = (event: { readonly reach: "own-copy" | "main-tree"; re
|
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
// One line reporting the daemon's rebase of this agent's branch onto the current workspace; `blocked` names repos it
|
|
53
|
-
// couldn't rebase, where the turn ran from an older base.
|
|
54
|
-
|
|
53
|
+
// couldn't rebase, where the turn ran from an older base. Worded by when it ran: a frame with no `cause` predates it and
|
|
54
|
+
// reads as a turn's opening, as it always did. A mid-turn catch-up only ever moves the branch where the main line touched
|
|
55
|
+
// none of the files it changed (land/sync.ts, the `clear` gate), and says so with the commit to diff against: in the
|
|
56
|
+
// shinobi-society audit (2026-11-17) "while this agent waited" sent an agent hunting for what had reset its fix.
|
|
57
|
+
export interface SyncFacts {
|
|
58
|
+
readonly commits: number;
|
|
59
|
+
readonly blocked: readonly string[];
|
|
60
|
+
readonly cause?: WorktreeSyncCause | undefined;
|
|
61
|
+
}
|
|
62
|
+
export const syncLine = (sync: SyncFacts, base?: string): string => {
|
|
63
|
+
const plural = sync.commits === 1 ? `` : `s`;
|
|
64
|
+
const onto = base === undefined || base === `` ? `` : ` \`git diff ${base}\` shows this agent's own changes on top of the new base.`;
|
|
55
65
|
const moved =
|
|
56
|
-
sync.commits
|
|
57
|
-
?
|
|
58
|
-
:
|
|
66
|
+
sync.commits === 0
|
|
67
|
+
? undefined
|
|
68
|
+
: sync.cause === `between-tools`
|
|
69
|
+
? `The main line moved on during this turn: its ${sync.commits} newer commit${plural} ${sync.commits === 1 ? `was` : `were`} rebased under this agent's branch between two of its tool calls. None of the files this agent changed were touched.${onto}`
|
|
70
|
+
: `Your workspace moved on while this agent waited, its branch was rebased onto your latest ${sync.commits} commit${plural}.`;
|
|
59
71
|
const blocked =
|
|
60
72
|
sync.blocked.length > 0
|
|
61
73
|
? `Couldn't rebase onto your workspace in ${sync.blocked.join(`, `)}: the turn is running from the older base, so its land may need a resolve.`
|
|
@@ -425,6 +425,23 @@ describe("foldTurn", () => {
|
|
|
425
425
|
});
|
|
426
426
|
});
|
|
427
427
|
|
|
428
|
+
// The shinobi-society audit (2026-11-17): a catch-up between two tool calls read "while this agent waited".
|
|
429
|
+
it("words a rebase by when it ran, a frame from before the cause was said reading as it always did", () => {
|
|
430
|
+
const frame = (cause?: "turn-open" | "answer" | "between-tools"): AgentEvent => {
|
|
431
|
+
const sync = cause === undefined ? { commits: 1, blocked: [] } : { commits: 1, blocked: [], cause };
|
|
432
|
+
return { kind: "worktree", branch: "agent/x", base: "abc1234", sync };
|
|
433
|
+
};
|
|
434
|
+
const waited = "Your workspace moved on while this agent waited, its branch was rebased onto your latest 1 commit.";
|
|
435
|
+
expect(foldOf("go", [frame()]).at(-1)?.text).toBe(waited);
|
|
436
|
+
expect(foldOf("go", [frame("turn-open")]).at(-1)?.text).toBe(waited);
|
|
437
|
+
expect(foldOf("go", [frame("answer")]).at(-1)?.text).toBe(waited);
|
|
438
|
+
expect(foldOf("go", [frame("between-tools")]).at(-1)).toEqual({
|
|
439
|
+
role: "notice",
|
|
440
|
+
text: "The main line moved on during this turn: its 1 newer commit was rebased under this agent's branch between two of its tool calls. None of the files this agent changed were touched. `git diff abc1234` shows this agent's own changes on top of the new base.",
|
|
441
|
+
noticeCode: { code: "synced", params: { commits: 1, cause: "between-tools", base: "abc1234" } },
|
|
442
|
+
});
|
|
443
|
+
});
|
|
444
|
+
|
|
428
445
|
it("writes the turn's own events down as notices", () => {
|
|
429
446
|
const events: AgentEvent[] = [
|
|
430
447
|
{ kind: "worktree", branch: "agent/x", base: "abc1234", sync: { commits: 2, blocked: [] } },
|
|
@@ -21,7 +21,7 @@ import { unspokenPromptRow } from "../events/agent-words.js";
|
|
|
21
21
|
import { takeToolUpdate } from "../events/tool-update.js";
|
|
22
22
|
import { needRowText } from "../events/need-wake.js";
|
|
23
23
|
import { noticeCode, sandboxNoticeOf } from "../events/sandbox-notice.js";
|
|
24
|
-
import { installRow, landedRow, syncLine } from "./land-rows.js";
|
|
24
|
+
import { installRow, landedRow, type SyncFacts, syncLine } from "./land-rows.js";
|
|
25
25
|
|
|
26
26
|
// Folds a turn's frames into rows once, live and for the settled record alike, so a reopened chat matches what was on
|
|
27
27
|
// screen. The main turn's frames are its rows; a frame a subagent produced (tagged with the call that spawned it) nests
|
|
@@ -250,7 +250,7 @@ export class TranscriptFold {
|
|
|
250
250
|
return line === undefined || notice === undefined ? [] : this.pushRow({ role: "notice", text: line, noticeCode: noticeCode(notice) });
|
|
251
251
|
}
|
|
252
252
|
case "worktree":
|
|
253
|
-
return this.synced(event.sync);
|
|
253
|
+
return this.synced(event.sync, event.base);
|
|
254
254
|
case "landed":
|
|
255
255
|
return this.pushRow(landedRow(event));
|
|
256
256
|
case "compact":
|
|
@@ -669,15 +669,18 @@ export class TranscriptFold {
|
|
|
669
669
|
|
|
670
670
|
// The rebase notice, less what a resolve turn was sent to fix: that turn opens because the branch couldn't rebase, so
|
|
671
671
|
// saying so again one row under its own errand only repeats it. What did move is still told.
|
|
672
|
-
private synced(sync:
|
|
672
|
+
private synced(sync: SyncFacts | undefined, base: string): TranscriptPatch[] {
|
|
673
673
|
if (sync === undefined) {
|
|
674
674
|
return [];
|
|
675
675
|
}
|
|
676
676
|
const opener = this.opener === undefined ? undefined : this.rows[this.opener];
|
|
677
677
|
const told = opener !== undefined && isLandConflict(opener.text) ? { ...sync, blocked: [] } : sync;
|
|
678
|
-
|
|
678
|
+
// The base is named only where the line says it (a mid-turn catch-up); every other row stays as it was.
|
|
679
|
+
const named = told.cause === `between-tools` && base !== `` ? base : undefined;
|
|
680
|
+
const text = syncLine(told, named);
|
|
679
681
|
const blocked = told.blocked.length > 0 ? told.blocked.join(`, `) : undefined;
|
|
680
|
-
|
|
682
|
+
const params = { commits: told.commits, blocked, cause: told.cause, base: named };
|
|
683
|
+
return text === "" ? [] : this.pushRow({ role: "notice", text, noticeCode: noticeCode({ code: "synced", params }) });
|
|
681
684
|
}
|
|
682
685
|
|
|
683
686
|
private stampOpener(mutate: (row: TranscriptRow) => void): TranscriptPatch[] {
|