@tangle-network/agent-app 0.60.226 → 0.60.228

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.
Files changed (59) hide show
  1. package/README.md +6 -0
  2. package/dist/chat-routes/index.js +6 -6
  3. package/dist/chat-routes/turn-routes.d.ts +2 -0
  4. package/dist/{chunk-EKV6T4YU.js → chunk-7QZNHBQT.js} +8 -1
  5. package/dist/chunk-7QZNHBQT.js.map +1 -0
  6. package/dist/{chunk-ILAQQYVL.js → chunk-BKVDPMFD.js} +2 -2
  7. package/dist/{chunk-YS2RYZQG.js → chunk-JILHXHJE.js} +789 -745
  8. package/dist/chunk-JILHXHJE.js.map +1 -0
  9. package/dist/{chunk-2TJWEFFM.js → chunk-LHGYK5I3.js} +4 -2
  10. package/dist/chunk-LHGYK5I3.js.map +1 -0
  11. package/dist/{chunk-EGIVLTLQ.js → chunk-PTB2B2OO.js} +21 -3
  12. package/dist/chunk-PTB2B2OO.js.map +1 -0
  13. package/dist/{chunk-XAD4VTP4.js → chunk-TEIKC276.js} +2 -2
  14. package/dist/{chunk-6XF3T6YD.js → chunk-TVPH5T4F.js} +26 -14
  15. package/dist/chunk-TVPH5T4F.js.map +1 -0
  16. package/dist/public-consultation/index.js +3 -3
  17. package/dist/rollout/d1.d.ts +9 -3
  18. package/dist/rollout/d1.js +11 -4
  19. package/dist/rollout/d1.js.map +1 -1
  20. package/dist/runtime/index.js +3 -3
  21. package/dist/runtime/router-turn.js +2 -2
  22. package/dist/sandbox/access.d.ts +46 -0
  23. package/dist/sandbox/app-tools.d.ts +129 -0
  24. package/dist/sandbox/box-health.d.ts +8 -0
  25. package/dist/sandbox/configuration.d.ts +280 -0
  26. package/dist/sandbox/credentials.d.ts +55 -0
  27. package/dist/sandbox/exec-failure.d.ts +9 -0
  28. package/dist/sandbox/existing-box.d.ts +43 -0
  29. package/dist/sandbox/index.d.ts +32 -950
  30. package/dist/sandbox/index.js +1 -1
  31. package/dist/sandbox/lifecycle-errors.d.ts +51 -0
  32. package/dist/sandbox/payload-limits.d.ts +55 -0
  33. package/dist/sandbox/product-egress.d.ts +4 -0
  34. package/dist/sandbox/profile-corpus.d.ts +16 -0
  35. package/dist/sandbox/profile-files.d.ts +16 -0
  36. package/dist/sandbox/prompt-dispatch.d.ts +14 -0
  37. package/dist/sandbox/prompt-events.d.ts +71 -0
  38. package/dist/sandbox/prompt-options.d.ts +79 -0
  39. package/dist/sandbox/prompt-profile.d.ts +61 -0
  40. package/dist/sandbox/prompt-result.d.ts +57 -0
  41. package/dist/sandbox/runtime-cache.d.ts +43 -0
  42. package/dist/sandbox/runtime-connection.d.ts +9 -0
  43. package/dist/sandbox/shell-path.d.ts +2 -0
  44. package/dist/sandbox/workspace-boxes.d.ts +76 -0
  45. package/dist/sandbox/workspace-claim.d.ts +13 -0
  46. package/dist/sandbox/workspace-provision.d.ts +9 -0
  47. package/dist/signoff/app-defaults.d.ts +4 -3
  48. package/dist/signoff/cli.js +1 -1
  49. package/dist/signoff/index.js +1 -1
  50. package/dist/turn-trace/index.js +2 -2
  51. package/dist/turn-trace/recorder.d.ts +4 -0
  52. package/package.json +1 -1
  53. package/dist/chunk-2TJWEFFM.js.map +0 -1
  54. package/dist/chunk-6XF3T6YD.js.map +0 -1
  55. package/dist/chunk-EGIVLTLQ.js.map +0 -1
  56. package/dist/chunk-EKV6T4YU.js.map +0 -1
  57. package/dist/chunk-YS2RYZQG.js.map +0 -1
  58. /package/dist/{chunk-ILAQQYVL.js.map → chunk-BKVDPMFD.js.map} +0 -0
  59. /package/dist/{chunk-XAD4VTP4.js.map → chunk-TEIKC276.js.map} +0 -0
