claude-use 11.80.0 → 11.82.0
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 +1 -1
- package/dist/cli.cjs +205 -33
- package/dist/index.cjs +165 -15
- package/dist/index.mjs +165 -15
- package/dist/types/index.d.ts +14 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -183,7 +183,7 @@ function providerFilePath(directory, name, source) {
|
|
|
183
183
|
}
|
|
184
184
|
return import_node_path.default.join(directory, `${name}.json`);
|
|
185
185
|
}
|
|
186
|
-
var import_node_path, import_zod, FILESYSTEM_COMPONENT_BYTES, MAX_PID_DIGITS, UUID_CHARS, ATOMIC_WRITE_OVERHEAD_BYTES, FARM_SWAP_OVERHEAD_BYTES, MAX_NAME_BYTES, FILE_NAME_PATTERN, FILE_NAME, FILE_NAME_RULE, STORED_NAME_RULE, FileNameSchema, StoredNameSchema, UnsafeNameError, InvalidProviderNameError;
|
|
186
|
+
var import_node_path, import_zod, FILESYSTEM_COMPONENT_BYTES, MAX_PID_DIGITS, UUID_CHARS, ATOMIC_WRITE_OVERHEAD_BYTES, FARM_SWAP_OVERHEAD_BYTES, MAX_NAME_BYTES, FILE_NAME_PATTERN, FILE_NAME, FILE_NAME_RULE, STORED_NAME_RULE, FileNameSchema, StoredNameSchema, LABEL_FORBIDDEN, IDENTITY_LABEL_RULE, IdentityLabelSchema, UnsafeNameError, InvalidProviderNameError;
|
|
187
187
|
var init_names = __esm({
|
|
188
188
|
"src/config/names.ts"() {
|
|
189
189
|
"use strict";
|
|
@@ -202,6 +202,9 @@ var init_names = __esm({
|
|
|
202
202
|
STORED_NAME_RULE = `must be non-empty, at most ${String(MAX_NAME_BYTES)} bytes, not "." or "..", and contain no path separator or NUL`;
|
|
203
203
|
FileNameSchema = import_zod.z.string().min(1).regex(FILE_NAME, FILE_NAME_RULE);
|
|
204
204
|
StoredNameSchema = import_zod.z.string().min(1).max(MAX_NAME_BYTES).refine(isStoredName, STORED_NAME_RULE);
|
|
205
|
+
LABEL_FORBIDDEN = /[\p{Cc}\p{Zl}\p{Zp}]/u;
|
|
206
|
+
IDENTITY_LABEL_RULE = `must be non-empty single-line text of at most ${String(MAX_NAME_BYTES)} characters, with no control characters and no leading or trailing whitespace`;
|
|
207
|
+
IdentityLabelSchema = import_zod.z.string().min(1).max(MAX_NAME_BYTES).refine((label) => label === label.trim() && !LABEL_FORBIDDEN.test(label), IDENTITY_LABEL_RULE);
|
|
205
208
|
UnsafeNameError = class extends CliError {
|
|
206
209
|
constructor(attemptedName, kind, rule = STORED_NAME_RULE, source) {
|
|
207
210
|
super(`${source === void 0 ? "" : `${source}: `}${JSON.stringify(attemptedName)} is not a valid ${kind} name: a name ${rule}.`);
|
|
@@ -1125,7 +1128,7 @@ var init_schema = __esm({
|
|
|
1125
1128
|
resumeOnLimit: import_zod3.z.boolean().optional(),
|
|
1126
1129
|
/** Whether a supervised session's context is compacted before its identity's quota is spent, so the resume on the next member writes a small context instead of a large one. Needs `resumeOnLimit`. Absent means false. */
|
|
1127
1130
|
compactBeforeLimit: import_zod3.z.boolean().optional(),
|
|
1128
|
-
/** The share of a quota window, in whole percent, at which sessions are compacted. Absent means the launcher decides from what compacting every session on the member would cost against what its
|
|
1131
|
+
/** The share of a quota window, in whole percent, at which sessions are compacted. Absent means the launcher decides from what compacting every session on the member would cost against what its tightest quota window has left. Needs `compactBeforeLimit`. */
|
|
1129
1132
|
compactAtUtilisation: CompactAtUtilisationSchema.optional()
|
|
1130
1133
|
}).refine((pool) => pool.compactBeforeLimit !== true || pool.resumeOnLimit === true, { message: "compactBeforeLimit needs resumeOnLimit, since a session that is not moved has no cold cache to avoid", path: ["compactBeforeLimit"] }).refine((pool) => pool.compactAtUtilisation === void 0 || pool.compactBeforeLimit === true, { message: "compactAtUtilisation needs compactBeforeLimit", path: ["compactAtUtilisation"] });
|
|
1131
1134
|
WEEKDAYS = ["mon", "tue", "wed", "thu", "fri", "sat", "sun"];
|
|
@@ -1228,6 +1231,8 @@ var init_schema = __esm({
|
|
|
1228
1231
|
IdentitySchema = import_zod3.z.strictObject({
|
|
1229
1232
|
$schema: import_zod3.z.string().optional(),
|
|
1230
1233
|
name: FileNameSchema,
|
|
1234
|
+
/** What the identity is for, in the person's words, drawn beside its name in `identity list` and `show`, the launch banner and the statusline. Display only: the name stays the key for lookup, paths, keychain service names and pools. */
|
|
1235
|
+
label: IdentityLabelSchema.optional(),
|
|
1231
1236
|
defaultConfigProfile: StoredNameSchema.optional(),
|
|
1232
1237
|
/** The provider this identity exists for: a launch on the identity routes through it unless `--provider`, `--no-provider` or a cascade layer's `launch.provider` says otherwise. Its sessions run on the provider's credential, so the identity needs no stored login. */
|
|
1233
1238
|
provider: StoredNameSchema.optional(),
|
|
@@ -1724,6 +1729,24 @@ function evaluateWhen(when, context) {
|
|
|
1724
1729
|
}
|
|
1725
1730
|
return { status: "definite", passed: failed.length === 0, checked, failed };
|
|
1726
1731
|
}
|
|
1732
|
+
function referencesFact(when, key) {
|
|
1733
|
+
if (when === void 0 || !("kind" in when)) {
|
|
1734
|
+
return false;
|
|
1735
|
+
}
|
|
1736
|
+
const walk2 = (node) => {
|
|
1737
|
+
if (Array.isArray(node)) {
|
|
1738
|
+
return node.some(walk2);
|
|
1739
|
+
}
|
|
1740
|
+
if (typeof node !== "object" || node === null) {
|
|
1741
|
+
return false;
|
|
1742
|
+
}
|
|
1743
|
+
if ("kind" in node && node.kind === "reference" && "key" in node && node.key === key) {
|
|
1744
|
+
return true;
|
|
1745
|
+
}
|
|
1746
|
+
return Object.values(node).some(walk2);
|
|
1747
|
+
};
|
|
1748
|
+
return walk2(when);
|
|
1749
|
+
}
|
|
1727
1750
|
function isVacuousWhen(when) {
|
|
1728
1751
|
return when !== void 0 && !("kind" in when) && Object.keys(when).length === 0;
|
|
1729
1752
|
}
|
|
@@ -4764,7 +4787,7 @@ var init_package = __esm({
|
|
|
4764
4787
|
"package.json"() {
|
|
4765
4788
|
package_default = {
|
|
4766
4789
|
name: "claude-use",
|
|
4767
|
-
version: "11.
|
|
4790
|
+
version: "11.82.0",
|
|
4768
4791
|
description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
|
|
4769
4792
|
license: "MIT",
|
|
4770
4793
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -7423,10 +7446,10 @@ function billedTokensOf(record) {
|
|
|
7423
7446
|
const usage = record.usage;
|
|
7424
7447
|
return (usage?.inputTokens ?? 0) + (usage?.cacheCreationInputTokens ?? 0) + (usage?.outputTokens ?? 0);
|
|
7425
7448
|
}
|
|
7426
|
-
function utilisationPerBilledToken(records) {
|
|
7449
|
+
function utilisationPerBilledToken(records, which) {
|
|
7427
7450
|
const points = [];
|
|
7428
7451
|
for (const record of records) {
|
|
7429
|
-
const window = record.rateLimitHeaders === void 0 ? void 0 : parseUnifiedRateLimit(record.rateLimitHeaders)?.
|
|
7452
|
+
const window = record.rateLimitHeaders === void 0 ? void 0 : parseUnifiedRateLimit(record.rateLimitHeaders)?.[which];
|
|
7430
7453
|
if (window?.utilization !== void 0 && window.resetsAt !== void 0) {
|
|
7431
7454
|
points.push({ resetsAt: window.resetsAt, utilization: window.utilization, billed: billedTokensOf(record) });
|
|
7432
7455
|
}
|
|
@@ -7611,14 +7634,17 @@ function rankPool(input) {
|
|
|
7611
7634
|
}
|
|
7612
7635
|
const { sticky: sticky2 } = input;
|
|
7613
7636
|
const warmHere = sticky2?.identity === candidate.identity && nowMs - Date.parse(sticky2.at) <= PROMPT_CACHE_TTL_MS;
|
|
7614
|
-
|
|
7615
|
-
|
|
7637
|
+
const resumeTokens = input.resumeContextTokens;
|
|
7638
|
+
if (input.resuming && resumeTokens !== void 0 && !warmHere) {
|
|
7616
7639
|
const committed = input.committedContextTokens?.[candidate.identity] ?? 0;
|
|
7617
|
-
const
|
|
7618
|
-
|
|
7619
|
-
|
|
7620
|
-
const
|
|
7621
|
-
|
|
7640
|
+
const alongside = committed === 0 ? "" : ` (with ${String(committed)} tokens of other conversations already moving here)`;
|
|
7641
|
+
for (const [name, label, window] of [["fiveHour", "5h", fiveHour], ["sevenDay", "7d", sevenDay]]) {
|
|
7642
|
+
const perToken = window === void 0 ? void 0 : utilisationPerBilledToken(assessment.member.records, name);
|
|
7643
|
+
const cost = perToken === void 0 ? void 0 : (resumeTokens + committed) * perToken;
|
|
7644
|
+
if (window !== void 0 && cost !== void 0 && cost > window.remaining) {
|
|
7645
|
+
dryAfterMs.push(0);
|
|
7646
|
+
drySpots.push(`resuming a ${String(resumeTokens)}-token conversation here${alongside} would cost about ${percent(cost)} of the ${label} window, which has ${percent(window.remaining)} left`);
|
|
7647
|
+
}
|
|
7622
7648
|
}
|
|
7623
7649
|
}
|
|
7624
7650
|
if (drySpots.length === 0) {
|
|
@@ -11594,9 +11620,15 @@ function movedRows(facts) {
|
|
|
11594
11620
|
}
|
|
11595
11621
|
return [];
|
|
11596
11622
|
}
|
|
11623
|
+
function identityText(facts) {
|
|
11624
|
+
if (facts.identity === void 0) {
|
|
11625
|
+
return "(none)";
|
|
11626
|
+
}
|
|
11627
|
+
return facts.identityLabel === void 0 ? facts.identity : `${facts.identity} (${facts.identityLabel})`;
|
|
11628
|
+
}
|
|
11597
11629
|
function decisionRows(facts) {
|
|
11598
11630
|
return [
|
|
11599
|
-
{ label: "identity", value: facts
|
|
11631
|
+
{ label: "identity", value: identityText(facts), detail: facts.identitySource },
|
|
11600
11632
|
...facts.pool === void 0 ? [] : [
|
|
11601
11633
|
{
|
|
11602
11634
|
label: "pool",
|
|
@@ -12122,6 +12154,7 @@ function decideLaunch(params, readOnly) {
|
|
|
12122
12154
|
return {
|
|
12123
12155
|
parsedArgv,
|
|
12124
12156
|
identityDecision,
|
|
12157
|
+
identityLabel: loadedIdentity?.config.label,
|
|
12125
12158
|
poolPick,
|
|
12126
12159
|
poolRanking,
|
|
12127
12160
|
lastRanAs,
|
|
@@ -12152,6 +12185,7 @@ function prepareLaunch(params) {
|
|
|
12152
12185
|
const rows = [
|
|
12153
12186
|
...decisionRows({
|
|
12154
12187
|
identity: identityDecision.name,
|
|
12188
|
+
identityLabel: decided.identityLabel,
|
|
12155
12189
|
identitySource: identityDecision.source,
|
|
12156
12190
|
pool: poolPick,
|
|
12157
12191
|
ranking: resolvedFlags.explain ? poolRanking : void 0,
|
|
@@ -17137,6 +17171,12 @@ function setIdentityProvider(paths, identityName, providerName) {
|
|
|
17137
17171
|
}
|
|
17138
17172
|
return applyPatch(identityJsonPath(paths, identityName), IdentitySchema, { provider: providerName });
|
|
17139
17173
|
}
|
|
17174
|
+
function setIdentityLabel(paths, identityName, label) {
|
|
17175
|
+
if (!identityExists(paths, identityName)) {
|
|
17176
|
+
throw new IdentityNotFoundError(identityName);
|
|
17177
|
+
}
|
|
17178
|
+
return applyPatch(identityJsonPath(paths, identityName), IdentitySchema, { label });
|
|
17179
|
+
}
|
|
17140
17180
|
function setAllowAmbientCredential(paths, identityName, allow) {
|
|
17141
17181
|
if (!identityExists(paths, identityName)) {
|
|
17142
17182
|
throw new IdentityNotFoundError(identityName);
|
|
@@ -17186,6 +17226,7 @@ var import_node_fs10 = __toESM(require("node:fs"), 1);
|
|
|
17186
17226
|
var import_node_path29 = __toESM(require("node:path"), 1);
|
|
17187
17227
|
init_signIn();
|
|
17188
17228
|
init_identityAccounts();
|
|
17229
|
+
init_read();
|
|
17189
17230
|
|
|
17190
17231
|
// src/codex/siwcStore.ts
|
|
17191
17232
|
var import_zod26 = require("zod");
|
|
@@ -17559,6 +17600,82 @@ function describeSharedLoginMembers(poolName, shared) {
|
|
|
17559
17600
|
return `Pool "${poolName}" lists ${joinNames(shared.members)}, which hold the same login${holder === void 0 ? "" : ` (${holder})`}, so they share one quota window. A launch ranks them as one candidate and never fails over from one to another; keep one of them in the pool.`;
|
|
17560
17601
|
}
|
|
17561
17602
|
|
|
17603
|
+
// src/poolWindowReads.ts
|
|
17604
|
+
init_schema();
|
|
17605
|
+
init_identity();
|
|
17606
|
+
init_conditions();
|
|
17607
|
+
init_middleware();
|
|
17608
|
+
init_rateLimit();
|
|
17609
|
+
var WINDOW_NAMES = ["fiveHour", "sevenDay", "extraUsage"];
|
|
17610
|
+
var WINDOW_PROSE = { fiveHour: "five-hour", sevenDay: "seven-day", extraUsage: "extra-usage" };
|
|
17611
|
+
var WINDOW_FACTS = ["remaining", "utilization", "hoursUntilReset"];
|
|
17612
|
+
var DERIVED_FACTS = [{ key: "quota.burnPerHour", window: "fiveHour" }];
|
|
17613
|
+
function receivedWindows(snapshot) {
|
|
17614
|
+
const unified = snapshot?.providers[ANTHROPIC_PROVIDER]?.rateLimit?.unified;
|
|
17615
|
+
if (unified === void 0) {
|
|
17616
|
+
return void 0;
|
|
17617
|
+
}
|
|
17618
|
+
return /* @__PURE__ */ new Set([...unified.fiveHour === void 0 ? [] : ["fiveHour"], ...unified.sevenDay === void 0 ? [] : ["sevenDay"], ...soleOverageWindow(unified) === void 0 ? [] : ["extraUsage"]]);
|
|
17619
|
+
}
|
|
17620
|
+
function conditionReads(when) {
|
|
17621
|
+
const direct = WINDOW_NAMES.flatMap((window) => WINDOW_FACTS.some((fact) => referencesFact(when, `quota.${window}.${fact}`)) ? [{ window, reference: `quota.${window}` }] : []);
|
|
17622
|
+
const derived = DERIVED_FACTS.flatMap(({ key, window }) => referencesFact(when, key) ? [{ window, reference: key }] : []);
|
|
17623
|
+
return [...direct, ...derived];
|
|
17624
|
+
}
|
|
17625
|
+
function identitiesOf(selector, pools, visited = /* @__PURE__ */ new Set()) {
|
|
17626
|
+
const nested = poolNameOf(selector);
|
|
17627
|
+
if (nested === void 0) {
|
|
17628
|
+
return [selector];
|
|
17629
|
+
}
|
|
17630
|
+
const pool = pools[nested];
|
|
17631
|
+
if (pool === void 0 || visited.has(nested)) {
|
|
17632
|
+
return [];
|
|
17633
|
+
}
|
|
17634
|
+
visited.add(nested);
|
|
17635
|
+
return [...new Set(pool.identities.flatMap((member) => identitiesOf(poolMemberIdentity(member), pools, visited)))];
|
|
17636
|
+
}
|
|
17637
|
+
function poolWindowReadFindings(pools, windowsOf) {
|
|
17638
|
+
const findings = [];
|
|
17639
|
+
for (const [poolName, pool] of Object.entries(pools)) {
|
|
17640
|
+
for (const member of pool.identities) {
|
|
17641
|
+
if (typeof member === "string") {
|
|
17642
|
+
continue;
|
|
17643
|
+
}
|
|
17644
|
+
const reads = conditionReads(member.when);
|
|
17645
|
+
for (const identity of identitiesOf(member.identity, pools)) {
|
|
17646
|
+
const received = windowsOf(identity);
|
|
17647
|
+
for (const { window, reference } of reads) {
|
|
17648
|
+
if (received !== void 0 && !received.has(window)) {
|
|
17649
|
+
findings.push({ subject: poolName, message: `Pool "${poolName}" guards ${member.identity} with a condition that reads ${reference}, but ${identity} reports no ${WINDOW_PROSE[window]} window, so the condition is undecided for it and it always ranks last within its class.` });
|
|
17650
|
+
}
|
|
17651
|
+
}
|
|
17652
|
+
}
|
|
17653
|
+
}
|
|
17654
|
+
if (pool.compactBeforeLimit === true) {
|
|
17655
|
+
for (const identity of identitiesOf(`pool:${poolName}`, pools)) {
|
|
17656
|
+
const received = windowsOf(identity);
|
|
17657
|
+
if (received !== void 0 && !received.has("fiveHour") && !received.has("sevenDay")) {
|
|
17658
|
+
findings.push({ subject: poolName, message: `Pool "${poolName}" compacts before the limit, but ${identity} reports no five-hour or seven-day window, so its sessions are never compacted before the limit.` });
|
|
17659
|
+
}
|
|
17660
|
+
}
|
|
17661
|
+
}
|
|
17662
|
+
}
|
|
17663
|
+
return findings;
|
|
17664
|
+
}
|
|
17665
|
+
function jobWindowReadFindings(jobs, pools, windowsOf) {
|
|
17666
|
+
return Object.entries(jobs).flatMap(([jobName, job]) => {
|
|
17667
|
+
const { trigger, target } = job;
|
|
17668
|
+
if (!("beforeReset" in trigger)) {
|
|
17669
|
+
return [];
|
|
17670
|
+
}
|
|
17671
|
+
const identities = "pool" in target ? identitiesOf(`pool:${target.pool}`, pools) : identitiesOf(target.identity, pools);
|
|
17672
|
+
return identities.flatMap((identity) => {
|
|
17673
|
+
const received = windowsOf(identity);
|
|
17674
|
+
return received === void 0 || received.has(trigger.beforeReset) ? [] : [{ subject: jobName, message: `Job "${jobName}" runs before the ${WINDOW_PROSE[trigger.beforeReset]} window resets, but ${identity} reports no ${WINDOW_PROSE[trigger.beforeReset]} window, so the job is skipped whenever it runs as ${identity}.` }];
|
|
17675
|
+
});
|
|
17676
|
+
});
|
|
17677
|
+
}
|
|
17678
|
+
|
|
17562
17679
|
// src/doctorReport.ts
|
|
17563
17680
|
init_extends();
|
|
17564
17681
|
var DOCTOR_SEVERITIES = ["pass", "warn", "fail"];
|
|
@@ -17927,6 +18044,17 @@ function runDoctor(params) {
|
|
|
17927
18044
|
reportedCycles.add(key);
|
|
17928
18045
|
push("pool", "fail", `Pool cycle: ${chain.join(" -> ")}. A pool cannot nest itself, directly or through another pool.`, chain[0]);
|
|
17929
18046
|
}
|
|
18047
|
+
const { usageSnapshots } = params;
|
|
18048
|
+
if (usageSnapshots !== void 0) {
|
|
18049
|
+
const windowsOf = (identityName) => receivedWindows(usageSnapshots[identityName]);
|
|
18050
|
+
for (const finding of poolWindowReadFindings(pools, windowsOf)) {
|
|
18051
|
+
push("pool", "warn", finding.message, finding.subject);
|
|
18052
|
+
}
|
|
18053
|
+
const jobs = validatedGlobalConfig?.ok === true ? validatedGlobalConfig.data.jobs ?? {} : {};
|
|
18054
|
+
for (const finding of jobWindowReadFindings(jobs, pools, windowsOf)) {
|
|
18055
|
+
push("global-config", "warn", finding.message, finding.subject);
|
|
18056
|
+
}
|
|
18057
|
+
}
|
|
17930
18058
|
const selectionExists = (selector) => {
|
|
17931
18059
|
const poolName = poolNameOf(selector);
|
|
17932
18060
|
return poolName === void 0 ? validIdentityNames.has(selector) : poolName in pools;
|
|
@@ -18185,6 +18313,19 @@ function collectDoctorReport(params) {
|
|
|
18185
18313
|
const identityPath = import_node_path29.default.join(farmRoot, "identity.json");
|
|
18186
18314
|
return { name, path: identityPath, raw: realFsPort.readFileUtf8(identityPath), farmRoot, credentialsFilePresent: import_node_fs10.default.existsSync(credentialsFilePath(farmRoot)), account: readIdentityAccount(realFsPort, paths.identitiesDir, name)?.account };
|
|
18187
18315
|
});
|
|
18316
|
+
const usageSnapshots = {};
|
|
18317
|
+
for (const name of identityNames) {
|
|
18318
|
+
try {
|
|
18319
|
+
const snapshot = readUsageSnapshot(realFsPort, paths.usageSnapshotsDir, name);
|
|
18320
|
+
if (snapshot !== void 0) {
|
|
18321
|
+
usageSnapshots[name] = snapshot;
|
|
18322
|
+
}
|
|
18323
|
+
} catch (error) {
|
|
18324
|
+
if (!(error instanceof UsageSnapshotError)) {
|
|
18325
|
+
throw error;
|
|
18326
|
+
}
|
|
18327
|
+
}
|
|
18328
|
+
}
|
|
18188
18329
|
const profileNames = import_node_fs10.default.existsSync(paths.configProfilesDir) ? import_node_fs10.default.readdirSync(paths.configProfilesDir, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".json")).map((entry) => entry.name.slice(0, -".json".length)).sort() : [];
|
|
18189
18330
|
const configProfiles = profileNames.map((name) => {
|
|
18190
18331
|
const profilePath = import_node_path29.default.join(paths.configProfilesDir, `${name}.json`);
|
|
@@ -18228,6 +18369,7 @@ function collectDoctorReport(params) {
|
|
|
18228
18369
|
chatgptSignIn: { path: paths.chatgptSignInFile, raw: realFsPort.readFileUtf8(paths.chatgptSignInFile) },
|
|
18229
18370
|
installedClaudeVersions: realInstalledClaudeVersions(),
|
|
18230
18371
|
identities,
|
|
18372
|
+
usageSnapshots,
|
|
18231
18373
|
configProfiles,
|
|
18232
18374
|
providers,
|
|
18233
18375
|
providerAliases: readProviderAliases(paths),
|
|
@@ -18531,6 +18673,7 @@ init_providersStore();
|
|
|
18531
18673
|
// src/frontdoor/configSchemas.ts
|
|
18532
18674
|
var import_zod30 = require("zod");
|
|
18533
18675
|
init_schema();
|
|
18676
|
+
init_names();
|
|
18534
18677
|
init_statusline();
|
|
18535
18678
|
var RemovalConfirmationSchema = import_zod30.z.boolean();
|
|
18536
18679
|
var CredentialWriteSchema = (targets) => import_zod30.z.strictObject({
|
|
@@ -18556,6 +18699,7 @@ var mutationOutput = (kind, action) => import_zod30.z.strictObject({ action: imp
|
|
|
18556
18699
|
var storedMutationOutput = (kind, action, value) => import_zod30.z.strictObject({ action: import_zod30.z.literal(action), kind: import_zod30.z.literal(kind), name: import_zod30.z.string(), value });
|
|
18557
18700
|
var IdentityValueSchema = import_zod30.z.strictObject({
|
|
18558
18701
|
name: import_zod30.z.string(),
|
|
18702
|
+
label: import_zod30.z.string().optional(),
|
|
18559
18703
|
defaultConfigProfile: import_zod30.z.string().optional(),
|
|
18560
18704
|
provider: import_zod30.z.string().optional(),
|
|
18561
18705
|
allowAmbientCredential: import_zod30.z.boolean(),
|
|
@@ -18576,6 +18720,8 @@ var ConfigNameInputSchema = import_zod30.z.strictObject({ name: import_zod30.z.s
|
|
|
18576
18720
|
var ConfigIdentityAddOutputSchema = storedMutationOutput("identity", "created", IdentityValueSchema);
|
|
18577
18721
|
var ConfigIdentitySetInputSchema = import_zod30.z.strictObject({
|
|
18578
18722
|
name: import_zod30.z.string().min(1),
|
|
18723
|
+
/** The identity's display label; `false` clears it. */
|
|
18724
|
+
label: import_zod30.z.union([IdentityLabelSchema, import_zod30.z.literal(false)]).optional(),
|
|
18579
18725
|
defaultConfigProfile: import_zod30.z.union([import_zod30.z.string().min(1), import_zod30.z.literal(false)]).optional(),
|
|
18580
18726
|
/** The provider the identity exists for; `false` clears it. */
|
|
18581
18727
|
provider: import_zod30.z.union([import_zod30.z.string().min(1), import_zod30.z.literal(false)]).optional(),
|
|
@@ -18722,6 +18868,7 @@ function identityValue(name, paths) {
|
|
|
18722
18868
|
}
|
|
18723
18869
|
return {
|
|
18724
18870
|
name: identity.name,
|
|
18871
|
+
...identity.label === void 0 ? {} : { label: identity.label },
|
|
18725
18872
|
...identity.defaultConfigProfile === void 0 ? {} : { defaultConfigProfile: identity.defaultConfigProfile },
|
|
18726
18873
|
...identity.provider === void 0 ? {} : { provider: identity.provider },
|
|
18727
18874
|
allowAmbientCredential: identity.allowAmbientCredential,
|
|
@@ -18756,9 +18903,9 @@ function createConfigApiRouter(deps) {
|
|
|
18756
18903
|
return { action: "created", kind: "identity", name: input.name, value: identityValue(input.name, paths) };
|
|
18757
18904
|
})
|
|
18758
18905
|
),
|
|
18759
|
-
set: route("/rest/config/identity/set", "Update an identity's default profile, provider, ambient-credential setting, credential or anchors").input(ConfigIdentitySetInputSchema).output(ConfigIdentitySetOutputSchema).handler(
|
|
18906
|
+
set: route("/rest/config/identity/set", "Update an identity's label, default profile, provider, ambient-credential setting, credential or anchors").input(ConfigIdentitySetInputSchema).output(ConfigIdentitySetOutputSchema).handler(
|
|
18760
18907
|
({ input }) => guarded(() => {
|
|
18761
|
-
requireChange(input.defaultConfigProfile !== void 0 || input.provider !== void 0 || input.allowAmbientCredential !== void 0 || input.credential !== void 0 || input.anchors !== void 0, "defaultConfigProfile, provider, allowAmbientCredential, credential or anchors");
|
|
18908
|
+
requireChange(input.label !== void 0 || input.defaultConfigProfile !== void 0 || input.provider !== void 0 || input.allowAmbientCredential !== void 0 || input.credential !== void 0 || input.anchors !== void 0, "label, defaultConfigProfile, provider, allowAmbientCredential, credential or anchors");
|
|
18762
18909
|
if (!identityExists(paths, input.name)) {
|
|
18763
18910
|
throw new IdentityNotFoundError(input.name);
|
|
18764
18911
|
}
|
|
@@ -18768,6 +18915,9 @@ function createConfigApiRouter(deps) {
|
|
|
18768
18915
|
if (typeof input.provider === "string") {
|
|
18769
18916
|
requireProviderExists(paths, input.provider);
|
|
18770
18917
|
}
|
|
18918
|
+
if (input.label !== void 0) {
|
|
18919
|
+
setIdentityLabel(paths, input.name, input.label === false ? void 0 : input.label);
|
|
18920
|
+
}
|
|
18771
18921
|
if (input.defaultConfigProfile !== void 0) {
|
|
18772
18922
|
setDefaultConfigProfile(paths, input.name, input.defaultConfigProfile === false ? void 0 : input.defaultConfigProfile);
|
|
18773
18923
|
}
|