@tangle-network/agent-app 0.60.114 → 0.60.116

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 (84) hide show
  1. package/dist/VaultPane-OWOPGPXP.js +7 -0
  2. package/dist/assistant/index.js +8 -8
  3. package/dist/chat-react/index.js +2 -2
  4. package/dist/chat-routes/index.js +2 -2
  5. package/dist/{chunk-Y4WLCFDZ.js → chunk-2FLSODOX.js} +6 -6
  6. package/dist/chunk-BTEVD7HG.js +198 -0
  7. package/dist/chunk-BTEVD7HG.js.map +1 -0
  8. package/dist/chunk-FVI2MHUL.js +1152 -0
  9. package/dist/chunk-FVI2MHUL.js.map +1 -0
  10. package/dist/{chunk-RQSYR4AV.js → chunk-GHUQ5HXU.js} +4 -4
  11. package/dist/{chunk-Q7M3GVLL.js → chunk-JCSHTJT6.js} +36 -2
  12. package/dist/chunk-JCSHTJT6.js.map +1 -0
  13. package/dist/{chunk-OGDEUCNW.js → chunk-JGLK5RDK.js} +176 -1
  14. package/dist/chunk-JGLK5RDK.js.map +1 -0
  15. package/dist/{chunk-AB63T2LM.js → chunk-KBJZMR4E.js} +8 -1
  16. package/dist/chunk-KBJZMR4E.js.map +1 -0
  17. package/dist/{chunk-RQSNTJTW.js → chunk-MO7PDQRZ.js} +526 -187
  18. package/dist/chunk-MO7PDQRZ.js.map +1 -0
  19. package/dist/{chunk-MEUNTJL5.js → chunk-N3CYCSKK.js} +6 -1
  20. package/dist/chunk-N3CYCSKK.js.map +1 -0
  21. package/dist/{chunk-56GPDCOJ.js → chunk-TSGWACTC.js} +5 -5
  22. package/dist/eval/index.d.ts +2 -0
  23. package/dist/eval/index.js +64 -0
  24. package/dist/eval/index.js.map +1 -1
  25. package/dist/eval/parity.d.ts +74 -0
  26. package/dist/journeys/cli.d.ts +2 -0
  27. package/dist/journeys/cli.js +165 -0
  28. package/dist/journeys/cli.js.map +1 -0
  29. package/dist/journeys/config.d.ts +96 -0
  30. package/dist/journeys/index.d.ts +18 -0
  31. package/dist/journeys/index.js +731 -0
  32. package/dist/journeys/index.js.map +1 -0
  33. package/dist/journeys/journey.d.ts +173 -0
  34. package/dist/journeys/page-reading.d.ts +42 -0
  35. package/dist/journeys/report.d.ts +51 -0
  36. package/dist/journeys/score.d.ts +115 -0
  37. package/dist/journeys/scrub.d.ts +21 -0
  38. package/dist/journeys/send.d.ts +46 -0
  39. package/dist/journeys/session.d.ts +27 -0
  40. package/dist/journeys/trace-zip.d.ts +28 -0
  41. package/dist/journeys/video.d.ts +53 -0
  42. package/dist/public-consultation/index.d.ts +1 -1
  43. package/dist/runtime/index.js +9 -3
  44. package/dist/runtime/index.js.map +1 -1
  45. package/dist/runtime/router-turn.d.ts +8 -1
  46. package/dist/runtime/router-turn.js +9 -3
  47. package/dist/runtime/turn-knowledge.d.ts +50 -0
  48. package/dist/sandbox/index.d.ts +2 -0
  49. package/dist/sandbox/index.js +13 -1
  50. package/dist/sandbox/sandbox-exec-tool.d.ts +68 -0
  51. package/dist/sandbox/sandbox-run-tool.d.ts +70 -0
  52. package/dist/studio-react/index.js +2 -2
  53. package/dist/teams/index.js +10 -6
  54. package/dist/teams/invitations-api.js +6 -3
  55. package/dist/teams/invitations-api.js.map +1 -1
  56. package/dist/teams/invitations.d.ts +4 -0
  57. package/dist/teams/members-api.js +2 -1
  58. package/dist/teams-react/components/InviteForm.d.ts +20 -0
  59. package/dist/teams-react/contracts.d.ts +2 -0
  60. package/dist/teams-react/index.js +196 -217
  61. package/dist/teams-react/index.js.map +1 -1
  62. package/dist/vault/VaultContentResults.d.ts +29 -0
  63. package/dist/vault/VaultHistoryPanel.d.ts +20 -0
  64. package/dist/vault/VaultPane.d.ts +3 -1
  65. package/dist/vault/contracts.d.ts +38 -0
  66. package/dist/vault/index.js +1 -1
  67. package/dist/vault/lazy.js +1 -1
  68. package/dist/web-react/index.js +22 -22
  69. package/dist/workspace-export/index.js +4 -193
  70. package/dist/workspace-export/index.js.map +1 -1
  71. package/dist/workspace-react/index.js +9 -7
  72. package/dist/workspace-react/index.js.map +1 -1
  73. package/dist/workspace-react/workspace-list.d.ts +7 -1
  74. package/package.json +8 -2
  75. package/dist/VaultPane-JUSNGOV7.js +0 -7
  76. package/dist/chunk-AB63T2LM.js.map +0 -1
  77. package/dist/chunk-MEUNTJL5.js.map +0 -1
  78. package/dist/chunk-OGDEUCNW.js.map +0 -1
  79. package/dist/chunk-Q7M3GVLL.js.map +0 -1
  80. package/dist/chunk-RQSNTJTW.js.map +0 -1
  81. /package/dist/{VaultPane-JUSNGOV7.js.map → VaultPane-OWOPGPXP.js.map} +0 -0
  82. /package/dist/{chunk-Y4WLCFDZ.js.map → chunk-2FLSODOX.js.map} +0 -0
  83. /package/dist/{chunk-RQSYR4AV.js.map → chunk-GHUQ5HXU.js.map} +0 -0
  84. /package/dist/{chunk-56GPDCOJ.js.map → chunk-TSGWACTC.js.map} +0 -0
