@tangle-network/agent-app 0.46.16 → 0.46.18

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 (43) hide show
  1. package/README.md +6 -5
  2. package/dist/assets/schema.d.ts +10 -10
  3. package/dist/assistant/index.js +1 -1
  4. package/dist/chat-react/index.js +1 -1
  5. package/dist/chat-routes/index.js +1 -1
  6. package/dist/chat-store/schema.d.ts +5 -5
  7. package/dist/{chunk-FVTGGN3G.js → chunk-47LN6Q2U.js} +105 -56
  8. package/dist/chunk-47LN6Q2U.js.map +1 -0
  9. package/dist/{chunk-QL7HXXXL.js → chunk-55E3K3Q6.js} +2 -1
  10. package/dist/chunk-55E3K3Q6.js.map +1 -0
  11. package/dist/{chunk-3PFKLSIZ.js → chunk-P2EC5VHG.js} +1 -1
  12. package/dist/{chunk-3PFKLSIZ.js.map → chunk-P2EC5VHG.js.map} +1 -1
  13. package/dist/config/index.d.ts +62 -62
  14. package/dist/design-canvas/schema.d.ts +6 -6
  15. package/dist/documents/pdf-inspector.d.ts +5 -7
  16. package/dist/documents/pdf-inspector.js.map +1 -1
  17. package/dist/intakes/drizzle/schema.d.ts +2 -2
  18. package/dist/interactions/contract.d.ts +3 -3
  19. package/dist/peer-floors/check.js +1 -1
  20. package/dist/peer-floors/cli.js +1 -1
  21. package/dist/plans/index.d.ts +1 -1
  22. package/dist/preset-cloudflare/index.d.ts +36 -36
  23. package/dist/record/drizzle/schema.d.ts +1 -1
  24. package/dist/run/index.d.ts +1 -1
  25. package/dist/sandbox/index.d.ts +14 -2
  26. package/dist/sandbox/index.js +1 -1
  27. package/dist/sequences/schema.d.ts +10 -10
  28. package/dist/signoff/proof-record.d.ts +11 -11
  29. package/dist/studio-react/styles.d.ts +2 -0
  30. package/dist/teams/drizzle/invitations-schema.d.ts +3 -3
  31. package/dist/teams/drizzle/schema.d.ts +6 -6
  32. package/dist/teams/roles.d.ts +3 -3
  33. package/dist/theme/styles.d.ts +2 -0
  34. package/dist/theme/tailwind-preset.d.ts +1 -1
  35. package/dist/tools/mcp-rpc.d.ts +1 -1
  36. package/dist/tools/openai.d.ts +1 -1
  37. package/dist/turn-stream/core.d.ts +15 -15
  38. package/dist/web/index.d.ts +5 -5
  39. package/dist/web-react/entry-composer.d.ts +1 -3
  40. package/dist/web-react/index.js +1 -1
  41. package/package.json +59 -52
  42. package/dist/chunk-FVTGGN3G.js.map +0 -1
  43. package/dist/chunk-QL7HXXXL.js.map +0 -1
package/README.md CHANGED
@@ -36,13 +36,14 @@ pnpm add @tangle-network/agent-eval @tangle-network/agent-integrations
36
36
  | Peer | Required by | Range |
37
37
  |---|---|---|
38
38
  | `@tangle-network/agent-eval` | `/eval`, `/eval-campaign`, `/profile`, `/knowledge` | `>=0.170.0 <0.171.0` |
