@super-one/cli 0.75.0-alpha.2 → 0.75.1-alpha
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/MANIFEST.json +2 -2
- package/lib/cli.mjs +183 -70
- package/package.json +1 -1
package/MANIFEST.json
CHANGED
package/lib/cli.mjs
CHANGED
|
@@ -137,8 +137,8 @@ import { fileURLToPath } from "node:url";
|
|
|
137
137
|
function resolveCliReleaseVersion() {
|
|
138
138
|
const fromEnv = process.env.SUPERONE_CLI_VERSION?.trim();
|
|
139
139
|
if (fromEnv) return fromEnv;
|
|
140
|
-
if ("0.75.
|
|
141
|
-
return "0.75.
|
|
140
|
+
if ("0.75.1-alpha".trim()) {
|
|
141
|
+
return "0.75.1-alpha".trim();
|
|
142
142
|
}
|
|
143
143
|
const fromDist = readDistManifestVersion();
|
|
144
144
|
if (fromDist) return fromDist;
|
|
@@ -5114,13 +5114,13 @@ var init_events = __esm({
|
|
|
5114
5114
|
|
|
5115
5115
|
// ../../packages/shared/src/environment/session-events.ts
|
|
5116
5116
|
function streamingEventKey(eventType2, payload) {
|
|
5117
|
-
const
|
|
5117
|
+
const record13 = payload ?? {};
|
|
5118
5118
|
if (eventType2 === SESSION_DURABLE_EVENT.assistantDelta) {
|
|
5119
|
-
return { messageId: typeof
|
|
5119
|
+
return { messageId: typeof record13.blockId === "string" ? record13.blockId : null };
|
|
5120
5120
|
}
|
|
5121
5121
|
if (eventType2 === SESSION_DURABLE_EVENT.toolInputDelta) return { messageId: null };
|
|
5122
5122
|
if (eventType2 !== SESSION_DURABLE_EVENT.agentEvent) return null;
|
|
5123
|
-
const event =
|
|
5123
|
+
const event = record13.event;
|
|
5124
5124
|
switch (event?.type) {
|
|
5125
5125
|
case "content_delta":
|
|
5126
5126
|
return event.delta.type === "text" || event.delta.type === "thinking" || event.delta.type === "tool_use" && event.delta.outputDelta !== void 0 ? { messageId: event.messageId } : null;
|
|
@@ -5132,10 +5132,10 @@ function streamingEventKey(eventType2, payload) {
|
|
|
5132
5132
|
}
|
|
5133
5133
|
}
|
|
5134
5134
|
function committedStreamingMessage(eventType2, payload) {
|
|
5135
|
-
const
|
|
5135
|
+
const record13 = payload ?? {};
|
|
5136
5136
|
switch (eventType2) {
|
|
5137
5137
|
case SESSION_DURABLE_EVENT.assistantMessage:
|
|
5138
|
-
return typeof
|
|
5138
|
+
return typeof record13.blockId === "string" ? record13.blockId : null;
|
|
5139
5139
|
case SESSION_DURABLE_EVENT.turnCompleted:
|
|
5140
5140
|
case SESSION_DURABLE_EVENT.turnInterrupted:
|
|
5141
5141
|
case SESSION_DURABLE_EVENT.turnError:
|
|
@@ -5143,7 +5143,7 @@ function committedStreamingMessage(eventType2, payload) {
|
|
|
5143
5143
|
case SESSION_DURABLE_EVENT.removed:
|
|
5144
5144
|
return null;
|
|
5145
5145
|
case SESSION_DURABLE_EVENT.agentEvent: {
|
|
5146
|
-
const event =
|
|
5146
|
+
const event = record13.event;
|
|
5147
5147
|
if (event?.type === "transcript_replaced") return null;
|
|
5148
5148
|
if (event?.type === "message_complete" || event?.type === "message_interrupted" || event?.type === "message_error") return event.messageId;
|
|
5149
5149
|
if (event?.type === "status_change" && event.status !== "streaming") return null;
|
|
@@ -11834,6 +11834,7 @@ var init_agent_types = __esm({
|
|
|
11834
11834
|
CLAUDE_LIST_ACCOUNTS: "claude:list-accounts",
|
|
11835
11835
|
CLAUDE_SIGN_IN_ACCOUNT: "claude:sign-in-account",
|
|
11836
11836
|
CLAUDE_SIGN_OUT_ACCOUNT: "claude:sign-out-account",
|
|
11837
|
+
CLAUDE_REMOVE_ACCOUNT: "claude:remove-account",
|
|
11837
11838
|
CLAUDE_SET_DEFAULT_ACCOUNT: "claude:set-default-account",
|
|
11838
11839
|
CLAUDE_CANCEL_SIGN_IN: "claude:cancel-sign-in",
|
|
11839
11840
|
// Third-party provider usage channels
|
|
@@ -22209,8 +22210,8 @@ var init_read_model = __esm({
|
|
|
22209
22210
|
return loaded2;
|
|
22210
22211
|
}
|
|
22211
22212
|
this.evictIdle();
|
|
22212
|
-
const
|
|
22213
|
-
const providerId =
|
|
22213
|
+
const record13 = this.records.get(sessionId);
|
|
22214
|
+
const providerId = record13?.harnessId ?? "claude";
|
|
22214
22215
|
const mapper = createNodeSessionEventMapper({ sessionId, providerId });
|
|
22215
22216
|
const checkpoint = this.db.prepare(`SELECT applied_version, state_json FROM session_read_models WHERE session_id = ?`).get(sessionId);
|
|
22216
22217
|
let session;
|
|
@@ -22231,14 +22232,14 @@ var init_read_model = __esm({
|
|
|
22231
22232
|
return session;
|
|
22232
22233
|
}
|
|
22233
22234
|
const events = this.log.listForSession(sessionId, Number.MAX_SAFE_INTEGER);
|
|
22234
|
-
const pending3 = nodePendingInteractionFields(
|
|
22235
|
+
const pending3 = nodePendingInteractionFields(record13?.pendingInteraction);
|
|
22235
22236
|
const core = {
|
|
22236
22237
|
...createDefaultChatCoreSession(),
|
|
22237
22238
|
sessionProvider: providerId,
|
|
22238
22239
|
preferredProvider: providerId,
|
|
22239
|
-
claudeFastMode:
|
|
22240
|
-
messages:
|
|
22241
|
-
status:
|
|
22240
|
+
claudeFastMode: record13?.claudeFastMode ?? void 0,
|
|
22241
|
+
messages: record13 ? sessionMessageBlocksToChatMessages(buildSessionMessageCatalog(record13, events), providerId) : [],
|
|
22242
|
+
status: record13?.status === "streaming" ? "streaming" : "idle",
|
|
22242
22243
|
...pending3
|
|
22243
22244
|
};
|
|
22244
22245
|
session = {
|
|
@@ -22579,7 +22580,7 @@ var init_harness_capabilities = __esm({
|
|
|
22579
22580
|
supportsMcp: true,
|
|
22580
22581
|
// Agent-driven plan + x.ai/exit_plan_mode approval is shipped (not host enter-plan).
|
|
22581
22582
|
supportsPlanMode: true,
|
|
22582
|
-
//
|
|
22583
|
+
// Plan entries and a completed todo_write emit todos_updated for the phone strip.
|
|
22583
22584
|
supportsTodos: true,
|
|
22584
22585
|
// Subagent_* notifications already map to task rows, but there is no nested
|
|
22585
22586
|
// child chrome for ACP. Keep false until Task UI can host those sessions.
|
|
@@ -34142,13 +34143,22 @@ function parseClaudeUsage(data, planType) {
|
|
|
34142
34143
|
let extraUsage = null;
|
|
34143
34144
|
const extra = data.extra_usage;
|
|
34144
34145
|
if (extra?.is_enabled && typeof extra.used_credits === "number") {
|
|
34145
|
-
|
|
34146
|
-
|
|
34147
|
-
limitDollars: typeof extra.monthly_limit === "number" && extra.monthly_limit > 0 ? extra.monthly_limit / 100 : null
|
|
34148
|
-
};
|
|
34146
|
+
const limitDollars = typeof extra.monthly_limit === "number" && extra.monthly_limit > 0 ? extra.monthly_limit / 100 : null;
|
|
34147
|
+
if (limitDollars !== null || extra.used_credits > 0) extraUsage = { usedDollars: extra.used_credits / 100, limitDollars };
|
|
34149
34148
|
}
|
|
34150
34149
|
return { windows, extraUsage, planType };
|
|
34151
34150
|
}
|
|
34151
|
+
function parseClaudeResetGrants(data) {
|
|
34152
|
+
const block = data.cedar_ember;
|
|
34153
|
+
if (!block?.eligible || !Array.isArray(block.grants)) return [];
|
|
34154
|
+
const grants = [];
|
|
34155
|
+
for (const grant of block.grants) {
|
|
34156
|
+
if (!grant?.id || typeof grant.resets_left !== "number" || !Number.isFinite(grant.resets_left)) return [];
|
|
34157
|
+
const resetsLeft = Math.floor(grant.resets_left);
|
|
34158
|
+
if (resetsLeft > 0) grants.push({ resetsLeft, expiresAt: isoToEpochSeconds(grant.ends_at) });
|
|
34159
|
+
}
|
|
34160
|
+
return grants;
|
|
34161
|
+
}
|
|
34152
34162
|
function claudePlanType(oauth) {
|
|
34153
34163
|
const sub = oauth.subscriptionType;
|
|
34154
34164
|
if (!sub) return null;
|
|
@@ -34156,8 +34166,8 @@ function claudePlanType(oauth) {
|
|
|
34156
34166
|
const tierMatch = String(oauth.rateLimitTier ?? "").match(/(\d+)x/);
|
|
34157
34167
|
return tierMatch ? `${base} ${tierMatch[1]}x` : base;
|
|
34158
34168
|
}
|
|
34159
|
-
function fetchUsage(accessToken) {
|
|
34160
|
-
return fetchWithTimeout(
|
|
34169
|
+
function fetchUsage(accessToken, url2 = USAGE_URL) {
|
|
34170
|
+
return fetchWithTimeout(url2, {
|
|
34161
34171
|
method: "GET",
|
|
34162
34172
|
headers: {
|
|
34163
34173
|
Authorization: `Bearer ${accessToken.trim()}`,
|
|
@@ -34171,6 +34181,19 @@ function fetchUsage(accessToken) {
|
|
|
34171
34181
|
function claudeCredentialFingerprint(creds) {
|
|
34172
34182
|
return createHash6("sha256").update(creds.oauth.refreshToken ?? creds.oauth.accessToken).digest("hex");
|
|
34173
34183
|
}
|
|
34184
|
+
async function readResetGrants(credentialDir, creds, accessToken, log2) {
|
|
34185
|
+
const { value } = await resetGrantsThrottle.read(credentialDir ?? "", claudeCredentialFingerprint(creds), false, async () => {
|
|
34186
|
+
const resp = await fetchUsage(accessToken, RESET_GRANTS_URL);
|
|
34187
|
+
if (resp.status === 429) return { rateLimitedForMs: retryAfterMs(resp) ?? 0 };
|
|
34188
|
+
if (!resp.ok) {
|
|
34189
|
+
log2.warn("[claude-usage] reset grants request failed status=%d", resp.status);
|
|
34190
|
+
return { error: `HTTP ${resp.status}` };
|
|
34191
|
+
}
|
|
34192
|
+
const data = parseJson(await resp.text());
|
|
34193
|
+
return data ? { value: parseClaudeResetGrants(data) } : { error: "Claude reset grants response changed." };
|
|
34194
|
+
});
|
|
34195
|
+
return value;
|
|
34196
|
+
}
|
|
34174
34197
|
async function readClaudeRateLimits(credentialDir, opts = {}) {
|
|
34175
34198
|
const log2 = opts.log ?? silentLog;
|
|
34176
34199
|
const creds = loadClaudeCredentials(credentialDir, log2);
|
|
@@ -34182,7 +34205,8 @@ async function readClaudeRateLimits(credentialDir, opts = {}) {
|
|
|
34182
34205
|
if (resp.status === 401 || resp.status === 403) {
|
|
34183
34206
|
const refreshed = await refreshClaudeToken(creds, log2);
|
|
34184
34207
|
if (!refreshed) return { error: "Claude login expired. Sign in to Claude again." };
|
|
34185
|
-
|
|
34208
|
+
accessToken = refreshed;
|
|
34209
|
+
resp = await fetchUsage(accessToken);
|
|
34186
34210
|
}
|
|
34187
34211
|
if (resp.status === 429) {
|
|
34188
34212
|
const retryMs = retryAfterMs(resp);
|
|
@@ -34193,10 +34217,11 @@ async function readClaudeRateLimits(credentialDir, opts = {}) {
|
|
|
34193
34217
|
if (!resp.ok) return { fingerprint, error: `Claude usage request failed (HTTP ${resp.status}).` };
|
|
34194
34218
|
const data = parseJson(await resp.text());
|
|
34195
34219
|
if (!data) return { fingerprint, error: "Claude usage response changed." };
|
|
34196
|
-
|
|
34220
|
+
const resetGrants = await readResetGrants(credentialDir, creds, accessToken, log2);
|
|
34221
|
+
return { fingerprint, value: { ...parseClaudeUsage(data, claudePlanType(creds.oauth)), ...resetGrants ? { resetGrants } : {}, fetchedAt: Date.now() } };
|
|
34197
34222
|
}, opts.preferCached);
|
|
34198
34223
|
}
|
|
34199
|
-
var KEYCHAIN_SERVICE, CRED_FILE_NAME, REFRESH_URL, CLIENT_ID, SCOPES, REFRESH_BUFFER_MS, USAGE_URL, USAGE_USER_AGENT, MIN_USAGE_FETCH_INTERVAL_MS, refreshes, LEADING_WINDOW_LABELS, LEGACY_MODEL_WINDOW_LABELS, throttle;
|
|
34224
|
+
var KEYCHAIN_SERVICE, CRED_FILE_NAME, REFRESH_URL, CLIENT_ID, SCOPES, REFRESH_BUFFER_MS, USAGE_URL, RESET_GRANTS_URL, USAGE_USER_AGENT, MIN_USAGE_FETCH_INTERVAL_MS, MIN_RESET_GRANTS_FETCH_INTERVAL_MS, refreshes, LEADING_WINDOW_LABELS, LEGACY_MODEL_WINDOW_LABELS, throttle, resetGrantsThrottle;
|
|
34200
34225
|
var init_claude = __esm({
|
|
34201
34226
|
"../../packages/runtime/src/usage/claude.ts"() {
|
|
34202
34227
|
"use strict";
|
|
@@ -34210,8 +34235,10 @@ var init_claude = __esm({
|
|
|
34210
34235
|
SCOPES = "user:profile user:inference user:sessions:claude_code user:mcp_servers user:file_upload";
|
|
34211
34236
|
REFRESH_BUFFER_MS = 5 * 60 * 1e3;
|
|
34212
34237
|
USAGE_URL = "https://api.anthropic.com/api/oauth/usage";
|
|
34238
|
+
RESET_GRANTS_URL = `${USAGE_URL}?cedar_ember=1&skip_spend=1`;
|
|
34213
34239
|
USAGE_USER_AGENT = "claude-code/2.1.289";
|
|
34214
34240
|
MIN_USAGE_FETCH_INTERVAL_MS = 5 * 60 * 1e3;
|
|
34241
|
+
MIN_RESET_GRANTS_FETCH_INTERVAL_MS = 60 * 60 * 1e3;
|
|
34215
34242
|
refreshes = new AsyncCoalescer();
|
|
34216
34243
|
LEADING_WINDOW_LABELS = [
|
|
34217
34244
|
["five_hour", "5h"],
|
|
@@ -34223,6 +34250,7 @@ var init_claude = __esm({
|
|
|
34223
34250
|
["seven_day_omelette", "Claude Design"]
|
|
34224
34251
|
];
|
|
34225
34252
|
throttle = new UsageThrottle(MIN_USAGE_FETCH_INTERVAL_MS);
|
|
34253
|
+
resetGrantsThrottle = new UsageThrottle(MIN_RESET_GRANTS_FETCH_INTERVAL_MS);
|
|
34226
34254
|
}
|
|
34227
34255
|
});
|
|
34228
34256
|
|
|
@@ -34819,13 +34847,13 @@ var init_account_store = __esm({
|
|
|
34819
34847
|
data.defaultId = id;
|
|
34820
34848
|
this.write(data);
|
|
34821
34849
|
}
|
|
34822
|
-
/** Forget a
|
|
34823
|
-
remove(id) {
|
|
34850
|
+
/** Forget a profile's card. Codex credentials and local history are not deleted. */
|
|
34851
|
+
remove(id, unreachable = false) {
|
|
34824
34852
|
codexAccountId(codexAccountProviderId(id));
|
|
34825
34853
|
const data = this.read();
|
|
34826
34854
|
const account = data.accounts.find((a) => a.id === id);
|
|
34827
34855
|
if (!account) return;
|
|
34828
|
-
if (account.status.signedIn) throw new Error("Sign out before removing this Codex account.");
|
|
34856
|
+
if (account.status.signedIn && !unreachable) throw new Error("Sign out before removing this Codex account.");
|
|
34829
34857
|
data.accounts = data.accounts.filter((a) => a.id !== id);
|
|
34830
34858
|
if (data.defaultId === id) data.defaultId = data.accounts.find((a) => a.status.signedIn)?.id ?? null;
|
|
34831
34859
|
this.write(data);
|
|
@@ -37549,12 +37577,14 @@ var init_account_manager = __esm({
|
|
|
37549
37577
|
async remove(providerId) {
|
|
37550
37578
|
const id = codexAccountId(providerId);
|
|
37551
37579
|
if (!id) throw new Error("Expected a Codex account");
|
|
37552
|
-
|
|
37580
|
+
const signedIn = () => this.store.list().some((a) => a.id === id && a.signedIn);
|
|
37581
|
+
const unreachable = signedIn() && await this.status(providerId).then(() => false, () => true);
|
|
37582
|
+
if (!unreachable && signedIn()) throw new Error("Sign out before removing this Codex account.");
|
|
37553
37583
|
this.revisions.set(id, (this.revisions.get(id) ?? 0) + 1);
|
|
37554
37584
|
for (const [loginId, pending3] of this.pending) {
|
|
37555
37585
|
if (pending3.accountId === id) await this.cancel(loginId);
|
|
37556
37586
|
}
|
|
37557
|
-
this.store.remove(id);
|
|
37587
|
+
this.store.remove(id, unreachable);
|
|
37558
37588
|
this.failed.delete(id);
|
|
37559
37589
|
this.changed(providerId);
|
|
37560
37590
|
}
|
|
@@ -37766,7 +37796,7 @@ function blockRefsOf(content) {
|
|
|
37766
37796
|
function createRetractionLedger() {
|
|
37767
37797
|
const byUuid = /* @__PURE__ */ new Map();
|
|
37768
37798
|
let currentMessageId = "";
|
|
37769
|
-
const
|
|
37799
|
+
const record13 = (uuid3, messageId, content) => {
|
|
37770
37800
|
const key = str2(uuid3);
|
|
37771
37801
|
if (!key) return;
|
|
37772
37802
|
if (messageId !== currentMessageId) {
|
|
@@ -37777,8 +37807,8 @@ function createRetractionLedger() {
|
|
|
37777
37807
|
if (blocks.length > 0) byUuid.set(key, { messageId, blocks });
|
|
37778
37808
|
};
|
|
37779
37809
|
return {
|
|
37780
|
-
recordAssistantFrame:
|
|
37781
|
-
recordToolResultFrame:
|
|
37810
|
+
recordAssistantFrame: record13,
|
|
37811
|
+
recordToolResultFrame: record13,
|
|
37782
37812
|
resolve(uuids) {
|
|
37783
37813
|
if (!Array.isArray(uuids)) return [];
|
|
37784
37814
|
const byMessage = /* @__PURE__ */ new Map();
|
|
@@ -38753,11 +38783,11 @@ function stringifyOutput(content) {
|
|
|
38753
38783
|
}
|
|
38754
38784
|
}
|
|
38755
38785
|
function applySdkMessage(message, state, emit) {
|
|
38756
|
-
const
|
|
38757
|
-
const sessionId = sessionIdOf2(
|
|
38758
|
-
const parentToolUseId = typeof
|
|
38759
|
-
if (
|
|
38760
|
-
const event = asRecord11(
|
|
38786
|
+
const record13 = message;
|
|
38787
|
+
const sessionId = sessionIdOf2(record13);
|
|
38788
|
+
const parentToolUseId = typeof record13.parent_tool_use_id === "string" ? record13.parent_tool_use_id : null;
|
|
38789
|
+
if (record13.type === "stream_event") {
|
|
38790
|
+
const event = asRecord11(record13.event);
|
|
38761
38791
|
if (!event) return emptyApply(sessionId);
|
|
38762
38792
|
const index = typeof event.index === "number" ? event.index : null;
|
|
38763
38793
|
if (event.type === "content_block_start") {
|
|
@@ -38826,8 +38856,8 @@ function applySdkMessage(message, state, emit) {
|
|
|
38826
38856
|
}
|
|
38827
38857
|
return emptyApply(sessionId);
|
|
38828
38858
|
}
|
|
38829
|
-
if (
|
|
38830
|
-
const messageBody = asRecord11(
|
|
38859
|
+
if (record13.type === "assistant") {
|
|
38860
|
+
const messageBody = asRecord11(record13.message);
|
|
38831
38861
|
const content = messageBody && Array.isArray(messageBody.content) ? messageBody.content : [];
|
|
38832
38862
|
for (const raw of content) {
|
|
38833
38863
|
const block = asRecord11(raw);
|
|
@@ -38856,8 +38886,8 @@ function applySdkMessage(message, state, emit) {
|
|
|
38856
38886
|
}
|
|
38857
38887
|
return emptyApply(sessionId);
|
|
38858
38888
|
}
|
|
38859
|
-
if (
|
|
38860
|
-
const messageBody = asRecord11(
|
|
38889
|
+
if (record13.type === "user") {
|
|
38890
|
+
const messageBody = asRecord11(record13.message);
|
|
38861
38891
|
const content = messageBody && Array.isArray(messageBody.content) ? messageBody.content : [];
|
|
38862
38892
|
for (const raw of content) {
|
|
38863
38893
|
const block = asRecord11(raw);
|
|
@@ -38881,12 +38911,12 @@ function applySdkMessage(message, state, emit) {
|
|
|
38881
38911
|
}
|
|
38882
38912
|
return emptyApply(sessionId);
|
|
38883
38913
|
}
|
|
38884
|
-
if (
|
|
38885
|
-
const resultIsError =
|
|
38886
|
-
const resultText = typeof
|
|
38914
|
+
if (record13.type === "result") {
|
|
38915
|
+
const resultIsError = record13.is_error === true || record13.subtype === "error";
|
|
38916
|
+
const resultText = typeof record13.result === "string" ? record13.result : null;
|
|
38887
38917
|
let resultError = null;
|
|
38888
38918
|
if (resultIsError) {
|
|
38889
|
-
resultError = resultText || (typeof
|
|
38919
|
+
resultError = resultText || (typeof record13.errors === "string" ? record13.errors : null) || "Claude turn failed";
|
|
38890
38920
|
}
|
|
38891
38921
|
for (const open2 of state.openTools.values()) {
|
|
38892
38922
|
if (open2.completed) continue;
|
|
@@ -39324,15 +39354,15 @@ async function resolveAskUserQuestion(params) {
|
|
|
39324
39354
|
toolUseId,
|
|
39325
39355
|
input: baseInput ?? void 0
|
|
39326
39356
|
});
|
|
39327
|
-
const
|
|
39328
|
-
const answers =
|
|
39357
|
+
const record13 = asRecord12(answer);
|
|
39358
|
+
const answers = record13 && "answers" in record13 ? record13.answers : answer;
|
|
39329
39359
|
const answerMap = asRecord12(answers);
|
|
39330
39360
|
const updatedInput = {
|
|
39331
39361
|
...baseInput,
|
|
39332
39362
|
...buildAnsweredQuestionInput({
|
|
39333
39363
|
questions: Array.isArray(baseInput?.questions) ? baseInput.questions : [],
|
|
39334
39364
|
answers: answerMap ?? {},
|
|
39335
|
-
annotations:
|
|
39365
|
+
annotations: record13?.annotations,
|
|
39336
39366
|
previewFormat
|
|
39337
39367
|
}),
|
|
39338
39368
|
// Preserve the host's answer shape verbatim — it is not always a record.
|
|
@@ -69838,6 +69868,76 @@ var init_acp = __esm({
|
|
|
69838
69868
|
}
|
|
69839
69869
|
});
|
|
69840
69870
|
|
|
69871
|
+
// ../../packages/shared/src/acp-todos.ts
|
|
69872
|
+
function record12(value) {
|
|
69873
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
69874
|
+
}
|
|
69875
|
+
function todoStatus(value) {
|
|
69876
|
+
const status2 = typeof value === "string" ? value : "";
|
|
69877
|
+
if (status2 === "in_progress" || status2 === "in-progress") return "in_progress";
|
|
69878
|
+
if (status2 === "completed" || status2 === "cancelled" || status2 === "canceled") return "completed";
|
|
69879
|
+
return "pending";
|
|
69880
|
+
}
|
|
69881
|
+
function todoItemFromRow(row2, index, idHint) {
|
|
69882
|
+
const fields = record12(row2);
|
|
69883
|
+
if (!fields) return null;
|
|
69884
|
+
const subject = String(fields.content ?? fields.subject ?? "").trim();
|
|
69885
|
+
if (!subject) return null;
|
|
69886
|
+
const status2 = todoStatus(fields.status);
|
|
69887
|
+
const id = String(fields.id ?? idHint ?? index + 1);
|
|
69888
|
+
return {
|
|
69889
|
+
id,
|
|
69890
|
+
subject,
|
|
69891
|
+
description: String(fields.description ?? ""),
|
|
69892
|
+
status: status2,
|
|
69893
|
+
...status2 === "in_progress" ? { activeForm: String(fields.activeForm ?? subject) } : {}
|
|
69894
|
+
};
|
|
69895
|
+
}
|
|
69896
|
+
function acpTodoItems(rows) {
|
|
69897
|
+
if (!Array.isArray(rows)) return null;
|
|
69898
|
+
const items = [];
|
|
69899
|
+
rows.forEach((row2, index) => {
|
|
69900
|
+
const item = todoItemFromRow(row2, index);
|
|
69901
|
+
if (item) items.push(item);
|
|
69902
|
+
});
|
|
69903
|
+
return items;
|
|
69904
|
+
}
|
|
69905
|
+
function grokTodoItemsFromOutput(raw) {
|
|
69906
|
+
const root = record12(raw);
|
|
69907
|
+
const body = root ? record12(root.TodosUpdated) : null;
|
|
69908
|
+
if (!root || root.type !== "Todo" || !body) return null;
|
|
69909
|
+
const stateTodos = record12(record12(body.state)?.todos);
|
|
69910
|
+
if (stateTodos) {
|
|
69911
|
+
const items = [];
|
|
69912
|
+
Object.entries(stateTodos).forEach(([id, row2], index) => {
|
|
69913
|
+
const item = todoItemFromRow(row2, index, id);
|
|
69914
|
+
if (item) items.push(item);
|
|
69915
|
+
});
|
|
69916
|
+
return items;
|
|
69917
|
+
}
|
|
69918
|
+
return Array.isArray(body.todos) ? acpTodoItems(body.todos) : null;
|
|
69919
|
+
}
|
|
69920
|
+
function todosUpdatedEvent(todos) {
|
|
69921
|
+
return { type: "todos_updated", todos };
|
|
69922
|
+
}
|
|
69923
|
+
function todosUpdatedFromAcpTool(input) {
|
|
69924
|
+
if (input.status !== "completed") return null;
|
|
69925
|
+
const fromOutput = grokTodoItemsFromOutput(input.rawOutput);
|
|
69926
|
+
if (fromOutput) return todosUpdatedEvent(fromOutput);
|
|
69927
|
+
const toolName = input.toolName ?? "";
|
|
69928
|
+
if (toolName !== "TodoWrite" && uiToolNameFromId(toolName) !== "TodoWrite") return null;
|
|
69929
|
+
const fromInput = acpTodoItems(input.todos);
|
|
69930
|
+
if (!fromInput) return null;
|
|
69931
|
+
if (fromInput.length === 0 && Array.isArray(input.todos) && input.todos.length > 0) return null;
|
|
69932
|
+
return todosUpdatedEvent(fromInput);
|
|
69933
|
+
}
|
|
69934
|
+
var init_acp_todos = __esm({
|
|
69935
|
+
"../../packages/shared/src/acp-todos.ts"() {
|
|
69936
|
+
"use strict";
|
|
69937
|
+
init_tool_ui();
|
|
69938
|
+
}
|
|
69939
|
+
});
|
|
69940
|
+
|
|
69841
69941
|
// ../../packages/shared/src/effort-labels.ts
|
|
69842
69942
|
function isAcpEffortConfigOption(option) {
|
|
69843
69943
|
const id = option.id?.trim().toLowerCase();
|
|
@@ -72034,7 +72134,7 @@ function mapPlanToTodoEvents(messageId, entries) {
|
|
|
72034
72134
|
});
|
|
72035
72135
|
const toolUseId = `acp-plan:${messageId}`;
|
|
72036
72136
|
const input = JSON.stringify({ todos });
|
|
72037
|
-
|
|
72137
|
+
const events = [
|
|
72038
72138
|
{
|
|
72039
72139
|
type: "content_delta",
|
|
72040
72140
|
messageId,
|
|
@@ -72057,6 +72157,9 @@ function mapPlanToTodoEvents(messageId, entries) {
|
|
|
72057
72157
|
}
|
|
72058
72158
|
}
|
|
72059
72159
|
];
|
|
72160
|
+
const items = acpTodoItems(todos);
|
|
72161
|
+
if (items) events.push(todosUpdatedEvent(items));
|
|
72162
|
+
return events;
|
|
72060
72163
|
}
|
|
72061
72164
|
function mapSessionUpdate(update, ctx, opts) {
|
|
72062
72165
|
switch (update.sessionUpdate) {
|
|
@@ -72137,6 +72240,14 @@ function mapSessionUpdate(update, ctx, opts) {
|
|
|
72137
72240
|
});
|
|
72138
72241
|
}
|
|
72139
72242
|
}
|
|
72243
|
+
const normalizedTodos = normalizeAcpTool(update, { terminalCommand });
|
|
72244
|
+
const todoSnapshot = todosUpdatedFromAcpTool({
|
|
72245
|
+
toolName: normalizedTodos?.toolName,
|
|
72246
|
+
status: update.status,
|
|
72247
|
+
rawOutput: "rawOutput" in update ? update.rawOutput : void 0,
|
|
72248
|
+
todos: normalizedTodos?.input.todos
|
|
72249
|
+
});
|
|
72250
|
+
if (todoSnapshot) events.push(todoSnapshot);
|
|
72140
72251
|
return events;
|
|
72141
72252
|
}
|
|
72142
72253
|
case "plan": {
|
|
@@ -72401,6 +72512,7 @@ function createAcpAgentEventMapper(options) {
|
|
|
72401
72512
|
var init_agent_event_mapper3 = __esm({
|
|
72402
72513
|
"../../packages/acp/src/agent-event-mapper.ts"() {
|
|
72403
72514
|
"use strict";
|
|
72515
|
+
init_acp_todos();
|
|
72404
72516
|
init_agent_error();
|
|
72405
72517
|
init_fs();
|
|
72406
72518
|
init_config_map();
|
|
@@ -72692,9 +72804,9 @@ function formatGrokAskUserAccepted(answers) {
|
|
|
72692
72804
|
if (!answers || typeof answers !== "object" || Array.isArray(answers)) {
|
|
72693
72805
|
return formatGrokAskUserCancelled();
|
|
72694
72806
|
}
|
|
72695
|
-
const
|
|
72696
|
-
const wrapped =
|
|
72697
|
-
const source = wrapped ?
|
|
72807
|
+
const record13 = answers;
|
|
72808
|
+
const wrapped = record13.answers !== null && typeof record13.answers === "object" && !Array.isArray(record13.answers);
|
|
72809
|
+
const source = wrapped ? record13.answers : record13;
|
|
72698
72810
|
const normalized = {};
|
|
72699
72811
|
for (const [question, value] of Object.entries(source)) {
|
|
72700
72812
|
if (typeof value === "string") {
|
|
@@ -72709,7 +72821,7 @@ function formatGrokAskUserAccepted(answers) {
|
|
|
72709
72821
|
return {
|
|
72710
72822
|
outcome: "accepted",
|
|
72711
72823
|
answers: normalized,
|
|
72712
|
-
...wrapped &&
|
|
72824
|
+
...wrapped && record13.annotations && typeof record13.annotations === "object" && !Array.isArray(record13.annotations) ? { annotations: record13.annotations } : {}
|
|
72713
72825
|
};
|
|
72714
72826
|
}
|
|
72715
72827
|
function formatGrokExitPlanCancelled(feedback) {
|
|
@@ -84733,16 +84845,16 @@ async function publish(file2, info, handoff) {
|
|
|
84733
84845
|
await rename(temporary, file2 + ".pty-handoff").finally(() => rm2(temporary, { force: true }));
|
|
84734
84846
|
}
|
|
84735
84847
|
async function environment2(file2, env) {
|
|
84736
|
-
const
|
|
84848
|
+
const record13 = await read2(file2);
|
|
84737
84849
|
const current = await readFile(file2, "utf8").then((text2) => JSON.parse(text2)).catch(() => {
|
|
84738
84850
|
return;
|
|
84739
84851
|
});
|
|
84740
|
-
const handoff =
|
|
84852
|
+
const handoff = record13 !== void 0 && record13.expiresAt > Date.now() && (current === void 0 || same(record13.source, current)) ? record13.handoff : void 0;
|
|
84741
84853
|
return { ...env, OPENCODE_PTY_HANDOFF: handoff == null ? void 0 : JSON.stringify(handoff) };
|
|
84742
84854
|
}
|
|
84743
84855
|
async function complete2(file2, info) {
|
|
84744
|
-
const
|
|
84745
|
-
if (
|
|
84856
|
+
const record13 = await read2(file2);
|
|
84857
|
+
if (record13 !== void 0 && !same(record13.source, info))
|
|
84746
84858
|
await clear2(file2);
|
|
84747
84859
|
}
|
|
84748
84860
|
async function clear2(file2) {
|
|
@@ -89731,9 +89843,9 @@ var init_codex_admin_service = __esm({
|
|
|
89731
89843
|
async installPlugin(projectId, key, apiProviderId) {
|
|
89732
89844
|
return this.withClient(projectId, apiProviderId, async (client3, path) => {
|
|
89733
89845
|
const records2 = await listPluginInventory(client3, path);
|
|
89734
|
-
const
|
|
89735
|
-
if (!
|
|
89736
|
-
await installPlugin2(client3,
|
|
89846
|
+
const record13 = records2.find((r) => r.key === key);
|
|
89847
|
+
if (!record13) throw new Error(`Unknown Codex plugin: ${key}`);
|
|
89848
|
+
await installPlugin2(client3, record13);
|
|
89737
89849
|
});
|
|
89738
89850
|
}
|
|
89739
89851
|
async uninstallPlugin(projectId, key, apiProviderId) {
|
|
@@ -102014,11 +102126,11 @@ function recordMessage(held, message, fragments, join54) {
|
|
|
102014
102126
|
const previous = held.messages.get(message.id);
|
|
102015
102127
|
const sent = message.fragments.map((fragment) => fragment.key);
|
|
102016
102128
|
const entries = new Map(fragments.fragments.map((fragment) => [fragment.key, fragment]));
|
|
102017
|
-
const
|
|
102129
|
+
const record13 = (keys) => new Map(keys.flatMap((key) => {
|
|
102018
102130
|
const entry3 = entries.get(key);
|
|
102019
102131
|
return entry3 ? [[key, heldFragment(entry3.digest, entry3.body)]] : [];
|
|
102020
102132
|
}));
|
|
102021
|
-
const joined = (keys) => new Map([...
|
|
102133
|
+
const joined = (keys) => new Map([...record13(keys.filter((key) => !previous.fragments.has(key))), ...previous.fragments]);
|
|
102022
102134
|
if (previous && join54 === "before") {
|
|
102023
102135
|
const keys = [...sent, ...previous.keys.filter((key) => !sent.includes(key))];
|
|
102024
102136
|
held.messages.set(message.id, { ...previous, keys, fragments: joined(keys), omittedBefore: message.omittedBefore });
|
|
@@ -102032,7 +102144,7 @@ function recordMessage(held, message, fragments, join54) {
|
|
|
102032
102144
|
held.messages.set(message.id, {
|
|
102033
102145
|
metaDigest: message.metaDigest,
|
|
102034
102146
|
keys: sent,
|
|
102035
|
-
fragments:
|
|
102147
|
+
fragments: record13(sent),
|
|
102036
102148
|
omittedBefore: message.omittedBefore,
|
|
102037
102149
|
omittedAfter: message.omittedAfter
|
|
102038
102150
|
});
|
|
@@ -102057,14 +102169,14 @@ function diffHeld(held, messages, fragments) {
|
|
|
102057
102169
|
for (let r = range.length - 1; r >= 0; r--) {
|
|
102058
102170
|
const source = messages[range[r]];
|
|
102059
102171
|
if (held.seen.get(source.id) === source && held.messages.has(source.id)) continue;
|
|
102060
|
-
const { message, record:
|
|
102172
|
+
const { message, record: record13 } = diffMessage(held.messages.get(source.id), fragments.of(source), range[r], Math.max(0, Math.min(LIVE_MESSAGE_BUDGET.maxBytes, remaining)));
|
|
102061
102173
|
const bytes = message ? patchBytes(message) : 0;
|
|
102062
102174
|
if (bytes > remaining && changed.length) {
|
|
102063
102175
|
start = r + 1;
|
|
102064
102176
|
break;
|
|
102065
102177
|
}
|
|
102066
102178
|
remaining -= bytes;
|
|
102067
|
-
held.messages.set(source.id,
|
|
102179
|
+
held.messages.set(source.id, record13);
|
|
102068
102180
|
held.seen.set(source.id, source);
|
|
102069
102181
|
if (message) changed.unshift(message);
|
|
102070
102182
|
}
|
|
@@ -102113,16 +102225,16 @@ function diffMessage(previous, current, index, maxBytes) {
|
|
|
102113
102225
|
const omittedAfter = all.length ? all.length - end : 0;
|
|
102114
102226
|
const metaHeld = previous?.metaDigest === current.metaDigest;
|
|
102115
102227
|
const unchanged = previous && metaHeld && previous.omittedBefore === omittedBefore && previous.omittedAfter === omittedAfter && previous.keys.length === sent.length && sent.every((fragment, i) => !fragment.body && fragment.append === void 0 && previous.keys[i] === fragment.key);
|
|
102116
|
-
const
|
|
102228
|
+
const record13 = {
|
|
102117
102229
|
metaDigest: current.metaDigest,
|
|
102118
102230
|
keys: sent.map((fragment) => fragment.key),
|
|
102119
102231
|
fragments: new Map(all.slice(start, end).map((fragment) => [fragment.key, heldFragment(fragment.digest, fragment.body)])),
|
|
102120
102232
|
omittedBefore,
|
|
102121
102233
|
omittedAfter
|
|
102122
102234
|
};
|
|
102123
|
-
if (unchanged) return { message: null, record:
|
|
102235
|
+
if (unchanged) return { message: null, record: record13 };
|
|
102124
102236
|
return {
|
|
102125
|
-
record:
|
|
102237
|
+
record: record13,
|
|
102126
102238
|
message: {
|
|
102127
102239
|
id: current.id,
|
|
102128
102240
|
index,
|
|
@@ -109339,6 +109451,7 @@ function mapSessionRow(s4) {
|
|
|
109339
109451
|
automationId: s4.automationId ?? null,
|
|
109340
109452
|
providerResume,
|
|
109341
109453
|
...providerSessionId ? { providerSessionId } : {},
|
|
109454
|
+
...s4.parentSessionId ? { parentSessionId: s4.parentSessionId } : {},
|
|
109342
109455
|
tags: Array.isArray(s4.tags) ? s4.tags : []
|
|
109343
109456
|
};
|
|
109344
109457
|
}
|
|
@@ -127907,8 +128020,8 @@ function createHostActionMcpServer(superoneSessionId, requestHostAction, opts) {
|
|
|
127907
128020
|
}
|
|
127908
128021
|
function shortenWidgetShowReply(reply, args, harnessId) {
|
|
127909
128022
|
if (reply.isError || !supportsShortWidgetResult(harnessId)) return reply;
|
|
127910
|
-
const
|
|
127911
|
-
const showArgs = readWidgetShowArgs(
|
|
128023
|
+
const record13 = args && typeof args === "object" && !Array.isArray(args) ? args : {};
|
|
128024
|
+
const showArgs = readWidgetShowArgs(record13);
|
|
127912
128025
|
if (!showArgs.widget_code || showArgs.template) return reply;
|
|
127913
128026
|
return { content: widgetShowShortContent(showArgs) };
|
|
127914
128027
|
}
|
package/package.json
CHANGED