@@ -412,6 +412,175 @@ function createSandboxPrewarmer(shell, options) {
412
412
  };
413
413
  }
414
414
 
415
+ // src/sandbox/sandbox-run-tool.ts
416
+ var SandboxRunError = class extends Error {
417
+ constructor(code, message, options) {
418
+ super(message, options);
419
+ this.code = code;
420
+ this.name = "SandboxRunError";
421
+ }
422
+ code;
423
+ };
424
+ var DEFAULT_TIMEOUT_MS = 5 * 6e4;
425
+ var TASK_LIMIT = 2e4;
426
+ var SANDBOX_RUN_DESCRIPTION = "Run work that needs a computer in this workspace's sandbox: executing code or scripts, reading or converting PDFs, spreadsheets and archives, filling forms with the installed toolkits, or editing many files. Describe the whole task and the result you need; the sandbox agent does it and returns its answer. Takes seconds to minutes, so use it only when the answer needs the computer.";
427
+ function sandboxPromptRunner(shell, prompt = {}) {
428
+ return (box, task, run) => runSandboxPrompt(shell, box, task, { ...prompt, ...run, disallowQuestions: true });
429
+ }
430
+ function createSandboxRunTool(options) {
431
+ const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
432
+ const runTask = options.runTask;
433
+ const fail2 = (code, message, cause) => {
434
+ const error = new SandboxRunError(code, message, cause === void 0 ? void 0 : { cause });
435
+ options.onFailure?.(error);
436
+ throw error;
437
+ };
438
+ return {
439
+ name: options.name ?? "sandbox_run",
440
+ description: options.description ?? SANDBOX_RUN_DESCRIPTION,
441
+ inputSchema: {
442
+ type: "object",
443
+ properties: { task: { type: "string", description: "The complete task for the sandbox agent, with the result you need back." } },
444
+ required: ["task"],
445
+ additionalProperties: false
446
+ },
447
+ async run(args) {
448
+ const task = typeof args.task === "string" ? args.task.trim() : "";
449
+ if (!task || task.length > TASK_LIMIT) {
450
+ return fail2("invalid_arguments", `task must be 1 to ${TASK_LIMIT} characters`);
451
+ }
452
+ const started = Date.now();
453
+ const signal = AbortSignal.any([AbortSignal.timeout(timeoutMs), ...options.signal ? [options.signal] : []]);
454
+ if (options.warm) await options.warm.leases.turn(options.warm.key).catch(() => {
455
+ });
456
+ let box;
457
+ try {
458
+ box = await options.box(signal);
459
+ } catch (error) {
460
+ if (error instanceof SandboxRunError) return fail2(error.code, error.message, error.cause);
461
+ return fail2("sandbox_unavailable", "The sandbox for this workspace could not start, so this work was not done.", error);
462
+ }
463
+ let answer;
464
+ try {
465
+ answer = await Promise.race([
466
+ runTask(box, task, { signal, timeoutMs: Math.max(1, timeoutMs - (Date.now() - started)) }),
467
+ new Promise((_, reject) => {
468
+ if (signal.aborted) reject(signal.reason);
469
+ signal.addEventListener("abort", () => reject(signal.reason), { once: true });
470
+ })
471
+ ]);
472
+ } catch (error) {
473
+ const timedOut = signal.aborted && !options.signal?.aborted;
474
+ return fail2("sandbox_failed", timedOut ? `The sandbox did not finish within ${Math.round(timeoutMs / 1e3)} s, so this work was not done.` : "The sandbox run failed, so this work was not done.", error);
475
+ }
476
+ if (!answer.trim()) return fail2("sandbox_empty", "The sandbox finished without an answer.");
477
+ return { answer, ms: Date.now() - started };
478
+ }
479
+ };
480
+ }
481
+
482
+ // src/sandbox/sandbox-exec-tool.ts
483
+ var DEFAULT_TIMEOUT_MS2 = 2 * 6e4;
484
+ var DEFAULT_OUTPUT_CHARS = 2e4;
485
+ var COMMAND_LIMIT = 1e4;
486
+ var SANDBOX_EXEC_DESCRIPTION = "Run one shell command in this workspace's sandbox and get its exit code, stdout and stderr. Use it for the installed toolkits and scripts, file conversion and checks. A non-zero exit code is a result to read and fix, not a reason to stop.";
487
+ function tail(text, limit) {
488
+ return text.length > limit ? { text: `\u2026${text.slice(-limit)}`, cut: true } : { text, cut: false };
489
+ }
490
+ function raceAbort(work, signal) {
491
+ return Promise.race([work, new Promise((_, reject) => {
492
+ if (signal.aborted) reject(signal.reason);
493
+ signal.addEventListener("abort", () => reject(signal.reason), { once: true });
494
+ })]);
495
+ }
496
+ function createSandboxExecTool(options) {
497
+ const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS2;
498
+ const outputChars = options.maxOutputChars ?? DEFAULT_OUTPUT_CHARS;
499
+ const fail2 = (code, message, cause) => {
500
+ const error = new SandboxRunError(code, message, cause === void 0 ? void 0 : { cause });
501
+ options.onFailure?.(error);
502
+ throw error;
503
+ };
504
+ let ready = null;
505
+ const place = (signal) => {
506
+ ready ??= (async () => {
507
+ let box;
508
+ try {
509
+ box = await options.box(signal);
510
+ } catch (error) {
511
+ if (error instanceof SandboxRunError) throw error;
512
+ throw new SandboxRunError("sandbox_unavailable", "The sandbox for this workspace could not start, so the command did not run.", { cause: error });
513
+ }
514
+ try {
515
+ await options.prepare?.(box, signal);
516
+ } catch (error) {
517
+ throw new SandboxRunError("sandbox_unavailable", "The sandbox could not be prepared for commands, so the command did not run.", { cause: error });
518
+ }
519
+ return box;
520
+ })();
521
+ ready.catch(() => {
522
+ ready = null;
523
+ });
524
+ return ready;
525
+ };
526
+ return {
527
+ name: options.name ?? "sandbox_exec",
528
+ description: options.description ?? SANDBOX_EXEC_DESCRIPTION,
529
+ inputSchema: {
530
+ type: "object",
531
+ properties: {
532
+ command: { type: "string", description: "One shell command, e.g. `tax-python fill_form.py --form 1040`." },
533
+ cwd: { type: "string", description: "Working directory; defaults to the workspace directory." }
534
+ },
535
+ required: ["command"],
536
+ additionalProperties: false
537
+ },
538
+ async run(args) {
539
+ const command = typeof args.command === "string" ? args.command.trim() : "";
540
+ if (!command || command.length > COMMAND_LIMIT) return fail2("invalid_arguments", `command must be 1 to ${COMMAND_LIMIT} characters`);
541
+ const refusal = options.allow?.(command);
542
+ if (refusal) return fail2("invalid_arguments", refusal);
543
+ const cwd = typeof args.cwd === "string" && args.cwd.trim() ? args.cwd.trim() : options.cwd;
544
+ const started = Date.now();
545
+ const signal = AbortSignal.any([AbortSignal.timeout(timeoutMs), ...options.signal ? [options.signal] : []]);
546
+ if (options.warm) await options.warm.leases.turn(options.warm.key).catch(() => {
547
+ });
548
+ let box;
549
+ try {
550
+ box = await raceAbort(place(signal), signal);
551
+ } catch (error) {
552
+ if (error instanceof SandboxRunError) {
553
+ options.onFailure?.(error);
554
+ throw error;
555
+ }
556
+ return fail2("sandbox_unavailable", "The sandbox did not start in time, so the command did not run.", error);
557
+ }
558
+ let result;
559
+ try {
560
+ result = await raceAbort(box.exec(command, {
561
+ ...cwd ? { cwd } : {},
562
+ ...options.env ? { env: options.env } : {},
563
+ timeoutMs: Math.max(1, timeoutMs - (Date.now() - started))
564
+ }), signal);
565
+ } catch (error) {
566
+ const timedOut = signal.aborted && !options.signal?.aborted;
567
+ return fail2("sandbox_failed", timedOut ? `The command did not finish within ${Math.round(timeoutMs / 1e3)} s.` : "The command could not run in the sandbox.", error);
568
+ }
569
+ const stdout = tail(result.stdout ?? "", outputChars);
570
+ const stderr = tail(result.stderr ?? "", outputChars);
571
+ const files = options.listFiles ? await options.listFiles(box, signal).catch(() => void 0) : void 0;
572
+ return {
573
+ exitCode: result.exitCode,
574
+ stdout: stdout.text,
575
+ stderr: stderr.text,
576
+ truncated: stdout.cut || stderr.cut,
577
+ ms: Date.now() - started,
578
+ ...files ? { files } : {}
579
+ };
580
+ }
581
+ };
582
+ }
583
+
415
584
  // src/sandbox/prewarm-claim-d1.ts
