@tangle-network/agent-runtime 0.339.0 → 0.342.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-CVSFxis9.js → activation-CWPmt0Do.js} +4 -4
- package/dist/{activation-CVSFxis9.js.map → activation-CWPmt0Do.js.map} +1 -1
- package/dist/{activation-CJIIl_Ey.d.ts → activation-CXqtijue.d.ts} +2 -2
- package/dist/agent.d.ts +4 -18
- package/dist/agent.js +3 -21
- package/dist/agent.js.map +1 -1
- package/dist/analyst-loop.d.ts +2 -2
- package/dist/{bundle-DVOhBTic.js → bundle-Cwpit6Tg.js} +2 -2
- package/dist/{bundle-DVOhBTic.js.map → bundle-Cwpit6Tg.js.map} +1 -1
- package/dist/candidate-execution/index.d.ts +2 -40
- package/dist/candidate-execution/index.js +9 -255
- package/dist/candidate-execution/index.js.map +1 -1
- package/dist/{driver-control-acknowledgers-C53ggdJ6.js → coordination-manager-B5JsolDR.js} +4852 -4539
- package/dist/coordination-manager-B5JsolDR.js.map +1 -0
- package/dist/{delegate-CCWE_AkU.js → delegate-Rl-5paLJ.js} +2 -2
- package/dist/{delegate-CCWE_AkU.js.map → delegate-Rl-5paLJ.js.map} +1 -1
- package/dist/durable.d.ts +1 -1
- package/dist/durable.js +451 -358
- package/dist/durable.js.map +1 -1
- package/dist/{graph-CI9JXKqO.js → graph-Ce-59ZXn.js} +5 -5
- package/dist/{graph-CI9JXKqO.js.map → graph-Ce-59ZXn.js.map} +1 -1
- package/dist/{improve-BOXTLWJ3.js → improve-BZXt2qM0.js} +837 -704
- package/dist/improve-BZXt2qM0.js.map +1 -0
- package/dist/{improvement-adapter-HUt_-cWA.d.ts → improvement-adapter-sIthWkcN.d.ts} +2 -2
- package/dist/index.d.ts +6 -14
- package/dist/index.js +10 -10
- package/dist/intelligence.d.ts +4 -4
- package/dist/intelligence.js +205 -191
- package/dist/intelligence.js.map +1 -1
- package/dist/kernel.d.ts +3 -3
- package/dist/kernel.js +10 -10
- package/dist/{loop-runner-pmPIHFVY.js → loop-runner-B0MV1-CD.js} +2 -2
- package/dist/{loop-runner-pmPIHFVY.js.map → loop-runner-B0MV1-CD.js.map} +1 -1
- package/dist/{loop-runner-CWzG1bH4.d.ts → loop-runner-CuhbgVGo.d.ts} +3 -3
- package/dist/loop-runner-bin.d.ts +1 -1
- package/dist/loop-runner-bin.js +1 -1
- package/dist/mcp/bin.js +3 -3
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +5 -5
- package/dist/placement.d.ts +2 -26
- package/dist/placement.js +1 -35
- package/dist/placement.js.map +1 -1
- package/dist/{prepare-bXkvPMJA.js → prepare-C-cWCyt3.js} +988 -735
- package/dist/prepare-C-cWCyt3.js.map +1 -0
- package/dist/{profile-Dpei_Sq0.js → profile-CbMw5hAn.js} +2 -2
- package/dist/{profile-Dpei_Sq0.js.map → profile-CbMw5hAn.js.map} +1 -1
- package/dist/profile-materialization-bPm0gGLO.d.ts +49 -0
- package/dist/profiles.d.ts +1 -1
- package/dist/{protected-model-port-BGgpy2r9.d.ts → protected-model-port-DVVh-hEk.d.ts} +2 -6
- package/dist/{provision-supervisor-CJ6Zz6dz.js → provision-supervisor-DL6gEMQp.js} +444 -419
- package/dist/provision-supervisor-DL6gEMQp.js.map +1 -0
- package/dist/{runtime-B2fjL9Oi.js → runtime-eghmj6W4.js} +1245 -1028
- package/dist/runtime-eghmj6W4.js.map +1 -0
- package/dist/{sandbox-profile-compat-BzVBFqrz.js → sandbox-profile-compat-FN2kab2-.js} +72 -72
- package/dist/{sandbox-profile-compat-BzVBFqrz.js.map → sandbox-profile-compat-FN2kab2-.js.map} +1 -1
- package/dist/{search-executor-zMumiak_.js → search-executor-rbjdZ3OD.js} +3 -3
- package/dist/{search-executor-zMumiak_.js.map → search-executor-rbjdZ3OD.js.map} +1 -1
- package/dist/{server-_4voDNrl.js → server-BiK1Kcno.js} +4 -4
- package/dist/{server-_4voDNrl.js.map → server-BiK1Kcno.js.map} +1 -1
- package/dist/{structural-rollout-DpLCXzaL.js → structural-rollout-BD9IN7K_.js} +3 -3
- package/dist/{structural-rollout-DpLCXzaL.js.map → structural-rollout-BD9IN7K_.js.map} +1 -1
- package/dist/{supervise-qAwXmPtD.js → supervise-DmOi7gll.js} +6525 -5562
- package/dist/supervise-DmOi7gll.js.map +1 -0
- package/dist/{supervisor-DHrUJhEZ.js → supervisor-DUWcecAd.js} +13717 -12778
- package/dist/supervisor-DUWcecAd.js.map +1 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +13 -13
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +1 -1
- package/dist/{types-CaOXqRTq.d.ts → types-Cgs89PQd.d.ts} +315 -409
- package/dist/{types-zWfqDjeL.d.ts → types-Cwrea-bU.d.ts} +2 -17
- package/dist/workspace-store/index.d.ts +1 -82
- package/dist/workspace-store/index.js +274 -680
- package/dist/workspace-store/index.js.map +1 -1
- package/package.json +8 -8
- package/dist/driver-control-acknowledgers-C53ggdJ6.js.map +0 -1
- package/dist/improve-BOXTLWJ3.js.map +0 -1
- package/dist/prepare-bXkvPMJA.js.map +0 -1
- package/dist/profile-materialization-B1wm2SPT.d.ts +0 -94
- package/dist/provision-supervisor-CJ6Zz6dz.js.map +0 -1
- package/dist/runtime-B2fjL9Oi.js.map +0 -1
- package/dist/supervise-qAwXmPtD.js.map +0 -1
- package/dist/supervisor-DHrUJhEZ.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as ImprovementProposalSource } from "./types-Cwrea-bU.js";
|
|
2
2
|
import { AnalystFinding, FindingSubject } from "@tangle-network/agent-eval";
|
|
3
3
|
//#region src/agent/surfaces.d.ts
|
|
4
4
|
/**
|
|
@@ -145,4 +145,4 @@ interface DraftPatchOutput {
|
|
|
145
145
|
declare function createSurfaceImprovementProposer(opts: CreateSurfaceImprovementProposerOptions): ImprovementProposalSource<SurfaceImprovementEdit>;
|
|
146
146
|
//#endregion
|
|
147
147
|
export { createSurfaceImprovementProposer as a, SurfaceValidationIssue as c, SurfaceImprovementEdit as i, renderSurfaceIssues as l, DraftPatchInput as n, AgentSurfaces as o, DraftPatchOutput as r, ResolvedSurface as s, CreateSurfaceImprovementProposerOptions as t, validateSurfaces as u };
|
|
148
|
-
//# sourceMappingURL=improvement-adapter-
|
|
148
|
+
//# sourceMappingURL=improvement-adapter-sIthWkcN.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { A_ as
|
|
1
|
+
import { A_ as OtelSpan, B_ as RuntimeTelemetryOptions, C as RuntimeFailureCause, D_ as OtelExportConfig, E_ as OtelAttribute, F_ as padTraceId, G_ as sanitizeKnowledgeReadinessReport, H_ as SanitizedKnowledgeRequirement, I_ as RuntimeEventCollector, Kl as IsolatedCheckResult, L_ as RuntimeStreamEventCollector, M as Budget, M_ as createOtelExporter, N_ as loopEventToOtelSpan, O_ as OtelExportStats, P_ as padSpanId, Qy as Redactor, R_ as RuntimeStreamEventSink, S as RuntimeStreamEvent, T as RuntimeFailureOwner, U_ as createRuntimeEventCollector, V_ as SanitizedKnowledgeReadinessReport, W_ as createRuntimeStreamEventCollector, Wl as IsolatedCheckBoxEvidence, _ as RunAgentTaskOptions, a as AgentKnowledgeProvider, ab as NotFoundError, b as RuntimeSession, c as AgentTaskContext, cd as SuperviseOptions, d as AgentTaskStatus, dS as RuntimeRunHandle, eb as AgentEvalError, fS as RuntimeRunOptions, g as OpenAIChatToolChoice, gS as startRuntimeRun, h as OpenAIChatTool, hS as RuntimeRunStatus, i as AgentExecutionBackend, ib as JudgeError, it as SupervisedResult, j_ as buildLoopOtelSpans, jp as ExecutorConfig, k_ as OtelExporter, l as AgentTaskRunResult, lS as RuntimeRunCompleteInput, lb as ExecutorFactory, m as OpenAIChatResponseFormat, mS as RuntimeRunRow, n as AgentBackendContext, nb as BackendTransportError, o as AgentRuntimeEvent, ob as ValidationError, p as KnowledgeReadinessDecision, pS as RuntimeRunPersistenceAdapter, r as AgentBackendInput, rb as ConfigError, s as AgentRuntimeEventSink, t as AgentAdapter, tb as AgentEvalErrorCode, u as AgentTaskSpec, uS as RuntimeRunCost, v as RunAgentTaskStreamOptions, w as RuntimeFailureCode, x as RuntimeSessionStore, y as RuntimeCanonicalStreamEvent, yf as SupervisorProfile, z_ as RuntimeStreamEventSummary } from "./types-Cgs89PQd.js";
|
|
2
2
|
import { a as RuntimeHookErrorContext, c as RuntimeHookTarget, d as defineRuntimeHooks, i as RuntimeHookContext, l as RuntimeHooks, o as RuntimeHookEvent, s as RuntimeHookPhase, u as composeRuntimeHooks } from "./runtime-hooks-nsqxSUFL.js";
|
|
3
3
|
import { N as AgentCandidateOutputArtifactPort } from "./workspace-streams-BiS4ABah.js";
|
|
4
|
-
import {
|
|
5
|
-
import { i as SurfaceImprovementEdit } from "./improvement-adapter-
|
|
6
|
-
import { $ as ImproveCodeBaseOptions, $t as CandidateGenerator, At as SearchPromotion, B as DecideSearchImprovementOptions, Bt as sharedBoxLane, Ct as ImproveSearchOptions, Dt as ImprovementCodeCandidate, Et as ImproveSurface, Ft as SearchLaneOptions, G as ImproveTrainingOptions, Gt as AgenticGeneratorOptions, H as decideSearchImprovement, Ht as DeepReadonly, It as SearchTraceOptions, J as ProfileTrainerRequest, Jt as AgenticGeneratorShotReceipt, K as ImproveTrainingResult, Kt as AgenticGeneratorShotDisposition, L as improve, Lt as SharedBoxSearchLane, Mt as SearchEnvironmentFault, Nt as SearchLane, Ot as ImprovementProfileCandidate, Pt as SearchLaneKind, Q as ImproveCandidateValidator, Qt as commandVerifier, R as SearchMethodOptions, Rt as dedicatedLane, St as ImproveSearchMethod, Tt as ImproveSkillsOptions, U as CheckpointServingPort, Ut as ReadonlyAgentProfile, V as SearchImprovementDecision, Vt as subscriptionLane, W as ControlledTrainingCommand, Wt as AgenticGeneratorExecutorForWorktree, X as createCommandProfileTrainer, Xt as VerifyResult, Y as TrainingBoundaryResult, Yt as Verifier, Z as ImproveCandidateValidationInput, Zt as agenticGenerator, at as ImproveLineage, bt as ImproveSearchAgent, ct as ImproveMethodLineage, dt as ImproveMethodSource, et as ImproveCodeOptions, ft as ImproveOptimizationRunOptions, gt as ImproveProfileSurface, ht as ImproveProfileComponents, i as AgentImprovementActivationTransition, it as ImproveCustomCodeGeneratorOptions, jt as SearchCellContext, kt as SearchDispatchContext, lt as ImproveMethodOptions, mt as ImproveProfileAgent, n as AgentImprovementActivationResultStore, nt as ImproveCodeRunOptions, ot as ImproveMethodContext, q as ProfileTrainer, qt as AgenticGeneratorShotExecution, rt as ImproveCost, st as ImproveMethodFactory, t as AgentImprovementActivationReconciliation, tt as ImproveCodeResult, ut as ImproveMethodResult, vt as ImproveRuntimeCodeGeneratorOptions, wt as ImproveSearchResult, xt as ImproveSearchIdentity, yt as ImproveScenarioPartitions, z as searchMethod, zt as routerLane } from "./activation-
|
|
7
|
-
import { i as auditLoopRunner, r as DelegatedLoopRunner } from "./loop-runner-
|
|
4
|
+
import { a as ImprovementProposalSource } from "./types-Cwrea-bU.js";
|
|
5
|
+
import { i as SurfaceImprovementEdit } from "./improvement-adapter-sIthWkcN.js";
|
|
6
|
+
import { $ as ImproveCodeBaseOptions, $t as CandidateGenerator, At as SearchPromotion, B as DecideSearchImprovementOptions, Bt as sharedBoxLane, Ct as ImproveSearchOptions, Dt as ImprovementCodeCandidate, Et as ImproveSurface, Ft as SearchLaneOptions, G as ImproveTrainingOptions, Gt as AgenticGeneratorOptions, H as decideSearchImprovement, Ht as DeepReadonly, It as SearchTraceOptions, J as ProfileTrainerRequest, Jt as AgenticGeneratorShotReceipt, K as ImproveTrainingResult, Kt as AgenticGeneratorShotDisposition, L as improve, Lt as SharedBoxSearchLane, Mt as SearchEnvironmentFault, Nt as SearchLane, Ot as ImprovementProfileCandidate, Pt as SearchLaneKind, Q as ImproveCandidateValidator, Qt as commandVerifier, R as SearchMethodOptions, Rt as dedicatedLane, St as ImproveSearchMethod, Tt as ImproveSkillsOptions, U as CheckpointServingPort, Ut as ReadonlyAgentProfile, V as SearchImprovementDecision, Vt as subscriptionLane, W as ControlledTrainingCommand, Wt as AgenticGeneratorExecutorForWorktree, X as createCommandProfileTrainer, Xt as VerifyResult, Y as TrainingBoundaryResult, Yt as Verifier, Z as ImproveCandidateValidationInput, Zt as agenticGenerator, at as ImproveLineage, bt as ImproveSearchAgent, ct as ImproveMethodLineage, dt as ImproveMethodSource, et as ImproveCodeOptions, ft as ImproveOptimizationRunOptions, gt as ImproveProfileSurface, ht as ImproveProfileComponents, i as AgentImprovementActivationTransition, it as ImproveCustomCodeGeneratorOptions, jt as SearchCellContext, kt as SearchDispatchContext, lt as ImproveMethodOptions, mt as ImproveProfileAgent, n as AgentImprovementActivationResultStore, nt as ImproveCodeRunOptions, ot as ImproveMethodContext, q as ProfileTrainer, qt as AgenticGeneratorShotExecution, rt as ImproveCost, st as ImproveMethodFactory, t as AgentImprovementActivationReconciliation, tt as ImproveCodeResult, ut as ImproveMethodResult, vt as ImproveRuntimeCodeGeneratorOptions, wt as ImproveSearchResult, xt as ImproveSearchIdentity, yt as ImproveScenarioPartitions, z as searchMethod, zt as routerLane } from "./activation-CXqtijue.js";
|
|
7
|
+
import { i as auditLoopRunner, r as DelegatedLoopRunner } from "./loop-runner-CuhbgVGo.js";
|
|
8
8
|
import { AgentCandidateBundle, AgentCandidateCapturedArtifact, AgentCandidateKnowledge, AgentProfile, Sha256Digest } from "@tangle-network/agent-interface";
|
|
9
9
|
import { AgentProfile as AgentProfile$1, ControlBudget, ControlDecision, ControlEvalResult, ControlEvalResult as ControlEvalResult$1, ControlRunResult, ControlStep, CustomTokenPricing, DataAcquisitionPlan, KnowledgeReadinessReport, KnowledgeReadinessReport as KnowledgeReadinessReport$1, KnowledgeRequirement, MaximumCharge, ProposalFinding, RunRecord, RunRecord as RunRecord$1 } from "@tangle-network/agent-eval";
|
|
10
10
|
import { ZodType } from "zod";
|
|
@@ -830,14 +830,6 @@ declare function decideKnowledgeReadiness(report: KnowledgeReadinessReport$1, op
|
|
|
830
830
|
}): KnowledgeReadinessDecision;
|
|
831
831
|
//#endregion
|
|
832
832
|
//#region src/run.d.ts
|
|
833
|
-
/** Stamp cross-cutting defaults onto adapter-projected RunRecords without
|
|
834
|
-
* overriding anything the adapter set explicitly:
|
|
835
|
-
* - `scenarioId` — the run's scenario, when the record omits one.
|
|
836
|
-
* - `failureClass` — the control layer's failure classification promoted
|
|
837
|
-
* onto the canonical cross-agent key, but ONLY when it's a real taxonomy
|
|
838
|
-
* class. This is what lets the substrate aggregate failures across every
|
|
839
|
-
* agent in one vocabulary instead of per-agent ad-hoc strings. */
|
|
840
|
-
declare function applyRunRecordDefaults(records: RunRecord$1[], scenarioId: string, controlFailureClass: string | undefined): RunRecord$1[];
|
|
841
833
|
/**
|
|
842
834
|
* Single-shot task lifecycle for adapter-driven tasks: readiness-gated, emits the runtime lifecycle event vocabulary, session-store pluggable.
|
|
843
835
|
*
|
|
@@ -880,5 +872,5 @@ declare function readinessServerSentEvent(report: KnowledgeReadinessReport$1, op
|
|
|
880
872
|
/** Serialize a `RuntimeStreamEvent` as a Server-Sent Event string. @stable */
|
|
881
873
|
declare function runtimeStreamServerSentEvent(event: RuntimeStreamEvent, options?: RuntimeTelemetryOptions & ServerSentEventOptions): string;
|
|
882
874
|
//#endregion
|
|
883
|
-
export { type AgentAdapter, type AgentBackendContext, type AgentBackendInput, AgentEvalError, type AgentEvalErrorCode, type AgentExecutionBackend, type AgentImprovementActivationReconciliation, type AgentImprovementActivationResultStore, type AgentImprovementActivationTransition, type AgentKnowledgeProvider, type AgentRuntimeEvent, type AgentRuntimeEventSink, type AgentTaskContext, type AgentTaskRunResult, type AgentTaskSpec, type AgentTaskStatus, type AgenticGeneratorExecutorForWorktree, type AgenticGeneratorOptions, type AgenticGeneratorShotDisposition, type AgenticGeneratorShotExecution, type AgenticGeneratorShotReceipt, type AuthSource, type BackendCallPolicy, BackendTransportError, type CandidateGenerator, type ChatModelCandidate, type ChatModelValidation, type CheckpointServingPort, type CircuitBreakerConfig, ConfigError, type ControlBudget, type ControlDecision, type ControlEvalResult, type ControlRunResult, type ControlStep, type ControlledTrainingCommand, type Conversation, type ConversationDriveState, type ConversationParticipant, type ConversationPolicy, type ConversationResult, type ConversationStreamEvent, type ConversationTurn, type CreateKnowledgeImprovementActivationExecutorOptions, type CreateProfileImprovementHarnessOptions, DEFAULT_ROUTER_BASE_URL, type DataAcquisitionPlan, type DecideSearchImprovementOptions, type DeepReadonly, type DelegatedLoopRunner, type HaltContext, type HaltPredicate, type HaltReason, type HaltSignal, type ImproveCandidateValidationInput, type ImproveCandidateValidator, type ImproveCodeBaseOptions, type ImproveCodeOptions, type ImproveCodeResult, type ImproveCodeRunOptions, type ImproveCost, type ImproveCustomCodeGeneratorOptions, type ImproveLineage, type ImproveMethodContext, type ImproveMethodFactory, type ImproveMethodLineage, type ImproveMethodOptions, type ImproveMethodResult, type ImproveMethodSource, type ImproveOptimizationRunOptions, type ImproveProfileAgent, type ImproveProfileComponents, type ImproveProfileSurface, type ImproveRuntimeCodeGeneratorOptions, type ImproveScenarioPartitions, type ImproveSearchAgent, type ImproveSearchIdentity, type ImproveSearchMethod, type ImproveSearchOptions, type ImproveSearchResult, type ImproveSkillsOptions, type ImproveSurface, type ImproveTrainingOptions, type ImproveTrainingResult, type ImprovementCodeCandidate, type ImprovementProfileCandidate, InMemoryRuntimeSessionStore, JudgeError, type KnowledgeImprovementActivationExecutor, type KnowledgeImprovementCandidatePair, type KnowledgeImprovementExperimentBundles, type KnowledgeImprovementJobMeasurement, type KnowledgeImprovementJobResult, type KnowledgeReadinessCheck, type KnowledgeReadinessCheckInput, type KnowledgeReadinessCheckResult, type KnowledgeReadinessDecision, type KnowledgeReadinessReport, type KnowledgeRequirement, type ModelInfo, NotFoundError, type OfficialGepaOptions, type OfficialOptimizerContextOptions, type OfficialSensitiveCandidateInput, type OfficialSkillOptOptions, type OpenAIChatResponseFormat, type OpenAIChatTool, type OpenAIChatToolChoice, type OtelAttribute, type OtelExportConfig, type OtelExportStats, type OtelExporter, type OtelSpan, type PersonaConversationResult, type PersonaDriver, type ProfileImprovementHarness, type ProfileImprovementHarnessRunOptions, type ProfileImprovementHarnessTrainOptions, type ProfileTrainer, type ProfileTrainerRequest, ROUTER_PRICE_SOURCE, type ReadonlyAgentProfile, type ReflectiveGeneratorOptions, type ReflectiveProfileProposerOptions, type ReflectiveProposerChat, type ReflectiveProposerParent, type ReflectiveProposerReply, type ResolvedChatModel, type RetryBackoff, type RetryableErrorPredicate, type RouterEnv, type RunAgentTaskOptions, type RunAgentTaskStreamOptions, type RunConversationOptions, type RunKnowledgeImprovementJobOptions, type RunPersonaConfig, type RunPersonaConversationOptions, type RunRecord, type RuntimeCanonicalStreamEvent, type RuntimeEventCollector, type RuntimeFailureCause, type RuntimeFailureCode, type RuntimeFailureOwner, type RuntimeHookContext, type RuntimeHookErrorContext, type RuntimeHookEvent, type RuntimeHookPhase, type RuntimeHookTarget, type RuntimeHooks, type RuntimeRunCompleteInput, type RuntimeRunCost, type RuntimeRunHandle, type RuntimeRunOptions, type RuntimeRunPersistenceAdapter, type RuntimeRunRow,
|
|
875
|
+
export { type AgentAdapter, type AgentBackendContext, type AgentBackendInput, AgentEvalError, type AgentEvalErrorCode, type AgentExecutionBackend, type AgentImprovementActivationReconciliation, type AgentImprovementActivationResultStore, type AgentImprovementActivationTransition, type AgentKnowledgeProvider, type AgentRuntimeEvent, type AgentRuntimeEventSink, type AgentTaskContext, type AgentTaskRunResult, type AgentTaskSpec, type AgentTaskStatus, type AgenticGeneratorExecutorForWorktree, type AgenticGeneratorOptions, type AgenticGeneratorShotDisposition, type AgenticGeneratorShotExecution, type AgenticGeneratorShotReceipt, type AuthSource, type BackendCallPolicy, BackendTransportError, type CandidateGenerator, type ChatModelCandidate, type ChatModelValidation, type CheckpointServingPort, type CircuitBreakerConfig, ConfigError, type ControlBudget, type ControlDecision, type ControlEvalResult, type ControlRunResult, type ControlStep, type ControlledTrainingCommand, type Conversation, type ConversationDriveState, type ConversationParticipant, type ConversationPolicy, type ConversationResult, type ConversationStreamEvent, type ConversationTurn, type CreateKnowledgeImprovementActivationExecutorOptions, type CreateProfileImprovementHarnessOptions, DEFAULT_ROUTER_BASE_URL, type DataAcquisitionPlan, type DecideSearchImprovementOptions, type DeepReadonly, type DelegatedLoopRunner, type HaltContext, type HaltPredicate, type HaltReason, type HaltSignal, type ImproveCandidateValidationInput, type ImproveCandidateValidator, type ImproveCodeBaseOptions, type ImproveCodeOptions, type ImproveCodeResult, type ImproveCodeRunOptions, type ImproveCost, type ImproveCustomCodeGeneratorOptions, type ImproveLineage, type ImproveMethodContext, type ImproveMethodFactory, type ImproveMethodLineage, type ImproveMethodOptions, type ImproveMethodResult, type ImproveMethodSource, type ImproveOptimizationRunOptions, type ImproveProfileAgent, type ImproveProfileComponents, type ImproveProfileSurface, type ImproveRuntimeCodeGeneratorOptions, type ImproveScenarioPartitions, type ImproveSearchAgent, type ImproveSearchIdentity, type ImproveSearchMethod, type ImproveSearchOptions, type ImproveSearchResult, type ImproveSkillsOptions, type ImproveSurface, type ImproveTrainingOptions, type ImproveTrainingResult, type ImprovementCodeCandidate, type ImprovementProfileCandidate, InMemoryRuntimeSessionStore, JudgeError, type KnowledgeImprovementActivationExecutor, type KnowledgeImprovementCandidatePair, type KnowledgeImprovementExperimentBundles, type KnowledgeImprovementJobMeasurement, type KnowledgeImprovementJobResult, type KnowledgeReadinessCheck, type KnowledgeReadinessCheckInput, type KnowledgeReadinessCheckResult, type KnowledgeReadinessDecision, type KnowledgeReadinessReport, type KnowledgeRequirement, type ModelInfo, NotFoundError, type OfficialGepaOptions, type OfficialOptimizerContextOptions, type OfficialSensitiveCandidateInput, type OfficialSkillOptOptions, type OpenAIChatResponseFormat, type OpenAIChatTool, type OpenAIChatToolChoice, type OtelAttribute, type OtelExportConfig, type OtelExportStats, type OtelExporter, type OtelSpan, type PersonaConversationResult, type PersonaDriver, type ProfileImprovementHarness, type ProfileImprovementHarnessRunOptions, type ProfileImprovementHarnessTrainOptions, type ProfileTrainer, type ProfileTrainerRequest, ROUTER_PRICE_SOURCE, type ReadonlyAgentProfile, type ReflectiveGeneratorOptions, type ReflectiveProfileProposerOptions, type ReflectiveProposerChat, type ReflectiveProposerParent, type ReflectiveProposerReply, type ResolvedChatModel, type RetryBackoff, type RetryableErrorPredicate, type RouterEnv, type RunAgentTaskOptions, type RunAgentTaskStreamOptions, type RunConversationOptions, type RunKnowledgeImprovementJobOptions, type RunPersonaConfig, type RunPersonaConversationOptions, type RunRecord, type RuntimeCanonicalStreamEvent, type RuntimeEventCollector, type RuntimeFailureCause, type RuntimeFailureCode, type RuntimeFailureOwner, type RuntimeHookContext, type RuntimeHookErrorContext, type RuntimeHookEvent, type RuntimeHookPhase, type RuntimeHookTarget, type RuntimeHooks, type RuntimeRunCompleteInput, type RuntimeRunCost, type RuntimeRunHandle, type RuntimeRunOptions, type RuntimeRunPersistenceAdapter, type RuntimeRunRow, type RuntimeRunStatus, type RuntimeSession, type RuntimeSessionStore, type RuntimeStreamEvent, type RuntimeStreamEventCollector, type RuntimeStreamEventSink, type RuntimeStreamEventSummary, type RuntimeTelemetryOptions, type SanitizedKnowledgeReadinessReport, type SanitizedKnowledgeRequirement, type SearchCellContext, type SearchDispatchContext, SearchEnvironmentFault, type SearchImprovementDecision, type SearchLane, type SearchLaneKind, type SearchLaneOptions, type SearchMethodOptions, type SearchPromotion, type SearchTraceOptions, type ServerSentEventOptions, type SharedBoxSearchLane, type TokenWork, type TrainingBoundaryResult, type TurnOrder, ValidationError, type Verifier, type VerifyResult, agenticGenerator, auditLoopRunner, buildKnowledgeImprovementExperimentBundles, buildLoopOtelSpans, cleanModelId, commandVerifier, composeRuntimeHooks, createCommandProfileTrainer, createConversationBackend, createIterableBackend, createKnowledgeImprovementActivationExecutor, createOtelExporter, createProfileExecutionBackend, createProfileImprovementHarness, createRuntimeEventCollector, createRuntimeStreamEventCollector, createSandboxPromptBackend, decideKnowledgeReadiness, decideSearchImprovement, dedicatedLane, defineRuntimeHooks, getModels, improve, isolatedCheckBoxEvidenceSchema, isolatedCheckResultSchema, loopEventToOtelSpan, officialGepa, officialSkillOpt, optimizerMethod, padSpanId, padTraceId, priceTokens, readinessServerSentEvent, reflectiveGenerator, reflectiveProfileProposer, resolveChatModel, resolveRouterBaseUrl, routerLane, runAgentTask, runAgentTaskStream, runConversation, runConversationStream, runKnowledgeImprovementJob, runPersonaConversation, runPersonaDispatch, runtimeStreamServerSentEvent, sanitizeKnowledgeReadinessReport, searchMethod, sharedBoxLane, startRuntimeRun, subscriptionLane, validateChatModelId };
|
|
884
876
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ji as providerMessageText, Mi as defaultRedactorIdentityMaterial, Ni as resolveRedactor, _n as sanitizeKnowledgeReadinessReport, ci as runtimeFailureCause, cn as createOtelExporter, cr as priceTokens, dn as loopEventToOtelSpan, fn as padSpanId, gn as createRuntimeStreamEventCollector, hn as createRuntimeEventCollector, ii as executableAgentProfileSnapshot, in as buildLoopOtelSpans, lr as ROUTER_PRICE_SOURCE, pn as padTraceId, vn as sanitizeRuntimeStreamEvent } from "./supervisor-DUWcecAd.js";
|
|
2
2
|
import { a as JudgeError, f as RuntimeRunStateError, i as ConfigError, m as ValidationError, o as NotFoundError, r as BackendTransportError, t as AgentEvalError } from "./errors-DodWX-cb.js";
|
|
3
|
-
import { B as InMemoryRuntimeSessionStore, C as optimizerMethod, H as nowIso, I as streamAgentTurn, L as createIterableBackend, R as createSandboxPromptBackend, U as startOrResumeRuntimeSession, V as newRuntimeSession, W as touchSession, z as normalizeBackendStreamEvent } from "./structural-rollout-
|
|
4
|
-
import {
|
|
3
|
+
import { B as InMemoryRuntimeSessionStore, C as optimizerMethod, H as nowIso, I as streamAgentTurn, L as createIterableBackend, R as createSandboxPromptBackend, U as startOrResumeRuntimeSession, V as newRuntimeSession, W as touchSession, z as normalizeBackendStreamEvent } from "./structural-rollout-BD9IN7K_.js";
|
|
4
|
+
import { L as embeddedCandidateArtifact, N as canonicalCandidateBytes$1, P as canonicalCandidateDigest$1, R as immutableCandidateValue, b as persistCandidateOutputArtifact, l as captureAgentCandidateWorkspace, ot as sleep, z as omitTopLevelDigest } from "./sandbox-profile-compat-FN2kab2-.js";
|
|
5
5
|
import { t as assertExecutableAgentProfile } from "./model-policy-CyCUwHed.js";
|
|
6
|
-
import { c as withMethodRuntimeControls, d as commandVerifier, f as addRuntimeUsage, i as assertCandidateValidator, m as isUsageAmount, n as createCommandProfileTrainer, o as parseExecutionRef, p as createRuntimeUsageTotals, r as searchMethod, s as privateValuePaths, t as improve, u as agenticGenerator } from "./improve-
|
|
6
|
+
import { c as withMethodRuntimeControls, d as commandVerifier, f as addRuntimeUsage, i as assertCandidateValidator, m as isUsageAmount, n as createCommandProfileTrainer, o as parseExecutionRef, p as createRuntimeUsageTotals, r as searchMethod, s as privateValuePaths, t as improve, u as agenticGenerator } from "./improve-BZXt2qM0.js";
|
|
7
7
|
import { n as defineRuntimeHooks, t as composeRuntimeHooks } from "./runtime-hooks-tXpAarhW.js";
|
|
8
|
-
import { t as supervise } from "./supervise-
|
|
9
|
-
import { n as createAgentImprovementActivationResult } from "./activation-
|
|
10
|
-
import { l as sharedBoxLane, o as routerLane, r as dedicatedLane, t as SearchEnvironmentFault, u as subscriptionLane, y as decideSearchImprovement } from "./search-executor-
|
|
11
|
-
import { t as sealAgentCandidateBundle } from "./bundle-
|
|
12
|
-
import { n as auditLoopRunner } from "./loop-runner-
|
|
8
|
+
import { t as supervise } from "./supervise-DmOi7gll.js";
|
|
9
|
+
import { n as createAgentImprovementActivationResult } from "./activation-CWPmt0Do.js";
|
|
10
|
+
import { l as sharedBoxLane, o as routerLane, r as dedicatedLane, t as SearchEnvironmentFault, u as subscriptionLane, y as decideSearchImprovement } from "./search-executor-rbjdZ3OD.js";
|
|
11
|
+
import { t as sealAgentCandidateBundle } from "./bundle-Cwpit6Tg.js";
|
|
12
|
+
import { n as auditLoopRunner } from "./loop-runner-B0MV1-CD.js";
|
|
13
13
|
import { agentCandidateKnowledgeSchema, agentCandidateWorkspaceManifestMaterialSchema, agentProfileSchema, canonicalAgentProfileDigest, canonicalCandidateDigest, sha256DigestSchema } from "@tangle-network/agent-interface";
|
|
14
14
|
import { FAILURE_CLASSES, acquisitionPlansForKnowledgeGaps, blockingKnowledgeEval, canonicalJson, runAgentControlLoop, scoreKnowledgeReadiness, userQuestionsForKnowledgeGaps } from "@tangle-network/agent-eval";
|
|
15
15
|
import { z } from "zod";
|
|
@@ -2875,6 +2875,6 @@ function stripNewlines(value) {
|
|
|
2875
2875
|
return value.replace(/[\r\n]/g, " ");
|
|
2876
2876
|
}
|
|
2877
2877
|
//#endregion
|
|
2878
|
-
export { AgentEvalError, BackendTransportError, ConfigError, DEFAULT_ROUTER_BASE_URL, InMemoryRuntimeSessionStore, JudgeError, NotFoundError, ROUTER_PRICE_SOURCE,
|
|
2878
|
+
export { AgentEvalError, BackendTransportError, ConfigError, DEFAULT_ROUTER_BASE_URL, InMemoryRuntimeSessionStore, JudgeError, NotFoundError, ROUTER_PRICE_SOURCE, SearchEnvironmentFault, ValidationError, agenticGenerator, auditLoopRunner, buildKnowledgeImprovementExperimentBundles, buildLoopOtelSpans, cleanModelId, commandVerifier, composeRuntimeHooks, createCommandProfileTrainer, createConversationBackend, createIterableBackend, createKnowledgeImprovementActivationExecutor, createOtelExporter, createProfileExecutionBackend, createProfileImprovementHarness, createRuntimeEventCollector, createRuntimeStreamEventCollector, createSandboxPromptBackend, decideKnowledgeReadiness, decideSearchImprovement, dedicatedLane, defineRuntimeHooks, getModels, improve, isolatedCheckBoxEvidenceSchema, isolatedCheckResultSchema, loopEventToOtelSpan, officialGepa, officialSkillOpt, optimizerMethod, padSpanId, padTraceId, priceTokens, readinessServerSentEvent, reflectiveGenerator, reflectiveProfileProposer, resolveChatModel, resolveRouterBaseUrl, routerLane, runAgentTask, runAgentTaskStream, runConversation, runConversationStream, runKnowledgeImprovementJob, runPersonaConversation, runPersonaDispatch, runtimeStreamServerSentEvent, sanitizeKnowledgeReadinessReport, searchMethod, sharedBoxLane, startRuntimeRun, subscriptionLane, validateChatModelId };
|
|
2879
2879
|
|
|
2880
2880
|
//# sourceMappingURL=index.js.map
|
package/dist/intelligence.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $x as LoopTraceEvent, $y as defaultRedactor, B_ as RuntimeTelemetryOptions, O_ as OtelExportStats, Qy as Redactor, S as RuntimeStreamEvent, cm as AgentEnvironmentProviderRef, lm as AgentEnvironmentProviderRegistry } from "./types-Cgs89PQd.js";
|
|
2
2
|
import { H as AgentCandidateTaskExecution, N as AgentCandidateOutputArtifactPort, S as AgentCandidateExecutorPort, _ as AgentCandidateBenchmarkGraderPort, y as AgentCandidateExecutionPorts } from "./workspace-streams-BiS4ABah.js";
|
|
3
|
-
import { d as
|
|
4
|
-
import {
|
|
5
|
-
import { A as AgentProfileMeasuredSurface, C as verifyAgentImprovementProposal, D as AgentImprovementActivationTargetIdentity, E as AGENT_PROFILE_MEASURED_SURFACES, F as isAgentImprovementProfileSurface, I as isAgentProfileMeasuredSurface, M as agentImprovementProfileSurfaceDigest, N as agentImprovementProfileSurfaceInput, O as AgentImprovementProfileSurface, P as agentImprovementTargetProfileDiffs, S as verifyAgentImprovementActivationResult, T as AGENT_IMPROVEMENT_PROFILE_SURFACES, _ as createAgentImprovementActivationResult, _t as ImproveResult, a as AgentImprovementActivationTransitionInput, b as reviewAgentImprovementProposal, c as CreateAgentImprovementActivationOptions, d as ExecuteAgentImprovementActivationInput, f as ExecuteAgentImprovementActivationOptions, g as createAgentImprovementActivation, h as SealedCandidateActivationTransitionInput, j as agentImprovementProfileDiffs, k as AgentImprovementTargetProfileDiffOptions, l as CreateAgentImprovementActivationResultOptions, lt as ImproveMethodOptions, m as ReviewAgentImprovementInput, o as AgentProfileImprovementActivationOperation, p as ProfileImprovementActivationTransitionInput, pt as ImproveOptions, r as AgentImprovementActivationTargetPlan, s as AgentProfileImprovementActivationTargetPlan, u as CreateAgentImprovementProposalOptions, ut as ImproveMethodResult, v as createAgentImprovementProposal, w as verifyAgentImprovementReview, x as verifyAgentImprovementActivation, y as executeAgentImprovementActivation, yt as ImproveScenarioPartitions } from "./activation-
|
|
3
|
+
import { d as RunAnalystLoopResult, u as RunAnalystLoopOpts } from "./types-Cwrea-bU.js";
|
|
4
|
+
import { b as AgentCandidateExecutionClaimStore, f as PrepareAgentCandidateExecutionOptions, i as CreateProtectedAgentCandidateModelPortOptions, m as ExecutePreparedAgentCandidateOptions, u as parseAgentCandidateProfileActivation } from "./protected-model-port-DVVh-hEk.js";
|
|
5
|
+
import { A as AgentProfileMeasuredSurface, C as verifyAgentImprovementProposal, D as AgentImprovementActivationTargetIdentity, E as AGENT_PROFILE_MEASURED_SURFACES, F as isAgentImprovementProfileSurface, I as isAgentProfileMeasuredSurface, M as agentImprovementProfileSurfaceDigest, N as agentImprovementProfileSurfaceInput, O as AgentImprovementProfileSurface, P as agentImprovementTargetProfileDiffs, S as verifyAgentImprovementActivationResult, T as AGENT_IMPROVEMENT_PROFILE_SURFACES, _ as createAgentImprovementActivationResult, _t as ImproveResult, a as AgentImprovementActivationTransitionInput, b as reviewAgentImprovementProposal, c as CreateAgentImprovementActivationOptions, d as ExecuteAgentImprovementActivationInput, f as ExecuteAgentImprovementActivationOptions, g as createAgentImprovementActivation, h as SealedCandidateActivationTransitionInput, j as agentImprovementProfileDiffs, k as AgentImprovementTargetProfileDiffOptions, l as CreateAgentImprovementActivationResultOptions, lt as ImproveMethodOptions, m as ReviewAgentImprovementInput, o as AgentProfileImprovementActivationOperation, p as ProfileImprovementActivationTransitionInput, pt as ImproveOptions, r as AgentImprovementActivationTargetPlan, s as AgentProfileImprovementActivationTargetPlan, u as CreateAgentImprovementProposalOptions, ut as ImproveMethodResult, v as createAgentImprovementProposal, w as verifyAgentImprovementReview, x as verifyAgentImprovementActivation, y as executeAgentImprovementActivation, yt as ImproveScenarioPartitions } from "./activation-CXqtijue.js";
|
|
6
6
|
import { AgentCandidateBenchmarkCellRef, AgentCandidateEvaluationPolicy, AgentCandidateExperiment, AgentCandidateExperimentMaterial, AgentCandidateExperimentMeasurement, AgentCandidateLineage, AgentImprovementActivation, AgentImprovementActivationIntent, AgentImprovementActivationOutcome, AgentImprovementActivationResult, AgentImprovementActivationTargetState, AgentImprovementActivationTargetTransition, AgentImprovementEvaluation, AgentImprovementMeasuredComparison, AgentImprovementProposal, AgentImprovementProposal as AgentImprovementProposal$1, AgentImprovementReview, AgentImprovementReviewDecision, AgentImprovementSource, AgentProfile, AgentProfileDiff, AgentProfileImprovementExecutionRef, AgentProfileImprovementExperiment, AgentProfileImprovementMeasuredComparison, AgentProfileImprovementMeasurement, AgentProfileImprovementRunReceipt, AgentProfileImprovementTaskMaterial, CandidateExecutionEvidence, CandidateExecutionEvidence as CandidateExecutionEvidence$1, Sha256Digest } from "@tangle-network/agent-interface";
|
|
7
7
|
import { CostLedgerHandle, TraceStore } from "@tangle-network/agent-eval";
|
|
8
8
|
import { ProposalFinding as ProposalFinding$1 } from "@tangle-network/agent-eval/analyst";
|
package/dist/intelligence.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as assertProfileTrainingIsHeldOut, f as addRuntimeUsage, l as rethrowAfterCleanup, m as isUsageAmount, p as createRuntimeUsageTotals, t as improve } from "./improve-
|
|
4
|
-
import { _ as agentImprovementTargetProfileDiffs, a as reviewAgentImprovementProposal, b as isAgentProfileMeasuredSurface, c as verifyAgentImprovementProposal, d as attachOptimizationActivationReceipt, f as createOptimizationActivationReceipt, g as agentImprovementProfileSurfaceInput, h as agentImprovementProfileSurfaceDigest, i as executeAgentImprovementActivation, l as verifyAgentImprovementReview, m as agentImprovementProfileDiffs, n as createAgentImprovementActivationResult, o as verifyAgentImprovementActivation, p as optimizationActivationReceiptFromMetadata, r as createAgentImprovementProposal, s as verifyAgentImprovementActivationResult, t as createAgentImprovementActivation, u as assertNoCallerOptimizationReceipt, v as assertProfileImprovementTargetsShareIdentity, y as isAgentImprovementProfileSurface } from "./activation-
|
|
5
|
-
import { _ as parseAgentCandidateProfileActivation, a as applyExactAgentProfileDiff, d as createAgentCandidateProfileActivation, g as omitUndefinedObjectFields, m as materializeAgentCandidateProfilePlan, o as assertCandidateProfileBinding, v as parseExactAgentProfile } from "./profile-
|
|
1
|
+
import { Ni as resolveRedactor, Pt as resolveAgentEnvironmentProvider, Vr as authoredAgentIdentity, cn as createOtelExporter, in as buildLoopOtelSpans, ji as defaultRedactor, ln as flatOtelSpan, mn as toOtelAttributes, on as buildRuntimeEventOtelSpans } from "./supervisor-DUWcecAd.js";
|
|
2
|
+
import { F as canonicalCandidateDocument, N as canonicalCandidateBytes$1, P as canonicalCandidateDigest$1, R as immutableCandidateValue, V as verifyCanonicalCandidateDocument, z as omitTopLevelDigest } from "./sandbox-profile-compat-FN2kab2-.js";
|
|
3
|
+
import { a as assertProfileTrainingIsHeldOut, f as addRuntimeUsage, l as rethrowAfterCleanup, m as isUsageAmount, p as createRuntimeUsageTotals, t as improve } from "./improve-BZXt2qM0.js";
|
|
4
|
+
import { _ as agentImprovementTargetProfileDiffs, a as reviewAgentImprovementProposal, b as isAgentProfileMeasuredSurface, c as verifyAgentImprovementProposal, d as attachOptimizationActivationReceipt, f as createOptimizationActivationReceipt, g as agentImprovementProfileSurfaceInput, h as agentImprovementProfileSurfaceDigest, i as executeAgentImprovementActivation, l as verifyAgentImprovementReview, m as agentImprovementProfileDiffs, n as createAgentImprovementActivationResult, o as verifyAgentImprovementActivation, p as optimizationActivationReceiptFromMetadata, r as createAgentImprovementProposal, s as verifyAgentImprovementActivationResult, t as createAgentImprovementActivation, u as assertNoCallerOptimizationReceipt, v as assertProfileImprovementTargetsShareIdentity, y as isAgentImprovementProfileSurface } from "./activation-CWPmt0Do.js";
|
|
5
|
+
import { _ as parseAgentCandidateProfileActivation, a as applyExactAgentProfileDiff, d as createAgentCandidateProfileActivation, g as omitUndefinedObjectFields, m as materializeAgentCandidateProfilePlan, o as assertCandidateProfileBinding, v as parseExactAgentProfile } from "./profile-CbMw5hAn.js";
|
|
6
6
|
import { t as runAnalystLoop } from "./analyst-loop-DZw5QWT9.js";
|
|
7
|
-
import { C as verifiedResourceTextByDigest, S as AGENT_CANDIDATE_EXECUTION_SUPPORT, n as executePreparedAgentCandidate, t as prepareAgentCandidateExecution, w as verifyAgentCandidateBundle, x as exactProcessProviderAsCandidateExecutor, y as createProtectedAgentCandidateModelPort } from "./prepare-
|
|
7
|
+
import { C as verifiedResourceTextByDigest, S as AGENT_CANDIDATE_EXECUTION_SUPPORT, n as executePreparedAgentCandidate, t as prepareAgentCandidateExecution, w as verifyAgentCandidateBundle, x as exactProcessProviderAsCandidateExecutor, y as createProtectedAgentCandidateModelPort } from "./prepare-C-cWCyt3.js";
|
|
8
8
|
import { AGENT_IMPROVEMENT_SOURCE_METADATA_KEY, agentCandidateMaterializationReceiptSchema, agentCandidateRunReceiptSchema, agentImprovementSourceMetadata, agentImprovementSourceSchema, agentProfileImprovementArmSchema, applyAgentProfileDiff, candidateExecutionEvidenceSchema, numbersApproximatelyEqual } from "@tangle-network/agent-interface";
|
|
9
9
|
import { CostLedger, contentHash } from "@tangle-network/agent-eval";
|
|
10
10
|
import { ATTR, agentIdentityAttributes } from "@tangle-network/agent-trace-contract";
|
|
@@ -331,6 +331,158 @@ function normalizeReportedUsage(usage, intelligenceOff = false) {
|
|
|
331
331
|
};
|
|
332
332
|
}
|
|
333
333
|
//#endregion
|
|
334
|
+
//#region src/intelligence/otel-run-export.ts
|
|
335
|
+
/**
|
|
336
|
+
* The OTLP spans Tangle Intelligence receives for one traced run or run record.
|
|
337
|
+
* Attribute keys are verbatim: the plane's session, model and cost readers
|
|
338
|
+
* exact-match them. Redaction applies to every customer payload before it is
|
|
339
|
+
* hashed or attached.
|
|
340
|
+
*/
|
|
341
|
+
function usageAttributes(usage, intelligenceOff) {
|
|
342
|
+
const normalized = normalizeReportedUsage(usage, intelligenceOff);
|
|
343
|
+
return {
|
|
344
|
+
"tangle.usage.inference_usd": normalized.inferenceUsd,
|
|
345
|
+
"tangle.usage.intelligence_usd": normalized.intelligenceUsd,
|
|
346
|
+
...normalized.inferenceUsdKnown === false ? { "tangle.usage.inference_usd_known": false } : {},
|
|
347
|
+
...normalized.intelligenceUsdKnown === false ? { "tangle.usage.intelligence_usd_known": false } : {},
|
|
348
|
+
...normalized.estimatedInferenceUsd !== void 0 ? { "tangle.usage.inference_usd_estimated": normalized.estimatedInferenceUsd } : {}
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
/** Serialize a redacted value without dropping customer trace content. */
|
|
352
|
+
function serializeJson(value) {
|
|
353
|
+
let s;
|
|
354
|
+
if (typeof value === "string") s = value;
|
|
355
|
+
else try {
|
|
356
|
+
s = JSON.stringify(value) ?? String(value);
|
|
357
|
+
} catch {
|
|
358
|
+
s = String(value);
|
|
359
|
+
}
|
|
360
|
+
return s;
|
|
361
|
+
}
|
|
362
|
+
function addPayloadAttributes(labels, key, value, includeFullPayload) {
|
|
363
|
+
const serialized = serializeJson(value);
|
|
364
|
+
labels[`${key}_hash`] = contentHash(serialized);
|
|
365
|
+
labels[`${key}_bytes`] = Buffer.byteLength(serialized, "utf8");
|
|
366
|
+
if (includeFullPayload) labels[key] = serialized;
|
|
367
|
+
}
|
|
368
|
+
/** Export one flat run span for a traced call. */
|
|
369
|
+
function exportTraceSpan(exporter, settings, meta, outcome, output) {
|
|
370
|
+
const labels = {
|
|
371
|
+
project: settings.project,
|
|
372
|
+
"tangle.effort.intelligence_off": outcome.intelligenceOff,
|
|
373
|
+
...usageAttributes(outcome.usage, settings.intelligenceOff),
|
|
374
|
+
...meta.model ? { "gen_ai.request.model": meta.model } : {},
|
|
375
|
+
...meta.provider ? { "provider.name": meta.provider } : {},
|
|
376
|
+
...typeof outcome.success === "boolean" ? { "tangle.outcome.success": outcome.success } : {},
|
|
377
|
+
...typeof outcome.score === "number" ? { "tangle.outcome.score": outcome.score } : {},
|
|
378
|
+
...meta.labels ?? {}
|
|
379
|
+
};
|
|
380
|
+
const redactedInput = meta.input !== void 0 ? settings.redactor(meta.input) : void 0;
|
|
381
|
+
const redactedOutput = output !== void 0 ? settings.redactor(output) : void 0;
|
|
382
|
+
if (redactedInput !== void 0) addPayloadAttributes(labels, "tangle.input", redactedInput, settings.includeFullPayload);
|
|
383
|
+
if (redactedOutput !== void 0) addPayloadAttributes(labels, "tangle.output", redactedOutput, settings.includeFullPayload);
|
|
384
|
+
exporter.exportSpan(flatOtelSpan("tangle.intelligence.run", {
|
|
385
|
+
"tangle.runId": outcome.runId,
|
|
386
|
+
...labels,
|
|
387
|
+
[ATTR.spanKind]: "AGENT"
|
|
388
|
+
}, outcome.traceId, Date.now()));
|
|
389
|
+
}
|
|
390
|
+
/** The run span's attributes that come straight from the record. */
|
|
391
|
+
function runRecordAttributes(settings, record) {
|
|
392
|
+
const repository = record.repository ?? (settings.repo ? `${settings.repo.owner}/${settings.repo.name}` : void 0);
|
|
393
|
+
return {
|
|
394
|
+
project: record.project,
|
|
395
|
+
"tangle.target": record.target,
|
|
396
|
+
"tangle.effort.intelligence_off": settings.intelligenceOff,
|
|
397
|
+
...usageAttributes(record.outcome.usage, settings.intelligenceOff),
|
|
398
|
+
...record.model ? { "gen_ai.request.model": record.model } : {},
|
|
399
|
+
...record.provider ? { "provider.name": record.provider } : {},
|
|
400
|
+
...record.sessionId ? {
|
|
401
|
+
"tangle.sessionId": record.sessionId,
|
|
402
|
+
"gen_ai.conversation.id": record.sessionId
|
|
403
|
+
} : {},
|
|
404
|
+
...record.harness ? { "tangle.agent.harness": record.harness } : {},
|
|
405
|
+
...repository ? { "vcs.repository.name": repository } : {},
|
|
406
|
+
...record.commitSha ? { "vcs.ref.head.revision": record.commitSha } : {},
|
|
407
|
+
...record.timing ? {
|
|
408
|
+
"tangle.started_at_ms": record.timing.startedAt,
|
|
409
|
+
"tangle.completed_at_ms": record.timing.completedAt,
|
|
410
|
+
"tangle.duration_ms": record.timing.durationMs
|
|
411
|
+
} : {},
|
|
412
|
+
...record.tokens ? {
|
|
413
|
+
"gen_ai.usage.input_tokens": record.tokens.input,
|
|
414
|
+
"gen_ai.usage.output_tokens": record.tokens.output,
|
|
415
|
+
...record.tokens.tokensKnown === false ? { "tangle.usage.tokens_known": false } : {},
|
|
416
|
+
...record.tokens.cachedInput !== void 0 ? { "gen_ai.usage.cache_read_input_tokens": record.tokens.cachedInput } : {},
|
|
417
|
+
...record.tokens.reasoning !== void 0 ? { "gen_ai.usage.reasoning_tokens": record.tokens.reasoning } : {}
|
|
418
|
+
} : {},
|
|
419
|
+
...typeof record.outcome.success === "boolean" ? { "tangle.outcome.success": record.outcome.success } : {},
|
|
420
|
+
...typeof record.outcome.score === "number" ? { "tangle.outcome.score": record.outcome.score } : {},
|
|
421
|
+
...record.error ? {
|
|
422
|
+
"error.type": record.error.code ?? record.error.name,
|
|
423
|
+
"error.message": serializeJson(settings.redactor(record.error.message))
|
|
424
|
+
} : {},
|
|
425
|
+
...record.runtimeEvents ? { "tangle.runtime.event_count": record.runtimeEvents.length } : {},
|
|
426
|
+
...record.candidateExecution ? {
|
|
427
|
+
"tangle.candidate.bundle_digest": record.candidateExecution.receipt.bundleDigest,
|
|
428
|
+
"tangle.candidate.experiment_digest": record.candidateExecution.materializationReceipt.executionPlan.material.runCell.experimentDigest,
|
|
429
|
+
"tangle.candidate.execution_id": record.candidateExecution.materializationReceipt.executionPlan.material.executionId,
|
|
430
|
+
"tangle.candidate.execution_plan_digest": record.candidateExecution.receipt.executionPlanDigest,
|
|
431
|
+
"tangle.candidate.materialization_receipt_digest": record.candidateExecution.receipt.materializationReceiptDigest,
|
|
432
|
+
"tangle.candidate.succeeded": record.candidateExecution.receipt.termination.kind === "exit" && record.candidateExecution.receipt.termination.exitCode === 0 && record.candidateExecution.receipt.benchmarkResult.material.passed,
|
|
433
|
+
"tangle.candidate.run_receipt_digest": record.candidateExecution.receipt.digest
|
|
434
|
+
} : {}
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
/** Export the loop → round → iteration span tree with the shipped topology builder, never a second one. */
|
|
438
|
+
function exportLoopSpans(exporter, events, traceId, parentSpanId, redactor, decorate = (span) => span) {
|
|
439
|
+
const spans = buildLoopOtelSpans(events, traceId, parentSpanId, redactor);
|
|
440
|
+
for (const span of spans) exporter.exportSpan(decorate(span));
|
|
441
|
+
}
|
|
442
|
+
/** Export a run record: its run span, then its runtime-event and loop spans under the same trace. */
|
|
443
|
+
function exportRunRecordSpans(exporter, settings, record) {
|
|
444
|
+
const labels = runRecordAttributes(settings, record);
|
|
445
|
+
if (record.profile) {
|
|
446
|
+
addPayloadAttributes(labels, "tangle.agent.profile", settings.redactor(record.profile), settings.includeFullPayload);
|
|
447
|
+
if (record.profile.name) labels["gen_ai.agent.name"] = record.profile.name;
|
|
448
|
+
}
|
|
449
|
+
const identity = agentIdentityAttributes({
|
|
450
|
+
...authoredAgentIdentity(record.profile),
|
|
451
|
+
...record.harness ? { harness: record.harness } : {}
|
|
452
|
+
});
|
|
453
|
+
const attributed = (span) => withMissingAttributes(span, identity);
|
|
454
|
+
Object.assign(labels, identity);
|
|
455
|
+
const redactedInput = record.input !== void 0 ? settings.redactor(record.input) : void 0;
|
|
456
|
+
const redactedOutput = record.output !== void 0 ? settings.redactor(record.output) : void 0;
|
|
457
|
+
if (redactedInput !== void 0) addPayloadAttributes(labels, "tangle.input", redactedInput, settings.includeFullPayload);
|
|
458
|
+
if (redactedOutput !== void 0) addPayloadAttributes(labels, "tangle.output", redactedOutput, settings.includeFullPayload);
|
|
459
|
+
const now = Date.now();
|
|
460
|
+
const runSpan = flatOtelSpan("tangle.intelligence.run", {
|
|
461
|
+
"tangle.runId": record.runId,
|
|
462
|
+
...labels,
|
|
463
|
+
[ATTR.spanKind]: "AGENT"
|
|
464
|
+
}, record.traceId, record.timing?.startedAt ?? now, void 0, record.timing?.completedAt ?? now);
|
|
465
|
+
exporter.exportSpan(runSpan);
|
|
466
|
+
if (record.runtimeEvents && record.runtimeEvents.length > 0) {
|
|
467
|
+
const spans = buildRuntimeEventOtelSpans(record.runtimeEvents, record.traceId, runSpan.spanId, {
|
|
468
|
+
...settings.runtimeTelemetry,
|
|
469
|
+
redact: settings.redactor
|
|
470
|
+
});
|
|
471
|
+
for (const span of spans) exporter.exportSpan(attributed(span));
|
|
472
|
+
}
|
|
473
|
+
if (record.loopEvents && record.loopEvents.length > 0) exportLoopSpans(exporter, record.loopEvents, record.traceId, runSpan.spanId, settings.redactor, attributed);
|
|
474
|
+
}
|
|
475
|
+
/** `span` plus each of `attributes` it does not already carry; its own values win. */
|
|
476
|
+
function withMissingAttributes(span, attributes) {
|
|
477
|
+
const present = new Set((span.attributes ?? []).map((attribute) => attribute.key));
|
|
478
|
+
const missing = Object.fromEntries(Object.entries(attributes).filter(([key]) => !present.has(key)));
|
|
479
|
+
if (Object.keys(missing).length === 0) return span;
|
|
480
|
+
return {
|
|
481
|
+
...span,
|
|
482
|
+
attributes: [...span.attributes ?? [], ...toOtelAttributes(missing)]
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
//#endregion
|
|
334
486
|
//#region src/intelligence/profile-improvement-experiment.ts
|
|
335
487
|
function createProfileImprovementCostLedger(budgetUsd, context = "profile improvement") {
|
|
336
488
|
if (!Number.isFinite(budgetUsd) || budgetUsd < 0) throw new Error(`${context} budgetUsd must be a non-negative finite number`);
|
|
@@ -1517,37 +1669,6 @@ function withIntelligence(agent, config) {
|
|
|
1517
1669
|
}
|
|
1518
1670
|
//#endregion
|
|
1519
1671
|
//#region src/intelligence/index.ts
|
|
1520
|
-
/**
|
|
1521
|
-
*
|
|
1522
|
-
* Tangle Intelligence SDK — trace capture plus reviewable improvement.
|
|
1523
|
-
*
|
|
1524
|
-
* The client keeps live-agent trace delivery best-effort. The separate
|
|
1525
|
-
* improvement-cycle exports analyze completed traces and run a signed baseline
|
|
1526
|
-
* versus candidate experiment. Activation exports bind review to its result
|
|
1527
|
-
* and activate only the exact measured candidate.
|
|
1528
|
-
*
|
|
1529
|
-
* 1. OBSERVE — wrap a generic agent and export one trace span per call to
|
|
1530
|
-
* Tangle Intelligence, swallowing every export failure so a live agent
|
|
1531
|
-
* never fails because Intelligence is down.
|
|
1532
|
-
* 2. MODE 0 / OFF — at `effort: 'off'`, run the agent as PURE PASSTHROUGH
|
|
1533
|
-
* (zero intelligence spawns) with best-effort telemetry still on. The
|
|
1534
|
-
* exported trace tags usage by class `{ inferenceUsd, intelligenceUsd }`,
|
|
1535
|
-
* and at OFF `intelligenceUsd` is provably `0` — the mechanism that proves
|
|
1536
|
-
* an OFF customer paid inference-only.
|
|
1537
|
-
*
|
|
1538
|
-
* @module
|
|
1539
|
-
* @stable
|
|
1540
|
-
*/
|
|
1541
|
-
function usageAttributes(usage, intelligenceOff) {
|
|
1542
|
-
const normalized = normalizeReportedUsage(usage, intelligenceOff);
|
|
1543
|
-
return {
|
|
1544
|
-
"tangle.usage.inference_usd": normalized.inferenceUsd,
|
|
1545
|
-
"tangle.usage.intelligence_usd": normalized.intelligenceUsd,
|
|
1546
|
-
...normalized.inferenceUsdKnown === false ? { "tangle.usage.inference_usd_known": false } : {},
|
|
1547
|
-
...normalized.intelligenceUsdKnown === false ? { "tangle.usage.intelligence_usd_known": false } : {},
|
|
1548
|
-
...normalized.estimatedInferenceUsd !== void 0 ? { "tangle.usage.inference_usd_estimated": normalized.estimatedInferenceUsd } : {}
|
|
1549
|
-
};
|
|
1550
|
-
}
|
|
1551
1672
|
function resolveEffortConfig(effort) {
|
|
1552
1673
|
if (effort === void 0) return resolveEffort(defaultEffortTier);
|
|
1553
1674
|
if (typeof effort === "string") return resolveEffort(effort);
|
|
@@ -1559,29 +1680,43 @@ function freshTraceId() {
|
|
|
1559
1680
|
function freshRunId() {
|
|
1560
1681
|
return `run-${randomHex(16)}`;
|
|
1561
1682
|
}
|
|
1562
|
-
/** Serialize a redacted value without dropping customer trace content. */
|
|
1563
|
-
function serializeJson(value) {
|
|
1564
|
-
let s;
|
|
1565
|
-
if (typeof value === "string") s = value;
|
|
1566
|
-
else try {
|
|
1567
|
-
s = JSON.stringify(value) ?? String(value);
|
|
1568
|
-
} catch {
|
|
1569
|
-
s = String(value);
|
|
1570
|
-
}
|
|
1571
|
-
return s;
|
|
1572
|
-
}
|
|
1573
|
-
function addPayloadAttributes(labels, key, value, includeFullPayload) {
|
|
1574
|
-
const serialized = serializeJson(value);
|
|
1575
|
-
labels[`${key}_hash`] = contentHash(serialized);
|
|
1576
|
-
labels[`${key}_bytes`] = Buffer.byteLength(serialized, "utf8");
|
|
1577
|
-
if (includeFullPayload) labels[key] = serialized;
|
|
1578
|
-
}
|
|
1579
1683
|
function randomHex(chars) {
|
|
1580
1684
|
const bytes = new Uint8Array(Math.ceil(chars / 2));
|
|
1581
1685
|
if (typeof globalThis.crypto?.getRandomValues === "function") globalThis.crypto.getRandomValues(bytes);
|
|
1582
1686
|
else for (let i = 0; i < bytes.length; i++) bytes[i] = Math.floor(Math.random() * 256);
|
|
1583
1687
|
return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("").slice(0, chars);
|
|
1584
1688
|
}
|
|
1689
|
+
/** The `doctor()` readiness report for a client's config, with no network call. */
|
|
1690
|
+
function doctorReport(config, effort, apiKey) {
|
|
1691
|
+
const hasRepo = Boolean(config.repo?.owner && config.repo?.name && config.repo?.baseBranch);
|
|
1692
|
+
const hasChecks = Boolean(config.checks && config.checks.length > 0);
|
|
1693
|
+
const hasSurfaces = Boolean(config.surfaces && config.surfaces.length > 0);
|
|
1694
|
+
const prMissing = [];
|
|
1695
|
+
if (!hasChecks) prMissing.push("checks");
|
|
1696
|
+
if (!hasSurfaces) prMissing.push("surfaces");
|
|
1697
|
+
if (!hasRepo) prMissing.push("repo");
|
|
1698
|
+
const recommendMissing = [];
|
|
1699
|
+
if (isIntelligenceOff(effort)) recommendMissing.push("effort above off");
|
|
1700
|
+
return {
|
|
1701
|
+
project: config.project,
|
|
1702
|
+
effort,
|
|
1703
|
+
exportConfigured: Boolean(apiKey),
|
|
1704
|
+
modes: {
|
|
1705
|
+
observe: {
|
|
1706
|
+
ready: true,
|
|
1707
|
+
missing: []
|
|
1708
|
+
},
|
|
1709
|
+
recommend: {
|
|
1710
|
+
ready: recommendMissing.length === 0,
|
|
1711
|
+
missing: recommendMissing
|
|
1712
|
+
},
|
|
1713
|
+
pr: {
|
|
1714
|
+
ready: prMissing.length === 0,
|
|
1715
|
+
missing: prMissing
|
|
1716
|
+
}
|
|
1717
|
+
}
|
|
1718
|
+
};
|
|
1719
|
+
}
|
|
1585
1720
|
/**
|
|
1586
1721
|
* Create an Observe-mode Intelligence client. Resolves effort, the base URL, and
|
|
1587
1722
|
* the redactor up front; the exporter is built lazily and is `undefined` when no
|
|
@@ -1596,6 +1731,18 @@ function createIntelligenceClient(config) {
|
|
|
1596
1731
|
const includeFullPayload = config.payloadAttributes === "full";
|
|
1597
1732
|
const apiKey = config.apiKey ?? (typeof process !== "undefined" ? process.env.TANGLE_API_KEY : void 0);
|
|
1598
1733
|
const otlpEndpoint = `${resolveIntelligenceBaseUrl(config.baseUrl)}/v1/otlp`;
|
|
1734
|
+
const exportSettings = {
|
|
1735
|
+
project: config.project,
|
|
1736
|
+
intelligenceOff,
|
|
1737
|
+
redactor,
|
|
1738
|
+
includeFullPayload,
|
|
1739
|
+
get repo() {
|
|
1740
|
+
return config.repo;
|
|
1741
|
+
},
|
|
1742
|
+
get runtimeTelemetry() {
|
|
1743
|
+
return config.runtimeTelemetry;
|
|
1744
|
+
}
|
|
1745
|
+
};
|
|
1599
1746
|
let exporter;
|
|
1600
1747
|
let exporterResolved = false;
|
|
1601
1748
|
function getExporter() {
|
|
@@ -1614,107 +1761,14 @@ function createIntelligenceClient(config) {
|
|
|
1614
1761
|
const ex = getExporter();
|
|
1615
1762
|
if (!ex) return;
|
|
1616
1763
|
try {
|
|
1617
|
-
|
|
1618
|
-
project: config.project,
|
|
1619
|
-
"tangle.effort.intelligence_off": outcome.intelligenceOff,
|
|
1620
|
-
...usageAttributes(outcome.usage, intelligenceOff),
|
|
1621
|
-
...meta.model ? { "gen_ai.request.model": meta.model } : {},
|
|
1622
|
-
...meta.provider ? { "provider.name": meta.provider } : {},
|
|
1623
|
-
...typeof outcome.success === "boolean" ? { "tangle.outcome.success": outcome.success } : {},
|
|
1624
|
-
...typeof outcome.score === "number" ? { "tangle.outcome.score": outcome.score } : {},
|
|
1625
|
-
...meta.labels ?? {}
|
|
1626
|
-
};
|
|
1627
|
-
const redactedInput = meta.input !== void 0 ? redactor(meta.input) : void 0;
|
|
1628
|
-
const redactedOutput = output !== void 0 ? redactor(output) : void 0;
|
|
1629
|
-
if (redactedInput !== void 0) addPayloadAttributes(labels, "tangle.input", redactedInput, includeFullPayload);
|
|
1630
|
-
if (redactedOutput !== void 0) addPayloadAttributes(labels, "tangle.output", redactedOutput, includeFullPayload);
|
|
1631
|
-
ex.exportSpan(flatOtelSpan("tangle.intelligence.run", {
|
|
1632
|
-
"tangle.runId": outcome.runId,
|
|
1633
|
-
...labels,
|
|
1634
|
-
[ATTR.spanKind]: "AGENT"
|
|
1635
|
-
}, outcome.traceId, Date.now()));
|
|
1764
|
+
exportTraceSpan(ex, exportSettings, meta, outcome, output);
|
|
1636
1765
|
} catch {}
|
|
1637
1766
|
}
|
|
1638
1767
|
function exportRunRecord(record) {
|
|
1639
1768
|
const ex = getExporter();
|
|
1640
1769
|
if (!ex) return record.traceId;
|
|
1641
1770
|
try {
|
|
1642
|
-
|
|
1643
|
-
const labels = {
|
|
1644
|
-
project: record.project,
|
|
1645
|
-
"tangle.target": record.target,
|
|
1646
|
-
"tangle.effort.intelligence_off": intelligenceOff,
|
|
1647
|
-
...usageAttributes(record.outcome.usage, intelligenceOff),
|
|
1648
|
-
...record.model ? { "gen_ai.request.model": record.model } : {},
|
|
1649
|
-
...record.provider ? { "provider.name": record.provider } : {},
|
|
1650
|
-
...record.sessionId ? {
|
|
1651
|
-
"tangle.sessionId": record.sessionId,
|
|
1652
|
-
"gen_ai.conversation.id": record.sessionId
|
|
1653
|
-
} : {},
|
|
1654
|
-
...record.harness ? { "tangle.agent.harness": record.harness } : {},
|
|
1655
|
-
...repository ? { "vcs.repository.name": repository } : {},
|
|
1656
|
-
...record.commitSha ? { "vcs.ref.head.revision": record.commitSha } : {},
|
|
1657
|
-
...record.timing ? {
|
|
1658
|
-
"tangle.started_at_ms": record.timing.startedAt,
|
|
1659
|
-
"tangle.completed_at_ms": record.timing.completedAt,
|
|
1660
|
-
"tangle.duration_ms": record.timing.durationMs
|
|
1661
|
-
} : {},
|
|
1662
|
-
...record.tokens ? {
|
|
1663
|
-
"gen_ai.usage.input_tokens": record.tokens.input,
|
|
1664
|
-
"gen_ai.usage.output_tokens": record.tokens.output,
|
|
1665
|
-
...record.tokens.tokensKnown === false ? { "tangle.usage.tokens_known": false } : {},
|
|
1666
|
-
...record.tokens.cachedInput !== void 0 ? { "gen_ai.usage.cache_read_input_tokens": record.tokens.cachedInput } : {},
|
|
1667
|
-
...record.tokens.reasoning !== void 0 ? { "gen_ai.usage.reasoning_tokens": record.tokens.reasoning } : {}
|
|
1668
|
-
} : {},
|
|
1669
|
-
...typeof record.outcome.success === "boolean" ? { "tangle.outcome.success": record.outcome.success } : {},
|
|
1670
|
-
...typeof record.outcome.score === "number" ? { "tangle.outcome.score": record.outcome.score } : {},
|
|
1671
|
-
...record.error ? {
|
|
1672
|
-
"error.type": record.error.code ?? record.error.name,
|
|
1673
|
-
"error.message": serializeJson(redactor(record.error.message))
|
|
1674
|
-
} : {},
|
|
1675
|
-
...record.runtimeEvents ? { "tangle.runtime.event_count": record.runtimeEvents.length } : {},
|
|
1676
|
-
...record.candidateExecution ? {
|
|
1677
|
-
"tangle.candidate.bundle_digest": record.candidateExecution.receipt.bundleDigest,
|
|
1678
|
-
"tangle.candidate.experiment_digest": record.candidateExecution.materializationReceipt.executionPlan.material.runCell.experimentDigest,
|
|
1679
|
-
"tangle.candidate.execution_id": record.candidateExecution.materializationReceipt.executionPlan.material.executionId,
|
|
1680
|
-
"tangle.candidate.execution_plan_digest": record.candidateExecution.receipt.executionPlanDigest,
|
|
1681
|
-
"tangle.candidate.materialization_receipt_digest": record.candidateExecution.receipt.materializationReceiptDigest,
|
|
1682
|
-
"tangle.candidate.succeeded": record.candidateExecution.receipt.termination.kind === "exit" && record.candidateExecution.receipt.termination.exitCode === 0 && record.candidateExecution.receipt.benchmarkResult.material.passed,
|
|
1683
|
-
"tangle.candidate.run_receipt_digest": record.candidateExecution.receipt.digest
|
|
1684
|
-
} : {}
|
|
1685
|
-
};
|
|
1686
|
-
if (record.profile) {
|
|
1687
|
-
addPayloadAttributes(labels, "tangle.agent.profile", redactor(record.profile), includeFullPayload);
|
|
1688
|
-
if (record.profile.name) labels["gen_ai.agent.name"] = record.profile.name;
|
|
1689
|
-
}
|
|
1690
|
-
const identity = agentIdentityAttributes({
|
|
1691
|
-
...authoredAgentIdentity(record.profile),
|
|
1692
|
-
...record.harness ? { harness: record.harness } : {}
|
|
1693
|
-
});
|
|
1694
|
-
const attributed = (span) => withMissingAttributes(span, identity);
|
|
1695
|
-
Object.assign(labels, identity);
|
|
1696
|
-
const redactedInput = record.input !== void 0 ? redactor(record.input) : void 0;
|
|
1697
|
-
const redactedOutput = record.output !== void 0 ? redactor(record.output) : void 0;
|
|
1698
|
-
if (redactedInput !== void 0) addPayloadAttributes(labels, "tangle.input", redactedInput, includeFullPayload);
|
|
1699
|
-
if (redactedOutput !== void 0) addPayloadAttributes(labels, "tangle.output", redactedOutput, includeFullPayload);
|
|
1700
|
-
const now = Date.now();
|
|
1701
|
-
const runSpan = flatOtelSpan("tangle.intelligence.run", {
|
|
1702
|
-
"tangle.runId": record.runId,
|
|
1703
|
-
...labels,
|
|
1704
|
-
[ATTR.spanKind]: "AGENT"
|
|
1705
|
-
}, record.traceId, record.timing?.startedAt ?? now, void 0, record.timing?.completedAt ?? now);
|
|
1706
|
-
ex.exportSpan(runSpan);
|
|
1707
|
-
if (record.runtimeEvents && record.runtimeEvents.length > 0) {
|
|
1708
|
-
const spans = buildRuntimeEventOtelSpans(record.runtimeEvents, record.traceId, runSpan.spanId, {
|
|
1709
|
-
...config.runtimeTelemetry,
|
|
1710
|
-
redact: redactor
|
|
1711
|
-
});
|
|
1712
|
-
for (const span of spans) ex.exportSpan(attributed(span));
|
|
1713
|
-
}
|
|
1714
|
-
if (record.loopEvents && record.loopEvents.length > 0) {
|
|
1715
|
-
const spans = buildLoopOtelSpans(record.loopEvents, record.traceId, runSpan.spanId, redactor);
|
|
1716
|
-
for (const span of spans) ex.exportSpan(attributed(span));
|
|
1717
|
-
}
|
|
1771
|
+
exportRunRecordSpans(ex, exportSettings, record);
|
|
1718
1772
|
} catch {}
|
|
1719
1773
|
return record.traceId;
|
|
1720
1774
|
}
|
|
@@ -1758,41 +1812,11 @@ function createIntelligenceClient(config) {
|
|
|
1758
1812
|
const ex = getExporter();
|
|
1759
1813
|
if (!ex || events.length === 0) return traceId;
|
|
1760
1814
|
try {
|
|
1761
|
-
|
|
1762
|
-
for (const span of spans) ex.exportSpan(span);
|
|
1815
|
+
exportLoopSpans(ex, events, traceId, meta?.rootParentSpanId);
|
|
1763
1816
|
} catch {}
|
|
1764
1817
|
return traceId;
|
|
1765
1818
|
},
|
|
1766
|
-
doctor()
|
|
1767
|
-
const hasRepo = Boolean(config.repo?.owner && config.repo?.name && config.repo?.baseBranch);
|
|
1768
|
-
const hasChecks = Boolean(config.checks && config.checks.length > 0);
|
|
1769
|
-
const hasSurfaces = Boolean(config.surfaces && config.surfaces.length > 0);
|
|
1770
|
-
const prMissing = [];
|
|
1771
|
-
if (!hasChecks) prMissing.push("checks");
|
|
1772
|
-
if (!hasSurfaces) prMissing.push("surfaces");
|
|
1773
|
-
if (!hasRepo) prMissing.push("repo");
|
|
1774
|
-
const recommendMissing = [];
|
|
1775
|
-
if (intelligenceOff) recommendMissing.push("effort above off");
|
|
1776
|
-
return {
|
|
1777
|
-
project: config.project,
|
|
1778
|
-
effort,
|
|
1779
|
-
exportConfigured: Boolean(apiKey),
|
|
1780
|
-
modes: {
|
|
1781
|
-
observe: {
|
|
1782
|
-
ready: true,
|
|
1783
|
-
missing: []
|
|
1784
|
-
},
|
|
1785
|
-
recommend: {
|
|
1786
|
-
ready: recommendMissing.length === 0,
|
|
1787
|
-
missing: recommendMissing
|
|
1788
|
-
},
|
|
1789
|
-
pr: {
|
|
1790
|
-
ready: prMissing.length === 0,
|
|
1791
|
-
missing: prMissing
|
|
1792
|
-
}
|
|
1793
|
-
}
|
|
1794
|
-
};
|
|
1795
|
-
},
|
|
1819
|
+
doctor: () => doctorReport(config, effort, apiKey),
|
|
1796
1820
|
async flush() {
|
|
1797
1821
|
const ex = getExporter();
|
|
1798
1822
|
if (!ex) return;
|
|
@@ -1805,16 +1829,6 @@ function createIntelligenceClient(config) {
|
|
|
1805
1829
|
}
|
|
1806
1830
|
};
|
|
1807
1831
|
}
|
|
1808
|
-
/** `span` plus each of `attributes` it does not already carry; its own values win. */
|
|
1809
|
-
function withMissingAttributes(span, attributes) {
|
|
1810
|
-
const present = new Set((span.attributes ?? []).map((attribute) => attribute.key));
|
|
1811
|
-
const missing = Object.fromEntries(Object.entries(attributes).filter(([key]) => !present.has(key)));
|
|
1812
|
-
if (Object.keys(missing).length === 0) return span;
|
|
1813
|
-
return {
|
|
1814
|
-
...span,
|
|
1815
|
-
attributes: [...span.attributes ?? [], ...toOtelAttributes(missing)]
|
|
1816
|
-
};
|
|
1817
|
-
}
|
|
1818
1832
|
//#endregion
|
|
1819
1833
|
export { CapabilityNotAdmittedError, agentImprovementProfileDiffs, agentImprovementProfileSurfaceDigest, agentImprovementProfileSurfaceInput, agentImprovementTargetProfileDiffs, compileEffort, composeCertifiedPrompt, createAgentImprovementActivation, createAgentImprovementActivationResult, createAgentImprovementProposal, createCertifiedPromptSource, createExactProcessCandidateExperimentExecutor, createIntelligenceClient, createOptimizationActivationReceipt, createProtectedExactProcessCandidateExperimentExecutor, defaultRedactor, exactProcessCandidateExperimentExecutionSupport, executeAgentCandidateExperimentCell, executeAgentImprovementActivation, isAgentImprovementProfileSurface, isAgentProfileMeasuredSurface, isIntelligenceOff, manifestFromProfile, optimizationActivationReceiptFromMetadata, parseAgentCandidateProfileActivation as parseCandidateProfileMaterialization, prepareAgentImprovementProfileActivation, proposeAgentImprovement, proposeAgentProfileImprovement, proposeAuthoredAgentProfileImprovement, pullCertified, resolveEffort, reviewAgentImprovementProposal, runAgentCandidateExperiment, verifyAgentImprovementActivation, verifyAgentImprovementActivationResult, verifyAgentImprovementProposal, verifyAgentImprovementReview, verifyCandidateExecutionEvidence, withIntelligence };
|
|
1820
1834
|
|