@norman-else/dsh-claude 0.1.4 → 0.1.6

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/lib/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { a as latestClaudeTasks, b as isClaudePresetId, c as normalizeTasksEvent, d as CLAUDE_ACTIVITY_EVENT, f as CLAUDE_CODE_PRESET_ID, g as CLAUDE_PROJECTION_PATH, h as CLAUDE_DOCTOR_PATH, i as latestClaudeSessionBinding, l as redactText, m as CLAUDE_CODE_PROVIDER_IDS, n as currentClaudeActivityCursor, o as normalizeActivity, p as CLAUDE_CODE_PROVIDER, r as latestClaudeContextUsage, s as normalizeContextUsage, t as boundText, u as safeDetail, y as TASK_TOOL_NAMES } from "./events-qlmU1KrH.mjs";
2
- import { a as ClaudeCommandBridge, i as CLAUDE_COMMANDS_SERVICE, r as dynamicPresenterDefinition, t as CLAUDE_PRESENTER_NAMES } from "./presenters-DbfG-9KQ.mjs";
3
- import { a as resolveClaudeExecutable, o as runClaudeDoctor, r as removeManagedPreset, t as ManagedPresetConflictError } from "./preset-installer-D8q3_-wJ.mjs";
1
+ import { a as latestClaudeTasks, c as normalizeTasksEvent, d as CLAUDE_ACTIVITY_EVENT, f as CLAUDE_CODE_PRESET_ID, g as CLAUDE_PROJECTION_PATH, h as CLAUDE_DOCTOR_PATH, i as latestClaudeSessionBinding, l as redactText, m as CLAUDE_CODE_PROVIDER_IDS, n as currentClaudeActivityCursor, o as normalizeActivity, p as CLAUDE_CODE_PROVIDER, r as latestClaudeContextUsage, s as normalizeContextUsage, t as boundText, u as safeDetail, v as TASK_TOOL_NAMES } from "./events-DP0Ov_Re.mjs";
2
+ import { a as ClaudeCommandBridge, i as CLAUDE_COMMANDS_SERVICE, r as dynamicPresenterDefinition, t as CLAUDE_PRESENTER_NAMES } from "./presenters-YMR2WMjn.mjs";
3
+ import { a as resolveClaudeExecutable, n as ensureManagedPreset, o as runClaudeDoctor, t as ManagedPresetConflictError } from "./preset-installer-BKw-SdOm.mjs";
4
4
  import z from "@deepseek-ai/schemastery";
5
5
  import { CallId, LlmAdapter, ReasoningEffortId, createToolResultMessage, createUserMessage } from "@deepseek-ai/dsh-llm";
6
6
  import { randomUUID } from "node:crypto";
@@ -357,21 +357,24 @@ function createPermissionBridge(approval, activeContext) {
357
357
  summary: options.title ?? options.description ?? reason,
358
358
  detail: input
359
359
  });
360
- const outcome = await approval.request({
360
+ const alreadyFullAccess = await active.hasFullAccess?.() === true;
361
+ const outcome = alreadyFullAccess ? "allowed-once" : await approval.request({
361
362
  agent: active.agent,
362
363
  toolName,
363
364
  reason,
364
365
  signal: options.signal
365
366
  });
366
- const result = mapApprovalOutcome(outcome, input, options.toolUseID);
367
+ const fullAccess = alreadyFullAccess || await active.hasFullAccess?.() === true;
368
+ const effectiveOutcome = fullAccess ? "allowed-once" : outcome;
369
+ const result = mapApprovalOutcome(effectiveOutcome, input, options.toolUseID);
367
370
  if (result.behavior === "deny") active.recordDenial?.(options.toolUseID);
368
371
  await active.appendActivity({
369
372
  kind: "permission",
370
- phase: outcome === "allowed-once" ? "completed" : "denied",
373
+ phase: effectiveOutcome === "allowed-once" ? "completed" : "denied",
371
374
  toolUseId: options.toolUseID,
372
375
  toolName,
373
376
  title: options.displayName ?? toolName,
374
- summary: outcome === "allowed-once" ? "Allowed once in DeepSeek Harness" : denialMessage(outcome)
377
+ summary: fullAccess ? "Allowed by Full access in DeepSeek Harness" : effectiveOutcome === "allowed-once" ? "Allowed once in DeepSeek Harness" : denialMessage(effectiveOutcome)
375
378
  });
376
379
  return result;
377
380
  } catch (error) {
@@ -1162,6 +1165,10 @@ var ClaudeSupervisor = class {
1162
1165
  recordDenial: (toolUseId) => {
1163
1166
  active.deniedToolUseIds.add(toolUseId);
1164
1167
  },
1168
+ hasFullAccess: async () => {
1169
+ await this.#syncPermissionMode(entry);
1170
+ return entry.permissionMode === "bypassPermissions";
1171
+ },
1165
1172
  appendActivity: (activity) => this.#appendActivity(active, activity)
1166
1173
  };
1167
1174
  });
@@ -1347,6 +1354,12 @@ var ClaudeSupervisor = class {
1347
1354
  title: message.toolName,
1348
1355
  summary: message.summary
1349
1356
  });
