Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
8543a5b
feat: add model-only offline mode
anandgupta42 Nov 21, 2026
1fb5527
fix: bypass inherited proxies in offline mode
anandgupta42 Nov 21, 2026
b1245bd
fix: gate direct shell entry points in offline mode
anandgupta42 Nov 21, 2026
c4d318c
fix: keep offline tool runs out of online daemons
anandgupta42 Nov 21, 2026
e749ec6
fix: close offline startup and subprocess gaps
anandgupta42 Nov 21, 2026
866ad87
fix: keep offline gating separate from account state
anandgupta42 Nov 21, 2026
026d63f
fix: close remaining offline egress paths
anandgupta42 Nov 21, 2026
843dc3e
fix: finish offline config, skill, and share guards
anandgupta42 Nov 21, 2026
ef47e04
fix: block ripgrep downloads and Git snapshot filters offline
anandgupta42 Nov 21, 2026
ff68bba
fix: skip working-tree Git filters offline
anandgupta42 Nov 21, 2026
890417a
fix: preserve early MCP stdio startup and refuse offline browser launch
anandgupta42 Nov 21, 2026
27c9af2
fix: allow only Git metadata reads in offline mode
anandgupta42 Nov 21, 2026
1ed8928
fix: isolate offline gates from sibling changes
anandgupta42 Nov 21, 2026
053c129
Keep local analysis tools available in offline mode
anandgupta42 Nov 21, 2026
9ee08fd
Tighten offline connection and startup checks
anandgupta42 Nov 21, 2026
69e6061
Preserve env interpolation in offline startup detection
anandgupta42 Nov 21, 2026
251c176
Address offline transport and local tooling review findings
anandgupta42 Nov 21, 2026
e331f02
Address offline provider and workspace review findings
anandgupta42 Nov 21, 2026
3d58d96
Keep compatible models and workspace changes working offline
anandgupta42 Nov 21, 2026
073cf78
Keep offline background calls on the configured model
anandgupta42 Nov 21, 2026
f6e4ca6
Seed the offline DuckDB fixture through the SQL runner
anandgupta42 Nov 21, 2026
86d9c6e
Close offline transport gaps and cover local cache behavior
anandgupta42 Nov 21, 2026
4e6a6c8
fix: limit offline mode to network egress
anandgupta42 Nov 21, 2026
4db67d8
chore: mark offline changes in upstream-shared files
anandgupta42 Nov 21, 2026
3a79399
fix: address offline review findings
anandgupta42 Nov 21, 2026
34fd556
fix: close remaining offline review gaps
anandgupta42 Nov 21, 2026
5f09cb9
fix: refuse offline deletion of shared sessions visibly
anandgupta42 Nov 21, 2026
6761808
fix: address offline bot review round
anandgupta42 Nov 21, 2026
cea796a
chore: mark offline worktree start command change
anandgupta42 Nov 21, 2026
117b1fe
fix: report offline refusals to API clients
anandgupta42 Nov 21, 2026
17894fa
fix: restore proxy settings for every language server offline
anandgupta42 Nov 21, 2026
c527bfa
fix: type offline session refusals and close dbt gaps
anandgupta42 Nov 21, 2026
43607e4
fix: refuse offline sharing before the config check
anandgupta42 Nov 21, 2026
4f178f4
fix: declare offline session refusals in the API contract
anandgupta42 Nov 21, 2026
a7b56d1
test: cover offline workspace tools and templated dbt roots
anandgupta42 Nov 21, 2026
6581848
fix: reset offline worktrees with unpopulated submodules
anandgupta42 Nov 21, 2026
c25ebbf
fix: refuse offline unshare in the service and share the libpq list
anandgupta42 Nov 21, 2026
7ea362a
fix: keep submodule paths whole in offline worktree reset
anandgupta42 Nov 21, 2026
3899993
fix: share offline share messages and match libpq names on Windows
anandgupta42 Nov 21, 2026
6886cd5
fix: skip dbt version probes offline
anandgupta42 Nov 21, 2026
17c40b6
fix: run offline dbt version probes behind a closed loopback proxy
anandgupta42 Nov 21, 2026
93fd3f6
fix: keep offline dbt detection when the version probe fails
anandgupta42 Nov 21, 2026
7acb3ad
fix: refuse offline removal of a workspace with a shared session
anandgupta42 Nov 21, 2026
7887586
fix: check whole session trees before offline workspace removal
anandgupta42 Nov 21, 2026
4749789
fix: restore proxy settings for custom language servers offline
anandgupta42 Nov 21, 2026
3f6ecfd
fix: keep the invoking project offline policy for remote attach
anandgupta42 Nov 21, 2026
f947dbf
fix: unset the offline model for every user program
anandgupta42 Nov 21, 2026
09bbe9f
refactor: share one root session list in workspace removal
anandgupta42 Nov 21, 2026
9c40275
refactor: simplify offline mode to one module and remove its cost whe…
anandgupta42 Nov 21, 2026
4cff64a
fix: close review gaps in offline mode checks
anandgupta42 Nov 21, 2026
f628a31
fix: keep offline worktree reset off the network and tool order uncha…
anandgupta42 Nov 21, 2026
8d460fc
fix: narrow offline checks to the cases they can judge
anandgupta42 Nov 21, 2026
935f5dd
fix: keep caller redirect choices in the offline fetch guard
anandgupta42 Nov 21, 2026
5d1dda4
fix: find dbt on the current PATH in offline data tool detection
anandgupta42 Nov 21, 2026
d61a6e0
fix: match fetch redirect rules in the offline guard and refine git a…
anandgupta42 Nov 21, 2026
ceeada4
fix: follow only real redirects and drop credentials across origins i…
anandgupta42 Nov 21, 2026
612e151
fix: catch an escaped offline key at startup and correct offline docs
anandgupta42 Nov 21, 2026
c5fb862
fix: merge both proxy exclusion lists and strip redirect headers like…
anandgupta42 Nov 21, 2026
cc57dd5
docs: note remote skill URLs are unavailable offline; fold nested mar…
anandgupta42 Nov 21, 2026
f88a960
fix: close cubic findings on offline host, git, submodule and dbt han…
anandgupta42 Nov 21, 2026
1b3a0bd
fix: refuse SSH tunnels for file databases and non-HTTP Trino/ClickHo…
anandgupta42 Nov 21, 2026
362f7a4
fix: allow only local SQL Server sign-in offline and parse submodule …
anandgupta42 Nov 21, 2026
55becda
fix: refuse Oracle TNS aliases and hostless Oracle offline; scope pro…
anandgupta42 Nov 21, 2026
bef6160
fix(offline): close review gaps in local operations
anandgupta42 Nov 21, 2026
3a17d06
fix(offline): tighten local connection and Git checks
anandgupta42 Nov 21, 2026
6bdbc3c
fix: revalidate cached dbt adapters when offline mode activates
anandgupta42 Nov 21, 2026
be00b9e
fix(offline): handle local ports, MongoDB options and git flags
anandgupta42 Nov 21, 2026
68cfd9f
fix: reopen cached DuckDB when offline mode activates
anandgupta42 Nov 21, 2026
db57f08
refactor(offline): simplify local port validation
anandgupta42 Nov 21, 2026
0d2646e
test: give the offline MCP auth test a CI-safe timeout
anandgupta42 Nov 21, 2026
6e992bc
fix(offline): require startup opt-in
anandgupta42 Nov 21, 2026
d0b20db
fix(offline): honor managed config at startup
anandgupta42 Nov 21, 2026
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
58 changes: 58 additions & 0 deletions docs/docs/configure/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Configuration is loaded from multiple sources, with later sources overriding ear
| `$schema` | `string` | JSON schema URL for editor autocompletion |
| `theme` | `string` | UI theme name |
| `username` | `string` | Custom display username |
| `offline` | `boolean` | Restrict network access to the configured model endpoint |
| `model` | `string` | Default model (`provider/model`) |
| `small_model` | `string` | Smaller model for lightweight tasks |
| `default_agent` | `string` | Default agent to use on startup |
Expand Down Expand Up @@ -158,3 +159,60 @@ Control how context is managed when conversations grow long:

