@useorgx/openclaw-plugin 0.4.9 → 0.7.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/README.md +77 -11
- package/dashboard/dist/assets/6mILZQ2a.js +1 -0
- package/dashboard/dist/assets/6mILZQ2a.js.br +0 -0
- package/dashboard/dist/assets/6mILZQ2a.js.gz +0 -0
- package/dashboard/dist/assets/8dksYiq4.js +2 -0
- package/dashboard/dist/assets/8dksYiq4.js.br +0 -0
- package/dashboard/dist/assets/8dksYiq4.js.gz +0 -0
- package/dashboard/dist/assets/B5zYRHc3.js +1 -0
- package/dashboard/dist/assets/B5zYRHc3.js.br +0 -0
- package/dashboard/dist/assets/B5zYRHc3.js.gz +0 -0
- package/dashboard/dist/assets/B6wPWJ35.js +1 -0
- package/dashboard/dist/assets/B6wPWJ35.js.br +0 -0
- package/dashboard/dist/assets/B6wPWJ35.js.gz +0 -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/BWEwjt1W.js +1 -0
- package/dashboard/dist/assets/BWEwjt1W.js.br +0 -0
- package/dashboard/dist/assets/BWEwjt1W.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/BzRbDCAD.css +1 -0
- package/dashboard/dist/assets/BzRbDCAD.css.br +0 -0
- package/dashboard/dist/assets/BzRbDCAD.css.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/C8uM3AX8.js +1 -0
- package/dashboard/dist/assets/C8uM3AX8.js.br +0 -0
- package/dashboard/dist/assets/C8uM3AX8.js.gz +0 -0
- package/dashboard/dist/assets/C9jy61eu.js +212 -0
- package/dashboard/dist/assets/C9jy61eu.js.br +0 -0
- package/dashboard/dist/assets/C9jy61eu.js.gz +0 -0
- package/dashboard/dist/assets/CC63EwFD.js +1 -0
- package/dashboard/dist/assets/CC63EwFD.js.br +0 -0
- package/dashboard/dist/assets/CC63EwFD.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/CZaT3ob_.js +1 -0
- package/dashboard/dist/assets/CZaT3ob_.js.br +0 -0
- package/dashboard/dist/assets/CZaT3ob_.js.gz +0 -0
- package/dashboard/dist/assets/CgaottFX.js +1 -0
- package/dashboard/dist/assets/CgaottFX.js.br +0 -0
- package/dashboard/dist/assets/CgaottFX.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/CzCxAZlW.js +1 -0
- package/dashboard/dist/assets/CzCxAZlW.js.br +0 -0
- package/dashboard/dist/assets/CzCxAZlW.js.gz +0 -0
- package/dashboard/dist/assets/D3iMTYEj.js +1 -0
- package/dashboard/dist/assets/D3iMTYEj.js.br +0 -0
- package/dashboard/dist/assets/D3iMTYEj.js.gz +0 -0
- package/dashboard/dist/assets/D8JNX8kq.js +2 -0
- package/dashboard/dist/assets/D8JNX8kq.js.br +0 -0
- package/dashboard/dist/assets/D8JNX8kq.js.gz +0 -0
- package/dashboard/dist/assets/DnA8dpj6.js +1 -0
- package/dashboard/dist/assets/DnA8dpj6.js.br +0 -0
- package/dashboard/dist/assets/DnA8dpj6.js.gz +0 -0
- package/dashboard/dist/assets/IUexzymk.js +1 -0
- package/dashboard/dist/assets/IUexzymk.js.br +0 -0
- package/dashboard/dist/assets/IUexzymk.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/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/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/rttbDbEx.js +1 -0
- package/dashboard/dist/assets/rttbDbEx.js.br +0 -0
- package/dashboard/dist/assets/rttbDbEx.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/practice-exercise-schema.d.ts +216 -0
- package/dist/contracts/practice-exercise-schema.js +314 -0
- 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 +199 -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 +247 -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/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 +3145 -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 +328 -25
- package/dist/http/helpers/autopilot-slice-utils.d.ts +18 -0
- package/dist/http/helpers/autopilot-slice-utils.js +514 -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 +104 -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 +877 -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 +1420 -105
- package/dist/http/routes/agent-suite.d.ts +9 -0
- package/dist/http/routes/agent-suite.js +294 -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 +232 -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 +49 -2
- package/dist/http/routes/live-snapshot.js +653 -23
- package/dist/http/routes/live-terminal.d.ts +11 -0
- package/dist/http/routes/live-terminal.js +154 -0
- package/dist/http/routes/live-triage.d.ts +61 -0
- package/dist/http/routes/live-triage.js +192 -0
- package/dist/http/routes/mission-control-actions.d.ts +49 -1
- package/dist/http/routes/mission-control-actions.js +1246 -84
- package/dist/http/routes/mission-control-read.d.ts +48 -3
- package/dist/http/routes/mission-control-read.js +1658 -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.d.ts +3 -0
- package/dist/mcp-http-handler.js +34 -60
- 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 +36 -5
- package/dist/reporting/rollups.d.ts +41 -0
- package/dist/reporting/rollups.js +113 -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 +20 -6
- 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,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { pickString } from "./value-utils.js";
|
|
3
|
-
const ACTIVITY_HEADLINE_TIMEOUT_MS = 4_000;
|
|
4
|
-
const ACTIVITY_HEADLINE_CACHE_TTL_MS = 12 * 60 * 60_000;
|
|
5
|
-
const ACTIVITY_HEADLINE_CACHE_MAX = 1_000;
|
|
1
|
+
import { callLlm } from "./llm-client.js";
|
|
6
2
|
const ACTIVITY_HEADLINE_MAX_INPUT_CHARS = 8_000;
|
|
7
3
|
const DEFAULT_ACTIVITY_HEADLINE_MODEL = "openai/gpt-4.1-nano";
|
|
8
|
-
const activityHeadlineCache = new Map();
|
|
9
|
-
let resolvedActivitySummaryApiKey;
|
|
10
4
|
function normalizeSpaces(value) {
|
|
11
5
|
return value.replace(/\s+/g, " ").trim();
|
|
12
6
|
}
|
|
@@ -46,84 +40,11 @@ function heuristicActivityHeadline(text, title) {
|
|
|
46
40
|
return cleanedTitle;
|
|
47
41
|
return "Activity update";
|
|
48
42
|
}
|
|
49
|
-
function resolveActivitySummaryApiKey() {
|
|
50
|
-
if (resolvedActivitySummaryApiKey !== undefined) {
|
|
51
|
-
return resolvedActivitySummaryApiKey;
|
|
52
|
-
}
|
|
53
|
-
const candidates = [
|
|
54
|
-
process.env.ORGX_ACTIVITY_SUMMARY_API_KEY ?? "",
|
|
55
|
-
process.env.OPENROUTER_API_KEY ?? "",
|
|
56
|
-
];
|
|
57
|
-
const key = candidates.find((candidate) => candidate.trim().length > 0)?.trim() ?? "";
|
|
58
|
-
resolvedActivitySummaryApiKey = key || null;
|
|
59
|
-
return resolvedActivitySummaryApiKey;
|
|
60
|
-
}
|
|
61
|
-
function trimActivityHeadlineCache() {
|
|
62
|
-
while (activityHeadlineCache.size > ACTIVITY_HEADLINE_CACHE_MAX) {
|
|
63
|
-
const firstKey = activityHeadlineCache.keys().next().value;
|
|
64
|
-
if (!firstKey)
|
|
65
|
-
break;
|
|
66
|
-
activityHeadlineCache.delete(firstKey);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
function extractCompletionText(payload) {
|
|
70
|
-
const choices = payload.choices;
|
|
71
|
-
if (!Array.isArray(choices) || choices.length === 0)
|
|
72
|
-
return null;
|
|
73
|
-
const first = choices[0];
|
|
74
|
-
if (!first || typeof first !== "object")
|
|
75
|
-
return null;
|
|
76
|
-
const firstRecord = first;
|
|
77
|
-
const message = firstRecord.message;
|
|
78
|
-
if (message && typeof message === "object") {
|
|
79
|
-
const content = message.content;
|
|
80
|
-
if (typeof content === "string") {
|
|
81
|
-
return content;
|
|
82
|
-
}
|
|
83
|
-
if (Array.isArray(content)) {
|
|
84
|
-
const textParts = content
|
|
85
|
-
.map((part) => {
|
|
86
|
-
if (typeof part === "string")
|
|
87
|
-
return part;
|
|
88
|
-
if (!part || typeof part !== "object")
|
|
89
|
-
return "";
|
|
90
|
-
const record = part;
|
|
91
|
-
return typeof record.text === "string" ? record.text : "";
|
|
92
|
-
})
|
|
93
|
-
.filter((part) => part.length > 0);
|
|
94
|
-
if (textParts.length > 0) {
|
|
95
|
-
return textParts.join(" ");
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return pickString(firstRecord, ["text", "content"]);
|
|
100
|
-
}
|
|
101
43
|
export async function summarizeActivityHeadline(input) {
|
|
102
44
|
const normalizedText = normalizeSpaces(input.text).slice(0, ACTIVITY_HEADLINE_MAX_INPUT_CHARS);
|
|
103
45
|
const normalizedTitle = normalizeSpaces(input.title ?? "");
|
|
104
46
|
const normalizedType = normalizeSpaces(input.type ?? "");
|
|
105
|
-
const
|
|
106
|
-
const cacheKey = createHash("sha256")
|
|
107
|
-
.update(`${normalizedType}\n${normalizedTitle}\n${normalizedText}`)
|
|
108
|
-
.digest("hex");
|
|
109
|
-
const cached = activityHeadlineCache.get(cacheKey);
|
|
110
|
-
if (cached && cached.expiresAt > Date.now()) {
|
|
111
|
-
return { headline: cached.headline, source: cached.source, model: null };
|
|
112
|
-
}
|
|
113
|
-
const apiKey = resolveActivitySummaryApiKey();
|
|
114
|
-
if (!apiKey) {
|
|
115
|
-
activityHeadlineCache.set(cacheKey, {
|
|
116
|
-
headline: heuristic,
|
|
117
|
-
source: "heuristic",
|
|
118
|
-
expiresAt: Date.now() + ACTIVITY_HEADLINE_CACHE_TTL_MS,
|
|
119
|
-
});
|
|
120
|
-
trimActivityHeadlineCache();
|
|
121
|
-
return { headline: heuristic, source: "heuristic", model: null };
|
|
122
|
-
}
|
|
123
|
-
const controller = new AbortController();
|
|
124
|
-
const timeout = setTimeout(() => controller.abort(), ACTIVITY_HEADLINE_TIMEOUT_MS);
|
|
125
|
-
const model = process.env.ORGX_ACTIVITY_SUMMARY_MODEL?.trim() || DEFAULT_ACTIVITY_HEADLINE_MODEL;
|
|
126
|
-
const prompt = [
|
|
47
|
+
const userPrompt = [
|
|
127
48
|
"Create one short activity title for a dashboard header.",
|
|
128
49
|
"Rules:",
|
|
129
50
|
"- Max 96 characters.",
|
|
@@ -138,55 +59,15 @@ export async function summarizeActivityHeadline(input) {
|
|
|
138
59
|
]
|
|
139
60
|
.filter(Boolean)
|
|
140
61
|
.join("\n");
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
messages: [
|
|
153
|
-
{
|
|
154
|
-
role: "system",
|
|
155
|
-
content: "You write concise activity headers for operational dashboards. Return only the header text.",
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
role: "user",
|
|
159
|
-
content: prompt,
|
|
160
|
-
},
|
|
161
|
-
],
|
|
162
|
-
}),
|
|
163
|
-
signal: controller.signal,
|
|
164
|
-
});
|
|
165
|
-
if (!response.ok) {
|
|
166
|
-
throw new Error(`headline model request failed (${response.status})`);
|
|
167
|
-
}
|
|
168
|
-
const payload = (await response.json());
|
|
169
|
-
const generated = cleanActivityHeadline(extractCompletionText(payload) ?? "");
|
|
170
|
-
const headline = generated || heuristic;
|
|
171
|
-
const source = generated ? "llm" : "heuristic";
|
|
172
|
-
activityHeadlineCache.set(cacheKey, {
|
|
173
|
-
headline,
|
|
174
|
-
source,
|
|
175
|
-
expiresAt: Date.now() + ACTIVITY_HEADLINE_CACHE_TTL_MS,
|
|
176
|
-
});
|
|
177
|
-
trimActivityHeadlineCache();
|
|
178
|
-
return { headline, source, model };
|
|
179
|
-
}
|
|
180
|
-
catch {
|
|
181
|
-
activityHeadlineCache.set(cacheKey, {
|
|
182
|
-
headline: heuristic,
|
|
183
|
-
source: "heuristic",
|
|
184
|
-
expiresAt: Date.now() + ACTIVITY_HEADLINE_CACHE_TTL_MS,
|
|
185
|
-
});
|
|
186
|
-
trimActivityHeadlineCache();
|
|
187
|
-
return { headline: heuristic, source: "heuristic", model: null };
|
|
188
|
-
}
|
|
189
|
-
finally {
|
|
190
|
-
clearTimeout(timeout);
|
|
191
|
-
}
|
|
62
|
+
const model = process.env.ORGX_ACTIVITY_SUMMARY_MODEL?.trim() || DEFAULT_ACTIVITY_HEADLINE_MODEL;
|
|
63
|
+
const response = await callLlm({
|
|
64
|
+
taskId: "activity_headline",
|
|
65
|
+
systemPrompt: "You write concise activity headers for operational dashboards. Return only the header text.",
|
|
66
|
+
userPrompt,
|
|
67
|
+
model,
|
|
68
|
+
temperature: 0.1,
|
|
69
|
+
maxTokens: 48,
|
|
70
|
+
timeoutMs: 4_000,
|
|
71
|
+
}, () => heuristicActivityHeadline(normalizedText, normalizedTitle), (raw) => cleanActivityHeadline(raw) || null);
|
|
72
|
+
return { headline: response.result, source: response.source, model: response.model };
|
|
192
73
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { OrgXClient } from "../../api.js";
|
|
2
2
|
import { type RuntimeHookPayload, type RuntimeInstanceRecord, type RuntimeSourceClient } from "../../runtime-instance-store.js";
|
|
3
|
-
import { type MissionControlNode } from "./mission-control.js";
|
|
3
|
+
import { type MissionControlNode, type SliceScope } from "./mission-control.js";
|
|
4
|
+
import type { KickoffContext, KickoffContextRequest } from "../../types.js";
|
|
4
5
|
export interface CreateAutoContinueEngineDeps {
|
|
5
6
|
client: OrgXClient;
|
|
6
7
|
filename: string;
|
|
@@ -46,23 +47,44 @@ export interface CreateAutoContinueEngineDeps {
|
|
|
46
47
|
title: string;
|
|
47
48
|
summary?: string | null;
|
|
48
49
|
urgency?: "low" | "medium" | "high" | "urgent";
|
|
49
|
-
options?: string
|
|
50
|
+
options?: Array<string | Record<string, unknown>>;
|
|
50
51
|
blocking?: boolean;
|
|
51
|
-
|
|
52
|
+
decisionType?: string | null;
|
|
53
|
+
workstreamId?: string | null;
|
|
54
|
+
agentId?: string | null;
|
|
55
|
+
dueAt?: string | null;
|
|
56
|
+
sourceSystem?: string | null;
|
|
57
|
+
conflictSource?: string | null;
|
|
58
|
+
dedupeKey?: string | null;
|
|
59
|
+
recommendedAction?: string | null;
|
|
60
|
+
sourceRunId?: string | null;
|
|
61
|
+
sourceSessionId?: string | null;
|
|
62
|
+
sourceStreamId?: string | null;
|
|
63
|
+
sourceRef?: Record<string, unknown> | null;
|
|
64
|
+
evidenceRefs?: Array<Record<string, unknown>> | null;
|
|
65
|
+
metadata?: Record<string, unknown> | null;
|
|
66
|
+
}) => Promise<boolean | {
|
|
67
|
+
queued: boolean;
|
|
68
|
+
decisionIds?: string[];
|
|
69
|
+
}>;
|
|
52
70
|
registerArtifactSafe: (input: {
|
|
53
71
|
initiativeId: string;
|
|
54
72
|
runId: string;
|
|
55
73
|
agentId: string;
|
|
56
74
|
agentName?: string | null;
|
|
57
75
|
workstreamId: string;
|
|
76
|
+
fallbackMilestoneId?: string | null;
|
|
77
|
+
fallbackTaskIds?: string[] | null;
|
|
58
78
|
artifact: {
|
|
59
79
|
name: string;
|
|
60
80
|
artifact_type?: string | null;
|
|
81
|
+
confidence_score?: number | null;
|
|
61
82
|
description?: string | null;
|
|
62
83
|
url?: string | null;
|
|
63
84
|
milestone_id?: string | null;
|
|
64
85
|
task_ids?: string[] | null;
|
|
65
86
|
};
|
|
87
|
+
isMockWorker?: boolean;
|
|
66
88
|
}) => Promise<{
|
|
67
89
|
ok: boolean;
|
|
68
90
|
id: string | null;
|
|
@@ -81,15 +103,36 @@ export interface CreateAutoContinueEngineDeps {
|
|
|
81
103
|
status: string;
|
|
82
104
|
reason?: string | null;
|
|
83
105
|
}>;
|
|
106
|
+
isMockWorker?: boolean;
|
|
84
107
|
}) => Promise<{
|
|
85
108
|
applied: number;
|
|
86
109
|
buffered: boolean;
|
|
110
|
+
taskUpdates: Array<{
|
|
111
|
+
taskId: string;
|
|
112
|
+
status: string;
|
|
113
|
+
reason: string | null;
|
|
114
|
+
}>;
|
|
115
|
+
milestoneUpdates: Array<{
|
|
116
|
+
milestoneId: string;
|
|
117
|
+
status: string;
|
|
118
|
+
reason: string | null;
|
|
119
|
+
}>;
|
|
87
120
|
}>;
|
|
88
121
|
upsertRuntimeInstanceFromHook: (payload: RuntimeHookPayload) => RuntimeInstanceRecord;
|
|
89
122
|
broadcastRuntimeSse: (event: string, payload: RuntimeInstanceRecord) => void;
|
|
90
123
|
clearSnapshotResponseCache: () => void;
|
|
91
124
|
resolveByokEnvOverrides: () => Record<string, string | undefined>;
|
|
92
125
|
randomUUID?: () => string;
|
|
126
|
+
fetchKickoffContextSafe?: (client: OrgXClient, payload: KickoffContextRequest) => Promise<KickoffContext | null>;
|
|
127
|
+
renderKickoffMessage?: (input: {
|
|
128
|
+
baseMessage: string;
|
|
129
|
+
kickoff: KickoffContext | null;
|
|
130
|
+
domain: string | null;
|
|
131
|
+
requiredSkills: string[];
|
|
132
|
+
}) => {
|
|
133
|
+
message: string;
|
|
134
|
+
contextHash: string | null;
|
|
135
|
+
};
|
|
93
136
|
}
|
|
94
137
|
export declare function createAutoContinueEngine(deps: CreateAutoContinueEngineDeps): {
|
|
95
138
|
autoContinueRuns: Map<string, {
|
|
@@ -99,7 +142,11 @@ export declare function createAutoContinueEngine(deps: CreateAutoContinueEngineD
|
|
|
99
142
|
includeVerification: boolean;
|
|
100
143
|
allowedWorkstreamIds: string[] | null;
|
|
101
144
|
stopAfterSlice: boolean;
|
|
102
|
-
|
|
145
|
+
ignoreSpawnGuardRateLimit: boolean;
|
|
146
|
+
maxParallelSlices: number;
|
|
147
|
+
parallelMode: "iwmt";
|
|
148
|
+
scope: SliceScope;
|
|
149
|
+
tokenBudget: number | null;
|
|
103
150
|
tokensUsed: number;
|
|
104
151
|
status: "stopped" | "running" | "stopping";
|
|
105
152
|
stopReason: ("error" | "blocked" | "completed" | "stopped" | "budget_exhausted") | null;
|
|
@@ -110,6 +157,19 @@ export declare function createAutoContinueEngine(deps: CreateAutoContinueEngineD
|
|
|
110
157
|
lastError: string | null;
|
|
111
158
|
lastTaskId: string | null;
|
|
112
159
|
lastRunId: string | null;
|
|
160
|
+
activeSliceRunIds: string[];
|
|
161
|
+
activeTaskIds: string[];
|
|
162
|
+
laneByWorkstreamId: Record<string, {
|
|
163
|
+
workstreamId: string;
|
|
164
|
+
state: "idle" | "blocked" | "completed" | "running" | "rate_limited" | "waiting_dependency";
|
|
165
|
+
activeRunId: string | null;
|
|
166
|
+
activeTaskIds: string[];
|
|
167
|
+
blockedReason: string | null;
|
|
168
|
+
waitingOnWorkstreamIds: string[];
|
|
169
|
+
retryAt: string | null;
|
|
170
|
+
updatedAt: string;
|
|
171
|
+
}>;
|
|
172
|
+
blockedWorkstreamIds: string[];
|
|
113
173
|
activeTaskId: string | null;
|
|
114
174
|
activeRunId: string | null;
|
|
115
175
|
activeTaskTokenEstimate: number | null;
|
|
@@ -124,6 +184,11 @@ export declare function createAutoContinueEngine(deps: CreateAutoContinueEngineD
|
|
|
124
184
|
agentName: string | null;
|
|
125
185
|
domain: string;
|
|
126
186
|
requiredSkills: string[];
|
|
187
|
+
behaviorConfigId: string | null;
|
|
188
|
+
behaviorConfigVersion: string | null;
|
|
189
|
+
behaviorConfigHash: string | null;
|
|
190
|
+
behaviorPolicySource: string | null;
|
|
191
|
+
behaviorAutomationLevel: "auto" | "supervised" | "manual";
|
|
127
192
|
sourceClient: RuntimeSourceClient;
|
|
128
193
|
pid: number | null;
|
|
129
194
|
status: "error" | "blocked" | "completed" | "running";
|
|
@@ -135,7 +200,10 @@ export declare function createAutoContinueEngine(deps: CreateAutoContinueEngineD
|
|
|
135
200
|
logPath: string;
|
|
136
201
|
taskIds: string[];
|
|
137
202
|
milestoneIds: string[];
|
|
203
|
+
scope: SliceScope;
|
|
204
|
+
scopeMilestoneIds: string[];
|
|
138
205
|
lastError: string | null;
|
|
206
|
+
isMockWorker: boolean;
|
|
139
207
|
}>;
|
|
140
208
|
localInitiativeStatusOverrides: Map<string, {
|
|
141
209
|
status: string;
|
|
@@ -157,7 +225,8 @@ export declare function createAutoContinueEngine(deps: CreateAutoContinueEngineD
|
|
|
157
225
|
timestamp?: string | null;
|
|
158
226
|
}) => RuntimeInstanceRecord;
|
|
159
227
|
autoContinueTickMs: number;
|
|
160
|
-
defaultAutoContinueTokenBudget: () => number;
|
|
228
|
+
defaultAutoContinueTokenBudget: () => number | null;
|
|
229
|
+
defaultAutoContinueMaxParallelSlices: () => number;
|
|
161
230
|
setLocalInitiativeStatusOverride: (initiativeId: string, status: string) => void;
|
|
162
231
|
clearLocalInitiativeStatusOverride: (initiativeId: string) => void;
|
|
163
232
|
applyLocalInitiativeOverrides: (rows: Record<string, unknown>[]) => Record<string, unknown>[];
|
|
@@ -177,7 +246,11 @@ export declare function createAutoContinueEngine(deps: CreateAutoContinueEngineD
|
|
|
177
246
|
includeVerification: boolean;
|
|
178
247
|
allowedWorkstreamIds: string[] | null;
|
|
179
248
|
stopAfterSlice: boolean;
|
|
180
|
-
|
|
249
|
+
ignoreSpawnGuardRateLimit: boolean;
|
|
250
|
+
maxParallelSlices: number;
|
|
251
|
+
parallelMode: "iwmt";
|
|
252
|
+
scope: SliceScope;
|
|
253
|
+
tokenBudget: number | null;
|
|
181
254
|
tokensUsed: number;
|
|
182
255
|
status: "stopped" | "running" | "stopping";
|
|
183
256
|
stopReason: ("error" | "blocked" | "completed" | "stopped" | "budget_exhausted") | null;
|
|
@@ -188,6 +261,19 @@ export declare function createAutoContinueEngine(deps: CreateAutoContinueEngineD
|
|
|
188
261
|
lastError: string | null;
|
|
189
262
|
lastTaskId: string | null;
|
|
190
263
|
lastRunId: string | null;
|
|
264
|
+
activeSliceRunIds: string[];
|
|
265
|
+
activeTaskIds: string[];
|
|
266
|
+
laneByWorkstreamId: Record<string, {
|
|
267
|
+
workstreamId: string;
|
|
268
|
+
state: "idle" | "blocked" | "completed" | "running" | "rate_limited" | "waiting_dependency";
|
|
269
|
+
activeRunId: string | null;
|
|
270
|
+
activeTaskIds: string[];
|
|
271
|
+
blockedReason: string | null;
|
|
272
|
+
waitingOnWorkstreamIds: string[];
|
|
273
|
+
retryAt: string | null;
|
|
274
|
+
updatedAt: string;
|
|
275
|
+
}>;
|
|
276
|
+
blockedWorkstreamIds: string[];
|
|
191
277
|
activeTaskId: string | null;
|
|
192
278
|
activeRunId: string | null;
|
|
193
279
|
activeTaskTokenEstimate: number | null;
|
|
@@ -201,7 +287,11 @@ export declare function createAutoContinueEngine(deps: CreateAutoContinueEngineD
|
|
|
201
287
|
includeVerification: boolean;
|
|
202
288
|
allowedWorkstreamIds: string[] | null;
|
|
203
289
|
stopAfterSlice: boolean;
|
|
204
|
-
|
|
290
|
+
ignoreSpawnGuardRateLimit: boolean;
|
|
291
|
+
maxParallelSlices: number;
|
|
292
|
+
parallelMode: "iwmt";
|
|
293
|
+
scope: SliceScope;
|
|
294
|
+
tokenBudget: number | null;
|
|
205
295
|
tokensUsed: number;
|
|
206
296
|
status: "stopped" | "running" | "stopping";
|
|
207
297
|
stopReason: ("error" | "blocked" | "completed" | "stopped" | "budget_exhausted") | null;
|
|
@@ -212,12 +302,27 @@ export declare function createAutoContinueEngine(deps: CreateAutoContinueEngineD
|
|
|
212
302
|
lastError: string | null;
|
|
213
303
|
lastTaskId: string | null;
|
|
214
304
|
lastRunId: string | null;
|
|
305
|
+
activeSliceRunIds: string[];
|
|
306
|
+
activeTaskIds: string[];
|
|
307
|
+
laneByWorkstreamId: Record<string, {
|
|
308
|
+
workstreamId: string;
|
|
309
|
+
state: "idle" | "blocked" | "completed" | "running" | "rate_limited" | "waiting_dependency";
|
|
310
|
+
activeRunId: string | null;
|
|
311
|
+
activeTaskIds: string[];
|
|
312
|
+
blockedReason: string | null;
|
|
313
|
+
waitingOnWorkstreamIds: string[];
|
|
314
|
+
retryAt: string | null;
|
|
315
|
+
updatedAt: string;
|
|
316
|
+
}>;
|
|
317
|
+
blockedWorkstreamIds: string[];
|
|
215
318
|
activeTaskId: string | null;
|
|
216
319
|
activeRunId: string | null;
|
|
217
320
|
activeTaskTokenEstimate: number | null;
|
|
218
321
|
};
|
|
219
322
|
reason: "error" | "blocked" | "completed" | "stopped" | "budget_exhausted";
|
|
220
323
|
error?: string | null;
|
|
324
|
+
decisionRequired?: boolean;
|
|
325
|
+
decisionIds?: string[];
|
|
221
326
|
}) => Promise<void>;
|
|
222
327
|
tickAutoContinueRun: (run: {
|
|
223
328
|
initiativeId: string;
|
|
@@ -226,7 +331,11 @@ export declare function createAutoContinueEngine(deps: CreateAutoContinueEngineD
|
|
|
226
331
|
includeVerification: boolean;
|
|
227
332
|
allowedWorkstreamIds: string[] | null;
|
|
228
333
|
stopAfterSlice: boolean;
|
|
229
|
-
|
|
334
|
+
ignoreSpawnGuardRateLimit: boolean;
|
|
335
|
+
maxParallelSlices: number;
|
|
336
|
+
parallelMode: "iwmt";
|
|
337
|
+
scope: SliceScope;
|
|
338
|
+
tokenBudget: number | null;
|
|
230
339
|
tokensUsed: number;
|
|
231
340
|
status: "stopped" | "running" | "stopping";
|
|
232
341
|
stopReason: ("error" | "blocked" | "completed" | "stopped" | "budget_exhausted") | null;
|
|
@@ -237,6 +346,19 @@ export declare function createAutoContinueEngine(deps: CreateAutoContinueEngineD
|
|
|
237
346
|
lastError: string | null;
|
|
238
347
|
lastTaskId: string | null;
|
|
239
348
|
lastRunId: string | null;
|
|
349
|
+
activeSliceRunIds: string[];
|
|
350
|
+
activeTaskIds: string[];
|
|
351
|
+
laneByWorkstreamId: Record<string, {
|
|
352
|
+
workstreamId: string;
|
|
353
|
+
state: "idle" | "blocked" | "completed" | "running" | "rate_limited" | "waiting_dependency";
|
|
354
|
+
activeRunId: string | null;
|
|
355
|
+
activeTaskIds: string[];
|
|
356
|
+
blockedReason: string | null;
|
|
357
|
+
waitingOnWorkstreamIds: string[];
|
|
358
|
+
retryAt: string | null;
|
|
359
|
+
updatedAt: string;
|
|
360
|
+
}>;
|
|
361
|
+
blockedWorkstreamIds: string[];
|
|
240
362
|
activeTaskId: string | null;
|
|
241
363
|
activeRunId: string | null;
|
|
242
364
|
activeTaskTokenEstimate: number | null;
|
|
@@ -250,7 +372,11 @@ export declare function createAutoContinueEngine(deps: CreateAutoContinueEngineD
|
|
|
250
372
|
includeVerification: boolean;
|
|
251
373
|
allowedWorkstreamIds: string[] | null;
|
|
252
374
|
stopAfterSlice: boolean;
|
|
253
|
-
|
|
375
|
+
ignoreSpawnGuardRateLimit: boolean;
|
|
376
|
+
maxParallelSlices: number;
|
|
377
|
+
parallelMode: "iwmt";
|
|
378
|
+
scope: SliceScope;
|
|
379
|
+
tokenBudget: number | null;
|
|
254
380
|
tokensUsed: number;
|
|
255
381
|
status: "stopped" | "running" | "stopping";
|
|
256
382
|
stopReason: ("error" | "blocked" | "completed" | "stopped" | "budget_exhausted") | null;
|
|
@@ -261,10 +387,51 @@ export declare function createAutoContinueEngine(deps: CreateAutoContinueEngineD
|
|
|
261
387
|
lastError: string | null;
|
|
262
388
|
lastTaskId: string | null;
|
|
263
389
|
lastRunId: string | null;
|
|
390
|
+
activeSliceRunIds: string[];
|
|
391
|
+
activeTaskIds: string[];
|
|
392
|
+
laneByWorkstreamId: Record<string, {
|
|
393
|
+
workstreamId: string;
|
|
394
|
+
state: "idle" | "blocked" | "completed" | "running" | "rate_limited" | "waiting_dependency";
|
|
395
|
+
activeRunId: string | null;
|
|
396
|
+
activeTaskIds: string[];
|
|
397
|
+
blockedReason: string | null;
|
|
398
|
+
waitingOnWorkstreamIds: string[];
|
|
399
|
+
retryAt: string | null;
|
|
400
|
+
updatedAt: string;
|
|
401
|
+
}>;
|
|
402
|
+
blockedWorkstreamIds: string[];
|
|
264
403
|
activeTaskId: string | null;
|
|
265
404
|
activeRunId: string | null;
|
|
266
405
|
activeTaskTokenEstimate: number | null;
|
|
267
406
|
} | null;
|
|
407
|
+
getAutoContinueLaneForWorkstream: (initiativeId: string, workstreamId: string) => {
|
|
408
|
+
workstreamId: string;
|
|
409
|
+
state: "idle" | "blocked" | "completed" | "running" | "rate_limited" | "waiting_dependency";
|
|
410
|
+
activeRunId: string | null;
|
|
411
|
+
activeTaskIds: string[];
|
|
412
|
+
blockedReason: string | null;
|
|
413
|
+
waitingOnWorkstreamIds: string[];
|
|
414
|
+
retryAt: string | null;
|
|
415
|
+
updatedAt: string;
|
|
416
|
+
} | null;
|
|
417
|
+
scheduleAutoFixForWorkstream: (input: {
|
|
418
|
+
initiativeId: string;
|
|
419
|
+
workstreamId: string;
|
|
420
|
+
runId?: string | null;
|
|
421
|
+
event?: string | null;
|
|
422
|
+
requestedByAgentId?: string | null;
|
|
423
|
+
requestedByAgentName?: string | null;
|
|
424
|
+
graceMs?: number | null;
|
|
425
|
+
}) => Promise<{
|
|
426
|
+
requestId: string;
|
|
427
|
+
initiativeId: string;
|
|
428
|
+
workstreamId: string;
|
|
429
|
+
runId: string | null;
|
|
430
|
+
sourceEvent: string | null;
|
|
431
|
+
graceMs: number;
|
|
432
|
+
scheduledAt: string;
|
|
433
|
+
dueAt: string;
|
|
434
|
+
}>;
|
|
268
435
|
startAutoContinueRun: (input: {
|
|
269
436
|
initiativeId: string;
|
|
270
437
|
agentId: string;
|
|
@@ -272,7 +439,11 @@ export declare function createAutoContinueEngine(deps: CreateAutoContinueEngineD
|
|
|
272
439
|
tokenBudget: unknown;
|
|
273
440
|
includeVerification: boolean;
|
|
274
441
|
allowedWorkstreamIds: string[] | null;
|
|
442
|
+
maxParallelSlices?: unknown;
|
|
443
|
+
parallelMode?: unknown;
|
|
275
444
|
stopAfterSlice?: boolean;
|
|
445
|
+
ignoreSpawnGuardRateLimit?: boolean;
|
|
446
|
+
scope?: SliceScope;
|
|
276
447
|
}) => Promise<{
|
|
277
448
|
initiativeId: string;
|
|
278
449
|
agentId: string;
|
|
@@ -280,7 +451,11 @@ export declare function createAutoContinueEngine(deps: CreateAutoContinueEngineD
|
|
|
280
451
|
includeVerification: boolean;
|
|
281
452
|
allowedWorkstreamIds: string[] | null;
|
|
282
453
|
stopAfterSlice: boolean;
|
|
283
|
-
|
|
454
|
+
ignoreSpawnGuardRateLimit: boolean;
|
|
455
|
+
maxParallelSlices: number;
|
|
456
|
+
parallelMode: "iwmt";
|
|
457
|
+
scope: SliceScope;
|
|
458
|
+
tokenBudget: number | null;
|
|
284
459
|
tokensUsed: number;
|
|
285
460
|
status: "stopped" | "running" | "stopping";
|
|
286
461
|
stopReason: ("error" | "blocked" | "completed" | "stopped" | "budget_exhausted") | null;
|
|
@@ -291,6 +466,19 @@ export declare function createAutoContinueEngine(deps: CreateAutoContinueEngineD
|
|
|
291
466
|
lastError: string | null;
|
|
292
467
|
lastTaskId: string | null;
|
|
293
468
|
lastRunId: string | null;
|
|
469
|
+
activeSliceRunIds: string[];
|
|
470
|
+
activeTaskIds: string[];
|
|
471
|
+
laneByWorkstreamId: Record<string, {
|
|
472
|
+
workstreamId: string;
|
|
473
|
+
state: "idle" | "blocked" | "completed" | "running" | "rate_limited" | "waiting_dependency";
|
|
474
|
+
activeRunId: string | null;
|
|
475
|
+
activeTaskIds: string[];
|
|
476
|
+
blockedReason: string | null;
|
|
477
|
+
waitingOnWorkstreamIds: string[];
|
|
478
|
+
retryAt: string | null;
|
|
479
|
+
updatedAt: string;
|
|
480
|
+
}>;
|
|
481
|
+
blockedWorkstreamIds: string[];
|
|
294
482
|
activeTaskId: string | null;
|
|
295
483
|
activeRunId: string | null;
|
|
296
484
|
activeTaskTokenEstimate: number | null;
|