@useorgx/openclaw-plugin 0.4.8 → 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 +38 -26
- package/dist/agent-context-store.js +84 -42
- package/dist/agent-run-store.js +49 -28
- package/dist/agent-suite.d.ts +9 -0
- package/dist/agent-suite.js +150 -17
- 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/auth/flows.d.ts +47 -0
- package/dist/auth/flows.js +169 -0
- package/dist/auth-store.js +6 -26
- package/dist/byok-store.js +5 -19
- package/dist/chat-store.d.ts +157 -0
- package/dist/chat-store.js +586 -0
- package/dist/cli/orgx.d.ts +66 -0
- package/dist/cli/orgx.js +102 -0
- package/dist/config/refresh.d.ts +32 -0
- package/dist/config/refresh.js +55 -0
- package/dist/config/resolution.d.ts +37 -0
- package/dist/config/resolution.js +178 -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 +306 -0
- package/dist/contracts/shared-types.js +179 -0
- 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 +224 -132
- package/dist/contracts/types.js +5 -0
- package/dist/entities/auto-assignment.d.ts +36 -0
- package/dist/entities/auto-assignment.js +141 -0
- package/dist/entity-comment-store.js +5 -25
- 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/hash-utils.d.ts +2 -0
- package/dist/hash-utils.js +12 -0
- package/dist/hooks/post-reporting-event.mjs +1 -5
- package/dist/http/helpers/activity-headline.d.ts +10 -0
- package/dist/http/helpers/activity-headline.js +73 -0
- package/dist/http/helpers/artifact-fallback.d.ts +13 -0
- package/dist/http/helpers/artifact-fallback.js +148 -0
- package/dist/http/helpers/auto-continue-engine.d.ts +486 -0
- package/dist/http/helpers/auto-continue-engine.js +3563 -0
- package/dist/http/helpers/autopilot-operations.d.ts +176 -0
- package/dist/http/helpers/autopilot-operations.js +554 -0
- package/dist/http/helpers/autopilot-runtime.d.ts +43 -0
- package/dist/http/helpers/autopilot-runtime.js +607 -0
- package/dist/http/helpers/autopilot-slice-utils.d.ts +56 -0
- package/dist/http/helpers/autopilot-slice-utils.js +899 -0
- package/dist/http/helpers/decision-mapper.d.ts +52 -0
- package/dist/http/helpers/decision-mapper.js +260 -0
- package/dist/http/helpers/dispatch-lifecycle.d.ts +119 -0
- package/dist/http/helpers/dispatch-lifecycle.js +809 -0
- package/dist/http/helpers/hash-utils.d.ts +1 -0
- package/dist/http/helpers/hash-utils.js +1 -0
- package/dist/http/helpers/kickoff-context.d.ts +12 -0
- package/dist/http/helpers/kickoff-context.js +228 -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 +193 -0
- package/dist/http/helpers/mission-control.js +1383 -0
- package/dist/http/helpers/openclaw-cli.d.ts +37 -0
- package/dist/http/helpers/openclaw-cli.js +283 -0
- package/dist/http/helpers/runtime-sse.d.ts +20 -0
- package/dist/http/helpers/runtime-sse.js +110 -0
- 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.d.ts +6 -0
- package/dist/http/helpers/value-utils.js +72 -0
- package/dist/http/helpers/workspace-scope.d.ts +15 -0
- package/dist/http/helpers/workspace-scope.js +170 -0
- package/dist/http/index.d.ts +88 -0
- package/dist/http/index.js +3610 -0
- package/dist/http/router.d.ts +23 -0
- package/dist/http/router.js +23 -0
- package/dist/http/routes/agent-control.d.ts +79 -0
- package/dist/http/routes/agent-control.js +684 -0
- package/dist/http/routes/agent-suite.d.ts +38 -0
- package/dist/http/routes/agent-suite.js +397 -0
- package/dist/http/routes/agents-catalog.d.ts +40 -0
- package/dist/http/routes/agents-catalog.js +128 -0
- package/dist/http/routes/billing.d.ts +23 -0
- package/dist/http/routes/billing.js +55 -0
- package/dist/http/routes/chat.d.ts +19 -0
- package/dist/http/routes/chat.js +522 -0
- package/dist/http/routes/debug.d.ts +14 -0
- package/dist/http/routes/debug.js +21 -0
- package/dist/http/routes/decision-actions.d.ts +20 -0
- package/dist/http/routes/decision-actions.js +103 -0
- package/dist/http/routes/delegation.d.ts +19 -0
- package/dist/http/routes/delegation.js +32 -0
- 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 +63 -0
- package/dist/http/routes/entities.js +440 -0
- package/dist/http/routes/entity-dynamic.d.ts +25 -0
- package/dist/http/routes/entity-dynamic.js +191 -0
- package/dist/http/routes/health.d.ts +22 -0
- package/dist/http/routes/health.js +49 -0
- package/dist/http/routes/live-legacy.d.ts +115 -0
- package/dist/http/routes/live-legacy.js +112 -0
- package/dist/http/routes/live-misc.d.ts +81 -0
- package/dist/http/routes/live-misc.js +426 -0
- package/dist/http/routes/live-snapshot.d.ts +136 -0
- package/dist/http/routes/live-snapshot.js +916 -0
- 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 +131 -0
- package/dist/http/routes/mission-control-actions.js +1791 -0
- package/dist/http/routes/mission-control-read.d.ts +73 -0
- package/dist/http/routes/mission-control-read.js +1640 -0
- package/dist/http/routes/onboarding.d.ts +34 -0
- package/dist/http/routes/onboarding.js +101 -0
- 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 +27 -0
- package/dist/http/routes/run-control.js +96 -0
- package/dist/http/routes/runtime-hooks.d.ts +69 -0
- package/dist/http/routes/runtime-hooks.js +437 -0
- package/dist/http/routes/sentinels-catalog.d.ts +7 -0
- package/dist/http/routes/sentinels-catalog.js +24 -0
- package/dist/http/routes/settings-byok.d.ts +23 -0
- package/dist/http/routes/settings-byok.js +163 -0
- package/dist/http/routes/summary.d.ts +18 -0
- package/dist/http/routes/summary.js +49 -0
- package/dist/http/routes/usage.d.ts +24 -0
- package/dist/http/routes/usage.js +362 -0
- package/dist/http/routes/work-artifacts.d.ts +9 -0
- package/dist/http/routes/work-artifacts.js +55 -0
- package/dist/http/shared-state.d.ts +16 -0
- package/dist/http/shared-state.js +1 -0
- package/dist/http-handler.d.ts +1 -88
- package/dist/http-handler.js +1 -10605
- package/dist/index.js +287 -2284
- package/dist/json-utils.d.ts +1 -0
- package/dist/json-utils.js +8 -0
- 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 +93 -25
- 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/runtime-instance-store.js +5 -31
- package/dist/services/background.d.ts +34 -0
- package/dist/services/background.js +45 -0
- package/dist/services/experiment-randomization.d.ts +21 -0
- package/dist/services/experiment-randomization.js +63 -0
- package/dist/services/instrumentation.d.ts +29 -0
- package/dist/services/instrumentation.js +136 -0
- package/dist/skill-pack-state.d.ts +36 -5
- package/dist/skill-pack-state.js +273 -29
- package/dist/snapshot-store.js +5 -25
- package/dist/stores/json-store.d.ts +11 -0
- package/dist/stores/json-store.js +42 -0
- package/dist/sync/local-agent-telemetry.d.ts +13 -0
- package/dist/sync/local-agent-telemetry.js +128 -0
- package/dist/sync/outbox-replay.d.ts +55 -0
- package/dist/sync/outbox-replay.js +621 -0
- 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 +72 -0
- package/dist/tools/core-tools.js +2270 -0
- 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/BNeJ0kpF.js +0 -1
- package/dashboard/dist/assets/BzkiMPmM.js +0 -215
- package/dashboard/dist/assets/CUV9IHHi.js +0 -1
- package/dashboard/dist/assets/Ie7d9Iq2.css +0 -1
- package/dashboard/dist/assets/sAhvFnpk.js +0 -4
package/dist/contracts/client.js
CHANGED
|
@@ -12,6 +12,12 @@ const DEFAULT_SYNC_TIMEOUT_MS = 45_000;
|
|
|
12
12
|
const USER_AGENT = "OrgX-Clawdbot-Plugin/1.0";
|
|
13
13
|
const DECISION_MUTATION_CONCURRENCY = 6;
|
|
14
14
|
const DEFAULT_CLIENT_BASE_URL = "https://www.useorgx.com";
|
|
15
|
+
function normalizeAgentStatus(value) {
|
|
16
|
+
if (value === "active" || value === "idle" || value === "throttled") {
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
return "idle";
|
|
20
|
+
}
|
|
15
21
|
function isUserScopedApiKey(apiKey) {
|
|
16
22
|
return apiKey.trim().toLowerCase().startsWith("oxk_");
|
|
17
23
|
}
|
|
@@ -184,21 +190,42 @@ export class OrgXClient {
|
|
|
184
190
|
}
|
|
185
191
|
return `?${search.toString()}`;
|
|
186
192
|
}
|
|
193
|
+
unwrapSyncResponse(response) {
|
|
194
|
+
if (response &&
|
|
195
|
+
typeof response === "object" &&
|
|
196
|
+
"data" in response &&
|
|
197
|
+
response.data) {
|
|
198
|
+
return response.data;
|
|
199
|
+
}
|
|
200
|
+
return response;
|
|
201
|
+
}
|
|
187
202
|
// ===========================================================================
|
|
188
203
|
// Org Snapshot
|
|
189
204
|
// ===========================================================================
|
|
190
205
|
async getOrgSnapshot() {
|
|
191
206
|
// Use the sync endpoint with POST (empty body = pull only)
|
|
192
207
|
const resp = await this.post("/api/client/sync", {});
|
|
193
|
-
const data = resp
|
|
208
|
+
const data = this.unwrapSyncResponse(resp);
|
|
194
209
|
// Transform SyncResponse to OrgSnapshot format
|
|
210
|
+
const syncAgents = Array.isArray(data.agents) ? data.agents : [];
|
|
195
211
|
return {
|
|
196
212
|
initiatives: data.initiatives.map(i => ({
|
|
197
213
|
id: i.id,
|
|
198
214
|
title: i.title,
|
|
199
215
|
status: i.status,
|
|
200
216
|
})),
|
|
201
|
-
agents:
|
|
217
|
+
agents: syncAgents.map((agent) => ({
|
|
218
|
+
id: String(agent.id ?? ""),
|
|
219
|
+
name: String(agent.name ?? ""),
|
|
220
|
+
domain: String(agent.domain ?? ""),
|
|
221
|
+
status: normalizeAgentStatus(agent.status),
|
|
222
|
+
currentTask: typeof agent.currentTask === "string" && agent.currentTask.trim().length > 0
|
|
223
|
+
? agent.currentTask
|
|
224
|
+
: undefined,
|
|
225
|
+
lastActive: typeof agent.lastActive === "string" && agent.lastActive.trim().length > 0
|
|
226
|
+
? agent.lastActive
|
|
227
|
+
: undefined,
|
|
228
|
+
})),
|
|
202
229
|
activeTasks: data.activeTasks.map(t => ({
|
|
203
230
|
id: t.id,
|
|
204
231
|
title: t.title,
|
|
@@ -219,13 +246,7 @@ export class OrgXClient {
|
|
|
219
246
|
// ===========================================================================
|
|
220
247
|
async syncMemory(payload) {
|
|
221
248
|
const response = await this.post("/api/client/sync", payload);
|
|
222
|
-
|
|
223
|
-
typeof response === "object" &&
|
|
224
|
-
"data" in response &&
|
|
225
|
-
response.data) {
|
|
226
|
-
return response.data;
|
|
227
|
-
}
|
|
228
|
-
return response;
|
|
249
|
+
return this.unwrapSyncResponse(response);
|
|
229
250
|
}
|
|
230
251
|
// ===========================================================================
|
|
231
252
|
// Kickoff Context
|
|
@@ -293,6 +314,20 @@ export class OrgXClient {
|
|
|
293
314
|
clearTimeout(timeout);
|
|
294
315
|
}
|
|
295
316
|
}
|
|
317
|
+
// ===========================================================================
|
|
318
|
+
// Client Agent Runtime Settings
|
|
319
|
+
// ===========================================================================
|
|
320
|
+
async getClientAgentRuntimeSettings(input) {
|
|
321
|
+
const workspaceScope = input?.workspaceId ?? input?.projectId ?? null;
|
|
322
|
+
const query = this.buildQuery({
|
|
323
|
+
workspace_id: workspaceScope,
|
|
324
|
+
command_center_id: workspaceScope,
|
|
325
|
+
});
|
|
326
|
+
return this.get(`/api/client/agents/runtime-settings${query}`);
|
|
327
|
+
}
|
|
328
|
+
async updateClientAgentRuntimeSettings(payload) {
|
|
329
|
+
return this.patch("/api/client/agents/runtime-settings", payload);
|
|
330
|
+
}
|
|
296
331
|
async delegationPreflight(payload) {
|
|
297
332
|
return this.post("/api/client/delegation/preflight", payload);
|
|
298
333
|
}
|
|
@@ -351,12 +386,34 @@ export class OrgXClient {
|
|
|
351
386
|
* PATCH /api/entities { type, id, ...updates }
|
|
352
387
|
*/
|
|
353
388
|
async updateEntity(type, id, updates) {
|
|
389
|
+
const result = await this.updateEntityDetailed(type, id, updates);
|
|
390
|
+
return result.entity;
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Update an OrgX entity and preserve reassignment metadata when present.
|
|
394
|
+
* PATCH /api/entities { type, id, ...updates }
|
|
395
|
+
*/
|
|
396
|
+
async updateEntityDetailed(type, id, updates) {
|
|
354
397
|
const resp = await this.patch("/api/entities", {
|
|
355
398
|
type,
|
|
356
399
|
id,
|
|
357
400
|
...updates,
|
|
358
401
|
});
|
|
359
|
-
|
|
402
|
+
if (resp && typeof resp === "object") {
|
|
403
|
+
const envelope = resp;
|
|
404
|
+
const entity = envelope.entity ?? envelope.data ?? resp;
|
|
405
|
+
return {
|
|
406
|
+
entity,
|
|
407
|
+
reassignment: envelope.reassignment && typeof envelope.reassignment === "object"
|
|
408
|
+
? envelope.reassignment
|
|
409
|
+
: null,
|
|
410
|
+
initiative_reassignment: envelope.initiative_reassignment &&
|
|
411
|
+
typeof envelope.initiative_reassignment === "object"
|
|
412
|
+
? envelope.initiative_reassignment
|
|
413
|
+
: null,
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
return { entity: resp };
|
|
360
417
|
}
|
|
361
418
|
/**
|
|
362
419
|
* List OrgX entities.
|
|
@@ -366,10 +423,49 @@ export class OrgXClient {
|
|
|
366
423
|
const params = new URLSearchParams({ type });
|
|
367
424
|
if (filters?.status)
|
|
368
425
|
params.set("status", filters.status);
|
|
426
|
+
if (typeof filters?.offset === "number" && Number.isFinite(filters.offset)) {
|
|
427
|
+
params.set("offset", String(Math.max(0, Math.floor(filters.offset))));
|
|
428
|
+
}
|
|
429
|
+
if (filters?.search)
|
|
430
|
+
params.set("search", String(filters.search));
|
|
431
|
+
if (filters?.id)
|
|
432
|
+
params.set("id", String(filters.id));
|
|
433
|
+
if (filters?.ids) {
|
|
434
|
+
const values = Array.isArray(filters.ids)
|
|
435
|
+
? filters.ids
|
|
436
|
+
: String(filters.ids)
|
|
437
|
+
.split(",")
|
|
438
|
+
.map((value) => value.trim())
|
|
439
|
+
.filter((value) => value.length > 0);
|
|
440
|
+
if (values.length > 0) {
|
|
441
|
+
params.set("ids", values.join(","));
|
|
442
|
+
}
|
|
443
|
+
}
|
|
369
444
|
if (filters?.limit)
|
|
370
445
|
params.set("limit", String(filters.limit));
|
|
371
446
|
if (filters?.initiative_id)
|
|
372
447
|
params.set("initiative_id", String(filters.initiative_id));
|
|
448
|
+
const legacyProjectIdRaw = filters?.project_id != null ? String(filters.project_id) : null;
|
|
449
|
+
const workspaceIdRaw = filters?.workspace_id != null ? String(filters.workspace_id) : null;
|
|
450
|
+
const commandCenterIdRaw = filters?.command_center_id != null
|
|
451
|
+
? String(filters.command_center_id)
|
|
452
|
+
: null;
|
|
453
|
+
if (workspaceIdRaw &&
|
|
454
|
+
commandCenterIdRaw &&
|
|
455
|
+
workspaceIdRaw.trim() !== commandCenterIdRaw.trim()) {
|
|
456
|
+
throw new Error("workspace_id and command_center_id must match when both are provided");
|
|
457
|
+
}
|
|
458
|
+
if (legacyProjectIdRaw &&
|
|
459
|
+
workspaceIdRaw &&
|
|
460
|
+
legacyProjectIdRaw.trim() !== workspaceIdRaw.trim()) {
|
|
461
|
+
throw new Error("project_id cannot differ from workspace_id; use workspace_id as canonical scope");
|
|
462
|
+
}
|
|
463
|
+
const workspaceId = workspaceIdRaw ?? commandCenterIdRaw ?? legacyProjectIdRaw;
|
|
464
|
+
if (workspaceId) {
|
|
465
|
+
// Canonical scope param. Keep legacy alias for backward compatibility.
|
|
466
|
+
params.set("workspace_id", workspaceId);
|
|
467
|
+
params.set("command_center_id", workspaceId);
|
|
468
|
+
}
|
|
373
469
|
return this.get(`/api/entities?${params.toString()}`);
|
|
374
470
|
}
|
|
375
471
|
// ===========================================================================
|
|
@@ -397,6 +493,18 @@ export class OrgXClient {
|
|
|
397
493
|
return response;
|
|
398
494
|
}
|
|
399
495
|
// ===========================================================================
|
|
496
|
+
// Usage (Control Plane + Forecast)
|
|
497
|
+
// ===========================================================================
|
|
498
|
+
async getUsageControlPlaneSummary() {
|
|
499
|
+
return this.get("/api/usage/control-plane/summary");
|
|
500
|
+
}
|
|
501
|
+
async getUsageUnified() {
|
|
502
|
+
return this.get("/api/usage/unified");
|
|
503
|
+
}
|
|
504
|
+
async getUsageForecast() {
|
|
505
|
+
return this.get("/api/usage/forecast");
|
|
506
|
+
}
|
|
507
|
+
// ===========================================================================
|
|
400
508
|
// Reporting Control Plane
|
|
401
509
|
// ===========================================================================
|
|
402
510
|
async emitActivity(payload) {
|
|
@@ -443,31 +551,44 @@ export class OrgXClient {
|
|
|
443
551
|
// Live Sessions + Activity + Handoffs
|
|
444
552
|
// ===========================================================================
|
|
445
553
|
async getLiveSessions(params) {
|
|
554
|
+
const workspaceScope = params?.workspaceId ?? params?.projectId ?? null;
|
|
446
555
|
const query = this.buildQuery({
|
|
447
556
|
limit: params?.limit,
|
|
448
557
|
initiative: params?.initiative ?? null,
|
|
558
|
+
workspace_id: workspaceScope,
|
|
559
|
+
command_center_id: workspaceScope,
|
|
449
560
|
});
|
|
450
561
|
return this.get(`/api/client/live/sessions${query}`);
|
|
451
562
|
}
|
|
452
563
|
async getLiveActivity(params) {
|
|
564
|
+
const workspaceScope = params?.workspaceId ?? params?.projectId ?? null;
|
|
453
565
|
const query = this.buildQuery({
|
|
454
566
|
limit: params?.limit,
|
|
455
567
|
run: params?.run ?? null,
|
|
456
568
|
since: params?.since ?? null,
|
|
569
|
+
workspace_id: workspaceScope,
|
|
570
|
+
command_center_id: workspaceScope,
|
|
457
571
|
});
|
|
458
572
|
return this.get(`/api/client/live/activity${query}`);
|
|
459
573
|
}
|
|
460
574
|
async getLiveAgents(params) {
|
|
575
|
+
const workspaceScope = params?.workspaceId ?? params?.projectId ?? null;
|
|
461
576
|
const query = this.buildQuery({
|
|
462
577
|
initiative: params?.initiative ?? null,
|
|
463
578
|
include_idle: params?.includeIdle ?? undefined,
|
|
579
|
+
workspace_id: workspaceScope,
|
|
580
|
+
command_center_id: workspaceScope,
|
|
464
581
|
});
|
|
465
582
|
return this.get(`/api/client/live/agents${query}`);
|
|
466
583
|
}
|
|
467
584
|
async getLiveInitiatives(params) {
|
|
585
|
+
const workspaceScope = params?.workspaceId ?? params?.projectId ?? null;
|
|
468
586
|
const query = this.buildQuery({
|
|
469
587
|
id: params?.id ?? null,
|
|
470
588
|
limit: params?.limit ?? null,
|
|
589
|
+
offset: params?.offset ?? null,
|
|
590
|
+
workspace_id: workspaceScope,
|
|
591
|
+
command_center_id: workspaceScope,
|
|
471
592
|
});
|
|
472
593
|
return this.get(`/api/client/live/initiatives${query}`);
|
|
473
594
|
}
|
|
@@ -493,9 +614,12 @@ export class OrgXClient {
|
|
|
493
614
|
return this.post(`/api/client/runs/${encodedRunId}/checkpoints/${encodedCheckpointId}/restore`, { reason: request.reason });
|
|
494
615
|
}
|
|
495
616
|
async getLiveDecisions(params) {
|
|
617
|
+
const workspaceScope = params?.workspaceId ?? params?.projectId ?? undefined;
|
|
496
618
|
const response = await this.listEntities("decision", {
|
|
497
619
|
status: params?.status,
|
|
498
620
|
limit: params?.limit,
|
|
621
|
+
workspace_id: workspaceScope,
|
|
622
|
+
command_center_id: workspaceScope,
|
|
499
623
|
});
|
|
500
624
|
const decisions = Array.isArray(response.data) ? response.data : [];
|
|
501
625
|
return {
|
|
@@ -503,32 +627,37 @@ export class OrgXClient {
|
|
|
503
627
|
total: response.pagination?.total ?? decisions.length,
|
|
504
628
|
};
|
|
505
629
|
}
|
|
506
|
-
async decideDecision(id, action,
|
|
507
|
-
const
|
|
508
|
-
const
|
|
630
|
+
async decideDecision(id, action, input) {
|
|
631
|
+
const note = input?.note?.trim() || null;
|
|
632
|
+
const optionId = input?.optionId?.trim() || null;
|
|
633
|
+
const resolvedStatus = action === "approve" ? "approved" : "declined";
|
|
634
|
+
const primaryPatch = {
|
|
635
|
+
status: resolvedStatus,
|
|
636
|
+
...(note ? { resolution_summary: note } : {}),
|
|
637
|
+
...(optionId ? { option_id: optionId } : {}),
|
|
638
|
+
};
|
|
509
639
|
try {
|
|
510
|
-
return await this.updateEntity("decision", id,
|
|
511
|
-
status: resolvedStatus,
|
|
512
|
-
resolution: resolvedStatus,
|
|
513
|
-
resolved_at: resolvedAt,
|
|
514
|
-
decided_at: resolvedAt,
|
|
515
|
-
decided_by: this.userId || undefined,
|
|
516
|
-
note: note ?? undefined,
|
|
517
|
-
});
|
|
640
|
+
return await this.updateEntity("decision", id, primaryPatch);
|
|
518
641
|
}
|
|
519
642
|
catch {
|
|
520
|
-
//
|
|
643
|
+
// Keep fallback payload schema-safe for strict entity routes.
|
|
521
644
|
return this.updateEntity("decision", id, {
|
|
522
|
-
status:
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
645
|
+
status: resolvedStatus,
|
|
646
|
+
...(note
|
|
647
|
+
? {
|
|
648
|
+
metadata: {
|
|
649
|
+
resolution: {
|
|
650
|
+
summary: note,
|
|
651
|
+
note,
|
|
652
|
+
},
|
|
653
|
+
},
|
|
654
|
+
}
|
|
655
|
+
: {}),
|
|
656
|
+
...(optionId ? { option_id: optionId } : {}),
|
|
528
657
|
});
|
|
529
658
|
}
|
|
530
659
|
}
|
|
531
|
-
async bulkDecideDecisions(ids, action,
|
|
660
|
+
async bulkDecideDecisions(ids, action, input) {
|
|
532
661
|
const uniqueIds = Array.from(new Set(ids.filter(Boolean)));
|
|
533
662
|
const results = new Array(uniqueIds.length);
|
|
534
663
|
let cursor = 0;
|
|
@@ -541,7 +670,7 @@ export class OrgXClient {
|
|
|
541
670
|
}
|
|
542
671
|
const id = uniqueIds[index];
|
|
543
672
|
try {
|
|
544
|
-
const entity = await this.decideDecision(id, action,
|
|
673
|
+
const entity = await this.decideDecision(id, action, input);
|
|
545
674
|
results[index] = { id, ok: true, entity };
|
|
546
675
|
}
|
|
547
676
|
catch (err) {
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export declare const RETRO_ARTIFACT_SCHEMA_VERSION: "retro.v1";
|
|
2
|
+
export type RetroArtifactSchemaVersion = typeof RETRO_ARTIFACT_SCHEMA_VERSION;
|
|
3
|
+
export declare const RETRO_ARTIFACT_JSON_SCHEMA: {
|
|
4
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
5
|
+
readonly $id: "https://schemas.useorgx.com/retro-artifact/v1.json";
|
|
6
|
+
readonly title: "OrgX Run Retro Artifact v1";
|
|
7
|
+
readonly description: "Structured post-run retrospective artifact emitted by OpenClaw/OrgX execution paths.";
|
|
8
|
+
readonly type: "object";
|
|
9
|
+
readonly additionalProperties: false;
|
|
10
|
+
readonly required: readonly ["schema_version", "summary"];
|
|
11
|
+
readonly properties: {
|
|
12
|
+
readonly schema_version: {
|
|
13
|
+
readonly type: "string";
|
|
14
|
+
readonly const: "retro.v1";
|
|
15
|
+
readonly description: "Version marker for safe schema evolution.";
|
|
16
|
+
};
|
|
17
|
+
readonly summary: {
|
|
18
|
+
readonly type: "string";
|
|
19
|
+
readonly minLength: 1;
|
|
20
|
+
readonly maxLength: 4000;
|
|
21
|
+
readonly description: "Required high-level run retrospective summary.";
|
|
22
|
+
};
|
|
23
|
+
readonly what_went_well: {
|
|
24
|
+
readonly type: "array";
|
|
25
|
+
readonly maxItems: 25;
|
|
26
|
+
readonly items: {
|
|
27
|
+
readonly type: "string";
|
|
28
|
+
readonly minLength: 1;
|
|
29
|
+
readonly maxLength: 1000;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
readonly what_went_wrong: {
|
|
33
|
+
readonly type: "array";
|
|
34
|
+
readonly maxItems: 25;
|
|
35
|
+
readonly items: {
|
|
36
|
+
readonly type: "string";
|
|
37
|
+
readonly minLength: 1;
|
|
38
|
+
readonly maxLength: 1000;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
readonly decisions: {
|
|
42
|
+
readonly type: "array";
|
|
43
|
+
readonly maxItems: 25;
|
|
44
|
+
readonly items: {
|
|
45
|
+
readonly type: "string";
|
|
46
|
+
readonly minLength: 1;
|
|
47
|
+
readonly maxLength: 1000;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
readonly follow_ups: {
|
|
51
|
+
readonly type: "array";
|
|
52
|
+
readonly maxItems: 25;
|
|
53
|
+
readonly items: {
|
|
54
|
+
readonly type: "object";
|
|
55
|
+
readonly additionalProperties: false;
|
|
56
|
+
readonly required: readonly ["title"];
|
|
57
|
+
readonly properties: {
|
|
58
|
+
readonly title: {
|
|
59
|
+
readonly type: "string";
|
|
60
|
+
readonly minLength: 1;
|
|
61
|
+
readonly maxLength: 500;
|
|
62
|
+
};
|
|
63
|
+
readonly priority: {
|
|
64
|
+
readonly type: "string";
|
|
65
|
+
readonly enum: readonly ["p0", "p1", "p2"];
|
|
66
|
+
};
|
|
67
|
+
readonly reason: {
|
|
68
|
+
readonly type: "string";
|
|
69
|
+
readonly minLength: 1;
|
|
70
|
+
readonly maxLength: 2000;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
readonly signals: {
|
|
76
|
+
readonly type: "object";
|
|
77
|
+
readonly additionalProperties: true;
|
|
78
|
+
readonly description: "Telemetry-style structured metadata for analytics and drill-down.";
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export const RETRO_ARTIFACT_SCHEMA_VERSION = 'retro.v1';
|
|
2
|
+
export const RETRO_ARTIFACT_JSON_SCHEMA = {
|
|
3
|
+
$schema: 'https://json-schema.org/draft/2020-12/schema',
|
|
4
|
+
$id: 'https://schemas.useorgx.com/retro-artifact/v1.json',
|
|
5
|
+
title: 'OrgX Run Retro Artifact v1',
|
|
6
|
+
description: 'Structured post-run retrospective artifact emitted by OpenClaw/OrgX execution paths.',
|
|
7
|
+
type: 'object',
|
|
8
|
+
additionalProperties: false,
|
|
9
|
+
required: ['schema_version', 'summary'],
|
|
10
|
+
properties: {
|
|
11
|
+
schema_version: {
|
|
12
|
+
type: 'string',
|
|
13
|
+
const: RETRO_ARTIFACT_SCHEMA_VERSION,
|
|
14
|
+
description: 'Version marker for safe schema evolution.',
|
|
15
|
+
},
|
|
16
|
+
summary: {
|
|
17
|
+
type: 'string',
|
|
18
|
+
minLength: 1,
|
|
19
|
+
maxLength: 4000,
|
|
20
|
+
description: 'Required high-level run retrospective summary.',
|
|
21
|
+
},
|
|
22
|
+
what_went_well: {
|
|
23
|
+
type: 'array',
|
|
24
|
+
maxItems: 25,
|
|
25
|
+
items: {
|
|
26
|
+
type: 'string',
|
|
27
|
+
minLength: 1,
|
|
28
|
+
maxLength: 1000,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
what_went_wrong: {
|
|
32
|
+
type: 'array',
|
|
33
|
+
maxItems: 25,
|
|
34
|
+
items: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
minLength: 1,
|
|
37
|
+
maxLength: 1000,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
decisions: {
|
|
41
|
+
type: 'array',
|
|
42
|
+
maxItems: 25,
|
|
43
|
+
items: {
|
|
44
|
+
type: 'string',
|
|
45
|
+
minLength: 1,
|
|
46
|
+
maxLength: 1000,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
follow_ups: {
|
|
50
|
+
type: 'array',
|
|
51
|
+
maxItems: 25,
|
|
52
|
+
items: {
|
|
53
|
+
type: 'object',
|
|
54
|
+
additionalProperties: false,
|
|
55
|
+
required: ['title'],
|
|
56
|
+
properties: {
|
|
57
|
+
title: {
|
|
58
|
+
type: 'string',
|
|
59
|
+
minLength: 1,
|
|
60
|
+
maxLength: 500,
|
|
61
|
+
},
|
|
62
|
+
priority: {
|
|
63
|
+
type: 'string',
|
|
64
|
+
enum: ['p0', 'p1', 'p2'],
|
|
65
|
+
},
|
|
66
|
+
reason: {
|
|
67
|
+
type: 'string',
|
|
68
|
+
minLength: 1,
|
|
69
|
+
maxLength: 2000,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
signals: {
|
|
75
|
+
type: 'object',
|
|
76
|
+
additionalProperties: true,
|
|
77
|
+
description: 'Telemetry-style structured metadata for analytics and drill-down.',
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
};
|