@useorgx/openclaw-plugin 0.4.5 → 0.4.6
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 +24 -3
- package/dashboard/dist/assets/0tOC3wSN.js +214 -0
- package/dashboard/dist/assets/B3ziCA02.js +8 -0
- package/dashboard/dist/assets/Bm8QnMJ_.js +1 -0
- package/dashboard/dist/assets/CpJsfbXo.js +9 -0
- package/dashboard/dist/assets/CyxZio4Y.js +1 -0
- package/dashboard/dist/assets/DaAIOik3.css +1 -0
- package/dashboard/dist/assets/sAhvFnpk.js +4 -0
- package/dashboard/dist/index.html +5 -5
- package/dist/activity-store.d.ts +28 -0
- package/dist/activity-store.js +250 -0
- package/dist/agent-context-store.d.ts +19 -0
- package/dist/agent-context-store.js +60 -3
- package/dist/agent-suite.d.ts +83 -0
- package/dist/agent-suite.js +615 -0
- package/dist/contracts/client.d.ts +22 -1
- package/dist/contracts/client.js +120 -3
- package/dist/contracts/types.d.ts +190 -1
- package/dist/entity-comment-store.d.ts +29 -0
- package/dist/entity-comment-store.js +190 -0
- package/dist/hooks/post-reporting-event.mjs +326 -0
- package/dist/http-handler.d.ts +7 -1
- package/dist/http-handler.js +3603 -578
- package/dist/index.js +936 -62
- package/dist/mcp-client-setup.js +156 -24
- package/dist/mcp-http-handler.d.ts +17 -0
- package/dist/mcp-http-handler.js +144 -3
- package/dist/next-up-queue-store.d.ts +31 -0
- package/dist/next-up-queue-store.js +169 -0
- package/dist/openclaw.plugin.json +1 -1
- package/dist/outbox.d.ts +1 -1
- package/dist/runtime-instance-store.d.ts +1 -1
- package/dist/runtime-instance-store.js +20 -3
- package/dist/skill-pack-state.d.ts +69 -0
- package/dist/skill-pack-state.js +232 -0
- package/dist/worker-supervisor.d.ts +25 -0
- package/dist/worker-supervisor.js +62 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +10 -1
- package/skills/orgx-design-agent/SKILL.md +38 -0
- package/skills/orgx-engineering-agent/SKILL.md +55 -0
- package/skills/orgx-marketing-agent/SKILL.md +40 -0
- package/skills/orgx-operations-agent/SKILL.md +40 -0
- package/skills/orgx-orchestrator-agent/SKILL.md +45 -0
- package/skills/orgx-product-agent/SKILL.md +39 -0
- package/skills/orgx-sales-agent/SKILL.md +40 -0
- package/skills/ship/SKILL.md +63 -0
- package/dashboard/dist/assets/B68j2crt.js +0 -1
- package/dashboard/dist/assets/BZZ-fiJx.js +0 -32
- package/dashboard/dist/assets/BoXlCHKa.js +0 -9
- package/dashboard/dist/assets/Bq9x_Xyh.css +0 -1
- package/dashboard/dist/assets/DBhrRVdp.js +0 -1
- package/dashboard/dist/assets/DD1jv1Hd.js +0 -8
- package/dashboard/dist/assets/DNjbmawF.js +0 -214
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import process from "node:process";
|
|
4
|
+
import { pathToFileURL } from "node:url";
|
|
5
|
+
|
|
6
|
+
export function parseArgs(argv) {
|
|
7
|
+
const args = {};
|
|
8
|
+
for (const arg of argv) {
|
|
9
|
+
if (!arg.startsWith("--")) continue;
|
|
10
|
+
const [rawKey, ...rest] = arg.slice(2).split("=");
|
|
11
|
+
const key = rawKey.trim();
|
|
12
|
+
if (!key) continue;
|
|
13
|
+
args[key] = rest.length > 0 ? rest.join("=") : "true";
|
|
14
|
+
}
|
|
15
|
+
return args;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function pickString(...values) {
|
|
19
|
+
for (const value of values) {
|
|
20
|
+
if (typeof value !== "string") continue;
|
|
21
|
+
const trimmed = value.trim();
|
|
22
|
+
if (trimmed.length > 0) {
|
|
23
|
+
return trimmed;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async function postJson(url, payload, headers, fetchImpl = fetch) {
|
|
30
|
+
const controller = new AbortController();
|
|
31
|
+
const timeout = setTimeout(() => controller.abort(), 8000);
|
|
32
|
+
try {
|
|
33
|
+
const response = await fetchImpl(url, {
|
|
34
|
+
method: "POST",
|
|
35
|
+
headers: {
|
|
36
|
+
"Content-Type": "application/json",
|
|
37
|
+
...headers,
|
|
38
|
+
},
|
|
39
|
+
body: JSON.stringify(payload),
|
|
40
|
+
signal: controller.signal,
|
|
41
|
+
});
|
|
42
|
+
if (!response.ok) {
|
|
43
|
+
const body = await response.text().catch(() => "");
|
|
44
|
+
throw new Error(`HTTP ${response.status}: ${body || response.statusText}`);
|
|
45
|
+
}
|
|
46
|
+
return await response.json().catch(() => ({}));
|
|
47
|
+
} finally {
|
|
48
|
+
clearTimeout(timeout);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function buildRuntimePayload({
|
|
53
|
+
initiativeId,
|
|
54
|
+
runId,
|
|
55
|
+
correlationId,
|
|
56
|
+
sourceClient,
|
|
57
|
+
event,
|
|
58
|
+
phase,
|
|
59
|
+
message,
|
|
60
|
+
workstreamId,
|
|
61
|
+
taskId,
|
|
62
|
+
agentId,
|
|
63
|
+
agentName,
|
|
64
|
+
progressPct,
|
|
65
|
+
args,
|
|
66
|
+
}) {
|
|
67
|
+
return {
|
|
68
|
+
source_client: sourceClient,
|
|
69
|
+
event,
|
|
70
|
+
run_id: runId,
|
|
71
|
+
correlation_id: correlationId,
|
|
72
|
+
initiative_id: initiativeId,
|
|
73
|
+
workstream_id: workstreamId,
|
|
74
|
+
task_id: taskId,
|
|
75
|
+
agent_id: agentId,
|
|
76
|
+
agent_name: agentName,
|
|
77
|
+
phase,
|
|
78
|
+
progress_pct: progressPct,
|
|
79
|
+
message,
|
|
80
|
+
metadata: {
|
|
81
|
+
source: "hook_runtime_relay",
|
|
82
|
+
raw_args: args,
|
|
83
|
+
},
|
|
84
|
+
timestamp: new Date().toISOString(),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function buildActivityPayload({
|
|
89
|
+
initiativeId,
|
|
90
|
+
runId,
|
|
91
|
+
correlationId,
|
|
92
|
+
sourceClient,
|
|
93
|
+
event,
|
|
94
|
+
phase,
|
|
95
|
+
message,
|
|
96
|
+
args,
|
|
97
|
+
}) {
|
|
98
|
+
return {
|
|
99
|
+
initiative_id: initiativeId,
|
|
100
|
+
run_id: runId,
|
|
101
|
+
correlation_id: correlationId,
|
|
102
|
+
source_client: sourceClient,
|
|
103
|
+
message,
|
|
104
|
+
phase,
|
|
105
|
+
level: phase === "blocked" ? "warn" : "info",
|
|
106
|
+
metadata: {
|
|
107
|
+
source: "hook_backstop",
|
|
108
|
+
hook_event: event,
|
|
109
|
+
raw_args: args,
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export function buildCompletionChangesetPayload({
|
|
115
|
+
initiativeId,
|
|
116
|
+
runId,
|
|
117
|
+
correlationId,
|
|
118
|
+
sourceClient,
|
|
119
|
+
event,
|
|
120
|
+
taskId,
|
|
121
|
+
}) {
|
|
122
|
+
return {
|
|
123
|
+
initiative_id: initiativeId,
|
|
124
|
+
run_id: runId,
|
|
125
|
+
correlation_id: correlationId,
|
|
126
|
+
source_client: sourceClient,
|
|
127
|
+
idempotency_key: `hook:${event}:${taskId}`,
|
|
128
|
+
operations: [
|
|
129
|
+
{
|
|
130
|
+
op: "task.update",
|
|
131
|
+
task_id: taskId,
|
|
132
|
+
status: "done",
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export async function main({
|
|
139
|
+
argv = process.argv.slice(2),
|
|
140
|
+
env = process.env,
|
|
141
|
+
fetchImpl = fetch,
|
|
142
|
+
now = () => Date.now(),
|
|
143
|
+
} = {}) {
|
|
144
|
+
const args = parseArgs(argv);
|
|
145
|
+
|
|
146
|
+
const runtimeHookUrl = pickString(
|
|
147
|
+
args.runtime_hook_url,
|
|
148
|
+
args.hook_url,
|
|
149
|
+
env.ORGX_RUNTIME_HOOK_URL,
|
|
150
|
+
"http://127.0.0.1:18789/orgx/api/hooks/runtime"
|
|
151
|
+
);
|
|
152
|
+
const runtimeHookToken = pickString(
|
|
153
|
+
args.hook_token,
|
|
154
|
+
args.runtime_hook_token,
|
|
155
|
+
env.ORGX_HOOK_TOKEN
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
const baseUrl = pickString(env.ORGX_BASE_URL, "https://www.useorgx.com")
|
|
159
|
+
.replace(/\/+$/, "");
|
|
160
|
+
const initiativeId = pickString(args.initiative, env.ORGX_INITIATIVE_ID);
|
|
161
|
+
const apiKey = pickString(env.ORGX_API_KEY);
|
|
162
|
+
|
|
163
|
+
const sourceClient = pickString(
|
|
164
|
+
args.source_client,
|
|
165
|
+
env.ORGX_SOURCE_CLIENT,
|
|
166
|
+
"openclaw"
|
|
167
|
+
);
|
|
168
|
+
const runId = pickString(args.run_id, env.ORGX_RUN_ID);
|
|
169
|
+
const correlationId = runId
|
|
170
|
+
? undefined
|
|
171
|
+
: pickString(
|
|
172
|
+
args.correlation_id,
|
|
173
|
+
env.ORGX_CORRELATION_ID,
|
|
174
|
+
`hook-${now()}`
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
const event = pickString(args.event, "hook_event");
|
|
178
|
+
const phase = pickString(args.phase, "execution");
|
|
179
|
+
const workstreamId = pickString(args.workstream_id, env.ORGX_WORKSTREAM_ID);
|
|
180
|
+
const taskId = pickString(args.task_id, env.ORGX_TASK_ID);
|
|
181
|
+
const agentId = pickString(args.agent_id, env.ORGX_AGENT_ID);
|
|
182
|
+
const agentName = pickString(args.agent_name, env.ORGX_AGENT_NAME);
|
|
183
|
+
const progressPctRaw = pickString(args.progress_pct, env.ORGX_PROGRESS_PCT);
|
|
184
|
+
const progressPct = progressPctRaw ? Number(progressPctRaw) : undefined;
|
|
185
|
+
const message = pickString(
|
|
186
|
+
args.message,
|
|
187
|
+
`Hook event: ${event}`
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
let runtimePosted = false;
|
|
191
|
+
let runtimePostFailed = false;
|
|
192
|
+
if (runtimeHookToken && runtimeHookUrl) {
|
|
193
|
+
const runtimePayload = buildRuntimePayload({
|
|
194
|
+
initiativeId,
|
|
195
|
+
runId,
|
|
196
|
+
correlationId,
|
|
197
|
+
sourceClient,
|
|
198
|
+
event,
|
|
199
|
+
phase,
|
|
200
|
+
message,
|
|
201
|
+
workstreamId,
|
|
202
|
+
taskId,
|
|
203
|
+
agentId,
|
|
204
|
+
agentName,
|
|
205
|
+
progressPct: Number.isFinite(progressPct) ? progressPct : undefined,
|
|
206
|
+
args,
|
|
207
|
+
});
|
|
208
|
+
try {
|
|
209
|
+
await postJson(
|
|
210
|
+
runtimeHookUrl,
|
|
211
|
+
runtimePayload,
|
|
212
|
+
{ "X-OrgX-Hook-Token": runtimeHookToken },
|
|
213
|
+
fetchImpl
|
|
214
|
+
);
|
|
215
|
+
runtimePosted = true;
|
|
216
|
+
} catch {
|
|
217
|
+
runtimePostFailed = true;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if (!apiKey) {
|
|
222
|
+
return {
|
|
223
|
+
ok: true,
|
|
224
|
+
runtime_posted: runtimePosted,
|
|
225
|
+
skipped: "missing_api_key",
|
|
226
|
+
...(runtimePostFailed ? { runtime_skipped: "runtime_post_failed" } : {}),
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
if (!initiativeId) {
|
|
230
|
+
return {
|
|
231
|
+
ok: true,
|
|
232
|
+
runtime_posted: runtimePosted,
|
|
233
|
+
skipped: "missing_initiative_id",
|
|
234
|
+
...(runtimePostFailed ? { runtime_skipped: "runtime_post_failed" } : {}),
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const headers = {
|
|
239
|
+
Authorization: `Bearer ${apiKey}`,
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
const userId = pickString(env.ORGX_USER_ID);
|
|
243
|
+
if (userId) {
|
|
244
|
+
headers["X-Orgx-User-Id"] = userId;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
const activityPayload = buildActivityPayload({
|
|
248
|
+
initiativeId,
|
|
249
|
+
runId,
|
|
250
|
+
correlationId,
|
|
251
|
+
sourceClient,
|
|
252
|
+
event,
|
|
253
|
+
phase,
|
|
254
|
+
message,
|
|
255
|
+
args,
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
try {
|
|
259
|
+
await postJson(
|
|
260
|
+
`${baseUrl}/api/client/live/activity`,
|
|
261
|
+
activityPayload,
|
|
262
|
+
headers,
|
|
263
|
+
fetchImpl
|
|
264
|
+
);
|
|
265
|
+
} catch {
|
|
266
|
+
return {
|
|
267
|
+
ok: true,
|
|
268
|
+
runtime_posted: runtimePosted,
|
|
269
|
+
skipped: "activity_post_failed",
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
const shouldApplyCompletion =
|
|
274
|
+
args.apply_completion === "true" || args.apply_completion === "1";
|
|
275
|
+
if (!shouldApplyCompletion || !taskId) {
|
|
276
|
+
return {
|
|
277
|
+
ok: true,
|
|
278
|
+
runtime_posted: runtimePosted,
|
|
279
|
+
activity_posted: true,
|
|
280
|
+
changeset_posted: false,
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
const changesetPayload = buildCompletionChangesetPayload({
|
|
285
|
+
initiativeId,
|
|
286
|
+
runId,
|
|
287
|
+
correlationId,
|
|
288
|
+
sourceClient,
|
|
289
|
+
event,
|
|
290
|
+
taskId,
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
try {
|
|
294
|
+
await postJson(
|
|
295
|
+
`${baseUrl}/api/client/live/changesets/apply`,
|
|
296
|
+
changesetPayload,
|
|
297
|
+
headers,
|
|
298
|
+
fetchImpl
|
|
299
|
+
);
|
|
300
|
+
} catch {
|
|
301
|
+
return {
|
|
302
|
+
ok: true,
|
|
303
|
+
runtime_posted: runtimePosted,
|
|
304
|
+
activity_posted: true,
|
|
305
|
+
changeset_posted: false,
|
|
306
|
+
skipped: "changeset_post_failed",
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
return {
|
|
311
|
+
ok: true,
|
|
312
|
+
runtime_posted: runtimePosted,
|
|
313
|
+
activity_posted: true,
|
|
314
|
+
changeset_posted: true,
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
319
|
+
main()
|
|
320
|
+
.then(() => {
|
|
321
|
+
process.exit(0);
|
|
322
|
+
})
|
|
323
|
+
.catch(() => {
|
|
324
|
+
process.exit(0);
|
|
325
|
+
});
|
|
326
|
+
}
|
package/dist/http-handler.d.ts
CHANGED
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
* /orgx/api/initiatives → initiative data
|
|
11
11
|
* /orgx/api/health → plugin diagnostics + outbox/sync status
|
|
12
12
|
* /orgx/api/onboarding → onboarding / config state
|
|
13
|
+
* /orgx/api/agent-suite/status → suite provisioning plan (OpenClaw-local)
|
|
14
|
+
* /orgx/api/agent-suite/install → install/update suite (OpenClaw-local)
|
|
13
15
|
* /orgx/api/delegation/preflight → delegation preflight
|
|
14
16
|
* /orgx/api/runs/:id/checkpoints → list/create checkpoints
|
|
15
17
|
* /orgx/api/runs/:id/checkpoints/:checkpointId/restore → restore checkpoint
|
|
@@ -75,7 +77,11 @@ interface DiagnosticsProvider {
|
|
|
75
77
|
probeRemote?: boolean;
|
|
76
78
|
}) => Promise<unknown>;
|
|
77
79
|
}
|
|
78
|
-
export declare function createHttpHandler(config: OrgXConfig
|
|
80
|
+
export declare function createHttpHandler(config: OrgXConfig & {
|
|
81
|
+
dashboardEnabled?: boolean;
|
|
82
|
+
pluginVersion?: string;
|
|
83
|
+
installationId?: string | null;
|
|
84
|
+
}, client: OrgXClient, getSnapshot: () => OrgSnapshot | null, onboarding: OnboardingController, diagnostics?: DiagnosticsProvider, adapters?: {
|
|
79
85
|
outbox?: OutboxAdapter;
|
|
80
86
|
openclaw?: OpenClawAdapter;
|
|
81
87
|
}): (req: PluginRequest, res: PluginResponse) => Promise<boolean>;
|