@voybio/ace-swarm 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +109 -0
- package/LICENSE +186 -0
- package/README.md +229 -0
- package/assets/.agents/ACE/ACE-Init/AGENTS.md +210 -0
- package/assets/.agents/ACE/ACE-Init/instructions.md +118 -0
- package/assets/.agents/ACE/ACE_coders/AGENTS.md +154 -0
- package/assets/.agents/ACE/ACE_coders/INSTRUCTIONS.md +216 -0
- package/assets/.agents/ACE/AGENT_REGISTRY.md +70 -0
- package/assets/.agents/ACE/AGENT_REGISTRY_7.md +9 -0
- package/assets/.agents/ACE/DIRECTIVE_KERNEL.md +234 -0
- package/assets/.agents/ACE/UI/AGENTS.md +115 -0
- package/assets/.agents/ACE/UI/instructions.md +178 -0
- package/assets/.agents/ACE/VOS/ACE_VOS_MISSING_INFO_MATRIX.md +42 -0
- package/assets/.agents/ACE/VOS/AGENTS.md +72 -0
- package/assets/.agents/ACE/VOS/instructions.md +211 -0
- package/assets/.agents/ACE/agent-astgrep/AGENTS.md +123 -0
- package/assets/.agents/ACE/agent-astgrep/instructions.md +91 -0
- package/assets/.agents/ACE/agent-builder/AGENTS.md +172 -0
- package/assets/.agents/ACE/agent-builder/instructions.md +137 -0
- package/assets/.agents/ACE/agent-docs/AGENTS.md +159 -0
- package/assets/.agents/ACE/agent-docs/instructions.md +133 -0
- package/assets/.agents/ACE/agent-eval/AGENTS.md +46 -0
- package/assets/.agents/ACE/agent-eval/instructions.md +56 -0
- package/assets/.agents/ACE/agent-memory/AGENTS.md +49 -0
- package/assets/.agents/ACE/agent-memory/instructions.md +50 -0
- package/assets/.agents/ACE/agent-observability/AGENTS.md +46 -0
- package/assets/.agents/ACE/agent-observability/instructions.md +50 -0
- package/assets/.agents/ACE/agent-ops/AGENTS.md +201 -0
- package/assets/.agents/ACE/agent-ops/instructions.md +136 -0
- package/assets/.agents/ACE/agent-qa/AGENTS.md +189 -0
- package/assets/.agents/ACE/agent-qa/instructions.md +121 -0
- package/assets/.agents/ACE/agent-release/AGENTS.md +48 -0
- package/assets/.agents/ACE/agent-release/instructions.md +49 -0
- package/assets/.agents/ACE/agent-research/AGENTS.md +160 -0
- package/assets/.agents/ACE/agent-research/instructions.md +118 -0
- package/assets/.agents/ACE/agent-security/AGENTS.md +48 -0
- package/assets/.agents/ACE/agent-security/instructions.md +50 -0
- package/assets/.agents/ACE/agent-skeptic/AGENTS.md +178 -0
- package/assets/.agents/ACE/agent-skeptic/instructions.md +196 -0
- package/assets/.agents/ACE/agent-spec/AGENTS.md +169 -0
- package/assets/.agents/ACE/agent-spec/instructions.md +116 -0
- package/assets/.agents/ACE/orchestrator/AGENTS.md +365 -0
- package/assets/.agents/ACE/orchestrator/instructions.md +231 -0
- package/assets/.agents/skills/ace-orchestrator/SKILL.md +63 -0
- package/assets/.agents/skills/ace-orchestrator/references/engineering-bootstrap-playbook.md +360 -0
- package/assets/.agents/skills/astgrep-index/SKILL.md +58 -0
- package/assets/.agents/skills/codemunch/SKILL.md +65 -0
- package/assets/.agents/skills/codemunch/references/ast-driven-protocol.md +543 -0
- package/assets/.agents/skills/codesnipe/SKILL.md +64 -0
- package/assets/.agents/skills/codesnipe/references/dual-codebase-playbook.md +671 -0
- package/assets/.agents/skills/eval-harness/SKILL.md +203 -0
- package/assets/.agents/skills/handoff-lint/SKILL.md +164 -0
- package/assets/.agents/skills/incident-commander/SKILL.md +174 -0
- package/assets/.agents/skills/landing-review-watcher/SKILL.md +68 -0
- package/assets/.agents/skills/memory-curator/SKILL.md +179 -0
- package/assets/.agents/skills/problem-triage/SKILL.md +57 -0
- package/assets/.agents/skills/problem-triage/agents/openai.yaml +3 -0
- package/assets/.agents/skills/release-sentry/SKILL.md +189 -0
- package/assets/.agents/skills/risk-quant/SKILL.md +190 -0
- package/assets/.agents/skills/schema-forge/SKILL.md +174 -0
- package/assets/.agents/skills/skill-auditor/SKILL.md +52 -0
- package/assets/.agents/skills/state-auditor/SKILL.md +182 -0
- package/assets/.github/hooks/ace-copilot.json +68 -0
- package/assets/agent-state/ACE_WORKFLOW.md +131 -0
- package/assets/agent-state/ARTIFACT_MANIFEST.json +5 -0
- package/assets/agent-state/AST_GREP_COMMANDS.md +121 -0
- package/assets/agent-state/AST_GREP_INDEX.json +13 -0
- package/assets/agent-state/AST_GREP_INDEX.md +15 -0
- package/assets/agent-state/DECISIONS.md +7 -0
- package/assets/agent-state/EVIDENCE_LOG.md +7 -0
- package/assets/agent-state/HANDOFF.json +24 -0
- package/assets/agent-state/INTERFACE_REGISTRY.md +75 -0
- package/assets/agent-state/MODULES/gates/gate-autonomy.json +7 -0
- package/assets/agent-state/MODULES/gates/gate-completeness.json +7 -0
- package/assets/agent-state/MODULES/gates/gate-correctness.json +7 -0
- package/assets/agent-state/MODULES/gates/gate-evaluation.json +7 -0
- package/assets/agent-state/MODULES/gates/gate-operability.json +7 -0
- package/assets/agent-state/MODULES/gates/gate-security.json +7 -0
- package/assets/agent-state/MODULES/gates/gate-typescript-public-surface.json +7 -0
- package/assets/agent-state/MODULES/registry.json +41 -0
- package/assets/agent-state/MODULES/roles/capability-astgrep.json +49 -0
- package/assets/agent-state/MODULES/roles/capability-build.json +39 -0
- package/assets/agent-state/MODULES/roles/capability-docs.json +38 -0
- package/assets/agent-state/MODULES/roles/capability-eval.json +20 -0
- package/assets/agent-state/MODULES/roles/capability-memory.json +20 -0
- package/assets/agent-state/MODULES/roles/capability-observability.json +20 -0
- package/assets/agent-state/MODULES/roles/capability-ops.json +45 -0
- package/assets/agent-state/MODULES/roles/capability-qa.json +40 -0
- package/assets/agent-state/MODULES/roles/capability-release.json +21 -0
- package/assets/agent-state/MODULES/roles/capability-research.json +44 -0
- package/assets/agent-state/MODULES/roles/capability-security.json +21 -0
- package/assets/agent-state/MODULES/roles/capability-skeptic.json +48 -0
- package/assets/agent-state/MODULES/roles/capability-spec.json +42 -0
- package/assets/agent-state/MODULES/schemas/ACE_RUNTIME_PROFILE.schema.json +289 -0
- package/assets/agent-state/MODULES/schemas/ARTIFACT_MANIFEST.schema.json +185 -0
- package/assets/agent-state/MODULES/schemas/HANDOFF.agent-state.schema.json +124 -0
- package/assets/agent-state/MODULES/schemas/HANDOFF.schema.json +55 -0
- package/assets/agent-state/MODULES/schemas/RUNTIME_EXECUTOR_SESSION_REGISTRY.schema.json +290 -0
- package/assets/agent-state/MODULES/schemas/RUNTIME_TOOL_SPEC_REGISTRY.schema.json +144 -0
- package/assets/agent-state/MODULES/schemas/STATUS_EVENT.schema.json +84 -0
- package/assets/agent-state/MODULES/schemas/SWARM_HANDOFF.schema.json +138 -0
- package/assets/agent-state/MODULES/schemas/TRACKER_SNAPSHOT.schema.json +134 -0
- package/assets/agent-state/MODULES/schemas/VERICIFY_BRIDGE_SNAPSHOT.schema.json +157 -0
- package/assets/agent-state/MODULES/schemas/VERICIFY_PROCESS_POST_LOG.schema.json +93 -0
- package/assets/agent-state/MODULES/schemas/WORKSPACE_SESSION_REGISTRY.schema.json +133 -0
- package/assets/agent-state/PROVENANCE_LOG.md +28 -0
- package/assets/agent-state/QUALITY_GATES.md +15 -0
- package/assets/agent-state/RISKS.md +8 -0
- package/assets/agent-state/SCOPE.md +20 -0
- package/assets/agent-state/SKILL_CATALOG.md +48 -0
- package/assets/agent-state/STATUS.md +8 -0
- package/assets/agent-state/STATUS_EVENTS.ndjson +1 -0
- package/assets/agent-state/TASK.md +18 -0
- package/assets/agent-state/TEAL_CONFIG.md +117 -0
- package/assets/agent-state/handoff-registry.json +5 -0
- package/assets/agent-state/index-fingerprints.json +7 -0
- package/assets/agent-state/index.json +32 -0
- package/assets/agent-state/run-ledger.json +5 -0
- package/assets/agent-state/runtime-executor-sessions.json +5 -0
- package/assets/agent-state/runtime-tool-specs.json +5 -0
- package/assets/agent-state/runtime-workspaces.json +5 -0
- package/assets/agent-state/todo-state.json +7 -0
- package/assets/agent-state/tracker-snapshot.json +7 -0
- package/assets/agent-state/vericify/ace-bridge.json +60 -0
- package/assets/agent-state/vericify/process-posts.json +5 -0
- package/assets/instructions/ACE.instructions.md +187 -0
- package/assets/instructions/ACE_Coder.instructions.md +146 -0
- package/assets/instructions/ACE_UI.instructions.md +178 -0
- package/assets/instructions/ACE_VOS.instructions.md +211 -0
- package/assets/scripts/ace-hook-dispatch.mjs +538 -0
- package/assets/scripts/bootstrap-workspace.sh +27 -0
- package/assets/scripts/copilot-hook-dispatch.mjs +3 -0
- package/assets/scripts/eval-harness.sh +68 -0
- package/assets/scripts/render-mcp-configs.sh +396 -0
- package/assets/tasks/README.md +48 -0
- package/assets/tasks/SWARM_HANDOFF.example.json +53 -0
- package/assets/tasks/SWARM_HANDOFF.example_ui_to_coders.json +55 -0
- package/assets/tasks/SWARM_HANDOFF.example_vos_to_ui.json +55 -0
- package/assets/tasks/SWARM_HANDOFF.template.json +52 -0
- package/assets/tasks/cli_work_split.md +22 -0
- package/assets/tasks/lessons.md +17 -0
- package/assets/tasks/role_tasks.md +206 -0
- package/assets/tasks/todo.md +23 -0
- package/dist/ace-autonomy.d.ts +137 -0
- package/dist/ace-autonomy.js +472 -0
- package/dist/ace-context.d.ts +29 -0
- package/dist/ace-context.js +240 -0
- package/dist/ace-internal-tools.d.ts +8 -0
- package/dist/ace-internal-tools.js +76 -0
- package/dist/ace-server-instructions.d.ts +12 -0
- package/dist/ace-server-instructions.js +324 -0
- package/dist/agent-runtime/role-adapters.d.ts +29 -0
- package/dist/agent-runtime/role-adapters.js +573 -0
- package/dist/astgrep-index.d.ts +24 -0
- package/dist/astgrep-index.js +476 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +591 -0
- package/dist/git-ops.d.ts +53 -0
- package/dist/git-ops.js +238 -0
- package/dist/handoff-registry.d.ts +71 -0
- package/dist/handoff-registry.js +422 -0
- package/dist/helpers.d.ts +126 -0
- package/dist/helpers.js +1687 -0
- package/dist/index-store.d.ts +51 -0
- package/dist/index-store.js +328 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +7 -0
- package/dist/internal-tool-runtime.d.ts +21 -0
- package/dist/internal-tool-runtime.js +136 -0
- package/dist/job-scheduler.d.ts +175 -0
- package/dist/job-scheduler.js +1217 -0
- package/dist/kanban.d.ts +27 -0
- package/dist/kanban.js +339 -0
- package/dist/local-model-runtime.d.ts +40 -0
- package/dist/local-model-runtime.js +174 -0
- package/dist/model-bridge.d.ts +54 -0
- package/dist/model-bridge.js +587 -0
- package/dist/orchestrator-supervisor.d.ts +100 -0
- package/dist/orchestrator-supervisor.js +399 -0
- package/dist/problem-triage.d.ts +23 -0
- package/dist/problem-triage.js +448 -0
- package/dist/prompts.d.ts +7 -0
- package/dist/prompts.js +628 -0
- package/dist/public-surface.d.ts +30 -0
- package/dist/public-surface.js +316 -0
- package/dist/resources.d.ts +7 -0
- package/dist/resources.js +545 -0
- package/dist/run-ledger.d.ts +36 -0
- package/dist/run-ledger.js +257 -0
- package/dist/runtime-command.d.ts +18 -0
- package/dist/runtime-command.js +76 -0
- package/dist/runtime-executor.d.ts +104 -0
- package/dist/runtime-executor.js +985 -0
- package/dist/runtime-profile.d.ts +116 -0
- package/dist/runtime-profile.js +532 -0
- package/dist/runtime-tool-specs.d.ts +68 -0
- package/dist/runtime-tool-specs.js +527 -0
- package/dist/safe-edit.d.ts +52 -0
- package/dist/safe-edit.js +255 -0
- package/dist/schemas.d.ts +44 -0
- package/dist/schemas.js +830 -0
- package/dist/semantic-cache.d.ts +147 -0
- package/dist/semantic-cache.js +552 -0
- package/dist/semantic-hash.d.ts +83 -0
- package/dist/semantic-hash.js +346 -0
- package/dist/server.d.ts +10 -0
- package/dist/server.js +46 -0
- package/dist/shared.d.ts +136 -0
- package/dist/shared.js +269 -0
- package/dist/skill-auditor.d.ts +26 -0
- package/dist/skill-auditor.js +184 -0
- package/dist/skill-catalog.d.ts +60 -0
- package/dist/skill-catalog.js +305 -0
- package/dist/status-events.d.ts +40 -0
- package/dist/status-events.js +269 -0
- package/dist/store/ace-packed-store.d.ts +69 -0
- package/dist/store/ace-packed-store.js +434 -0
- package/dist/store/bootstrap-store.d.ts +46 -0
- package/dist/store/bootstrap-store.js +242 -0
- package/dist/store/catalog-builder.d.ts +21 -0
- package/dist/store/catalog-builder.js +68 -0
- package/dist/store/importer.d.ts +19 -0
- package/dist/store/importer.js +157 -0
- package/dist/store/knowledge-bake.d.ts +59 -0
- package/dist/store/knowledge-bake.js +339 -0
- package/dist/store/materializers/hook-context-materializer.d.ts +25 -0
- package/dist/store/materializers/hook-context-materializer.js +100 -0
- package/dist/store/materializers/host-file-materializer.d.ts +37 -0
- package/dist/store/materializers/host-file-materializer.js +271 -0
- package/dist/store/materializers/todo-syncer.d.ts +30 -0
- package/dist/store/materializers/todo-syncer.js +140 -0
- package/dist/store/materializers/vericify-projector.d.ts +38 -0
- package/dist/store/materializers/vericify-projector.js +239 -0
- package/dist/store/repositories/discovery-repository.d.ts +24 -0
- package/dist/store/repositories/discovery-repository.js +58 -0
- package/dist/store/repositories/handoff-repository.d.ts +31 -0
- package/dist/store/repositories/handoff-repository.js +67 -0
- package/dist/store/repositories/ledger-repository.d.ts +26 -0
- package/dist/store/repositories/ledger-repository.js +49 -0
- package/dist/store/repositories/runtime-kv-repository.d.ts +16 -0
- package/dist/store/repositories/runtime-kv-repository.js +36 -0
- package/dist/store/repositories/scheduler-repository.d.ts +50 -0
- package/dist/store/repositories/scheduler-repository.js +123 -0
- package/dist/store/repositories/session-repository.d.ts +33 -0
- package/dist/store/repositories/session-repository.js +82 -0
- package/dist/store/repositories/todo-repository.d.ts +31 -0
- package/dist/store/repositories/todo-repository.js +77 -0
- package/dist/store/repositories/tracker-repository.d.ts +25 -0
- package/dist/store/repositories/tracker-repository.js +43 -0
- package/dist/store/repositories/vericify-repository.d.ts +32 -0
- package/dist/store/repositories/vericify-repository.js +58 -0
- package/dist/store/skills-install.d.ts +28 -0
- package/dist/store/skills-install.js +86 -0
- package/dist/store/state-reader.d.ts +49 -0
- package/dist/store/state-reader.js +111 -0
- package/dist/store/store-artifacts.d.ts +12 -0
- package/dist/store/store-artifacts.js +138 -0
- package/dist/store/store-snapshot.d.ts +19 -0
- package/dist/store/store-snapshot.js +140 -0
- package/dist/store/topology-bake.d.ts +15 -0
- package/dist/store/topology-bake.js +215 -0
- package/dist/store/types.d.ts +155 -0
- package/dist/store/types.js +35 -0
- package/dist/store/workspace-snapshot.d.ts +26 -0
- package/dist/store/workspace-snapshot.js +107 -0
- package/dist/store/write-queue.d.ts +7 -0
- package/dist/store/write-queue.js +26 -0
- package/dist/todo-state.d.ts +41 -0
- package/dist/todo-state.js +399 -0
- package/dist/tools-agent.d.ts +7 -0
- package/dist/tools-agent.js +1542 -0
- package/dist/tools-discovery.d.ts +6 -0
- package/dist/tools-discovery.js +178 -0
- package/dist/tools-drift.d.ts +13 -0
- package/dist/tools-drift.js +357 -0
- package/dist/tools-files.d.ts +6 -0
- package/dist/tools-files.js +679 -0
- package/dist/tools-framework.d.ts +7 -0
- package/dist/tools-framework.js +1414 -0
- package/dist/tools-git.d.ts +6 -0
- package/dist/tools-git.js +183 -0
- package/dist/tools-handoff.d.ts +32 -0
- package/dist/tools-handoff.js +489 -0
- package/dist/tools-lifecycle.d.ts +6 -0
- package/dist/tools-lifecycle.js +205 -0
- package/dist/tools-memory.d.ts +6 -0
- package/dist/tools-memory.js +260 -0
- package/dist/tools-scheduler.d.ts +6 -0
- package/dist/tools-scheduler.js +228 -0
- package/dist/tools-skills.d.ts +3 -0
- package/dist/tools-skills.js +104 -0
- package/dist/tools-todo.d.ts +6 -0
- package/dist/tools-todo.js +154 -0
- package/dist/tools.d.ts +9 -0
- package/dist/tools.js +33 -0
- package/dist/tracker-adapters.d.ts +74 -0
- package/dist/tracker-adapters.js +776 -0
- package/dist/tracker-sync.d.ts +10 -0
- package/dist/tracker-sync.js +84 -0
- package/dist/tui/agent-runner.d.ts +137 -0
- package/dist/tui/agent-runner.js +466 -0
- package/dist/tui/agent-worker.d.ts +10 -0
- package/dist/tui/agent-worker.js +347 -0
- package/dist/tui/chat.d.ts +84 -0
- package/dist/tui/chat.js +368 -0
- package/dist/tui/commands.d.ts +57 -0
- package/dist/tui/commands.js +432 -0
- package/dist/tui/dashboard.d.ts +24 -0
- package/dist/tui/dashboard.js +110 -0
- package/dist/tui/index.d.ts +114 -0
- package/dist/tui/index.js +1059 -0
- package/dist/tui/input.d.ts +49 -0
- package/dist/tui/input.js +336 -0
- package/dist/tui/layout.d.ts +116 -0
- package/dist/tui/layout.js +367 -0
- package/dist/tui/ollama.d.ts +116 -0
- package/dist/tui/ollama.js +192 -0
- package/dist/tui/openai-compatible.d.ts +63 -0
- package/dist/tui/openai-compatible.js +370 -0
- package/dist/tui/provider-discovery.d.ts +59 -0
- package/dist/tui/provider-discovery.js +530 -0
- package/dist/tui/renderer.d.ts +166 -0
- package/dist/tui/renderer.js +304 -0
- package/dist/tui/tabs.d.ts +70 -0
- package/dist/tui/tabs.js +208 -0
- package/dist/tui/telemetry.d.ts +56 -0
- package/dist/tui/telemetry.js +106 -0
- package/dist/vericify-bridge.d.ts +146 -0
- package/dist/vericify-bridge.js +571 -0
- package/dist/vericify-context.d.ts +10 -0
- package/dist/vericify-context.js +72 -0
- package/dist/workspace-manager.d.ts +107 -0
- package/dist/workspace-manager.js +636 -0
- package/package.json +83 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared role adapter engine for worker implementations.
|
|
3
|
+
*
|
|
4
|
+
* This module is transport-agnostic so both TUI and non-TUI workers can reuse
|
|
5
|
+
* the same role-intent planning behavior.
|
|
6
|
+
*/
|
|
7
|
+
export type AdapterDomain = "venture" | "ux" | "engineering" | "mixed" | "research";
|
|
8
|
+
export interface ToolIntent {
|
|
9
|
+
tool: string;
|
|
10
|
+
args: Record<string, unknown>;
|
|
11
|
+
}
|
|
12
|
+
export interface HandoffIntent {
|
|
13
|
+
from: string;
|
|
14
|
+
to: string;
|
|
15
|
+
payload: Record<string, unknown>;
|
|
16
|
+
}
|
|
17
|
+
export interface AdapterDecision {
|
|
18
|
+
toolCalls: ToolIntent[];
|
|
19
|
+
handoffs: HandoffIntent[];
|
|
20
|
+
notes: string[];
|
|
21
|
+
domain: AdapterDomain;
|
|
22
|
+
confidence: number;
|
|
23
|
+
confidenceLevel: "low" | "medium" | "high";
|
|
24
|
+
}
|
|
25
|
+
export declare function inferDomain(input: string): AdapterDomain;
|
|
26
|
+
export declare function parseManualHandoffCommand(input: string): HandoffIntent | undefined;
|
|
27
|
+
export declare function parseManualToolCommand(input: string): ToolIntent | undefined;
|
|
28
|
+
export declare function planRoleExecution(roleValue: string, input: string): AdapterDecision;
|
|
29
|
+
//# sourceMappingURL=role-adapters.d.ts.map
|
|
@@ -0,0 +1,573 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared role adapter engine for worker implementations.
|
|
3
|
+
*
|
|
4
|
+
* This module is transport-agnostic so both TUI and non-TUI workers can reuse
|
|
5
|
+
* the same role-intent planning behavior.
|
|
6
|
+
*/
|
|
7
|
+
const KNOWN_ROLES = [
|
|
8
|
+
"orchestrator",
|
|
9
|
+
"vos",
|
|
10
|
+
"ui",
|
|
11
|
+
"coders",
|
|
12
|
+
"astgrep",
|
|
13
|
+
"skeptic",
|
|
14
|
+
"ops",
|
|
15
|
+
"research",
|
|
16
|
+
"spec",
|
|
17
|
+
"builder",
|
|
18
|
+
"qa",
|
|
19
|
+
"docs",
|
|
20
|
+
"memory",
|
|
21
|
+
"security",
|
|
22
|
+
"observability",
|
|
23
|
+
"eval",
|
|
24
|
+
"release",
|
|
25
|
+
];
|
|
26
|
+
const KNOWN_ROLE_SET = new Set(KNOWN_ROLES);
|
|
27
|
+
const ROLE_PATTERN = new RegExp(`\\b(?:agent[-\\s]?)?(${KNOWN_ROLES.join("|")})\\b`, "i");
|
|
28
|
+
function canonicalizeRole(input) {
|
|
29
|
+
const value = input.trim().toLowerCase().replace(/^agent-/, "");
|
|
30
|
+
return value || "unknown";
|
|
31
|
+
}
|
|
32
|
+
function includeAny(text, needles) {
|
|
33
|
+
return needles.some((needle) => text.includes(needle));
|
|
34
|
+
}
|
|
35
|
+
function escapeRegex(input) {
|
|
36
|
+
return input.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
37
|
+
}
|
|
38
|
+
function toTokenPattern(input) {
|
|
39
|
+
return escapeRegex(input.toLowerCase()).replace(/\s+/g, "\\s+");
|
|
40
|
+
}
|
|
41
|
+
function toFlexibleNeedlePattern(input) {
|
|
42
|
+
const normalized = input.trim().toLowerCase();
|
|
43
|
+
const base = toTokenPattern(normalized);
|
|
44
|
+
if (!normalized.includes(" ") && !normalized.endsWith("s")) {
|
|
45
|
+
return `${base}s?`;
|
|
46
|
+
}
|
|
47
|
+
return base;
|
|
48
|
+
}
|
|
49
|
+
function countKeywordHits(text, needles) {
|
|
50
|
+
let hits = 0;
|
|
51
|
+
for (const needle of needles) {
|
|
52
|
+
const pattern = new RegExp(`\\b${toTokenPattern(needle)}\\b`, "i");
|
|
53
|
+
if (pattern.test(text))
|
|
54
|
+
hits += 1;
|
|
55
|
+
}
|
|
56
|
+
return hits;
|
|
57
|
+
}
|
|
58
|
+
function hasNegatedIntent(text, needles) {
|
|
59
|
+
const normalized = text.toLowerCase().replace(/[’]/g, "'");
|
|
60
|
+
const negations = ["no", "not", "never", "without", "skip", "avoid", "don't", "do not"];
|
|
61
|
+
for (const needle of needles) {
|
|
62
|
+
const needlePattern = toFlexibleNeedlePattern(needle);
|
|
63
|
+
for (const negation of negations) {
|
|
64
|
+
const pattern = new RegExp(`\\b${toTokenPattern(negation)}\\b(?:\\W+\\w+){0,3}\\W+${needlePattern}\\b`, "i");
|
|
65
|
+
if (pattern.test(normalized))
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
function intentRequested(text, positiveNeedles, negationNeedles = positiveNeedles) {
|
|
72
|
+
if (!includeAny(text, positiveNeedles))
|
|
73
|
+
return false;
|
|
74
|
+
return !hasNegatedIntent(text, negationNeedles);
|
|
75
|
+
}
|
|
76
|
+
function truncate(input, max) {
|
|
77
|
+
if (input.length <= max)
|
|
78
|
+
return input;
|
|
79
|
+
const clipped = input.slice(0, Math.max(0, max - 3)).trimEnd();
|
|
80
|
+
return `${clipped}...`;
|
|
81
|
+
}
|
|
82
|
+
export function inferDomain(input) {
|
|
83
|
+
const score = scoreDomain(input);
|
|
84
|
+
return score.domain;
|
|
85
|
+
}
|
|
86
|
+
function scoreDomain(input) {
|
|
87
|
+
const text = input.toLowerCase();
|
|
88
|
+
const uxHits = countKeywordHits(text, ["ux", "ui", "design", "layout", "visual", "tui"]);
|
|
89
|
+
const engineeringHits = countKeywordHits(text, [
|
|
90
|
+
"build",
|
|
91
|
+
"code",
|
|
92
|
+
"test",
|
|
93
|
+
"regression",
|
|
94
|
+
"debug",
|
|
95
|
+
"fix",
|
|
96
|
+
"bug",
|
|
97
|
+
"compile",
|
|
98
|
+
"deploy",
|
|
99
|
+
"engineer",
|
|
100
|
+
]);
|
|
101
|
+
const ventureHits = countKeywordHits(text, [
|
|
102
|
+
"market",
|
|
103
|
+
"pricing",
|
|
104
|
+
"thesis",
|
|
105
|
+
"growth",
|
|
106
|
+
"revenue",
|
|
107
|
+
"venture",
|
|
108
|
+
"business",
|
|
109
|
+
"fund",
|
|
110
|
+
]);
|
|
111
|
+
const researchHits = countKeywordHits(text, [
|
|
112
|
+
"research",
|
|
113
|
+
"evidence",
|
|
114
|
+
"source",
|
|
115
|
+
"hypothesis",
|
|
116
|
+
"assumption",
|
|
117
|
+
"unknown",
|
|
118
|
+
"literature",
|
|
119
|
+
]);
|
|
120
|
+
const rows = [
|
|
121
|
+
{ domain: "ux", hits: uxHits },
|
|
122
|
+
{ domain: "engineering", hits: engineeringHits },
|
|
123
|
+
{ domain: "venture", hits: ventureHits },
|
|
124
|
+
{ domain: "research", hits: researchHits },
|
|
125
|
+
].sort((a, b) => b.hits - a.hits);
|
|
126
|
+
const top = rows[0];
|
|
127
|
+
const runnerUp = rows[1];
|
|
128
|
+
const totalHits = uxHits + engineeringHits + ventureHits + researchHits;
|
|
129
|
+
if (!top || totalHits === 0 || top.hits === 0) {
|
|
130
|
+
return { domain: "mixed", confidence: 0.2, confidenceLevel: "low", ambiguous: true };
|
|
131
|
+
}
|
|
132
|
+
const ambiguous = runnerUp ? top.hits === runnerUp.hits : false;
|
|
133
|
+
if (ambiguous) {
|
|
134
|
+
const confidence = Math.max(0.3, top.hits / Math.max(1, totalHits));
|
|
135
|
+
return {
|
|
136
|
+
domain: "mixed",
|
|
137
|
+
confidence,
|
|
138
|
+
confidenceLevel: confidence >= 0.45 ? "medium" : "low",
|
|
139
|
+
ambiguous: true,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
const base = top.hits / Math.max(1, totalHits);
|
|
143
|
+
const spread = Math.max(0, top.hits - (runnerUp?.hits ?? 0));
|
|
144
|
+
const confidence = Math.min(0.95, base + Math.min(0.25, spread * 0.08));
|
|
145
|
+
const confidenceLevel = confidence >= 0.7 ? "high" : confidence >= 0.45 ? "medium" : "low";
|
|
146
|
+
return {
|
|
147
|
+
domain: top.domain,
|
|
148
|
+
confidence,
|
|
149
|
+
confidenceLevel,
|
|
150
|
+
ambiguous: false,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
function inferPriority(input) {
|
|
154
|
+
const text = input.toLowerCase();
|
|
155
|
+
if (includeAny(text, ["p0", "urgent", "critical", "asap", "immediately"])) {
|
|
156
|
+
return "P0";
|
|
157
|
+
}
|
|
158
|
+
if (includeAny(text, ["p1", "high", "soon", "priority"])) {
|
|
159
|
+
return "P1";
|
|
160
|
+
}
|
|
161
|
+
return "P2";
|
|
162
|
+
}
|
|
163
|
+
function normalizeRoleTarget(input) {
|
|
164
|
+
if (!input)
|
|
165
|
+
return undefined;
|
|
166
|
+
const raw = input.trim().toLowerCase().replace(/^agent-/, "").replace(/[^a-z]/g, "");
|
|
167
|
+
if (!raw)
|
|
168
|
+
return undefined;
|
|
169
|
+
return KNOWN_ROLE_SET.has(raw) ? raw : undefined;
|
|
170
|
+
}
|
|
171
|
+
function extractTargetRole(input) {
|
|
172
|
+
const text = input.toLowerCase();
|
|
173
|
+
const explicit = text.match(/\b(?:to|into|for)\s+(?:agent[-\s]?)?([a-z-]+)\b/i)?.[1];
|
|
174
|
+
const normalizedExplicit = normalizeRoleTarget(explicit);
|
|
175
|
+
if (normalizedExplicit)
|
|
176
|
+
return normalizedExplicit;
|
|
177
|
+
const anyRole = text.match(ROLE_PATTERN)?.[1];
|
|
178
|
+
return normalizeRoleTarget(anyRole);
|
|
179
|
+
}
|
|
180
|
+
export function parseManualHandoffCommand(input) {
|
|
181
|
+
if (!input.toLowerCase().startsWith("handoff "))
|
|
182
|
+
return undefined;
|
|
183
|
+
const [, fromRaw, toRaw, ...rest] = input.split(/\s+/);
|
|
184
|
+
const from = normalizeRoleTarget(fromRaw);
|
|
185
|
+
const to = normalizeRoleTarget(toRaw);
|
|
186
|
+
if (!from || !to)
|
|
187
|
+
return undefined;
|
|
188
|
+
return {
|
|
189
|
+
from,
|
|
190
|
+
to,
|
|
191
|
+
payload: {
|
|
192
|
+
reason: rest.join(" ") || "manual handoff request from worker input",
|
|
193
|
+
mode: "manual",
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
export function parseManualToolCommand(input) {
|
|
198
|
+
if (!input.toLowerCase().startsWith("tool "))
|
|
199
|
+
return undefined;
|
|
200
|
+
const [, tool, ...argsParts] = input.split(/\s+/);
|
|
201
|
+
if (!tool)
|
|
202
|
+
return undefined;
|
|
203
|
+
const rawArg = argsParts.join(" ").trim();
|
|
204
|
+
if (!rawArg)
|
|
205
|
+
return { tool, args: {} };
|
|
206
|
+
if (rawArg.startsWith("{")) {
|
|
207
|
+
try {
|
|
208
|
+
const parsed = JSON.parse(rawArg);
|
|
209
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
210
|
+
return { tool, args: parsed };
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
catch {
|
|
214
|
+
// Fall through to raw payload.
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return { tool, args: { raw: rawArg } };
|
|
218
|
+
}
|
|
219
|
+
function asHandoffTaskType(domain) {
|
|
220
|
+
if (domain === "venture" || domain === "ux" || domain === "engineering") {
|
|
221
|
+
return domain;
|
|
222
|
+
}
|
|
223
|
+
return "mixed";
|
|
224
|
+
}
|
|
225
|
+
function dedupeToolIntents(calls) {
|
|
226
|
+
const seen = new Set();
|
|
227
|
+
const out = [];
|
|
228
|
+
for (const call of calls) {
|
|
229
|
+
const key = `${call.tool}:${JSON.stringify(call.args)}`;
|
|
230
|
+
if (seen.has(key))
|
|
231
|
+
continue;
|
|
232
|
+
seen.add(key);
|
|
233
|
+
out.push(call);
|
|
234
|
+
if (out.length >= 8)
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
237
|
+
return out;
|
|
238
|
+
}
|
|
239
|
+
function dedupeHandoffIntents(handoffs) {
|
|
240
|
+
const seen = new Set();
|
|
241
|
+
const out = [];
|
|
242
|
+
for (const handoff of handoffs) {
|
|
243
|
+
const key = `${handoff.from}->${handoff.to}:${JSON.stringify(handoff.payload)}`;
|
|
244
|
+
if (seen.has(key))
|
|
245
|
+
continue;
|
|
246
|
+
seen.add(key);
|
|
247
|
+
out.push(handoff);
|
|
248
|
+
if (out.length >= 2)
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
return out;
|
|
252
|
+
}
|
|
253
|
+
function buildCreateHandoffIntent(fromRole, toRole, input) {
|
|
254
|
+
const from = normalizeRoleTarget(fromRole) ?? "orchestrator";
|
|
255
|
+
const to = normalizeRoleTarget(toRole) ?? "ops";
|
|
256
|
+
const domain = inferDomain(input);
|
|
257
|
+
const taskType = asHandoffTaskType(domain);
|
|
258
|
+
const priority = inferPriority(input);
|
|
259
|
+
const summary = truncate(input, 96);
|
|
260
|
+
return {
|
|
261
|
+
tool: "create_handoff",
|
|
262
|
+
args: {
|
|
263
|
+
from,
|
|
264
|
+
to,
|
|
265
|
+
title: `Worker dispatch: ${truncate(summary, 64)}`,
|
|
266
|
+
task_type: taskType,
|
|
267
|
+
priority,
|
|
268
|
+
directive: input,
|
|
269
|
+
acceptance_criteria: [
|
|
270
|
+
`Execute delegated objective: ${summary}`,
|
|
271
|
+
"Return completion status with evidence references.",
|
|
272
|
+
],
|
|
273
|
+
},
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
export function planRoleExecution(roleValue, input) {
|
|
277
|
+
const normalizedRole = canonicalizeRole(roleValue);
|
|
278
|
+
const text = input.toLowerCase();
|
|
279
|
+
const domainScore = scoreDomain(input);
|
|
280
|
+
const domain = domainScore.domain;
|
|
281
|
+
const toolCalls = [];
|
|
282
|
+
const handoffs = [];
|
|
283
|
+
const notes = [];
|
|
284
|
+
const dispatchKeywords = [
|
|
285
|
+
"handoff",
|
|
286
|
+
"delegate",
|
|
287
|
+
"route to",
|
|
288
|
+
"dispatch",
|
|
289
|
+
"assign to",
|
|
290
|
+
];
|
|
291
|
+
const dispatchRequested = intentRequested(text, dispatchKeywords);
|
|
292
|
+
if (includeAny(text, dispatchKeywords) && !dispatchRequested) {
|
|
293
|
+
notes.push("Dispatch keywords were negated; delegation intents suppressed.");
|
|
294
|
+
}
|
|
295
|
+
const targetRole = extractTargetRole(input);
|
|
296
|
+
if (dispatchRequested && !targetRole) {
|
|
297
|
+
notes.push("Dispatch requested but no valid target role detected; create_handoff suppressed.");
|
|
298
|
+
}
|
|
299
|
+
if (domainScore.ambiguous || domainScore.confidenceLevel === "low") {
|
|
300
|
+
notes.push(`Low-confidence adapter routing (domain=${domain}, confidence=${Math.round(domainScore.confidence * 100)}%).`);
|
|
301
|
+
}
|
|
302
|
+
const contradictoryStateRequested = includeAny(text, [
|
|
303
|
+
"contradict",
|
|
304
|
+
"conflict",
|
|
305
|
+
"misalign",
|
|
306
|
+
"drift",
|
|
307
|
+
"blocked",
|
|
308
|
+
"unclear",
|
|
309
|
+
"ambiguous",
|
|
310
|
+
]);
|
|
311
|
+
const aceStateRequested = countKeywordHits(text, ["task", "scope", "gate", "handoff", "state", "status"]) > 0;
|
|
312
|
+
switch (normalizedRole) {
|
|
313
|
+
case "orchestrator": {
|
|
314
|
+
const preflightRequired = dispatchRequested ||
|
|
315
|
+
domainScore.ambiguous ||
|
|
316
|
+
domainScore.confidenceLevel === "low" ||
|
|
317
|
+
contradictoryStateRequested ||
|
|
318
|
+
aceStateRequested;
|
|
319
|
+
toolCalls.push({ tool: "recall_context", args: {} });
|
|
320
|
+
toolCalls.push({ tool: "validate_framework", args: {} });
|
|
321
|
+
toolCalls.push({ tool: "get_framework_status", args: {} });
|
|
322
|
+
toolCalls.push({ tool: "route_task", args: { description: input, domain } });
|
|
323
|
+
if (preflightRequired) {
|
|
324
|
+
toolCalls.push({ tool: "execute_gates", args: {} });
|
|
325
|
+
notes.push("Orchestrator preflight required before dispatch.");
|
|
326
|
+
}
|
|
327
|
+
if (intentRequested(text, ["scheduler", "queue", "dispatch", "lock"])) {
|
|
328
|
+
toolCalls.push({ tool: "dispatch_jobs", args: {} });
|
|
329
|
+
toolCalls.push({ tool: "list_jobs", args: { limit: 20 } });
|
|
330
|
+
}
|
|
331
|
+
if (dispatchRequested && targetRole && targetRole !== normalizedRole && !preflightRequired) {
|
|
332
|
+
toolCalls.push(buildCreateHandoffIntent(normalizedRole, targetRole, input));
|
|
333
|
+
handoffs.push({
|
|
334
|
+
from: normalizedRole,
|
|
335
|
+
to: targetRole,
|
|
336
|
+
payload: { reason: truncate(input, 180), mode: "adapter" },
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
else if (dispatchRequested && targetRole && targetRole !== normalizedRole && preflightRequired) {
|
|
340
|
+
notes.push(`Dispatch to ${targetRole} deferred until preflight clears current ACE state.`);
|
|
341
|
+
}
|
|
342
|
+
break;
|
|
343
|
+
}
|
|
344
|
+
case "vos": {
|
|
345
|
+
toolCalls.push({ tool: "get_task_pack", args: { role: "vos" } });
|
|
346
|
+
toolCalls.push({ tool: "route_task", args: { description: input, domain: "venture" } });
|
|
347
|
+
if (dispatchRequested && targetRole && targetRole !== normalizedRole) {
|
|
348
|
+
toolCalls.push(buildCreateHandoffIntent(normalizedRole, targetRole, input));
|
|
349
|
+
handoffs.push({ from: normalizedRole, to: targetRole, payload: { reason: input, mode: "adapter" } });
|
|
350
|
+
}
|
|
351
|
+
break;
|
|
352
|
+
}
|
|
353
|
+
case "ui": {
|
|
354
|
+
toolCalls.push({ tool: "get_task_pack", args: { role: "ui" } });
|
|
355
|
+
toolCalls.push({ tool: "route_task", args: { description: input, domain: "ux" } });
|
|
356
|
+
if (intentRequested(text, ["test", "qa", "verify"], ["test", "qa", "verify"])) {
|
|
357
|
+
toolCalls.push({ tool: "run_tests", args: {} });
|
|
358
|
+
}
|
|
359
|
+
if (dispatchRequested && targetRole && targetRole !== normalizedRole) {
|
|
360
|
+
toolCalls.push(buildCreateHandoffIntent(normalizedRole, targetRole, input));
|
|
361
|
+
handoffs.push({ from: normalizedRole, to: targetRole, payload: { reason: input, mode: "adapter" } });
|
|
362
|
+
}
|
|
363
|
+
break;
|
|
364
|
+
}
|
|
365
|
+
case "coders": {
|
|
366
|
+
toolCalls.push({ tool: "get_task_pack", args: { role: "coders" } });
|
|
367
|
+
if (intentRequested(text, ["test", "regression", "verify", "suite"])) {
|
|
368
|
+
toolCalls.push({ tool: "run_tests", args: {} });
|
|
369
|
+
}
|
|
370
|
+
if (intentRequested(text, ["gate", "criteria", "quality"])) {
|
|
371
|
+
toolCalls.push({ tool: "execute_gates", args: {} });
|
|
372
|
+
}
|
|
373
|
+
if (intentRequested(text, ["diff", "patch", "changes"])) {
|
|
374
|
+
toolCalls.push({ tool: "git_diff", args: {} });
|
|
375
|
+
}
|
|
376
|
+
if (dispatchRequested && targetRole && targetRole !== normalizedRole) {
|
|
377
|
+
toolCalls.push(buildCreateHandoffIntent(normalizedRole, targetRole, input));
|
|
378
|
+
handoffs.push({ from: normalizedRole, to: targetRole, payload: { reason: input, mode: "adapter" } });
|
|
379
|
+
}
|
|
380
|
+
break;
|
|
381
|
+
}
|
|
382
|
+
case "astgrep": {
|
|
383
|
+
toolCalls.push({ tool: "refresh_astgrep_index", args: {} });
|
|
384
|
+
if (includeAny(text, ["scan", "delta", "workspace", "changed", "index"])) {
|
|
385
|
+
toolCalls.push({ tool: "scan_workspace_delta", args: {} });
|
|
386
|
+
}
|
|
387
|
+
break;
|
|
388
|
+
}
|
|
389
|
+
case "skeptic": {
|
|
390
|
+
if (intentRequested(text, ["review", "adversarial", "disprove", "audit", "skeptic pass"], [
|
|
391
|
+
"review",
|
|
392
|
+
"adversarial",
|
|
393
|
+
"disprove",
|
|
394
|
+
"audit",
|
|
395
|
+
"skeptic pass",
|
|
396
|
+
])) {
|
|
397
|
+
toolCalls.push({
|
|
398
|
+
tool: "execute_gates",
|
|
399
|
+
args: {
|
|
400
|
+
review_mode: "skeptic_adversarial",
|
|
401
|
+
review_focus: truncate(input, 160),
|
|
402
|
+
},
|
|
403
|
+
});
|
|
404
|
+
notes.push("Skeptic adversarial review requested; only confirmed findings should remain actionable.");
|
|
405
|
+
}
|
|
406
|
+
else {
|
|
407
|
+
toolCalls.push({ tool: "execute_gates", args: {} });
|
|
408
|
+
}
|
|
409
|
+
if (includeAny(text, ["risk", "blocker", "unsafe", "halt", "critical"])) {
|
|
410
|
+
toolCalls.push({
|
|
411
|
+
tool: "open_circuit_breaker",
|
|
412
|
+
args: { reason: `skeptic flagged: ${truncate(input, 160)}` },
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
break;
|
|
416
|
+
}
|
|
417
|
+
case "ops": {
|
|
418
|
+
toolCalls.push({ tool: "list_jobs", args: { limit: 20 } });
|
|
419
|
+
toolCalls.push({
|
|
420
|
+
tool: "emit_status_event",
|
|
421
|
+
args: {
|
|
422
|
+
source_module: "capability-ops",
|
|
423
|
+
event_type: "WORKER_INPUT",
|
|
424
|
+
status: "in_progress",
|
|
425
|
+
summary: truncate(input, 140),
|
|
426
|
+
},
|
|
427
|
+
});
|
|
428
|
+
if (intentRequested(text, ["dispatch", "schedule", "lock"])) {
|
|
429
|
+
toolCalls.push({ tool: "dispatch_jobs", args: {} });
|
|
430
|
+
}
|
|
431
|
+
if (includeAny(text, ["lease"])) {
|
|
432
|
+
toolCalls.push({ tool: "get_scheduler_lease", args: {} });
|
|
433
|
+
}
|
|
434
|
+
if (includeAny(text, ["todo", "task"])) {
|
|
435
|
+
toolCalls.push({ tool: "get_todo_state", args: {} });
|
|
436
|
+
}
|
|
437
|
+
if (dispatchRequested && targetRole && targetRole !== normalizedRole) {
|
|
438
|
+
toolCalls.push(buildCreateHandoffIntent(normalizedRole, targetRole, input));
|
|
439
|
+
handoffs.push({ from: normalizedRole, to: targetRole, payload: { reason: input, mode: "adapter" } });
|
|
440
|
+
}
|
|
441
|
+
break;
|
|
442
|
+
}
|
|
443
|
+
case "research": {
|
|
444
|
+
toolCalls.push({ tool: "route_task", args: { description: input, domain: "research" } });
|
|
445
|
+
if (includeAny(text, ["skill", "pattern", "approach"])) {
|
|
446
|
+
toolCalls.push({ tool: "list_skills", args: {} });
|
|
447
|
+
}
|
|
448
|
+
if (includeAny(text, ["assumption", "hypothesis", "unknown", "gap"])) {
|
|
449
|
+
toolCalls.push({
|
|
450
|
+
tool: "context_snapshot",
|
|
451
|
+
args: {
|
|
452
|
+
name: `research-${Date.now()}`,
|
|
453
|
+
summary: truncate(input, 140),
|
|
454
|
+
},
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
break;
|
|
458
|
+
}
|
|
459
|
+
case "spec": {
|
|
460
|
+
toolCalls.push({ tool: "get_task_pack", args: { role: "spec" } });
|
|
461
|
+
if (includeAny(text, ["schema", "contract", "interface", "validate"])) {
|
|
462
|
+
toolCalls.push({ tool: "validate_framework", args: {} });
|
|
463
|
+
}
|
|
464
|
+
if (includeAny(text, ["handoff", "payload"])) {
|
|
465
|
+
toolCalls.push({ tool: "get_handoff_template", args: {} });
|
|
466
|
+
}
|
|
467
|
+
break;
|
|
468
|
+
}
|
|
469
|
+
case "builder": {
|
|
470
|
+
toolCalls.push({ tool: "get_task_pack", args: { role: "builder" } });
|
|
471
|
+
if (intentRequested(text, ["build", "implement", "fix", "test"])) {
|
|
472
|
+
toolCalls.push({ tool: "run_tests", args: {} });
|
|
473
|
+
}
|
|
474
|
+
if (intentRequested(text, ["diff", "changes", "patch"])) {
|
|
475
|
+
toolCalls.push({ tool: "git_diff", args: {} });
|
|
476
|
+
}
|
|
477
|
+
break;
|
|
478
|
+
}
|
|
479
|
+
case "qa": {
|
|
480
|
+
toolCalls.push({ tool: "run_tests", args: {} });
|
|
481
|
+
toolCalls.push({ tool: "execute_gates", args: {} });
|
|
482
|
+
if (includeAny(text, ["status", "trace", "event", "regression"])) {
|
|
483
|
+
toolCalls.push({ tool: "list_status_events", args: { limit: 25 } });
|
|
484
|
+
}
|
|
485
|
+
break;
|
|
486
|
+
}
|
|
487
|
+
case "docs": {
|
|
488
|
+
toolCalls.push({ tool: "get_task_pack", args: { role: "docs" } });
|
|
489
|
+
if (includeAny(text, ["kanban", "board"])) {
|
|
490
|
+
toolCalls.push({ tool: "generate_kanban_ui", args: {} });
|
|
491
|
+
}
|
|
492
|
+
if (includeAny(text, ["readme", "docs", "guide", "documentation"])) {
|
|
493
|
+
toolCalls.push({ tool: "get_run_ledger", args: {} });
|
|
494
|
+
}
|
|
495
|
+
break;
|
|
496
|
+
}
|
|
497
|
+
case "memory": {
|
|
498
|
+
toolCalls.push({ tool: "recall_context", args: {} });
|
|
499
|
+
if (includeAny(text, ["snapshot", "remember", "save", "capture", "context"])) {
|
|
500
|
+
toolCalls.push({
|
|
501
|
+
tool: "context_snapshot",
|
|
502
|
+
args: {
|
|
503
|
+
name: `memory-${Date.now()}`,
|
|
504
|
+
summary: truncate(input, 140),
|
|
505
|
+
},
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
if (includeAny(text, ["lesson", "guardrail", "failure"])) {
|
|
509
|
+
toolCalls.push({ tool: "get_lessons", args: {} });
|
|
510
|
+
}
|
|
511
|
+
break;
|
|
512
|
+
}
|
|
513
|
+
case "security": {
|
|
514
|
+
toolCalls.push({ tool: "execute_gates", args: {} });
|
|
515
|
+
toolCalls.push({ tool: "validate_framework", args: {} });
|
|
516
|
+
if (intentRequested(text, ["breach", "vulnerability", "exploit", "critical", "risk"])) {
|
|
517
|
+
toolCalls.push({
|
|
518
|
+
tool: "open_circuit_breaker",
|
|
519
|
+
args: { reason: `security escalation: ${truncate(input, 160)}` },
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
if (intentRequested(text, ["resolved", "mitigated", "resume", "unblock"])) {
|
|
523
|
+
toolCalls.push({
|
|
524
|
+
tool: "close_circuit_breaker",
|
|
525
|
+
args: { reason: `security clear: ${truncate(input, 160)}` },
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
break;
|
|
529
|
+
}
|
|
530
|
+
case "observability": {
|
|
531
|
+
toolCalls.push({ tool: "list_status_events", args: { limit: 50 } });
|
|
532
|
+
if (includeAny(text, ["ledger", "history", "trend"])) {
|
|
533
|
+
toolCalls.push({ tool: "get_run_ledger", args: {} });
|
|
534
|
+
}
|
|
535
|
+
if (includeAny(text, ["scheduler", "lease"])) {
|
|
536
|
+
toolCalls.push({ tool: "get_scheduler_lease", args: {} });
|
|
537
|
+
}
|
|
538
|
+
break;
|
|
539
|
+
}
|
|
540
|
+
case "eval": {
|
|
541
|
+
toolCalls.push({ tool: "run_tests", args: {} });
|
|
542
|
+
toolCalls.push({ tool: "execute_gates", args: {} });
|
|
543
|
+
if (includeAny(text, ["framework", "drift", "integrity", "validate"])) {
|
|
544
|
+
toolCalls.push({ tool: "validate_framework", args: {} });
|
|
545
|
+
}
|
|
546
|
+
break;
|
|
547
|
+
}
|
|
548
|
+
case "release": {
|
|
549
|
+
toolCalls.push({ tool: "git_status", args: {} });
|
|
550
|
+
toolCalls.push({ tool: "execute_gates", args: {} });
|
|
551
|
+
if (includeAny(text, ["log", "history", "changelog"])) {
|
|
552
|
+
toolCalls.push({ tool: "git_log", args: { limit: 20 } });
|
|
553
|
+
}
|
|
554
|
+
if (includeAny(text, ["validate", "framework", "check"])) {
|
|
555
|
+
toolCalls.push({ tool: "validate_framework", args: {} });
|
|
556
|
+
}
|
|
557
|
+
break;
|
|
558
|
+
}
|
|
559
|
+
default: {
|
|
560
|
+
toolCalls.push({ tool: "route_task", args: { description: input, domain } });
|
|
561
|
+
notes.push(`No role adapter profile for "${normalizedRole}", defaulted to route_task.`);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
return {
|
|
565
|
+
toolCalls: dedupeToolIntents(toolCalls),
|
|
566
|
+
handoffs: dedupeHandoffIntents(handoffs),
|
|
567
|
+
notes,
|
|
568
|
+
domain,
|
|
569
|
+
confidence: domainScore.confidence,
|
|
570
|
+
confidenceLevel: domainScore.confidenceLevel,
|
|
571
|
+
};
|
|
572
|
+
}
|
|
573
|
+
//# sourceMappingURL=role-adapters.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface RefreshAstgrepIndexInput {
|
|
2
|
+
scope?: string;
|
|
3
|
+
append_evidence?: boolean;
|
|
4
|
+
emit_event?: boolean;
|
|
5
|
+
include_rep_corpus?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface RefreshAstgrepIndexResult {
|
|
8
|
+
generated_at: string;
|
|
9
|
+
scope: string;
|
|
10
|
+
astgrep_command: string | null;
|
|
11
|
+
output_md_path: string;
|
|
12
|
+
output_json_path: string;
|
|
13
|
+
evidence_appended: boolean;
|
|
14
|
+
event_path?: string;
|
|
15
|
+
event_id?: string;
|
|
16
|
+
stats: {
|
|
17
|
+
language_profile_entries: number;
|
|
18
|
+
hotspot_files: number;
|
|
19
|
+
rep_sources: number;
|
|
20
|
+
todo_signals: number;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export declare function refreshAstgrepIndex(input?: RefreshAstgrepIndexInput): RefreshAstgrepIndexResult;
|
|
24
|
+
//# sourceMappingURL=astgrep-index.d.ts.map
|