39
- | `@tangle-network/agent-runtime` | `/runtime`, `/chat-routes` | `>=0.170.0 <0.171.0` |
40
- | `@tangle-network/agent-integrations` | `/integrations` | `>=0.52.0` |
41
- | `@tangle-network/agent-interface` | `/interactions`, `/chat-store`, `/harness` | `^1.0.0` |
42
- | `@tangle-network/sandbox` | `/sandbox` | `>=0.31.0 <0.32.0` |
39
+ | `@tangle-network/agent-runtime` | `/runtime`, `/chat-routes` | `>=0.178.0 <0.179.0` |
40
+ | `@tangle-network/agent-integrations` | `/integrations` | `>=0.53.55 <0.54.0` |
41
+ | `@tangle-network/agent-interface` | `/interactions`, `/chat-store`, `/harness` | `^1.8.0` |
42
+ | `@tangle-network/sandbox` | `/sandbox` | `>=0.34.0 <0.35.0` |
43
43
  | `@tangle-network/agent-knowledge` | `/knowledge-loop` | `^10.8.0` |
44
44
  | `@tangle-network/agent-profile-materialize` | `/skills-placement` | `>=0.17.1 <0.18.0` |
45
- | `@tangle-network/sandbox-ui` | `/brand`, `/work-product-react`, `/workspace-react` | `>=0.105.0` |
45
+ | `@tangle-network/sandbox-ui` | `/brand`, `/work-product-react`, `/workspace-react` | `>=0.111.0 <0.112.0` |
46
+ | `@tangle-network/ui` | `/brand`, `/work-product-react`, `/workspace-react` | `>=11.6.0 <12.0.0` |
46
47
 
47
48
  All of these except `agent-eval`, `agent-integrations`, and `agent-interface` are declared **optional** peers, so a product that never imports the subpath installs nothing.
48
49
 
@@ -74,9 +74,9 @@ export declare const ImageContentSchema: z.ZodObject<{
74
74
  y: z.ZodNumber;
75
75
  width: z.ZodOptional<z.ZodNumber>;
76
76
  align: z.ZodOptional<z.ZodEnum<{
77
+ center: "center";
77
78
  left: "left";
78
79
  right: "right";
79
- center: "center";
80
80
  }>>;
81
81
  }, z.core.$strip>, z.ZodObject<{
82
82
  type: z.ZodLiteral<"image">;
@@ -89,8 +89,8 @@ export declare const ImageContentSchema: z.ZodObject<{
89
89
  }, z.core.$strip>, z.ZodObject<{
90
90
  type: z.ZodLiteral<"shape">;
91
91
  shape: z.ZodEnum<{
92
- rect: "rect";
93
92
  circle: "circle";
93
+ rect: "rect";
94
94
  "rounded-rect": "rounded-rect";
95
95
  }>;
96
96
  x: z.ZodNumber;
@@ -170,9 +170,9 @@ export declare const VideoContentSchema: z.ZodObject<{
170
170
  y: z.ZodNumber;
171
171
  width: z.ZodOptional<z.ZodNumber>;
172
172
  align: z.ZodOptional<z.ZodEnum<{
173
+ center: "center";
173
174
  left: "left";
174
175
  right: "right";
175
- center: "center";
176
176
  }>>;
177
177
  }, z.core.$strip>, z.ZodObject<{
178
178
  type: z.ZodLiteral<"image">;
@@ -185,8 +185,8 @@ export declare const VideoContentSchema: z.ZodObject<{
185
185
  }, z.core.$strip>, z.ZodObject<{
186
186
  type: z.ZodLiteral<"shape">;
187
187
  shape: z.ZodEnum<{
188
- rect: "rect";
189
188
  circle: "circle";
189
+ rect: "rect";
190
190
  "rounded-rect": "rounded-rect";
191
191
  }>;
192
192
  x: z.ZodNumber;
@@ -222,12 +222,12 @@ export declare const CopyContentSchema: z.ZodObject<{
222
222
  body: z.ZodString;
223
223
  hashtags: z.ZodOptional<z.ZodArray<z.ZodString>>;
224
224
  platform: z.ZodEnum<{
225
- x: "x";
226
- linkedin: "linkedin";
227
- tiktok: "tiktok";
225
+ "email-subject": "email-subject";
228
226
  instagram: "instagram";
227
+ linkedin: "linkedin";
229
228
  sms: "sms";
230
- "email-subject": "email-subject";
229
+ tiktok: "tiktok";
230
+ x: "x";
231
231
  }>;
232
232
  characterCount: z.ZodOptional<z.ZodNumber>;
233
233
  }, z.core.$strip>;
@@ -236,10 +236,10 @@ export declare const ApprovalEventSchema: z.ZodObject<{
236
236
  assetId: z.ZodString;
237
237
  variantId: z.ZodOptional<z.ZodString>;
238
238
  action: z.ZodEnum<{
239
- scheduled: "scheduled";
240
239
  approved: "approved";
241
- rejected: "rejected";
242
240
  edited: "edited";
241
+ rejected: "rejected";
242
+ scheduled: "scheduled";
243
243
  }>;
244
244
  editedFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
245
245
  userId: z.ZodString;
@@ -9,7 +9,7 @@ import "../chunk-ENLRJYVW.js";
9
9
  import "../chunk-GEYACSFW.js";
10
10
  import {
11
11
  ChatComposer
12
- } from "../chunk-3PFKLSIZ.js";
12
+ } from "../chunk-P2EC5VHG.js";
13
13
  import "../chunk-L7MB2LLM.js";
14
14
  import {
15
15
  ModelPicker
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ComposerModeControls,
3
3
  EntryComposer
4
- } from "../chunk-3PFKLSIZ.js";
4
+ } from "../chunk-P2EC5VHG.js";
5
5
  import "../chunk-L7MB2LLM.js";
6
6
  import "../chunk-YDOQE47G.js";
7
7
  import "../chunk-EDTWGSQT.js";
@@ -112,7 +112,7 @@ import {
112
112
  flattenHistory,
113
113
  readSandboxBinaryBytes,
114
114
  statSandboxFileSize
115
- } from "../chunk-FVTGGN3G.js";
115
+ } from "../chunk-47LN6Q2U.js";
116
116
  import "../chunk-TH7L265V.js";
117
117
  import "../chunk-LWSJK546.js";
118
118
  import "../chunk-P5PIAQVS.js";
@@ -105,7 +105,7 @@ export declare function createChatTables<TThreadExtras extends Record<string, SQ
105
105
  name: T[Key]["_"]["name"] extends "" ? import("drizzle-orm").Assume<Key, string> : T[Key]["_"]["name"];
106
106
  };
107
107
  }, TDialect>; } : never;