!!! info
Compaction automatically summarizes older messages to free up context window space, allowing longer conversations without losing important context. See [Context Management](context-management.md) for full details.

## Offline / air-gapped mode

Offline mode is for running Altimate Code against a local or self-hosted model with no other network access. Altimate Code then sends network requests only to the configured model endpoint and to services on this machine (loopback). Local work keeps running: tools, shell commands, local databases, language servers, local MCP servers and local Git.

With offline mode off, nothing in this section applies and Altimate Code behaves exactly as before.

### Turn it on

Set `ALTIMATE_OFFLINE=1` before starting Altimate Code, or add `"offline": true` to a global, project, or organisation-managed JSON or JSONC configuration file (or `OPENCODE_CONFIG_CONTENT`). Altimate Code checks those sources for the setting when it starts, so startup requests are covered too. If Altimate Code first sees `"offline": true` after the startup check, such as in macOS managed preferences (MDM), remote (well-known) configuration, account configuration, or the legacy TOML `config` file, it refuses to load the configuration and asks you to restart with `ALTIMATE_OFFLINE=1`. Any startup opt-in turns offline mode on for the whole process, regardless of a `false` value elsewhere. `ALTIMATE_OFFLINE` values of empty, `0`, `false`, `off` and `no` mean off. Once on, offline mode lasts for the rest of the process, including any server that loaded the project.

