@tangle-network/agent-app 0.60.236 → 0.60.238

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 (56) hide show
  1. package/dist/{DesignCanvas-SNE3H3TH.js → DesignCanvas-OW3W2QXW.js} +2 -2
  2. package/dist/{DesignCanvasEditor-G5O75CUT.js → DesignCanvasEditor-TCHZF25W.js} +3 -3
  3. package/dist/VaultPane-RXL3WLA2.js +7 -0
  4. package/dist/assistant/index.js +2 -2
  5. package/dist/chat-routes/attachment-store.d.ts +28 -2
  6. package/dist/chat-routes/dispatch-parts.d.ts +12 -1
  7. package/dist/chat-routes/index.js +41 -2
  8. package/dist/chat-routes/index.js.map +1 -1
  9. package/dist/chat-store/index.js +3 -1
  10. package/dist/chat-store/index.js.map +1 -1
  11. package/dist/chat-store/parts.d.ts +6 -0
  12. package/dist/{chunk-BGDQ7245.js → chunk-2UIRJPC6.js} +2 -2
  13. package/dist/{chunk-I57SNMX4.js → chunk-EWOJATDS.js} +3 -3
  14. package/dist/{chunk-P2NJIDLE.js → chunk-JH3CKHF4.js} +380 -366
  15. package/dist/chunk-JH3CKHF4.js.map +1 -0
  16. package/dist/{chunk-E6UTFXKQ.js → chunk-PYG2N2JX.js} +12 -1
  17. package/dist/{chunk-E6UTFXKQ.js.map → chunk-PYG2N2JX.js.map} +1 -1
  18. package/dist/{chunk-MX3RI3MO.js → chunk-QW6PFYJS.js} +2 -2
  19. package/dist/{chunk-IDQU36M5.js → chunk-RL3Z747H.js} +708 -659
  20. package/dist/chunk-RL3Z747H.js.map +1 -0
  21. package/dist/{chunk-3KXYYAY4.js → chunk-VBWYH7UZ.js} +243 -232
  22. package/dist/chunk-VBWYH7UZ.js.map +1 -0
  23. package/dist/design-canvas-react/components/Toolbar.d.ts +1 -2
  24. package/dist/design-canvas-react/components/toolbar-fields.d.ts +65 -0
  25. package/dist/design-canvas-react/components/toolbar-page-controls.d.ts +20 -0
  26. package/dist/design-canvas-react/components/toolbar-selection-controls.d.ts +22 -0
  27. package/dist/design-canvas-react/components/use-workspace-keyboard.d.ts +24 -0
  28. package/dist/design-canvas-react/components/use-workspace-viewport.d.ts +16 -0
  29. package/dist/design-canvas-react/components/workspace-gesture-state.d.ts +10 -0
  30. package/dist/design-canvas-react/index.js +3 -3
  31. package/dist/design-canvas-react/lazy.js +1 -1
  32. package/dist/public-consultation/index.d.ts +1 -1
  33. package/dist/public-consultation/index.js +2 -2
  34. package/dist/vault/SourceEditor.d.ts +8 -0
  35. package/dist/vault/VaultCreateDialog.d.ts +14 -0
  36. package/dist/vault/VaultDocumentToolbar.d.ts +29 -0
  37. package/dist/vault/VaultPaneNavigation.d.ts +10 -0
  38. package/dist/vault/VaultPaneStates.d.ts +59 -0
  39. package/dist/vault/VaultTreePanel.d.ts +19 -0
  40. package/dist/vault/index.js +1 -1
  41. package/dist/vault/lazy.js +1 -1
  42. package/dist/vault/useVaultDockPlacement.d.ts +5 -0
  43. package/dist/vault/useVaultSearch.d.ts +13 -0
  44. package/dist/vault/vault-tree-paths.d.ts +12 -0
  45. package/dist/web-react/index.js +2 -2
  46. package/package.json +1 -1
  47. package/dist/VaultPane-QEG35UAZ.js +0 -7
  48. package/dist/chunk-3KXYYAY4.js.map +0 -1
  49. package/dist/chunk-IDQU36M5.js.map +0 -1
  50. package/dist/chunk-P2NJIDLE.js.map +0 -1
  51. /package/dist/{DesignCanvas-SNE3H3TH.js.map → DesignCanvas-OW3W2QXW.js.map} +0 -0
  52. /package/dist/{DesignCanvasEditor-G5O75CUT.js.map → DesignCanvasEditor-TCHZF25W.js.map} +0 -0
  53. /package/dist/{VaultPane-QEG35UAZ.js.map → VaultPane-RXL3WLA2.js.map} +0 -0
  54. /package/dist/{chunk-BGDQ7245.js.map → chunk-2UIRJPC6.js.map} +0 -0
  55. /package/dist/{chunk-I57SNMX4.js.map → chunk-EWOJATDS.js.map} +0 -0
  56. /package/dist/{chunk-MX3RI3MO.js.map → chunk-QW6PFYJS.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DesignCanvas
3
- } from "./chunk-3KXYYAY4.js";
3
+ } from "./chunk-VBWYH7UZ.js";
4
4
  import "./chunk-VBKP2NLI.js";
