@tangle-network/agent-app 0.46.45 → 0.46.47

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.
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  ChatEmptyState,
3
3
  ChatMessages
4
- } from "../chunk-YLHEVJQG.js";
5
- import "../chunk-R7IK25XI.js";
4
+ } from "../chunk-67ISDCXH.js";
5
+ import "../chunk-QUEKC2DS.js";
6
6
  import "../chunk-3HUFJ5LO.js";
7
7
  import "../chunk-FBVLEGEG.js";
8
8
  import "../chunk-ENLRJYVW.js";
9
9
  import "../chunk-GEYACSFW.js";
10
10
  import {
11
11
  ChatComposer
12
- } from "../chunk-SGO7KEIW.js";
12
+ } from "../chunk-NKTTJE26.js";
13
13
  import "../chunk-L7MB2LLM.js";
14
14
  import {
15
15
  ModelPicker
16
- } from "../chunk-3JA7EVYZ.js";
16
+ } from "../chunk-PI3IVWFC.js";
17
17
  import "../chunk-BATKJP3P.js";
18
18
  import {
19
19
  AsyncView
@@ -28,7 +28,7 @@ import "../chunk-ZMMIQOFI.js";
28
28
  import "../chunk-M3K2HVQD.js";
29
29
  import "../chunk-YJMCRXQQ.js";
30
30
  import "../chunk-MCYJON3F.js";
31
- import "../chunk-NRG2ZOSN.js";
31
+ import "../chunk-OS2FGYJQ.js";
32
32
 
33
33
  // src/assistant/sse.ts
34
34
  var SSEChunkParser = class {
@@ -5,7 +5,7 @@ import {
5
5
  isChatCapableModel,
6
6
  normalizeModelId,
7
7
  sortModelsByFreshness
8
- } from "../chunk-NRG2ZOSN.js";
8
+ } from "../chunk-OS2FGYJQ.js";
9
9
  export {
10
10
  __resetCatalogCache,
11
11
  buildCatalog,
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  ComposerModeControls,
3
3
  EntryComposer
4
- } from "../chunk-SGO7KEIW.js";
4
+ } from "../chunk-NKTTJE26.js";
5
5
  import "../chunk-L7MB2LLM.js";
6
- import "../chunk-3JA7EVYZ.js";
6
+ import "../chunk-PI3IVWFC.js";
7
7
  import "../chunk-SJWIZT7B.js";
8
8
  import "../chunk-SUO2R2ET.js";
9
9
  import "../chunk-DXHUQ5NO.js";
10
10
  import "../chunk-MCYJON3F.js";
11
- import "../chunk-NRG2ZOSN.js";
11
+ import "../chunk-OS2FGYJQ.js";
12
12
  export {
13
13
  ComposerModeControls,
14
14
  EntryComposer
@@ -112,7 +112,7 @@ import {
112
112
  flattenHistory,
113
113
  readSandboxBinaryBytes,
114
114
  statSandboxFileSize
115
- } from "../chunk-N55NM3W2.js";
115
+ } from "../chunk-FS6YF4ZV.js";
116
116
  import "../chunk-MCYJON3F.js";
117
117
  import "../chunk-LWSJK546.js";
118
118
  import "../chunk-P5PIAQVS.js";
@@ -23,7 +23,7 @@ import {
23
23
  PopoverSurface,
24
24
  usePending,
25
25
  usePopover
26
- } from "./chunk-3JA7EVYZ.js";
26
+ } from "./chunk-PI3IVWFC.js";
27
27
  import {
28
28
  AsyncView
29
29
  } from "./chunk-3UBAO3N5.js";
@@ -5959,4 +5959,4 @@ export {
5959
5959
  useThinkingSeconds,
5960
5960
  ChatMessages
5961
5961
  };
5962
- //# sourceMappingURL=chunk-YLHEVJQG.js.map
5962
+ //# sourceMappingURL=chunk-67ISDCXH.js.map
@@ -2288,6 +2288,65 @@ function applyPromptTokenLimits(profile, limits) {
2288
2288
  }
2289
2289
  };
2290
2290
  }