Configure a provider with an explicit HTTP(S) `options.baseURL` and use one of its models (`provider/model`). For an OpenAI-compatible server, use the bundled `@ai-sdk/openai-compatible` provider, and define the model under the provider if it is not in the bundled or cached catalog. Model requests go only to a provider's explicit `baseURL`, never to a catalog URL, and are not redirected. They respect `HTTPS_PROXY` and `HTTP_PROXY`. A `small_model` is used only if its provider also has an explicit `baseURL`.

### Before going offline

While still online:

- Run `altimate-code workspace refresh` to save the workspace skill snapshot. Offline runs use it as it is, without refreshing it.
- Install the warehouse drivers you need (the `warehouse_install_driver` tool), any language servers, and ripgrep.
- Run `dbt deps` for dbt projects, and install any DuckDB extensions your profiles use.

### What keeps working

- Local warehouses: DuckDB and SQLite files, and Postgres, Redshift, MySQL, MariaDB, SQL Server, ClickHouse, Trino, Oracle and MongoDB servers reached through a host of `localhost`, `::1` or `127.x.x.x`. Postgres and Redshift also accept a Unix socket directory as the host. For MongoDB, set `direct_connection: true` or add `directConnection=true` to the connection URI. Other hosts, connection strings that cannot be parsed (including Oracle Easy Connect strings; set `host` instead), and account-addressed warehouses such as Snowflake, BigQuery and Databricks are refused.
- dbt commands whose selected profile and target are local. Values written as Jinja templates (for example `{{ env_var('DBT_HOST') }}`) cannot be checked and are refused; write them literally to use them offline. dbt-duckdb profiles can use extensions, local attachments and plugins; settings that point at remote storage, a remote server or a remote extension repository (`s3://`, `https://`, `gcs://`, `md:` and similar) are refused. Named extensions and plugins are not checked: install extensions while online, and do not configure plugins that call remote services.
- DuckDB loads extensions that are already installed and does not install new ones automatically.
- The shell tool, installed language servers, stdio MCP servers and MCP servers at `localhost`, `127.0.0.1`, `[::1]` or `0.0.0.0`, including `tool run --daemon`.
- Git diffs, session snapshots and revert, and worktree create, remove and reset. Reset uses the locally cached base branch and updates checked-out top-level submodules from local objects. Nested submodules keep their current commits, and uninitialized submodules remain uninitialized. Reset discards local changes in all checked-out submodules, including nested ones. Worktree create and reset leave Git LFS files as pointer files.
- `attach` and `run --attach` to a server on this machine. The attached server applies its own policy, so start it with offline mode too.

### What is blocked

Each of these fails with a one-line message or is skipped:

- telemetry, account and remote configuration requests;
- model catalog downloads and update checks;
- workspace and workspace engine sync, and session sharing;
- the web fetch, web search, code search, `datamate_manager`, feedback and memory refresh tools;
- MCP servers at other URLs, and MCP sign-in;
- skills from remote skill URLs (`skills.urls`), including copies already cached;
- automatic installs of warehouse drivers, language servers, plugins and ripgrep;
- warehouse connections to other hosts, SSH tunnels, MongoDB SRV, replica-set discovery and MongoDB connection proxies, and cloud sign-in (SQL Server methods other than SQL or Windows login, MongoDB AWS/OIDC/Kerberos, dbt cloud methods);
- `dbt deps` and dbt's usage reporting and version check;
- `git clone`, `fetch`, `pull`, `push` and other Git commands that use a remote;
- commands that need a remote service, such as `github`, `pr`, `web`, `upgrade`, `review --post` and `attach` to another machine.

### What offline mode does not police

Programs you run or configure yourself keep their own network access and proxy settings: shell commands, language servers, local MCP servers and their child processes. Offline mode does not sandbox them. They inherit `ALTIMATE_OFFLINE=1`, so an `altimate-code` started from the shell is offline too, and `NO_PROXY` gains `localhost,127.0.0.1,[::1],0.0.0.0` so that local requests do not go through a proxy.

