Skip to content

Commit c6a6cef

Browse files
committed
chore: re-apply altimate_change blocks after upstream merge
Re-applied 155 altimate_change marker blocks across 40 files that were overwritten during the v1.2.27 upstream merge with unrelated histories. https://claude.ai/code/session_01FVE7bSfST5rpzbEmUhNiBU
1 parent dd64858 commit c6a6cef

41 files changed

Lines changed: 2092 additions & 6 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.upstream-merge-state.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"version": "v1.2.27",
3+
"mergeBranch": "upstream/merge-v1.2.27",
4+
"backupBranch": "backup/claude/merge-upstream-opencode-k1IdW-2026-03-21T20-42-04",
5+
"baseBranch": "main",
6+
"step": 7,
7+
"versionSnapshot": {
8+
"package.json": {
9+
"type": "package.json",
10+
"name": "opencode",
11+
"version": ""
12+
},
13+
"packages/opencode/package.json": {
14+
"type": "package.json",
15+
"name": "@altimateai/altimate-code",
16+
"version": "1.2.20"
17+
},
18+
"packages/plugin/package.json": {
19+
"type": "package.json",
20+
"name": "@opencode-ai/plugin",
21+
"version": "1.2.20"
22+
},
23+
"packages/sdk/js/package.json": {
24+
"type": "package.json",
25+
"name": "@opencode-ai/sdk",
26+
"version": "1.2.20"
27+
},
28+
"packages/script/package.json": {
29+
"type": "package.json",
30+
"name": "@opencode-ai/script",
31+
"version": ""
32+
},
33+
"packages/util/package.json": {
34+
"type": "package.json",
35+
"name": "@opencode-ai/util",
36+
"version": "1.2.20"
37+
}
38+
}
39+
}

