@tangle-network/agent-runtime 0.94.11 → 0.94.13

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 (67) hide show
  1. package/README.md +65 -1
  2. package/dist/agent.d.ts +2 -1
  3. package/dist/agent.js +2 -1
  4. package/dist/agent.js.map +1 -1
  5. package/dist/{agentic-generator-JT47GnAp.d.ts → agentic-generator-DDMM45kZ.d.ts} +2 -2
  6. package/dist/analyst-loop.d.ts +2 -1
  7. package/dist/backends-BO4Jqoe2.d.ts +134 -0
  8. package/dist/candidate-execution/index.d.ts +2 -2
  9. package/dist/candidate-execution/index.js +2 -2
  10. package/dist/chunk-AEG3NGJ2.js +639 -0
  11. package/dist/chunk-AEG3NGJ2.js.map +1 -0
  12. package/dist/{chunk-37V4KQDC.js → chunk-CNH7DF7Z.js} +173 -84
  13. package/dist/chunk-CNH7DF7Z.js.map +1 -0
  14. package/dist/{chunk-OLZ6ZZQ2.js → chunk-D3H7F6L2.js} +11 -8
  15. package/dist/chunk-D3H7F6L2.js.map +1 -0
  16. package/dist/{chunk-5LIOH5DR.js → chunk-PCURO3DL.js} +4 -4
  17. package/dist/chunk-PCURO3DL.js.map +1 -0
  18. package/dist/{chunk-FTXM7Q7P.js → chunk-TVJQAYQM.js} +13 -21
  19. package/dist/chunk-TVJQAYQM.js.map +1 -0
  20. package/dist/{chunk-YP6B7RZ2.js → chunk-U33YZ7B2.js} +6 -635
  21. package/dist/chunk-U33YZ7B2.js.map +1 -0
  22. package/dist/chunk-VYA2YEKA.js +1187 -0
  23. package/dist/chunk-VYA2YEKA.js.map +1 -0
  24. package/dist/{chunk-MXBQNVFE.js → chunk-XP5KDM3R.js} +5 -5
  25. package/dist/{completion-gate-Bn4AZ_Kw.d.ts → completion-gate-D1gX1-hg.d.ts} +1 -1
  26. package/dist/conversation.d.ts +793 -0
  27. package/dist/conversation.js +56 -0
  28. package/dist/conversation.js.map +1 -0
  29. package/dist/{coordination-DzwagV_s.d.ts → coordination-Dr_axlAf.d.ts} +5 -4
  30. package/dist/environment-provider.d.ts +3 -2
  31. package/dist/{improve-BucbjddC.d.ts → improve-BN3HyXIO.d.ts} +1 -1
  32. package/dist/index.d.ts +29 -943
  33. package/dist/index.js +60 -1161
  34. package/dist/index.js.map +1 -1
  35. package/dist/intelligence.d.ts +6 -5
  36. package/dist/intelligence.js +6 -6
  37. package/dist/knowledge.d.ts +7 -6
  38. package/dist/lifecycle.d.ts +2 -2
  39. package/dist/lifecycle.js +1 -1
  40. package/dist/{loop-runner-bin-D6K_C6op.d.ts → loop-runner-bin-BRQSQdHa.d.ts} +2 -2
  41. package/dist/loop-runner-bin.d.ts +6 -5
  42. package/dist/loop-runner-bin.js +4 -3
  43. package/dist/loops.d.ts +15 -14
  44. package/dist/loops.js +2 -1
  45. package/dist/mcp/index.d.ts +9 -8
  46. package/dist/mcp/index.js +2 -1
  47. package/dist/mcp/index.js.map +1 -1
  48. package/dist/{mcp-serve-verifier-i6nTNSnu.d.ts → mcp-serve-verifier-DQQDbuyz.d.ts} +1 -1
  49. package/dist/{openai-tools-0wACz8f8.d.ts → openai-tools-fnj6SRVg.d.ts} +1 -1
  50. package/dist/{prepare-DIeVgQG3.d.ts → prepare-CtdtsFNG.d.ts} +18 -14
  51. package/dist/primeintellect/index.d.ts +214 -0
  52. package/dist/primeintellect/index.js +1120 -0
  53. package/dist/primeintellect/index.js.map +1 -0
  54. package/dist/profiles.d.ts +2 -1
  55. package/dist/{sanitize-Dcbjp0tU.d.ts → sanitize-BTSsdBXw.d.ts} +1 -1
  56. package/dist/{supervise-CzyytS-o.d.ts → supervise-DmYOug5f.d.ts} +4 -4
  57. package/dist/{types-CogNCaw7.d.ts → types-1d5QGK3t.d.ts} +1 -1
  58. package/dist/types-BwoZWq-i.d.ts +510 -0
  59. package/dist/{types-CKmyZ9TP.d.ts → types-ByAYqlVb.d.ts} +3 -509
  60. package/dist/{worktree-fanout-Bn7w_1bM.d.ts → worktree-fanout-CPprU-qI.d.ts} +3 -3
  61. package/package.json +17 -5
  62. package/dist/chunk-37V4KQDC.js.map +0 -1
  63. package/dist/chunk-5LIOH5DR.js.map +0 -1
  64. package/dist/chunk-FTXM7Q7P.js.map +0 -1
  65. package/dist/chunk-OLZ6ZZQ2.js.map +0 -1
  66. package/dist/chunk-YP6B7RZ2.js.map +0 -1
  67. /package/dist/{chunk-MXBQNVFE.js.map → chunk-XP5KDM3R.js.map} +0 -0
