TRILHA 8

🎯 The Big Picture

Visao sistemica: model system com 4 providers, sandbox security, message processing pipeline, task system e o REPL screen principal.

5
Modulos
~30
Topicos
~4h
Duracao
Avancado
Nivel

Navegacao Rapida

8.1~55 min

Model System

4 providers (firstParty/Bedrock/Vertex/Foundry), 5 selection layers, aliases com [1m] suffix, effort levels, fast mode e model migrations.

1
📋 Four-Provider Registry & Selection Chain
ALL_MODEL_CONFIGS, 5-layer priority, allowlist gate
2
🏷️ Aliases, [1m] Suffix & opusplan
sonnet/opus/haiku/best, 1M context gate, plan mode upgrade
3
💪 Effort Levels & Fast Mode
auto/low/medium/high/max, Opus 4.6 only, cooldown
4
🛡️ Allowlist: Three-Tier Matching
Family wildcard, version prefix, exact ID, narrowing rule
5
🔀 Subagent Model Inheritance
4-level precedence, alias-matches-parent, Bedrock region prefix
6
🔄 Model Migrations & Validation
6 idempotent migrations, live API probe, deprecation warnings
Ver Completo
8.2~50 min

Sandbox Security

Confinamento OS-level via Apple Seatbelt/bubblewrap, 3 modos (disabled/regular/auto-allow), network/filesystem control e secure storage.

1
🏗️ Sandbox Architecture & Three Modes
Seatbelt macOS, bubblewrap Linux, disabled/regular/auto-allow
2
🌐 Network & Filesystem Control
Domain allow/deny, always-denied paths, bare git repo defense
3
🔑 macOS Keychain Storage
Hex encoding, stdin buffer limit, generation counter
4
🔄 Fallback Storage & Login Loop Fix
createFallbackStorage combinator, stale primary deletion
5
🚨 Violation Reporting & Live Config
SandboxViolationStore, stderr annotation, settingsChangeDetector
6
🏢 Enterprise Policy Lock & Excluded Commands
flagSettings/policySettings priority, /sandbox exclude
Ver Completo
8.3~50 min

Message Processing

Pipeline de 4 estagios: submit/route, input classification, message construction e API normalization com merge de turns e tool result pairing.

1
📨 handlePromptSubmit: Entry Point
Queue vs direct path, paste expansion, immediate commands
2
🔀 Input Classification & Hooks
bash/slash/text/ultraplan branching, UserPromptSubmit hooks
3
📦 Message Construction & Factory
createUserMessage, isMeta, synthetic messages
4
🔄 normalizeMessagesForAPI
6-pass transformation, turn merging, tool result pairing
5
📚 Message Taxonomy & Memory Hint
6 message types, withMemoryCorrectionHint pattern
6
⏱️ Query Profiling Checkpoints
Wall-clock timestamps, 3 latency hotspots
Ver Completo
8.4~50 min

Task System

7 task types (bash, agent, remote, teammate, workflow, monitor, dream) com lifecycle de 5 estados, notification XML, output em file mode e O_NOFOLLOW security.

1
🏗️ Task Architecture & 5-State Lifecycle
TaskStateBase, 7 types, notified atomic latch
2
💻 LocalShellTask: Stall Watchdog & Orphan Cleanup
OS fd output, 7 prompt patterns, agent orphan kill
3
🤖 Agent & Remote Tasks
Progress tracking, retain/evict, remote completion checkers
4
👥 Teammate & Dream Tasks
50-msg cap (36GB fix), idle lifecycle, lock rewind
5
📢 Notification System & Output Management
XML envelope, next vs later priority, O_NOFOLLOW security
6
📋 TaskCreate/Update vs Background Tasks
Two separate "task" systems, verification nudge, auto-ownership
Ver Completo
8.5~55 min

REPL Screen

O arquivo de 5000 linhas que E a sessao Claude Code: turn lifecycle, QueryGuard, dialog priority queue, session resume e auto-restore on interrupt.

1
🔄 Turn Lifecycle: onSubmit -> onQuery -> onQueryImpl
QueryGuard generation counter, messagesRef pattern
2
💡 Loading State & Dialog Priority Queue
3 sources of isLoading, getFocusedInputDialog() pure function
3
💬 Messages Array & Deferred Rendering
Ref+state dual, ephemeral progress replacement, useDeferredValue
4
🔄 Session Resume & toolJSX Overlay
15-step resume, local JSX vs tool updates priority
5
↩️ Auto-Restore on Interrupt
Esc rewind, runs outside generation guard, 5 conditions
6
🎨 Render Tree & Performance Isolation
FullscreenLayout, AnimatedTerminalTitle null-render, unseen divider
Ver Completo