@tangle-network/agent-runtime 0.77.0 → 0.78.0

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 (30) hide show
  1. package/dist/agent.d.ts +1 -1
  2. package/dist/agent.js +2 -2
  3. package/dist/analyst-loop.d.ts +1 -1
  4. package/dist/{chunk-LFL7K5FM.js → chunk-OL2SEETC.js} +2 -2
  5. package/dist/{chunk-RQYPH2QE.js → chunk-OLPH6W3J.js} +39 -1
  6. package/dist/chunk-OLPH6W3J.js.map +1 -0
  7. package/dist/{chunk-KKHMDE5I.js → chunk-QJ6BWENI.js} +3 -3
  8. package/dist/{chunk-CEW5BMGN.js → chunk-YHS6I2IS.js} +2 -2
  9. package/dist/{coordination-CZe4lTxy.d.ts → coordination-Csxsy39a.d.ts} +2 -2
  10. package/dist/index.d.ts +6 -6
  11. package/dist/index.js +4 -4
  12. package/dist/intelligence.d.ts +1 -1
  13. package/dist/{loop-runner-bin-Dbtg787n.d.ts → loop-runner-bin-BTMpf1oY.d.ts} +2 -2
  14. package/dist/loop-runner-bin.d.ts +4 -4
  15. package/dist/loop-runner-bin.js +3 -3
  16. package/dist/loops.d.ts +8 -8
  17. package/dist/loops.js +2 -2
  18. package/dist/mcp/bin.js +1 -1
  19. package/dist/mcp/index.d.ts +6 -6
  20. package/dist/mcp/index.js +3 -3
  21. package/dist/{openai-tools-D5tcirFF.d.ts → openai-tools-B-3v06BE.d.ts} +1 -1
  22. package/dist/profiles.d.ts +1 -1
  23. package/dist/{types-B-jWSfcu.d.ts → types-BF-MEsQB.d.ts} +21 -0
  24. package/dist/{worktree-CDxqwxGo.d.ts → worktree-DH_Y0brm.d.ts} +1 -1
  25. package/dist/{worktree-fanout-CljF1L2v.d.ts → worktree-fanout-DGC7jS7i.d.ts} +2 -2
  26. package/package.json +1 -5
  27. package/dist/chunk-RQYPH2QE.js.map +0 -1
  28. /package/dist/{chunk-LFL7K5FM.js.map → chunk-OL2SEETC.js.map} +0 -0
  29. /package/dist/{chunk-KKHMDE5I.js.map → chunk-QJ6BWENI.js.map} +0 -0
  30. /package/dist/{chunk-CEW5BMGN.js.map → chunk-YHS6I2IS.js.map} +0 -0
package/dist/agent.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _tangle_network_agent_eval from '@tangle-network/agent-eval';
2
2
  import { TraceAnalystKindSpec, AnalystFinding } from '@tangle-network/agent-eval';
3
3
  import { A as ArtifactKind, C as CandidateGenerator, P as PromotionGate } from './generator-YkAQrOoD.js';
4
- import { a as RuntimeStreamEvent, S as SandboxClient, b as OutputAdapter, A as AgentRunSpec } from './types-B-jWSfcu.js';
4
+ import { a as RuntimeStreamEvent, S as SandboxClient, b as OutputAdapter, A as AgentRunSpec } from './types-BF-MEsQB.js';
5
5
  import { A as AgentSurfaces } from './improvement-adapter-CioiEE2z.js';
6
6
  export { C as CreateSurfaceImprovementAdapterOpts, D as DraftPatchInput, a as DraftPatchOutput, R as ResolvedSurface, S as SurfaceImprovementEdit, b as SurfaceValidationIssue, c as createSurfaceImprovementAdapter, r as renderSurfaceIssues, d as resolveSubjectPath, v as validateSurfaces } from './improvement-adapter-CioiEE2z.js';
7
7
  import { K as KnowledgeAdapter, a as RunAnalystLoopResult } from './types-BC3bZpH0.js';
package/dist/agent.js CHANGED
@@ -1,7 +1,7 @@
1
- import "./chunk-CEW5BMGN.js";
1
+ import "./chunk-YHS6I2IS.js";
2
2
  import {
3
3
  createSandboxForSpec
4
- } from "./chunk-RQYPH2QE.js";
4
+ } from "./chunk-OLPH6W3J.js";
5
5
  import "./chunk-VMNEQHJR.js";