packages/opencode/parsers-config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,9 @@ export default {
215215
{
216216
filetype: "clojure",
217217
// temporarily using fork to fix issues
218+
// altimate_change start — rebranded tree-sitter fork URL
219+
wasm: "https://github.com/AltimateAI/tree-sitter-clojure/releases/download/v0.0.1/tree-sitter-clojure.wasm",
220+
// altimate_change end
218221
wasm: "https://github.com/anomalyco/tree-sitter-clojure/releases/download/v0.0.1/tree-sitter-clojure.wasm",
219222
queries: {
220223
highlights: [

packages/opencode/src/acp/agent.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ import { z } from "zod"
4545
import { LoadAPIKeyError } from "ai"
4646
import type { AssistantMessage, Event, OpencodeClient, SessionMessageResponse, ToolPart } from "@opencode-ai/sdk/v2"
4747
import { applyPatch } from "diff"
48+
// altimate_change start - yolo mode
49+
import { Flag } from "@/flag/flag"
50+
// altimate_change end
4851

4952
type ModeOption = { id: string; name: string; description?: string }
5053
type ModelOption = { modelId: string; name: string }
@@ -188,6 +191,16 @@ export namespace ACP {
188191
const session = this.sessionManager.tryGet(permission.sessionID)
189192
if (!session) return
190193

194+
// altimate_change start - yolo mode: auto-approve without asking ACP client
195+
if (Flag.ALTIMATE_CLI_YOLO) {
196+
await this.sdk.permission.reply({
197+
requestID: permission.id,
198+
reply: "once",
199+
directory: session.cwd,
200+
})
201+
return
202+
}
203+
// altimate_change end
191204
const prev = this.permissionQueues.get(permission.sessionID) ?? Promise.resolve()
192205
const next = prev
193206
.then(async () => {
@@ -520,6 +533,24 @@ export namespace ACP {
520533
async initialize(params: InitializeRequest): Promise<InitializeResponse> {
521534
log.info("initialize", { protocolVersion: params.protocolVersion })
522535

536+
// altimate_change start — branding: altimate auth
537+
const authMethod: AuthMethod = {
538+
description: "Run `altimate auth login` in the terminal",
539+
name: "Login with altimate",
540+
id: "altimate-login",
541+
}
542+
543+
// If client supports terminal-auth capability, use that instead.
544+
if (params.clientCapabilities?._meta?.["terminal-auth"] === true) {
545+
authMethod._meta = {
546+
"terminal-auth": {
547+
command: "altimate",
548+
args: ["auth", "login"],
549+
label: "Altimate Code Login",
550+
},
551+
}
552+
}
553+
// altimate_change end
523554
const authMethod: AuthMethod = {
524555
description: "Run `opencode auth login` in the terminal",
525556
name: "Login with opencode",

packages/opencode/src/agent/agent.ts

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ import PROMPT_COMPACTION from "./prompt/compaction.txt"
1414
import PROMPT_EXPLORE from "./prompt/explore.txt"
1515
import PROMPT_SUMMARY from "./prompt/summary.txt"
1616
import PROMPT_TITLE from "./prompt/title.txt"
17+
// altimate_change start - import custom agent mode prompts
18+
import PROMPT_BUILDER from "../altimate/prompts/builder.txt"
19+
import PROMPT_ANALYST from "../altimate/prompts/analyst.txt"
20+
// altimate_change end
1721
import { PermissionNext } from "@/permission/next"
1822
import { mergeDeep, pipe, sortBy, values } from "remeda"
1923
import { Global } from "@/global"
@@ -61,6 +65,19 @@ export namespace Agent {
6165
"*": "ask",
6266
...Object.fromEntries(whitelistedDirs.map((dir) => [dir, "allow"])),
6367
},
68+
// altimate_change start - SQL write safety denials
69+
sql_execute_write: {
70+
"DROP DATABASE *": "deny",
71+
"DROP SCHEMA *": "deny",
72+
"TRUNCATE *": "deny",
73+
"drop database *": "deny",
74+
"drop schema *": "deny",
75+
"truncate *": "deny",
76+
"Drop Database *": "deny",
77+
"Drop Schema *": "deny",
78+
"Truncate *": "deny",
79+
},
80+
// altimate_change end
6481
question: "deny",
6582
plan_enter: "deny",
6683
plan_exit: "deny",
@@ -75,6 +92,72 @@ export namespace Agent {
7592
const user = PermissionNext.fromConfig(cfg.permission ?? {})
7693

7794
const result: Record<string, Info> = {
95+
// altimate_change start - 3 modes: builder, analyst, plan
96+
builder: {
97+
name: "builder",
98+
description: "Create and modify dbt models, SQL, and data pipelines. Full read/write access.",
99+
prompt: PROMPT_BUILDER,
100+
options: {},
101+
permission: PermissionNext.merge(
102+
defaults,
103+
PermissionNext.fromConfig({
104+
question: "allow",
105+
plan_enter: "allow",
106+
sql_execute_write: "ask",
107+
}),
108+
userWithSafety,
109+
),
110+
mode: "primary",
111+
native: true,
112+
},
113+
analyst: {
114+
name: "analyst",
115+
description: "Read-only data exploration and analysis. Cannot modify files or run destructive SQL.",
116+
prompt: PROMPT_ANALYST,
117+
options: {},
118+
permission: PermissionNext.merge(
119+
defaults,
120+
PermissionNext.fromConfig({
121+
"*": "deny",
122+
// SQL read tools
123+
sql_execute: "allow", sql_validate: "allow", sql_analyze: "allow",
124+
sql_translate: "allow", sql_optimize: "allow", lineage_check: "allow",
125+
sql_explain: "allow", sql_format: "allow", sql_fix: "allow",
126+
sql_autocomplete: "allow", sql_diff: "allow",
127+
// SQL writes denied
128+
sql_execute_write: "deny",
129+
// Warehouse/schema/finops
130+
warehouse_list: "allow", warehouse_test: "allow", warehouse_discover: "allow",
131+
schema_inspect: "allow", schema_index: "allow", schema_search: "allow",
132+
schema_cache_status: "allow", schema_detect_pii: "allow",
133+
schema_tags: "allow", schema_tags_list: "allow",
134+
finops_query_history: "allow", finops_analyze_credits: "allow",
135+
finops_expensive_queries: "allow", finops_warehouse_advice: "allow",
136+
finops_unused_resources: "allow", finops_role_grants: "allow",
137+
finops_role_hierarchy: "allow", finops_user_roles: "allow",
138+
// Core tools
139+
altimate_core_validate: "allow", altimate_core_check: "allow",
140+
altimate_core_rewrite: "allow",
141+
// Read-only file access
142+
read: "allow", grep: "allow", glob: "allow",
143+
webfetch: "allow", websearch: "allow",
144+
question: "allow", tool_lookup: "allow",
145+
// Bash: last-match-wins — "*": "deny" MUST come first, then specific allows override
146+
bash: {
147+
"*": "deny",
148+
"ls *": "allow", "grep *": "allow", "cat *": "allow",
149+
"head *": "allow", "tail *": "allow", "find *": "allow", "wc *": "allow",
150+
"dbt list *": "allow", "dbt ls *": "allow", "dbt debug *": "allow",
151+
},
152+
// Training
153+
training_save: "allow", training_list: "allow", training_remove: "allow",
154+
}),
155+
userWithSafety,
156+
),
157+
mode: "primary",
158+
native: true,
159+
},
160+
// altimate_change end
78161
build: {
79162
name: "build",
80163
description: "The default agent. Executes tools based on configured permissions.",
@@ -260,6 +343,9 @@ export namespace Agent {
260343
return pipe(
261344
await state(),
262345
values(),
346+
// altimate_change start - default agent is "builder" not "build"
347+
sortBy([(x) => (cfg.default_agent ? x.name === cfg.default_agent : x.name === "builder"), "desc"]),
348+
// altimate_change end
263349
sortBy([(x) => (cfg.default_agent ? x.name === cfg.default_agent : x.name === "build"), "desc"]),
264350
)
265351
}

packages/opencode/src/cli/cmd/providers.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,9 @@ export const ProvidersLoginCommand = cmd({
253253
builder: (yargs) =>
254254
yargs
255255
.positional("url", {
256+
// altimate_change start — branding
257+
describe: "altimate auth provider",
258+
// altimate_change end
256259
describe: "opencode auth provider",
257260
type: "string",
258261
})

packages/opencode/src/cli/cmd/run.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,9 @@ export const RunCommand = cmd({
229229
array: true,
230230
default: [],
231231
})
232+
// altimate_change start - activate tracer for session
233+
if (tracer) Tracer.setActive(tracer)
234+
// altimate_change end
232235
.option("command", {
233236
describe: "the command to run, use message for args",
234237
type: "string",
@@ -544,6 +547,30 @@ export const RunCommand = cmd({
544547
if (event.type === "permission.asked") {
545548
const permission = event.properties
546549
if (permission.sessionID !== sessionID) continue
550+
// altimate_change start - yolo mode: auto-approve instead of auto-reject
551+
const yolo = args.yolo || Flag.ALTIMATE_CLI_YOLO
552+
if (yolo) {
553+
UI.println(
554+
UI.Style.TEXT_WARNING_BOLD + "!",
555+
UI.Style.TEXT_NORMAL +
556+
`yolo mode: auto-approved ${permission.permission} (${permission.patterns.join(", ")})`,
557+
)
558+
await sdk.permission.reply({
559+
requestID: permission.id,
560+
reply: "once",
561+
})
562+
} else {
563+
UI.println(
564+
UI.Style.TEXT_WARNING_BOLD + "!",
565+
UI.Style.TEXT_NORMAL +
566+
`permission requested: ${permission.permission} (${permission.patterns.join(", ")}); auto-rejecting`,
567+
)
568+
await sdk.permission.reply({
569+
requestID: permission.id,
570+
reply: "reject",
571+
})
572+
}
573+
// altimate_change end
547574
UI.println(
548575
UI.Style.TEXT_WARNING_BOLD + "!",
549576
UI.Style.TEXT_NORMAL +

0 commit comments

Comments
 (0)