@tangle-network/agent-runtime 0.120.0 → 0.123.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/dist/{activation-DdIpwQ0k.js → activation-B7sTehZB.js} +3 -3
- package/dist/{activation-DdIpwQ0k.js.map → activation-B7sTehZB.js.map} +1 -1
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +3 -3
- package/dist/candidate-execution/index.js +4 -4
- package/dist/{candidate-execution-DDkSRPjY.js → candidate-execution-BFpq-Xi6.js} +4 -4
- package/dist/{candidate-execution-DDkSRPjY.js.map → candidate-execution-BFpq-Xi6.js.map} +1 -1
- package/dist/{environment-provider-Bh4nX2qt.d.ts → environment-provider-CEjwunXO.d.ts} +105 -11
- package/dist/{environment-provider-Cr75N-rU.js → environment-provider-CY22kUQH.js} +4 -85
- package/dist/environment-provider-CY22kUQH.js.map +1 -0
- package/dist/environment-provider.d.ts +1 -1
- package/dist/environment-provider.js +1 -1
- package/dist/{improvement-cycle-zjR-MXwK.js → improvement-cycle-BcwsSbT-.js} +4 -4
- package/dist/{improvement-cycle-zjR-MXwK.js.map → improvement-cycle-BcwsSbT-.js.map} +1 -1
- package/dist/{index-I35151Fr.d.ts → index-BKSzgMvA.d.ts} +5 -5
- package/dist/{index-BLsKcxNd.d.ts → index-CKply5aj.d.ts} +3 -3
- package/dist/{index-CGADWaa_.d.ts → index-CyXinqJw.d.ts} +1213 -849
- package/dist/index.d.ts +6 -6
- package/dist/index.js +12 -12
- package/dist/intelligence.d.ts +1 -1
- package/dist/intelligence.js +6 -6
- package/dist/kernel.d.ts +3 -3
- package/dist/kernel.js +7 -7
- package/dist/{knowledge-I1e9zQGj.js → knowledge-Cuvb21T7.js} +5 -5
- package/dist/{knowledge-I1e9zQGj.js.map → knowledge-Cuvb21T7.js.map} +1 -1
- package/dist/knowledge.d.ts +1 -1
- package/dist/knowledge.js +1 -1
- package/dist/{loop-runner-bin-BeG9vTdE.d.ts → loop-runner-bin-BjnNpN5m.d.ts} +3 -3
- package/dist/{loop-runner-bin-L996YVPS.js → loop-runner-bin-Clhj8gy5.js} +3 -3
- package/dist/{loop-runner-bin-L996YVPS.js.map → loop-runner-bin-Clhj8gy5.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 +2 -2
- package/dist/mcp/index.d.ts +3 -3
- package/dist/mcp/index.js +5 -5
- package/dist/{openai-tools-CvFEzw6f.js → openai-tools-BwTsBfd-.js} +2 -2
- package/dist/{openai-tools-CvFEzw6f.js.map → openai-tools-BwTsBfd-.js.map} +1 -1
- package/dist/{prepare-DpV6np9e.js → prepare--8EvLqCr.js} +2 -2
- package/dist/{prepare-DpV6np9e.js.map → prepare--8EvLqCr.js.map} +1 -1
- package/dist/primeintellect/index.d.ts +1 -1
- package/dist/{protected-model-port-vQLBRoAQ.js → protected-model-port-CXVfOUu_.js} +2 -2
- package/dist/{protected-model-port-vQLBRoAQ.js.map → protected-model-port-CXVfOUu_.js.map} +1 -1
- package/dist/{runtime-D4e3GP5K.js → runtime-OI7oLLec.js} +463 -52
- package/dist/runtime-OI7oLLec.js.map +1 -0
- package/dist/{spawn-journal-IeXpidO2.js → spawn-journal-DsZKDqeh.js} +5 -3
- package/dist/spawn-journal-DsZKDqeh.js.map +1 -0
- package/dist/{structural-rollout-DQHO3b2Y.js → structural-rollout-C4Jv_7vt.js} +3 -3
- package/dist/{structural-rollout-DQHO3b2Y.js.map → structural-rollout-C4Jv_7vt.js.map} +1 -1
- package/dist/{supervise-Cq50UT5-.js → supervise-Dwq16u8n.js} +451 -55
- package/dist/supervise-Dwq16u8n.js.map +1 -0
- package/dist/{supervisor-CpT9yAxL.js → supervisor-DjZ82HIB.js} +166 -23
- package/dist/supervisor-DjZ82HIB.js.map +1 -0
- package/dist/testing.js +12 -12
- package/dist/{workspace-archive-B4SkNJjw.js → workspace-archive-BQxvkypI.js} +2 -2
- package/dist/{workspace-archive-B4SkNJjw.js.map → workspace-archive-BQxvkypI.js.map} +1 -1
- package/package.json +11 -9
- package/dist/environment-provider-Cr75N-rU.js.map +0 -1
- package/dist/runtime-D4e3GP5K.js.map +0 -1
- package/dist/spawn-journal-IeXpidO2.js.map +0 -1
- package/dist/supervise-Cq50UT5-.js.map +0 -1
- package/dist/supervisor-CpT9yAxL.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as RuntimeRunStateError, u as ValidationError } from "./errors-DEAvWQPy.js";
|
|
2
|
-
import { S as detachedSnapshot, _ as captureWorkerTraceEvidence, c as replaySpawnTree, f as attestNestedDriverTreeOwner, h as runtimeOwnedNestedDriverTreeRoot, m as nestedDriverTreeRoot, o as materializeTreeView, p as driverRuntime, s as pendingWaits, x as contentAddress } from "./spawn-journal-
|
|
2
|
+
import { S as detachedSnapshot, _ as captureWorkerTraceEvidence, c as replaySpawnTree, f as attestNestedDriverTreeOwner, h as runtimeOwnedNestedDriverTreeRoot, m as nestedDriverTreeRoot, o as materializeTreeView, p as driverRuntime, s as pendingWaits, x as contentAddress } from "./spawn-journal-DsZKDqeh.js";
|
|
3
3
|
import { f as zeroTokenUsage, t as addTokenUsage } from "./util-MVgdwuIS.js";
|
|
4
4
|
import { i as notifyRuntimeHookEvent } from "./runtime-hooks-C7iJOWm3.js";
|
|
5
5
|
import { estimateCost, isModelPriced } from "@tangle-network/agent-eval";
|
|
@@ -12,6 +12,7 @@ import { basename, delimiter, dirname, isAbsolute, join, resolve, sep, win32 } f
|
|
|
12
12
|
import { spawn } from "node:child_process";
|
|
13
13
|
import { homedir, tmpdir } from "node:os";
|
|
14
14
|
import { stripVTControlCharacters } from "node:util";
|
|
15
|
+
import { deriveHexId, isW3CSpanId, isW3CTraceId } from "@tangle-network/agent-trace-contract";
|
|
15
16
|
//#region src/mcp/codex-diagnostics.ts
|
|
16
17
|
/** Thrown when reproducible Codex exits without one valid terminal usage event. */
|
|
17
18
|
var CodexExecutionDiagnosticError = class extends Error {
|
|
@@ -4391,11 +4392,30 @@ function toOtelAttributes(record) {
|
|
|
4391
4392
|
function msToNs(ms) {
|
|
4392
4393
|
return (BigInt(Math.floor(Number.isFinite(ms) ? ms : Date.now())) * 1000000n).toString();
|
|
4393
4394
|
}
|
|
4395
|
+
/**
|
|
4396
|
+
* Map a caller-supplied span id onto the 16-hex OTLP encoding. An id that is already a valid W3C
|
|
4397
|
+
* span id passes through UNCHANGED — that is what lets an inherited `PARENT_SPAN_ID`/`TRACEPARENT`
|
|
4398
|
+
* id keep parenting the same trace. A DASHED hex id (a UUID-form id) passes through dash-stripped:
|
|
4399
|
+
* that is the exact wire id every earlier release exported for it, so cross-version joins survive
|
|
4400
|
+
* the strict-W3C upgrade. Anything else (a human run id) is DERIVED via the zero-dep contract's
|
|
4401
|
+
* `deriveHexId`, the one legal derivation: the old slice-and-pad produced ids that embedded the
|
|
4402
|
+
* raw input in the wire id and were not even valid hex (the contract's own `non-hex-id` validator
|
|
4403
|
+
* rejected what this module exported). Exported as the ONE wire-id normalization every writer
|
|
4404
|
+
* shares — `traceContextToEnv` builds the child's `TRACEPARENT` through these same functions, so
|
|
4405
|
+
* a parent's exported spans and the context it hands its children always name the same trace.
|
|
4406
|
+
*/
|
|
4394
4407
|
function padSpanId(id) {
|
|
4395
|
-
|
|
4408
|
+
if (isW3CSpanId(id)) return id;
|
|
4409
|
+
const dashless = id.replace(/-/g, "");
|
|
4410
|
+
return isW3CSpanId(dashless) ? dashless : deriveHexId(id, 8);
|
|
4396
4411
|
}
|
|
4412
|
+
/** Trace-id counterpart of {@link padSpanId}: valid W3C trace ids pass through (dash-stripped when
|
|
4413
|
+
* UUID-form, preserving the pre-strict-W3C wire id), everything else is derived with
|
|
4414
|
+
* `deriveHexId(id, 16)` so every process derives the SAME wire id for the same run. */
|
|
4397
4415
|
function padTraceId(id) {
|
|
4398
|
-
|
|
4416
|
+
if (isW3CTraceId(id)) return id;
|
|
4417
|
+
const dashless = id.replace(/-/g, "");
|
|
4418
|
+
return isW3CTraceId(dashless) ? dashless : deriveHexId(id, 16);
|
|
4399
4419
|
}
|
|
4400
4420
|
/** Mint a fresh 16-hex-character OTLP span id. Exported so a producer that must know a span's id
|
|
4401
4421
|
* BEFORE the span closes (a node opened at spawn and parented by its children) uses this one
|
|
@@ -4452,18 +4472,63 @@ async function exportEvalRuns(events, config) {
|
|
|
4452
4472
|
//#endregion
|
|
4453
4473
|
//#region src/mcp/trace-propagation.ts
|
|
4454
4474
|
/**
|
|
4455
|
-
*
|
|
4456
|
-
*
|
|
4475
|
+
*
|
|
4476
|
+
* Trace context propagation across process-spawn boundaries.
|
|
4477
|
+
*
|
|
4478
|
+
* CANONICAL WIRE: the W3C `TRACEPARENT` environment variable
|
|
4479
|
+
* (`00-<32 hex trace id>-<16 hex span id>-<2 hex flags>`), the convention the wider ecosystem —
|
|
4480
|
+
* OTel SDKs, collectors, the Claude Code harness binary — already reads at spawn. The bespoke
|
|
4481
|
+
* `TRACE_ID` / `PARENT_SPAN_ID` pair this package shipped first is the FORK, not the standard:
|
|
4482
|
+
* it is still read as a fallback and still written alongside `TRACEPARENT` for one release, so
|
|
4483
|
+
* a child running either version of this package joins the same trace. The legacy pair is
|
|
4484
|
+
* scheduled for removal in the next major.
|
|
4485
|
+
*
|
|
4486
|
+
* read: TRACEPARENT first, then TRACE_ID / PARENT_SPAN_ID, else a fresh root.
|
|
4487
|
+
* write: BOTH — TRACEPARENT (+ TRACESTATE untouched) and TRACE_ID / PARENT_SPAN_ID.
|
|
4488
|
+
*
|
|
4489
|
+
* A fresh root minted because NO context reached this process is a severed hop, not a normal
|
|
4490
|
+
* start: it is marked `unpropagated: true` and every span tree it emits carries
|
|
4491
|
+
* `tangle.trace.unpropagated=true`, so a disconnected trace is a queryable fact instead of a
|
|
4492
|
+
* silent stranger.
|
|
4493
|
+
*
|
|
4494
|
+
* @experimental
|
|
4495
|
+
*/
|
|
4496
|
+
/** `00-<traceId>-<spanId>-<flags>`, any version prefix, case-insensitive per the W3C grammar. */
|
|
4497
|
+
const TRACEPARENT_PATTERN = /^[0-9a-f]{2}-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/i;
|
|
4498
|
+
/** Parse a W3C `traceparent` header/env value, or `undefined` when malformed. Fails closed: a
|
|
4499
|
+
* half-formed value yields no context rather than an unjoinable id. */
|
|
4500
|
+
function parseTraceparent(value) {
|
|
4501
|
+
if (typeof value !== "string") return void 0;
|
|
4502
|
+
const match = TRACEPARENT_PATTERN.exec(value.trim());
|
|
4503
|
+
if (!match) return void 0;
|
|
4504
|
+
const traceId = match[1].toLowerCase();
|
|
4505
|
+
const parentSpanId = match[2].toLowerCase();
|
|
4506
|
+
if (!isW3CTraceId(traceId) || !isW3CSpanId(parentSpanId)) return void 0;
|
|
4507
|
+
return {
|
|
4508
|
+
traceId,
|
|
4509
|
+
parentSpanId
|
|
4510
|
+
};
|
|
4511
|
+
}
|
|
4512
|
+
/**
|
|
4513
|
+
* Read trace context from a process environment (defaults to `process.env`).
|
|
4514
|
+
* `TRACEPARENT` wins; the legacy `TRACE_ID` / `PARENT_SPAN_ID` pair is the fallback; with
|
|
4515
|
+
* neither present a fresh root is generated AND marked `unpropagated` — see {@link TraceContext}.
|
|
4457
4516
|
*/
|
|
4458
|
-
function readTraceContextFromEnv() {
|
|
4517
|
+
function readTraceContextFromEnv(env = process.env) {
|
|
4518
|
+
const fromTraceparent = parseTraceparent(env.TRACEPARENT);
|
|
4519
|
+
if (fromTraceparent) return fromTraceparent;
|
|
4520
|
+
if (env.TRACE_ID) return {
|
|
4521
|
+
traceId: env.TRACE_ID,
|
|
4522
|
+
...env.PARENT_SPAN_ID ? { parentSpanId: env.PARENT_SPAN_ID } : {}
|
|
4523
|
+
};
|
|
4459
4524
|
return {
|
|
4460
|
-
traceId:
|
|
4461
|
-
|
|
4525
|
+
traceId: generateTraceId(),
|
|
4526
|
+
unpropagated: true
|
|
4462
4527
|
};
|
|
4463
4528
|
}
|
|
4464
4529
|
/**
|
|
4465
4530
|
* Create a LoopTraceEmitter that:
|
|
4466
|
-
* 1. Parents all spans under the inherited
|
|
4531
|
+
* 1. Parents all spans under the inherited parent span id.
|
|
4467
4532
|
* 2. Exports spans to OTEL when OTEL_EXPORTER_OTLP_ENDPOINT is set.
|
|
4468
4533
|
*
|
|
4469
4534
|
* Returns both the emitter and the optional exporter handle for shutdown.
|
|
@@ -4480,7 +4545,13 @@ function createPropagatingTraceEmitter(ctx) {
|
|
|
4480
4545
|
if (event.kind === "loop.ended") {
|
|
4481
4546
|
const events = buffers.get(event.runId) ?? [event];
|
|
4482
4547
|
buffers.delete(event.runId);
|
|
4483
|
-
for (const span of buildLoopOtelSpans(events, ctx.traceId, ctx.parentSpanId)) exporter.exportSpan(
|
|
4548
|
+
for (const span of buildLoopOtelSpans(events, ctx.traceId, ctx.parentSpanId)) exporter.exportSpan(ctx.unpropagated === true ? {
|
|
4549
|
+
...span,
|
|
4550
|
+
attributes: [...span.attributes ?? [], {
|
|
4551
|
+
key: "tangle.trace.unpropagated",
|
|
4552
|
+
value: { boolValue: true }
|
|
4553
|
+
}]
|
|
4554
|
+
} : span);
|
|
4484
4555
|
}
|
|
4485
4556
|
} },
|
|
4486
4557
|
exporter,
|
|
@@ -4488,14 +4559,49 @@ function createPropagatingTraceEmitter(ctx) {
|
|
|
4488
4559
|
};
|
|
4489
4560
|
}
|
|
4490
4561
|
/**
|
|
4491
|
-
* Build env vars to pass to a child
|
|
4492
|
-
*
|
|
4562
|
+
* Build env vars to pass to a child subprocess so it inherits the current trace context.
|
|
4563
|
+
*
|
|
4564
|
+
* Writes BOTH conventions (see the module doc): `TRACEPARENT` carries the W3C-hex ids — mapped
|
|
4565
|
+
* through the exporter's own `padTraceId`/`padSpanId` (dashed hex passes through dash-stripped, a
|
|
4566
|
+
* human id is derived through the contract's `deriveHexId`), the SAME normalization every emitted
|
|
4567
|
+
* span uses, so both spellings and the parent's own spans all name ONE trace — and the legacy
|
|
4568
|
+
* pair carries the caller's ids verbatim. `TRACEPARENT` needs a parent span id by grammar; when
|
|
4569
|
+
* the context has none, the legacy pair still propagates the trace id alone.
|
|
4493
4570
|
*/
|
|
4494
4571
|
function traceContextToEnv(ctx) {
|
|
4495
4572
|
const env = { TRACE_ID: ctx.traceId };
|
|
4496
4573
|
if (ctx.parentSpanId) env.PARENT_SPAN_ID = ctx.parentSpanId;
|
|
4574
|
+
if (ctx.parentSpanId) env.TRACEPARENT = `00-${padTraceId(ctx.traceId)}-${padSpanId(ctx.parentSpanId)}-01`;
|
|
4497
4575
|
return env;
|
|
4498
4576
|
}
|
|
4577
|
+
/**
|
|
4578
|
+
* Merge a spawned child's environment from lowest to highest precedence — ambient env, the
|
|
4579
|
+
* recorder's stamped trace env, the caller's own overrides — while keeping the ONE cross-key
|
|
4580
|
+
* invariant a plain spread cannot: `TRACEPARENT` and the legacy pair must name the SAME trace.
|
|
4581
|
+
* A caller override that declares `TRACE_ID` / `PARENT_SPAN_ID` without its own `TRACEPARENT`
|
|
4582
|
+
* would otherwise keep the recorder's W3C wire — the child would join the caller's trace on the
|
|
4583
|
+
* legacy pair and the RECORDER's on the standard one. The dual-write is performed on the
|
|
4584
|
+
* caller's behalf: the merged `TRACEPARENT` is rebuilt from the merged legacy pair through the
|
|
4585
|
+
* same {@link traceContextToEnv} derivation (`deriveHexId` for human ids), or dropped when no
|
|
4586
|
+
* parent span id survives the merge (the W3C grammar requires one).
|
|
4587
|
+
*/
|
|
4588
|
+
function mergeTraceEnv(ambient, traceEnv, overrides) {
|
|
4589
|
+
const merged = {
|
|
4590
|
+
...ambient,
|
|
4591
|
+
...traceEnv,
|
|
4592
|
+
...overrides ?? {}
|
|
4593
|
+
};
|
|
4594
|
+
if (!(overrides !== void 0 && overrides.TRACEPARENT === void 0 && (overrides.TRACE_ID !== void 0 || overrides.PARENT_SPAN_ID !== void 0))) return merged;
|
|
4595
|
+
delete merged.TRACEPARENT;
|
|
4596
|
+
if (merged.TRACE_ID !== void 0) {
|
|
4597
|
+
const rewritten = traceContextToEnv({
|
|
4598
|
+
traceId: merged.TRACE_ID,
|
|
4599
|
+
...merged.PARENT_SPAN_ID !== void 0 ? { parentSpanId: merged.PARENT_SPAN_ID } : {}
|
|
4600
|
+
});
|
|
4601
|
+
if (rewritten.TRACEPARENT !== void 0) merged.TRACEPARENT = rewritten.TRACEPARENT;
|
|
4602
|
+
}
|
|
4603
|
+
return merged;
|
|
4604
|
+
}
|
|
4499
4605
|
function generateTraceId() {
|
|
4500
4606
|
const bytes = /* @__PURE__ */ new Uint8Array(16);
|
|
4501
4607
|
if (typeof globalThis.crypto?.getRandomValues === "function") globalThis.crypto.getRandomValues(bytes);
|
|
@@ -4513,11 +4619,13 @@ function generateTraceId() {
|
|
|
4513
4619
|
* parent's trace id and the spawning node's span id emits spans that JOIN the parent's trace, and
|
|
4514
4620
|
* the viewer assembles the whole cross-machine tree with no viewer change.
|
|
4515
4621
|
*
|
|
4516
|
-
*
|
|
4517
|
-
* `
|
|
4518
|
-
*
|
|
4519
|
-
*
|
|
4520
|
-
*
|
|
4622
|
+
* THE WIRE IS W3C `TRACEPARENT`, dual-written with the legacy pair. `traceContextToEnv`
|
|
4623
|
+
* (`src/mcp/trace-propagation.ts`) writes `TRACEPARENT` (the convention the ecosystem — OTel SDKs,
|
|
4624
|
+
* collectors, the Claude Code harness binary — reads at spawn) ALONGSIDE the bespoke
|
|
4625
|
+
* `TRACE_ID` / `PARENT_SPAN_ID` pair this package shipped first, and `readTraceContextFromEnv()`
|
|
4626
|
+
* reads `TRACEPARENT` first with the legacy pair as fallback. The bespoke pair is the fork, not
|
|
4627
|
+
* the standard; it is kept for one release so children on the previous package version still join,
|
|
4628
|
+
* then removed in the next major.
|
|
4521
4629
|
*
|
|
4522
4630
|
* WHICH SPAN. The stamped `PARENT_SPAN_ID` is the span of the node that DID the spawning — the
|
|
4523
4631
|
* scope's own `parentId` — not the span of the worker's own node. At depth 0 that is the run's root
|
|
@@ -4545,7 +4653,10 @@ function generateTraceId() {
|
|
|
4545
4653
|
* 2. the trace context stamped here,
|
|
4546
4654
|
* 3. the caller's own seam env (`CliSeam.env`).
|
|
4547
4655
|
* A caller who sets `TRACE_ID` / `PARENT_SPAN_ID` on a seam wins — theirs is a deliberate
|
|
4548
|
-
* declaration about the worker
|
|
4656
|
+
* declaration about the worker — and the W3C wire follows: a seam that overrides the legacy pair
|
|
4657
|
+
* without its own `TRACEPARENT` gets `TRACEPARENT` rebuilt from ITS ids (`mergeTraceEnv` performs
|
|
4658
|
+
* the dual-write on the caller's behalf), never left as the recorder's, so both spellings always
|
|
4659
|
+
* name the same trace. Ambient `process.env` does NOT win: when the supervisor process was
|
|
4549
4660
|
* itself launched as someone's worker, its inherited ids describe the SUPERVISOR's place in an
|
|
4550
4661
|
* outer trace, and reusing them for a child would file the child's spans under the wrong parent.
|
|
4551
4662
|
* The supported way to join that outer trace is `SupervisorSpanOptions.traceId` / `parentSpanId`
|
|
@@ -4566,6 +4677,23 @@ function generateTraceId() {
|
|
|
4566
4677
|
* - `provider` NO — `AgentEnvironmentProvider` has no environment field on its port.
|
|
4567
4678
|
*/
|
|
4568
4679
|
/**
|
|
4680
|
+
* The census above, as a value the compiler checks. `satisfies` against every `ExecutorConfig`
|
|
4681
|
+
* discriminant means an EIGHTH backend arm cannot be added without classifying it here — the prose
|
|
4682
|
+
* alone could go stale silently, which is the failure this table exists to prevent.
|
|
4683
|
+
*
|
|
4684
|
+
* `true` = the arm has a real environment channel to the worker and stamps the context.
|
|
4685
|
+
* `false` = it has none today; it is honestly unpropagated rather than silently dropping.
|
|
4686
|
+
*/
|
|
4687
|
+
const WORKER_TRACE_PROPAGATION = {
|
|
4688
|
+
cli: true,
|
|
4689
|
+
sandbox: true,
|
|
4690
|
+
router: false,
|
|
4691
|
+
"router-tools": false,
|
|
4692
|
+
bridge: false,
|
|
4693
|
+
"cli-worktree": false,
|
|
4694
|
+
provider: false
|
|
4695
|
+
};
|
|
4696
|
+
/**
|
|
4569
4697
|
* Seam key the `Scope` seeds a {@link TraceContext} under on each child's `ExecutorContext.seams`.
|
|
4570
4698
|
* Single-sourced here so the scope and every backend agree on it without a circular import — the
|
|
4571
4699
|
* same arrangement `nestedScopeSeamKey` uses.
|
|
@@ -4587,7 +4715,8 @@ function readWorkerTraceContext(ctx) {
|
|
|
4587
4715
|
};
|
|
4588
4716
|
}
|
|
4589
4717
|
/**
|
|
4590
|
-
* The
|
|
4718
|
+
* The trace env to merge into a worker's environment — `TRACEPARENT` plus the legacy
|
|
4719
|
+
* `TRACE_ID` / `PARENT_SPAN_ID` pair (dual-written for one release) — EMPTY when the run
|
|
4591
4720
|
* records no spans, which is what keeps the untraced path byte-identical. Merge it BELOW the
|
|
4592
4721
|
* caller's own seam env so a deliberately-set id wins (see the precedence note above).
|
|
4593
4722
|
*/
|
|
@@ -4657,6 +4786,7 @@ function makeNestedScopeSeam(args, liveWorkerCapacity, childNodeId, childBudget,
|
|
|
4657
4786
|
...args.now ? { now: args.now } : {},
|
|
4658
4787
|
...args.hooks ? { hooks: args.hooks } : {},
|
|
4659
4788
|
...args.workerTrace ? { workerTrace: args.workerTrace } : {},
|
|
4789
|
+
...args.workerTraceUnpropagated ? { workerTraceUnpropagated: args.workerTraceUnpropagated } : {},
|
|
4660
4790
|
...deferredOwner.ownerMaterialization === void 0 ? {} : { ownerMaterialization: deferredOwner.ownerMaterialization }
|
|
4661
4791
|
});
|
|
4662
4792
|
}
|
|
@@ -4917,6 +5047,17 @@ function createScope(args) {
|
|
|
4917
5047
|
...identity ? { identity } : {},
|
|
4918
5048
|
seq: ordinal,
|
|
4919
5049
|
at: new Date(now()).toISOString()
|
|
5050
|
+
}).then(async () => {
|
|
5051
|
+
if (args.workerTraceUnpropagated === void 0 || workerTrace === void 0) return;
|
|
5052
|
+
await args.journal.appendEvent(args.root, {
|
|
5053
|
+
kind: "trace-unpropagated",
|
|
5054
|
+
id,
|
|
5055
|
+
expectedTraceId: workerTrace.traceId,
|
|
5056
|
+
backend: args.workerTraceUnpropagated.backend,
|
|
5057
|
+
reason: args.workerTraceUnpropagated.reason,
|
|
5058
|
+
seq: ordinal,
|
|
5059
|
+
at: new Date(now()).toISOString()
|
|
5060
|
+
});
|
|
4920
5061
|
}).then(async () => {
|
|
4921
5062
|
const profileDigest = identity?.profileDigest ?? authoredProfileDigest(spec.profile);
|
|
4922
5063
|
let receipt;
|
|
@@ -6659,7 +6800,7 @@ function describeRejection(error) {
|
|
|
6659
6800
|
function createSupervisor() {
|
|
6660
6801
|
let attached;
|
|
6661
6802
|
async function run(root, task, opts) {
|
|
6662
|
-
const { budget, rootIdentity, rootMaterialization, runId, journal: journalStore, blobs: blobStore, executors: executorRegistry, probes, maxDepth, maxLiveWorkers, maxRestarts, withinMs, resume, now: suppliedNow, signal, hooks, workerTrace } = opts;
|
|
6803
|
+
const { budget, rootIdentity, rootMaterialization, runId, journal: journalStore, blobs: blobStore, executors: executorRegistry, probes, maxDepth, maxLiveWorkers, maxRestarts, withinMs, resume, now: suppliedNow, signal, hooks, workerTrace, workerTraceUnpropagated } = opts;
|
|
6663
6804
|
const input = detachedSnapshot({
|
|
6664
6805
|
task,
|
|
6665
6806
|
options: {
|
|
@@ -6683,7 +6824,8 @@ function createSupervisor() {
|
|
|
6683
6824
|
...suppliedNow === void 0 ? {} : { now: suppliedNow },
|
|
6684
6825
|
...signal === void 0 ? {} : { signal },
|
|
6685
6826
|
...hooks === void 0 ? {} : { hooks },
|
|
6686
|
-
...workerTrace === void 0 ? {} : { workerTrace }
|
|
6827
|
+
...workerTrace === void 0 ? {} : { workerTrace },
|
|
6828
|
+
...workerTraceUnpropagated === void 0 ? {} : { workerTraceUnpropagated }
|
|
6687
6829
|
});
|
|
6688
6830
|
task = input.task;
|
|
6689
6831
|
const rootAct = root.act.bind(root);
|
|
@@ -6790,6 +6932,7 @@ function createSupervisor() {
|
|
|
6790
6932
|
} } : {},
|
|
6791
6933
|
...opts.probes ? { probes: opts.probes } : {},
|
|
6792
6934
|
...opts.workerTrace ? { workerTrace: opts.workerTrace } : {},
|
|
6935
|
+
...opts.workerTraceUnpropagated ? { workerTraceUnpropagated: opts.workerTraceUnpropagated } : {},
|
|
6793
6936
|
...resumeFrom ? { resumeFrom } : {}
|
|
6794
6937
|
});
|
|
6795
6938
|
const openScope = scope;
|
|
@@ -7186,6 +7329,6 @@ function isNonEmptySpend(s) {
|
|
|
7186
7329
|
return s.iterations > 0 || s.tokens.input > 0 || s.tokens.output > 0 || s.usd > 0 || s.ms > 0 || s.tokensKnown === false || s.usdKnown === false;
|
|
7187
7330
|
}
|
|
7188
7331
|
//#endregion
|
|
7189
|
-
export {
|
|
7332
|
+
export { queueOf as $, flatOtelSpan as A, controlProfileMaterialization as At, sanitizeRuntimeStreamEvent as B, validateProfileMaterialization as Bt, INTELLIGENCE_WIRE_VERSION as C, runWorktreeHarness as Ct, createOpenInferenceFileExporter as D, removeWorktree as Dt, buildRuntimeEventOtelSpans as E, createWorktree as Et, toOtelAttributes as F, promptModelProfileMaterialization as Ft, validateWaitSpec as G, harnessSupportsReasoningEffort as Gt, isWaitOutcome as H, DEFAULT_LOCAL_HARNESS as Ht, createRuntimeEventCollector as I, promptOnlyProfileMaterialization as It, createActivityLog as J, runLocalHarness as Jt, waitUntil as K, localHarnessExecutable as Kt, createRuntimeStreamEventCollector as L, promptResourceProfileMaterialization as Lt, loopEventToOtelSpan as M, fullProfileMaterialization as Mt, padSpanId as N, profileMaterializationAxes as Nt, createOtelExporter as O, AGENT_PROFILE_MATERIALIZATION_AXES as Ot, padTraceId as P, promptControlProfileMaterialization as Pt, freeSlots as Q, sanitizeAgentRuntimeEvent as R, renderProfileMaterializationIssues as Rt, traceContextToEnv as S, runWorktreeChecks as St, buildLoopSpanNodes as T, captureWorktreeDiff as Tt, pollFor as U, LOCAL_HARNESSES as Ut, createWaitProbes as V, worktreeCliProfileMaterialization as Vt, timerAt as W, harnessInvocation as Wt, readWorkerProgress as X, describeToolArgs as Y, CodexExecutionDiagnosticError as Yt, effectiveConcurrency as Z, workerTraceEnv as _, routerChatWithUsage as _t, pickBestDelivered as a, assertValidBudget as at, mergeTraceEnv as b, runBrainLoop as bt, driverChild as c, attestRuntimeOwnedExecutor as ct, deriveNodeExecutionIdentity as d, newExecutionAttemptId as dt, rollingDispatch as et, recordScopeOwnerMaterialization as f, runtimeOwnedExecutorExecutionBinding as ft, readWorkerTraceContext as g, routerChatWithTools as gt, WORKER_TRACE_PROPAGATION as h, routerBrain as ht, collectDelivered as i, workerTokenFloor as it, generateSpanId as j, defineProfileMaterializationContract as jt, exportEvalRuns as k, assertProfileMaterialization as kt, withDriverExecutor as l, attestRuntimeOwnedScopeOwner as lt, settledToIteration as m, runtimeOwnedScopeOwnerRuntime as mt, createSupervisor as n, teardownExecutor as nt, runFinalizer as o, createBudgetPool as ot, scopeOwnerExecutorNodeContext as p, runtimeOwnedExecutorMaterialization as pt, DEFAULT_STALL_AFTER_MS as q, parseCodexTokenUsage as qt, bestDelivered as r, WORKER_TOKEN_FLOOR as rt, runTree as s, spendFromUsageEvents as st, createRootHandle as t, DEFAULT_SUCCESSFUL_SHUTDOWN_MS as tt, createScope as u, inheritRuntimeOwnedExecutorAttestation as ut, workerTraceSeamKey as v, routerToolLoop as vt, buildLoopOtelSpans as w, worktreeProfileExecutionPlan as wt, readTraceContextFromEnv as x, runSettledCommand as xt, createPropagatingTraceEmitter as y, streamRouterChatWithTools as yt, sanitizeKnowledgeReadinessReport as z, sandboxActProfileMaterialization as zt };
|
|
7190
7333
|
|
|
7191
|
-
//# sourceMappingURL=supervisor-
|
|
7334
|
+
//# sourceMappingURL=supervisor-DjZ82HIB.js.map
|