forge-openclaw-plugin 0.2.23 → 0.2.25
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 +13 -0
- package/dist/assets/{board-_C6oMy5w.js → board-VmF4FAfr.js} +3 -3
- package/dist/assets/{board-_C6oMy5w.js.map → board-VmF4FAfr.js.map} +1 -1
- package/dist/assets/index-CFCKDIMH.js +67 -0
- package/dist/assets/index-CFCKDIMH.js.map +1 -0
- package/dist/assets/index-ZPY6U1TU.css +1 -0
- package/dist/assets/{motion-D4sZgCHd.js → motion-DvkU14p-.js} +3 -3
- package/dist/assets/motion-DvkU14p-.js.map +1 -0
- package/dist/assets/{table-BWzTaky1.js → table-DgiPof9E.js} +2 -2
- package/dist/assets/{table-BWzTaky1.js.map → table-DgiPof9E.js.map} +1 -1
- package/dist/assets/{ui-BzK4azQb.js → ui-nYfoC0Gq.js} +2 -2
- package/dist/assets/{ui-BzK4azQb.js.map → ui-nYfoC0Gq.js.map} +1 -1
- package/dist/assets/vendor-D9PTEPSB.js +824 -0
- package/dist/assets/vendor-D9PTEPSB.js.map +1 -0
- package/dist/assets/viz-Cqb6s--o.js +34 -0
- package/dist/assets/viz-Cqb6s--o.js.map +1 -0
- package/dist/index.html +8 -8
- package/dist/openclaw/parity.d.ts +1 -1
- package/dist/openclaw/parity.js +29 -0
- package/dist/openclaw/plugin-entry-shared.d.ts +1 -0
- package/dist/openclaw/plugin-entry-shared.js +7 -4
- package/dist/openclaw/plugin-sdk-types.d.ts +12 -0
- package/dist/openclaw/routes.js +236 -0
- package/dist/openclaw/session-bootstrap.d.ts +78 -0
- package/dist/openclaw/session-bootstrap.js +240 -0
- package/dist/openclaw/tools.js +279 -3
- package/dist/server/app.js +855 -19
- package/dist/server/connectors/box-registry.js +257 -0
- package/dist/server/db.js +2 -0
- package/dist/server/discovery-advertiser.js +114 -0
- package/dist/server/health.js +39 -11
- package/dist/server/index.js +4 -0
- package/dist/server/managers/platform/llm-manager.js +40 -4
- package/dist/server/managers/platform/openai-responses-provider.js +129 -19
- package/dist/server/movement.js +2935 -0
- package/dist/server/openapi.js +628 -5
- package/dist/server/psyche-types.js +15 -1
- package/dist/server/questionnaire-flow.js +552 -0
- package/dist/server/questionnaire-seeds.js +853 -0
- package/dist/server/questionnaire-types.js +340 -0
- package/dist/server/repositories/ai-connectors.js +944 -0
- package/dist/server/repositories/ai-processors.js +547 -0
- package/dist/server/repositories/diagnostic-logs.js +57 -4
- package/dist/server/repositories/entity-ownership.js +9 -1
- package/dist/server/repositories/habits.js +77 -9
- package/dist/server/repositories/model-settings.js +216 -0
- package/dist/server/repositories/notes.js +57 -15
- package/dist/server/repositories/preferences.js +124 -0
- package/dist/server/repositories/questionnaires.js +1338 -0
- package/dist/server/repositories/rewards.js +2 -2
- package/dist/server/repositories/settings.js +108 -12
- package/dist/server/repositories/surface-layouts.js +76 -0
- package/dist/server/repositories/wiki-memory.js +5 -1
- package/dist/server/services/entity-crud.js +81 -2
- package/dist/server/services/openai-codex-oauth.js +153 -0
- package/dist/server/services/psyche-observation-calendar.js +46 -0
- package/dist/server/types.js +492 -3
- package/dist/server/watch-mobile.js +562 -0
- package/dist/server/web.js +9 -2
- package/openclaw.plugin.json +1 -1
- package/package.json +6 -1
- package/server/migrations/024_questionnaires.sql +96 -0
- package/server/migrations/025_ai_model_connections.sql +26 -0
- package/server/migrations/026_custom_theme_settings.sql +2 -0
- package/server/migrations/027_ai_processors.sql +31 -0
- package/server/migrations/028_movement_domain.sql +136 -0
- package/server/migrations/029_watch_micro_capture.sql +23 -0
- package/server/migrations/030_surface_layouts.sql +5 -0
- package/server/migrations/031_ai_processor_runtime_upgrades.sql +10 -0
- package/server/migrations/032_ai_connectors.sql +44 -0
- package/server/migrations/033_movement_trip_point_sync.sql +36 -0
- package/server/migrations/034_movement_segment_sync.sql +49 -0
- package/skills/forge-openclaw/SKILL.md +12 -1
- package/skills/forge-openclaw/entity_conversation_playbooks.md +331 -84
- package/skills/forge-openclaw/psyche_entity_playbooks.md +252 -221
- package/dist/assets/index-Ch_xeZ2u.js +0 -63
- package/dist/assets/index-Ch_xeZ2u.js.map +0 -1
- package/dist/assets/index-DvVM7K6j.css +0 -1
- package/dist/assets/motion-D4sZgCHd.js.map +0 -1
- package/dist/assets/vendor-De38P6YR.js +0 -729
- package/dist/assets/vendor-De38P6YR.js.map +0 -1
- package/dist/assets/viz-C6hfyqzu.js +0 -34
- package/dist/assets/viz-C6hfyqzu.js.map +0 -1
- package/skills/forge-openclaw/cron_jobs.md +0 -395
|
@@ -23,6 +23,8 @@ const RESERVED_RESPONSE_TOKENS = 140_000;
|
|
|
23
23
|
const APPROX_CHARS_PER_TOKEN = 4;
|
|
24
24
|
const REQUEST_TIMEOUT_MS = 90_000;
|
|
25
25
|
const BACKGROUND_POLL_INTERVAL_MS = 2_000;
|
|
26
|
+
const DEFAULT_CODEX_BASE_URL = "https://chatgpt.com/backend-api";
|
|
27
|
+
const CODEX_JWT_CLAIM_PATH = "https://api.openai.com/auth";
|
|
26
28
|
function closedObject(properties) {
|
|
27
29
|
return {
|
|
28
30
|
type: "object",
|
|
@@ -172,6 +174,67 @@ function readVerbosity(profile) {
|
|
|
172
174
|
? profile.metadata.verbosity
|
|
173
175
|
: null;
|
|
174
176
|
}
|
|
177
|
+
function isCodexProfile(profile) {
|
|
178
|
+
return profile.provider === "openai-codex";
|
|
179
|
+
}
|
|
180
|
+
function normalizeBaseUrl(profile) {
|
|
181
|
+
const trimmed = profile.baseUrl.trim();
|
|
182
|
+
if (trimmed.length > 0) {
|
|
183
|
+
return trimmed.replace(/\/$/, "");
|
|
184
|
+
}
|
|
185
|
+
return isCodexProfile(profile)
|
|
186
|
+
? DEFAULT_CODEX_BASE_URL
|
|
187
|
+
: "https://api.openai.com/v1";
|
|
188
|
+
}
|
|
189
|
+
function buildResponsesUrl(profile, responseId) {
|
|
190
|
+
const baseUrl = normalizeBaseUrl(profile);
|
|
191
|
+
const root = isCodexProfile(profile)
|
|
192
|
+
? baseUrl.endsWith("/codex/responses")
|
|
193
|
+
? baseUrl
|
|
194
|
+
: baseUrl.endsWith("/codex")
|
|
195
|
+
? `${baseUrl}/responses`
|
|
196
|
+
: `${baseUrl}/codex/responses`
|
|
197
|
+
: baseUrl.endsWith("/responses")
|
|
198
|
+
? baseUrl
|
|
199
|
+
: `${baseUrl}/responses`;
|
|
200
|
+
return responseId ? `${root}/${responseId}` : root;
|
|
201
|
+
}
|
|
202
|
+
function extractCodexAccountId(accessToken) {
|
|
203
|
+
try {
|
|
204
|
+
const parts = accessToken.split(".");
|
|
205
|
+
if (parts.length !== 3) {
|
|
206
|
+
throw new Error("Invalid token");
|
|
207
|
+
}
|
|
208
|
+
const payload = JSON.parse(Buffer.from(parts[1], "base64url").toString("utf8"));
|
|
209
|
+
const auth = payload[CODEX_JWT_CLAIM_PATH];
|
|
210
|
+
if (!auth || typeof auth !== "object") {
|
|
211
|
+
throw new Error("Missing auth claim");
|
|
212
|
+
}
|
|
213
|
+
const accountId = auth.chatgpt_account_id;
|
|
214
|
+
if (typeof accountId !== "string" || accountId.trim().length === 0) {
|
|
215
|
+
throw new Error("Missing account id");
|
|
216
|
+
}
|
|
217
|
+
return accountId;
|
|
218
|
+
}
|
|
219
|
+
catch {
|
|
220
|
+
throw new Error("Failed to extract accountId from OpenAI Codex token.");
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
function buildRequestHeaders(profile, apiKey, options = {}) {
|
|
224
|
+
const headers = {
|
|
225
|
+
authorization: `Bearer ${apiKey}`
|
|
226
|
+
};
|
|
227
|
+
if (options.includeJsonContentType) {
|
|
228
|
+
headers["content-type"] = "application/json";
|
|
229
|
+
}
|
|
230
|
+
if (!isCodexProfile(profile)) {
|
|
231
|
+
return headers;
|
|
232
|
+
}
|
|
233
|
+
headers["OpenAI-Beta"] = "responses=experimental";
|
|
234
|
+
headers.originator = "pi";
|
|
235
|
+
headers["chatgpt-account-id"] = extractCodexAccountId(apiKey);
|
|
236
|
+
return headers;
|
|
237
|
+
}
|
|
175
238
|
function buildReasoningConfiguration(profile) {
|
|
176
239
|
const effort = readReasoningEffort(profile);
|
|
177
240
|
return effort ? { effort } : undefined;
|
|
@@ -268,7 +331,13 @@ function normalizeResult(content, input) {
|
|
|
268
331
|
}
|
|
269
332
|
}
|
|
270
333
|
export class OpenAiResponsesProvider {
|
|
271
|
-
providerNames = [
|
|
334
|
+
providerNames = [
|
|
335
|
+
"openai",
|
|
336
|
+
"openai-api",
|
|
337
|
+
"openai-codex",
|
|
338
|
+
"openai-responses",
|
|
339
|
+
"openai-compatible"
|
|
340
|
+
];
|
|
272
341
|
async testConnection({ apiKey, profile, logger }) {
|
|
273
342
|
emitDiagnostic(logger, {
|
|
274
343
|
level: "info",
|
|
@@ -283,12 +352,11 @@ export class OpenAiResponsesProvider {
|
|
|
283
352
|
});
|
|
284
353
|
let response;
|
|
285
354
|
try {
|
|
286
|
-
response = await fetch(
|
|
355
|
+
response = await fetch(buildResponsesUrl(profile), {
|
|
287
356
|
method: "POST",
|
|
288
|
-
headers: {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
},
|
|
357
|
+
headers: buildRequestHeaders(profile, apiKey, {
|
|
358
|
+
includeJsonContentType: true
|
|
359
|
+
}),
|
|
292
360
|
body: JSON.stringify({
|
|
293
361
|
model: profile.model,
|
|
294
362
|
input: "Reply with the single word ok.",
|
|
@@ -353,6 +421,53 @@ export class OpenAiResponsesProvider {
|
|
|
353
421
|
outputPreview: parseOutputText(payload)?.trim() || "ok"
|
|
354
422
|
};
|
|
355
423
|
}
|
|
424
|
+
async runText({ apiKey, profile, systemPrompt, prompt, logger }) {
|
|
425
|
+
emitDiagnostic(logger, {
|
|
426
|
+
level: "info",
|
|
427
|
+
message: "Running OpenAI text prompt.",
|
|
428
|
+
details: {
|
|
429
|
+
scope: "ai_processor",
|
|
430
|
+
eventKey: "prompt_run_start",
|
|
431
|
+
provider: profile.provider,
|
|
432
|
+
baseUrl: profile.baseUrl,
|
|
433
|
+
model: profile.model
|
|
434
|
+
}
|
|
435
|
+
});
|
|
436
|
+
const response = await fetch(buildResponsesUrl(profile), {
|
|
437
|
+
method: "POST",
|
|
438
|
+
headers: buildRequestHeaders(profile, apiKey, {
|
|
439
|
+
includeJsonContentType: true
|
|
440
|
+
}),
|
|
441
|
+
body: JSON.stringify({
|
|
442
|
+
model: profile.model,
|
|
443
|
+
input: [
|
|
444
|
+
...(systemPrompt?.trim()
|
|
445
|
+
? [
|
|
446
|
+
{
|
|
447
|
+
role: "system",
|
|
448
|
+
content: [{ type: "input_text", text: systemPrompt.trim() }]
|
|
449
|
+
}
|
|
450
|
+
]
|
|
451
|
+
: []),
|
|
452
|
+
{
|
|
453
|
+
role: "user",
|
|
454
|
+
content: [{ type: "input_text", text: prompt }]
|
|
455
|
+
}
|
|
456
|
+
],
|
|
457
|
+
reasoning: buildReasoningConfiguration(profile),
|
|
458
|
+
text: buildTextConfiguration({ profile }),
|
|
459
|
+
max_output_tokens: 1200
|
|
460
|
+
})
|
|
461
|
+
});
|
|
462
|
+
if (!response.ok) {
|
|
463
|
+
const message = await response.text();
|
|
464
|
+
throw new Error(`OpenAI text prompt failed (${response.status})${message ? `: ${message}` : ""}`);
|
|
465
|
+
}
|
|
466
|
+
const payload = await readJsonPayload(response);
|
|
467
|
+
return {
|
|
468
|
+
outputText: parseOutputText(payload)?.trim() || ""
|
|
469
|
+
};
|
|
470
|
+
}
|
|
356
471
|
async compile({ apiKey, profile, input, resumeResponseId, logger }) {
|
|
357
472
|
const sourceText = input.rawText.trim();
|
|
358
473
|
const prompt = [
|
|
@@ -517,11 +632,9 @@ export class OpenAiResponsesProvider {
|
|
|
517
632
|
responseId
|
|
518
633
|
}
|
|
519
634
|
});
|
|
520
|
-
const resumeResponse = await fetch(
|
|
635
|
+
const resumeResponse = await fetch(buildResponsesUrl(profile, responseId), {
|
|
521
636
|
method: "GET",
|
|
522
|
-
headers:
|
|
523
|
-
authorization: `Bearer ${apiKey}`
|
|
524
|
-
},
|
|
637
|
+
headers: buildRequestHeaders(profile, apiKey),
|
|
525
638
|
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
|
|
526
639
|
});
|
|
527
640
|
if (!resumeResponse.ok) {
|
|
@@ -547,12 +660,11 @@ export class OpenAiResponsesProvider {
|
|
|
547
660
|
else {
|
|
548
661
|
let createResponse;
|
|
549
662
|
try {
|
|
550
|
-
createResponse = await fetch(
|
|
663
|
+
createResponse = await fetch(buildResponsesUrl(profile), {
|
|
551
664
|
method: "POST",
|
|
552
|
-
headers: {
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
},
|
|
665
|
+
headers: buildRequestHeaders(profile, apiKey, {
|
|
666
|
+
includeJsonContentType: true
|
|
667
|
+
}),
|
|
556
668
|
body: JSON.stringify({
|
|
557
669
|
model: profile.model,
|
|
558
670
|
input: inputs,
|
|
@@ -646,11 +758,9 @@ export class OpenAiResponsesProvider {
|
|
|
646
758
|
while (!isTerminalBackgroundStatus(readResponseStatus(payload))) {
|
|
647
759
|
await new Promise((resolve) => setTimeout(resolve, BACKGROUND_POLL_INTERVAL_MS));
|
|
648
760
|
try {
|
|
649
|
-
const pollResponse = await fetch(
|
|
761
|
+
const pollResponse = await fetch(buildResponsesUrl(profile, responseId), {
|
|
650
762
|
method: "GET",
|
|
651
|
-
headers:
|
|
652
|
-
authorization: `Bearer ${apiKey}`
|
|
653
|
-
},
|
|
763
|
+
headers: buildRequestHeaders(profile, apiKey),
|
|
654
764
|
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
|
|
655
765
|
});
|
|
656
766
|
if (!pollResponse.ok) {
|