@tangle-network/agent-runtime 0.182.0 → 0.183.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.
Files changed (59) hide show
  1. package/dist/{activation-BfLdmBd5.js → activation-n31Hpe4r.js} +2 -2
  2. package/dist/{activation-BfLdmBd5.js.map → activation-n31Hpe4r.js.map} +1 -1
  3. package/dist/agent.d.ts +1 -1
  4. package/dist/agent.js +2 -2
  5. package/dist/{authoring-Dh_8qg7q.js → authoring-B05VmJoe.js} +4 -4
  6. package/dist/authoring-B05VmJoe.js.map +1 -0
  7. package/dist/{coordination-driver-DBvHI8ZG.js → coordination-driver-DwwFgEKZ.js} +19 -11
  8. package/dist/coordination-driver-DwwFgEKZ.js.map +1 -0
  9. package/dist/durable.d.ts +1 -1
  10. package/dist/durable.js +1 -1
  11. package/dist/{graph-lU6GacsN.js → graph-CJOhaZ35.js} +5 -5
  12. package/dist/graph-CJOhaZ35.js.map +1 -0
  13. package/dist/graph.d.ts +1 -1
  14. package/dist/graph.js +3 -3
  15. package/dist/{improvement-cycle-DezfYhlh.js → improvement-cycle-xqQfqSpf.js} +3 -3
  16. package/dist/{improvement-cycle-DezfYhlh.js.map → improvement-cycle-xqQfqSpf.js.map} +1 -1
  17. package/dist/{index-z2A6q-v0.d.ts → index-BhtdFMnG.d.ts} +16 -16
  18. package/dist/{index-BG4l6MHH.d.ts → index-Dg2UXocB.d.ts} +2 -2
  19. package/dist/index.d.ts +3 -3
  20. package/dist/index.js +7 -7
  21. package/dist/intelligence.js +3 -3
  22. package/dist/kernel.d.ts +1 -1
  23. package/dist/kernel.js +8 -8
  24. package/dist/{knowledge-CioWuU6F.js → knowledge-CRoESDWq.js} +3 -3
  25. package/dist/{knowledge-CioWuU6F.js.map → knowledge-CRoESDWq.js.map} +1 -1
  26. package/dist/knowledge.d.ts +1 -1
  27. package/dist/knowledge.js +1 -1
  28. package/dist/{loop-runner-bin-Rzj8NOjr.js → loop-runner-bin-DBMN5QXW.js} +3 -3
  29. package/dist/{loop-runner-bin-Rzj8NOjr.js.map → loop-runner-bin-DBMN5QXW.js.map} +1 -1
  30. package/dist/{loop-runner-bin-Dj0GJJWz.d.ts → loop-runner-bin-NanoP_bG.d.ts} +2 -2
  31. package/dist/loop-runner-bin.d.ts +1 -1
  32. package/dist/loop-runner-bin.js +1 -1
  33. package/dist/mcp/bin.js +3 -3
  34. package/dist/mcp/index.d.ts +30 -3
  35. package/dist/mcp/index.js +52 -6
  36. package/dist/mcp/index.js.map +1 -1
  37. package/dist/{openai-tools-B4Gbj7BL.js → openai-tools-DcBRPkrK.js} +2 -2
  38. package/dist/{openai-tools-B4Gbj7BL.js.map → openai-tools-DcBRPkrK.js.map} +1 -1
  39. package/dist/{provision-supervisor-BBPNrEQk.js → provision-supervisor-BOy-x5Rn.js} +4 -4
  40. package/dist/{provision-supervisor-BBPNrEQk.js.map → provision-supervisor-BOy-x5Rn.js.map} +1 -1
  41. package/dist/{runtime-Db1JYl9P.js → runtime-CDnK6T-T.js} +9 -9
  42. package/dist/{runtime-Db1JYl9P.js.map → runtime-CDnK6T-T.js.map} +1 -1
  43. package/dist/{structural-rollout-dG-cTxPq.js → structural-rollout-Cv_aUlFY.js} +2 -2
  44. package/dist/{structural-rollout-dG-cTxPq.js.map → structural-rollout-Cv_aUlFY.js.map} +1 -1
  45. package/dist/{supervise-rDa_CeUP.js → supervise-OiFWCM75.js} +9 -9
  46. package/dist/supervise-OiFWCM75.js.map +1 -0
  47. package/dist/{supervisor-Df9kT_z3.js → supervisor-DyRbmn1C.js} +2 -2
  48. package/dist/{supervisor-Df9kT_z3.js.map → supervisor-DyRbmn1C.js.map} +1 -1
  49. package/dist/testing.d.ts +1 -1
  50. package/dist/testing.js +12 -12
  51. package/dist/tui/index.d.ts +1 -1
  52. package/dist/tui/index.js +1 -1
  53. package/package.json +1 -1
  54. package/skills/codemode/SKILL.md +1 -1
  55. package/skills/supervise/SKILL.md +2 -2
  56. package/dist/authoring-Dh_8qg7q.js.map +0 -1
  57. package/dist/coordination-driver-DBvHI8ZG.js.map +0 -1
  58. package/dist/graph-lU6GacsN.js.map +0 -1
  59. package/dist/supervise-rDa_CeUP.js.map +0 -1
