@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
|
@@ -3,6 +3,7 @@ import type { upsertAgentRun as upsertAgentRunType } from "../../agent-run-store
|
|
|
3
3
|
type AutopilotSliceArtifact = {
|
|
4
4
|
name: string;
|
|
5
5
|
artifact_type?: string | null;
|
|
6
|
+
confidence_score?: number | null;
|
|
6
7
|
description?: string | null;
|
|
7
8
|
url?: string | null;
|
|
8
9
|
verification_steps?: string[] | null;
|
|
@@ -109,7 +110,10 @@ export declare function createAutopilotOperations(deps: CreateAutopilotOperation
|
|
|
109
110
|
agentId: string;
|
|
110
111
|
agentName?: string | null;
|
|
111
112
|
workstreamId: string;
|
|
113
|
+
fallbackMilestoneId?: string | null;
|
|
114
|
+
fallbackTaskIds?: string[] | null;
|
|
112
115
|
artifact: AutopilotSliceArtifact;
|
|
116
|
+
isMockWorker?: boolean;
|
|
113
117
|
}) => Promise<{
|
|
114
118
|
ok: boolean;
|
|
115
119
|
id: string | null;
|
|
@@ -118,6 +122,10 @@ export declare function createAutopilotOperations(deps: CreateAutopilotOperation
|
|
|
118
122
|
initiativeId: string;
|
|
119
123
|
runId: string;
|
|
120
124
|
correlationId: string;
|
|
125
|
+
agentId?: string | null;
|
|
126
|
+
agentName?: string | null;
|
|
127
|
+
outputPath?: string | null;
|
|
128
|
+
logPath?: string | null;
|
|
121
129
|
taskUpdates: Array<{
|
|
122
130
|
task_id: string;
|
|
123
131
|
status: string;
|
|
@@ -128,9 +136,20 @@ export declare function createAutopilotOperations(deps: CreateAutopilotOperation
|
|
|
128
136
|
status: string;
|
|
129
137
|
reason?: string | null;
|
|
130
138
|
}>;
|
|
139
|
+
isMockWorker?: boolean;
|
|
131
140
|
}) => Promise<{
|
|
132
141
|
applied: number;
|
|
133
142
|
buffered: boolean;
|
|
143
|
+
taskUpdates: Array<{
|
|
144
|
+
taskId: string;
|
|
145
|
+
status: string;
|
|
146
|
+
reason: string | null;
|
|
147
|
+
}>;
|
|
148
|
+
milestoneUpdates: Array<{
|
|
149
|
+
milestoneId: string;
|
|
150
|
+
status: string;
|
|
151
|
+
reason: string | null;
|
|
152
|
+
}>;
|
|
134
153
|
}>;
|
|
135
154
|
resolveAgentDisplayName: (agentId: string, fallbackName?: string | null) => Promise<string | null>;
|
|
136
155
|
dispatchFallbackWorkstreamTurn: (input: {
|
|
@@ -3,11 +3,37 @@ import { registerArtifact } from "../../artifacts/register-artifact.js";
|
|
|
3
3
|
export function createAutopilotOperations(deps) {
|
|
4
4
|
async function registerArtifactSafe(input) {
|
|
5
5
|
const now = new Date().toISOString();
|
|
6
|
-
const name =
|
|
6
|
+
const name = typeof input.artifact.name === "string" && input.artifact.name.trim().length > 0
|
|
7
|
+
? input.artifact.name.trim()
|
|
8
|
+
: "";
|
|
7
9
|
if (!name)
|
|
8
10
|
return { ok: false, id: null };
|
|
9
|
-
const artifactType =
|
|
11
|
+
const artifactType = typeof input.artifact.artifact_type === "string" && input.artifact.artifact_type.trim().length > 0
|
|
12
|
+
? input.artifact.artifact_type.trim()
|
|
13
|
+
: "other";
|
|
14
|
+
const confidenceScore = typeof input.artifact.confidence_score === "number" &&
|
|
15
|
+
Number.isFinite(input.artifact.confidence_score) &&
|
|
16
|
+
input.artifact.confidence_score >= 0 &&
|
|
17
|
+
input.artifact.confidence_score <= 1
|
|
18
|
+
? input.artifact.confidence_score
|
|
19
|
+
: null;
|
|
10
20
|
const artifactId = deps.randomUUID();
|
|
21
|
+
const milestoneId = (typeof input.artifact.milestone_id === "string" &&
|
|
22
|
+
input.artifact.milestone_id.trim().length > 0
|
|
23
|
+
? input.artifact.milestone_id.trim()
|
|
24
|
+
: null) ??
|
|
25
|
+
(typeof input.fallbackMilestoneId === "string" &&
|
|
26
|
+
input.fallbackMilestoneId.trim().length > 0
|
|
27
|
+
? input.fallbackMilestoneId.trim()
|
|
28
|
+
: null);
|
|
29
|
+
const taskIds = (Array.isArray(input.artifact.task_ids) && input.artifact.task_ids.length > 0
|
|
30
|
+
? input.artifact.task_ids
|
|
31
|
+
: Array.isArray(input.fallbackTaskIds)
|
|
32
|
+
? input.fallbackTaskIds
|
|
33
|
+
: [])
|
|
34
|
+
.filter((taskId) => typeof taskId === "string")
|
|
35
|
+
.map((taskId) => taskId.trim())
|
|
36
|
+
.filter(Boolean);
|
|
11
37
|
const verificationSteps = Array.isArray(input.artifact.verification_steps)
|
|
12
38
|
? input.artifact.verification_steps
|
|
13
39
|
.filter((step) => typeof step === "string")
|
|
@@ -27,14 +53,15 @@ export function createAutopilotOperations(deps) {
|
|
|
27
53
|
const createdByType = hasUuidAgent ? "agent" : "human";
|
|
28
54
|
const createdById = hasUuidAgent ? input.agentId : null;
|
|
29
55
|
try {
|
|
30
|
-
const entityType =
|
|
31
|
-
const entityId =
|
|
56
|
+
const entityType = milestoneId ? "milestone" : "initiative";
|
|
57
|
+
const entityId = milestoneId ?? input.initiativeId;
|
|
32
58
|
const result = await registerArtifact(deps.client, deps.client.getBaseUrl(), {
|
|
33
59
|
artifact_id: artifactId,
|
|
34
60
|
entity_type: entityType,
|
|
35
61
|
entity_id: entityId,
|
|
36
62
|
name,
|
|
37
63
|
artifact_type: artifactType,
|
|
64
|
+
confidence_score: confidenceScore,
|
|
38
65
|
created_by_type: createdByType,
|
|
39
66
|
created_by_id: createdById,
|
|
40
67
|
description,
|
|
@@ -47,12 +74,45 @@ export function createAutopilotOperations(deps) {
|
|
|
47
74
|
run_id: input.runId,
|
|
48
75
|
initiative_id: input.initiativeId,
|
|
49
76
|
workstream_id: input.workstreamId,
|
|
50
|
-
milestone_id:
|
|
51
|
-
task_ids:
|
|
77
|
+
milestone_id: milestoneId,
|
|
78
|
+
task_ids: taskIds.length > 0 ? taskIds : null,
|
|
79
|
+
confidence_score: confidenceScore,
|
|
52
80
|
},
|
|
53
81
|
// Make persistence validation opt-in to avoid adding latency to every slice by default.
|
|
54
82
|
validate_persistence: process.env.ORGX_VALIDATE_ARTIFACT_PERSISTENCE === "1",
|
|
55
83
|
});
|
|
84
|
+
if (result.ok) {
|
|
85
|
+
try {
|
|
86
|
+
await deps.emitActivitySafe({
|
|
87
|
+
initiativeId: input.initiativeId,
|
|
88
|
+
runId: input.runId,
|
|
89
|
+
correlationId: input.runId,
|
|
90
|
+
phase: "handoff",
|
|
91
|
+
level: "info",
|
|
92
|
+
message: `Artifact registered: ${name}`,
|
|
93
|
+
progressPct: 100,
|
|
94
|
+
metadata: {
|
|
95
|
+
event: "artifact_registered",
|
|
96
|
+
artifact_id: result.artifact_id ?? artifactId,
|
|
97
|
+
artifact_type: artifactType,
|
|
98
|
+
confidence_score: confidenceScore,
|
|
99
|
+
initiative_id: input.initiativeId,
|
|
100
|
+
workstream_id: input.workstreamId,
|
|
101
|
+
milestone_id: milestoneId,
|
|
102
|
+
task_ids: taskIds,
|
|
103
|
+
agent_id: input.agentId,
|
|
104
|
+
agent_name: input.agentName ?? null,
|
|
105
|
+
executor_agent_id: input.agentId,
|
|
106
|
+
executor_agent_name: input.agentName ?? null,
|
|
107
|
+
source_run_id: input.runId,
|
|
108
|
+
...(input.isMockWorker ? { mock: true } : {}),
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
// best effort
|
|
114
|
+
}
|
|
115
|
+
}
|
|
56
116
|
return { ok: result.ok, id: result.artifact_id };
|
|
57
117
|
}
|
|
58
118
|
catch (err) {
|
|
@@ -63,10 +123,11 @@ export function createAutopilotOperations(deps) {
|
|
|
63
123
|
timestamp: now,
|
|
64
124
|
payload: {
|
|
65
125
|
artifact_id: artifactId,
|
|
66
|
-
entity_type:
|
|
67
|
-
entity_id:
|
|
126
|
+
entity_type: milestoneId ? "milestone" : "initiative",
|
|
127
|
+
entity_id: milestoneId ?? input.initiativeId,
|
|
68
128
|
name,
|
|
69
129
|
artifact_type: artifactType,
|
|
130
|
+
confidence_score: confidenceScore,
|
|
70
131
|
created_by_type: createdByType,
|
|
71
132
|
created_by_id: createdById,
|
|
72
133
|
description,
|
|
@@ -93,9 +154,11 @@ export function createAutopilotOperations(deps) {
|
|
|
93
154
|
source: "openclaw_local_fallback",
|
|
94
155
|
event: "autopilot_slice_artifact_buffered",
|
|
95
156
|
artifact_type: artifactType,
|
|
157
|
+
confidence_score: confidenceScore,
|
|
96
158
|
artifact_id: artifactId,
|
|
97
159
|
url: input.artifact.url ?? null,
|
|
98
160
|
error: deps.safeErrorMessage(err),
|
|
161
|
+
...(input.isMockWorker ? { mock: true } : {}),
|
|
99
162
|
},
|
|
100
163
|
},
|
|
101
164
|
});
|
|
@@ -161,11 +224,18 @@ export function createAutopilotOperations(deps) {
|
|
|
161
224
|
return null;
|
|
162
225
|
};
|
|
163
226
|
const operations = [];
|
|
227
|
+
const normalizedTaskUpdates = [];
|
|
228
|
+
const normalizedMilestoneUpdates = [];
|
|
164
229
|
for (const update of input.taskUpdates) {
|
|
165
230
|
const taskId = (update?.task_id ?? "").trim();
|
|
166
231
|
const status = normalizeTaskStatus(update?.status ?? "");
|
|
167
232
|
if (!taskId || !status)
|
|
168
233
|
continue;
|
|
234
|
+
normalizedTaskUpdates.push({
|
|
235
|
+
taskId,
|
|
236
|
+
status,
|
|
237
|
+
reason: typeof update?.reason === "string" && update.reason.trim().length > 0 ? update.reason.trim() : null,
|
|
238
|
+
});
|
|
169
239
|
operations.push({ op: "task.update", task_id: taskId, status });
|
|
170
240
|
}
|
|
171
241
|
for (const update of input.milestoneUpdates) {
|
|
@@ -173,28 +243,81 @@ export function createAutopilotOperations(deps) {
|
|
|
173
243
|
const status = normalizeMilestoneStatus(update?.status ?? "");
|
|
174
244
|
if (!milestoneId || !status)
|
|
175
245
|
continue;
|
|
246
|
+
normalizedMilestoneUpdates.push({
|
|
247
|
+
milestoneId,
|
|
248
|
+
status,
|
|
249
|
+
reason: typeof update?.reason === "string" && update.reason.trim().length > 0
|
|
250
|
+
? update.reason.trim()
|
|
251
|
+
: null,
|
|
252
|
+
});
|
|
176
253
|
operations.push({ op: "milestone.update", milestone_id: milestoneId, status });
|
|
177
254
|
}
|
|
178
|
-
if (operations.length === 0)
|
|
179
|
-
return {
|
|
255
|
+
if (operations.length === 0) {
|
|
256
|
+
return {
|
|
257
|
+
applied: 0,
|
|
258
|
+
buffered: false,
|
|
259
|
+
taskUpdates: [],
|
|
260
|
+
milestoneUpdates: [],
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
const normalizedAgentId = typeof input.agentId === "string" && input.agentId.trim().length > 0
|
|
264
|
+
? input.agentId.trim()
|
|
265
|
+
: null;
|
|
266
|
+
const normalizedAgentName = typeof input.agentName === "string" && input.agentName.trim().length > 0
|
|
267
|
+
? input.agentName.trim()
|
|
268
|
+
: null;
|
|
269
|
+
const runIdForApply = input.runId?.trim() ?? "";
|
|
270
|
+
const correlationIdForApply = input.correlationId?.trim() ?? "";
|
|
271
|
+
const applyPayloadBase = {
|
|
272
|
+
initiative_id: input.initiativeId,
|
|
273
|
+
source_client: "openclaw",
|
|
274
|
+
idempotency_key: deps.idempotencyKey([
|
|
275
|
+
"openclaw",
|
|
276
|
+
"autopilot",
|
|
277
|
+
"slice_status",
|
|
278
|
+
input.initiativeId,
|
|
279
|
+
input.correlationId,
|
|
280
|
+
]),
|
|
281
|
+
operations: operations,
|
|
282
|
+
};
|
|
180
283
|
try {
|
|
181
284
|
await deps.client.applyChangeset({
|
|
182
|
-
|
|
183
|
-
run_id:
|
|
184
|
-
correlation_id:
|
|
185
|
-
source_client: "openclaw",
|
|
186
|
-
idempotency_key: deps.idempotencyKey([
|
|
187
|
-
"openclaw",
|
|
188
|
-
"autopilot",
|
|
189
|
-
"slice_status",
|
|
190
|
-
input.initiativeId,
|
|
191
|
-
input.correlationId,
|
|
192
|
-
]),
|
|
193
|
-
operations: operations,
|
|
285
|
+
...applyPayloadBase,
|
|
286
|
+
run_id: runIdForApply || undefined,
|
|
287
|
+
correlation_id: correlationIdForApply || undefined,
|
|
194
288
|
});
|
|
195
|
-
return {
|
|
289
|
+
return {
|
|
290
|
+
applied: operations.length,
|
|
291
|
+
buffered: false,
|
|
292
|
+
taskUpdates: normalizedTaskUpdates,
|
|
293
|
+
milestoneUpdates: normalizedMilestoneUpdates,
|
|
294
|
+
};
|
|
196
295
|
}
|
|
197
296
|
catch (err) {
|
|
297
|
+
const errMsg = deps.safeErrorMessage(err);
|
|
298
|
+
// Common local-path case: run_id is only known locally. Retry with
|
|
299
|
+
// correlation_id-only semantics so OrgX can attach deterministically.
|
|
300
|
+
if (runIdForApply &&
|
|
301
|
+
/^404\b/.test(errMsg) &&
|
|
302
|
+
/\brun\b/i.test(errMsg) &&
|
|
303
|
+
/not found/i.test(errMsg)) {
|
|
304
|
+
try {
|
|
305
|
+
await deps.client.applyChangeset({
|
|
306
|
+
...applyPayloadBase,
|
|
307
|
+
run_id: undefined,
|
|
308
|
+
correlation_id: correlationIdForApply || `openclaw_run_${runIdForApply.replace(/-/g, "").slice(0, 24)}`,
|
|
309
|
+
});
|
|
310
|
+
return {
|
|
311
|
+
applied: operations.length,
|
|
312
|
+
buffered: false,
|
|
313
|
+
taskUpdates: normalizedTaskUpdates,
|
|
314
|
+
milestoneUpdates: normalizedMilestoneUpdates,
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
catch {
|
|
318
|
+
// Fall through to local outbox buffering.
|
|
319
|
+
}
|
|
320
|
+
}
|
|
198
321
|
const timestamp = new Date().toISOString();
|
|
199
322
|
try {
|
|
200
323
|
await appendToOutbox(input.initiativeId, {
|
|
@@ -220,12 +343,12 @@ export function createAutopilotOperations(deps) {
|
|
|
220
343
|
type: "run_started",
|
|
221
344
|
title: `Buffered status updates for slice ${input.runId}`,
|
|
222
345
|
description: null,
|
|
223
|
-
agentId:
|
|
224
|
-
agentName:
|
|
225
|
-
requesterAgentId:
|
|
226
|
-
requesterAgentName:
|
|
227
|
-
executorAgentId:
|
|
228
|
-
executorAgentName:
|
|
346
|
+
agentId: normalizedAgentId,
|
|
347
|
+
agentName: normalizedAgentName,
|
|
348
|
+
requesterAgentId: normalizedAgentId,
|
|
349
|
+
requesterAgentName: normalizedAgentName,
|
|
350
|
+
executorAgentId: normalizedAgentId,
|
|
351
|
+
executorAgentName: normalizedAgentName,
|
|
229
352
|
runId: input.runId,
|
|
230
353
|
initiativeId: input.initiativeId,
|
|
231
354
|
timestamp,
|
|
@@ -234,7 +357,30 @@ export function createAutopilotOperations(deps) {
|
|
|
234
357
|
metadata: {
|
|
235
358
|
source: "openclaw_local_fallback",
|
|
236
359
|
event: "autopilot_slice_status_updates_buffered",
|
|
237
|
-
error:
|
|
360
|
+
error: errMsg,
|
|
361
|
+
run_id: input.runId,
|
|
362
|
+
correlation_id: input.correlationId,
|
|
363
|
+
output_path: typeof input.outputPath === "string" && input.outputPath.trim().length > 0
|
|
364
|
+
? input.outputPath.trim()
|
|
365
|
+
: null,
|
|
366
|
+
log_path: typeof input.logPath === "string" && input.logPath.trim().length > 0
|
|
367
|
+
? input.logPath.trim()
|
|
368
|
+
: null,
|
|
369
|
+
task_update_count: normalizedTaskUpdates.length,
|
|
370
|
+
milestone_update_count: normalizedMilestoneUpdates.length,
|
|
371
|
+
task_updates: normalizedTaskUpdates.map((entry) => ({
|
|
372
|
+
task_id: entry.taskId,
|
|
373
|
+
status: entry.status,
|
|
374
|
+
reason: entry.reason,
|
|
375
|
+
})),
|
|
376
|
+
milestone_updates: normalizedMilestoneUpdates.map((entry) => ({
|
|
377
|
+
milestone_id: entry.milestoneId,
|
|
378
|
+
status: entry.status,
|
|
379
|
+
reason: entry.reason,
|
|
380
|
+
})),
|
|
381
|
+
...(normalizedAgentId ? { agent_id: normalizedAgentId } : {}),
|
|
382
|
+
...(normalizedAgentName ? { agent_name: normalizedAgentName } : {}),
|
|
383
|
+
...(input.isMockWorker ? { mock: true } : {}),
|
|
238
384
|
},
|
|
239
385
|
},
|
|
240
386
|
});
|
|
@@ -242,7 +388,12 @@ export function createAutopilotOperations(deps) {
|
|
|
242
388
|
catch {
|
|
243
389
|
// best effort
|
|
244
390
|
}
|
|
245
|
-
return {
|
|
391
|
+
return {
|
|
392
|
+
applied: operations.length,
|
|
393
|
+
buffered: true,
|
|
394
|
+
taskUpdates: normalizedTaskUpdates,
|
|
395
|
+
milestoneUpdates: normalizedMilestoneUpdates,
|
|
396
|
+
};
|
|
246
397
|
}
|
|
247
398
|
}
|
|
248
399
|
async function resolveAgentDisplayName(agentId, fallbackName) {
|