u-foo 4.0.0 → 4.0.2
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/OBSERVABILITY.md +65 -0
- package/README.md +90 -30
- package/README.zh-CN.md +76 -26
- package/SKILLS/ufoo/SKILL.md +25 -1
- package/SKILLS/ufoo-bus/SKILL.md +25 -2
- package/bin/ucode.js +4 -0
- package/bin/ufoo.js +3 -3
- package/dist/tui/darwin-arm64/ufoo-tui +0 -0
- package/dist/tui/darwin-x64/ufoo-tui +0 -0
- package/dist/tui/linux-arm64/ufoo-tui +0 -0
- package/dist/tui/linux-x64/ufoo-tui +0 -0
- package/package.json +6 -6
- package/src/agents/activity/activityDetector.js +1 -1
- package/src/agents/capabilities/agentManagement/service.js +40 -13
- package/src/agents/capabilities/coordination/index.js +1 -1
- package/src/agents/capabilities/taskReports/index.js +1 -1
- package/src/agents/controller/controllerToolExecutor.js +36 -20
- package/src/agents/controller/index.js +1 -6
- package/src/agents/internal/internalRunner.js +90 -56
- package/src/agents/launch/index.js +0 -1
- package/src/agents/launch/launcher.js +38 -29
- package/src/agents/launch/launcherReadiness.js +35 -0
- package/src/agents/launch/notifier.js +2 -2
- package/src/agents/launch/ptyWrapper.js +5 -2
- package/src/agents/launch/readyDetector.js +2 -2
- package/src/agents/profiles/main.js +1 -1
- package/src/agents/prompts/cooperation.js +14 -0
- package/src/agents/prompts/defaultBootstrap.js +1 -1
- package/src/agents/prompts/groupBootstrap.js +23 -7
- package/src/agents/prompts/mainAgent.js +11 -2
- package/src/agents/prompts/native/system.js +4 -1
- package/src/agents/prompts/native/ufoo.js +11 -3
- package/src/agents/prompts/promptProfiles.js +2 -0
- package/src/agents/prompts/reporting.js +16 -0
- package/src/agents/providers/claudeEventTranslator.js +3 -0
- package/src/agents/providers/claudeThreadProvider.js +3 -2
- package/src/agents/providers/clientIdentity.js +75 -0
- package/src/agents/providers/codexEventTranslator.js +23 -2
- package/src/agents/providers/codexThreadProvider.js +15 -6
- package/src/agents/providers/credentials/index.js +2 -0
- package/src/agents/providers/directAuthStatus.js +1 -1
- package/src/agents/providers/index.js +1 -1
- package/src/agents/providers/modelSettings.js +34 -0
- package/src/agents/providers/modelsCatalog.js +379 -0
- package/src/agents/providers/nativeTransport.js +58 -40
- package/src/agents/providers/runtimeConfig.js +10 -8
- package/src/agents/providers/thinkingLevels.js +10 -36
- package/src/agents/providers/transports/responsesProtocol.js +11 -6
- package/src/agents/providers/upstreamRuntime.js +135 -0
- package/src/agents/runtime/context/checkpointStore.js +38 -0
- package/src/agents/runtime/context/compaction.js +151 -0
- package/src/agents/runtime/context/contextBudget.js +93 -0
- package/src/agents/runtime/context/replayHistory.js +28 -0
- package/src/agents/runtime/context/runtimeStore.js +2 -1
- package/src/agents/runtime/core/agentLoop.js +99 -18
- package/src/agents/runtime/core/executionBudget.js +36 -0
- package/src/agents/runtime/createAgentRuntime.js +16 -4
- package/src/agents/runtime/prompts/responseLanguage.js +12 -0
- package/src/agents/runtime/protocol/runObservation.js +24 -0
- package/src/agents/runtime/protocol/traceContext.js +9 -0
- package/src/app/chat/ChatController.js +26 -53
- package/src/app/chat/agentDirectory.js +1 -16
- package/src/app/chat/bootstrap.js +1 -2
- package/src/app/chat/commandExecutor.js +93 -285
- package/src/app/chat/commands.js +32 -45
- package/src/app/chat/daemonMessageRouter.js +0 -45
- package/src/app/chat/historyStore.js +12 -48
- package/src/app/chat/inputSubmitHandler.js +7 -33
- package/src/app/chat/internalAgentLogHistory.js +19 -60
- package/src/app/chat/multiWindow/paneManager.js +10 -3
- package/src/app/chat/streamState.js +0 -4
- package/src/app/cli/features/init.js +5 -5
- package/src/app/cli/metricsCommands.js +68 -0
- package/src/app/cli/run.js +42 -3
- package/src/app/cli/traceCommands.js +36 -0
- package/src/code/agent.js +18 -13
- package/src/code/busConsumer.js +1 -3
- package/src/code/commands.js +1 -1
- package/src/code/context/assembler.js +7 -8
- package/src/code/context/stateCommit.js +2 -1
- package/src/code/internalThread.js +10 -3
- package/src/code/launcher/ucode.js +1 -1
- package/src/code/launcher/ucodeBootstrap.js +1 -1
- package/src/code/modelCommand.js +11 -35
- package/src/code/nativeRunner.js +55 -17
- package/src/code/providers/modelsCatalog.js +1 -317
- package/src/code/repl.js +4 -11
- package/src/code/sessionStore.js +3 -3
- package/src/code/taskDecomposer.js +18 -0
- package/src/code/toolBudget.js +1 -17
- package/src/config.js +22 -72
- package/src/coordination/bus/index.js +12 -3
- package/src/coordination/bus/inject.js +2 -2
- package/src/coordination/bus/message.js +15 -1
- package/src/coordination/bus/nickname.js +1 -1
- package/src/coordination/bus/subscriber.js +3 -2
- package/src/coordination/bus/utils.js +1 -1
- package/src/coordination/history/agentPerformance.js +279 -0
- package/src/coordination/history/agentTrace.js +249 -0
- package/src/coordination/state/workspaceAccess.js +1 -1
- package/src/orchestration/controller/index.js +1 -8
- package/src/orchestration/controller/launchRouting.js +1 -1
- package/src/orchestration/solo/commands.js +3 -1
- package/src/runtime/contracts/agentMode.js +11 -2
- package/src/runtime/contracts/uiProtocol.js +18 -19
- package/src/runtime/daemon/agentHost.js +57 -25
- package/src/runtime/daemon/agentRecoveryGroups.js +70 -0
- package/src/runtime/daemon/busBridge.js +1 -1
- package/src/runtime/daemon/controlPlaneService.js +1 -1
- package/src/runtime/daemon/groupOrchestrator.js +20 -5
- package/src/runtime/daemon/groupStatus.js +20 -0
- package/src/runtime/daemon/index.js +19 -44
- package/src/runtime/daemon/mcpHttpServer.js +39 -10
- package/src/runtime/daemon/mcpServer.js +1 -1
- package/src/runtime/daemon/nicknameScope.js +1 -1
- package/src/runtime/daemon/ops.js +46 -23
- package/src/runtime/daemon/projectRuntimeGateway.js +2 -0
- package/src/runtime/daemon/promptRequest.js +92 -589
- package/src/runtime/daemon/status.js +5 -6
- package/src/tools/controllerSchemas.js +6 -2
- package/src/tools/handlers/tier2.js +4 -2
- package/src/tools/registry.js +4 -0
- package/src/tools/schemaFixtures.js +26 -2
- package/src/tools/tier0/readAgentMetrics.js +14 -0
- package/src/tools/tier0/readAgentTrace.js +12 -0
- package/src/ui/agentSettingsController.js +107 -0
- package/src/ui/agentSurface.js +1 -1
- package/src/ui/dashboardBridge.js +1 -1
- package/src/ui/format/banner.js +1 -4
- package/src/ui/format/index.js +14 -10
- package/src/ui/format/loopSummary.js +50 -0
- package/src/ui/format/markdownRenderer.js +3 -4
- package/src/ui/rustChatHost.js +191 -206
- package/src/ui/rustMultiSession.js +77 -36
- package/src/ui/rustUcodeHost.js +6 -1
- package/src/ui/settingsBridge.js +33 -16
- package/src/ui/toolMergeBridge.js +0 -4
- package/src/ui/uiHostServer.js +5 -8
- package/src/agents/controller/loopObservability.js +0 -200
- package/src/agents/controller/loopRuntime.js +0 -336
- package/src/agents/controller/ufooAgent.js +0 -830
- package/src/agents/launch/ptyRunner.js +0 -1135
- package/src/agents/providers/controllerJsonTransport.js +0 -28
- package/src/agents/providers/upstreamTransport.js +0 -698
- package/src/app/chat/agentBar.js +0 -135
- package/src/app/chat/agentSockets.js +0 -225
- package/src/app/chat/dashboardView.js +0 -405
- package/src/app/chat/rawKeyMap.js +0 -42
- package/src/app/chat/settingsController.js +0 -111
- package/src/coordination/history/controllerSummary.js +0 -23
- package/src/orchestration/controller/flags.js +0 -167
- package/src/orchestration/controller/gateRouter.js +0 -211
- package/src/orchestration/controller/routerFastPath.js +0 -22
- package/src/orchestration/controller/routerFinalize.js +0 -222
- package/src/orchestration/controller/shadowGuard.js +0 -280
- package/src/runtime/daemon/executionPaths.js +0 -30
- package/src/runtime/daemon/promptLoop.js +0 -136
- package/src/runtime/privacy/shadowDiff.js +0 -174
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { createHash } = require("crypto");
|
|
4
|
+
const { stableStringify } = require("../core/stableJson");
|
|
5
|
+
const { version } = require("../../../../package.json");
|
|
6
|
+
|
|
7
|
+
function observationFingerprint(value) {
|
|
8
|
+
return createHash("sha256").update(stableStringify(value) || "null").digest("hex");
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Configuration evidence only: no credentials, headers, URLs or prompt bodies.
|
|
12
|
+
function buildRunObservation({ provider = "", model = "", transport = "", thinkingLevel = "",
|
|
13
|
+
systemPrompt = "", systemBlocks = null, prompt = "", tools = [], resume = false, executionKind = "native", engineFingerprint = null, requestKind = "unknown" } = {}) {
|
|
14
|
+
const config = { version: 1, runtimeVersion: version, engineFingerprint, executionKind, provider, model, transport,
|
|
15
|
+
thinkingLevel, requestKind, resumed: Boolean(resume),
|
|
16
|
+
promptFingerprint: observationFingerprint(systemBlocks || systemPrompt),
|
|
17
|
+
inputFingerprint: prompt ? observationFingerprint(prompt) : null,
|
|
18
|
+
toolSchemaFingerprint: tools.length ? observationFingerprint(tools) : null,
|
|
19
|
+
toolCount: executionKind === "sdk" && !tools.length ? null : tools.length,
|
|
20
|
+
toolInventoryScope: executionKind === "sdk" ? "ufoo-exposed" : "runtime" };
|
|
21
|
+
return { ...config, configurationFingerprint: observationFingerprint({ ...config, inputFingerprint: undefined, resumed: undefined }) };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
module.exports = { buildRunObservation, observationFingerprint };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// Correlation metadata is observational. It never grants authority or identity.
|
|
4
|
+
const TRACE_FIELDS = Object.freeze(["traceId", "taskId", "taskRunId", "parentTaskRunId", "parentSessionId", "parentRequestId", "requestId", "attemptId"]);
|
|
5
|
+
function normalizeTraceContext(input = {}) {
|
|
6
|
+
return Object.fromEntries(TRACE_FIELDS.filter(key => typeof input?.[key] === "string" && input[key].length <= 256 && input[key].trim())
|
|
7
|
+
.map(key => [key, input[key].trim()]));
|
|
8
|
+
}
|
|
9
|
+
module.exports = { normalizeTraceContext };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Headless ChatController — composition root for
|
|
4
|
+
* Headless ChatController — composition root for Rust chat.
|
|
5
5
|
*
|
|
6
6
|
* Owns stream state, STATUS→agents snapshot, slash/submit wiring ports.
|
|
7
7
|
* View adapters attach via `ports` (dispatch / publish / log / setStatus).
|
|
@@ -21,7 +21,6 @@ const {
|
|
|
21
21
|
buildAgentMaps,
|
|
22
22
|
resolveAgentId,
|
|
23
23
|
normalizeStatusToAgentsSnapshot,
|
|
24
|
-
toInkAgentsDispatchList,
|
|
25
24
|
} = require("./agentDirectory");
|
|
26
25
|
const { buildPromptIpcRequest, buildDirectBusSendRequest } = require("./ipcBuilders");
|
|
27
26
|
const { IPC_REQUEST_TYPES } = require("../../runtime/contracts/eventContract");
|
|
@@ -29,7 +28,6 @@ const { IPC_REQUEST_TYPES } = require("../../runtime/contracts/eventContract");
|
|
|
29
28
|
function createChatController({
|
|
30
29
|
projectRoot = process.cwd(),
|
|
31
30
|
globalMode = false,
|
|
32
|
-
internalOnly = false,
|
|
33
31
|
ports = {},
|
|
34
32
|
} = {}) {
|
|
35
33
|
const view = {
|
|
@@ -38,9 +36,6 @@ function createChatController({
|
|
|
38
36
|
setStatus: typeof ports.setStatus === "function" ? ports.setStatus : () => {},
|
|
39
37
|
publish: typeof ports.publish === "function" ? ports.publish : () => {},
|
|
40
38
|
getState: typeof ports.getState === "function" ? ports.getState : () => ({}),
|
|
41
|
-
mapAgentsForDispatch: typeof ports.mapAgentsForDispatch === "function"
|
|
42
|
-
? ports.mapAgentsForDispatch
|
|
43
|
-
: (snapshot) => snapshot.agents,
|
|
44
39
|
appendHistory: typeof ports.appendHistory === "function"
|
|
45
40
|
? ports.appendHistory
|
|
46
41
|
: (type, text, meta) => appendChatHistory(projectRoot, type, text, meta, { globalMode }),
|
|
@@ -72,12 +67,13 @@ function createChatController({
|
|
|
72
67
|
|
|
73
68
|
function setSend(fn) {
|
|
74
69
|
daemonSend = typeof fn === "function" ? (req) => fn(req.type === IPC_REQUEST_TYPES.PROMPT || req.type === IPC_REQUEST_TYPES.AGENT_RUNTIME
|
|
75
|
-
? { ...req, request_id: req.request_id || require("crypto").randomUUID(), session_id: req.session_id
|
|
70
|
+
? { ...req, request_id: req.request_id || require("crypto").randomUUID(), session_id: req.session_id
|
|
71
|
+
|| require("../../config").loadConfig(ports.getActiveProjectRoot?.() || projectRoot).agentConversationId || session.runtimeSessionId } : req) : () => {};
|
|
76
72
|
}
|
|
77
73
|
setSend(view.send);
|
|
78
74
|
|
|
79
75
|
function applyStatus(data = {}) {
|
|
80
|
-
const snapshot = normalizeStatusToAgentsSnapshot(data, { internalOnly });
|
|
76
|
+
const snapshot = normalizeStatusToAgentsSnapshot(data, { internalOnly: true });
|
|
81
77
|
session.agents = snapshot.agents.map((row) => row.id || row.fullId);
|
|
82
78
|
session.metaMap = snapshot.metaMap;
|
|
83
79
|
session.labelMap = snapshot.labelMap;
|
|
@@ -95,20 +91,20 @@ function createChatController({
|
|
|
95
91
|
cron: snapshot.cron,
|
|
96
92
|
loop: snapshot.loop,
|
|
97
93
|
});
|
|
98
|
-
view.dispatch({ type: "agents/set", list:
|
|
94
|
+
view.dispatch({ type: "agents/set", list: snapshot.agents });
|
|
99
95
|
return snapshot;
|
|
100
96
|
}
|
|
101
97
|
|
|
102
98
|
function patchAgentActivity(agentId, patch = {}) {
|
|
103
99
|
if (!agentId) return;
|
|
104
|
-
if (
|
|
100
|
+
if (!session.metaMap.has(agentId)) return;
|
|
105
101
|
const existing = session.metaMap.get(agentId) || { id: agentId };
|
|
106
102
|
const next = { ...existing, ...patch };
|
|
107
103
|
session.metaMap.set(agentId, next);
|
|
108
104
|
const rebuilt = normalizeStatusToAgentsSnapshot({
|
|
109
105
|
active: session.agents,
|
|
110
106
|
active_meta: session.agents.map((id) => session.metaMap.get(id) || { id }),
|
|
111
|
-
}, { internalOnly });
|
|
107
|
+
}, { internalOnly: true });
|
|
112
108
|
session.footer = rebuilt.footer;
|
|
113
109
|
view.publish("agents.patch", {
|
|
114
110
|
agents: rebuilt.agents.map((row) => ({
|
|
@@ -130,12 +126,10 @@ function createChatController({
|
|
|
130
126
|
const { createCommandExecutor } = require("./commandExecutor");
|
|
131
127
|
const { parseCommand } = require("./commands");
|
|
132
128
|
const { startDaemon, stopDaemon } = require("./transport");
|
|
133
|
-
const AgentActivator = require("../../coordination/bus/activate");
|
|
134
129
|
const fs = require("fs");
|
|
135
130
|
|
|
136
131
|
commandExecutor = createCommandExecutor({
|
|
137
132
|
projectRoot,
|
|
138
|
-
internalOnly,
|
|
139
133
|
getActiveProjectRoot: typeof ports.getActiveProjectRoot === "function"
|
|
140
134
|
? ports.getActiveProjectRoot
|
|
141
135
|
: () => projectRoot,
|
|
@@ -174,18 +168,22 @@ function createChatController({
|
|
|
174
168
|
? ports.restartDaemon
|
|
175
169
|
: async () => {},
|
|
176
170
|
send: (req) => daemonSend(req),
|
|
177
|
-
setRuntimeSession: (id) => {
|
|
178
|
-
|
|
171
|
+
setRuntimeSession: (id) => {
|
|
172
|
+
session.runtimeSessionId = id;
|
|
173
|
+
require("../../config").saveConfig(ports.getActiveProjectRoot?.() || projectRoot, { agentConversationId: id });
|
|
174
|
+
},
|
|
175
|
+
getRuntimeSession: () => require("../../config").loadConfig(ports.getActiveProjectRoot?.() || projectRoot).agentConversationId || session.runtimeSessionId,
|
|
176
|
+
openAgentSettings: ports.openAgentSettings,
|
|
177
|
+
applyAgentModel: ports.applyAgentModel,
|
|
178
|
+
applyAgentSettings: ports.applyAgentSettings,
|
|
179
179
|
requestStatus: () => {
|
|
180
180
|
if (typeof requestDaemonStatus === "function") requestDaemonStatus();
|
|
181
181
|
else daemonSend({ type: IPC_REQUEST_TYPES.STATUS });
|
|
182
182
|
},
|
|
183
183
|
requestCron: (payload = {}) => daemonSend({ type: IPC_REQUEST_TYPES.CRON, ...payload }),
|
|
184
184
|
activateAgent: async (target) => {
|
|
185
|
-
if (
|
|
186
|
-
|
|
187
|
-
const activator = new AgentActivator(projectRoot);
|
|
188
|
-
await activator.activate(target);
|
|
185
|
+
if (!session.metaMap.has(target)) return;
|
|
186
|
+
return ports.activateInternalAgent?.(target);
|
|
189
187
|
},
|
|
190
188
|
globalMode: Boolean(globalMode),
|
|
191
189
|
listProjects: typeof ports.listProjects === "function"
|
|
@@ -197,14 +195,15 @@ function createChatController({
|
|
|
197
195
|
switchProject: typeof ports.switchProject === "function"
|
|
198
196
|
? ports.switchProject
|
|
199
197
|
: async () => ({ ok: false, error: "project switching unavailable" }),
|
|
200
|
-
|
|
201
|
-
? ports.
|
|
198
|
+
setWindowLayout: typeof ports.setWindowLayout === "function"
|
|
199
|
+
? ports.setWindowLayout
|
|
202
200
|
: () => {
|
|
203
|
-
view.logMessage("system", "
|
|
201
|
+
view.logMessage("system", "Window layouts unavailable in this host.");
|
|
204
202
|
},
|
|
205
203
|
applyChatSettings: typeof ports.applyChatSettings === "function"
|
|
206
204
|
? ports.applyChatSettings
|
|
207
205
|
: null,
|
|
206
|
+
openResumeMenu: typeof ports.openResumeMenu === "function" ? ports.openResumeMenu : null,
|
|
208
207
|
});
|
|
209
208
|
return commandExecutor;
|
|
210
209
|
}
|
|
@@ -233,7 +232,7 @@ function createChatController({
|
|
|
233
232
|
});
|
|
234
233
|
submitHandler = createInputSubmitHandler({
|
|
235
234
|
state: submitState,
|
|
236
|
-
requireKnownTarget:
|
|
235
|
+
requireKnownTarget: true,
|
|
237
236
|
parseAtTarget,
|
|
238
237
|
resolveAgentId: (label) => resolveAgentId({
|
|
239
238
|
label,
|
|
@@ -275,35 +274,10 @@ function createChatController({
|
|
|
275
274
|
const label = getAgentLabel(agentId);
|
|
276
275
|
view.publish("prompt.set_prefix", { prefix: `›@${label} ` });
|
|
277
276
|
},
|
|
278
|
-
|
|
279
|
-
if (
|
|
280
|
-
|
|
281
|
-
}
|
|
282
|
-
view.logMessage("system", "Agent enter unavailable in this host.");
|
|
283
|
-
},
|
|
284
|
-
getAgentAdapter: (agentId) => {
|
|
285
|
-
if (typeof ports.getAgentAdapter === "function") {
|
|
286
|
-
return ports.getAgentAdapter(agentId);
|
|
287
|
-
}
|
|
288
|
-
try {
|
|
289
|
-
const { createTerminalAdapterRouter } = require("../../runtime/terminal/adapterRouter");
|
|
290
|
-
const meta = session.metaMap.get(agentId) || {};
|
|
291
|
-
const launchMode = String(meta.launch_mode || meta.launchMode || "").trim();
|
|
292
|
-
return createTerminalAdapterRouter().getAdapter({ launchMode, agentId, meta });
|
|
293
|
-
} catch {
|
|
294
|
-
return null;
|
|
295
|
-
}
|
|
296
|
-
},
|
|
297
|
-
activateAgent: async (agentId) => {
|
|
298
|
-
if (typeof ports.activateAgent === "function") {
|
|
299
|
-
return ports.activateAgent(agentId);
|
|
300
|
-
}
|
|
301
|
-
const AgentActivator = require("../../coordination/bus/activate");
|
|
302
|
-
const root = typeof ports.getActiveProjectRoot === "function"
|
|
303
|
-
? ports.getActiveProjectRoot()
|
|
304
|
-
: projectRoot;
|
|
305
|
-
const activator = new AgentActivator(root || projectRoot);
|
|
306
|
-
await activator.activate(agentId);
|
|
277
|
+
activateInternalAgent: (agentId) => {
|
|
278
|
+
if (!session.metaMap.has(agentId)) return { ok: false, error: "Unknown internal agent" };
|
|
279
|
+
if (typeof ports.activateInternalAgent === "function") return ports.activateInternalAgent(agentId);
|
|
280
|
+
return { ok: false, error: "Internal pane unavailable in this host" };
|
|
307
281
|
},
|
|
308
282
|
focusMultiPane: typeof ports.focusMultiPane === "function"
|
|
309
283
|
? ports.focusMultiPane
|
|
@@ -440,5 +414,4 @@ function createChatController({
|
|
|
440
414
|
|
|
441
415
|
module.exports = {
|
|
442
416
|
createChatController,
|
|
443
|
-
toInkAgentsDispatchList,
|
|
444
417
|
};
|
|
@@ -83,7 +83,7 @@ function clampAgentWindowWithSelection({
|
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
85
|
* Normalize daemon STATUS payload into agents list + footer string.
|
|
86
|
-
*
|
|
86
|
+
* Used by Rust `agents.snapshot`.
|
|
87
87
|
*/
|
|
88
88
|
function normalizeStatusToAgentsSnapshot(data = {}, { internalOnly = false } = {}) {
|
|
89
89
|
let activeIds = Array.isArray(data.active) ? data.active : [];
|
|
@@ -132,20 +132,6 @@ function normalizeStatusToAgentsSnapshot(data = {}, { internalOnly = false } = {
|
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
/**
|
|
136
|
-
* Ink chatReducer expects `id` as the short agent id and `fullId` as the key.
|
|
137
|
-
* Shared so ChatController and ChatApp stay aligned.
|
|
138
|
-
*/
|
|
139
|
-
function toInkAgentsDispatchList(snapshot = {}) {
|
|
140
|
-
const agents = Array.isArray(snapshot.agents) ? snapshot.agents : [];
|
|
141
|
-
return agents.map((row) => ({
|
|
142
|
-
...row,
|
|
143
|
-
fullId: row.fullId || row.id,
|
|
144
|
-
id: row.agentId || row.id,
|
|
145
|
-
nickname: row.label || row.nickname,
|
|
146
|
-
}));
|
|
147
|
-
}
|
|
148
|
-
|
|
149
135
|
module.exports = {
|
|
150
136
|
buildAgentMaps,
|
|
151
137
|
getAgentLabel,
|
|
@@ -153,5 +139,4 @@ module.exports = {
|
|
|
153
139
|
resolveAgentDisplayName,
|
|
154
140
|
clampAgentWindowWithSelection,
|
|
155
141
|
normalizeStatusToAgentsSnapshot,
|
|
156
|
-
toInkAgentsDispatchList,
|
|
157
142
|
};
|