@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
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
export const OPENCLAW_SKILL_PACK_SCHEMA_VERSION = "openclaw-skill-pack.v1";
|
|
2
|
+
export const ORGX_AGENT_DOMAINS = [
|
|
3
|
+
"engineering",
|
|
4
|
+
"product",
|
|
5
|
+
"design",
|
|
6
|
+
"marketing",
|
|
7
|
+
"sales",
|
|
8
|
+
"operations",
|
|
9
|
+
"orchestration",
|
|
10
|
+
];
|
|
11
|
+
const DOMAIN_SET = new Set(ORGX_AGENT_DOMAINS);
|
|
12
|
+
function isRecord(value) {
|
|
13
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
14
|
+
}
|
|
15
|
+
function hasOwn(record, key) {
|
|
16
|
+
return Object.prototype.hasOwnProperty.call(record, key);
|
|
17
|
+
}
|
|
18
|
+
const DOMAIN_STRING_SCHEMA = {
|
|
19
|
+
type: "string",
|
|
20
|
+
minLength: 1,
|
|
21
|
+
};
|
|
22
|
+
export const OPENCLAW_SKILLS_MAP_JSON_SCHEMA = {
|
|
23
|
+
type: "object",
|
|
24
|
+
additionalProperties: false,
|
|
25
|
+
properties: {
|
|
26
|
+
engineering: DOMAIN_STRING_SCHEMA,
|
|
27
|
+
product: DOMAIN_STRING_SCHEMA,
|
|
28
|
+
design: DOMAIN_STRING_SCHEMA,
|
|
29
|
+
marketing: DOMAIN_STRING_SCHEMA,
|
|
30
|
+
sales: DOMAIN_STRING_SCHEMA,
|
|
31
|
+
operations: DOMAIN_STRING_SCHEMA,
|
|
32
|
+
orchestration: DOMAIN_STRING_SCHEMA,
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
export const OPENCLAW_SKILL_PACK_MANIFEST_JSON_SCHEMA = {
|
|
36
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
37
|
+
$id: "https://schemas.useorgx.com/openclaw-skill-pack/v1.json",
|
|
38
|
+
title: "OrgX OpenClaw Skill Pack Manifest",
|
|
39
|
+
description: "Behavior config manifest for OpenClaw skill overrides by domain.",
|
|
40
|
+
type: "object",
|
|
41
|
+
additionalProperties: true,
|
|
42
|
+
oneOf: [
|
|
43
|
+
{
|
|
44
|
+
type: "object",
|
|
45
|
+
additionalProperties: true,
|
|
46
|
+
properties: {
|
|
47
|
+
schema_version: { type: "string", const: OPENCLAW_SKILL_PACK_SCHEMA_VERSION },
|
|
48
|
+
openclaw_skills: OPENCLAW_SKILLS_MAP_JSON_SCHEMA,
|
|
49
|
+
},
|
|
50
|
+
required: ["openclaw_skills"],
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
type: "object",
|
|
54
|
+
additionalProperties: true,
|
|
55
|
+
properties: {
|
|
56
|
+
schema_version: { type: "string", const: OPENCLAW_SKILL_PACK_SCHEMA_VERSION },
|
|
57
|
+
openclawSkills: OPENCLAW_SKILLS_MAP_JSON_SCHEMA,
|
|
58
|
+
},
|
|
59
|
+
required: ["openclawSkills"],
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
type: "object",
|
|
63
|
+
additionalProperties: true,
|
|
64
|
+
properties: {
|
|
65
|
+
schema_version: { type: "string", const: OPENCLAW_SKILL_PACK_SCHEMA_VERSION },
|
|
66
|
+
openclaw: {
|
|
67
|
+
type: "object",
|
|
68
|
+
additionalProperties: true,
|
|
69
|
+
properties: {
|
|
70
|
+
skills: OPENCLAW_SKILLS_MAP_JSON_SCHEMA,
|
|
71
|
+
},
|
|
72
|
+
required: ["skills"],
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
required: ["openclaw"],
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
};
|
|
79
|
+
function resolveManifestConfigType(manifest) {
|
|
80
|
+
const hasOpenclawSkills = hasOwn(manifest, "openclaw_skills");
|
|
81
|
+
const hasOpenclawSkillsCamel = hasOwn(manifest, "openclawSkills");
|
|
82
|
+
const openclaw = manifest.openclaw;
|
|
83
|
+
const hasOpenclawNestedSkills = isRecord(openclaw) && hasOwn(openclaw, "skills");
|
|
84
|
+
const errors = [];
|
|
85
|
+
const selectedConfigTypes = [
|
|
86
|
+
hasOpenclawSkills ? "openclaw_skills" : null,
|
|
87
|
+
hasOpenclawSkillsCamel ? "openclawSkills" : null,
|
|
88
|
+
hasOpenclawNestedSkills ? "openclaw.skills" : null,
|
|
89
|
+
].filter((value) => value !== null);
|
|
90
|
+
if (selectedConfigTypes.length > 1) {
|
|
91
|
+
errors.push("manifest must define only one config container: openclaw_skills, openclawSkills, or openclaw.skills");
|
|
92
|
+
}
|
|
93
|
+
if (hasOpenclawSkills) {
|
|
94
|
+
const value = manifest.openclaw_skills;
|
|
95
|
+
if (!isRecord(value)) {
|
|
96
|
+
return {
|
|
97
|
+
type: "openclaw_skills",
|
|
98
|
+
rawMap: null,
|
|
99
|
+
errors: [...errors, "manifest.openclaw_skills must be an object"],
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
return { type: "openclaw_skills", rawMap: value, errors };
|
|
103
|
+
}
|
|
104
|
+
if (hasOpenclawSkillsCamel) {
|
|
105
|
+
const value = manifest.openclawSkills;
|
|
106
|
+
if (!isRecord(value)) {
|
|
107
|
+
return {
|
|
108
|
+
type: "openclawSkills",
|
|
109
|
+
rawMap: null,
|
|
110
|
+
errors: [...errors, "manifest.openclawSkills must be an object"],
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
return { type: "openclawSkills", rawMap: value, errors };
|
|
114
|
+
}
|
|
115
|
+
if (hasOpenclawNestedSkills) {
|
|
116
|
+
const value = openclaw.skills;
|
|
117
|
+
if (!isRecord(value)) {
|
|
118
|
+
return {
|
|
119
|
+
type: "openclaw.skills",
|
|
120
|
+
rawMap: null,
|
|
121
|
+
errors: [...errors, "manifest.openclaw.skills must be an object"],
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
return { type: "openclaw.skills", rawMap: value, errors };
|
|
125
|
+
}
|
|
126
|
+
return { type: "none", rawMap: null, errors };
|
|
127
|
+
}
|
|
128
|
+
export function validateOpenClawSkillPackManifest(manifest) {
|
|
129
|
+
if (!isRecord(manifest)) {
|
|
130
|
+
return {
|
|
131
|
+
ok: false,
|
|
132
|
+
configType: "none",
|
|
133
|
+
openclaw_skills: {},
|
|
134
|
+
errors: ["manifest must be an object"],
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
const errors = [];
|
|
138
|
+
if ("schema_version" in manifest) {
|
|
139
|
+
const version = manifest.schema_version;
|
|
140
|
+
if (typeof version !== "string") {
|
|
141
|
+
errors.push("manifest.schema_version must be a string");
|
|
142
|
+
}
|
|
143
|
+
else if (version.trim() !== OPENCLAW_SKILL_PACK_SCHEMA_VERSION) {
|
|
144
|
+
errors.push(`manifest.schema_version must equal "${OPENCLAW_SKILL_PACK_SCHEMA_VERSION}"`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
const { type, rawMap, errors: manifestConfigErrors } = resolveManifestConfigType(manifest);
|
|
148
|
+
errors.push(...manifestConfigErrors);
|
|
149
|
+
if (!rawMap) {
|
|
150
|
+
return {
|
|
151
|
+
ok: errors.length === 0,
|
|
152
|
+
configType: type,
|
|
153
|
+
openclaw_skills: {},
|
|
154
|
+
errors,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
const openclaw_skills = {};
|
|
158
|
+
for (const [domain, rawValue] of Object.entries(rawMap)) {
|
|
159
|
+
if (!DOMAIN_SET.has(domain)) {
|
|
160
|
+
errors.push(`unknown domain key "${domain}" in manifest ${type}`);
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
if (typeof rawValue !== "string") {
|
|
164
|
+
errors.push(`manifest ${type}.${domain} must be a string`);
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
const normalized = rawValue.trim();
|
|
168
|
+
if (!normalized) {
|
|
169
|
+
errors.push(`manifest ${type}.${domain} must not be empty`);
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
openclaw_skills[domain] = normalized;
|
|
173
|
+
}
|
|
174
|
+
return {
|
|
175
|
+
ok: errors.length === 0,
|
|
176
|
+
configType: type,
|
|
177
|
+
openclaw_skills,
|
|
178
|
+
errors,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
* Types for the plugin's API client and tool interfaces.
|
|
5
5
|
* Mirrors the server-side types in orgx/lib/client-integration/types.ts
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
import type { DecisionActionType } from './shared-types.js';
|
|
8
|
+
import type { RetroArtifactSchemaVersion } from './retro-schema.js';
|
|
9
|
+
export type { ActivityEventName, HandoffEvent, HandoffSummary, LiveActivityItem, LiveActivityType, LiveDecision, OnboardingKeySource, OnboardingNextAction, OnboardingState, OnboardingStatus, RunPhase, RuntimeInstance, RuntimeInstanceState, RuntimeProviderLogo, RuntimeSourceClient, SessionBlockerContext, SessionBlockerDiagnostics, SessionTreeEdge, SessionTreeGroup, SessionTreeNode, SessionTreeResponse, } from './shared-types.js';
|
|
8
10
|
export interface OrgXConfig {
|
|
9
11
|
/** OrgX API key */
|
|
10
12
|
apiKey: string;
|
|
@@ -81,6 +83,29 @@ export interface KickoffContext {
|
|
|
81
83
|
collaboration_style?: string | null;
|
|
82
84
|
defaults?: string[] | null;
|
|
83
85
|
} | null;
|
|
86
|
+
runtime_settings?: {
|
|
87
|
+
decision_v2_enabled?: boolean;
|
|
88
|
+
decision_dedupe_enabled?: boolean;
|
|
89
|
+
decision_evidence_required_for_blocking?: boolean;
|
|
90
|
+
decision_auto_resolve_guarded_enabled?: boolean;
|
|
91
|
+
custom_run_instructions?: string | null;
|
|
92
|
+
} | null;
|
|
93
|
+
/** Recent team activity for cross-agent awareness. */
|
|
94
|
+
team_context?: {
|
|
95
|
+
recent_completions?: Array<{
|
|
96
|
+
domain: string;
|
|
97
|
+
task_title: string;
|
|
98
|
+
summary: string;
|
|
99
|
+
key_outputs?: string[];
|
|
100
|
+
completed_at: string;
|
|
101
|
+
}>;
|
|
102
|
+
recent_decisions?: Array<{
|
|
103
|
+
title: string;
|
|
104
|
+
resolution: string;
|
|
105
|
+
affected_domains?: string[];
|
|
106
|
+
resolved_at: string;
|
|
107
|
+
}>;
|
|
108
|
+
} | null;
|
|
84
109
|
}
|
|
85
110
|
export type KickoffContextRequest = KickoffContextScope & {
|
|
86
111
|
agent_id?: string | null;
|
|
@@ -124,6 +149,42 @@ export type OrgxAgentPack = {
|
|
|
124
149
|
agents: OrgxAgentProfile[];
|
|
125
150
|
managed_files: string[];
|
|
126
151
|
};
|
|
152
|
+
export interface AgentRuntimeSettingsPayload {
|
|
153
|
+
decision_v2_enabled?: boolean;
|
|
154
|
+
decision_dedupe_enabled?: boolean;
|
|
155
|
+
decision_evidence_required_for_blocking?: boolean;
|
|
156
|
+
decision_auto_resolve_guarded_enabled?: boolean;
|
|
157
|
+
custom_run_instructions?: string | null;
|
|
158
|
+
}
|
|
159
|
+
export interface ClientRuntimeSettingsAgent {
|
|
160
|
+
id: string;
|
|
161
|
+
name: string;
|
|
162
|
+
type: string;
|
|
163
|
+
status: string;
|
|
164
|
+
model: string | null;
|
|
165
|
+
runtime_settings: AgentRuntimeSettingsPayload;
|
|
166
|
+
}
|
|
167
|
+
export type ClientRuntimeSettingsResponse = {
|
|
168
|
+
ok: true;
|
|
169
|
+
workspace_id?: string | null;
|
|
170
|
+
/** Legacy alias retained for backward compatibility */
|
|
171
|
+
project_id?: string | null;
|
|
172
|
+
agents?: ClientRuntimeSettingsAgent[];
|
|
173
|
+
agent?: ClientRuntimeSettingsAgent;
|
|
174
|
+
} | {
|
|
175
|
+
ok: false;
|
|
176
|
+
error: string;
|
|
177
|
+
};
|
|
178
|
+
export interface ClientRuntimeSettingsUpdateRequest {
|
|
179
|
+
/** Canonical workspace scope */
|
|
180
|
+
workspace_id?: string;
|
|
181
|
+
/** Legacy alias retained for backward compatibility */
|
|
182
|
+
command_center_id?: string;
|
|
183
|
+
/** Legacy alias retained for backward compatibility */
|
|
184
|
+
project_id?: string;
|
|
185
|
+
agent_id: string;
|
|
186
|
+
runtime_settings: AgentRuntimeSettingsPayload;
|
|
187
|
+
}
|
|
127
188
|
export type SkillPack = {
|
|
128
189
|
name: string;
|
|
129
190
|
version: string;
|
|
@@ -184,6 +245,8 @@ export interface SyncPayload {
|
|
|
184
245
|
memory?: string;
|
|
185
246
|
/** Today's session log */
|
|
186
247
|
dailyLog?: string;
|
|
248
|
+
/** Local OpenClaw agent states to mirror into OrgX */
|
|
249
|
+
agents?: AgentState[];
|
|
187
250
|
/** Workspace state for local↔cloud handoff continuity */
|
|
188
251
|
workspaceState?: HandoffWorkspaceState;
|
|
189
252
|
/** Decisions made this session */
|
|
@@ -205,6 +268,8 @@ export interface SyncResponse {
|
|
|
205
268
|
title: string;
|
|
206
269
|
status: string;
|
|
207
270
|
}>;
|
|
271
|
+
/** Agent states (optional for backward compatibility with older servers) */
|
|
272
|
+
agents?: AgentState[];
|
|
208
273
|
/** In-progress tasks */
|
|
209
274
|
activeTasks: Array<{
|
|
210
275
|
id: string;
|
|
@@ -249,6 +314,80 @@ export interface BillingUrlResult {
|
|
|
249
314
|
url: string | null;
|
|
250
315
|
checkout_url?: string | null;
|
|
251
316
|
}
|
|
317
|
+
export type UsageRiskLevel = "safe" | "watch" | "at_risk" | "over_limit";
|
|
318
|
+
export type UsageBreakdownBucket = {
|
|
319
|
+
key: string;
|
|
320
|
+
label: string;
|
|
321
|
+
runs: number;
|
|
322
|
+
tokens: number;
|
|
323
|
+
minutes: number;
|
|
324
|
+
costCents: number;
|
|
325
|
+
};
|
|
326
|
+
export type UsagePrediction = {
|
|
327
|
+
agentRuns: number;
|
|
328
|
+
agentMinutes: number;
|
|
329
|
+
tokens: number;
|
|
330
|
+
costCents: number;
|
|
331
|
+
confidence: number;
|
|
332
|
+
method: string;
|
|
333
|
+
remainingAgentRuns: number;
|
|
334
|
+
remainingAgentMinutes: number;
|
|
335
|
+
remainingTokens: number;
|
|
336
|
+
remainingCostCents: number;
|
|
337
|
+
};
|
|
338
|
+
export type UsageControlPlaneSummary = {
|
|
339
|
+
generatedAt: string;
|
|
340
|
+
period: {
|
|
341
|
+
start: string;
|
|
342
|
+
end: string;
|
|
343
|
+
daysTotal: number;
|
|
344
|
+
daysElapsed: number;
|
|
345
|
+
daysRemaining: number;
|
|
346
|
+
};
|
|
347
|
+
plan: {
|
|
348
|
+
id: string;
|
|
349
|
+
name: string;
|
|
350
|
+
allowsOverage: boolean;
|
|
351
|
+
includedBudgetCents: number;
|
|
352
|
+
overageBudgetCents: number;
|
|
353
|
+
agentRunsLimit: number;
|
|
354
|
+
agentMinutesLimit: number;
|
|
355
|
+
scaffoldsLimit: number;
|
|
356
|
+
};
|
|
357
|
+
actual: {
|
|
358
|
+
agentRuns: number;
|
|
359
|
+
agentMinutes: number;
|
|
360
|
+
tokens: number;
|
|
361
|
+
costCents: number;
|
|
362
|
+
scaffoldsUsed: number;
|
|
363
|
+
scaffoldsRemaining: number;
|
|
364
|
+
};
|
|
365
|
+
predicted: UsagePrediction;
|
|
366
|
+
utilization: {
|
|
367
|
+
runsPct: number | null;
|
|
368
|
+
minutesPct: number | null;
|
|
369
|
+
budgetPct: number | null;
|
|
370
|
+
};
|
|
371
|
+
headroom: {
|
|
372
|
+
agentRunsRemaining: number;
|
|
373
|
+
agentMinutesRemaining: number;
|
|
374
|
+
budgetRemainingCents: number;
|
|
375
|
+
};
|
|
376
|
+
risk: UsageRiskLevel;
|
|
377
|
+
breakdown: {
|
|
378
|
+
provider: UsageBreakdownBucket[];
|
|
379
|
+
executionTarget: UsageBreakdownBucket[];
|
|
380
|
+
sourceClient: UsageBreakdownBucket[];
|
|
381
|
+
model: UsageBreakdownBucket[];
|
|
382
|
+
};
|
|
383
|
+
velocity: {
|
|
384
|
+
windowDays: number;
|
|
385
|
+
dailyAvgRuns: number;
|
|
386
|
+
dailyAvgMinutes: number;
|
|
387
|
+
dailyAvgTokens: number;
|
|
388
|
+
dailyAvgCostCents: number;
|
|
389
|
+
};
|
|
390
|
+
};
|
|
252
391
|
export interface HandoffWorkspaceState {
|
|
253
392
|
git?: {
|
|
254
393
|
branch?: string | null;
|
|
@@ -377,14 +516,61 @@ export interface EntityUpdatePayload {
|
|
|
377
516
|
export interface EntityListFilters {
|
|
378
517
|
status?: string;
|
|
379
518
|
limit?: number;
|
|
519
|
+
offset?: number;
|
|
520
|
+
search?: string;
|
|
521
|
+
id?: string;
|
|
522
|
+
ids?: string[] | string;
|
|
523
|
+
initiative_id?: string;
|
|
524
|
+
project_id?: string;
|
|
525
|
+
/** Canonical workspace scope */
|
|
526
|
+
workspace_id?: string;
|
|
527
|
+
/** Legacy alias for workspace_id */
|
|
528
|
+
command_center_id?: string;
|
|
380
529
|
[key: string]: unknown;
|
|
381
530
|
}
|
|
531
|
+
export interface WorkstreamReassignmentStatus {
|
|
532
|
+
scheduled: boolean;
|
|
533
|
+
requestId?: string | null;
|
|
534
|
+
dueAt?: string | null;
|
|
535
|
+
reason?: string;
|
|
536
|
+
}
|
|
537
|
+
export interface InitiativeReassignmentStatus {
|
|
538
|
+
triggered: boolean;
|
|
539
|
+
requested: number;
|
|
540
|
+
scheduled: number;
|
|
541
|
+
skipped: number;
|
|
542
|
+
failures: string[];
|
|
543
|
+
}
|
|
544
|
+
export interface EntityUpdateResult {
|
|
545
|
+
entity: Entity;
|
|
546
|
+
reassignment?: WorkstreamReassignmentStatus | null;
|
|
547
|
+
initiative_reassignment?: InitiativeReassignmentStatus | null;
|
|
548
|
+
}
|
|
382
549
|
export type ReportingSourceClient = 'openclaw' | 'codex' | 'claude-code' | 'api';
|
|
383
550
|
export type ReportingPhase = 'intent' | 'execution' | 'blocked' | 'review' | 'handoff' | 'completed';
|
|
384
551
|
export type ReportingLevel = 'info' | 'warn' | 'error';
|
|
385
552
|
export type TaskStatus = 'todo' | 'in_progress' | 'done' | 'blocked';
|
|
386
553
|
export type MilestoneStatus = 'planned' | 'in_progress' | 'completed' | 'at_risk' | 'cancelled';
|
|
387
554
|
export type DecisionUrgency = 'low' | 'medium' | 'high' | 'urgent';
|
|
555
|
+
export type DecisionOptionImpliedStatus = 'approved' | 'declined' | 'cancelled' | 'rejected';
|
|
556
|
+
export interface DecisionCreateOption {
|
|
557
|
+
id?: string;
|
|
558
|
+
label: string;
|
|
559
|
+
description?: string;
|
|
560
|
+
implied_status?: DecisionOptionImpliedStatus;
|
|
561
|
+
action_type?: DecisionActionType;
|
|
562
|
+
requires_note?: boolean;
|
|
563
|
+
}
|
|
564
|
+
export interface DecisionEvidenceRef {
|
|
565
|
+
evidence_type?: string;
|
|
566
|
+
title?: string;
|
|
567
|
+
summary?: string;
|
|
568
|
+
source_url?: string;
|
|
569
|
+
source_pointer?: string;
|
|
570
|
+
freshness?: string;
|
|
571
|
+
confidence?: number;
|
|
572
|
+
payload?: Record<string, unknown>;
|
|
573
|
+
}
|
|
388
574
|
export interface EmitActivityRequest {
|
|
389
575
|
initiative_id: string;
|
|
390
576
|
message: string;
|
|
@@ -431,8 +617,22 @@ export type ChangesetOperation = {
|
|
|
431
617
|
title: string;
|
|
432
618
|
summary?: string;
|
|
433
619
|
urgency?: DecisionUrgency;
|
|
434
|
-
options?: string
|
|
620
|
+
options?: Array<string | DecisionCreateOption>;
|
|
435
621
|
blocking?: boolean;
|
|
622
|
+
decision_type?: string;
|
|
623
|
+
workstream_id?: string;
|
|
624
|
+
agent_id?: string;
|
|
625
|
+
due_at?: string;
|
|
626
|
+
source_system?: string;
|
|
627
|
+
conflict_source?: string;
|
|
628
|
+
dedupe_key?: string;
|
|
629
|
+
recommended_action?: string;
|
|
630
|
+
source_run_id?: string;
|
|
631
|
+
source_session_id?: string;
|
|
632
|
+
source_stream_id?: string;
|
|
633
|
+
source_ref?: Record<string, unknown>;
|
|
634
|
+
evidence_refs?: DecisionEvidenceRef[];
|
|
635
|
+
metadata?: Record<string, unknown>;
|
|
436
636
|
};
|
|
437
637
|
export interface ApplyChangesetRequest {
|
|
438
638
|
initiative_id: string;
|
|
@@ -486,6 +686,7 @@ export interface RecordRunOutcomeResponse {
|
|
|
486
686
|
}
|
|
487
687
|
export type RetroFollowUpPriority = 'p0' | 'p1' | 'p2';
|
|
488
688
|
export interface RetroJson {
|
|
689
|
+
schema_version: RetroArtifactSchemaVersion;
|
|
489
690
|
summary: string;
|
|
490
691
|
what_went_well?: string[];
|
|
491
692
|
what_went_wrong?: string[];
|
|
@@ -520,3 +721,27 @@ export interface RecordRunRetroResponse {
|
|
|
520
721
|
event_id: string | null;
|
|
521
722
|
auth_mode?: 'service' | 'api_key';
|
|
522
723
|
}
|
|
724
|
+
export type ProofLevel = "L1_traceability" | "L2_correctness" | "L3_completion" | "L4_adoption" | "L5_impact" | "L6_economics" | "L7_repeatability";
|
|
725
|
+
export type ProofEnforcement = "hard_block" | "soft_warn" | "reporting_only";
|
|
726
|
+
export interface ProofLevelStatus {
|
|
727
|
+
level: ProofLevel;
|
|
728
|
+
label: string;
|
|
729
|
+
passed: boolean;
|
|
730
|
+
enforcement: ProofEnforcement;
|
|
731
|
+
missingFields: string[];
|
|
732
|
+
details?: string;
|
|
733
|
+
}
|
|
734
|
+
export interface ProofChainStatus {
|
|
735
|
+
task_id?: string;
|
|
736
|
+
run_id?: string;
|
|
737
|
+
domain?: OrgxAgentDomain;
|
|
738
|
+
levels: ProofLevelStatus[];
|
|
739
|
+
overall_passed: boolean;
|
|
740
|
+
missing_count: number;
|
|
741
|
+
/** Codes like "no_artifact", "no_quality_gate", "no_outcome" etc. */
|
|
742
|
+
reason_codes: string[];
|
|
743
|
+
}
|
|
744
|
+
export interface ProofStatusRequest {
|
|
745
|
+
task_id?: string;
|
|
746
|
+
run_id?: string;
|
|
747
|
+
}
|
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
import { callLlmJson } from "../http/helpers/llm-client.js";
|
|
2
|
+
const VALID_DOMAINS = new Set([
|
|
3
|
+
"engineering",
|
|
4
|
+
"product",
|
|
5
|
+
"design",
|
|
6
|
+
"marketing",
|
|
7
|
+
"sales",
|
|
8
|
+
"operations",
|
|
9
|
+
]);
|
|
10
|
+
function heuristicDomainGuess(title, summary) {
|
|
11
|
+
const haystack = `${title} ${summary ?? ""}`.toLowerCase();
|
|
12
|
+
if (/market|campaign|thread|article|tweet|copy/.test(haystack))
|
|
13
|
+
return ["marketing"];
|
|
14
|
+
if (/design|ux|ui|a11y/.test(haystack))
|
|
15
|
+
return ["design"];
|
|
16
|
+
if (/ops|runbook|incident|reliability/.test(haystack))
|
|
17
|
+
return ["operations"];
|
|
18
|
+
if (/sales|deal|pipeline/.test(haystack))
|
|
19
|
+
return ["sales"];
|
|
20
|
+
return ["engineering", "product"];
|
|
21
|
+
}
|
|
1
22
|
export async function autoAssignEntityForCreate(input) {
|
|
2
23
|
const warnings = [];
|
|
3
24
|
const byKey = new Map();
|
|
@@ -67,23 +88,28 @@ export async function autoAssignEntityForCreate(input) {
|
|
|
67
88
|
warnings.push(`delegation preflight failed (${input.toErrorMessage(err)})`);
|
|
68
89
|
}
|
|
69
90
|
if (byKey.size === 0) {
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
91
|
+
const domainResult = await callLlmJson({
|
|
92
|
+
taskId: "domain_assignment",
|
|
93
|
+
systemPrompt: 'Classify which agent domain(s) should handle this task. Return JSON: {"domains": [...]} with 1-2 values from: engineering, product, design, marketing, sales, operations. Be precise based on the task content.',
|
|
94
|
+
userPrompt: `Task: ${input.title}\n${input.summary ? `Details: ${input.summary}` : ""}`,
|
|
95
|
+
maxTokens: 64,
|
|
96
|
+
temperature: 0.1,
|
|
97
|
+
cacheTtlMs: 60 * 60_000, // 1 hour
|
|
98
|
+
}, (raw) => {
|
|
99
|
+
try {
|
|
100
|
+
const parsed = JSON.parse(raw);
|
|
101
|
+
if (Array.isArray(parsed.domains) &&
|
|
102
|
+
parsed.domains.length > 0 &&
|
|
103
|
+
parsed.domains.every((d) => typeof d === "string" && VALID_DOMAINS.has(d))) {
|
|
104
|
+
return { domains: parsed.domains };
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
// fall through
|
|
109
|
+
}
|
|
110
|
+
return null;
|
|
111
|
+
}, () => ({ domains: heuristicDomainGuess(input.title, input.summary ?? null) }));
|
|
112
|
+
const domainHints = domainResult.result.domains;
|
|
87
113
|
for (const domain of domainHints) {
|
|
88
114
|
const match = liveAgents.find((agent) => (agent.domain ?? "").toLowerCase().includes(domain));
|
|
89
115
|
if (match)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { LiveActivityItem } from "./contracts/shared-types.js";
|
|
2
|
+
export declare function isUuid(value: string | null | undefined): boolean;
|
|
3
|
+
export declare function isSyntheticIdentifier(value: string | null | undefined): boolean;
|
|
4
|
+
type OutboxEventLike = {
|
|
5
|
+
type?: unknown;
|
|
6
|
+
payload?: unknown;
|
|
7
|
+
activityItem?: unknown;
|
|
8
|
+
};
|
|
9
|
+
export declare function classifyOutboxReplaySkip(event: OutboxEventLike): string | null;
|
|
10
|
+
export declare function shouldHideActivityItem(item: LiveActivityItem): boolean;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
function toRecord(value) {
|
|
2
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
3
|
+
return null;
|
|
4
|
+
return value;
|
|
5
|
+
}
|
|
6
|
+
function pickString(input, ...keys) {
|
|
7
|
+
if (!input)
|
|
8
|
+
return null;
|
|
9
|
+
for (const key of keys) {
|
|
10
|
+
const value = input[key];
|
|
11
|
+
if (typeof value !== "string")
|
|
12
|
+
continue;
|
|
13
|
+
const trimmed = value.trim();
|
|
14
|
+
if (trimmed.length > 0)
|
|
15
|
+
return trimmed;
|
|
16
|
+
}
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
function pickBool(input, ...keys) {
|
|
20
|
+
if (!input)
|
|
21
|
+
return false;
|
|
22
|
+
for (const key of keys) {
|
|
23
|
+
if (input[key] === true)
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
function containsMockMarker(value) {
|
|
29
|
+
if (!value)
|
|
30
|
+
return false;
|
|
31
|
+
const normalized = value.trim().toLowerCase();
|
|
32
|
+
if (!normalized)
|
|
33
|
+
return false;
|
|
34
|
+
// Match whole marker tokens and avoid substring false positives (e.g. "latest").
|
|
35
|
+
return /(^|[^a-z0-9])(mock|fixture|synthetic|test)([^a-z0-9]|$)/i.test(normalized);
|
|
36
|
+
}
|
|
37
|
+
export function isUuid(value) {
|
|
38
|
+
if (!value)
|
|
39
|
+
return false;
|
|
40
|
+
const trimmed = value.trim();
|
|
41
|
+
if (!trimmed)
|
|
42
|
+
return false;
|
|
43
|
+
return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(trimmed);
|
|
44
|
+
}
|
|
45
|
+
export function isSyntheticIdentifier(value) {
|
|
46
|
+
if (!value)
|
|
47
|
+
return false;
|
|
48
|
+
const trimmed = value.trim();
|
|
49
|
+
if (!trimmed)
|
|
50
|
+
return false;
|
|
51
|
+
if (isUuid(trimmed))
|
|
52
|
+
return false;
|
|
53
|
+
return /^(init|initiative|task|workstream|ws|milestone|ms|decision|artifact|demo|mock|test|sample|queue|tmp|local)-/i.test(trimmed);
|
|
54
|
+
}
|
|
55
|
+
function isMockTaggedMetadata(metadata) {
|
|
56
|
+
if (!metadata)
|
|
57
|
+
return false;
|
|
58
|
+
if (pickBool(metadata, "mock", "is_mock", "isMock"))
|
|
59
|
+
return true;
|
|
60
|
+
if (containsMockMarker(pickString(metadata, "source")) ||
|
|
61
|
+
containsMockMarker(pickString(metadata, "worker_kind", "workerKind")) ||
|
|
62
|
+
containsMockMarker(pickString(metadata, "environment"))) {
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
export function classifyOutboxReplaySkip(event) {
|
|
68
|
+
const eventType = typeof event.type === "string" ? event.type.trim().toLowerCase() : "";
|
|
69
|
+
const payload = toRecord(event.payload);
|
|
70
|
+
const activity = toRecord(event.activityItem);
|
|
71
|
+
const payloadMetadata = toRecord(payload?.metadata);
|
|
72
|
+
const activityMetadata = toRecord(activity?.metadata);
|
|
73
|
+
const normalizedSourceClient = pickString(payload, "source_client", "sourceClient")
|
|
74
|
+
?.trim()
|
|
75
|
+
.toLowerCase();
|
|
76
|
+
const normalizedPayloadEvent = pickString(payloadMetadata, "event")?.trim().toLowerCase();
|
|
77
|
+
const normalizedActivityEvent = pickString(activityMetadata, "event")?.trim().toLowerCase();
|
|
78
|
+
const skipMockOutboxReplay = String(process.env.ORGX_SKIP_MOCK_OUTBOX_REPLAY ?? "false")
|
|
79
|
+
.trim()
|
|
80
|
+
.toLowerCase() === "true";
|
|
81
|
+
if (skipMockOutboxReplay &&
|
|
82
|
+
(isMockTaggedMetadata(payloadMetadata) ||
|
|
83
|
+
isMockTaggedMetadata(activityMetadata) ||
|
|
84
|
+
pickBool(payload, "mock", "is_mock", "isMock"))) {
|
|
85
|
+
return "mock_event";
|
|
86
|
+
}
|
|
87
|
+
if (eventType === "artifact") {
|
|
88
|
+
const initiativeId = pickString(payload, "initiative_id", "initiativeId");
|
|
89
|
+
const entityId = pickString(payload, "entity_id", "entityId");
|
|
90
|
+
const allowSyntheticArtifact = normalizedSourceClient === "openclaw" ||
|
|
91
|
+
normalizedPayloadEvent === "autopilot_slice_artifact_buffered" ||
|
|
92
|
+
normalizedActivityEvent === "autopilot_slice_artifact_buffered";
|
|
93
|
+
if (!allowSyntheticArtifact && isSyntheticIdentifier(initiativeId)) {
|
|
94
|
+
return "synthetic_initiative_id";
|
|
95
|
+
}
|
|
96
|
+
if (!allowSyntheticArtifact && !entityId) {
|
|
97
|
+
return "missing_artifact_entity_id";
|
|
98
|
+
}
|
|
99
|
+
if (!allowSyntheticArtifact && isSyntheticIdentifier(entityId)) {
|
|
100
|
+
return "synthetic_artifact_entity_id";
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
export function shouldHideActivityItem(item) {
|
|
106
|
+
const metadata = toRecord(item.metadata);
|
|
107
|
+
const hideMockActivity = String(process.env.ORGX_HIDE_MOCK_ACTIVITY ?? "false")
|
|
108
|
+
.trim()
|
|
109
|
+
.toLowerCase() === "true";
|
|
110
|
+
if (hideMockActivity && isMockTaggedMetadata(metadata))
|
|
111
|
+
return true;
|
|
112
|
+
return false;
|
|
113
|
+
}
|