5
5
  import "./chunk-JK7R7BZQ.js";
6
6
  import "./chunk-FENBDSIW.js";
@@ -10,4 +10,4 @@ import "./chunk-TXD5HXLE.js";
10
10
  export {
11
11
  DesignCanvas
12
12
  };
13
- //# sourceMappingURL=DesignCanvas-SNE3H3TH.js.map
13
+ //# sourceMappingURL=DesignCanvas-OW3W2QXW.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DesignCanvasEditor
3
- } from "./chunk-P2NJIDLE.js";
4
- import "./chunk-3KXYYAY4.js";
3
+ } from "./chunk-JH3CKHF4.js";
4
+ import "./chunk-VBWYH7UZ.js";
5
5
  import "./chunk-UTF7H6BK.js";
6
6
  import "./chunk-X556WVBG.js";
7
7
  import "./chunk-VBKP2NLI.js";
@@ -13,4 +13,4 @@ import "./chunk-TXD5HXLE.js";
13
13
  export {
14
14
  DesignCanvasEditor
15
15
  };
16
- //# sourceMappingURL=DesignCanvasEditor-G5O75CUT.js.map
16
+ //# sourceMappingURL=DesignCanvasEditor-TCHZF25W.js.map
@@ -0,0 +1,7 @@
1
+ import {
2
+ VaultPane
3
+ } from "./chunk-RL3Z747H.js";
4
+ export {
5
+ VaultPane
6
+ };
7
+ //# sourceMappingURL=VaultPane-RXL3WLA2.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ReasoningRow,
3
3
  chatToolCallPart
4
- } from "../chunk-BGDQ7245.js";
4
+ } from "../chunk-2UIRJPC6.js";
5
5
  import "../chunk-3HUFJ5LO.js";
6
6
  import "../chunk-BDEBQ4WO.js";
7
7
  import "../chunk-FBVLEGEG.js";
@@ -33,7 +33,7 @@ import "../chunk-VBRUG4N5.js";
33
33
  import "../chunk-B7CL7ENS.js";
34
34
  import "../chunk-PV33JZKV.js";
35
35
  import "../chunk-AMUXRAUO.js";
36
- import "../chunk-E6UTFXKQ.js";
36
+ import "../chunk-PYG2N2JX.js";
37
37
  import "../chunk-ZVEEWGDK.js";
38
38
  import "../chunk-YHRWZZJN.js";
39
39
  import "../chunk-TXD5HXLE.js";
@@ -5,14 +5,17 @@
5
5
  * default implementation — agent-app owns the size/budget/idempotency
6
6
  * mechanism, the product owns where the bytes actually live.
7
7
  *
8
- * One reader, two callers: `resolveChatAttachments` reads only the
8
+ * One reader serves validation, materialization, and dispatch:
9
+ * `resolveChatAttachments` reads only the
9
10
  * authoritative `size` (never trusting the client-reported size), while
10
11
  * `buildDispatchParts` reads the inline `content` (base64 or raw bytes) to
