@geminixiang/mikan 1.0.0-beta.67 → 1.0.0-beta.69

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 (49) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/adapters/slack/auto-reply-context.d.ts +7 -5
  3. package/dist/adapters/slack/auto-reply-context.d.ts.map +1 -1
  4. package/dist/adapters/slack/auto-reply-context.js +11 -53
  5. package/dist/adapters/slack/auto-reply-context.js.map +1 -1
  6. package/dist/adapters/slack/bot.d.ts +8 -0
  7. package/dist/adapters/slack/bot.d.ts.map +1 -1
  8. package/dist/adapters/slack/bot.js +65 -11
  9. package/dist/adapters/slack/bot.js.map +1 -1
  10. package/dist/adapters/slack/jev-context.d.ts +30 -0
  11. package/dist/adapters/slack/jev-context.d.ts.map +1 -0
  12. package/dist/adapters/slack/jev-context.js +67 -0
  13. package/dist/adapters/slack/jev-context.js.map +1 -0
  14. package/dist/adapters/slack/task-intent.d.ts +32 -0
  15. package/dist/adapters/slack/task-intent.d.ts.map +1 -0
  16. package/dist/adapters/slack/task-intent.js +72 -0
  17. package/dist/adapters/slack/task-intent.js.map +1 -0
  18. package/dist/adapters/slack/task-status.d.ts.map +1 -1
  19. package/dist/adapters/slack/task-status.js +6 -0
  20. package/dist/adapters/slack/task-status.js.map +1 -1
  21. package/dist/env-manifest.js +1 -1
  22. package/dist/env-manifest.js.map +1 -1
  23. package/dist/harness/index.d.ts +1 -1
  24. package/dist/harness/index.d.ts.map +1 -1
  25. package/dist/harness/index.js.map +1 -1
  26. package/dist/harness/jev.d.ts +32 -11
  27. package/dist/harness/jev.d.ts.map +1 -1
  28. package/dist/harness/jev.js +103 -45
  29. package/dist/harness/jev.js.map +1 -1
  30. package/dist/harness/presenter.d.ts.map +1 -1
  31. package/dist/harness/presenter.js +4 -3
  32. package/dist/harness/presenter.js.map +1 -1
  33. package/dist/harness/prompt.d.ts.map +1 -1
  34. package/dist/harness/prompt.js +1 -0
  35. package/dist/harness/prompt.js.map +1 -1
  36. package/dist/harness/subagent-profiles.js +5 -5
  37. package/dist/harness/subagent-profiles.js.map +1 -1
  38. package/dist/harness/tools/index.d.ts.map +1 -1
  39. package/dist/harness/tools/index.js +3 -0
  40. package/dist/harness/tools/index.js.map +1 -1
  41. package/dist/harness/tools/jev.d.ts +21 -0
  42. package/dist/harness/tools/jev.d.ts.map +1 -0
  43. package/dist/harness/tools/jev.js +109 -0
  44. package/dist/harness/tools/jev.js.map +1 -0
  45. package/dist/sessions/session-store.d.ts +2 -0
  46. package/dist/sessions/session-store.d.ts.map +1 -1
  47. package/dist/sessions/session-store.js +1 -0
  48. package/dist/sessions/session-store.js.map +1 -1
  49. package/package.json +2 -1
