@aiwg/cli 2026.10.15 → 2026.10.16
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 +23 -9
- 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/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/models-resource-sample.js +10 -0
- package/dist/src/cli/handlers/models.js +3 -2
- package/dist/src/cli/handlers/regenerate.js +8 -16
- package/dist/src/cli/handlers/sessions.js +7 -7
- package/dist/src/cli/handlers/subcommands.js +8 -0
- 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/services/deployment-verification.js +0 -1
- package/dist/src/config/aiwg-config.js +2 -1
- package/dist/src/config/authorization-cli.js +7 -3
- package/dist/src/config/dispatch-thresholds-runtime.d.mts +3 -2
- package/dist/src/config/dispatch-thresholds-runtime.mjs +17 -7
- package/dist/src/config/framework-aliases.js +12 -0
- package/dist/src/config/host-resource-report.d.mts +19 -0
- package/dist/src/config/host-resource-report.mjs +80 -0
- package/dist/src/config/host-resource-runtime.d.mts +34 -0
- package/dist/src/config/host-resource-runtime.mjs +293 -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/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/effects/verifiers/file.js +22 -5
- package/dist/src/extensions/claude-attribution.js +82 -0
- package/dist/src/extensions/claude-hooks-installer.js +115 -69
- package/dist/src/extensions/commands/daemon.js +109 -0
- package/dist/src/extensions/commands/definitions.js +5 -89
- package/dist/src/gates/heldout.js +17 -7
- 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/memory/project-registry.js +44 -4
- 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/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/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/research/clients/arxiv.js +4 -30
- package/dist/src/research/clients/base.js +48 -22
- package/dist/src/research/identity.js +34 -2
- 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 +70 -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/serve/mission-conductor.js +48 -4
- 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 +16 -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/finalization.js +81 -51
- package/dist/src/smiths/context-pipeline/generator.js +9 -10
- 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/package.json +10 -1
- package/schemas/decision/D29Study.v10.schema.json +65 -0
- package/tools/agents/deploy-agents.mjs +10 -0
- package/tools/agents/providers/claude-post-deploy.mjs +12 -1
- package/tools/agents/providers/context-write.mjs +4 -0
- package/tools/agents/providers/pi.mjs +3 -1
- package/tools/agents/providers/rule-delivery-surface.mjs +332 -0
- package/tools/agents/providers/rule-delivery.mjs +20 -1144
- package/tools/agents/providers/rule-deployment-commit.mjs +144 -0
- package/tools/agents/providers/rule-deployment-prepare.mjs +452 -0
- package/tools/agents/providers/rule-deployment-state.mjs +300 -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 +3 -2
- 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-unit-cleanup.mjs +72 -0
- package/tools/ralph-external/session-launcher.mjs +7 -7
- package/tools/scripts/resource-preflight.mjs +3 -242
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ConciergeOrchestrator — wires the intent router, response translator,
|
|
3
|
+
* and memory manager into a single pipeline that mediates daemon interactions.
|
|
4
|
+
*
|
|
5
|
+
* Pipeline:
|
|
6
|
+
* user input → intent router → handler dispatch → response translator → user output
|
|
7
|
+
*
|
|
8
|
+
* Lifecycle hooks:
|
|
9
|
+
* - onSessionStart(ctx) — greeting with memory context
|
|
10
|
+
* - handleMessage(msg,ctx) — full classify→dispatch→translate pipeline
|
|
11
|
+
* - translateResponse(raw) — standalone pre-response translation
|
|
12
|
+
* - onError(error, ctx) — error absorption
|
|
13
|
+
*
|
|
14
|
+
* @issue #642
|
|
15
|
+
* @tests @test/unit/daemon/concierge/orchestrator.test.js
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { ConciergeIntentRouter } from './intent-router.mjs';
|
|
19
|
+
import { ConciergeResponseTranslator } from './response-translator.mjs';
|
|
20
|
+
|
|
21
|
+
export class ConciergeOrchestrator {
|
|
22
|
+
/**
|
|
23
|
+
* @param {Object} options
|
|
24
|
+
* @param {Object} options.supervisor AgentSupervisor for task dispatch
|
|
25
|
+
* @param {Object} [options.memoryManager] MemoryManager for session context
|
|
26
|
+
* @param {Object} [options.capabilityMatrix] Provider capability data
|
|
27
|
+
* @param {string} [options.provider] Current provider key
|
|
28
|
+
* @param {Object} [options.sessionLog] Session state logger
|
|
29
|
+
*/
|
|
30
|
+
constructor(options = {}) {
|
|
31
|
+
this.supervisor = options.supervisor;
|
|
32
|
+
this.memoryManager = options.memoryManager || null;
|
|
33
|
+
this.provider = options.provider || null;
|
|
34
|
+
|
|
35
|
+
this.router = new ConciergeIntentRouter({
|
|
36
|
+
capabilityMatrix: options.capabilityMatrix || null,
|
|
37
|
+
provider: this.provider,
|
|
38
|
+
sessionLog: options.sessionLog || null,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
this.translator = new ConciergeResponseTranslator();
|
|
42
|
+
|
|
43
|
+
this._sessionStarted = false;
|
|
44
|
+
this._sessionContext = {};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// ---------------------------------------------------------------------------
|
|
48
|
+
// Session lifecycle
|
|
49
|
+
// ---------------------------------------------------------------------------
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Called on first interaction or explicit session start.
|
|
53
|
+
* Loads memory context and returns a contextual greeting.
|
|
54
|
+
*
|
|
55
|
+
* @param {Object} [ctx] Session context (branch, pending tasks, etc.)
|
|
56
|
+
* @returns {{ greeting: string, memoryContext: string }}
|
|
57
|
+
*/
|
|
58
|
+
onSessionStart(ctx = {}) {
|
|
59
|
+
this._sessionStarted = true;
|
|
60
|
+
this._sessionContext = { ...ctx, startedAt: new Date().toISOString() };
|
|
61
|
+
|
|
62
|
+
const memoryContext = this.memoryManager?.getContext?.() || '';
|
|
63
|
+
|
|
64
|
+
// Build a contextual greeting — not a generic hello
|
|
65
|
+
let greeting = 'Good to see you. What are we working on?';
|
|
66
|
+
|
|
67
|
+
if (memoryContext) {
|
|
68
|
+
// Memory exists ��� reference prior context
|
|
69
|
+
const hasActiveWork = memoryContext.includes('in progress') ||
|
|
70
|
+
memoryContext.includes('working on') ||
|
|
71
|
+
memoryContext.includes('active');
|
|
72
|
+
if (hasActiveWork) {
|
|
73
|
+
greeting = 'Picking up where we left off. What would you like to focus on?';
|
|
74
|
+
} else {
|
|
75
|
+
greeting = 'Welcome back. What can I help with?';
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return { greeting, memoryContext };
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// ---------------------------------------------------------------------------
|
|
83
|
+
// Message handling — the main pipeline
|
|
84
|
+
// ---------------------------------------------------------------------------
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Process a user message through the full concierge pipeline.
|
|
88
|
+
*
|
|
89
|
+
* classify → route → dispatch → translate → return
|
|
90
|
+
*
|
|
91
|
+
* @param {string} message User message
|
|
92
|
+
* @param {Object} [ctx] Per-call context
|
|
93
|
+
* @returns {Promise<ConciergeResult>}
|
|
94
|
+
*/
|
|
95
|
+
async handleMessage(message, ctx = {}) {
|
|
96
|
+
// Ensure session is started
|
|
97
|
+
if (!this._sessionStarted) {
|
|
98
|
+
this.onSessionStart(ctx);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Step 1: Route — classify intent, match handler, check capability
|
|
102
|
+
const routing = this.router.route(message, { provider: ctx.provider || this.provider });
|
|
103
|
+
|
|
104
|
+
// Step 2: Dispatch based on routing result
|
|
105
|
+
let rawOutput;
|
|
106
|
+
let taskId = null;
|
|
107
|
+
|
|
108
|
+
if (routing.fallback) {
|
|
109
|
+
// Fallback — use the router's suggestion as the response
|
|
110
|
+
rawOutput = routing.suggestion || 'Could you clarify what you need?';
|
|
111
|
+
} else if (routing.handler?.type === 'inline') {
|
|
112
|
+
// Conversational — concierge responds directly (no task dispatch)
|
|
113
|
+
rawOutput = this._handleInline(message, routing);
|
|
114
|
+
} else {
|
|
115
|
+
// Dispatch to supervisor as a task
|
|
116
|
+
const dispatchResult = this._dispatch(message, routing);
|
|
117
|
+
taskId = dispatchResult.taskId;
|
|
118
|
+
// For async tasks, return immediately with task reference
|
|
119
|
+
// The pre-response hook will translate the result when it completes
|
|
120
|
+
return {
|
|
121
|
+
type: 'task-dispatched',
|
|
122
|
+
taskId,
|
|
123
|
+
category: routing.category,
|
|
124
|
+
handler: routing.handler?.id,
|
|
125
|
+
message: `On it. I've queued that for ${routing.handler?.description || routing.category}.`,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Step 3: Translate the response
|
|
130
|
+
const translated = this.translator.translate(rawOutput, {
|
|
131
|
+
isSensitive: routing.isSensitive,
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
return {
|
|
135
|
+
type: 'response',
|
|
136
|
+
taskId,
|
|
137
|
+
category: routing.category,
|
|
138
|
+
response: translated.translated,
|
|
139
|
+
bypassed: translated.bypassed,
|
|
140
|
+
discreetApplied: translated.discreetApplied,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// ---------------------------------------------------------------------------
|
|
145
|
+
// Pre-response hook — translate raw task output
|
|
146
|
+
// ---------------------------------------------------------------------------
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Translate raw output from a completed task.
|
|
150
|
+
* Called by the daemon when a supervisor task completes.
|
|
151
|
+
*
|
|
152
|
+
* @param {string} raw Raw task output
|
|
153
|
+
* @param {Object} [options] Translation options
|
|
154
|
+
* @param {boolean} [options.raw] Skip translation
|
|
155
|
+
* @param {boolean} [options.verbose] Skip translation
|
|
156
|
+
* @param {string} [options.sourceType] Output type hint
|
|
157
|
+
* @param {boolean} [options.isSensitive] Mark as sensitive
|
|
158
|
+
* @returns {TranslationResult}
|
|
159
|
+
*/
|
|
160
|
+
translateResponse(raw, options = {}) {
|
|
161
|
+
return this.translator.translate(raw, options);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// ---------------------------------------------------------------------------
|
|
165
|
+
// Error absorption
|
|
166
|
+
// ---------------------------------------------------------------------------
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Absorb an error and return a composed, non-technical response.
|
|
170
|
+
* Never exposes stack traces or internal state to the user.
|
|
171
|
+
*
|
|
172
|
+
* @param {Error|string} error The error to absorb
|
|
173
|
+
* @param {Object} [ctx] Context about what was happening
|
|
174
|
+
* @returns {{ response: string, severity: string }}
|
|
175
|
+
*/
|
|
176
|
+
onError(error, ctx = {}) {
|
|
177
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
178
|
+
const stack = error instanceof Error ? error.stack : '';
|
|
179
|
+
|
|
180
|
+
// Classify the error
|
|
181
|
+
let severity = 'recoverable';
|
|
182
|
+
let response;
|
|
183
|
+
|
|
184
|
+
if (message.includes('ENOENT') || message.includes('not found')) {
|
|
185
|
+
severity = 'user-actionable';
|
|
186
|
+
response = 'I couldn\'t find what was needed. Could you check the path or resource exists?';
|
|
187
|
+
} else if (message.includes('ECONNREFUSED') || message.includes('timeout') || message.includes('ETIMEDOUT')) {
|
|
188
|
+
severity = 'recoverable';
|
|
189
|
+
response = 'A connection issue occurred. I\'ll retry shortly.';
|
|
190
|
+
} else if (message.includes('permission') || message.includes('EACCES')) {
|
|
191
|
+
severity = 'user-actionable';
|
|
192
|
+
response = 'I don\'t have the required permissions. You may need to check access settings.';
|
|
193
|
+
} else if (message.includes('INVALID_PARAMS') || message.includes('Missing required')) {
|
|
194
|
+
severity = 'user-actionable';
|
|
195
|
+
response = `Something was missing from the request: ${message.replace(/^.*?:\s*/, '')}`;
|
|
196
|
+
} else {
|
|
197
|
+
severity = 'system-level';
|
|
198
|
+
response = 'Something went wrong internally. Details have been logged.';
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return { response, severity, logged: true };
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// ---------------------------------------------------------------------------
|
|
205
|
+
// Status
|
|
206
|
+
// ---------------------------------------------------------------------------
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Return concierge status for IPC/CLI inspection.
|
|
210
|
+
*/
|
|
211
|
+
getStatus() {
|
|
212
|
+
return {
|
|
213
|
+
enabled: true,
|
|
214
|
+
sessionStarted: this._sessionStarted,
|
|
215
|
+
sessionContext: this._sessionContext,
|
|
216
|
+
provider: this.provider,
|
|
217
|
+
routerPatterns: this.router.getPatterns().length,
|
|
218
|
+
routerHandlers: Object.keys(this.router.getHandlers()).length,
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// ---------------------------------------------------------------------------
|
|
223
|
+
// Private
|
|
224
|
+
// ---------------------------------------------------------------------------
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Handle inline/conversational messages directly.
|
|
228
|
+
* No task dispatch — the concierge responds in-persona.
|
|
229
|
+
*/
|
|
230
|
+
_handleInline(message, routing) {
|
|
231
|
+
const lower = (message || '').toLowerCase().trim();
|
|
232
|
+
|
|
233
|
+
if (/^(thanks|thank you|cheers|ta|thx)/i.test(lower)) {
|
|
234
|
+
return 'Happy to help.';
|
|
235
|
+
}
|
|
236
|
+
if (/^(looks? good|perfect|great|nice|ok|okay|👍)/i.test(lower)) {
|
|
237
|
+
return 'Glad that works. Let me know if you need anything else.';
|
|
238
|
+
}
|
|
239
|
+
if (/^(hi|hello|hey|good (morning|afternoon|evening))/i.test(lower)) {
|
|
240
|
+
return this._sessionStarted
|
|
241
|
+
? 'What can I help with?'
|
|
242
|
+
: this.onSessionStart({}).greeting;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
return 'Understood. What would you like to do next?';
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Dispatch a message to the supervisor based on routing result.
|
|
250
|
+
*/
|
|
251
|
+
_dispatch(message, routing) {
|
|
252
|
+
const handler = routing.handler;
|
|
253
|
+
const prompt = handler.type === 'agent'
|
|
254
|
+
? message // Agents receive the raw user message
|
|
255
|
+
: `[Concierge → ${handler.id}] ${message}`; // Skills/flows get a tagged prompt
|
|
256
|
+
|
|
257
|
+
const task = this.supervisor.submit(prompt, {
|
|
258
|
+
agent: handler.type === 'agent' ? handler.id : undefined,
|
|
259
|
+
priority: 5, // Chat messages get higher priority
|
|
260
|
+
metadata: {
|
|
261
|
+
source: 'concierge',
|
|
262
|
+
category: routing.category,
|
|
263
|
+
handlerId: handler.id,
|
|
264
|
+
handlerType: handler.type,
|
|
265
|
+
},
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
return { taskId: task.id };
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export default ConciergeOrchestrator;
|