zidane 7.1.4 → 7.1.7
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 +4 -0
- package/dist/{acp-DbYGzaVK.js → acp-BxRfclPQ.js} +3 -3
- package/dist/{acp-DbYGzaVK.js.map → acp-BxRfclPQ.js.map} +1 -1
- package/dist/acp-cli.js +4 -4
- package/dist/acp.d.ts +1 -1
- package/dist/acp.js +1 -1
- package/dist/{agent-BlGt76qk.js → agent-CJbmpTmA.js} +94 -106
- package/dist/agent-CJbmpTmA.js.map +1 -0
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +1 -1
- package/dist/{anthropic-DPPs3wjJ.js → anthropic-BQdAnY-w.js} +2 -2
- package/dist/{anthropic-DPPs3wjJ.js.map → anthropic-BQdAnY-w.js.map} +1 -1
- package/dist/{approvals-CnFq-_Gu.js → approvals-DMxUgyVd.js} +162 -56
- package/dist/approvals-DMxUgyVd.js.map +1 -0
- package/dist/{auth-CNetxyJH.js → auth-DvMdkpGD.js} +4 -4
- package/dist/{auth-CNetxyJH.js.map → auth-DvMdkpGD.js.map} +1 -1
- package/dist/chat/pure.d.ts +4 -4
- package/dist/chat/pure.js +2 -2
- package/dist/chat.d.ts +6 -6
- package/dist/chat.js +5 -5
- package/dist/contexts/daytona.d.ts +1 -1
- package/dist/contexts/e2b.d.ts +1 -1
- package/dist/daemon-cli.js +2 -1
- package/dist/daemon-cli.js.map +1 -1
- package/dist/eval.d.ts +1 -1
- package/dist/extensions.d.ts +1 -1
- package/dist/extensions.js +1 -1
- package/dist/{fetch-url-ma-5_p0p.js → fetch-url-DX75gpL0.js} +3 -2
- package/dist/fetch-url-DX75gpL0.js.map +1 -0
- package/dist/headless.d.ts +1 -1
- package/dist/headless.js +1 -1
- package/dist/{index-DtF2yPaI.d.ts → index-BMOl2Bog.d.ts} +20 -11
- package/dist/index-BMOl2Bog.d.ts.map +1 -0
- package/dist/{index-BIJKozYj.d.ts → index-DCYh6lOp.d.ts} +71 -5
- package/dist/index-DCYh6lOp.d.ts.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +6 -5
- package/dist/{ipc-DZffY7UT.js → ipc-BZcE9wnT.js} +2 -2
- package/dist/{ipc-DZffY7UT.js.map → ipc-BZcE9wnT.js.map} +1 -1
- package/dist/ipc.d.ts +28 -6
- package/dist/ipc.d.ts.map +1 -1
- package/dist/ipc.js +4 -4
- package/dist/mcp.d.ts +1 -1
- package/dist/{oauth-B6F43fti.js → oauth-DxHO17JE.js} +10 -8
- package/dist/{oauth-B6F43fti.js.map → oauth-DxHO17JE.js.map} +1 -1
- package/dist/output/stream-json.d.ts +1 -1
- package/dist/output/terminal.d.ts +1 -1
- package/dist/plugins.d.ts +1 -1
- package/dist/presets.d.ts +1 -1
- package/dist/presets.js +1 -1
- package/dist/prompts-Pqc3JdW_.d.ts +116 -0
- package/dist/prompts-Pqc3JdW_.d.ts.map +1 -0
- package/dist/providers/anthropic.d.ts +1 -1
- package/dist/providers/anthropic.js +1 -1
- package/dist/providers/arcee.d.ts +1 -1
- package/dist/providers/baseten.d.ts +1 -1
- package/dist/providers/cerebras.d.ts +1 -1
- package/dist/providers/local.d.ts +1 -1
- package/dist/providers/openai-compat.d.ts +1 -1
- package/dist/providers/openai.d.ts +1 -1
- package/dist/providers/openai.js +1 -1
- package/dist/providers/openrouter.d.ts +1 -1
- package/dist/providers/xai.d.ts +1 -1
- package/dist/providers/xai.js +1 -1
- package/dist/{providers-DP9kwXYo.js → providers-BVhnFyiY.js} +2 -2
- package/dist/{providers-DP9kwXYo.js.map → providers-BVhnFyiY.js.map} +1 -1
- package/dist/providers.d.ts +1 -1
- package/dist/providers.js +3 -3
- package/dist/restate.d.ts +1 -1
- package/dist/restate.js +1 -1
- package/dist/session/sqlite.d.ts +1 -1
- package/dist/session.d.ts +1 -1
- package/dist/{server-Cdrcncg-.js → shell-path-BBH8xrmU.js} +95 -9
- package/dist/shell-path-BBH8xrmU.js.map +1 -0
- package/dist/skills.d.ts +1 -1
- package/dist/{tool-formatters-Baj_BroN.d.ts → tool-formatters-BDm0tjgy.d.ts} +2 -2
- package/dist/{tool-formatters-Baj_BroN.d.ts.map → tool-formatters-BDm0tjgy.d.ts.map} +1 -1
- package/dist/tools/fetch-url.d.ts +1 -1
- package/dist/tools/fetch-url.d.ts.map +1 -1
- package/dist/tools/fetch-url.js +1 -1
- package/dist/tools/prompts.d.ts +2 -0
- package/dist/tools/prompts.js +164 -0
- package/dist/tools/prompts.js.map +1 -0
- package/dist/tools/web-search.d.ts +1 -1
- package/dist/tools/web-search.d.ts.map +1 -1
- package/dist/tools/web-search.js +3 -3
- package/dist/tools/web-search.js.map +1 -1
- package/dist/tools.d.ts +3 -2
- package/dist/tools.js +3 -2
- package/dist/{transcript-anchors-DfnBVZX0.d.ts → transcript-anchors-DjcEsOYq.d.ts} +2 -2
- package/dist/{transcript-anchors-DfnBVZX0.d.ts.map → transcript-anchors-DjcEsOYq.d.ts.map} +1 -1
- package/dist/tui.d.ts +3 -3
- package/dist/tui.js +43 -25
- package/dist/tui.js.map +1 -1
- package/dist/{turn-operations-BHeYIvSY.js → turn-operations-JynC5ODZ.js} +30 -2
- package/dist/{turn-operations-BHeYIvSY.js.map → turn-operations-JynC5ODZ.js.map} +1 -1
- package/dist/{turn-operations-Cl3RNQ2O.d.ts → turn-operations-Rqk3E0Ue.d.ts} +34 -4
- package/dist/{turn-operations-Cl3RNQ2O.d.ts.map → turn-operations-Rqk3E0Ue.d.ts.map} +1 -1
- package/dist/types.d.ts +3 -2
- package/docs/ARCHITECTURE.md +14 -2
- package/docs/SKILL.md +31 -1
- package/package.json +6 -1
- package/dist/agent-BlGt76qk.js.map +0 -1
- package/dist/approvals-CnFq-_Gu.js.map +0 -1
- package/dist/fetch-url-ma-5_p0p.js.map +0 -1
- package/dist/index-BIJKozYj.d.ts.map +0 -1
- package/dist/index-DtF2yPaI.d.ts.map +0 -1
- package/dist/server-Cdrcncg-.js.map +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { n as __require } from "./rolldown-runtime-BhDjJH2R.js";
|
|
2
2
|
import { n as THINKING_LEVELS, u as toolResultToText } from "./types-CWgENVLY.js";
|
|
3
|
-
import {
|
|
3
|
+
import { u as oauthAccountLabel } from "./cred-keys-BbbBr4q3.js";
|
|
4
|
+
import { A as buildPostCompactAttachments, Bt as multiEdit, D as resolvePersistDir, E as resolveMcpWarningsDir, Et as waitTask, Gn as renderArtifactRow, It as shell, Jt as edit, Kt as grep, Ln as artifactKindLabel, M as selectFilesFromSession, Ot as createSpawnTool, P as compactConversation, Pt as shellKill, Rt as readFile$1, S as migrateSessionArtifactDirs, Sn as createDebugLog, Wt as listFiles, Xn as effectiveContextWindow, Xt as artifacts_default, Yn as OUTPUT_RESERVE_TOKENS, Z as EMPTY_EXTENSION_REGISTRY, bt as composePresets, cn as mergeKeybindings, dn as readKeybindingsRaw, dt as composeExtensionPreset, f as applyCompactSummaryCutoff, fn as resolveExtensionKeybindings, g as unwrapCallTool, in as formatBindingForDisplay, k as resolveTasksDir, kt as isSpawnTool, lt as buildExtensionPreset, mt as filterRegistryPlugins, q as summaryToTurn, qt as glob, t as createAgent, wt as writeFile$1, xt as definePreset } from "./agent-CJbmpTmA.js";
|
|
4
5
|
import { F as parseCommandInvocation, M as commandBlocksToContent, P as executeCommand, c as SKILL_EDIT_METADATA_KEY, g as readSkillEditMarker, j as commandBlockToEvent, l as ZIDANE_EXTENSION_SKILL_NAME, m as extensionDirForCwd, s as EXTENSION_EDIT_METADATA_KEY, u as ZIDANE_SKILL_EDIT_SKILL_NAME, v as withZidaneExtensionSkill, w as generateStructuredData, y as withZidaneSkillEditSkill } from "./src-CkNQKFKr.js";
|
|
5
6
|
import { a as formatDuration, c as previewLine, i as fmtTokens, l as shortId, s as formatTaskSummary, t as ageString } from "./format-BF745pLL.js";
|
|
6
7
|
import { a as DEFAULT_UNREADABLE_DIRS, c as resolveUnreadableDirs, l as resolveWritableRoots, o as isolationAvailability, r as createProcessContext, s as parseAllowWriteSetting, u as resolveWritableRootsAsync } from "./contexts-CRE9pw07.js";
|
|
@@ -9,17 +10,19 @@ import { L as projectUserPaths, R as findGitRoot$1, x as discoverSkills } from "
|
|
|
9
10
|
import { t as writeFileAtomic } from "./atomic-write-B7zr1ddF.js";
|
|
10
11
|
import { n as defaultPluginDataRoot, p as resolveStorageDirs, r as loadAgentPlugin } from "./plugins-gbI7SBA6.js";
|
|
11
12
|
import { r as createLogger, t as consoleSink } from "./logger--C1VQjwJ.js";
|
|
13
|
+
import { toolPrompts } from "./tools/prompts.js";
|
|
12
14
|
import { h as McpOAuthProvider, l as normalizeMcpServers, n as connectMcpServers, s as nonOwningMcpView } from "./mcp-CgNd-f3F.js";
|
|
13
15
|
import { appendDynamicSection, joinSystemPrompt, splitSystemPrompt } from "./prompt.js";
|
|
14
16
|
import { l as withExtensionSession, o as loadSession, t as createSession } from "./session-BqRP1hS7.js";
|
|
15
17
|
import { n as flattenTurns, r as formatTokenUsage } from "./stats-DAKBEKjc.js";
|
|
16
18
|
import { i as installCacheBreakLogger } from "./cache-telemetry-ehVdWsg2.js";
|
|
17
19
|
import { i as findActiveTriggers, n as collectReferences, o as mergeSuggestions, t as applyInsert } from "./completion-core-BRo86R_L.js";
|
|
18
|
-
import { h as sanitizeProviderDiagnosticMetadata, n as THINKING_BINDING_SETTING_ENV } from "./anthropic-
|
|
19
|
-
import {
|
|
20
|
+
import { h as sanitizeProviderDiagnosticMetadata, n as THINKING_BINDING_SETTING_ENV } from "./anthropic-BQdAnY-w.js";
|
|
21
|
+
import { s as resolveOAuthApiKey } from "./oauth-DxHO17JE.js";
|
|
22
|
+
import { r as fetchUrl } from "./fetch-url-DX75gpL0.js";
|
|
20
23
|
import { webSearch } from "./tools/web-search.js";
|
|
21
|
-
import {
|
|
22
|
-
import { T as modelsForDescriptor, b as getContextWindow, g as anthropicDescriptor, h as BUILTIN_PROVIDERS, i as readCredentials, k as restoreModelOptions, n as applyApiKeyEnv, r as credentialsPath, t as detectAuth, v as credKeyOf, w as modelSupportsReasoning, y as enabledModelOptions } from "./auth-
|
|
24
|
+
import { B as cacheBreakNoticeText, Bt as isMainSession, Cn as resolveApprovalForPayload, Et as promptTurnRefs, Ft as ORCHESTRATED_BY_KEY, Ht as parseSessionEventXml, Lt as SESSION_ROLE_KEY, N as chunkMarkdownForRender, Nt as MAIN_PLAYBOOK_FRAGMENT, On as chatReferenceTokensFromText, Pt as MAIN_SESSION_TITLE, Q as filterChainFallbacks, Rt as WORKER_REPORT_FRAGMENT, Sn as parseEditOutcomesFromResult, Tn as stripEditOutcomesAnnotation, Ut as renderProjectsBriefing, Vt as orchestratedBy, Wt as renderSessionEventXml, an as hasRunReceipt, hn as previewEditPayload, it as restoreChainFallbacks, m as ownerOf, nn as formatRunReceiptLine, on as runReceiptFromRun, pn as extractEditPayload, q as buildRunModel, qt as sessionEventLabel, u as capTranscriptEvents, wn as rewriteMultiEditHeader, xn as mergeApprovalAndBodyOutcomes, yn as buildEditOutcomesAnnotation, z as cacheBreakChip, zt as artifactsFromTurns } from "./turn-operations-JynC5ODZ.js";
|
|
25
|
+
import { T as modelsForDescriptor, b as getContextWindow, g as anthropicDescriptor, h as BUILTIN_PROVIDERS, i as readCredentials, k as restoreModelOptions, n as applyApiKeyEnv, p as storedCredentialsOf, r as credentialsPath, t as detectAuth, v as credKeyOf, w as modelSupportsReasoning, y as enabledModelOptions } from "./auth-DvMdkpGD.js";
|
|
23
26
|
import { basename, delimiter, dirname, isAbsolute, join, posix, relative, resolve, sep } from "node:path";
|
|
24
27
|
import { Buffer } from "node:buffer";
|
|
25
28
|
import { chmodSync, closeSync, cpSync, createReadStream, createWriteStream, existsSync, mkdirSync, mkdtempSync, openSync, readFileSync, readSync, readdirSync, realpathSync, renameSync, rmSync, statSync, watch, writeFileSync } from "node:fs";
|
|
@@ -996,11 +999,7 @@ function createChatTurnsReadTool(options) {
|
|
|
996
999
|
isConcurrencySafe: true,
|
|
997
1000
|
spec: {
|
|
998
1001
|
name: "read_chat_turns",
|
|
999
|
-
description:
|
|
1000
|
-
"Read selected turns from a previous chat explicitly referenced by the user with `#<chat>` in the current prompt.",
|
|
1001
|
-
"Use this when the user asks to continue from, compare with, or inspect a referenced chat.",
|
|
1002
|
-
"The tool refuses chats that were not referenced in the current user prompt."
|
|
1003
|
-
].join(" "),
|
|
1002
|
+
description: toolPrompts.read_chat_turns,
|
|
1004
1003
|
inputSchema: {
|
|
1005
1004
|
type: "object",
|
|
1006
1005
|
properties: {
|
|
@@ -10042,6 +10041,26 @@ function createCommandModule(deps) {
|
|
|
10042
10041
|
turnId: pendingTurnId
|
|
10043
10042
|
});
|
|
10044
10043
|
};
|
|
10044
|
+
const emitCommandError = async (text) => {
|
|
10045
|
+
await flushCommandTurn();
|
|
10046
|
+
const notice = {
|
|
10047
|
+
severity: "error",
|
|
10048
|
+
label: "command"
|
|
10049
|
+
};
|
|
10050
|
+
const turnId = randomUUID();
|
|
10051
|
+
await session.appendTurns([{
|
|
10052
|
+
id: turnId,
|
|
10053
|
+
role: "command",
|
|
10054
|
+
createdAt: Date.now(),
|
|
10055
|
+
content: noticeTurnContent(notice, text)
|
|
10056
|
+
}]).catch(() => void 0);
|
|
10057
|
+
emitEvent({
|
|
10058
|
+
kind: "error",
|
|
10059
|
+
text,
|
|
10060
|
+
notice,
|
|
10061
|
+
turnId
|
|
10062
|
+
});
|
|
10063
|
+
};
|
|
10045
10064
|
const ctx = {
|
|
10046
10065
|
args: invocation.args,
|
|
10047
10066
|
argv: invocation.argv,
|
|
@@ -10324,15 +10343,9 @@ function createCommandModule(deps) {
|
|
|
10324
10343
|
});
|
|
10325
10344
|
emitBlock({ text: `\`❯ /${invocation.name}${invocation.args ? ` ${invocation.args}` : ""}\`` });
|
|
10326
10345
|
const result = await executeScoped();
|
|
10327
|
-
if (result.error)
|
|
10328
|
-
kind: "error",
|
|
10329
|
-
text: `/${invocation.name}: ${errorMessage(result.error)}`
|
|
10330
|
-
});
|
|
10346
|
+
if (result.error) await emitCommandError(`/${invocation.name}: ${errorMessage(result.error)}`);
|
|
10331
10347
|
} catch (err) {
|
|
10332
|
-
|
|
10333
|
-
kind: "error",
|
|
10334
|
-
text: `/${invocation.name}: ${errorMessage(err)}`
|
|
10335
|
-
});
|
|
10348
|
+
await emitCommandError(`/${invocation.name}: ${errorMessage(err)}`);
|
|
10336
10349
|
} finally {
|
|
10337
10350
|
if (run.commandAbort === controller) delete run.commandAbort;
|
|
10338
10351
|
await flushCommandTurn();
|
|
@@ -14854,6 +14867,8 @@ function formatPathForCwd(projectRelativePath, projectRoot, cwd) {
|
|
|
14854
14867
|
const FETCH_TIMEOUT_MS = 15e3;
|
|
14855
14868
|
/** How long a snapshot stays fresh. Usage windows move in minutes, not seconds. */
|
|
14856
14869
|
const USAGE_CACHE_TTL_MS = 6e4;
|
|
14870
|
+
/** TTL after a failed probe kept the previous good snapshot: retry soon, not in a minute. */
|
|
14871
|
+
const USAGE_RETRY_TTL_MS = 1e4;
|
|
14857
14872
|
/**
|
|
14858
14873
|
* Credential-file key to probe. Keyed by credential key rather than provider
|
|
14859
14874
|
* key so a custom descriptor reusing a builtin credential slot
|
|
@@ -14880,12 +14895,12 @@ function usageSourceFor(descriptor) {
|
|
|
14880
14895
|
function providerUsageSupported(descriptor) {
|
|
14881
14896
|
return usageSourceFor(descriptor) !== null;
|
|
14882
14897
|
}
|
|
14883
|
-
/** Keyed by credential
|
|
14898
|
+
/** Keyed by credential slot + token: two descriptors sharing tokens share a snapshot. */
|
|
14884
14899
|
const cache = /* @__PURE__ */ new Map();
|
|
14885
14900
|
/** In-flight probes, so a footer read and a panel open share one request. */
|
|
14886
14901
|
const inFlight = /* @__PURE__ */ new Map();
|
|
14887
14902
|
/**
|
|
14888
|
-
* Newest probe issued per
|
|
14903
|
+
* Newest probe issued per cache key, as a monotonic ticket. `refresh`
|
|
14889
14904
|
* skips both maps above, so two probes for one key can be outstanding at once
|
|
14890
14905
|
* (panel refresh while the footer's post-run refresh is still in flight); only
|
|
14891
14906
|
* the newest may write the cache, or a slow older probe would pin stale
|
|
@@ -14916,47 +14931,122 @@ function usageChecksOptedOut(env = process.env) {
|
|
|
14916
14931
|
return false;
|
|
14917
14932
|
}
|
|
14918
14933
|
/**
|
|
14919
|
-
* Usage for one provider
|
|
14920
|
-
*
|
|
14921
|
-
*
|
|
14922
|
-
*
|
|
14934
|
+
* Usage for one provider, probed with the credential requests use — or, when
|
|
14935
|
+
* that one is not the kind the probe needs (an API key in use, OAuth accounts
|
|
14936
|
+
* parked beside it), the first stored one that is. What the footer shows.
|
|
14937
|
+
*
|
|
14938
|
+
* `null` means there is nothing to show: the provider has no usage surface,
|
|
14939
|
+
* no credential of the kind its probe needs (file or, for API keys, env), or
|
|
14940
|
+
* the environment opted out (see {@link usageChecksOptedOut}).
|
|
14923
14941
|
*
|
|
14924
14942
|
* Never rejects. Transport and parse failures land in the snapshot.
|
|
14925
14943
|
*/
|
|
14926
14944
|
async function fetchProviderUsage(dataDir, descriptor, opts = {}) {
|
|
14927
14945
|
const source = usageSourceFor(descriptor);
|
|
14928
14946
|
if (!source || usageChecksOptedOut()) return null;
|
|
14929
|
-
const
|
|
14930
|
-
|
|
14931
|
-
|
|
14932
|
-
|
|
14933
|
-
|
|
14934
|
-
|
|
14935
|
-
|
|
14936
|
-
|
|
14947
|
+
const [preferred] = resolveUsageCredentials(dataDir, descriptor, source);
|
|
14948
|
+
if (!preferred) return null;
|
|
14949
|
+
return probeRenewed(dataDir, source, descriptor, preferred, opts);
|
|
14950
|
+
}
|
|
14951
|
+
/**
|
|
14952
|
+
* Usage for EVERY credential of a provider the probe can use — one snapshot
|
|
14953
|
+
* per stored OAuth account, the active one first. What the panel renders.
|
|
14954
|
+
* Empty under the same conditions {@link fetchProviderUsage} returns `null`.
|
|
14955
|
+
*/
|
|
14956
|
+
async function fetchProviderUsageAccounts(dataDir, descriptor, opts = {}) {
|
|
14957
|
+
const source = usageSourceFor(descriptor);
|
|
14958
|
+
if (!source || usageChecksOptedOut()) return [];
|
|
14959
|
+
const credentials = resolveUsageCredentials(dataDir, descriptor, source);
|
|
14960
|
+
return Promise.all(credentials.map((c) => probeRenewed(dataDir, source, descriptor, c, opts)));
|
|
14961
|
+
}
|
|
14962
|
+
/**
|
|
14963
|
+
* {@link probeCached}, after renewing an expired OAuth token in its slot.
|
|
14964
|
+
* Stays synchronous up to the request when no renewal is needed, so callers
|
|
14965
|
+
* that start two probes back to back still see both requests issued at once.
|
|
14966
|
+
*/
|
|
14967
|
+
function probeRenewed(dataDir, source, descriptor, credential, opts) {
|
|
14968
|
+
if (!needsRenewal(credential.cred)) return probeCached(source, descriptor, credential, opts);
|
|
14969
|
+
return renewExpired(dataDir, descriptor, credential).then((renewed) => "status" in renewed ? stampIdentity(renewed, descriptor, credential) : probeCached(source, descriptor, renewed, opts));
|
|
14970
|
+
}
|
|
14971
|
+
/**
|
|
14972
|
+
* An expired OAuth token that carries a refresh token. One without cannot be
|
|
14973
|
+
* renewed and reports `token expired` from the probe itself.
|
|
14974
|
+
*/
|
|
14975
|
+
function needsRenewal(cred) {
|
|
14976
|
+
return cred.kind === "oauth" && typeof cred.expires === "number" && cred.expires <= Date.now() && !!cred.refresh;
|
|
14977
|
+
}
|
|
14978
|
+
/**
|
|
14979
|
+
* Rotate an expired OAuth token through the run path's refresh helper, keyed
|
|
14980
|
+
* to this credential's own slot, and hand back the credential as now stored.
|
|
14981
|
+
* A failed refresh becomes an `unauthorized` snapshot.
|
|
14982
|
+
*/
|
|
14983
|
+
async function renewExpired(dataDir, descriptor, credential) {
|
|
14984
|
+
try {
|
|
14985
|
+
await resolveOAuthApiKey({
|
|
14986
|
+
provider: descriptor.key,
|
|
14987
|
+
providerId: credKeyOf(descriptor),
|
|
14988
|
+
credentialKey: credential.key,
|
|
14989
|
+
credentialsPath: credentialsPath(dataDir),
|
|
14990
|
+
missingError: "not signed in",
|
|
14991
|
+
refreshError: (reason) => reason
|
|
14992
|
+
});
|
|
14993
|
+
} catch {
|
|
14994
|
+
return snapshot({
|
|
14995
|
+
providerKey: descriptor.key,
|
|
14996
|
+
label: descriptor.label
|
|
14997
|
+
}, {
|
|
14998
|
+
status: "unauthorized",
|
|
14999
|
+
error: "refresh failed"
|
|
15000
|
+
});
|
|
15001
|
+
}
|
|
15002
|
+
const stored = readCredentials(dataDir)[credential.key];
|
|
15003
|
+
return stored?.kind === "oauth" ? {
|
|
15004
|
+
...credential,
|
|
15005
|
+
cred: stored
|
|
15006
|
+
} : credential;
|
|
15007
|
+
}
|
|
15008
|
+
/** Probe one credential through the cache / in-flight coalescing. */
|
|
15009
|
+
function probeCached(source, descriptor, credential, opts) {
|
|
15010
|
+
const cacheKey = `${credential.key}\0${credential.cred.kind === "oauth" ? credential.cred.access : credential.cred.value}`;
|
|
15011
|
+
const identify = (snapshot) => stampIdentity(snapshot, descriptor, credential);
|
|
14937
15012
|
if (!opts.refresh) {
|
|
14938
|
-
const cached = cache.get(
|
|
14939
|
-
if (cached && cached.expiresAt > Date.now()) return identify(cached.snapshot);
|
|
14940
|
-
const pending = inFlight.get(
|
|
15013
|
+
const cached = cache.get(cacheKey);
|
|
15014
|
+
if (cached && cached.expiresAt > Date.now()) return Promise.resolve(identify(cached.snapshot));
|
|
15015
|
+
const pending = inFlight.get(cacheKey);
|
|
14941
15016
|
if (pending) return pending.then(identify);
|
|
14942
15017
|
}
|
|
14943
15018
|
const ticket = ++probeTicket;
|
|
14944
|
-
latestProbe.set(
|
|
14945
|
-
const
|
|
14946
|
-
|
|
14947
|
-
|
|
15019
|
+
latestProbe.set(cacheKey, ticket);
|
|
15020
|
+
const previous = cache.get(cacheKey)?.snapshot;
|
|
15021
|
+
const probe = runProbe(source, descriptor, credential.cred).then((fresh) => {
|
|
15022
|
+
const keepPrevious = fresh.status === "unavailable" && previous?.status === "ok";
|
|
15023
|
+
const snapshot = keepPrevious ? previous : fresh;
|
|
15024
|
+
if (latestProbe.get(cacheKey) === ticket) cache.set(cacheKey, {
|
|
15025
|
+
expiresAt: Date.now() + (keepPrevious ? USAGE_RETRY_TTL_MS : USAGE_CACHE_TTL_MS),
|
|
14948
15026
|
snapshot
|
|
14949
15027
|
});
|
|
14950
15028
|
return snapshot;
|
|
14951
15029
|
}).finally(() => {
|
|
14952
|
-
if (inFlight.get(
|
|
15030
|
+
if (inFlight.get(cacheKey) === probe) inFlight.delete(cacheKey);
|
|
14953
15031
|
});
|
|
14954
|
-
inFlight.set(
|
|
15032
|
+
inFlight.set(cacheKey, probe);
|
|
14955
15033
|
return probe.then(identify);
|
|
14956
15034
|
}
|
|
15035
|
+
/** Name the provider, slot, and account a snapshot belongs to. */
|
|
15036
|
+
function stampIdentity(snapshot, descriptor, credential) {
|
|
15037
|
+
return {
|
|
15038
|
+
...snapshot,
|
|
15039
|
+
providerKey: descriptor.key,
|
|
15040
|
+
label: descriptor.label,
|
|
15041
|
+
credentialKey: credential.key,
|
|
15042
|
+
account: credential.cred.kind === "oauth" ? oauthAccountLabel(credential.cred) : null,
|
|
15043
|
+
activeCredential: credential.active
|
|
15044
|
+
};
|
|
15045
|
+
}
|
|
14957
15046
|
/**
|
|
14958
|
-
*
|
|
14959
|
-
* authenticated in a way
|
|
15047
|
+
* Every credential a probe can authenticate with, active slot first, then in
|
|
15048
|
+
* storage order. Empty when the provider isn't authenticated in a way the
|
|
15049
|
+
* probe can use.
|
|
14960
15050
|
*
|
|
14961
15051
|
* An API key is taken from the environment when the file has none: `detectAuth`
|
|
14962
15052
|
* marks a provider available on a shell-set `envKey` alone, and the launcher
|
|
@@ -14965,26 +15055,35 @@ async function fetchProviderUsage(dataDir, descriptor, opts = {}) {
|
|
|
14965
15055
|
* telling them they aren't signed in. OAuth tokens have no env equivalent, so
|
|
14966
15056
|
* those probes stay file-only.
|
|
14967
15057
|
*/
|
|
14968
|
-
function
|
|
15058
|
+
function resolveUsageCredentials(dataDir, descriptor, source) {
|
|
14969
15059
|
const kind = SOURCE_CRED_KIND[source];
|
|
14970
|
-
const
|
|
14971
|
-
|
|
15060
|
+
const credKey = credKeyOf(descriptor);
|
|
15061
|
+
const stored = storedCredentialsOf(readCredentials(dataDir), credKey).filter((s) => s.credential.kind === kind && (s.credential.kind !== "apikey" || s.credential.value)).map((s) => ({
|
|
15062
|
+
key: s.key,
|
|
15063
|
+
cred: s.credential,
|
|
15064
|
+
active: s.active
|
|
15065
|
+
}));
|
|
15066
|
+
if (stored.length > 0) return stored;
|
|
14972
15067
|
if (kind === "apikey" && descriptor.envKey) {
|
|
14973
15068
|
const fromEnv = process.env[descriptor.envKey];
|
|
14974
|
-
if (fromEnv) return {
|
|
14975
|
-
|
|
14976
|
-
|
|
14977
|
-
|
|
15069
|
+
if (fromEnv) return [{
|
|
15070
|
+
key: credKey,
|
|
15071
|
+
cred: {
|
|
15072
|
+
kind: "apikey",
|
|
15073
|
+
value: fromEnv
|
|
15074
|
+
},
|
|
15075
|
+
active: true
|
|
15076
|
+
}];
|
|
14978
15077
|
}
|
|
14979
|
-
return
|
|
15078
|
+
return [];
|
|
14980
15079
|
}
|
|
14981
15080
|
/**
|
|
14982
15081
|
* Usage for every registered provider that has both a usage surface and a
|
|
14983
|
-
* usable credential, in registry order
|
|
15082
|
+
* usable credential, in registry order, every account included.
|
|
14984
15083
|
*/
|
|
14985
15084
|
async function fetchAllProviderUsage(dataDir, registry, opts = {}) {
|
|
14986
15085
|
const candidates = Object.values(registry).filter(providerUsageSupported);
|
|
14987
|
-
return (await Promise.all(candidates.map((descriptor) =>
|
|
15086
|
+
return (await Promise.all(candidates.map((descriptor) => fetchProviderUsageAccounts(dataDir, descriptor, opts)))).flat();
|
|
14988
15087
|
}
|
|
14989
15088
|
async function runProbe(source, descriptor, cred) {
|
|
14990
15089
|
const base = {
|
|
@@ -15002,10 +15101,17 @@ async function runProbe(source, descriptor, cred) {
|
|
|
15002
15101
|
return snapshot(base, { error: err instanceof Error ? err.message : "request failed" });
|
|
15003
15102
|
}
|
|
15004
15103
|
}
|
|
15005
|
-
/**
|
|
15104
|
+
/**
|
|
15105
|
+
* Snapshot factory. Defaults to `unavailable` so failure paths stay one-liners.
|
|
15106
|
+
* The credential identity fields are placeholders here; `probeCached` stamps
|
|
15107
|
+
* the real ones on every return path.
|
|
15108
|
+
*/
|
|
15006
15109
|
function snapshot(base, partial = {}) {
|
|
15007
15110
|
return {
|
|
15008
15111
|
...base,
|
|
15112
|
+
credentialKey: base.providerKey,
|
|
15113
|
+
account: null,
|
|
15114
|
+
activeCredential: true,
|
|
15009
15115
|
status: "unavailable",
|
|
15010
15116
|
plan: null,
|
|
15011
15117
|
windows: [],
|
|
@@ -17217,6 +17323,6 @@ function createApprovalHub(options) {
|
|
|
17217
17323
|
};
|
|
17218
17324
|
}
|
|
17219
17325
|
//#endregion
|
|
17220
|
-
export {
|
|
17326
|
+
export { runOAuthLogin as $, dedupMcpServersByName as $n, getArchivedTodosForRun as $r, discoverProjectPlugins as $t, useSafeModeQueue as A, lastContextSizeFromTurns as Ai, CATPPUCCIN_MACCHIATO as An, chatAutoCompactBehavior as Ar, serializeInteractionResponse as At, USAGE_CACHE_TTL_MS as B, toolCallPreview as Bi, resolveConfig as Bn, DEFAULT_PERSIST_EXCLUDE_TOOLS as Br, resolveCwdPath as Bt, resolveSessionExportTarget as C, createChatTurnsReadTool as Ci, resolveChipColor as Cn, compareSemver as Cr, buildResumedToolResultsTurn as Ct, scopeCwd as D, deriveSessionTitle as Di, GRUVBOX_LIGHT as Dn, performInPlaceSelfUpdate as Dr, isModelInteraction as Dt, resolveSessionCwd as E, createStateStore as Ei, GRUVBOX_DARK as En, parseSemver as Er, isInteractionTool as Et, matchesSafelistEntry as F, saveState as Fi, DiscoveryProvider as Fn, renderAgentsMdBlock as Fr, toTodosSnapshot as Ft, providerUsageSupported as G, useCompletion as Gn, DEFAULT_MAX_TODO_ITEMS as Gr, modelChainMetadata as Gt, fetchAllProviderUsage as H, updateToolEventOutcomes as Hi, ARTIFACTS_COMPLETION_PROVIDER_ID as Hn, accentColor as Hr, createBuiltinCommands as Ht, projectsFilePath as I, serverToolResultSummary as Ii, useDiscovery as In, BUILD_AGENT as Ir, installProviderDiagnosticHook as It, formatPathForCwd as J, importFromClaudeCode as Jn, TODOWRITE_TOOL as Jr, createFileMcpCredentialStore as Jt, usageChecksOptedOut as K, countClaudeSessionFiles as Kn, TODOREAD_TOOL as Kr, sessionModelFallbacks as Kt, readProjects as L, stripSpawnTokensLine as Li, useDiscoveryOptional as Ln, BUILTIN_AGENTS as Lr, createInteractionHub as Lt, addToSafelist as M, loadState as Mi, parseEditorCommand as Mn, groupArtifacts as Mr, useInteractionsQueue as Mt, getSafelist as N, marginTopFor as Ni, quoteForShell as Nn, summarizeArtifactCounts as Nr, STALE_RUN_MARKER_MS as Nt, SafeModeProvider as O, eventsFromTurns as Oi, CATPPUCCIN_FRAPPE as On, performSelfUpdate as Or, makeRequestInteraction as Ot, isOnSafelist as P, noticeTurnContent as Pi, createDiscoverySlot as Pn, discoverAgentsMd as Pr, createChatHost as Pt, oauthUsesManualCodePaste as Q, buildMcpServers as Qn, createTodoTools as Qr, buildPluginContributions as Qt, suggestSafelistEntries as R, sumRunCosts as Ri, ConfigProvider as Rn, DEFAULT_AGENT_ID as Rr, extractEditPayloadForGate as Rt, renderSession as S, chatReferenceTokensForPrompt as Si, DEFAULT_THEME as Sn, checkTarballAvailable as Sr, PRESENT_PLAN_TOOL as St, folderlessCwd as T, compactSummaryEvent as Ti, VAPORWAVE_THEME as Tn, detectPackageManager as Tr, createInteractionTools as Tt, fetchProviderUsage as U, usageByModel as Ui, createArtifactsCompletionProvider as Un, resolveAgentId as Ur, applyThinkingBindingSetting as Ut, clearProviderUsageCache as V, toolResultText as Vi, resolveStoragePaths as Vn, PLAN_AGENT as Vr, serializePreview as Vt, fetchProviderUsageAccounts as W, scoreArtifacts as Wn, singleAgentRegistry as Wr, createMainSession as Wt, normalizeRedirectPaste as X, removeMcpServer as Xn, TODO_WRITE_COUNTS_METADATA_KEY as Xr, patchMcpCredential as Xt, fetchOAuthRedirect as Y, mcpsWritePath as Yn, TODO_STATUS_GLYPHS as Yr, mcpCredentialsPath as Yt, redirectUriFromAuthUrl as Z, upsertMcpServer as Zn, applyTodosSnapshot as Zr, runEndNotice as Zt, buildSpawnEndEvent as _, SUBAGENT_GUIDANCE as _i, SettingsProvider as _n, useRestartRequired as _r, reduceMcpAuth as _t, renderActiveTodoAnchor as a, selectActiveTodos as ai, clipHintsToWidth as an, bootProfileEnabled as ar, saveMcpToolsCache as at, defaultSkillScanPaths as b, buildPlanSystem as bi, useSettings as bn, findInstalledCompanion as br, HOST_INTERACTION_ID_PREFIX as bt, useSelectStyle as c, useActiveTodos as ci, buildHints as cn, buildRestartHint as cr, useMcpToolToggleMap as ct, useTheme as d, DOING_TASKS_DOCTRINE as di, useEnabledToggleSet as dn, runUpdateCommand as dr, indexOfServerRow as dt, getTodosForRun as ei, parsePluginScanPathEnv as en, defaultMcpsConfigPaths as er, supportsOAuth as et, discoverSystemMd as f, IDENTITY_PREFIX as fi, DEFAULT_SETTINGS as fn, UPDATE_APPLIED_MARKER as fr, parentServerName as ft, useStreamBuffer as g, PLAN_MODE_DOCTRINE_NO_PROMPTS as gi, SETTINGS_TOGGLES as gn, updateAppliedMarkerPath as gr, getMcpAuthStatus as gt, userSystemMdPath as h, PLAN_MODE_DOCTRINE as hi, SETTINGS_INPUTS as hn, readUpdateAppliedMarker as hr, useMcpAuthState as ht, createActiveTodoAnchorHooks as i, sanitizeTodoItems as ii, EMPTY_HINTS as in, tryRevealPath as ir, refreshMcpToolsCatalog as it, IMPLICITLY_SAFE_TOOLS as j, listSessionMeta as ji, CATPPUCCIN_MOCHA as jn, chatWindowBehavior as jr, useInteractionsActions as jt, useSafeModeActions as k, getSessionMeta as ki, CATPPUCCIN_LATTE as kn, resolvePlatformPackage as kr, pendingInteractionsFromTurns as kt, useSurfaces as l, ACTIONS_WITH_CARE_DOCTRINE as li, shortChord as ln, buildUpdateHint as lr, useMcpToolToggleSet as lt, userScopeOverridesLoad as m, INTERACTION_GUIDANCE_NO_PROMPTS as mi, SETTINGS_CHOICES as mn, probeInstalledVersion as mr, useMcpAuthDispatch as mt, createMemoryApprovalsStore as n, pickActiveRunId as ni, EditOutcomeLedger as nn, parseMcpsFile as nr, loadMcpToolsCache as nt, ThemeProvider as o, setTodosForRun as oi, hintsLength as on, bootTick as or, subscribeMcpToolsCache as ot, renderSystemMdSeed as p, INTERACTION_GUIDANCE as pi, SETTINGS_CATEGORIES as pn, hasUpdateAppliedMarker as pr, McpAuthProvider as pt, usageSourceFor as q, hasClaudeCodeSetup as qn, TODOS_METADATA_KEY as qr, resolveSandboxFromSettings as qt, computeTurnAnchors as r, pruneTodosByRun as ri, runCompaction as rn, tryOpenBrowser as rr, mcpToolsCachePath as rt, useColors as s, todoProgressLabel as si, truncateTrailing as sn, upgradeInstalledPackages as sr, buildToolToggle as st, createApprovalHub as t, isTodoTool as ti, attachMcpWarnLog as tn, discoverProjectMcps as tr, clearMcpToolsCache as tt, useSyntaxStyles as u, COMMUNICATION_DOCTRINE as ui, listProjectFiles as un, useUpdateCheck as ur, buildVisibleMcpRows as ut, buildSpawnStartEvent as v, TOKEN_DISCIPLINE_DOCTRINE as vi, clampFps as vn, watchInstalledVersion as vr, ASK_USER_TOOL as vt, writeSessionExport as w, DEFAULT_SESSION_TITLE as wi, resolveTheme as wn, detectLibc as wr, createAutomaticInteractionResponse as wt, discoverProjectSkills as x, envSection as xi, BUILTIN_THEMES as xn, checkForUpdate as xr, InteractionsProvider as xt, buildSkillsConfig as y, buildBuildSystem as yi, enforceSettingsInvariants as yn, writeUpdateAppliedMarker as yr, AUTOMATIC_INTERACTION_INSTRUCTION as yt, writeProjects as z, titleFromTurns as zi, useConfig as zn, DEFAULT_BUDGET_EXCLUDE_TOOLS as zr, readFileSafe as zt };
|
|
17221
17327
|
|
|
17222
|
-
//# sourceMappingURL=approvals-
|
|
17328
|
+
//# sourceMappingURL=approvals-DMxUgyVd.js.map
|