@@ -0,0 +1,134 @@
1
+ import { A as AgentBackendInput, O as OpenAIChatTool, a as OpenAIChatToolChoice, b as OpenAIChatResponseFormat, c as AgentExecutionBackend, d as AgentBackendContext, R as RuntimeStreamEvent } from './types-BwoZWq-i.js';
2
+
3
+ /**
4
+ *
5
+ * Backend factories for `runAgentTaskStream`. Three shapes ship in core:
6
+ *
7
+ * - `createIterableBackend` — wrap any custom async iterable into a backend
8
+ * - `createSandboxPromptBackend` — sandbox / sidecar `streamPrompt` clients
9
+ * - `createOpenAICompatibleBackend` — OpenAI-style chat completions endpoints
10
+ *
11
+ * Adapters stay thin: domain repos own auth, model selection, and the concrete
12
+ * tool surface. The factories handle session creation, stream normalization,
13
+ * and graceful end-of-stream signalling.
14
+ *
15
+ * @stable
16
+ */
17
+
18
+ /** Wrap any custom async-iterable stream into a typed `AgentExecutionBackend`. @stable */
19
+ declare function createIterableBackend<TInput extends AgentBackendInput>(options: {
20
+ kind: string;
21
+ start?: AgentExecutionBackend<TInput>['start'];
22
+ resume?: AgentExecutionBackend<TInput>['resume'];
23
+ stream: AgentExecutionBackend<TInput>['stream'];
24
+ stop?: AgentExecutionBackend<TInput>['stop'];
25
+ }): AgentExecutionBackend<TInput>;
26
+ /** Build an `AgentExecutionBackend` backed by a sandbox/sidecar `streamPrompt` call. @stable */
27
+ declare function createSandboxPromptBackend<TBox, TInput extends AgentBackendInput = AgentBackendInput>(options: {
28
+ kind?: string;
29
+ getBox(input: TInput, context: Omit<AgentBackendContext, 'session'>): Promise<TBox> | TBox;
30
+ streamPrompt(box: TBox, message: string, context: AgentBackendContext): AsyncIterable<unknown>;
31
+ mapEvent?: (event: unknown, context: AgentBackendContext) => RuntimeStreamEvent | undefined;
32
+ getSessionId?: (box: TBox, input: TInput) => string | undefined;
33
+ }): AgentExecutionBackend<TInput>;
34
+ /** @stable */
35
+ /**
36
+ * Retry policy for transient transport errors (rate limits, upstream
37
+ * timeouts). Defaults to 5 attempts with exponential backoff starting at
38
+ * 1s, ±25% jitter, capped at 30s. Set `maxAttempts: 1` to disable retries.
39
+ *
40
+ * Retried status codes:
41
+ * - 408 Request Timeout
42
+ * - 425 Too Early
43
+ * - 429 Too Many Requests
44
+ * - 500 / 502 / 503 / 504 — upstream transient failures
45
+ *
46
+ * Hard failures (401, 403, 4xx other than the above) propagate immediately.
47
+ */
48
+ interface BackendRetryPolicy {
49
+ /** Total attempts including the first try. Default 5. */
50
+ maxAttempts?: number;
51
+ /** Initial backoff in ms before the second attempt. Default 1000. */
52
+ initialBackoffMs?: number;
53
+ /** Hard ceiling on backoff in ms. Default 30000. */
54
+ maxBackoffMs?: number;
55
+ /** Jitter fraction in [0, 1]. Default 0.25 (±25%). */
56
+ jitter?: number;
57
+ /** Status codes that trigger a retry. Default: 408, 425, 429, 500, 502, 503, 504. */
58
+ retryStatuses?: ReadonlyArray<number>;
59
+ /**
60
+ * Per-attempt wall-clock deadline in ms. If a single fetch attempt does
61
+ * not return headers within this window the attempt is aborted and
62
+ * retried. Default 120000 (2 min). Without this a hung upstream blocks
63
+ * the attempt indefinitely — observed in production as a 15-minute
64
+ * `fetch failed` that burned an entire eval persona. Set to 0 to disable.
65
+ */
66
+ requestTimeoutMs?: number;
67
+ }
68
+ /**
69
+ *
70
+ * OpenAI-compat streaming backend. Routes `runAgentTaskStream` through any
71
+ * `POST /chat/completions` endpoint that speaks OpenAI's SSE protocol —
72
+ * Tangle Router, OpenAI direct, OpenRouter, Groq, DeepSeek, Together. The
73
+ * router also fronts Anthropic models in Anthropic-native SSE shape; this
74
+ * backend handles both.
75
+ *
76
+ * ### Tool calls
77
+ *
78
+ * Pass `tools` (and optionally `toolChoice`) to forward an OpenAI Chat
79
+ * Completions `tools[]` array on every request. Streamed `tool_call` chunks
80
+ * are buffered until the model finalizes them (either `finish_reason:
81
+ * 'tool_calls'` for OpenAI shape or a `content_block_stop` for Anthropic
82
+ * `tool_use` blocks proxied through the router), then emitted as a single
83
+ * `tool_call` RuntimeStreamEvent with the assembled `args`.
84
+ *
85
+ * The backend does NOT execute tools — it surfaces calls for the caller's
86
+ * own dispatcher (typically the product's MCP / sandbox runtime) to fulfill
87
+ * and feed back as a subsequent `messages` turn. This keeps the transport
88
+ * thin and lets the agent host own tool dispatch policy.
89
+ *
90
+ * ### Fail-loud errors
91
+ *
92
+ * Non-success HTTP responses (4xx/5xx) and exhausted retry budgets throw
93
+ * `BackendTransportError` from inside the `stream()` generator. The runtime
94
+ * catches the throw, yields a `backend_error` with a typed `error` field
95
+ * (`kind`, `status`, truncated `body`) and a terminal `final` event with
96
+ * `status: 'failed'` carrying the same detail. Consumers MUST map
97
+ * `final.error` onto their `RunRecord.error` — silently treating an empty
98
+ * `finalText` as "agent produced nothing" hides credit exhaustion, auth
99
+ * failure, and upstream outages.
100
+ *
101
+ * @stable
102
+ */
103
+ declare function createOpenAICompatibleBackend<TInput extends AgentBackendInput = AgentBackendInput>(options: {
104
+ apiKey: string;
105
+ baseUrl: string;
106
+ model: string;
107
+ kind?: string;
108
+ /**
109
+ * OpenAI Chat Completions `tools[]` definitions surfaced to the model on
110
+ * every request. Omit to send a tool-free request (existing behavior).
111
+ * The runtime makes no assumption about the dispatcher — calls stream out
112
+ * as `tool_call` events and the caller is responsible for executing them
113
+ * and feeding `tool_result` messages back on a follow-up turn.
114
+ */
115
+ tools?: ReadonlyArray<OpenAIChatTool>;
116
+ /**
117
+ * OpenAI Chat Completions `tool_choice`. Default `undefined` (request
118
+ * omits the field; provider falls back to its own default — typically
119
+ * `'auto'`).
120
+ */
121
+ toolChoice?: OpenAIChatToolChoice;
122
+ /**
123
+ * OpenAI Chat Completions `response_format`. Omit for provider default text.
124
+ */
125
+ responseFormat?: OpenAIChatResponseFormat;
126
+ /** OpenAI Chat Completions `temperature`. Omit for provider default. */
127
+ temperature?: number;
128
+ /** Maximum completion tokens, sent as OpenAI-compatible `max_tokens`. Omit for provider default. */
129
+ maxTokens?: number;
130
+ fetchImpl?: typeof fetch;
131
+ retry?: BackendRetryPolicy;
132
+ }): AgentExecutionBackend<TInput>;
133
+
134
+ export { createIterableBackend as a, createSandboxPromptBackend as b, createOpenAICompatibleBackend as c };
@@ -1,7 +1,7 @@
1
1
  import { CodeSurface } from '@tangle-network/agent-eval/campaign';