11
- * build a `data:` URI. Both fit behind ONE `ReadAttachmentFn` so a product
12
+ * build a `data:` URI. `prepareDispatchAttachments` copies raw bytes when a
13
+ * product opts in. All share `ReadAttachmentFn` so a product
12
14
  * wires a single vault/object-store adapter, not two. gtm's KV vault (stores
13
15
  * base64 bodies) and `/object-store`'s `ObjectStore` (hands back raw bytes)
14
16
  * both satisfy this shape.
15
17
  */
18
+ import type { ChatAttachmentPart } from '../chat-store/parts';
16
19
  /**
17
20
  * The result of reading one stored attachment. `ok:true` MUST carry the
18
21
  * authoritative decoded byte `size` (the cap is meaningless against a
@@ -46,6 +49,29 @@ export type AttachmentReadResult = {
46
49
  * turn-level exception.
47
50
  */
48
51
  export type ReadAttachmentFn = (scopeId: string, path: string) => Promise<AttachmentReadResult>;
52
+ /** Opt-in copy from the product attachment store to its already-authorized box.
53
+ * Uploads are sequential and their returned byte counts must match the store.
54
+ * The product retains its missing-content sentence and the surrounding trace span. */
55
+ export interface AttachmentMaterialization {
56
+ upload: (absolutePath: string, bytes: Uint8Array) => Promise<{
57
+ size: number;
58
+ }>;
59
+ missingBytesMessage: (path: string) => string;
60
+ }
61
+ /** Prepare carried files before a product constructs its prompt and dispatch input. */
62
+ export interface PrepareDispatchAttachmentsInput {
63
+ attachments: ChatAttachmentPart[];
64
+ historyAttachments?: readonly ChatAttachmentPart[];
65
+ mentionCount?: number;
66
+ scopeId: string;
67
+ readAttachment: ReadAttachmentFn;
68
+ resolveAttachmentPath: (path: string) => string;
69
+ materialize?: AttachmentMaterialization;
70
+ }
71
+ /** Select carried files and optionally copy them before constructing a prompt.
72
+ * Omitted history and materialization preserve the supplied attachment list.
73
+ * `slice(-0)` intentionally retains the apps' current zero-slot behavior. */
74
+ export declare function prepareDispatchAttachments(input: PrepareDispatchAttachmentsInput): Promise<ChatAttachmentPart[]>;
49
75
  /** The ownership identity for one attempted write. The upload and promotion
50
76
  * routes create a unique path for each attempt, and the product adapter stores
51
77
  * this id with it. */
@@ -22,7 +22,7 @@
22
22
  import { type PromptInputPart } from '../sandbox';
23
23
  import { type SandboxExecChannel } from '../sandbox/binary-read';
24
24
  import { type ChatTurnPartInput } from './wire';
25
- import type { ChatAttachmentPart, ChatMentionPart } from '../chat-store/parts';
25
+ import { type ChatAttachmentPart, type ChatMentionPart } from '../chat-store/parts';
26
26
  import type { ReadAttachmentFn } from './attachment-store';
27
27
  export type { PromptInputPart };
28
28
  /** Resolve the outcome of dispatching parts with success status and corresponding value or error message */
@@ -55,6 +55,17 @@ export type ReadSandboxMentionFn = (box: SandboxExecChannel, absolutePath: strin
55
55
  * filename and URL.
56
56
  */
57
57
  export declare function normalizeChatPromptForSandbox(prompt: string | readonly ChatTurnPartInput[]): string | PromptInputPart[];
58
+ /** A persisted message whose attachment pointers accompany its history text. */
59
+ export interface DispatchHistoryMessage {
60
+ role: string;
61
+ content: string;
62
+ parts?: ReadonlyArray<Record<string, unknown>> | null;
63
+ }
64
+ /** Project persisted rows using the same role and attachment policy as dispatch. */
65
+ export declare function projectDispatchHistory(messages: ReadonlyArray<DispatchHistoryMessage>): Array<{
66
+ role: 'user' | 'assistant';
67
+ content: string;
68
+ }>;
58
69
  /** Build input parameters for dispatching chat message parts including text, attachments, mentions, and history */
59
70
  export interface BuildDispatchPartsInput {
60
71
  text: string;
@@ -83,7 +83,7 @@ import {
83
83
  rowIdOf,
84
84
  storeSupportsDraftPersistence,
85
85
  streamChatRouteAsSandboxEvents
86
- } from "../chunk-MX3RI3MO.js";
86
+ } from "../chunk-QW6PFYJS.js";
87
87
  import "../chunk-TCGZFSN5.js";
88
88
  import "../chunk-FENBDSIW.js";
89
89
  import "../chunk-RN4WPTBH.js";
@@ -98,8 +98,9 @@ import "../chunk-MM6RLOXF.js";
98
98
  import {
99
99
  attachmentInputToPart,
100
100
  attachmentKindForMime,
101
+ historyContentWithAttachments,
101
102
  toChatMessageParts
102
- } from "../chunk-E6UTFXKQ.js";
103
+ } from "../chunk-PYG2N2JX.js";
103
104
  import "../chunk-ZVEEWGDK.js";