416
585
  var DEFAULT_PREWARM_CLAIM_TABLE = "sandbox_prewarm_claims";
417
586
  var PREWARM_CLAIM_TABLE_DDL = `CREATE TABLE IF NOT EXISTS ${DEFAULT_PREWARM_CLAIM_TABLE} (
@@ -3050,6 +3219,12 @@ export {
3050
3219
  createSandboxTerminalConnectionRoute,
3051
3220
  sandboxPrewarmClaimKey,
3052
3221
  createSandboxPrewarmer,
3222
+ SandboxRunError,
3223
+ SANDBOX_RUN_DESCRIPTION,
3224
+ sandboxPromptRunner,
3225
+ createSandboxRunTool,
3226
+ SANDBOX_EXEC_DESCRIPTION,
3227
+ createSandboxExecTool,
3053
3228
  DEFAULT_PREWARM_CLAIM_TABLE,
3054
3229
  PREWARM_CLAIM_TABLE_DDL,
3055
3230
  createD1PrewarmClaimStore,
@@ -3130,4 +3305,4 @@ export {
3130
3305
  isTerminalPromptEvent,
3131
3306
  detectInteractiveQuestion
3132
3307
  };
3133
- //# sourceMappingURL=chunk-OGDEUCNW.js.map
3308
+ //# sourceMappingURL=chunk-JGLK5RDK.js.map