typeclaw 0.48.13 → 0.50.0
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/dist/types/agent/attention-escalation.d.ts +18 -0
- package/dist/types/agent/auth.d.ts +7 -0
- package/dist/types/agent/compaction.d.ts +8 -0
- package/dist/types/agent/git-nudge.d.ts +6 -0
- package/dist/types/agent/guard-types.d.ts +25 -0
- package/dist/types/agent/guards.d.ts +7 -0
- package/dist/types/agent/idle-compaction.d.ts +7 -0
- package/dist/types/agent/index.d.ts +163 -0
- package/dist/types/agent/live-subagents.d.ts +113 -0
- package/dist/types/agent/llm-replay-sanitizer.d.ts +11 -0
- package/dist/types/agent/loop-guard.d.ts +67 -0
- package/dist/types/agent/model-fallback.d.ts +29 -0
- package/dist/types/agent/model-overrides.d.ts +8 -0
- package/dist/types/agent/multimodal/index.d.ts +2 -0
- package/dist/types/agent/multimodal/look-at.d.ts +60 -0
- package/dist/types/agent/multimodal/looker.d.ts +61 -0
- package/dist/types/agent/multimodal/read-redirect.d.ts +6 -0
- package/dist/types/agent/network/response-body.d.ts +1 -0
- package/dist/types/agent/network/safe-http.d.ts +46 -0
- package/dist/types/agent/plugin-tools.d.ts +129 -0
- package/dist/types/agent/proactive-next-step-nudge.d.ts +2 -0
- package/dist/types/agent/prompt-cache-key.d.ts +3 -0
- package/dist/types/agent/provider-error.d.ts +23 -0
- package/dist/types/agent/reload-tool.d.ts +10 -0
- package/dist/types/agent/restart/index.d.ts +31 -0
- package/dist/types/agent/restart-handoff/index.d.ts +32 -0
- package/dist/types/agent/restart-handoff/paths.d.ts +1 -0
- package/dist/types/agent/retry-same-ref.d.ts +41 -0
- package/dist/types/agent/reviewer-activity.d.ts +3 -0
- package/dist/types/agent/reviewer-bash-policy.d.ts +8 -0
- package/dist/types/agent/self.d.ts +1 -0
- package/dist/types/agent/session-meta.d.ts +28 -0
- package/dist/types/agent/session-origin.d.ts +65 -0
- package/dist/types/agent/subagent-cache-keepalive.d.ts +38 -0
- package/dist/types/agent/subagent-completion-reminder.d.ts +29 -0
- package/dist/types/agent/subagent-drain.d.ts +25 -0
- package/dist/types/agent/subagent-session.d.ts +3 -0
- package/dist/types/agent/subagents.d.ts +153 -0
- package/dist/types/agent/system-prompt.d.ts +7 -0
- package/dist/types/agent/throttle-circuit.d.ts +25 -0
- package/dist/types/agent/todo/continuation-policy.d.ts +54 -0
- package/dist/types/agent/todo/continuation-state.d.ts +11 -0
- package/dist/types/agent/todo/continuation-wiring.d.ts +32 -0
- package/dist/types/agent/todo/continuation.d.ts +21 -0
- package/dist/types/agent/todo/scope.d.ts +6 -0
- package/dist/types/agent/todo/store.d.ts +16 -0
- package/dist/types/agent/tool-error-remediation.d.ts +1 -0
- package/dist/types/agent/tool-file-safety.d.ts +78 -0
- package/dist/types/agent/tool-not-found-nudge.d.ts +9 -0
- package/dist/types/agent/tool-result-budget.d.ts +15 -0
- package/dist/types/agent/tools/channel-disengage.d.ts +18 -0
- package/dist/types/agent/tools/channel-edit.d.ts +19 -0
- package/dist/types/agent/tools/channel-fetch-attachment.d.ts +36 -0
- package/dist/types/agent/tools/channel-handoff.d.ts +13 -0
- package/dist/types/agent/tools/channel-history-render.d.ts +3 -0
- package/dist/types/agent/tools/channel-history.d.ts +25 -0
- package/dist/types/agent/tools/channel-log.d.ts +5 -0
- package/dist/types/agent/tools/channel-react.d.ts +23 -0
- package/dist/types/agent/tools/channel-read.d.ts +27 -0
- package/dist/types/agent/tools/channel-reply.d.ts +47 -0
- package/dist/types/agent/tools/channel-send.d.ts +42 -0
- package/dist/types/agent/tools/channel-session-search.d.ts +10 -0
- package/dist/types/agent/tools/curl-impersonate.d.ts +37 -0
- package/dist/types/agent/tools/ddg.d.ts +18 -0
- package/dist/types/agent/tools/grant-role.d.ts +25 -0
- package/dist/types/agent/tools/keyed-semaphore.d.ts +10 -0
- package/dist/types/agent/tools/post-github-review.d.ts +38 -0
- package/dist/types/agent/tools/restart.d.ts +25 -0
- package/dist/types/agent/tools/runtime-notice.d.ts +3 -0
- package/dist/types/agent/tools/search-retry.d.ts +16 -0
- package/dist/types/agent/tools/skip-response.d.ts +17 -0
- package/dist/types/agent/tools/spawn-subagent.d.ts +77 -0
- package/dist/types/agent/tools/stream-snapshot.d.ts +23 -0
- package/dist/types/agent/tools/subagent-access.d.ts +20 -0
- package/dist/types/agent/tools/subagent-cancel.d.ts +23 -0
- package/dist/types/agent/tools/subagent-output.d.ts +50 -0
- package/dist/types/agent/tools/todo/index.d.ts +14 -0
- package/dist/types/agent/tools/webfetch/adaptive-html.d.ts +29 -0
- package/dist/types/agent/tools/webfetch/fetch.d.ts +26 -0
- package/dist/types/agent/tools/webfetch/html-lexical.d.ts +27 -0
- package/dist/types/agent/tools/webfetch/index.d.ts +1 -0
- package/dist/types/agent/tools/webfetch/inline-style-visibility.d.ts +3 -0
- package/dist/types/agent/tools/webfetch/strategies/grep.d.ts +11 -0
- package/dist/types/agent/tools/webfetch/strategies/jq.d.ts +4 -0
- package/dist/types/agent/tools/webfetch/strategies/raw.d.ts +1 -0
- package/dist/types/agent/tools/webfetch/strategies/readability.d.ts +16 -0
- package/dist/types/agent/tools/webfetch/strategies/selector.d.ts +4 -0
- package/dist/types/agent/tools/webfetch/strategies/snapshot.d.ts +1 -0
- package/dist/types/agent/tools/webfetch/tool.d.ts +15 -0
- package/dist/types/agent/tools/webfetch/types.d.ts +32 -0
- package/dist/types/agent/tools/websearch.d.ts +17 -0
- package/dist/types/agent/tools/wikipedia.d.ts +7 -0
- package/dist/types/agent/tools-without-local-file-operands.d.ts +1 -0
- package/dist/types/agent/turn-runner.d.ts +36 -0
- package/dist/types/agent-messenger/config-dir.d.ts +19 -0
- package/dist/types/browser/dockerfile.d.ts +2 -0
- package/dist/types/browser/registry.d.ts +49 -0
- package/dist/types/bundled-plugins/bun-hygiene/policy.d.ts +18 -0
- package/dist/types/bundled-plugins/github-cli-auth/git-askpass.d.ts +5 -0
- package/dist/types/bundled-plugins/guard/keys.d.ts +6 -0
- package/dist/types/bundled-plugins/guard/policies/managed-config.d.ts +7 -0
- package/dist/types/bundled-plugins/guard/policies/memory-topics-delete.d.ts +11 -0
- package/dist/types/bundled-plugins/guard/policies/memory-topics-write.d.ts +7 -0
- package/dist/types/bundled-plugins/guard/policies/non-workspace-write.d.ts +9 -0
- package/dist/types/bundled-plugins/guard/policies/skill-authoring.d.ts +20 -0
- package/dist/types/bundled-plugins/guard/policies/uncommitted-changes.d.ts +12 -0
- package/dist/types/bundled-plugins/guard/policy.d.ts +11 -0
- package/dist/types/bundled-plugins/memory/secret-detector.d.ts +11 -0
- package/dist/types/bundled-plugins/memory/slug.d.ts +4 -0
- package/dist/types/bundled-plugins/security/permissions.d.ts +20 -0
- package/dist/types/bundled-plugins/security/policies/private-surface-read.d.ts +34 -0
- package/dist/types/bundled-plugins/security/policies/ssrf.d.ts +18 -0
- package/dist/types/bundled-plugins/security/policy.d.ts +4 -0
- package/dist/types/channels/adapter-namespace.d.ts +2 -0
- package/dist/types/channels/adapters/mention-hints.d.ts +12 -0
- package/dist/types/channels/adapters/webex-id-ref.d.ts +5 -0
- package/dist/types/channels/background-handoff.d.ts +56 -0
- package/dist/types/channels/background-obligations.d.ts +135 -0
- package/dist/types/channels/catch-up.d.ts +26 -0
- package/dist/types/channels/commands.d.ts +2 -0
- package/dist/types/channels/completion-claim.d.ts +20 -0
- package/dist/types/channels/continuation-willingness.d.ts +1 -0
- package/dist/types/channels/continuity-types.d.ts +75 -0
- package/dist/types/channels/describe-error.d.ts +1 -0
- package/dist/types/channels/engagement.d.ts +34 -0
- package/dist/types/channels/github-false-receipt.d.ts +20 -0
- package/dist/types/channels/github-repo.d.ts +2 -0
- package/dist/types/channels/github-rereview-guard.d.ts +24 -0
- package/dist/types/channels/github-review-check.d.ts +135 -0
- package/dist/types/channels/github-review-claim.d.ts +3 -0
- package/dist/types/channels/github-review-turn-ledger.d.ts +71 -0
- package/dist/types/channels/github-review-verdict-coordinator.d.ts +117 -0
- package/dist/types/channels/github-token-bridge.d.ts +20 -0
- package/dist/types/channels/github-verdict-activity.d.ts +12 -0
- package/dist/types/channels/inbound-journal.d.ts +272 -0
- package/dist/types/channels/last-alive.d.ts +3 -0
- package/dist/types/channels/membership-cache.d.ts +27 -0
- package/dist/types/channels/membership.d.ts +21 -0
- package/dist/types/channels/outbound-flood-filter.d.ts +7 -0
- package/dist/types/channels/participants.d.ts +4 -0
- package/dist/types/channels/persistence.d.ts +32 -0
- package/dist/types/channels/recovery-notice.d.ts +26 -0
- package/dist/types/channels/recovery-outbox.d.ts +58 -0
- package/dist/types/channels/router.d.ts +798 -0
- package/dist/types/channels/schema.d.ts +501 -0
- package/dist/types/channels/session-handoff.d.ts +58 -0
- package/dist/types/channels/session-search.d.ts +29 -0
- package/dist/types/channels/types.d.ts +414 -0
- package/dist/types/channels/waiting-reactions.d.ts +25 -0
- package/dist/types/cli/builtins.d.ts +2 -0
- package/dist/types/cli/command-meta.d.ts +9 -0
- package/dist/types/coding-agent/broker-body.d.ts +7 -0
- package/dist/types/coding-agent/broker.d.ts +22 -0
- package/dist/types/coding-agent/claude.d.ts +22 -0
- package/dist/types/coding-agent/codex.d.ts +19 -0
- package/dist/types/coding-agent/index.d.ts +71 -0
- package/dist/types/coding-agent/omo-state.d.ts +2 -0
- package/dist/types/coding-agent/omo-stream.d.ts +22 -0
- package/dist/types/coding-agent/omo.d.ts +133 -0
- package/dist/types/coding-agent/runner.d.ts +35 -0
- package/dist/types/coding-agent/tool.d.ts +27 -0
- package/dist/types/coding-agent/worktree.d.ts +22 -0
- package/dist/types/commands/index.d.ts +45 -0
- package/dist/types/config/config.d.ts +814 -0
- package/dist/types/config/index.d.ts +3 -0
- package/dist/types/config/model-overrides.d.ts +3 -0
- package/dist/types/config/providers.d.ts +1456 -0
- package/dist/types/config/reloadable.d.ts +9 -0
- package/dist/types/container/agent-operation-lock.d.ts +31 -0
- package/dist/types/container/build-cache.d.ts +39 -0
- package/dist/types/container/compose-project.d.ts +1 -0
- package/dist/types/container/controller.d.ts +25 -0
- package/dist/types/container/docker-app.d.ts +23 -0
- package/dist/types/container/exit-reason.d.ts +10 -0
- package/dist/types/container/index.d.ts +14 -0
- package/dist/types/container/log-archive.d.ts +68 -0
- package/dist/types/container/log-colors.d.ts +3 -0
- package/dist/types/container/log-timestamps.d.ts +9 -0
- package/dist/types/container/logs.d.ts +37 -0
- package/dist/types/container/memory-limit.d.ts +13 -0
- package/dist/types/container/memory-oversubscription.d.ts +20 -0
- package/dist/types/container/oom-events.d.ts +18 -0
- package/dist/types/container/port.d.ts +18 -0
- package/dist/types/container/require-running.d.ts +16 -0
- package/dist/types/container/restart.d.ts +32 -0
- package/dist/types/container/shared.d.ts +93 -0
- package/dist/types/container/shell.d.ts +35 -0
- package/dist/types/container/start.d.ts +144 -0
- package/dist/types/container/stats.d.ts +31 -0
- package/dist/types/container/status.d.ts +25 -0
- package/dist/types/container/stop.d.ts +24 -0
- package/dist/types/container/tool-oom-priority.d.ts +4 -0
- package/dist/types/container/verify-running.d.ts +49 -0
- package/dist/types/cron/consumer.d.ts +42 -0
- package/dist/types/cron/count-state.d.ts +24 -0
- package/dist/types/cron/index.d.ts +21 -0
- package/dist/types/cron/list.d.ts +33 -0
- package/dist/types/cron/reloadable.d.ts +11 -0
- package/dist/types/cron/scheduler.d.ts +51 -0
- package/dist/types/cron/schema.d.ts +108 -0
- package/dist/types/dependencies/bin-resolver.d.ts +28 -0
- package/dist/types/dependencies/bins.d.ts +22 -0
- package/dist/types/dependencies/index.d.ts +2 -0
- package/dist/types/git/bound-gc-config.d.ts +4 -0
- package/dist/types/git/hookless.d.ts +1 -0
- package/dist/types/git/reconcile-ignored.d.ts +13 -0
- package/dist/types/git/resolve-agent-git.d.ts +8 -0
- package/dist/types/git/resolve-identity.d.ts +10 -0
- package/dist/types/git/run.d.ts +24 -0
- package/dist/types/git/system-commit.d.ts +2 -0
- package/dist/types/hostd/client.d.ts +13 -0
- package/dist/types/hostd/models.d.ts +1 -0
- package/dist/types/hostd/paths.d.ts +17 -0
- package/dist/types/hostd/protocol.d.ts +93 -0
- package/dist/types/hostd/spawn.d.ts +17 -0
- package/dist/types/hostd/version.d.ts +18 -0
- package/dist/types/init/auto-upgrade.d.ts +41 -0
- package/dist/types/init/cli-version.d.ts +7 -0
- package/dist/types/init/dockerfile.d.ts +34 -0
- package/dist/types/init/ensure-deps.d.ts +17 -0
- package/dist/types/init/env-file.d.ts +3 -0
- package/dist/types/init/gitignore.d.ts +5 -0
- package/dist/types/init/local-source-stamp.d.ts +3 -0
- package/dist/types/init/packagejson.d.ts +7 -0
- package/dist/types/init/paths.d.ts +3 -0
- package/dist/types/init/reconcile-plugin-deps.d.ts +13 -0
- package/dist/types/init/run-bun-install.d.ts +16 -0
- package/dist/types/init/windows-dev-link.d.ts +8 -0
- package/dist/types/mcp/catalog.d.ts +7 -0
- package/dist/types/mcp/client.d.ts +58 -0
- package/dist/types/mcp/manager.d.ts +56 -0
- package/dist/types/mcp/tools.d.ts +23 -0
- package/dist/types/models/embedding-model.d.ts +20 -0
- package/dist/types/models/transformers-version.d.ts +1 -0
- package/dist/types/network/internal-destinations.d.ts +29 -0
- package/dist/types/operations/classify-tool-outcome.d.ts +35 -0
- package/dist/types/operations/incidents.d.ts +47 -0
- package/dist/types/operations/index.d.ts +3 -0
- package/dist/types/operations/remediations.d.ts +25 -0
- package/dist/types/path-safety/real-intended-path.d.ts +9 -0
- package/dist/types/permissions/builtins.d.ts +25 -0
- package/dist/types/permissions/grant.d.ts +19 -0
- package/dist/types/permissions/index.d.ts +6 -0
- package/dist/types/permissions/match-rule.d.ts +28 -0
- package/dist/types/permissions/permissions.d.ts +42 -0
- package/dist/types/permissions/resolve.d.ts +25 -0
- package/dist/types/permissions/schema.d.ts +14 -0
- package/dist/types/plugin/context.d.ts +20 -0
- package/dist/types/plugin/core-tool-names.d.ts +4 -0
- package/dist/types/plugin/define.d.ts +46 -0
- package/dist/types/plugin/hooks.d.ts +52 -0
- package/dist/types/plugin/index.d.ts +11 -0
- package/dist/types/plugin/load-skill.d.ts +14 -0
- package/dist/types/plugin/loader.d.ts +25 -0
- package/dist/types/plugin/manager.d.ts +42 -0
- package/dist/types/plugin/registry.d.ts +73 -0
- package/dist/types/plugin/skills.d.ts +11 -0
- package/dist/types/plugin/types.d.ts +336 -0
- package/dist/types/plugin/zod-introspect.d.ts +11 -0
- package/dist/types/reload/client.d.ts +11 -0
- package/dist/types/reload/docker-exec-client.d.ts +11 -0
- package/dist/types/reload/format.d.ts +2 -0
- package/dist/types/reload/index.d.ts +6 -0
- package/dist/types/reload/recover.d.ts +22 -0
- package/dist/types/reload/registry.d.ts +10 -0
- package/dist/types/reload/types.d.ts +25 -0
- package/dist/types/role-claim/client.d.ts +20 -0
- package/dist/types/role-claim/code.d.ts +4 -0
- package/dist/types/role-claim/controller.d.ts +59 -0
- package/dist/types/role-claim/index.d.ts +6 -0
- package/dist/types/role-claim/match-rule.d.ts +9 -0
- package/dist/types/role-claim/pending.d.ts +35 -0
- package/dist/types/role-claim/reload-after-claim.d.ts +16 -0
- package/dist/types/run/llm-fetch-observer.d.ts +50 -0
- package/dist/types/sandbox/availability.d.ts +21 -0
- package/dist/types/sandbox/build.d.ts +7 -0
- package/dist/types/sandbox/canonical-secrets.d.ts +8 -0
- package/dist/types/sandbox/coding-agent.d.ts +20 -0
- package/dist/types/sandbox/dependency-bins.d.ts +19 -0
- package/dist/types/sandbox/dev-source.d.ts +4 -0
- package/dist/types/sandbox/env-exposure.d.ts +1 -0
- package/dist/types/sandbox/errors.d.ts +20 -0
- package/dist/types/sandbox/hidden-paths.d.ts +11 -0
- package/dist/types/sandbox/index.d.ts +14 -0
- package/dist/types/sandbox/package-install.d.ts +1 -0
- package/dist/types/sandbox/policy.d.ts +71 -0
- package/dist/types/sandbox/privileged-runtime.d.ts +13 -0
- package/dist/types/sandbox/quote.d.ts +2 -0
- package/dist/types/sandbox/runtime-private.d.ts +1 -0
- package/dist/types/sandbox/session-tmp.d.ts +6 -0
- package/dist/types/sandbox/symlinks.d.ts +6 -0
- package/dist/types/sandbox/writable-zones.d.ts +15 -0
- package/dist/types/secrets/coding-agent-auth.d.ts +25 -0
- package/dist/types/secrets/defaults.d.ts +21 -0
- package/dist/types/secrets/export-github-cli-store.d.ts +22 -0
- package/dist/types/secrets/hydrate.d.ts +7 -0
- package/dist/types/secrets/index.d.ts +7 -0
- package/dist/types/secrets/provision-github-cli-store.d.ts +45 -0
- package/dist/types/secrets/refresh-provider-oauth.d.ts +22 -0
- package/dist/types/secrets/resolve.d.ts +14 -0
- package/dist/types/secrets/schema.d.ts +840 -0
- package/dist/types/secrets/storage.d.ts +56 -0
- package/dist/types/shared/host-locale.d.ts +1 -0
- package/dist/types/shared/index.d.ts +5 -0
- package/dist/types/shared/local-time.d.ts +4 -0
- package/dist/types/shared/platform.d.ts +2 -0
- package/dist/types/shared/protocol.d.ts +424 -0
- package/dist/types/shared/style-text.d.ts +3 -0
- package/dist/types/shared/wsl.d.ts +17 -0
- package/dist/types/stream/broker.d.ts +2 -0
- package/dist/types/stream/index.d.ts +2 -0
- package/dist/types/stream/types.d.ts +71 -0
- package/package.json +13 -6
- package/scripts/build-plugin-types.ts +105 -0
- package/scripts/check-plugin-sdk.ts +111 -0
- package/scripts/dump-system-prompt.ts +52 -110
- package/scripts/require-parallel.ts +5 -32
- package/src/agent/guard-types.ts +3 -0
- package/src/agent/guards.ts +4 -0
- package/src/agent/idle-compaction.ts +174 -0
- package/src/agent/index.ts +210 -80
- package/src/agent/live-sessions.ts +2 -2
- package/src/agent/live-subagents.ts +20 -0
- package/src/agent/multimodal/look-at.ts +22 -9
- package/src/agent/plugin-tools.ts +66 -12
- package/src/agent/prompt-cache-key.ts +42 -0
- package/src/agent/provider-error.ts +179 -10
- package/src/agent/restart-handoff/index.ts +7 -14
- package/src/agent/reviewer-activity.ts +68 -0
- package/src/agent/reviewer-bash-policy.ts +41 -1
- package/src/agent/session-origin.ts +58 -9
- package/src/agent/subagent-cache-keepalive.ts +198 -0
- package/src/agent/subagent-session.ts +6 -0
- package/src/agent/subagents.ts +59 -9
- package/src/agent/system-prompt.ts +68 -202
- package/src/agent/todo/continuation-policy.ts +12 -4
- package/src/agent/tool-file-safety.ts +119 -15
- package/src/agent/tool-not-found-nudge.ts +1 -1
- package/src/agent/tools/channel-edit.ts +20 -10
- package/src/agent/tools/channel-fetch-attachment.ts +12 -5
- package/src/agent/tools/channel-handoff.ts +72 -0
- package/src/agent/tools/channel-history-render.ts +2 -1
- package/src/agent/tools/channel-read.ts +57 -10
- package/src/agent/tools/channel-reply.ts +55 -30
- package/src/agent/tools/channel-send.ts +69 -19
- package/src/agent/tools/channel-session-search.ts +35 -0
- package/src/agent/tools/curl-impersonate.ts +22 -6
- package/src/agent/tools/ddg.ts +13 -5
- package/src/agent/tools/post-github-review.ts +77 -15
- package/src/agent/tools/skip-response.ts +2 -2
- package/src/agent/tools/spawn-subagent.ts +190 -23
- package/src/agent/tools/stream-snapshot.ts +15 -2
- package/src/agent/tools/subagent-access.ts +11 -4
- package/src/agent/tools/subagent-output.ts +8 -0
- package/src/browser/bsk-shim.mjs +74 -0
- package/src/browser/dockerfile.ts +84 -0
- package/src/browser/egress.ts +104 -0
- package/src/browser/managed-browser.ts +205 -0
- package/src/browser/registry.ts +110 -0
- package/src/browser/relay.ts +231 -0
- package/src/browser/sandbox-entry.ts +167 -0
- package/src/bundled-plugins/agent-browser/index.ts +2 -0
- package/src/bundled-plugins/backup/README.md +10 -9
- package/src/bundled-plugins/backup/runner.ts +140 -58
- package/src/bundled-plugins/backup/subagents.ts +58 -26
- package/src/bundled-plugins/browser-agent/browser-agent.ts +89 -0
- package/src/bundled-plugins/browser-agent/index.ts +12 -0
- package/src/bundled-plugins/doc-render/index.ts +0 -10
- package/src/bundled-plugins/doc-render/render.ts +83 -111
- package/src/bundled-plugins/doc-render/skills/typeclaw-render-pdf/SKILL.md +152 -257
- package/src/bundled-plugins/github-cli-auth/gh-command.ts +38 -2
- package/src/bundled-plugins/github-cli-auth/git-auth-diagnostic.ts +95 -0
- package/src/bundled-plugins/github-cli-auth/granted-push.ts +135 -0
- package/src/bundled-plugins/github-cli-auth/index.ts +158 -70
- package/src/bundled-plugins/github-cli-auth/review-account.ts +23 -0
- package/src/bundled-plugins/github-cli-auth/review-checkout.ts +9 -2
- package/src/bundled-plugins/github-cli-auth/review-recorder.ts +45 -7
- package/src/bundled-plugins/managed-browser/index.ts +74 -0
- package/src/bundled-plugins/managed-browser/skills/browser-use/browser-use/SKILL.md +27 -0
- package/src/bundled-plugins/managed-browser/skills/browserskill/browserskill/SKILL.md +28 -0
- package/src/bundled-plugins/managed-browser/skills/omowright/omowright/SKILL.md +40 -0
- package/src/bundled-plugins/operator/operator.ts +15 -4
- package/src/bundled-plugins/qa/index.ts +11 -0
- package/src/bundled-plugins/qa/qa.ts +160 -0
- package/src/bundled-plugins/qa/skills/qa-cli.ts +50 -0
- package/src/bundled-plugins/qa/skills/qa-general.ts +30 -0
- package/src/bundled-plugins/qa/skills/qa-http.ts +39 -0
- package/src/bundled-plugins/qa/skills/qa-pr.ts +51 -0
- package/src/bundled-plugins/qa/skills/qa-web.ts +49 -0
- package/src/bundled-plugins/reviewer/skills/code-review.ts +1 -1
- package/src/bundled-plugins/security/index.ts +103 -36
- package/src/bundled-plugins/security/policies/git-exfil.ts +24 -12
- package/src/bundled-plugins/security/policies/outbound-secret-scan.ts +1 -0
- package/src/channels/adapter-namespace.ts +13 -0
- package/src/channels/adapters/discord-bot-reactions.ts +18 -0
- package/src/channels/adapters/discord-bot.ts +219 -72
- package/src/channels/adapters/discord-reactions.ts +18 -0
- package/src/channels/adapters/discord.ts +114 -8
- package/src/channels/adapters/github/inbound.ts +103 -8
- package/src/channels/adapters/github/index.ts +267 -19
- package/src/channels/adapters/github/last-alive.ts +15 -0
- package/src/channels/adapters/github/outbound.ts +54 -18
- package/src/channels/adapters/github/pending-review-store.ts +141 -0
- package/src/channels/adapters/github/permission-guidance.ts +1 -0
- package/src/channels/adapters/github/reactions.ts +100 -0
- package/src/channels/adapters/github/reconcile-cooldown-store.ts +197 -67
- package/src/channels/adapters/github/reconcile-open-prs.ts +418 -33
- package/src/channels/adapters/github/recovery.ts +106 -0
- package/src/channels/adapters/github/review-check.ts +510 -0
- package/src/channels/adapters/github/review-submitter.ts +34 -2
- package/src/channels/adapters/instagram.ts +32 -14
- package/src/channels/adapters/kakaotalk.ts +22 -7
- package/src/channels/adapters/line.ts +18 -3
- package/src/channels/adapters/outbound-account.ts +20 -0
- package/src/channels/adapters/own-reactions.ts +66 -0
- package/src/channels/adapters/recovery-correlation.ts +214 -0
- package/src/channels/adapters/slack-attachment-download.ts +14 -3
- package/src/channels/adapters/slack-bot-author-resolver.ts +4 -3
- package/src/channels/adapters/slack-bot-channel-resolver.ts +9 -6
- package/src/channels/adapters/slack-bot-classify.ts +19 -11
- package/src/channels/adapters/slack-bot-dedupe.ts +111 -28
- package/src/channels/adapters/slack-bot-reactions.ts +18 -0
- package/src/channels/adapters/slack-bot-slash-commands.ts +3 -1
- package/src/channels/adapters/slack-bot.ts +424 -124
- package/src/channels/adapters/slack-classify.ts +26 -4
- package/src/channels/adapters/slack-inbound-revision.ts +96 -0
- package/src/channels/adapters/slack-reactions.ts +18 -0
- package/src/channels/adapters/slack-thread-ts.ts +6 -0
- package/src/channels/adapters/slack.ts +48 -3
- package/src/channels/adapters/teams.ts +14 -4
- package/src/channels/adapters/telegram-bot.ts +56 -10
- package/src/channels/adapters/webex-bot.ts +12 -2
- package/src/channels/adapters/webex.ts +12 -2
- package/src/channels/background-handoff.ts +434 -0
- package/src/channels/background-obligations.ts +893 -0
- package/src/channels/catch-up.ts +137 -0
- package/src/channels/continuation-willingness.ts +2 -2
- package/src/channels/continuity-types.ts +272 -0
- package/src/channels/engagement.ts +17 -1
- package/src/channels/github-false-receipt.ts +3 -3
- package/src/channels/github-rereview-guard.ts +9 -5
- package/src/channels/github-review-check.ts +598 -0
- package/src/channels/github-review-turn-ledger.ts +102 -28
- package/src/channels/github-review-verdict-coordinator.ts +72 -12
- package/src/channels/github-token-bridge.ts +35 -5
- package/src/channels/inbound-journal.ts +1738 -0
- package/src/channels/index.ts +6 -1
- package/src/channels/last-alive.ts +34 -0
- package/src/channels/manager.ts +25 -8
- package/src/channels/recovery-dispatcher.ts +264 -0
- package/src/channels/recovery-notice.ts +94 -0
- package/src/channels/recovery-outbox.ts +459 -0
- package/src/channels/router.ts +2951 -736
- package/src/channels/schema.ts +8 -1
- package/src/channels/session-handoff.fixture.ts +144 -0
- package/src/channels/session-handoff.ts +175 -0
- package/src/channels/session-search.ts +71 -0
- package/src/channels/subagent-completion-bridge.ts +17 -14
- package/src/channels/types.ts +133 -18
- package/src/channels/waiting-reactions.ts +664 -0
- package/src/cli/channel.ts +2 -3
- package/src/cli/compose.ts +7 -4
- package/src/cli/hostd.ts +49 -3
- package/src/cli/init.ts +2 -3
- package/src/cli/inspect.ts +11 -14
- package/src/cli/model.ts +132 -3
- package/src/coding-agent/broker-body.ts +38 -0
- package/src/coding-agent/broker.ts +290 -0
- package/src/coding-agent/claude.ts +95 -0
- package/src/coding-agent/codex.ts +104 -0
- package/src/coding-agent/index.ts +512 -0
- package/src/coding-agent/omo-state.ts +69 -0
- package/src/coding-agent/omo-stream.ts +138 -0
- package/src/coding-agent/omo.ts +192 -0
- package/src/coding-agent/runner.ts +285 -0
- package/src/coding-agent/tool.ts +62 -0
- package/src/coding-agent/worktree.ts +355 -0
- package/src/compose/restart.ts +10 -3
- package/src/compose/start.ts +20 -3
- package/src/config/config.ts +121 -25
- package/src/config/model-overrides.ts +59 -0
- package/src/config/models-mutation.ts +185 -2
- package/src/config/providers-mutation.ts +12 -4
- package/src/config/providers.ts +71 -9
- package/src/container/exit-reason.ts +44 -0
- package/src/container/index.ts +5 -0
- package/src/container/log-archive.ts +51 -13
- package/src/container/memory-limit.ts +1 -1
- package/src/container/memory-oversubscription.ts +36 -6
- package/src/container/oom-events.ts +86 -0
- package/src/container/restart.ts +2 -0
- package/src/container/shared.ts +8 -1
- package/src/container/start.ts +120 -17
- package/src/container/stop.ts +6 -2
- package/src/container/tool-oom-priority.ts +32 -0
- package/src/cron/consumer.ts +10 -4
- package/src/cron/reloadable.ts +23 -2
- package/src/doctor/checks.ts +22 -8
- package/src/hostd/daemon.ts +33 -11
- package/src/hostd/spawn.ts +106 -5
- package/src/hostd/version.ts +20 -0
- package/src/hostd/watchdog.ts +241 -0
- package/src/init/auto-upgrade.ts +7 -1
- package/src/init/dockerfile.ts +112 -602
- package/src/init/index.ts +6 -6
- package/src/init/local-source-stamp.ts +68 -0
- package/src/init/models-dev.ts +4 -0
- package/src/init/validate-api-key.ts +3 -0
- package/src/mcp/client.ts +3 -1
- package/src/operations/classify-tool-outcome.ts +45 -1
- package/src/operations/incidents.ts +10 -5
- package/src/permissions/builtins.ts +7 -0
- package/src/permissions/permissions.ts +18 -9
- package/src/permissions/resolve.ts +7 -1
- package/src/plugin/context.ts +2 -0
- package/src/plugin/core-tool-names.ts +1 -1
- package/src/plugin/define.ts +1 -0
- package/src/plugin/hooks.ts +137 -0
- package/src/plugin/index.ts +7 -0
- package/src/plugin/manager.ts +4 -0
- package/src/plugin/types.ts +66 -1
- package/src/run/background-handoff-boot.ts +86 -0
- package/src/run/bundled-plugins.ts +6 -0
- package/src/run/index.ts +107 -97
- package/src/run/llm-fetch-observer.ts +12 -15
- package/src/run/resource-sample.ts +19 -0
- package/src/sandbox/build.ts +4 -0
- package/src/sandbox/canonical-secrets.ts +4 -0
- package/src/sandbox/coding-agent.ts +214 -0
- package/src/sandbox/dev-source.ts +26 -0
- package/src/sandbox/hidden-paths.ts +16 -2
- package/src/sandbox/policy.ts +1 -0
- package/src/sandbox/runtime-private.ts +4 -1
- package/src/secrets/coding-agent-auth.ts +97 -0
- package/src/secrets/index.ts +0 -16
- package/src/secrets/storage.ts +13 -0
- package/src/server/command-runner.ts +6 -2
- package/src/server/index.ts +101 -40
- package/src/skills/typeclaw-channel-github/SKILL.md +15 -13
- package/src/skills/typeclaw-claude-code/SKILL.md +25 -260
- package/src/skills/typeclaw-claude-code/references/auth-flow.md +7 -23
- package/src/skills/typeclaw-claude-code/references/headless-sessions.md +11 -0
- package/src/skills/typeclaw-claude-code/references/results-and-worktrees.md +13 -0
- package/src/skills/typeclaw-codex-cli/SKILL.md +35 -270
- package/src/skills/typeclaw-codex-cli/references/auth-flow.md +13 -20
- package/src/skills/typeclaw-codex-cli/references/headless-sessions.md +26 -0
- package/src/skills/typeclaw-codex-cli/references/results-and-worktrees.md +28 -0
- package/src/skills/typeclaw-config/SKILL.md +60 -26
- package/src/skills/typeclaw-config/references/dockerfile.md +14 -13
- package/src/skills/typeclaw-cron/SKILL.md +1 -1
- package/src/skills/typeclaw-github-contributing/SKILL.md +3 -3
- package/src/skills/typeclaw-memory/SKILL.md +3 -3
- package/src/skills/typeclaw-monorepo/SKILL.md +1 -1
- package/src/skills/typeclaw-omo-cli/SKILL.md +52 -0
- package/src/skills/typeclaw-omo-cli/references/auth-flow.md +11 -0
- package/src/skills/typeclaw-omo-cli/references/headless-sessions.md +11 -0
- package/src/skills/typeclaw-omo-cli/references/results-and-worktrees.md +23 -0
- package/src/skills/typeclaw-permissions/SKILL.md +7 -7
- package/src/skills/typeclaw-plugins/SKILL.md +15 -15
- package/src/skills/typeclaw-skills/SKILL.md +19 -2
- package/src/skills/typeclaw-troubleshooting/SKILL.md +26 -2
- package/typeclaw.schema.json +448 -6
- package/src/bundled-plugins/doc-render/templates/lib.typ +0 -339
- package/src/bundled-plugins/github-cli-auth/gh-store.ts +0 -733
- package/src/secrets/claude-credentials-json.ts +0 -129
- package/src/secrets/codex-auth-json.ts +0 -102
- package/src/secrets/export-claude-credentials-file.ts +0 -270
- package/src/secrets/export-codex-auth-file.ts +0 -250
- package/src/skills/typeclaw-claude-code/references/stop-hook.md +0 -101
- package/src/skills/typeclaw-claude-code/references/tmux-driving.md +0 -243
- package/src/skills/typeclaw-codex-cli/references/stop-hook.md +0 -92
- package/src/skills/typeclaw-codex-cli/references/tmux-driving.md +0 -239
package/src/init/dockerfile.ts
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { CONTAINER_AGENT_MESSENGER_CONFIG_DIR } from '@/agent-messenger/config-dir'
|
|
2
|
+
import { renderBrowserLayers } from '@/browser/dockerfile'
|
|
3
|
+
import type { BrowserConfig } from '@/browser/registry'
|
|
2
4
|
import { ASKPASS_SCRIPT, TYPECLAW_GIT_ASKPASS_PATH } from '@/bundled-plugins/github-cli-auth/git-askpass'
|
|
5
|
+
import { CLAUDE_CODE_VERSION } from '@/coding-agent/claude'
|
|
6
|
+
import { CODEX_CLI_VERSION } from '@/coding-agent/codex'
|
|
7
|
+
import { OMO_CLI_VERSION } from '@/coding-agent/omo'
|
|
3
8
|
import { validateDockerfileAppendLine } from '@/config/config'
|
|
4
9
|
import type { DockerfileConfig, DockerfileFeatureToggle } from '@/config/config'
|
|
5
|
-
import {
|
|
6
|
-
CLAUDE_CREDENTIALS_FILE_NAME,
|
|
7
|
-
CLAUDE_CREDENTIALS_RELATIVE_PATH,
|
|
8
|
-
} from '@/secrets/export-claude-credentials-file'
|
|
10
|
+
import { TESTED_BUN_VERSION } from '@/hostd/version'
|
|
9
11
|
|
|
10
12
|
import { GHCR_BASE_IMAGE_REPO } from './cli-version'
|
|
11
13
|
|
|
12
14
|
export const DOCKERFILE = 'Dockerfile'
|
|
13
15
|
|
|
14
16
|
export type BuildDockerfileOptions = {
|
|
17
|
+
// `typeclaw.json#browser`; omitted = the default agent-browser-only image.
|
|
18
|
+
browser?: BrowserConfig
|
|
15
19
|
// Null or omitted = emit the full inline heavy stack (dev mode, tests).
|
|
16
20
|
baseImageVersion?: string | null
|
|
17
21
|
// Host-locale decision for `cjkFonts: 'auto'`. Callers that have a host
|
|
@@ -423,89 +427,6 @@ link_configured_symlinks() {
|
|
|
423
427
|
' || true
|
|
424
428
|
}
|
|
425
429
|
|
|
426
|
-
# link_custom_claude_credentials keeps a custom CLAUDE_CONFIG_DIR credential file
|
|
427
|
-
# out of model-visible reach. The Claude Code exporter writes the OAuth refresh
|
|
428
|
-
# token to \$CLAUDE_CONFIG_DIR/.credentials.json when that env var is set. Under
|
|
429
|
-
# the default (unset) it lands in the runtime HOME's .claude, which bwrap never
|
|
430
|
-
# binds — invisible to sandboxed bash. But a custom dir under /agent (or any
|
|
431
|
-
# jail-visible root) would put the real token where model bash can read it.
|
|
432
|
-
#
|
|
433
|
-
# Instead of masking every possible custom location, plant a symlink from the
|
|
434
|
-
# custom path INTO the runtime HOME's .claude and let the exporter's
|
|
435
|
-
# symlink-aware writeAtomic() follow it — so the real bytes always live in the
|
|
436
|
-
# unbound, already-denied runtime HOME regardless of where CLAUDE_CONFIG_DIR
|
|
437
|
-
# points. This restores the invariant the old persistence helper used to provide
|
|
438
|
-
# (it linked into the masked persist root); the target moved to the ephemeral
|
|
439
|
-
# HOME, but the "credential is only an alias in the custom dir" property is
|
|
440
|
-
# preserved. Runs in the root phase before privilege drop so custom dirs under
|
|
441
|
-
# root-owned roots (e.g. /etc) can still be created. No-op when the value is
|
|
442
|
-
# unset/blank or already resolves to the runtime HOME's .claude (avoids a
|
|
443
|
-
# self-referential link). Re-linking is idempotent (an existing symlink is
|
|
444
|
-
# replaced); failures are non-fatal so a bad custom path never blocks boot.
|
|
445
|
-
#
|
|
446
|
-
# The from-path MUST match where the exporter actually writes. The exporter
|
|
447
|
-
# (src/secrets/export-claude-credentials-file.ts resolveClaudeConfigDir) applies
|
|
448
|
-
# JS String.trim() and treats an all-whitespace value as unset. Replicating that
|
|
449
|
-
# in POSIX sed would diverge on Unicode whitespace (\u00A0, \u2003, …) that
|
|
450
|
-
# .trim() strips but a byte-oriented sed class does not — a divergence is a
|
|
451
|
-
# credential-isolation bypass (exporter writes the trimmed path, alias sits at
|
|
452
|
-
# the padded path, token stays model-readable). So do the normalization in the
|
|
453
|
-
# same \`bun -e\` runtime the exporter uses, guaranteeing byte-for-byte identical
|
|
454
|
-
# trimming, and create the symlink there too.
|
|
455
|
-
link_custom_claude_credentials() {
|
|
456
|
-
CLAUDE_CONFIG_DIR="\${CLAUDE_CONFIG_DIR:-}" _CLAUDE_RUNTIME_HOME="$runtime_home" \\
|
|
457
|
-
_CLAUDE_CRED_FILE="${CLAUDE_CREDENTIALS_FILE_NAME}" _CLAUDE_CRED_REL="${CLAUDE_CREDENTIALS_RELATIVE_PATH}" bun -e '
|
|
458
|
-
import { mkdirSync, rmSync, symlinkSync } from "node:fs";
|
|
459
|
-
import { dirname, join } from "node:path";
|
|
460
|
-
const raw = process.env.CLAUDE_CONFIG_DIR;
|
|
461
|
-
const trimmed = raw?.trim();
|
|
462
|
-
if (trimmed === undefined || trimmed.length === 0) process.exit(0);
|
|
463
|
-
const runtimeHome = process.env._CLAUDE_RUNTIME_HOME || "/home/agent";
|
|
464
|
-
const from = join(trimmed, process.env._CLAUDE_CRED_FILE);
|
|
465
|
-
const to = join(runtimeHome, process.env._CLAUDE_CRED_REL);
|
|
466
|
-
if (from === to) process.exit(0);
|
|
467
|
-
try {
|
|
468
|
-
mkdirSync(trimmed, { recursive: true });
|
|
469
|
-
mkdirSync(dirname(to), { recursive: true });
|
|
470
|
-
// Unconditionally (re)point the alias, matching the old ln -sfn: a
|
|
471
|
-
// pre-existing real file at the custom path would otherwise keep the token
|
|
472
|
-
// model-readable, which is exactly the exposure this aliasing closes.
|
|
473
|
-
try { rmSync(from); } catch { /* nothing to remove */ }
|
|
474
|
-
symlinkSync(to, from);
|
|
475
|
-
} catch (e) {
|
|
476
|
-
console.error("typeclaw-entrypoint: failed to alias custom Claude credentials:", String(e));
|
|
477
|
-
}
|
|
478
|
-
' || true
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
# seed_runtime_home copies the image-baked Claude Code / Codex CLI settings from
|
|
482
|
-
# the build-time HOME (/root) into the ephemeral runtime HOME. The Dockerfile
|
|
483
|
-
# writes ~/.claude.json, ~/.claude/settings.json, and ~/.codex/hooks.json against
|
|
484
|
-
# /root during \`docker build\`; once the runtime runs under HOME=$runtime_home
|
|
485
|
-
# those files would otherwise be invisible, silently disabling Claude onboarding
|
|
486
|
-
# state and both CLIs' completion hooks for claudeCode/codexCli users.
|
|
487
|
-
#
|
|
488
|
-
# Runs in the root setup phase (HOME is still /root), BEFORE the optional chown
|
|
489
|
-
# so copied files have the dynamic host ownership when the runtime drops
|
|
490
|
-
# privileges. \`cp -n\` keeps repeated shim execution idempotent within one
|
|
491
|
-
# container life; Docker removes this HOME with the container.
|
|
492
|
-
seed_runtime_home() {
|
|
493
|
-
_src="\${1:-/root}"
|
|
494
|
-
_dst="$2"
|
|
495
|
-
[ "$_src" = "$_dst" ] && return 0
|
|
496
|
-
mkdir -p "$_dst"
|
|
497
|
-
[ -f "$_src/.claude.json" ] && cp -n "$_src/.claude.json" "$_dst/.claude.json" 2>/dev/null || true
|
|
498
|
-
if [ -f "$_src/.claude/settings.json" ]; then
|
|
499
|
-
mkdir -p "$_dst/.claude"
|
|
500
|
-
cp -n "$_src/.claude/settings.json" "$_dst/.claude/settings.json" 2>/dev/null || true
|
|
501
|
-
fi
|
|
502
|
-
if [ -f "$_src/.codex/hooks.json" ]; then
|
|
503
|
-
mkdir -p "$_dst/.codex"
|
|
504
|
-
cp -n "$_src/.codex/hooks.json" "$_dst/.codex/hooks.json" 2>/dev/null || true
|
|
505
|
-
fi
|
|
506
|
-
unset _src _dst
|
|
507
|
-
}
|
|
508
|
-
|
|
509
430
|
start_xvfb() {
|
|
510
431
|
if ! command -v Xvfb >/dev/null 2>&1; then
|
|
511
432
|
return 0
|
|
@@ -575,8 +496,6 @@ fi
|
|
|
575
496
|
|
|
576
497
|
runtime_home="\${TYPECLAW_RUNTIME_HOME:-/home/agent}"
|
|
577
498
|
mkdir -p "$runtime_home"
|
|
578
|
-
seed_runtime_home "$HOME" "$runtime_home"
|
|
579
|
-
link_custom_claude_credentials
|
|
580
499
|
if [ -n "\${TYPECLAW_HOST_UID:-}" ] && [ -n "\${TYPECLAW_HOST_GID:-}" ]; then
|
|
581
500
|
chown -R "$TYPECLAW_HOST_UID:$TYPECLAW_HOST_GID" "$runtime_home"
|
|
582
501
|
fi
|
|
@@ -759,511 +678,26 @@ RUN SHARP_ARCH="$(case "$(uname -m)" in aarch64|arm64) echo arm64 ;; x86_64|amd6
|
|
|
759
678
|
"@img/sharp-libvips-linux-\${SHARP_ARCH}@1.2.4"
|
|
760
679
|
WORKDIR /agent`
|
|
761
680
|
|
|
762
|
-
//
|
|
763
|
-
//
|
|
764
|
-
// certificates from the baseline are guaranteed present) and before the
|
|
765
|
-
// entrypoint shim (which is always last). Omitted entirely when disabled.
|
|
766
|
-
//
|
|
767
|
-
// The Anthropic installer drops `claude` at `$HOME/.local/bin/claude` and
|
|
768
|
-
// emits a "~/.local/bin is not in your PATH" warning on every install on
|
|
769
|
-
// bun:1-slim (PATH out of the box is `/usr/local/sbin:/usr/local/bin:/usr/
|
|
770
|
-
// sbin:/usr/bin:/sbin:/bin:/usr/local/bun-node-fallback-bin`, no
|
|
771
|
-
// `~/.local/bin`). Without intervention, every `which claude` from the
|
|
772
|
-
// agent (and from the typeclaw-claude-code skill's verification step)
|
|
773
|
-
// returns empty. Symlink into `/usr/local/bin/` — already on PATH, matches
|
|
774
|
-
// what `cloudflared` does, survives `/root/.local/bin` getting rewritten
|
|
775
|
-
// by the installer's "update" path. The symlink resolves to the
|
|
776
|
-
// `~/.local/bin/claude` shim, which itself dereferences to the versioned
|
|
777
|
-
// binary under `~/.local/share/claude/versions/<ver>/`, so upgrades via
|
|
778
|
-
// `claude update` keep working without re-running this layer.
|
|
779
|
-
// `~/.claude.json` is Claude Code's internal state file (NOT
|
|
780
|
-
// `~/.claude/settings.json`, which is user-facing). On first run with an
|
|
781
|
-
// empty or missing file, `claude` enters a TTY-only theme picker:
|
|
782
|
-
// "Welcome to Claude Code … Choose the text style that looks best with
|
|
783
|
-
// your terminal" with 7 options. The picker is unskippable via CLI
|
|
784
|
-
// flags or env vars (no `--skip-onboarding`, no `--theme=dark`;
|
|
785
|
-
// `IS_DEMO=1` exists but has documented side effects). The single
|
|
786
|
-
// official escape hatch is writing `{"hasCompletedOnboarding": true,
|
|
787
|
-
// "theme": "dark"}` to `~/.claude.json` before the first launch —
|
|
788
|
-
// confirmed by Anthropic in multiple GitHub issues
|
|
789
|
-
// (anthropics/claude-code#4714, #8938, #13827) and the empirical
|
|
790
|
-
// answer used by metabase/metabase's `bin/claude-dangerous`, the
|
|
791
|
-
// `claudeCodeAlDevContainer` feature, and dozens of other Docker
|
|
792
|
-
// integrations.
|
|
793
|
-
//
|
|
794
|
-
// Without the pre-seed, the very first agent-driven `tmux new-session …
|
|
795
|
-
// claude` invocation hangs on the theme picker: the agent's
|
|
796
|
-
// `send-keys "<prompt>" Enter` arrives at the picker, gets interpreted
|
|
797
|
-
// as picker input, and never reaches claude's actual prompt. The
|
|
798
|
-
// `typeclaw-claude-code` skill is structured around a `Stop`-hook
|
|
799
|
-
// sentinel, which never fires while the picker is up, so the polling
|
|
800
|
-
// loop only learns of the hang at the 10-minute wall-clock budget.
|
|
801
|
-
// Pre-seeding here costs ~85 bytes on disk and zero runtime overhead.
|
|
802
|
-
//
|
|
803
|
-
// SCOPE: this seed is NECESSARY but not SUFFICIENT for a fully
|
|
804
|
-
// no-questions-asked first launch. Claude Code also shows two
|
|
805
|
-
// post-seed modal dialogs that this file deliberately does NOT
|
|
806
|
-
// pre-clear:
|
|
807
|
-
// 1. "Detected a custom API key from environment. Do you want to use
|
|
808
|
-
// this API key?" — fires when ANTHROPIC_API_KEY is set. Options
|
|
809
|
-
// `[No (recommended), Yes]`, focus on No, picker does NOT wrap.
|
|
810
|
-
// 2. Workspace trust ("Do you trust the files in this folder?") —
|
|
811
|
-
// fires on every new cwd. Options `[Yes, proceed, No, exit]`,
|
|
812
|
-
// focus on Yes.
|
|
813
|
-
// Both are kept as runtime decisions handled by the
|
|
814
|
-
// `typeclaw-claude-code` skill (see its "Driving the session" section,
|
|
815
|
-
// "Clear startup dialogs" step, which uses dialog-specific keystrokes
|
|
816
|
-
// because the picker doesn't wrap). Pre-seeding
|
|
817
|
-
// `hasTrustDialogAccepted` or `customApiKeyResponses.approved` here
|
|
818
|
-
// would silently widen the trust surface in ways the operator hasn't
|
|
819
|
-
// consented to — the seed's job is strictly cosmetic-wizard removal,
|
|
820
|
-
// not trust/permission preemption.
|
|
821
|
-
//
|
|
822
|
-
// `theme: "dark"` matches typeclaw's default TUI theme so the visual
|
|
823
|
-
// transition between the typeclaw TUI and a tmux-attached claude pane
|
|
824
|
-
// is consistent. Users on light terminals can override by editing
|
|
825
|
-
// `~/.claude.json` (which persists across container restarts only if
|
|
826
|
-
// they mount it; in the default container-ephemeral state it resets
|
|
827
|
-
// to this default on every rebuild, which is fine — `claude` reads
|
|
828
|
-
// the file at startup and the theme has no behavioral impact).
|
|
829
|
-
//
|
|
830
|
-
// `lastOnboardingVersion` is INTENTIONALLY OMITTED. ii-agent and a
|
|
831
|
-
// few other templates ship `lastOnboardingVersion: "1.0.30"`, but
|
|
832
|
-
// that value is version-coupled and goes stale on every Claude Code
|
|
833
|
-
// release. Empirically against Claude Code 2.1.146, the current
|
|
834
|
-
// `hasCompletedOnboarding: true` alone is honored without a version
|
|
835
|
-
// pin. If a future Claude version starts re-triggering the picker
|
|
836
|
-
// when the field is missing, capture `claude --version` output at
|
|
837
|
-
// build time and inject it then — don't hardcode a stale value.
|
|
838
|
-
//
|
|
839
|
-
// `installMethod: "native"` and `numStartups: 1` match the shape
|
|
840
|
-
// Claude Code itself writes after a clean first launch; keeping them
|
|
841
|
-
// makes our seed indistinguishable from a real post-onboarding state,
|
|
842
|
-
// which minimizes the chance of a future "if the file looks like
|
|
843
|
-
// agent-pre-seed, redo onboarding" detection heuristic landing on us.
|
|
844
|
-
//
|
|
845
|
-
// Built via `JSON.stringify` rather than a hand-written string
|
|
846
|
-
// literal so quote/escape bugs surface as TS errors at compile time,
|
|
847
|
-
// not as a corrupt `~/.claude.json` discovered only when the build
|
|
848
|
-
// runs. The `printf '%s\\n' '<JSON>'` shell pattern relies on the
|
|
849
|
-
// JSON containing no single quotes (true by construction — JSON.
|
|
850
|
-
// stringify only emits double quotes); a regression test parses the
|
|
851
|
-
// emitted JSON back to confirm.
|
|
852
|
-
const CLAUDE_CODE_ONBOARDING_SEED = JSON.stringify({
|
|
853
|
-
hasCompletedOnboarding: true,
|
|
854
|
-
theme: 'dark',
|
|
855
|
-
installMethod: 'native',
|
|
856
|
-
numStartups: 1,
|
|
857
|
-
})
|
|
858
|
-
|
|
859
|
-
// The Stop hook is what powers the typeclaw-claude-code skill's done-signal:
|
|
860
|
-
// the operator subagent spawns claude in a worktree, polls a sentinel file,
|
|
861
|
-
// and decides "turn done" from the file's contents. The hook was originally
|
|
862
|
-
// per-worktree (`<worktree>/.claude/settings.json` + `<worktree>/hook-on-
|
|
863
|
-
// stop.sh`), which meant the operator subagent wrote both files itself at
|
|
864
|
-
// delegation time. That worked when operator wrote the canonical shape —
|
|
865
|
-
// and silently failed when it didn't. Claude Code's settings parser
|
|
866
|
-
// ignores unknown keys, so wrong-shape configs (`{"hooks": {"onStop":
|
|
867
|
-
// "./script.sh"}}`, `{"hooks": {"Stop": "./script.sh"}}`,
|
|
868
|
-
// `{"hooks": {"Stop": [{"command": "./script.sh"}]}}` etc.) surface as
|
|
869
|
-
// "polling timed out at the 10-minute wall-clock budget" rather than as a
|
|
870
|
-
// parse error — the failure is invisible until you've already paid the
|
|
871
|
-
// budget. The skill's "do not simplify this JSON" warning helps but doesn't
|
|
872
|
-
// eliminate the slip: as long as an LLM has to write the JSON, an LLM can
|
|
873
|
-
// invent a shape.
|
|
874
|
-
//
|
|
875
|
-
// Move both pieces to Dockerfile-build time, where the JSON is constructed
|
|
876
|
-
// once via JSON.stringify and the shape can never drift from the operator's
|
|
877
|
-
// reading of the skill:
|
|
878
|
-
//
|
|
879
|
-
// 1. `/usr/local/bin/typeclaw-cc-stop-hook` — the hook script. Stable
|
|
880
|
-
// absolute path so the global settings.json can name it without
|
|
881
|
-
// worrying about $PATH. Reads stdin (Claude Code's Stop event JSON)
|
|
882
|
-
// and atomically writes `$PWD/sentinel.json` + touches `$PWD/.done`.
|
|
883
|
-
// The temp-file-then-rename keeps the read side from ever seeing a
|
|
884
|
-
// partial sentinel even if the polling loop races the write — same
|
|
885
|
-
// atomicity contract as the previous per-worktree script.
|
|
886
|
-
// 2. `~/.claude/settings.json` — the user-level (global) hook config.
|
|
887
|
-
// User-level hooks fire for every `claude` invocation regardless of
|
|
888
|
-
// cwd, so the operator's worktree no longer needs its own
|
|
889
|
-
// `.claude/settings.json`. (Claude Code merges hooks additively
|
|
890
|
-
// across scopes per docs.claude.com/en/docs/claude-code/settings —
|
|
891
|
-
// if a future user mounts their own `~/.claude/settings.json` with a
|
|
892
|
-
// different Stop hook, both fire in parallel rather than ours being
|
|
893
|
-
// clobbered.)
|
|
894
|
-
//
|
|
895
|
-
// Both files are written via JSON.stringify + heredoc; the JSON shape is
|
|
896
|
-
// validated by JSON.parse in dockerfile.test.ts, so a future edit that
|
|
897
|
-
// corrupts the structure fails the test, not the docker build (let alone
|
|
898
|
-
// the next delegation that runs against the broken hook). The previous
|
|
899
|
-
// per-worktree path is fully removed from the skill body; the only place
|
|
900
|
-
// the hook shape lives is here.
|
|
901
|
-
//
|
|
902
|
-
// IMPORTANT — \`$PWD\` vs \`$CLAUDE_PROJECT_DIR\`: an earlier version of this
|
|
903
|
-
// layer used \`$CLAUDE_PROJECT_DIR\`. Self-review caught this as a critical
|
|
904
|
-
// bug. \`CLAUDE_PROJECT_DIR\` is Claude Code's documented env var for "the
|
|
905
|
-
// project root" — but empirically (see anthropics/claude-code#27343 and
|
|
906
|
-
// #44450), inside a git worktree it resolves to the *main repo's* git
|
|
907
|
-
// root, NOT the worktree's path. The operator's flow is:
|
|
908
|
-
// git -C /agent worktree add /tmp/cc-<id> HEAD
|
|
909
|
-
// tmux new-session -d -s cc-<id> -c /tmp/cc-<id> claude
|
|
910
|
-
// So \`/tmp/cc-<id>\` is a registered worktree of \`/agent\`, and Claude
|
|
911
|
-
// Code would resolve \`CLAUDE_PROJECT_DIR=/agent\` — landing the sentinel
|
|
912
|
-
// in the live agent folder while the polling loop watches the worktree.
|
|
913
|
-
//
|
|
914
|
-
// The fix: write to \`$PWD\` instead. \`$PWD\` is set by every POSIX shell
|
|
915
|
-
// on every invocation (POSIX-required since IEEE 1003.1-1988), and it's
|
|
916
|
-
// the literal cwd Claude Code was invoked with — exactly the worktree
|
|
917
|
-
// path \`tmux -c\` set. \`CLAUDE_PROJECT_DIR\` is Anthropic-specific and
|
|
918
|
-
// has shifted semantics across versions per the cited bug reports; we
|
|
919
|
-
// deliberately avoid depending on it.
|
|
920
|
-
//
|
|
921
|
-
// PER-SESSION FILENAMES — concurrent-claude race safety: the Stop hook
|
|
922
|
-
// writes to \`sentinel-<session_id>.json\` and \`.done-<session_id>\`,
|
|
923
|
-
// not a fixed filename. session_id comes from Claude Code's Stop event
|
|
924
|
-
// JSON on stdin (\`BaseHookInputSchema.session_id\`, always present per
|
|
925
|
-
// the upstream schema). The operator learns the UUID by reading a
|
|
926
|
-
// \`.session-id\` file that a SessionStart hook (also baked here) writes
|
|
927
|
-
// at session-start time; see TYPECLAW_CC_SESSION_START_HOOK_SCRIPT
|
|
928
|
-
// below.
|
|
929
|
-
//
|
|
930
|
-
// The earlier shape used fixed \`sentinel.json\` + \`.done\` names, which
|
|
931
|
-
// is safe when each worktree has at most one claude session (today's
|
|
932
|
-
// only caller). But if two callers ever share a cwd — operator A and
|
|
933
|
-
// operator B both delegating in \`/agent\`, a future plugin that runs
|
|
934
|
-
// \`claude\` from a shared dir, or an out-of-band caller violating the
|
|
935
|
-
// "one worktree per delegation" invariant — both write to the same
|
|
936
|
-
// file and corrupt each other's state with no diagnostic. Per-session
|
|
937
|
-
// filenames make the race structurally impossible.
|
|
938
|
-
//
|
|
939
|
-
// WHY NOT \`claude --session-id <pre-generated-uuid>\`: an earlier
|
|
940
|
-
// iteration of this PR had the operator pre-generate a UUID and pass
|
|
941
|
-
// it via \`--session-id\`. Self-review caught that as a critical bug:
|
|
942
|
-
// per anthropics/claude-code#44607, the \`--session-id\` flag only
|
|
943
|
-
// controls the persistence/transcript UUID in \`-p\` (print) mode. In
|
|
944
|
-
// interactive mode (which the typeclaw-claude-code skill uses), the
|
|
945
|
-
// flag sets a separate telemetry/API ID while the CLI generates its
|
|
946
|
-
// own internal UUID for the transcript file and for the \`session_id\`
|
|
947
|
-
// field that hooks see. The pre-generated UUID and the hook's UUID
|
|
948
|
-
// don't match — the polling loop times out forever. The current
|
|
949
|
-
// design sidesteps this entirely: the operator does NOT pass
|
|
950
|
-
// \`--session-id\`; it lets claude generate its own UUID and learns it
|
|
951
|
-
// back via the \`.session-id\` file the SessionStart hook writes.
|
|
952
|
-
//
|
|
953
|
-
// session_id extraction: \`bun -e\` against the JSON payload. We use bun,
|
|
954
|
-
// NOT POSIX sed, because bun is guaranteed in the container (bun:1-slim
|
|
955
|
-
// base) and is a real JSON parser. A previous iteration used
|
|
956
|
-
// \`sed -n 's/.*"session_id":"\\([^"]*\\)".*/\\1/p'\` which is greedy and
|
|
957
|
-
// picks the LAST \`"session_id":"..."\` occurrence in the JSON.
|
|
958
|
-
// Claude Code's Stop event carries \`last_assistant_message\` which
|
|
959
|
-
// contains the assistant's prose — that prose can include the literal
|
|
960
|
-
// text \`"session_id":"<fake-uuid>"\` (the model might have been
|
|
961
|
-
// discussing session IDs!), which sed would extract instead of the
|
|
962
|
-
// top-level field. bun's JSON.parse picks the structural \`session_id\`
|
|
963
|
-
// regardless of what appears in nested string values. UUID-shape
|
|
964
|
-
// validation still applies downstream as defense-in-depth against
|
|
965
|
-
// path-traversal session_id values; malformed JSON or missing field
|
|
966
|
-
// falls back to "malformed" so the polling loop sees SOMETHING and
|
|
967
|
-
// can surface the corruption.
|
|
968
|
-
//
|
|
969
|
-
// FALLBACK FILENAMES — \`sentinel-malformed.json\` / \`.done-malformed\`:
|
|
970
|
-
// if session_id extraction fails or validation rejects the result, the
|
|
971
|
-
// hook writes to these fixed names. The operator's polling loop watches
|
|
972
|
-
// its own \`<sid>\` file (read from \`.session-id\`) and will time out —
|
|
973
|
-
// but the \`-malformed\` file exists on disk so a post-mortem inspector
|
|
974
|
-
// can tell "hook fired but session_id was bad" apart from "hook never
|
|
975
|
-
// fired at all."
|
|
976
|
-
//
|
|
977
|
-
// SECURITY/SCOPE: both hook scripts only touch files inside \`$PWD\`,
|
|
978
|
-
// with filenames validated to UUID shape or the fixed "malformed"
|
|
979
|
-
// fallback. Even with an adversarial \`session_id\` in the stdin
|
|
980
|
-
// payload, the worst case is "hook writes \`$PWD/sentinel-malformed.json\`"
|
|
981
|
-
// or "hook writes \`$PWD/.session-id\` containing 'malformed'" — never
|
|
982
|
-
// path traversal, never writes outside \`$PWD\`. The hooks run as root
|
|
983
|
-
// inside the container like every other in-container process; there is
|
|
984
|
-
// no privilege boundary to cross.
|
|
985
|
-
const TYPECLAW_CC_STOP_HOOK_PATH = '/usr/local/bin/typeclaw-cc-stop-hook'
|
|
986
|
-
const TYPECLAW_CC_SESSION_START_HOOK_PATH = '/usr/local/bin/typeclaw-cc-session-start-hook'
|
|
987
|
-
|
|
988
|
-
// SessionStart hook script. Fires when a session begins via
|
|
989
|
-
// startup/resume/clear/compact per the upstream lifecycle docs. Writes
|
|
990
|
-
// \`$PWD/.session-id\` containing the validated UUID, atomically.
|
|
991
|
-
//
|
|
992
|
-
// IMPORTANT — \`.session-id\` is a FAST PATH, not a precondition. Per
|
|
993
|
-
// anthropics/claude-code#11519, SessionStart can be SKIPPED entirely
|
|
994
|
-
// when workspace trust hasn't been accepted yet: debug logs show
|
|
995
|
-
// \`Skipping SessionStart:startup hook execution - workspace trust not
|
|
996
|
-
// accepted\`. For the typeclaw-claude-code skill flow, EVERY first
|
|
997
|
-
// invocation in a fresh worktree hits this — the trust dialog fires
|
|
998
|
-
// before any prompt can be sent. So \`.session-id\` may never appear
|
|
999
|
-
// pre-first-prompt. The skill instructs the operator to fall back to
|
|
1000
|
-
// reading session_id from the FIRST Stop hook's sentinel instead.
|
|
1001
|
-
// \`.session-id\` is still useful for sessions that were already
|
|
1002
|
-
// trusted (re-attaching to a running worktree, etc.) — when it
|
|
1003
|
-
// appears, the operator can skip the discovery step.
|
|
1004
|
-
//
|
|
1005
|
-
// IMPORTANT — \`compact\` can ROTATE the session_id. The upstream
|
|
1006
|
-
// behavior is documented in anthropics/claude-code#29094: a SessionStart
|
|
1007
|
-
// with \`source: "compact"\` is a NEW session linked via
|
|
1008
|
-
// \`parent_session_id\`. So \`.session-id\` can change mid-delegation if
|
|
1009
|
-
// a long claude session compacts itself. The operator's polling loop
|
|
1010
|
-
// must handle session_id rotation: a new \`.done-<different-uuid>\`
|
|
1011
|
-
// appearing means \`cc_session_id\` should update to the new value.
|
|
1012
|
-
const TYPECLAW_CC_SESSION_START_HOOK_SCRIPT = `#!/bin/sh
|
|
1013
|
-
# typeclaw SessionStart-hook for Claude Code. Stdin carries the
|
|
1014
|
-
# SessionStart event JSON. Writes \$PWD/.session-id with the session
|
|
1015
|
-
# UUID as a fast-path optimization (the operator falls back to
|
|
1016
|
-
# discovering session_id from the first Stop sentinel if .session-id
|
|
1017
|
-
# never appears — see anthropics/claude-code#11519). Rationale lives
|
|
1018
|
-
# in src/init/dockerfile.ts.
|
|
1019
|
-
#
|
|
1020
|
-
# Both temp filenames are PID-scoped (PID = \$\$) so two SessionStart
|
|
1021
|
-
# hooks firing concurrently in the same cwd don't race on the same
|
|
1022
|
-
# temp file.
|
|
1023
|
-
set -eu
|
|
1024
|
-
tmp_out="\${PWD}/.session-id.\$\$.tmp"
|
|
1025
|
-
trap 'rm -f "\$tmp_out"' EXIT
|
|
1026
|
-
sid=\$(bun -e 'try { const j = await new Response(Bun.stdin.stream()).json(); process.stdout.write(String(j.session_id ?? "")) } catch { process.stdout.write("") }')
|
|
1027
|
-
case "\$sid" in
|
|
1028
|
-
[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]-[0-9a-f][0-9a-f][0-9a-f][0-9a-f]-[0-9a-f][0-9a-f][0-9a-f][0-9a-f]-[0-9a-f][0-9a-f][0-9a-f][0-9a-f]-[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]) ;;
|
|
1029
|
-
*) sid=malformed ;;
|
|
1030
|
-
esac
|
|
1031
|
-
printf '%s\\n' "\$sid" > "\$tmp_out"
|
|
1032
|
-
mv "\$tmp_out" "\${PWD}/.session-id"
|
|
1033
|
-
trap - EXIT
|
|
1034
|
-
`
|
|
1035
|
-
|
|
1036
|
-
// Single-quoted heredoc so the body is delivered verbatim — no shell
|
|
1037
|
-
// expansion at build time. Runtime expansion of \`$PWD\`, \`$sid\`, etc.
|
|
1038
|
-
// is what we want, so the heredoc must NOT expand them during \`docker
|
|
1039
|
-
// build\`. POSIX \`<<'EOF'\` (quoted delimiter) is the canonical way to
|
|
1040
|
-
// get verbatim heredoc.
|
|
1041
|
-
//
|
|
1042
|
-
// Script flow:
|
|
1043
|
-
// 1. Buffer stdin to a temp file (we need to read it twice: once for
|
|
1044
|
-
// session_id extraction, once for the sentinel write).
|
|
1045
|
-
// 2. Extract session_id via POSIX sed. Result is matched against the
|
|
1046
|
-
// RFC-4122-style UUID regex (8-4-4-4-12 hex with dashes). Anything
|
|
1047
|
-
// that doesn't match — empty extraction, embedded escapes, path
|
|
1048
|
-
// traversal, missing field — falls through to "malformed".
|
|
1049
|
-
// 3. Atomic write: \`mv\` is POSIX-atomic on the same filesystem (we
|
|
1050
|
-
// stay inside \`$PWD\` so the temp and final paths share an fs).
|
|
1051
|
-
// 4. \`touch .done-<sid>\` AFTER the mv so a polling reader never sees
|
|
1052
|
-
// .done existing before sentinel.json — the polling loop watches
|
|
1053
|
-
// .done as the readiness signal.
|
|
1054
|
-
const TYPECLAW_CC_STOP_HOOK_SCRIPT = `#!/bin/sh
|
|
1055
|
-
# typeclaw Stop-hook for Claude Code. Stdin carries the Stop event JSON.
|
|
1056
|
-
# Writes per-session sentinel/.done files into \$PWD. Rationale (including
|
|
1057
|
-
# the security model, \$PWD semantics, and why bun-not-sed for JSON
|
|
1058
|
-
# extraction) lives in src/init/dockerfile.ts.
|
|
1059
|
-
set -eu
|
|
1060
|
-
tmp_in="\${PWD}/.cc-stop-hook-in.\$\$"
|
|
1061
|
-
trap 'rm -f "\$tmp_in"' EXIT
|
|
1062
|
-
cat > "\$tmp_in"
|
|
1063
|
-
sid=\$(bun -e 'try { const j = await Bun.file(process.argv[1]).json(); process.stdout.write(String(j.session_id ?? "")) } catch { process.stdout.write("") }' "\$tmp_in")
|
|
1064
|
-
case "\$sid" in
|
|
1065
|
-
[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]-[0-9a-f][0-9a-f][0-9a-f][0-9a-f]-[0-9a-f][0-9a-f][0-9a-f][0-9a-f]-[0-9a-f][0-9a-f][0-9a-f][0-9a-f]-[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]) ;;
|
|
1066
|
-
*) sid=malformed ;;
|
|
1067
|
-
esac
|
|
1068
|
-
mv "\$tmp_in" "\${PWD}/sentinel-\${sid}.json"
|
|
1069
|
-
trap - EXIT
|
|
1070
|
-
touch "\${PWD}/.done-\${sid}"
|
|
1071
|
-
`
|
|
1072
|
-
|
|
1073
|
-
// User-level Claude Code settings file; applies to every invocation
|
|
1074
|
-
// regardless of cwd. Registers BOTH the SessionStart hook (so the
|
|
1075
|
-
// operator can learn the session UUID) and the Stop hook (so the
|
|
1076
|
-
// operator can poll for turn-completion). Built via JSON.stringify
|
|
1077
|
-
// rather than a string literal so any future shape edit fails the
|
|
1078
|
-
// JSON.parse regression test, not the docker build (or worse, the
|
|
1079
|
-
// first failed delegation).
|
|
1080
|
-
//
|
|
1081
|
-
// SessionStart matcher \`startup|resume|clear|compact\`: covers all four
|
|
1082
|
-
// session-origin types per the upstream matcher reference. Stop has no
|
|
1083
|
-
// matcher support (always fires on every occurrence per the docs), so
|
|
1084
|
-
// \`matcher: "*"\` is the canonical "fire on every Stop" form.
|
|
1085
|
-
//
|
|
1086
|
-
// \`args: []\` is the exec-form trigger per docs.claude.com/en/docs/
|
|
1087
|
-
// claude-code/hooks: with \`args\` present, Claude Code runs the command
|
|
1088
|
-
// directly via execvp (kernel-handled shebang, no shell tokenization).
|
|
1089
|
-
// With \`args\` absent, Claude Code falls back to shell form (\`sh -c
|
|
1090
|
-
// "<command>"\`), which works for our absolute-path-no-special-chars
|
|
1091
|
-
// case but is fragile to any future path change. Exec form is the
|
|
1092
|
-
// canonical robust shape.
|
|
1093
|
-
const TYPECLAW_CC_GLOBAL_SETTINGS = JSON.stringify({
|
|
1094
|
-
hooks: {
|
|
1095
|
-
SessionStart: [
|
|
1096
|
-
{
|
|
1097
|
-
matcher: 'startup|resume|clear|compact',
|
|
1098
|
-
hooks: [{ type: 'command', command: TYPECLAW_CC_SESSION_START_HOOK_PATH, args: [] }],
|
|
1099
|
-
},
|
|
1100
|
-
],
|
|
1101
|
-
Stop: [
|
|
1102
|
-
{
|
|
1103
|
-
matcher: '*',
|
|
1104
|
-
hooks: [{ type: 'command', command: TYPECLAW_CC_STOP_HOOK_PATH, args: [] }],
|
|
1105
|
-
},
|
|
1106
|
-
],
|
|
1107
|
-
},
|
|
1108
|
-
})
|
|
1109
|
-
|
|
681
|
+
// The pinned native executable must live entirely under /usr, which bwrap binds.
|
|
682
|
+
// Subscription compatibility is qualified by the live release gate, not --version.
|
|
1110
683
|
function renderClaudeCodeInstallLayer(enabled: boolean): string {
|
|
1111
684
|
if (!enabled) return ''
|
|
1112
|
-
return `# Layer 5.6 (toggle):
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
# Also pre-write the canonical Stop-hook config and helper script at
|
|
1118
|
-
# build time (see TYPECLAW_CC_STOP_HOOK_PATH above) so the operator
|
|
1119
|
-
# subagent never has to construct that JSON itself — the historically
|
|
1120
|
-
# failure-prone step where wrong-shape configs (\`onStop\`, bare-string
|
|
1121
|
-
# values, etc.) would silently disable the done-signal and burn the
|
|
1122
|
-
# polling loop's wall-clock budget. The seed write runs LAST in the
|
|
1123
|
-
# chain so the final layer state is exactly the seeded config —
|
|
1124
|
-
# independent of whether any earlier command (or a future Claude
|
|
1125
|
-
# version's \`--version\` smoke test) writes a default \`~/.claude.json\`
|
|
1126
|
-
# partway through the layer.
|
|
1127
|
-
RUN curl -fsSL https://claude.ai/install.sh | bash \\
|
|
1128
|
-
&& ln -sf "$HOME/.local/bin/claude" /usr/local/bin/claude \\
|
|
1129
|
-
&& claude --version > /dev/null \\
|
|
1130
|
-
&& cat > ${TYPECLAW_CC_SESSION_START_HOOK_PATH} <<'TYPECLAW_CC_SESSION_START_HOOK_EOF'
|
|
1131
|
-
${TYPECLAW_CC_SESSION_START_HOOK_SCRIPT}TYPECLAW_CC_SESSION_START_HOOK_EOF
|
|
1132
|
-
RUN cat > ${TYPECLAW_CC_STOP_HOOK_PATH} <<'TYPECLAW_CC_STOP_HOOK_EOF'
|
|
1133
|
-
${TYPECLAW_CC_STOP_HOOK_SCRIPT}TYPECLAW_CC_STOP_HOOK_EOF
|
|
1134
|
-
RUN chmod +x ${TYPECLAW_CC_SESSION_START_HOOK_PATH} ${TYPECLAW_CC_STOP_HOOK_PATH} \\
|
|
1135
|
-
&& mkdir -p "$HOME/.claude" \\
|
|
1136
|
-
&& printf '%s\\n' '${TYPECLAW_CC_GLOBAL_SETTINGS}' > "$HOME/.claude/settings.json" \\
|
|
1137
|
-
&& printf '%s\\n' '${CLAUDE_CODE_ONBOARDING_SEED}' > "$HOME/.claude.json"`
|
|
685
|
+
return `# Layer 5.6 (toggle): brokered headless Claude Code.
|
|
686
|
+
RUN curl -fsSL https://claude.ai/install.sh | bash -s -- ${CLAUDE_CODE_VERSION} \\
|
|
687
|
+
&& install -D -m 0755 "$(readlink -f "$HOME/.local/bin/claude")" /usr/local/lib/typeclaw-coding-agents/claude/${CLAUDE_CODE_VERSION}/claude \\
|
|
688
|
+
&& ln -sf /usr/local/lib/typeclaw-coding-agents/claude/${CLAUDE_CODE_VERSION}/claude /usr/local/bin/claude \\
|
|
689
|
+
&& claude --version > /dev/null`
|
|
1138
690
|
}
|
|
1139
691
|
|
|
1140
|
-
//
|
|
1141
|
-
// \`@openai/codex\` (https://www.npmjs.com/package/@openai/codex). Unlike
|
|
1142
|
-
// Claude Code's \`curl | bash\` install, Codex installs cleanly via the same
|
|
1143
|
-
// bun-global path agent-browser uses, so we layer it under the existing
|
|
1144
|
-
// \`bun install -g\` invariant: cache-mount keyed install, no \$HOME/.local/bin
|
|
1145
|
-
// symlink dance, no installer scratch.
|
|
1146
|
-
//
|
|
1147
|
-
// Hook architecture: Codex CLI ships a hook system with the SAME event names
|
|
1148
|
-
// as Claude Code (SessionStart, Stop, PreToolUse, PostToolUse, etc.) and the
|
|
1149
|
-
// SAME JSON shape (\`{ session_id, transcript_path, cwd, hook_event_name }\` on
|
|
1150
|
-
// stdin). The two CLIs are NOT interoperable — Codex's config file is
|
|
1151
|
-
// \`~/.codex/hooks.json\` (or inline \`[hooks]\` in \`config.toml\`), and the trust
|
|
1152
|
-
// model differs (Codex prompts for hook trust on first run, gated by
|
|
1153
|
-
// \`--dangerously-bypass-hook-trust\`). But the hook script body, the
|
|
1154
|
-
// per-session filenames (\`.done-<sid>\`, \`sentinel-<sid>.json\`), the
|
|
1155
|
-
// \`.session-id\` fast path, and the \`malformed\` fallback are byte-for-byte
|
|
1156
|
-
// reusable. We deliberately use distinct paths (\`typeclaw-cx-*\` instead of
|
|
1157
|
-
// \`typeclaw-cc-*\`) and a distinct settings file (\`~/.codex/hooks.json\` vs
|
|
1158
|
-
// \`~/.claude/settings.json\`) so an agent with BOTH toggles on doesn't have
|
|
1159
|
-
// the two CLIs racing on the same sentinel files. The skill side
|
|
1160
|
-
// (\`typeclaw-codex-cli\`) documents which UUID-bearing artifacts belong to
|
|
1161
|
-
// which CLI.
|
|
1162
|
-
//
|
|
1163
|
-
// Onboarding: Codex has NO theme picker, NO telemetry consent dialog, NO
|
|
1164
|
-
// terms-of-service prompt — verified against
|
|
1165
|
-
// codex-rs/tui/src/onboarding/onboarding_screen.rs in the upstream repo.
|
|
1166
|
-
// The TUI's onboarding state machine has exactly three steps: Welcome,
|
|
1167
|
-
// Auth, TrustDirectory. We CAN'T pre-seed past Welcome (it's an animation,
|
|
1168
|
-
// not a prompt), and we DELIBERATELY don't pre-seed past Auth (the user
|
|
1169
|
-
// must paste their OPENAI_API_KEY or run \`codex login\` themselves) or past
|
|
1170
|
-
// TrustDirectory (trusting an arbitrary worktree silently widens the trust
|
|
1171
|
-
// surface in ways the operator hasn't consented to — exact same reasoning
|
|
1172
|
-
// as Claude Code's "don't preseed hasTrustDialogAccepted"). The
|
|
1173
|
-
// \`typeclaw-codex-cli\` skill handles all three at runtime via dialog
|
|
1174
|
-
// polling, the same shape Claude Code's skill uses for its post-seed
|
|
1175
|
-
// modals.
|
|
1176
|
-
//
|
|
1177
|
-
// Smoke test: \`codex --version\` is supported per codex-rs/cli/src/main.rs
|
|
1178
|
-
// (clap \`version\` attribute), so we use it as the build-time install check.
|
|
1179
|
-
const TYPECLAW_CX_STOP_HOOK_PATH = '/usr/local/bin/typeclaw-cx-stop-hook'
|
|
1180
|
-
const TYPECLAW_CX_SESSION_START_HOOK_PATH = '/usr/local/bin/typeclaw-cx-session-start-hook'
|
|
1181
|
-
|
|
1182
|
-
const TYPECLAW_CX_SESSION_START_HOOK_SCRIPT = `#!/bin/sh
|
|
1183
|
-
# typeclaw SessionStart-hook for Codex CLI. Stdin carries the SessionStart
|
|
1184
|
-
# event JSON. Writes \$PWD/.session-id with the session UUID as a fast-path
|
|
1185
|
-
# optimization (the operator falls back to discovering session_id from the
|
|
1186
|
-
# first Stop sentinel if .session-id never appears). Rationale lives in
|
|
1187
|
-
# src/init/dockerfile.ts.
|
|
1188
|
-
set -eu
|
|
1189
|
-
tmp_out="\${PWD}/.session-id.\$\$.tmp"
|
|
1190
|
-
trap 'rm -f "\$tmp_out"' EXIT
|
|
1191
|
-
sid=\$(bun -e 'try { const j = await new Response(Bun.stdin.stream()).json(); process.stdout.write(String(j.session_id ?? "")) } catch { process.stdout.write("") }')
|
|
1192
|
-
case "\$sid" in
|
|
1193
|
-
[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]-[0-9a-f][0-9a-f][0-9a-f][0-9a-f]-[0-9a-f][0-9a-f][0-9a-f][0-9a-f]-[0-9a-f][0-9a-f][0-9a-f][0-9a-f]-[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]) ;;
|
|
1194
|
-
*) sid=malformed ;;
|
|
1195
|
-
esac
|
|
1196
|
-
printf '%s\\n' "\$sid" > "\$tmp_out"
|
|
1197
|
-
mv "\$tmp_out" "\${PWD}/.session-id"
|
|
1198
|
-
trap - EXIT
|
|
1199
|
-
`
|
|
1200
|
-
|
|
1201
|
-
const TYPECLAW_CX_STOP_HOOK_SCRIPT = `#!/bin/sh
|
|
1202
|
-
# typeclaw Stop-hook for Codex CLI. Stdin carries the Stop event JSON.
|
|
1203
|
-
# Writes per-session sentinel/.done files into \$PWD. Rationale (the
|
|
1204
|
-
# security model, \$PWD semantics, and why bun-not-sed for JSON
|
|
1205
|
-
# extraction) lives in src/init/dockerfile.ts.
|
|
1206
|
-
set -eu
|
|
1207
|
-
tmp_in="\${PWD}/.cx-stop-hook-in.\$\$"
|
|
1208
|
-
trap 'rm -f "\$tmp_in"' EXIT
|
|
1209
|
-
cat > "\$tmp_in"
|
|
1210
|
-
sid=\$(bun -e 'try { const j = await Bun.file(process.argv[1]).json(); process.stdout.write(String(j.session_id ?? "")) } catch { process.stdout.write("") }' "\$tmp_in")
|
|
1211
|
-
case "\$sid" in
|
|
1212
|
-
[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]-[0-9a-f][0-9a-f][0-9a-f][0-9a-f]-[0-9a-f][0-9a-f][0-9a-f][0-9a-f]-[0-9a-f][0-9a-f][0-9a-f][0-9a-f]-[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]) ;;
|
|
1213
|
-
*) sid=malformed ;;
|
|
1214
|
-
esac
|
|
1215
|
-
mv "\$tmp_in" "\${PWD}/sentinel-\${sid}.json"
|
|
1216
|
-
trap - EXIT
|
|
1217
|
-
touch "\${PWD}/.done-\${sid}"
|
|
1218
|
-
`
|
|
1219
|
-
|
|
1220
|
-
// Codex CLI's hook config file lives at ~/.codex/hooks.json. The JSON shape
|
|
1221
|
-
// mirrors Claude Code's settings.json hooks block exactly — same nesting,
|
|
1222
|
-
// same matcher syntax, same exec-form via \`args: []\`. Built via
|
|
1223
|
-
// JSON.stringify so a shape edit fails the JSON.parse regression test, not
|
|
1224
|
-
// the docker build (or the first failed delegation).
|
|
1225
|
-
//
|
|
1226
|
-
// SessionStart matcher \`startup|resume\`: Codex documents \`startup\` and
|
|
1227
|
-
// \`resume\` as the two SessionStart sources (vs Claude Code's
|
|
1228
|
-
// \`startup|resume|clear|compact\` — Codex has no \`/clear\` command and no
|
|
1229
|
-
// auto-compaction in the same shape). Claude's broader matcher would not
|
|
1230
|
-
// be wrong but would match against events Codex never fires.
|
|
1231
|
-
const TYPECLAW_CX_GLOBAL_HOOKS = JSON.stringify({
|
|
1232
|
-
hooks: {
|
|
1233
|
-
SessionStart: [
|
|
1234
|
-
{
|
|
1235
|
-
matcher: 'startup|resume',
|
|
1236
|
-
hooks: [{ type: 'command', command: TYPECLAW_CX_SESSION_START_HOOK_PATH, args: [] }],
|
|
1237
|
-
},
|
|
1238
|
-
],
|
|
1239
|
-
Stop: [
|
|
1240
|
-
{
|
|
1241
|
-
matcher: '*',
|
|
1242
|
-
hooks: [{ type: 'command', command: TYPECLAW_CX_STOP_HOOK_PATH, args: [] }],
|
|
1243
|
-
},
|
|
1244
|
-
],
|
|
1245
|
-
},
|
|
1246
|
-
})
|
|
692
|
+
// Keep the JS launcher and native optional dependencies under the sandbox-visible /usr.
|
|
1247
693
|
|
|
1248
694
|
function renderCodexCliInstallLayer(enabled: boolean, buildKit: boolean): string {
|
|
1249
695
|
if (!enabled) return ''
|
|
1250
|
-
return `# Layer 5.7 (toggle):
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
# are pre-written at build time so the operator subagent never has to
|
|
1256
|
-
# construct that JSON itself — same load-bearing reason as the Claude
|
|
1257
|
-
# Code layer above.
|
|
1258
|
-
RUN ${bunCacheMount(buildKit)}bun install -g @openai/codex \\
|
|
1259
|
-
&& codex --version > /dev/null \\
|
|
1260
|
-
&& cat > ${TYPECLAW_CX_SESSION_START_HOOK_PATH} <<'TYPECLAW_CX_SESSION_START_HOOK_EOF'
|
|
1261
|
-
${TYPECLAW_CX_SESSION_START_HOOK_SCRIPT}TYPECLAW_CX_SESSION_START_HOOK_EOF
|
|
1262
|
-
RUN cat > ${TYPECLAW_CX_STOP_HOOK_PATH} <<'TYPECLAW_CX_STOP_HOOK_EOF'
|
|
1263
|
-
${TYPECLAW_CX_STOP_HOOK_SCRIPT}TYPECLAW_CX_STOP_HOOK_EOF
|
|
1264
|
-
RUN chmod +x ${TYPECLAW_CX_SESSION_START_HOOK_PATH} ${TYPECLAW_CX_STOP_HOOK_PATH} \\
|
|
1265
|
-
&& mkdir -p "$HOME/.codex" \\
|
|
1266
|
-
&& printf '%s\\n' '${TYPECLAW_CX_GLOBAL_HOOKS}' > "$HOME/.codex/hooks.json"`
|
|
696
|
+
return `# Layer 5.7 (toggle): brokered headless Codex CLI.
|
|
697
|
+
RUN ${bunCacheMount(buildKit)}BUN_INSTALL=/usr/local/lib/typeclaw-coding-agents/codex BUN_INSTALL_BIN=/usr/local/lib/typeclaw-coding-agents/codex/bin bun install -g @openai/codex@${CODEX_CLI_VERSION} \\
|
|
698
|
+
&& printf '%s\\n' '#!/bin/sh' 'exec /usr/local/bin/bun /usr/local/lib/typeclaw-coding-agents/codex/bin/codex "$@"' > /usr/local/bin/codex \\
|
|
699
|
+
&& chmod 0755 /usr/local/bin/codex \\
|
|
700
|
+
&& codex --version > /dev/null`
|
|
1267
701
|
}
|
|
1268
702
|
|
|
1269
703
|
// Shared-library runtime deps Chrome for Testing needs to launch on amd64
|
|
@@ -1353,6 +787,8 @@ export function buildDockerfile(
|
|
|
1353
787
|
|
|
1354
788
|
const claudeCodeLayer = renderClaudeCodeInstallLayer(config.claudeCode)
|
|
1355
789
|
const codexCliLayer = renderCodexCliInstallLayer(config.codexCli, buildKit)
|
|
790
|
+
const omoCliLayer = renderOmoCliInstallLayer(config.omoCli)
|
|
791
|
+
const browserLayers = renderBrowserLayers(options.browser ?? { engines: ['agent-browser'], extensions: [] })
|
|
1356
792
|
const fromAndHeavyLayers =
|
|
1357
793
|
baseImageVersion !== null
|
|
1358
794
|
? renderVersionedHead(
|
|
@@ -1362,9 +798,20 @@ export function buildDockerfile(
|
|
|
1362
798
|
cloudflaredLayer,
|
|
1363
799
|
claudeCodeLayer,
|
|
1364
800
|
codexCliLayer,
|
|
801
|
+
omoCliLayer,
|
|
802
|
+
browserLayers,
|
|
803
|
+
buildKit,
|
|
804
|
+
)
|
|
805
|
+
: renderInlineHead(
|
|
806
|
+
ghKeyringLayer,
|
|
807
|
+
toggleAptArgs,
|
|
808
|
+
cloudflaredLayer,
|
|
809
|
+
claudeCodeLayer,
|
|
810
|
+
codexCliLayer,
|
|
811
|
+
omoCliLayer,
|
|
812
|
+
browserLayers,
|
|
1365
813
|
buildKit,
|
|
1366
814
|
)
|
|
1367
|
-
: renderInlineHead(ghKeyringLayer, toggleAptArgs, cloudflaredLayer, claudeCodeLayer, codexCliLayer, buildKit)
|
|
1368
815
|
|
|
1369
816
|
const header = buildKit ? `${BUILDKIT_HEADER}\n` : ''
|
|
1370
817
|
return `${header}# AUTOGENERATED by typeclaw — do not edit.
|
|
@@ -1416,19 +863,22 @@ function renderVersionedHead(
|
|
|
1416
863
|
cloudflaredLayer: string,
|
|
1417
864
|
claudeCodeLayer: string,
|
|
1418
865
|
codexCliLayer: string,
|
|
866
|
+
omoCliLayer: string,
|
|
867
|
+
browserLayers: string,
|
|
1419
868
|
buildKit: boolean,
|
|
1420
869
|
): string {
|
|
1421
870
|
const toggleAptLayer = toggleAptArgs.length === 0 ? '' : `${renderToggleAptInstallLayer(toggleAptArgs, buildKit)}\n\n`
|
|
1422
871
|
const cloudflaredBlock = cloudflaredLayer === '' ? '' : `${cloudflaredLayer}\n\n`
|
|
1423
872
|
const claudeCodeBlock = claudeCodeLayer === '' ? '' : `${claudeCodeLayer}\n\n`
|
|
1424
873
|
const codexCliBlock = codexCliLayer === '' ? '' : `${codexCliLayer}\n\n`
|
|
874
|
+
const omoCliBlock = omoCliLayer === '' ? '' : `${omoCliLayer}\n\n`
|
|
1425
875
|
return `FROM ${GHCR_BASE_IMAGE_REPO}:${baseImageVersion}
|
|
1426
876
|
|
|
1427
877
|
WORKDIR /agent
|
|
1428
878
|
|
|
1429
879
|
ARG TARGETARCH
|
|
1430
880
|
|
|
1431
|
-
${ghKeyringLayer}${toggleAptLayer}${cloudflaredBlock}${claudeCodeBlock}${codexCliBlock}${renderEntrypointShimLayer()}
|
|
881
|
+
${ghKeyringLayer}${toggleAptLayer}${cloudflaredBlock}${claudeCodeBlock}${codexCliBlock}${omoCliBlock}${browserLayers}${renderEntrypointShimLayer()}
|
|
1432
882
|
${renderGitAskPassLayer()}
|
|
1433
883
|
|
|
1434
884
|
${LAYER_TRANSFORMERS_INSTALL}
|
|
@@ -1446,12 +896,15 @@ function renderInlineHead(
|
|
|
1446
896
|
cloudflaredLayer: string,
|
|
1447
897
|
claudeCodeLayer: string,
|
|
1448
898
|
codexCliLayer: string,
|
|
899
|
+
omoCliLayer: string,
|
|
900
|
+
browserLayers: string,
|
|
1449
901
|
buildKit: boolean,
|
|
1450
902
|
): string {
|
|
1451
903
|
const baselineAndToggleArgs = [...BASELINE_APT_PACKAGES, ...toggleAptArgs]
|
|
1452
904
|
const cloudflaredBlock = cloudflaredLayer === '' ? '' : `${cloudflaredLayer}\n\n`
|
|
1453
905
|
const claudeCodeBlock = claudeCodeLayer === '' ? '' : `${claudeCodeLayer}\n\n`
|
|
1454
906
|
const codexCliBlock = codexCliLayer === '' ? '' : `${codexCliLayer}\n\n`
|
|
907
|
+
const omoCliBlock = omoCliLayer === '' ? '' : `${omoCliLayer}\n\n`
|
|
1455
908
|
return `${FROM_AND_WORKDIR}
|
|
1456
909
|
|
|
1457
910
|
# Layers are ordered most-stable first to maximize Docker layer cache hits on
|
|
@@ -1492,7 +945,7 @@ ${LAYER_4_5_AGENT_BROWSER_HEADED_WRAPPER}
|
|
|
1492
945
|
|
|
1493
946
|
${renderChromeForTestingLayer()}
|
|
1494
947
|
|
|
1495
|
-
${cloudflaredBlock}${claudeCodeBlock}${codexCliBlock}${renderEntrypointShimLayer()}
|
|
948
|
+
${cloudflaredBlock}${claudeCodeBlock}${codexCliBlock}${omoCliBlock}${browserLayers}${renderEntrypointShimLayer()}
|
|
1496
949
|
${renderGitAskPassLayer()}
|
|
1497
950
|
|
|
1498
951
|
${LAYER_TRANSFORMERS_INSTALL}
|
|
@@ -1601,8 +1054,10 @@ const bunCacheMount = (buildKit: boolean): string => (buildKit ? BUN_CACHE_MOUNT
|
|
|
1601
1054
|
// resolving to Bun 1.4.0 the day it shipped — that would put an unvalidated
|
|
1602
1055
|
// runtime in every container while CI still tested 1.3.14. Bump this in the
|
|
1603
1056
|
// same change as the `bun-version:` pins in .github/workflows/*.yml so the
|
|
1604
|
-
// host-stage checks and the container-stage runtime never disagree.
|
|
1605
|
-
|
|
1057
|
+
// host-stage checks and the container-stage runtime never disagree. The
|
|
1058
|
+
// version itself lives in `TESTED_BUN_VERSION`, which also drives the host-Bun
|
|
1059
|
+
// warning in `typeclaw doctor` and the host daemon log.
|
|
1060
|
+
export const BUN_BASE_IMAGE = `oven/bun:${TESTED_BUN_VERSION}-slim`
|
|
1606
1061
|
|
|
1607
1062
|
const FROM_AND_WORKDIR = `FROM ${BUN_BASE_IMAGE}
|
|
1608
1063
|
|
|
@@ -1639,18 +1094,50 @@ RUN ARCH_TARBALL="$(if [ "$TARGETARCH" = "arm64" ]; then echo aarch64-linux-gnu;
|
|
|
1639
1094
|
&& rm curl-impersonate.tar.gz \\
|
|
1640
1095
|
&& /usr/local/bin/curl_${CURL_IMPERSONATE_PROFILE} --version > /dev/null`
|
|
1641
1096
|
|
|
1642
|
-
|
|
1643
|
-
|
|
1097
|
+
// Everything agent-browser needs at runtime lives under /usr: the model's
|
|
1098
|
+
// bwrap sandbox binds /usr but not /root, and its PATH has no `node`.
|
|
1099
|
+
const AGENT_BROWSER_ROOT = '/usr/local/lib/typeclaw-agent-browser'
|
|
1100
|
+
const AGENT_BROWSER_PACKAGE = `${AGENT_BROWSER_ROOT}/install/global/node_modules/agent-browser`
|
|
1101
|
+
// Stable browser path for both arches: a launcher that execs the real
|
|
1102
|
+
// browser, linked at AGENT_BROWSER_CHROME_BIN (apt chromium on arm64, Chrome
|
|
1103
|
+
// for Testing on amd64 in Layer 5).
|
|
1104
|
+
const AGENT_BROWSER_CHROME = `${AGENT_BROWSER_ROOT}/chrome`
|
|
1105
|
+
const AGENT_BROWSER_CHROME_BIN = `${AGENT_BROWSER_ROOT}/chrome-bin`
|
|
1106
|
+
|
|
1107
|
+
// The launcher adds --no-sandbox because Chromium's own sandbox cannot start
|
|
1108
|
+
// inside the model's bwrap sandbox: with the default proc-bind strategy /proc
|
|
1109
|
+
// is read-only, so Chromium's user-namespace sandbox cannot write
|
|
1110
|
+
// /proc/self/uid_map, and there is no setuid chrome-sandbox. agent-browser
|
|
1111
|
+
// only auto-adds --no-sandbox when it detects root or a container
|
|
1112
|
+
// (/.dockerenv, /proc/1/cgroup), and none of that is visible inside bwrap.
|
|
1113
|
+
// bwrap stays the isolation boundary for the browser. The flag lives in the
|
|
1114
|
+
// launcher, not AGENT_BROWSER_ARGS, because a CLI --args replaces that env
|
|
1115
|
+
// value wholesale and would silently drop it.
|
|
1116
|
+
const LAYER_3_AGENT_BROWSER_ARM64_CONFIG = `# Layer 3 (stable): point agent-browser at a browser launcher visible inside
|
|
1117
|
+
# the sandbox. arm64 links the apt chromium; amd64 links Chrome for Testing in
|
|
1118
|
+
# Layer 5. Independent of the npm install below so it stays cached across
|
|
1644
1119
|
# agent-browser version bumps.
|
|
1645
|
-
RUN
|
|
1646
|
-
|
|
1647
|
-
|
|
1120
|
+
RUN mkdir -p ${AGENT_BROWSER_ROOT} \\
|
|
1121
|
+
&& printf '%s\\n' '#!/bin/sh' 'exec ${AGENT_BROWSER_CHROME_BIN} --no-sandbox "$@"' > ${AGENT_BROWSER_CHROME} \\
|
|
1122
|
+
&& chmod 0755 ${AGENT_BROWSER_CHROME} \\
|
|
1123
|
+
&& if [ "$TARGETARCH" = "arm64" ]; then \\
|
|
1124
|
+
ln -sf /usr/bin/chromium ${AGENT_BROWSER_CHROME_BIN}; \\
|
|
1648
1125
|
fi`
|
|
1649
1126
|
|
|
1127
|
+
// Layer 4: the npm tarball ships the native binaries without the exec bit and
|
|
1128
|
+
// the JS launcher chmods them on first run, which fails on the read-only /usr
|
|
1129
|
+
// inside the sandbox, so set it at build time. The launcher runs under bun
|
|
1130
|
+
// because the image's `node` fallback is outside the sandbox PATH, and it
|
|
1131
|
+
// defaults the browser path itself because the sandbox clears image ENV.
|
|
1132
|
+
// An inherited AGENT_BROWSER_EXECUTABLE_PATH (operator .env) still wins.
|
|
1650
1133
|
const renderAgentBrowserInstallLayer = (buildKit: boolean): string =>
|
|
1651
|
-
`# Layer 4 (volatile): install agent-browser
|
|
1652
|
-
# runtime bind-mount over /agent/node_modules.
|
|
1653
|
-
RUN ${bunCacheMount(buildKit)}bun install -g agent-browser@^0.
|
|
1134
|
+
`# Layer 4 (volatile): install agent-browser under /usr so it survives the
|
|
1135
|
+
# runtime bind-mount over /agent/node_modules and stays visible in bwrap.
|
|
1136
|
+
RUN ${bunCacheMount(buildKit)}BUN_INSTALL=${AGENT_BROWSER_ROOT} BUN_INSTALL_BIN=${AGENT_BROWSER_ROOT}/bin BUN_INSTALL_CACHE_DIR=/root/.bun/install/cache bun install -g agent-browser@^0.39.1 \\
|
|
1137
|
+
&& chmod 0755 ${AGENT_BROWSER_PACKAGE}/bin/agent-browser-linux-* \\
|
|
1138
|
+
&& printf '%s\\n' '#!/bin/sh' ': "\${AGENT_BROWSER_EXECUTABLE_PATH:=${AGENT_BROWSER_CHROME}}"' 'export AGENT_BROWSER_EXECUTABLE_PATH' 'exec /usr/local/bin/bun ${AGENT_BROWSER_PACKAGE}/bin/agent-browser.js "$@"' > /usr/local/bin/agent-browser \\
|
|
1139
|
+
&& chmod 0755 /usr/local/bin/agent-browser \\
|
|
1140
|
+
&& agent-browser --version > /dev/null`
|
|
1654
1141
|
|
|
1655
1142
|
// Layer 4.5: shim the agent-browser binary with a wrapper that calls
|
|
1656
1143
|
// \`agent-browser close\` before \`open\`/\`goto\`/\`navigate\` when headed
|
|
@@ -1773,7 +1260,8 @@ exec env _TYPECLAW_AGENT_BROWSER_HEADED_HANDLED=1 "$real" "$@"
|
|
|
1773
1260
|
TYPECLAW_AGENT_BROWSER_WRAPPER_EOF`
|
|
1774
1261
|
|
|
1775
1262
|
// Layer 5: download the pinned Chrome for Testing build into
|
|
1776
|
-
//
|
|
1263
|
+
// $HOME/.agent-browser/browsers/, with HOME pointed under /usr so the
|
|
1264
|
+
// sandbox can see it, then link it to the stable path. NO cache mount on that path because the
|
|
1777
1265
|
// runtime needs the binary in the image, and no apt cache mount either
|
|
1778
1266
|
// because nothing in this layer runs apt.
|
|
1779
1267
|
//
|
|
@@ -1787,9 +1275,30 @@ TYPECLAW_AGENT_BROWSER_WRAPPER_EOF`
|
|
|
1787
1275
|
const renderChromeForTestingLayer = (): string =>
|
|
1788
1276
|
`# Layer 5 (heavy, amd64 only): Chrome for Testing download.
|
|
1789
1277
|
RUN if [ "$TARGETARCH" != "arm64" ]; then \\
|
|
1790
|
-
agent-browser install
|
|
1278
|
+
HOME=${AGENT_BROWSER_ROOT} agent-browser install \\
|
|
1279
|
+
&& chrome="$(find ${AGENT_BROWSER_ROOT}/.agent-browser/browsers -type f -name chrome -perm -u+x | head -n 1)" \\
|
|
1280
|
+
&& [ -n "$chrome" ] \\
|
|
1281
|
+
&& ln -sf "$chrome" ${AGENT_BROWSER_CHROME_BIN}; \\
|
|
1791
1282
|
fi`
|
|
1792
1283
|
|
|
1284
|
+
function renderOmoCliInstallLayer(enabled: boolean): string {
|
|
1285
|
+
if (!enabled) return ''
|
|
1286
|
+
const root = `/usr/local/lib/typeclaw-coding-agents/omo/${OMO_CLI_VERSION}`
|
|
1287
|
+
return `# Pinned OmO Native: executable and symlink target stay inside /usr.
|
|
1288
|
+
RUN case "\${TARGETARCH:-$(uname -m)}" in \\
|
|
1289
|
+
arm64|aarch64) asset=omo-linux-arm64; sha=87dc0f001e5821599bda889d55b10655136623ba5b74a804bae0edcdc4ce50b2 ;; \\
|
|
1290
|
+
amd64|x86_64) asset=omo-linux-x64-baseline; sha=df4ca3223fe600d3b497f9fbbe759052a11ae9300a9cb965834a8942d5747fc7 ;; \\
|
|
1291
|
+
*) echo "Unsupported OmO architecture" >&2; exit 1 ;; \\
|
|
1292
|
+
esac \\
|
|
1293
|
+
&& mkdir -p ${root} \\
|
|
1294
|
+
&& curl -fsSL "https://github.com/code-yeongyu/oh-my-openagent/releases/download/v${OMO_CLI_VERSION}/\${asset}" -o ${root}/omo \\
|
|
1295
|
+
&& echo "\${sha} ${root}/omo" | sha256sum -c - \\
|
|
1296
|
+
&& chmod 0755 ${root}/omo \\
|
|
1297
|
+
&& ln -sf ${root}/omo /usr/local/bin/omo \\
|
|
1298
|
+
&& HOME=/tmp/typeclaw-omo-smoke PI_OFFLINE=1 PI_SKIP_VERSION_CHECK=1 PI_TELEMETRY=0 DO_NOT_TRACK=1 OMO_SEND_ANONYMOUS_TELEMETRY=0 omo --version \\
|
|
1299
|
+
&& rm -rf /tmp/typeclaw-omo-smoke`
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1793
1302
|
function defaultConfig(): DockerfileConfig {
|
|
1794
1303
|
return {
|
|
1795
1304
|
ffmpeg: false,
|
|
@@ -1801,6 +1310,7 @@ function defaultConfig(): DockerfileConfig {
|
|
|
1801
1310
|
xvfb: true,
|
|
1802
1311
|
claudeCode: false,
|
|
1803
1312
|
codexCli: false,
|
|
1313
|
+
omoCli: false,
|
|
1804
1314
|
append: [],
|
|
1805
1315
|
}
|
|
1806
1316
|
}
|