104
105
  import {
105
106
  ChatTurnInputError,
@@ -2572,6 +2573,36 @@ function createUploadRoute(options) {
2572
2573
  }
2573
2574
 
2574
2575
  // src/chat-routes/attachment-store.ts
2576
+ async function prepareDispatchAttachments(input) {
2577
+ const historyBudget = Math.max(
2578
+ 0,
2579
+ DISPATCH_MAX_MEDIA_PARTS - input.attachments.length - (input.mentionCount ?? 0)
2580
+ );
2581
+ const attachments = input.historyAttachments === void 0 ? input.attachments : [
2582
+ ...input.attachments,
2583
+ ...input.historyAttachments.slice(-historyBudget)
2584
+ ];
2585
+ const materialize = input.materialize;
2586
+ if (!materialize) return attachments;
2587
+ const written = /* @__PURE__ */ new Set();
2588
+ for (const part of attachments) {
2589
+ const target = input.resolveAttachmentPath(part.path);
2590
+ if (written.has(target)) continue;
2591
+ written.add(target);
2592
+ const read = await input.readAttachment(input.scopeId, part.path);
2593
+ if (!read.ok) throw new Error(read.reason);
2594
+ if (!read.bytes) {
2595
+ throw new Error(materialize.missingBytesMessage(part.path));
2596
+ }
2597
+ const result = await materialize.upload(target, read.bytes);
2598
+ if (result.size !== read.size) {
2599
+ throw new Error(
2600
+ `Sandbox attachment size mismatch for ${part.path}: expected ${read.size}, uploaded ${result.size}`
2601
+ );
2602
+ }
2603
+ }
2604
+ return attachments;
2605
+ }
2575
2606
  var ATTACHMENT_STORAGE_FAILURE_MESSAGE = "Attachment storage is temporarily unavailable. Please try again.";
2576
2607
  var ATTACHMENT_ROLLBACK_FAILURE_CODE = "rollback_failed";
2577
2608
  var ATTACHMENT_ROLLBACK_FAILURE_MESSAGE = "Attachment cleanup failed. Please try again.";
@@ -3611,6 +3642,12 @@ function normalizeChatPromptForSandbox(prompt) {
3611
3642
  };
3612
3643
  });
3613
3644
  }
3645
+ function projectDispatchHistory(messages) {
3646
+ return messages.map((message) => ({
3647
+ role: message.role === "assistant" ? "assistant" : "user",
3648
+ content: historyContentWithAttachments(message)
3649
+ }));
3650
+ }
3614
3651
  function readResultToBase64(read) {
3615
3652
  if (typeof read.base64 === "string") return read.base64;
3616
3653
  if (read.bytes) return bytesToBase64(read.bytes);
@@ -3954,7 +3991,9 @@ export {
3954
3991
  parseFileMentions,
3955
3992
  parsePlanFollowUpAttach,
3956
3993
  planFollowUpExecutionId,
3994
+ prepareDispatchAttachments,
3957
3995
  produceChatTurnWithIntelligence,
3996
+ projectDispatchHistory,
3958
3997
  promoteAgentFilePart,
3959
3998
  promptPartsByteSize,
3960
3999
  readCompletedSandboxTurn,