108
- dialect: "sqlite";
108
+ dialect: 'sqlite';
109
109
  }>;
110
110
  messages: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
111
111
  name: `${string}message`;
@@ -129,12 +129,12 @@ export declare function createChatTables<TThreadExtras extends Record<string, SQ
129
129
  cacheWriteTokens: import("drizzle-orm/sqlite-core").SQLiteIntegerBuilderInitial<"cache_write_tokens">;
130
130
  costUsd: import("drizzle-orm/sqlite-core").SQLiteRealBuilderInitial<"cost_usd">;
131
131
  createdAt: import("drizzle-orm").HasDefault<import("drizzle-orm").NotNull<import("drizzle-orm/sqlite-core").SQLiteTimestampBuilderInitial<"created_at">>>;
132
- } & TMessageExtras extends infer T_1 extends Record<string, import("drizzle-orm").ColumnBuilderBase<import("drizzle-orm").ColumnBuilderBaseConfig<import("drizzle-orm").ColumnDataType, string>, object>> ? { [Key_1 in keyof T_1]: import("drizzle-orm").BuildColumn<TTableName, {
133
- _: Omit<T_1[Key_1]["_"], "name"> & {
134
- name: T_1[Key_1]["_"]["name"] extends "" ? import("drizzle-orm").Assume<Key_1, string> : T_1[Key_1]["_"]["name"];
132
+ } & TMessageExtras extends infer T_1 extends Record<string, import("drizzle-orm").ColumnBuilderBase<import("drizzle-orm").ColumnBuilderBaseConfig<import("drizzle-orm").ColumnDataType, string>, object>> ? { [Key in keyof T_1]: import("drizzle-orm").BuildColumn<TTableName, {
133
+ _: Omit<T_1[Key]["_"], "name"> & {
134
+ name: T_1[Key]["_"]["name"] extends "" ? import("drizzle-orm").Assume<Key, string> : T_1[Key]["_"]["name"];
135
135
  };
136
136
  }, TDialect>; } : never;
137
- dialect: "sqlite";
137
+ dialect: 'sqlite';
138
138
  }>;
139
139
  };
