The Open Framework for Building Agents
refactor(eve): internal cleanup of experimental tasks plumbing (#2500)
Ruif38eaf1b4331
diff --git a/.changeset/tasks-internal-cleanup.md b/.changeset/tasks-internal-cleanup.mdnew file mode 100644index 000000000..4527efd67--- /dev/null+++ b/.changeset/tasks-internal-cleanup.md@@ -0,0 +1,5 @@+---+"eve": patch+---++Internal cleanup of the experimental background-tasks plumbing: centralized task-view schemas while preserving strict projection and broad tool-output contracts, removed a duplicate task tool-name set, established one task inbox-token import path, and shared serialized-context key-name constants. No behavior change.diff --git a/packages/eve/src/context/key-names.ts b/packages/eve/src/context/key-names.tsnew file mode 100644index 000000000..512c237a5--- /dev/null+++ b/packages/eve/src/context/key-names.ts@@ -0,0 +1,13 @@+/**+ * Serialized-context slot names shared with modules that must inspect a+ * serialized context map without instantiating the owning key.+ *+ * `ChannelKey` (`#runtime/sessions/runtime-context-keys.ts`) carries a+ * codec that calls into the runtime, so workflow bodies cannot import+ * it; they read its slot through this name constant instead. The owning+ * keys construct themselves from these constants, so the names cannot+ * silently drift apart.+ */++export const CHANNEL_CONTEXT_KEY_NAME = "eve.channel";+export const SESSION_CALLBACK_CONTEXT_KEY_NAME = "eve.sessionCallback";diff --git a/packages/eve/src/context/keys.ts b/packages/eve/src/context/keys.tsindex e27d7f492..d7f507583 100644--- a/packages/eve/src/context/keys.ts+++ b/packages/eve/src/context/keys.ts@@ -18,6 +18,7 @@ import type {SessionTurn,} from "#channel/types.js";import { ContextKey } from "#context/key.js";+import { SESSION_CALLBACK_CONTEXT_KEY_NAME } from "#context/key-names.js";import type { InstrumentationChannelDeliveryRef } from "#harness/instrumentation/lifecycle.js";import type { HandleEventFn } from "#harness/types.js";import type { DurableDynamicToolCallbacks } from "#shared/durable-dynamic-tool-callbacks.js";@@ -115,7 +116,9 @@ export const CapabilitiesKey = new ContextKey<SessionCapabilities>("eve.capabili/*** Optional framework-owned caller callback captured when the session is created.*/-export const SessionCallbackKey = new ContextKey<SessionCallback>("eve.sessionCallback");+export const SessionCallbackKey = new ContextKey<SessionCallback>(+ SESSION_CALLBACK_CONTEXT_KEY_NAME,+);// ---------------------------------------------------------------------------// Derived keys — reconstructed by providers each step, never serialized.diff --git a/packages/eve/src/execution/agent-handle-dispatch.ts b/packages/eve/src/execution/agent-handle-dispatch.tsindex b10faecb1..f8156c1a1 100644--- a/packages/eve/src/execution/agent-handle-dispatch.ts+++ b/packages/eve/src/execution/agent-handle-dispatch.ts@@ -44,7 +44,7 @@ import { createWorkflowCallbackUrl } from "#execution/workflow-callback-url.js";import { createLogger, logError } from "#internal/logging.js";import { createEveCallbackRoutePath } from "#protocol/routes.js";import { err, ok, type Result } from "#shared/result.js";-import { readTaskIdFromInboxToken } from "#tasks/task-id.js";+import { readTaskIdFromInboxToken } from "#tasks/task-inbox-token.js";const log = createLogger("execution.agent-handle-dispatch");diff --git a/packages/eve/src/execution/delegated-parent-notification.ts b/packages/eve/src/execution/delegated-parent-notification.tsindex 350d6a30f..26c663af5 100644--- a/packages/eve/src/execution/delegated-parent-notification.ts+++ b/packages/eve/src/execution/delegated-parent-notification.ts@@ -24,7 +24,7 @@ import type { TokenUsage } from "#shared/token-usage.js";import { resumeHook } from "#internal/workflow/runtime.js";import { postSessionCallbackRequest } from "#execution/session-callback-request.js";import type { TaskInboundTurnStarted } from "#tasks/types.js";-import { readTaskIdFromInboxToken } from "#tasks/task-id.js";+import { readTaskIdFromInboxToken } from "#tasks/task-inbox-token.js";const log = createLogger("execution.delegated-parent-notification");diff --git a/packages/eve/src/execution/delegated-parent-result.ts b/packages/eve/src/execution/delegated-parent-result.tsindex 2b162a8d0..a37ab28c5 100644--- a/packages/eve/src/execution/delegated-parent-result.ts+++ b/packages/eve/src/execution/delegated-parent-result.ts@@ -11,6 +11,7 @@ import type { JsonValue } from "#shared/json.js";import { toErrorMessage } from "#shared/errors.js";import type { TokenUsage } from "#shared/token-usage.js";import { SUBAGENT_ADAPTER_KIND } from "#execution/subagent-adapter-state.js";+import { CHANNEL_CONTEXT_KEY_NAME } from "#context/key-names.js";const ZERO_TOKEN_USAGE: TokenUsage = {cacheReadTokens: 0,@@ -27,7 +28,7 @@ export function createDelegatedSubagentSuccessResult(serializedContext: Record<string, unknown>,output: unknown,): RuntimeSubagentChildResult | undefined {- const channel = serializedContext["eve.channel"] as+ const channel = serializedContext[CHANNEL_CONTEXT_KEY_NAME] as| { kind?: string; state?: Record<string, unknown> }| undefined;diff --git a/packages/eve/src/execution/eve-workflow-attributes.test.ts b/packages/eve/src/execution/eve-workflow-attributes.test.tsindex f8ec45f12..90dfaa428 100644--- a/packages/eve/src/execution/eve-workflow-attributes.test.ts+++ b/packages/eve/src/execution/eve-workflow-attributes.test.ts@@ -6,6 +6,7 @@ import {buildTurnAttributes,deriveSessionTitle,EVE_SESSION_TITLE_MAX_CHARS,+ isWorkflowTraceContentVisible,readChannelKind,readChannelRequestId,readParentLineage,@@ -14,6 +15,7 @@ import {readSessionTraceId,} from "#execution/eve-workflow-attributes.js";import { ChannelRequestIdKey } from "#context/keys.js";+import { CHANNEL_CONTEXT_KEY_NAME } from "#context/key-names.js";const slackChannelCtx = {"eve.channel": { kind: "slack", state: { team: "T1" }, audience: "public" },@@ -45,6 +47,16 @@ describe("readChannelKind", () => {});});+describe("isWorkflowTraceContentVisible", () => {+ it("reads audience from the shared serialized channel slot", () => {+ expect(+ isWorkflowTraceContentVisible({+ [CHANNEL_CONTEXT_KEY_NAME]: { audience: "public", kind: "slack" },+ }),+ ).toBe(true);+ });+});+describe("readParentSessionId", () => {it("returns the immediate parent's session id", () => {expect(readParentSessionId(subagentChainCtx)).toBe("wrun_parent_subagent");diff --git a/packages/eve/src/execution/eve-workflow-attributes.ts b/packages/eve/src/execution/eve-workflow-attributes.tsindex 08bcfcc56..d4a2b2e71 100644--- a/packages/eve/src/execution/eve-workflow-attributes.ts+++ b/packages/eve/src/execution/eve-workflow-attributes.ts@@ -31,6 +31,7 @@* absence means no exported OTEL trace exists.*/+import { CHANNEL_CONTEXT_KEY_NAME } from "#context/key-names.js";import { ChannelRequestIdKey, type SessionTraceSeed } from "#context/keys.js";import { shouldCaptureInstrumentationContent } from "#harness/instrumentation/content-policy.js";import { isSampledTrace } from "#tracing/sampled-trace.js";@@ -82,13 +83,17 @@ export interface SessionParentLineage {* tag emission silently drops undefined values.*/export function readChannelKind(serializedContext: Record<string, unknown>): string | undefined {- const channel = serializedContext["eve.channel"] as SerializedChannelAdapter | undefined;+ const channel = serializedContext[CHANNEL_CONTEXT_KEY_NAME] as+ | SerializedChannelAdapter+ | undefined;const kind = channel?.kind;return isNonEmptyString(kind) ? kind : undefined;}export function isWorkflowTraceContentVisible(serializedContext: Record<string, unknown>): boolean {- const channel = serializedContext["eve.channel"] as SerializedChannelAdapter | undefined;+ const channel = serializedContext[CHANNEL_CONTEXT_KEY_NAME] as+ | SerializedChannelAdapter+ | undefined;return shouldCaptureInstrumentationContent(normalizeChannelAudience(channel?.audience));}diff --git a/packages/eve/src/execution/remote-agent-dispatch.ts b/packages/eve/src/execution/remote-agent-dispatch.tsindex 57a75d0d7..cd4e71e63 100644--- a/packages/eve/src/execution/remote-agent-dispatch.ts+++ b/packages/eve/src/execution/remote-agent-dispatch.ts@@ -24,7 +24,7 @@ import type { CompiledRuntimeAgentBundle } from "#runtime/sessions/compiled-agenimport type { ResolvedRuntimeRemoteAgentNode } from "#runtime/types.js";import { expectFunction, expectObjectRecord } from "#internal/authored-module.js";import type { JsonObject } from "#shared/json.js";-import { readTaskIdFromInboxToken } from "#tasks/task-id.js";+import { readTaskIdFromInboxToken } from "#tasks/task-inbox-token.js";const CreateSessionResponseSchema = z.object({ok: z.literal(true),diff --git a/packages/eve/src/execution/session-callback-route.ts b/packages/eve/src/execution/session-callback-route.tsindex d1122a7e4..e15cd8614 100644--- a/packages/eve/src/execution/session-callback-route.ts+++ b/packages/eve/src/execution/session-callback-route.ts@@ -15,7 +15,7 @@ import type {TaskInboundTurnStarted,TaskInboundUpdate,} from "#tasks/types.js";-import { readTaskIdFromInboxToken } from "#tasks/task-id.js";+import { readTaskIdFromInboxToken } from "#tasks/task-inbox-token.js";const ZERO_TOKEN_USAGE: TokenUsage = {cacheReadTokens: 0,diff --git a/packages/eve/src/execution/tasks/child/instructions.ts b/packages/eve/src/execution/tasks/child/instructions.tsindex f5be214a6..e90658c1a 100644--- a/packages/eve/src/execution/tasks/child/instructions.ts+++ b/packages/eve/src/execution/tasks/child/instructions.ts@@ -1,14 +1,12 @@+import { CHANNEL_CONTEXT_KEY_NAME, SESSION_CALLBACK_CONTEXT_KEY_NAME } from "#context/key-names.js";import { readTaskIdFromInboxToken } from "#tasks/task-inbox-token.js";-const SESSION_CALLBACK_CONTEXT_KEY = "eve.sessionCallback";-const CHANNEL_CONTEXT_KEY = "eve.channel";-export const TASK_UPDATE_SESSION_INSTRUCTION ="Background task updates\nYou are running as a background task. For multi-step work, use `task_update` at meaningful milestones to briefly state what you are currently doing. Keep updates terse and activity-focused; do not include preliminary findings or results. Do not wait for a response, and return your final result normally.";/** True when the serialized caller binding points at a durable task inbox. */export function isTaskOwnedSerializedContext(serializedContext: Record<string, unknown>): boolean {- const callback = serializedContext[SESSION_CALLBACK_CONTEXT_KEY];+ const callback = serializedContext[SESSION_CALLBACK_CONTEXT_KEY_NAME];if (callback !== null &&typeof callback === "object" &&@@ -16,7 +14,7 @@ export function isTaskOwnedSerializedContext(serializedContext: Record<string, u) {return true;}- const channel = serializedContext[CHANNEL_CONTEXT_KEY];+ const channel = serializedContext[CHANNEL_CONTEXT_KEY_NAME];if (channel === null || typeof channel !== "object") return false;const state = Reflect.get(channel, "state");if (state === null || typeof state !== "object") return false;diff --git a/packages/eve/src/execution/tasks/child/update.ts b/packages/eve/src/execution/tasks/child/update.tsindex 702e96adb..79f0f3294 100644--- a/packages/eve/src/execution/tasks/child/update.ts+++ b/packages/eve/src/execution/tasks/child/update.ts@@ -8,7 +8,7 @@ import {import { createTaskControlError } from "#execution/tasks/parent/control-shared.js";import { resumeHook } from "#internal/workflow/runtime.js";import type { RuntimeActionResult, RuntimeToolCallActionRequest } from "#shared/action-types.js";-import { readTaskIdFromInboxToken } from "#tasks/task-id.js";+import { readTaskIdFromInboxToken } from "#tasks/task-inbox-token.js";import type { TaskInboundUpdate } from "#tasks/types.js";/** Sends one child-authored progress update over its existing parent transport. */diff --git a/packages/eve/src/execution/tasks/parent/dispatch.ts b/packages/eve/src/execution/tasks/parent/dispatch.tsindex 4f718519f..c4290f013 100644--- a/packages/eve/src/execution/tasks/parent/dispatch.ts+++ b/packages/eve/src/execution/tasks/parent/dispatch.ts@@ -25,7 +25,7 @@ import type {import type { CompiledBundle } from "#runtime/sessions/runtime-context-keys.js";import {TASK_CANCEL_TOOL_NAME,- TASK_CONTROL_TOOL_NAMES,+ TASK_TOOL_NAMES,TASK_UPDATE_TOOL_NAME,} from "#shared/task-tool.js";import type { SessionTaskIndexEntry } from "#tasks/session-index.js";@@ -46,7 +46,7 @@ const CANCEL_COMMIT_POLL_DELAY_MS = 250;export function isTaskControlAction(action: RuntimeActionRequest,): action is RuntimeToolCallActionRequest {- return action.kind === "tool-call" && TASK_CONTROL_TOOL_NAMES.has(action.toolName);+ return action.kind === "tool-call" && TASK_TOOL_NAMES.has(action.toolName);}/**diff --git a/packages/eve/src/runtime/sessions/runtime-context-keys.ts b/packages/eve/src/runtime/sessions/runtime-context-keys.tsindex 708457c9a..70c43bf06 100644--- a/packages/eve/src/runtime/sessions/runtime-context-keys.ts+++ b/packages/eve/src/runtime/sessions/runtime-context-keys.ts@@ -8,6 +8,7 @@ import type { ChannelAudience } from "#shared/channel-audience.js";import { getAdapterKind } from "#channel/adapter.js";import { ContextKey } from "#context/key.js";import { buildChannelInstrumentationProjection } from "#channel/instrumentation.js";+import { CHANNEL_CONTEXT_KEY_NAME } from "#context/key-names.js";import { deserializeRuntimeAdapter } from "#runtime/channels/registry.js";import {type DurableCompiledArtifactsSource,@@ -34,7 +35,7 @@ interface SerializedBundle {readonly source: DurableCompiledArtifactsSource;}-export const ChannelKey = new ContextKey<ChannelAdapter>("eve.channel", {+export const ChannelKey = new ContextKey<ChannelAdapter>(CHANNEL_CONTEXT_KEY_NAME, {codec: {serialize(adapter): SerializedAdapter {const projection = buildChannelInstrumentationProjection({ adapter });diff --git a/packages/eve/src/shared/task-tool.ts b/packages/eve/src/shared/task-tool.tsindex 698eb3ad0..1240a7441 100644--- a/packages/eve/src/shared/task-tool.ts+++ b/packages/eve/src/shared/task-tool.ts@@ -1,4 +1,5 @@import { z } from "#compiled/zod/index.js";+import { jsonValueSchema } from "#shared/json-schemas.js";export const TASK_CANCEL_TOOL_NAME = "task_cancel";export const TASK_UPDATE_TOOL_NAME = "task_update";@@ -9,9 +10,6 @@ export const TASK_TOOL_NAMES: ReadonlySet<string> = new Set([TASK_UPDATE_TOOL_NAME,]);-/** Transitional PR 1 dispatch classifier, removed by the kernel-effects PR. */-export const TASK_CONTROL_TOOL_NAMES = TASK_TOOL_NAMES;-const TASK_IDS_SCHEMA = z.array(z.string().min(1)).min(1)@@ -23,7 +21,52 @@ export const TASK_UPDATE_INPUT_SCHEMA = z.strictObject({message: z.string().min(1).describe("Brief description of what this task is currently doing."),});-const TASK_VIEW_SCHEMA = z.object({+const taskMetadataJsonSchema = z.union([+ z.object({+ agentId: z.string(),+ kind: z.literal("subagent"),+ mode: z.enum(["local", "remote"]),+ name: z.string(),+ }),+ z.object({+ kind: z.string(),+ name: z.string(),+ }),+]);++const taskOutputJsonSchema = z.object({+ data: jsonValueSchema,+ type: z.enum(["result", "error"]),+});++const taskViewJsonBaseShape = {+ metadata: taskMetadataJsonSchema,+ taskId: z.string(),+};++/** Strict model-visible task projection. */+export const TASK_VIEW_JSON_SCHEMA = z.discriminatedUnion("status", [+ z.object({ ...taskViewJsonBaseShape, status: z.literal("working") }),+ z.object({+ ...taskViewJsonBaseShape,+ inputRequests: z.array(jsonValueSchema).readonly(),+ status: z.literal("input_required"),+ }),+ z.object({+ ...taskViewJsonBaseShape,+ lastOutput: taskOutputJsonSchema.extend({ type: z.literal("result") }),+ status: z.literal("completed"),+ }),+ z.object({+ ...taskViewJsonBaseShape,+ lastOutput: taskOutputJsonSchema.extend({ type: z.literal("error") }),+ status: z.literal("failed"),+ }),+ z.object({ ...taskViewJsonBaseShape, status: z.literal("cancelled") }),+]);++/** Broad schema advertised by task-control tool outputs. */+export const TASK_VIEW_OUTPUT_SCHEMA = z.object({inputRequests: z.array(z.unknown()).optional(),lastOutput: z.object({@@ -49,7 +92,7 @@ const TASK_VIEW_SCHEMA = z.object({});export const TASK_VIEWS_OUTPUT_SCHEMA = z.object({- tasks: z.array(TASK_VIEW_SCHEMA),+ tasks: z.array(TASK_VIEW_OUTPUT_SCHEMA),});export const SUBAGENT_TASK_RECEIPT_OUTPUT_SCHEMA = z.strictObject({diff --git a/packages/eve/src/tasks/json.test.ts b/packages/eve/src/tasks/json.test.tsindex bb9f4b1e8..0f3cd8735 100644--- a/packages/eve/src/tasks/json.test.ts+++ b/packages/eve/src/tasks/json.test.ts@@ -1,5 +1,7 @@import { describe, expect, it } from "vitest";+import { taskCancel } from "#public/tools/task-cancel.js";+import { TASK_VIEWS_OUTPUT_SCHEMA } from "#shared/task-tool.js";import { taskViewToJson } from "#tasks/json.js";import type { TaskView } from "#tasks/types.js";@@ -41,3 +43,22 @@ describe("taskViewToJson", () => {});});});++describe("taskCancel.outputSchema", () => {+ it("preserves the broad task-control output contract", () => {+ expect(taskCancel.outputSchema).toBe(TASK_VIEWS_OUTPUT_SCHEMA);+ expect(+ TASK_VIEWS_OUTPUT_SCHEMA.parse({+ tasks: [+ {+ inputRequests: [{ prompt: "Choose" }],+ lastOutput: { data: "partial", type: "result" },+ metadata: { data: { source: "custom" }, kind: "tool", name: "report" },+ status: "working",+ taskId: "task-1",+ },+ ],+ }),+ ).toMatchObject({ tasks: [{ status: "working", taskId: "task-1" }] });+ });+});diff --git a/packages/eve/src/tasks/json.ts b/packages/eve/src/tasks/json.tsindex 84fe4c1bd..2f780420a 100644--- a/packages/eve/src/tasks/json.ts+++ b/packages/eve/src/tasks/json.ts@@ -1,63 +1,19 @@-import { z } from "#compiled/zod/index.js";+import type { z } from "#compiled/zod/index.js";-import { jsonValueSchema } from "#shared/json-schemas.js";import type { JsonValue } from "#shared/json.js";+import { TASK_VIEW_JSON_SCHEMA } from "#shared/task-tool.js";import type { TaskView } from "#tasks/types.js";import { readSubagentTaskMetadata } from "#tasks/types.js";-const taskMetadataJsonSchema = z.union([- z.object({- agentId: z.string(),- kind: z.literal("subagent"),- mode: z.enum(["local", "remote"]),- name: z.string(),- }),- z.object({- kind: z.string(),- name: z.string(),- }),-]);--const taskOutputJsonSchema = z.object({- data: jsonValueSchema,- type: z.enum(["result", "error"]),-});--const taskViewJsonBaseShape = {- metadata: taskMetadataJsonSchema,- taskId: z.string(),-};--/** Model-visible task shape. Unlisted private fields are stripped by zod. */-const taskViewJsonSchema = z.discriminatedUnion("status", [- z.object({ ...taskViewJsonBaseShape, status: z.literal("working") }),- z.object({- ...taskViewJsonBaseShape,- inputRequests: z.array(jsonValueSchema).readonly(),- status: z.literal("input_required"),- }),- z.object({- ...taskViewJsonBaseShape,- lastOutput: taskOutputJsonSchema.extend({ type: z.literal("result") }),- status: z.literal("completed"),- }),- z.object({- ...taskViewJsonBaseShape,- lastOutput: taskOutputJsonSchema.extend({ type: z.literal("error") }),- status: z.literal("failed"),- }),- z.object({ ...taskViewJsonBaseShape, status: z.literal("cancelled") }),-]);-/**- * Model-visible task view, inferred from {@link taskViewJsonSchema}.+ * Model-visible task view, inferred from {@link TASK_VIEW_JSON_SCHEMA}.** This is the public projection of `TaskView` (#tasks/types.js), not a* replacement for it: the durable view additionally carries private* `executor` and `usage`, and its module must stay zod-free because it is* bundled into workflow bodies.*/-type TaskViewJson = z.infer<typeof taskViewJsonSchema>;+type TaskViewJson = z.infer<typeof TASK_VIEW_JSON_SCHEMA>;/** Projects a task view into the JSON value carried by tool results. */export function taskViewToJson(view: TaskView): TaskViewJson {@@ -73,7 +29,7 @@ export function taskViewToJson(view: TaskView): TaskViewJson {};// `satisfies` couples the schema to `TaskView` at compile time; the runtime// parse strips the private fields structural typing would let through.- return taskViewJsonSchema.parse({ ...view, metadata });+ return TASK_VIEW_JSON_SCHEMA.parse({ ...view, metadata });}/** Projects many views into one `{ tasks }` tool output. */diff --git a/packages/eve/src/tasks/task-id.ts b/packages/eve/src/tasks/task-id.tsindex 4a3d69815..d910172be 100644--- a/packages/eve/src/tasks/task-id.ts+++ b/packages/eve/src/tasks/task-id.ts@@ -1,7 +1,6 @@import { createHash } from "node:crypto";import { deriveAgentOperationId } from "#harness/handles/operation-id.js";-export { readTaskIdFromInboxToken } from "#tasks/task-inbox-token.js";/*** Derives the stable task id for one originating subagent call.diff --git a/research/programmatic-agent-sources.md b/research/programmatic-agent-sources.mdindex eef8d9352..f5d1765af 100644--- a/research/programmatic-agent-sources.md+++ b/research/programmatic-agent-sources.md@@ -94,7 +94,7 @@ extension features work around that assumption at different layers:Native dispatch itself is a layer of magic strings. Execution branches on`sourceId.startsWith("eve:")` to decide how a tool executor is called; theharness recognizes `ask_question` and `final_output` by tool-name comparison;-task control is classified through the `TASK_CONTROL_TOOL_NAMES` name set;+task control is classified through the `TASK_TOOL_NAMES` name set;`load_skill` carries a `frameworkAction` marker even though it runs anordinary inline executor; and advertisement rules such as root-only anddelegated-caller-only visibility are name checks inside the harness.@@ -880,7 +880,7 @@ the implementation, not a condition to police with new guards.This deletes the magic-string dispatch layer: `sourceId.startsWith("eve:")`execution branching, `toolName === "ask_question"` and-`toolName === "final_output"` harness checks, the `TASK_CONTROL_TOOL_NAMES`+`toolName === "final_output"` harness checks, the `TASK_TOOL_NAMES`name set, the `frameworkAction: "load-skill"` marker, and name-basedvisibility rules in tool advertisement.@@ -1072,7 +1072,7 @@ remains:| Framework-source graph | Runtime no-source sandbox construction; `PACKAGE_ROUTES` and the native home, health, and info route defaults; host lifecycle probes using the public health route; silent post-compile ordinary route drops; discovery-only diagnostics that lose compiler warnings; module-global subagent executor-identity state and discarded subagent composition; prompt ownership parsed from source IDs; `public/tools/internal.ts` and `toPublicToolDefinition`. || Primitive ownership | The mixed `runtime/framework-tools` directory, the `eve/tools/defaults` barrel export, transitional re-export wrappers, public-to-runtime imports, duplicate default definition values, and ordinary “framework tool catalog” terminology. || Default config authority | Synthesized default config in `normalize-agent-config.ts`, undefined-config-source inspection conventions, and config loading outside the total binding table. |-| Kernel effects | `sourceId.startsWith("eve:")` execution branching; `ask_question` and `final_output` tool-name checks in the harness; the `TASK_CONTROL_TOOL_NAMES` name set; the `frameworkAction: "load-skill"` marker; name-based advertisement visibility; kernel conditionals, literal name lists, or registries outside the exhaustive integration points; native fabrication of ordinary resources. |+| Kernel effects | `sourceId.startsWith("eve:")` execution branching; `ask_question` and `final_output` tool-name checks in the harness; the `TASK_TOOL_NAMES` name set; the `frameworkAction: "load-skill"` marker; name-based advertisement visibility; kernel conditionals, literal name lists, or registries outside the exhaustive integration points; native fabrication of ordinary resources. || Inspection and memory parity | Inspection owner fallback or framework-state reconstruction; omitted dynamic-resolver or remote-agent provenance; `createMemorySourceId`, mirrored memory manifest references, and other in-memory descriptor shortcuts; harness execution of caller-owned tool objects; downstream source catalogs, composers, merges, or compatibility readers. |This ledger also removes the old framework tool and channel catalogs, duplicate