@@ -1 +1 @@
1
- {"version":3,"file":"subagent-profiles.js","sourceRoot":"","sources":["../../src/harness/subagent-profiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAU3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,gBAAgB,GAAsB;IAC1C;QACE,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,4EAA4E;QACzF,YAAY,EAAE;YACZ,sFAAsF;YACtF,EAAE;YACF,maAAma;YACna,EAAE;YACF,8KAA8K;SAC/K,CAAC,IAAI,CAAC,IAAI,CAAC;QACZ,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC;QACxC,aAAa,EAAE,MAAM;QACrB,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,SAAS;KACrB;IACD;QACE,IAAI,EAAE,mBAAmB;QACzB,WAAW,EACT,sFAAsF;QACxF,YAAY,EAAE;YACZ,gFAAgF;YAChF,EAAE;YACF,iaAAia;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G,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;YACvF,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACtC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,WAAW,CAAC,IAAI,CAAC;gBACf,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;gBAC/D,IAAI,EAAE,QAAQ;aACf,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;AACnC,CAAC","sourcesContent":["/**\n * Subagent profiles: the curated capability sets a subagent may be launched\n * with.\n *\n * Profiles exist because the two halves of a subagent definition have\n * different owners. What a profile *does* — its tools, required evidence,\n * prompt and budget — is portable, so it ships as a built-in below and is\n * versioned with the code. Which model runs it is per-installation, so it is\n * overridden by `<workspaceDir>/agents/<name>.md`.\n *\n * A workspace file therefore *patches* the built-in of the same name rather\n * than replacing it: overriding only `model:` must not force an operator to\n * restate the tools and prompt, because a restated copy silently drifts from\n * the built-in it was cloned from. A file whose name matches no built-in\n * defines a new profile and must supply `tools` itself.\n *\n * A malformed file is reported as a diagnostic and skipped, never thrown:\n * these are hand-edited, and one typo must not take the whole workspace down.\n */\nimport { existsSync, readFileSync, readdirSync } from \"node:fs\";\nimport { basename, join } from \"node:path\";\nimport type { ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport type {\n LoadSubagentProfilesResult,\n SubagentModelSpec,\n SubagentProfile,\n SubagentProfileDiagnostic,\n} from \"./types.js\";\n\nexport type { LoadSubagentProfilesResult, SubagentProfileDiagnostic } from \"./types.js\";\nimport { parseFrontmatter } from \"./skills.js\";\n\nconst BUILTIN_PROFILES: SubagentProfile[] = [\n {\n name: \"worker\",\n description: \"Completes a bounded general-purpose task without adding domain assumptions\",\n systemPrompt: [\n \"You are a general-purpose worker responsible for one clearly bounded delegated task.\",\n \"\",\n \"Use `read` and `bash` to inspect the actual workspace state, and use `edit` or `write` only when the assignment requires changes. Follow applicable skill instructions, preserve behavior outside the stated scope, and do not invent requirements or broaden the task. Verify concrete outputs before reporting success; if the assignment lacks information or a required capability, state the limitation instead of guessing.\",\n \"\",\n \"Keep verbose discovery and command output in this isolated run. Return the completed result, files or artifacts changed, verification performed, and any unresolved blocker.\",\n ].join(\"\\n\"),\n tools: [\"read\", \"bash\", \"edit\", \"write\"],\n thinkingLevel: \"high\",\n maxTurns: 30,\n maxTokens: 1_000_000,\n },\n {\n name: \"software-engineer\",\n description:\n \"Owns software investigation, implementation, integration, and technical verification\",\n systemPrompt: [\n \"You are the software engineer responsible for one delegated technical outcome.\",\n \"\",\n \"Apply the relevant engineering and vendor skill instructions. Use `bash` to inspect repositories, run development tools, diagnose browser or integration behavior, and make only changes explicitly included in the assignment. Trace failures to their technical cause, preserve existing contracts outside scope, and verify work with the narrowest meaningful checks. Do not treat plausible output as evidence of success.\",\n \"\",\n \"Keep source discovery, build logs, browser traces, and repetitive diagnostics in this isolated run. Return the implemented or diagnosed outcome, decisive technical evidence, changed artifact paths when applicable, verification results, and remaining engineering risk.\",\n ].join(\"\\n\"),\n tools: [\"read\", \"bash\", \"edit\", \"write\"],\n thinkingLevel: \"high\",\n maxTurns: 35,\n maxTokens: 1_000_000,\n },\n {\n name: \"devops-engineer\",\n description:\n \"Owns cloud access, environments, deployments, and production workflow reliability\",\n systemPrompt: [\n \"You are the DevOps engineer responsible for one delegated infrastructure or production-operations outcome.\",\n \"\",\n \"Apply the relevant setup, GCP, repository-access, service-status, and production workflow skill instructions. Use `bash` to inspect current state before acting. Respect the named project, environment, principal, and resource scope; protect credentials; prefer least privilege; and check idempotency before writes, retries, or provisioning. Do not broaden access or repeat a non-idempotent operation without explicit authorization and evidence that it is needed.\",\n \"\",\n \"Keep verbose CLI, API, and job logs in this isolated run. Return the resulting state, affected resources or job identifiers, verification performed, and concrete follow-up or rollback information.\",\n ].join(\"\\n\"),\n tools: [\"read\", \"bash\", \"edit\", \"write\", \"event\", \"sandbox\"],\n thinkingLevel: \"high\",\n maxTurns: 40,\n maxTokens: 1_000_000,\n },\n {\n name: \"data-scientist\",\n description:\n \"Owns metric definition, data analysis, reconciliation, and defensible conclusions\",\n systemPrompt: [\n \"You are the data scientist responsible for answering one delegated quantitative question.\",\n \"\",\n \"Apply the relevant Metabase, GAM, accounting, billing, reporting, and parser skill instructions. Use `bash` to run the prescribed queries and analysis tools. Establish the time range, timezone, filters, dimensions, population, and metric definitions before interpreting results. Reconcile totals and cross-check consequential figures when practical. Separate source values, derived calculations, and inference; never fill missing data with guesses.\",\n \"\",\n \"Keep verbose rows and query output in this isolated run. Return the conclusion, key figures with units and scope, methodology and checks, and limitations that affect confidence.\",\n ].join(\"\\n\"),\n tools: [\"read\", \"bash\", \"write\"],\n thinkingLevel: \"high\",\n maxTurns: 35,\n maxTokens: 1_000_000,\n },\n {\n name: \"account-manager\",\n description:\n \"Owns existing-client onboarding, account coordination, and delivery follow-through\",\n systemPrompt: [\n \"You are the account manager responsible for one delegated existing-client outcome.\",\n \"\",\n \"Apply the relevant onboarding, publisher account, slot, workspace, meeting, and communication skill instructions. Use `bash` to inspect the current customer and account state before acting. Preserve supplied commercial and technical requirements, coordinate dependencies, avoid duplicate account changes, and clearly distinguish completed work from items awaiting another owner. Do not invent customer approval or make an external commitment beyond the assignment.\",\n \"\",\n \"Keep verbose records and operational output in this isolated run. Return the customer-facing outcome, account or artifact identifiers, decisions and blockers, and the next owner and action where follow-through remains.\",\n ].join(\"\\n\"),\n tools: [\"read\", \"bash\", \"write\", \"event\"],\n thinkingLevel: \"high\",\n maxTurns: 30,\n maxTokens: 1_000_000,\n },\n {\n name: \"business-development\",\n description:\n \"Owns prospect research, qualification, contact discovery, and outreach preparation\",\n systemPrompt: [\n \"You are the business development specialist responsible for one delegated growth opportunity.\",\n \"\",\n \"Apply the relevant prospecting, website sampling, contact-finding, email-validation, and client-approach skill instructions. Use `bash` to gather and verify public evidence. Evaluate fit against the supplied criteria, distinguish verified contacts from inferred ones, and preserve source URLs. Do not contact prospects, submit forms, or represent that outreach occurred unless the assignment explicitly authorizes it.\",\n \"\",\n \"Keep raw pages, candidate lists, and repetitive validation output in this isolated run. Return qualified opportunities, supporting evidence, confidence and disqualifiers, and a concise recommended next action.\",\n ].join(\"\\n\"),\n tools: [\"read\", \"bash\", \"write\"],\n thinkingLevel: \"high\",\n maxTurns: 30,\n maxTokens: 1_000_000,\n },\n {\n name: \"creative-producer\",\n description: \"Owns media deliverables from creative brief through verified production output\",\n systemPrompt: [\n \"You are the creative producer responsible for one delegated media deliverable.\",\n \"\",\n \"Apply the relevant source acquisition, storyboard, video, image, speech, lipsync, and generation-provider skill instructions. Use `bash` to run the prescribed production tools, and `generate_image` for image deliverables. Confirm the brief, audience, format, dimensions, duration, language, and source inputs; use discovery commands rather than guessing provider or model identifiers. Preserve provenance and generation parameters, and verify that claimed outputs exist and match the requested technical properties.\",\n \"\",\n \"Keep generation logs, intermediate assets, and provider polling in this isolated run. Return deliverable paths or external identifiers, a concise production summary, verification results, and unresolved creative, quality, or rights constraints.\",\n ].join(\"\\n\"),\n tools: [\"read\", \"bash\", \"write\", \"generate_image\"],\n thinkingLevel: \"high\",\n maxTurns: 40,\n maxTokens: 1_000_000,\n },\n {\n name: \"ad-operations-specialist\",\n description:\n \"Owns ad serving setup, delivery diagnostics, policy checks, and operational health\",\n systemPrompt: [\n \"You are the ad operations specialist responsible for one delegated advertising-delivery outcome.\",\n \"\",\n \"Apply the relevant GAM, ads.txt, player detection, targeting, behavior, monitoring, and policy skill instructions. Use `bash` to run the prescribed browser and reporting tools. Establish the site, account, slot, time window, geography, device, and consent conditions; distinguish configuration, eligibility, request, impression, and playback evidence. Reproduce dynamic behavior when practical, and do not change live serving configuration unless explicitly authorized.\",\n \"\",\n \"Keep browser traces, HAR data, report rows, and repetitive diagnostics in this isolated run. Return the operational conclusion, decisive delivery evidence, affected inventory, remediation or escalation owner, and uncertainty that could change the diagnosis.\",\n ].join(\"\\n\"),\n tools: [\"read\", \"bash\", \"write\"],\n thinkingLevel: \"high\",\n maxTurns: 35,\n maxTokens: 1_000_000,\n },\n {\n name: \"summarizer\",\n description:\n \"Synthesizes supplied task input and upstream DAG dependency output without claiming external verification\",\n systemPrompt: [\n \"You synthesize only the task text and structured dependency input supplied to this run — typically the combined output of upstream DAG nodes that did their own investigation.\",\n \"\",\n \"Do not claim to have inspected files, executed commands, accessed URLs, or verified external state. Clearly distinguish dependency-provided facts from your own analysis. If the supplied evidence is insufficient, state the limitation instead of inventing details.\",\n ].join(\"\\n\"),\n tools: [],\n thinkingLevel: \"high\",\n maxTurns: 20,\n maxTokens: 1_000_000,\n },\n];\n\nconst THINKING_LEVELS = new Set<ThinkingLevel>([\n \"off\",\n \"minimal\",\n \"low\",\n \"medium\",\n \"high\",\n \"xhigh\",\n]);\n\n/** Parse a comma-separated tool list. The literal `none` is an empty grant. */\nfunction csv(value: string): string[] {\n if (value.trim() === \"none\") return [];\n return [\n ...new Set(\n value\n .split(\",\")\n .map((item) => item.trim())\n .filter(Boolean),\n ),\n ];\n}\n\nfunction parseModel(value: string): SubagentModelSpec {\n const separator = value.indexOf(\"/\");\n if (separator <= 0 || separator === value.length - 1) {\n throw new Error(`model must be provider/id, got ${value}`);\n }\n return { provider: value.slice(0, separator), id: value.slice(separator + 1) };\n}\n\nfunction parseThinking(value: string): ThinkingLevel {\n if (!THINKING_LEVELS.has(value as ThinkingLevel)) {\n throw new Error(`unknown thinking level: ${value}`);\n }\n return value as ThinkingLevel;\n}\n\nfunction parsePositiveInteger(value: string, field: string): number {\n const parsed = Number(value);\n if (!Number.isInteger(parsed) || parsed <= 0) {\n throw new Error(`${field} must be a positive integer`);\n }\n return parsed;\n}\n\nfunction parseNonNegativeNumber(value: string, field: string): number {\n const parsed = Number(value);\n if (!Number.isFinite(parsed) || parsed < 0) {\n throw new Error(`${field} must be a non-negative number`);\n }\n return parsed;\n}\n\n/** Apply `field` from frontmatter onto `patch` only when the file sets it. */\nfunction applyField<K extends keyof SubagentProfile>(\n patch: Partial<SubagentProfile>,\n values: Record<string, string>,\n key: string,\n field: K,\n parse: (value: string) => SubagentProfile[K],\n): void {\n const raw = values[key];\n if (raw === undefined) return;\n patch[field] = parse(raw);\n}\n\n/**\n * Build the overlay a single file contributes. Throws with a human-readable\n * message on malformed input; the caller turns that into a diagnostic.\n */\nfunction parseProfilePatch(filePath: string, base: SubagentProfile | undefined): SubagentProfile {\n const { values, body } = parseFrontmatter(readFileSync(filePath, \"utf-8\"));\n const name = basename(filePath, \".md\");\n const patch: Partial<SubagentProfile> = {};\n\n applyField(patch, values, \"description\", \"description\", (value) => value.trim());\n applyField(patch, values, \"tools\", \"tools\", csv);\n applyField(patch, values, \"model\", \"model\", parseModel);\n applyField(patch, values, \"thinking\", \"thinkingLevel\", parseThinking);\n applyField(patch, values, \"max_turns\", \"maxTurns\", (v) => parsePositiveInteger(v, \"max_turns\"));\n applyField(patch, values, \"max_tokens\", \"maxTokens\", (v) =>\n parsePositiveInteger(v, \"max_tokens\"),\n );\n applyField(patch, values, \"max_cost_usd\", \"maxCostUsd\", (v) =>\n parseNonNegativeNumber(v, \"max_cost_usd\"),\n );\n applyField(patch, values, \"max_duration_ms\", \"maxDurationMs\", (v) =>\n parsePositiveInteger(v, \"max_duration_ms\"),\n );\n\n const systemPrompt = body.trim() || base?.systemPrompt;\n if (!base && patch.tools === undefined) {\n throw new Error(`tools is required for a new profile (no built-in named ${name})`);\n }\n if (!systemPrompt) {\n throw new Error(`a new profile needs prompt text in the file body`);\n }\n\n const merged: SubagentProfile = {\n ...base,\n ...patch,\n name,\n description: patch.description || base?.description || name,\n systemPrompt,\n tools: patch.tools ?? base?.tools ?? [],\n };\n return merged;\n}\n\n/**\n * Load the built-in profiles, then patch them with `<workspaceDir>/agents/*.md`.\n * Malformed files are reported and skipped, leaving the built-in in place.\n */\nexport function loadSubagentProfiles(workspaceDir: string): LoadSubagentProfilesResult {\n const dir = join(workspaceDir, \"agents\");\n const profiles = new Map(BUILTIN_PROFILES.map((profile) => [profile.name, profile]));\n const diagnostics: SubagentProfileDiagnostic[] = [];\n if (!existsSync(dir)) return { profiles, diagnostics };\n\n let entries;\n try {\n entries = readdirSync(dir, { withFileTypes: true });\n } catch (error) {\n diagnostics.push({\n type: \"warning\",\n message: error instanceof Error ? error.message : String(error),\n path: dir,\n });\n return { profiles, diagnostics };\n }\n\n for (const entry of entries) {\n if (!entry.isFile() || !entry.name.endsWith(\".md\")) continue;\n const filePath = join(dir, entry.name);\n try {\n const profile = parseProfilePatch(filePath, profiles.get(basename(entry.name, \".md\")));\n profiles.set(profile.name, profile);\n } catch (error) {\n diagnostics.push({\n type: \"warning\",\n message: error instanceof Error ? error.message : String(error),\n path: filePath,\n });\n }\n }\n return { profiles, diagnostics };\n}\n"]}
1
+ {"version":3,"file":"subagent-profiles.js","sourceRoot":"","sources":["../../src/harness/subagent-profiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAU3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,gBAAgB,GAAsB;IAC1C;QACE,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,4EAA4E;QACzF,YAAY,EAAE;YACZ,sFAAsF;YACtF,EAAE;YACF,maAAma;YACna,EAAE;YACF,8KAA8K;SAC/K,CAAC,IAAI,CAAC,IAAI,CAAC;QACZ,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KA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AC5B,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;YAAE,SAAS;QAC7D,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;YACvF,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACtC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,WAAW,CAAC,IAAI,CAAC;gBACf,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;gBAC/D,IAAI,EAAE,QAAQ;aACf,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;AACnC,CAAC","sourcesContent":["/**\n * Subagent profiles: the curated capability sets a subagent may be launched\n * with.\n *\n * Profiles exist because the two halves of a subagent definition have\n * different owners. What a profile *does* — its tools, required evidence,\n * prompt and budget — is portable, so it ships as a built-in below and is\n * versioned with the code. Which model runs it is per-installation, so it is\n * overridden by `<workspaceDir>/agents/<name>.md`.\n *\n * A workspace file therefore *patches* the built-in of the same name rather\n * than replacing it: overriding only `model:` must not force an operator to\n * restate the tools and prompt, because a restated copy silently drifts from\n * the built-in it was cloned from. A file whose name matches no built-in\n * defines a new profile and must supply `tools` itself.\n *\n * A malformed file is reported as a diagnostic and skipped, never thrown:\n * these are hand-edited, and one typo must not take the whole workspace down.\n */\nimport { existsSync, readFileSync, readdirSync } from \"node:fs\";\nimport { basename, join } from \"node:path\";\nimport type { ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport type {\n LoadSubagentProfilesResult,\n SubagentModelSpec,\n SubagentProfile,\n SubagentProfileDiagnostic,\n} from \"./types.js\";\n\nexport type { LoadSubagentProfilesResult, SubagentProfileDiagnostic } from \"./types.js\";\nimport { parseFrontmatter } from \"./skills.js\";\n\nconst BUILTIN_PROFILES: SubagentProfile[] = [\n {\n name: \"worker\",\n description: \"Completes a bounded general-purpose task without adding domain assumptions\",\n systemPrompt: [\n \"You are a general-purpose worker responsible for one clearly bounded delegated task.\",\n \"\",\n \"Use `read` and `bash` to inspect the actual workspace state, and use `edit` or `write` only when the assignment requires changes. Follow applicable skill instructions, preserve behavior outside the stated scope, and do not invent requirements or broaden the task. Verify concrete outputs before reporting success; if the assignment lacks information or a required capability, state the limitation instead of guessing.\",\n \"\",\n \"Keep verbose discovery and command output in this isolated run. Return the completed result, files or artifacts changed, verification performed, and any unresolved blocker.\",\n ].join(\"\\n\"),\n tools: [\"read\", \"bash\", \"edit\", \"write\", \"jev\"],\n thinkingLevel: \"high\",\n maxTurns: 30,\n maxTokens: 1_000_000,\n },\n {\n name: \"software-engineer\",\n description:\n \"Owns software investigation, implementation, integration, and technical verification\",\n systemPrompt: [\n \"You are the software engineer responsible for one delegated technical outcome.\",\n \"\",\n \"Apply the relevant engineering and vendor skill instructions. Use `bash` to inspect repositories, run development tools, diagnose browser or integration behavior, and make only changes explicitly included in the assignment. Trace failures to their technical cause, preserve existing contracts outside scope, and verify work with the narrowest meaningful checks. Do not treat plausible output as evidence of success.\",\n \"\",\n \"Keep source discovery, build logs, browser traces, and repetitive diagnostics in this isolated run. Return the implemented or diagnosed outcome, decisive technical evidence, changed artifact paths when applicable, verification results, and remaining engineering risk.\",\n ].join(\"\\n\"),\n tools: [\"read\", \"bash\", \"edit\", \"write\", \"jev\"],\n thinkingLevel: \"high\",\n maxTurns: 35,\n maxTokens: 1_000_000,\n },\n {\n name: \"devops-engineer\",\n description:\n \"Owns cloud access, environments, deployments, and production workflow reliability\",\n systemPrompt: [\n \"You are the DevOps engineer responsible for one delegated infrastructure or production-operations outcome.\",\n \"\",\n \"Apply the relevant setup, GCP, repository-access, service-status, and production workflow skill instructions. Use `bash` to inspect current state before acting. Respect the named project, environment, principal, and resource scope; protect credentials; prefer least privilege; and check idempotency before writes, retries, or provisioning. Do not broaden access or repeat a non-idempotent operation without explicit authorization and evidence that it is needed.\",\n \"\",\n \"Keep verbose CLI, API, and job logs in this isolated run. Return the resulting state, affected resources or job identifiers, verification performed, and concrete follow-up or rollback information.\",\n ].join(\"\\n\"),\n tools: [\"read\", \"bash\", \"edit\", \"write\", \"event\", \"sandbox\"],\n thinkingLevel: \"high\",\n maxTurns: 40,\n maxTokens: 1_000_000,\n },\n {\n name: \"data-scientist\",\n description:\n \"Owns metric definition, data analysis, reconciliation, and defensible conclusions\",\n systemPrompt: [\n \"You are the data scientist responsible for answering one delegated quantitative question.\",\n \"\",\n \"Apply the relevant Metabase, GAM, accounting, billing, reporting, and parser skill instructions. Use `bash` to run the prescribed queries and analysis tools. Establish the time range, timezone, filters, dimensions, population, and metric definitions before interpreting results. Reconcile totals and cross-check consequential figures when practical. Separate source values, derived calculations, and inference; never fill missing data with guesses.\",\n \"\",\n \"Keep verbose rows and query output in this isolated run. Return the conclusion, key figures with units and scope, methodology and checks, and limitations that affect confidence.\",\n ].join(\"\\n\"),\n tools: [\"read\", \"bash\", \"write\", \"jev\"],\n thinkingLevel: \"high\",\n maxTurns: 35,\n maxTokens: 1_000_000,\n },\n {\n name: \"account-manager\",\n description:\n \"Owns existing-client onboarding, account coordination, and delivery follow-through\",\n systemPrompt: [\n \"You are the account manager responsible for one delegated existing-client outcome.\",\n \"\",\n \"Apply the relevant onboarding, publisher account, slot, workspace, meeting, and communication skill instructions. Use `bash` to inspect the current customer and account state before acting. Preserve supplied commercial and technical requirements, coordinate dependencies, avoid duplicate account changes, and clearly distinguish completed work from items awaiting another owner. Do not invent customer approval or make an external commitment beyond the assignment.\",\n \"\",\n \"Keep verbose records and operational output in this isolated run. Return the customer-facing outcome, account or artifact identifiers, decisions and blockers, and the next owner and action where follow-through remains.\",\n ].join(\"\\n\"),\n tools: [\"read\", \"bash\", \"write\", \"event\"],\n thinkingLevel: \"high\",\n maxTurns: 30,\n maxTokens: 1_000_000,\n },\n {\n name: \"business-development\",\n description:\n \"Owns prospect research, qualification, contact discovery, and outreach preparation\",\n systemPrompt: [\n \"You are the business development specialist responsible for one delegated growth opportunity.\",\n \"\",\n \"Apply the relevant prospecting, website sampling, contact-finding, email-validation, and client-approach skill instructions. Use `bash` to gather and verify public evidence. Evaluate fit against the supplied criteria, distinguish verified contacts from inferred ones, and preserve source URLs. Do not contact prospects, submit forms, or represent that outreach occurred unless the assignment explicitly authorizes it.\",\n \"\",\n \"Keep raw pages, candidate lists, and repetitive validation output in this isolated run. Return qualified opportunities, supporting evidence, confidence and disqualifiers, and a concise recommended next action.\",\n ].join(\"\\n\"),\n tools: [\"read\", \"bash\", \"write\"],\n thinkingLevel: \"high\",\n maxTurns: 30,\n maxTokens: 1_000_000,\n },\n {\n name: \"creative-producer\",\n description: \"Owns media deliverables from creative brief through verified production output\",\n systemPrompt: [\n \"You are the creative producer responsible for one delegated media deliverable.\",\n \"\",\n \"Apply the relevant source acquisition, storyboard, video, image, speech, lipsync, and generation-provider skill instructions. Use `bash` to run the prescribed production tools, and `generate_image` for image deliverables. Confirm the brief, audience, format, dimensions, duration, language, and source inputs; use discovery commands rather than guessing provider or model identifiers. Preserve provenance and generation parameters, and verify that claimed outputs exist and match the requested technical properties.\",\n \"\",\n \"Keep generation logs, intermediate assets, and provider polling in this isolated run. Return deliverable paths or external identifiers, a concise production summary, verification results, and unresolved creative, quality, or rights constraints.\",\n ].join(\"\\n\"),\n tools: [\"read\", \"bash\", \"write\", \"generate_image\"],\n thinkingLevel: \"high\",\n maxTurns: 40,\n maxTokens: 1_000_000,\n },\n {\n name: \"ad-operations-specialist\",\n description:\n \"Owns ad serving setup, delivery diagnostics, policy checks, and operational health\",\n systemPrompt: [\n \"You are the ad operations specialist responsible for one delegated advertising-delivery outcome.\",\n \"\",\n \"Apply the relevant GAM, ads.txt, player detection, targeting, behavior, monitoring, and policy skill instructions. Use `bash` to run the prescribed browser and reporting tools. Establish the site, account, slot, time window, geography, device, and consent conditions; distinguish configuration, eligibility, request, impression, and playback evidence. Reproduce dynamic behavior when practical, and do not change live serving configuration unless explicitly authorized.\",\n \"\",\n \"Keep browser traces, HAR data, report rows, and repetitive diagnostics in this isolated run. Return the operational conclusion, decisive delivery evidence, affected inventory, remediation or escalation owner, and uncertainty that could change the diagnosis.\",\n ].join(\"\\n\"),\n tools: [\"read\", \"bash\", \"write\"],\n thinkingLevel: \"high\",\n maxTurns: 35,\n maxTokens: 1_000_000,\n },\n {\n name: \"summarizer\",\n description:\n \"Synthesizes supplied task input and upstream DAG dependency output without claiming external verification\",\n systemPrompt: [\n \"You synthesize only the task text and structured dependency input supplied to this run — typically the combined output of upstream DAG nodes that did their own investigation.\",\n \"\",\n \"Do not claim to have inspected files, executed commands, accessed URLs, or verified external state. Clearly distinguish dependency-provided facts from your own analysis. If the supplied evidence is insufficient, state the limitation instead of inventing details. `jev` is your only tool: use it to classify, rank, or check claims against the supplied input when the volume is large or a calibrated probability helps.\",\n ].join(\"\\n\"),\n tools: [\"jev\"],\n thinkingLevel: \"high\",\n maxTurns: 20,\n maxTokens: 1_000_000,\n },\n];\n\nconst THINKING_LEVELS = new Set<ThinkingLevel>([\n \"off\",\n \"minimal\",\n \"low\",\n \"medium\",\n \"high\",\n \"xhigh\",\n]);\n\n/** Parse a comma-separated tool list. The literal `none` is an empty grant. */\nfunction csv(value: string): string[] {\n if (value.trim() === \"none\") return [];\n return [\n ...new Set(\n value\n .split(\",\")\n .map((item) => item.trim())\n .filter(Boolean),\n ),\n ];\n}\n\nfunction parseModel(value: string): SubagentModelSpec {\n const separator = value.indexOf(\"/\");\n if (separator <= 0 || separator === value.length - 1) {\n throw new Error(`model must be provider/id, got ${value}`);\n }\n return { provider: value.slice(0, separator), id: value.slice(separator + 1) };\n}\n\nfunction parseThinking(value: string): ThinkingLevel {\n if (!THINKING_LEVELS.has(value as ThinkingLevel)) {\n throw new Error(`unknown thinking level: ${value}`);\n }\n return value as ThinkingLevel;\n}\n\nfunction parsePositiveInteger(value: string, field: string): number {\n const parsed = Number(value);\n if (!Number.isInteger(parsed) || parsed <= 0) {\n throw new Error(`${field} must be a positive integer`);\n }\n return parsed;\n}\n\nfunction parseNonNegativeNumber(value: string, field: string): number {\n const parsed = Number(value);\n if (!Number.isFinite(parsed) || parsed < 0) {\n throw new Error(`${field} must be a non-negative number`);\n }\n return parsed;\n}\n\n/** Apply `field` from frontmatter onto `patch` only when the file sets it. */\nfunction applyField<K extends keyof SubagentProfile>(\n patch: Partial<SubagentProfile>,\n values: Record<string, string>,\n key: string,\n field: K,\n parse: (value: string) => SubagentProfile[K],\n): void {\n const raw = values[key];\n if (raw === undefined) return;\n patch[field] = parse(raw);\n}\n\n/**\n * Build the overlay a single file contributes. Throws with a human-readable\n * message on malformed input; the caller turns that into a diagnostic.\n */\nfunction parseProfilePatch(filePath: string, base: SubagentProfile | undefined): SubagentProfile {\n const { values, body } = parseFrontmatter(readFileSync(filePath, \"utf-8\"));\n const name = basename(filePath, \".md\");\n const patch: Partial<SubagentProfile> = {};\n\n applyField(patch, values, \"description\", \"description\", (value) => value.trim());\n applyField(patch, values, \"tools\", \"tools\", csv);\n applyField(patch, values, \"model\", \"model\", parseModel);\n applyField(patch, values, \"thinking\", \"thinkingLevel\", parseThinking);\n applyField(patch, values, \"max_turns\", \"maxTurns\", (v) => parsePositiveInteger(v, \"max_turns\"));\n applyField(patch, values, \"max_tokens\", \"maxTokens\", (v) =>\n parsePositiveInteger(v, \"max_tokens\"),\n );\n applyField(patch, values, \"max_cost_usd\", \"maxCostUsd\", (v) =>\n parseNonNegativeNumber(v, \"max_cost_usd\"),\n );\n applyField(patch, values, \"max_duration_ms\", \"maxDurationMs\", (v) =>\n parsePositiveInteger(v, \"max_duration_ms\"),\n );\n\n const systemPrompt = body.trim() || base?.systemPrompt;\n if (!base && patch.tools === undefined) {\n throw new Error(`tools is required for a new profile (no built-in named ${name})`);\n }\n if (!systemPrompt) {\n throw new Error(`a new profile needs prompt text in the file body`);\n }\n\n const merged: SubagentProfile = {\n ...base,\n ...patch,\n name,\n description: patch.description || base?.description || name,\n systemPrompt,\n tools: patch.tools ?? base?.tools ?? [],\n };\n return merged;\n}\n\n/**\n * Load the built-in profiles, then patch them with `<workspaceDir>/agents/*.md`.\n * Malformed files are reported and skipped, leaving the built-in in place.\n */\nexport function loadSubagentProfiles(workspaceDir: string): LoadSubagentProfilesResult {\n const dir = join(workspaceDir, \"agents\");\n const profiles = new Map(BUILTIN_PROFILES.map((profile) => [profile.name, profile]));\n const diagnostics: SubagentProfileDiagnostic[] = [];\n if (!existsSync(dir)) return { profiles, diagnostics };\n\n let entries;\n try {\n entries = readdirSync(dir, { withFileTypes: true });\n } catch (error) {\n diagnostics.push({\n type: \"warning\",\n message: error instanceof Error ? error.message : String(error),\n path: dir,\n });\n return { profiles, diagnostics };\n }\n\n for (const entry of entries) {\n if (!entry.isFile() || !entry.name.endsWith(\".md\")) continue;\n const filePath = join(dir, entry.name);\n try {\n const profile = parseProfilePatch(filePath, profiles.get(basename(entry.name, \".md\")));\n profiles.set(profile.name, profile);\n } catch (error) {\n diagnostics.push({\n type: \"warning\",\n message: error instanceof Error ? error.message : String(error),\n path: filePath,\n });\n }\n }\n return { profiles, diagnostics };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/harness/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,KAAK,EAAE,QAAQ,EAAE,aA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CAAC,OAAO,EAAE;QAAE,OAAO,EAAE,aAAa,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CAClF,CAuCA"}
@@ -3,6 +3,7 @@ import { createEventTool } from "./event.js";
3
3
  import { createGenerateImageTool } from "./generate-image.js";
4
4
  import { adaptAgentTool, createSandboxTools } from "./pi-tools.js";
5
5
  import { createTaskTools } from "./task.js";
6
+ import { createJevTool } from "./jev.js";
6
7
  import { createReactTool } from "./react.js";
7
8
  import { createSandboxTool } from "./sandbox.js";
8
9
  export { createSubagentTool } from "./subagent.js";
@@ -14,6 +15,7 @@ platformToolPackFactories = [], imageGeneration) {
14
15
  const imageTool = imageGeneration ? createGenerateImageTool(imageGeneration) : undefined;
15
16
  const { tools: taskTools, bindTasks } = createTaskTools();
16
17
  const { tool: reactTool, setReactFunction } = createReactTool();
18
+ const jevTool = createJevTool();
17
19
  const { tool: eventTool, setEventContext } = createEventTool(eventStore);
18
20
  const { tool: sandboxTool, setSandboxContext } = createSandboxTool(sandboxController ?? { sandbox: executor.getSandboxConfig() });
19
21
  const platformToolPacks = platformToolPackFactories.map((createPack) => createPack());
@@ -27,6 +29,7 @@ platformToolPackFactories = [], imageGeneration) {
27
29
  adaptAgentTool(attachTool),
28
30
  ...(imageTool ? [adaptAgentTool(imageTool.tool)] : []),
29
31
  adaptAgentTool(reactTool),
32
+ adaptAgentTool(jevTool),
30
33
  ...taskTools.map(adaptAgentTool),
31
34
  ...packTools.map(adaptAgentTool),
32
35
  ],
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/harness/tools/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAI/C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAyB,MA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AAC,SAAS,CAAC;YACzB,cAAc,CAAC,WAAW,CAAC;YAC3B,cAAc,CAAC,UAAU,CAAC;YAC1B,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACtD,cAAc,CAAC,SAAS,CAAC;YACzB,GAAG,SAAS,CAAC,GAAG,CAAC,cAAc,CAAC;YAChC,GAAG,SAAS,CAAC,GAAG,CAAC,cAAc,CAAC;SACjC;QACD,iBAAiB;QACjB,sBAAsB,EAAE,CAAC,EAAE,EAAE,EAAE;YAC7B,SAAS,EAAE,iBAAiB,CAAC,EAAE,CAAC,CAAC;QACnC,CAAC;QACD,gBAAgB;QAChB,SAAS;QACT,qBAAqB,EAAE,CAAC,GAAG,EAAE,EAAE;YAC7B,KAAK,MAAM,IAAI,IAAI,iBAAiB,EAAE,CAAC;gBACrC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACpB,CAAC;QACH,CAAC;QACD,eAAe;QACf,iBAAiB;KAClB,CAAC;AACJ,CAAC","sourcesContent":["import type { Api, Model } from \"@earendil-works/pi-ai\";\nimport type { ConversationKind } from \"../../types.js\";\nimport { createAttachTool } from \"./attach.js\";\nimport type { Executor, SandboxConfig } from \"../../sandbox/index.js\";\nimport type { OfficeAddress, SandboxResourceController } from \"../../types.js\";\nimport type { EventStore } from \"../../events/index.js\";\nimport { createEventTool } from \"./event.js\";\nimport { createGenerateImageTool } from \"./generate-image.js\";\nimport { adaptAgentTool, createSandboxTools, type MikanHarnessTool } from \"./pi-tools.js\";\nimport { createTaskTools } from \"./task.js\";\nimport { createReactTool } from \"./react.js\";\nimport { createSandboxTool } from \"./sandbox.js\";\nimport type { PlatformToolPackFactory, PlatformToolRunContext } from \"./types.js\";\n\nexport { createSubagentTool } from \"./subagent.js\";\n\nexport function createMikanTools(\n executor: Executor,\n eventStore: EventStore,\n sandboxController?: {\n sandbox: SandboxConfig;\n resourceController?: Pick<SandboxResourceController, \"getLimitStatus\" | \"setLimits\">;\n },\n /** Platform capability pack factories (e.g. GitHub PR/CI); instantiated\n * here so each runner owns its packs' bind state. Not core tools. */\n platformToolPackFactories: readonly PlatformToolPackFactory[] = [],\n imageGeneration?: {\n model: Model<Api>;\n getApiKey: () => Promise<string | undefined>;\n outputDir: string;\n },\n): {\n tools: MikanHarnessTool[];\n setUploadFunction: (fn: (filePath: string, title?: string) => Promise<void>) => void;\n /** Upload for generate_image. Receives the file's HOST path — the tool\n * writes host-side, so this must not stage through the sandbox like the\n * attach upload does. No-op when image generation is not configured. */\n setImageUploadFunction: (fn: (hostPath: string, title?: string) => Promise<void>) => void;\n bindTasks: ReturnType<typeof createTaskTools>[\"bindTasks\"];\n setReactFunction: (fn: ((emoji: string) => Promise<void>) | null) => void;\n bindPlatformToolPacks: (ctx: PlatformToolRunContext) => void;\n setEventContext: (context: {\n platform: string;\n conversationId: string;\n conversationKind: ConversationKind;\n userId: string;\n }) => void;\n setSandboxContext: (context: { address: OfficeAddress; userId: string }) => void;\n} {\n const { tool: attachTool, setUploadFunction } = createAttachTool();\n const imageTool = imageGeneration ? createGenerateImageTool(imageGeneration) : undefined;\n const { tools: taskTools, bindTasks } = createTaskTools();\n const { tool: reactTool, setReactFunction } = createReactTool();\n const { tool: eventTool, setEventContext } = createEventTool(eventStore);\n const { tool: sandboxTool, setSandboxContext } = createSandboxTool(\n sandboxController ?? { sandbox: executor.getSandboxConfig() },\n );\n const platformToolPacks = platformToolPackFactories.map((createPack) => createPack());\n const packTools = platformToolPacks.flatMap((pack) => pack.tools);\n return {\n tools: [\n // pi-native read/write/edit/bash, addressed through the sandbox env.\n ...createSandboxTools(),\n adaptAgentTool(eventTool),\n adaptAgentTool(sandboxTool),\n adaptAgentTool(attachTool),\n ...(imageTool ? [adaptAgentTool(imageTool.tool)] : []),\n adaptAgentTool(reactTool),\n ...taskTools.map(adaptAgentTool),\n ...packTools.map(adaptAgentTool),\n ],\n setUploadFunction,\n setImageUploadFunction: (fn) => {\n imageTool?.setUploadFunction(fn);\n },\n setReactFunction,\n bindTasks,\n bindPlatformToolPacks: (ctx) => {\n for (const pack of platformToolPacks) {\n pack.bindRun(ctx);\n }\n },\n setEventContext,\n setSandboxContext,\n };\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/harness/tools/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAI/C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAyB,MAAM,eAAe,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,MAAM,UAAU,gBAAgB,CAC9B,QAAkB,EAClB,UAAsB,EACtB,iBAGC;AACD;sEACsE;AACtE,yBAAyB,GAAuC,EAAE,EAClE,eAIC;IAmBD,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,iBAAiB,EAAE,GAAG,gBAAgB,EAAE,CAAC;IACnE,MAAM,SAAS,GAAG,eAAe,CAAC,CAAC,CAAC,uBAAuB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACzF,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,eAAe,EAAE,CAAC;IAC1D,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAG,eAAe,EAAE,CAAC;IAChE,MAAM,OAAO,GAAG,aAAa,EAAE,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eAAe;QACf,iBAAiB;KAClB,CAAC;AACJ,CAAC","sourcesContent":["import type { Api, Model } from \"@earendil-works/pi-ai\";\nimport type { ConversationKind } from \"../../types.js\";\nimport { createAttachTool } from \"./attach.js\";\nimport type { Executor, SandboxConfig } from \"../../sandbox/index.js\";\nimport type { OfficeAddress, SandboxResourceController } from \"../../types.js\";\nimport type { EventStore } from \"../../events/index.js\";\nimport { createEventTool } from \"./event.js\";\nimport { createGenerateImageTool } from \"./generate-image.js\";\nimport { adaptAgentTool, createSandboxTools, type MikanHarnessTool } from \"./pi-tools.js\";\nimport { createTaskTools } from \"./task.js\";\nimport { createJevTool } from \"./jev.js\";\nimport { createReactTool } from \"./react.js\";\nimport { createSandboxTool } from \"./sandbox.js\";\nimport type { PlatformToolPackFactory, PlatformToolRunContext } from \"./types.js\";\n\nexport { createSubagentTool } from \"./subagent.js\";\n\nexport function createMikanTools(\n executor: Executor,\n eventStore: EventStore,\n sandboxController?: {\n sandbox: SandboxConfig;\n resourceController?: Pick<SandboxResourceController, \"getLimitStatus\" | \"setLimits\">;\n },\n /** Platform capability pack factories (e.g. GitHub PR/CI); instantiated\n * here so each runner owns its packs' bind state. Not core tools. */\n platformToolPackFactories: readonly PlatformToolPackFactory[] = [],\n imageGeneration?: {\n model: Model<Api>;\n getApiKey: () => Promise<string | undefined>;\n outputDir: string;\n },\n): {\n tools: MikanHarnessTool[];\n setUploadFunction: (fn: (filePath: string, title?: string) => Promise<void>) => void;\n /** Upload for generate_image. Receives the file's HOST path — the tool\n * writes host-side, so this must not stage through the sandbox like the\n * attach upload does. No-op when image generation is not configured. */\n setImageUploadFunction: (fn: (hostPath: string, title?: string) => Promise<void>) => void;\n bindTasks: ReturnType<typeof createTaskTools>[\"bindTasks\"];\n setReactFunction: (fn: ((emoji: string) => Promise<void>) | null) => void;\n bindPlatformToolPacks: (ctx: PlatformToolRunContext) => void;\n setEventContext: (context: {\n platform: string;\n conversationId: string;\n conversationKind: ConversationKind;\n userId: string;\n }) => void;\n setSandboxContext: (context: { address: OfficeAddress; userId: string }) => void;\n} {\n const { tool: attachTool, setUploadFunction } = createAttachTool();\n const imageTool = imageGeneration ? createGenerateImageTool(imageGeneration) : undefined;\n const { tools: taskTools, bindTasks } = createTaskTools();\n const { tool: reactTool, setReactFunction } = createReactTool();\n const jevTool = createJevTool();\n const { tool: eventTool, setEventContext } = createEventTool(eventStore);\n const { tool: sandboxTool, setSandboxContext } = createSandboxTool(\n sandboxController ?? { sandbox: executor.getSandboxConfig() },\n );\n const platformToolPacks = platformToolPackFactories.map((createPack) => createPack());\n const packTools = platformToolPacks.flatMap((pack) => pack.tools);\n return {\n tools: [\n // pi-native read/write/edit/bash, addressed through the sandbox env.\n ...createSandboxTools(),\n adaptAgentTool(eventTool),\n adaptAgentTool(sandboxTool),\n adaptAgentTool(attachTool),\n ...(imageTool ? [adaptAgentTool(imageTool.tool)] : []),\n adaptAgentTool(reactTool),\n adaptAgentTool(jevTool),\n ...taskTools.map(adaptAgentTool),\n ...packTools.map(adaptAgentTool),\n ],\n setUploadFunction,\n setImageUploadFunction: (fn) => {\n imageTool?.setUploadFunction(fn);\n },\n setReactFunction,\n bindTasks,\n bindPlatformToolPacks: (ctx) => {\n for (const pack of platformToolPacks) {\n pack.bindRun(ctx);\n }\n },\n setEventContext,\n setSandboxContext,\n };\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import type { AgentTool } from "@earendil-works/pi-agent-core";
2
+ declare const jevSchema: import("@sinclair/typebox").TObject<{
3
+ label: import("@sinclair/typebox").TString;
4
+ state: import("@sinclair/typebox").TAny;
5
+ questions: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TObject<{
6
+ type: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"boolean">, import("@sinclair/typebox").TLiteral<"choice">, import("@sinclair/typebox").TLiteral<"score">]>;
7
+ instructions: import("@sinclair/typebox").TAny;
8
+ criteria: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>;
9
+ }>>;
10
+ }>;
11
+ /**
12
+ * The `jev` tool is a direct pass-through of the Jev decisions API
13
+ * (`state` + typed `questions` → calibrated answers) so the model can use
14
+ * Jev the way any client would: it composes the state and questions itself.
15
+ * Unlike the harness-internal decision points, a missing OPENROUTER_API_KEY
16
+ * surfaces as a tool error so the model knows to judge for itself instead of
17
+ * silently falling back.
18
+ */
19
+ export declare function createJevTool(): AgentTool<typeof jevSchema>;
20
+ export {};
21
+ //# sourceMappingURL=jev.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jev.d.ts","sourceRoot":"","sources":["../../../src/harness/tools/jev.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AA+B/D,QAAA,MAAM,SAAS;;;;;;;;EAQb,CAAC;AAyCH;;;;;;;GAOG;AACH,wBAAgB,aAAa,IAAI,SAAS,CAAC,OAAO,SAAS,CAAC,CAiD3D"}
@@ -0,0 +1,109 @@
1
+ import { Type } from "@sinclair/typebox";
2
+ import { evaluateWithJev, JevNotConfiguredError, } from "../jev.js";
3
+ // State, instructions, and criteria descriptions all accept text or JSON
4
+ // structure per the Jev API; `Type.Any` keeps that open while the object root
5
+ // stays provider-safe.
6
+ const entrySchema = Type.Any({
7
+ description: "Text, or a JSON object or array. Jev reads structure, so labelled keys help.",
8
+ });
9
+ const questionSchema = Type.Object({
10
+ type: Type.Union([Type.Literal("boolean"), Type.Literal("choice"), Type.Literal("score")], {
11
+ description: "boolean: yes/no, answered as a probability 0-1. choice: pick one option from a set; answered with a probability per option and a confidence. score: place the state on an ordered rubric; answered with a score (fractional between levels), a probability per level, and a confidence.",
12
+ }),
13
+ instructions: entrySchema,
14
+ criteria: Type.Optional(Type.Any({
15
+ description: 'choice (required): object mapping option id -> description (string, JSON, or null when the id is self-explanatory). score (required): array of level descriptions, lowest first. boolean (optional): {"true": description of yes, "false": description of no}.',
16
+ })),
17
+ });
18
+ const jevSchema = Type.Object({
19
+ label: Type.String({ description: "Brief description of the judgment (shown to user)" }),
20
+ state: entrySchema,
21
+ questions: Type.Record(Type.String(), questionSchema, {
22
+ description: "Questions keyed by id. Every question is evaluated independently against the same state in one request.",
23
+ minProperties: 1,
24
+ }),
25
+ });
26
+ function isRecord(value) {
27
+ return typeof value === "object" && value !== null && !Array.isArray(value);
28
+ }
29
+ function toJevQuestion(id, question) {
30
+ const instructions = question.instructions;
31
+ if (question.type === "boolean") {
32
+ if (question.criteria === undefined)
33
+ return { type: "boolean", instructions };
34
+ if (!isRecord(question.criteria)) {
35
+ throw new Error(`Question "${id}" (boolean) criteria must be {"true": …, "false": …}`);
36
+ }
37
+ return {
38
+ type: "boolean",
39
+ instructions,
40
+ criteria: question.criteria,
41
+ };
42
+ }
43
+ if (question.type === "choice") {
44
+ if (!isRecord(question.criteria) || Object.keys(question.criteria).length < 2) {
45
+ throw new Error(`Question "${id}" (choice) criteria must be an object with at least two options`);
46
+ }
47
+ return {
48
+ type: "choice",
49
+ instructions,
50
+ criteria: question.criteria,
51
+ };
52
+ }
53
+ if (!Array.isArray(question.criteria) || question.criteria.length < 2) {
54
+ throw new Error(`Question "${id}" (score) criteria must be an array of at least two levels, lowest first`);
55
+ }
56
+ return { type: "score", instructions, criteria: question.criteria };
57
+ }
58
+ /**
59
+ * The `jev` tool is a direct pass-through of the Jev decisions API
60
+ * (`state` + typed `questions` → calibrated answers) so the model can use
61
+ * Jev the way any client would: it composes the state and questions itself.
62
+ * Unlike the harness-internal decision points, a missing OPENROUTER_API_KEY
63
+ * surfaces as a tool error so the model knows to judge for itself instead of
64
+ * silently falling back.
65
+ */
66
+ export function createJevTool() {
67
+ return {
68
+ name: "jev",
69
+ label: "jev",
70
+ description: [
71
+ "Ask Jev, a fast calibrated decision model, typed questions about a state. Jev never generates text; it returns probabilities.",
72
+ "state: the material to judge — text, or a JSON object/array (prefer labelled keys). questions: any number of boolean / choice / score questions, all evaluated against that state in one request.",
73
+ "Use it for classification, detection, scoring, ranking, routing, extraction over known candidates, and verification — anywhere you would otherwise judge by eye.",
74
+ "Ask narrow, atomic questions and batch them: to rank N items, ask one score question per item (not one choice over orderings); to verify a summary, ask one boolean per claim.",
75
+ "choice and score answers carry a confidence; below 0.5 Jev is unsure between options, so say so instead of presenting the top option as settled.",
76
+ ].join(" "),
77
+ parameters: jevSchema,
78
+ execute: async (_toolCallId, args, signal) => {
79
+ if (signal?.aborted)
80
+ throw new Error("Operation aborted");
81
+ const questions = {};
82
+ for (const [id, question] of Object.entries(args.questions)) {
83
+ questions[id] = toJevQuestion(id, question);
84
+ }
85
+ let result;
86
+ try {
87
+ result = await evaluateWithJev(args.state, questions, {
88
+ abortSignal: signal,
89
+ });
90
+ }
91
+ catch (error) {
92
+ if (error instanceof JevNotConfiguredError) {
93
+ throw new Error("Jev is not configured (OPENROUTER_API_KEY missing). Judge the input yourself.", { cause: error });
94
+ }
95
+ throw error;
96
+ }
97
+ return {
98
+ content: [
99
+ {
100
+ type: "text",
101
+ text: JSON.stringify({ answers: result.answers, model: result.model, usage: result.usage }, null, 2),
102
+ },
103
+ ],
104
+ details: undefined,
105
+ };
106
+ },
107
+ };
108
+ }
109
+ //# sourceMappingURL=jev.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jev.js","sourceRoot":"","sources":["../../../src/harness/tools/jev.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAe,MAAM,mBAAmB,CAAC;AACtD,OAAO,EACL,eAAe,EACf,qBAAqB,GAItB,MAAM,WAAW,CAAC;AAEnB,yEAAyE;AACzE,8EAA8E;AAC9E,uBAAuB;AACvB,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC;IAC3B,WAAW,EAAE,8EAA8E;CAC5F,CAAC,CAAC;AAEH,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC;IACjC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,I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C,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;gBAC5D,SAAS,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;YAC9C,CAAC;YAED,IAAI,MAAM,CAAC;YACX,IAAI,CAAC;gBACH,MAAM,GAAG,MAAM,eAAe,CAAC,IAAI,CAAC,KAAiB,EAAE,SAAS,EAAE;oBAChE,WAAW,EAAE,MAAM;iBACpB,CAAC,CAAC;YACL,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,KAAK,YAAY,qBAAqB,EAAE,CAAC;oBAC3C,MAAM,IAAI,KAAK,CACb,+EAA+E,EAC/E,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CAAC;gBACJ,CAAC;gBACD,MAAM,KAAK,CAAC;YACd,CAAC;YAED,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,EACrE,IAAI,EACJ,CAAC,CACF;qBACF;iBACF;gBACD,OAAO,EAAE,SAAS;aACnB,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { AgentTool } from \"@earendil-works/pi-agent-core\";\nimport { Type, type Static } from \"@sinclair/typebox\";\nimport {\n evaluateWithJev,\n JevNotConfiguredError,\n type JevEntry,\n type JevQuestion,\n type JevQuestions,\n} from \"../jev.js\";\n\n// State, instructions, and criteria descriptions all accept text or JSON\n// structure per the Jev API; `Type.Any` keeps that open while the object root\n// stays provider-safe.\nconst entrySchema = Type.Any({\n description: \"Text, or a JSON object or array. Jev reads structure, so labelled keys help.\",\n});\n\nconst questionSchema = Type.Object({\n type: Type.Union([Type.Literal(\"boolean\"), Type.Literal(\"choice\"), Type.Literal(\"score\")], {\n description:\n \"boolean: yes/no, answered as a probability 0-1. choice: pick one option from a set; answered with a probability per option and a confidence. score: place the state on an ordered rubric; answered with a score (fractional between levels), a probability per level, and a confidence.\",\n }),\n instructions: entrySchema,\n criteria: Type.Optional(\n Type.Any({\n description:\n 'choice (required): object mapping option id -> description (string, JSON, or null when the id is self-explanatory). score (required): array of level descriptions, lowest first. boolean (optional): {\"true\": description of yes, \"false\": description of no}.',\n }),\n ),\n});\n\nconst jevSchema = Type.Object({\n label: Type.String({ description: \"Brief description of the judgment (shown to user)\" }),\n state: entrySchema,\n questions: Type.Record(Type.String(), questionSchema, {\n description:\n \"Questions keyed by id. Every question is evaluated independently against the same state in one request.\",\n minProperties: 1,\n }),\n});\n\ntype QuestionArg = Static<typeof questionSchema>;\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction toJevQuestion(id: string, question: QuestionArg): JevQuestion {\n const instructions = question.instructions as JevEntry;\n if (question.type === \"boolean\") {\n if (question.criteria === undefined) return { type: \"boolean\", instructions };\n if (!isRecord(question.criteria)) {\n throw new Error(`Question \"${id}\" (boolean) criteria must be {\"true\": …, \"false\": …}`);\n }\n return {\n type: \"boolean\",\n instructions,\n criteria: question.criteria as { true?: JevEntry; false?: JevEntry },\n };\n }\n if (question.type === \"choice\") {\n if (!isRecord(question.criteria) || Object.keys(question.criteria).length < 2) {\n throw new Error(\n `Question \"${id}\" (choice) criteria must be an object with at least two options`,\n );\n }\n return {\n type: \"choice\",\n instructions,\n criteria: question.criteria as Record<string, JevEntry>,\n };\n }\n if (!Array.isArray(question.criteria) || question.criteria.length < 2) {\n throw new Error(\n `Question \"${id}\" (score) criteria must be an array of at least two levels, lowest first`,\n );\n }\n return { type: \"score\", instructions, criteria: question.criteria as JevEntry[] };\n}\n\n/**\n * The `jev` tool is a direct pass-through of the Jev decisions API\n * (`state` + typed `questions` → calibrated answers) so the model can use\n * Jev the way any client would: it composes the state and questions itself.\n * Unlike the harness-internal decision points, a missing OPENROUTER_API_KEY\n * surfaces as a tool error so the model knows to judge for itself instead of\n * silently falling back.\n */\nexport function createJevTool(): AgentTool<typeof jevSchema> {\n return {\n name: \"jev\",\n label: \"jev\",\n description: [\n \"Ask Jev, a fast calibrated decision model, typed questions about a state. Jev never generates text; it returns probabilities.\",\n \"state: the material to judge — text, or a JSON object/array (prefer labelled keys). questions: any number of boolean / choice / score questions, all evaluated against that state in one request.\",\n \"Use it for classification, detection, scoring, ranking, routing, extraction over known candidates, and verification — anywhere you would otherwise judge by eye.\",\n \"Ask narrow, atomic questions and batch them: to rank N items, ask one score question per item (not one choice over orderings); to verify a summary, ask one boolean per claim.\",\n \"choice and score answers carry a confidence; below 0.5 Jev is unsure between options, so say so instead of presenting the top option as settled.\",\n ].join(\" \"),\n parameters: jevSchema,\n execute: async (_toolCallId, args, signal) => {\n if (signal?.aborted) throw new Error(\"Operation aborted\");\n const questions: JevQuestions = {};\n for (const [id, question] of Object.entries(args.questions)) {\n questions[id] = toJevQuestion(id, question);\n }\n\n let result;\n try {\n result = await evaluateWithJev(args.state as JevEntry, questions, {\n abortSignal: signal,\n });\n } catch (error) {\n if (error instanceof JevNotConfiguredError) {\n throw new Error(\n \"Jev is not configured (OPENROUTER_API_KEY missing). Judge the input yourself.\",\n { cause: error },\n );\n }\n throw error;\n }\n\n return {\n content: [\n {\n type: \"text\" as const,\n text: JSON.stringify(\n { answers: result.answers, model: result.model, usage: result.usage },\n null,\n 2,\n ),\n },\n ],\n details: undefined,\n };\n },\n };\n}\n"]}
@@ -19,6 +19,8 @@ export declare class SessionStore implements SessionInspection {
19
19
  /** Read native execution state without claiming the live file's writer. */
20
20
  static inspectExecution(path: string): Promise<{
21
21
  open: boolean;
22
+ /** False until the first operation is recorded: admitted, never run. */
23
+ started: boolean;
22
24
  result?: {
23
25
  status: "completed" | "aborted" | "failed" | "declined";
24
26
  endedAt: number;
@@ -1 +1 @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,GAChB,OAAO,CAAC,MAAM,CAAC,CAIjB;IAEK,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAIhD;IAEK,gBAAgB,CACpB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,YAAY,EAAE,EAC5B,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,OAAO,GAChB,OAAO,CAAC,MAAM,CAAC,CA0BjB;IAEK,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAsB3B;IAED,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,MAAM;YAUA,IAAI;CAyCnB"}
@@ -389,6 +389,7 @@ export class SessionStore {
389
389
  : undefined;
390
390
  return {
391
391
  open: state?.currentOperationId != null,
392
+ started: state?.currentOperationId != null || state?.lastOperationId != null,
392
393
  ...(result ? { result: { status: result.status, endedAt: result.endedAt } } : {}),
393
394
  };
394
395
  });