claude-code-rust 0.14.3 → 0.14.5

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.
@@ -11,12 +11,20 @@ function isEffortLevel(value) {
11
11
  function normalizeModelKey(id) {
12
12
  const original = id.trim();
13
13
  if (!original) {
14
- return { original, family: "unknown", versionParts: [], variantParts: [], buildParts: [] };
14
+ return {
15
+ original,
16
+ family: "unknown",
17
+ versionParts: [],
18
+ variantParts: [],
19
+ buildParts: [],
20
+ };
15
21
  }
16
22
  const lower = original.toLowerCase();
17
23
  const contextMatch = lower.match(/\[([^[\]]+)\]$/);
18
24
  const contextSuffix = contextMatch?.[1];
19
- const withoutContext = contextMatch ? lower.slice(0, contextMatch.index) : lower;
25
+ const withoutContext = contextMatch
26
+ ? lower.slice(0, contextMatch.index)
27
+ : lower;
20
28
  const withoutPrefix = withoutContext.startsWith("claude-")
21
29
  ? withoutContext.slice("claude-".length)
22
30
  : withoutContext;
@@ -82,7 +90,8 @@ function modelKeysAreCompatible(leftId, rightId) {
82
90
  function sameContextSuffix(leftId, rightId) {
83
91
  const left = normalizeModelKey(leftId);
84
92
  const right = normalizeModelKey(rightId);
85
- return (left.contextSuffix?.toLowerCase() ?? "") === (right.contextSuffix?.toLowerCase() ?? "");
93
+ return ((left.contextSuffix?.toLowerCase() ?? "") ===
94
+ (right.contextSuffix?.toLowerCase() ?? ""));
86
95
  }
87
96
  function sameFamilyAndVersion(leftId, rightId) {
88
97
  const left = normalizeModelKey(leftId);
@@ -129,7 +138,9 @@ function humanizeModelId(id) {
129
138
  : normalized.family === "sonnet"
130
139
  ? "Sonnet"
131
140
  : "Haiku";
132
- const versionLabel = normalized.versionParts.length > 0 ? ` ${normalized.versionParts.join(".")}` : "";
141
+ const versionLabel = normalized.versionParts.length > 0
142
+ ? ` ${normalized.versionParts.join(".")}`
143
+ : "";
133
144
  const contextLabel = normalized.contextSuffix?.toLowerCase() === "1m"
134
145
  ? " [1M]"
135
146
  : normalized.contextSuffix
@@ -181,7 +192,8 @@ export function mapAvailableModels(models) {
181
192
  })
182
193
  .map((entry) => ({
183
194
  id: entry.value,
184
- ...(typeof entry.resolvedModel === "string" && entry.resolvedModel.trim().length > 0
195
+ ...(typeof entry.resolvedModel === "string" &&
196
+ entry.resolvedModel.trim().length > 0
185
197
  ? { resolved_model: entry.resolvedModel.trim() }
186
198
  : {}),
187
199
  display_name: entry.displayName,
@@ -198,7 +210,8 @@ export function mapAvailableModels(models) {
198
210
  ...(typeof entry.supportsAutoMode === "boolean"
199
211
  ? { supports_auto_mode: entry.supportsAutoMode }
200
212
  : {}),
201
- ...(typeof entry.description === "string" && entry.description.trim().length > 0
213
+ ...(typeof entry.description === "string" &&
214
+ entry.description.trim().length > 0
202
215
  ? { description: entry.description }
203
216
  : {}),
204
217
  }));
@@ -1,7 +1,13 @@
1
1
  const SESSION_PERMISSION_DESTINATIONS = new Set(["session", "cliArg"]);
2
- const PERSISTENT_PERMISSION_DESTINATIONS = new Set(["userSettings", "projectSettings", "localSettings"]);
2
+ const PERSISTENT_PERMISSION_DESTINATIONS = new Set([
3
+ "userSettings",
4
+ "projectSettings",
5
+ "localSettings",
6
+ ]);
3
7
  function formatPermissionRule(rule) {
4
- return rule.ruleContent === undefined ? rule.toolName : `${rule.toolName}(${rule.ruleContent})`;
8
+ return rule.ruleContent === undefined
9
+ ? rule.toolName
10
+ : `${rule.toolName}(${rule.ruleContent})`;
5
11
  }
6
12
  export function formatPermissionUpdates(updates) {
7
13
  if (!updates || updates.length === 0) {
@@ -9,8 +15,12 @@ export function formatPermissionUpdates(updates) {
9
15
  }
10
16
  return updates
11
17
  .map((update) => {
12
- if (update.type === "addRules" || update.type === "replaceRules" || update.type === "removeRules") {
13
- const rules = update.rules.map((rule) => formatPermissionRule(rule)).join(", ");
18
+ if (update.type === "addRules" ||
19
+ update.type === "replaceRules" ||
20
+ update.type === "removeRules") {
21
+ const rules = update.rules
22
+ .map((rule) => formatPermissionRule(rule))
23
+ .join(", ");
14
24
  return `${update.type}:${update.behavior}:${update.destination}=[${rules}]`;
15
25
  }
16
26
  if (update.type === "setMode") {
@@ -44,7 +54,9 @@ export function permissionOptionsFromSuggestions(suggestions) {
44
54
  const hasSessionScoped = scoped.session.length > 0;
45
55
  const hasPersistentScoped = scoped.persistent.length > 0;
46
56
  const sessionOnly = hasSessionScoped && !hasPersistentScoped;
47
- const options = [{ option_id: "allow_once", name: "Allow once", kind: "allow_once" }];
57
+ const options = [
58
+ { option_id: "allow_once", name: "Allow once", kind: "allow_once" },
59
+ ];
48
60
  options.push({
49
61
  option_id: sessionOnly ? "allow_session" : "allow_always",
50
62
  name: sessionOnly ? "Allow for session" : "Always allow",
@@ -57,7 +69,11 @@ export function permissionResultFromOutcome(outcome, toolCallId, inputData, sugg
57
69
  const scopedSuggestions = splitPermissionSuggestionsByScope(suggestions);
58
70
  if (outcome.outcome === "selected") {
59
71
  if (outcome.option_id === "allow_once") {
60
- return { behavior: "allow", updatedInput: inputData, toolUseID: toolCallId };
72
+ return {
73
+ behavior: "allow",
74
+ updatedInput: inputData,
75
+ toolUseID: toolCallId,
76
+ };
61
77
  }
62
78
  if (outcome.option_id === "allow_session") {
63
79
  const sessionSuggestions = scopedSuggestions.session;
@@ -105,7 +121,15 @@ export function permissionResultFromOutcome(outcome, toolCallId, inputData, sugg
105
121
  toolUseID: toolCallId,
106
122
  };
107
123
  }
108
- return { behavior: "deny", message: "Permission denied", toolUseID: toolCallId };
124
+ return {
125
+ behavior: "deny",
126
+ message: "Permission denied",
127
+ toolUseID: toolCallId,
128
+ };
109
129
  }
110
- return { behavior: "deny", message: "Permission cancelled", toolUseID: toolCallId };
130
+ return {
131
+ behavior: "deny",
132
+ message: "Permission cancelled",
133
+ toolUseID: toolCallId,
134
+ };
111
135
  }