@tea-agent/loop-agent 0.40.0-next.12 → 0.40.0-next.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/README.md +2 -2
- package/dist/build-stamp.json +3 -3
- package/dist/cli/command-definitions.js +9 -5
- package/dist/cli/program.js +38 -3
- package/dist/commands/init-model-catalog.js +22 -0
- package/dist/commands/task-advance.js +23 -1
- package/dist/commands/task-source-prepare.js +5 -0
- package/dist/commands/task-status.js +1 -0
- package/dist/shared/operator/capabilities.js +9 -1
- package/dist/worker/console/chat/assistant-content.js +7 -0
- package/dist/worker/console/chat/chat-event-store.js +82 -11
- package/dist/worker/console/chat/goal-round-driver.js +72 -0
- package/dist/worker/console/chat/goals.js +300 -0
- package/dist/worker/console/chat/pi-runtime.js +140 -4
- package/dist/worker/console/chat/repo-browser.js +94 -12
- package/dist/worker/console/chat/routes.js +482 -29
- package/dist/worker/console/chat/session-catalog.js +48 -0
- package/dist/worker/console/chat/session-store.js +27 -18
- package/dist/worker/console/chat/shortcuts.js +7 -0
- package/dist/worker/console/chat/turn-process.js +32 -3
- package/dist/worker/console/operator-actions.js +16 -2
- package/dist/worker/console/operator-selection.js +6 -2
- package/dist/worker/console/pi-plugins.catalog.json +73658 -0
- package/dist/worker/console/pi-plugins.js +100 -0
- package/dist/worker/console/routes.js +221 -6
- package/dist/worker/console/server.js +172 -42
- package/dist/worker/console/static/assets/{abnfDiagram-N423BO3Z-C_hkwt2J.js → abnfDiagram-N423BO3Z-B0gRLXJs.js} +1 -1
- package/dist/worker/console/static/assets/{arc-s2Q6r96B.js → arc-DldY0Hsk.js} +1 -1
- package/dist/worker/console/static/assets/{architectureDiagram-T3A2C74G-CtgsrwU1.js → architectureDiagram-T3A2C74G-4xHhMRM9.js} +1 -1
- package/dist/worker/console/static/assets/{blockDiagram-VBNYF7ZC-DZ-A7EiJ.js → blockDiagram-VBNYF7ZC-DPym7n0M.js} +1 -1
- package/dist/worker/console/static/assets/{c4Diagram-5PPSVZJV-D2qv0Nyo.js → c4Diagram-5PPSVZJV-cSFzY5yS.js} +1 -1
- package/dist/worker/console/static/assets/channel-4xBA5kwn.js +1 -0
- package/dist/worker/console/static/assets/{chunk-2GRJ4B5K-D-UYpSaW.js → chunk-2GRJ4B5K-w-64RMuc.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-2Q5K7J3B-DAS3jrrt.js → chunk-2Q5K7J3B-Bvue--jh.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-5RXB4S5H-CSbuRcGB.js → chunk-5RXB4S5H-DxqkQnCh.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-5VM5RSS4-BDH1ZO40.js → chunk-5VM5RSS4-C83gOKLK.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-6Q2QTUOP-Dc2cqQIb.js → chunk-6Q2QTUOP-C_V6tKAV.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-GF5L2VYU-CkZuemIW.js → chunk-GF5L2VYU-CPvZQuL9.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-JWPE2WC7-URwjQnte.js → chunk-JWPE2WC7-w31Z_ATM.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-KBJHAD2P-04RHylJK.js → chunk-KBJHAD2P-DermQC9f.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-RYQCIY6F-CvQX56Hh.js → chunk-RYQCIY6F-CmwaYcnB.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-XXDRQBXY-dUF7qura.js → chunk-XXDRQBXY-DLwZqUBf.js} +1 -1
- package/dist/worker/console/static/assets/classDiagram-JCYQIIEL-CkefOueI.js +1 -0
- package/dist/worker/console/static/assets/classDiagram-v2-OCEON4UE-CkefOueI.js +1 -0
- package/dist/worker/console/static/assets/{cose-bilkent-JH36ORCC-COwbfxJE.js → cose-bilkent-JH36ORCC-Dzh7bT73.js} +1 -1
- package/dist/worker/console/static/assets/{cynefin-VYW2F7L2-CaBEJekQ.js → cynefin-VYW2F7L2-CfOcBHtp.js} +1 -1
- package/dist/worker/console/static/assets/{cynefinDiagram-MW4NZA55-COWUBdet.js → cynefinDiagram-MW4NZA55-D0EbCVDZ.js} +1 -1
- package/dist/worker/console/static/assets/{dagre-VZM6K2ZE-BLxVqTn4.js → dagre-VZM6K2ZE-MfOFA6PZ.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-7IWD3JNH-WL0yKfEQ.js → diagram-7IWD3JNH-BOa5-9PN.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-B4RE2ZJO-DaVkKCle.js → diagram-B4RE2ZJO-B6zvJ-aL.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-LBJQPF4R-DdTgnRGf.js → diagram-LBJQPF4R-BKwr5bRF.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-Q27KOJAE-PG2Axo6A.js → diagram-Q27KOJAE-PLI5QLpX.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-UB23O5K3-6vuQzlzI.js → diagram-UB23O5K3-BgYYME3o.js} +1 -1
- package/dist/worker/console/static/assets/{ebnfDiagram-BXEA7PRR-BpXeBz-g.js → ebnfDiagram-BXEA7PRR-D-SpjXk2.js} +1 -1
- package/dist/worker/console/static/assets/{erDiagram-JOGREHBK-PxtUnaa1.js → erDiagram-JOGREHBK--JHpEOka.js} +1 -1
- package/dist/worker/console/static/assets/{flowDiagram-UKHOOZJN-B--Qgvs1.js → flowDiagram-UKHOOZJN-CbkQgWUz.js} +1 -1
- package/dist/worker/console/static/assets/{ganttDiagram-PKOTCBZU-BIfQCgtx.js → ganttDiagram-PKOTCBZU-CTZMAMVE.js} +1 -1
- package/dist/worker/console/static/assets/{gitGraphDiagram-DS77QQ5N-BRaX_E4j.js → gitGraphDiagram-DS77QQ5N-BaUGSDig.js} +1 -1
- package/dist/worker/console/static/assets/index-C4mO0i6P.js +437 -0
- package/dist/worker/console/static/assets/index-C86Y55Or.css +1 -0
- package/dist/worker/console/static/assets/{infoDiagram-6WML65LV-Cd93r4Ab.js → infoDiagram-6WML65LV-DA3WbWjf.js} +1 -1
- package/dist/worker/console/static/assets/{ishikawaDiagram-WSZJBQD7-C4c80iHt.js → ishikawaDiagram-WSZJBQD7-DbhI82U4.js} +1 -1
- package/dist/worker/console/static/assets/{journeyDiagram-NVQOT4AX-Ch5ajf3s.js → journeyDiagram-NVQOT4AX-CJKA3OBG.js} +1 -1
- package/dist/worker/console/static/assets/{kanban-definition-27J2QSJJ-DbpyW1Ut.js → kanban-definition-27J2QSJJ-CF6dIVRa.js} +1 -1
- package/dist/worker/console/static/assets/{linear-BHVjBnTW.js → linear-D4dEtOUL.js} +1 -1
- package/dist/worker/console/static/assets/{mermaid.core-DO70kJ34.js → mermaid.core-ClhMic6O.js} +5 -5
- package/dist/worker/console/static/assets/{mindmap-definition-FAOFIHXS-_P44Zpvs.js → mindmap-definition-FAOFIHXS-NfRin7S2.js} +1 -1
- package/dist/worker/console/static/assets/{pegDiagram-VL7TDLO6-Bgi9FmEd.js → pegDiagram-VL7TDLO6-DlBtBwW-.js} +1 -1
- package/dist/worker/console/static/assets/{pieDiagram-7S7Q4E2Y-C9InDfJn.js → pieDiagram-7S7Q4E2Y-DdIkNHZO.js} +1 -1
- package/dist/worker/console/static/assets/{quadrantDiagram-CIZ2JOQS-DtKrUouv.js → quadrantDiagram-CIZ2JOQS-YD8T98WX.js} +1 -1
- package/dist/worker/console/static/assets/{railroadDiagram-AXF67PYL-zgAD_6Yo.js → railroadDiagram-AXF67PYL-CS4e5zGK.js} +1 -1
- package/dist/worker/console/static/assets/{requirementDiagram-LRYGKXZP-CQNO6kj4.js → requirementDiagram-LRYGKXZP-BpbWoL9r.js} +1 -1
- package/dist/worker/console/static/assets/{sankeyDiagram-W5VNT64P-knKu111P.js → sankeyDiagram-W5VNT64P-DvWy-Mc9.js} +1 -1
- package/dist/worker/console/static/assets/{sequenceDiagram-SI44F4Z6-D6tshiQ6.js → sequenceDiagram-SI44F4Z6-DmoXH5pJ.js} +1 -1
- package/dist/worker/console/static/assets/{sizeCapture-X5ZJPWSS-BMIWJcir.js → sizeCapture-X5ZJPWSS-BY89V1SW.js} +1 -1
- package/dist/worker/console/static/assets/{stateDiagram-OKZ733FA-BP9wRDqc.js → stateDiagram-OKZ733FA-DaK2Iuqr.js} +1 -1
- package/dist/worker/console/static/assets/stateDiagram-v2-UEYNNEHI-DLc5WD-z.js +1 -0
- package/dist/worker/console/static/assets/{swimlanes-SLNWSIFB-DEkM5Dhe.js → swimlanes-SLNWSIFB-VVcozat-.js} +2 -2
- package/dist/worker/console/static/assets/swimlanesDiagram-ULZ7WXOC-DhjxpI7d.js +8 -0
- package/dist/worker/console/static/assets/{timeline-definition-Z64GVDOM-ByBKsL35.js → timeline-definition-Z64GVDOM-D4l1E4Mu.js} +1 -1
- package/dist/worker/console/static/assets/{vennDiagram-T6HMQDX7-waFbNCUy.js → vennDiagram-T6HMQDX7-CJmewqcq.js} +1 -1
- package/dist/worker/console/static/assets/{wardleyDiagram-T6FBY63Y-1ljiY0eZ.js → wardleyDiagram-T6FBY63Y-CsCCYorj.js} +1 -1
- package/dist/worker/console/static/assets/{xychartDiagram-ELKLHX3M-B4ZLHr_L.js → xychartDiagram-ELKLHX3M-CwjILi0N.js} +1 -1
- package/dist/worker/console/static/index.html +2 -2
- package/dist/worker/console/static-src/operator-chat/chat-sse-events.js +95 -25
- package/dist/worker/console/static-src/operator-chat/compaction-message.js +35 -1
- package/dist/worker/console/static-src/operator-chat/open-preview-in-browser.js +3 -1
- package/dist/worker/console/static-src/operator-chat/useChatSessions.js +24 -19
- package/dist/worker/console/static-src/operator-chat/useChatStream.js +0 -11
- package/dist/worker/console/static-src/operator-chat/useChatThread.js +8 -1
- package/dist/worker/console/static-src/operator-chat/useRepoBrowser.js +34 -4
- package/dist/worker/console/static-src/operator-chat/workspace-reorder.js +18 -0
- package/dist/worker/console/static-src/shell/useWorkspaces.js +150 -34
- package/dist/worker/console/workspace-context.js +28 -3
- package/dist/worker/console/workspace-registry.js +333 -60
- package/dist/worker/observe/static/inspect-bootstrap.d.ts +8 -0
- package/dist/worker/observe/static/inspect-bootstrap.js +57 -0
- package/dist/worker/observe/static/inspect-workspace.js +54 -10
- package/dist/worker/observe/static/operator-chrome.css +23 -4
- package/dist/worker/observe/static/operator-chrome.js +6 -2
- package/dist/worker/observe/static/styles.css +78 -25
- package/dist/worker/observe/static/views/dag-inspector.js +2 -1
- package/dist/worker/observe/static/views/dags.js +7 -5
- package/dist/workflows/dag/init-hybrid.js +3 -3
- package/docs/templates/backend-test-dag.json +3 -3
- package/docs/templates/init-managed-agents.md +1 -1
- package/package.json +1 -1
- package/skills/loop-agent/references/command-reference.md +15 -1
- package/dist/worker/console/static/assets/channel-BluaMT3-.js +0 -1
- package/dist/worker/console/static/assets/classDiagram-JCYQIIEL-H-ZpSafr.js +0 -1
- package/dist/worker/console/static/assets/classDiagram-v2-OCEON4UE-H-ZpSafr.js +0 -1
- package/dist/worker/console/static/assets/index-Crrgl8Mx.css +0 -1
- package/dist/worker/console/static/assets/index-vPsp-idE.js +0 -437
- package/dist/worker/console/static/assets/stateDiagram-v2-UEYNNEHI-ClEhytQG.js +0 -1
- package/dist/worker/console/static/assets/swimlanesDiagram-ULZ7WXOC-DPg5IMuu.js +0 -8
|
@@ -4,8 +4,12 @@ import { lstat, open, readdir } from "node:fs/promises";
|
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { guardReadPath, isSensitivePath, scrubSecrets, } from "./explore-tools.js";
|
|
6
6
|
const TREE_LIMIT = 500;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
/** DSH-style bounded source read: large text files return this leading slice
|
|
8
|
+
* instead of being rejected solely because the complete file is larger. */
|
|
9
|
+
export const TEXT_PREVIEW_LIMIT = 512 * 1024;
|
|
10
|
+
/** Full-file ceiling for the sandboxed HTML preview route and its assets. */
|
|
11
|
+
export const HTML_PREVIEW_ASSET_LIMIT = 20 * 1024 * 1024;
|
|
12
|
+
export const REPO_HTML_PREVIEW_ROUTE_PREFIX = "/api/operator/v1/chat/repo/html/";
|
|
9
13
|
const SKIP_DIRS = new Set([
|
|
10
14
|
".git",
|
|
11
15
|
".harness",
|
|
@@ -32,6 +36,45 @@ export class RepoBrowserError extends Error {
|
|
|
32
36
|
function guardedCode(code) {
|
|
33
37
|
return code === "PATH_OUTSIDE_REPO" ? "OUT_OF_REPO" : code;
|
|
34
38
|
}
|
|
39
|
+
/** Match the path-encoded HTML preview route. Keeping workspace + file path in
|
|
40
|
+
* the URL path lets browser-relative CSS/image references retain their scope. */
|
|
41
|
+
export function matchRepoHtmlPreviewRoute(pathname) {
|
|
42
|
+
if (!pathname.startsWith(REPO_HTML_PREVIEW_ROUTE_PREFIX))
|
|
43
|
+
return null;
|
|
44
|
+
const rest = pathname.slice(REPO_HTML_PREVIEW_ROUTE_PREFIX.length);
|
|
45
|
+
const [workspaceId = "", ...pathSegments] = rest.split("/");
|
|
46
|
+
return { workspaceId, rawPath: pathSegments.join("/") };
|
|
47
|
+
}
|
|
48
|
+
export function repoHtmlAssetContentType(rawPath) {
|
|
49
|
+
const extension = path.extname(rawPath).toLowerCase();
|
|
50
|
+
const types = {
|
|
51
|
+
".html": "text/html; charset=utf-8",
|
|
52
|
+
".htm": "text/html; charset=utf-8",
|
|
53
|
+
".css": "text/css; charset=utf-8",
|
|
54
|
+
".js": "text/javascript; charset=utf-8",
|
|
55
|
+
".mjs": "text/javascript; charset=utf-8",
|
|
56
|
+
".json": "application/json; charset=utf-8",
|
|
57
|
+
".txt": "text/plain; charset=utf-8",
|
|
58
|
+
".svg": "image/svg+xml",
|
|
59
|
+
".png": "image/png",
|
|
60
|
+
".jpg": "image/jpeg",
|
|
61
|
+
".jpeg": "image/jpeg",
|
|
62
|
+
".gif": "image/gif",
|
|
63
|
+
".webp": "image/webp",
|
|
64
|
+
".avif": "image/avif",
|
|
65
|
+
".bmp": "image/bmp",
|
|
66
|
+
".ico": "image/x-icon",
|
|
67
|
+
".woff": "font/woff",
|
|
68
|
+
".woff2": "font/woff2",
|
|
69
|
+
".ttf": "font/ttf",
|
|
70
|
+
".otf": "font/otf",
|
|
71
|
+
".mp3": "audio/mpeg",
|
|
72
|
+
".wav": "audio/wav",
|
|
73
|
+
".mp4": "video/mp4",
|
|
74
|
+
".webm": "video/webm",
|
|
75
|
+
};
|
|
76
|
+
return types[extension] ?? "application/octet-stream";
|
|
77
|
+
}
|
|
35
78
|
export async function listRepoDirectory(repoRoot, rawPath) {
|
|
36
79
|
const root = rawPath === "";
|
|
37
80
|
const guard = await guardReadPath(repoRoot, root ? "." : rawPath);
|
|
@@ -92,8 +135,6 @@ export async function readRepoPreview(repoRoot, rawPath) {
|
|
|
92
135
|
const info = await handle.stat();
|
|
93
136
|
if (!info.isFile())
|
|
94
137
|
throw new RepoBrowserError(400, "NOT_A_FILE", "path is not a regular file");
|
|
95
|
-
if (info.size > READ_LIMIT)
|
|
96
|
-
throw new RepoBrowserError(413, "TOO_LARGE", `file exceeds ${READ_LIMIT} byte preview limit`);
|
|
97
138
|
const rechecked = await guardReadPath(repoRoot, rawPath);
|
|
98
139
|
if (!rechecked.ok)
|
|
99
140
|
throw new RepoBrowserError(403, guardedCode(rechecked.code), "file path changed while it was being opened");
|
|
@@ -103,9 +144,10 @@ export async function readRepoPreview(repoRoot, rawPath) {
|
|
|
103
144
|
current.ino !== info.ino)
|
|
104
145
|
throw new RepoBrowserError(403, "OUT_OF_REPO", "file identity changed while it was being opened");
|
|
105
146
|
size = info.size;
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
147
|
+
const readSize = Math.min(size, TEXT_PREVIEW_LIMIT);
|
|
148
|
+
bytes = Buffer.alloc(readSize);
|
|
149
|
+
const bytesRead = readSize
|
|
150
|
+
? (await handle.read(bytes, 0, readSize, 0)).bytesRead
|
|
109
151
|
: 0;
|
|
110
152
|
bytes = bytes.subarray(0, bytesRead);
|
|
111
153
|
}
|
|
@@ -114,17 +156,14 @@ export async function readRepoPreview(repoRoot, rawPath) {
|
|
|
114
156
|
}
|
|
115
157
|
if (bytes.includes(0))
|
|
116
158
|
throw new RepoBrowserError(415, "BINARY_UNSUPPORTED", "binary files cannot be previewed");
|
|
117
|
-
|
|
118
|
-
while (end > 0 && end < bytes.length && (bytes[end] & 0xc0) === 0x80)
|
|
119
|
-
end -= 1;
|
|
120
|
-
const content = scrubSecrets(bytes.subarray(0, end).toString("utf8")).scrubbed;
|
|
159
|
+
const content = scrubSecrets(bytes.toString("utf8")).scrubbed;
|
|
121
160
|
return {
|
|
122
161
|
path: guard.repoRelative,
|
|
123
162
|
kind: "text",
|
|
124
163
|
content,
|
|
125
164
|
language: path.extname(guard.repoRelative).slice(1).toLowerCase() || "text",
|
|
126
165
|
bytes: size,
|
|
127
|
-
truncated: bytes.length
|
|
166
|
+
truncated: size > bytes.length,
|
|
128
167
|
sha256: createHash("sha256").update(bytes).digest("hex"),
|
|
129
168
|
};
|
|
130
169
|
}
|
|
@@ -138,3 +177,46 @@ export async function readRepoPreview(repoRoot, rawPath) {
|
|
|
138
177
|
throw error;
|
|
139
178
|
}
|
|
140
179
|
}
|
|
180
|
+
/** Read one complete file for the sandboxed HTML iframe. Unlike source reads,
|
|
181
|
+
* this route needs complete HTML/CSS/image bytes so documents and relative
|
|
182
|
+
* assets render correctly; the separate 20 MiB cap keeps memory bounded. */
|
|
183
|
+
export async function readRepoHtmlAsset(repoRoot, rawPath) {
|
|
184
|
+
const guard = await guardReadPath(repoRoot, rawPath);
|
|
185
|
+
if (!guard.ok)
|
|
186
|
+
throw new RepoBrowserError(403, guardedCode(guard.code), guard.message);
|
|
187
|
+
try {
|
|
188
|
+
const handle = await open(guard.abs, constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
189
|
+
try {
|
|
190
|
+
const info = await handle.stat();
|
|
191
|
+
if (!info.isFile())
|
|
192
|
+
throw new RepoBrowserError(400, "NOT_A_FILE", "path is not a regular file");
|
|
193
|
+
if (info.size > HTML_PREVIEW_ASSET_LIMIT)
|
|
194
|
+
throw new RepoBrowserError(413, "TOO_LARGE", `file exceeds ${HTML_PREVIEW_ASSET_LIMIT} byte HTML preview limit`);
|
|
195
|
+
const rechecked = await guardReadPath(repoRoot, rawPath);
|
|
196
|
+
if (!rechecked.ok)
|
|
197
|
+
throw new RepoBrowserError(403, guardedCode(rechecked.code), "file path changed while it was being opened");
|
|
198
|
+
const current = await lstat(rechecked.abs);
|
|
199
|
+
if (current.isSymbolicLink() ||
|
|
200
|
+
current.dev !== info.dev ||
|
|
201
|
+
current.ino !== info.ino)
|
|
202
|
+
throw new RepoBrowserError(403, "OUT_OF_REPO", "file identity changed while it was being opened");
|
|
203
|
+
return {
|
|
204
|
+
body: await handle.readFile(),
|
|
205
|
+
contentType: repoHtmlAssetContentType(guard.repoRelative),
|
|
206
|
+
bytes: info.size,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
finally {
|
|
210
|
+
await handle.close();
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
catch (error) {
|
|
214
|
+
if (error instanceof RepoBrowserError)
|
|
215
|
+
throw error;
|
|
216
|
+
if (error.code === "ENOENT")
|
|
217
|
+
throw new RepoBrowserError(404, "NOT_FOUND", "file does not exist");
|
|
218
|
+
if (error.code === "ELOOP")
|
|
219
|
+
throw new RepoBrowserError(403, "OUT_OF_REPO", "symbolic links are not previewable");
|
|
220
|
+
throw error;
|
|
221
|
+
}
|
|
222
|
+
}
|