@tangle-network/agent-app 0.50.6 → 0.50.8

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.
@@ -99,7 +99,7 @@ import {
99
99
  workspaceSandboxRecoveryMessage,
100
100
  workspaceSandboxRecoveryRecommendedActions,
101
101
  writeProfileFilesToBox
102
- } from "../chunk-P5ZJQKOI.js";
102
+ } from "../chunk-2TZLCQ5U.js";
103
103
  import "../chunk-MCYJON3F.js";
104
104
  import "../chunk-LWSJK546.js";
105
105
  import "../chunk-FZOGDD2E.js";
@@ -0,0 +1,9 @@
1
+ import type { AgentProfile } from '@tangle-network/agent-interface/profile';
2
+ export interface AgentProfileEditorProps {
3
+ value: AgentProfile;
4
+ onChange: (value: AgentProfile) => void;
5
+ disabled?: boolean;
6
+ className?: string;
7
+ }
8
+ /** Controlled editor for the canonical profile. The product owns save and execution authority. */
9
+ export declare function AgentProfileEditor({ value, onChange, disabled, className }: AgentProfileEditorProps): import("react").JSX.Element;
@@ -30,6 +30,7 @@ import type { WorkProductPersistedPart } from '../work-product/types';
30
30
  export * from './chat-stream';
31
31
  export * from './chat-interactions';
32
32
  export * from './chat-composer';
33
+ export * from './agent-profile-editor';
33
34
  export * from './composer-file-accept';
34
35
  export * from './interaction-card-support';
35
36
  export * from './interaction-question-card';
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  AgentActivityPanel,
3
+ AgentProfileEditor,
3
4
  ApiAccessPanel,
4
5
  ChatEmptyState,
5
6
  ChatMessages,