2291
+ function cachedSandboxPromptEvents(cached, fallbackExecutionId) {
2292
+ const cachedResult = cached.result;
2293
+ const executionId = typeof cachedResult.executionId === "string" && cachedResult.executionId.trim() ? cachedResult.executionId : fallbackExecutionId;
2294
+ const finalText = typeof cachedResult.finalText === "string" ? cachedResult.finalText : typeof cachedResult.response === "string" ? cachedResult.response : typeof cachedResult.text === "string" ? cachedResult.text : void 0;
2295
+ return [
2296
+ {
2297
+ type: "result",
2298
+ data: {
2299
+ ...cachedResult,
2300
+ ...finalText !== void 0 && cachedResult.finalText === void 0 ? { finalText } : {},
2301
+ sessionId: cached.sessionId,
2302
+ executionId
2303
+ }
2304
+ },
2305
+ {
2306
+ type: "done",
2307
+ data: {
2308
+ sessionId: cached.sessionId,
2309
+ executionId,
2310
+ status: "completed",
2311
+ outcome: { type: "completed" }
2312
+ }
2313
+ }
2314
+ ];
2315
+ }
2316
+ async function* detachedSandboxPromptEvents(box, prompt, options, backend) {
2317
+ const sessionId = options.sessionId?.trim();
2318
+ const executionId = options.executionId?.trim();
2319
+ if (!sessionId || !executionId) {
2320
+ throw new Error("streamSandboxPrompt detach requires stable sessionId and executionId");
2321
+ }
2322
+ const lastEventId = options.lastEventId?.trim() || void 0;
2323
+ const turnId = options.turnId?.trim() || executionId;
2324
+ const admission = lastEventId ? null : await box.dispatchPrompt(prompt, {
2325
+ sessionId,
2326
+ executionId,
2327
+ turnId,
2328
+ backend,
2329
+ ...options.requireVisibleAssistantOutput !== void 0 ? { requireVisibleAssistantOutput: options.requireVisibleAssistantOutput } : {},
2330
+ ...options.timeoutMs !== void 0 ? { timeoutMs: options.timeoutMs } : {}
2331
+ });
2332
+ const admittedExecutionId = admission?.executionId ?? executionId;
2333
+ if (!admittedExecutionId) {
2334
+ throw new Error(`detached Sandbox dispatch for ${sessionId} returned no executionId`);
2335
+ }
2336
+ if (admission?.dispatched === false) {
2337
+ const cached = await box.findCompletedTurn(turnId, { sessionId });
2338
+ if (cached) {
2339
+ yield* cachedSandboxPromptEvents(cached, admittedExecutionId);
2340
+ return;
2341
+ }
2342
+ }
2343
+ yield* box.streamPrompt("", {
2344
+ sessionId: admission?.sessionId ?? sessionId,
2345
+ executionId: admittedExecutionId,
2346
+ lastEventId: lastEventId || "0",
2347
+ ...options.signal ? { signal: options.signal } : {}
2348
+ });
2349
+ }
2291
2350
  function optionalNonNegativeNumber(value, field) {
2292
2351
  if (value === void 0) return void 0;
2293
2352
  if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
@@ -2422,7 +2481,13 @@ async function* streamSandboxPrompt(shell, box, message, options) {
2422
2481
  await fingerprintAgentProfile(profileWithLimits, { model: model?.model, harness })
2423
2482
  );
2424
2483
  }
2425
- const stream = box.streamPrompt(prompt, {
2484
+ const backend = {
2485
+ type: harness,
2486
+ profile: profileWithLimits,
2487
+ ...model ? { model } : {},
2488
+ ...options?.interactions ? { interactions: options.interactions } : {}
2489
+ };
2490
+ const stream = options?.detach ? detachedSandboxPromptEvents(box, prompt, options, backend) : box.streamPrompt(prompt, {
2426
2491
  sessionId: options?.sessionId,
2427
2492
  executionId: options?.executionId,
2428
2493
  turnId: options?.turnId,
@@ -2430,13 +2495,7 @@ async function* streamSandboxPrompt(shell, box, message, options) {
2430
2495
  ...options?.signal ? { signal: options.signal } : {},
2431
2496
  ...options?.timeoutMs !== void 0 ? { timeoutMs: options.timeoutMs } : {},
2432
2497
  ...options?.requireVisibleAssistantOutput !== void 0 ? { requireVisibleAssistantOutput: options.requireVisibleAssistantOutput } : {},
2433
- ...options?.detach ? { detach: true } : {},
2434
- backend: {
2435
- type: harness,
2436
- profile: profileWithLimits,
2437
- ...model ? { model } : {},
2438
- ...options?.interactions ? { interactions: options.interactions } : {}
2439
- }
2498
+ backend
2440
2499
  });
2441
2500
  emitSandboxActivity(options?.spend, box);
2442
2501
  let severedFinishReason = null;
@@ -2770,4 +2829,4 @@ export {
2770
2829
  isTerminalPromptEvent,
2771
2830
  detectInteractiveQuestion
2772
2831
  };
2773
- //# sourceMappingURL=chunk-N55NM3W2.js.map
2832
+ //# sourceMappingURL=chunk-FS6YF4ZV.js.map