6
6
  import {
7
7
  mapSandboxEvent
@@ -1,5 +1,5 @@
1
1
  import { TraceAnalystByteBudgets, TraceAnalysisStore } from '@tangle-network/agent-eval';
2
- import { I as Iteration } from './types-B-jWSfcu.js';
2
+ import { I as Iteration } from './types-BF-MEsQB.js';
3
3
  import { R as RunAnalystLoopOpts, a as RunAnalystLoopResult } from './types-BC3bZpH0.js';
4
4
  export { A as AnalystLoopEvent, b as AnalystRegistryLike, c as AnalystRegistryStreamingLike, d as AutoApplyPolicy, F as FindingsStoreLike, I as ImprovementAdapter, e as ImprovementEditBatch, f as ImprovementReport, K as KnowledgeAdapter, g as KnowledgeProposalBatch, h as KnowledgeReport } from './types-BC3bZpH0.js';
5
5
  import '@tangle-network/sandbox';
@@ -8,7 +8,7 @@ import {
8
8
  DELEGATION_STATUS_DESCRIPTION,
9
9
  DELEGATION_STATUS_INPUT_SCHEMA,
10
10
  DELEGATION_STATUS_TOOL_NAME
11
- } from "./chunk-RQYPH2QE.js";
11
+ } from "./chunk-OLPH6W3J.js";
12
12
 
13
13
  // src/mcp/openai-tools.ts
14
14
  function buildTool(name, description, parameters) {
@@ -45,4 +45,4 @@ export {
45
45
  mcpToolsForRuntimeMcp,
46
46
  mcpToolsForRuntimeMcpSubset
47
47
  };
48
- //# sourceMappingURL=chunk-LFL7K5FM.js.map
48
+ //# sourceMappingURL=chunk-OL2SEETC.js.map
@@ -930,6 +930,20 @@ async function executeIteration(args) {
930
930
  const events = [];
931
931
  for await (const event of stream) {
932
932
  events.push(event);
933
+ if (args.ctx.onSandboxEvent) {
934
+ try {
935
+ const observerEvent = cloneEventForObserver(event);
936
+ const result = args.ctx.onSandboxEvent(observerEvent, {
937
+ iterationIndex: args.item.index,
938
+ agentRunName: slot.agentRunName
939
+ });
940
+ if (result && typeof result.then === "function") {
941
+ void result.then(void 0, () => {
942
+ });
943
+ }
944
+ } catch {
945
+ }
946
+ }
933
947
  const llmCall = extractLlmCallEvent(event, slot.agentRunName);
934
948
  if (llmCall) {
935
949
  slot.costUsd += llmCall.costUsd ?? 0;
@@ -1206,6 +1220,30 @@ async function emitTrace(emitter, event) {
1206
1220
  if (!emitter) return;
1207
1221
  await emitter.emit(event);
1208
1222
  }
1223
+ function cloneEventForObserver(event) {
1224
+ try {
1225
+ return structuredClone(event);
1226
+ } catch {
1227
+ return copyPlainSpine(event, /* @__PURE__ */ new WeakMap());
1228
+ }
1229
+ }
1230
+ function copyPlainSpine(value, seen) {
1231
+ if (value === null || typeof value !== "object") return value;
1232
+ const existing = seen.get(value);
1233
+ if (existing !== void 0) return existing;
1234
+ if (Array.isArray(value)) {
1235
+ const copy2 = [];
1236
+ seen.set(value, copy2);
1237
+ for (const item of value) copy2.push(copyPlainSpine(item, seen));
1238
+ return copy2;
1239
+ }
1240
+ const proto = Object.getPrototypeOf(value);
1241
+ if (proto !== Object.prototype && proto !== null) return {};
1242
+ const copy = {};
1243
+ seen.set(value, copy);
1244
+ for (const [key, v] of Object.entries(value)) copy[key] = copyPlainSpine(v, seen);
1245
+ return copy;
1246
+ }
1209
1247
  function hashJson(value) {
1210
1248
  let str;
1211
1249
  try {
@@ -6231,4 +6269,4 @@ export {
6231
6269
  createInProcessTransport,
6232
6270
  serveCoordinationMcp
6233
6271
  };
6234
- //# sourceMappingURL=chunk-RQYPH2QE.js.map
6272
+ //# sourceMappingURL=chunk-OLPH6W3J.js.map