@useorgx/openclaw-plugin 0.4.9 → 0.7.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/README.md +35 -0
- package/dashboard/dist/assets/BJgZIVUQ.js +53 -0
- package/dashboard/dist/assets/BJgZIVUQ.js.br +0 -0
- package/dashboard/dist/assets/BJgZIVUQ.js.gz +0 -0
- package/dashboard/dist/assets/BXWDRGm-.js +1 -0
- package/dashboard/dist/assets/BXWDRGm-.js.br +0 -0
- package/dashboard/dist/assets/BXWDRGm-.js.gz +0 -0
- package/dashboard/dist/assets/BgOYB78t.js +4 -0
- package/dashboard/dist/assets/BgOYB78t.js.br +0 -0
- package/dashboard/dist/assets/BgOYB78t.js.gz +0 -0
- package/dashboard/dist/assets/C-KIc3Wc.js.br +0 -0
- package/dashboard/dist/assets/C-KIc3Wc.js.gz +0 -0
- package/dashboard/dist/assets/CE38zU4U.js +1 -0
- package/dashboard/dist/assets/CE38zU4U.js.br +0 -0
- package/dashboard/dist/assets/CE38zU4U.js.gz +0 -0
- package/dashboard/dist/assets/CFGKRAzG.js +1 -0
- package/dashboard/dist/assets/CFGKRAzG.js.br +0 -0
- package/dashboard/dist/assets/CFGKRAzG.js.gz +0 -0
- package/dashboard/dist/assets/CGGR2GZh.js +1 -0
- package/dashboard/dist/assets/CGGR2GZh.js.br +0 -0
- package/dashboard/dist/assets/CGGR2GZh.js.gz +0 -0
- package/dashboard/dist/assets/CL_wXqR7.js +1 -0
- package/dashboard/dist/assets/CL_wXqR7.js.br +0 -0
- package/dashboard/dist/assets/CL_wXqR7.js.gz +0 -0
- package/dashboard/dist/assets/CPFiTmlw.js +8 -0
- package/dashboard/dist/assets/CPFiTmlw.js.br +0 -0
- package/dashboard/dist/assets/CPFiTmlw.js.gz +0 -0
- package/dashboard/dist/assets/CZZTvkQZ.js +1 -0
- package/dashboard/dist/assets/CZZTvkQZ.js.br +0 -0
- package/dashboard/dist/assets/CZZTvkQZ.js.gz +0 -0
- package/dashboard/dist/assets/{CpJsfbXo.js → CxQ08qFN.js} +2 -2
- package/dashboard/dist/assets/CxQ08qFN.js.br +0 -0
- package/dashboard/dist/assets/CxQ08qFN.js.gz +0 -0
- package/dashboard/dist/assets/D-bf6hEI.js +213 -0
- package/dashboard/dist/assets/D-bf6hEI.js.br +0 -0
- package/dashboard/dist/assets/D-bf6hEI.js.gz +0 -0
- package/dashboard/dist/assets/DG6y9wJI.js +2 -0
- package/dashboard/dist/assets/DG6y9wJI.js.br +0 -0
- package/dashboard/dist/assets/DG6y9wJI.js.gz +0 -0
- package/dashboard/dist/assets/DNxKz-GV.js +1 -0
- package/dashboard/dist/assets/DNxKz-GV.js.br +0 -0
- package/dashboard/dist/assets/DNxKz-GV.js.gz +0 -0
- package/dashboard/dist/assets/DW_rKUic.js +11 -0
- package/dashboard/dist/assets/DW_rKUic.js.br +0 -0
- package/dashboard/dist/assets/DW_rKUic.js.gz +0 -0
- package/dashboard/dist/assets/DbNoijHm.js +1 -0
- package/dashboard/dist/assets/DbNoijHm.js.br +0 -0
- package/dashboard/dist/assets/DbNoijHm.js.gz +0 -0
- package/dashboard/dist/assets/DjcdE6jC.js +2 -0
- package/dashboard/dist/assets/DjcdE6jC.js.br +0 -0
- package/dashboard/dist/assets/DjcdE6jC.js.gz +0 -0
- package/dashboard/dist/assets/FZYuCDnt.js +1 -0
- package/dashboard/dist/assets/FZYuCDnt.js.br +0 -0
- package/dashboard/dist/assets/FZYuCDnt.js.gz +0 -0
- package/dashboard/dist/assets/PAUiij_z.js +1 -0
- package/dashboard/dist/assets/PAUiij_z.js.br +0 -0
- package/dashboard/dist/assets/PAUiij_z.js.gz +0 -0
- package/dashboard/dist/assets/cNrhgGc1.js +8 -0
- package/dashboard/dist/assets/cNrhgGc1.js.br +0 -0
- package/dashboard/dist/assets/cNrhgGc1.js.gz +0 -0
- package/dashboard/dist/assets/h5biQs2I.css +1 -0
- package/dashboard/dist/assets/h5biQs2I.css.br +0 -0
- package/dashboard/dist/assets/h5biQs2I.css.gz +0 -0
- package/dashboard/dist/assets/ic2FaMnh.js +1 -0
- package/dashboard/dist/assets/ic2FaMnh.js.br +0 -0
- package/dashboard/dist/assets/ic2FaMnh.js.gz +0 -0
- package/dashboard/dist/assets/nByHNHoW.js +1 -0
- package/dashboard/dist/assets/nByHNHoW.js.br +0 -0
- package/dashboard/dist/assets/nByHNHoW.js.gz +0 -0
- package/dashboard/dist/assets/qm8xLgv-.css +1 -0
- package/dashboard/dist/assets/qm8xLgv-.css.br +0 -0
- package/dashboard/dist/assets/qm8xLgv-.css.gz +0 -0
- package/dashboard/dist/assets/tS9mbYZi.js +1 -0
- package/dashboard/dist/assets/tS9mbYZi.js.br +0 -0
- package/dashboard/dist/assets/tS9mbYZi.js.gz +0 -0
- package/dashboard/dist/brand/anthropic-mark.svg.br +0 -0
- package/dashboard/dist/brand/anthropic-mark.svg.gz +0 -0
- package/dashboard/dist/brand/openai-mark.svg.br +0 -0
- package/dashboard/dist/brand/openai-mark.svg.gz +0 -0
- package/dashboard/dist/brand/openclaw-mark.svg.br +0 -0
- package/dashboard/dist/brand/openclaw-mark.svg.gz +0 -0
- package/dashboard/dist/brand/xandy-orchestrator.png +0 -0
- package/dashboard/dist/index.html +7 -5
- package/dashboard/dist/index.html.br +0 -0
- package/dashboard/dist/index.html.gz +0 -0
- package/dist/activity-actor-fields.js +26 -4
- package/dist/activity-store.js +34 -8
- package/dist/agent-context-store.js +79 -17
- package/dist/agent-run-store.js +44 -3
- package/dist/agent-suite.d.ts +9 -0
- package/dist/agent-suite.js +149 -9
- package/dist/artifacts/artifact-domain-schemas.d.ts +66 -0
- package/dist/artifacts/artifact-domain-schemas.js +357 -0
- package/dist/artifacts/register-artifact.d.ts +4 -3
- package/dist/artifacts/register-artifact.js +170 -57
- package/dist/chat-store.d.ts +157 -0
- package/dist/chat-store.js +586 -0
- package/dist/cli/orgx.js +11 -0
- package/dist/contracts/client.d.ts +43 -3
- package/dist/contracts/client.js +159 -30
- package/dist/contracts/retro-schema.d.ts +81 -0
- package/dist/contracts/retro-schema.js +80 -0
- package/dist/contracts/shared-types.d.ts +159 -0
- package/dist/contracts/shared-types.js +177 -1
- package/dist/contracts/skill-pack-schema.d.ts +192 -0
- package/dist/contracts/skill-pack-schema.js +180 -0
- package/dist/contracts/types.d.ts +227 -2
- package/dist/entities/auto-assignment.js +43 -17
- package/dist/event-sanitization.d.ts +11 -0
- package/dist/event-sanitization.js +113 -0
- package/dist/fs-utils.js +13 -1
- package/dist/gateway-watchdog.d.ts +5 -0
- package/dist/gateway-watchdog.js +50 -0
- package/dist/hooks/post-reporting-event.mjs +1 -5
- package/dist/http/helpers/activity-headline.js +13 -132
- package/dist/http/helpers/auto-continue-engine.d.ts +198 -10
- package/dist/http/helpers/auto-continue-engine.js +2531 -186
- package/dist/http/helpers/autopilot-operations.d.ts +19 -0
- package/dist/http/helpers/autopilot-operations.js +182 -31
- package/dist/http/helpers/autopilot-runtime.d.ts +1 -0
- package/dist/http/helpers/autopilot-runtime.js +308 -20
- package/dist/http/helpers/autopilot-slice-utils.d.ts +18 -0
- package/dist/http/helpers/autopilot-slice-utils.js +516 -93
- package/dist/http/helpers/decision-mapper.d.ts +40 -0
- package/dist/http/helpers/decision-mapper.js +223 -7
- package/dist/http/helpers/dispatch-lifecycle.d.ts +19 -2
- package/dist/http/helpers/dispatch-lifecycle.js +242 -37
- package/dist/http/helpers/kickoff-context.js +74 -0
- package/dist/http/helpers/llm-client.d.ts +47 -0
- package/dist/http/helpers/llm-client.js +256 -0
- package/dist/http/helpers/mission-control.d.ts +102 -3
- package/dist/http/helpers/mission-control.js +498 -9
- package/dist/http/helpers/sentinel-catalog.d.ts +23 -0
- package/dist/http/helpers/sentinel-catalog.js +193 -0
- package/dist/http/helpers/session-classification.d.ts +9 -0
- package/dist/http/helpers/session-classification.js +564 -0
- package/dist/http/helpers/slice-experience-v2.d.ts +137 -0
- package/dist/http/helpers/slice-experience-v2.js +677 -0
- package/dist/http/helpers/slice-run-projections.d.ts +72 -0
- package/dist/http/helpers/slice-run-projections.js +860 -0
- package/dist/http/helpers/triage-mapper.d.ts +43 -0
- package/dist/http/helpers/triage-mapper.js +549 -0
- package/dist/http/helpers/value-utils.js +7 -2
- package/dist/http/helpers/workspace-scope.d.ts +15 -0
- package/dist/http/helpers/workspace-scope.js +170 -0
- package/dist/http/index.js +1354 -97
- package/dist/http/routes/agent-suite.d.ts +9 -0
- package/dist/http/routes/agent-suite.js +207 -8
- package/dist/http/routes/agents-catalog.js +64 -19
- package/dist/http/routes/chat.d.ts +19 -0
- package/dist/http/routes/chat.js +522 -0
- package/dist/http/routes/decision-actions.d.ts +8 -1
- package/dist/http/routes/decision-actions.js +42 -5
- package/dist/http/routes/dispatch-gateway-envelope.d.ts +25 -0
- package/dist/http/routes/dispatch-gateway-envelope.js +26 -0
- package/dist/http/routes/entities.d.ts +16 -0
- package/dist/http/routes/entities.js +294 -6
- package/dist/http/routes/live-legacy.d.ts +5 -0
- package/dist/http/routes/live-legacy.js +23 -509
- package/dist/http/routes/live-misc.d.ts +12 -0
- package/dist/http/routes/live-misc.js +251 -31
- package/dist/http/routes/live-snapshot.d.ts +48 -2
- package/dist/http/routes/live-snapshot.js +638 -19
- package/dist/http/routes/live-terminal.d.ts +11 -0
- package/dist/http/routes/live-terminal.js +261 -0
- package/dist/http/routes/live-triage.d.ts +61 -0
- package/dist/http/routes/live-triage.js +248 -0
- package/dist/http/routes/mission-control-actions.d.ts +49 -1
- package/dist/http/routes/mission-control-actions.js +1334 -84
- package/dist/http/routes/mission-control-read.d.ts +48 -3
- package/dist/http/routes/mission-control-read.js +1593 -20
- package/dist/http/routes/realtime-orchestrator.d.ts +10 -0
- package/dist/http/routes/realtime-orchestrator.js +74 -0
- package/dist/http/routes/run-control.d.ts +5 -2
- package/dist/http/routes/run-control.js +10 -0
- package/dist/http/routes/sentinels-catalog.d.ts +7 -0
- package/dist/http/routes/sentinels-catalog.js +24 -0
- package/dist/http/routes/summary.js +10 -3
- package/dist/http/routes/usage.d.ts +24 -0
- package/dist/http/routes/usage.js +362 -0
- package/dist/http/routes/work-artifacts.js +28 -9
- package/dist/index.js +165 -27
- package/dist/local-openclaw.js +29 -6
- package/dist/mcp-client-setup.js +3 -3
- package/dist/mcp-http-handler.js +33 -59
- package/dist/next-up-queue-store.d.ts +16 -1
- package/dist/next-up-queue-store.js +89 -7
- package/dist/outbox.d.ts +5 -0
- package/dist/outbox.js +113 -9
- package/dist/paths.js +24 -5
- package/dist/reporting/rollups.d.ts +53 -0
- package/dist/reporting/rollups.js +148 -0
- package/dist/retro/domain-templates.d.ts +45 -0
- package/dist/retro/domain-templates.js +297 -0
- package/dist/retro/quality-rubric.d.ts +33 -0
- package/dist/retro/quality-rubric.js +213 -0
- package/dist/runtime-cleanup.d.ts +18 -0
- package/dist/runtime-cleanup.js +87 -0
- package/dist/services/background.d.ts +11 -0
- package/dist/services/background.js +22 -0
- package/dist/services/experiment-randomization.d.ts +21 -0
- package/dist/services/experiment-randomization.js +63 -0
- package/dist/skill-pack-state.d.ts +36 -5
- package/dist/skill-pack-state.js +273 -29
- package/dist/sync/local-agent-telemetry.d.ts +13 -0
- package/dist/sync/local-agent-telemetry.js +128 -0
- package/dist/sync/outbox-replay.js +131 -24
- package/dist/team-context-store.d.ts +23 -0
- package/dist/team-context-store.js +116 -0
- package/dist/telemetry/posthog.js +4 -2
- package/dist/tools/core-tools.d.ts +10 -14
- package/dist/tools/core-tools.js +1289 -24
- package/dist/types.d.ts +2 -0
- package/dist/types.js +2 -0
- package/dist/worker-supervisor.js +23 -0
- package/package.json +14 -4
- package/dashboard/dist/assets/B3ziCA02.js +0 -8
- package/dashboard/dist/assets/B5NEElEI.css +0 -1
- package/dashboard/dist/assets/BhapSNAs.js +0 -215
- package/dashboard/dist/assets/iFdvE7lx.js +0 -1
- package/dashboard/dist/assets/jRJsmpYM.js +0 -1
- package/dashboard/dist/assets/sAhvFnpk.js +0 -4
|
@@ -1,12 +1,52 @@
|
|
|
1
1
|
import type { Entity } from "../../types.js";
|
|
2
|
+
import type { DecisionActionType } from "../../contracts/shared-types.js";
|
|
3
|
+
type LiveDecisionOptionStatus = "approved" | "declined" | "cancelled";
|
|
4
|
+
type LiveDecisionOption = {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
description: string | null;
|
|
8
|
+
impliedStatus: LiveDecisionOptionStatus | null;
|
|
9
|
+
actionType: DecisionActionType | null;
|
|
10
|
+
requiresNote: boolean;
|
|
11
|
+
};
|
|
12
|
+
type LiveDecisionEvidenceRef = {
|
|
13
|
+
evidenceType: string | null;
|
|
14
|
+
title: string | null;
|
|
15
|
+
summary: string | null;
|
|
16
|
+
sourceUrl: string | null;
|
|
17
|
+
sourcePointer: string | null;
|
|
18
|
+
freshness: string | null;
|
|
19
|
+
confidence: number | null;
|
|
20
|
+
payload: Record<string, unknown> | null;
|
|
21
|
+
};
|
|
2
22
|
export declare function mapDecisionEntity(entity: Entity): {
|
|
3
23
|
id: string;
|
|
4
24
|
title: string;
|
|
5
25
|
context: string | null;
|
|
6
26
|
status: string;
|
|
27
|
+
priority: string | null;
|
|
28
|
+
decisionType: string | null;
|
|
7
29
|
agentName: string | null;
|
|
30
|
+
agentId: string | null;
|
|
31
|
+
initiativeId: string | null;
|
|
32
|
+
workstreamId: string | null;
|
|
33
|
+
dueAt: string | null;
|
|
8
34
|
requestedAt: string | null;
|
|
9
35
|
updatedAt: string | null;
|
|
36
|
+
sourceSystem: string | null;
|
|
37
|
+
conflictSource: string | null;
|
|
38
|
+
dedupeKey: string | null;
|
|
39
|
+
recommendedAction: string | null;
|
|
40
|
+
occurrenceCount: number | null;
|
|
41
|
+
firstSeenAt: string | null;
|
|
42
|
+
lastSeenAt: string | null;
|
|
43
|
+
sourceRunId: string | null;
|
|
44
|
+
sourceSessionId: string | null;
|
|
45
|
+
sourceStreamId: string | null;
|
|
46
|
+
evidenceRefs: LiveDecisionEvidenceRef[];
|
|
10
47
|
waitingMinutes: number;
|
|
11
48
|
metadata: Record<string, unknown>;
|
|
49
|
+
options: LiveDecisionOption[];
|
|
50
|
+
selectedOptionId: string | null;
|
|
12
51
|
};
|
|
52
|
+
export {};
|
|
@@ -1,7 +1,186 @@
|
|
|
1
1
|
import { pickNumber, pickString, toIsoString } from "./value-utils.js";
|
|
2
|
+
import { normalizeDecisionActionType } from "../../contracts/shared-types.js";
|
|
3
|
+
function asRecord(value) {
|
|
4
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
5
|
+
return null;
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
8
|
+
function normalizeOptionStatus(value) {
|
|
9
|
+
if (typeof value !== "string")
|
|
10
|
+
return null;
|
|
11
|
+
const normalized = value.trim().toLowerCase();
|
|
12
|
+
if (normalized === "rejected")
|
|
13
|
+
return "declined";
|
|
14
|
+
if (normalized === "approved" || normalized === "declined" || normalized === "cancelled") {
|
|
15
|
+
return normalized;
|
|
16
|
+
}
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
function pickStringFromRecords(records, keys) {
|
|
20
|
+
for (const record of records) {
|
|
21
|
+
if (!record)
|
|
22
|
+
continue;
|
|
23
|
+
const value = pickString(record, keys);
|
|
24
|
+
if (value)
|
|
25
|
+
return value;
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
function pickNumberFromRecords(records, keys) {
|
|
30
|
+
for (const record of records) {
|
|
31
|
+
if (!record)
|
|
32
|
+
continue;
|
|
33
|
+
const value = pickNumber(record, keys);
|
|
34
|
+
if (typeof value === "number" && Number.isFinite(value))
|
|
35
|
+
return value;
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
function pickActionType(values) {
|
|
40
|
+
for (const value of values) {
|
|
41
|
+
const normalized = normalizeDecisionActionType(value);
|
|
42
|
+
if (normalized)
|
|
43
|
+
return normalized;
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
function parseDecisionOptions(record) {
|
|
48
|
+
const metadata = asRecord(record.metadata);
|
|
49
|
+
const envelope = metadata ? asRecord(metadata.envelope_v2) : null;
|
|
50
|
+
const containers = [record];
|
|
51
|
+
if (metadata)
|
|
52
|
+
containers.push(metadata);
|
|
53
|
+
if (envelope)
|
|
54
|
+
containers.push(envelope);
|
|
55
|
+
const rawItems = [];
|
|
56
|
+
for (const container of containers) {
|
|
57
|
+
for (const key of ["decision_options", "options", "actions"]) {
|
|
58
|
+
const value = container[key];
|
|
59
|
+
if (Array.isArray(value))
|
|
60
|
+
rawItems.push(...value);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const options = [];
|
|
64
|
+
const seen = new Set();
|
|
65
|
+
for (let index = 0; index < rawItems.length; index += 1) {
|
|
66
|
+
const item = rawItems[index];
|
|
67
|
+
if (typeof item === "string") {
|
|
68
|
+
const label = item.trim();
|
|
69
|
+
if (!label)
|
|
70
|
+
continue;
|
|
71
|
+
const id = `option-${index + 1}`;
|
|
72
|
+
if (seen.has(id))
|
|
73
|
+
continue;
|
|
74
|
+
seen.add(id);
|
|
75
|
+
options.push({
|
|
76
|
+
id,
|
|
77
|
+
label,
|
|
78
|
+
description: null,
|
|
79
|
+
impliedStatus: null,
|
|
80
|
+
actionType: null,
|
|
81
|
+
requiresNote: false,
|
|
82
|
+
});
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
const candidate = asRecord(item);
|
|
86
|
+
if (!candidate)
|
|
87
|
+
continue;
|
|
88
|
+
const id = (typeof candidate.id === "string" && candidate.id.trim()) ||
|
|
89
|
+
(typeof candidate.option_id === "string" && candidate.option_id.trim()) ||
|
|
90
|
+
(typeof candidate.action_id === "string" && candidate.action_id.trim()) ||
|
|
91
|
+
`option-${index + 1}`;
|
|
92
|
+
if (seen.has(id))
|
|
93
|
+
continue;
|
|
94
|
+
const label = (typeof candidate.label === "string" && candidate.label.trim()) ||
|
|
95
|
+
(typeof candidate.title === "string" && candidate.title.trim()) ||
|
|
96
|
+
(typeof candidate.name === "string" && candidate.name.trim()) ||
|
|
97
|
+
(typeof candidate.action === "string" && candidate.action.trim()) ||
|
|
98
|
+
null;
|
|
99
|
+
if (!label)
|
|
100
|
+
continue;
|
|
101
|
+
seen.add(id);
|
|
102
|
+
options.push({
|
|
103
|
+
id,
|
|
104
|
+
label,
|
|
105
|
+
description: typeof candidate.description === "string" ? candidate.description : null,
|
|
106
|
+
impliedStatus: normalizeOptionStatus(candidate.implied_status) ??
|
|
107
|
+
normalizeOptionStatus(candidate.status) ??
|
|
108
|
+
normalizeOptionStatus(candidate.disposition),
|
|
109
|
+
actionType: pickActionType([
|
|
110
|
+
candidate.action_type,
|
|
111
|
+
candidate.type,
|
|
112
|
+
candidate.verb,
|
|
113
|
+
candidate.action,
|
|
114
|
+
]) ?? null,
|
|
115
|
+
requiresNote: candidate.requires_note === true ||
|
|
116
|
+
candidate.requiresNote === true ||
|
|
117
|
+
candidate.note_required === true,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
return options.slice(0, 12);
|
|
121
|
+
}
|
|
122
|
+
function parseSelectedOptionId(record) {
|
|
123
|
+
const metadata = asRecord(record.metadata);
|
|
124
|
+
if (!metadata)
|
|
125
|
+
return null;
|
|
126
|
+
const resolution = asRecord(metadata.resolution);
|
|
127
|
+
if (!resolution)
|
|
128
|
+
return null;
|
|
129
|
+
const selected = (typeof resolution.selected_option_id === "string" && resolution.selected_option_id.trim()) ||
|
|
130
|
+
(typeof resolution.option_id === "string" && resolution.option_id.trim()) ||
|
|
131
|
+
null;
|
|
132
|
+
return selected;
|
|
133
|
+
}
|
|
134
|
+
function parseEvidenceRefs(record) {
|
|
135
|
+
const metadata = asRecord(record.metadata);
|
|
136
|
+
const envelope = metadata ? asRecord(metadata.envelope_v2) : null;
|
|
137
|
+
const rawGroups = [
|
|
138
|
+
record.evidence_refs,
|
|
139
|
+
metadata?.evidence_refs,
|
|
140
|
+
metadata?.decision_evidence,
|
|
141
|
+
envelope?.evidence_refs,
|
|
142
|
+
];
|
|
143
|
+
const refs = [];
|
|
144
|
+
for (const group of rawGroups) {
|
|
145
|
+
if (!Array.isArray(group))
|
|
146
|
+
continue;
|
|
147
|
+
for (const item of group) {
|
|
148
|
+
const evidence = asRecord(item);
|
|
149
|
+
if (!evidence)
|
|
150
|
+
continue;
|
|
151
|
+
const confidenceRaw = pickNumber(evidence, ["confidence"]);
|
|
152
|
+
refs.push({
|
|
153
|
+
evidenceType: pickString(evidence, ["evidence_type", "evidenceType", "type"]),
|
|
154
|
+
title: pickString(evidence, ["title", "name"]),
|
|
155
|
+
summary: pickString(evidence, ["summary", "description"]),
|
|
156
|
+
sourceUrl: pickString(evidence, ["source_url", "sourceUrl", "url"]),
|
|
157
|
+
sourcePointer: pickString(evidence, ["source_pointer", "sourcePointer", "pointer", "path"]),
|
|
158
|
+
freshness: pickString(evidence, ["freshness"]),
|
|
159
|
+
confidence: typeof confidenceRaw === "number" && Number.isFinite(confidenceRaw)
|
|
160
|
+
? confidenceRaw
|
|
161
|
+
: null,
|
|
162
|
+
payload: asRecord(evidence.payload),
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return refs.slice(0, 20);
|
|
167
|
+
}
|
|
2
168
|
export function mapDecisionEntity(entity) {
|
|
3
169
|
const record = entity;
|
|
4
|
-
const
|
|
170
|
+
const metadata = asRecord(record.metadata);
|
|
171
|
+
const envelope = metadata ? asRecord(metadata.envelope_v2) : null;
|
|
172
|
+
const sourceRef = asRecord(record.source_ref);
|
|
173
|
+
const metadataSourceRef = metadata ? asRecord(metadata.source_ref) : null;
|
|
174
|
+
const envelopeSourceRef = envelope ? asRecord(envelope.source_ref) : null;
|
|
175
|
+
const containers = [
|
|
176
|
+
record,
|
|
177
|
+
metadata,
|
|
178
|
+
envelope,
|
|
179
|
+
sourceRef,
|
|
180
|
+
metadataSourceRef,
|
|
181
|
+
envelopeSourceRef,
|
|
182
|
+
];
|
|
183
|
+
const requestedAt = toIsoString(pickStringFromRecords(containers, [
|
|
5
184
|
"requestedAt",
|
|
6
185
|
"requested_at",
|
|
7
186
|
"createdAt",
|
|
@@ -9,8 +188,9 @@ export function mapDecisionEntity(entity) {
|
|
|
9
188
|
"updatedAt",
|
|
10
189
|
"updated_at",
|
|
11
190
|
]));
|
|
12
|
-
const updatedAt = toIsoString(
|
|
13
|
-
const
|
|
191
|
+
const updatedAt = toIsoString(pickStringFromRecords(containers, ["updatedAt", "updated_at", "createdAt", "created_at"]));
|
|
192
|
+
const dueAt = toIsoString(pickStringFromRecords(containers, ["dueAt", "due_at"]));
|
|
193
|
+
const waitingMinutesFromEntity = pickNumberFromRecords(containers, [
|
|
14
194
|
"waitingMinutes",
|
|
15
195
|
"waiting_minutes",
|
|
16
196
|
"ageMinutes",
|
|
@@ -20,12 +200,23 @@ export function mapDecisionEntity(entity) {
|
|
|
20
200
|
(requestedAt
|
|
21
201
|
? Math.max(0, Math.floor((Date.now() - Date.parse(requestedAt)) / 60_000))
|
|
22
202
|
: 0);
|
|
203
|
+
const options = parseDecisionOptions(record);
|
|
204
|
+
const evidenceRefs = parseEvidenceRefs(record);
|
|
23
205
|
return {
|
|
24
206
|
id: String(record.id ?? ""),
|
|
25
|
-
title:
|
|
26
|
-
context:
|
|
27
|
-
|
|
28
|
-
|
|
207
|
+
title: pickStringFromRecords(containers, ["title", "name"]) ?? "Decision",
|
|
208
|
+
context: pickStringFromRecords(containers, [
|
|
209
|
+
"context",
|
|
210
|
+
"summary",
|
|
211
|
+
"description",
|
|
212
|
+
"details",
|
|
213
|
+
"recommended_action",
|
|
214
|
+
"recommendedAction",
|
|
215
|
+
]),
|
|
216
|
+
status: pickStringFromRecords(containers, ["status", "decision_status"]) ?? "pending",
|
|
217
|
+
priority: pickStringFromRecords(containers, ["priority"]),
|
|
218
|
+
decisionType: pickStringFromRecords(containers, ["decision_type", "decisionType"]),
|
|
219
|
+
agentName: pickStringFromRecords(containers, [
|
|
29
220
|
"agentName",
|
|
30
221
|
"agent_name",
|
|
31
222
|
"requestedBy",
|
|
@@ -36,9 +227,34 @@ export function mapDecisionEntity(entity) {
|
|
|
36
227
|
"createdBy",
|
|
37
228
|
"created_by",
|
|
38
229
|
]),
|
|
230
|
+
agentId: pickStringFromRecords(containers, ["agent_id", "agentId"]),
|
|
231
|
+
initiativeId: pickStringFromRecords(containers, ["initiative_id", "initiativeId"]),
|
|
232
|
+
workstreamId: pickStringFromRecords(containers, ["workstream_id", "workstreamId"]),
|
|
233
|
+
dueAt,
|
|
39
234
|
requestedAt,
|
|
40
235
|
updatedAt,
|
|
236
|
+
sourceSystem: pickStringFromRecords(containers, ["source_system", "sourceSystem"]),
|
|
237
|
+
conflictSource: pickStringFromRecords(containers, ["conflict_source", "conflictSource"]),
|
|
238
|
+
dedupeKey: pickStringFromRecords(containers, ["dedupe_key", "dedupeKey"]),
|
|
239
|
+
recommendedAction: pickStringFromRecords(containers, [
|
|
240
|
+
"recommended_action",
|
|
241
|
+
"recommendedAction",
|
|
242
|
+
]),
|
|
243
|
+
occurrenceCount: pickNumberFromRecords(containers, ["occurrence_count", "occurrenceCount"]),
|
|
244
|
+
firstSeenAt: toIsoString(pickStringFromRecords(containers, ["first_seen_at", "firstSeenAt"])),
|
|
245
|
+
lastSeenAt: toIsoString(pickStringFromRecords(containers, ["last_seen_at", "lastSeenAt"])),
|
|
246
|
+
sourceRunId: pickStringFromRecords(containers, ["source_run_id", "sourceRunId"]),
|
|
247
|
+
sourceSessionId: pickStringFromRecords(containers, [
|
|
248
|
+
"source_session_id",
|
|
249
|
+
"sourceSessionId",
|
|
250
|
+
"session_id",
|
|
251
|
+
"sessionId",
|
|
252
|
+
]),
|
|
253
|
+
sourceStreamId: pickStringFromRecords(containers, ["source_stream_id", "sourceStreamId"]),
|
|
254
|
+
evidenceRefs,
|
|
41
255
|
waitingMinutes,
|
|
42
256
|
metadata: record,
|
|
257
|
+
options,
|
|
258
|
+
selectedOptionId: parseSelectedOptionId(record),
|
|
43
259
|
};
|
|
44
260
|
}
|
|
@@ -34,9 +34,26 @@ export declare function createDispatchLifecycle(deps: DispatchLifecycleDeps): {
|
|
|
34
34
|
title: string;
|
|
35
35
|
summary?: string | null;
|
|
36
36
|
urgency?: "low" | "medium" | "high" | "urgent";
|
|
37
|
-
options?: string
|
|
37
|
+
options?: Array<string | Record<string, unknown>>;
|
|
38
38
|
blocking?: boolean;
|
|
39
|
-
|
|
39
|
+
decisionType?: string | null;
|
|
40
|
+
workstreamId?: string | null;
|
|
41
|
+
agentId?: string | null;
|
|
42
|
+
dueAt?: string | null;
|
|
43
|
+
sourceSystem?: string | null;
|
|
44
|
+
conflictSource?: string | null;
|
|
45
|
+
dedupeKey?: string | null;
|
|
46
|
+
recommendedAction?: string | null;
|
|
47
|
+
sourceRunId?: string | null;
|
|
48
|
+
sourceSessionId?: string | null;
|
|
49
|
+
sourceStreamId?: string | null;
|
|
50
|
+
sourceRef?: Record<string, unknown> | null;
|
|
51
|
+
evidenceRefs?: Array<Record<string, unknown>> | null;
|
|
52
|
+
metadata?: Record<string, unknown> | null;
|
|
53
|
+
}) => Promise<{
|
|
54
|
+
queued: boolean;
|
|
55
|
+
decisionIds: string[];
|
|
56
|
+
}>;
|
|
40
57
|
checkSpawnGuardSafe: (input: {
|
|
41
58
|
domain: string;
|
|
42
59
|
taskId?: string | null;
|