2
2
  import { AgentCandidateCodeDisabled, AgentCandidateCodeNoOp, AgentCandidateGitHubRepository, AgentProfile, AgentProfileDiff, AgentCandidateProfile, AgentCandidateExecution, AgentCandidateKnowledge, AgentCandidateMemoryPolicy, AgentCandidateLineage, Sha256Digest, AgentCandidateArtifactRef, AgentCandidateWorkspaceSnapshotEvidence } from '@tangle-network/agent-interface';
3
- import { a9 as sealAgentCandidateBundle, a0 as PreparedAgentCandidateExecution, j as AgentCandidateExecutionClaim, l as AgentCandidateExecutionClaimStore, k as AgentCandidateExecutionClaimResult, i as AgentCandidateExecutionAttemptRef, h as AgentCandidateExecutionAttemptRecord, p as AgentCandidateExecutionLease, r as AgentCandidateExecutionPhaseResult, v as AgentCandidateExecutionTerminalResult, t as AgentCandidateExecutionStageResult, o as AgentCandidateExecutionFinishResult, s as AgentCandidateExecutionRecoveryEvidence, M as AgentCandidateOutputArtifactPort, N as AgentCandidateOutputPurpose, L as AgentCandidateModelPort, R as AgentCandidateProtectedModelReservation, O as AgentCandidateProtectedModelActivation, S as AgentCandidateProtectedModelSettlement, z as AgentCandidateExecutorPort, b as AgentCandidateExecutionPorts, W as AgentCandidateVerificationPorts, a5 as VerifiedAgentCandidate, G as AgentCandidateExecutorWorkspaceFile, X as AgentCandidateWorkspacePort } from '../prepare-DIeVgQG3.js';
4
- export { d as AgentCandidateArtifactPort, e as AgentCandidateBenchmarkGraderIdentity, f as AgentCandidateBenchmarkGraderPort, A as AgentCandidateBundleInput, g as AgentCandidateContainerPort, m as AgentCandidateExecutionCleanupHandles, n as AgentCandidateExecutionFailureClass, q as AgentCandidateExecutionPhase, u as AgentCandidateExecutionTerminalRecord, w as AgentCandidateExecutionUsage, x as AgentCandidateExecutorFinalCapture, y as AgentCandidateExecutorMemoryCapture, B as AgentCandidateExecutorProfileFile, C as AgentCandidateExecutorRequest, D as AgentCandidateExecutorStopRequest, F as AgentCandidateExecutorTaskOutcomeCapture, H as AgentCandidateExecutorWorkspaceInput, I as AgentCandidateMemoryPort, J as AgentCandidateMemoryResetResult, K as AgentCandidateModelLimits, Q as AgentCandidateProtectedModelCall, T as AgentCandidateProtectedRunCapture, U as AgentCandidateRepositoryPort, V as AgentCandidateRetryRejection, c as AgentCandidateRunFinalization, a as AgentCandidateTaskExecution, Y as CANDIDATE_TRACE_ENV, Z as CANDIDATE_TRACE_TAGS, _ as CanonicalCandidateDocument, E as ExecutePreparedAgentCandidateOptions, $ as InMemoryAgentCandidateExecutionClaimStore, P as PrepareAgentCandidateExecutionOptions, a1 as PreparedAgentCandidateInstruction, a2 as PreparedAgentCandidateLaunch, a3 as PreparedAgentCandidateTrace, a4 as ResolvedAgentCandidateContainer, a6 as VerifiedAgentCandidateTaskOutcome, a7 as executePreparedAgentCandidate, a8 as prepareAgentCandidateExecution } from '../prepare-DIeVgQG3.js';
3
+ import { aa as sealAgentCandidateBundle, a0 as PreparedAgentCandidateExecution, j as AgentCandidateExecutionClaim, l as AgentCandidateExecutionClaimStore, k as AgentCandidateExecutionClaimResult, i as AgentCandidateExecutionAttemptRef, h as AgentCandidateExecutionAttemptRecord, p as AgentCandidateExecutionLease, r as AgentCandidateExecutionPhaseResult, v as AgentCandidateExecutionTerminalResult, t as AgentCandidateExecutionStageResult, o as AgentCandidateExecutionFinishResult, s as AgentCandidateExecutionRecoveryEvidence, M as AgentCandidateOutputArtifactPort, N as AgentCandidateOutputPurpose, L as AgentCandidateModelPort, R as AgentCandidateProtectedModelReservation, O as AgentCandidateProtectedModelActivation, S as AgentCandidateProtectedModelSettlement, z as AgentCandidateExecutorPort, b as AgentCandidateExecutionPorts, W as AgentCandidateVerificationPorts, a6 as VerifiedAgentCandidate, G as AgentCandidateExecutorWorkspaceFile, X as AgentCandidateWorkspacePort } from '../prepare-CtdtsFNG.js';
4
+ export { d as AgentCandidateArtifactPort, e as AgentCandidateBenchmarkGraderIdentity, f as AgentCandidateBenchmarkGraderPort, A as AgentCandidateBundleInput, g as AgentCandidateContainerPort, m as AgentCandidateExecutionCleanupHandles, n as AgentCandidateExecutionFailureClass, q as AgentCandidateExecutionPhase, u as AgentCandidateExecutionTerminalRecord, w as AgentCandidateExecutionUsage, x as AgentCandidateExecutorFinalCapture, y as AgentCandidateExecutorMemoryCapture, B as AgentCandidateExecutorProfileFile, C as AgentCandidateExecutorRequest, D as AgentCandidateExecutorStopRequest, F as AgentCandidateExecutorTaskOutcomeCapture, H as AgentCandidateExecutorWorkspaceInput, I as AgentCandidateMemoryPort, J as AgentCandidateMemoryResetResult, K as AgentCandidateModelLimits, Q as AgentCandidateProtectedModelCall, T as AgentCandidateProtectedRunCapture, U as AgentCandidateRepositoryPort, V as AgentCandidateRetryRejection, c as AgentCandidateRunFinalization, a as AgentCandidateTaskExecution, Y as CANDIDATE_TRACE_ENV, Z as CANDIDATE_TRACE_TAGS, _ as CanonicalCandidateDocument, E as ExecutePreparedAgentCandidateOptions, $ as InMemoryAgentCandidateExecutionClaimStore, P as PrepareAgentCandidateExecutionOptions, a1 as PreparedAgentCandidateInstruction, a2 as PreparedAgentCandidateKnowledge, a3 as PreparedAgentCandidateLaunch, a4 as PreparedAgentCandidateTrace, a5 as ResolvedAgentCandidateContainer, a7 as VerifiedAgentCandidateTaskOutcome, a8 as executePreparedAgentCandidate, a9 as prepareAgentCandidateExecution } from '../prepare-CtdtsFNG.js';
5
5
  import { TraceStore } from '@tangle-network/agent-eval';
6
6
 
7
7
  /** A complete profile that can be frozen without losing behavior. */
@@ -7,7 +7,7 @@ import {
7
7
  createProtectedAgentCandidateModelPort,
8
8
  disposePreparedAgentCandidateExecution,
9
9
  recoverExpiredAgentCandidateExecution
10
- } from "../chunk-FTXM7Q7P.js";
10
+ } from "../chunk-TVJQAYQM.js";
11
11
  import {
12
12
  CANDIDATE_TRACE_ENV,
13
13
  CANDIDATE_TRACE_TAGS,
@@ -21,7 +21,7 @@ import {
21
21
  prepareAgentCandidateExecution,
22
22
  sealAgentCandidateBundle,
23
23
  verifyAgentCandidateBundle
24
- } from "../chunk-37V4KQDC.js";
24
+ } from "../chunk-CNH7DF7Z.js";
25
25
  import "../chunk-WIPGQ4GT.js";
26
26
  import "../chunk-3MDZX7YU.js";
27
27
  import "../chunk-DGUM43GV.js";