@aiwg/cli 2026.10.15 → 2026.10.18
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/agentic/code/providers/pi/aiwg-bridge.ts +45 -7
- package/dist/src/artifacts/citation-parser.js +7 -6
- package/dist/src/artifacts/corpus-tools/citation-densify.js +4 -2
- package/dist/src/artifacts/corpus-tools/cli.js +8 -3
- package/dist/src/artifacts/corpus-tools/discovery-log.js +26 -24
- package/dist/src/artifacts/corpus-tools/expand-cli.js +3 -2
- package/dist/src/artifacts/corpus-tools/expand-dates.js +107 -0
- package/dist/src/artifacts/corpus-tools/expand-queue.js +4 -1
- package/dist/src/artifacts/corpus-tools/expand-review.js +104 -0
- package/dist/src/artifacts/corpus-tools/expand-state.js +17 -1
- package/dist/src/artifacts/corpus-tools/expand.js +16 -17
- package/dist/src/artifacts/corpus-tools/induction-audit.js +7 -6
- package/dist/src/artifacts/corpus-tools/integrity-scan.js +3 -3
- package/dist/src/artifacts/corpus-tools/radar-shared.js +7 -9
- package/dist/src/artifacts/corpus-tools/ref-files.js +11 -0
- package/dist/src/artifacts/corpus-tools/resolve-cli.js +11 -3
- package/dist/src/artifacts/corpus-tools/resolve.js +42 -11
- package/dist/src/artifacts/corpus-tools/retrieval-lab.js +2 -1
- package/dist/src/artifacts/corpus-tools/sidecar-lint.js +4 -4
- package/dist/src/artifacts/corpus-tools/sidecar-repair.js +2 -1
- package/dist/src/artifacts/corpus-views/ref-parser.js +3 -17
- package/dist/src/artifacts/graph-query.js +5 -3
- package/dist/src/artifacts/hybrid-query.js +11 -2
- package/dist/src/artifacts/index-refresh.js +2 -0
- package/dist/src/artifacts/query-engine-corpus.js +217 -0
- package/dist/src/artifacts/query-engine-discover-output.js +229 -0
- package/dist/src/artifacts/query-engine-discover.js +285 -0
- package/dist/src/artifacts/query-engine-entries.js +188 -0
- package/dist/src/artifacts/query-engine-index.js +249 -0
- package/dist/src/artifacts/query-engine-matching.js +143 -0
- package/dist/src/artifacts/query-engine-options.js +2 -0
- package/dist/src/artifacts/query-engine-rules.js +202 -0
- package/dist/src/artifacts/query-engine-scoring.js +436 -0
- package/dist/src/artifacts/query-engine-show-card.js +194 -0
- package/dist/src/artifacts/query-engine-show-load.js +211 -0
- package/dist/src/artifacts/query-engine-show.js +300 -0
- package/dist/src/artifacts/query-engine.js +7 -2576
- package/dist/src/cli/handlers/daemon.js +17 -1
- package/dist/src/cli/handlers/doctor-args.js +10 -5
- package/dist/src/cli/handlers/doctor-help.js +4 -1
- package/dist/src/cli/handlers/index.js +2 -2
- package/dist/src/cli/handlers/mc-agents.js +111 -0
- package/dist/src/cli/handlers/mc-args.js +54 -0
- package/dist/src/cli/handlers/mc-control.js +227 -0
- package/dist/src/cli/handlers/mc-dispatch.js +203 -0
- package/dist/src/cli/handlers/mc-help.js +171 -0
- package/dist/src/cli/handlers/mc-run.js +343 -0
- package/dist/src/cli/handlers/mc-session.js +138 -0
- package/dist/src/cli/handlers/mc-status.js +258 -0
- package/dist/src/cli/handlers/mc-summary.js +43 -0
- package/dist/src/cli/handlers/mc-types.js +3 -0
- package/dist/src/cli/handlers/mc-worker.js +205 -0
- package/dist/src/cli/handlers/mc.js +12 -1665
- package/dist/src/cli/handlers/models-refusal.js +13 -0
- package/dist/src/cli/handlers/models-resource-sample.js +10 -0
- package/dist/src/cli/handlers/models.js +5 -3
- package/dist/src/cli/handlers/regenerate.js +8 -16
- package/dist/src/cli/handlers/remove-bundled.js +133 -0
- package/dist/src/cli/handlers/remove-options.js +31 -0
- package/dist/src/cli/handlers/remove-user.js +174 -0
- package/dist/src/cli/handlers/remove.js +201 -0
- package/dist/src/cli/handlers/sessions.js +7 -7
- package/dist/src/cli/handlers/subcommands-bundles.js +257 -0
- package/dist/src/cli/handlers/subcommands-discovery.js +165 -0
- package/dist/src/cli/handlers/subcommands-list-format.js +129 -0
- package/dist/src/cli/handlers/subcommands-list.js +250 -0
- package/dist/src/cli/handlers/subcommands-plugins.js +213 -0
- package/dist/src/cli/handlers/subcommands-quickref.js +58 -0
- package/dist/src/cli/handlers/subcommands-rlm.js +113 -0
- package/dist/src/cli/handlers/subcommands-services.js +66 -0
- package/dist/src/cli/handlers/subcommands-storage.js +259 -0
- package/dist/src/cli/handlers/subcommands.js +18 -1976
- package/dist/src/cli/handlers/update.js +157 -0
- package/dist/src/cli/handlers/use.js +14 -4
- package/dist/src/cli/handlers/utilities.js +3 -560
- package/dist/src/cli/handlers/utility-doctor.js +412 -0
- package/dist/src/cli/scope-resolver.js +1 -142
- package/dist/src/cli/services/deployment-verification.js +0 -1
- package/dist/src/cli/user-scope-mirror.js +173 -0
- package/dist/src/config/aiwg-config.js +2 -1
- package/dist/src/config/authorization-cli.js +7 -3
- package/dist/src/config/dispatch-host-thresholds.js +2 -0
- package/dist/src/config/dispatch-thresholds-runtime.d.mts +3 -2
- package/dist/src/config/dispatch-thresholds-runtime.mjs +21 -7
- package/dist/src/config/framework-aliases.js +12 -0
- package/dist/src/config/host-resource-report.d.mts +24 -0
- package/dist/src/config/host-resource-report.mjs +110 -0
- package/dist/src/config/host-resource-runtime.d.mts +37 -0
- package/dist/src/config/host-resource-runtime.mjs +296 -0
- package/dist/src/config/installed-selection.js +22 -0
- package/dist/src/config/worker-invocation-marker.d.mts +1 -0
- package/dist/src/config/worker-invocation-marker.mjs +2 -0
- package/dist/src/decision/ensemble-study/artifacts.js +7 -0
- package/dist/src/decision/ensemble-study/gate-policy.js +58 -0
- package/dist/src/decision/ensemble-study/gates.js +78 -0
- package/dist/src/decision/ensemble-study/protocol.js +18 -21
- package/dist/src/decision/ensemble-study/score.js +3 -2
- package/dist/src/decision/ensemble-study/statistics.js +7 -26
- package/dist/src/decision/heldout/access.js +74 -0
- package/dist/src/decision/heldout/calibration.js +1 -0
- package/dist/src/decision/heldout/collector.js +8 -1
- package/dist/src/decision/sensitivity/comparative-gates.js +135 -0
- package/dist/src/decision/sensitivity/comparative.js +18 -41
- package/dist/src/effects/verifiers/file.js +22 -5
- package/dist/src/extensions/claude-attribution.js +82 -0
- package/dist/src/extensions/claude-hooks-installer.js +133 -69
- package/dist/src/extensions/commands/daemon.js +109 -0
- package/dist/src/extensions/commands/definitions.js +5 -89
- package/dist/src/gates/evaluate.js +2 -358
- package/dist/src/gates/heldout.js +17 -7
- package/dist/src/gates/observations.js +363 -0
- package/dist/src/gates/pack-composition.js +270 -0
- package/dist/src/gates/pack-tightening.js +197 -0
- package/dist/src/gates/pack-validation.js +262 -0
- package/dist/src/gates/registry-error.js +5 -0
- package/dist/src/gates/registry.js +13 -685
- package/dist/src/lint/check-patterns.js +163 -0
- package/dist/src/lint/checks.js +268 -0
- package/dist/src/lint/reference-resolution.js +54 -0
- package/dist/src/lint/runner.js +3 -465
- package/dist/src/mcp/helpers.mjs +11 -1
- package/dist/src/mcp/json-document.mjs +29 -0
- package/dist/src/mcp/muse-native-config.mjs +1 -28
- package/dist/src/memory/project-registry.js +44 -4
- package/dist/src/mission-protocol/worker-review-gate.js +7 -0
- package/dist/src/models/worker-plan.js +36 -5
- package/dist/src/models/wrapper-deployment.js +25 -12
- package/dist/src/models/wrapper-enforcement.js +47 -7
- package/dist/src/network-analysis/research.js +2 -1
- package/dist/src/plugin/command-ownership.js +34 -0
- package/dist/src/plugin/skill-command-frontmatter.js +197 -0
- package/dist/src/plugin/skill-command-translator.js +6 -232
- package/dist/src/policy/hitl-check.js +14 -4
- package/dist/src/policy/hitl-consume.js +54 -0
- package/dist/src/policy/hitl-receipt.js +2 -0
- package/dist/src/policy/hitl.js +11 -3
- package/dist/src/providers/context-output-ownership.js +26 -0
- package/dist/src/providers/deployment-ownership.d.mts +19 -0
- package/dist/src/providers/deployment-ownership.mjs +226 -0
- package/dist/src/providers/deployment-removal.js +200 -0
- package/dist/src/providers/provider-context-contracts.js +162 -0
- package/dist/src/providers/provider-definition-schema.js +136 -0
- package/dist/src/providers/provider-definitions.js +8 -1298
- package/dist/src/providers/provider-seeds-1.js +360 -0
- package/dist/src/providers/provider-seeds-2.js +387 -0
- package/dist/src/providers/provider-seeds-3.js +262 -0
- package/dist/src/providers/removal-transaction.js +86 -0
- package/dist/src/providers/settings-document.d.mts +3 -0
- package/dist/src/providers/settings-document.mjs +47 -0
- package/dist/src/providers/settings-removal.js +190 -0
- package/dist/src/providers/skill-ownership.d.mts +19 -2
- package/dist/src/providers/skill-ownership.mjs +12 -4
- package/dist/src/providers/transformation-receipt-integration.js +15 -271
- package/dist/src/providers/transformation-receipt-outputs.js +99 -0
- package/dist/src/providers/transformation-receipt-source.js +194 -0
- package/dist/src/research/clients/arxiv.js +4 -30
- package/dist/src/research/clients/base.js +48 -22
- package/dist/src/research/identity.js +42 -4
- package/dist/src/research/query-cli.js +3 -87
- package/dist/src/research/query-options.js +87 -0
- package/dist/src/research/reference-match.js +105 -24
- package/dist/src/research/services/acquisition.js +9 -7
- package/dist/src/research/services/citation.js +5 -2
- package/dist/src/research/types.js +2 -0
- package/dist/src/rules/activation.mjs +15 -6
- package/dist/src/rules/core-startup.mjs +2 -2
- package/dist/src/serve/mission-conductor.js +52 -4
- package/dist/src/serve/mission-summary.js +56 -0
- package/dist/src/sessions/adapters/grok-build-native.js +23 -0
- package/dist/src/sessions/adapters/grok-build.js +14 -7
- package/dist/src/sessions/workspace-discovery.js +5 -5
- package/dist/src/smiths/context-pipeline/aiwg-md.js +39 -46
- package/dist/src/smiths/context-pipeline/claude-hook.js +1 -1
- package/dist/src/smiths/context-pipeline/code-regions.js +28 -0
- package/dist/src/smiths/context-pipeline/context-file-safety.js +3 -0
- package/dist/src/smiths/context-pipeline/finalization.js +81 -51
- package/dist/src/smiths/context-pipeline/generator.js +10 -11
- package/dist/src/smiths/context-pipeline/managed-hook.js +1 -1
- package/dist/src/smiths/context-pipeline/muse-bridge.js +2 -2
- package/dist/src/smiths/context-pipeline/provider-policy.js +6 -12
- package/dist/src/smiths/context-pipeline/workspace-audit.js +299 -0
- package/dist/src/smiths/context-pipeline/workspace-bootstrap.js +148 -0
- package/dist/src/smiths/context-pipeline/workspace-context-shared.js +111 -0
- package/dist/src/smiths/context-pipeline/workspace-context.js +8 -1373
- package/dist/src/smiths/context-pipeline/workspace-doctor.js +192 -0
- package/dist/src/smiths/context-pipeline/workspace-document.js +201 -0
- package/dist/src/smiths/context-pipeline/workspace-extraction.js +205 -0
- package/dist/src/smiths/context-pipeline/workspace-migration.js +250 -0
- package/dist/src/smiths/hook-bridge/index.js +9 -0
- package/package.json +13 -1
- package/schemas/decision/D17StudyProtocol.v1.schema.json +39 -67
- package/schemas/decision/D29Study.v10.schema.json +65 -0
- package/tools/agents/deploy-agents.mjs +24 -675
- package/tools/agents/deploy-command-mirrors.mjs +229 -0
- package/tools/agents/deploy-options.mjs +258 -0
- package/tools/agents/deploy-support.mjs +165 -0
- package/tools/agents/providers/base-addon-discovery.mjs +139 -0
- package/tools/agents/providers/base-behaviors.mjs +168 -0
- package/tools/agents/providers/base-context.mjs +205 -0
- package/tools/agents/providers/base-contract.mjs +116 -0
- package/tools/agents/providers/base-files.mjs +252 -0
- package/tools/agents/providers/base-flat-artifacts.mjs +233 -0
- package/tools/agents/providers/base-framework-discovery.mjs +309 -0
- package/tools/agents/providers/base-frontmatter.mjs +196 -0
- package/tools/agents/providers/base-inventory.mjs +269 -0
- package/tools/agents/providers/base-kernel-skills.mjs +354 -0
- package/tools/agents/providers/base-migrations.mjs +258 -0
- package/tools/agents/providers/base-models-platforms.mjs +273 -0
- package/tools/agents/providers/base-rule-index.mjs +450 -0
- package/tools/agents/providers/base-runtime.mjs +60 -0
- package/tools/agents/providers/base-skill-copy.mjs +273 -0
- package/tools/agents/providers/base.mjs +16 -3364
- package/tools/agents/providers/claude-post-deploy.mjs +20 -1
- package/tools/agents/providers/context-write.mjs +4 -0
- package/tools/agents/providers/hermes-startup.mjs +0 -5
- package/tools/agents/providers/muse.mjs +7 -2
- package/tools/agents/providers/pi.mjs +3 -1
- package/tools/agents/providers/rule-delivery-surface.mjs +359 -0
- package/tools/agents/providers/rule-delivery.mjs +20 -1144
- package/tools/agents/providers/rule-deployment-commit.mjs +148 -0
- package/tools/agents/providers/rule-deployment-prepare.mjs +461 -0
- package/tools/agents/providers/rule-deployment-state.mjs +300 -0
- package/tools/agents/providers/rule-projection.mjs +3 -0
- package/tools/daemon/README.md +511 -0
- package/tools/daemon/adapters/base-adapter.mjs +84 -0
- package/tools/daemon/adapters/webhook-adapter.mjs +107 -0
- package/tools/daemon/agent-supervisor.mjs +299 -0
- package/tools/daemon/automation-engine.mjs +310 -0
- package/tools/daemon/autonomous-engine.mjs +346 -0
- package/tools/daemon/behavior-loader.mjs +316 -0
- package/tools/daemon/behavior.mjs +174 -0
- package/tools/daemon/concierge/intent-router.mjs +401 -0
- package/tools/daemon/concierge/orchestrator.mjs +272 -0
- package/tools/daemon/concierge/response-translator.mjs +462 -0
- package/tools/daemon/config.mjs +377 -0
- package/tools/daemon/cron-scheduler.mjs +178 -0
- package/tools/daemon/daemon-main.mjs +1169 -0
- package/tools/daemon/event-router.mjs +84 -0
- package/tools/daemon/file-watcher.mjs +383 -0
- package/tools/daemon/index.mjs +1181 -0
- package/tools/daemon/init-profile.mjs +124 -0
- package/tools/daemon/ipc-client.mjs +197 -0
- package/tools/daemon/ipc-ops-handlers.mjs +236 -0
- package/tools/daemon/ipc-server.mjs +275 -0
- package/tools/daemon/maintenance-owner.mjs +79 -0
- package/tools/daemon/memory-manager.mjs +386 -0
- package/tools/daemon/message-router.mjs +194 -0
- package/tools/daemon/provider-watcher.mjs +585 -0
- package/tools/daemon/pty-adapter.mjs +420 -0
- package/tools/daemon/repl-chat.mjs +359 -0
- package/tools/daemon/resource-bounds.mjs +88 -0
- package/tools/daemon/sandbox-transport.mjs +295 -0
- package/tools/daemon/scheduled-task-runner.mjs +535 -0
- package/tools/daemon/task-store.mjs +450 -0
- package/tools/daemon/tmux-manager.mjs +324 -0
- package/tools/daemon/update-policy.mjs +517 -0
- package/tools/daemon/web-server.mjs +399 -0
- package/tools/daemon/web-ui/index.html +585 -0
- package/tools/daemon/web-ui/styles.css +156 -0
- package/tools/docker/Dockerfile.daemon +35 -0
- package/tools/docker/container-manager.mjs +291 -0
- package/tools/messaging/adapter-registry.mjs +230 -0
- package/tools/messaging/adapters/base.mjs +326 -0
- package/tools/messaging/adapters/discord.mjs +462 -0
- package/tools/messaging/adapters/slack.mjs +402 -0
- package/tools/messaging/adapters/telegram.mjs +552 -0
- package/tools/messaging/chat-handler.mjs +297 -0
- package/tools/messaging/command-router.mjs +269 -0
- package/tools/messaging/event-bus.mjs +199 -0
- package/tools/messaging/index.mjs +456 -0
- package/tools/messaging/message-formatter.mjs +320 -0
- package/tools/messaging/room-manager.mjs +277 -0
- package/tools/messaging/types.mjs +94 -0
- package/tools/providers/pi-bridge-policy.mjs +4 -0
- package/tools/ralph-external/daemon-supervisor.mjs +394 -0
- package/tools/ralph-external/lib/behavior-registry.mjs +270 -0
- package/tools/ralph-external/lib/worker-invocation-processes.mjs +7 -4
- package/tools/ralph-external/lib/worker-isolation-args.mjs +217 -0
- package/tools/ralph-external/lib/worker-isolation-status.mjs +19 -0
- package/tools/ralph-external/lib/worker-isolation.mjs +11 -237
- package/tools/ralph-external/lib/worker-overflow.mjs +10 -2
- package/tools/ralph-external/lib/worker-termination.mjs +15 -8
- package/tools/ralph-external/lib/worker-unit-cleanup.mjs +72 -0
- package/tools/ralph-external/session-launcher.mjs +7 -7
- package/tools/scripts/resource-preflight.mjs +3 -242
- package/vscode-extension/schemas/aiwg.config.v1.json +2 -4
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Behavior management CLI
|
|
5
|
+
*
|
|
6
|
+
* Manage behavior YAML bundles that bind directives and toolsets to agent types.
|
|
7
|
+
* Usage: aiwg behavior <list|info|apply|remove> [name] [options]
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import fs from 'fs';
|
|
11
|
+
import path from 'path';
|
|
12
|
+
import { fileURLToPath } from 'url';
|
|
13
|
+
import { createClient } from './ipc-client.mjs';
|
|
14
|
+
|
|
15
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
16
|
+
const repoRoot = path.join(__dirname, '..', '..');
|
|
17
|
+
|
|
18
|
+
const SOCKET_PATH = '.aiwg/daemon/daemon.sock';
|
|
19
|
+
|
|
20
|
+
const args = process.argv.slice(2);
|
|
21
|
+
const subcommand = args[0];
|
|
22
|
+
const name = args[1];
|
|
23
|
+
|
|
24
|
+
function getBehaviorDirs() {
|
|
25
|
+
const dirs = [];
|
|
26
|
+
|
|
27
|
+
// Cross-framework behaviors
|
|
28
|
+
const globalDir = path.join(repoRoot, 'agentic', 'code', 'behaviors');
|
|
29
|
+
if (fs.existsSync(globalDir)) {
|
|
30
|
+
for (const entry of fs.readdirSync(globalDir, { withFileTypes: true })) {
|
|
31
|
+
if (entry.isDirectory() && fs.existsSync(path.join(globalDir, entry.name, 'BEHAVIOR.md'))) {
|
|
32
|
+
dirs.push({ name: entry.name, path: path.join(globalDir, entry.name), scope: 'global' });
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Per-framework behaviors
|
|
38
|
+
const frameworksDir = path.join(repoRoot, 'agentic', 'code', 'frameworks');
|
|
39
|
+
if (fs.existsSync(frameworksDir)) {
|
|
40
|
+
for (const fw of fs.readdirSync(frameworksDir, { withFileTypes: true })) {
|
|
41
|
+
if (!fw.isDirectory()) continue;
|
|
42
|
+
const fwBehaviorsDir = path.join(frameworksDir, fw.name, 'behaviors');
|
|
43
|
+
if (!fs.existsSync(fwBehaviorsDir)) continue;
|
|
44
|
+
for (const entry of fs.readdirSync(fwBehaviorsDir, { withFileTypes: true })) {
|
|
45
|
+
if (entry.isDirectory() && fs.existsSync(path.join(fwBehaviorsDir, entry.name, 'BEHAVIOR.md'))) {
|
|
46
|
+
dirs.push({ name: entry.name, path: path.join(fwBehaviorsDir, entry.name), scope: fw.name });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return dirs;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function listBehaviors() {
|
|
56
|
+
const behaviors = getBehaviorDirs();
|
|
57
|
+
if (behaviors.length === 0) {
|
|
58
|
+
console.log('No behaviors found.');
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
console.log(`\nBehaviors (${behaviors.length}):\n`);
|
|
63
|
+
for (const b of behaviors) {
|
|
64
|
+
console.log(` ${b.name} (${b.scope})`);
|
|
65
|
+
}
|
|
66
|
+
console.log('');
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function infoBehavior(behaviorName) {
|
|
70
|
+
if (!behaviorName) {
|
|
71
|
+
console.error('Usage: aiwg behavior info <name>');
|
|
72
|
+
process.exit(1);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const behaviors = getBehaviorDirs();
|
|
76
|
+
const found = behaviors.find(b => b.name === behaviorName);
|
|
77
|
+
if (!found) {
|
|
78
|
+
console.error(`Behavior not found: ${behaviorName}`);
|
|
79
|
+
process.exit(1);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const content = fs.readFileSync(path.join(found.path, 'BEHAVIOR.md'), 'utf-8');
|
|
83
|
+
console.log(content);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function printHelp() {
|
|
87
|
+
console.log(`
|
|
88
|
+
Usage: aiwg behavior <subcommand> [name] [options]
|
|
89
|
+
|
|
90
|
+
Subcommands:
|
|
91
|
+
list List all available behaviors
|
|
92
|
+
info <name> Show behavior details (BEHAVIOR.md)
|
|
93
|
+
apply <name> Apply a behavior to the daemon (not yet implemented)
|
|
94
|
+
remove <name> Remove a behavior from the daemon (not yet implemented)
|
|
95
|
+
|
|
96
|
+
Examples:
|
|
97
|
+
aiwg behavior list
|
|
98
|
+
aiwg behavior info security-sentinel
|
|
99
|
+
`);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
async function applyBehavior(behaviorName) {
|
|
103
|
+
if (!behaviorName) {
|
|
104
|
+
console.error('Usage: aiwg behavior apply <name>');
|
|
105
|
+
process.exit(1);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
let client;
|
|
109
|
+
try {
|
|
110
|
+
client = await createClient(SOCKET_PATH);
|
|
111
|
+
const result = await client.call('behaviors.apply', { name: behaviorName });
|
|
112
|
+
console.log(`Behavior applied: ${result.name}`);
|
|
113
|
+
} catch (err) {
|
|
114
|
+
if (err.message && err.message.includes('not running')) {
|
|
115
|
+
console.error('Daemon is not running. Start it with: aiwg daemon start');
|
|
116
|
+
} else {
|
|
117
|
+
console.error(`Failed to apply behavior '${behaviorName}': ${err.message}`);
|
|
118
|
+
}
|
|
119
|
+
process.exit(1);
|
|
120
|
+
} finally {
|
|
121
|
+
client?.disconnect();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
async function removeBehavior(behaviorName) {
|
|
126
|
+
if (!behaviorName) {
|
|
127
|
+
console.error('Usage: aiwg behavior remove <name>');
|
|
128
|
+
process.exit(1);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
let client;
|
|
132
|
+
try {
|
|
133
|
+
client = await createClient(SOCKET_PATH);
|
|
134
|
+
const result = await client.call('behaviors.remove', { name: behaviorName });
|
|
135
|
+
if (result.removed) {
|
|
136
|
+
console.log(`Behavior removed: ${result.name}`);
|
|
137
|
+
} else {
|
|
138
|
+
console.log(`Behavior '${behaviorName}' was not active`);
|
|
139
|
+
}
|
|
140
|
+
} catch (err) {
|
|
141
|
+
if (err.message && err.message.includes('not running')) {
|
|
142
|
+
console.error('Daemon is not running. Start it with: aiwg daemon start');
|
|
143
|
+
} else {
|
|
144
|
+
console.error(`Failed to remove behavior '${behaviorName}': ${err.message}`);
|
|
145
|
+
}
|
|
146
|
+
process.exit(1);
|
|
147
|
+
} finally {
|
|
148
|
+
client?.disconnect();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
switch (subcommand) {
|
|
153
|
+
case 'list':
|
|
154
|
+
listBehaviors();
|
|
155
|
+
break;
|
|
156
|
+
case 'info':
|
|
157
|
+
infoBehavior(name);
|
|
158
|
+
break;
|
|
159
|
+
case 'apply':
|
|
160
|
+
applyBehavior(name);
|
|
161
|
+
break;
|
|
162
|
+
case 'remove':
|
|
163
|
+
removeBehavior(name);
|
|
164
|
+
break;
|
|
165
|
+
case '--help':
|
|
166
|
+
case '-h':
|
|
167
|
+
case undefined:
|
|
168
|
+
printHelp();
|
|
169
|
+
break;
|
|
170
|
+
default:
|
|
171
|
+
console.error(`Unknown subcommand: ${subcommand}`);
|
|
172
|
+
printHelp();
|
|
173
|
+
process.exit(1);
|
|
174
|
+
}
|
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ConciergeIntentRouter — classifies user intent and dispatches to the correct
|
|
3
|
+
* AIWG skill, agent, or flow for the daemon Concierge.
|
|
4
|
+
*
|
|
5
|
+
* Pipeline: CLASSIFY → MATCH → CAPABILITY CHECK → DISPATCH → ABSORB
|
|
6
|
+
*
|
|
7
|
+
* Design: v1 uses pattern-matching intent classification (prompt-based upgrade
|
|
8
|
+
* is a future enhancement). The router never exposes internal
|
|
9
|
+
* skill/agent names in user-facing output — only the result reaches
|
|
10
|
+
* the user. Routing decisions are logged to daemon session state for
|
|
11
|
+
* steward diagnostics.
|
|
12
|
+
*
|
|
13
|
+
* @issue #606
|
|
14
|
+
* @tests @test/unit/daemon/concierge/intent-router.test.js
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// Intent category patterns
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Ordered list of categories, each with a set of regex patterns.
|
|
23
|
+
* First match wins. 'conversational' is the catch-all fallback.
|
|
24
|
+
*/
|
|
25
|
+
const INTENT_PATTERNS = [
|
|
26
|
+
{
|
|
27
|
+
category: 'maintenance',
|
|
28
|
+
patterns: [
|
|
29
|
+
/\baiwg\s+(up\s+to\s+date|version|update|upgrade|sync|health|doctor|check)\b/i,
|
|
30
|
+
/\b(health\s+check|doctor|is\s+aiwg|update\s+aiwg|check\s+for\s+updates?)\b/i,
|
|
31
|
+
/\binstall(ation)?\s+(health|status)\b/i,
|
|
32
|
+
/\bvalidate[\s-]?metadata\b/i,
|
|
33
|
+
/\bcleanup\s+audit\b/i,
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
category: 'scheduling',
|
|
38
|
+
patterns: [
|
|
39
|
+
/\b(run|execute|do|schedule|set\s+up|create)\s+.{0,40}\b(every|each|daily|weekly|morning|night|hour|minute|cron|recurring|interval)\b/i,
|
|
40
|
+
/\b(cron|schedule|recurring|automation)\b/i,
|
|
41
|
+
/\brun\s+.{0,30}\s+at\s+\d/i,
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
category: 'agent-teams',
|
|
46
|
+
patterns: [
|
|
47
|
+
/\b(run|start|launch|kick\s+off|execute)\s+a?\s*(security|test|review|audit|analysis)\s*(team|squad|crew|group)?\b/i,
|
|
48
|
+
/\bagent\s+team\b/i,
|
|
49
|
+
/\bmulti.agent\b/i,
|
|
50
|
+
/\b(security|compliance|performance)\s+review\b/i,
|
|
51
|
+
/\bparallel\s+(agents?|review|execution)\b/i,
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
category: 'query',
|
|
56
|
+
patterns: [
|
|
57
|
+
/\b(what|which|how|where|when|who|why|list|show|what'?s)\b.*\b(command|skill|agent|feature|option|available|install|use|work|mean)\b/i,
|
|
58
|
+
/\b(help|how\s+do\s+i|how\s+to|can\s+(i|you|aiwg)|does\s+(it|aiwg)|what\s+is|explain)\b/i,
|
|
59
|
+
/\b(aiwg\s+kb|knowledge\s+base|documentation|docs)\b/i,
|
|
60
|
+
/\bwhat\s+(are|were|can)\s+.{3,30}\b(command|skill|agent|feature|option|available|install)\b/i,
|
|
61
|
+
/\bhow\s+(does|do|can|should)\s+.{3,60}\b(work|function|run|operate|behave)\b/i,
|
|
62
|
+
],
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
category: 'sdlc',
|
|
66
|
+
patterns: [
|
|
67
|
+
/\b(transition|move|start|begin|kick\s+off|enter)\s+(to\s+|into\s+)?(inception|elaboration|construction|transition|production)\b/i,
|
|
68
|
+
/\b(project\s+status|phase\s+(gate|check|status)|iteration\s+\d+|sprint\s+\d+)\b/i,
|
|
69
|
+
/\b(deploy(ment)?|release|rollout)\s+(to\s+)?(prod(uction)?|staging)\b/i,
|
|
70
|
+
/\b(requirements?|architecture|sad|adr|test\s+plan|risk\s+register)\b/i,
|
|
71
|
+
/\b(intake|onboard|handoff|retrospective|retro)\b/i,
|
|
72
|
+
/\b(fix|address|resolve|work\s+on)\s+(issue|bug|ticket|#\d+)\b/i,
|
|
73
|
+
/\baddress.issues?\b/i,
|
|
74
|
+
/\b(run|start|execute)\s+(the\s+)?ralph\s+loop\b/i,
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
category: 'conversational',
|
|
79
|
+
patterns: [
|
|
80
|
+
// Catch-all — always matches; must be last
|
|
81
|
+
/.*/,
|
|
82
|
+
],
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
// ---------------------------------------------------------------------------
|
|
87
|
+
// Default handler catalog (v1 — curated by category)
|
|
88
|
+
// ---------------------------------------------------------------------------
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Maps each intent category to its default handler descriptor.
|
|
92
|
+
* Handler ids reference AIWG skills/agents/flows by their internal id.
|
|
93
|
+
* The id is used for dispatch but never surfaced to the user.
|
|
94
|
+
*/
|
|
95
|
+
const DEFAULT_HANDLERS = {
|
|
96
|
+
maintenance: {
|
|
97
|
+
id: 'aiwg-steward',
|
|
98
|
+
type: 'agent',
|
|
99
|
+
description: 'AIWG installation health and self-maintenance',
|
|
100
|
+
requires_feature: null,
|
|
101
|
+
},
|
|
102
|
+
scheduling: {
|
|
103
|
+
id: 'schedule',
|
|
104
|
+
type: 'skill',
|
|
105
|
+
description: 'Recurring task scheduling',
|
|
106
|
+
requires_feature: 'cron',
|
|
107
|
+
},
|
|
108
|
+
'agent-teams': {
|
|
109
|
+
id: 'flow-security-review-cycle',
|
|
110
|
+
type: 'flow',
|
|
111
|
+
description: 'Multi-agent review and team coordination',
|
|
112
|
+
requires_feature: 'agent_teams',
|
|
113
|
+
},
|
|
114
|
+
sdlc: {
|
|
115
|
+
id: 'sdlc-complete',
|
|
116
|
+
type: 'framework',
|
|
117
|
+
description: 'SDLC phase workflows and project management',
|
|
118
|
+
requires_feature: null,
|
|
119
|
+
},
|
|
120
|
+
query: {
|
|
121
|
+
id: 'aiwg-kb',
|
|
122
|
+
type: 'skill',
|
|
123
|
+
description: 'AIWG knowledge base and help',
|
|
124
|
+
requires_feature: null,
|
|
125
|
+
},
|
|
126
|
+
conversational: {
|
|
127
|
+
id: 'concierge-inline',
|
|
128
|
+
type: 'inline',
|
|
129
|
+
description: 'Direct concierge response',
|
|
130
|
+
requires_feature: null,
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
// ---------------------------------------------------------------------------
|
|
135
|
+
// Sensitive operation categories for discreet logging
|
|
136
|
+
// ---------------------------------------------------------------------------
|
|
137
|
+
|
|
138
|
+
const SENSITIVE_CATEGORIES = new Set(['maintenance']);
|
|
139
|
+
const SENSITIVE_KEYWORDS = /\b(token|secret|key|credential|password|auth|cert(ificate)?|rotate)\b/i;
|
|
140
|
+
|
|
141
|
+
// ---------------------------------------------------------------------------
|
|
142
|
+
// ConciergeIntentRouter
|
|
143
|
+
// ---------------------------------------------------------------------------
|
|
144
|
+
|
|
145
|
+
export class ConciergeIntentRouter {
|
|
146
|
+
/**
|
|
147
|
+
* @param {Object} [options]
|
|
148
|
+
* @param {Object|null} [options.capabilityMatrix] Loaded capability matrix
|
|
149
|
+
* (from src/providers/capability-matrix.ts). If null, capability checks
|
|
150
|
+
* are skipped.
|
|
151
|
+
* @param {Object|null} [options.catalog] Installed catalog for
|
|
152
|
+
* semantic search (future v2 enhancement). Currently unused.
|
|
153
|
+
* @param {Object|null} [options.sessionLog] Session state logger.
|
|
154
|
+
* Must expose: log(entry: Object) => void
|
|
155
|
+
* @param {number} [options.confidenceThreshold=0.7] Below this score,
|
|
156
|
+
* the router asks for clarification instead of dispatching.
|
|
157
|
+
* @param {string|null} [options.provider] Current provider key
|
|
158
|
+
* (e.g. 'claude-code'). Used for capability checks.
|
|
159
|
+
*/
|
|
160
|
+
constructor({
|
|
161
|
+
capabilityMatrix = null,
|
|
162
|
+
catalog = null,
|
|
163
|
+
sessionLog = null,
|
|
164
|
+
confidenceThreshold = 0.7,
|
|
165
|
+
provider = null,
|
|
166
|
+
} = {}) {
|
|
167
|
+
this._capabilityMatrix = capabilityMatrix;
|
|
168
|
+
this._catalog = catalog;
|
|
169
|
+
this._sessionLog = sessionLog;
|
|
170
|
+
this.confidenceThreshold = confidenceThreshold;
|
|
171
|
+
this.provider = provider;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// -------------------------------------------------------------------------
|
|
175
|
+
// Public API
|
|
176
|
+
// -------------------------------------------------------------------------
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Route a raw user message to the appropriate handler.
|
|
180
|
+
*
|
|
181
|
+
* Returns a routing result that the Concierge uses for dispatch.
|
|
182
|
+
* Never exposes internal handler names to the caller directly — the
|
|
183
|
+
* caller is responsible for keeping routing internals out of user output.
|
|
184
|
+
*
|
|
185
|
+
* @param {string} message Raw user message
|
|
186
|
+
* @param {Object} [ctx] Optional per-call context overrides
|
|
187
|
+
* @param {string} [ctx.provider] Override the instance-level provider
|
|
188
|
+
* @returns {RoutingResult}
|
|
189
|
+
*/
|
|
190
|
+
route(message, ctx = {}) {
|
|
191
|
+
const provider = ctx.provider ?? this.provider;
|
|
192
|
+
const { category, confidence } = this.classify(message);
|
|
193
|
+
const isSensitive = this._isSensitive(message, category);
|
|
194
|
+
|
|
195
|
+
if (confidence < this.confidenceThreshold) {
|
|
196
|
+
const result = this._buildFallback(message, 'low-confidence', { category, confidence });
|
|
197
|
+
this._logDecision({ message: isSensitive ? '[redacted]' : message, ...result, provider });
|
|
198
|
+
return result;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const handler = this._matchHandler(category, message);
|
|
202
|
+
|
|
203
|
+
if (!handler) {
|
|
204
|
+
const result = this._buildFallback(message, 'no-handler', { category, confidence });
|
|
205
|
+
this._logDecision({ message: isSensitive ? '[redacted]' : message, ...result, provider });
|
|
206
|
+
return result;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const available = this._checkCapability(handler, provider);
|
|
210
|
+
|
|
211
|
+
if (!available) {
|
|
212
|
+
const result = this._buildFallback(message, 'capability-unavailable', {
|
|
213
|
+
category,
|
|
214
|
+
confidence,
|
|
215
|
+
handler,
|
|
216
|
+
provider,
|
|
217
|
+
});
|
|
218
|
+
this._logDecision({ message: isSensitive ? '[redacted]' : message, ...result, provider });
|
|
219
|
+
return result;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const result = {
|
|
223
|
+
ok: true,
|
|
224
|
+
category,
|
|
225
|
+
confidence,
|
|
226
|
+
handler,
|
|
227
|
+
provider,
|
|
228
|
+
fallback: false,
|
|
229
|
+
isSensitive,
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
this._logDecision({ message: isSensitive ? '[redacted]' : message, ...result });
|
|
233
|
+
return result;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Classify the user message into an intent category.
|
|
238
|
+
*
|
|
239
|
+
* Returns the category and a confidence score in [0, 1].
|
|
240
|
+
* Confidence is 1.0 for a specific-category match, 0.5 for conversational.
|
|
241
|
+
*
|
|
242
|
+
* @param {string} message
|
|
243
|
+
* @returns {{ category: string, confidence: number }}
|
|
244
|
+
*/
|
|
245
|
+
classify(message) {
|
|
246
|
+
if (!message || typeof message !== 'string') {
|
|
247
|
+
return { category: 'conversational', confidence: 0.5 };
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
const normalized = message.trim();
|
|
251
|
+
|
|
252
|
+
for (const { category, patterns } of INTENT_PATTERNS) {
|
|
253
|
+
// Skip catch-all for primary classification pass
|
|
254
|
+
if (category === 'conversational') continue;
|
|
255
|
+
|
|
256
|
+
for (const pattern of patterns) {
|
|
257
|
+
if (pattern.test(normalized)) {
|
|
258
|
+
return { category, confidence: 1.0 };
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
return { category: 'conversational', confidence: 0.5 };
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Expose the pattern catalog for testing and introspection.
|
|
268
|
+
* @returns {Array<{category: string, patterns: RegExp[]}>}
|
|
269
|
+
*/
|
|
270
|
+
getPatterns() {
|
|
271
|
+
return INTENT_PATTERNS.slice(0, -1); // exclude catch-all
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Expose the handler catalog for testing and introspection.
|
|
276
|
+
* @returns {Record<string, Object>}
|
|
277
|
+
*/
|
|
278
|
+
getHandlers() {
|
|
279
|
+
return { ...DEFAULT_HANDLERS };
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// -------------------------------------------------------------------------
|
|
283
|
+
// Private helpers
|
|
284
|
+
// -------------------------------------------------------------------------
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Find the best handler for the given category and message.
|
|
288
|
+
* v1: returns the default catalog handler for the category.
|
|
289
|
+
* v2: will do semantic search against the installed catalog.
|
|
290
|
+
*/
|
|
291
|
+
_matchHandler(category, _message) {
|
|
292
|
+
return DEFAULT_HANDLERS[category] ?? null;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Check whether the handler's required feature is available on the provider.
|
|
297
|
+
* Returns true if no capability matrix is configured or the handler has
|
|
298
|
+
* no feature requirement.
|
|
299
|
+
*/
|
|
300
|
+
_checkCapability(handler, provider) {
|
|
301
|
+
if (!this._capabilityMatrix || !provider || !handler.requires_feature) {
|
|
302
|
+
return true;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
const caps = this._capabilityMatrix.providers?.[provider];
|
|
306
|
+
if (!caps) return true;
|
|
307
|
+
|
|
308
|
+
const feature = handler.requires_feature;
|
|
309
|
+
const native = caps.native_features?.[feature];
|
|
310
|
+
const emulated = caps.emulation?.[feature];
|
|
311
|
+
|
|
312
|
+
return !!(native || (emulated && emulated !== null));
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Build a standardised fallback result.
|
|
317
|
+
*/
|
|
318
|
+
_buildFallback(message, reason, details = {}) {
|
|
319
|
+
return {
|
|
320
|
+
ok: false,
|
|
321
|
+
fallback: true,
|
|
322
|
+
reason,
|
|
323
|
+
category: details.category ?? 'unknown',
|
|
324
|
+
confidence: details.confidence ?? 0,
|
|
325
|
+
handler: null,
|
|
326
|
+
provider: details.provider ?? null,
|
|
327
|
+
isSensitive: this._isSensitive(message, details.category),
|
|
328
|
+
// Suggestion for in-persona user response (never expose raw reason)
|
|
329
|
+
suggestion: this._buildFallbackSuggestion(reason, details),
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Build a user-friendly (in-persona) fallback suggestion.
|
|
335
|
+
* These strings are consumed by the Concierge response layer — they are NOT
|
|
336
|
+
* shown verbatim to the user; the Concierge applies tone rules before surfacing.
|
|
337
|
+
*/
|
|
338
|
+
_buildFallbackSuggestion(reason, details) {
|
|
339
|
+
switch (reason) {
|
|
340
|
+
case 'low-confidence':
|
|
341
|
+
return 'Could you clarify what you need? I want to make sure I route this correctly.';
|
|
342
|
+
case 'no-handler':
|
|
343
|
+
return `I don\'t have a handler for that category yet. Here\'s what I can help with: maintenance, scheduling, agent teams, SDLC workflows, and general questions.`;
|
|
344
|
+
case 'capability-unavailable': {
|
|
345
|
+
const feature = details.handler?.requires_feature;
|
|
346
|
+
const provider = details.provider;
|
|
347
|
+
return feature && provider
|
|
348
|
+
? `That feature (${feature}) isn\'t available on ${provider}. I can use AIWG emulation — would you like me to proceed that way?`
|
|
349
|
+
: 'That capability isn\'t available in the current environment. Would you like to see alternatives?';
|
|
350
|
+
}
|
|
351
|
+
default:
|
|
352
|
+
return 'I wasn\'t able to handle that request. Could you rephrase it?';
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Determine if the message or category is sensitive (redact from logs).
|
|
358
|
+
*/
|
|
359
|
+
_isSensitive(message, category) {
|
|
360
|
+
if (SENSITIVE_CATEGORIES.has(category)) return false; // maintenance is not sensitive
|
|
361
|
+
return typeof message === 'string' && SENSITIVE_KEYWORDS.test(message);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Log the routing decision to the session log.
|
|
366
|
+
* Log entries are consumed by the steward for diagnostics — never surfaced
|
|
367
|
+
* directly to the user.
|
|
368
|
+
*/
|
|
369
|
+
_logDecision(entry) {
|
|
370
|
+
if (!this._sessionLog) return;
|
|
371
|
+
|
|
372
|
+
try {
|
|
373
|
+
this._sessionLog.log({
|
|
374
|
+
source: 'concierge:intent-router',
|
|
375
|
+
timestamp: new Date().toISOString(),
|
|
376
|
+
...entry,
|
|
377
|
+
});
|
|
378
|
+
} catch {
|
|
379
|
+
// Non-fatal — logging failures must not disrupt routing
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
// ---------------------------------------------------------------------------
|
|
385
|
+
// Exports
|
|
386
|
+
// ---------------------------------------------------------------------------
|
|
387
|
+
|
|
388
|
+
export { INTENT_PATTERNS, DEFAULT_HANDLERS };
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* @typedef {Object} RoutingResult
|
|
392
|
+
* @property {boolean} ok True when a handler was matched and is available
|
|
393
|
+
* @property {string} category Classified intent category
|
|
394
|
+
* @property {number} confidence Classification confidence [0, 1]
|
|
395
|
+
* @property {Object|null} handler Matched handler descriptor (or null on fallback)
|
|
396
|
+
* @property {string|null} provider Provider key used for capability check
|
|
397
|
+
* @property {boolean} fallback True when ok=false and a fallback was triggered
|
|
398
|
+
* @property {boolean} isSensitive True when message contains sensitive keywords
|
|
399
|
+
* @property {string} [reason] Fallback reason (present when fallback=true)
|
|
400
|
+
* @property {string} [suggestion] In-persona fallback suggestion (when fallback=true)
|
|
401
|
+
*/
|