@tangle-network/agent-runtime 6.0.8 → 8.0.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.
- package/CHANGELOG.md +86 -0
- package/README.md +23 -12
- package/dist/{activation-Cwy3_Qn_.js → activation-Ce4zUcu8.js} +4 -4
- package/dist/{activation-Cwy3_Qn_.js.map → activation-Ce4zUcu8.js.map} +1 -1
- package/dist/{activation-CWx7I1PU.d.ts → activation-xxvLF1-1.d.ts} +2 -2
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +3 -3
- package/dist/{bundle-Cy5igJdv.js → bundle-CcpL2lfr.js} +2 -2
- package/dist/{bundle-Cy5igJdv.js.map → bundle-CcpL2lfr.js.map} +1 -1
- package/dist/candidate-execution/index.js +4 -4
- package/dist/continuation-CIyKnS1Q.js +451 -0
- package/dist/continuation-CIyKnS1Q.js.map +1 -0
- package/dist/{coordination-manager-D9z7To7p.js → coordination-manager-sa_PkISw.js} +247 -149
- package/dist/coordination-manager-sa_PkISw.js.map +1 -0
- package/dist/{coordination-map-routing-CKRNZSaV.js → coordination-map-routing-XZXTlCmn.js} +2 -4
- package/dist/coordination-map-routing-XZXTlCmn.js.map +1 -0
- package/dist/{delegate-ws-KBA2H.js → delegate-DhTkJIta.js} +3 -3
- package/dist/{delegate-ws-KBA2H.js.map → delegate-DhTkJIta.js.map} +1 -1
- package/dist/durable.d.ts +71 -4
- package/dist/durable.js +162 -13
- package/dist/durable.js.map +1 -1
- package/dist/{errors-AzSuGI23.js → errors-DG8yufqX.js} +8 -1
- package/dist/errors-DG8yufqX.js.map +1 -0
- package/dist/{failure-cause-BzjUUsRz.js → failure-cause-CVB-YE88.js} +17 -16
- package/dist/failure-cause-CVB-YE88.js.map +1 -0
- package/dist/{graph-registry-7X2nrreR.js → graph-registry-czAwYwNj.js} +133 -9
- package/dist/graph-registry-czAwYwNj.js.map +1 -0
- package/dist/{graph-registry-gYbq4L5Z.js → graph-registry-uTIyyy7A.js} +1 -1
- package/dist/graph-tSIT_eWK.js +1793 -0
- package/dist/graph-tSIT_eWK.js.map +1 -0
- package/dist/{improve-BxfqTsZy.js → improve-H08hiIw9.js} +19 -48
- package/dist/improve-H08hiIw9.js.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +16 -16
- package/dist/intelligence.d.ts +2 -2
- package/dist/intelligence.js +8 -8
- package/dist/intelligence.js.map +1 -1
- package/dist/kernel.d.ts +2 -2
- package/dist/kernel.js +16 -15
- package/dist/{loop-runner-CUMypgRw.d.ts → loop-runner-BGwhcn1p.d.ts} +2 -2
- package/dist/{loop-runner-BmGZ4y1W.js → loop-runner-ChqK8kSz.js} +3 -3
- package/dist/{loop-runner-BmGZ4y1W.js.map → loop-runner-ChqK8kSz.js.map} +1 -1
- package/dist/loop-runner-bin.d.ts +1 -1
- package/dist/loop-runner-bin.js +1 -1
- package/dist/mcp/bin.js +7 -5
- package/dist/mcp/bin.js.map +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +9 -9
- package/dist/mcp/memory-bin.js +2 -2
- package/dist/{model-policy-JOcg3NRs.js → model-policy-yxOrDTTj.js} +9 -9
- package/dist/model-policy-yxOrDTTj.js.map +1 -0
- package/dist/{prepare-Dtfk_Wi_.js → prepare-BnF8nGIg.js} +4 -4
- package/dist/{prepare-Dtfk_Wi_.js.map → prepare-BnF8nGIg.js.map} +1 -1
- package/dist/{profile-CNSQjOes.js → profile-CD25rTJF.js} +4 -4
- package/dist/{profile-CNSQjOes.js.map → profile-CD25rTJF.js.map} +1 -1
- package/dist/profiles.d.ts +1 -1
- package/dist/profiles.js +2 -2
- package/dist/{provision-supervisor-CeQTPHRr.js → provision-supervisor-Dx4TXTMM.js} +8 -8
- package/dist/{provision-supervisor-CeQTPHRr.js.map → provision-supervisor-Dx4TXTMM.js.map} +1 -1
- package/dist/{run-cancellation-D_4vJ522.js → run-cancellation-DYszFJtQ.js} +4 -4
- package/dist/{run-cancellation-D_4vJ522.js.map → run-cancellation-DYszFJtQ.js.map} +1 -1
- package/dist/{run-state-CTZVngI_.js → run-state-DHBoJjaF.js} +6 -6
- package/dist/{run-state-CTZVngI_.js.map → run-state-DHBoJjaF.js.map} +1 -1
- package/dist/{runtime-COm9uBBx.js → runtime-CaM5Gbbv.js} +76 -987
- package/dist/runtime-CaM5Gbbv.js.map +1 -0
- package/dist/{sandbox-profile-compat-oFGWESLn.js → sandbox-profile-compat-l-SLQnGb.js} +2 -2
- package/dist/{sandbox-profile-compat-oFGWESLn.js.map → sandbox-profile-compat-l-SLQnGb.js.map} +1 -1
- package/dist/{search-executor-DTEIl58w.js → search-executor-B9L8W_1O.js} +17 -46
- package/dist/search-executor-B9L8W_1O.js.map +1 -0
- package/dist/{server-zO9Nz9Nk.js → server-BlDV8sj_.js} +32 -8
- package/dist/{server-zO9Nz9Nk.js.map → server-BlDV8sj_.js.map} +1 -1
- package/dist/{settle-record-U7fkQEZa.js → settle-record-WWQasnDq.js} +12 -4
- package/dist/settle-record-WWQasnDq.js.map +1 -0
- package/dist/{snapshot-Cgj2Wzi6.js → snapshot-BKI_w3JD.js} +19 -5
- package/dist/snapshot-BKI_w3JD.js.map +1 -0
- package/dist/{structural-rollout-BwTwTUXF.js → structural-rollout-C1xxoWcN.js} +39 -57
- package/dist/structural-rollout-C1xxoWcN.js.map +1 -0
- package/dist/{supervise-tmqDU6YT.js → supervise-DWiSgPLB.js} +103 -111
- package/dist/supervise-DWiSgPLB.js.map +1 -0
- package/dist/{supervision-discovery-CGbXayGv.js → supervision-discovery-C9kfBLKy.js} +4 -4
- package/dist/{supervision-discovery-CGbXayGv.js.map → supervision-discovery-C9kfBLKy.js.map} +1 -1
- package/dist/{supervisor-1A27fE6k.js → supervisor-Dpeu7rnZ.js} +209 -999
- package/dist/supervisor-Dpeu7rnZ.js.map +1 -0
- package/dist/{scope-gIYQ5ZiL.js → supervisor-accounting-Bw4MJk-b.js} +755 -458
- package/dist/supervisor-accounting-Bw4MJk-b.js.map +1 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +13 -13
- package/dist/{tool-server-B9q2dtnW.js → tool-server-DYwRbi0I.js} +3 -3
- package/dist/{tool-server-B9q2dtnW.js.map → tool-server-DYwRbi0I.js.map} +1 -1
- package/dist/{top-web-CS4PD4ck.js → top-web-B3HOAtrZ.js} +9 -7
- package/dist/{top-web-CS4PD4ck.js.map → top-web-B3HOAtrZ.js.map} +1 -1
- package/dist/tui/bin.js +6 -6
- package/dist/tui/bin.js.map +1 -1
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +2 -2
- package/dist/{types-w3Oo1uRJ.d.ts → types-C_qbnw9N.d.ts} +1263 -1497
- package/dist/{util-C_cdPNC4.js → util-fcckrkKp.js} +39 -113
- package/dist/util-fcckrkKp.js.map +1 -0
- package/dist/{workspace-streams-B7yNMahl.js → workspace-streams-DA9R3j-p.js} +2 -2
- package/dist/{workspace-streams-B7yNMahl.js.map → workspace-streams-DA9R3j-p.js.map} +1 -1
- package/package.json +1 -1
- package/dist/coordination-manager-D9z7To7p.js.map +0 -1
- package/dist/coordination-map-routing-CKRNZSaV.js.map +0 -1
- package/dist/errors-AzSuGI23.js.map +0 -1
- package/dist/failure-cause-BzjUUsRz.js.map +0 -1
- package/dist/graph-2_nX4ib4.js +0 -579
- package/dist/graph-2_nX4ib4.js.map +0 -1
- package/dist/graph-registry-7X2nrreR.js.map +0 -1
- package/dist/improve-BxfqTsZy.js.map +0 -1
- package/dist/model-policy-JOcg3NRs.js.map +0 -1
- package/dist/runtime-COm9uBBx.js.map +0 -1
- package/dist/scope-gIYQ5ZiL.js.map +0 -1
- package/dist/search-executor-DTEIl58w.js.map +0 -1
- package/dist/settle-record-U7fkQEZa.js.map +0 -1
- package/dist/snapshot-Cgj2Wzi6.js.map +0 -1
- package/dist/structural-rollout-BwTwTUXF.js.map +0 -1
- package/dist/supervise-tmqDU6YT.js.map +0 -1
- package/dist/supervisor-1A27fE6k.js.map +0 -1
- package/dist/util-C_cdPNC4.js.map +0 -1
package/dist/testing.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ad as supervisorAgentWithTestBrain, B as PeerAuditAccess, Cf as PriorCoordination, Cv as AnalystRegistry, F as CoordinationTools, Gu as runGraphWithTestBrain, H as SpawnPreflight, Hf as SpawnResourceReader, Hu as RunGraphTestOptions, K as SuperviseProfileEntry, L as GraphSubtaskPreparation, Lh as DeliverableSpec, M_ as ContinuityMode, R as GraphSubtasks, Tv as AnalyzeOnSettleRoute, U as SpawnPreflightContext, W as SpawnRefusal, Wd as ManagerWakePolicy, Zd as StopRule, Zv as RunCancelRequest, Zx as HarnessTranscriptCapture, __ as EscalateQuestion, _m as ToolLoopCompactionOptions, bb as Agent, bf as CoordinationDeliveryEvidence, cv as McpToolDescriptor, d_ as RouteFlow, dv as BusRecord, e_ as CoordinationEvent, g_ as ChildQuestionInbox, hm as ToolLoopChat, iy as ResultBlobStore, k_ as AuthorizeDownMessage, lf as SupervisorFinalizer, mm as ToolLoopCallContext, o_ as WorkerWatchOptions, qy as Budget, s_ as DecideGate, um as RouterResponseReceipt, vm as ToolLoopMessageRecord, wu as SuperviseTestOptions, ym as ToolLoopToolCall, yp as Inbox, yu as superviseWithTestBrain, z as MakeWorkerAgent, z_ as MapOnSettleRoute, zd as SupervisorAgentTestDeps } from "./types-C_qbnw9N.js";
|
|
2
2
|
import { AgentImprovementProposal, AgentProfile, AgentProfileImprovementMeasuredComparison, SandboxSizePreset } from "@tangle-network/agent-interface";
|
|
3
3
|
/** What the brain returned for one turn, as the recorder keeps it. */
|
|
4
4
|
interface RouterTranscriptReply {
|
package/dist/testing.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { L as immutableCandidateValue, N as canonicalCandidateDigest$1 } from "./workspace-streams-
|
|
2
|
-
import { c as verifyAgentImprovementProposal } from "./activation-
|
|
3
|
-
import { a as applyExactAgentProfileDiff, v as parseExactAgentProfile } from "./profile-
|
|
4
|
-
import { c as supervisorAgentWithTestBrain, m as driverAgent, r as superviseWithTestBrain } from "./supervise-
|
|
5
|
-
import { r as runGraphWithTestBrain } from "./graph-
|
|
1
|
+
import { L as immutableCandidateValue, N as canonicalCandidateDigest$1 } from "./workspace-streams-DA9R3j-p.js";
|
|
2
|
+
import { c as verifyAgentImprovementProposal } from "./activation-Ce4zUcu8.js";
|
|
3
|
+
import { a as applyExactAgentProfileDiff, v as parseExactAgentProfile } from "./profile-CD25rTJF.js";
|
|
4
|
+
import { c as supervisorAgentWithTestBrain, m as driverAgent, r as superviseWithTestBrain } from "./supervise-DWiSgPLB.js";
|
|
5
|
+
import { r as runGraphWithTestBrain } from "./graph-tSIT_eWK.js";
|
|
6
6
|
import { SANDBOX_SIZE_PRESET_NAMES, canonicalAgentProfileDigest } from "@tangle-network/agent-interface";
|
|
7
7
|
// src/testing/fixtures/agent-improvement-proposal.json
|
|
8
8
|
var agent_improvement_proposal_default = {
|
|
9
9
|
changedSurfaces: ["prompt"],
|
|
10
|
-
digest: "sha256:
|
|
10
|
+
digest: "sha256:e617de7bf9814e91d7cf798d9c9adfb94d746b0a39513d73f55601d69a890131",
|
|
11
11
|
evaluation: {
|
|
12
12
|
"decision": {
|
|
13
13
|
"contributingChecks": [
|
|
@@ -4578,7 +4578,7 @@ var agent_improvement_proposal_default = {
|
|
|
4578
4578
|
],
|
|
4579
4579
|
"metadata": {
|
|
4580
4580
|
"fixture": "agent-improvement-proposal",
|
|
4581
|
-
"runtimeVersion": "
|
|
4581
|
+
"runtimeVersion": "8.0.0"
|
|
4582
4582
|
},
|
|
4583
4583
|
"objectives": [
|
|
4584
4584
|
{
|
|
@@ -4689,8 +4689,8 @@ var agent_improvement_proposal_default = {
|
|
|
4689
4689
|
"baselineContentHash": "sha256:5c21ee53e513fc604cb09754e21c392b24a424da0ef37dbf8f1ee4a8a0b08f09",
|
|
4690
4690
|
"candidateContentHash": "sha256:60fcbb1c728194bd51d7d19cb732d1c3f1881dce7e0a6266b41c8b98cfd65693",
|
|
4691
4691
|
"kind": "agent-eval-loop",
|
|
4692
|
-
"recordDigest": "sha256:
|
|
4693
|
-
"runId": "agent-runtime-
|
|
4692
|
+
"recordDigest": "sha256:f5fc610f6c7134c625066060f0d0e31eca3a357213b23b00336d7b99e5592e25",
|
|
4693
|
+
"runId": "agent-runtime-8.0.0-proposal-fixture",
|
|
4694
4694
|
"schema": "agent-candidate-experiment"
|
|
4695
4695
|
}
|
|
4696
4696
|
},
|
|
@@ -4713,12 +4713,12 @@ var agent_improvement_proposal_default = {
|
|
|
4713
4713
|
}],
|
|
4714
4714
|
kind: "agent-improvement-proposal",
|
|
4715
4715
|
proposedAt: "2026-07-10T01:00:00.000Z",
|
|
4716
|
-
runId: "agent-runtime-
|
|
4716
|
+
runId: "agent-runtime-8.0.0-proposal-fixture"
|
|
4717
4717
|
};
|
|
4718
4718
|
// src/testing/fixtures/agent-profile-improvement-proposal.json
|
|
4719
4719
|
var agent_profile_improvement_proposal_default = {
|
|
4720
4720
|
changedSurfaces: ["prompt", "skills"],
|
|
4721
|
-
digest: "sha256:
|
|
4721
|
+
digest: "sha256:12a0d3d14f8921d5ca05e9403e414962f7a8d50c3d110ebcfc824ab37ec6ab14",
|
|
4722
4722
|
evaluation: {
|
|
4723
4723
|
"decision": {
|
|
4724
4724
|
"contributingChecks": [
|
|
@@ -6352,7 +6352,7 @@ var agent_profile_improvement_proposal_default = {
|
|
|
6352
6352
|
],
|
|
6353
6353
|
"metadata": {
|
|
6354
6354
|
"fixture": "agent-profile-improvement-proposal",
|
|
6355
|
-
"runtimeVersion": "
|
|
6355
|
+
"runtimeVersion": "8.0.0"
|
|
6356
6356
|
},
|
|
6357
6357
|
"objectives": [
|
|
6358
6358
|
{
|
|
@@ -6463,7 +6463,7 @@ var agent_profile_improvement_proposal_default = {
|
|
|
6463
6463
|
"baselineContentHash": "sha256:21c495a37c418c10bde64fbaa188beddeed31f1f051ea60a6a6582a9ee0db704",
|
|
6464
6464
|
"candidateContentHash": "sha256:103f77bc8481601eef1ad5fe6ba84a40dffabc3a44f421f8c8559121edab84e9",
|
|
6465
6465
|
"kind": "agent-eval-loop",
|
|
6466
|
-
"recordDigest": "sha256:
|
|
6466
|
+
"recordDigest": "sha256:6ef5c55279085e82efb34b5399c5f53e146aca047c6ba7e191fc5f27ab8d5987",
|
|
6467
6467
|
"runId": "profile-improvement-1",
|
|
6468
6468
|
"schema": "agent-profile-improvement-experiment"
|
|
6469
6469
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { m as ValidationError } from "./errors-
|
|
2
|
-
import { n as runtimeFailureCause, r as runtimeFailureCauseSchema } from "./failure-cause-
|
|
1
|
+
import { m as ValidationError } from "./errors-DG8yufqX.js";
|
|
2
|
+
import { n as runtimeFailureCause, r as runtimeFailureCauseSchema } from "./failure-cause-CVB-YE88.js";
|
|
3
3
|
import { createInterface } from "node:readline";
|
|
4
4
|
// src/mcp/tool-server.ts
|
|
5
5
|
/**
|
|
@@ -171,4 +171,4 @@ function writeResponse(output, response) {
|
|
|
171
171
|
}
|
|
172
172
|
export { createStdioToolServer as n, PROTOCOL_VERSION as t };
|
|
173
173
|
|
|
174
|
-
//# sourceMappingURL=tool-server-
|
|
174
|
+
//# sourceMappingURL=tool-server-DYwRbi0I.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-server-B9q2dtnW.js","names":[],"sources":["../src/mcp/tool-server.ts"],"sourcesContent":["/**\n * `createStdioToolServer` — the generic newline-delimited JSON-RPC 2.0 MCP\n * server core: `initialize` / `notifications/initialized` / `tools/list` /\n * `ping` / `tools/call` over a stdio-shaped transport. It answers the\n * client's protocol version when listed in `SUPPORTED_PROTOCOL_VERSIONS`,\n * else 2024-11-05, and publishes tool annotations when a tool declares them.\n *\n * @experimental\n */\n\nimport { createInterface, type Interface as ReadlineInterface } from 'node:readline'\nimport { ValidationError } from '../errors'\nimport { runtimeFailureCause, runtimeFailureCauseSchema } from '../runtime/failure-cause'\nimport type { JsonRpcMessage, JsonRpcResponse, McpToolDescriptor, McpTransport } from './protocol'\n\nexport type { JsonRpcMessage, JsonRpcResponse, McpToolDescriptor, McpTransport } from './protocol'\n\nexport const PROTOCOL_VERSION = '2024-11-05'\n\n/**\n * Protocol versions this server speaks, newest first. `initialize` answers with\n * the client's requested version when it is listed here, and otherwise with\n * `PROTOCOL_VERSION` (2024-11-05), which every client that speaks 2024-11-05 accepts.\n */\nconst SUPPORTED_PROTOCOL_VERSIONS: readonly string[] = [\n '2025-11-25',\n '2025-06-18',\n '2025-03-26',\n PROTOCOL_VERSION,\n]\n\nconst toolFailureSchema = runtimeFailureCauseSchema.unwrap().pick({\n code: true,\n owner: true,\n providerCode: true,\n providerStatus: true,\n retryAfterMs: true,\n})\n\n/** @experimental */\nexport interface StdioToolServerOptions {\n /** Server display name surfaced via `initialize`. */\n serverName: string\n /** Server version surfaced via `initialize`. */\n serverVersion: string\n /** The tools to serve. Duplicate names throw — a silent shadow would hide a tool. */\n tools: readonly McpToolDescriptor[]\n}\n\n/** @experimental */\nexport interface StdioToolServer {\n /** Tools currently registered, keyed by name. */\n readonly tools: ReadonlyMap<string, McpToolDescriptor>\n /** Handle a single parsed JSON-RPC message. Returns the response object (or `null` for notifications). */\n handle(message: JsonRpcMessage): Promise<JsonRpcResponse | null>\n /** Drive the server on a stdio-shaped transport until `stop()` is called. */\n serve(transport?: McpTransport): Promise<void>\n /** Stop a `serve` call. Subsequent requests are rejected. */\n stop(): void\n}\n\n/** Build the generic stdio JSON-RPC tool server. */\nexport function createStdioToolServer(options: StdioToolServerOptions): StdioToolServer {\n const tools = new Map<string, McpToolDescriptor>()\n for (const tool of options.tools) {\n if (tools.has(tool.name)) {\n throw new ValidationError(`createStdioToolServer: duplicate tool name \"${tool.name}\"`)\n }\n tools.set(tool.name, tool)\n }\n\n let stopped = false\n let activeReadline: ReadlineInterface | undefined\n\n async function handle(message: JsonRpcMessage): Promise<JsonRpcResponse | null> {\n if (stopped) {\n return rpcError(message.id ?? null, -32099, 'server stopped')\n }\n if (message.method === 'initialize') {\n const requested = (message.params as { protocolVersion?: unknown } | undefined)\n ?.protocolVersion\n return rpcResult(message.id ?? null, {\n protocolVersion:\n typeof requested === 'string' && SUPPORTED_PROTOCOL_VERSIONS.includes(requested)\n ? requested\n : PROTOCOL_VERSION,\n capabilities: { tools: {} },\n serverInfo: { name: options.serverName, version: options.serverVersion },\n })\n }\n if (message.method === 'notifications/initialized') {\n // MCP clients send this after the handshake; it has no id and expects\n // no response.\n return null\n }\n if (message.method === 'ping') {\n return rpcResult(message.id ?? null, {})\n }\n if (message.method === 'tools/list') {\n return rpcResult(message.id ?? null, {\n tools: [...tools.values()].map((tool) => ({\n name: tool.name,\n description: tool.description,\n inputSchema: tool.inputSchema,\n ...(tool.annotations ? { annotations: tool.annotations } : {}),\n })),\n })\n }\n if (message.method === 'tools/call') {\n const params = (message.params ?? {}) as { name?: unknown; arguments?: unknown }\n const name = typeof params.name === 'string' ? params.name : ''\n const tool = tools.get(name)\n if (!tool) {\n return rpcError(message.id ?? null, -32601, `unknown tool: ${name}`)\n }\n try {\n const output = await tool.handler(params.arguments ?? {})\n return rpcResult(message.id ?? null, toolCallResult(output))\n } catch (err) {\n const reason = err instanceof Error ? err.message : String(err)\n const code = err instanceof TypeError || err instanceof RangeError ? -32602 : -32000\n const failure = toolFailureSchema.safeParse(runtimeFailureCause(err))\n return rpcError(\n message.id ?? null,\n code,\n reason,\n failure.success ? { failure: failure.data } : undefined,\n )\n }\n }\n if (message.id === undefined || message.id === null) return null\n return rpcError(message.id, -32601, `unknown method: ${message.method}`)\n }\n\n async function serve(transport?: McpTransport): Promise<void> {\n const input = transport?.input ?? process.stdin\n const output = transport?.output ?? process.stdout\n const rl = createInterface({ input, crlfDelay: Number.POSITIVE_INFINITY })\n activeReadline = rl\n return new Promise<void>((resolve, reject) => {\n rl.on('line', (line) => {\n const trimmed = line.trim()\n if (!trimmed) return\n let parsed: JsonRpcMessage | undefined\n try {\n parsed = JSON.parse(trimmed) as JsonRpcMessage\n } catch (err) {\n writeResponse(output, rpcError(null, -32700, `parse error: ${(err as Error).message}`))\n return\n }\n if (parsed?.jsonrpc !== '2.0' || typeof parsed.method !== 'string') {\n writeResponse(output, rpcError(parsed?.id ?? null, -32600, 'invalid request'))\n return\n }\n void handle(parsed).then((response) => {\n if (response) writeResponse(output, response)\n })\n })\n rl.on('close', () => resolve())\n rl.on('error', (err) => reject(err))\n if (stopped) {\n rl.close()\n resolve()\n }\n })\n }\n\n function stop(): void {\n stopped = true\n activeReadline?.close()\n activeReadline = undefined\n }\n\n return { tools, handle, serve, stop }\n}\n\nfunction toolCallResult(output: unknown): {\n content: [{ type: 'text'; text: string }]\n structuredContent?: Record<string, unknown>\n isError: false\n} {\n let json: string | undefined\n try {\n json = JSON.stringify(output)\n } catch (err) {\n const reason = err instanceof Error ? `: ${err.message}` : ''\n throw new TypeError(`MCP tool result must be JSON-serializable${reason}`, { cause: err })\n }\n if (json === undefined) {\n throw new TypeError('MCP tool result must be JSON-serializable')\n }\n\n const serialized = JSON.parse(json) as unknown\n // Preserve string content verbatim. MCP clients pass this text directly to the calling agent.\n const result: {\n content: [{ type: 'text'; text: string }]\n structuredContent?: Record<string, unknown>\n isError: false\n } = {\n content: [{ type: 'text', text: typeof serialized === 'string' ? serialized : json }],\n isError: false,\n }\n if (serialized !== null && typeof serialized === 'object' && !Array.isArray(serialized)) {\n result.structuredContent = serialized as Record<string, unknown>\n }\n return result\n}\n\nfunction rpcResult(id: number | string | null, result: unknown): JsonRpcResponse {\n return { jsonrpc: '2.0', id, result }\n}\n\nfunction rpcError(\n id: number | string | null,\n code: number,\n message: string,\n data?: unknown,\n): JsonRpcResponse {\n return {\n jsonrpc: '2.0',\n id,\n error: data === undefined ? { code, message } : { code, message, data },\n }\n}\n\nfunction writeResponse(output: NodeJS.WritableStream, response: JsonRpcResponse): void {\n output.write(`${JSON.stringify(response)}\\n`)\n}\n"],"mappings":";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AAI;GAAE;GAAM;GAAS;EAAK;CACxE;AACF;AAEA,SAAS,cAAc,QAA+B,UAAiC;CACrF,OAAO,MAAM,GAAG,KAAK,UAAU,QAAQ,EAAE,GAAG;AAC9C"}
|
|
1
|
+
{"version":3,"file":"tool-server-DYwRbi0I.js","names":[],"sources":["../src/mcp/tool-server.ts"],"sourcesContent":["/**\n * `createStdioToolServer` — the generic newline-delimited JSON-RPC 2.0 MCP\n * server core: `initialize` / `notifications/initialized` / `tools/list` /\n * `ping` / `tools/call` over a stdio-shaped transport. It answers the\n * client's protocol version when listed in `SUPPORTED_PROTOCOL_VERSIONS`,\n * else 2024-11-05, and publishes tool annotations when a tool declares them.\n *\n * @experimental\n */\n\nimport { createInterface, type Interface as ReadlineInterface } from 'node:readline'\nimport { ValidationError } from '../errors'\nimport { runtimeFailureCause, runtimeFailureCauseSchema } from '../runtime/failure-cause'\nimport type { JsonRpcMessage, JsonRpcResponse, McpToolDescriptor, McpTransport } from './protocol'\n\nexport type { JsonRpcMessage, JsonRpcResponse, McpToolDescriptor, McpTransport } from './protocol'\n\nexport const PROTOCOL_VERSION = '2024-11-05'\n\n/**\n * Protocol versions this server speaks, newest first. `initialize` answers with\n * the client's requested version when it is listed here, and otherwise with\n * `PROTOCOL_VERSION` (2024-11-05), which every client that speaks 2024-11-05 accepts.\n */\nconst SUPPORTED_PROTOCOL_VERSIONS: readonly string[] = [\n '2025-11-25',\n '2025-06-18',\n '2025-03-26',\n PROTOCOL_VERSION,\n]\n\nconst toolFailureSchema = runtimeFailureCauseSchema.unwrap().pick({\n code: true,\n owner: true,\n providerCode: true,\n providerStatus: true,\n retryAfterMs: true,\n})\n\n/** @experimental */\nexport interface StdioToolServerOptions {\n /** Server display name surfaced via `initialize`. */\n serverName: string\n /** Server version surfaced via `initialize`. */\n serverVersion: string\n /** The tools to serve. Duplicate names throw — a silent shadow would hide a tool. */\n tools: readonly McpToolDescriptor[]\n}\n\n/** @experimental */\nexport interface StdioToolServer {\n /** Tools currently registered, keyed by name. */\n readonly tools: ReadonlyMap<string, McpToolDescriptor>\n /** Handle a single parsed JSON-RPC message. Returns the response object (or `null` for notifications). */\n handle(message: JsonRpcMessage): Promise<JsonRpcResponse | null>\n /** Drive the server on a stdio-shaped transport until `stop()` is called. */\n serve(transport?: McpTransport): Promise<void>\n /** Stop a `serve` call. Subsequent requests are rejected. */\n stop(): void\n}\n\n/** Build the generic stdio JSON-RPC tool server. */\nexport function createStdioToolServer(options: StdioToolServerOptions): StdioToolServer {\n const tools = new Map<string, McpToolDescriptor>()\n for (const tool of options.tools) {\n if (tools.has(tool.name)) {\n throw new ValidationError(`createStdioToolServer: duplicate tool name \"${tool.name}\"`)\n }\n tools.set(tool.name, tool)\n }\n\n let stopped = false\n let activeReadline: ReadlineInterface | undefined\n\n async function handle(message: JsonRpcMessage): Promise<JsonRpcResponse | null> {\n if (stopped) {\n return rpcError(message.id ?? null, -32099, 'server stopped')\n }\n if (message.method === 'initialize') {\n const requested = (message.params as { protocolVersion?: unknown } | undefined)\n ?.protocolVersion\n return rpcResult(message.id ?? null, {\n protocolVersion:\n typeof requested === 'string' && SUPPORTED_PROTOCOL_VERSIONS.includes(requested)\n ? requested\n : PROTOCOL_VERSION,\n capabilities: { tools: {} },\n serverInfo: { name: options.serverName, version: options.serverVersion },\n })\n }\n if (message.method === 'notifications/initialized') {\n // MCP clients send this after the handshake; it has no id and expects\n // no response.\n return null\n }\n if (message.method === 'ping') {\n return rpcResult(message.id ?? null, {})\n }\n if (message.method === 'tools/list') {\n return rpcResult(message.id ?? null, {\n tools: [...tools.values()].map((tool) => ({\n name: tool.name,\n description: tool.description,\n inputSchema: tool.inputSchema,\n ...(tool.annotations ? { annotations: tool.annotations } : {}),\n })),\n })\n }\n if (message.method === 'tools/call') {\n const params = (message.params ?? {}) as { name?: unknown; arguments?: unknown }\n const name = typeof params.name === 'string' ? params.name : ''\n const tool = tools.get(name)\n if (!tool) {\n return rpcError(message.id ?? null, -32601, `unknown tool: ${name}`)\n }\n try {\n const output = await tool.handler(params.arguments ?? {})\n return rpcResult(message.id ?? null, toolCallResult(output))\n } catch (err) {\n const reason = err instanceof Error ? err.message : String(err)\n const code = err instanceof TypeError || err instanceof RangeError ? -32602 : -32000\n const failure = toolFailureSchema.safeParse(runtimeFailureCause(err))\n return rpcError(\n message.id ?? null,\n code,\n reason,\n failure.success ? { failure: failure.data } : undefined,\n )\n }\n }\n if (message.id === undefined || message.id === null) return null\n return rpcError(message.id, -32601, `unknown method: ${message.method}`)\n }\n\n async function serve(transport?: McpTransport): Promise<void> {\n const input = transport?.input ?? process.stdin\n const output = transport?.output ?? process.stdout\n const rl = createInterface({ input, crlfDelay: Number.POSITIVE_INFINITY })\n activeReadline = rl\n return new Promise<void>((resolve, reject) => {\n rl.on('line', (line) => {\n const trimmed = line.trim()\n if (!trimmed) return\n let parsed: JsonRpcMessage | undefined\n try {\n parsed = JSON.parse(trimmed) as JsonRpcMessage\n } catch (err) {\n writeResponse(output, rpcError(null, -32700, `parse error: ${(err as Error).message}`))\n return\n }\n if (parsed?.jsonrpc !== '2.0' || typeof parsed.method !== 'string') {\n writeResponse(output, rpcError(parsed?.id ?? null, -32600, 'invalid request'))\n return\n }\n void handle(parsed).then((response) => {\n if (response) writeResponse(output, response)\n })\n })\n rl.on('close', () => resolve())\n rl.on('error', (err) => reject(err))\n if (stopped) {\n rl.close()\n resolve()\n }\n })\n }\n\n function stop(): void {\n stopped = true\n activeReadline?.close()\n activeReadline = undefined\n }\n\n return { tools, handle, serve, stop }\n}\n\nfunction toolCallResult(output: unknown): {\n content: [{ type: 'text'; text: string }]\n structuredContent?: Record<string, unknown>\n isError: false\n} {\n let json: string | undefined\n try {\n json = JSON.stringify(output)\n } catch (err) {\n const reason = err instanceof Error ? `: ${err.message}` : ''\n throw new TypeError(`MCP tool result must be JSON-serializable${reason}`, { cause: err })\n }\n if (json === undefined) {\n throw new TypeError('MCP tool result must be JSON-serializable')\n }\n\n const serialized = JSON.parse(json) as unknown\n // Preserve string content verbatim. MCP clients pass this text directly to the calling agent.\n const result: {\n content: [{ type: 'text'; text: string }]\n structuredContent?: Record<string, unknown>\n isError: false\n } = {\n content: [{ type: 'text', text: typeof serialized === 'string' ? serialized : json }],\n isError: false,\n }\n if (serialized !== null && typeof serialized === 'object' && !Array.isArray(serialized)) {\n result.structuredContent = serialized as Record<string, unknown>\n }\n return result\n}\n\nfunction rpcResult(id: number | string | null, result: unknown): JsonRpcResponse {\n return { jsonrpc: '2.0', id, result }\n}\n\nfunction rpcError(\n id: number | string | null,\n code: number,\n message: string,\n data?: unknown,\n): JsonRpcResponse {\n return {\n jsonrpc: '2.0',\n id,\n error: data === undefined ? { code, message } : { code, message, data },\n }\n}\n\nfunction writeResponse(output: NodeJS.WritableStream, response: JsonRpcResponse): void {\n output.write(`${JSON.stringify(response)}\\n`)\n}\n"],"mappings":";;;;;;;;;;;;;AAiBA,MAAa,mBAAmB;;;;;;AAOhC,MAAM,8BAAiD;CACrD;CACA;CACA;CACA;AACF;AAEA,MAAM,oBAAoB,0BAA0B,OAAO,CAAC,CAAC,KAAK;CAChE,MAAM;CACN,OAAO;CACP,cAAc;CACd,gBAAgB;CAChB,cAAc;AAChB,CAAC;;AAyBD,SAAgB,sBAAsB,SAAkD;CACtF,MAAM,wBAAQ,IAAI,IAA+B;CACjD,KAAK,MAAM,QAAQ,QAAQ,OAAO;EAChC,IAAI,MAAM,IAAI,KAAK,IAAI,GACrB,MAAM,IAAI,gBAAgB,+CAA+C,KAAK,KAAK,EAAE;EAEvF,MAAM,IAAI,KAAK,MAAM,IAAI;CAC3B;CAEA,IAAI,UAAU;CACd,IAAI;CAEJ,eAAe,OAAO,SAA0D;EAC9E,IAAI,SACF,OAAO,SAAS,QAAQ,MAAM,MAAM,QAAQ,gBAAgB;EAE9D,IAAI,QAAQ,WAAW,cAAc;GACnC,MAAM,YAAa,QAAQ,QACvB;GACJ,OAAO,UAAU,QAAQ,MAAM,MAAM;IACnC,iBACE,OAAO,cAAc,YAAY,4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AO,IAAI,CAAC;CAC1F;CACA,IAAI,SAAS,KAAA,GACX,MAAM,IAAI,UAAU,2CAA2C;CAGjE,MAAM,aAAa,KAAK,MAAM,IAAI;CAElC,MAAM,SAIF;EACF,SAAS,CAAC;GAAE,MAAM;GAAQ,MAAM,OAAO,eAAe,WAAW,aAAa;EAAK,CAAC;EACpF,SAAS;CACX;CACA,IAAI,eAAe,QAAQ,OAAO,eAAe,YAAY,CAAC,MAAM,QAAQ,UAAU,GACpF,OAAO,oBAAoB;CAE7B,OAAO;AACT;AAEA,SAAS,UAAU,IAA4B,QAAkC;CAC/E,OAAO;EAAE,SAAS;EAAO;EAAI;CAAO;AACtC;AAEA,SAAS,SACP,IACA,MACA,SACA,MACiB;CACjB,OAAO;EACL,SAAS;EACT;EACA,OAAO,SAAS,KAAA,IAAY;GAAE;GAAM;EAAQ,IAAI;GAAE;GAAM;GAAS;EAAK;CACxE;AACF;AAEA,SAAS,cAAc,QAA+B,UAAiC;CACrF,OAAO,MAAM,GAAG,KAAK,UAAU,QAAQ,EAAE,GAAG;AAC9C"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { K as spawnJournalRecordEvents, Qn as harnessTranscriptArtifact, Tn as FileObserverJournal, W as FileSpawnJournal, i as ROOT_STREAM_FILE, in as FileResultBlobStore, m as legacySupervisorRunsRoot, o as nodeStreamFile, oi as linkAbort, si as runAbortable, x as supervisorRunsRoot, y as safeWorkerFile } from "./supervisor-accounting-Bw4MJk-b.js";
|
|
2
|
+
import { Tt as recordValue } from "./failure-cause-CVB-YE88.js";
|
|
3
3
|
import { n as parseCommittedJsonLines } from "./jsonl-file-DsxVI0E_.js";
|
|
4
|
-
import { h as rootCoordinationOwner, v as FileCoordinationLog } from "./run-cancellation-
|
|
5
|
-
import { a as readFailureRecord, o as readSettleRecord } from "./settle-record-
|
|
6
|
-
import { n as projectPursuit, t as discoverDurableSupervisionRun } from "./supervision-discovery-
|
|
4
|
+
import { h as rootCoordinationOwner, v as FileCoordinationLog } from "./run-cancellation-DYszFJtQ.js";
|
|
5
|
+
import { a as readFailureRecord, o as readSettleRecord } from "./settle-record-WWQasnDq.js";
|
|
6
|
+
import { n as projectPursuit, t as discoverDurableSupervisionRun } from "./supervision-discovery-C9kfBLKy.js";
|
|
7
7
|
import { createRequire } from "node:module";
|
|
8
8
|
import { isRecord } from "@tangle-network/agent-core";
|
|
9
9
|
import { createHash } from "node:crypto";
|
|
@@ -1500,7 +1500,9 @@ async function serveTopWeb(options) {
|
|
|
1500
1500
|
touched.add(root);
|
|
1501
1501
|
schedule();
|
|
1502
1502
|
};
|
|
1503
|
-
for (const root of roots)
|
|
1503
|
+
for (const root of roots) try {
|
|
1504
|
+
watchers.push(watch(root, { recursive: true }, mark(root)).on("error", () => void 0));
|
|
1505
|
+
} catch {}
|
|
1504
1506
|
const reconcile = setInterval(schedule, 500);
|
|
1505
1507
|
const heartbeat = setInterval(() => {
|
|
1506
1508
|
for (const client of clients) client.write(": alive\n\n");
|
|
@@ -1671,4 +1673,4 @@ async function loadRunsRoot(root) {
|
|
|
1671
1673
|
}
|
|
1672
1674
|
export { topAgentMetadata as _, buildSupervisorView as a, numberValue as c, topSnapshot as d, totalSpend as f, readTopAgentInspection as g, readTopAgentHistory as h, aggregateSnapshot as i, parseSpend as l, harnessSessionRows as m, runTopWeb as n, isSpawnEvent as o, createTopAgentStream as p, serveTopWeb as r, loadTopSnapshot as s, TOP_SNAPSHOT_RECONCILE_MS as t, parseTime as u, topAgentWorker as v };
|
|
1673
1675
|
|
|
1674
|
-
//# sourceMappingURL=top-web-
|
|
1676
|
+
//# sourceMappingURL=top-web-B3HOAtrZ.js.map
|