@sideboard-ai/core 0.1.279 → 0.1.281
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/dist/{abletime-VCVPSLSU.js → abletime-WLDBJJUI.js} +3 -3
- package/dist/{abletime-VRATUMDO.js → abletime-X64E3GUJ.js} +3 -3
- package/dist/{abletime-oauth-4K7MICAD.js → abletime-oauth-AXR676W5.js} +2 -2
- package/dist/{abletime-oauth-4C4G2J3R.js → abletime-oauth-UWOCEICP.js} +2 -2
- package/dist/{abletime-rest-PIBCNHF3.js → abletime-rest-LPUDJUEP.js} +2 -2
- package/dist/{abletime-rest-6N63ZVQ3.js → abletime-rest-S4XWEXV2.js} +2 -2
- package/dist/{agents-DYCFLDNL.js → agents-2IE4HKHA.js} +5 -5
- package/dist/{agents-RXP5NZBC.js → agents-XA2E64AW.js} +5 -5
- package/dist/{chunk-V5DMHB6Y.js → chunk-2KNO2GJQ.js} +781 -159
- package/dist/{chunk-TZ5JHIYK.js → chunk-2SJXQ4UX.js} +68 -21
- package/dist/{chunk-K7MWJLR7.js → chunk-5MGLNVNK.js} +6 -906
- package/dist/{chunk-RK5PIWCW.js → chunk-ADXVTKLC.js} +12 -4
- package/dist/{chunk-Y7JPL4WA.js → chunk-BDAUPNHL.js} +3 -4
- package/dist/{chunk-R7HLXD4I.js → chunk-BS3QLVPL.js} +93 -57
- package/dist/{chunk-CPGJ5ICZ.js → chunk-BYZ7F2BQ.js} +766 -148
- package/dist/{chunk-2J34G3WJ.js → chunk-DGPROCE5.js} +93 -57
- package/dist/{chunk-HQXBBUQX.js → chunk-DQZPF6WL.js} +12 -11
- package/dist/{chunk-YDXNCBA2.js → chunk-EIEAR62M.js} +12 -11
- package/dist/{chunk-XKZAVGTT.js → chunk-I6HSGKMZ.js} +1 -1
- package/dist/chunk-JPH7PYSK.js +1241 -0
- package/dist/{chunk-IPPY3FG5.js → chunk-K5XSTHHP.js} +6 -906
- package/dist/chunk-N5UGX3JL.js +1239 -0
- package/dist/{chunk-HNNS25SG.js → chunk-OCUIZD4Y.js} +14 -4
- package/dist/{chunk-IJDQKC5A.js → chunk-PY4UCMRI.js} +4 -4
- package/dist/{chunk-NQ7JMVSU.js → chunk-U7HAVAGJ.js} +1 -1
- package/dist/{chunk-PZURG3XN.js → chunk-VA55JG2I.js} +4 -4
- package/dist/{chunk-CPA43FBK.js → chunk-W7HIK2A6.js} +3 -4
- package/dist/{chunk-SKSOCIJT.js → chunk-WY2IAB7J.js} +68 -21
- package/dist/{chunk-QINJKNLR.js → chunk-XTPQEZZA.js} +2 -2
- package/dist/{conductor-J6WDOXWM.js → conductor-CNSCOC54.js} +5 -5
- package/dist/{conductor-OW6NAK3N.js → conductor-U776JSXQ.js} +5 -5
- package/dist/{coordinator-prompt-Z2D32HWK.js → coordinator-prompt-4DJIHSE6.js} +3 -3
- package/dist/{coordinator-prompt-ERTHREGJ.js → coordinator-prompt-SVVGU6AZ.js} +3 -3
- package/dist/{global-workspace-5PJXO45Z.js → global-workspace-UPUDWIS6.js} +3 -3
- package/dist/{global-workspace-AK5PSPQ2.js → global-workspace-XON4YZXE.js} +3 -3
- package/dist/index.cjs +3819 -2995
- package/dist/index.d.cts +103 -30
- package/dist/index.d.ts +103 -30
- package/dist/index.js +1013 -1001
- package/dist/mcp/run-stdio.cjs +2075 -1313
- package/dist/mcp/run-stdio.js +743 -785
- package/dist/{orchestrator-KY2KBBE2.js → orchestrator-FPGVKEID.js} +7 -7
- package/dist/{orchestrator-E5WK57DA.js → orchestrator-HWJHK5NL.js} +7 -7
- package/dist/{thread-store-B3ZM4QEZ.js → thread-store-7XBOUQ5K.js} +1 -1
- package/dist/{thread-store-SHCUBWB3.js → thread-store-ZQZDREVH.js} +1 -1
- package/dist/{workspaces-UP6DQ3WL.js → workspaces-7AJ5RZ3P.js} +7 -3
- package/dist/{workspaces-WU2RNLDV.js → workspaces-F76BWCSI.js} +7 -3
- package/dist/{worktree-L57T3KH7.js → worktree-NKLNVNXX.js} +20 -15
- package/dist/{worktree-Q6UJHG25.js → worktree-YTZC3UQN.js} +14 -9
- package/package.json +1 -1
- package/dist/chunk-FWNL62VA.js +0 -308
- package/dist/chunk-JANCPF7Z.js +0 -310
package/dist/chunk-JANCPF7Z.js
DELETED
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
cursorSdkStoreDir
|
|
5
|
-
} from "./chunk-4RZRHTSZ.js";
|
|
6
|
-
import {
|
|
7
|
-
normalizeThinkingEffort
|
|
8
|
-
} from "./chunk-KGZBYWZ3.js";
|
|
9
|
-
import {
|
|
10
|
-
threadFilePath,
|
|
11
|
-
threadLockPath,
|
|
12
|
-
threadsDir
|
|
13
|
-
} from "./chunk-H5XL4KUS.js";
|
|
14
|
-
|
|
15
|
-
// src/store/thread-store.ts
|
|
16
|
-
import { randomUUID } from "crypto";
|
|
17
|
-
import {
|
|
18
|
-
existsSync,
|
|
19
|
-
readFileSync,
|
|
20
|
-
renameSync,
|
|
21
|
-
rmSync,
|
|
22
|
-
statSync,
|
|
23
|
-
unlinkSync,
|
|
24
|
-
writeFileSync,
|
|
25
|
-
readdirSync
|
|
26
|
-
} from "fs";
|
|
27
|
-
import { basename } from "path";
|
|
28
|
-
import lockfile from "proper-lockfile";
|
|
29
|
-
function nowIso() {
|
|
30
|
-
return (/* @__PURE__ */ new Date()).toISOString();
|
|
31
|
-
}
|
|
32
|
-
function resolveThreadEffort(raw) {
|
|
33
|
-
const fromField = normalizeThinkingEffort(raw.effort);
|
|
34
|
-
if (fromField) return fromField;
|
|
35
|
-
if (raw.fast) return "low";
|
|
36
|
-
return "high";
|
|
37
|
-
}
|
|
38
|
-
function normalizeRunScriptRequest(raw) {
|
|
39
|
-
if (!raw || typeof raw !== "object") return void 0;
|
|
40
|
-
const req = raw;
|
|
41
|
-
if (req.op !== "start" && req.op !== "stop") return void 0;
|
|
42
|
-
if (typeof req.requestId !== "string" || !req.requestId.trim()) return void 0;
|
|
43
|
-
if (typeof req.requestedAt !== "string" || !req.requestedAt.trim()) return void 0;
|
|
44
|
-
return {
|
|
45
|
-
op: req.op,
|
|
46
|
-
scriptName: req.scriptName ?? null,
|
|
47
|
-
requestId: req.requestId,
|
|
48
|
-
requestedAt: req.requestedAt,
|
|
49
|
-
claimedAt: req.claimedAt ?? null,
|
|
50
|
-
fulfilledAt: req.fulfilledAt ?? null,
|
|
51
|
-
error: req.error ?? null
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
function normalizeThread(raw) {
|
|
55
|
-
return {
|
|
56
|
-
...raw,
|
|
57
|
-
model: raw.model ?? null,
|
|
58
|
-
effort: resolveThreadEffort(raw),
|
|
59
|
-
fast: Boolean(raw.fast),
|
|
60
|
-
planMode: Boolean(raw.planMode),
|
|
61
|
-
isolateCodexPlugins: raw.isolateCodexPlugins === true ? true : void 0,
|
|
62
|
-
autonomy: raw.autonomy ?? "default",
|
|
63
|
-
lastError: raw.lastError ?? null,
|
|
64
|
-
agentPid: raw.agentPid ?? null,
|
|
65
|
-
attachments: Array.isArray(raw.attachments) ? raw.attachments : [],
|
|
66
|
-
pendingTurnAttachments: Array.isArray(raw.pendingTurnAttachments) ? raw.pendingTurnAttachments : [],
|
|
67
|
-
queueAttachments: Array.isArray(raw.queueAttachments) ? raw.queueAttachments : [],
|
|
68
|
-
prTitle: raw.prTitle ?? null,
|
|
69
|
-
prState: raw.prState ?? null,
|
|
70
|
-
prIsDraft: Boolean(raw.prIsDraft),
|
|
71
|
-
prReviewDecision: raw.prReviewDecision ?? null,
|
|
72
|
-
prMergeable: raw.prMergeable ?? null,
|
|
73
|
-
prMergeStateStatus: raw.prMergeStateStatus ?? null,
|
|
74
|
-
prIsInMergeQueue: Boolean(raw.prIsInMergeQueue),
|
|
75
|
-
prLabels: Array.isArray(raw.prLabels) ? raw.prLabels : [],
|
|
76
|
-
prChecksFailed: typeof raw.prChecksFailed === "boolean" ? raw.prChecksFailed : void 0,
|
|
77
|
-
skipAutoArchiveOnMerge: Boolean(raw.skipAutoArchiveOnMerge),
|
|
78
|
-
cowboy: Boolean(raw.cowboy),
|
|
79
|
-
stackId: raw.stackId ?? null,
|
|
80
|
-
stackLayer: raw.stackLayer ?? null,
|
|
81
|
-
userSetTitle: Boolean(raw.userSetTitle),
|
|
82
|
-
activeRuns: Array.isArray(raw.activeRuns) ? raw.activeRuns : [],
|
|
83
|
-
runScriptRequest: normalizeRunScriptRequest(raw.runScriptRequest),
|
|
84
|
-
quotaResumeAt: raw.quotaResumeAt ?? null,
|
|
85
|
-
quotaContinuedFromId: raw.quotaContinuedFromId ?? null,
|
|
86
|
-
accountId: raw.accountId === null ? null : typeof raw.accountId === "string" && raw.accountId.trim() ? raw.accountId.trim() : void 0,
|
|
87
|
-
archivedAt: typeof raw.archivedAt === "string" && raw.archivedAt.trim() ? raw.archivedAt.trim() : void 0,
|
|
88
|
-
compactedMessages: Array.isArray(raw.compactedMessages) ? raw.compactedMessages : void 0
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
function createEmptyThread(partial) {
|
|
92
|
-
const ts = nowIso();
|
|
93
|
-
return {
|
|
94
|
-
id: randomUUID(),
|
|
95
|
-
sessionId: partial.sessionId ?? null,
|
|
96
|
-
autonomy: partial.autonomy ?? "default",
|
|
97
|
-
model: partial.model ?? null,
|
|
98
|
-
effort: partial.effort ?? "high",
|
|
99
|
-
fast: partial.fast ?? false,
|
|
100
|
-
planMode: partial.planMode ?? false,
|
|
101
|
-
sourceIsFork: partial.sourceIsFork ?? false,
|
|
102
|
-
status: partial.status ?? "idle",
|
|
103
|
-
queue: partial.queue ?? [],
|
|
104
|
-
parentThreadId: partial.parentThreadId ?? null,
|
|
105
|
-
devPort: partial.devPort ?? null,
|
|
106
|
-
activeRuns: partial.activeRuns ?? [],
|
|
107
|
-
prUrl: partial.prUrl ?? null,
|
|
108
|
-
prTitle: partial.prTitle ?? null,
|
|
109
|
-
prState: partial.prState ?? null,
|
|
110
|
-
prIsDraft: Boolean(partial.prIsDraft),
|
|
111
|
-
prAuthorLogin: partial.prAuthorLogin?.trim() || null,
|
|
112
|
-
prReviewerLogins: partial.prReviewerLogins ?? [],
|
|
113
|
-
prReviewDecision: partial.prReviewDecision ?? null,
|
|
114
|
-
prMergeable: partial.prMergeable ?? null,
|
|
115
|
-
prMergeStateStatus: partial.prMergeStateStatus ?? null,
|
|
116
|
-
prIsInMergeQueue: Boolean(partial.prIsInMergeQueue),
|
|
117
|
-
prLabels: partial.prLabels ?? [],
|
|
118
|
-
prChecksFailed: partial.prChecksFailed,
|
|
119
|
-
skipAutoArchiveOnMerge: partial.skipAutoArchiveOnMerge ?? false,
|
|
120
|
-
cowboy: Boolean(partial.cowboy),
|
|
121
|
-
stackId: partial.stackId ?? null,
|
|
122
|
-
stackLayer: partial.stackLayer ?? null,
|
|
123
|
-
userSetTitle: partial.userSetTitle ?? false,
|
|
124
|
-
messages: partial.messages ?? [],
|
|
125
|
-
attachments: partial.attachments ?? [],
|
|
126
|
-
pendingTurnAttachments: partial.pendingTurnAttachments ?? [],
|
|
127
|
-
queueAttachments: partial.queueAttachments ?? [],
|
|
128
|
-
createdAt: ts,
|
|
129
|
-
updatedAt: ts,
|
|
130
|
-
archivedAt: typeof partial.archivedAt === "string" && partial.archivedAt.trim() ? partial.archivedAt.trim() : void 0,
|
|
131
|
-
title: partial.title,
|
|
132
|
-
sourceType: partial.sourceType,
|
|
133
|
-
sourceRef: partial.sourceRef,
|
|
134
|
-
branchName: partial.branchName,
|
|
135
|
-
worktreePath: partial.worktreePath,
|
|
136
|
-
repoPath: partial.repoPath,
|
|
137
|
-
agent: partial.agent,
|
|
138
|
-
lastError: null,
|
|
139
|
-
agentPid: null,
|
|
140
|
-
...partial.accountId !== void 0 ? { accountId: partial.accountId } : {}
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
async function withThreadLock(id, fn) {
|
|
144
|
-
const lockPath = threadLockPath(id);
|
|
145
|
-
writeFileSync(lockPath, "", { flag: "a" });
|
|
146
|
-
let release;
|
|
147
|
-
try {
|
|
148
|
-
release = await lockfile.lock(lockPath, {
|
|
149
|
-
retries: { retries: 10, minTimeout: 50, maxTimeout: 200 },
|
|
150
|
-
stale: 6e4
|
|
151
|
-
});
|
|
152
|
-
return await fn();
|
|
153
|
-
} finally {
|
|
154
|
-
if (release) await release();
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
var listCache = null;
|
|
158
|
-
function cacheForDir() {
|
|
159
|
-
const dir = threadsDir();
|
|
160
|
-
if (!listCache || listCache.dir !== dir) {
|
|
161
|
-
listCache = { dir, byId: /* @__PURE__ */ new Map(), mtimeMs: /* @__PURE__ */ new Map() };
|
|
162
|
-
}
|
|
163
|
-
return listCache;
|
|
164
|
-
}
|
|
165
|
-
function fileMtimeMs(path) {
|
|
166
|
-
try {
|
|
167
|
-
return statSync(path).mtimeMs;
|
|
168
|
-
} catch {
|
|
169
|
-
return null;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
function rememberThread(thread, mtimeMs) {
|
|
173
|
-
const cache = cacheForDir();
|
|
174
|
-
cache.byId.set(thread.id, thread);
|
|
175
|
-
if (mtimeMs != null) cache.mtimeMs.set(thread.id, mtimeMs);
|
|
176
|
-
}
|
|
177
|
-
function forgetThread(id) {
|
|
178
|
-
const cache = cacheForDir();
|
|
179
|
-
cache.byId.delete(id);
|
|
180
|
-
cache.mtimeMs.delete(id);
|
|
181
|
-
selfWriteMtimes.delete(id);
|
|
182
|
-
}
|
|
183
|
-
function invalidateThreadListCache() {
|
|
184
|
-
listCache = null;
|
|
185
|
-
}
|
|
186
|
-
function invalidateThreadRecord(id) {
|
|
187
|
-
if (!id) return;
|
|
188
|
-
forgetThread(id);
|
|
189
|
-
}
|
|
190
|
-
function readThread(id) {
|
|
191
|
-
const path = threadFilePath(id);
|
|
192
|
-
const mtimeMs = fileMtimeMs(path);
|
|
193
|
-
if (mtimeMs == null) {
|
|
194
|
-
forgetThread(id);
|
|
195
|
-
return null;
|
|
196
|
-
}
|
|
197
|
-
const cache = cacheForDir();
|
|
198
|
-
const cached = cache.byId.get(id);
|
|
199
|
-
if (cached && cache.mtimeMs.get(id) === mtimeMs) return cached;
|
|
200
|
-
const raw = readFileSync(path, "utf8");
|
|
201
|
-
const thread = normalizeThread(JSON.parse(raw));
|
|
202
|
-
rememberThread(thread, mtimeMs);
|
|
203
|
-
return thread;
|
|
204
|
-
}
|
|
205
|
-
var selfWriteMtimes = /* @__PURE__ */ new Map();
|
|
206
|
-
function writeThread(thread, opts) {
|
|
207
|
-
const path = threadFilePath(idPath(thread.id));
|
|
208
|
-
const tmp = `${path}.${process.pid}.tmp`;
|
|
209
|
-
const next = opts?.touch === false ? { ...thread } : { ...thread, updatedAt: nowIso() };
|
|
210
|
-
writeFileSync(tmp, JSON.stringify(next, null, 2), "utf8");
|
|
211
|
-
renameSync(tmp, path);
|
|
212
|
-
const mtimeMs = fileMtimeMs(path) ?? Date.now();
|
|
213
|
-
rememberThread(next, mtimeMs);
|
|
214
|
-
selfWriteMtimes.set(thread.id, mtimeMs);
|
|
215
|
-
}
|
|
216
|
-
function isSelfWrittenRecord(id) {
|
|
217
|
-
const ours = selfWriteMtimes.get(id);
|
|
218
|
-
if (ours == null) return false;
|
|
219
|
-
return fileMtimeMs(threadFilePath(id)) === ours;
|
|
220
|
-
}
|
|
221
|
-
function idPath(id) {
|
|
222
|
-
return id;
|
|
223
|
-
}
|
|
224
|
-
function isThreadRecordFile(nameOrPath) {
|
|
225
|
-
const name = basename(nameOrPath);
|
|
226
|
-
return name.endsWith(".json") && !name.endsWith(".live.json") && !name.endsWith(".setup.log.json");
|
|
227
|
-
}
|
|
228
|
-
function listThreads(opts) {
|
|
229
|
-
const cache = cacheForDir();
|
|
230
|
-
const files = readdirSync(threadsDir()).filter(isThreadRecordFile);
|
|
231
|
-
const seen = /* @__PURE__ */ new Set();
|
|
232
|
-
for (const f of files) {
|
|
233
|
-
const id = f.replace(/\.json$/, "");
|
|
234
|
-
if (!id) continue;
|
|
235
|
-
seen.add(id);
|
|
236
|
-
try {
|
|
237
|
-
readThread(id);
|
|
238
|
-
} catch {
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
for (const id of [...cache.byId.keys()]) {
|
|
242
|
-
if (!seen.has(id)) forgetThread(id);
|
|
243
|
-
}
|
|
244
|
-
const threads = [...cache.byId.values()].sort(
|
|
245
|
-
(a, b) => b.updatedAt.localeCompare(a.updatedAt)
|
|
246
|
-
);
|
|
247
|
-
if (opts?.includeArchived) return threads;
|
|
248
|
-
return threads.filter((t) => t.status !== "archived");
|
|
249
|
-
}
|
|
250
|
-
function deleteThreadRecord(id) {
|
|
251
|
-
forgetThread(id);
|
|
252
|
-
const path = threadFilePath(id);
|
|
253
|
-
if (existsSync(path)) unlinkSync(path);
|
|
254
|
-
const lock = threadLockPath(id);
|
|
255
|
-
if (existsSync(lock)) {
|
|
256
|
-
try {
|
|
257
|
-
unlinkSync(lock);
|
|
258
|
-
} catch {
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
try {
|
|
262
|
-
rmSync(cursorSdkStoreDir(id), { recursive: true, force: true });
|
|
263
|
-
} catch {
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
function updateThread(id, patch) {
|
|
267
|
-
const current = readThread(id);
|
|
268
|
-
if (!current) throw new Error(`Thread not found: ${id}`);
|
|
269
|
-
const next = { ...current, ...patch, id: current.id, updatedAt: nowIso() };
|
|
270
|
-
if (next.status === "archived") {
|
|
271
|
-
next.archivedAt = typeof next.archivedAt === "string" && next.archivedAt.trim() || current.archivedAt || nowIso();
|
|
272
|
-
} else {
|
|
273
|
-
delete next.archivedAt;
|
|
274
|
-
}
|
|
275
|
-
writeThread(next);
|
|
276
|
-
return next;
|
|
277
|
-
}
|
|
278
|
-
function appendMessage(id, message) {
|
|
279
|
-
const current = readThread(id);
|
|
280
|
-
if (!current) throw new Error(`Thread not found: ${id}`);
|
|
281
|
-
return updateThread(id, { messages: [...current.messages, message] });
|
|
282
|
-
}
|
|
283
|
-
function setStatus(id, status, lastError) {
|
|
284
|
-
return updateThread(id, { status, lastError: lastError ?? null });
|
|
285
|
-
}
|
|
286
|
-
function findThreadByRef(ref) {
|
|
287
|
-
const all = listThreads({ includeArchived: true });
|
|
288
|
-
return all.find(
|
|
289
|
-
(t) => t.id === ref || t.id.startsWith(ref) || t.branchName === ref || t.title === ref
|
|
290
|
-
) ?? null;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
export {
|
|
294
|
-
resolveThreadEffort,
|
|
295
|
-
normalizeThread,
|
|
296
|
-
createEmptyThread,
|
|
297
|
-
withThreadLock,
|
|
298
|
-
invalidateThreadListCache,
|
|
299
|
-
invalidateThreadRecord,
|
|
300
|
-
readThread,
|
|
301
|
-
writeThread,
|
|
302
|
-
isSelfWrittenRecord,
|
|
303
|
-
isThreadRecordFile,
|
|
304
|
-
listThreads,
|
|
305
|
-
deleteThreadRecord,
|
|
306
|
-
updateThread,
|
|
307
|
-
appendMessage,
|
|
308
|
-
setStatus,
|
|
309
|
-
findThreadByRef
|
|
310
|
-
};
|