package/dist/testing.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Ho as SuperviseTestOptions, Nn as runGraphWithTestBrain, Wo as superviseWithTestBrain, cr as driverAgent, ds as supervisorAgentWithTestBrain, kn as RunGraphTestOptions, ns as SupervisorAgentTestDeps, sr as DriverAgentOptions } from "./index-z2A6q-v0.js";
1
+ import { Ho as SuperviseTestOptions, Nn as runGraphWithTestBrain, Wo as superviseWithTestBrain, cr as driverAgent, ds as supervisorAgentWithTestBrain, kn as RunGraphTestOptions, ns as SupervisorAgentTestDeps, sr as DriverAgentOptions } from "./index-BhtdFMnG.js";
2
2
  import { St as ToolLoopChat, xt as ToolLoopCallContext } from "./runtime-B-DLSfE5.js";
3
3
  import { AgentImprovementProposal, AgentProfile, AgentProfileImprovementMeasuredComparison, SandboxSizePreset } from "@tangle-network/agent-interface";
4
4
  //#region src/testing/index.d.ts
package/dist/testing.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import { ct as immutableCandidateValue, et as parseExactAgentProfile, it as canonicalCandidateDigest$1, q as applyExactAgentProfileDiff } from "./prepare-Tip-2ZoZ.js";
2
- import { f as verifyAgentImprovementProposal } from "./improvement-cycle-DezfYhlh.js";
3
- import { r as driverAgent } from "./coordination-driver-DBvHI8ZG.js";
4
- import { c as supervisorAgentWithTestBrain, r as superviseWithTestBrain } from "./supervise-rDa_CeUP.js";
5
- import { i as runGraphWithTestBrain } from "./graph-lU6GacsN.js";
2
+ import { f as verifyAgentImprovementProposal } from "./improvement-cycle-xqQfqSpf.js";
3
+ import { r as driverAgent } from "./coordination-driver-DwwFgEKZ.js";
4
+ import { c as supervisorAgentWithTestBrain, r as superviseWithTestBrain } from "./supervise-OiFWCM75.js";
5
+ import { i as runGraphWithTestBrain } from "./graph-CJOhaZ35.js";
6
6
  import { SANDBOX_SIZE_PRESET_NAMES } from "@tangle-network/agent-interface";
7
7
  //#region src/testing/fixtures/agent-improvement-proposal.json
