Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@
"check:compat-boundary-imports": "node config/scripts/check-compat-boundary-imports.mjs"
},
"dependencies": {
"@anthropic-ai/claude-agent-sdk": "0.3.284",
"@anthropic-ai/claude-agent-sdk": "0.3.302",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

rg -n "permission-mode|permissionMode|pre-SDK|dangerously-skip-permissions" src tests --glob '!**/node_modules/**' | head -80
rg -n "produces a matching CLI flag for every pre-SDK argv entry" -r '' src tests
rg -n "permission-mode|permissionMode" node_modules/@anthropic-ai/claude-agent-sdk/*.mjs 2>/dev/null | head -20

Repository: stablyai/orca

Length of output: 45657


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- target test locations ---'
rg -n -F -- 'produces a matching CLI flag for every pre-SDK argv entry' . --glob '!node_modules/**' --glob '!dist/**' --glob '!build/**' || test "$?" -eq 1
printf '%s\n' '--- relevant source hits ---'
rg -n -F --glob '*.{ts,tsx,js,cjs,mjs}' -e 'permissionMode' -e 'pre-SDK' -e 'dangerously-skip-permissions' -e 'claude-agent-sdk' src tests test 2>/dev/null | rg 'claude|Claude|permission|pre-SDK|argv|SDK' | head -240 || true
printf '%s\n' '--- changed files and package diff ---'
git diff --stat 30f5bef947471007efe3b24fd9026c9e94ae1f21 7a6682d86bf3074c2440cfcf54edb8dcb0a32b38
git diff --unified=20 30f5bef947471007efe3b24fd9026c9e94ae1f21 7a6682d86bf3074c2440cfcf54edb8dcb0a32b38 -- package.json pnpm-lock.yaml src/main/claude tests
printf '%s\n' '--- package and installed SDK metadata ---'
sed -n '180,198p' package.json
if test -f node_modules/@anthropic-ai/claude-agent-sdk/package.json; then
  rg -n -F -e '"version"' -e '0.3.' node_modules/@anthropic-ai/claude-agent-sdk/package.json | head -20
fi
printf '%s\n' '--- candidate files ---'
rg --files src tests test 2>/dev/null | rg 'claude|sdk|fake|cli' | head -200

Repository: stablyai/orca

Length of output: 41285


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- claude directory files ---'
rg --files src/main/claude | sort
printf '%s\n' '--- target test context ---'
nl -ba src/main/claude/claude-agent-sdk-contract-pins.test.ts | sed -n '1,430p'
printf '%s\n' '--- exact claude permission references ---'
rg -n -F -- 'permissionMode' src/main/claude src/main/runtime src/shared --glob '*.ts' --glob '*.tsx' | head -240
printf '%s\n' '--- exact SDK query references ---'
rg -n -F -- 'query(' src/main/claude src/main/runtime src/shared --glob '*.ts' --glob '*.tsx' | head -200
printf '%s\n' '--- fake CLI and argv references ---'
rg -n -F -- 'pre-SDK' src/main src/shared tests --glob '*.ts' --glob '*.tsx' --glob '*.mjs' --glob '*.cjs' || test "$?" -eq 1
rg -n -F -- 'fake' src/main/claude --glob '*.ts' --glob '*.tsx' --glob '*.mjs' --glob '*.cjs' || test "$?" -eq 1
rg -n -F -- 'argv' src/main/claude --glob '*.ts' --glob '*.tsx' --glob '*.mjs' --glob '*.cjs' | head -200

Repository: stablyai/orca

Length of output: 42831


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- target test setup and assertion ---'
nl -ba src/main/claude/claude-agent-sdk-contract-pins.test.ts | sed -n '86,215p;328,402p'
printf '%s\n' '--- permissionMode declarations and assignments ---'
rg -n --glob '*.ts' --glob '*.tsx' -F -- 'permissionMode' src/main/claude src/main/runtime src/shared | head -300
printf '%s\n' '--- resolver and option-builder symbols ---'
rg -n --glob '*.ts' --glob '*.tsx' -e 'createClaudeStructuredLaunchResolver' -e 'CLAUDE_STRUCTURED_BASE_OPTIONS' -e 'permissionMode' src/main src/shared | rg 'launch|structured|claude|permissionMode' | head -300
printf '%s\n' '--- candidate option-builder files ---'
rg --files src/main src/shared | rg 'structured-agent-launch|structured-launch|structured-options|session-acquisition-options|claude.*launch.*args|claude.*options' | sort

Repository: stablyai/orca

Length of output: 41974


🌐 Web query:

@anthropic-ai/claude-agent-sdk 0.3.302 permissionMode omitted default CLI settings

💡 Result:

In **`@anthropic-ai/claude-agent-sdk` v0.3.302**, leaving `permissionMode` unset starts the session in **`default` mode** when using a third-party provider, with telemetry either off or on a fresh install. To retain `auto` mode, explicitly set `permissionMode: 'auto'`. ([github.com](https://github.com/anthropics/claude-agent-sdk-typescript/releases?utm_source=openai))

That’s the version’s release-note statement; it does **not** establish that omission resolves to `default` for every provider or installation state.

Citations:

- 1: https://github.com/anthropics/claude-agent-sdk-typescript/releases?utm_source=openai

🏁 Script executed:

set -o pipefail
printf '%s\n' '--- Claude permission mapping and resolver ---'
nl -ba src/main/claude/claude-structured-launch-resolution.ts | sed -n '1,235p'
printf '%s\n' '--- Claude option and launch-args builders ---'
nl -ba src/main/claude/claude-structured-options.ts | sed -n '1,260p'
nl -ba src/main/claude/claude-structured-launch-args.ts | sed -n '1,240p'
nl -ba src/main/runtime/structured-agent-launch-composition.ts | sed -n '130,215p'
printf '%s\n' '--- all exact permission flag source references ---'
rg -n --glob '*.ts' --glob '*.tsx' -F -e '--permission-mode' -e 'CLAUDE_PERMISSION_MODES' -e 'permissionMode:' src/main src/shared
printf '%s\n' '--- historical pre-SDK references ---'
git log --all --oneline -S'--permission-mode' -- src/main src/shared | head -30
git log --all --oneline -S'permissionMode: default' -- src/main src/shared | head -30
printf '%s\n' '--- base versions of likely relevant files ---'
for f in src/main/claude/claude-structured-launch-resolution.ts src/main/claude/claude-structured-options.ts src/main/claude/claude-structured-launch-args.ts src/main/runtime/structured-agent-launch-composition.ts; do
  if git cat-file -e 30f5bef947471007efe3b24fd9026c9e94ae1f21:$f 2>/dev/null; then
    echo "--- $f at base ---"
    git show 30f5bef947471007efe3b24fd9026c9e94ae1f21:$f | rg -n -F -e '--permission-mode' -e 'permissionMode' -e 'CLAUDE_PERMISSION_MODES' | head -120
  fi
done

Repository: stablyai/orca

Length of output: 16835


🏁 Script executed:

printf '%s\n' '--- permission mapping ---'
nl -ba src/main/claude/claude-structured-launch-resolution.ts | sed -n '60,100p'
printf '%s\n' '--- resolver construction ---'
nl -ba src/main/claude/claude-structured-launch-resolution.ts | sed -n '180,225p'
printf '%s\n' '--- launch resolution tests around modes ---'
nl -ba src/main/claude/claude-structured-launch-resolution.test.ts | sed -n '260,345p'
printf '%s\n' '--- launch args implementation and tests ---'
nl -ba src/main/claude/claude-structured-launch-args.ts | sed -n '1,180p'
nl -ba src/main/claude/claude-structured-launch-args.test.ts | sed -n '1,100p'
printf '%s\n' '--- exact permission flags in current source ---'
rg -n --glob '*.ts' --glob '*.tsx' -F -e '--permission-mode' -e 'permissionMode: undefined' -e 'permissionMode: default' src/main/claude src/main/runtime src/shared | head -180
printf '%s\n' '--- base target test and base resolver snippets ---'
git show 30f5bef947471007efe3b24fd9026c9e94ae1f21:src/main/claude/claude-agent-sdk-contract-pins.test.ts 2>/dev/null | sed -n '30,48p;336,395p'
git show 30f5bef947471007efe3b24fd9026c9e94ae1f21:src/main/claude/claude-structured-launch-resolution.ts 2>/dev/null | sed -n '60,90p;195,215p'

Repository: stablyai/orca

Length of output: 25749


🏁 Script executed:

printf '%s\n' '--- final SDK options assembly ---'
nl -ba src/main/claude/claude-structured-launch-resolution.ts | sed -n '218,285p'
printf '%s\n' '--- Orca permission-mode type ---'
nl -ba src/shared/agent-chat-permission-mode.ts | sed -n '1,150p'
printf '%s\n' '--- local SDK 0.3.302 artifacts, if present ---'
find node_modules ~/.local/share/pnpm/store /root/.local/share/pnpm/store -maxdepth 6 -iname '*claude-agent-sdk*0.3.302*' -print 2>/dev/null | head -40
find node_modules -path '*claude-agent-sdk*' -maxdepth 6 -type f -name 'package.json' -print 2>/dev/null | head -20

Repository: stablyai/orca

Length of output: 10272


🌐 Web query:

site:github.com/anthropics/claude-agent-sdk-typescript/releases/tag 0.3.302 permissionMode settings defaultMode

💡 Result:

For **`@anthropic-ai/claude-agent-sdk` v0.3.302**, the release says an omitted `permissionMode` now starts in **`default` mode** on third-party providers when telemetry is off or on a fresh install. To keep **`auto`** mode, explicitly pass `permissionMode: 'auto'`. ([github.com](https://github.com/anthropics/claude-agent-sdk-typescript/releases))

The release note does not mention `settings` or `defaultMode`, so it doesn’t establish whether those settings affect this behavior.

Citations:

- 1: https://github.com/anthropics/claude-agent-sdk-typescript/releases

🏁 Script executed:

set -o pipefail
SDK=$(find node_modules/.pnpm -maxdepth 1 -type d -name '@anthropic-ai+claude-agent-sdk@0.3.302*' | head -1)/node_modules/@anthropic-ai/claude-agent-sdk
printf '%s\n' "--- SDK package: $SDK ---"
cat "$SDK/package.json" | sed -n '1,90p'
printf '%s\n' '--- SDK declarations mentioning permissionMode ---'
rg -n -F -- 'permissionMode' "$SDK" --glob '*.d.ts' --glob '*.ts' | head -120
printf '%s\n' '--- SDK source files mentioning relevant terms ---'
rg -l -F -e 'permissionMode' -e 'defaultMode' -e 'dangerously-skip-permissions' "$SDK" --glob '*.mjs' --glob '*.js' --glob '*.cjs' | head -40
printf '%s\n' '--- bounded source contexts ---'
python3 - "$SDK" <<'PY'
from pathlib import Path
import sys
root = Path(sys.argv[1])
terms = ('permissionMode', 'defaultMode', 'dangerously-skip-permissions')
for path in sorted(root.rglob('*')):
    if path.suffix not in {'.mjs', '.js', '.cjs'} or not path.is_file():
        continue
    text = path.read_text(errors='replace')
    hits = [text.find(term) for term in terms]
    if max(hits) < 0:
        continue
    print(f'--- {path} ---')
    shown = set()
    for term in terms:
        pos = text.find(term)
        if pos < 0:
            continue
        start = max(0, pos - 700)
        end = min(len(text), pos + 1100)
        snippet = text[start:end]
        if snippet in shown:
            continue
        shown.add(snippet)
        print(f'[{term} at {pos}]')
        print(snippet)
PY

Repository: stablyai/orca

Length of output: 45647


🏁 Script executed:

python3 <<'PY'
from pathlib import Path
roots = sorted(Path('node_modules/.pnpm').glob('@anthropic-ai+claude-agent-sdk@0.3.**/node_modules/@anthropic-ai/claude-agent-sdk'))
for root in roots:
    print(f'--- {root} ---')
    for name in ('core.mjs', 'sdk.mjs'):
        path = root / name
        if not path.exists():
            continue
        text = path.read_text(errors='replace')
        for term in ('resolvePermissionModeInCli', 'permissionMode:oV', 'permissionMode:', 'filterEscalatingDefaultMode', 'defaultMode:'):
            positions = []
            start = 0
            while True:
                pos = text.find(term, start)
                if pos < 0:
                    break
                positions.append(pos)
                start = pos + 1
            if not positions:
                continue
            print(f'{name} term={term} count={len(positions)}')
            for pos in positions[:3]:
                line = text.count("\n", 0, pos) + 1
                print(f'  line={line} offset={pos}')
                print(text[max(0, pos-260):min(len(text), pos+520)])
PY

Repository: stablyai/orca

Length of output: 576


🏁 Script executed:

python3 <<'PY'
from pathlib import Path
base = Path('node_modules/.pnpm')
roots = []
for entry in base.iterdir():
    if entry.name.startswith('@anthropic-ai+claude-agent-sdk@'):
        pkg = entry / 'node_modules/@anthropic-ai/claude-agent-sdk'
        if pkg.is_dir():
            roots.append(pkg)
for root in sorted(roots, key=str):
    print(f'--- {root} ---')
    for name in ('core.mjs', 'sdk.mjs'):
        path = root / name
        if not path.exists():
            continue
        text = path.read_text(errors='replace')
        for term in ('resolvePermissionModeInCli', 'filterEscalatingDefaultMode', 'defaultMode:'):
            positions = []
            start = 0
            while True:
                pos = text.find(term, start)
                if pos < 0:
                    break
                positions.append(pos)
                start = pos + 1
            if not positions:
                continue
            print(f'{name} term={term} count={len(positions)}')
            for pos in positions[:3]:
                line = text.count("\n", 0, pos) + 1
                print(f'  line={line} offset={pos}')
                print(text[max(0, pos-300):min(len(text), pos+650)])
PY

Repository: stablyai/orca

Length of output: 10863


Preserve the explicit default permission mode for Full Access.

full-access currently omits permissionMode and relies only on --dangerously-skip-permissions. SDK 0.3.302 no longer emits --permission-mode default when the option is omitted, so enabled CLI settings can select a different starting mode. The fake-CLI assertion detects this contract change. Do not relax it.

Suggested fix
   return mode === 'full-access'
-    ? { extraArgs: { 'dangerously-skip-permissions': null } }
+    ? {
+        permissionMode: 'default',
+        extraArgs: { 'dangerously-skip-permissions': null }
+      }
     : { permissionMode: CLAUDE_PERMISSION_MODES[mode] }

"@floating-ui/dom": "1.8.0",
"@linear/sdk": "^97.0.0",
"@orca/process-host": "workspace:*",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/main/claude/claude-agent-sdk-contract-pins.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,8 @@ describe('Claude Agent SDK contract pins', () => {
// Keep the older bypass flag until user-installed CLIs have a compatible minimum version.
expect(argv.filter((arg) => arg === '--dangerously-skip-permissions')).toHaveLength(1)
expect(argv).not.toContain('--allow-dangerously-skip-permissions')
expect(argv[argv.indexOf('--permission-mode') + 1]).toBe('default')
// Full access is the skip flag alone; the CLI starts it in bypass mode whatever the user's settings say.
expect(argv).not.toContain('--permission-mode')
expect(argv[argv.indexOf('--model') + 1]).toBe('claude-sonnet-4-5')
expect(argv.flatMap((arg, index) => (arg === '--add-dir' ? [argv[index + 1]] : []))).toEqual([
'/repo/one',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,7 @@ describe.skipIf(skip || process.platform === 'win32')('packaged plain-Node struc
'--output-format',
'--include-partial-messages',
'--replay-user-messages',
'--permission-prompt-tool',
'stdio',
'--permission-prompt-tool=stdio',
`--session-id=${claudeSessionIdForOrcaSession(sessionId)}`,
'--setting-sources=user,project,local',
'--dangerously-skip-permissions'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,20 +506,14 @@ exports[`native-chat launch parity > claude floating fresh 1`] = `
"--verbose",
"--input-format",
"stream-json",
"--permission-prompt-tool",
"stdio",
"--permission-prompt-tool=stdio",
"--setting-sources=user,project,local",
"--permission-mode",
"default",
"--permission-mode=default",
"--include-partial-messages",
"--add-dir",
"/parity/extra",
"--add-dir",
"<root>/state/agent-session-attachments",
"--add-dir",
"<root>/state/chat-scratch/993224b4fe85990df64db926ca5c0346",
"--plugin-dir",
"<repo>/resources/native-chat-visuals",
"--add-dir=/parity/extra",
"--add-dir=<root>/state/agent-session-attachments",
"--add-dir=<root>/state/chat-scratch/993224b4fe85990df64db926ca5c0346",
"--plugin-dir=<repo>/resources/native-chat-visuals",
"--session-id=ef4c28b6-1b32-45ba-8fec-d9ebb4e9bc59",
"--replay-user-messages",
"--thinking-display",
Expand Down Expand Up @@ -594,21 +588,15 @@ exports[`native-chat launch parity > claude floating resumed 1`] = `
"--verbose",
"--input-format",
"stream-json",
"--permission-prompt-tool",
"stdio",
"--permission-prompt-tool=stdio",
"--resume=00000000-0000-4000-8000-000000000004",
"--setting-sources=user,project,local",
"--permission-mode",
"default",
"--permission-mode=default",
"--include-partial-messages",
"--add-dir",
"/parity/extra",
"--add-dir",
"<root>/state/agent-session-attachments",
"--add-dir",
"<root>/state/chat-scratch/008bf60b9309e6141ae7eb98acb2a35d",
"--plugin-dir",
"<repo>/resources/native-chat-visuals",
"--add-dir=/parity/extra",
"--add-dir=<root>/state/agent-session-attachments",
"--add-dir=<root>/state/chat-scratch/008bf60b9309e6141ae7eb98acb2a35d",
"--plugin-dir=<repo>/resources/native-chat-visuals",
"--replay-user-messages",
"--thinking-display",
"summarized",
Expand Down Expand Up @@ -680,20 +668,14 @@ exports[`native-chat launch parity > claude worktree fresh 1`] = `
"--verbose",
"--input-format",
"stream-json",
"--permission-prompt-tool",
"stdio",
"--permission-prompt-tool=stdio",
"--setting-sources=user,project,local",
"--permission-mode",
"default",
"--permission-mode=default",
"--include-partial-messages",
"--add-dir",
"/parity/extra",
"--add-dir",
"<root>/state/agent-session-attachments",
"--add-dir",
"<root>/state/chat-scratch/11e594f481958c10e3015d0bf0447a22",
"--plugin-dir",
"<repo>/resources/native-chat-visuals",
"--add-dir=/parity/extra",
"--add-dir=<root>/state/agent-session-attachments",
"--add-dir=<root>/state/chat-scratch/11e594f481958c10e3015d0bf0447a22",
"--plugin-dir=<repo>/resources/native-chat-visuals",
"--session-id=f00702b6-4b6d-4a6c-b685-4215832dab6b",
"--replay-user-messages",
"--thinking-display",
Expand Down Expand Up @@ -766,20 +748,13 @@ exports[`native-chat launch parity > claude worktree fresh configured 1`] = `
"--verbose",
"--input-format",
"stream-json",
"--permission-prompt-tool",
"stdio",
"--permission-prompt-tool=stdio",
"--setting-sources=user,project,local",
"--permission-mode",
"default",
"--include-partial-messages",
"--add-dir",
"/parity/configured",
"--add-dir",
"<root>/state/agent-session-attachments",
"--add-dir",
"<root>/state/chat-scratch/7d3f4165565b3c0388cb5e400cb94aeb",
"--plugin-dir",
"<repo>/resources/native-chat-visuals",
"--add-dir=/parity/configured",
"--add-dir=<root>/state/agent-session-attachments",
"--add-dir=<root>/state/chat-scratch/7d3f4165565b3c0388cb5e400cb94aeb",
"--plugin-dir=<repo>/resources/native-chat-visuals",
"--session-id=549765eb-29e2-4b8e-a209-47773e58bade",
"--replay-user-messages",
"--dangerously-skip-permissions",
Expand Down Expand Up @@ -851,16 +826,12 @@ exports[`native-chat launch parity > claude worktree fresh worker 1`] = `
"--verbose",
"--input-format",
"stream-json",
"--permission-prompt-tool",
"stdio",
"--permission-prompt-tool=stdio",
"--setting-sources=user,project,local",
"--permission-mode",
"default",
"--permission-mode=default",
"--include-partial-messages",
"--add-dir",
"/parity/extra",
"--add-dir",
"<root>/state/agent-session-attachments",
"--add-dir=/parity/extra",
"--add-dir=<root>/state/agent-session-attachments",
"--session-id=605d826f-82d0-4002-8f87-818cdfd51395",
"--replay-user-messages",
"--thinking-display",
Expand Down Expand Up @@ -932,21 +903,15 @@ exports[`native-chat launch parity > claude worktree resumed 1`] = `
"--verbose",
"--input-format",
"stream-json",
"--permission-prompt-tool",
"stdio",
"--permission-prompt-tool=stdio",
"--resume=00000000-0000-4000-8000-000000000002",
"--setting-sources=user,project,local",
"--permission-mode",
"default",
"--permission-mode=default",
"--include-partial-messages",
"--add-dir",
"/parity/extra",
"--add-dir",
"<root>/state/agent-session-attachments",
"--add-dir",
"<root>/state/chat-scratch/e79acd97ac88086665d85a762f43d533",
"--plugin-dir",
"<repo>/resources/native-chat-visuals",
"--add-dir=/parity/extra",
"--add-dir=<root>/state/agent-session-attachments",
"--add-dir=<root>/state/chat-scratch/e79acd97ac88086665d85a762f43d533",
"--plugin-dir=<repo>/resources/native-chat-visuals",
"--replay-user-messages",
"--thinking-display",
"summarized",
Expand Down Expand Up @@ -1018,21 +983,14 @@ exports[`native-chat launch parity > claude worktree resumed configured 1`] = `
"--verbose",
"--input-format",
"stream-json",
"--permission-prompt-tool",
"stdio",
"--permission-prompt-tool=stdio",
"--resume=00000000-0000-4000-8000-000000000042",
"--setting-sources=user,project,local",
"--permission-mode",
"default",
"--include-partial-messages",
"--add-dir",
"/parity/configured",
"--add-dir",
"<root>/state/agent-session-attachments",
"--add-dir",
"<root>/state/chat-scratch/4a19eb9b3f23e5c387e9d8af286e4a7f",
"--plugin-dir",
"<repo>/resources/native-chat-visuals",
"--add-dir=/parity/configured",
"--add-dir=<root>/state/agent-session-attachments",
"--add-dir=<root>/state/chat-scratch/4a19eb9b3f23e5c387e9d8af286e4a7f",
"--plugin-dir=<repo>/resources/native-chat-visuals",
"--replay-user-messages",
"--dangerously-skip-permissions",
"--thinking-display",
Expand Down
Loading