@cluesmith/codev 3.3.3 → 3.3.5
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/dashboard-dist/assets/index-BuflRUi6.js +220 -0
- package/dashboard-dist/assets/index-BuflRUi6.js.map +1 -0
- package/dashboard-dist/assets/index-r3bZzLmX.css +32 -0
- package/dashboard-dist/index.html +2 -2
- package/dist/agent-farm/cli.d.ts.map +1 -1
- package/dist/agent-farm/cli.js +48 -0
- package/dist/agent-farm/cli.js.map +1 -1
- package/dist/agent-farm/commands/ide.d.ts +20 -0
- package/dist/agent-farm/commands/ide.d.ts.map +1 -0
- package/dist/agent-farm/commands/ide.js +138 -0
- package/dist/agent-farm/commands/ide.js.map +1 -0
- package/dist/agent-farm/commands/inbox.d.ts.map +1 -1
- package/dist/agent-farm/commands/inbox.js +15 -3
- package/dist/agent-farm/commands/inbox.js.map +1 -1
- package/dist/agent-farm/commands/send.d.ts +3 -2
- package/dist/agent-farm/commands/send.d.ts.map +1 -1
- package/dist/agent-farm/commands/send.js +40 -6
- package/dist/agent-farm/commands/send.js.map +1 -1
- package/dist/agent-farm/commands/spawn-worktree.d.ts.map +1 -1
- package/dist/agent-farm/commands/spawn-worktree.js +28 -9
- package/dist/agent-farm/commands/spawn-worktree.js.map +1 -1
- package/dist/agent-farm/commands/tower.d.ts +21 -9
- package/dist/agent-farm/commands/tower.d.ts.map +1 -1
- package/dist/agent-farm/commands/tower.js +90 -30
- package/dist/agent-farm/commands/tower.js.map +1 -1
- package/dist/agent-farm/db/tower-owner.d.ts +168 -0
- package/dist/agent-farm/db/tower-owner.d.ts.map +1 -0
- package/dist/agent-farm/db/tower-owner.js +369 -0
- package/dist/agent-farm/db/tower-owner.js.map +1 -0
- package/dist/agent-farm/db/types.d.ts +30 -5
- package/dist/agent-farm/db/types.d.ts.map +1 -1
- package/dist/agent-farm/db/types.js.map +1 -1
- package/dist/agent-farm/lib/ide-record.d.ts +65 -0
- package/dist/agent-farm/lib/ide-record.d.ts.map +1 -0
- package/dist/agent-farm/lib/ide-record.js +118 -0
- package/dist/agent-farm/lib/ide-record.js.map +1 -0
- package/dist/agent-farm/lib/tunnel-client.d.ts +22 -0
- package/dist/agent-farm/lib/tunnel-client.d.ts.map +1 -1
- package/dist/agent-farm/lib/tunnel-client.js +53 -5
- package/dist/agent-farm/lib/tunnel-client.js.map +1 -1
- package/dist/agent-farm/servers/decisions/file.d.ts +50 -0
- package/dist/agent-farm/servers/decisions/file.d.ts.map +1 -0
- package/dist/agent-farm/servers/decisions/file.js +146 -0
- package/dist/agent-farm/servers/decisions/file.js.map +1 -0
- package/dist/agent-farm/servers/decisions/grammar.d.ts +36 -0
- package/dist/agent-farm/servers/decisions/grammar.d.ts.map +1 -0
- package/dist/agent-farm/servers/decisions/grammar.js +109 -0
- package/dist/agent-farm/servers/decisions/grammar.js.map +1 -0
- package/dist/agent-farm/servers/decisions/notice.d.ts +11 -0
- package/dist/agent-farm/servers/decisions/notice.d.ts.map +1 -0
- package/dist/agent-farm/servers/decisions/notice.js +18 -0
- package/dist/agent-farm/servers/decisions/notice.js.map +1 -0
- package/dist/agent-farm/servers/decisions/parse.d.ts +36 -0
- package/dist/agent-farm/servers/decisions/parse.d.ts.map +1 -0
- package/dist/agent-farm/servers/decisions/parse.js +308 -0
- package/dist/agent-farm/servers/decisions/parse.js.map +1 -0
- package/dist/agent-farm/servers/decisions/routes.d.ts +17 -0
- package/dist/agent-farm/servers/decisions/routes.d.ts.map +1 -0
- package/dist/agent-farm/servers/decisions/routes.js +160 -0
- package/dist/agent-farm/servers/decisions/routes.js.map +1 -0
- package/dist/agent-farm/servers/decisions/splice.d.ts +26 -0
- package/dist/agent-farm/servers/decisions/splice.d.ts.map +1 -0
- package/dist/agent-farm/servers/decisions/splice.js +120 -0
- package/dist/agent-farm/servers/decisions/splice.js.map +1 -0
- package/dist/agent-farm/servers/decisions/stamp.d.ts +4 -0
- package/dist/agent-farm/servers/decisions/stamp.d.ts.map +1 -0
- package/dist/agent-farm/servers/decisions/stamp.js +171 -0
- package/dist/agent-farm/servers/decisions/stamp.js.map +1 -0
- package/dist/agent-farm/servers/gate-profiles.d.ts +23 -2
- package/dist/agent-farm/servers/gate-profiles.d.ts.map +1 -1
- package/dist/agent-farm/servers/gate-profiles.js +43 -2
- package/dist/agent-farm/servers/gate-profiles.js.map +1 -1
- package/dist/agent-farm/servers/ide-forward.d.ts +62 -0
- package/dist/agent-farm/servers/ide-forward.d.ts.map +1 -0
- package/dist/agent-farm/servers/ide-forward.js +274 -0
- package/dist/agent-farm/servers/ide-forward.js.map +1 -0
- package/dist/agent-farm/servers/ide-server.d.ts +68 -0
- package/dist/agent-farm/servers/ide-server.d.ts.map +1 -0
- package/dist/agent-farm/servers/ide-server.js +281 -0
- package/dist/agent-farm/servers/ide-server.js.map +1 -0
- package/dist/agent-farm/servers/mailbox-delivery.d.ts +213 -4
- package/dist/agent-farm/servers/mailbox-delivery.d.ts.map +1 -1
- package/dist/agent-farm/servers/mailbox-delivery.js +489 -68
- package/dist/agent-farm/servers/mailbox-delivery.js.map +1 -1
- package/dist/agent-farm/servers/mailbox-wiring.d.ts +18 -4
- package/dist/agent-farm/servers/mailbox-wiring.d.ts.map +1 -1
- package/dist/agent-farm/servers/mailbox-wiring.js +94 -21
- package/dist/agent-farm/servers/mailbox-wiring.js.map +1 -1
- package/dist/agent-farm/servers/message-write.d.ts +138 -11
- package/dist/agent-farm/servers/message-write.d.ts.map +1 -1
- package/dist/agent-farm/servers/message-write.js +144 -35
- package/dist/agent-farm/servers/message-write.js.map +1 -1
- package/dist/agent-farm/servers/overview.d.ts +32 -15
- package/dist/agent-farm/servers/overview.d.ts.map +1 -1
- package/dist/agent-farm/servers/overview.js +181 -103
- package/dist/agent-farm/servers/overview.js.map +1 -1
- package/dist/agent-farm/servers/render-gate.d.ts +53 -0
- package/dist/agent-farm/servers/render-gate.d.ts.map +1 -1
- package/dist/agent-farm/servers/render-gate.js +135 -24
- package/dist/agent-farm/servers/render-gate.js.map +1 -1
- package/dist/agent-farm/servers/session-submit.d.ts +7 -4
- package/dist/agent-farm/servers/session-submit.d.ts.map +1 -1
- package/dist/agent-farm/servers/session-submit.js +7 -4
- package/dist/agent-farm/servers/session-submit.js.map +1 -1
- package/dist/agent-farm/servers/tower-cron.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-cron.js +4 -1
- package/dist/agent-farm/servers/tower-cron.js.map +1 -1
- package/dist/agent-farm/servers/tower-instances.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-instances.js +6 -7
- package/dist/agent-farm/servers/tower-instances.js.map +1 -1
- package/dist/agent-farm/servers/tower-routes.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-routes.js +116 -18
- package/dist/agent-farm/servers/tower-routes.js.map +1 -1
- package/dist/agent-farm/servers/tower-server.js +64 -7
- package/dist/agent-farm/servers/tower-server.js.map +1 -1
- package/dist/agent-farm/servers/tower-terminals.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-terminals.js +53 -8
- package/dist/agent-farm/servers/tower-terminals.js.map +1 -1
- package/dist/agent-farm/servers/tower-websocket.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-websocket.js +18 -1
- package/dist/agent-farm/servers/tower-websocket.js.map +1 -1
- package/dist/agent-farm/utils/message-format.d.ts +8 -0
- package/dist/agent-farm/utils/message-format.d.ts.map +1 -1
- package/dist/agent-farm/utils/message-format.js +21 -6
- package/dist/agent-farm/utils/message-format.js.map +1 -1
- package/dist/agent-farm/utils/port.d.ts +22 -0
- package/dist/agent-farm/utils/port.d.ts.map +1 -0
- package/dist/agent-farm/utils/port.js +35 -0
- package/dist/agent-farm/utils/port.js.map +1 -0
- package/dist/agent-farm/utils/server-utils.d.ts +26 -0
- package/dist/agent-farm/utils/server-utils.d.ts.map +1 -1
- package/dist/agent-farm/utils/server-utils.js +36 -0
- package/dist/agent-farm/utils/server-utils.js.map +1 -1
- package/dist/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/dist/commands/consult/index.d.ts +20 -1
- package/dist/commands/consult/index.d.ts.map +1 -1
- package/dist/commands/consult/index.js +117 -3
- package/dist/commands/consult/index.js.map +1 -1
- package/dist/commands/consult/tree-tripwire.d.ts +177 -0
- package/dist/commands/consult/tree-tripwire.d.ts.map +1 -0
- package/dist/commands/consult/tree-tripwire.js +356 -0
- package/dist/commands/consult/tree-tripwire.js.map +1 -0
- package/dist/commands/doctor.d.ts +69 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +163 -0
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/generate-image.d.ts +5 -0
- package/dist/commands/generate-image.d.ts.map +1 -1
- package/dist/commands/generate-image.js +225 -4
- package/dist/commands/generate-image.js.map +1 -1
- package/dist/commands/porch/checks.d.ts +7 -1
- package/dist/commands/porch/checks.d.ts.map +1 -1
- package/dist/commands/porch/checks.js +77 -14
- package/dist/commands/porch/checks.js.map +1 -1
- package/dist/commands/porch/index.d.ts +38 -1
- package/dist/commands/porch/index.d.ts.map +1 -1
- package/dist/commands/porch/index.js +79 -43
- package/dist/commands/porch/index.js.map +1 -1
- package/dist/commands/porch/protocol.d.ts +4 -3
- package/dist/commands/porch/protocol.d.ts.map +1 -1
- package/dist/commands/porch/protocol.js +32 -5
- package/dist/commands/porch/protocol.js.map +1 -1
- package/dist/commands/porch/types.d.ts +2 -0
- package/dist/commands/porch/types.d.ts.map +1 -1
- package/dist/lib/agent-env.d.ts +95 -0
- package/dist/lib/agent-env.d.ts.map +1 -0
- package/dist/lib/agent-env.js +137 -0
- package/dist/lib/agent-env.js.map +1 -0
- package/dist/lib/config.d.ts +8 -0
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/forge-contracts.d.ts +10 -0
- package/dist/lib/forge-contracts.d.ts.map +1 -1
- package/dist/lib/forge-contracts.js.map +1 -1
- package/dist/lib/forge-rate-limit.d.ts +45 -0
- package/dist/lib/forge-rate-limit.d.ts.map +1 -0
- package/dist/lib/forge-rate-limit.js +89 -0
- package/dist/lib/forge-rate-limit.js.map +1 -0
- package/dist/lib/forge.d.ts +28 -0
- package/dist/lib/forge.d.ts.map +1 -1
- package/dist/lib/forge.js +63 -10
- package/dist/lib/forge.js.map +1 -1
- package/dist/lib/github.d.ts +13 -1
- package/dist/lib/github.d.ts.map +1 -1
- package/dist/lib/github.js +58 -15
- package/dist/lib/github.js.map +1 -1
- package/dist/lib/test-env.d.ts +17 -0
- package/dist/lib/test-env.d.ts.map +1 -1
- package/dist/lib/test-env.js +20 -0
- package/dist/lib/test-env.js.map +1 -1
- package/dist/terminal/pty-session.d.ts +122 -4
- package/dist/terminal/pty-session.d.ts.map +1 -1
- package/dist/terminal/pty-session.js +142 -7
- package/dist/terminal/pty-session.js.map +1 -1
- package/dist/terminal/session-manager.d.ts +23 -2
- package/dist/terminal/session-manager.d.ts.map +1 -1
- package/dist/terminal/session-manager.js +115 -36
- package/dist/terminal/session-manager.js.map +1 -1
- package/dist/terminal/session-screen.d.ts +34 -5
- package/dist/terminal/session-screen.d.ts.map +1 -1
- package/dist/terminal/session-screen.js +52 -6
- package/dist/terminal/session-screen.js.map +1 -1
- package/dist/terminal/terminal-replies.d.ts +102 -0
- package/dist/terminal/terminal-replies.d.ts.map +1 -0
- package/dist/terminal/terminal-replies.js +181 -0
- package/dist/terminal/terminal-replies.js.map +1 -0
- package/package.json +4 -4
- package/scripts/forge/github/pr-list.sh +6 -2
- package/scripts/forge/github/pr-search.sh +4 -2
- package/scripts/forge/gitlab/issue-search.sh +1 -0
- package/scripts/forge/gitlab/pr-search.sh +35 -2
- package/scripts/forge/linear/auth-status.sh +1 -0
- package/scripts/forge/linear/issue-comment.sh +1 -0
- package/scripts/forge/linear/issue-list.sh +1 -0
- package/scripts/forge/linear/issue-search.sh +1 -0
- package/scripts/forge/linear/issue-view.sh +1 -0
- package/scripts/forge/linear/recently-closed.sh +1 -0
- package/scripts/forge/linear/user-identity.sh +1 -0
- package/skeleton/.claude/skills/afx/SKILL.md +15 -0
- package/skeleton/.claude/skills/arch-init/SKILL.md +56 -9
- package/skeleton/.claude/skills/arch-save/SKILL.md +100 -9
- package/skeleton/.claude/skills/consult/SKILL.md +9 -0
- package/skeleton/.claude/skills/generate-image/SKILL.md +19 -2
- package/skeleton/.claude/skills/porch/SKILL.md +18 -0
- package/skeleton/.codex/skills/afx/SKILL.md +15 -0
- package/skeleton/.codex/skills/arch-init/SKILL.md +56 -9
- package/skeleton/.codex/skills/arch-save/SKILL.md +100 -9
- package/skeleton/.codex/skills/consult/SKILL.md +9 -0
- package/skeleton/.codex/skills/generate-image/SKILL.md +19 -2
- package/skeleton/.codex/skills/porch/SKILL.md +18 -0
- package/skeleton/protocol-schema.json +6 -0
- package/skeleton/protocols/maintain/protocol.md +5 -0
- package/skeleton/protocols/pir/prompts/review.md +0 -1
- package/skeleton/protocols/protocol-schema.json +6 -0
- package/skeleton/resources/commands/agent-farm.md +71 -2
- package/skeleton/resources/commands/consult.md +9 -2
- package/skeleton/roles/consultant.md +32 -0
- package/skeleton/templates/AGENTS.md +1 -1
- package/skeleton/templates/CLAUDE.md +1 -1
- package/skeleton/templates/cheatsheet.md +1 -1
- package/dashboard-dist/assets/index-CUIjS_Vb.js +0 -199
- package/dashboard-dist/assets/index-CUIjS_Vb.js.map +0 -1
- package/dashboard-dist/assets/index-DnYLy5C_.css +0 -32
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// Ruling splice for the decisions file (Spec 1819).
|
|
2
|
+
//
|
|
3
|
+
// A pure function that writes the owner's ruling into the file's text, or refuses
|
|
4
|
+
// with a specific reason and returns no text. The write route is a thin wrapper
|
|
5
|
+
// around it: read the file, splice, write back only on success.
|
|
6
|
+
//
|
|
7
|
+
// The ruling goes directly after the item's `**Your word:**` line: the word on the
|
|
8
|
+
// very next line; then the comment, after a blank line when a word was written; then
|
|
9
|
+
// a blank line when the line that follows is not already blank. Inserted lines use
|
|
10
|
+
// the file's own line ending, a missing final newline on the Your-word line is
|
|
11
|
+
// supplied, and every other character is preserved in order. The result is
|
|
12
|
+
// re-parsed and must keep the file's structure — anything the explicit checks miss
|
|
13
|
+
// (an option word that is itself a heading or fence, say) is `structure-changed`.
|
|
14
|
+
import { isFenceLine, isHeadingLine, isYourWordLine } from './grammar.js';
|
|
15
|
+
import { parseDecisions } from './parse.js';
|
|
16
|
+
/** Longest comment accepted, in characters, after trimming. */
|
|
17
|
+
export const MAX_COMMENT_LENGTH = 10_000;
|
|
18
|
+
function refuse(code, message) {
|
|
19
|
+
return { ok: false, code, message };
|
|
20
|
+
}
|
|
21
|
+
/** Refuse a comment line that would add structure: a heading, fence or Your-word line. */
|
|
22
|
+
function checkCommentLines(commentLines) {
|
|
23
|
+
for (const [n, line] of commentLines.entries()) {
|
|
24
|
+
const where = `Line ${n + 1} of the comment`;
|
|
25
|
+
if (isHeadingLine(line))
|
|
26
|
+
return refuse('comment-heading', `${where} is a markdown heading ("${line.trim()}"); headings end the item.`);
|
|
27
|
+
if (isFenceLine(line))
|
|
28
|
+
return refuse('comment-fence', `${where} is a code fence ("${line.trim()}"), which would change how the file parses.`);
|
|
29
|
+
if (isYourWordLine(line))
|
|
30
|
+
return refuse('comment-your-word', `${where} starts with **Your word:**, which would give the item a second Your-word line.`);
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
/** Find the request's item in `## Open` and check it can take a ruling now. */
|
|
35
|
+
function checkItem(parsed, request, word) {
|
|
36
|
+
const { id } = request;
|
|
37
|
+
if (parsed.problems.includes('open-multiple')) {
|
|
38
|
+
return refuse('open-multiple', 'The file has more than one ## Open section; the tab cannot tell where items belong, so it writes nothing.');
|
|
39
|
+
}
|
|
40
|
+
const matches = parsed.items.filter(item => item.id === id);
|
|
41
|
+
if (matches.length === 0)
|
|
42
|
+
return refuse('heading-missing', `Item ${id} is not in ## Open (it may have been ruled or removed).`);
|
|
43
|
+
if (matches.length > 1)
|
|
44
|
+
return refuse('heading-duplicate', `Item ${id} appears ${matches.length} times in ## Open; rulings for it go through main.`);
|
|
45
|
+
const item = matches[0];
|
|
46
|
+
if (item.yourWordLines.length === 0)
|
|
47
|
+
return refuse('your-word-missing', `Item ${id} has no **Your word:** line to rule under.`);
|
|
48
|
+
if (item.yourWordLines.length > 1)
|
|
49
|
+
return refuse('your-word-multiple', `Item ${id} has ${item.yourWordLines.length} **Your word:** lines; the tab cannot tell which one to rule under.`);
|
|
50
|
+
if (item.currentRuling !== '')
|
|
51
|
+
return refuse('already-ruled', `Item ${id} already has text under its **Your word:** line; a change goes through main or a hand edit.`);
|
|
52
|
+
if (word && !item.options.some(option => option.word === word)) {
|
|
53
|
+
return refuse('unknown-word', `"${word}" is not an option on item ${id}'s current **Your word:** line.`);
|
|
54
|
+
}
|
|
55
|
+
if (item.fingerprint !== request.fingerprint)
|
|
56
|
+
return refuse('item-changed', `Item ${id} changed since it was shown; review it and submit again.`);
|
|
57
|
+
return item;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Check the spliced text kept the file's structure: the same sections, the same items
|
|
61
|
+
* in the same order, the same options on this item, this item's current ruling equal
|
|
62
|
+
* to the inserted ruling, and every inserted line plain unfenced content.
|
|
63
|
+
*/
|
|
64
|
+
function verify(before, after, item, ruling, insertedLines) {
|
|
65
|
+
const sections = (p) => p.lines.filter(l => l.headingLevel === 1 || l.headingLevel === 2).map(l => `${l.headingLevel} ${l.headingText}`).join('\n');
|
|
66
|
+
const changed = (what) => refuse('structure-changed', `Writing this ruling into item ${item.id} would change ${what}, so nothing was written.`);
|
|
67
|
+
if (sections(after) !== sections(before) || after.problems.join() !== before.problems.join())
|
|
68
|
+
return changed("the file's sections");
|
|
69
|
+
if (after.items.map(i => i.id).join('\n') !== before.items.map(i => i.id).join('\n'))
|
|
70
|
+
return changed('the list of open items');
|
|
71
|
+
const afterItem = after.items.find(i => i.headingLine === item.headingLine);
|
|
72
|
+
if (!afterItem || afterItem.id !== item.id)
|
|
73
|
+
return changed('the list of open items');
|
|
74
|
+
if (JSON.stringify(afterItem.options) !== JSON.stringify(item.options))
|
|
75
|
+
return changed("the item's options");
|
|
76
|
+
if (afterItem.currentRuling !== ruling)
|
|
77
|
+
return changed("the item's text after its **Your word:** line");
|
|
78
|
+
const inserted = after.lines.slice(insertedLines.from, insertedLines.from + insertedLines.count);
|
|
79
|
+
if (inserted.some(l => l.fenced || l.headingLevel > 0 || l.yourWord))
|
|
80
|
+
return changed("the file's structure (the ruling would add a heading or fence)");
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
/** Apply the owner's ruling to the decisions file's text, or refuse with the reason. */
|
|
84
|
+
export function spliceRuling(text, request) {
|
|
85
|
+
if (!request.id)
|
|
86
|
+
return refuse('invalid-request', 'The request names no item.');
|
|
87
|
+
if (!request.fingerprint)
|
|
88
|
+
return refuse('invalid-request', 'The request carries no item fingerprint.');
|
|
89
|
+
const word = request.word ?? '';
|
|
90
|
+
const comment = (request.comment ?? '').trim();
|
|
91
|
+
if (!word && !comment)
|
|
92
|
+
return refuse('empty-ruling', 'Choose an option or write a comment.');
|
|
93
|
+
if (comment.length > MAX_COMMENT_LENGTH) {
|
|
94
|
+
return refuse('comment-too-long', `The comment is ${comment.length} characters; the limit is ${MAX_COMMENT_LENGTH}.`);
|
|
95
|
+
}
|
|
96
|
+
const commentLines = comment ? comment.split(/\r\n|\r|\n/) : [];
|
|
97
|
+
const commentRefusal = checkCommentLines(commentLines);
|
|
98
|
+
if (commentRefusal)
|
|
99
|
+
return commentRefusal;
|
|
100
|
+
const before = parseDecisions(text);
|
|
101
|
+
const item = checkItem(before, request, word);
|
|
102
|
+
if ('ok' in item)
|
|
103
|
+
return item;
|
|
104
|
+
const rulingLines = [...(word ? [word] : []), ...(word && comment ? [''] : []), ...commentLines];
|
|
105
|
+
const yourWord = before.lines[item.yourWordLines[0]];
|
|
106
|
+
const following = before.lines[yourWord.index + 1];
|
|
107
|
+
const newLines = following && following.text.trim() !== '' ? [...rulingLines, ''] : rulingLines;
|
|
108
|
+
const at = yourWord.end + yourWord.eol.length;
|
|
109
|
+
const inserted = (yourWord.eol === '' ? before.eol : '') + newLines.map(line => line + before.eol).join('');
|
|
110
|
+
const result = text.slice(0, at) + inserted + text.slice(at);
|
|
111
|
+
// The parser's current ruling is LF-joined whatever the file's line ending.
|
|
112
|
+
const refusal = verify(before, parseDecisions(result), item, rulingLines.join('\n'), {
|
|
113
|
+
from: yourWord.index + 1,
|
|
114
|
+
count: newLines.length,
|
|
115
|
+
});
|
|
116
|
+
if (refusal)
|
|
117
|
+
return refusal;
|
|
118
|
+
return { ok: true, text: result };
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=splice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"splice.js","sourceRoot":"","sources":["../../../../src/agent-farm/servers/decisions/splice.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,EAAE;AACF,kFAAkF;AAClF,gFAAgF;AAChF,gEAAgE;AAChE,EAAE;AACF,mFAAmF;AACnF,qFAAqF;AACrF,mFAAmF;AACnF,+EAA+E;AAC/E,2EAA2E;AAC3E,mFAAmF;AACnF,kFAAkF;AAGlF,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAyC,MAAM,YAAY,CAAC;AAEnF,+DAA+D;AAC/D,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAuBzC,SAAS,MAAM,CAAC,IAAuB,EAAE,OAAe;IACtD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AACtC,CAAC;AAED,0FAA0F;AAC1F,SAAS,iBAAiB,CAAC,YAAsB;IAC/C,KAAK,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,YAAY,CAAC,OAAO,EAAE,EAAE,CAAC;QAC/C,MAAM,KAAK,GAAG,QAAQ,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WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QACnF,IAAI,EAAE,QAAQ,CAAC,KAAK,GAAG,CAAC;QACxB,KAAK,EAAE,QAAQ,CAAC,MAAM;KACvB,CAAC,CAAC;IACH,IAAI,OAAO;QAAE,OAAO,OAAO,CAAC;IAC5B,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stamp.d.ts","sourceRoot":"","sources":["../../../../src/agent-farm/servers/decisions/stamp.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AA2H5D,+EAA+E;AAC/E,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAuCvD"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
// Decision heading timestamps (Spec 1819).
|
|
2
|
+
//
|
|
3
|
+
// A stamp is `YYYY-MM-DD h:mm am|pm <ZONE>` or `YYYY-MM-DD HH:mm <ZONE>`. It is
|
|
4
|
+
// resolved to an absolute instant using ONLY the zone written in it — nothing here
|
|
5
|
+
// defaults to, or special-cases, any zone. Anything not in the accepted forms is
|
|
6
|
+
// returned unconverted with a reason, so the tab shows it verbatim.
|
|
7
|
+
//
|
|
8
|
+
// IANA and generic zones are resolved with the runtime's built-in `Intl` time-zone
|
|
9
|
+
// data by offset probing: the wall-clock time is tried against every offset the
|
|
10
|
+
// zone has near that date, and the candidates that round-trip are kept. One means
|
|
11
|
+
// success; none is a spring-forward gap; two is a fall-back fold. Gaps and folds
|
|
12
|
+
// are left unconverted rather than broken by a tie-break rule.
|
|
13
|
+
/** Generic North-American zones: DST follows the stamp's date. */
|
|
14
|
+
const GENERIC_ZONES = {
|
|
15
|
+
PT: 'America/Los_Angeles',
|
|
16
|
+
MT: 'America/Denver',
|
|
17
|
+
CT: 'America/Chicago',
|
|
18
|
+
ET: 'America/New_York',
|
|
19
|
+
AKT: 'America/Anchorage',
|
|
20
|
+
HT: 'Pacific/Honolulu',
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Fixed-offset abbreviations, in minutes east of UTC. `CST` is North-American
|
|
24
|
+
* Central (China Standard Time is written `+08:00` or `Asia/Shanghai`). Ambiguous
|
|
25
|
+
* abbreviations (`IST`, `BST`, `AST`, …) are deliberately absent.
|
|
26
|
+
*/
|
|
27
|
+
const FIXED_ZONES = {
|
|
28
|
+
UTC: 0,
|
|
29
|
+
GMT: 0,
|
|
30
|
+
Z: 0,
|
|
31
|
+
PST: -8 * 60,
|
|
32
|
+
PDT: -7 * 60,
|
|
33
|
+
MST: -7 * 60,
|
|
34
|
+
MDT: -6 * 60,
|
|
35
|
+
CST: -6 * 60,
|
|
36
|
+
CDT: -5 * 60,
|
|
37
|
+
EST: -5 * 60,
|
|
38
|
+
EDT: -4 * 60,
|
|
39
|
+
AKST: -9 * 60,
|
|
40
|
+
AKDT: -8 * 60,
|
|
41
|
+
HST: -10 * 60,
|
|
42
|
+
WET: 0,
|
|
43
|
+
WEST: 1 * 60,
|
|
44
|
+
CET: 1 * 60,
|
|
45
|
+
CEST: 2 * 60,
|
|
46
|
+
EET: 2 * 60,
|
|
47
|
+
EEST: 3 * 60,
|
|
48
|
+
MSK: 3 * 60,
|
|
49
|
+
SGT: 8 * 60,
|
|
50
|
+
HKT: 8 * 60,
|
|
51
|
+
JST: 9 * 60,
|
|
52
|
+
KST: 9 * 60,
|
|
53
|
+
AEST: 10 * 60,
|
|
54
|
+
AEDT: 11 * 60,
|
|
55
|
+
NZST: 12 * 60,
|
|
56
|
+
NZDT: 13 * 60,
|
|
57
|
+
};
|
|
58
|
+
const STAMP_RE = /^(\d{4})-(\d{2})-(\d{2})\s+(\d{1,2}):(\d{2})(?:\s*(am|pm))?\s+(\S.*?)\s*$/i;
|
|
59
|
+
const OFFSET_RE = /^(?:UTC|GMT)?([+-])(\d{1,2})(?::?(\d{2}))?$/;
|
|
60
|
+
const MINUTE_MS = 60_000;
|
|
61
|
+
const DAY_MS = 24 * 60 * MINUTE_MS;
|
|
62
|
+
function isIanaZone(name) {
|
|
63
|
+
try {
|
|
64
|
+
new Intl.DateTimeFormat('en-US', { timeZone: name });
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function parseZone(zone) {
|
|
72
|
+
// Own keys only: `in` would let prototype names (`toString`, `__proto__`, …) through.
|
|
73
|
+
if (Object.hasOwn(FIXED_ZONES, zone))
|
|
74
|
+
return { kind: 'fixed', offsetMinutes: FIXED_ZONES[zone] };
|
|
75
|
+
if (Object.hasOwn(GENERIC_ZONES, zone))
|
|
76
|
+
return { kind: 'iana', name: GENERIC_ZONES[zone] };
|
|
77
|
+
const offset = OFFSET_RE.exec(zone);
|
|
78
|
+
if (offset) {
|
|
79
|
+
const hours = Number(offset[2]);
|
|
80
|
+
const minutes = offset[3] ? Number(offset[3]) : 0;
|
|
81
|
+
if (hours > 14 || minutes > 59)
|
|
82
|
+
return null;
|
|
83
|
+
const sign = offset[1] === '-' ? -1 : 1;
|
|
84
|
+
return { kind: 'fixed', offsetMinutes: sign * (hours * 60 + minutes) };
|
|
85
|
+
}
|
|
86
|
+
// IANA names only in Area/Location form, so legacy ids (`EST5EDT`, `IST`, …) are
|
|
87
|
+
// never accepted through the back door.
|
|
88
|
+
if (zone.includes('/') && isIanaZone(zone))
|
|
89
|
+
return { kind: 'iana', name: zone };
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
const formatters = new Map();
|
|
93
|
+
function formatterFor(zone) {
|
|
94
|
+
let f = formatters.get(zone);
|
|
95
|
+
if (!f) {
|
|
96
|
+
f = new Intl.DateTimeFormat('en-US', {
|
|
97
|
+
timeZone: zone,
|
|
98
|
+
hourCycle: 'h23',
|
|
99
|
+
year: 'numeric',
|
|
100
|
+
month: '2-digit',
|
|
101
|
+
day: '2-digit',
|
|
102
|
+
hour: '2-digit',
|
|
103
|
+
minute: '2-digit',
|
|
104
|
+
});
|
|
105
|
+
formatters.set(zone, f);
|
|
106
|
+
}
|
|
107
|
+
return f;
|
|
108
|
+
}
|
|
109
|
+
/** The zone's UTC offset, in minutes, at the given instant. */
|
|
110
|
+
function offsetAt(instantMs, zone) {
|
|
111
|
+
const parts = formatterFor(zone).formatToParts(new Date(instantMs));
|
|
112
|
+
const get = (type) => Number(parts.find(p => p.type === type).value);
|
|
113
|
+
const wallMs = Date.UTC(get('year'), get('month') - 1, get('day'), get('hour'), get('minute'));
|
|
114
|
+
const instantMinute = Math.floor(instantMs / MINUTE_MS) * MINUTE_MS;
|
|
115
|
+
return Math.round((wallMs - instantMinute) / MINUTE_MS);
|
|
116
|
+
}
|
|
117
|
+
/** All instants whose wall-clock time in `zone` is `wallMs` (as if UTC). */
|
|
118
|
+
function instantsForWallClock(wallMs, zone) {
|
|
119
|
+
const offsets = new Set([offsetAt(wallMs - DAY_MS, zone), offsetAt(wallMs, zone), offsetAt(wallMs + DAY_MS, zone)]);
|
|
120
|
+
const instants = new Set();
|
|
121
|
+
for (const offset of offsets) {
|
|
122
|
+
const candidate = wallMs - offset * MINUTE_MS;
|
|
123
|
+
if (offsetAt(candidate, zone) === offset)
|
|
124
|
+
instants.add(candidate);
|
|
125
|
+
}
|
|
126
|
+
return [...instants].sort((a, b) => a - b);
|
|
127
|
+
}
|
|
128
|
+
/** Resolve a heading stamp to an instant using only the zone written in it. */
|
|
129
|
+
export function resolveStamp(raw) {
|
|
130
|
+
const m = STAMP_RE.exec(raw.trim());
|
|
131
|
+
if (!m)
|
|
132
|
+
return { raw, instant: null, unconvertedReason: 'unrecognized-format' };
|
|
133
|
+
const [, y, mo, d, h, mi, meridiem, zoneText] = m;
|
|
134
|
+
// `12:10 am` with no zone backtracks to read `am` as the zone; it has none.
|
|
135
|
+
if (/^(am|pm)$/i.test(zoneText))
|
|
136
|
+
return { raw, instant: null, unconvertedReason: 'unrecognized-format' };
|
|
137
|
+
const year = Number(y);
|
|
138
|
+
const month = Number(mo);
|
|
139
|
+
const day = Number(d);
|
|
140
|
+
let hour = Number(h);
|
|
141
|
+
const minute = Number(mi);
|
|
142
|
+
if (meridiem) {
|
|
143
|
+
if (hour < 1 || hour > 12)
|
|
144
|
+
return { raw, instant: null, unconvertedReason: 'unrecognized-format' };
|
|
145
|
+
const pm = meridiem.toLowerCase() === 'pm';
|
|
146
|
+
hour = (hour % 12) + (pm ? 12 : 0);
|
|
147
|
+
}
|
|
148
|
+
else if (hour > 23) {
|
|
149
|
+
return { raw, instant: null, unconvertedReason: 'unrecognized-format' };
|
|
150
|
+
}
|
|
151
|
+
if (minute > 59)
|
|
152
|
+
return { raw, instant: null, unconvertedReason: 'unrecognized-format' };
|
|
153
|
+
const wallMs = Date.UTC(year, month - 1, day, hour, minute);
|
|
154
|
+
const check = new Date(wallMs);
|
|
155
|
+
if (check.getUTCFullYear() !== year || check.getUTCMonth() !== month - 1 || check.getUTCDate() !== day) {
|
|
156
|
+
return { raw, instant: null, unconvertedReason: 'unrecognized-format' };
|
|
157
|
+
}
|
|
158
|
+
const zone = parseZone(zoneText);
|
|
159
|
+
if (!zone)
|
|
160
|
+
return { raw, instant: null, unconvertedReason: 'unknown-zone' };
|
|
161
|
+
if (zone.kind === 'fixed') {
|
|
162
|
+
return { raw, instant: new Date(wallMs - zone.offsetMinutes * MINUTE_MS).toISOString() };
|
|
163
|
+
}
|
|
164
|
+
const instants = instantsForWallClock(wallMs, zone.name);
|
|
165
|
+
if (instants.length === 0)
|
|
166
|
+
return { raw, instant: null, unconvertedReason: 'nonexistent-time' };
|
|
167
|
+
if (instants.length > 1)
|
|
168
|
+
return { raw, instant: null, unconvertedReason: 'ambiguous-time' };
|
|
169
|
+
return { raw, instant: new Date(instants[0]).toISOString() };
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=stamp.js.map
|
|
@@ -0,0 +1 @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C,CAAC,WAAW,EAAE,EAAE,CAAC;IAC3F,CAAC;IAED,MAAM,QAAQ,GAAG,oBAAoB,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACzD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,CAAC;IAChG,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;IAC5F,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;AAC/D,CAAC"}
|
|
@@ -17,9 +17,30 @@
|
|
|
17
17
|
* correctness bug, since agy's screens classify by an entirely different rule.
|
|
18
18
|
*/
|
|
19
19
|
import type { GateProfile } from './render-gate.js';
|
|
20
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* claude composer profile (marker ❯, dim placeholder — measured, spike g2).
|
|
22
|
+
*
|
|
23
|
+
* `queuesInputMidTurn` measured for Issue #1664 against claude 2.1.266: a message delivered while
|
|
24
|
+
* a turn was streaming landed intact and was submitted as one message at the turn's end in 100 of
|
|
25
|
+
* 100 trials (0 head-loss), and the TUI shows it as `Press up to edit queued messages` in the
|
|
26
|
+
* meantime. Evidence: `codev/evidence/1664-streaming-delivery/`.
|
|
27
|
+
*/
|
|
21
28
|
export declare const CLAUDE_PROFILE: GateProfile;
|
|
22
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* codex composer profile (marker ›, dim placeholder — measured, spike g2).
|
|
31
|
+
*
|
|
32
|
+
* `queuesInputMidTurn` measured for Issue #1664 against codex-cli 0.153.4, by the same harness
|
|
33
|
+
* and the same production delivery path as claude's: 20 of 20 mid-turn deliveries landed intact
|
|
34
|
+
* and were submitted, 0 head-loss, every one written at an instant the retired whole-screen
|
|
35
|
+
* settle would have refused. Evidence: `codev/evidence/1664-streaming-delivery/`.
|
|
36
|
+
*
|
|
37
|
+
* One measured quirk worth knowing, though it needs no code: codex's composer SLIDES DOWN the
|
|
38
|
+
* screen as its transcript grows (measured rows 13 → 37 over ~11 s) until it reaches the bottom
|
|
39
|
+
* and pins. Its row span is part of the fingerprint, so during that phase the region legitimately
|
|
40
|
+
* counts as moving and mail holds — a fresh codex session's first delivery waits for the screen
|
|
41
|
+
* to fill. Transient, self-correcting, and not worth special-casing: a long-lived builder's
|
|
42
|
+
* screen is always full.
|
|
43
|
+
*/
|
|
23
44
|
export declare const CODEX_PROFILE: GateProfile;
|
|
24
45
|
/**
|
|
25
46
|
* agy composer profile (Spec 1313 Phase 3 — net-new measurement). agy breaks the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gate-profiles.d.ts","sourceRoot":"","sources":["../../../src/agent-farm/servers/gate-profiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AA+BpD
|
|
1
|
+
{"version":3,"file":"gate-profiles.d.ts","sourceRoot":"","sources":["../../../src/agent-farm/servers/gate-profiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AA+BpD;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,EAAE,WAK5B,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,aAAa,EAAE,WAK3B,CAAC;AAkBF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,WAAW,EAAE,WAyBzB,CAAC;AAQF;;;;;;;;GAQG;AACH,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,WAAW,GAAG,WAAW,GAAG,IAAI,CAMxE"}
|
|
@@ -45,17 +45,40 @@ const COMPOSER_MARKER = /^[❯›]/;
|
|
|
45
45
|
* from a real capture — a too-loose pattern that matches draft content is a false-clean.
|
|
46
46
|
*/
|
|
47
47
|
const REGION_END_PATTERNS = [/^[─━╌┄]{5,}/, /^\s{2,}(gpt|high:|~\/)/];
|
|
48
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* claude composer profile (marker ❯, dim placeholder — measured, spike g2).
|
|
50
|
+
*
|
|
51
|
+
* `queuesInputMidTurn` measured for Issue #1664 against claude 2.1.266: a message delivered while
|
|
52
|
+
* a turn was streaming landed intact and was submitted as one message at the turn's end in 100 of
|
|
53
|
+
* 100 trials (0 head-loss), and the TUI shows it as `Press up to edit queued messages` in the
|
|
54
|
+
* meantime. Evidence: `codev/evidence/1664-streaming-delivery/`.
|
|
55
|
+
*/
|
|
49
56
|
export const CLAUDE_PROFILE = {
|
|
50
57
|
app: 'claude',
|
|
51
58
|
markerPattern: COMPOSER_MARKER,
|
|
52
59
|
regionEndPatterns: REGION_END_PATTERNS,
|
|
60
|
+
queuesInputMidTurn: true,
|
|
53
61
|
};
|
|
54
|
-
/**
|
|
62
|
+
/**
|
|
63
|
+
* codex composer profile (marker ›, dim placeholder — measured, spike g2).
|
|
64
|
+
*
|
|
65
|
+
* `queuesInputMidTurn` measured for Issue #1664 against codex-cli 0.153.4, by the same harness
|
|
66
|
+
* and the same production delivery path as claude's: 20 of 20 mid-turn deliveries landed intact
|
|
67
|
+
* and were submitted, 0 head-loss, every one written at an instant the retired whole-screen
|
|
68
|
+
* settle would have refused. Evidence: `codev/evidence/1664-streaming-delivery/`.
|
|
69
|
+
*
|
|
70
|
+
* One measured quirk worth knowing, though it needs no code: codex's composer SLIDES DOWN the
|
|
71
|
+
* screen as its transcript grows (measured rows 13 → 37 over ~11 s) until it reaches the bottom
|
|
72
|
+
* and pins. Its row span is part of the fingerprint, so during that phase the region legitimately
|
|
73
|
+
* counts as moving and mail holds — a fresh codex session's first delivery waits for the screen
|
|
74
|
+
* to fill. Transient, self-correcting, and not worth special-casing: a long-lived builder's
|
|
75
|
+
* screen is always full.
|
|
76
|
+
*/
|
|
55
77
|
export const CODEX_PROFILE = {
|
|
56
78
|
app: 'codex',
|
|
57
79
|
markerPattern: COMPOSER_MARKER,
|
|
58
80
|
regionEndPatterns: REGION_END_PATTERNS,
|
|
81
|
+
queuesInputMidTurn: true,
|
|
59
82
|
};
|
|
60
83
|
/**
|
|
61
84
|
* agy (Antigravity CLI) composer marker: a `>` prompt glyph at the input row start — a
|
|
@@ -112,6 +135,24 @@ export const AGY_PROFILE = {
|
|
|
112
135
|
placeholderFgPalette: 8,
|
|
113
136
|
markerRequiresCursorRow: true,
|
|
114
137
|
markerFgPalette: 12,
|
|
138
|
+
// Issue #1664, set by OWNER RULING (2026-09-09) — **UNMEASURED**. Every other value of this
|
|
139
|
+
// field on this page came from driving the real TUI through the acceptance harness; this one
|
|
140
|
+
// did not. The owner's call is that mid-turn delivery is universal and only human input holds
|
|
141
|
+
// mail, so agy is granted the licence rather than waiting on a measurement.
|
|
142
|
+
//
|
|
143
|
+
// What that trades away, stated plainly so a future reader is not misled by the company this
|
|
144
|
+
// line keeps: if agy DROPS or mishandles input arriving mid-turn, a delivery lands as text in
|
|
145
|
+
// its composer that is never submitted — the body strands on the line, the classifier then
|
|
146
|
+
// reads it as `user-text`, and every later message to that agent queues behind it until a
|
|
147
|
+
// human clears the line. That is a stuck agent with a visible cause, not silent data loss, but
|
|
148
|
+
// it is a real failure mode and it is not ruled out by anything in this repository.
|
|
149
|
+
//
|
|
150
|
+
// Settling it is a harness run, not an argument:
|
|
151
|
+
// node --experimental-strip-types scripts/bugfix-1664-streaming-delivery-harness.mts \
|
|
152
|
+
// --harness agy --scenario streaming --trials 20 --assume-queues-input
|
|
153
|
+
// If that reports 20/20 delivered-intact and submitted, replace this comment with the measured
|
|
154
|
+
// one. If it does not, this line is what needs changing.
|
|
155
|
+
queuesInputMidTurn: true,
|
|
115
156
|
};
|
|
116
157
|
/** Registry keyed by the harness name `detectHarnessFromCommand` returns. */
|
|
117
158
|
const PROFILES_BY_HARNESS = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gate-profiles.js","sourceRoot":"","sources":["../../../src/agent-farm/servers/gate-profiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAG/D;;;;;GAKG;AACH,MAAM,eAAe,GAAG,OAAO,CAAC;AAEhC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,mBAAmB,GAAG,CAAC,aAAa,EAAE,wBAAwB,CAAC,CAAC;AAEtE
|
|
1
|
+
{"version":3,"file":"gate-profiles.js","sourceRoot":"","sources":["../../../src/agent-farm/servers/gate-profiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAG/D;;;;;GAKG;AACH,MAAM,eAAe,GAAG,OAAO,CAAC;AAEhC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,mBAAmB,GAAG,CAAC,aAAa,EAAE,wBAAwB,CAAC,CAAC;AAEtE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,cAAc,GAAgB;IACzC,GAAG,EAAE,QAAQ;IACb,aAAa,EAAE,eAAe;IAC9B,iBAAiB,EAAE,mBAAmB;IACtC,kBAAkB,EAAE,IAAI;CACzB,CAAC;A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O,IAAI,OAAO,IAAI,mBAAmB;QAAE,OAAO,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACnF,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IDE prefix forward (Issue #1668).
|
|
3
|
+
*
|
|
4
|
+
* Tower forwards a fixed `/ide/` prefix to a single local VS Code server-web
|
|
5
|
+
* process — plain HTTP here and, for the workbench's own remote-protocol
|
|
6
|
+
* sockets, a raw bidirectional WebSocket pipe (Tower never parses those frames;
|
|
7
|
+
* they are VS Code's protocol, not Tower's — see `tower-websocket.ts` for the
|
|
8
|
+
* contrast with the PTY terminal bridge).
|
|
9
|
+
*
|
|
10
|
+
* Authorization is decided upstream by `isForwardAuthorized` (the HTTP path also
|
|
11
|
+
* passes the general `isRequestAllowed` choke point first); this module only
|
|
12
|
+
* proxies, after that decision. Header hygiene and `x-forwarded-*` stamping
|
|
13
|
+
* happen here, strictly after auth (Issue #1668 §D2).
|
|
14
|
+
*/
|
|
15
|
+
import http from 'node:http';
|
|
16
|
+
import type net from 'node:net';
|
|
17
|
+
/** The tunnel's public authority, for stamping `x-forwarded-*` on tunnel-borne requests. */
|
|
18
|
+
export interface PublicAuthority {
|
|
19
|
+
host: string;
|
|
20
|
+
proto: string;
|
|
21
|
+
prefix: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Merge the IDE connection token into a Cookie header value as `vscode-tkn=…`,
|
|
25
|
+
* preserving every existing cookie and never clobbering an already-present
|
|
26
|
+
* `vscode-tkn` (Issue #1668). Exported for testing.
|
|
27
|
+
*/
|
|
28
|
+
export declare function mergeConnectionTokenCookie(existing: string | string[] | undefined, token: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Derive the tunnel's public authority from the cloud config, matching the
|
|
31
|
+
* `accessUrl` Tower advertises (`tower-tunnel.ts`: `${server_url}/t/${tower_name}/`).
|
|
32
|
+
* Returns null when the tower is not cloud-registered.
|
|
33
|
+
*/
|
|
34
|
+
export declare function getPublicAuthority(): PublicAuthority | null;
|
|
35
|
+
/**
|
|
36
|
+
* Build the header set forwarded to the IDE server: drop hop-by-hop and
|
|
37
|
+
* Tower-internal headers, set the loopback `Host`, and — only when tunnel-borne
|
|
38
|
+
* — stamp `x-forwarded-host` / `x-forwarded-proto` / `x-forwarded-prefix` from
|
|
39
|
+
* the public authority so the workbench builds correct `remoteAuthority` and
|
|
40
|
+
* base-path URLs and never sees a stale upstream port. Response caching headers
|
|
41
|
+
* (`Cache-Control` / `ETag`) are a RESPONSE concern and preserved separately.
|
|
42
|
+
*
|
|
43
|
+
* Pure and exported for unit testing.
|
|
44
|
+
*/
|
|
45
|
+
export declare function buildForwardHeaders(incoming: http.IncomingHttpHeaders, port: number, publicAuthority: PublicAuthority | null, connectionToken: string | null): Record<string, string | string[]>;
|
|
46
|
+
/** True if `pathname` targets the IDE forward prefix (`/ide` or `/ide/…`). */
|
|
47
|
+
export declare function matchIdePrefix(pathname: string): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Forward a plain HTTP request to the local IDE server. Assumes authorization
|
|
50
|
+
* has already passed. Path and query are forwarded unchanged (the workbench
|
|
51
|
+
* runs with `--server-base-path /ide` and selects the workspace from `?folder=`).
|
|
52
|
+
* A dead / unreachable server yields 502, never a crash.
|
|
53
|
+
*/
|
|
54
|
+
export declare function forwardIdeHttp(req: http.IncomingMessage, res: http.ServerResponse, log: (level: 'INFO' | 'ERROR' | 'WARN', message: string) => void): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Forward a WebSocket upgrade to the local IDE server as a raw bidirectional
|
|
57
|
+
* byte pipe. Tower authenticates the upgrade (caller) and then gets out of the
|
|
58
|
+
* way — the workbench speaks VS Code's own remote protocol, which Tower must not
|
|
59
|
+
* parse. Mirrors `tunnel-client.ts handleWebSocketConnect`'s pipe.
|
|
60
|
+
*/
|
|
61
|
+
export declare function forwardIdeWebSocket(req: http.IncomingMessage, socket: net.Socket, head: Buffer, log: (level: 'INFO' | 'ERROR' | 'WARN', message: string) => void): Promise<void>;
|
|
62
|
+
//# sourceMappingURL=ide-forward.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ide-forward.d.ts","sourceRoot":"","sources":["../../../src/agent-farm/servers/ide-forward.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAuChC,4FAA4F;AAC5F,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAUD;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAMzG;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,eAAe,GAAG,IAAI,CAa3D;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,IAAI,CAAC,mBAAmB,EAClC,IAAI,EAAE,MAAM,EACZ,eAAe,EAAE,eAAe,GAAG,IAAI,EACvC,eAAe,EAAE,MAAM,GAAG,IAAI,GAC7B,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CA0BnC;AAED,8EAA8E;AAC9E,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAGxD;AAaD;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,GAAG,EAAE,IAAI,CAAC,eAAe,EACzB,GAAG,EAAE,IAAI,CAAC,cAAc,EACxB,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAC/D,OAAO,CAAC,IAAI,CAAC,C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