@@ -128,7 +129,7 @@ import {
128
129
  withoutRecordGridCreated,
129
130
  withoutRecordGridRemoved,
130
131
  withoutRecordGridUpdate
131
- } from "../chunk-5DEQ2FJK.js";
132
+ } from "../chunk-ZYJCWKZ7.js";
132
133
  import {
133
134
  SessionHistoryPanel,
134
135
  formatSessionTimestamp,
@@ -255,6 +256,7 @@ import {
255
256
  export {
256
257
  ATTACHMENT_ACCEPT,
257
258
  AgentActivityPanel,
259
+ AgentProfileEditor,
258
260
  AgentSessionControls,
259
261
  ApiAccessPanel,
260
262
  ChatComposer,
@@ -56,11 +56,17 @@ export interface WorkspaceAppHttpProof {
56
56
  export declare function confirmWorkspaceAppReady(app: WorkspaceAppRecord, proof: WorkspaceAppHttpProof): WorkspaceAppRecord;
57
57
  /** Refresh delivery state without changing which sandbox service this app means. */
58
58
  export declare function refreshWorkspaceAppPreview(app: WorkspaceAppRecord, link: WorkspaceAppPreviewLink, updatedAt?: string): WorkspaceAppRecord;
59
- export interface WorkspaceAppBuilderInstructionsOptions {
60
- /** Host tool that writes or updates the app registration after creating a preview link. */
59
+ export type WorkspaceAppBuilderInstructionsOptions = {
60
+ /** Host tool that writes the registration after creating a trusted preview. */
61
61
  publishTool: string;
62
62
  /** Optional host tool for finding app IDs the builder may update. */
63
63
  listTool?: string;
64
- }
64
+ manifestPath?: never;
65
+ } | {
66
+ /** Host-scoped manifest the builder writes after creating runnable projects. */
67
+ manifestPath: string;
68
+ publishTool?: never;
69
+ listTool?: never;
70
+ };
65
71
  /** Portable instructions for an agent profile that builds workspace apps. */
66
- export declare function workspaceAppBuilderInstructions({ publishTool, listTool, }: WorkspaceAppBuilderInstructionsOptions): string[];
72
+ export declare function workspaceAppBuilderInstructions(options: WorkspaceAppBuilderInstructionsOptions): string[];
@@ -72,23 +72,42 @@ function toolName(value) {
72
72
  }
73
73
  return value;
74
74
  }
75
- function workspaceAppBuilderInstructions({
76
- publishTool,
77
- listTool
78
- }) {
79
- const publish = toolName(publishTool);
80
- const list = listTool ? toolName(listTool) : void 0;
81
- return [
75
+ function builderManifestPath(value) {
76
+ if (!/^[A-Za-z0-9._-]+(?:[/][A-Za-z0-9._-]+)*$/.test(value) || value.split("/").some((segment) => segment === ".." || segment === ".")) {
77
+ throw new Error("Invalid workspace app manifest path");
78
+ }
79
+ return value;
80
+ }
81
+ function workspaceAppBuilderInstructions(options) {
82
+ const common = [
82
83
  "Build a working HTTP application in the current sandbox when the user asks for an app.",
83
- ...list ? ["Use " + list + " to inspect the existing apps before creating or updating one."] : [],
84
- "Start its server on 0.0.0.0 using an available, unclaimed port.",
85
- "Call " + publish + " with the app name, stable app ID when updating, and listening port.",
86
- "Use the host tool result as the source of the registered app URL and status; never invent a preview URL.",
87
84
  "Keep the same app ID for later revisions of that app.",
88
85
  "Treat a preview link as public. Do not embed secrets or private business facts in client code or responses.",
89
86
  "Read real business data through authorized product APIs. Do not fabricate records to make the app look complete.",
90
87
  "Report the app as available only after the host confirms its preview is ready."
91
88
  ];
89
+ if (options.manifestPath !== void 0) {
90
+ const path = builderManifestPath(options.manifestPath);
91
+ return [
92
+ common[0],
93
+ "Inspect the existing app projects and manifest before creating or updating an app.",
94
+ "Keep each runnable project under apps/<id> relative to the sandbox working directory. Give it a package.json dev script; its HTTP server must listen on 0.0.0.0 and use PORT when supplied.",
95
+ "Write " + path + " as JSON with exactly an apps array of { id, name, projectPath } records; each projectPath is apps/<id>.",
96
+ "Do not put URLs, credentials, tokens, sandbox IDs, or preview IDs in that manifest.",
97
+ "The host reads this manifest and owns server launch, port selection, preview creation, registration, and access policy.",
98
+ ...common.slice(1)
99
+ ];
100
+ }
101
+ const publish = toolName(options.publishTool);
102
+ const list = options.listTool ? toolName(options.listTool) : void 0;
103
+ return [
104
+ common[0],
105
+ ...list ? ["Use " + list + " to inspect the existing apps before creating or updating one."] : [],
106
+ "Start its server on 0.0.0.0 using an available, unclaimed port.",
107
+ "Call " + publish + " with the app name, stable app ID when updating, and listening port.",
108
+ "Use the host tool result as the source of the registered app URL and status; never invent a preview URL.",
109
+ ...common.slice(1)
110
+ ];
92
111
  }
93
112
  export {
94
113
  confirmWorkspaceAppReady,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/workspace-apps/index.ts"],"sourcesContent":["/** A sandbox app registered in one product workspace. Products persist and authorize these rows. */\nexport interface WorkspaceAppRecord {\n id: string\n workspaceId: string\n name: string\n sandboxId: string\n previewId: string\n port: number\n previewUrl: string\n status: 'starting' | 'ready' | 'unavailable'\n createdAt: string\n updatedAt: string\n}\n\n/** Structural shape returned by the Sandbox SDK previewLinks API. */\nexport interface WorkspaceAppPreviewLink {\n previewId: string\n sandboxId: string\n port: number\n protocol: 'tcp' | 'udp'\n hostname: string\n url: string\n status: 'provisioning' | 'ready' | 'error' | 'disabled'\n}\n\nexport interface WorkspaceAppIdentity {\n /** Assigned by the product, stable across preview updates and deliberate republishes. */\n id: string\n /** Taken from the authenticated route or session, never agent tool arguments. */\n workspaceId: string\n /** Current box resolved by the product from that workspace or session. */\n sandboxId: string\n name: string\n /** Preserve this when republishing the same app onto a replacement sandbox. */\n createdAt?: string\n updatedAt?: string\n}\n\nfunction nonempty(value: string, field: string): string {\n if (typeof value !== 'string' || !value.trim() || /[\\u0000-\\u001f\\u007f]/.test(value)) {\n throw new Error('Invalid workspace app ' + field)\n }\n return value.trim()\n}\n\nfunction checkedLink(link: WorkspaceAppPreviewLink, sandboxId: string): void {\n if (link.sandboxId !== sandboxId) {\n throw new Error('Preview link belongs to another sandbox')\n }\n nonempty(link.previewId, 'previewId')\n if (link.protocol !== 'tcp') throw new Error('Workspace app preview must use TCP')\n if (!Number.isInteger(link.port) || link.port < 1 || link.port > 65535) {\n throw new Error('Invalid workspace app port')\n }\n if (!['provisioning', 'ready', 'error', 'disabled'].includes(link.status)) {\n throw new Error('Invalid workspace app preview status')\n }\n let url: URL\n try {\n url = new URL(link.url)\n } catch {\n throw new Error('Invalid workspace app preview URL')\n }\n if (\n url.protocol !== 'https:' ||\n !url.hostname ||\n url.hostname !== link.hostname ||\n url.username ||\n url.password ||\n url.search ||\n url.hash\n ) {\n throw new Error('Invalid workspace app preview URL')\n }\n}\n\nfunction appStatus(status: WorkspaceAppPreviewLink['status']): WorkspaceAppRecord['status'] {\n if (status === 'ready' || status === 'provisioning') return 'starting'\n return 'unavailable'\n}\n\n/**\n * Build a durable registration from a preview link created on the box that\n * the authenticated product request resolved. The product owns row identity,\n * access policy, persistence, and the decision to publish.\n */\nexport function workspaceAppFromPreviewLink(\n identity: WorkspaceAppIdentity,\n link: WorkspaceAppPreviewLink,\n): WorkspaceAppRecord {\n const sandboxId = nonempty(identity.sandboxId, 'sandboxId')\n checkedLink(link, sandboxId)\n const timestamp = identity.updatedAt ?? new Date().toISOString()\n return {\n id: nonempty(identity.id, 'id'),\n workspaceId: nonempty(identity.workspaceId, 'workspaceId'),\n name: nonempty(identity.name, 'name'),\n sandboxId,\n previewId: link.previewId,\n port: link.port,\n previewUrl: link.url,\n status: appStatus(link.status),\n createdAt: identity.createdAt ?? timestamp,\n updatedAt: timestamp,\n }\n}\n\nexport interface WorkspaceAppHttpProof {\n /** The exact trusted SDK preview URL requested by the server. */\n previewUrl: string\n status: number\n contentType: string\n /** Number of bytes read from the response body, excluding headers. */\n bodyBytes: number\n checkedAt: string\n}\n\n/**\n * Mark an app ready only after the host fetched its HTML over the trusted\n * preview URL. The host owns the request timeout, redirect and credential\n * policy, authorization, and compare-and-swap storage update.\n */\nexport function confirmWorkspaceAppReady(\n app: WorkspaceAppRecord,\n proof: WorkspaceAppHttpProof,\n): WorkspaceAppRecord {\n if (\n proof.previewUrl !== app.previewUrl ||\n proof.status !== 200 ||\n !/^text\\/html(?:\\s*;|\\s*$)/i.test(proof.contentType) ||\n !Number.isInteger(proof.bodyBytes) ||\n proof.bodyBytes < 1 ||\n !Number.isFinite(Date.parse(proof.checkedAt))\n ) {\n throw new Error('Workspace app HTML preview is not ready')\n }\n return { ...app, status: 'ready', updatedAt: proof.checkedAt }\n}\n\n/** Refresh delivery state without changing which sandbox service this app means. */\nexport function refreshWorkspaceAppPreview(\n app: WorkspaceAppRecord,\n link: WorkspaceAppPreviewLink,\n updatedAt = new Date().toISOString(),\n): WorkspaceAppRecord {\n checkedLink(link, app.sandboxId)\n if (link.previewId !== app.previewId || link.port !== app.port) {\n throw new Error('Preview link does not match workspace app')\n }\n return {\n ...app,\n previewUrl: link.url,\n status: appStatus(link.status),\n updatedAt,\n }\n}\n\nexport interface WorkspaceAppBuilderInstructionsOptions {\n /** Host tool that writes or updates the app registration after creating a preview link. */\n publishTool: string\n /** Optional host tool for finding app IDs the builder may update. */\n listTool?: string\n}\n\nfunction toolName(value: string): string {\n if (!/^[A-Za-z][A-Za-z0-9_.-]*$/.test(value)) {\n throw new Error('Invalid workspace app tool name')\n }\n return value\n}\n\n/** Portable instructions for an agent profile that builds workspace apps. */\nexport function workspaceAppBuilderInstructions({\n publishTool,\n listTool,\n}: WorkspaceAppBuilderInstructionsOptions): string[] {\n const publish = toolName(publishTool)\n const list = listTool ? toolName(listTool) : undefined\n return [\n 'Build a working HTTP application in the current sandbox when the user asks for an app.',\n ...(list ? ['Use ' + list + ' to inspect the existing apps before creating or updating one.'] : []),\n 'Start its server on 0.0.0.0 using an available, unclaimed port.',\n 'Call ' + publish + ' with the app name, stable app ID when updating, and listening port.',\n 'Use the host tool result as the source of the registered app URL and status; never invent a preview URL.',\n 'Keep the same app ID for later revisions of that app.',\n 'Treat a preview link as public. Do not embed secrets or private business facts in client code or responses.',\n 'Read real business data through authorized product APIs. Do not fabricate records to make the app look complete.',\n 'Report the app as available only after the host confirms its preview is ready.',\n ]\n}\n"],"mappings":";AAsCA,SAAS,SAAS,OAAe,OAAuB;AACtD,MAAI,OAAO,UAAU,YAAY,CAAC,MAAM,KAAK,KAAK,wBAAwB,KAAK,KAAK,GAAG;AACrF,UAAM,IAAI,MAAM,2BAA2B,KAAK;AAAA,EAClD;AACA,SAAO,MAAM,KAAK;AACpB;AAEA,SAAS,YAAY,MAA+B,WAAyB;AAC3E,MAAI,KAAK,cAAc,WAAW;AAChC,UAAM,IAAI,MAAM,yCAAyC;AAAA,EAC3D;AACA,WAAS,KAAK,WAAW,WAAW;AACpC,MAAI,KAAK,aAAa,MAAO,OAAM,IAAI,MAAM,oCAAoC;AACjF,MAAI,CAAC,OAAO,UAAU,KAAK,IAAI,KAAK,KAAK,OAAO,KAAK,KAAK,OAAO,OAAO;AACtE,UAAM,IAAI,MAAM,4BAA4B;AAAA,EAC9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AAyC;AAAA,EAC3D;AACA,SAAO,EAAE,GAAG,KAAK,QAAQ,SAAS,WAAW,MAAM,UAAU;AAC/D;AAGO,SAAS,2BACd,KACA,MACA,aAAY,oBAAI,KAAK,GAAE,YAAY,GACf;AACpB,cAAY,MAAM,IAAI,SAAS;AAC/B,MAAI,KAAK,cAAc,IAAI,aAAa,KAAK,SAAS,IAAI,MAAM;AAC9D,UAAM,IAAI,MAAM,2CAA2C;AAAA,EAC7D;AACA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,YAAY,KAAK;AAAA,IACjB,QAAQ,UAAU,KAAK,MAAM;AAAA,IAC7B;AAAA,EACF;AACF;AASA,SAAS,SAAS,OAAuB;AACvC,MAAI,CAAC,4BAA4B,KAAK,KAAK,GAAG;AAC5C,UAAM,IAAI,MAAM,iCAAiC;AAAA,EACnD;AACA,SAAO;AACT;AAGO,SAAS,gCAAgC;AAAA,EAC9C;AAAA,EACA;AACF,GAAqD;AACnD,QAAM,UAAU,SAAS,WAAW;AACpC,QAAM,OAAO,WAAW,SAAS,QAAQ,IAAI;AAC7C,SAAO;AAAA,IACL;AAAA,IACA,GAAI,OAAO,CAAC,SAAS,OAAO,gEAAgE,IAAI,CAAC;AAAA,IACjG;AAAA,IACA,UAAU,UAAU;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/workspace-apps/index.ts"],"sourcesContent":["/** A sandbox app registered in one product workspace. Products persist and authorize these rows. */\nexport interface WorkspaceAppRecord {\n id: string\n workspaceId: string\n name: string\n sandboxId: string\n previewId: string\n port: number\n previewUrl: string\n status: 'starting' | 'ready' | 'unavailable'\n createdAt: string\n updatedAt: string\n}\n\n/** Structural shape returned by the Sandbox SDK previewLinks API. */\nexport interface WorkspaceAppPreviewLink {\n previewId: string\n sandboxId: string\n port: number\n protocol: 'tcp' | 'udp'\n hostname: string\n url: string\n status: 'provisioning' | 'ready' | 'error' | 'disabled'\n}\n\nexport interface WorkspaceAppIdentity {\n /** Assigned by the product, stable across preview updates and deliberate republishes. */\n id: string\n /** Taken from the authenticated route or session, never agent tool arguments. */\n workspaceId: string\n /** Current box resolved by the product from that workspace or session. */\n sandboxId: string\n name: string\n /** Preserve this when republishing the same app onto a replacement sandbox. */\n createdAt?: string\n updatedAt?: string\n}\n\nfunction nonempty(value: string, field: string): string {\n if (typeof value !== 'string' || !value.trim() || /[\\u0000-\\u001f\\u007f]/.test(value)) {\n throw new Error('Invalid workspace app ' + field)\n }\n return value.trim()\n}\n\nfunction checkedLink(link: WorkspaceAppPreviewLink, sandboxId: string): void {\n if (link.sandboxId !== sandboxId) {\n throw new Error('Preview link belongs to another sandbox')\n }\n nonempty(link.previewId, 'previewId')\n if (link.protocol !== 'tcp') throw new Error('Workspace app preview must use TCP')\n if (!Number.isInteger(link.port) || link.port < 1 || link.port > 65535) {\n throw new Error('Invalid workspace app port')\n }\n if (!['provisioning', 'ready', 'error', 'disabled'].includes(link.status)) {\n throw new Error('Invalid workspace app preview status')\n }\n let url: URL\n try {\n url = new URL(link.url)\n } catch {\n throw new Error('Invalid workspace app preview URL')\n }\n if (\n url.protocol !== 'https:' ||\n !url.hostname ||\n url.hostname !== link.hostname ||\n url.username ||\n url.password ||\n url.search ||\n url.hash\n ) {\n throw new Error('Invalid workspace app preview URL')\n }\n}\n\nfunction appStatus(status: WorkspaceAppPreviewLink['status']): WorkspaceAppRecord['status'] {\n if (status === 'ready' || status === 'provisioning') return 'starting'\n return 'unavailable'\n}\n\n/**\n * Build a durable registration from a preview link created on the box that\n * the authenticated product request resolved. The product owns row identity,\n * access policy, persistence, and the decision to publish.\n */\nexport function workspaceAppFromPreviewLink(\n identity: WorkspaceAppIdentity,\n link: WorkspaceAppPreviewLink,\n): WorkspaceAppRecord {\n const sandboxId = nonempty(identity.sandboxId, 'sandboxId')\n checkedLink(link, sandboxId)\n const timestamp = identity.updatedAt ?? new Date().toISOString()\n return {\n id: nonempty(identity.id, 'id'),\n workspaceId: nonempty(identity.workspaceId, 'workspaceId'),\n name: nonempty(identity.name, 'name'),\n sandboxId,\n previewId: link.previewId,\n port: link.port,\n previewUrl: link.url,\n status: appStatus(link.status),\n createdAt: identity.createdAt ?? timestamp,\n updatedAt: timestamp,\n }\n}\n\nexport interface WorkspaceAppHttpProof {\n /** The exact trusted SDK preview URL requested by the server. */\n previewUrl: string\n status: number\n contentType: string\n /** Number of bytes read from the response body, excluding headers. */\n bodyBytes: number\n checkedAt: string\n}\n\n/**\n * Mark an app ready only after the host fetched its HTML over the trusted\n * preview URL. The host owns the request timeout, redirect and credential\n * policy, authorization, and compare-and-swap storage update.\n */\nexport function confirmWorkspaceAppReady(\n app: WorkspaceAppRecord,\n proof: WorkspaceAppHttpProof,\n): WorkspaceAppRecord {\n if (\n proof.previewUrl !== app.previewUrl ||\n proof.status !== 200 ||\n !/^text\\/html(?:\\s*;|\\s*$)/i.test(proof.contentType) ||\n !Number.isInteger(proof.bodyBytes) ||\n proof.bodyBytes < 1 ||\n !Number.isFinite(Date.parse(proof.checkedAt))\n ) {\n throw new Error('Workspace app HTML preview is not ready')\n }\n return { ...app, status: 'ready', updatedAt: proof.checkedAt }\n}\n\n/** Refresh delivery state without changing which sandbox service this app means. */\nexport function refreshWorkspaceAppPreview(\n app: WorkspaceAppRecord,\n link: WorkspaceAppPreviewLink,\n updatedAt = new Date().toISOString(),\n): WorkspaceAppRecord {\n checkedLink(link, app.sandboxId)\n if (link.previewId !== app.previewId || link.port !== app.port) {\n throw new Error('Preview link does not match workspace app')\n }\n return {\n ...app,\n previewUrl: link.url,\n status: appStatus(link.status),\n updatedAt,\n }\n}\n\nexport type WorkspaceAppBuilderInstructionsOptions =\n | {\n /** Host tool that writes the registration after creating a trusted preview. */\n publishTool: string\n /** Optional host tool for finding app IDs the builder may update. */\n listTool?: string\n manifestPath?: never\n }\n | {\n /** Host-scoped manifest the builder writes after creating runnable projects. */\n manifestPath: string\n publishTool?: never\n listTool?: never\n }\n\nfunction toolName(value: string): string {\n if (!/^[A-Za-z][A-Za-z0-9_.-]*$/.test(value)) {\n throw new Error('Invalid workspace app tool name')\n }\n return value\n}\n\nfunction builderManifestPath(value: string): string {\n if (\n !/^[A-Za-z0-9._-]+(?:[/][A-Za-z0-9._-]+)*$/.test(value) ||\n value.split('/').some(segment => segment === '..' || segment === '.')\n ) {\n throw new Error('Invalid workspace app manifest path')\n }\n return value\n}\n\n/** Portable instructions for an agent profile that builds workspace apps. */\nexport function workspaceAppBuilderInstructions(\n options: WorkspaceAppBuilderInstructionsOptions,\n): string[] {\n const common = [\n 'Build a working HTTP application in the current sandbox when the user asks for an app.',\n 'Keep the same app ID for later revisions of that app.',\n 'Treat a preview link as public. Do not embed secrets or private business facts in client code or responses.',\n 'Read real business data through authorized product APIs. Do not fabricate records to make the app look complete.',\n 'Report the app as available only after the host confirms its preview is ready.',\n ] as const\n if (options.manifestPath !== undefined) {\n const path = builderManifestPath(options.manifestPath)\n return [\n common[0],\n 'Inspect the existing app projects and manifest before creating or updating an app.',\n 'Keep each runnable project under apps/<id> relative to the sandbox working directory. Give it a package.json dev script; its HTTP server must listen on 0.0.0.0 and use PORT when supplied.',\n 'Write ' + path + ' as JSON with exactly an apps array of { id, name, projectPath } records; each projectPath is apps/<id>.',\n 'Do not put URLs, credentials, tokens, sandbox IDs, or preview IDs in that manifest.',\n 'The host reads this manifest and owns server launch, port selection, preview creation, registration, and access policy.',\n ...common.slice(1),\n ]\n }\n const publish = toolName(options.publishTool)\n const list = options.listTool ? toolName(options.listTool) : undefined\n return [\n common[0],\n ...(list ? ['Use ' + list + ' to inspect the existing apps before creating or updating one.'] : []),\n 'Start its server on 0.0.0.0 using an available, unclaimed port.',\n 'Call ' + publish + ' with the app name, stable app ID when updating, and listening port.',\n 'Use the host tool result as the source of the registered app URL and status; never invent a preview URL.',\n ...common.slice(1),\n ]\n}\n"],"mappings":";AAsCA,SAAS,SAAS,OAAe,OAAuB;AACtD,MAAI,OAAO,U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SAAS;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACA,MAAI,QAAQ,iBAAiB,QAAW;AACtC,UAAM,OAAO,oBAAoB,QAAQ,YAAY;AACrD,WAAO;AAAA,MACL,OAAO,CAAC;AAAA,MACR;AAAA,MACA;AAAA,MACA,WAAW,OAAO;AAAA,MAClB;AAAA,MACA;AAAA,MACA,GAAG,OAAO,MAAM,CAAC;AAAA,IACnB;AAAA,EACF;AACA,QAAM,UAAU,SAAS,QAAQ,WAAW;AAC5C,QAAM,OAAO,QAAQ,WAAW,SAAS,QAAQ,QAAQ,IAAI;AAC7D,SAAO;AAAA,IACL,OAAO,CAAC;AAAA,IACR,GAAI,OAAO,CAAC,SAAS,OAAO,gEAAgE,IAAI,CAAC;AAAA,IACjG;AAAA,IACA,UAAU,UAAU;AAAA,IACpB;AAAA,IACA,GAAG,OAAO,MAAM,CAAC;AAAA,EACnB;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-app",
3
- "version": "0.50.6",
3
+ "version": "0.50.8",
4
4
  "packageManager": "pnpm@11.24.0",
5
5
  "description": "Build agent applications with typed chat, tools, sandboxes, integrations, billing, and evaluation.",
6
6
  "keywords": [
@@ -575,7 +575,7 @@
575
575
  "@tangle-network/brand": "1.6.0",
576
576
  "@tangle-network/hub-sdk": "0.21.0",
577
577
  "@tangle-network/sandbox": "0.58.1",
578
- "@tangle-network/sandbox-ui": "0.114.0",
578
+ "@tangle-network/sandbox-ui": "0.115.0",
579
579
  "@tangle-network/ui": "11.10.0",
580
580
  "@testing-library/dom": "^10.4.1",
581
581
  "@testing-library/react": "^16.3.3",
@@ -643,7 +643,7 @@
643
643
  "@tangle-network/brand": ">=1.6.0",
644
644
  "@tangle-network/hub-sdk": ">=0.19.3 <0.21.0 || >=0.21.0 <0.22.0",
645
645
  "@tangle-network/sandbox": ">=0.45.0 <0.48.0 || ^0.49.0 || ^0.50.0 || ^0.51.0 || ^0.52.0 || ^0.53.0 || ^0.54.0 || ^0.55.0 || >=0.58.1 <0.59.0",
646
- "@tangle-network/sandbox-ui": ">=0.113.3 <0.115.0",
646
+ "@tangle-network/sandbox-ui": ">=0.113.3 <0.116.0",
647
647
  "@tangle-network/ui": ">=11.6.0 <12.0.0",
648
648
  "@tiptap/core": ">=3.28.0 <4.0.0",
649
649
  "@tiptap/extension-mention": ">=3.28.0 <4.0.0",