@@ -116,10 +116,11 @@ import { existsSync as existsSync2, mkdtempSync, readFileSync, rmSync, statSync
116
116
  import { tmpdir } from "os";
117
117
  import { join as join2, posix } from "path";
118
118
  var APP_DEFAULTS_STEP = "agent-app defaults";
119
- var EXEMPTIBLE_DEFAULTS = ["turn-trace", "first-text", "prewarm", "placement", "limit-alarms"];
119
+ var EXEMPTIBLE_DEFAULTS = ["turn-trace", "first-visible", "first-text", "prewarm", "placement", "limit-alarms"];
120
120
  var AGENT_APP_OUTCOME_FLOORS = [
121
121
  { id: "turn-trace", label: "turn trace", since: "0.60.199" },
122
122
  { id: "first-text", label: "first text", since: "0.60.203" },
123
+ { id: "first-visible", label: "first visible", since: "0.60.227" },
123
124
  // createChatTurnRoutes exports every turn without a sink option, and a turn handed to `handoffCompletion` too.
124
125
  { id: "default-trace", label: "default turn trace", since: "0.60.221" },
125
126
  { id: "router-turn-defaults", label: "router-turn defaults (gzip and D1 queries)", since: "0.60.225" }
@@ -277,19 +278,25 @@ function turnTraceRow(pin, sources, calls, exports) {
277
278
  }
278
279
  return { row: { id: "turn-trace", label: "turn trace", status: "ok", detail: `${wired}; last export not checked` }, optedOut: null, wired: true };
279
280
  }
280
- function firstTextRow(pin, sources, traceWired, calls, exports) {
281
- const floor = AGENT_APP_OUTCOME_FLOORS.find((entry) => entry.id === "first-text")?.since ?? "";
281
+ function firstOutputRow(kind, pin, sources, traceWired, calls, exports) {
282
+ const id = kind === "visible" ? "first-visible" : "first-text";
283
+ const label = `first ${kind}`;
284
+ const method = kind === "visible" ? "markFirstVisible" : "markFirstText";
285
+ const metric = kind === "visible" ? "first_visible_ms" : "first_text_ms";
286
+ const field = kind === "visible" ? "firstVisibleMs" : "firstTextMs";
287
+ const floor = AGENT_APP_OUTCOME_FLOORS.find((entry) => entry.id === id)?.since ?? "";
282
288
  const tuple = pin === null ? null : versionTuple(pin);
283
- const marks = filesMatching(sources, /\.markFirstText\s*\(/).length > 0;
289
+ const marks = filesMatching(sources, new RegExp(`\\.${method}\\s*\\(`)).length > 0;
284
290
  const routes = filesMatching(sources, /\bcreateChatTurnRoutes\s*[(<]/).length > 0;
285
- if (!traceWired) return { id: "first-text", label: "first text", status: "gap", detail: "needs the turn trace" };
286
- if (tuple !== null && !atLeast(tuple, floor)) return { id: "first-text", label: "first text", status: "gap", detail: `agent-app ${pin} does not mark first text; ${floor} does` };
287
- if (!routes && !marks) return { id: "first-text", label: "first text", status: "gap", detail: "the turn owner does not call trace.markFirstText() and the app does not use createChatTurnRoutes" };
291
+ if (!traceWired) return { id, label, status: "gap", detail: "needs the turn trace" };
292
+ if (tuple !== null && !atLeast(tuple, floor)) return { id, label, status: "gap", detail: `agent-app ${pin} does not mark ${label}; ${floor} does` };
293
+ if (!routes && !marks) return { id, label, status: "gap", detail: `the turn owner does not call trace.${method}() and the app does not use createChatTurnRoutes` };
288
294
  const project = calls.find((call) => call.project)?.project ?? routeProjects(sources).find((call) => call.project)?.project ?? null;
289
295
  const last = project === null ? void 0 : exports?.get(project);
290
- const observed = last?.firstTextMs === void 0 ? "" : `; last turn first_text_ms ${Math.round(last.firstTextMs)}`;
291
- if (last && last.firstTextMs === void 0) return { id: "first-text", label: "first text", status: "gap", detail: "the last exported turn has no tangle.turn.first_text_ms" };
292
- return { id: "first-text", label: "first text", status: "ok", detail: `${routes ? "createChatTurnRoutes marks it" : "the turn owner marks it"}${observed}` };
296
+ const measured = last?.[field];
297
+ const observed = measured === void 0 ? "" : `; last turn ${metric} ${Math.round(measured)}`;
298
+ if (last && measured === void 0) return { id, label, status: "gap", detail: `the last exported turn has no tangle.turn.${metric}` };
299
+ return { id, label, status: "ok", detail: `${routes ? "createChatTurnRoutes marks it" : "the turn owner marks it"}${observed}` };
293
300
  }
294
301
  function prewarmRow(sources) {
295
302
  const usesBox = filesMatching(sources, /@tangle-network\/agent-app\/sandbox|\bensureWorkspaceSandbox\b/).length > 0;
@@ -406,7 +413,8 @@ function checkAppDefaults(repoRoot, options = {}) {
406
413
  const reports = [
407
414
  { row: pinRow(pin, pkg.spec), id: null, optedOut: null },
408
415
  { row: trace.row, id: "turn-trace", optedOut: trace.optedOut },
409
- { row: firstTextRow(pin, sources, traceWired, calls, options.exports), id: "first-text", optedOut: null },
416
+ { row: firstOutputRow("visible", pin, sources, traceWired, calls, options.exports), id: "first-visible", optedOut: null },
417
+ { row: firstOutputRow("text", pin, sources, traceWired, calls, options.exports), id: "first-text", optedOut: null },
410
418
  { row: prewarmRow(sources), id: "prewarm", optedOut: null },
411
419
  { row: placementRow(configs), id: "placement", optedOut: null },
412
420
  { row: toolCountRow(), id: null, optedOut: null },
@@ -426,8 +434,10 @@ function checkAppDefaults(repoRoot, options = {}) {
426
434
  }
427
435
  const traceResolved = rows.find((row) => row.id === "turn-trace");
428
436
  if (trace.optedOut && traceResolved) {
429
- const at = rows.findIndex((row) => row.id === "first-text");
430
- rows[at] = { id: "first-text", label: "first text", status: traceResolved.status, detail: "the turn trace is turned off" };
437
+ for (const id of ["first-visible", "first-text"]) {
438
+ const at = rows.findIndex((row) => row.id === id);
439
+ rows[at] = { ...rows[at], status: traceResolved.status, detail: "the turn trace is turned off" };
440
+ }
431
441
  }
432
442
  apps.push({ app: pkg.name, dir: pkg.dir, pin, rows, findings: appFindings });
433
443
  findings.push(...appFindings.map((finding) => `${pkg.name}: ${finding}`));
@@ -468,10 +478,12 @@ async function readLastTurnExport(project, options) {
468
478
  const newest = listing.items?.[0];
469
479
  if (!newest) return null;
470
480
  const spans = await get(`/v1/traces/${newest.traceId}/spans`);
481
+ const firstVisibleMs = Number(spans.items?.find((span) => span.name === "agent_app.turn")?.attributes?.["tangle.turn.first_visible_ms"]);
471
482
  const firstTextMs = Number(spans.items?.find((span) => span.name === "agent_app.turn")?.attributes?.["tangle.turn.first_text_ms"]);
472
483
  return {
473
484
  at: Number(BigInt(newest.startUnixNano) / 1000000n),
474
485
  traceId: newest.traceId,
486
+ ...Number.isFinite(firstVisibleMs) ? { firstVisibleMs } : {},
475
487
  ...Number.isFinite(firstTextMs) ? { firstTextMs } : {}
476
488
  };
477
489
  }
@@ -2828,4 +2840,4 @@ export {
2828
2840
  formatWorkspaceSurfaceReport,
2829
2841
  runWorkspaceSurfaceCli
2830
2842
  };
2831
- //# sourceMappingURL=chunk-6XF3T6YD.js.map
2843
+ //# sourceMappingURL=chunk-TVPH5T4F.js.map