8
8
  var agent_improvement_proposal_default = {
9
9
  changedSurfaces: ["prompt"],
10
- digest: "sha256:b12e908bbbbbb3dcb1bd43ef3218bd0b6ef2c760bd036b41842df78b6e17a9b6",
10
+ digest: "sha256:15ff5ee207500f85a098da9acd5e73ab600e3f32dfd7d9a2e4a6e55ac76320e2",
11
11
  evaluation: {
12
12
  "decision": {
13
13
  "contributingChecks": [
@@ -4578,7 +4578,7 @@ var agent_improvement_proposal_default = {
4578
4578
  ],
4579
4579
  "metadata": {
4580
4580
  "fixture": "agent-improvement-proposal",
4581
- "runtimeVersion": "0.182.0"
4581
+ "runtimeVersion": "0.183.0"
4582
4582
  },
4583
4583
  "objectives": [
4584
4584
  {
@@ -4689,8 +4689,8 @@ var agent_improvement_proposal_default = {
4689
4689
  "baselineContentHash": "sha256:5c21ee53e513fc604cb09754e21c392b24a424da0ef37dbf8f1ee4a8a0b08f09",
4690
4690
  "candidateContentHash": "sha256:60fcbb1c728194bd51d7d19cb732d1c3f1881dce7e0a6266b41c8b98cfd65693",
4691
4691
  "kind": "agent-eval-loop",
4692
- "recordDigest": "sha256:ae447f4c01984fb16fb180cbc57fc29cf545c8bf610b2c99a92011b7861df3d7",
4693
- "runId": "agent-runtime-0.182.0-proposal-fixture",
4692
+ "recordDigest": "sha256:f754016d356b719400c724f4e03ab5597e8c2376544c0b7617e250d7ea05ced3",
4693
+ "runId": "agent-runtime-0.183.0-proposal-fixture",
4694
4694
  "schema": "agent-candidate-experiment"
4695
4695
  }
4696
4696
  },
@@ -4713,13 +4713,13 @@ var agent_improvement_proposal_default = {
4713
4713
  }],
4714
4714
  kind: "agent-improvement-proposal",
4715
4715
  proposedAt: "2026-07-10T01:00:00.000Z",
4716
- runId: "agent-runtime-0.182.0-proposal-fixture"
4716
+ runId: "agent-runtime-0.183.0-proposal-fixture"
4717
4717
  };
4718
4718
  //#endregion
4719
4719
  //#region src/testing/fixtures/agent-profile-improvement-proposal.json
4720
4720
  var agent_profile_improvement_proposal_default = {
4721
4721
  changedSurfaces: ["prompt", "skills"],
4722
- digest: "sha256:3d4fd34e807a422162535a7bce02e68785a93c80ebaa285d7aa306cbf2833840",
4722
+ digest: "sha256:b6d9e5bcfb515e08e1270d27bb68aeb19ae8d0a41bdce9b83b7dc334507a9e1b",
4723
4723
  evaluation: {
4724
4724
  "decision": {
4725
4725
  "contributingChecks": [
@@ -6353,7 +6353,7 @@ var agent_profile_improvement_proposal_default = {
6353
6353
  ],
6354
6354
  "metadata": {
6355
6355
  "fixture": "agent-profile-improvement-proposal",
6356
- "runtimeVersion": "0.182.0"
6356
+ "runtimeVersion": "0.183.0"
6357
6357
  },
6358
6358
  "objectives": [
6359
6359
  {
@@ -6464,7 +6464,7 @@ var agent_profile_improvement_proposal_default = {
6464
6464
  "baselineContentHash": "sha256:21c495a37c418c10bde64fbaa188beddeed31f1f051ea60a6a6582a9ee0db704",
6465
6465
  "candidateContentHash": "sha256:103f77bc8481601eef1ad5fe6ba84a40dffabc3a44f421f8c8559121edab84e9",
6466
6466
  "kind": "agent-eval-loop",
6467
- "recordDigest": "sha256:c65aede193feabf77a1374da578bdac9fca7b80d36539d44848d0fdc958a7aa3",
6467
+ "recordDigest": "sha256:e0a924ea5048201462e8706a25bd37735aaa0863b89e14c0effdaee78d386edd",
6468
6468
  "runId": "profile-improvement-1",
6469
6469
  "schema": "agent-profile-improvement-experiment"
6470
6470
  }
@@ -1,4 +1,4 @@
1
- import { an as provisionSupervisor, in as SupervisorCleanupReceipt, nn as ProvisionSupervisorRequest, rn as ProvisionedSupervisor, tn as ProvisionSupervisorConnection } from "../index-z2A6q-v0.js";
1
+ import { an as provisionSupervisor, in as SupervisorCleanupReceipt, nn as ProvisionSupervisorRequest, rn as ProvisionedSupervisor, tn as ProvisionSupervisorConnection } from "../index-BhtdFMnG.js";
2
2
  //#region src/tui/top-app.d.ts
3
3
  /**
4
4
  * The interactive side of the supervisor-run TUI: a keypress/mouse loop over the frames
package/dist/tui/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { t as provisionSupervisor } from "../provision-supervisor-BBPNrEQk.js";
1
+ import { t as provisionSupervisor } from "../provision-supervisor-BOy-x5Rn.js";
2
2
  import { a as renderTopFrameWithLayout, i as renderTopFrame, n as runTopApp, r as loadTopSnapshot, t as renderTopOnce } from "../top-app-DIBApkt1.js";
3
3
  export { loadTopSnapshot, provisionSupervisor, renderTopFrame, renderTopFrameWithLayout, renderTopOnce, runTopApp };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-runtime",
3
- "version": "0.182.0",
3
+ "version": "0.183.0",
4
4
  "description": "Shared task-lifecycle skeleton for agents: a recursive loop kernel for chat turns, one-shot tasks, and multi-attempt loops, with trace capture and eval-gated self-improvement. Domain behavior lives in adapters; scoring and ship-gates in @tangle-network/agent-eval.",
5
5
  "homepage": "https://github.com/tangle-network/agent-runtime#readme",
6
6
  "repository": {
@@ -31,7 +31,7 @@ The lint on authored code refuses imports, `process`, and network access; it is
31
31
  ## Router-Brained Supervisors
32
32
 
33
33
  A raw chat model has no shell, so give it the runtime's code mode: pass `codeModeSupervisorTools()` as `resolveSupervisorTools` and the supervisor's tool surface becomes `search` and `execute`.
34
- `search` answers a TypeScript API generated from the live coordination grant; `execute` runs the model's program through a caller-supplied runner, and every `api.spawn_agent` call crosses the kernel's pool, authorization, and journal.
34
+ `search` answers a TypeScript API generated from the live coordination grant; `execute` runs the model's program through a caller-supplied runner, and every `api.spawn_worker` call crosses the kernel's pool, authorization, and journal.
35
35
  Supply a jailed runner for an untrusted model: the in-process runner is not an isolation boundary.
36
36
  The lifecycle verbs (`submit_result`, `stop`, `ask_parent`) stay model tools: the program does the mechanics, the model keeps the judgment.
37
37
 
@@ -5,13 +5,13 @@ description: Drive worker agents with explicit profiles, corrections, budgets, a
5
5
 
6
6
  # Supervise
7
7
 
8
- Use this policy only when the running agent has the coordination tools, including `spawn_agent` and `await_event`.
8
+ Use this policy only when the running agent has the coordination tools, including `spawn_worker` and `await_event`.
9
9
  The supervisor plans and checks work; workers produce the artifacts.
10
10
 
11
11
  ## Run The Work
12
12
 
13
13
  1. Split the job into independent deliverables with observable completion checks.
14
- 2. Call `spawn_agent` with a focused task and a complete worker profile.
14
+ 2. Call `spawn_worker` with a focused task and a complete worker profile.
15
15
  3. Assign each worker only the tools, context, authority, and budget it needs.
16
16
  4. Use `await_event` to collect questions, findings, progress, and settlements.
17
17
  5. Answer blocking questions or steer the responsible worker with specific evidence.
@@ -1 +0,0 @@
1
- {"version":3,"file":"authoring-Dh_8qg7q.js","names":[],"sources":["../src/runtime/supervise/authoring.ts"],"sourcesContent":["/**\n *\n * The supervisor's intelligence is AUTHORING the agents it spawns — not pressing buttons.\n *\n * Every agent here is three things: instructions (system prompt), tools, and a model — its\n * `AgentProfile`. The supervisor's job is to WRITE those profiles: read the task, decompose it,\n * and for each sub-task author a tailored worker recipe. `supervisorInstructions` is the how-to the\n * supervisor reads; canonical Runtime executors materialize the resulting profile.\n *\n * The skill is the single OPTIMIZABLE surface: edit it → the supervisor designs better agents.\n * That is the self-improvement lever (the prompt/skill lever), not the execution plumbing.\n *\n * @experimental\n */\n\nimport { type AnalystFinding, computeFindingId, makeFinding } from '@tangle-network/agent-eval'\nimport {\n type AgentProfile,\n type AgentProfilePrompt,\n agentProfileSchema,\n} from '@tangle-network/agent-interface'\nimport { supervisorPolicyPrompt } from './prompt-registry'\n\n/** What the supervisor AUTHORS per sub-task: one complete canonical profile whose name and\n * task-specific system prompt are present. Every other `AgentProfile` axis is preserved exactly. */\nexport type AuthoredProfile = AgentProfile & {\n readonly name: string\n readonly prompt: AgentProfilePrompt & { readonly systemPrompt: string }\n}\n\n/** Narrow an untyped `spawn_agent` profile argument to an `AuthoredProfile`, or null if the\n * supervisor failed to author one (empty/placeholder profile — a skill violation worth catching). */\nexport function asAuthoredProfile(raw: unknown): AuthoredProfile | null {\n const parsed = agentProfileSchema.safeParse(raw)\n if (!parsed.success) return null\n const systemPrompt = parsed.data.prompt?.systemPrompt\n if (typeof systemPrompt !== 'string' || systemPrompt.trim().length === 0) return null\n return {\n ...parsed.data,\n name:\n typeof parsed.data.name === 'string' && parsed.data.name.length > 0\n ? parsed.data.name\n : 'worker',\n prompt: { ...parsed.data.prompt, systemPrompt },\n }\n}\n\n/** The supervisor SKILL — the how-to the supervisor reads (its system prompt). THE optimizable\n * surface: editing this changes how the supervisor designs every agent it spawns.\n *\n * The POLICY paragraph is the registry's one `supervisor/policy` entry — the same stance\n * `defaultSupervisorPrompt` carries — so both front doors run the same work-vs-delegate rule;\n * this function ADDS the profile-authoring skill (how to WRITE the workers it spawns), which is\n * additive craft, not a different policy. */\nexport function supervisorInstructions(opts?: { goal?: string }): string {\n return [\n supervisorPolicyPrompt.text,\n '',\n 'Your delegation craft is AUTHORING: a spawned worker is exactly as good as the profile you write.',\n '',\n 'For the task you are given:',\n '1. DECOMPOSE it into the smallest set of sub-tasks a single focused worker can each deliver.',\n '2. For EACH sub-task, AUTHOR a worker by calling spawn_agent with a COMPLETE `profile`:',\n ' • name and description: who this specialist is and why it exists.',\n ' • prompt.systemPrompt: rich instructions for THIS sub-task — exact output, process, evidence, and what \"done\" means.',\n ' • model.default, model.reasoningEffort, and harness: choose the execution system deliberately when the task benefits from it.',\n ' • tools, mcp, resources.skills/files/instructions, hooks, subagents, permissions, and modes: grant or attach every capability the worker needs; omit an axis only when it is intentionally unnecessary.',\n ' • metadata.role=\"driver\" when this child should be a sub-supervisor that may author and drive its own children.',\n ' NEVER spawn a worker with an empty profile. The quality of the worker IS the quality of the profile you write.',\n \"3. await_event (kinds:['settled']) to collect each worker. Its result says valid:true only if the deployable check passed.\",\n '4. If a worker did NOT deliver, AUTHOR A NEW profile whose prompt.systemPrompt names the SPECIFIC failure and how to fix it — never just retry the same profile.',\n '5. Stop (reply with no tool call) once the work is delivered.',\n ...(opts?.goal ? ['', `The goal: ${opts.goal}`] : []),\n ].join('\\n')\n}\n\n// ── Profile-richness gate ────────────────────────────────────────────────────\n//\n// The supervisor's product is the worker PROFILE it authors. The failure mode the existing\n// gates miss: `asAuthoredProfile` / `local-harness` only reject a FULLY EMPTY system prompt —\n// a two-sentence stub passes. `assessAuthoredProfile` OBSERVES the authored artifact (it reads\n// no judge verdict, so it steers cleanly past `assertTraceDerivedFindings`) and flags THIN:\n// a short/few-line system prompt, OR no tools, OR no skills, OR no MCP when the task needs one.\n// It emits a real `AnalystFinding` so it rides the SAME coordination bus the driver pulls via\n// `await_event({kinds:['finding']})` — the supervisor can self-correct and re-author richer.\n\n/** Thresholds below which a system prompt is treated as a thin stub. Tunable per call. */\nexport interface ProfileRichnessThresholds {\n /** A prompt shorter than this many characters is thin (default 600). */\n readonly minSystemPromptChars: number\n /** A prompt with fewer than this many non-blank lines is thin (default 6). */\n readonly minSystemPromptLines: number\n}\n\n/** Default thresholds for `ProfileRichnessThresholds` — 600 chars / 6 lines minimum system prompt. */\nexport const defaultProfileRichnessThresholds: ProfileRichnessThresholds = {\n minSystemPromptChars: 600,\n minSystemPromptLines: 6,\n}\n\n/** Per-field verdict on one authored profile — the raw material the bench renders + scores. */\nexport interface ProfileRichness {\n readonly name: string\n /** The resolved system prompt (canonical `prompt.systemPrompt`, the sandbox `prompt.system`\n * convention, or a bare-string prompt — whichever the author used). */\n readonly systemPrompt: string\n readonly systemPromptChars: number\n readonly systemPromptLines: number\n readonly sentenceCount: number\n readonly hasDescription: boolean\n readonly hasTools: boolean\n readonly hasSkills: boolean\n readonly hasMcp: boolean\n readonly hasSubagents: boolean\n /** 0..1 — fraction of richness signals present (prompt-depth + the four levers). */\n readonly richness: number\n /** True when the supervisor authored a stub instead of a real profile. */\n readonly thin: boolean\n /** The specific reasons it is thin (empty when rich) — used in the finding's action. */\n readonly reasons: string[]\n}\n\n/** Read the system prompt from any authored shape: canonical `prompt.systemPrompt`, the sandbox\n * `prompt.system` convention, or a bare-string `prompt`. */\nfunction resolveSystemPrompt(profile: AgentProfile): string {\n const pr = (profile as { prompt?: unknown }).prompt\n if (typeof pr === 'string') return pr\n if (pr && typeof pr === 'object') {\n const o = pr as { systemPrompt?: unknown; system?: unknown }\n if (typeof o.systemPrompt === 'string') return o.systemPrompt\n if (typeof o.system === 'string') return o.system\n }\n return ''\n}\n\n/** OBSERVE one authored `AgentProfile` and score its richness (no judge verdict is read). The task\n * context (`needsMcp`) lets a domain say \"this work needs a data/tool MCP\" so a missing MCP counts. */\nexport function assessAuthoredProfile(\n profile: AgentProfile,\n opts?: { needsMcp?: boolean; thresholds?: Partial<ProfileRichnessThresholds> },\n): ProfileRichness {\n const th = { ...defaultProfileRichnessThresholds, ...(opts?.thresholds ?? {}) }\n const systemPrompt = resolveSystemPrompt(profile)\n const trimmed = systemPrompt.trim()\n const systemPromptChars = trimmed.length\n const systemPromptLines = trimmed\n ? trimmed.split('\\n').filter((l) => l.trim().length > 0).length\n : 0\n const sentenceCount = trimmed\n ? (trimmed.match(/[.!?](\\s|$)/g) ?? []).length || (trimmed ? 1 : 0)\n : 0\n const hasDescription =\n typeof profile.description === 'string' && profile.description.trim().length > 0\n const tools = (profile as { tools?: Record<string, unknown> }).tools\n const hasTools = !!tools && Object.keys(tools).length > 0\n const skills = (profile.resources as { skills?: unknown[] } | undefined)?.skills\n const hasSkills = Array.isArray(skills) && skills.length > 0\n const mcp = (profile as { mcp?: Record<string, unknown> }).mcp\n const hasMcp = !!mcp && Object.keys(mcp).length > 0\n const subagents = (profile as { subagents?: Record<string, unknown> }).subagents\n const hasSubagents = !!subagents && Object.keys(subagents).length > 0\n\n const reasons: string[] = []\n const promptThin =\n systemPromptChars < th.minSystemPromptChars || systemPromptLines < th.minSystemPromptLines\n if (promptThin)\n reasons.push(\n `system prompt is thin (${systemPromptChars} chars, ${systemPromptLines} lines; need ≥${th.minSystemPromptChars} chars and ≥${th.minSystemPromptLines} lines)`,\n )\n if (!hasTools)\n reasons.push('no tools granted (a worker can only act through the tools you grant it)')\n if (!hasSkills) reasons.push('no skills attached (no reusable how-to notes injected)')\n if (opts?.needsMcp && !hasMcp) reasons.push('no MCP server, but the task needs data/tool access')\n\n // Richness = fraction of signals present. Prompt-depth is one signal; the four levers are the rest.\n const signals = [!promptThin, hasTools, hasSkills, hasDescription, opts?.needsMcp ? hasMcp : true]\n const richness = signals.filter(Boolean).length / signals.length\n // THIN ⟺ the prompt is a stub OR the worker has no levers at all (no tools AND no skills AND no mcp).\n const thin = promptThin || (!hasTools && !hasSkills && !hasMcp)\n\n return {\n name: profile.name ?? 'worker',\n systemPrompt,\n systemPromptChars,\n systemPromptLines,\n sentenceCount,\n hasDescription,\n hasTools,\n hasSkills,\n hasMcp,\n hasSubagents,\n richness,\n thin,\n reasons,\n }\n}\n\n/** Turn a {@link ProfileRichness} verdict into a bus-routable `AnalystFinding` (area `profile-quality`).\n * Severity scales with thinness; the recommended action names the MISSING lever so the supervisor can\n * re-author. `subject` = the worker name so per-worker findings diff cleanly across re-authors. */\nexport function profileRichnessFinding(\n richness: ProfileRichness,\n opts?: { analystId?: string; runId?: string },\n): AnalystFinding {\n const analyst_id = opts?.analystId ?? 'profile-richness'\n const subject = richness.name\n const claim = richness.thin\n ? `Worker \"${richness.name}\" was authored as a THIN profile: ${richness.reasons.join('; ')}.`\n : `Worker \"${richness.name}\" was authored as a rich profile (richness ${(richness.richness * 100).toFixed(0)}%).`\n const severity: AnalystFinding['severity'] = richness.thin\n ? richness.richness < 0.25\n ? 'high'\n : 'medium'\n : 'info'\n return makeFinding({\n analyst_id,\n severity,\n area: 'profile-quality',\n claim,\n subject,\n confidence: 0.9,\n evidence_refs: [\n {\n kind: 'metric',\n uri: `profile:${subject}`,\n excerpt: `chars=${richness.systemPromptChars} lines=${richness.systemPromptLines} tools=${richness.hasTools} skills=${richness.hasSkills} mcp=${richness.hasMcp} richness=${richness.richness.toFixed(2)}`,\n },\n ],\n ...(richness.thin\n ? { recommended_action: `Re-author \"${richness.name}\" with: ${richness.reasons.join('; ')}.` }\n : {}),\n id_basis: computeFindingId({\n analyst_id,\n area: 'profile-quality',\n subject,\n claim: `richness:${richness.thin ? 'thin' : 'rich'}`,\n }),\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAgCA,SAAgB,kBAAkB,KAAsC;CACtE,MAAM,SAAS,mBAAmB,UAAU,GAAG;CAC/C,IAAI,CAAC,OAAO,SAAS,OAAO;CAC5B,MAAM,eAAe,OAAO,KAAK,QAAQ;CACzC,IAAI,OAAO,iBAAiB,YAAY,aAAa,KAAK,CAAC,CAAC,WAAW,GAAG,OAAO;CACjF,OAAO;EACL,GAAG,OAAO;EACV,MACE,OAAO,OAAO,KAAK,SAAS,YAAY,OAAO,KAAK,KAAK,SAAS,IAC9D,OAAO,KAAK,OACZ;EACN,QAAQ;GAAE,GAAG,OAAO,KAAK;GAAQ;EAAa;CAChD;AACF;;;;;;;;AASA,SAAgB,uBAAuB,MAAkC;CACvE,OAAO;EACL,uBAAuB;EACvB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,GAAI,MAAM,OAAO,CAAC,IAAI,aAAa,KAAK,MAAM,IAAI,CAAC;CACrD,CAAC,CAAC,KAAK,IAAI;AACb;;AAqBA,MAAa,mCAA8D;CACzE,sBAAsB;CACtB,sBAAsB;AACxB;;;AA0BA,SAAS,oBAAoB,SAA+B;CAC1D,MAAM,KAAM,QAAiC;CAC7C,IAAI,OAAO,OAAO,UAAU,OAAO;CACnC,IAAI,MAAM,OAAO,OAAO,UAAU;EAChC,MAAM,IAAI;EACV,IAAI,OAAO,EAAE,iBAAiB,UAAU,OAAO,EAAE;EACjD,IAAI,OAAO,EAAE,WAAW,UAAU,OAAO,EAAE;CAC7C;CACA,OAAO;AACT;;;AAIA,SAAgB,sBACd,SACA,MACiB;CACjB,MAAM,KAAK;EAAE,GAAG;EAAkC,GAAI,MAAM,cAAc,CAAC;CAAG;CAC9E,MA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