Repository navigation
Closed
Labels
app/corePackage: core (pkgs/ or apps/ in this repo)Package: core (pkgs/ or apps/ in this repo)effort/mMedium: expected under 1 day of workMedium: expected under 1 day of workkind/featureNew feature or capability requestNew feature or capability requestpriority/normalOrdinary priority (the default)Ordinary priority (the default)source/design-architectFiled by the repo design architect jobFiled by the repo design architect jobstatus:done
Description
Sub-issue of #800 (design: Code Mode's missing standard library). Implements phase 1 of that design; the mechanism for #765's adopted Code Mode helper library.
Scope
librariesoption in@opencode/codemode(packages/codemode):CodeMode.makeaccepts named, versioned libraries —{ name, version, source }wheresourceis JavaScript in the interpreter's supported subset. At execution start each library is evaluated in the program scope and its exports bound to one frozen global per library. Library evaluation must not shift program diagnostic locations (Diagnostic.locationinpackages/codemode/src/codemode.tsstill points at the program's own line/column).- std library v1.0.0 — pure set only:
std.version,std.bind(target, defaults)(wraps a tool callable or a whole namespace object; defaults merged under explicit arguments, explicit wins),std.chunk,std.uniqBy,std.keyBy,std.pick,std.omit. No async helpers in this phase (they are phase 2, a sibling sub-issue). - Core wiring:
packages/core/src/codemode/tool.tsruntime passes the std library. A bound tool call must still record, display, and hook as the original tool (the wrapper calls the same callable — hooks andtoolCallsunchanged). - Instructions:
packages/core/src/codemode/instructions.tslistsstd@1.0.0with one signature line per member, through the existing Instructions diff machinery. packages/codemode/interpreter-support.mdgains checklist entries for the library surface (it is a checklist, not a changelog — perpackages/codemode/AGENTS.md).
Acceptance criteria
- A Code Mode program can call
std.chunk/uniqBy/keyBy/pick/omitand readstd.version— covered by tests inpackages/codemodethat run the library inside the interpreter itself. -
std.bindon a namespace with a fixed default (e.g.aws_profile) produces calls with the default applied; an explicit argument overrides it; the recorded/displayed tool call is the original tool. - A program that never touches
stdbehaves exactly as today; a deliberate error after library installation reports the program's own line/column in its diagnostic. - The Code Mode instructions render the std listing with its version.
-
bun run checkfrom the repo root passes, or pre-existing failures on the base branch are named in the closing note. Tests run from package directories per repoAGENTS.md, never the root.
Design: #800 (full text in the keep-the-four-repos-healthy goal workspace, files/designs/opencode-codemode-stdlib.md, §§1–2, 4).
Metadata
Metadata
Assignees
Labels
app/corePackage: core (pkgs/ or apps/ in this repo)Package: core (pkgs/ or apps/ in this repo)effort/mMedium: expected under 1 day of workMedium: expected under 1 day of workkind/featureNew feature or capability requestNew feature or capability requestpriority/normalOrdinary priority (the default)Ordinary priority (the default)source/design-architectFiled by the repo design architect jobFiled by the repo design architect jobstatus:done
Activity
developing-today commentedon Oct 29, 2026
OPENCODE-174
dezren39 commentedon Oct 29, 2026
🤖 Agent note · filed
librariesoption to@opencode/codemode(named, versioned, program-source; one frozen namespace global; diagnostic locations unshifted), ship std v1.0.0 pure helpers (bind,chunk,uniqBy,keyBy,pick,omit,version), wire it inpackages/core/src/codemode/tool.ts, list it in the Code Mode instructions, add interpreter-support.md checklist entries.std.bind(bound calls still record/display/hook as the original tool), programs not touchingstdare unchanged, tests run inside the interpreter itself.dezren39 commentedon Oct 29, 2026
🤖 Agent note · done
Triage verdict: CONFIRMED at origin/main
59d692b36e(2026-10-29T02:13Z)git grep "libraries"inpackages/codemode+packages/core/src/codemodeon origin/main: no hits.git grep "uniqBy"/std.chunk: no hits. The feature is absent, not partially built — no superseding PR (open/all PR search for feat(codemode): versioned program-source libraries + std v1 pure helpers (bind, chunk, uniqBy, keyBy, pick, omit) (design #800, phase 1) #802 returned none).packages/core/src/codemode/tool.ts:239:CodeMode.make({ tools, extensions: [CodeModeWeb.extension], hooks })— the single runtime assembly point passes no libraries.packages/codemode/src/codemode.ts:Options/ExecuteOptionscarry tools/limits/extensions/hooks only;make()(lines 145–163) wires onlyextensionGlobals. There is no library-evaluation path, so the packet's Diagnostic.location concern is real and unaddressed.packages/codemode/src/extension.ts; instructions listing point (packages/core/src/codemode/instructions.ts) exists. No held / user/owned / do-not-merge / do-not-auto-edit labels; design(codemode): Code Mode's missing standard library — one versioned std namespace for execute, import maps stay out of the interpreter #800'suser/reviewis on the design issue, not this implementation issue.Issue stays open with
queue/queuedfor follow-up task 2982.14 remaining items
dezren39 commentedon Oct 29, 2026
Status by queue worker (lane A), task 2982: read the sealed unit logs from run 40807380452 and addressed the Codex review on PR #812; new head
93cec21bf1pushed, CI re-running (run 40815525561). Parking until it lands.Unit failures on the previous head were both outside codemode (PR touches only codemode + core codemode files):
config plugin reloads > loads skills when home/.claude appears after startup(@opencode/core, watcher timing); codemode suites all passed (7019 pass in that run's core+codemode aggregate, this was the only fail).upgrade command > is registered in root help and documents its options(@opencode/cli, hit the 30s test timeout).All three Codex findings were reproduced in the interpreter first, then fixed:
this) are now rejected atmake— a library namedthispreviously overwrote the top-levelthisbinding (typeof thisreturned "object").std.bindnow binds namespaces with children namedname/length(namespace-object fallback when assignment over a function wrapper's read-only metadata throws) instead of failing withCannot assign to read only property 'name'.freezeValuein stdlib/object) instead of a duplicate subclass ladder in execute.ts.Local verification on the new head: packages/codemode
bun test1409 pass / 0 fail (incl. new regression tests), packages/core codemode tests 29 pass,bun run check36/36. PR body rewritten to the repo template (compliance bot had flagged it).Resume: when run 40815525561 finishes, if unit failures are only these same unrelated flakes, merge PR #812 per the standing directive, confirm #802 closed, complete task 2982 — that also unblocks parked task 2964 (#803 phase 2).
dezren39 commentedon Oct 29, 2026
CI rechecked by queue worker (lane B), task 2982: PR #812 head
93cec21bf1— typecheck, affected-packages and nix-eval pass, remaining checks still in-progress/queued since 04:02Z with no failures (checked 2026-10-29T04:51Z). Task 2982 is re-parked 1h rather than waiting on the CI backlog; resume merges PR #812 once unit checks settle (allowing only the known unrelated flakes named in the queue resume brief).