Some network use happens inside programs Altimate Code starts and is not checked either:

- Git in a partial (blobless or treeless) clone fetches missing objects on demand, even for local commands such as `diff`, and Git LFS can download missing objects during a checkout outside worktree reset.
- dbt reads libpq environment variables such as `PGHOSTADDR` and `PGSERVICE`, which can point a Postgres profile at another host.
- An offline TUI started with `--hostname` set to a LAN address or machine name cannot reach its own server; use the default or `0.0.0.0`.

SQL that runs an explicit `INSTALL`, or loads an installed network extension (such as `httpfs`) and reads a remote path, is not blocked. The `altimate-dbt` command runs through the shell tool and is not policed either, although it turns off its own dependency installs and usage reporting.
2 changes: 2 additions & 0 deletions docs/mcp-workspaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Workspace context adds bounded data to a client's prompt; skills load on demand.

Verification covers unit contracts, a real stdio protocol fixture and existing SQLite MCP behavior. A non-empty cloud memory round trip and real workspace-engine SQL and knowledge calls are not covered by tests yet.

In [offline mode](docs/configure/config.md#offline-air-gapped-mode), Altimate Code sessions use the local workspace skill snapshot. Refresh it with `altimate-code workspace refresh` while online. The external workspace gateway requires an online run.

## Automatic-client setup and stable gateway

The opt-in workspace catalog is always `workspace_context`, `workspace_skill` and `workspace_execute`, including when initially unlinked. `workspace_context` reports `needs_auth`, `needs_workspace`, `disabled` or `unavailable` without returning raw credential errors. A ready context includes the workspace receipt. Context loads coalesce and cache for 30 seconds; identity is verified on every use. `refresh: true` bypasses that cache.
Expand Down
5 changes: 5 additions & 0 deletions packages/core/src/flag/flag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ export function env(key: string): string | undefined {
return documented !== undefined && documented !== "" ? documented : process.env[key]
}

export function offlineModeEnabled() {
const value = process.env.ALTIMATE_OFFLINE?.trim().toLowerCase()
return killSwitchSet(value) && value !== "off" && value !== "no"
}

export function truthy(key: string) {
const value = env(key)?.toLowerCase()
return value === "true" || value === "1"
Expand Down
37 changes: 37 additions & 0 deletions packages/core/src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,39 @@ import { AbsolutePath } from "./schema"
import { FSUtil } from "./fs-util"
import { AppProcess } from "./process"
import { LayerNode } from "./effect/layer-node"
// altimate_change start — offline mode refuses Git commands that use the network
import { offlineModeEnabled } from "./flag/flag"

const remoteCommands = new Set(["clone", "fetch", "pull", "push", "ls-remote", "send-pack", "fetch-pack", "submodule--helper"])

export function gitCommandUsesNetwork(args: string[]) {
let index = 0
while (args[index]?.startsWith("-")) {
index += ["-c", "-C", "--git-dir", "--work-tree", "--namespace", "--config-env"].includes(args[index]) ? 2 : 1
}
const [command, ...after] = args.slice(index)
// The operation is the first word after the subcommand's own options (`submodule --quiet update`).
const at = after.findIndex((arg) => !arg.startsWith("-"))
const operation = at === -1 ? "" : after[at]
const rest = at === -1 ? after : [...after.slice(0, at), ...after.slice(at + 1)]
// Git runs foreach through a shell. Allow only these literal local commands.
if (command === "submodule" && operation === "foreach") {
const nested = rest.findIndex((arg) => arg === "--" || !arg.startsWith("-"))
return nested === -1 || !["git reset --hard", "git clean -fdx", "git status"].includes(rest.slice(nested).join(" "))
}
return (
remoteCommands.has(command) ||
(command === "remote" && (operation === "update" || (operation === "show" && !rest.includes("-n")))) ||
(command === "submodule" && ["update", "add"].includes(operation)) ||
(command === "remote" && operation === "add" && rest.some((arg) => arg === "-f" || arg === "--fetch")) ||
(command === "remote" && (operation === "prune" || (operation === "set-head" && rest.some((arg) => arg === "-a" || arg === "--auto")))) ||
(command === "lfs" && ["fetch", "pull", "push", "clone"].includes(operation)) ||
(command === "archive" && [operation, ...rest].some((arg) => arg?.startsWith("--remote")))
)
}

export const GIT_OFFLINE_REFUSAL = "Git remote operations require an online run."
// altimate_change end

export interface Repo {
/**
Expand Down Expand Up @@ -416,6 +449,10 @@ function run(cwd: string, proc: AppProcess.Interface) {

function execute(cwd: string, proc: AppProcess.Interface) {
return (args: string[]) =>
// altimate_change start — offline mode refuses Git commands that use the network
offlineModeEnabled() && gitCommandUsesNetwork(args)
? Effect.succeed({ exitCode: 1, text: "", stderr: GIT_OFFLINE_REFUSAL } satisfies Result)
: // altimate_change end
proc
Comment thread
anandgupta42 marked this conversation as resolved.
Resolved
.run(
ChildProcess.make("git", args, {
Expand Down
15 changes: 12 additions & 3 deletions packages/core/src/models-dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import path from "path"
import { Context, Duration, Effect, Layer, Option, Schedule, Schema } from "effect"
import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/unstable/http"
import { Global } from "./global"
import { Flag } from "./flag/flag"
// altimate_change start — offline mode
import { Flag, offlineModeEnabled } from "./flag/flag"
// altimate_change end
import { Flock } from "./util/flock"
import { Hash } from "./util/hash"
import { FSUtil } from "./fs-util"
Expand Down Expand Up @@ -201,7 +203,9 @@ export const layer = Layer.effect(
if (fromDisk) return fromDisk
const snapshot = yield* loadSnapshot
if (snapshot) return snapshot
if (Flag.OPENCODE_DISABLE_MODELS_FETCH) return {}
// altimate_change start — offline mode uses only the cached or bundled catalog
if (offlineModeEnabled() || Flag.OPENCODE_DISABLE_MODELS_FETCH) return {}
// altimate_change end
// Flock is cross-process: concurrent opencode CLIs can race on this cache file.
const text = yield* Effect.scoped(
Effect.gen(function* () {
Expand All @@ -217,6 +221,9 @@ export const layer = Layer.effect(
const get = (): Effect.Effect<Record<string, Provider>> => cachedGet

const refresh = Effect.fn("ModelsDev.refresh")(function* (force = false) {
// altimate_change start — skip forced catalog refresh in offline mode
if (offlineModeEnabled()) return
// altimate_change end
if (!force && (yield* fresh())) return
yield* Effect.scoped(
Effect.gen(function* () {
Expand All @@ -234,7 +241,9 @@ export const layer = Layer.effect(
)
})

if (!Flag.OPENCODE_DISABLE_MODELS_FETCH && !process.argv.includes("--get-yargs-completions")) {
// altimate_change start — skip background refresh in offline mode
if (!offlineModeEnabled() && !Flag.OPENCODE_DISABLE_MODELS_FETCH && !process.argv.includes("--get-yargs-completions")) {
// altimate_change end
// Schedule.spaced runs the effect once, then waits between completions.
yield* Effect.forkScoped(refresh().pipe(Effect.repeat(Schedule.spaced("60 minutes")), Effect.ignore))
}
Expand Down
16 changes: 16 additions & 0 deletions packages/core/src/npm.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// altimate_change start — offline mode
import { offlineModeEnabled } from "./flag/flag"
Comment thread
anandgupta42 marked this conversation as resolved.
Resolved
// altimate_change end
export * as Npm from "./npm"

import path from "path"
Expand Down Expand Up @@ -126,6 +129,14 @@ export const layer = Layer.effect(
return resolveEntryPoint(name, path.join(dir, "node_modules", name))
}

// altimate_change start — offline mode skips registry installs
if (offlineModeEnabled())
return yield* new InstallFailedError({
add: [pkg],
dir,
cause: new Error(`Install ${pkg} while online.`),
})
// altimate_change end
const tree = yield* reify({ dir, add: [pkg] })
const first = tree.edgesOut.values().next().value?.to
if (!first) {
Expand All @@ -137,6 +148,9 @@ export const layer = Layer.effect(
}, Effect.scoped)

const install: Interface["install"] = Effect.fn("Npm.install")(function* (dir, input) {
// altimate_change start — offline mode skips registry installs
if (offlineModeEnabled()) return
// altimate_change end
const canWrite = yield* afs.access(dir, { writable: true }).pipe(
Effect.as(true),
Effect.orElseSucceed(() => false),
Expand Down Expand Up @@ -225,6 +239,8 @@ export const layer = Layer.effect(
return Option.some(path.join(binDir, bin.value))
}

// altimate_change — a missing offline binary should leave the cache untouched
if (offlineModeEnabled()) return Option.none<string>()
yield* fs.remove(path.join(dir, "package-lock.json")).pipe(Effect.orElseSucceed(() => {}))

yield* add(pkg)
Expand Down
12 changes: 9 additions & 3 deletions packages/core/src/observability/otlp.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Layer } from "effect"
import { OtlpLogger } from "effect/unstable/observability"
import { Flag } from "../flag/flag"
// altimate_change start — offline mode
import { Flag, offlineModeEnabled } from "../flag/flag"
// altimate_change end
import { InstallationChannel, InstallationVersion } from "../installation/version"
import { runID } from "./shared"

Expand Down Expand Up @@ -48,12 +50,16 @@ export function resource(): { serviceName: string; serviceVersion: string; attri
}

export function loggers() {
if (!endpoint) return []
// altimate_change start — offline mode disables OTLP export
if (offlineModeEnabled() || !endpoint) return []
// altimate_change end
return [OtlpLogger.make({ url: `${endpoint}/v1/logs`, resource: resource(), headers })]
}

export async function tracingLayer() {
if (!endpoint) return Layer.empty
// altimate_change start — offline mode disables OTLP export
if (offlineModeEnabled() || !endpoint) return Layer.empty
// altimate_change end
const NodeSdk = await import("@effect/opentelemetry/NodeSdk")
const OTLP = await import("@opentelemetry/exporter-trace-otlp-http")
const SdkBase = await import("@opentelemetry/sdk-trace-base")
Expand Down
7 changes: 7 additions & 0 deletions packages/core/src/ripgrep/binary.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// altimate_change start — prevent ripgrep downloads in offline mode
import { offlineModeEnabled } from "../flag/flag"
// altimate_change end
import path from "path"
import { Context, Effect, Layer, Stream } from "effect"
import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/unstable/http"
Expand Down Expand Up @@ -168,6 +171,10 @@ export namespace RipgrepBinary {

const target = path.join(Global.Path.bin, `rg${process.platform === "win32" ? ".exe" : ""}`)
if (yield* fs.isFile(target).pipe(Effect.orDie)) return target
// altimate_change start — preserve installed ripgrep and skip downloads offline
if (offlineModeEnabled())
return yield* Effect.fail(new Error("Install ripgrep while online to use file search in offline mode."))
// altimate_change end

const platformKey = `${process.arch}-${process.platform}` as keyof typeof PLATFORM
const config = PLATFORM[platformKey]
Expand Down
5 changes: 5 additions & 0 deletions packages/core/src/v1/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ export const Info = Schema.Struct({
autoshare: Schema.optional(Schema.Boolean).annotate({
description: "@deprecated Use 'share' field instead. Share newly created sessions automatically",
}),
// altimate_change start — offline mode
offline: Schema.optional(Schema.Boolean).annotate({
description: "Use the configured model endpoint and cached local resources without other network access",
}),
// altimate_change end
autoupdate: Schema.optional(Schema.Union([Schema.Boolean, Schema.Literal("notify")])).annotate({
description:
"Automatically update to the latest version. Set to true to auto-update, false to disable, or 'notify' to show update notifications",
Expand Down
22 changes: 22 additions & 0 deletions packages/core/test/git.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,28 @@ describe("Git", () => {
),
)

it.live("offline rejects clone and fetch while preserving local metadata", () =>
withRemote((fixture) =>
Effect.gen(function* () {
const git = yield* Git.Service
const target = path.join(fixture.root, "checkout")
expect((yield* git.clone({ remote: fixture.remote, target })).exitCode).toBe(0)
const previous = process.env.ALTIMATE_OFFLINE
process.env.ALTIMATE_OFFLINE = "1"
try {
expect(yield* git.head(target)).toBeString()
const rejected = path.join(fixture.root, "rejected")
expect((yield* git.clone({ remote: fixture.remote, target: rejected })).stderr).toContain("online run")
expect((yield* git.fetch(target)).stderr).toContain("online run")
expect((yield* git.fetchBranch(target, "main")).stderr).toContain("online run")
} finally {
if (previous === undefined) delete process.env.ALTIMATE_OFFLINE
else process.env.ALTIMATE_OFFLINE = previous
}
}),
),
)

it.live("fetches, checks out, and resets remote changes", () =>
withRemote((fixture) =>
Effect.gen(function* () {
Expand Down
Loading
Loading