@tangle-network/agent-runtime 0.104.0 → 0.106.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/README.md +176 -42
- package/dist/activation-CRjVfOiy.js +203 -0
- package/dist/activation-CRjVfOiy.js.map +1 -0
- package/dist/activation-DyWB0K6E.d.ts +98 -0
- package/dist/agent.d.ts +216 -234
- package/dist/agent.js +615 -547
- package/dist/agent.js.map +1 -1
- package/dist/analyst-loop-DGdtVENg.js +517 -0
- package/dist/analyst-loop-DGdtVENg.js.map +1 -0
- package/dist/analyst-loop.d.ts +10 -43
- package/dist/analyst-loop.js +2 -11
- package/dist/backends-Dy8NujB4.js +713 -0
- package/dist/backends-Dy8NujB4.js.map +1 -0
- package/dist/candidate-execution/index.d.ts +4 -192
- package/dist/candidate-execution/index.js +5 -66
- package/dist/candidate-execution-DqMbv1rU.js +488 -0
- package/dist/candidate-execution-DqMbv1rU.js.map +1 -0
- package/dist/coder-yhVWbdWc.js +40 -0
- package/dist/coder-yhVWbdWc.js.map +1 -0
- package/dist/conversation-XucG_K3l.js +1265 -0
- package/dist/conversation-XucG_K3l.js.map +1 -0
- package/dist/conversation.d.ts +2 -804
- package/dist/conversation.js +2 -55
- package/dist/environment-provider-CfLUmKmf.js +1168 -0
- package/dist/environment-provider-CfLUmKmf.js.map +1 -0
- package/dist/environment-provider-IUGU3epE.d.ts +964 -0
- package/dist/environment-provider.d.ts +2 -78
- package/dist/environment-provider.js +2 -18
- package/dist/errors-DEAvWQPy.js +111 -0
- package/dist/errors-DEAvWQPy.js.map +1 -0
- package/dist/improvement-adapter-Cr5TBSji.d.ts +166 -0
- package/dist/improvement-cycle-C095kS_g.js +2624 -0
- package/dist/improvement-cycle-C095kS_g.js.map +1 -0
- package/dist/index-BGdxAwfO.d.ts +838 -0
- package/dist/index-C-FYUuFG.d.ts +193 -0
- package/dist/index-CbNM40xG.d.ts +140 -0
- package/dist/index-DruSKs3Z.d.ts +7224 -0
- package/dist/index-Efjb3nrQ.d.ts +671 -0
- package/dist/index.d.ts +14 -1134
- package/dist/index.js +2134 -1972
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +776 -888
- package/dist/intelligence.js +1466 -1410
- package/dist/intelligence.js.map +1 -1
- package/dist/{kb-gate-CwHO0vz6.d.ts → kb-gate-C8z2juK8.d.ts} +33 -31
- package/dist/kb-gate-DpaSwXVx.js +80 -0
- package/dist/kb-gate-DpaSwXVx.js.map +1 -0
- package/dist/knowledge-Ku-mPP4f.js +433 -0
- package/dist/knowledge-Ku-mPP4f.js.map +1 -0
- package/dist/knowledge.d.ts +2 -150
- package/dist/knowledge.js +2 -40
- package/dist/local-harness-Dh8PJ0ot.d.ts +455 -0
- package/dist/loop-runner-bin-BXsFEUcf.d.ts +162 -0
- package/dist/loop-runner-bin-BwjQ1NfH.js +268 -0
- package/dist/loop-runner-bin-BwjQ1NfH.js.map +1 -0
- package/dist/loop-runner-bin.d.ts +2 -17
- package/dist/loop-runner-bin.js +2 -24
- package/dist/loops.d.ts +5 -4164
- package/dist/loops.js +8 -419
- package/dist/mcp/bin.d.ts +1 -1
- package/dist/mcp/bin.js +116 -146
- package/dist/mcp/bin.js.map +1 -1
- package/dist/mcp/index.d.ts +295 -437
- package/dist/mcp/index.js +1242 -1177
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/memory-bin.d.ts +1 -1
- package/dist/mcp/memory-bin.js +37 -16
- package/dist/mcp/memory-bin.js.map +1 -1
- package/dist/memory-server-DL6cE2Ag.js +234 -0
- package/dist/memory-server-DL6cE2Ag.js.map +1 -0
- package/dist/model-resolution-Btd9iIKV.js +98 -0
- package/dist/model-resolution-Btd9iIKV.js.map +1 -0
- package/dist/openai-tools-B68JaOCx.d.ts +24 -0
- package/dist/openai-tools-CKLy1C7M.js +44 -0
- package/dist/openai-tools-CKLy1C7M.js.map +1 -0
- package/dist/otel-export-D34IQW1C.js +843 -0
- package/dist/otel-export-D34IQW1C.js.map +1 -0
- package/dist/platform.d.ts +188 -185
- package/dist/platform.js +185 -218
- package/dist/platform.js.map +1 -1
- package/dist/prepare-B53sPV7M.js +4292 -0
- package/dist/prepare-B53sPV7M.js.map +1 -0
- package/dist/primeintellect/index.d.ts +150 -147
- package/dist/primeintellect/index.js +626 -1004
- package/dist/primeintellect/index.js.map +1 -1
- package/dist/profiles.d.ts +296 -490
- package/dist/profiles.js +722 -749
- package/dist/profiles.js.map +1 -1
- package/dist/protected-model-port-BLPH5VVv.js +722 -0
- package/dist/protected-model-port-BLPH5VVv.js.map +1 -0
- package/dist/protected-model-port-BP6Z4eau.d.ts +283 -0
- package/dist/protected-redaction--F3v1oo8.js +200 -0
- package/dist/protected-redaction--F3v1oo8.js.map +1 -0
- package/dist/redact-D-u-rrcn.js +82 -0
- package/dist/redact-D-u-rrcn.js.map +1 -0
- package/dist/redact-kbIOjfjM.d.ts +452 -0
- package/dist/researcher-CoVqNhfI.js +433 -0
- package/dist/researcher-CoVqNhfI.js.map +1 -0
- package/dist/runtime-BG0BziaP.js +5408 -0
- package/dist/runtime-BG0BziaP.js.map +1 -0
- package/dist/sandbox-events-DeI5xX8P.js +316 -0
- package/dist/sandbox-events-DeI5xX8P.js.map +1 -0
- package/dist/spawn-journal-CwPvKUTa.js +456 -0
- package/dist/spawn-journal-CwPvKUTa.js.map +1 -0
- package/dist/structural-rollout-IXUEplky.js +1445 -0
- package/dist/structural-rollout-IXUEplky.js.map +1 -0
- package/dist/substrate-B0TYNrXn.js +27 -0
- package/dist/substrate-B0TYNrXn.js.map +1 -0
- package/dist/{substrate-Dyiqmd3o.d.ts → substrate-BcnuSHXm.d.ts} +57 -54
- package/dist/supervise-BiRutHS9.js +7321 -0
- package/dist/supervise-BiRutHS9.js.map +1 -0
- package/dist/supervisor-DTKhF-RV.js +3826 -0
- package/dist/supervisor-DTKhF-RV.js.map +1 -0
- package/dist/testing.d.ts +4 -3
- package/dist/testing.js +2478 -2637
- package/dist/testing.js.map +1 -1
- package/dist/tool-server-RcWgLIsL.js +141 -0
- package/dist/tool-server-RcWgLIsL.js.map +1 -0
- package/dist/trace-propagation-CJJC7SVB.js +57 -0
- package/dist/trace-propagation-CJJC7SVB.js.map +1 -0
- package/dist/types-BaIpb0XT.d.ts +492 -0
- package/dist/types-BevOjfTY.d.ts +765 -0
- package/dist/types-C9j4qg6l.d.ts +500 -0
- package/dist/types-Cja5OTGh.d.ts +190 -0
- package/dist/util-MVgdwuIS.js +145 -0
- package/dist/util-MVgdwuIS.js.map +1 -0
- package/dist/workspace-archive-BosQiotA.js +575 -0
- package/dist/workspace-archive-BosQiotA.js.map +1 -0
- package/package.json +43 -55
- package/skills/build-with-agent-runtime/SKILL.md +16 -9
- package/skills/loop-writer/SKILL.md +1 -1
- package/dist/activation-Cm-9MMX1.d.ts +0 -69
- package/dist/analyst-loop.js.map +0 -1
- package/dist/backends-BO4Jqoe2.d.ts +0 -134
- package/dist/candidate-execution/index.js.map +0 -1
- package/dist/chunk-2KGAN2HM.js +0 -1256
- package/dist/chunk-2KGAN2HM.js.map +0 -1
- package/dist/chunk-2QJSNOGK.js +0 -48
- package/dist/chunk-2QJSNOGK.js.map +0 -1
- package/dist/chunk-2UABGGUB.js +0 -474
- package/dist/chunk-2UABGGUB.js.map +0 -1
- package/dist/chunk-2VZYRB55.js +0 -834
- package/dist/chunk-2VZYRB55.js.map +0 -1
- package/dist/chunk-2X65HYMI.js +0 -3526
- package/dist/chunk-2X65HYMI.js.map +0 -1
- package/dist/chunk-3MDZX7YU.js +0 -125
- package/dist/chunk-3MDZX7YU.js.map +0 -1
- package/dist/chunk-3PPVCS75.js +0 -199
- package/dist/chunk-3PPVCS75.js.map +0 -1
- package/dist/chunk-5HNDYWUT.js +0 -6424
- package/dist/chunk-5HNDYWUT.js.map +0 -1
- package/dist/chunk-5IBQAPVB.js +0 -29
- package/dist/chunk-5IBQAPVB.js.map +0 -1
- package/dist/chunk-5QOB7H74.js +0 -387
- package/dist/chunk-5QOB7H74.js.map +0 -1
- package/dist/chunk-ATDFUJYI.js +0 -4728
- package/dist/chunk-ATDFUJYI.js.map +0 -1
- package/dist/chunk-B7K7V22Y.js +0 -699
- package/dist/chunk-B7K7V22Y.js.map +0 -1
- package/dist/chunk-DPEUKJRO.js +0 -27
- package/dist/chunk-DPEUKJRO.js.map +0 -1
- package/dist/chunk-FD2MBMOH.js +0 -494
- package/dist/chunk-FD2MBMOH.js.map +0 -1
- package/dist/chunk-FJI3EXU3.js +0 -2402
- package/dist/chunk-FJI3EXU3.js.map +0 -1
- package/dist/chunk-HAO4CXHP.js +0 -200
- package/dist/chunk-HAO4CXHP.js.map +0 -1
- package/dist/chunk-ISPWRSEC.js +0 -408
- package/dist/chunk-ISPWRSEC.js.map +0 -1
- package/dist/chunk-KRBFHMV6.js +0 -1228
- package/dist/chunk-KRBFHMV6.js.map +0 -1
- package/dist/chunk-L5DST3QC.js +0 -351
- package/dist/chunk-L5DST3QC.js.map +0 -1
- package/dist/chunk-M22PL4GH.js +0 -171
- package/dist/chunk-M22PL4GH.js.map +0 -1
- package/dist/chunk-NURIQBJQ.js +0 -72
- package/dist/chunk-NURIQBJQ.js.map +0 -1
- package/dist/chunk-PZZKQVQV.js +0 -52
- package/dist/chunk-PZZKQVQV.js.map +0 -1
- package/dist/chunk-Q2JSAVQ3.js +0 -671
- package/dist/chunk-Q2JSAVQ3.js.map +0 -1
- package/dist/chunk-SBTWKPVR.js +0 -5576
- package/dist/chunk-SBTWKPVR.js.map +0 -1
- package/dist/chunk-SGKPNBXE.js +0 -60
- package/dist/chunk-SGKPNBXE.js.map +0 -1
- package/dist/chunk-SNSMRT6H.js +0 -680
- package/dist/chunk-SNSMRT6H.js.map +0 -1
- package/dist/chunk-STJEHM5F.js +0 -1338
- package/dist/chunk-STJEHM5F.js.map +0 -1
- package/dist/chunk-UPWGXKXB.js +0 -254
- package/dist/chunk-UPWGXKXB.js.map +0 -1
- package/dist/chunk-YEJR7IXO.js +0 -68
- package/dist/chunk-YEJR7IXO.js.map +0 -1
- package/dist/chunk-ZXICDSAK.js +0 -907
- package/dist/chunk-ZXICDSAK.js.map +0 -1
- package/dist/completion-gate-Bv47cOnn.d.ts +0 -256
- package/dist/conversation.js.map +0 -1
- package/dist/coordination-CxtzMxSM.d.ts +0 -2570
- package/dist/environment-provider.js.map +0 -1
- package/dist/improve--2A0gK1-.d.ts +0 -440
- package/dist/improvement-adapter-HAZz-7vK.d.ts +0 -203
- package/dist/knowledge.js.map +0 -1
- package/dist/local-harness-CtK9dSny.d.ts +0 -175
- package/dist/loop-runner-bin-DUOGtvOl.d.ts +0 -207
- package/dist/loop-runner-bin.js.map +0 -1
- package/dist/loops.js.map +0 -1
- package/dist/openai-tools-fnj6SRVg.d.ts +0 -46
- package/dist/protected-model-port-DzkUY3HQ.d.ts +0 -271
- package/dist/sanitize-DEbPNtyI.d.ts +0 -328
- package/dist/structural-rollout-C4mabf87.d.ts +0 -446
- package/dist/supervise-7q9F5brx.d.ts +0 -379
- package/dist/types-BCoemcXU.d.ts +0 -802
- package/dist/types-BwoZWq-i.d.ts +0 -510
- package/dist/types-Cbp72qyu.d.ts +0 -491
- package/dist/types-CmYCMbFT.d.ts +0 -203
- package/dist/types-CvNwMzQt.d.ts +0 -957
- package/dist/worktree-fanout-WsOzt8qu.d.ts +0 -999
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-archive-BosQiotA.js","names":["canonicalCandidateDigest","canonicalCandidateDigest","fsConstants"],"sources":["../src/candidate-execution/bundle.ts","../src/candidate-execution/workspace-archive.ts"],"sourcesContent":["import type { AgentCandidateBundle } from '@tangle-network/agent-interface'\nimport { agentCandidateBundleSchema } from '@tangle-network/agent-interface'\n\nimport { canonicalCandidateDigest, immutableCandidateValue, omitTopLevelDigest } from './digest'\n\n/** Exact candidate wire shape before the runtime computes its canonical digest. */\nexport type AgentCandidateBundleInput = Omit<AgentCandidateBundle, 'digest'>\n\n/** Validate and content-address a candidate bundle before it crosses an approval boundary. */\nexport function sealAgentCandidateBundle(input: AgentCandidateBundleInput): AgentCandidateBundle {\n const digest = canonicalCandidateDigest(input)\n const parsed = agentCandidateBundleSchema.parse({ ...input, digest })\n const parsedDigest = canonicalCandidateDigest(omitTopLevelDigest(parsed))\n if (parsedDigest !== digest) {\n throw new Error('candidate bundle changed while validating its canonical wire shape')\n }\n return immutableCandidateValue(parsed)\n}\n","import { randomUUID } from 'node:crypto'\nimport { constants as fsConstants } from 'node:fs'\nimport {\n lstat,\n mkdir,\n mkdtemp,\n open,\n readdir,\n readFile,\n realpath,\n rename,\n rm,\n writeFile,\n} from 'node:fs/promises'\nimport { tmpdir } from 'node:os'\nimport { dirname, isAbsolute, join, resolve, sep, win32 } from 'node:path'\nimport { isAnyArrayBuffer, isSharedArrayBuffer } from 'node:util/types'\n\nimport type {\n AgentCandidateCapturedArtifact,\n AgentCandidateWorkspaceSnapshotEvidence,\n} from '@tangle-network/agent-interface'\nimport { type Entry, extract, type Pack, pack } from 'tar-stream'\n\nimport {\n candidateWorkspaceManifest,\n captureMaterializedWorkspace,\n verifyBytes,\n verifyMaterializedWorkspace,\n} from './artifacts'\nimport {\n canonicalCandidateBytes,\n canonicalCandidateDigest,\n deepFreezeCandidate,\n embeddedCandidateArtifact,\n sha256Bytes,\n} from './digest'\nimport {\n assertNoGitIndirection,\n readCandidateGitTreeFiles,\n runCandidateGit,\n} from './git-materialize'\nimport { persistCandidateOutputArtifact } from './output-artifacts'\nimport type {\n AgentCandidateExecutorWorkspaceFile,\n AgentCandidateOutputArtifactPort,\n AgentCandidateWorkspacePort,\n} from './types'\n\nconst archiveKind = 'agent-candidate-workspace-archive' as const\nconst workspaceEntryPrefix = 'workspace/'\nconst repositoryMetadataEntry = 'metadata/repository.json'\nconst repositoryBundleEntry = 'metadata/repository.bundle'\nconst fixedTarTime = new Date(0)\n\nexport interface AgentCandidateWorkspaceArchiveLimits {\n maxArchiveBytes: number\n maxEmbeddedArtifactBytes: number\n maxFiles: number\n maxFileBytes: number\n maxTotalFileBytes: number\n maxPathBytes: number\n maxRepositoryBundleBytes: number\n}\n\nconst defaultLimits: AgentCandidateWorkspaceArchiveLimits = Object.freeze({\n maxArchiveBytes: 512 * 1024 * 1024,\n maxEmbeddedArtifactBytes: 1024 * 1024,\n maxFiles: 50_000,\n maxFileBytes: 128 * 1024 * 1024,\n maxTotalFileBytes: 256 * 1024 * 1024,\n maxPathBytes: 4_096,\n maxRepositoryBundleBytes: 128 * 1024 * 1024,\n})\n\ninterface WorkspaceArchiveRepository {\n headCommit: string\n headTree: string\n bundle: {\n sha256: `sha256:${string}`\n byteLength: number\n bytes: Uint8Array\n }\n}\n\ninterface WorkspaceArchiveRepositoryMetadata {\n kind: typeof archiveKind\n headCommit: string\n headTree: string\n bundle: {\n sha256: `sha256:${string}`\n byteLength: number\n }\n}\n\ninterface DecodedWorkspaceArchive {\n files: Array<{ path: string; mode: number; bytes: Uint8Array }>\n repository?: WorkspaceArchiveRepository\n}\n\nexport interface CaptureAgentCandidateWorkspaceOptions {\n /** Include Git HEAD so task preparation can prove its exact commit and tree. */\n includeRepository?: boolean\n limits?: Partial<AgentCandidateWorkspaceArchiveLimits>\n /** Use the evaluator-owned artifact store when manifest or archive bytes should not be embedded. */\n artifactPersistence?: {\n executionId: string\n outputArtifacts: AgentCandidateOutputArtifactPort\n signal?: AbortSignal\n }\n}\n\nexport interface CreateAgentCandidateWorkspacePortOptions {\n limits?: Partial<AgentCandidateWorkspaceArchiveLimits>\n}\n\nexport interface CapturedAgentCandidateWorkspace {\n readonly snapshot: AgentCandidateWorkspaceSnapshotEvidence\n /** Caller-owned bytes accepted by createAgentCandidateWorkspacePort. */\n readonly archive: Uint8Array\n}\n\n/** Capture one exact regular-file workspace for immutable candidate execution. */\nexport async function captureAgentCandidateWorkspace(\n rootInput: string,\n options: CaptureAgentCandidateWorkspaceOptions = {},\n): Promise<CapturedAgentCandidateWorkspace> {\n const root = resolve(rootInput)\n const limits = workspaceLimits(options.limits)\n const captured = options.includeRepository\n ? await captureRepository(root, limits)\n : await captureMaterializedWorkspace(root, {\n limits: {\n maxFiles: limits.maxFiles,\n maxFileBytes: limits.maxFileBytes,\n maxTotalFileBytes: limits.maxTotalFileBytes,\n },\n })\n assertWorkspaceFilesWithinLimits(captured.files, limits)\n const repository = 'repository' in captured ? captured.repository : undefined\n return captureWorkspaceFiles(captured.files, repository, limits, options.artifactPersistence)\n}\n\n/** Capture detached files returned by a remote executor into the standard archive. */\nexport async function captureAgentCandidateWorkspaceFiles(\n input: readonly AgentCandidateExecutorWorkspaceFile[],\n options: Omit<CaptureAgentCandidateWorkspaceOptions, 'includeRepository'> = {},\n): Promise<CapturedAgentCandidateWorkspace> {\n const limits = workspaceLimits(options.limits)\n return captureWorkspaceFiles(\n normalizeWorkspaceFiles(input, limits),\n undefined,\n limits,\n options.artifactPersistence,\n )\n}\n\nasync function captureWorkspaceFiles(\n files: readonly AgentCandidateExecutorWorkspaceFile[],\n repository: WorkspaceArchiveRepository | undefined,\n limits: AgentCandidateWorkspaceArchiveLimits,\n artifactPersistence: CaptureAgentCandidateWorkspaceOptions['artifactPersistence'],\n): Promise<CapturedAgentCandidateWorkspace> {\n const material = candidateWorkspaceManifest(files)\n const manifest = canonicalCandidateBytes(material)\n const archive = await encodeWorkspaceArchive(files, repository, limits.maxArchiveBytes)\n if (\n !artifactPersistence &&\n (manifest.byteLength > limits.maxEmbeddedArtifactBytes ||\n archive.byteLength > limits.maxEmbeddedArtifactBytes)\n ) {\n throw new Error(\n 'candidate workspace artifacts exceed maxEmbeddedArtifactBytes; artifactPersistence is required',\n )\n }\n const manifestArtifact = await captureWorkspaceArtifact('manifest', manifest, artifactPersistence)\n const archiveArtifact = await captureWorkspaceArtifact('archive', archive, artifactPersistence)\n const snapshot = deepFreezeCandidate({\n kind: 'agent-candidate-workspace-snapshot',\n digest: canonicalCandidateDigest(material),\n material,\n manifest: manifestArtifact,\n archive: archiveArtifact,\n } satisfies AgentCandidateWorkspaceSnapshotEvidence)\n return Object.freeze({ snapshot, archive })\n}\n\nasync function captureWorkspaceArtifact(\n kind: 'manifest' | 'archive',\n bytes: Uint8Array,\n persistence: CaptureAgentCandidateWorkspaceOptions['artifactPersistence'],\n): Promise<AgentCandidateCapturedArtifact> {\n if (!persistence) return embeddedCandidateArtifact(bytes)\n if (!persistence.executionId.trim()) {\n throw new Error('candidate workspace artifact persistence requires an executionId')\n }\n return persistCandidateOutputArtifact(persistence.outputArtifacts, {\n executionId: persistence.executionId,\n purpose: kind === 'manifest' ? 'candidate-workspace-manifest' : 'candidate-workspace-archive',\n bytes,\n ...(persistence.signal ? { signal: persistence.signal } : {}),\n })\n}\n\n/** Create the standard bounded materializer for candidate execution ports. */\nexport function createAgentCandidateWorkspacePort(\n options: CreateAgentCandidateWorkspacePortOptions = {},\n): AgentCandidateWorkspacePort {\n const limits = workspaceLimits(options.limits)\n const port: AgentCandidateWorkspacePort = {\n materialize: async ({ role, snapshot, archive, destination }) => {\n await materializeAgentCandidateWorkspace({\n role,\n snapshot,\n archive,\n destination,\n limits,\n })\n },\n }\n return Object.freeze(port)\n}\n\nasync function materializeAgentCandidateWorkspace(input: {\n role: 'task' | 'candidate' | 'knowledge' | 'memory'\n snapshot: AgentCandidateWorkspaceSnapshotEvidence\n archive: Uint8Array\n destination: string\n limits: AgentCandidateWorkspaceArchiveLimits\n}): Promise<void> {\n verifyBytes(\n input.archive,\n input.snapshot.archive.sha256,\n input.snapshot.archive.byteLength,\n 'candidate workspace archive',\n )\n const decoded = await parseWorkspaceArchive(input.archive, input.limits)\n if (decoded.repository && input.role !== 'task') {\n throw new Error('only task workspaces may carry a Git repository')\n }\n assertArchiveMatchesSnapshot(decoded.files, input.snapshot)\n const destination = resolve(input.destination)\n await prepareEmptyDestination(destination)\n const staging = await mkdtemp(`${destination}.materializing-`)\n try {\n await writeWorkspaceFiles(staging, decoded.files)\n if (decoded.repository) {\n await materializeRepository(decoded.repository, staging)\n }\n await verifyMaterializedWorkspace(staging, input.snapshot.material, {\n ignoredProtectedRootEntries: decoded.repository ? ['.git'] : [],\n })\n await rename(staging, destination)\n } catch (error) {\n await rm(staging, { recursive: true, force: true })\n await rm(destination, { recursive: true, force: true })\n throw error\n }\n}\n\nasync function captureRepository(\n root: string,\n limits: AgentCandidateWorkspaceArchiveLimits,\n): Promise<{\n files: Array<{ path: string; mode: number; bytes: Uint8Array }>\n repository: WorkspaceArchiveRepository\n}> {\n const stats = await lstat(root)\n if (!stats.isDirectory() || stats.isSymbolicLink() || (await realpath(root)) !== root) {\n throw new Error('candidate repository root must be a real directory')\n }\n const topLevel = (await runCandidateGit(root, ['rev-parse', '--show-toplevel'])).stdout\n .toString('utf8')\n .trim()\n if (resolve(topLevel) !== root) {\n throw new Error('candidate repository capture must start at the Git worktree root')\n }\n const gitDir = resolve(\n (await runCandidateGit(root, ['rev-parse', '--absolute-git-dir'])).stdout\n .toString('utf8')\n .trim(),\n )\n if ((await realpath(gitDir)) !== gitDir || gitDir.includes(':')) {\n throw new Error('candidate repository Git object store has an unsupported path')\n }\n await assertNoGitIndirection(root, gitDir, 'candidate repository')\n const headCommit = (await runCandidateGit(root, ['rev-parse', 'HEAD'])).stdout\n .toString('utf8')\n .trim()\n const headTree = (await runCandidateGit(root, ['rev-parse', 'HEAD^{tree}'])).stdout\n .toString('utf8')\n .trim()\n assertGitObjectId(headCommit, 'HEAD')\n assertGitObjectId(headTree, 'HEAD tree')\n if (headCommit.length !== headTree.length) {\n throw new Error('candidate repository HEAD and tree use different object formats')\n }\n const files = await readCandidateGitTreeFiles(root, headTree, {}, limits)\n assertWorkspaceFilesWithinLimits(files, limits)\n const reachableBytesText = (\n await runCandidateGit(root, ['rev-list', '--disk-usage', '--objects', 'HEAD'])\n ).stdout\n .toString('utf8')\n .trim()\n const reachableBytes = Number(reachableBytesText)\n if (!Number.isSafeInteger(reachableBytes) || reachableBytes < 0) {\n throw new Error('candidate repository reachable size is invalid')\n }\n if (reachableBytes > limits.maxRepositoryBundleBytes) {\n throw new Error('candidate repository exceeds maxRepositoryBundleBytes')\n }\n const temporary = await mkdtemp(join(tmpdir(), 'agent-candidate-workspace-bundle-'))\n const bundlePath = join(temporary, `${randomUUID()}.bundle`)\n try {\n await runCandidateGit(root, ['bundle', 'create', bundlePath, 'HEAD'])\n const bundle = Uint8Array.from(await readFile(bundlePath))\n if (bundle.byteLength > limits.maxRepositoryBundleBytes) {\n throw new Error('candidate repository bundle exceeds maxRepositoryBundleBytes')\n }\n return {\n files,\n repository: {\n headCommit,\n headTree,\n bundle: {\n sha256: sha256Bytes(bundle),\n byteLength: bundle.byteLength,\n bytes: bundle,\n },\n },\n }\n } finally {\n await rm(temporary, { recursive: true, force: true })\n }\n}\n\nasync function encodeWorkspaceArchive(\n files: ReadonlyArray<{ path: string; mode: number; bytes: Uint8Array }>,\n repository: WorkspaceArchiveRepository | undefined,\n maxArchiveBytes: number,\n): Promise<Uint8Array> {\n const archive = pack()\n const output = collectStream(archive, maxArchiveBytes, 'candidate workspace archive')\n try {\n await writeWorkspaceArchiveEntries(archive, files, repository)\n archive.finalize()\n return await output\n } catch (error) {\n archive.destroy(error instanceof Error ? error : new Error(String(error)))\n await output.catch(() => undefined)\n throw error\n }\n}\n\nasync function verifyCanonicalWorkspaceArchive(\n files: ReadonlyArray<{ path: string; mode: number; bytes: Uint8Array }>,\n repository: WorkspaceArchiveRepository | undefined,\n expected: Uint8Array,\n maxArchiveBytes: number,\n): Promise<void> {\n const archive = pack()\n const comparison = streamEqualsBytes(\n archive,\n expected,\n maxArchiveBytes,\n 'candidate workspace archive',\n )\n try {\n await writeWorkspaceArchiveEntries(archive, files, repository)\n archive.finalize()\n if (!(await comparison)) throw new Error('candidate workspace tar is not canonical')\n } catch (error) {\n archive.destroy(error instanceof Error ? error : new Error(String(error)))\n await comparison.catch(() => undefined)\n throw error\n }\n}\n\nasync function writeWorkspaceArchiveEntries(\n archive: Pack,\n files: ReadonlyArray<{ path: string; mode: number; bytes: Uint8Array }>,\n repository: WorkspaceArchiveRepository | undefined,\n): Promise<void> {\n for (const file of files) {\n await writeTarEntry(archive, `${workspaceEntryPrefix}${file.path}`, file.mode, file.bytes)\n }\n if (!repository) return\n const metadata = canonicalCandidateBytes({\n kind: archiveKind,\n headCommit: repository.headCommit,\n headTree: repository.headTree,\n bundle: {\n sha256: repository.bundle.sha256,\n byteLength: repository.bundle.byteLength,\n },\n } satisfies WorkspaceArchiveRepositoryMetadata)\n await writeTarEntry(archive, repositoryMetadataEntry, 0o600, metadata)\n await writeTarEntry(archive, repositoryBundleEntry, 0o600, repository.bundle.bytes)\n}\n\nasync function parseWorkspaceArchive(\n bytes: Uint8Array,\n limits: AgentCandidateWorkspaceArchiveLimits,\n): Promise<DecodedWorkspaceArchive> {\n if (bytes.byteLength > limits.maxArchiveBytes) {\n throw new Error('candidate workspace archive exceeds maxArchiveBytes')\n }\n const parser = extract()\n const files: DecodedWorkspaceArchive['files'] = []\n const observedEntryNames = new Set<string>()\n const observedPaths = new Set<string>()\n let totalBytes = 0\n let retainedEntryBytes = 0\n let previousPath: string | undefined\n let repositoryMetadata: WorkspaceArchiveRepositoryMetadata | undefined\n let repositoryBundle: Uint8Array | undefined\n const decoded = (async () => {\n for await (const entry of parser) {\n const name = entry.header.name\n if (\n entry.header.type !== 'file' ||\n typeof name !== 'string' ||\n observedEntryNames.has(name)\n ) {\n throw new Error('candidate workspace tar contains an invalid entry')\n }\n observedEntryNames.add(name)\n if (name.startsWith(workspaceEntryPrefix)) {\n if (files.length >= limits.maxFiles) {\n throw new Error('candidate workspace archive has an invalid file count')\n }\n const path = safeArchivePath(name.slice(workspaceEntryPrefix.length), limits.maxPathBytes)\n if (!isWorkspaceFileMode(entry.header.mode)) {\n throw new Error(`candidate workspace archive has an unsupported mode: ${path}`)\n }\n assertRetainedArchiveSize(bytes.byteLength, retainedEntryBytes, entry.header.size, limits)\n const fileBytes = await readTarEntry(entry, limits.maxFileBytes, `workspace file ${path}`)\n retainedEntryBytes += fileBytes.byteLength\n assertWorkspacePathOrder(\n path,\n previousPath,\n observedPaths,\n 'candidate workspace archive paths must be unique and sorted',\n )\n previousPath = path\n if (fileBytes.byteLength > limits.maxTotalFileBytes - totalBytes) {\n throw new Error('candidate workspace archive exceeds maxTotalFileBytes')\n }\n totalBytes += fileBytes.byteLength\n files.push({ path, mode: entry.header.mode, bytes: fileBytes })\n } else if (name === repositoryMetadataEntry) {\n if (entry.header.mode !== 0o600 || repositoryMetadata) {\n throw new Error('candidate workspace archive repository metadata is invalid')\n }\n assertRetainedArchiveSize(bytes.byteLength, retainedEntryBytes, entry.header.size, limits)\n const metadataBytes = await readTarEntry(\n entry,\n limits.maxPathBytes,\n 'candidate repository metadata',\n )\n retainedEntryBytes += metadataBytes.byteLength\n repositoryMetadata = parseRepositoryMetadata(metadataBytes, limits.maxRepositoryBundleBytes)\n } else if (name === repositoryBundleEntry) {\n if (entry.header.mode !== 0o600 || repositoryBundle) {\n throw new Error('candidate workspace archive repository bundle is invalid')\n }\n assertRetainedArchiveSize(bytes.byteLength, retainedEntryBytes, entry.header.size, limits)\n repositoryBundle = await readTarEntry(\n entry,\n limits.maxRepositoryBundleBytes,\n 'candidate Git bundle',\n )\n retainedEntryBytes += repositoryBundle.byteLength\n } else {\n throw new Error(`candidate workspace tar contains an unsupported entry: ${name}`)\n }\n }\n if (Boolean(repositoryMetadata) !== Boolean(repositoryBundle)) {\n throw new Error('candidate workspace archive repository evidence is incomplete')\n }\n const repository =\n repositoryMetadata && repositoryBundle\n ? repositoryFromTar(repositoryMetadata, repositoryBundle)\n : undefined\n return { files, ...(repository ? { repository } : {}) }\n })()\n parser.end(Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength))\n const result = await decoded\n await verifyCanonicalWorkspaceArchive(\n result.files,\n result.repository,\n bytes,\n limits.maxArchiveBytes,\n )\n return result\n}\n\nfunction assertRetainedArchiveSize(\n archiveBytes: number,\n retainedEntryBytes: number,\n entryBytes: number | undefined,\n limits: AgentCandidateWorkspaceArchiveLimits,\n): void {\n if (\n !Number.isSafeInteger(entryBytes) ||\n entryBytes === undefined ||\n entryBytes < 0 ||\n entryBytes > limits.maxArchiveBytes - archiveBytes - retainedEntryBytes\n ) {\n throw new Error('candidate workspace archive exceeds maxArchiveBytes while decoding')\n }\n}\n\nfunction parseRepositoryMetadata(\n bytes: Uint8Array,\n maxBundleBytes: number,\n): WorkspaceArchiveRepositoryMetadata {\n let value: unknown\n try {\n value = JSON.parse(new TextDecoder('utf-8', { fatal: true }).decode(bytes))\n } catch (error) {\n throw new Error('candidate workspace archive repository metadata is invalid', { cause: error })\n }\n if (\n !isRecord(value) ||\n Object.keys(value).sort().join(',') !== 'bundle,headCommit,headTree,kind' ||\n value.kind !== archiveKind ||\n typeof value.headCommit !== 'string' ||\n typeof value.headTree !== 'string' ||\n !isRecord(value.bundle) ||\n Object.keys(value.bundle).sort().join(',') !== 'byteLength,sha256' ||\n typeof value.bundle.sha256 !== 'string' ||\n !/^sha256:[a-f0-9]{64}$/.test(value.bundle.sha256) ||\n !Number.isSafeInteger(value.bundle.byteLength) ||\n (value.bundle.byteLength as number) <= 0 ||\n (value.bundle.byteLength as number) > maxBundleBytes\n ) {\n throw new Error('candidate workspace archive repository is invalid')\n }\n if (!Buffer.from(canonicalCandidateBytes(value)).equals(Buffer.from(bytes))) {\n throw new Error('candidate workspace archive repository metadata is not canonical')\n }\n assertGitObjectId(value.headCommit, 'repository HEAD')\n assertGitObjectId(value.headTree, 'repository HEAD tree')\n if (value.headCommit.length !== value.headTree.length) {\n throw new Error('candidate repository HEAD and tree use different object formats')\n }\n return {\n kind: archiveKind,\n headCommit: value.headCommit,\n headTree: value.headTree,\n bundle: {\n sha256: value.bundle.sha256 as `sha256:${string}`,\n byteLength: value.bundle.byteLength as number,\n },\n }\n}\n\nfunction repositoryFromTar(\n metadata: WorkspaceArchiveRepositoryMetadata,\n bundle: Uint8Array,\n): WorkspaceArchiveRepository {\n verifyBytes(bundle, metadata.bundle.sha256, metadata.bundle.byteLength, 'candidate Git bundle')\n return {\n headCommit: metadata.headCommit,\n headTree: metadata.headTree,\n bundle: { ...metadata.bundle, bytes: bundle },\n }\n}\n\nasync function writeTarEntry(\n archive: Pack,\n name: string,\n mode: number,\n bytes: Uint8Array,\n): Promise<void> {\n await new Promise<void>((resolveEntry, rejectEntry) => {\n archive.entry(\n {\n name,\n mode,\n uid: 0,\n gid: 0,\n size: bytes.byteLength,\n mtime: fixedTarTime,\n type: 'file',\n uname: '',\n gname: '',\n },\n Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength),\n (error) => (error ? rejectEntry(error) : resolveEntry()),\n )\n })\n}\n\nasync function readTarEntry(entry: Entry, maxBytes: number, label: string): Promise<Uint8Array> {\n const size = entry.header.size\n if (!Number.isSafeInteger(size) || size === undefined || size < 0 || size > maxBytes) {\n throw new Error(`${label} has an invalid tar size`)\n }\n const bytes = await collectStream(entry, maxBytes, label)\n if (bytes.byteLength !== size) throw new Error(`${label} differs from its tar size`)\n return bytes\n}\n\nasync function collectStream(\n stream: AsyncIterable<Uint8Array>,\n maxBytes: number,\n label: string,\n): Promise<Uint8Array> {\n const chunks: Buffer[] = []\n let totalBytes = 0\n for await (const chunk of stream) {\n if (chunk.byteLength > maxBytes - totalBytes) {\n const error = new Error(`${label} exceeds its size limit`)\n if ('destroy' in stream && typeof stream.destroy === 'function') stream.destroy(error)\n throw error\n }\n const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk)\n chunks.push(bytes)\n totalBytes += bytes.byteLength\n }\n return Buffer.concat(chunks, totalBytes)\n}\n\nasync function streamEqualsBytes(\n stream: AsyncIterable<Uint8Array>,\n expected: Uint8Array,\n maxBytes: number,\n label: string,\n): Promise<boolean> {\n const expectedBuffer = Buffer.from(expected.buffer, expected.byteOffset, expected.byteLength)\n let equal = true\n let offset = 0\n for await (const chunk of stream) {\n if (chunk.byteLength > maxBytes - offset) {\n const error = new Error(`${label} exceeds its size limit`)\n if ('destroy' in stream && typeof stream.destroy === 'function') stream.destroy(error)\n throw error\n }\n const observed = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength)\n if (\n offset + observed.byteLength > expectedBuffer.byteLength ||\n !observed.equals(expectedBuffer.subarray(offset, offset + observed.byteLength))\n ) {\n equal = false\n }\n offset += observed.byteLength\n }\n return equal && offset === expectedBuffer.byteLength\n}\n\nasync function prepareEmptyDestination(destination: string): Promise<void> {\n await mkdir(destination, { recursive: true, mode: 0o700 })\n const stats = await lstat(destination)\n if (\n !stats.isDirectory() ||\n stats.isSymbolicLink() ||\n (await realpath(destination)) !== destination\n ) {\n throw new Error('candidate workspace destination must be a real directory')\n }\n if ((await readdir(destination)).length > 0) {\n throw new Error('candidate workspace destination must be empty')\n }\n}\n\nasync function writeWorkspaceFiles(\n destination: string,\n files: ReadonlyArray<{ path: string; mode: number; bytes: Uint8Array }>,\n): Promise<void> {\n for (const file of files) {\n const path = workspacePath(destination, file.path)\n await mkdir(dirname(path), { recursive: true, mode: 0o700 })\n const descriptor = await open(\n path,\n fsConstants.O_WRONLY |\n fsConstants.O_CREAT |\n fsConstants.O_EXCL |\n (typeof fsConstants.O_NOFOLLOW === 'number' ? fsConstants.O_NOFOLLOW : 0),\n 0o600,\n )\n try {\n await descriptor.writeFile(file.bytes)\n const stats = await descriptor.stat()\n if (!stats.isFile() || stats.nlink !== 1) {\n throw new Error(`candidate workspace file identity changed while writing: ${file.path}`)\n }\n await descriptor.chmod(file.mode)\n } finally {\n await descriptor.close()\n }\n }\n}\n\nasync function materializeRepository(\n repository: WorkspaceArchiveRepository,\n destination: string,\n): Promise<void> {\n const temporary = await mkdtemp(join(tmpdir(), 'agent-candidate-workspace-bundle-'))\n const bundlePath = join(temporary, `${randomUUID()}.bundle`)\n try {\n await writeFile(bundlePath, repository.bundle.bytes, { flag: 'wx', mode: 0o600 })\n await runCandidateGit(destination, [\n 'init',\n '--quiet',\n '--initial-branch=candidate',\n `--object-format=${repository.headCommit.length === 64 ? 'sha256' : 'sha1'}`,\n ])\n await runCandidateGit(destination, ['bundle', 'verify', bundlePath])\n await runCandidateGit(destination, ['bundle', 'unbundle', bundlePath])\n const objectType = (\n await runCandidateGit(destination, ['cat-file', '-t', repository.headCommit])\n ).stdout\n .toString('utf8')\n .trim()\n if (objectType !== 'commit') throw new Error('candidate repository HEAD is not a commit')\n const observedTree = (\n await runCandidateGit(destination, ['rev-parse', `${repository.headCommit}^{tree}`])\n ).stdout\n .toString('utf8')\n .trim()\n if (observedTree !== repository.headTree) {\n throw new Error('candidate repository bundle HEAD tree changed')\n }\n await runCandidateGit(destination, ['update-ref', '--no-deref', 'HEAD', repository.headCommit])\n await runCandidateGit(destination, ['read-tree', repository.headTree])\n const status = (\n await runCandidateGit(destination, ['status', '--porcelain=v1', '--untracked-files=all'])\n ).stdout\n .toString('utf8')\n .trim()\n if (status) throw new Error('candidate repository files do not exactly match HEAD')\n } finally {\n await rm(temporary, { recursive: true, force: true })\n }\n}\n\nfunction assertArchiveMatchesSnapshot(\n files: ReadonlyArray<{ path: string; mode: number; bytes: Uint8Array }>,\n snapshot: AgentCandidateWorkspaceSnapshotEvidence,\n): void {\n const material = candidateWorkspaceManifest(files)\n const materialBytes = canonicalCandidateBytes(material)\n verifyBytes(\n materialBytes,\n snapshot.manifest.sha256,\n snapshot.manifest.byteLength,\n 'candidate workspace manifest',\n )\n if (\n canonicalCandidateDigest(material) !== snapshot.digest ||\n !Buffer.from(materialBytes).equals(Buffer.from(canonicalCandidateBytes(snapshot.material)))\n ) {\n throw new Error('candidate workspace archive does not match its snapshot manifest')\n }\n}\n\nfunction assertWorkspaceFilesWithinLimits(\n files: ReadonlyArray<{ path: string; mode: number; bytes: Uint8Array }>,\n limits: AgentCandidateWorkspaceArchiveLimits,\n): void {\n if (files.length > limits.maxFiles) {\n throw new Error('candidate workspace exceeds maxFiles')\n }\n let totalBytes = 0\n let previousPath: string | undefined\n const observedPaths = new Set<string>()\n for (const file of files) {\n const path = safeArchivePath(file.path, limits.maxPathBytes)\n assertWorkspacePathOrder(\n path,\n previousPath,\n observedPaths,\n 'candidate workspace paths must be unique and sorted',\n )\n previousPath = path\n if (!isWorkspaceFileMode(file.mode)) {\n throw new Error(`candidate workspace file has unsupported mode: ${path}`)\n }\n if (file.bytes.byteLength > limits.maxFileBytes) {\n throw new Error(`candidate workspace file exceeds maxFileBytes: ${path}`)\n }\n totalBytes += file.bytes.byteLength\n if (totalBytes > limits.maxTotalFileBytes) {\n throw new Error('candidate workspace exceeds maxTotalFileBytes')\n }\n }\n}\n\nfunction normalizeWorkspaceFiles(\n input: readonly AgentCandidateExecutorWorkspaceFile[],\n limits: AgentCandidateWorkspaceArchiveLimits,\n): AgentCandidateExecutorWorkspaceFile[] {\n if (!Array.isArray(input)) {\n throw new Error('candidate workspace files must be an array')\n }\n const fileCount = input.length\n if (fileCount > limits.maxFiles) {\n throw new Error('candidate workspace exceeds maxFiles')\n }\n let totalBytes = 0\n const files: AgentCandidateExecutorWorkspaceFile[] = []\n for (let index = 0; index < fileCount; index++) {\n const inputFile = input[index]\n if (!isRecord(inputFile) || Object.keys(inputFile).sort().join(',') !== 'bytes,mode,path') {\n throw new Error(`candidate workspace file ${index} is invalid`)\n }\n const descriptors = Object.getOwnPropertyDescriptors(inputFile)\n if (\n !('value' in (descriptors.path ?? {})) ||\n !('value' in (descriptors.mode ?? {})) ||\n !('value' in (descriptors.bytes ?? {}))\n ) {\n throw new Error(`candidate workspace file ${index} must use fixed values`)\n }\n const path = safeArchivePath(descriptors.path?.value, limits.maxPathBytes)\n const mode = descriptors.mode?.value\n const inputBytes = descriptors.bytes?.value\n if (!isWorkspaceFileMode(mode)) {\n throw new Error(`candidate workspace file has unsupported mode: ${path}`)\n }\n const view = inspectWorkspaceBytes(inputBytes, path)\n if (view.byteLength > limits.maxFileBytes) {\n throw new Error(`candidate workspace file exceeds maxFileBytes: ${path}`)\n }\n if (view.byteLength > limits.maxTotalFileBytes - totalBytes) {\n throw new Error('candidate workspace exceeds maxTotalFileBytes')\n }\n if (view.byteLength > Math.max(0, limits.maxArchiveBytes - 1024)) {\n throw new Error('candidate workspace archive exceeds maxArchiveBytes')\n }\n totalBytes += view.byteLength\n files.push({ path, mode, bytes: detachWorkspaceBytes(view) })\n }\n files.sort((left, right) => (left.path < right.path ? -1 : left.path > right.path ? 1 : 0))\n assertWorkspaceFilesWithinLimits(files, limits)\n return files\n}\n\nfunction isWorkspaceFileMode(value: unknown): value is number {\n return Number.isSafeInteger(value) && (value as number) >= 0 && (value as number) <= 0o777\n}\n\nfunction workspaceLimits(\n overrides: Partial<AgentCandidateWorkspaceArchiveLimits> | undefined,\n): AgentCandidateWorkspaceArchiveLimits {\n const limits = { ...defaultLimits, ...overrides }\n for (const [name, value] of Object.entries(limits)) {\n if (!Number.isSafeInteger(value) || value <= 0) {\n throw new Error(`candidate workspace ${name} must be a positive safe integer`)\n }\n }\n return Object.freeze(limits)\n}\n\nfunction safeArchivePath(value: unknown, maxPathBytes: number): string {\n if (\n typeof value !== 'string' ||\n !value ||\n !isWellFormedUnicode(value) ||\n Buffer.byteLength(value, 'utf8') > maxPathBytes ||\n isAbsolute(value) ||\n win32.isAbsolute(value) ||\n value.includes('\\\\') ||\n value.includes('\\0') ||\n hasControlCharacter(value) ||\n value.split('/').some((part) => !part || part === '.' || part === '..') ||\n ['.git', '.sidecar'].includes(value.split('/')[0]?.toLowerCase() ?? '')\n ) {\n throw new Error(`candidate workspace archive contains an unsafe path: ${String(value)}`)\n }\n return value\n}\n\nfunction assertWorkspacePathOrder(\n path: string,\n previousPath: string | undefined,\n observedPaths: Set<string>,\n errorMessage: string,\n): void {\n if (previousPath !== undefined && previousPath >= path) throw new Error(errorMessage)\n for (let slash = path.indexOf('/'); slash !== -1; slash = path.indexOf('/', slash + 1)) {\n if (observedPaths.has(path.slice(0, slash))) throw new Error(errorMessage)\n }\n observedPaths.add(path)\n}\n\nfunction inspectWorkspaceBytes(\n input: unknown,\n path: string,\n): { buffer: ArrayBuffer; byteOffset: number; byteLength: number } {\n let buffer: ArrayBufferLike\n let byteOffset: number\n let byteLength: number\n try {\n buffer = typedArrayBufferGetter.call(input as Uint8Array) as ArrayBufferLike\n byteOffset = typedArrayByteOffsetGetter.call(input as Uint8Array) as number\n byteLength = typedArrayByteLengthGetter.call(input as Uint8Array) as number\n } catch {\n throw new Error(`candidate workspace file bytes are invalid: ${path}`)\n }\n if (isSharedArrayBuffer(buffer)) {\n throw new Error(`candidate workspace file uses shared bytes: ${path}`)\n }\n if (!isAnyArrayBuffer(buffer)) {\n throw new Error(`candidate workspace file bytes are invalid: ${path}`)\n }\n return { buffer, byteOffset, byteLength }\n}\n\nfunction detachWorkspaceBytes(input: {\n buffer: ArrayBuffer\n byteOffset: number\n byteLength: number\n}): Uint8Array {\n const { buffer, byteOffset, byteLength } = input\n const copy = new Uint8Array(byteLength)\n Uint8Array.prototype.set.call(copy, new Uint8Array(buffer, byteOffset, byteLength))\n return copy\n}\n\nfunction isWellFormedUnicode(value: string): boolean {\n for (let index = 0; index < value.length; index++) {\n const code = value.charCodeAt(index)\n if (code >= 0xd800 && code <= 0xdbff) {\n const next = value.charCodeAt(index + 1)\n if (!(next >= 0xdc00 && next <= 0xdfff)) return false\n index++\n } else if (code >= 0xdc00 && code <= 0xdfff) {\n return false\n }\n }\n return true\n}\n\nfunction workspacePath(root: string, relativePath: string): string {\n const path = resolve(root, relativePath)\n if (!path.startsWith(`${root}${sep}`)) {\n throw new Error(`candidate workspace archive path escapes its destination: ${relativePath}`)\n }\n return path\n}\n\nfunction assertGitObjectId(value: string, label: string): void {\n if (!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/.test(value)) {\n throw new Error(`candidate repository ${label} is not a Git object id`)\n }\n}\n\nfunction hasControlCharacter(value: string): boolean {\n for (let index = 0; index < value.length; index++) {\n const code = value.charCodeAt(index)\n if (code < 0x20 || code === 0x7f) return true\n }\n return false\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\ntype TypedArrayGetter = (this: Uint8Array) => unknown\n\nfunction requireTypedArrayGetter(name: 'buffer' | 'byteOffset' | 'byteLength'): TypedArrayGetter {\n const typedArrayPrototype = Object.getPrototypeOf(Uint8Array.prototype) as object\n const getter = Object.getOwnPropertyDescriptor(typedArrayPrototype, name)?.get\n if (!getter) throw new Error(`typed array intrinsic ${name} accessor is unavailable`)\n return getter\n}\n\nconst typedArrayBufferGetter = requireTypedArrayGetter('buffer')\nconst typedArrayByteOffsetGetter = requireTypedArrayGetter('byteOffset')\nconst typedArrayByteLengthGetter = requireTypedArrayGetter('byteLength')\n"],"mappings":";;;;;;;;;;;AASA,SAAgB,yBAAyB,OAAwD;CAC/F,MAAM,SAASA,2BAAyB,KAAK;CAC7C,MAAM,SAAS,2BAA2B,MAAM;EAAE,GAAG;EAAO;CAAO,CAAC;CAEpE,IADqBA,2BAAyB,mBAAmB,MAAM,CACxD,MAAM,QACnB,MAAM,IAAI,MAAM,oEAAoE;CAEtF,OAAO,wBAAwB,MAAM;AACvC;;;ACgCA,MAAM,cAAc;AACpB,MAAM,uBAAuB;AAC7B,MAAM,0BAA0B;AAChC,MAAM,wBAAwB;AAC9B,MAAM,+BAAe,IAAI,KAAK,CAAC;AAY/B,MAAM,gBAAsD,OAAO,OAAO;CACxE,iBAAiB,MAAM,OAAO;CAC9B,0BAA0B,OAAO;CACjC,UAAU;CACV,cAAc,MAAM,OAAO;CAC3B,mBAAmB,MAAM,OAAO;CAChC,cAAc;CACd,0BAA0B,MAAM,OAAO;AACzC,CAAC;;AAkDD,eAAsB,+BACpB,WACA,UAAiD,CAAC,GACR;CAC1C,MAAM,OAAO,QAAQ,SAAS;CAC9B,MAAM,SAAS,gBAAgB,QAAQ,MAAM;CAC7C,MAAM,WAAW,QAAQ,oBACrB,MAAM,kBAAkB,MAAM,MAAM,IACpC,MAAM,6BAA6B,MAAM,EACvC,QAAQ;EACN,UAAU,OAAO;EACjB,cAAc,OAAO;EACrB,mBAAmB,OAAO;CAC5B,EACF,CAAC;CACL,iCAAiC,SAAS,OAAO,M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;CAC3C;CACA,OAAO;AACT;AAEA,SAAS,SAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAIA,SAAS,wBAAwB,MAAgE;CAC/F,MAAM,sBAAsB,OAAO,eAAe,WAAW,SAAS;CACtE,MAAM,SAAS,OAAO,yBAAyB,qBAAqB,IAAI,CAAC,EAAE;CAC3E,IAAI,CAAC,QAAQ,MAAM,IAAI,MAAM,yBAAyB,KAAK,yBAAyB;CACpF,OAAO;AACT;AAEA,MAAM,yBAAyB,wBAAwB,QAAQ;AAC/D,MAAM,6BAA6B,wBAAwB,YAAY;AACvE,MAAM,6BAA6B,wBAAwB,YAAY"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/agent-runtime",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.106.0",
|
|
4
4
|
"description": "Shared task-lifecycle skeleton for agents: a recursive loop kernel for chat turns, one-shot tasks, and multi-attempt loops, with trace capture and eval-gated self-improvement. Domain behavior lives in adapters; scoring and ship-gates in @tangle-network/agent-eval.",
|
|
5
5
|
"homepage": "https://github.com/tangle-network/agent-runtime#readme",
|
|
6
6
|
"repository": {
|
|
@@ -98,65 +98,31 @@
|
|
|
98
98
|
"publishConfig": {
|
|
99
99
|
"access": "public"
|
|
100
100
|
},
|
|
101
|
-
"scripts": {
|
|
102
|
-
"build": "tsup",
|
|
103
|
-
"dev": "tsup --watch",
|
|
104
|
-
"prepublishOnly": "pnpm run build",
|
|
105
|
-
"test": "vitest run",
|
|
106
|
-
"test:watch": "vitest",
|
|
107
|
-
"lint": "biome check src tests examples",
|
|
108
|
-
"lint:fix": "biome check --write src tests examples",
|
|
109
|
-
"typecheck": "tsc --noEmit && pnpm run typecheck:examples",
|
|
110
|
-
"typecheck:examples": "tsc --noEmit -p tsconfig.examples.json",
|
|
111
|
-
"generate:testing-fixture": "tsx scripts/generate-agent-improvement-proposal-fixture.ts",
|
|
112
|
-
"check:testing-fixture": "tsx scripts/generate-agent-improvement-proposal-fixture.ts --check",
|
|
113
|
-
"check:skills": "node scripts/check-skills.mjs",
|
|
114
|
-
"verify:bench": "pnpm build && pnpm --filter @tangle-network/agent-bench run typecheck:public && pnpm --filter @tangle-network/agent-bench test && pnpm --filter @tangle-network/agent-bench run verify:package:local-runtime",
|
|
115
|
-
"verify:bench:published": "pnpm build && pnpm --filter @tangle-network/agent-bench run typecheck:public && pnpm --filter @tangle-network/agent-bench test && pnpm --filter @tangle-network/agent-bench run verify:package",
|
|
116
|
-
"verify:package": "pnpm run check:testing-fixture && pnpm run check:skills && node scripts/verify-package-exports.mjs",
|
|
117
|
-
"verify:primeintellect": "pnpm build && node scripts/verify-primeintellect-v1.mjs",
|
|
118
|
-
"verify:primeintellect:live": "pnpm build && node scripts/verify-primeintellect-live.mjs",
|
|
119
|
-
"docs:api": "pnpm run build && typedoc && node scripts/gen-primitive-catalog.mjs",
|
|
120
|
-
"docs:freshness": "node scripts/check-docs-freshness.mjs",
|
|
121
|
-
"docs:check": "pnpm run docs:api && git diff --exit-code -- docs/api && pnpm run docs:freshness"
|
|
122
|
-
},
|
|
123
101
|
"devDependencies": {
|
|
124
|
-
"@
|
|
125
|
-
"@
|
|
126
|
-
"@tangle-network/agent-
|
|
127
|
-
"@tangle-network/
|
|
128
|
-
"@
|
|
102
|
+
"@arethetypeswrong/cli": "0.18.5",
|
|
103
|
+
"@biomejs/biome": "^2.5.5",
|
|
104
|
+
"@tangle-network/agent-eval": "0.131.0",
|
|
105
|
+
"@tangle-network/agent-interface": "0.35.0",
|
|
106
|
+
"@tangle-network/sandbox": "0.14.0",
|
|
107
|
+
"@types/node": "26.1.1",
|
|
129
108
|
"@types/tar-stream": "3.1.4",
|
|
130
|
-
"playwright": "^1.
|
|
131
|
-
"
|
|
132
|
-
"
|
|
133
|
-
"
|
|
109
|
+
"playwright": "^1.62.0",
|
|
110
|
+
"publint": "0.3.22",
|
|
111
|
+
"tsdown": "0.22.14",
|
|
112
|
+
"tsx": "4.23.1",
|
|
113
|
+
"typedoc": "0.28.20",
|
|
134
114
|
"typedoc-plugin-markdown": "4.12.0",
|
|
135
|
-
"typescript": "
|
|
136
|
-
"vitest": "^
|
|
137
|
-
},
|
|
138
|
-
"pnpm": {
|
|
139
|
-
"minimumReleaseAge": 4320,
|
|
140
|
-
"minimumReleaseAgeExclude": [
|
|
141
|
-
"@tangle-network/agent-eval",
|
|
142
|
-
"@tangle-network/agent-interface",
|
|
143
|
-
"@tangle-network/agent-knowledge",
|
|
144
|
-
"@tangle-network/agent-profile-materialize",
|
|
145
|
-
"@tangle-network/sandbox"
|
|
146
|
-
],
|
|
147
|
-
"onlyBuiltDependencies": [
|
|
148
|
-
"esbuild"
|
|
149
|
-
]
|
|
115
|
+
"typescript": "6.0.3",
|
|
116
|
+
"vitest": "^4.1.10"
|
|
150
117
|
},
|
|
151
118
|
"engines": {
|
|
152
|
-
"node": ">=
|
|
119
|
+
"node": ">=22.13.0"
|
|
153
120
|
},
|
|
154
121
|
"license": "MIT",
|
|
155
|
-
"packageManager": "pnpm@10.28.0",
|
|
156
122
|
"peerDependencies": {
|
|
157
|
-
"@tangle-network/agent-eval": ">=0.
|
|
158
|
-
"@tangle-network/agent-interface": ">=0.
|
|
159
|
-
"@tangle-network/sandbox": ">=0.
|
|
123
|
+
"@tangle-network/agent-eval": ">=0.131.0 <0.132.0",
|
|
124
|
+
"@tangle-network/agent-interface": ">=0.35.0 <0.36.0",
|
|
125
|
+
"@tangle-network/sandbox": ">=0.14.0 <0.15.0",
|
|
160
126
|
"playwright": "^1.40.0"
|
|
161
127
|
},
|
|
162
128
|
"peerDependenciesMeta": {
|
|
@@ -168,8 +134,30 @@
|
|
|
168
134
|
}
|
|
169
135
|
},
|
|
170
136
|
"dependencies": {
|
|
171
|
-
"@tangle-network/agent-knowledge": "
|
|
172
|
-
"@tangle-network/agent-profile-materialize": "0.
|
|
137
|
+
"@tangle-network/agent-knowledge": "6.1.1",
|
|
138
|
+
"@tangle-network/agent-profile-materialize": "0.9.0",
|
|
173
139
|
"tar-stream": "3.2.0"
|
|
140
|
+
},
|
|
141
|
+
"scripts": {
|
|
142
|
+
"build": "tsdown",
|
|
143
|
+
"dev": "tsdown --watch",
|
|
144
|
+
"test": "vitest run",
|
|
145
|
+
"test:watch": "vitest",
|
|
146
|
+
"lint": "biome check src tests examples",
|
|
147
|
+
"lint:fix": "biome check --write src tests examples",
|
|
148
|
+
"typecheck": "tsc --noEmit && pnpm run typecheck:examples",
|
|
149
|
+
"typecheck:examples": "tsc --noEmit -p tsconfig.examples.json",
|
|
150
|
+
"generate:testing-fixture": "tsx scripts/generate-agent-improvement-proposal-fixture.ts",
|
|
151
|
+
"check:testing-fixture": "tsx scripts/generate-agent-improvement-proposal-fixture.ts --check",
|
|
152
|
+
"check:skills": "node scripts/check-skills.mjs",
|
|
153
|
+
"verify:bench": "pnpm build && pnpm --filter @tangle-network/agent-bench run typecheck:public && pnpm --filter @tangle-network/agent-bench test && pnpm --filter @tangle-network/agent-bench run verify:package:local-runtime",
|
|
154
|
+
"verify:bench:published": "pnpm build && pnpm --filter @tangle-network/agent-bench run typecheck:public && pnpm --filter @tangle-network/agent-bench test && pnpm --filter @tangle-network/agent-bench run verify:package",
|
|
155
|
+
"verify:package": "pnpm run build && pnpm run check:testing-fixture && pnpm run check:skills && publint && attw --pack --profile esm-only . && node scripts/verify-package-exports.mjs",
|
|
156
|
+
"verify:official-optimizers": "node scripts/verify-official-optimizers.mjs",
|
|
157
|
+
"verify:primeintellect": "pnpm build && node scripts/verify-primeintellect.mjs",
|
|
158
|
+
"verify:primeintellect:live": "pnpm build && node scripts/verify-primeintellect-live.mjs",
|
|
159
|
+
"docs:api": "pnpm run build && typedoc && node scripts/gen-primitive-catalog.mjs",
|
|
160
|
+
"docs:freshness": "node scripts/check-docs-freshness.mjs",
|
|
161
|
+
"docs:check": "pnpm run docs:api && git diff --exit-code -- docs/api && pnpm run docs:freshness"
|
|
174
162
|
}
|
|
175
|
-
}
|
|
163
|
+
}
|
|
@@ -34,7 +34,7 @@ Do not move product storage transactions into a provider-neutral package.
|
|
|
34
34
|
|---|---|
|
|
35
35
|
| One product chat turn | `handleChatTurn(...)` |
|
|
36
36
|
| One normalized streamed agent turn | `streamAgentTurn(...)` and `collectAgentTurn(...)` |
|
|
37
|
-
| One task or multi-turn loop | `runAgentTask(...)`, `runAgentTaskStream(...)`, or `
|
|
37
|
+
| One task or multi-turn loop | `runAgentTask(...)`, `runAgentTaskStream(...)`, or `runAgentRounds(...)` |
|
|
38
38
|
| Supervisor and workers | `supervise(...)` or `superviseSurface(...)` |
|
|
39
39
|
| Parallel work with a shared budget | `fanout(...)` |
|
|
40
40
|
| Fixed composition | `pipeline(...)`, `panel(...)`, or `verify(...)` |
|
|
@@ -50,11 +50,16 @@ Do not move product storage transactions into a provider-neutral package.
|
|
|
50
50
|
|
|
51
51
|
## Improvement flow
|
|
52
52
|
|
|
53
|
-
`improve(profile,
|
|
53
|
+
`improve(profile, options)` searches one surface and returns a detached winner.
|
|
54
54
|
It never changes a profile, document, repository, memory store, or knowledge base.
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
For a profile field, pass one complete agent-eval `OptimizationMethod`, explicit train, selection, and final-test partitions, judges, and the candidate execution function.
|
|
57
|
+
Use `officialGepa(...)` with an explicit recipe when upstream GEPA should own search.
|
|
58
|
+
Use `officialSkillOpt(...)` when Microsoft's SkillOpt should own search.
|
|
59
|
+
Both require `evaluationId`; change it whenever dispatch, judges, models, or scoring behavior changes.
|
|
60
|
+
Resumable runs accept `never`, `if-compatible`, or `required` and reuse state only when agent-eval derives the same run identity.
|
|
61
|
+
Runtime has no local prompt, skill, memory, or profile optimizer fallback.
|
|
62
|
+
Code uses Runtime's isolated worktrees and returns a sealed patch candidate.
|
|
58
63
|
Knowledge uses `runKnowledgeImprovementJob(...)` and returns paired snapshots.
|
|
59
64
|
|
|
60
65
|
Use `proposeAgentImprovement(...)` for a production proposal.
|
|
@@ -80,12 +85,12 @@ Never treat a lost response as a failed write without reconciling it.
|
|
|
80
85
|
|
|
81
86
|
## Surface rules
|
|
82
87
|
|
|
83
|
-
- Prompt changes `profile.prompt` only.
|
|
84
|
-
- Skill optimization selects one inline skill by `skills.resourceName
|
|
88
|
+
- Prompt changes `profile.prompt` only and requires a complete method.
|
|
89
|
+
- Skill optimization selects one inline skill by `skills.resourceName`, requires a complete method, and requires profile resources to fail closed.
|
|
85
90
|
- Curated memory changes `profile.resources.instructions`; retrieval stores and memory databases belong in the knowledge flow.
|
|
86
|
-
- Tools, MCP, hooks, subagents, and whole-profile changes require
|
|
91
|
+
- Tools, MCP, hooks, subagents, curated memory, rollout policy, and whole-profile changes require a complete method.
|
|
87
92
|
- Code candidates must come from the Runtime worktree path so patch identity and cleanup stay intact.
|
|
88
|
-
- Workflow
|
|
93
|
+
- Workflow files are code surfaces. Parameter sweeps belong in a complete agent-eval method.
|
|
89
94
|
- Knowledge candidates remain detached until the shared activation path applies or restores their frozen snapshots.
|
|
90
95
|
|
|
91
96
|
## Product integration
|
|
@@ -104,10 +109,12 @@ The product must not recreate candidate hashing, paired comparison, confidence i
|
|
|
104
109
|
## Do not duplicate
|
|
105
110
|
|
|
106
111
|
- Do not write a provider-specific profile wrapper; extend `AgentProfile` and its materializer.
|
|
107
|
-
- Do not write a second optimizer loop;
|
|
112
|
+
- Do not write a second optimizer loop; pass a complete agent-eval method to `improve(...)`.
|
|
113
|
+
- Do not use Runtime's code generator to approximate GEPA, SkillOpt, or another upstream profile optimizer.
|
|
108
114
|
- Do not write a second candidate catalog; persist the immutable proposal records.
|
|
109
115
|
- Do not let an analyst or adapter commit, push, open a pull request, or edit a live store.
|
|
110
116
|
- Do not hand-roll SSE parsing, usage totals, profile matrices, bootstrap statistics, sandbox acquisition, or worktree cleanup.
|
|
117
|
+
- Do not attach completed Runtime totals to an Eval campaign. Use `loopDispatch` or `loopCampaignDispatch` so admission and receipt capture surround the paid work.
|
|
111
118
|
- Do not add a product-local approval format for knowledge, code, or profile changes.
|
|
112
119
|
|
|
113
120
|
## Finish
|
|
@@ -21,7 +21,7 @@ Do not copy signatures from this skill.
|
|
|
21
21
|
| Parallel repository workers with isolated branches | `worktreeFanout(...)` |
|
|
22
22
|
| Repeated work in a graded tool environment | `runAgentic(...)` |
|
|
23
23
|
| Equal-budget comparison over that environment | `runBenchmark(...)` |
|
|
24
|
-
| Low-level round policy with custom planning and stopping | `
|
|
24
|
+
| Low-level round policy with custom planning and stopping | `runAgentRounds(...)` |
|
|
25
25
|
|
|
26
26
|
If an existing row fits, use it and stop.
|
|
27
27
|
Do not create another wrapper solely to rename inputs or results.
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { Sha256Digest, AgentImprovementActivationResult, AgentImprovementActivation, AgentCandidateBundle, AgentImprovementActivationTarget, AgentImprovementActivationOutcome, AgentImprovementProposal, AgentImprovementReview } from '@tangle-network/agent-interface';
|
|
2
|
-
|
|
3
|
-
interface CreateAgentImprovementActivationResultOptions {
|
|
4
|
-
completedAt: string;
|
|
5
|
-
outcome: AgentImprovementActivationOutcome;
|
|
6
|
-
}
|
|
7
|
-
interface AgentImprovementActivationTargetPlan extends AgentImprovementActivationTarget {
|
|
8
|
-
desiredDigest: Sha256Digest;
|
|
9
|
-
/**
|
|
10
|
-
* Exact measured input the product must apply to reach `desiredDigest`.
|
|
11
|
-
* Transition surfaces such as code and knowledge are applied operations, so
|
|
12
|
-
* their resulting state digest is not the digest of this input document.
|
|
13
|
-
*/
|
|
14
|
-
desiredInput: unknown;
|
|
15
|
-
}
|
|
16
|
-
interface AgentImprovementActivationTransitionInput {
|
|
17
|
-
activation: AgentImprovementActivation;
|
|
18
|
-
candidateBundle: AgentCandidateBundle;
|
|
19
|
-
bundle: AgentCandidateBundle;
|
|
20
|
-
targets: [AgentImprovementActivationTargetPlan, ...AgentImprovementActivationTargetPlan[]];
|
|
21
|
-
attemptedAt: string;
|
|
22
|
-
expired: boolean;
|
|
23
|
-
}
|
|
24
|
-
interface AgentImprovementActivationResultStore {
|
|
25
|
-
load(idempotencyKey: Sha256Digest): Promise<unknown | undefined>;
|
|
26
|
-
putIfAbsent(result: AgentImprovementActivationResult): Promise<unknown>;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Product-owned or Runtime-composed transition.
|
|
30
|
-
*
|
|
31
|
-
* Implementations resolve a stored result for `activation.digest`, compare
|
|
32
|
-
* every target, and make the write durably idempotent. Co-located targets store
|
|
33
|
-
* the all-or-none write with its result. Other targets throw when result
|
|
34
|
-
* storage fails so a retry can reconcile it. Runtime never invokes this write
|
|
35
|
-
* function after authorization expires.
|
|
36
|
-
*/
|
|
37
|
-
type AgentImprovementActivationTransition = (input: AgentImprovementActivationTransitionInput) => Promise<unknown>;
|
|
38
|
-
/**
|
|
39
|
-
* Target-read-only check for a prior exact write.
|
|
40
|
-
* It may persist recovered result metadata, but must not change an activation target.
|
|
41
|
-
* Return undefined only when no target write can have committed.
|
|
42
|
-
*/
|
|
43
|
-
type AgentImprovementActivationReconciliation = (input: AgentImprovementActivationTransitionInput) => Promise<unknown | undefined>;
|
|
44
|
-
interface ExecuteAgentImprovementActivationInput {
|
|
45
|
-
proposal: AgentImprovementProposal;
|
|
46
|
-
review: AgentImprovementReview;
|
|
47
|
-
activation: AgentImprovementActivation;
|
|
48
|
-
}
|
|
49
|
-
interface ExecuteAgentImprovementActivationOptions {
|
|
50
|
-
transition: AgentImprovementActivationTransition;
|
|
51
|
-
reconcile?: AgentImprovementActivationReconciliation;
|
|
52
|
-
now?: () => Date;
|
|
53
|
-
}
|
|
54
|
-
/** Create the exact result a product stores in the same transaction as its target write. */
|
|
55
|
-
declare function createAgentImprovementActivationResult(transition: AgentImprovementActivationTransitionInput, options: CreateAgentImprovementActivationResultOptions): AgentImprovementActivationResult;
|
|
56
|
-
/**
|
|
57
|
-
* Recompute one historical activation result against the exact measured proposal and authority.
|
|
58
|
-
* The result records that attempt; it is not a query of the target's current state.
|
|
59
|
-
*/
|
|
60
|
-
declare function verifyAgentImprovementActivationResult(input: {
|
|
61
|
-
proposal: unknown;
|
|
62
|
-
review: unknown;
|
|
63
|
-
activation: unknown;
|
|
64
|
-
result: unknown;
|
|
65
|
-
}): AgentImprovementActivationResult;
|
|
66
|
-
/** Validate and execute one product-owned activation transition. */
|
|
67
|
-
declare function executeAgentImprovementActivation(input: ExecuteAgentImprovementActivationInput, options: ExecuteAgentImprovementActivationOptions): Promise<AgentImprovementActivationResult>;
|
|
68
|
-
|
|
69
|
-
export { type AgentImprovementActivationTargetPlan as A, type CreateAgentImprovementActivationResultOptions as C, type ExecuteAgentImprovementActivationInput as E, type AgentImprovementActivationReconciliation as a, type AgentImprovementActivationResultStore as b, type AgentImprovementActivationTransition as c, type AgentImprovementActivationTransitionInput as d, type ExecuteAgentImprovementActivationOptions as e, createAgentImprovementActivationResult as f, executeAgentImprovementActivation as g, verifyAgentImprovementActivationResult as v };
|
package/dist/analyst-loop.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,134 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|