@useorgx/openclaw-plugin 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -1
- package/dashboard/dist/assets/MissionControlView-CthHdl6R.js +1 -0
- package/dashboard/dist/assets/SessionInspector-Dq0Z5WMo.js +1 -0
- package/dashboard/dist/assets/index-CoLgC4zE.js +11 -0
- package/dashboard/dist/assets/index-jfEYE0kO.css +1 -0
- package/dashboard/dist/assets/motion-CVDprFZg.js +9 -0
- package/dashboard/dist/assets/orgx-logo-Fm0FhtnV.png +0 -0
- package/dashboard/dist/assets/react-vendor-C2t2w4r2.js +32 -0
- package/dashboard/dist/assets/tanstack-C-KIc3Wc.js +1 -0
- package/dashboard/dist/assets/vendor-C-AHK0Ly.js +9 -0
- package/dashboard/dist/index.html +6 -2
- package/dist/adapters/outbox.d.ts +8 -0
- package/dist/adapters/outbox.d.ts.map +1 -0
- package/dist/adapters/outbox.js +6 -0
- package/dist/adapters/outbox.js.map +1 -0
- package/dist/agent-context-store.d.ts +24 -0
- package/dist/agent-context-store.d.ts.map +1 -0
- package/dist/agent-context-store.js +111 -0
- package/dist/agent-context-store.js.map +1 -0
- package/dist/agent-run-store.d.ts +31 -0
- package/dist/agent-run-store.d.ts.map +1 -0
- package/dist/agent-run-store.js +159 -0
- package/dist/agent-run-store.js.map +1 -0
- package/dist/api.d.ts +4 -139
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +4 -347
- package/dist/api.js.map +1 -1
- package/dist/auth-store.d.ts.map +1 -1
- package/dist/auth-store.js +56 -35
- package/dist/auth-store.js.map +1 -1
- package/dist/byok-store.d.ts +11 -0
- package/dist/byok-store.d.ts.map +1 -0
- package/dist/byok-store.js +98 -0
- package/dist/byok-store.js.map +1 -0
- package/dist/contracts/client.d.ts +154 -0
- package/dist/contracts/client.d.ts.map +1 -0
- package/dist/contracts/client.js +422 -0
- package/dist/contracts/client.js.map +1 -0
- package/dist/contracts/types.d.ts +430 -0
- package/dist/contracts/types.d.ts.map +1 -0
- package/dist/contracts/types.js +8 -0
- package/dist/contracts/types.js.map +1 -0
- package/dist/fs-utils.d.ts +7 -0
- package/dist/fs-utils.d.ts.map +1 -0
- package/dist/fs-utils.js +63 -0
- package/dist/fs-utils.js.map +1 -0
- package/dist/http-handler.d.ts +27 -1
- package/dist/http-handler.d.ts.map +1 -1
- package/dist/http-handler.js +2520 -92
- package/dist/http-handler.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +352 -27
- package/dist/index.js.map +1 -1
- package/dist/local-openclaw.d.ts.map +1 -1
- package/dist/local-openclaw.js +57 -15
- package/dist/local-openclaw.js.map +1 -1
- package/dist/mcp-apps/orgx-live.html +690 -0
- package/dist/openclaw.plugin.json +3 -3
- package/dist/outbox.d.ts +7 -0
- package/dist/outbox.d.ts.map +1 -1
- package/dist/outbox.js +150 -17
- package/dist/outbox.js.map +1 -1
- package/dist/paths.d.ts +23 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +50 -0
- package/dist/paths.js.map +1 -0
- package/dist/reporting/outbox-replay.d.ts +2 -0
- package/dist/reporting/outbox-replay.d.ts.map +1 -0
- package/dist/reporting/outbox-replay.js +17 -0
- package/dist/reporting/outbox-replay.js.map +1 -0
- package/dist/reporting/rollups.d.ts +21 -0
- package/dist/reporting/rollups.d.ts.map +1 -0
- package/dist/reporting/rollups.js +85 -0
- package/dist/reporting/rollups.js.map +1 -0
- package/dist/snapshot-store.d.ts +10 -0
- package/dist/snapshot-store.d.ts.map +1 -0
- package/dist/snapshot-store.js +68 -0
- package/dist/snapshot-store.js.map +1 -0
- package/dist/types.d.ts +5 -410
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +5 -4
- package/dist/types.js.map +1 -1
- package/openclaw.plugin.json +3 -3
- package/package.json +13 -3
- package/dashboard/dist/assets/index-BrAP-X_H.css +0 -1
- package/dashboard/dist/assets/index-cOk6qwh-.js +0 -56
- package/dashboard/dist/assets/orgx-logo-QSE5QWy4.png +0 -0
package/dist/api.js
CHANGED
|
@@ -1,351 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Public API client entrypoint.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* Uses native fetch — no external dependencies.
|
|
4
|
+
* Kept stable because consumers import `@useorgx/openclaw-plugin/api`.
|
|
5
|
+
* The implementation lives under `src/contracts/client.ts`.
|
|
8
6
|
*/
|
|
9
|
-
|
|
10
|
-
const USER_AGENT = "OrgX-Clawdbot-Plugin/1.0";
|
|
11
|
-
const DECISION_MUTATION_CONCURRENCY = 6;
|
|
12
|
-
export class OrgXClient {
|
|
13
|
-
apiKey;
|
|
14
|
-
baseUrl;
|
|
15
|
-
userId;
|
|
16
|
-
constructor(apiKey, baseUrl, userId) {
|
|
17
|
-
this.apiKey = apiKey;
|
|
18
|
-
this.baseUrl = baseUrl.replace(/\/+$/, "");
|
|
19
|
-
this.userId = userId || "";
|
|
20
|
-
}
|
|
21
|
-
setCredentials(input) {
|
|
22
|
-
if (typeof input.apiKey === "string") {
|
|
23
|
-
this.apiKey = input.apiKey;
|
|
24
|
-
}
|
|
25
|
-
if (typeof input.userId === "string") {
|
|
26
|
-
this.userId = input.userId;
|
|
27
|
-
}
|
|
28
|
-
if (typeof input.baseUrl === "string" && input.baseUrl.trim().length > 0) {
|
|
29
|
-
this.baseUrl = input.baseUrl.replace(/\/+$/, "");
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
getBaseUrl() {
|
|
33
|
-
return this.baseUrl;
|
|
34
|
-
}
|
|
35
|
-
// ===========================================================================
|
|
36
|
-
// HTTP helpers
|
|
37
|
-
// ===========================================================================
|
|
38
|
-
async request(method, path, body) {
|
|
39
|
-
const url = `${this.baseUrl}${path}`;
|
|
40
|
-
const controller = new AbortController();
|
|
41
|
-
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS);
|
|
42
|
-
try {
|
|
43
|
-
const headers = {
|
|
44
|
-
"Content-Type": "application/json",
|
|
45
|
-
"User-Agent": USER_AGENT,
|
|
46
|
-
Authorization: `Bearer ${this.apiKey}`,
|
|
47
|
-
};
|
|
48
|
-
if (this.userId) {
|
|
49
|
-
headers["X-Orgx-User-Id"] = this.userId;
|
|
50
|
-
}
|
|
51
|
-
const response = await fetch(url, {
|
|
52
|
-
method,
|
|
53
|
-
headers,
|
|
54
|
-
body: body ? JSON.stringify(body) : undefined,
|
|
55
|
-
signal: controller.signal,
|
|
56
|
-
});
|
|
57
|
-
if (!response.ok) {
|
|
58
|
-
const text = await response.text().catch(() => "");
|
|
59
|
-
let detail = "";
|
|
60
|
-
if (text) {
|
|
61
|
-
try {
|
|
62
|
-
const parsed = JSON.parse(text);
|
|
63
|
-
const msg = parsed.message ?? parsed.error;
|
|
64
|
-
detail = typeof msg === "string" ? msg : text.slice(0, 200);
|
|
65
|
-
}
|
|
66
|
-
catch {
|
|
67
|
-
detail = text.slice(0, 200);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
throw new Error(`${response.status} ${response.statusText}${detail ? `: ${detail}` : ""}`);
|
|
71
|
-
}
|
|
72
|
-
const contentType = response.headers.get("content-type") ?? "";
|
|
73
|
-
if (contentType.includes("application/json")) {
|
|
74
|
-
return (await response.json());
|
|
75
|
-
}
|
|
76
|
-
return (await response.text());
|
|
77
|
-
}
|
|
78
|
-
catch (err) {
|
|
79
|
-
if (err instanceof DOMException && err.name === "AbortError") {
|
|
80
|
-
throw new Error(`OrgX API ${method} ${path} timed out after ${REQUEST_TIMEOUT_MS}ms`);
|
|
81
|
-
}
|
|
82
|
-
throw err;
|
|
83
|
-
}
|
|
84
|
-
finally {
|
|
85
|
-
clearTimeout(timeout);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
get(path) {
|
|
89
|
-
return this.request("GET", path);
|
|
90
|
-
}
|
|
91
|
-
post(path, body) {
|
|
92
|
-
return this.request("POST", path, body);
|
|
93
|
-
}
|
|
94
|
-
patch(path, body) {
|
|
95
|
-
return this.request("PATCH", path, body);
|
|
96
|
-
}
|
|
97
|
-
buildQuery(params) {
|
|
98
|
-
const entries = Object.entries(params).filter(([, value]) => value !== undefined && value !== null);
|
|
99
|
-
if (entries.length === 0)
|
|
100
|
-
return "";
|
|
101
|
-
const search = new URLSearchParams();
|
|
102
|
-
for (const [key, value] of entries) {
|
|
103
|
-
search.set(key, String(value));
|
|
104
|
-
}
|
|
105
|
-
return `?${search.toString()}`;
|
|
106
|
-
}
|
|
107
|
-
// ===========================================================================
|
|
108
|
-
// Org Snapshot
|
|
109
|
-
// ===========================================================================
|
|
110
|
-
async getOrgSnapshot() {
|
|
111
|
-
// Use the sync endpoint with POST (empty body = pull only)
|
|
112
|
-
const resp = await this.post("/api/client/sync", {});
|
|
113
|
-
const data = resp.data;
|
|
114
|
-
// Transform SyncResponse to OrgSnapshot format
|
|
115
|
-
return {
|
|
116
|
-
initiatives: data.initiatives.map(i => ({
|
|
117
|
-
id: i.id,
|
|
118
|
-
title: i.title,
|
|
119
|
-
status: i.status,
|
|
120
|
-
})),
|
|
121
|
-
agents: [], // Not returned by sync endpoint
|
|
122
|
-
activeTasks: data.activeTasks.map(t => ({
|
|
123
|
-
id: t.id,
|
|
124
|
-
title: t.title,
|
|
125
|
-
status: t.status,
|
|
126
|
-
domain: t.domain,
|
|
127
|
-
modelTier: t.modelTier,
|
|
128
|
-
})),
|
|
129
|
-
pendingDecisions: data.pendingDecisions.map(d => ({
|
|
130
|
-
id: d.id,
|
|
131
|
-
title: d.title,
|
|
132
|
-
urgency: d.urgency,
|
|
133
|
-
})),
|
|
134
|
-
syncedAt: data.syncedAt,
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
// ===========================================================================
|
|
138
|
-
// Memory Sync
|
|
139
|
-
// ===========================================================================
|
|
140
|
-
async syncMemory(payload) {
|
|
141
|
-
const response = await this.post("/api/client/sync", payload);
|
|
142
|
-
if (response &&
|
|
143
|
-
typeof response === "object" &&
|
|
144
|
-
"data" in response &&
|
|
145
|
-
response.data) {
|
|
146
|
-
return response.data;
|
|
147
|
-
}
|
|
148
|
-
return response;
|
|
149
|
-
}
|
|
150
|
-
async delegationPreflight(payload) {
|
|
151
|
-
return this.post("/api/client/delegation/preflight", payload);
|
|
152
|
-
}
|
|
153
|
-
// ===========================================================================
|
|
154
|
-
// Spawn Guard (Quality Gate + Model Routing)
|
|
155
|
-
// ===========================================================================
|
|
156
|
-
async checkSpawnGuard(domain, taskId) {
|
|
157
|
-
return this.post("/api/client/spawn", {
|
|
158
|
-
domain,
|
|
159
|
-
taskId,
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
// ===========================================================================
|
|
163
|
-
// Quality Scores
|
|
164
|
-
// ===========================================================================
|
|
165
|
-
async recordQuality(score) {
|
|
166
|
-
return this.post("/api/client/quality", score);
|
|
167
|
-
}
|
|
168
|
-
// ===========================================================================
|
|
169
|
-
// Entity CRUD
|
|
170
|
-
// Uses /api/entities with type in body (NOT per-type REST paths)
|
|
171
|
-
// ===========================================================================
|
|
172
|
-
/**
|
|
173
|
-
* Create an OrgX entity.
|
|
174
|
-
* POST /api/entities { type, title, summary, status, initiative_id, ... }
|
|
175
|
-
*/
|
|
176
|
-
async createEntity(type, data) {
|
|
177
|
-
const resp = await this.post("/api/entities", {
|
|
178
|
-
type,
|
|
179
|
-
...data,
|
|
180
|
-
});
|
|
181
|
-
return resp.data ?? resp;
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Update an OrgX entity.
|
|
185
|
-
* PATCH /api/entities { type, id, ...updates }
|
|
186
|
-
*/
|
|
187
|
-
async updateEntity(type, id, updates) {
|
|
188
|
-
const resp = await this.patch("/api/entities", {
|
|
189
|
-
type,
|
|
190
|
-
id,
|
|
191
|
-
...updates,
|
|
192
|
-
});
|
|
193
|
-
return resp.data ?? resp;
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* List OrgX entities.
|
|
197
|
-
* GET /api/entities?type={type}&status={status}&limit={n}
|
|
198
|
-
*/
|
|
199
|
-
async listEntities(type, filters) {
|
|
200
|
-
const params = new URLSearchParams({ type });
|
|
201
|
-
if (filters?.status)
|
|
202
|
-
params.set("status", filters.status);
|
|
203
|
-
if (filters?.limit)
|
|
204
|
-
params.set("limit", String(filters.limit));
|
|
205
|
-
if (filters?.initiative_id)
|
|
206
|
-
params.set("initiative_id", String(filters.initiative_id));
|
|
207
|
-
return this.get(`/api/entities?${params.toString()}`);
|
|
208
|
-
}
|
|
209
|
-
// ===========================================================================
|
|
210
|
-
// Reporting Control Plane
|
|
211
|
-
// ===========================================================================
|
|
212
|
-
async emitActivity(payload) {
|
|
213
|
-
const response = await this.post("/api/client/live/activity", payload);
|
|
214
|
-
if (response &&
|
|
215
|
-
typeof response === "object" &&
|
|
216
|
-
"data" in response &&
|
|
217
|
-
response.data) {
|
|
218
|
-
return response.data;
|
|
219
|
-
}
|
|
220
|
-
return response;
|
|
221
|
-
}
|
|
222
|
-
async applyChangeset(payload) {
|
|
223
|
-
const response = await this.post("/api/client/live/changesets/apply", payload);
|
|
224
|
-
if (response &&
|
|
225
|
-
typeof response === "object" &&
|
|
226
|
-
"data" in response &&
|
|
227
|
-
response.data) {
|
|
228
|
-
return response.data;
|
|
229
|
-
}
|
|
230
|
-
return response;
|
|
231
|
-
}
|
|
232
|
-
// ===========================================================================
|
|
233
|
-
// Live Sessions + Activity + Handoffs
|
|
234
|
-
// ===========================================================================
|
|
235
|
-
async getLiveSessions(params) {
|
|
236
|
-
const query = this.buildQuery({
|
|
237
|
-
limit: params?.limit,
|
|
238
|
-
initiative: params?.initiative ?? null,
|
|
239
|
-
});
|
|
240
|
-
return this.get(`/api/client/live/sessions${query}`);
|
|
241
|
-
}
|
|
242
|
-
async getLiveActivity(params) {
|
|
243
|
-
const query = this.buildQuery({
|
|
244
|
-
limit: params?.limit,
|
|
245
|
-
run: params?.run ?? null,
|
|
246
|
-
since: params?.since ?? null,
|
|
247
|
-
});
|
|
248
|
-
return this.get(`/api/client/live/activity${query}`);
|
|
249
|
-
}
|
|
250
|
-
async getLiveAgents(params) {
|
|
251
|
-
const query = this.buildQuery({
|
|
252
|
-
initiative: params?.initiative ?? null,
|
|
253
|
-
include_idle: params?.includeIdle ?? undefined,
|
|
254
|
-
});
|
|
255
|
-
return this.get(`/api/client/live/agents${query}`);
|
|
256
|
-
}
|
|
257
|
-
async getLiveInitiatives(params) {
|
|
258
|
-
const query = this.buildQuery({
|
|
259
|
-
id: params?.id ?? null,
|
|
260
|
-
limit: params?.limit ?? null,
|
|
261
|
-
});
|
|
262
|
-
return this.get(`/api/client/live/initiatives${query}`);
|
|
263
|
-
}
|
|
264
|
-
async getHandoffs() {
|
|
265
|
-
return this.get(`/api/client/handoffs`);
|
|
266
|
-
}
|
|
267
|
-
async runAction(runId, action, payload) {
|
|
268
|
-
const encodedRunId = encodeURIComponent(runId);
|
|
269
|
-
const encodedAction = encodeURIComponent(action);
|
|
270
|
-
return this.post(`/api/client/runs/${encodedRunId}/actions/${encodedAction}`, payload ?? {});
|
|
271
|
-
}
|
|
272
|
-
async listRunCheckpoints(runId) {
|
|
273
|
-
const encodedRunId = encodeURIComponent(runId);
|
|
274
|
-
return this.get(`/api/client/runs/${encodedRunId}/checkpoints`);
|
|
275
|
-
}
|
|
276
|
-
async createRunCheckpoint(runId, payload) {
|
|
277
|
-
const encodedRunId = encodeURIComponent(runId);
|
|
278
|
-
return this.post(`/api/client/runs/${encodedRunId}/checkpoints`, payload ?? {});
|
|
279
|
-
}
|
|
280
|
-
async restoreRunCheckpoint(runId, request) {
|
|
281
|
-
const encodedRunId = encodeURIComponent(runId);
|
|
282
|
-
const encodedCheckpointId = encodeURIComponent(request.checkpointId);
|
|
283
|
-
return this.post(`/api/client/runs/${encodedRunId}/checkpoints/${encodedCheckpointId}/restore`, { reason: request.reason });
|
|
284
|
-
}
|
|
285
|
-
async getLiveDecisions(params) {
|
|
286
|
-
const response = await this.listEntities("decision", {
|
|
287
|
-
status: params?.status,
|
|
288
|
-
limit: params?.limit,
|
|
289
|
-
});
|
|
290
|
-
const decisions = Array.isArray(response.data) ? response.data : [];
|
|
291
|
-
return {
|
|
292
|
-
decisions,
|
|
293
|
-
total: response.pagination?.total ?? decisions.length,
|
|
294
|
-
};
|
|
295
|
-
}
|
|
296
|
-
async decideDecision(id, action, note) {
|
|
297
|
-
const resolvedStatus = action === "approve" ? "approved" : "rejected";
|
|
298
|
-
const resolvedAt = new Date().toISOString();
|
|
299
|
-
try {
|
|
300
|
-
return await this.updateEntity("decision", id, {
|
|
301
|
-
status: resolvedStatus,
|
|
302
|
-
resolution: resolvedStatus,
|
|
303
|
-
resolved_at: resolvedAt,
|
|
304
|
-
decided_at: resolvedAt,
|
|
305
|
-
decided_by: this.userId || undefined,
|
|
306
|
-
note: note ?? undefined,
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
catch {
|
|
310
|
-
// Fallback for backends that only support generic "resolved" status.
|
|
311
|
-
return this.updateEntity("decision", id, {
|
|
312
|
-
status: "resolved",
|
|
313
|
-
decision_status: resolvedStatus,
|
|
314
|
-
resolution: resolvedStatus,
|
|
315
|
-
resolved_at: resolvedAt,
|
|
316
|
-
decided_at: resolvedAt,
|
|
317
|
-
note: note ?? undefined,
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
async bulkDecideDecisions(ids, action, note) {
|
|
322
|
-
const uniqueIds = Array.from(new Set(ids.filter(Boolean)));
|
|
323
|
-
const results = new Array(uniqueIds.length);
|
|
324
|
-
let cursor = 0;
|
|
325
|
-
const worker = async () => {
|
|
326
|
-
while (true) {
|
|
327
|
-
const index = cursor;
|
|
328
|
-
cursor += 1;
|
|
329
|
-
if (index >= uniqueIds.length) {
|
|
330
|
-
return;
|
|
331
|
-
}
|
|
332
|
-
const id = uniqueIds[index];
|
|
333
|
-
try {
|
|
334
|
-
const entity = await this.decideDecision(id, action, note);
|
|
335
|
-
results[index] = { id, ok: true, entity };
|
|
336
|
-
}
|
|
337
|
-
catch (err) {
|
|
338
|
-
results[index] = {
|
|
339
|
-
id,
|
|
340
|
-
ok: false,
|
|
341
|
-
error: err instanceof Error ? err.message : String(err),
|
|
342
|
-
};
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
};
|
|
346
|
-
const concurrency = Math.min(DECISION_MUTATION_CONCURRENCY, Math.max(1, uniqueIds.length));
|
|
347
|
-
await Promise.all(Array.from({ length: concurrency }, () => worker()));
|
|
348
|
-
return results;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
7
|
+
export * from "./contracts/client.js";
|
|
351
8
|
//# sourceMappingURL=api.js.map
|
package/dist/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAsBH,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAClC,MAAM,UAAU,GAAG,0BAA0B,CAAC;AAC9C,MAAM,6BAA6B,GAAG,CAAC,CAAC;AAYxC,MAAM,OAAO,UAAU;IACb,MAAM,CAAS;IACf,OAAO,CAAS;IAChB,MAAM,CAAS;IAEvB,YAAY,MAAc,EAAE,OAAe,EAAE,MAAe;QAC1D,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC3C,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,EAAE,CAAC;IAC7B,CAAC;IAED,cAAc,CAAC,KAA6D;QAC1E,IAAI,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;YACrC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAC7B,CAAC;QACD,IAAI,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;YACr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api.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,uBAAuB,CAAC"}
|
package/dist/auth-store.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-store.d.ts","sourceRoot":"","sources":["../src/auth-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth-store.d.ts","sourceRoot":"","sources":["../src/auth-store.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,QAAQ,GAAG,iBAAiB,CAAC;IACrC,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AA8BD,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED,wBAAgB,iBAAiB,IAAI,mBAAmB,GAAG,IAAI,CA8B9D;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,IAAI,CAAC,mBAAmB,EAAE,WAAW,GAAG,WAAW,CAAC,GAC1D,mBAAmB,CAsBrB;AAED,wBAAgB,kBAAkB,IAAI,IAAI,CAOzC;AAoBD,wBAAgB,yBAAyB,IAAI,MAAM,CAiBlD;AAGD,wBAAgB,aAAa,IAAI,mBAAmB,GAAG,IAAI,CAE1D;AAED,wBAAgB,aAAa,CAC3B,KAAK,EAAE,IAAI,CAAC,mBAAmB,EAAE,WAAW,GAAG,WAAW,CAAC,GAC1D,mBAAmB,CAErB;AAED,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C"}
|
package/dist/auth-store.js
CHANGED
|
@@ -1,14 +1,24 @@
|
|
|
1
|
-
import { mkdirSync, readFileSync,
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import { homedir } from 'node:os';
|
|
1
|
+
import { mkdirSync, readFileSync, chmodSync, existsSync, rmSync } from 'node:fs';
|
|
4
2
|
import { randomUUID } from 'node:crypto';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import { getOrgxPluginConfigDir, getOrgxPluginConfigPath } from './paths.js';
|
|
4
|
+
import { backupCorruptFileSync, writeJsonFileAtomicSync } from './fs-utils.js';
|
|
5
|
+
function authDir() {
|
|
6
|
+
return getOrgxPluginConfigDir();
|
|
7
|
+
}
|
|
8
|
+
function authFile() {
|
|
9
|
+
return getOrgxPluginConfigPath('auth.json');
|
|
10
|
+
}
|
|
11
|
+
function installationFile() {
|
|
12
|
+
return getOrgxPluginConfigPath('installation.json');
|
|
13
|
+
}
|
|
14
|
+
function isUserScopedApiKey(apiKey) {
|
|
15
|
+
return apiKey.trim().toLowerCase().startsWith('oxk_');
|
|
16
|
+
}
|
|
8
17
|
function ensureAuthDir() {
|
|
9
|
-
|
|
18
|
+
const dir = authDir();
|
|
19
|
+
mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
10
20
|
try {
|
|
11
|
-
chmodSync(
|
|
21
|
+
chmodSync(dir, 0o700);
|
|
12
22
|
}
|
|
13
23
|
catch {
|
|
14
24
|
// best effort
|
|
@@ -23,16 +33,33 @@ function parseJson(value) {
|
|
|
23
33
|
}
|
|
24
34
|
}
|
|
25
35
|
export function getAuthFilePath() {
|
|
26
|
-
return
|
|
36
|
+
return authFile();
|
|
27
37
|
}
|
|
28
38
|
export function readPersistedAuth() {
|
|
39
|
+
const file = authFile();
|
|
29
40
|
try {
|
|
30
|
-
if (!existsSync(
|
|
41
|
+
if (!existsSync(file))
|
|
42
|
+
return null;
|
|
43
|
+
const raw = readFileSync(file, 'utf8');
|
|
44
|
+
const parsed = parseJson(raw);
|
|
45
|
+
if (!parsed) {
|
|
46
|
+
backupCorruptFileSync(file);
|
|
31
47
|
return null;
|
|
32
|
-
|
|
48
|
+
}
|
|
33
49
|
if (!parsed || typeof parsed.apiKey !== 'string' || parsed.apiKey.trim().length === 0) {
|
|
34
50
|
return null;
|
|
35
51
|
}
|
|
52
|
+
if (isUserScopedApiKey(parsed.apiKey) &&
|
|
53
|
+
typeof parsed.userId === 'string' &&
|
|
54
|
+
parsed.userId.trim().length > 0) {
|
|
55
|
+
const sanitized = {
|
|
56
|
+
...parsed,
|
|
57
|
+
userId: null,
|
|
58
|
+
updatedAt: new Date().toISOString(),
|
|
59
|
+
};
|
|
60
|
+
writeJsonFileAtomicSync(file, sanitized, 0o600);
|
|
61
|
+
return sanitized;
|
|
62
|
+
}
|
|
36
63
|
return parsed;
|
|
37
64
|
}
|
|
38
65
|
catch {
|
|
@@ -43,41 +70,43 @@ export function writePersistedAuth(input) {
|
|
|
43
70
|
ensureAuthDir();
|
|
44
71
|
const now = new Date().toISOString();
|
|
45
72
|
const existing = readPersistedAuth();
|
|
73
|
+
const normalizedUserId = isUserScopedApiKey(input.apiKey)
|
|
74
|
+
? null
|
|
75
|
+
: input.userId ?? null;
|
|
46
76
|
const next = {
|
|
47
77
|
apiKey: input.apiKey,
|
|
48
78
|
source: input.source,
|
|
49
79
|
installationId: input.installationId,
|
|
50
|
-
userId:
|
|
80
|
+
userId: normalizedUserId,
|
|
51
81
|
workspaceName: input.workspaceName ?? null,
|
|
52
82
|
keyPrefix: input.keyPrefix ?? null,
|
|
53
83
|
createdAt: existing?.createdAt ?? now,
|
|
54
84
|
updatedAt: now,
|
|
55
85
|
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
encoding: 'utf8',
|
|
59
|
-
});
|
|
60
|
-
try {
|
|
61
|
-
chmodSync(AUTH_FILE, 0o600);
|
|
62
|
-
}
|
|
63
|
-
catch {
|
|
64
|
-
// best effort
|
|
65
|
-
}
|
|
86
|
+
const file = authFile();
|
|
87
|
+
writeJsonFileAtomicSync(file, next, 0o600);
|
|
66
88
|
return next;
|
|
67
89
|
}
|
|
68
90
|
export function clearPersistedAuth() {
|
|
91
|
+
const file = authFile();
|
|
69
92
|
try {
|
|
70
|
-
rmSync(
|
|
93
|
+
rmSync(file, { force: true });
|
|
71
94
|
}
|
|
72
95
|
catch {
|
|
73
96
|
// best effort
|
|
74
97
|
}
|
|
75
98
|
}
|
|
76
99
|
function readInstallationRecord() {
|
|
100
|
+
const file = installationFile();
|
|
77
101
|
try {
|
|
78
|
-
if (!existsSync(
|
|
102
|
+
if (!existsSync(file))
|
|
103
|
+
return null;
|
|
104
|
+
const raw = readFileSync(file, 'utf8');
|
|
105
|
+
const parsed = parseJson(raw);
|
|
106
|
+
if (!parsed) {
|
|
107
|
+
backupCorruptFileSync(file);
|
|
79
108
|
return null;
|
|
80
|
-
|
|
109
|
+
}
|
|
81
110
|
if (!parsed || typeof parsed.installationId !== 'string')
|
|
82
111
|
return null;
|
|
83
112
|
if (parsed.installationId.trim().length < 6)
|
|
@@ -100,16 +129,8 @@ export function getOrCreateInstallationId() {
|
|
|
100
129
|
createdAt: now,
|
|
101
130
|
updatedAt: now,
|
|
102
131
|
};
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
encoding: 'utf8',
|
|
106
|
-
});
|
|
107
|
-
try {
|
|
108
|
-
chmodSync(INSTALLATION_FILE, 0o600);
|
|
109
|
-
}
|
|
110
|
-
catch {
|
|
111
|
-
// best effort
|
|
112
|
-
}
|
|
132
|
+
const file = installationFile();
|
|
133
|
+
writeJsonFileAtomicSync(file, record, 0o600);
|
|
113
134
|
return installationId;
|
|
114
135
|
}
|
|
115
136
|
// Backward-compatible aliases used by the runtime.
|
package/dist/auth-store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-store.js","sourceRoot":"","sources":["../src/auth-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"auth-store.js","sourceRoot":"","sources":["../src/auth-store.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,QAAQ;YAAE,OAAO,IAAI,CAAC;QACtE,IAAI,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QACzD,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,UAAU,yBAAyB;IACvC,MAAM,QAAQ,GAAG,sBAAsB,EAAE,CAAC;IAC1C,IAAI,QAAQ,EAAE,cAAc;QAAE,OAAO,QAAQ,CAAC,cAAc,CAAC;IAE7D,aAAa,EAAE,CAAC;IAChB,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACrC,MAAM,cAAc,GAAG,OAAO,UAAU,EAAE,EAAE,CAAC;IAC7C,MAAM,MAAM,GAAuB;QACjC,cAAc;QACd,SAAS,EAAE,GAAG;QACd,SAAS,EAAE,GAAG;KACf,CAAC;IAEF,MAAM,IAAI,GAAG,gBAAgB,EAAE,CAAC;IAChC,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IAE7C,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,mDAAmD;AACnD,MAAM,UAAU,aAAa;IAC3B,OAAO,iBAAiB,EAAE,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,aAAa,CAC3B,KAA2D;IAE3D,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,qBAAqB;IACnC,OAAO,yBAAyB,EAAE,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,oBAAoB;IAClC,kBAAkB,EAAE,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface ByokKeysRecord {
|
|
2
|
+
openaiApiKey: string | null;
|
|
3
|
+
anthropicApiKey: string | null;
|
|
4
|
+
openrouterApiKey: string | null;
|
|
5
|
+
createdAt: string;
|
|
6
|
+
updatedAt: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function readByokKeys(): ByokKeysRecord | null;
|
|
9
|
+
export declare function writeByokKeys(input: Partial<ByokKeysRecord>): ByokKeysRecord;
|
|
10
|
+
export declare function clearByokKeys(): void;
|
|
11
|
+
//# sourceMappingURL=byok-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"byok-store.d.ts","sourceRoot":"","sources":["../src/byok-store.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AA2BD,wBAAgB,YAAY,IAAI,cAAc,GAAG,IAAI,CA6BpD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,cAAc,CAwB5E;AAED,wBAAgB,aAAa,IAAI,IAAI,CAOpC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { chmodSync, existsSync, mkdirSync, readFileSync, rmSync } from "node:fs";
|
|
2
|
+
import { getOrgxPluginConfigDir, getOrgxPluginConfigPath } from "./paths.js";
|
|
3
|
+
import { backupCorruptFileSync, writeJsonFileAtomicSync } from "./fs-utils.js";
|
|
4
|
+
function configDir() {
|
|
5
|
+
return getOrgxPluginConfigDir();
|
|
6
|
+
}
|
|
7
|
+
function byokFile() {
|
|
8
|
+
return getOrgxPluginConfigPath("byok.json");
|
|
9
|
+
}
|
|
10
|
+
function ensureConfigDir() {
|
|
11
|
+
const dir = configDir();
|
|
12
|
+
mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
13
|
+
try {
|
|
14
|
+
chmodSync(dir, 0o700);
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
// best effort
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function parseJson(value) {
|
|
21
|
+
try {
|
|
22
|
+
return JSON.parse(value);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function normalizeKey(value) {
|
|
29
|
+
if (typeof value !== "string")
|
|
30
|
+
return null;
|
|
31
|
+
const trimmed = value.trim();
|
|
32
|
+
if (!trimmed)
|
|
33
|
+
return null;
|
|
34
|
+
return trimmed;
|
|
35
|
+
}
|
|
36
|
+
export function readByokKeys() {
|
|
37
|
+
const file = byokFile();
|
|
38
|
+
try {
|
|
39
|
+
if (!existsSync(file))
|
|
40
|
+
return null;
|
|
41
|
+
const raw = readFileSync(file, "utf8");
|
|
42
|
+
const parsed = parseJson(raw);
|
|
43
|
+
if (!parsed) {
|
|
44
|
+
backupCorruptFileSync(file);
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
if (!parsed || typeof parsed !== "object")
|
|
48
|
+
return null;
|
|
49
|
+
const createdAt = typeof parsed.createdAt === "string" && parsed.createdAt.trim().length > 0
|
|
50
|
+
? parsed.createdAt
|
|
51
|
+
: new Date().toISOString();
|
|
52
|
+
const updatedAt = typeof parsed.updatedAt === "string" && parsed.updatedAt.trim().length > 0
|
|
53
|
+
? parsed.updatedAt
|
|
54
|
+
: createdAt;
|
|
55
|
+
return {
|
|
56
|
+
openaiApiKey: normalizeKey(parsed.openaiApiKey) ?? null,
|
|
57
|
+
anthropicApiKey: normalizeKey(parsed.anthropicApiKey) ?? null,
|
|
58
|
+
openrouterApiKey: normalizeKey(parsed.openrouterApiKey) ?? null,
|
|
59
|
+
createdAt,
|
|
60
|
+
updatedAt,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
export function writeByokKeys(input) {
|
|
68
|
+
ensureConfigDir();
|
|
69
|
+
const now = new Date().toISOString();
|
|
70
|
+
const existing = readByokKeys();
|
|
71
|
+
const has = (key) => Object.prototype.hasOwnProperty.call(input, key);
|
|
72
|
+
const next = {
|
|
73
|
+
openaiApiKey: has("openaiApiKey")
|
|
74
|
+
? normalizeKey(input.openaiApiKey)
|
|
75
|
+
: existing?.openaiApiKey ?? null,
|
|
76
|
+
anthropicApiKey: has("anthropicApiKey")
|
|
77
|
+
? normalizeKey(input.anthropicApiKey)
|
|
78
|
+
: existing?.anthropicApiKey ?? null,
|
|
79
|
+
openrouterApiKey: has("openrouterApiKey")
|
|
80
|
+
? normalizeKey(input.openrouterApiKey)
|
|
81
|
+
: existing?.openrouterApiKey ?? null,
|
|
82
|
+
createdAt: existing?.createdAt ?? now,
|
|
83
|
+
updatedAt: now,
|
|
84
|
+
};
|
|
85
|
+
const file = byokFile();
|
|
86
|
+
writeJsonFileAtomicSync(file, next, 0o600);
|
|
87
|
+
return next;
|
|
88
|
+
}
|
|
89
|
+
export function clearByokKeys() {
|
|
90
|
+
const file = byokFile();
|
|
91
|
+
try {
|
|
92
|
+
rmSync(file, { force: true });
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
// best effort
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=byok-store.js.map
|