@tangle-network/agent-app 0.45.26 → 0.45.27
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.
- package/dist/assistant/index.js +5 -5
- package/dist/chat-routes/index.js +21 -21
- package/dist/chat-store/index.js +2 -2
- package/dist/{chunk-B2UEW62O.js → chunk-5ZTFZBS6.js} +4 -4
- package/dist/{chunk-AGCRCOQH.js → chunk-AWPK7ZDS.js} +1 -1
- package/dist/chunk-NEJ7OMQS.js +351 -0
- package/dist/chunk-NEJ7OMQS.js.map +1 -0
- package/dist/{chunk-KOMP6NDW.js → chunk-ODYE4A7L.js} +6 -6
- package/dist/{chunk-7V2I3JGZ.js → chunk-OTLEYHOG.js} +50 -12
- package/dist/chunk-OTLEYHOG.js.map +1 -0
- package/dist/design-canvas-react/index.js +4 -4
- package/dist/design-canvas-react/lazy.js +1 -1
- package/dist/sandbox/index.d.ts +53 -1
- package/dist/sandbox/index.js +1 -1
- package/dist/spend/cli.d.ts +1 -0
- package/dist/spend/cli.js +119 -0
- package/dist/spend/cli.js.map +1 -0
- package/dist/spend/index.d.ts +640 -0
- package/dist/spend/index.js +196 -0
- package/dist/spend/index.js.map +1 -0
- package/dist/stream/index.js +14 -14
- package/dist/teams/index.js +9 -9
- package/dist/teams/invitations-api.js +7 -7
- package/dist/web-react/index.js +11 -11
- package/package.json +7 -1
- package/dist/chunk-7V2I3JGZ.js.map +0 -1
- /package/dist/{chunk-B2UEW62O.js.map → chunk-5ZTFZBS6.js.map} +0 -0
- /package/dist/{chunk-AGCRCOQH.js.map → chunk-AWPK7ZDS.js.map} +0 -0
- /package/dist/{chunk-KOMP6NDW.js.map → chunk-ODYE4A7L.js.map} +0 -0
|
@@ -971,6 +971,13 @@ function buildAppToolMcpServers(options) {
|
|
|
971
971
|
}
|
|
972
972
|
return entries;
|
|
973
973
|
}
|
|
974
|
+
function emitSandboxActivity(spend, box) {
|
|
975
|
+
if (!spend?.onActivity) return;
|
|
976
|
+
try {
|
|
977
|
+
spend.onActivity({ sandboxId: box.id, at: Date.now() });
|
|
978
|
+
} catch {
|
|
979
|
+
}
|
|
980
|
+
}
|
|
974
981
|
function shellSingleQuote(value) {
|
|
975
982
|
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
976
983
|
}
|
|
@@ -1704,6 +1711,31 @@ async function assertExistingBoxEgress(box, desired, migrate, stage, name) {
|
|
|
1704
1711
|
);
|
|
1705
1712
|
}
|
|
1706
1713
|
async function ensureWorkspaceSandbox(shell, options) {
|
|
1714
|
+
await options.spend?.beforeProvision?.({
|
|
1715
|
+
workspaceId: options.workspaceId,
|
|
1716
|
+
...options.userId ? { userId: options.userId } : {}
|
|
1717
|
+
});
|
|
1718
|
+
const box = await bringUpWorkspaceSandbox(shell, options);
|
|
1719
|
+
await observeProvisionedBox(shell, options, box);
|
|
1720
|
+
return box;
|
|
1721
|
+
}
|
|
1722
|
+
async function observeProvisionedBox(shell, options, box) {
|
|
1723
|
+
if (!options.spend?.onProvisioned) return;
|
|
1724
|
+
const resources = shell.resources ?? DEFAULT_SANDBOX_RESOURCES;
|
|
1725
|
+
try {
|
|
1726
|
+
await options.spend.onProvisioned({
|
|
1727
|
+
workspaceId: options.workspaceId,
|
|
1728
|
+
...options.userId ? { userId: options.userId } : {},
|
|
1729
|
+
sandboxId: box.id,
|
|
1730
|
+
boxKey: box.name,
|
|
1731
|
+
idleTimeoutSeconds: resources.idleTimeoutSeconds,
|
|
1732
|
+
maxLifetimeSeconds: resources.maxLifetimeSeconds,
|
|
1733
|
+
at: Date.now()
|
|
1734
|
+
});
|
|
1735
|
+
} catch {
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
async function bringUpWorkspaceSandbox(shell, options) {
|
|
1707
1739
|
try {
|
|
1708
1740
|
return await provisionWorkspaceSandbox(shell, options);
|
|
1709
1741
|
} catch (err) {
|
|
@@ -2003,20 +2035,25 @@ async function* streamSandboxPrompt(shell, box, message, options) {
|
|
|
2003
2035
|
...options?.interactions ? { interactions: options.interactions } : {}
|
|
2004
2036
|
}
|
|
2005
2037
|
});
|
|
2038
|
+
emitSandboxActivity(options?.spend, box);
|
|
2006
2039
|
let severedFinishReason = null;
|
|
2007
|
-
|
|
2008
|
-
const
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2040
|
+
try {
|
|
2041
|
+
for await (const event of stream) {
|
|
2042
|
+
const step = classifySeveredStream(event);
|
|
2043
|
+
if (step) severedFinishReason = step.kind === "step-finish" && step.severed ? step.reason : null;
|
|
2044
|
+
if (severedFinishReason && isTerminalPromptEvent(event)) {
|
|
2045
|
+
throw new Error(`sandbox model stream severed mid-turn (reason="${severedFinishReason}")`);
|
|
2046
|
+
}
|
|
2047
|
+
if (options?.disallowQuestions) {
|
|
2048
|
+
const q = detectInteractiveQuestion(event);
|
|
2049
|
+
if (q) {
|
|
2050
|
+
throw new Error(`sandbox agent asked an interactive question during an autonomous run: ${q}`);
|
|
2051
|
+
}
|
|
2017
2052
|
}
|
|
2053
|
+
yield event;
|
|
2018
2054
|
}
|
|
2019
|
-
|
|
2055
|
+
} finally {
|
|
2056
|
+
emitSandboxActivity(options?.spend, box);
|
|
2020
2057
|
}
|
|
2021
2058
|
if (severedFinishReason) {
|
|
2022
2059
|
throw new Error(`sandbox model stream severed mid-turn (reason="${severedFinishReason}")`);
|
|
@@ -2177,6 +2214,7 @@ async function driveSandboxTurn(shell, box, message, options) {
|
|
|
2177
2214
|
// no consumer to answer a question. Interactive Q&A is streaming-path only.
|
|
2178
2215
|
backend: { type: harness, profile, ...model ? { model } : {} }
|
|
2179
2216
|
});
|
|
2217
|
+
emitSandboxActivity(options.spend, box);
|
|
2180
2218
|
return ok(drive);
|
|
2181
2219
|
} catch (err) {
|
|
2182
2220
|
return fail(err);
|
|
@@ -2316,4 +2354,4 @@ export {
|
|
|
2316
2354
|
isTerminalPromptEvent,
|
|
2317
2355
|
detectInteractiveQuestion
|
|
2318
2356
|
};
|
|
2319
|
-
//# sourceMappingURL=chunk-
|
|
2357
|
+
//# sourceMappingURL=chunk-OTLEYHOG.js.map
|