@tryarcanist/cli 0.1.94 → 0.1.95
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/index.js +31 -33
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1986,15 +1986,12 @@ function parseSsePayload(payload) {
|
|
|
1986
1986
|
const entry = {
|
|
1987
1987
|
phase
|
|
1988
1988
|
};
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
if (
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
if (typeof data.finalizingStep === "string" && VALID_FINALIZING_STEPS.has(data.finalizingStep)) {
|
|
1996
|
-
entry.finalizingStep = data.finalizingStep;
|
|
1997
|
-
}
|
|
1989
|
+
const sandboxSubstate = validateEnumField(data.sandboxSubstate, VALID_SANDBOX_SUBSTATES);
|
|
1990
|
+
if (sandboxSubstate !== void 0) entry.sandboxSubstate = sandboxSubstate;
|
|
1991
|
+
const stopMode = validateEnumField(data.stopMode, VALID_STOP_MODES);
|
|
1992
|
+
if (stopMode !== void 0) entry.stopMode = stopMode;
|
|
1993
|
+
const finalizingStep = validateEnumField(data.finalizingStep, VALID_FINALIZING_STEPS);
|
|
1994
|
+
if (finalizingStep !== void 0) entry.finalizingStep = finalizingStep;
|
|
1998
1995
|
if (typeof data.sessionKind === "string") entry.sessionKind = data.sessionKind;
|
|
1999
1996
|
if (typeof data.title === "string") entry.title = data.title;
|
|
2000
1997
|
if (typeof data.spawnDurationMs === "number" || data.spawnDurationMs === null) {
|
|
@@ -2011,6 +2008,9 @@ function parseSsePayload(payload) {
|
|
|
2011
2008
|
}
|
|
2012
2009
|
return { status, events };
|
|
2013
2010
|
}
|
|
2011
|
+
function validateEnumField(value, validSet) {
|
|
2012
|
+
return typeof value === "string" && validSet.has(value) ? value : void 0;
|
|
2013
|
+
}
|
|
2014
2014
|
function parseJsonObject(value) {
|
|
2015
2015
|
try {
|
|
2016
2016
|
const parsed = JSON.parse(value);
|
|
@@ -2159,6 +2159,14 @@ async function fetchPromptLabels(config, sessionId) {
|
|
|
2159
2159
|
const data = await apiFetch(config, `/api/sessions/${sessionId}/prompts`);
|
|
2160
2160
|
return buildPromptLabelMap(data.prompts);
|
|
2161
2161
|
}
|
|
2162
|
+
function extractSessionLifecycle(payload) {
|
|
2163
|
+
const session = payload.session;
|
|
2164
|
+
const root = session && typeof session === "object" ? session : payload;
|
|
2165
|
+
const phaseRaw = root.phase;
|
|
2166
|
+
const phase = typeof phaseRaw === "string" && VALID_PHASES.has(phaseRaw) ? phaseRaw : null;
|
|
2167
|
+
const sessionKind = typeof root.sessionKind === "string" ? root.sessionKind : null;
|
|
2168
|
+
return { phase, sessionKind };
|
|
2169
|
+
}
|
|
2162
2170
|
async function watchCommand(sessionId, options, command) {
|
|
2163
2171
|
const runtime = getRuntimeOptions(command, options);
|
|
2164
2172
|
const config = requireConfig(runtime);
|
|
@@ -2275,14 +2283,6 @@ function buildPromptFailureError(sessionId, prompt, sessionUrl) {
|
|
|
2275
2283
|
hint: `Inspect with: arcanist sessions transcript ${sessionId}`
|
|
2276
2284
|
});
|
|
2277
2285
|
}
|
|
2278
|
-
function extractSessionLifecycle(payload) {
|
|
2279
|
-
const session = payload.session;
|
|
2280
|
-
const root = session && typeof session === "object" ? session : payload;
|
|
2281
|
-
const phaseRaw = root.phase;
|
|
2282
|
-
const phase = typeof phaseRaw === "string" && VALID_PHASES.has(phaseRaw) ? phaseRaw : null;
|
|
2283
|
-
const sessionKind = typeof root.sessionKind === "string" ? root.sessionKind : null;
|
|
2284
|
-
return { phase, sessionKind };
|
|
2285
|
-
}
|
|
2286
2286
|
async function fetchCreatedPromptStatus(config, sessionId, promptId) {
|
|
2287
2287
|
const promptList = await apiFetch(config, `/api/sessions/${sessionId}/prompts`);
|
|
2288
2288
|
return selectCreatedPrompt(promptList.prompts, promptId);
|
|
@@ -2360,16 +2360,15 @@ async function createCommand(repoUrl, promptArg, options, command) {
|
|
|
2360
2360
|
const idempotencyKey = options.idempotencyKey ?? randomIdempotencyKey();
|
|
2361
2361
|
const sessionIdempotencyKey = `${idempotencyKey}:session`;
|
|
2362
2362
|
const promptIdempotencyKey = `${idempotencyKey}:prompt`;
|
|
2363
|
+
const body = { context: { repoUrl } };
|
|
2364
|
+
if (options.model) body.model = options.model;
|
|
2365
|
+
if (options.backend) body.agentRuntimeBackend = agentRuntimeBackend;
|
|
2366
|
+
if (options.reasoningEffort) body.reasoningEffort = options.reasoningEffort;
|
|
2367
|
+
if (options.cold) body.cold = true;
|
|
2363
2368
|
const sessionData = await apiFetch(config, "/api/sessions", {
|
|
2364
2369
|
method: "POST",
|
|
2365
2370
|
headers: { "Idempotency-Key": sessionIdempotencyKey },
|
|
2366
|
-
body: JSON.stringify(
|
|
2367
|
-
context: { repoUrl },
|
|
2368
|
-
...options.model ? { model: options.model } : {},
|
|
2369
|
-
...options.backend ? { agentRuntimeBackend } : {},
|
|
2370
|
-
...options.reasoningEffort ? { reasoningEffort: options.reasoningEffort } : {},
|
|
2371
|
-
...options.cold ? { cold: true } : {}
|
|
2372
|
-
})
|
|
2371
|
+
body: JSON.stringify(body)
|
|
2373
2372
|
});
|
|
2374
2373
|
const sessionId = sessionData.sessionId;
|
|
2375
2374
|
let promptId;
|
|
@@ -2403,15 +2402,14 @@ async function createCommand(repoUrl, promptArg, options, command) {
|
|
|
2403
2402
|
await waitForCreatedPrompt(sessionId, promptId, sessionData.sessionUrl, waitPollIntervalMs, runtime, command);
|
|
2404
2403
|
}
|
|
2405
2404
|
if (isJson(command, options)) {
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
});
|
|
2405
|
+
const output = { sessionId };
|
|
2406
|
+
if (sessionData.sessionUrl) output.sessionUrl = sessionData.sessionUrl;
|
|
2407
|
+
output.repoUrl = repoUrl;
|
|
2408
|
+
if (options.model) output.model = options.model;
|
|
2409
|
+
if (options.backend) output.agentRuntimeBackend = agentRuntimeBackend;
|
|
2410
|
+
if (options.reasoningEffort) output.reasoningEffort = options.reasoningEffort;
|
|
2411
|
+
if (promptId) output.promptId = promptId;
|
|
2412
|
+
writeJson(output);
|
|
2415
2413
|
return;
|
|
2416
2414
|
}
|
|
2417
2415
|
if (options.wait) return;
|