1357
+ if (!TASK_TOOL_NAMES.has(active.callNames.get(message.toolUseId) ?? message.toolName)) await this.#appendNativeToolResult(active, {
1358
+ kind: "tool-result",
1359
+ toolUseId: message.toolUseId,
1360
+ output: message.summary,
1361
+ isError: true
1362
+ });
1350
1363
  return;
1351
1364
  }
1352
1365
  }
@@ -1774,9 +1787,9 @@ var ClaudeCodeAdapter = class extends LlmAdapter {
1774
1787
  providerRetryPolicy() {
1775
1788
  return NO_RETRY_POLICY;
1776
1789
  }
1777
- async listModels() {
1790
+ async listModels(provider) {
1778
1791
  return MODELS.map((model) => ({
1779
- provider: CLAUDE_CODE_PROVIDER,
1792
+ provider,
1780
1793
  id: model.id,
1781
1794
  name: model.name,
1782
1795
  description: model.description,
@@ -1803,7 +1816,7 @@ var ClaudeCodeAdapter = class extends LlmAdapter {
1803
1816
  async *stream(options) {
1804
1817
  if (options.purpose !== void 0) throw new Error(`dsh-claude: auxiliary ${options.purpose} calls are not routed into the Claude session`);
1805
1818
  const agent = resolveAgent(this.#agents, options);
1806
- if (!isClaudePresetId(this.#presetIdFor(agent))) throw new Error(`dsh-claude: provider ${CLAUDE_CODE_PROVIDER} is available only to the ${CLAUDE_CODE_PRESET_ID} preset`);
1819
+ if (this.#presetIdFor(agent) !== "claude") throw new Error(`dsh-claude: provider ${CLAUDE_CODE_PROVIDER} is available only to the ${CLAUDE_CODE_PRESET_ID} preset`);
1807
1820
  const thinkingMode = thinkingModeFor(options.reasoningEffort);
1808
1821
  const prompt = extractDirectUserText(options.messages);
1809
1822
  const events = await this.#supervisor.runTurn({
@@ -2082,7 +2095,7 @@ const SCOPE_RETRY_MS = 500;
2082
2095
  const MAX_CATALOG_RETRIES = 3;
2083
2096
  const MAX_SCOPE_RETRIES = 24;
2084
2097
  function mountClaudeMetadata(ctx, supervisor, agent, model, sidecar, resolveCommands = () => ctx.agentPresets.serviceFor(agent, CLAUDE_COMMANDS_SERVICE)) {
2085
- if (!isClaudePresetId(ctx.agentPresets.composedPreset(agent.ctx))) return void 0;
2098
+ if (ctx.agentPresets.composedPreset(agent.ctx) !== "claude") return void 0;
2086
2099
  let stopped = false;
2087
2100
  let pending = Promise.resolve();
2088
2101
  let commandScope;
@@ -2179,13 +2192,17 @@ function mountClaudeMetadata(ctx, supervisor, agent, model, sidecar, resolveComm
2179
2192
  };
2180
2193
  }, "dsh-claude: agent metadata bridge");
2181
2194
  }
2182
- async function apply(ctx, config) {
2195
+ async function installManagedPresetCompatibility(logger, install = ensureManagedPreset) {
2183
2196
  try {
2184
- await removeManagedPreset();
2197
+ return await install();
2185
2198
  } catch (error) {
2186
2199
  if (!(error instanceof ManagedPresetConflictError)) throw error;
2187
- ctx.logger.warn(`dsh-claude: preserving user-modified legacy preset at ${error.path}`);
2200
+ logger.warn(`dsh-claude: preserving user-modified preset at ${error.path}`);
2201
+ return "conflict";
2188
2202
  }
2203
+ }
2204
+ async function apply(ctx, config) {
2205
+ await installManagedPresetCompatibility(ctx.logger);
2189
2206
  const supervisorConfig = {
2190
2207
  executablePath: "",
2191
2208
  defaultModel: config.model ?? "default",
@@ -2243,7 +2260,7 @@ async function apply(ctx, config) {
2243
2260
  });
2244
2261
  const onPresetSelected = ctx.on;
2245
2262
  const stopSelected = onPresetSelected("agent-preset/selected", (sessionId, preset) => {
2246
- if (!isClaudePresetId(preset)) return;
2263
+ if (preset !== "claude") return;
2247
2264
  const agent = ctx.agents.get(sessionId);
2248
2265
  if (agent !== void 0) mountWhenPresetSettles(agent);
2249
2266
  });
@@ -2267,11 +2284,11 @@ async function apply(ctx, config) {
2267
2284
  registerClaudeDoctorRoutes(webCtx, webCtx.subprocess, supervisor, supervisorConfig, resolutionError);
2268
2285
  registerClaudeProjectionRoute(webCtx, sidecar, (sessionId) => {
2269
2286
  const agent = webCtx.agents.get(sessionId);
2270
- return agent !== void 0 && isClaudePresetId(webCtx.agentPresets.composedPreset(agent.ctx));
2287
+ return agent !== void 0 && webCtx.agentPresets.composedPreset(agent.ctx) === "claude";
2271
2288
  });
2272
2289
  });
2273
2290
  }
2274
2291
  //#endregion
2275
- export { Config, apply, inject, mountClaudeMetadata, name };
2292
+ export { Config, apply, inject, installManagedPresetCompatibility, mountClaudeMetadata, name };
2276
2293
 
2277
2294
  //# sourceMappingURL=index.mjs.map