@ycodium-ai/agent-claude 0.2.3112 → 0.2.3116

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.
Files changed (2) hide show
  1. package/dist/index.js +50 -11
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -22771,27 +22771,56 @@ function assertSteeringTarget(expectedTurnId, turnState) {
22771
22771
  }
22772
22772
 
22773
22773
  // src/hostMcpAllowRules.ts
22774
+ import { setsOwnModelConnection } from "@ycodium-ai/plugin-api/executor";
22774
22775
  function claudeHostMcpAllowRules(servers) {
22775
22776
  return (servers ?? []).filter((server) => server.hostOwned === true).map((server) => `mcp__${server.name}`);
22776
22777
  }
22777
- function claudePermissionAllow(rules, mode) {
22778
- return mode === "auto" ? [...rules.read, ...rules.hostMcp] : rules.read;
22778
+ function claudeUsesOfficialChannel(env2) {
22779
+ const connectivity = CLAUDE_CARD.modelConnectivity;
22780
+ const rows = Object.entries(env2).map(([name, value]) => ({ name, value }));
22781
+ if (setsOwnModelConnection({ backendSwitchEnvKeys: connectivity?.backendSwitchEnvKeys }, rows))
22782
+ return false;
22783
+ const key = connectivity?.baseUrlEnvKey;
22784
+ const baseUrl = key === void 0 ? void 0 : env2[key]?.trim();
22785
+ if (baseUrl === void 0 || baseUrl === "") return true;
22786
+ try {
22787
+ const host = new URL(baseUrl).hostname.toLowerCase();
22788
+ return host === "anthropic.com" || host.endsWith(".anthropic.com");
22789
+ } catch {
22790
+ return false;
22791
+ }
22792
+ }
22793
+ var ALLOWLIST_MODE_TOOLS = [
22794
+ "Read",
22795
+ "Glob",
22796
+ "Grep",
22797
+ "Edit",
22798
+ "MultiEdit",
22799
+ "Write",
22800
+ "NotebookEdit",
22801
+ "Bash"
22802
+ ];
22803
+ function claudeSdkPermission(rules, mode) {
22804
+ if (mode !== "auto") return { mode, allow: rules.read };
22805
+ if (rules.officialChannel) return { mode, allow: [...rules.read, ...rules.hostMcp] };
22806
+ return { mode: "dontAsk", allow: [...rules.read, ...rules.hostMcp, ...ALLOWLIST_MODE_TOOLS] };
22779
22807
  }
22780
22808
 
22781
22809
  // src/adapter/permissionMode.ts
22782
22810
  var sameRules = (a, b3) => a.join("\n") === b3.join("\n");
22783
22811
  var permissionAllowInSync = (context) => sameRules(
22784
- claudePermissionAllow(context.permissionRules, context.currentPermissionMode),
22812
+ claudeSdkPermission(context.permissionRules, context.currentPermissionMode ?? "default").allow,
22785
22813
  context.currentPermissionAllow
22786
22814
  );
22787
22815
  async function applyClaudePermissionMode(context, mode, failAs) {
22816
+ const sdk = claudeSdkPermission(context.permissionRules, mode);
22788
22817
  try {
22789
- await context.query.setPermissionMode(mode);
22818
+ await context.query.setPermissionMode(sdk.mode);
22790
22819
  } catch (cause) {
22791
22820
  throw toRequestError(failAs.threadId, failAs.method, cause);
22792
22821
  }
22793
22822
  context.currentPermissionMode = mode;
22794
- const allow = claudePermissionAllow(context.permissionRules, mode);
22823
+ const allow = sdk.allow;
22795
22824
  if (sameRules(allow, context.currentPermissionAllow)) return;
22796
22825
  try {
22797
22826
  await context.query.applyFlagSettings({
@@ -23983,9 +24012,19 @@ var makeStartSession = (deps) => {
23983
24012
  const querySettings = { ...settings };
23984
24013
  const permissionRules = {
23985
24014
  read: claudeReadAllowRules(input.readOnlyDirectories),
23986
- hostMcp: claudeHostMcpAllowRules(input.mcpServers)
24015
+ hostMcp: claudeHostMcpAllowRules(input.mcpServers),
24016
+ officialChannel: claudeUsesOfficialChannel(spawnEnvironment.processEnv)
23987
24017
  };
23988
- const permissionAllow = claudePermissionAllow(permissionRules, permissionMode);
24018
+ const sdkPermission = claudeSdkPermission(permissionRules, permissionMode);
24019
+ const permissionAllow = sdkPermission.allow;
24020
+ if (sdkPermission.mode !== permissionMode) {
24021
+ log.warn("claude.permission.allowlistMode", {
24022
+ threadId: input.threadId,
24023
+ seatMode: permissionMode,
24024
+ sdkMode: sdkPermission.mode,
24025
+ reason: "model requests do not use the official channel; the auto-mode classifier is unavailable"
24026
+ });
24027
+ }
23989
24028
  if (permissionAllow.length > 0) {
23990
24029
  querySettings.permissions = { allow: [...permissionAllow] };
23991
24030
  }
@@ -24006,7 +24045,7 @@ var makeStartSession = (deps) => {
24006
24045
  ...effectiveEffort ? {
24007
24046
  effort: effectiveEffort
24008
24047
  } : {},
24009
- ...permissionMode ? { permissionMode } : {},
24048
+ permissionMode: sdkPermission.mode,
24010
24049
  ...permissionMode === "bypassPermissions" ? { allowDangerouslySkipPermissions: true } : {},
24011
24050
  ...Object.keys(querySettings).length > 0 ? { settings: querySettings } : {},
24012
24051
  ...existingResumeSessionId ? { resume: existingResumeSessionId } : {},
@@ -27055,7 +27094,7 @@ import * as NodePath15 from "node:path";
27055
27094
  // src/usageRead/quota.ts
27056
27095
  import * as NodeFS4 from "node:fs";
27057
27096
  import * as NodePath12 from "node:path";
27058
- import { mergeLaunchEnv as mergeLaunchEnv2, setsOwnModelConnection } from "@ycodium-ai/plugin-api/executor";
27097
+ import { mergeLaunchEnv as mergeLaunchEnv2, setsOwnModelConnection as setsOwnModelConnection2 } from "@ycodium-ai/plugin-api/executor";
27059
27098
  import {
27060
27099
  parseRetryAfterMs
27061
27100
  } from "@ycodium-ai/plugin-api/usage";
@@ -27151,8 +27190,8 @@ var readClaudeQuota = async (request) => {
27151
27190
  name,
27152
27191
  value
27153
27192
  }));
27154
- if (connectivity !== void 0 && setsOwnModelConnection(connectivity, environmentRows)) {
27155
- const changesEndpoint = setsOwnModelConnection(
27193
+ if (connectivity !== void 0 && setsOwnModelConnection2(connectivity, environmentRows)) {
27194
+ const changesEndpoint = setsOwnModelConnection2(
27156
27195
  {
27157
27196
  baseUrlEnvKey: connectivity.baseUrlEnvKey,
27158
27197
  backendSwitchEnvKeys: connectivity.backendSwitchEnvKeys
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/agent-claude",
3
- "version": "0.2.3112",
3
+ "version": "0.2.3116",
4
4
  "description": "Claude executor: Claude Code CLI via @anthropic-ai/claude-agent-sdk.",
5
5
  "keywords": [
6
6
  "ycodium",
@@ -24,10 +24,10 @@
24
24
  "@types/node": "24.12.4",
25
25
  "esbuild": "0.28.1",
26
26
  "vite-plus": "0.2.2",
27
- "@ycodium-ai/plugin-api": "0.2.3112",
27
+ "@ycodium-ai/plugin-api": "0.2.3116",
28
28
  "ycodium-composer-tokens": "0.0.0",
29
- "ycodium-jsonl-stream": "0.0.0",
30
- "ycodium-executor-testing": "0.0.0"
29
+ "ycodium-executor-testing": "0.0.0",
30
+ "ycodium-jsonl-stream": "0.0.0"
31
31
  },
32
32
  "ycodium": {
33
33
  "plugin": "./dist/index.js",