140
140
  /**
@@ -1714,16 +1714,28 @@ function normalizedEgressPolicy(policy) {
1714
1714
  }
1715
1715
  return JSON.stringify(canonicalizeJson(normalized));
1716
1716
  }
1717
+ function existingBoxEgressError(operation, box, stage, name, cause) {
1718
+ const error = cause instanceof Error ? cause : new Error(String(cause));
1719
+ const status = error.status;
1720
+ const suffix = operation === "migration" ? "/egress" : "";
1721
+ return Object.assign(
1722
+ new Error(`egress policy ${operation} failed on ${stage} box ${name}: ${error.message}`, {
1723
+ cause: error
1724
+ }),
1725
+ {
1726
+ origin: "sandbox-api",
1727
+ endpoint: `/v1/sandboxes/${encodeURIComponent(box.id)}${suffix}`,
1728
+ ...typeof status === "number" || typeof status === "string" ? { status } : {}
1729
+ }
1730
+ );
1731
+ }
1717
1732
  async function assertExistingBoxEgress(box, desired, migrate, stage, name) {
1718
1733
  if (!desired) return;
1719
1734
  let current;
1720
1735
  try {
1721
1736
  current = await box.egress.get();
1722
1737
  } catch (cause) {
1723
- const error = cause instanceof Error ? cause : new Error(String(cause));
1724
- throw new Error(`egress policy read failed on ${stage} box ${name}: ${error.message}`, {
1725
- cause: error
1726
- });
1738
+ throw existingBoxEgressError("read", box, stage, name, cause);
1727
1739
  }
1728
1740
  const matchingPolicy = normalizedEgressPolicy(current.policy) === normalizedEgressPolicy(desired);
1729
1741
  const explicitSource = current.source !== "platform";
@@ -1736,10 +1748,7 @@ async function assertExistingBoxEgress(box, desired, migrate, stage, name) {
1736
1748
  if (migratedPolicy && migrated.source !== "platform") return;
1737
1749
  current = migrated;
1738
1750
  } catch (cause) {
1739
- const error = cause instanceof Error ? cause : new Error(String(cause));
1740
- throw new Error(`egress policy migration failed on ${stage} box ${name}: ${error.message}`, {
1741
- cause: error
1742
- });
1751
+ throw existingBoxEgressError("migration", box, stage, name, cause);
1743
1752
  }
1744
1753
  }
1745
1754
  throw new SandboxEgressPolicyMismatchError(
@@ -1790,12 +1799,36 @@ function isUnbringableBoxError(error) {
1790
1799
  const diagnostics = serializeSandboxProvisioningError(error);
1791
1800
  return isSandboxHostCapacityFailure(diagnostics) || isSandboxBoxConfigFailure(diagnostics);
1792
1801
  }
1802
+ async function requestSandboxReplacement(recover, failure, label) {
1803
+ if (!recover) throw failure.error;
1804
+ const recovery = await recover(failure);
1805
+ if (!recovery.succeeded) throw recovery.error;
1806
+ if (!recovery.value) throw failure.error;
1807
+ const replacementBoxKey = recovery.value.replacementBoxKey.trim();
1808
+ if (!replacementBoxKey || replacementBoxKey === failure.boxKey) {
1809
+ throw new Error(
1810
+ `${label} must return a fresh replacement box key for ${failure.boxKey}`,
1811
+ { cause: failure.error }
1812
+ );
1813
+ }
1814
+ return { ...recovery.value, replacementBoxKey };
1815
+ }
1816
+ async function requestMissingSandboxReplacement(shell, failure) {
1817
+ const diagnostics = serializeSandboxProvisioningError(failure.error);
1818
+ if (!isSandboxApiSandboxMissingFailure(diagnostics)) throw failure.error;
1819
+ return requestSandboxReplacement(
1820
+ shell.recoverMissingSandbox,
1821
+ failure,
1822
+ "missing sandbox recovery"
1823
+ );
1824
+ }
1793
1825
  async function provisionWorkspaceSandbox(shell, options) {
1794
1826
  const { workspaceId, userId, harness, forceNew, onProgress, billingOwnerId } = options;
1795
1827
  const resolved = await resolveWorkspaceSandboxClient(shell, workspaceId, userId);
1796
1828
  const { scope, client } = resolved;
1797
1829
  let name = resolved.name;
1798
1830
  let recoveryRestore;
1831
+ let replacementRequested = false;
1799
1832
  const resources = shell.resources ?? DEFAULT_SANDBOX_RESOURCES;
1800
1833
  const resumeTimeout = shell.provisionTimeoutMs ?? DEFAULT_PROVISION_TIMEOUT_MS;
1801
1834
  const existing = await listRunning(client, name);
@@ -1807,21 +1840,35 @@ async function provisionWorkspaceSandbox(shell, options) {
1807
1840
  throw new Error(`forceNew: sandbox ${name} could not be deleted`, { cause: dropped.error });
1808
1841
  }
1809
1842
  } else if (found.metadata?.harness === harness) {
1810
- const ready = await refreshRuntimeConnection(client, found);
1811
- if (await isReusableBox(ready, harness, shell.livenessProbe)) {
1812
- return finalizeExistingBox(shell, client, ready, "reused", name, workspaceId, userId, harness, scope);
1843
+ try {
1844
+ const ready = await refreshRuntimeConnection(client, found);
1845
+ if (await isReusableBox(ready, harness, shell.livenessProbe)) {
1846
+ return await finalizeExistingBox(shell, client, ready, "reused", name, workspaceId, userId, harness, scope);
1847
+ }
1848
+ const recovered = await recoverUnresponsiveBox(
1849
+ client,
1850
+ ready,
1851
+ harness,
1852
+ shell.livenessProbe,
1853
+ "reused",
1854
+ name,
1855
+ resumeTimeout,
1856
+ onProgress
1857
+ );
1858
+ return await finalizeExistingBox(shell, client, recovered, "reused", name, workspaceId, userId, harness, scope);
1859
+ } catch (cause) {
1860
+ const error = cause instanceof Error ? cause : new Error(String(cause));
1861
+ const recovery = await requestMissingSandboxReplacement(shell, {
1862
+ box: found,
1863
+ error,
1864
+ scope,
1865
+ boxKey: name,
1866
+ stage: "reused"
1867
+ });
1868
+ name = recovery.replacementBoxKey;
1869
+ recoveryRestore = recovery.restore;
1870
+ replacementRequested = true;
1813
1871
  }
1814
- const recovered = await recoverUnresponsiveBox(
1815
- client,
1816
- ready,
1817
- harness,
1818
- shell.livenessProbe,
1819
- "reused",
1820
- name,
1821
- resumeTimeout,
1822
- onProgress
1823
- );
1824
- return finalizeExistingBox(shell, client, recovered, "reused", name, workspaceId, userId, harness, scope);
1825
1872
  } else {
1826
1873
  const dropped = await deleteBox(found);
1827
1874
  if (!dropped.succeeded) {
@@ -1832,46 +1879,48 @@ async function provisionWorkspaceSandbox(shell, options) {
1832
1879
  }
1833
1880
  }
1834
1881
  }
1835
- if (!forceNew && shell.resumeStopped !== false) {
1882
+ if (!replacementRequested && !forceNew && shell.resumeStopped !== false) {
1836
1883
  const stopped = await listStopped(client, name);
1837
1884
  if (!stopped.succeeded) throw stopped.error;
1838
1885
  if (stopped.value) {
1839
1886
  const resumed = await resumeStoppedBox(stopped.value, resumeTimeout, onProgress);
1840
1887
  if (!resumed.succeeded) {
1841
- if (!shell.recoverStoppedSandbox) throw resumed.error;
1842
- const recovery = await shell.recoverStoppedSandbox({
1843
- box: stopped.value,
1844
- error: resumed.error,
1845
- scope,
1846
- boxKey: name
1847
- });
1848
- if (!recovery.succeeded) throw recovery.error;
1849
- if (!recovery.value) throw resumed.error;
1850
- const replacementBoxKey = recovery.value.replacementBoxKey.trim();
1851
- if (!replacementBoxKey || replacementBoxKey === name) {
1852
- throw new Error(
1853
- `stopped sandbox recovery must return a fresh replacement box key for ${name}`,
1854
- { cause: resumed.error }
1855
- );
1856
- }
1857
- name = replacementBoxKey;
1858
- recoveryRestore = recovery.value.restore;
1888
+ const recovery = await requestSandboxReplacement(
1889
+ shell.recoverStoppedSandbox,
1890
+ { box: stopped.value, error: resumed.error, scope, boxKey: name },
1891
+ "stopped sandbox recovery"
1892
+ );
1893
+ name = recovery.replacementBoxKey;
1894
+ recoveryRestore = recovery.restore;
1859
1895
  } else {
1860
- const box2 = await refreshRuntimeConnection(client, resumed.value);
1861
- if (await isReusableBox(box2, harness, shell.livenessProbe)) {
1862
- return finalizeExistingBox(shell, client, box2, "resumed", name, workspaceId, userId, harness, scope);
1896
+ try {
1897
+ const box2 = await refreshRuntimeConnection(client, resumed.value);
1898
+ if (await isReusableBox(box2, harness, shell.livenessProbe)) {
1899
+ return await finalizeExistingBox(shell, client, box2, "resumed", name, workspaceId, userId, harness, scope);
1900
+ }
1901
+ const recovered = await recoverUnresponsiveBox(
1902
+ client,
1903
+ box2,
1904
+ harness,
1905
+ shell.livenessProbe,
1906
+ "resumed",
1907
+ name,
1908
+ resumeTimeout,
1909
+ onProgress
1910
+ );
1911
+ return await finalizeExistingBox(shell, client, recovered, "resumed", name, workspaceId, userId, harness, scope);
1912
+ } catch (cause) {
1913
+ const error = cause instanceof Error ? cause : new Error(String(cause));
1914
+ const recovery = await requestMissingSandboxReplacement(shell, {
1915
+ box: stopped.value,
1916
+ error,
1917
+ scope,
1918
+ boxKey: name,
1919
+ stage: "resumed"
1920
+ });
1921
+ name = recovery.replacementBoxKey;
1922
+ recoveryRestore = recovery.restore;
1863
1923
  }
1864
- const recovered = await recoverUnresponsiveBox(
1865
- client,
1866
- box2,
1867
- harness,
1868
- shell.livenessProbe,
1869
- "resumed",
1870
- name,
1871
- resumeTimeout,
1872
- onProgress
1873
- );
1874
- return finalizeExistingBox(shell, client, recovered, "resumed", name, workspaceId, userId, harness, scope);
1875
1924
  }
1876
1925
  }
1877
1926
  }
@@ -2399,4 +2448,4 @@ export {
2399
2448
  isTerminalPromptEvent,
2400
2449
  detectInteractiveQuestion
2401
2450
  };
2402
- //# sourceMappingURL=chunk-FVTGGN3G.js.map
2451
+ //# sourceMappingURL=chunk-47LN6Q2U.js.map