Dashboard › opencode › Session 09GqDaRPiD0n
09GqDaRPiD0nnIazrRead-only investigate whether the Lore OpenCode plugin at /home/byk/Code/opencode-lore supports the current OpenCode V2 plugin/runtime API in /home/byk/Code/opencode-v2-pilot. Do not edit files or start/stop services. Inspect Lore's package manifests, entrypoint, imports, plugin export shape, hook/event/session/client APIs, tests, and docs. Compare against the current V2 loader and Promise plugin API. Determine: (1) whether Lore is currently activated in the isolated V2 pilot, based on config/plugin inventory evidence if accessible; (2) whether Lore can load as-is on V2; (3) exact incompatibilities with file:line references; (4) smallest viable port and validation needed. Verify current source, do not rely on memory. Return a concise evidence-based compatibility report. Thoroughness: very thorough.
<path>/home/byk/Code/opencode-lore</path> <type>directory</type> <entries> .craft.yml .git/ .github/ .gitignore .jj/ .lore.md .opencode/ .oxfmtrc.json .oxlintrc.json .plans/ .sentryclirc .vendor-build/ .worktrees/ AGENTS.md CHANGELOG.md codecov.yml LICENSE local_cache/ node_modules/ package.json packages/ patches/ pnpm-lock.yaml pnpm-workspace.yaml quality/ README.md scripts/ stryker.config.mjs supabase/ tsconfig.base.json tsconfig.json vitest.config.ts vitest.evals.config.ts vitest.mutation.config.ts (34 entries) </entries>
<path>/home/byk/Code/opencode-v2-pilot</path> <type>directory</type> <entries> .changeset/ .dockerignore .editorconfig .git .gitattributes .github/ .gitignore .gitleaksignore .husky/ .opencode/ .oxlintrc.json .prettierignore .vscode/ .zed/ AGENTS.md artifacts/ bun.lock bunfig.toml CONTRIBUTING.md flake.lock flake.nix github/ infra/ install LICENSE nix/ node_modules/ package.json packages/ patches/ perf/ README.ar.md README.bn.md README.br.md README.bs.md README.da.md README.de.md README.es.md README.fr.md README.gr.md README.it.md README.ja.md README.ko.md README.md README.no.md README.pl.md README.ru.md README.th.md README.tr.md README.uk.md README.vi.md README.zh.md README.zht.md screenshot-uk.png script/ sdks/ SECURITY.md services/ specs/ sst-env.d.ts sst.config.ts STATS.md tsconfig.json turbo.json (64 entries) </entries>
<path>/home/byk/Code/opencode-lore/AGENTS.md</path> <type>file</type> <content> 1: <!-- This section is maintained by the coding agent via lore (https://github.com/BYK/loreai) --> 2: ## Long-term Knowledge 3: 4: For long-term knowledge entries managed by [lore](https://github.com/BYK/loreai) (gotchas, patterns, decisions, architecture), see [`.lore.md`](.lore.md) in the project root. 5: <!-- End lore-managed section --> 6: 7: ## Review 8: 9: See [`quality/REVIEW.md`](quality/REVIEW.md) for the review heuristics and workflow — regression-test discipline, adversarial-order state setup, fan-out registry coverage, recurring bug-class batteries, and the two-reviewer rule. Every non-trivial PR requires an adversarial correctness review before merge. 10: 11: # Project Overview 12: 13: Lore is a **three-tier memory architecture** for AI coding agents. ...
<path>/home/byk/Code/opencode-v2-pilot/AGENTS.md</path> <type>file</type> <content> 1: - After changing the public Protocol or Server `HttpApi`, run `bun run generate` from `packages/client`. Do not edit generated client files directly. 2: - Keep runtime dependencies directed from Schema to Core and Protocol, then from Core and Protocol to Server. Client runtime code may depend on Schema and Protocol but never Core or Server; `sdk` composes Client, Core, and Server. 3: - Current implementation changes belong in `packages/core`, `packages/cli`, `packages/server`, `packages/protocol`, `packages/schema`, and related generated client surfaces when required. 4: - This repository does not use Changesets. Do not add `.changeset` files; follow the existing release workflow instead. 5: - The default branch in this repo is `v2`. 6: - Default new branches and worktrees to `v2`, or `origin/v2` when the local `v2` ref is unavailable, and default pull requests to target `v2`. ...
No files found
/home/byk/Code/opencode-v2-pilot/packages/ui/AGENTS.md /home/byk/Code/opencode-v2-pilot/packages/schema/AGENTS.md /home/byk/Code/opencode-v2-pilot/packages/plugin/AGENTS.md /home/byk/Code/opencode-v2-pilot/packages/session-ui/AGENTS.md /home/byk/Code/opencode-v2-pilot/packages/tui/AGENTS.md /home/byk/Code/opencode-v2-pilot/packages/desktop/AGENTS.md /home/byk/Code/opencode-v2-pilot/packages/cli/AGENTS.md /home/byk/Code/opencode-v2-pilot/packages/app/AGENTS.md /home/byk/Code/opencode-v2-pilot/packages/stats/AGENTS.md /home/byk/Code/opencode-v2-pilot/packages/app/e2e/performance/AGENTS.md /home/byk/Code/opencode-v2-pilot/packages/app/e2e/AGENTS.md /home/byk/Code/opencode-v2-pilot/packages/ai/AGENTS.md /home/byk/Code/opencode-v2-pilot/packages/codemode/AGENTS.md /home/byk/Code/opencode-v2-pilot/packages/core/src/tool/AGENTS.md
<skill_content name="jj-guide"> # Skill: jj-guide # jj Guide for AI Agents Jujutsu (jj) is a Git-compatible VCS with mutable commits, automatic snapshotting, no staging area, and first-class conflicts. This skill teaches you how to use it safely from a non-interactive agent environment. If `.jj/` exists in the repo root, this is a jj repo. **Use `jj` commands, not `git`.** In a colocated repo (`.jj/` *and* `.git/`), git tools can read the state, but mutations should go through `jj` so the operation log stays consistent. ## Critical Rules - **NEVER** use interactive flags (`-i`, `--interactive`). TUI prompts hang in agent environments. This applies to `jj split -i`, `jj squash -i`, `jj commit -i`, `jj resolve`, `jj diffedit`, etc. - **ALWAYS** pass `-m "msg"` when describing/committing. Without `-m`, an editor opens and hangs. - **VERIFY** mutations with `jj st` and `jj log` after `squash`, `abandon`, `rebase`, `restore`, `commit`. ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/AGENTS.md</path> <type>file</type> <content> 1: # Plugin Package Guide 2: 3: - The plugin package has two versions: Effect and Promise. 4: - In the Effect version, every domain must extend the corresponding Effect API client interface from `@opencode/client/effect/api`. 5: - Do not redefine functions that already exist on the Effect API client interface. 6: - Plugin domains add only the additional functions that make sense in the plugin context. (End of file - total 6 lines) </content> <system-reminder> Instructions from: /home/byk/Code/opencode-v2-pilot/AGENTS.md - After changing the public Protocol or Server `HttpApi`, run `bun run generate` from `packages/client`. Do not edit generated client files directly. - Keep runtime dependencies directed from Schema to Core and Protocol, then from Core and Protocol to Server. ...
Reset the working copy parent to the new Git HEAD. Done importing changes from the underlying Git repo. Working copy changes: M .lore.md Working copy (@) : ptswrqrr 79e212d6 (no description set) Parent commit (@-): uutomtup 42911412 main | fix(gateway): preserve large recall continuations (#1730) @ ptswrqrrxowx 79e212d63b5fc2df78a8f2c21db27aff5f855a88 │ ~
## v2-pilot...origin/v2 M packages/core/src/plugin/host.ts M packages/core/test/plugin.test.ts M packages/core/test/plugin/fixture.ts M packages/core/test/plugin/host.ts M packages/plugin/src/effect/permission.ts M packages/plugin/src/promise/adapter.ts M packages/plugin/src/promise/permission.ts ?? packages/cli/dist-v2-pilot-byk/ ?? packages/cli/dist-v2-pilot-final/ ?? packages/cli/dist-v2-pilot-next/ ?? packages/cli/dist-v2-pilot/ 2ac698d65aa4690a694307e9cbdf44537ea9a4fb 2ac698d65a feat(ai): add Moonshot provider (#47851)
<path>/home/byk/Code/opencode-lore/package.json</path>
<type>file</type>
<content>
1: {
2: "name": "lore-monorepo",
3: "private": true,
4: "type": "module",
5: "license": "FSL-1.1-Apache-2.0",
6: "description": "Monorepo root for Lore — three-tier memory architecture",
7: "main": "./packages/opencode/src/index.ts",
8: "exports": {
9: ".": "./packages/opencode/src/index.ts"
10: },
11: "packageManager": "pnpm@10.28.0",
12: "volta": {
13: "node": "24.16.0",
14: "pnpm": "10.28.0"
15: },
16: "pnpm": {
17: "onlyBuiltDependencies": [
18: "esbuild",
19: "onnxruntime-node",
20: "sharp"
21: ],
22: "overrides": {
23: "basic-ftp": "5.3.1",
24: "ip-address": "10.2.0",
25: "fast-xml-parser": "5.7.3",
26: "@huggingface/hub": "2.11.0",
27: "onnxruntime-node": "1.27.0",
28: "yaml": ">=2.8.3",
29: "esbuild": ">=0.28.1",
30: "@opentelemetry/core": ">=2.8.0",
31: "protobufjs": ...
<path>/home/byk/Code/opencode-lore/packages/opencode/package.json</path>
<type>file</type>
<content>
1: {
2: "name": "@loreai/opencode",
3: "version": "0.40.0",
4: "type": "module",
5: "license": "FSL-1.1-Apache-2.0",
6: "description": "Three-tier memory architecture for OpenCode — distillation, not summarization",
7: "main": "./src/index.ts",
8: "types": "./src/index.ts",
9: "exports": {
10: ".": {
11: "types": "./src/index.ts",
12: "bun": "./src/index.ts",
13: "default": "./src/index.ts"
14: }
15: },
16: "scripts": {
17: "typecheck": "tsc --noEmit",
18: "build": "echo '@loreai/opencode ships raw TS — no build step needed'"
19: },
20: "peerDependencies": {
21: "@opencode-ai/plugin": ">=1.1.0"
22: },
23: "dependencies": {
24: "@loreai/core": "workspace:*",
25: "@loreai/gateway": "workspace:*"
26: },
27: "devDependencies": {
28: "@opencode-ai/plugin": "^1.1.39",
29: "@opencode-ai/sdk": "^1.1.39",
30: ...
<path>/home/byk/Code/opencode-v2-pilot/package.json</path>
<type>file</type>
<content>
1: {
2: "$schema": "https://json.schemastore.org/package.json",
3: "name": "opencode",
4: "description": "AI-powered development tool",
5: "version": "0.0.0",
6: "private": true,
7: "type": "module",
8: "packageManager": "bun@1.4.2",
9: "scripts": {
10: "dev": "bun run --cwd packages/cli src/index.ts",
11: "dev:live": "sh -c 'OPENCODE_TUI_CHANNEL=dev OPENCODE_PASSWORD=\"$(opencode2 service get password)\" exec bun run dev \"$@\" --server \"$(opencode2 service status)\"' --",
12: "dev:desktop": "bun --cwd packages/desktop dev",
13: "dev:web": "bun --cwd packages/app dev",
14: "dev:console": "ulimit -n 10240 2>/dev/null; bun run --cwd packages/console/app dev",
15: "dev:stats": "bun sst shell --stage=production -- bun run --cwd packages/stats/app dev",
16: "dev:www": "bun run --cwd services/www dev",
17: "dev:storybook": "bun --cwd packages/storybook ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/package.json</path>
<type>file</type>
<content>
1: {
2: "$schema": "https://json.schemastore.org/package.json",
3: "name": "@opencode/plugin",
4: "version": "1.18.15",
5: "type": "module",
6: "license": "MIT",
7: "scripts": {
8: "test": "bun test --only-failures",
9: "typecheck": "tsgo --noEmit",
10: "build": "tsc -p tsconfig.build.json"
11: },
12: "exports": {
13: ".": "./src/promise/index.ts",
14: "./effect": "./src/effect/index.ts",
15: "./host": "./src/host.ts",
16: "./tui": "./src/tui/index.ts",
17: "./*": "./src/*.ts"
18: },
19: "imports": {
20: "#plugin-source": {
21: "bun": "./src/source.bun.ts",
22: "node": "./src/source.node.ts",
23: "default": "./src/source.node.ts"
24: }
25: },
26: "files": [
27: "dist"
28: ],
29: "dependencies": {
30: "@ai-sdk/provider": "3.0.8",
31: "@opencode/ai": "workspace:*",
32: ...
/home/byk/Code/opencode-lore/packages/opencode/README.md /home/byk/Code/opencode-lore/packages/opencode/package.json /home/byk/Code/opencode-lore/packages/opencode/tsconfig.json /home/byk/Code/opencode-lore/packages/opencode/LICENSE /home/byk/Code/opencode-lore/packages/opencode/test/index.test.ts /home/byk/Code/opencode-lore/packages/opencode/test/routing.e2e.test.ts /home/byk/Code/opencode-lore/packages/opencode/test/internal.test.ts /home/byk/Code/opencode-lore/packages/opencode/test/gateway-smoke.test.ts /home/byk/Code/opencode-lore/packages/opencode/test/subagent-detection.test.ts /home/byk/Code/opencode-lore/packages/opencode/test/tui-silence.test.ts /home/byk/Code/opencode-lore/packages/opencode/test/session-state.test.ts /home/byk/Code/opencode-lore/packages/opencode/src/internal.ts /home/byk/Code/opencode-lore/packages/opencode/src/index.ts /home/byk/Code/opencode-lore/packages/opencode/scripts/list-sessions.ts /home/byk/Code/opencode-lore/packages/opencode/eval/session_eval.t...
<path>/home/byk/Code/opencode-lore/packages/opencode/src/index.ts</path>
<type>file</type>
<content>
1: import type { Hooks, Plugin, PluginInput } from "@opencode-ai/plugin";
2: import {
3: log,
4: getGitRemote,
5: discoverWorkspaceRoot,
6: installFetchInterceptor,
7: } from "@loreai/core";
8: // Helpers live in a separate module so they are NOT re-exported from this
9: // plugin entry. OpenCode's legacy plugin loader invokes every function
10: // exported from the entry module as a plugin; leaking these helpers pushed
11: // `undefined` into the host hooks array and crashed it on event dispatch
12: // (`undefined is not an object (evaluating 'A.event')`). See ./internal.ts.
13: import {
14: applyLoreProviderConfig,
15: gatewayAccessHeadersForRemote,
16: probeGateway,
17: shouldForwardUpstreamExtraHeader,
18: surfaceGatewayUnavailable,
19: } from "./internal";
20:
21: /**
22: * Lore plugin for OpenCode — transparent LLM proxy routing. ...
<path>/home/byk/Code/opencode-lore/packages/opencode/src/internal.ts</path> <type>file</type> <content> 1: /** 2: * Internal helpers for the Lore OpenCode plugin. 3: * 4: * These functions are intentionally kept OUT of the plugin entry module 5: * (`./index.ts`). OpenCode's legacy plugin loader treats EVERY function 6: * exported from a plugin module as a plugin instance and invokes it (see 7: * `getServerPlugin`/`getLegacyPlugins` in opencode's plugin loader). Exporting 8: * these helpers from the entry module caused them to be invoked as plugins and 9: * their return values pushed into the host's hooks array: 10: * `applyLoreProviderConfig` returns `undefined`, so the host crashed on the 11: * first hook dispatch with `undefined is not an object (evaluating 'A.event')` 12: * (the `?.` guards the `.event` property, not the `undefined` hook element). ...
/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/worktree.ts /home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/websearch.ts /home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/vcs.ts /home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/tool.ts /home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/storage.ts /home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/skill.ts /home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/session.ts /home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/rpc.ts /home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/registration.ts /home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/reference.ts /home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/plugin.ts /home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/permission.ts /home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/mcp.ts /home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/integrat...
/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/warming.ts /home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/vcs/hg.ts /home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/vcs/git.ts /home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/variant.ts /home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/update.ts /home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/supervisor.ts /home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/source-directory.ts /home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/skill.ts /home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/service.ts /home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/sdk.ts /home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/provider.ts /home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/promise.ts /home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/plan.ts /home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/optimize.ts /home/byk/Code/opencode-v2-pilo...
Found 100 matches (more matches available)
/home/byk/Code/opencode-v2-pilot/packages/core/src/worktree/refresh.ts:
Line 6: import { Plugin } from "../plugin.js"
Line 7: import { PluginSupervisor } from "../plugin/supervisor.js"
Line 13: const plugins = yield* Plugin.Service
Line 16: yield* plugins.awaitActivation.pipe(
/home/byk/Code/opencode-v2-pilot/packages/core/src/worktree.ts:
Line 318: // A location's plugin instances only discover its own checkout, not sibling clones.
/home/byk/Code/opencode-v2-pilot/packages/core/src/tool/runtime.ts:
Line 31: // Tool implementations declare `Tool.Error` but plugins can fail with anything at
/home/byk/Code/opencode-v2-pilot/packages/core/src/instruction-discovery.ts:
Line 39: // Discovery policy lives here because internal plugins have no per-composition options channel.
Line 40: // Move it into plugin config once plugins can consume their own options. ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/index.ts</path>
<type>file</type>
<content>
1: export type { PluginOptions } from "../options.js"
2: export type { StorageEntry, StorageScanOptions, StorageScanResult } from "../storage.js"
3: export * as Plugin from "./plugin.js"
4:
5: export { Agent } from "@opencode/schema/agent"
6: export { Command } from "@opencode/schema/command"
7: export { Connection } from "@opencode/schema/connection"
8: export { Credential } from "@opencode/schema/credential"
9: export { Integration } from "@opencode/schema/integration"
10: export { Location } from "@opencode/schema/location"
11: export { Mcp } from "@opencode/schema/mcp"
12: export { Model } from "@opencode/schema/model"
13: export { PersistentPty } from "@opencode/schema/persistent-pty"
14: export { Provider } from "@opencode/schema/provider"
15: export { Reference } from "@opencode/schema/reference"
16: export { Rpc } from "@opencode/schema/rpc"
17: export { Skill } from ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/plugin.ts</path>
<type>file</type>
<content>
1: import type { OpenCodeClient } from "@opencode/client"
2: import type { GenerateApi, PluginApi } from "@opencode/client/promise/api"
3: import type { Location } from "@opencode/schema/location"
4: import type { PluginOptions } from "../options.js"
5: import type { App } from "../app.js"
6: import type { AgentDomain } from "./agent.js"
7: import type { AISDKDomain } from "./aisdk.js"
8: import type { CatalogDomain } from "./catalog.js"
9: import type { CommandDomain } from "./command.js"
10: import type { EventDomain } from "./event.js"
11: import type { IntegrationDomain } from "./integration.js"
12: import type { MCPDomain } from "./mcp.js"
13: import type { PermissionDomain } from "./permission.js"
14: import type { ReferenceDomain } from "./reference.js"
15: import type { RpcDomain } from "./rpc.js"
16: import type { SessionDomain } from "./session.js"
17: import type ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts</path>
<type>file</type>
<content>
1: import { Tool } from "@opencode/schema/tool"
2: import type { Rpc } from "@opencode/schema/rpc"
3: import type { RpcCallOptions, RpcEventPayload } from "@opencode/client/promise/api"
4: import { Effect, Schema, SchemaAST, Stream } from "effect"
5: import type { Scope } from "effect"
6: import { HttpApiEndpoint, HttpApiSchema } from "effect/unstable/httpapi"
7: import { define } from "../effect/plugin.js"
8: import type { Plugin } from "./plugin.js"
9: import type { Info } from "./tool.js"
10: import type { RpcDomain, RpcHandlers } from "./rpc.js"
11:
12: type HostRegistration = { readonly dispose: Effect.Effect<void> }
13: type Registration = { readonly dispose: () => Promise<void> }
14: type PromiseContext = Parameters<Plugin["setup"]>[0]
15: type PromiseEvent = ReturnType<PromiseContext["event"]["subscribe"]> extends AsyncIterable<infer Event> ? ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/agent.ts</path>
<type>file</type>
<content>
1: import type { AgentApi } from "@opencode/client/promise/api"
2: import type { Agent } from "@opencode/schema/agent"
3: import type { Transform } from "./registration.js"
4: import type { DeepMutable } from "./types.js"
5:
6: export interface AgentEditor {
7: list(): readonly DeepMutable<Agent.Info>[]
8: get(id: string): DeepMutable<Agent.Info> | undefined
9: default(id: string | undefined): void
10: update(id: string, update: (agent: DeepMutable<Agent.Info>) => void): void
11: remove(id: string): void
12: }
13:
14: export interface AgentDomain extends AgentApi {
15: readonly transform: Transform<AgentEditor>
16: readonly reload: () => Promise<void>
17: }
(End of file - total 17 lines)
</content>
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/aisdk.ts</path>
<type>file</type>
<content>
1: import type { LanguageModelV3 } from "@ai-sdk/provider"
2: import type { Model } from "@opencode/schema/model"
3: import type { ModelHooks } from "./registration.js"
4:
5: export interface AISDKHooks {
6: sdk: {
7: readonly model: Model.Info
8: readonly package: string
9: readonly options: Record<string, any>
10: sdk?: any
11: }
12: language: {
13: readonly model: Model.Info
14: readonly sdk: any
15: readonly options: Record<string, any>
16: language?: LanguageModelV3
17: }
18: }
19:
20: export interface AISDKDomain {
21: readonly hook: ModelHooks<AISDKHooks>
22: }
(End of file - total 22 lines)
</content>
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/session.ts</path>
<type>file</type>
<content>
1: import type { SessionApi } from "@opencode/client/promise/api"
2: import type { GenerationOptionsFields, Message, SystemPart } from "@opencode/ai"
3: import type { Agent } from "@opencode/schema/agent"
4: import type { Model } from "@opencode/schema/model"
5: import type { PromptInput } from "@opencode/schema/prompt-input"
6: import type { Session } from "@opencode/schema/session"
7: import type { SessionInbox } from "@opencode/schema/session-inbox"
8: import type { SessionError } from "@opencode/schema/session-error"
9: import type { SessionMessage } from "@opencode/schema/session-message"
10: import type { JsonSchema, Types } from "effect"
11: import type { ModelHooks } from "./registration.js"
12:
13: export interface SessionPrompt {
14: readonly sessionID: Session.ID
15: readonly messageID: SessionMessage.ID
16: prompt: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/event.ts</path>
<type>file</type>
<content>
1: import type { EventApi } from "@opencode/client/promise/api"
2:
3: export interface EventDomain extends Pick<EventApi, "subscribe"> {}
(End of file - total 3 lines)
</content>
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/tool.ts</path>
<type>file</type>
<content>
1: export { CallID, Error } from "@opencode/schema/tool"
2: export type { Metadata, Options, Result } from "@opencode/schema/tool"
3:
4: import { Tool } from "@opencode/schema/tool"
5: import type { Agent } from "@opencode/schema/agent"
6: import type { Session } from "@opencode/schema/session"
7: import type { SessionMessage } from "@opencode/schema/session-message"
8: import type { Types } from "effect"
9: import type { Hooks, Transform } from "./registration.js"
10:
11: export interface ToolContext extends Omit<Tool.Context, "progress"> {
12: readonly progress: (update: Tool.Metadata) => Promise<void>
13: }
14:
15: export type Info<
16: Input extends Tool.ValueSchema<any> = Tool.ValueSchema<any>,
17: Output extends Tool.ValueSchema<any> | undefined = Tool.ValueSchema<any> | undefined,
18: > = Omit<Tool.Info<Input, Output>, "execute"> & {
19: readonly execute: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/registration.ts</path>
<type>file</type>
<content>
1: export interface Registration {
2: readonly dispose: () => Promise<void>
3: }
4:
5: export interface ModelHookOptions {
6: /** Limits the hook to one provider. Unscoped hooks apply to every provider. */
7: readonly providerID?: string
8: }
9:
10: export type Hooks<Spec> = <Name extends keyof Spec>(
11: name: Name,
12: callback: (input: Spec[Name]) => Promise<void> | void,
13: ) => Promise<Registration>
14:
15: export type ModelHooks<Spec> = <Name extends keyof Spec>(
16: name: Name,
17: callback: (input: Spec[Name]) => Promise<void> | void,
18: options?: Spec[Name] extends { readonly model: unknown } ? ModelHookOptions : never,
19: ) => Promise<Registration>
20:
21: export type Transform<Input> = (callback: (input: Input) => void) => Promise<Registration>
(End of file - total 21 lines)
</content>
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/options.ts</path> <type>file</type> <content> 1: export type PluginOptions = Readonly<Record<string, any>> (End of file - total 1 lines) </content>
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/app.ts</path>
<type>file</type>
<content>
1: export interface App {
2: readonly name: string
3: readonly version: string
4: readonly channel: string
5: }
(End of file - total 5 lines)
</content>
<path>/home/byk/Code/opencode-v2-pilot/packages/schema/src/location.ts</path>
<type>file</type>
<content>
1: export * as Location from "./location.js"
2:
3: import { Schema } from "effect"
4: import { AbsolutePath, optional } from "./schema.js"
5: import { ProjectID } from "./project-id.js"
6: import { WorkspaceID } from "./workspace-id.js"
7:
8: export interface Ref extends Schema.Schema.Type<typeof Ref> {}
9: export const Ref = Schema.Struct({
10: directory: AbsolutePath,
11: workspaceID: optional(WorkspaceID),
12: }).annotate({ identifier: "Location.Ref" })
13:
14: export class Info extends Schema.Class<Info>("Location.Info")({
15: directory: AbsolutePath,
16: workspaceID: optional(WorkspaceID),
17: project: Schema.Struct({
18: id: ProjectID,
19: directory: AbsolutePath,
20: canonical: AbsolutePath,
21: }),
22: }) {}
23:
24: export function response<S extends Schema.Top>(data: S) {
25: return Schema.Struct({ location: Info, data })
26: }
(End of file ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/catalog.ts</path>
<type>file</type>
<content>
1: import type { CatalogApi } from "@opencode/client/promise/api"
2: import type { Model } from "@opencode/schema/model"
3: import type { Provider } from "@opencode/schema/provider"
4: import type { Transform } from "./registration.js"
5: import type { DeepMutable } from "./types.js"
6:
7: export interface CatalogProviderRecord {
8: readonly provider: DeepMutable<Provider.Info>
9: readonly models: ReadonlyMap<string, DeepMutable<Model.Info>>
10: }
11:
12: export interface CatalogEditor {
13: readonly provider: {
14: list(): readonly CatalogProviderRecord[]
15: get(providerID: string): CatalogProviderRecord | undefined
16: update(providerID: string, update: (provider: DeepMutable<Provider.Info>) => void): void
17: remove(providerID: string): void
18: }
19: readonly model: {
20: get(providerID: string, modelID: string): DeepMutable<Model.Info> ...
<path>/home/byk/Code/opencode-v2-pilot/packages/schema/src/provider.ts</path>
<type>file</type>
<content>
1: export * as Provider from "./provider.js"
2:
3: import { Effect, Schema } from "effect"
4: import { Integration } from "./integration.js"
5: import { optional, PositiveInt, statics } from "./schema.js"
6:
7: export const ID = Schema.String.pipe(
8: Schema.brand("Provider.ID"),
9: statics((schema) => ({
10: opencode: schema.make("opencode"),
11: anthropic: schema.make("anthropic"),
12: openai: schema.make("openai"),
13: google: schema.make("google"),
14: googleVertex: schema.make("google-vertex"),
15: githubCopilot: schema.make("github-copilot"),
16: amazonBedrock: schema.make("amazon-bedrock"),
17: azure: schema.make("azure"),
18: openrouter: schema.make("openrouter"),
19: mistral: schema.make("mistral"),
20: gitlab: schema.make("gitlab"),
21: })),
22: )
23: export type ID = typeof ID.Type
24:
25: export const Package = ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/hooks.ts</path>
<type>file</type>
<content>
1: export * as PluginHooks from "./hooks.js"
2:
3: import type { AISDKHooks } from "@opencode/plugin/effect/aisdk"
4: import type { SessionHooks } from "@opencode/plugin/effect/session"
5: import type { ShellHooks } from "@opencode/plugin/effect/shell"
6: import type { ToolFailures, ToolHooks } from "@opencode/plugin/effect/tool"
7: import type { ModelHookOptions } from "@opencode/plugin/effect/registration"
8: import type { PermissionHooks } from "@opencode/plugin/effect/permission"
9: import { Context, Effect, Layer, Scope } from "effect"
10: import { makeLocationNode } from "@opencode/util/effect/app-node"
11: import { State } from "../state.js"
12:
13: export interface Domains {
14: readonly aisdk: AISDKHooks
15: readonly session: SessionHooks
16: readonly permission: PermissionHooks
17: readonly shell: ShellHooks
18: readonly tool: ToolHooks
19: }
20:
21: type ...
Found 36 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/session.ts:
Line 171: input: Parameters<Session.Handle["prompt"]>[0] & { sessionID: SessionSchema.ID },
Line 172: ) => ReturnType<Session.Handle["prompt"]>
/home/byk/Code/opencode-v2-pilot/packages/core/src/models-dev.ts:
Line 24: readonly tiers?: readonly (Cost & { readonly tier: { readonly type: "context"; readonly size: number } })[]
Line 144: tier: { type: "context" as const, size: 200_000 },
/home/byk/Code/opencode-v2-pilot/packages/core/src/v1/config/migrate.ts:
Line 315: tier: { type: "context" as const, size: 200_000 },
/home/byk/Code/opencode-v2-pilot/packages/core/src/session/usage.ts:
Line 25: .filter((cost) => cost.tier?.type === "context" && context > cost.tier.size)
/home/byk/Code/opencode-v2-pilot/packages/core/src/database/drizzle/sqlite-core/effect/update.ts:
Line 208: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/session/model-request.ts</path>
<type>file</type>
<content>
180: return Message.text(IMAGE_REMOVED)
181: }
182: if (part.type !== "tool-result" || part.result.type !== "content") return part
183: return {
184: ...part,
185: result: {
186: ...part.result,
187: value: part.result.value.map((item: Content) => {
188: if (item.type !== "file" || !isImage(item.mime) || imageBytes - removed <= IMAGE_BYTES_TARGET) return item
189: removed += Buffer.byteLength(item.uri)
190: return { type: "text" as const, text: IMAGE_REMOVED }
191: }),
192: },
193: }
194: }),
195: }),
196: )
197: }
198:
199: /** The identity a plugin hook sees for one outbound request. */
200: interface HookScope {
201: readonly sessionID: SessionSchema.ID
202: readonly agent: Agent.ID
203: readonly ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/effect/agent.ts</path>
<type>file</type>
<content>
1: import type { AgentApi } from "@opencode/client/effect/api"
2: import type { Agent } from "@opencode/schema/agent"
3: import type { Effect, Types } from "effect"
4: import type { Transform } from "./registration.js"
5:
6: export interface AgentEditor {
7: list(): readonly Types.DeepMutable<Agent.Info>[]
8: get(id: string): Types.DeepMutable<Agent.Info> | undefined
9: default(id: string | undefined): void
10: update(id: string, update: (agent: Types.DeepMutable<Agent.Info>) => void): void
11: remove(id: string): void
12: }
13:
14: export interface AgentDomain extends AgentApi<unknown> {
15: readonly transform: Transform<AgentEditor>
16: readonly reload: () => Effect.Effect<void>
17: }
(End of file - total 17 lines)
</content>
Found 100 matches (more matches available)
/home/byk/Code/opencode-v2-pilot/package.json:
Line 132: "@opencode/plugin": "workspace:*",
/home/byk/Code/opencode-v2-pilot/AGENTS.md:
Line 87: - Never use type-position `import("...")` references such as `Schema.declare<import("@opencode/plugin/effect/plugin").Plugin["effect"]>`. Only when two imports genuinely collide on a name and no other option exists, an aliased type import (`import type { Plugin as PluginDefinition } from "..."`) is permitted as a last resort — still strongly preferred not to.
/home/byk/Code/opencode-v2-pilot/.opencode/tool/github-triage.ts:
Line 2: import { tool } from "@opencode/plugin"
/home/byk/Code/opencode-v2-pilot/.opencode/tool/github-pr-search.ts:
Line 2: import { tool } from "@opencode/plugin"
/home/byk/Code/opencode-v2-pilot/packages/sdk/test/instances.test.ts:
Line 38: await ctx.session.hook("prompt", (event) => {
Line 166: await ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/README.md</path>
<type>file</type>
<content>
1: # OpenCode V2 Promise Plugin API
2:
3: The Promise plugin API at `@opencode/plugin` is the async/await equivalent of `@opencode/plugin/effect`. It grants plugins the same two in-process capabilities:
4:
5: - `hook` installs behavior at an OpenCode extension point.
6: - `reload` reruns every transform hook for a stateful domain.
7:
8: The Promise API uses Promises instead of Effects for setup, runtime hook
9: callbacks, hook registration, `reload`, and `Registration.dispose`. Transform
10: editor callbacks remain synchronous.
11:
12: ## Defining A Plugin
13:
14: ```ts
15: import { Plugin } from "@opencode/plugin"
16:
17: export default Plugin.define({
18: id: "example",
19: setup: async (ctx) => {
20: await ctx.catalog.transform((catalog) => {
21: catalog.provider.update("example", (provider) => {
22: provider.name = "Example"
23: })
24: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/promise.ts</path>
<type>file</type>
<content>
1: export * as PluginPromise from "./promise.js"
2:
3: export { fromPromise } from "@opencode/plugin/promise/adapter"
(End of file - total 3 lines)
</content>
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/module.ts</path>
<type>file</type>
<content>
1: export * as PluginModule from "./module.js"
2:
3: import type { Plugin } from "@opencode/plugin/effect/plugin"
4: import { Host } from "@opencode/plugin/host"
5: import { createPluginSources } from "@opencode/plugin/source"
6: import { Npm } from "@opencode/util/npm"
7: import { Deferred, Effect, FiberSet, PubSub, Schema, Stream } from "effect"
8: import path from "path"
9: import { stat } from "node:fs/promises"
10: import { fileURLToPath, pathToFileURL } from "url"
11: import type { ConfigPluginSource } from "../config/plugin/source.js"
12: import type { Generation } from "../plugin.js"
13: import { PluginPromise } from "./promise.js"
14: import { Watcher } from "../filesystem/watcher.js"
15:
16: export const make = Effect.fn("PluginModule.make")(function* () {
17: const watcher = yield* Watcher.Service
18: const scope = yield* Effect.scope
19: const runPromise = ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/host.ts</path>
<type>file</type>
<content>
1: export * as Host from "./host.js"
2:
3: import path from "node:path"
4: import { importModule, resolveModule } from "@opencode/util/runtime-import"
5:
6: export interface Target {
7: readonly directory: string
8: readonly name?: string
9: }
10:
11: export interface Entrypoints {
12: readonly server?: string
13: readonly tui?: string
14: readonly rpc?: string
15: }
16:
17: export function resolve(target: Target): Entrypoints {
18: const entry = (subpaths: readonly string[]) => {
19: for (const subpath of subpaths) {
20: const specifier = target.name
21: ? [target.name, subpath].filter(Boolean).join("/")
22: : path.resolve(target.directory, subpath || "index")
23: try {
24: return resolveModule(specifier, target.directory)
25: } catch (error) {
26: if (
27: !(error instanceof Error) ||
28: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/config/plugin/source.ts</path>
<type>file</type>
<content>
1: export * as ConfigPluginSource from "./source.js"
2:
3: import { Directory, Document, type Entry } from "@opencode/schema/config"
4: import { ConfigPlugin } from "@opencode/schema/config/plugin"
5: import { FSUtil } from "@opencode/util/fs-util"
6: import { Host } from "@opencode/plugin/host"
7: import { makeLocationNode } from "@opencode/util/effect/app-node"
8: import { Context, Effect, Layer, Option, PubSub, Scope, Stream } from "effect"
9: import path from "path"
10: import { fileURLToPath, pathToFileURL } from "url"
11: import { Config } from "../../config.js"
12: import { Watcher } from "../../filesystem/watcher.js"
13: import { Location } from "../../location.js"
14: import { PluginSourceDirectory } from "../../plugin/source-directory.js"
15:
16: export type Operation =
17: | {
18: readonly type: "add"
19: readonly target: string
20: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/schema/src/config/plugin.ts</path>
<type>file</type>
<content>
1: export * as ConfigPlugin from "./plugin.js"
2:
3: import { Schema } from "effect"
4: import { optional } from "../schema.js"
5:
6: export class Entry extends Schema.Class<Entry>("Config.Plugin.Entry")({
7: package: Schema.String,
8: options: Schema.Record(Schema.String, Schema.Unknown).pipe(optional),
9: }) {}
10:
11: export const Plugin = Schema.Union([Schema.String, Entry])
12: export type Plugin = typeof Plugin.Type
13:
14: export const Plugins = Plugin.pipe(Schema.Array)
(End of file - total 14 lines)
</content>
Found 100 matches (more matches available)
/home/byk/Code/opencode-v2-pilot/README.fr.md:
Line 108: - Idéal pour explorer une base de code inconnue ou planifier des changements
/home/byk/Code/opencode-v2-pilot/AGENTS.md:
Line 19: - Render the real production component rather than a visual copy. Keep submissions and other side effects local to the story so it is safe to explore repeatedly.
/home/byk/Code/opencode-v2-pilot/packages/stats/app/src/i18n/fr.ts:
Line 4: "Explorez l'utilisation d'OpenCode Go par modèle d'IA, avec le volume de tokens, les classements, la part de marché, le prix des tokens, le coût par session, le taux de cache et les répartitions géographiques.",
Line 137: "lab.heroPrefix": "Explorez {{count}} modèles {{lab}} utilisés dans OpenCode",
/home/byk/Code/opencode-v2-pilot/packages/stats/app/src/i18n/br.ts:
Line 4: "Explore o uso do OpenCode Go em modelos de IA, incluindo volume de tokens, rankings, participação de mercado, preço por ...
No files found
Found 100 matches (more matches available) /home/byk/Code/opencode-v2-pilot/services/files/README.md: Line 80: R2 key: bin/0.0.0-dev-123/opencode2-linux-x64.tar.gz Line 81: URL: https://opencode.ai/files/bin/0.0.0-dev-123/opencode2-linux-x64.tar.gz /home/byk/Code/opencode-v2-pilot/package.json: Line 11: "dev:live": "sh -c 'OPENCODE_TUI_CHANNEL=dev OPENCODE_PASSWORD=\"$(opencode2 service get password)\" exec bun run dev \"$@\" --server \"$(opencode2 service status)\"' --", /home/byk/Code/opencode-v2-pilot/AGENTS.md: Line 11: - Run `bun run dev:live` from a development worktree to test its TUI against the currently elected `opencode2` background server and live sessions. Line 13: - The script discovers the server with `opencode2 service status`, injects its private local credential from `opencode2 service get password`, and uses the `dev` TUI storage channel so tabs and other client-local state match the installed client. ...
<path>/home/byk/.config/systemd/user</path> <type>directory</type> <entries> chromecast-avr-bridge.service default.target.wants/ lore-gateway.service opencode-v2-pilot.service (4 entries) </entries>
<path>/home/byk/.config/systemd/user/opencode-v2-pilot.service</path> <type>file</type> <content> 1: [Unit] 2: Description=OpenCode V2 pilot server 3: After=network-online.target 4: Wants=network-online.target 5: 6: [Service] 7: Type=simple 8: WorkingDirectory=/home/byk 9: Environment=XDG_DATA_HOME=/home/byk/.local/share/opencode-v2-pilot/data 10: Environment=XDG_CACHE_HOME=/home/byk/.local/share/opencode-v2-pilot/cache 11: Environment=XDG_CONFIG_HOME=/home/byk/.local/share/opencode-v2-pilot/config 12: Environment=XDG_STATE_HOME=/home/byk/.local/share/opencode-v2-pilot/state 13: Environment=OPENCODE_CONFIG_DIR=/home/byk/.local/share/opencode-v2-pilot/config/opencode 14: Environment=OPENCODE_DB=/home/byk/.local/share/opencode-v2-pilot/data/opencode/opencode.db 15: ExecStart=/home/byk/Code/opencode-v2-pilot/packages/cli/dist-v2-pilot/cli-node-linux-x64/bin/opencode2-node serve --service 16: Restart=on-failure 17: RestartSec=3 18: TimeoutStopSec=30 19: 20: [Install] 21: ...
<path>/home/byk/.local/share/opencode-v2-pilot/config/opencode</path> <type>directory</type> <entries> bun.lock node_modules/ opencode.json package.json plugins/ service-v2-pilot.json test/ tsconfig.json types/ (9 entries) </entries>
<path>/home/byk/.local/share/opencode-v2-pilot/config/opencode/opencode.json</path>
<type>file</type>
<content>
1: {
2: "$schema": "https://opencode.ai/config.json"
3: }
(End of file - total 3 lines)
</content>
<path>/home/byk/.local/share/opencode-v2-pilot/config/opencode/package.json</path>
<type>file</type>
<content>
1: {
2: "private": true,
3: "type": "module",
4: "dependencies": {
5: "effect": "file:/home/byk/Code/opencode-v2-pilot/node_modules/.bun/effect@4.0.0-rc.112/node_modules/effect"
6: },
7: "devDependencies": {
8: "@types/bun": "1.2.21"
9: }
10: }
(End of file - total 10 lines)
</content>
<path>/home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins</path> <type>directory</type> <entries> followup.ts pty.ts (2 entries) </entries>
<path>/home/byk/.local/share/opencode-v2-pilot/config/opencode/service-v2-pilot.json</path>
<type>file</type>
<content>
1: {
2: "hostname": "127.0.0.1",
3: "port": 14104,
4: "password": "0ZEDypl6r2V8gYMw+bfbOvabqO7NvvaG6+m/NvAHxJg="
5: }
(End of file - total 5 lines)
</content>
Found 5 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin.ts:
Line 42: let inventory: Plugin.Info[] = []
Line 285: function slotInfo(slot: Slot): Plugin.Info {
/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/supervisor.ts:
Line 34: Plugin.Info & { readonly state: Extract<Plugin.State, { readonly status: "failed" }> }
/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/service.ts:
Line 11: readonly list: () => Effect.Effect<Plugin.Info[]>
Line 19: export type Failure = Plugin.Info & { readonly state: Extract<Plugin.State, { readonly status: "failed" }> }
/home/byk/Code/opencode-v2-pilot/packages/protocol/src/groups/plugin.ts
<path>/home/byk/Code/opencode-v2-pilot/packages/protocol/src/groups/plugin.ts</path>
<type>file</type>
<content>
1: import { Location } from "@opencode/schema/location"
2: import { Plugin } from "@opencode/schema/plugin"
3: import { Schema } from "effect"
4: import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/unstable/httpapi"
5: import { InvalidRequestError, ServiceUnavailableError } from "../errors.js"
6: import { LocationQuery, locationQueryOpenApi } from "./location.js"
7:
8: export const PluginGroup = HttpApiGroup.make("server.plugin")
9: .add(
10: HttpApiEndpoint.get("plugin.list", "/api/plugin", {
11: query: LocationQuery,
12: success: Location.response(Schema.Array(Plugin.Info)),
13: })
14: .annotateMerge(locationQueryOpenApi)
15: .annotateMerge(
16: OpenApi.annotations({
17: identifier: "v2.plugin.list",
18: summary: "List plugins",
19: description: "Retrieve enabled server ...
<path>/home/byk/Code/opencode-v2-pilot/packages/protocol/src/groups/location.ts</path>
<type>file</type>
<content>
1: import { Location } from "@opencode/schema/location"
2: import { Schema } from "effect"
3: import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi"
4:
5: export const LocationQuery = Schema.Struct({
6: location: Schema.optional(
7: Schema.Struct({
8: directory: Schema.optional(Schema.String),
9: workspace: Schema.optional(Schema.String),
10: }),
11: ),
12: }).annotate({ identifier: "LocationQuery" })
13:
14: export const locationQueryOpenApi = OpenApi.annotations({
15: transform: (operation) => {
16: const parameters = operation.parameters
17: if (!Array.isArray(parameters)) return operation
18: return {
19: ...operation,
20: parameters: parameters.map((parameter) =>
21: parameter?.name === "location" && parameter?.in === "query"
22: ? { ...parameter, style: "deepObject", ...
Failed to connect to bus: No medium found
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/source-directory.ts</path>
<type>file</type>
<content>
1: export * as PluginSourceDirectory from "./source-directory.js"
2:
3: import { FSUtil } from "@opencode/util/fs-util"
4: import { Effect, Option } from "effect"
5: import path from "path"
6:
7: export const names = ["plugin", "plugins"] as const
8:
9: export const discover = Effect.fn("PluginSourceDirectory.discover")(function* (
10: fs: FSUtil.Interface,
11: directory: string,
12: ) {
13: const children = (yield* Effect.forEach(names, (source) =>
14: fs.readDirectoryEntries(path.join(directory, source)).pipe(
15: Effect.orElseSucceed(() => []),
16: Effect.map((entries) => entries.map((entry) => ({ ...entry, target: path.join(directory, source, entry.name) }))),
17: ),
18: ))
19: .flat()
20: .sort((a, b) => (a.target < b.target ? -1 : a.target > b.target ? 1 : 0))
21: const targets = yield* Effect.forEach(children, (entry) ...
<path>/home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/followup.ts</path>
<type>file</type>
<content>
1: import { Plugin } from "@opencode/plugin"
2: import { Schema } from "effect"
3:
4: const SUBAGENT_REFUSAL =
5: "Error: scheduled follow-ups are disabled in subagents. A subagent must finish its task and return a result synchronously."
6:
7: const DelayInput = Schema.Struct({
8: delay: Schema.String.annotate({
9: description: "How long to wait, such as 30s, 2m, or 1h. A bare number means seconds.",
10: }),
11: message: Schema.String.annotate({
12: description: "The instruction to deliver when the delay expires.",
13: }),
14: })
15:
16: const EmptyInput = Schema.Struct({})
17:
18: const CancelInput = Schema.Struct({
19: id: Schema.String.annotate({ description: "The follow-up ID to cancel, or all." }),
20: })
21:
22: export default Plugin.define({
23: id: "followup",
24: async setup(ctx) {
25: const pending = new Map<
26: string,
27: ...
<path>/home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/pty.ts</path>
<type>file</type>
<content>
1: import { Plugin } from "@opencode/plugin"
2: import type { Context } from "@opencode/plugin/plugin"
3: import type { ToolContext } from "@opencode/plugin/tool"
4: import { Schema } from "effect"
5: import { spawn } from "node:child_process"
6: import { open, realpath } from "node:fs/promises"
7: import type { FileHandle } from "node:fs/promises"
8: import { constants } from "node:fs"
9: import { Readable } from "node:stream"
10: import { StringDecoder } from "node:string_decoder"
11:
12: type PtyPluginOptions = {
13: openProcess?: typeof openPtyProcess
14: spawnTimeoutMs?: number
15: }
16:
17: const MAX_SESSIONS = 16
18: const MAX_SESSIONS_PER_OWNER = 5
19: const DEFAULT_READ_LIMIT = 500
20: const MAX_READ_LIMIT = 2_000
21: const MAX_READ_OFFSET = 10_000
22: const MAX_LINE_LENGTH = 2_000
23: const MAX_PATTERN_LENGTH = 500
24: const MAX_WRITE_SIZE = 65_536
25: const ...
Found 21 matches
/home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/pty.ts:
Line 73: id: Schema.String.annotate({ description: "The PTY session ID." }),
Line 80: id: Schema.String.annotate({ description: "The PTY session ID." }),
Line 96: id: Schema.String.annotate({ description: "The PTY session ID." }),
Line 107: id: string
Line 119: pid: number
Line 141: pid: number
Line 150: id: "local-pty",
Line 164: id: session.id,
Line 176: pid: session.pid,
Line 190: id: session.id,
Line 282: pid: process.pid,
Line 357: return result(JSON.stringify({ type: "pty.write", id: input.id, bytes }))
Line 386: id: session.id,
Line 424: return result(JSON.stringify({ type: "pty.kill", id: input.id, removed: true }))
Line 430: return result(JSON.stringify({ type: "pty.kill", id: input.id, removed: false, status: current.status }))
Line 493: export default createPtyPlugin()
Line 499: function ...
<path>/home/byk/.local/share/opencode-v2-pilot</path> <type>directory</type> <entries> cache/ config/ CUTOVER.md data/ opencode-v2.service state/ supervisor/ (7 entries) </entries>
<path>/home/byk/.local/share/opencode-v2-pilot/data/opencode</path> <type>directory</type> <entries> log/ opencode.db repos/ shell/ (4 entries) </entries>
<path>/home/byk/.local/share/opencode-v2-pilot/data/opencode/log</path> <type>directory</type> <entries> opencode.log (1 entries) </entries>
Found 10 matches /home/byk/.local/share/opencode-v2-pilot/data/opencode/log/opencode.log: Line 48: timestamp=2026-09-08T18:40:37.500Z level=INFO run=9386f4fa msg="loading plugin" id=/home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/followup.ts entrypoint=file:///home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/followup.ts http.span=185 role=server Line 51: timestamp=2026-09-08T18:40:38.047Z level=INFO run=9386f4fa msg="loading plugin" id=/home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/pty.ts entrypoint=file:///home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/pty.ts http.span=732 role=server Line 76: timestamp=2026-09-08T18:45:40.850Z level=INFO run=9386f4fa msg="loading plugin" id=/home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/followup.ts entrypoint=file:///home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/followup.ts http.span=303535 role=server Line 77: ...
<path>/home/byk/.local/share/opencode-v2-pilot/data/opencode/log/opencode.log</path> <type>file</type> <content> 180: timestamp=2026-09-08T19:03:21.793Z level=INFO run=132dc9d8 message="watcher subscribe" path=/home/byk/.local/share/opencode-v2-pilot/config/opencode type=directory ignores=3 http.span=61 role=server 181: timestamp=2026-09-08T19:03:21.798Z level=INFO run=132dc9d8 message="watcher subscribe" path=/home/byk/.opencode type=directory ignores=3 http.span=66 role=server 182: timestamp=2026-09-08T19:03:21.800Z level=INFO run=132dc9d8 message="watcher subscribe" path=/ type=entries ignores=0 http.span=68 role=server 183: timestamp=2026-09-08T19:03:21.802Z level=INFO run=132dc9d8 message="watcher started" path=/ type=entries backend=node ignores=0 http.span=70 role=server 184: timestamp=2026-09-08T19:03:21.802Z level=INFO run=132dc9d8 message="watcher subscribe" path=/home type=entries ignores=0 http.span=70 role=server 185: timestamp=2026-09-08T19:03:21.802Z level=INFO ...
<path>/home/byk/.opencode/opencode.json</path>
<type>file</type>
<content>
1: {
2: "$schema": "https://opencode.ai/config.json",
3: "model": "openrouter/anthropic/claude-opus-4.8",
4: "permission": "allow",
5: "snapshot": false,
6: "autoupdate": false,
7: "server": {
8: "port": 4096,
9: "hostname": "0.0.0.0",
10: "mdns": false,
11: "cors": [
12: "http://labs:4096",
13: "https://opencode.sheep-fir.ts.net"
14: ]
15: },
16: "default_agent": "build",
17: }
(End of file - total 17 lines)
</content>
<path>/home/byk/.opencode</path> <type>directory</type> <entries> .gitignore bin/ bun.lock command/ env messages/ node_modules/ opencode.json opencode.json.tui-migration.bak package-lock.json package.json parts/ server.backups/ server.previous/ server/ tui.json (16 entries) </entries>
<path>/home/byk/Code/opencode-lore/packages/opencode/README.md</path>
<type>file</type>
<content>
1: # @loreai/opencode
2:
3: > **Experimental** — Under active development. APIs, storage format, and behavior may change.
4:
5: Three-tier memory architecture for [OpenCode](https://opencode.ai) — distillation, not summarization.
6:
7: An implementation of [Sanity's Nuum](https://www.sanity.io/blog/how-we-solved-the-agent-memory-problem) memory architecture and [Mastra's Observational Memory](https://mastra.ai/research/observational-memory) system as an OpenCode plugin. Preserves operational intelligence (file paths, error messages, exact decisions) rather than narrative summaries that lose the details agents need to keep working.
8:
9: ## Install
10:
11: Add to your project's `opencode.json`:
12:
13: ```json
14: {
15: "plugin": [
16: "@loreai/opencode"
17: ]
18: }
19: ```
20:
21: Restart OpenCode and the plugin will be installed automatically. ...
<path>/home/byk/Code/opencode-lore/packages/opencode/test/index.test.ts</path>
<type>file</type>
<content>
1: import { describe, test, expect } from "vitest";
2: import { fileURLToPath } from "node:url";
3: import { LorePlugin } from "../src/index";
4: import { applyLoreProviderConfig } from "../src/internal";
5: import type { Plugin } from "@opencode-ai/plugin";
6:
7: /**
8: * Minimal mock of the OpenCode client. Only stubs the methods the plugin
9: * actually calls during initialization.
10: */
11: function createMockClient() {
12: return {
13: tui: {
14: showToast: () => Promise.resolve(),
15: },
16: session: {
17: get: () => Promise.resolve({ data: {} }),
18: list: () => Promise.resolve({ data: [] }),
19: create: () => Promise.resolve({ data: { id: "worker_1" } }),
20: messages: () => Promise.resolve({ data: [] }),
21: message: () => Promise.resolve({ data: null }),
22: prompt: () => Promise.resolve({ data: {} }),
23: ...
<path>/home/byk/Code/opencode-lore/packages/opencode/test/session-state.test.ts</path> <type>file</type> <content> 1: /** 2: * Tests for per-project state in the OpenCode plugin (B2). 3: * 4: * The plugin function (`LorePlugin`) can be called multiple times in the 5: * same process — e.g., when the user has multiple OpenCode worktrees open 6: * in parallel, or when a sub-agent spawns a new project context. The 7: * per-project Map ensures that: 8: * - Each project gets its own registered project path + git remote 9: * - The `chat.headers` hook injects the right headers per request 10: * - Concurrent project registrations don't clobber each other 11: * 12: * Regression coverage for the "lore-config" bug variant where the module- 13: * level `currentProjectPath` global was overwritten by sibling project 14: * inits, causing requests to be misattributed. ...
<path>/home/byk/Code/opencode-lore/packages/opencode/test/subagent-detection.test.ts</path>
<type>file</type>
<content>
1: /**
2: * OpenCode sub-agent detection (#1300).
3: *
4: * A Task sub-agent runs in a child session whose `parentID` points at the
5: * spawning session. The plugin's `chat.headers` hook resolves that parent via
6: * the SDK and forwards it as `x-parent-session-id` — the same signal Claude
7: * Code emits natively — so the gateway flags the session as a sub-agent and
8: * sizes its LTM injection (#1302). Primary sessions have no parent and emit no
9: * such header.
10: *
11: * The lookup is cached per session and must never block or break the request.
12: */
13: import { mkdtempSync, rmSync } from "node:fs";
14: import { tmpdir } from "node:os";
15: import { join } from "node:path";
16: import type { Hooks, PluginInput } from "@opencode-ai/plugin";
17: import { afterEach, describe, expect, test } from "vitest";
18: import { LorePlugin } from ...
<path>/home/byk/Code/opencode-lore/packages/opencode/test/routing.e2e.test.ts</path> <type>file</type> <content> 1: /** 2: * End-to-end test: the OpenCode plugin's REAL active path against a REAL 3: * in-process Lore gateway (upstream mocked — no real API call). 4: * 5: * Unlike the config-hook units (index.test.ts) and per-project header units 6: * (session-state.test.ts) — which run with the plugin inert under 7: * `NODE_ENV=test` — this test forces the plugin active via 8: * `LORE_OPENCODE_FORCE_ACTIVE=1` and points it at a controlled gateway via 9: * `LORE_GATEWAY_URL`, then proves the wiring the whole #1036/#1039 series 10: * exists to guard: 11: * 1. the plugin DISCOVERS the gateway (gatewayBase is resolved, not ""), 12: * so its `config` hook actually pins provider baseURLs to it, 13: * 2. the `chat.headers` hook injects the `x-lore-*` attribution headers, and 14: * 3. ...
<path>/home/byk/Code/opencode-lore/packages/opencode/test/internal.test.ts</path>
<type>file</type>
<content>
1: import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
2: import type { PluginInput } from "@opencode-ai/plugin";
3: import { log } from "@loreai/core";
4: import {
5: gatewayAccessHeadersForRemote,
6: shouldForwardUpstreamExtraHeader,
7: surfaceGatewayUnavailable,
8: } from "../src/internal";
9:
10: describe("remote gateway access headers", () => {
11: const token = "opencode-remote-gateway-token-at-least-32";
12:
13: test("injects the access token only for the matching LORE_REMOTE_URL", () => {
14: expect(
15: gatewayAccessHeadersForRemote("https://lore.example", {
16: LORE_REMOTE_URL: "https://lore.example/",
17: LORE_GATEWAY_AUTH_TOKEN: token,
18: }),
19: ).toEqual({ "x-lore-gateway-token": token });
20:
21: expect(
22: gatewayAccessHeadersForRemote("http://127.0.0.1:3207", {
23: ...
Found 78 matches
/home/byk/Code/opencode-lore/packages/opencode/package.json:
Line 21: "@opencode-ai/plugin": ">=1.1.0"
Line 28: "@opencode-ai/plugin": "^1.1.39",
Line 29: "@opencode-ai/sdk": "^1.1.39",
/home/byk/Code/opencode-lore/packages/opencode/test/index.test.ts:
Line 5: import type { Plugin } from "@opencode-ai/plugin";
Line 37: type PluginInput = Parameters<typeof LorePlugin>[0];
Line 40: project: { id: "test", path: tmpDir } as unknown as PluginInput["project"],
Line 44: $: {} as unknown as PluginInput["$"],
Line 59: await hooks.config?.(cfg);
Line 71: await hooks.config?.(cfg);
Line 115: await hooks.config?.(cfg);
Line 265: expect(hooks.config).toBeDefined();
Line 267: // Only config, tool, and chat.headers hooks should be registered
/home/byk/Code/opencode-lore/packages/opencode/test/routing.e2e.test.ts:
Line 13: * 2. the `chat.headers` hook injects the `x-lore-*` attribution ...
Found 9 matches
/home/byk/Code/opencode-v2-pilot/packages/core/test/plugin.test.ts:
Line 16: import { fromPromise } from "@opencode/plugin/promise/adapter"
Line 436: it.live("retains Promise plugin groups for later registrations and ignores a disabled group's attempts", () =>
Line 441: const definition = fromPromise({
Line 447: throw new Error("late Promise failure")
Line 465: it.effect("exposes canonical permission assertions to Promise plugins", () =>
Line 469: const definition = fromPromise({
Line 482: await Effect.runPromise(Deferred.succeed(asserted, undefined))
Line 492: promisePermissionIt.effect("preserves Promise permission assertion outcomes through tool execution", () =>
Line 499: ...fromPromise({
Found 8 matches
/home/byk/Code/opencode-v2-pilot/packages/core/test/plugin.test.ts:
Line 12: import { PluginModule } from "@opencode/core/plugin/module"
Line 107: const modules = yield* PluginModule.make().pipe(Effect.provide(Watcher.testLayer))
Line 442: id: "promise-plugin",
Line 470: id: "promise-permission",
Line 500: id: "promise-permission-tool",
/home/byk/Code/opencode-v2-pilot/packages/core/test/plugin/module.test.ts:
Line 6: import { PluginModule } from "@opencode/core/plugin/module"
Line 25: const modules = yield* PluginModule.make()
Line 69: const modules = yield* PluginModule.make().pipe(
<path>/home/byk/Code/opencode-v2-pilot/packages/core/test/plugin/module.test.ts</path>
<type>file</type>
<content>
1: import { expect } from "bun:test"
2: import path from "node:path"
3: import { Deferred, Effect, Exit, Fiber, Layer, Schedule, Scope, Stream } from "effect"
4: import { AppNodeBuilder } from "@opencode/core/effect/app-node-builder"
5: import { Watcher } from "@opencode/core/filesystem/watcher"
6: import { PluginModule } from "@opencode/core/plugin/module"
7: import { Global } from "@opencode/util/global"
8: import { Npm } from "@opencode/util/npm"
9: import { tempGlobalLayer } from "../fixture/global"
10: import { tmpdirScoped } from "../fixture/tmpdir"
11: import { testEffect } from "../lib/effect"
12:
13: const it = testEffect(
14: Layer.merge(
15: AppNodeBuilder.build(Npm.node, [Global.node.replace(tempGlobalLayer)]),
16: Watcher.layer().pipe(Layer.provide(Watcher.nativeLayer)),
17: ),
18: )
19:
20: it.live("watches creation of an external helper with ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/v1/config/migrate.ts</path>
<type>file</type>
<content>
1: export * as ConfigMigrateV1 from "./migrate.js"
2:
3: import { Info } from "@opencode/schema/config"
4: import { ConfigAgent } from "@opencode/schema/config/agent"
5: import { Schema } from "effect"
6: import { ConfigV1 } from "./config.js"
7: import { ConfigAgentV1 } from "./agent.js"
8: import { ConfigCommandV1 } from "./command.js"
9: import { ConfigMCPV1 } from "./mcp.js"
10: import { ConfigPermissionV1 } from "./permission.js"
11: import { ConfigProviderV1 } from "./provider.js"
12: import { ConfigProviderOptionsV1 } from "./provider-options.js"
13: import { Provider } from "../../provider.js"
14: import { Model } from "../../model.js"
15:
16: const decodeOptions = { errors: "all", onExcessProperty: "ignore", propertyOrder: "original" } as const
17: const decodeInfo = Schema.decodeUnknownSync(Schema.fromJsonString(Info), decodeOptions)
18: const encodeInfo = ...
Found 5 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/config.ts:
Line 96: const parseInfo = Effect.fn("Config.parseInfo")(function* (text: string, source: string) {
Line 132: const info = yield* parseInfo(substituted, filepath)
Line 160: Effect.flatMap((text) => parseInfo(text, entry.origin)),
Line 208: Effect.flatMap((text) => parseInfo(text, "OPENCODE_CONFIG_CONTENT")),
/home/byk/Code/opencode-v2-pilot/packages/core/src/v1/config/config.ts:
Line 1: export * as ConfigV1 from "./config.js"
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/config.ts</path>
<type>file</type>
<content>
70: Effect.gen(function* () {
71: const entries = yield* Ref.make(initial)
72: const updates = yield* PubSub.unbounded<Watcher.Update>()
73: const service = Test.of({
74: entries: () => Ref.get(entries),
75: changes: () => Stream.fromPubSub(updates),
76: setEntries: (next) => Ref.set(entries, next),
77: emitChange: (update) => PubSub.publish(updates, update).pipe(Effect.asVoid),
78: })
79: return Context.empty().pipe(Context.add(Service, service), Context.add(Test, service))
80: }),
81: )
82:
83: export const layer = (options?: Options) =>
84: Layer.effect(
85: Service,
86: Effect.gen(function* () {
87: const fs = yield* FSUtil.Service
88: const location = yield* Location.Service
89: const watcher = yield* Watcher.Service
90: const bus = yield* Bus.Service
91: const ...
/home/byk/Code/opencode-v2-pilot/packages/core/src/config/normalize.ts
Found 76 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/config/normalize.ts:
Line 14: import { ConfigPlugin } from "@opencode/schema/config/plugin"
Line 20: import { ConfigAgentV1 } from "../v1/config/agent.js"
Line 21: import { ConfigAttachmentV1 } from "../v1/config/attachment.js"
Line 22: import { ConfigCommandV1 } from "../v1/config/command.js"
Line 23: import { ConfigMCPV1 } from "../v1/config/mcp.js"
Line 24: import { ConfigPermissionV1 } from "../v1/config/permission.js"
Line 25: import { ConfigPluginV1 } from "../v1/config/plugin.js"
Line 26: import { ConfigProviderV1 } from "../v1/config/provider.js"
Line 27: import { ConfigV1 } from "../v1/config/config.js"
Line 28: import { ConfigMigrateV1 } from "../v1/config/migrate.js"
Line 70: const legacySnapshots = own(input, "snapshot")
Line 73: const legacyUpdate = own(input, "autoupdate")
Line 79: const legacyShare = own(input, "autoshare")
Line 84: const legacyMedia = ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/config/normalize.ts</path>
<type>file</type>
<content>
178:
179: const toolRules = migrateTools(input.tools, diagnostics)
180: const permissionRules = migratePermissions(input.permission, diagnostics)
181: const nativePermissions = decodeList(input.permissions, Permission.Rule, ["permissions"], diagnostics, decodeEncoded)
182: const permissions = [...toolRules, ...permissionRules, ...nativePermissions]
183: if (permissions.length || Array.isArray(input.permissions)) encoded.permissions = permissions
184:
185: const legacyPlugins = decodeList(input.plugin, ConfigPluginV1.Spec, ["plugin"], diagnostics, decodeValue).map(
186: (plugin) => (typeof plugin === "string" ? plugin : { package: plugin[0], options: plugin[1] }),
187: )
188: const nativePlugins = decodeList(input.plugins, ConfigPlugin.Plugin, ["plugins"], diagnostics, decodeEncoded)
189: if (legacyPlugins.length || nativePlugins.length || ...
Found 100 matches (more matches available)
/home/byk/Code/opencode-lore/packages/gateway/test/worker-recovery.test.ts:
Line 131: async function failAdapter(workerID = "lore-distill"): Promise<void> {
Line 190: await failAdapter("lore-curator");
Line 196: workerHealth: makeWorkerHealth(sessionID, "lore-curator"),
Line 212: await failAdapter("lore-query-expand");
Line 268: expect(getWorkerHealth()[0]?.workerIDs).toEqual(["lore-distill"]);
Line 273: await failAdapter("lore-query-expand");
Line 297: expect(getWorkerHealth()[0]?.workerIDs).toEqual(["lore-query-expand"]);
/home/byk/Code/opencode-lore/packages/gateway/test/worker-health.test.ts:
Line 55: recordWorkerFailure("s1", "lore-curator", "parse-error");
Line 57: recordWorkerFailure("s1", "lore-curator", "parse-error");
Line 58: recordWorkerFailure("s1", "lore-distill", "no-response");
Line 59: makeWorkerHealth("s1", "lore-distill").recordSuccess();
Line 61: ...
No files found
Found 100 matches (more matches available)
/home/byk/Code/opencode-lore/packages/gateway/test/worker-recovery.test.ts:
Line 131: async function failAdapter(workerID = "lore-distill"): Promise<void> {
Line 190: await failAdapter("lore-curator");
Line 196: workerHealth: makeWorkerHealth(sessionID, "lore-curator"),
Line 212: await failAdapter("lore-query-expand");
Line 268: expect(getWorkerHealth()[0]?.workerIDs).toEqual(["lore-distill"]);
Line 273: await failAdapter("lore-query-expand");
Line 297: expect(getWorkerHealth()[0]?.workerIDs).toEqual(["lore-query-expand"]);
/home/byk/Code/opencode-lore/packages/gateway/test/worker-health.test.ts:
Line 55: recordWorkerFailure("s1", "lore-curator", "parse-error");
Line 57: recordWorkerFailure("s1", "lore-curator", "parse-error");
Line 58: recordWorkerFailure("s1", "lore-distill", "no-response");
Line 59: makeWorkerHealth("s1", "lore-distill").recordSuccess();
Line 61: ...
Found 18 matches /home/byk/Code/opencode-lore/packages/gateway/src/pipeline.ts: Line 12891: // thousands of futile calls (Sentry: runaway lore-distill failure counts). Line 12930: workerHealth: makeWorkerHealth(sessionID, "lore-distill"), Line 12977: workerHealth: makeWorkerHealth(sessionID, "lore-distill"), Line 13062: workerHealth: makeWorkerHealth(sessionID, "lore-curator"), Line 13169: workerHealth: makeWorkerHealth(sessionID, "lore-distill"), Line 19082: workerHealth: makeWorkerHealth(sessionID, "lore-distill"), Line 19104: workerHealth: makeWorkerHealth(sessionID, "lore-curator"), /home/byk/Code/opencode-lore/packages/gateway/src/idle.ts: Line 1153: workerHealth: makeWorkerHealth(sessionID, "lore-distill"), Line 1181: workerHealth: makeWorkerHealth(sessionID, "lore-distill"), Line 1227: workerHealth: makeWorkerHealth(sessionID, ...
<path>/home/byk/Code/opencode-lore/packages/gateway/src/pipeline.ts</path> <type>file</type> <content> 12870: // cross-provider config (e.g. MiniMax workers, Anthropic sessions) is exactly 12871: // when model.providerID legitimately differs from the session's credential. 12872: if ( 12873: !config.workerApiKey && 12874: model && 12875: !hasWorkerSessionAuth( 12876: sessionID, 12877: model.providerID, 12878: matchingProviderSnapshot(sessionState, model.providerID)?.protocol, 12879: ) 12880: ) 12881: return; 12882: 12883: // When the OAuth account is near quota exhaustion, skip non-urgent 12884: // background work to preserve remaining entitlement for user-facing turns. 12885: // Urgent distillation is exempt (it unblocks the next user turn). ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/agent.ts</path>
<type>file</type>
<content>
1: export * as AgentPlugin from "./agent.js"
2:
3: import { define } from "@opencode/plugin/effect/plugin"
4: import { Effect } from "effect"
5: import { Agent } from "../agent.js"
6: import { Permission } from "../permission.js"
7:
8: const PROMPT_EXPLORE = `You are a file search specialist. You excel at thoroughly navigating and exploring codebases.
9:
10: Your strengths:
11: - Rapidly finding files using glob patterns
12: - Searching code and text with powerful regex patterns
13: - Reading and analyzing file contents
14:
15: Guidelines:
16: - Use Glob for broad file pattern matching
17: - Use Grep for searching file contents with regex
18: - Use Read when you know the specific file path you need to read
19: - Adapt your search approach based on the thoroughness level specified by the caller
20: - Return file paths as absolute paths in your final response
21: - For clear ...
Found 56 matches
/home/byk/Code/opencode-lore/packages/opencode/test/routing.e2e.test.ts:
Line 208: expect(output.headers["x-lore-agent"]).toBe("build");
Line 226: "x-lore-agent": "build",
/home/byk/Code/opencode-lore/packages/opencode/test/session-state.test.ts:
Line 119: expect(output.headers["x-lore-agent"]).toBe("coder");
/home/byk/Code/opencode-lore/packages/opencode/src/index.ts:
Line 387: output.headers["x-lore-agent"] = input.agent;
/home/byk/Code/opencode-lore/packages/gateway/test/session-retention.test.ts:
Line 61: "x-lore-agent": "coder",
/home/byk/Code/opencode-lore/packages/gateway/test/recall-exhaustion.test.ts:
Line 277: "x-lore-agent": "coder",
/home/byk/Code/opencode-lore/packages/gateway/test/recall-buffered-transaction.test.ts:
Line 732: "x-lore-agent": "coder",
/home/byk/Code/opencode-lore/packages/gateway/test/pipeline-streaming.test.ts:
Line 296: "x-lore-agent": "coder",
Line ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/agent.ts</path>
<type>file</type>
<content>
1: export * as Agent from "./agent.js"
2:
3: import path from "path"
4: import { makeLocationNode } from "@opencode/util/effect/app-node"
5: import { Array, Context, Effect, Layer, Types } from "effect"
6: import { Agent } from "@opencode/schema/agent"
7: import { Global } from "@opencode/util/global"
8: import { Bus } from "./bus.js"
9: import { State } from "./state.js"
10:
11: const SHELL_OUTPUT_GLOB = (data: string) => path.join(data, "shell", "*", "*")
12: const TOOL_OUTPUT_GLOB = (data: string) => path.join(data, "tool-output", "*")
13:
14: export const ID = Agent.ID
15: export type ID = typeof ID.Type
16: export const Name = Agent.Name
17: export type Name = Agent.Name
18: export const defaultID = ID.make("build")
19:
20: export const Color = Agent.Color
21:
22: export const Info = Agent.Info
23: export type Info = Agent.Info
24:
25: export { Event } from ...
<path>/home/byk/Code/opencode-v2-pilot/packages/schema/src/agent.ts</path>
<type>file</type>
<content>
1: export * as Agent from "./agent.js"
2:
3: import { Schema } from "effect"
4: import { ephemeral, inventory } from "./event.js"
5: import { optional } from "./schema.js"
6: import { Model } from "./model.js"
7: import { Permission } from "./permission.js"
8: import { Provider } from "./provider.js"
9: import { PositiveInt, statics } from "./schema.js"
10:
11: const Updated = ephemeral({ type: "agent.updated", schema: {} })
12:
13: export const ID = Schema.String.pipe(Schema.brand("Agent.ID"))
14: export type ID = typeof ID.Type
15:
16: export const Name = Schema.String.pipe(Schema.brand("Agent.Name"))
17: export type Name = typeof Name.Type
18:
19: export const Color = Schema.String.annotate({ identifier: "Agent.Color" })
20: export type Color = typeof Color.Type
21:
22: export interface Info extends Schema.Schema.Type<typeof Info> {}
23: export const Info = ...
Found 40 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/config/normalize.ts:
Line 324: if (!isRecord(input.compaction)) {
Line 328: unsupportedIfPresent(input.compaction, "tail_turns", ["compaction", "tail_turns"], diagnostics)
Line 329: unsupportedIfPresent(input.compaction, "prune", ["compaction", "prune"], diagnostics)
Line 331: if (own(input.compaction, "auto")) {
Line 334: input.compaction.auto,
Line 340: const legacyTokens = own(input.compaction, "preserve_recent_tokens")
Line 343: input.compaction.preserve_recent_tokens,
Line 348: const nativeKeep = isRecord(input.compaction.keep) ? input.compaction.keep : undefined
Line 349: if (own(input.compaction, "keep") && !nativeKeep) invalid(["compaction", "keep"], diagnostics)
Line 361: const legacyBuffer = own(input.compaction, "reserved")
Line 364: input.compaction.reserved,
Line 369: const nativeBuffer = own(input.compaction, "buffer")
Line ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/config/plugin/compaction.ts</path>
<type>file</type>
<content>
1: export * as ConfigCompactionPlugin from "./compaction.js"
2:
3: import { define } from "@opencode/plugin/effect/plugin"
4: import { Effect } from "effect"
5: import { Config } from "../../config.js"
6: import { SessionCompaction } from "../../session/compaction.js"
7: import { ConfigEntryObserver } from "./entry-observer.js"
8:
9: export const Plugin = define({
10: id: "opencode.config.compaction",
11: effect: Effect.fn(function* (ctx) {
12: const config = yield* Config.Service
13: const compaction = yield* SessionCompaction.Service
14: const loaded = yield* ConfigEntryObserver.observe(config, ctx.event, compaction.reload())
15: yield* compaction.transform((editor) => {
16: for (const entry of loaded.entries) {
17: if (entry.type !== "document" || !entry.info.compaction) continue
18: editor.configure({
19: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/effect/plugin.ts</path>
<type>file</type>
<content>
1: import type { ExperimentalApi, GenerateApi, PluginApi } from "@opencode/client/effect/api"
2: import type { Location } from "@opencode/schema/location"
3: import type { Effect, Scope } from "effect"
4: import type { PluginOptions } from "../options.js"
5: import type { App } from "../app.js"
6: import type { AgentDomain } from "./agent.js"
7: import type { AISDKDomain } from "./aisdk.js"
8: import type { CatalogDomain } from "./catalog.js"
9: import type { CommandDomain } from "./command.js"
10: import type { EventDomain } from "./event.js"
11: import type { IntegrationDomain } from "./integration.js"
12: import type { MCPDomain } from "./mcp.js"
13: import type { PermissionDomain } from "./permission.js"
14: import type { ReferenceDomain } from "./reference.js"
15: import type { RpcDomain } from "./rpc.js"
16: import type { SessionDomain } from "./session.js"
17: import ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/session/compaction.ts</path>
<type>file</type>
<content>
650: }
651: yield* recordUsage
652: const summary = chunks.join("")
653: if (failure || !hasSummarySection(summary)) {
654: const error = failure ?? {
655: type: "compaction.failed" as const,
656: message: summary.trim()
657: ? "Compaction summary did not match the required template"
658: : "Compaction produced no summary",
659: }
660: return yield* failed({
661: sessionID: context.session.id,
662: reason: input.reason,
663: error,
664: inputID: input.inputID,
665: })
666: }
667: yield* bus.publish(SessionEvent.Compaction.Ended, {
668: sessionID: context.session.id,
669: reason: input.reason,
670: model: context.model.ref,
671: providerState,
672: text: summary,
673: recent: ...
Found 9 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/session/title.ts:
Line 67: kind: "title",
Line 73: contextHooks: false,
/home/byk/Code/opencode-v2-pilot/packages/core/src/session/model-request.ts:
Line 84: readonly contextHooks?: false
Line 319: if (input.contextHooks !== false) yield* hooks.trigger("session", "context", context)
Line 333: { sessionID: session.id, agent: input.scope.agentID, model: resolved.ref, kind: input.kind },
Line 379: kind: input.kind,
/home/byk/Code/opencode-v2-pilot/packages/core/src/session/generate.ts:
Line 47: kind: "generate",
/home/byk/Code/opencode-v2-pilot/packages/core/src/session/compaction.ts:
Line 429: kind: "compaction",
/home/byk/Code/opencode-v2-pilot/packages/core/src/session/runner/llm.ts:
Line 230: kind: "primary",
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin.ts</path>
<type>file</type>
<content>
1: export * as Plugin from "./plugin.js"
2: export { Event, ID, Info, Source, State } from "@opencode/schema/plugin"
3:
4: import { Plugin } from "@opencode/schema/plugin"
5: import { Node } from "@opencode/util/effect/app-node"
6: import { LayerNode } from "@opencode/util/effect/layer-node"
7: import type { PersistentPty } from "./persistent-pty.js"
8: import { Cause, Context, Effect, Exit, Latch, Layer, Logger, Queue, References, Scope, Semaphore } from "effect"
9: import { Bus } from "./bus.js"
10: import { KV } from "./kv.js"
11: import { PluginHost } from "./plugin/host.js"
12: import { type Failure, type Generation, Service } from "./plugin/service.js"
13: import { State } from "./state.js"
14:
15: export { awaitActivation, type Generation, type Interface, Service } from "./plugin/service.js"
16:
17: const layer = Layer.effect(
18: Service,
19: Effect.gen(function* () ...
Found 4 matches /home/byk/Code/opencode-lore/packages/core/src/index.ts: Line 356: installFetchInterceptor, /home/byk/Code/opencode-lore/packages/core/src/fetch-interceptor.ts: Line 322: * in `installFetchInterceptor()`: a non-null slot means some copy of this Line 338: * The slot is unset until `installFetchInterceptor()` is called, and released Line 421: export function installFetchInterceptor(
<path>/home/byk/Code/opencode-lore/packages/core/src/fetch-interceptor.ts</path>
<type>file</type>
<content>
300: } catch {
301: return false;
302: }
303: }
304:
305: /**
306: * Install a fetch interceptor that transparently reroutes LLM API calls
307: * through the Lore gateway.
308: *
309: * The interceptor:
310: * 1. Checks if the outgoing URL matches a known LLM API path
311: * 2. Rewrites the URL to the gateway, preserving the path
312: * 3. Adds `X-Lore-Upstream-URL` (base) and `X-Lore-Upstream-Path` (original
313: * endpoint pathname, for verbatim forwarding)
314: * 4. Injects dynamic `X-Lore-*` context headers from `getHeaders()`
315: * 5. Preserves ALL original headers (auth, content-type, etc.)
316: *
317: * Returns a cleanup function that restores the original `globalThis.fetch`.
318: */
319: /**
320: * Process-global slot holding the original `globalThis.fetch` captured before
321: * any interceptor was installed. ...
Found 1 matches /home/byk/Code/opencode-v2-pilot/packages/core/src/v1/config/provider.ts: Line 103: headerTimeout: Schema.optional(
Found 2 matches
/home/byk/Code/opencode-v2-pilot/packages/client/src/promise/api.ts:
Line 20: export type SessionApi = Client["session"]
/home/byk/Code/opencode-v2-pilot/packages/client/src/effect/api/api.ts:
Line 1109: export interface SessionApi<E = never> {
<path>/home/byk/Code/opencode-v2-pilot/packages/client/src/promise/api.ts</path>
<type>file</type>
<content>
1: import type { OpenCode } from "./client.js"
2:
3: type Client = ReturnType<typeof OpenCode.make>
4:
5: export type { RpcApi, RpcCallOptions, RpcClient, RpcEventPayload } from "./rpc.js"
6:
7: export type AgentApi = Client["agent"]
8: export type CommandApi = Client["command"]
9: export type ConfigApi = Client["config"]
10: export type EventApi = Client["event"]
11: export type GenerateApi = Client["generate"]
12: export type IntegrationApi = Client["integration"]
13: export type McpApi = Client["mcp"]
14: export type ModelApi = Client["model"]
15: export type PluginApi = Client["plugin"]
16: export type PermissionApi = Client["permission"]
17: export type ProviderApi = Client["provider"]
18: export type ReferenceApi = Client["reference"]
19: export type WebSearchApi = Client["websearch"]
20: export type SessionApi = Client["session"]
21: export type SkillApi = ...
Found 15 matches
/home/byk/Code/opencode-v2-pilot/packages/client/src/promise/generated/client.ts:
Line 412: get: (requestOptions?: RequestOptions) =>
Line 419: get: (requestOptions?: RequestOptions) =>
Line 426: get: (input?: LocationGetInput, requestOptions?: RequestOptions) =>
Line 452: get: (input: AgentGetInput, requestOptions?: RequestOptions) =>
Line 517: session: {
Line 612: get: (input: SessionGetInput, requestOptions?: RequestOptions) =>
Line 1093: get: (input: ProviderGetInput, requestOptions?: RequestOptions) =>
Line 1119: get: (input: IntegrationGetInput, requestOptions?: RequestOptions) =>
Line 1443: get: (input: FormGetInput, requestOptions?: RequestOptions) =>
Line 1560: get: (input: PermissionGetInput, requestOptions?: RequestOptions) =>
Line 1705: get: (input: PtyGetInput, requestOptions?: RequestOptions) =>
Line 1824: get: (input: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/client/src/promise/generated/client.ts</path>
<type>file</type>
<content>
500: },
501: requestOptions,
502: ),
503: update: (input: PluginUpdateInput, requestOptions?: RequestOptions) =>
504: request<PluginUpdateOutput>(
505: {
506: method: "POST",
507: path: `/api/plugin/update`,
508: query: { location: input["location"] },
509: body: { targets: input["targets"] },
510: successStatus: 204,
511: declaredStatuses: [400, 401, 503],
512: empty: true,
513: },
514: requestOptions,
515: ),
516: },
517: session: {
518: list: (input?: SessionListInput, requestOptions?: RequestOptions) =>
519: request<SessionListOutput>(
520: {
521: method: "GET",
522: path: `/api/session`,
523: query: {
524: workspace: ...
Found 1 matches /home/byk/Code/opencode-v2-pilot/packages/plugin/src/tui/context.ts: Line 461: readonly toast: Toast
diff --git a/packages/core/src/plugin/host.ts b/packages/core/src/plugin/host.ts
index 44beadcc6c..6abb955508 100644
--- a/packages/core/src/plugin/host.ts
+++ b/packages/core/src/plugin/host.ts
@@ -383,6 +383,7 @@ export const make = Effect.fn("PluginHost.make")(function* (
},
permission: {
hook: (name, callback) => hooks.register("permission", name, callback),
+ assert: permission.assert,
list: (input) => permission.forSession(input.sessionID),
get: (input) =>
permission
diff --git a/packages/core/test/plugin.test.ts b/packages/core/test/plugin.test.ts
index 1b71e18978..18a6966a62 100644
--- a/packages/core/test/plugin.test.ts
+++ b/packages/core/test/plugin.test.ts
@@ -1,20 +1,33 @@
import { expect } from "bun:test"
import path from "path"
-import { Clock, Deferred, Effect } from "effect"
+import { Cause, Clock, Deferred, Effect, Exit, Schema } from "effect"
import { TestClock } from "effect/testing"
+import { Agent } from ...
<path>/home/byk/Code/opencode-lore/packages/opencode/tsconfig.json</path>
<type>file</type>
<content>
1: {
2: "extends": "../../tsconfig.base.json",
3: "compilerOptions": {
4: "noEmit": true,
5: "types": ["bun"],
6: "paths": {
7: "@loreai/core": ["../core/src/index.ts"]
8: }
9: },
10: "include": ["src", "test", "script", "scripts", "eval"]
11: }
(End of file - total 11 lines)
</content>
File not found: /home/byk/Code/opencode-lore/node_modules/@opencode-ai/plugin/package.json
<path>/home/byk/Code/opencode-lore/packages/opencode/node_modules</path> <type>directory</type> <entries> .bin/ @loreai/ @opencode-ai/ @sentry/ @types/ (5 entries) </entries>
<path>/home/byk/Code/opencode-lore/packages/opencode/node_modules/@opencode-ai/plugin/package.json</path>
<type>file</type>
<content>
1: {
2: "$schema": "https://json.schemastore.org/package.json",
3: "name": "@opencode-ai/plugin",
4: "version": "1.2.15",
5: "type": "module",
6: "license": "MIT",
7: "scripts": {
8: "typecheck": "tsgo --noEmit",
9: "build": "tsc"
10: },
11: "exports": {
12: ".": {
13: "import": "./dist/index.js",
14: "types": "./dist/index.d.ts"
15: },
16: "./tool": {
17: "import": "./dist/tool.js",
18: "types": "./dist/tool.d.ts"
19: }
20: },
21: "files": [
22: "dist"
23: ],
24: "dependencies": {
25: "@opencode-ai/sdk": "1.2.15",
26: "zod": "4.1.8"
27: },
28: "devDependencies": {
29: "@tsconfig/node22": "22.0.2",
30: "@types/node": "22.13.9",
31: "typescript": "5.8.2",
32: "@typescript/native-preview": "7.0.0-dev.20251207.1"
33: }
34: }
(End of file - total 34 ...
<path>/home/byk/Code/opencode-lore/packages/opencode/node_modules/@opencode-ai/plugin/dist/index.d.ts</path>
<type>file</type>
<content>
1: import type { Event, createOpencodeClient, Project, Model, Provider, Permission, UserMessage, Message, Part, Auth, Config } from "@opencode-ai/sdk";
2: import type { BunShell } from "./shell";
3: import { type ToolDefinition } from "./tool";
4: export * from "./tool";
5: export type ProviderContext = {
6: source: "env" | "config" | "custom" | "api";
7: info: Provider;
8: options: Record<string, any>;
9: };
10: export type PluginInput = {
11: client: ReturnType<typeof createOpencodeClient>;
12: project: Project;
13: directory: string;
14: worktree: string;
15: serverUrl: URL;
16: $: BunShell;
17: };
18: export type Plugin = (input: PluginInput) => Promise<Hooks>;
19: export type AuthHook = {
20: provider: string;
21: loader?: (auth: () => Promise<Auth>, provider: Provider) => Promise<Record<string, ...
<path>/home/byk/.local/share/opencode-v2-pilot/config/opencode/node_modules</path> <type>directory</type> <entries> .bin/ @msgpackr-extract/ @protobufjs/ @types/ ajv-draft-04/ ajv/ ast-types/ bun-pty/ bun-types/ csstype/ detect-libc/ effect/ fast-check/ fast-deep-equal/ fast-uri/ immer/ json-schema-traverse/ long/ msgpackr-extract/ msgpackr/ node-gyp-build-optional-packages/ protobufjs/ pure-rand/ require-from-string/ tinybench/ tslib/ undici-types/ valibot/ (28 entries) </entries>
Found 16 matches /home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/skill/opencode.md: Line 5: with plugins, and build integrations with the OpenCode SDK, clients, and API. Line 50: keybindings, terminal plugins, scrolling, attention alerts, diff presentation, Line 91: `agents`, `commands`, `plugins`, `providers`, `mcp`, `skills`, `instructions`, Line 136: plugins, integrations, or other behavior from V1 to V2, read the full Line 141: The only intentional breaking changes are the server API and plugin API. Native Line 145: plugin migrations, fetch and follow both the migration guide and the full Line 146: [plugins guide](https://opencode.ai/v2/docs/build/plugins). If non-API V1 Line 150: ## [Plugins](https://opencode.ai/v2/docs/build/plugins) Line 153: plugins, fetch the full [plugins guide](https://opencode.ai/v2/docs/build/plugins) Line 154: before answering. Refer to this guide when the user wants to build a plugin. ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/skill/opencode.md</path> <type>file</type> <content> 82: During ordinary project discovery, OpenCode searches the current Location 83: directory and every ancestor through the filesystem root, including directories 84: above the detected project or repository root. It merges direct 85: `opencode.json(c)` files from the farthest ancestor to the current directory, 86: then does the same for `.opencode/opencode.json(c)` files. This means every 87: discovered `.opencode` config overrides every discovered direct config. Global 88: filesystem configuration has lower precedence than these discovered documents. 89: 90: Common configuration fields include `model`, `default_agent`, `permissions`, 91: `agents`, `commands`, `plugins`, `providers`, `mcp`, `skills`, `instructions`, 92: `references`, `formatter`, and `lsp`. 93: 94: This configuration is distinct from `cli.json`. Use the 95: [CLI configuration ...
/home/byk/Code/opencode-v2-pilot/services/www/src/docs/content/plugins.mdx /home/byk/Code/opencode-v2-pilot/services/www/src/docs/content/cli/plugins.mdx
/home/byk/Code/opencode-v2-pilot/services/www/src/docs/content/migrate-v1.mdx
<path>/home/byk/Code/opencode-v2-pilot/services/www/src/docs/content/plugins.mdx</path>
<type>file</type>
<content>
1: ---
2: title: "Plugins"
3: ---
4:
5: Load published packages, versioned packages, scoped packages, local plugin directories, or configured plugins from
6: `opencode.json(c)`.
7:
8: ```jsonc title="opencode.jsonc"
9: {
10: "$schema": "https://opencode.ai/config.json",
11: "plugins": [
12: "opencode-acme-plugin",
13: "opencode-acme-plugin@1.2.0",
14: "@acme/opencode-plugin",
15: "./plugins/local",
16: "../shared/plugin.ts",
17: "/absolute/path/plugin.ts",
18: "file:///home/me/plugins/local",
19: {
20: "package": "@acme/opencode-plugin",
21: "options": {
22: "agent": "reviewer",
23: "strict": true,
24: },
25: },
26: ],
27: }
28: ```
29:
30: Relative paths resolve from the config file containing the entry. ...
No files found
<path>/home/byk/Code/opencode-v2-pilot/services/www/src/docs/content</path> <type>directory</type> <entries> agents.mdx attachments.mdx build/ cli/ commands.mdx compaction.mdx config.mdx console/ formatters.mdx index.mdx instructions.mdx lsp.mdx mcp-servers.mdx migrate-v1.mdx models.mdx permissions.mdx plugins.mdx providers.mdx references.mdx sharing.mdx skills.mdx snapshots.mdx themes.mdx troubleshooting.mdx warming.mdx (25 entries) </entries>
<path>/home/byk/Code/opencode-v2-pilot/services/www/src/docs/content/build</path> <type>directory</type> <entries> client/ index.mdx plugins/ sdk/ (4 entries) </entries>
<path>/home/byk/Code/opencode-v2-pilot/services/www/src/docs/content/build/plugins</path> <type>directory</type> <entries> cli.mdx effect.mdx effect/ index.mdx rpc.mdx (5 entries) </entries>
<path>/home/byk/Code/opencode-v2-pilot/services/www/src/docs/content/build/plugins/index.mdx</path>
<type>file</type>
<content>
1: ---
2: title: "Overview"
3: ---
4:
5: Plugins can modify OpenCode's behavior and add new features. To change the terminal UI, build a [CLI
6: plugin](/build/plugins/cli).
7:
8: ```ts title=".opencode/plugins/example/index.ts"
9: import { Plugin } from "@opencode/plugin"
10:
11: export default Plugin.define({
12: id: "example",
13: async setup(ctx) {
14: await ctx.storage.set("loaded", true)
15: },
16: })
17: ```
18:
19: Plugins under `.opencode/plugins/` are loaded automatically, like the local example above. To load published packages
20: or plugin directories from other locations, add them to `plugins` in `opencode.json(c)`:
21:
22: ```jsonc title="opencode.jsonc"
23: {
24: "$schema": "https://opencode.ai/config.json",
25: "plugins": [
26: "opencode-acme-plugin",
27: "opencode-acme-plugin@1.2.0",
28: ...
Found 41 matches /home/byk/Code/opencode-v2-pilot/services/www/src/docs/content/migrate-v1.mdx: Line 12: - [Plugins](#plugins) use a new plugin API. Line 14: - [Terminal client configuration](/cli/config) moves from layered `tui.json(c)` files to one global `cli.json` file (auto Line 21: Existing supported server config fields, agent definitions, command definitions, skills, and other files in `.opencode/` Line 31: OpenCode 2.0 is in beta. Features may break unintentionally, and the server and plugin APIs may continue to change. Line 40: This section covers both JSON/JSONC configuration and file-based definitions under `.opencode/`. Line 42: ### Use your existing configuration Line 44: V2 reads existing global and project configuration from the same locations as V1: Line 47: ~/.config/opencode/opencode.json(c) Line 53: file. ...
<path>/home/byk/Code/opencode-v2-pilot/services/www/src/docs/content/migrate-v1.mdx</path>
<type>file</type>
<content>
519: ## Plugins
520:
521: Rename `plugin` to `plugins`. Replace a package-and-options tuple with an object:
522:
523: ```jsonc
524: // V1
525: {
526: "plugin": [
527: "opencode-example-plugin",
528: ["./plugin/local.ts", { "enabled": true }]
529: ]
530: }
531:
532: // V2
533: {
534: "plugins": [
535: "opencode-example-plugin",
536: {
537: "package": "./plugin/local.ts",
538: "options": { "enabled": true }
539: }
540: ]
541: }
542: ```
543:
544: V2 discovers local plugins from both `.opencode/plugin/` and `.opencode/plugins/`; use `.opencode/plugins/` for V2 files.
545: Moving a file between these directories does not migrate its implementation.
546:
547: <Callout type="warning">V1 plugins will not work in V2.</Callout>
548:
549: The config entry can be translated automatically, but plugin implementation code must be ported ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin-browser/package.json</path>
<type>file</type>
<content>
1: {
2: "$schema": "https://json.schemastore.org/package.json",
3: "name": "@opencode/plugin-browser",
4: "version": "0.0.0",
5: "description": "OpenCode's desktop browser plugin",
6: "type": "module",
7: "license": "MIT",
8: "repository": {
9: "type": "git",
10: "url": "git+https://github.com/anomalyco/opencode.git",
11: "directory": "packages/plugin-browser"
12: },
13: "publishConfig": {
14: "access": "public"
15: },
16: "files": [
17: "dist"
18: ],
19: "exports": {
20: ".": "./src/index.ts",
21: "./rpc": "./src/rpc.ts",
22: "./proxy": "./src/proxy.ts"
23: },
24: "scripts": {
25: "build": "tsc -p tsconfig.build.json",
26: "typecheck": "tsgo --noEmit -p tsconfig.test.json",
27: "test": "bun test"
28: },
29: "dependencies": {
30: "@opencode/plugin": "workspace:*",
31: "@opencode/schema": ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/test/session-model-request-hooks.test.ts</path>
<type>file</type>
<content>
1: import { describe, expect } from "bun:test"
2: import { OpenAIChat } from "@opencode/ai/protocols"
3: import { Agent } from "@opencode/schema/agent"
4: import { Money } from "@opencode/schema/money"
5: import { Session } from "@opencode/schema/session"
6: import type { SessionRequestKind } from "@opencode/plugin/effect/session"
7: import { Location } from "@opencode/core/location"
8: import { PluginHooks } from "@opencode/core/plugin/hooks"
9: import { Project } from "@opencode/core/project"
10: import { AbsolutePath } from "@opencode/core/schema"
11: import { SessionModelRequest } from "@opencode/core/session/model-request"
12: import { SessionModelTransport } from "@opencode/core/session/model-transport"
13: import { SessionRunnerModel } from "@opencode/core/session/runner/model"
14: import { DateTime, Effect } from "effect"
15: import { ...
Found 100 matches (more matches available)
/home/byk/Code/opencode-v2-pilot/packages/core/test/catalog.test.ts:
Line 46: baseURL: "https://fixture.example/v1",
Line 196: provider.settings = { baseURL: "https://gateway.example.com/v1" }
Line 247: provider.settings = { baseURL: "https://override.example.com" }
Line 253: settings: { baseURL: "https://override.example.com" },
Line 266: provider.settings = { baseURL: "https://provider.example.com" }
Line 271: model.settings = { baseURL: "https://override.example.com" }
Line 278: settings: { baseURL: "https://override.example.com" },
Line 291: provider.settings = { baseURL: "https://provider.example.com" }
Line 298: settings: { baseURL: "https://provider.example.com" },
/home/byk/Code/opencode-v2-pilot/packages/core/test/aisdk.test.ts:
Line 127: baseURL: String(event.options.baseURL),
Line 131: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/catalog.ts</path>
<type>file</type>
<content>
1: export * as Catalog from "./catalog.js"
2:
3: import { makeLocationNode } from "@opencode/util/effect/app-node"
4: import { Array, Context, Effect, Layer, Order, pipe } from "effect"
5: import { Catalog } from "@opencode/schema/catalog"
6: import { Model } from "./model.js"
7: import { Provider } from "./provider.js"
8: import { Bus } from "./bus.js"
9: import { State } from "./state.js"
10: import { Integration } from "./integration.js"
11:
12: export type ProviderRecord = {
13: provider: Provider.MutableInfo
14: models: Map<Model.ID, Model.MutableInfo>
15: }
16:
17: export type DefaultModel = { providerID: Provider.ID; modelID: Model.ID }
18:
19: export { Event } from "@opencode/schema/catalog"
20:
21: type Data = {
22: providers: Map<Provider.ID, ProviderRecord>
23: defaultModel?: DefaultModel
24: }
25:
26: export type Editor = {
27: provider: {
28: list: () ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/host.ts</path>
<type>file</type>
<content>
300: code: input.code,
301: }),
302: cancel: (input) =>
303: integration.oauth.cancel({
304: integrationID: Integration.ID.make(input.integrationID),
305: attemptID: Integration.AttemptID.make(input.attemptID),
306: }),
307: },
308: command: {
309: connect: (input) =>
310: response(
311: integration.command.connect({
312: integrationID: Integration.ID.make(input.integrationID),
313: methodID: Integration.MethodID.make(input.methodID),
314: label: input.label,
315: }),
316: ),
317: status: (input) =>
318: response(
319: integration.command.status({
320: integrationID: Integration.ID.make(input.integrationID),
321: attemptID: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/host.ts</path>
<type>file</type>
<content>
60: const location = yield* Location.Service
61: const reference = yield* Reference.Service
62: const rpc = yield* Rpc.Service
63: const skill = yield* Skill.Service
64: const tools = yield* Tool.Service
65: const vcs = yield* Vcs.Service
66: const websearch = yield* WebSearch.Service
67: const generate = yield* Generate.Service
68: const permission = yield* Permission.Service
69: const hooks = yield* PluginHooks.Service
70: const sessions = yield* Session.Service
71: const persistentPty = yield* PersistentPty.Service
72: const locations = yield* LocationServiceMap.Service
73: const worktrees = yield* Worktree.Service
74: const locationInfo = () =>
75: new Location.Info({
76: directory: location.directory,
77: workspaceID: location.workspaceID,
78: project: location.project,
79: })
80: const locationRef = (input?: { ...
Found 6 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/host.ts:
Line 170: hook: (name, callback, options) => {
Line 385: hook: (name, callback) => hooks.register("permission", name, callback),
Line 441: hook: (name, callback) => hooks.register("shell", name, callback),
Line 446: hook: (name, callback) => hooks.register("tool", name, callback),
Line 505: session: {
Line 506: hook: (name, callback, options) => hooks.register("session", name, callback, options),
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/host.ts</path>
<type>file</type>
<content>
495: add: (definition) =>
496: editor.add({
497: id: Worktree.StrategyID.make(definition.id),
498: create: (input) => definition.create(input).pipe(Effect.flatMap(decodeWorktree)),
499: remove: (input) => definition.remove(input),
500: list: (directory) => definition.list(directory).pipe(Effect.flatMap(decodeWorktrees)),
501: }),
502: }),
503: ),
504: },
505: session: {
506: hook: (name, callback, options) => hooks.register("session", name, callback, options),
507: create: (input) =>
508: sessions.create({
509: id: input?.id,
510: title: input?.title,
511: agent: input?.agent,
512: model: input?.model,
513: location:
514: input?.location ?? Location.Ref.make({ directory: ...
Found 16 matches
/home/byk/Code/opencode-lore/packages/gateway/src/pipeline.ts:
Line 1268: expectedUnowned: boolean;
Line 5623: expectedUnowned: boolean;
Line 5822: expectedUnowned: !best.credentialBound,
Line 5831: expectedUnowned: !best.credentialBound,
Line 5921: ...(expectedUnowned ? { expectedUnowned: true } : {}),
/home/byk/Code/opencode-lore/packages/gateway/src/cli/start.ts:
Line 108: export interface GatewayHandle {
Line 112: owned: boolean;
Line 865: * handle with `owned: false`
Line 868: export async function startGateway(
Line 877: async function startGatewayLocked(
Line 982: owned: false,
Line 1010: owned: false,
Line 1239: owned: true,
Line 1268: owned: false,
/home/byk/Code/opencode-lore/packages/gateway/src/cli/run.ts:
Line 404: let owned: boolean;
/home/byk/Code/opencode-lore/packages/gateway/src/translate/types.ts:
Line 785: // Body encoding is ...
<path>/home/byk/Code/opencode-lore/packages/gateway/src/cli/start.ts</path>
<type>file</type>
<content>
100: * the gateway until healthy, prints the address + PID + log path, and exits 0.
101: * CLI: `--bg` / `--daemon`.
102: */
103: bg?: boolean;
104: /** @internal CLI-owned process boundary; never set by in-process plugins. */
105: processBoundary?: boolean;
106: }
107:
108: export interface GatewayHandle {
109: config: GatewayConfig;
110: port: number;
111: /** Whether this process owns the server (started it). False when reusing an existing instance. */
112: owned: boolean;
113: /** Owner-only token used to authenticate the gateway control endpoint. */
114: managementToken: string;
115: /** Shut down the gateway. No-op when `owned` is false. */
116: shutdown: () => Promise<void>;
117: /** @internal One-shot CLI process shutdown shared by signals and control. */
118: processShutdown?: ProcessShutdownController;
119: }
120:
121: export interface ...
Found 16 matches
/home/byk/Code/opencode-lore/AGENTS.md:
Line 25: | `@loreai/opencode` | `packages/opencode/` | OpenCode plugin adapter — hooks into OpenCode's lifecycle via `@opencode-ai/plugin` |
/home/byk/Code/opencode-lore/.oxlintrc.json:
Line 3: "plugins": ["typescript", "unicorn", "oxc"],
/home/byk/Code/opencode-lore/packages/gateway/test/setup.test.ts:
Line 565: plugin: ["@opencode-ai/plugin", "@other/plugin"],
Line 570: "@opencode-ai/plugin",
/home/byk/Code/opencode-lore/packages/opencode/package.json:
Line 21: "@opencode-ai/plugin": ">=1.1.0"
Line 28: "@opencode-ai/plugin": "^1.1.39",
/home/byk/Code/opencode-lore/packages/opencode/test/index.test.ts:
Line 5: import type { Plugin } from "@opencode-ai/plugin";
/home/byk/Code/opencode-lore/packages/opencode/test/routing.e2e.test.ts:
Line 24: import type { Hooks, PluginInput } from "@opencode-ai/plugin";
/home/byk/Code/opencode-lore/packages/opencode/test/internal.test.ts:
...
<path>/home/byk/Code/opencode-v2-pilot/packages/cli/dist-v2-pilot/cli-node-linux-x64/package.json</path>
<type>file</type>
<content>
1: {
2: "name": "@opencode-ai/cli-node-linux-x64",
3: "version": "0.0.0-v2-pilot-202608250932",
4: "license": "MIT",
5: "repository": {
6: "type": "git",
7: "url": "git+https://github.com/anomalyco/opencode.git"
8: },
9: "os": [
10: "linux"
11: ],
12: "cpu": [
13: "x64"
14: ]
15: }
(End of file - total 15 lines)
</content>
<system-reminder>
Instructions from: /home/byk/Code/opencode-v2-pilot/packages/cli/AGENTS.md
# CLI and TUI development guide
- Use `@opencode/client` and the location-scoped data in `packages/tui/src/context/data.tsx` instead of adding dependencies on legacy sync state.
- Preserve established TUI behavior unless the task intentionally changes it.
</system-reminder>
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/source.node.ts</path>
<type>file</type>
<content>
1: import { registerHooks } from "node:module"
2: import path from "node:path"
3: import { fileURLToPath } from "node:url"
4: import { localSource } from "./source.js"
5: import { Host } from "./host.js"
6:
7: let generation = Date.now()
8:
9: export async function prepareSource(entrypoint: string, track: (file: string, directory?: boolean) => void) {
10: const version = String(++generation)
11: const fresh = (specifier: string) => {
12: const url = new URL(specifier)
13: url.searchParams.set("__opencode_reload", version)
14: return url.href
15: }
16: const hook = registerHooks({
17: resolve(specifier, context, nextResolve) {
18: if (!context.parentURL || new URL(context.parentURL).searchParams.get("__opencode_reload") !== version)
19: return nextResolve(specifier, context)
20: const local =
21: specifier.startsWith("./") || ...
Found 7 matches
/home/byk/Code/opencode-v2-pilot/packages/util/src/runtime/import.workerd.ts:
Line 3: export function importModule(_specifier: string): Promise<unknown> {
Line 7: export function resolveModule(_specifier: string, _directory: string): string {
/home/byk/Code/opencode-v2-pilot/packages/util/src/runtime/import.node.ts:
Line 7: export async function importModule(specifier: string) {
Line 20: export function resolveModule(specifier: string, directory: string) {
/home/byk/Code/opencode-v2-pilot/packages/util/src/runtime/import.bun.ts:
Line 3: export function importModule(specifier: string) {
Line 7: export function resolveModule(specifier: string, directory: string) {
/home/byk/Code/opencode-v2-pilot/packages/util/src/runtime-import.ts:
Line 1: export { importModule, resolveModule } from "#runtime-import"
<path>/home/byk/Code/opencode-v2-pilot/packages/util/src/runtime/import.node.ts</path>
<type>file</type>
<content>
1: import { Script, constants } from "node:vm"
2: import { registerHooks } from "node:module"
3: import { statSync } from "node:fs"
4: import path from "node:path"
5: import { pathToFileURL } from "node:url"
6:
7: export async function importModule(specifier: string) {
8: const imported = (await new Script(`import(${JSON.stringify(specifier)})`, {
9: importModuleDynamically: constants.USE_MAIN_CONTEXT_DEFAULT_LOADER,
10: }).runInThisContext()) as unknown
11: if (typeof imported !== "object" || imported === null) return imported
12:
13: const module = imported as Record<string, unknown>
14: const exports = module["module.exports"]
15: if (exports !== module.default || (typeof exports !== "object" && typeof exports !== "function") || exports === null)
16: return imported
17: return Object.assign({}, module, exports)
18: }
19:
20: export function ...
<path>/home/byk/Code/opencode-v2-pilot/packages/schema/src/config/compaction.ts</path>
<type>file</type>
<content>
1: export * as ConfigCompaction from "./compaction.js"
2:
3: import { Schema } from "effect"
4: import { NonNegativeInt, optional } from "../schema.js"
5:
6: export class Keep extends Schema.Class<Keep>("Config.Compaction.Keep")({
7: tokens: NonNegativeInt.pipe(optional),
8: }) {}
9:
10: export class Info extends Schema.Class<Info>("Config.Compaction")({
11: auto: Schema.Boolean.pipe(optional),
12: keep: Keep.pipe(optional),
13: buffer: NonNegativeInt.pipe(optional),
14: }) {}
(End of file - total 14 lines)
</content>
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/config/normalize.ts</path>
<type>file</type>
<content>
315: })
316: }
317:
318: function normalizeCompaction(
319: input: Record<string, unknown>,
320: encoded: Record<string, unknown>,
321: diagnostics: Diagnostic[],
322: ) {
323: if (!own(input, "compaction")) return
324: if (!isRecord(input.compaction)) {
325: invalid(["compaction"], diagnostics)
326: return
327: }
328: unsupportedIfPresent(input.compaction, "tail_turns", ["compaction", "tail_turns"], diagnostics)
329: unsupportedIfPresent(input.compaction, "prune", ["compaction", "prune"], diagnostics)
330: const result: Record<string, unknown> = {}
331: if (own(input.compaction, "auto")) {
332: const value = decodeEncoded(
333: ConfigCompaction.Info.fields.auto,
334: input.compaction.auto,
335: ["compaction", "auto"],
336: diagnostics,
337: )
338: if (value !== undefined) result.auto = value
339: }
340: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/session/title.ts</path>
<type>file</type>
<content>
35: title: session.title,
36: time: { created: DateTime.toEpochMillis(session.time.created) },
37: })
38:
39: export const layer = Layer.effect(
40: Service,
41: Effect.gen(function* () {
42: const bus = yield* Bus.Service
43: const llm = yield* LLMClient.Service
44: const context = yield* SessionContext.Service
45: const store = yield* SessionStore.Service
46: const db = (yield* Database.Service).db
47:
48: const attempt = Effect.fn("SessionTitle.attempt")(function* (input: {
49: readonly session: SessionSchema.Info
50: readonly agent: Agent.Info
51: readonly text: string
52: readonly model: SessionRunnerModel.Resolved
53: }) {
54: const chunks: string[] = []
55: let failed = false
56: let usage: SessionUsage.Recorded | undefined
57: const recordUsage = Effect.suspend(() =>
58: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/schema/src/model.ts</path>
<type>file</type>
<content>
1: export * as Model from "./model.js"
2:
3: import { Schema } from "effect"
4: import { optional, statics } from "./schema.js"
5: import { Provider } from "./provider.js"
6: import { Money } from "./money.js"
7:
8: export const ID = Schema.String.pipe(Schema.brand("Model.ID"))
9: export type ID = typeof ID.Type
10:
11: export const VariantID = Schema.String.pipe(Schema.brand("Model.VariantID"))
12: export type VariantID = typeof VariantID.Type
13:
14: export const Ref = Schema.Struct({
15: id: ID,
16: providerID: Provider.ID,
17: variant: VariantID.pipe(optional),
18: })
19: .annotate({ identifier: "Model.Ref" })
20: .pipe(
21: statics((schema) => ({
22: parse: (input: string) => {
23: const providerEnd = input.indexOf("/")
24: if (providerEnd <= 0) throw new Error(`Invalid model reference: ${input}`)
25: const providerID = ...
3859275 /usr/bin/bash -c pgrep -af 'opencode2(-node)? serve|opencode-v2-pilot' || true
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/tui/context.ts</path>
<type>file</type>
<content>
430: readonly key: string
431: readonly title?: string
432: readonly description?: string
433: readonly group?: string
434: readonly continues: boolean
435: }
436:
437: export interface Keymap {
438: /** Creates a reactive keymap layer owned by the calling component. */
439: layer(input: () => KeymapLayer): void
440: /** Dispatches a reachable command by ID. */
441: dispatch(id: string, input?: string): void
442: /** Returns every formatted shortcut for a registered command. */
443: shortcuts(id: string): readonly string[]
444: /** Returns the currently reachable commands. Reactive when read in a Solid computation. */
445: commands(): readonly KeymapCommand[]
446: /** Returns the pending key sequence. Reactive when read in a Solid computation. ...
Found 100 matches (more matches available)
/home/byk/Code/opencode-v2-pilot/packages/sdk/test/import-boundaries.test.ts:
Line 16: expect(within(inputs, server).length).toBeGreaterThan(0)
/home/byk/Code/opencode-v2-pilot/packages/sdk/test/contract-identity.test.ts:
Line 99: expect(emitPromise(client)).toEqual(emitPromise(server))
/home/byk/Code/opencode-v2-pilot/packages/sdk/src/internal/workerd.ts:
Line 18: options: ServerWorkerd.serverOptions(server),
Line 19: replacements: ServerWorkerd.replacements(server),
/home/byk/Code/opencode-v2-pilot/packages/function/src/api.ts:
Line 27: this.ctx.acceptWebSocket(server)
/home/byk/Code/opencode-v2-pilot/packages/storybook/.storybook/playground-css-plugin.ts:
Line 64: configureServer(server) {
/home/byk/Code/opencode-v2-pilot/packages/desktop/scripts/picker.ts:
Line 16: plugin.configureServer(server)
/home/byk/Code/opencode-v2-pilot/packages/desktop/scripts/dev.ts:
Line 18: await ...
Found 9 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/module.ts:
Line 98: const entrypoint = entrypoints.server
/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/host.ts:
Line 367: data: yield* mcp.servers(),
Line 370: return response(mcp.servers())
/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/command.ts:
Line 57: name: mcpCommandName(prompt.server, prompt.name),
Line 63: server: prompt.server,
Line 69: if (!result) return yield* Effect.fail(new Error(`MCP prompt not found: ${prompt.server}:${prompt.name}`))
/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/provider/opencode.ts:
Line 44: const server = yield* normalizeServer(answer.server ?? defaultServer)
Line 64: const server = typeof credential.metadata?.server === "string" ? credential.metadata.server : defaultServer
Line 213: const server = typeof metadata?.server === ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/module.ts</path>
<type>file</type>
<content>
1: export * as PluginModule from "./module.js"
2:
3: import type { Plugin } from "@opencode/plugin/effect/plugin"
4: import { Host } from "@opencode/plugin/host"
5: import { createPluginSources } from "@opencode/plugin/source"
6: import { Npm } from "@opencode/util/npm"
7: import { Deferred, Effect, FiberSet, PubSub, Schema, Stream } from "effect"
8: import path from "path"
9: import { stat } from "node:fs/promises"
10: import { fileURLToPath, pathToFileURL } from "url"
11: import type { ConfigPluginSource } from "../config/plugin/source.js"
12: import type { Generation } from "../plugin.js"
13: import { PluginPromise } from "./promise.js"
14: import { Watcher } from "../filesystem/watcher.js"
15:
16: export const make = Effect.fn("PluginModule.make")(function* () {
17: const watcher = yield* Watcher.Service
18: const scope = yield* Effect.scope
19: const runPromise = ...
Found 15 matches
/home/byk/Code/opencode-lore/packages/gateway/src/cli/setup.ts:
Line 248: const existing = config.plugin;
Line 255: config.plugin = ["@loreai/opencode"];
Line 277: plugin: opencodePluginSpec,
Line 556: `[lore] re-run with --no-plugin: lore setup <app> --no-plugin`,
Line 2092: const existingPlugins = existing.plugin;
Line 2163: `[lore] "@loreai/opencode" to the "plugin" array in ${configPath}.`,
Line 2168: loreValues.plugin = existing.plugin;
Line 2171: ["plugin"],
Line 2172: existing.plugin,
Line 2205: projectionPaths: ["plugin", LORE_BACKUP_KEY],
Line 2777: "plugin",
Line 2882: restoredText = config.plugin
Line 2883: ? setJsonConfigValue(restoredText, ["plugin"], config.plugin)
Line 2884: : deleteJsonConfigValue(restoredText, ["plugin"]);
Line 2907: "plugin",
<path>/home/byk/Code/opencode-lore/packages/gateway/src/cli/setup.ts</path>
<type>file</type>
<content>
235: undo: (guard: SetupGuard, stagedPaths?: readonly string[]) => RestoreSummary;
236: }
237:
238: /**
239: * OpenCode plugin spec: installs `@loreai/opencode` and adds it to the
240: * `plugin` array of `~/.config/opencode/opencode.json`.
241: *
242: * Defined before SUPPORTED_APPS so it can be referenced by the opencode
243: * entry without a forward-reference.
244: */
245: export const opencodePluginSpec: PluginSpec = {
246: npmPackage: "@loreai/opencode",
247: apply: (config) => {
248: const existing = config.plugin;
249: if (Array.isArray(existing) && existing.includes("@loreai/opencode")) {
250: return false;
251: }
252: if (Array.isArray(existing)) {
253: existing.push("@loreai/opencode");
254: } else {
255: config.plugin = ["@loreai/opencode"];
256: }
257: return true;
258: },
259: };
260:
261: const ...
<path>/home/byk/Code/opencode-lore/packages/gateway/src/cli/setup.ts</path>
<type>file</type>
<content>
2080: // keys — the illegal key made OpenCode refuse to start).
2081: const legacyBackup = requireLegacyJsonBackup(beforeConfig);
2082: const previousBackup = sidecarFile?.backup ?? legacyBackup;
2083: const existing = structuredClone(beforeConfig);
2084: delete existing[LORE_BACKUP_KEY];
2085:
2086: // Values lore is about to set (provider baseURLs + compaction), captured from
2087: // the ORIGINAL config for the backup's prior values.
2088: const loreValues: Record<string, unknown> = { "compaction.auto": false };
2089: for (const id of OPENCODE_SETUP_PROVIDER_IDS) {
2090: loreValues[`provider.${id}.options.baseURL`] = baseUrl;
2091: }
2092: const existingPlugins = existing.plugin;
2093: const pluginAlreadyPresent =
2094: Array.isArray(existingPlugins) &&
2095: existingPlugins.includes("@loreai/opencode");
2096:
2097: let updatedText = ...
Found 22 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/config/normalize.ts:
Line 16: import { ConfigProvider } from "@opencode/schema/config/provider"
Line 26: import { ConfigProviderV1 } from "../v1/config/provider.js"
Line 45: const options = { errors: "all", onExcessProperty: "ignore", propertyOrder: "original" } as const
Line 169: const nativeProviders = decodeMap(input.providers, ConfigProvider.Info, ["providers"], diagnostics, decodeEncoded)
Line 186: (plugin) => (typeof plugin === "string" ? plugin : { package: plugin[0], options: plugin[1] }),
Line 386: generated.push({ action: "provider.use", resource: "*", effect: "deny" })
Line 389: action: "provider.use",
Line 398: action: "provider.use",
Line 534: const provider = decodeValue(ConfigProviderV1.Info, raw, path, diagnostics)
Line 541: provider: canonical(ConfigProvider.Info, ConfigMigrateV1.migrateProvider(name, provider)),
Line 555: if ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/config/normalize.ts</path>
<type>file</type>
<content>
140: : undefined
141: if (legacySmallModel && !migratedSmallModel)
142: diagnostics.push({
143: kind: "unsupported",
144: path: ["small_model"],
145: message: "omitted unsupported legacy model reference",
146: })
147: if (migratedSmallModel)
148: legacyAgents.title = {
149: model: migratedSmallModel,
150: ...legacyAgents.title,
151: }
152: const modeAgents = mapValues(decodeMap(input.mode, ConfigAgentV1.Info, ["mode"], diagnostics, decodeValue), (value) =>
153: canonical(ConfigAgent.Info, ConfigMigrateV1.migrateAgent({ ...value, mode: "primary" })),
154: )
155: const migratedAgents = mergeMaps(legacyAgents, modeAgents, ["agents"], diagnostics)
156: const nativeAgents = decodeMap(input.agents, ConfigAgent.Info, ["agents"], diagnostics, decodeEncoded)
157: diagnoseAgentUnsupported(input.agent, ["agent"], ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/v1/config/migrate.ts</path>
<type>file</type>
<content>
1: export * as ConfigMigrateV1 from "./migrate.js"
2:
3: import { Info } from "@opencode/schema/config"
4: import { ConfigAgent } from "@opencode/schema/config/agent"
5: import { Schema } from "effect"
6: import { ConfigV1 } from "./config.js"
7: import { ConfigAgentV1 } from "./agent.js"
8: import { ConfigCommandV1 } from "./command.js"
9: import { ConfigMCPV1 } from "./mcp.js"
10: import { ConfigPermissionV1 } from "./permission.js"
11: import { ConfigProviderV1 } from "./provider.js"
12: import { ConfigProviderOptionsV1 } from "./provider-options.js"
13: import { Provider } from "../../provider.js"
14: import { Model } from "../../model.js"
15:
16: const decodeOptions = { errors: "all", onExcessProperty: "ignore", propertyOrder: "original" } as const
17: const decodeInfo = Schema.decodeUnknownSync(Schema.fromJsonString(Info), decodeOptions)
18: const encodeInfo = ...
Found 5 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/session/model-request.ts:
Line 227: headers: { ...request.http?.headers },
Line 237: headers: Object.keys(event.headers).length === 0 ? undefined : event.headers,
Line 258: before.request.headers.get("content-type") ?? undefined,
Line 266: { status: response.status, headers: response.headers },
Line 337: headers: sessionHeaders(session, app),
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/session/model-request.ts</path>
<type>file</type>
<content>
205: }
206:
207: const sessionHeaders = (session: Pick<SessionSchema.Info, "id" | "parentID" | "projectID">, app: App.Info) => ({
208: "x-session-affinity": session.id,
209: "X-Session-Id": session.id,
210: ...(session.parentID ? { "x-parent-session-id": session.parentID } : {}),
211: "User-Agent": App.useragent(app),
212: "x-opencode-project": session.projectID,
213: "x-opencode-session": session.id,
214: "x-opencode-client": app.name,
215: })
216:
217: const promptCacheKey = (sessionID: SessionSchema.ID) =>
218: /^ses_[0-9a-f]{64}$/.test(sessionID) ? sessionID.slice(4) : sessionID
219:
220: // Lets session.model.request hooks rewrite the base URL and headers before dispatch.
221: const applyModelHooks = (hooks: PluginHooks.Interface, scope: HookScope, request: LLMRequest) =>
222: Effect.gen(function* () {
223: const currentBaseURL = ...
Found 7 matches
/home/byk/Code/opencode-v2-pilot/packages/schema/src/session.ts:
Line 5: import { Location } from "./location.js"
Line 34: parentID: ID.pipe(optional),
Line 39: projectID: Project.ID,
Line 54: location: Location.Ref,
/home/byk/Code/opencode-v2-pilot/packages/schema/src/v1/session.ts:
Line 461: parentID: MessageID,
Line 546: projectID: Project.ID,
Line 550: parentID: optional(SessionID),
<path>/home/byk/Code/opencode-v2-pilot/packages/schema/src/session.ts</path>
<type>file</type>
<content>
1: export * as Session from "./session.js"
2:
3: import { Schema } from "effect"
4: import { Agent } from "./agent.js"
5: import { Location } from "./location.js"
6: import { Model } from "./model.js"
7: import { Project } from "./project.js"
8: import { DateTimeUtcFromMillis, optional, RelativePath } from "./schema.js"
9: import { SessionEvent } from "./session-event.js"
10: import { SessionID } from "./session-id.js"
11: import { SessionMetadata } from "./session-metadata.js"
12: import { Money } from "./money.js"
13: import { TokenUsage } from "./token-usage.js"
14: import { Revert } from "./session-revert.js"
15: import { SessionFork } from "./session-fork.js"
16:
17: export const ID = SessionID
18: export type ID = SessionID
19:
20: export const Metadata = SessionMetadata
21: export type Metadata = SessionMetadata
22:
23: export const Event = SessionEvent
24:
25: export { ...
Found 4 matches
/home/byk/Code/opencode-v2-pilot/packages/schema/src/session-event.ts:
Line 157: export const Deleted = Event.durable({
Line 158: type: "session.deleted",
Line 165: export type Deleted = typeof Deleted.Type
Line 632: Deleted,
<path>/home/byk/Code/opencode-v2-pilot/packages/schema/src/session-event.ts</path>
<type>file</type>
<content>
130: content: Schema.Array(SessionMessage.AssistantContentEncoded),
131: },
132: })
133: export type MessageContentUpdated = typeof MessageContentUpdated.Type
134:
135: export const UsageRecorded = Event.durable({
136: type: "session.usage.recorded",
137: ...options,
138: schema: {
139: ...Base,
140: source: Schema.Literals(["title", "compaction"]),
141: cost: Money.USD,
142: tokens: TokenUsage.Info,
143: },
144: })
145: export type UsageRecorded = typeof UsageRecorded.Type
146:
147: export const UsageUpdated = Event.ephemeral({
148: type: "session.usage.updated",
149: schema: {
150: ...Base,
151: cost: Money.USD,
152: tokens: TokenUsage.Info,
153: },
154: })
155: export type UsageUpdated = typeof UsageUpdated.Type
156:
157: export const Deleted = Event.durable({
158: type: "session.deleted",
159: durable: {
160: ...
Found 1 matches
/home/byk/Code/opencode-v2-pilot/packages/schema/src/session-event.ts:
Line 40: const Base = {
<path>/home/byk/Code/opencode-v2-pilot/packages/schema/src/session-event.ts</path>
<type>file</type>
<content>
30:
31: export const Source = Schema.Struct({
32: start: NonNegativeInt,
33: end: NonNegativeInt,
34: text: Schema.String,
35: }).annotate({
36: identifier: "Session.Event.Source",
37: })
38: export interface Source extends Schema.Schema.Type<typeof Source> {}
39:
40: const Base = {
41: sessionID: SessionID,
42: }
43:
44: const options = {
45: durable: {
46: aggregate: "sessionID",
47: version: 1,
48: },
49: } as const
50: export const Created = Event.durable({
51: type: "session.created",
52: ...options,
53: schema: {
54: ...Base,
55: projectID: Project.ID,
56: location: Location.Ref,
57: subpath: RelativePath.pipe(optional),
58: parentID: SessionID.pipe(optional),
59: slug: Schema.String,
(Showing lines 30-59 of 693. Use offset=60 to continue.)
</content>
<path>/home/byk/Code/opencode-v2-pilot/packages/schema/src/project.ts</path>
<type>file</type>
<content>
1: export * as Project from "./project.js"
2:
3: import { Schema } from "effect"
4: import { ephemeral, inventory } from "./event.js"
5: import { AbsolutePath, NonNegativeInt, optional } from "./schema.js"
6: import { ProjectID } from "./project-id.js"
7:
8: export const ID = ProjectID
9: export type ID = typeof ID.Type
10:
11: export const Vcs = Schema.String.check(Schema.isPattern(/^[a-z][a-z0-9._-]*$/)).annotate({
12: identifier: "Project.Vcs",
13: })
14: export const Current = Schema.Struct({
15: id: ID,
16: directory: AbsolutePath,
17: canonical: AbsolutePath,
18: }).annotate({ identifier: "Project.Current" })
19: export interface Current extends Schema.Schema.Type<typeof Current> {}
20: export const Icon = Schema.Struct({
21: url: optional(Schema.String),
22: override: optional(Schema.String),
23: color: optional(Schema.String),
24: }).annotate({ identifier: ...
No files found
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/vcs.ts</path>
<type>file</type>
<content>
1: import type { VcsApi } from "@opencode/client/promise/api"
2: import type { FileDiff } from "@opencode/schema/file-diff"
3: import type { Vcs } from "@opencode/schema/vcs"
4: import type { Transform } from "./registration.js"
5:
6: export interface VcsScope {
7: readonly directory: string
8: readonly worktree: string
9: readonly canonical: string
10: readonly store?: string
11: }
12:
13: export interface VcsBranchesInput extends VcsScope {
14: readonly search?: string
15: readonly limit?: number
16: }
17:
18: export interface VcsDiffInput extends VcsScope {
19: readonly mode: Vcs.Mode
20: readonly base?: string
21: readonly context: number
22: readonly maxOutputBytes: number
23: }
24:
25: export interface VcsDefinition {
26: readonly id: string
27: readonly name: string
28: readonly info: (input: VcsScope, context: { readonly signal: AbortSignal ...
Found 3 matches
/home/byk/Code/opencode-v2-pilot/packages/schema/src/vcs.ts:
Line 12: export const Info = Schema.Struct({
Line 13: branch: Branch,
Line 27: export const Mode = Schema.Literals(["working", "branch", "committed"]).annotate({ identifier: "Vcs.Mode" })
<path>/home/byk/Code/opencode-v2-pilot/packages/schema/src/vcs.ts</path>
<type>file</type>
<content>
1: export * as Vcs from "./vcs.js"
2:
3: import { Schema } from "effect"
4: import { NonNegativeInt, optional } from "./schema.js"
5:
6: export const Branch = Schema.Struct({
7: current: optional(Schema.String),
8: default: optional(Schema.String),
9: }).annotate({ identifier: "Vcs.Branch" })
10: export interface Branch extends Schema.Schema.Type<typeof Branch> {}
11:
12: export const Info = Schema.Struct({
13: branch: Branch,
14: }).annotate({ identifier: "Vcs.Info" })
15: export interface Info extends Schema.Schema.Type<typeof Info> {}
16:
17: export const BranchList = Schema.Array(Schema.String).annotate({ identifier: "Vcs.BranchList" })
18: export type BranchList = typeof BranchList.Type
19:
20: export const Base = Schema.Struct({
21: name: Schema.String,
22: ref: Schema.String,
23: source: Schema.Literals(["reflog", "default"]),
24: }).annotate({ identifier: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/plugin.ts</path>
<type>file</type>
<content>
1: import type { OpenCodeClient } from "@opencode/client"
2: import type { GenerateApi, PluginApi } from "@opencode/client/promise/api"
3: import type { Location } from "@opencode/schema/location"
4: import type { PluginOptions } from "../options.js"
5: import type { App } from "../app.js"
6: import type { AgentDomain } from "./agent.js"
7: import type { AISDKDomain } from "./aisdk.js"
8: import type { CatalogDomain } from "./catalog.js"
9: import type { CommandDomain } from "./command.js"
10: import type { EventDomain } from "./event.js"
11: import type { IntegrationDomain } from "./integration.js"
12: import type { MCPDomain } from "./mcp.js"
13: import type { PermissionDomain } from "./permission.js"
14: import type { ReferenceDomain } from "./reference.js"
15: import type { RpcDomain } from "./rpc.js"
16: import type { SessionDomain } from "./session.js"
17: import type ...
No files found
No files found
<path>/home/byk/Code/opencode-lore/packages/opencode/src/index.ts</path>
<type>file</type>
<content>
1: import type { Hooks, Plugin, PluginInput } from "@opencode-ai/plugin";
2: import {
3: log,
4: getGitRemote,
5: discoverWorkspaceRoot,
6: installFetchInterceptor,
7: } from "@loreai/core";
8: // Helpers live in a separate module so they are NOT re-exported from this
9: // plugin entry. OpenCode's legacy plugin loader invokes every function
10: // exported from the entry module as a plugin; leaking these helpers pushed
11: // `undefined` into the host hooks array and crashed it on event dispatch
12: // (`undefined is not an object (evaluating 'A.event')`). See ./internal.ts.
13: import {
14: applyLoreProviderConfig,
15: gatewayAccessHeadersForRemote,
16: probeGateway,
17: shouldForwardUpstreamExtraHeader,
18: surfaceGatewayUnavailable,
19: } from "./internal";
20:
21: /**
22: * Lore plugin for OpenCode — transparent LLM proxy routing. ...
<path>/home/byk/Code/opencode-lore/packages/core/package.json</path>
<type>file</type>
<content>
1: {
2: "name": "@loreai/core",
3: "version": "0.40.0",
4: "type": "module",
5: "license": "FSL-1.1-Apache-2.0",
6: "description": "Shared memory engine for Lore — three-tier storage, distillation, gradient context management",
7: "main": "./dist/node/index.js",
8: "types": "./dist/node/index.d.ts",
9: "exports": {
10: ".": {
11: "types": "./dist/types/index.d.ts",
12: "development": "./src/index.ts",
13: "bun": "./dist/bun/index.js",
14: "default": "./dist/node/index.js"
15: }
16: },
17: "imports": {
18: "#db/driver": {
19: "bun": "./src/db/driver.bun.ts",
20: "default": "./src/db/driver.node.ts"
21: }
22: },
23: "scripts": {
24: "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.eval.json",
25: "build": "tsx script/build.ts"
26: },
27: "dependencies": {
28: "@hpke/core": "^1.9.0",
29: ...
<path>/home/byk/Code/opencode-lore/packages/gateway/package.json</path>
<type>file</type>
<content>
1: {
2: "name": "@loreai/gateway",
3: "version": "0.40.0",
4: "type": "module",
5: "license": "FSL-1.1-Apache-2.0",
6: "description": "Lore as a transparent LLM proxy — context management for any AI coding client",
7: "main": "./dist/index.cjs",
8: "types": "./dist/index.d.cts",
9: "exports": {
10: ".": {
11: "types": "./dist/index.d.cts",
12: "bun": "./dist/index.bun.js",
13: "require": "./dist/index.cjs",
14: "default": "./dist/index.cjs"
15: }
16: },
17: "bin": {
18: "lore": "./dist/bin.cjs",
19: "lore-gateway": "./dist/bin.cjs"
20: },
21: "scripts": {
22: "typecheck": "tsc --noEmit",
23: "build": "tsx script/build.ts",
24: "bundle": "tsx script/bundle.ts",
25: "build:binary": "tsx script/build.ts --binary",
26: "build:binary:sea": "tsx script/build-binary-sea.ts",
27: "start": "tsx ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/session.ts</path>
<type>file</type>
<content>
1: import type { SessionApi } from "@opencode/client/promise/api"
2: import type { GenerationOptionsFields, Message, SystemPart } from "@opencode/ai"
3: import type { Agent } from "@opencode/schema/agent"
4: import type { Model } from "@opencode/schema/model"
5: import type { PromptInput } from "@opencode/schema/prompt-input"
6: import type { Session } from "@opencode/schema/session"
7: import type { SessionInbox } from "@opencode/schema/session-inbox"
8: import type { SessionError } from "@opencode/schema/session-error"
9: import type { SessionMessage } from "@opencode/schema/session-message"
10: import type { JsonSchema, Types } from "effect"
11: import type { ModelHooks } from "./registration.js"
12:
13: export interface SessionPrompt {
14: readonly sessionID: Session.ID
15: readonly messageID: SessionMessage.ID
16: prompt: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts</path>
<type>file</type>
<content>
400: Effect.map((authorization) =>
401: authorization.mode === "auto"
402: ? {
403: ...authorization,
404: callback: Effect.promise(() => authorization.callback),
405: }
406: : {
407: ...authorization,
408: callback: (code) => Effect.promise(() => authorization.callback(code)),
409: },
410: ),
411: ),
412: refresh:
413: refresh === undefined
414: ? ...
Found 10 matches
/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts:
Line 15: type PromiseEvent = ReturnType<PromiseContext["event"]["subscribe"]> extends AsyncIterable<infer Event> ? Event : never
Line 48: const makeStreams = Effect.fn("Plugin.Event.makeStreams")(function* () {
Line 86: const subscribe = (
Line 89: ): AsyncIterable<RpcEventPayload<Rpc.PortableDefinition>> => streams(local.events.subscribe(name), options)
Line 104: subscribe,
Line 113: for await (const event of subscribe(name, { signal })) await handler(event)
Line 243: const streams = yield* makeStreams()
Line 333: event: {
Line 334: subscribe: (options) =>
Line 336: host.event.subscribe().pipe(
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts</path> <type>file</type> <content> 235: const ProviderEndpoints = ClientApi.groups["server.provider"].endpoints 236: const ReferenceEndpoints = ClientApi.groups["server.reference"].endpoints 237: const SessionEndpoints = ClientApi.groups["server.session"].endpoints 238: const SkillEndpoints = ClientApi.groups["server.skill"].endpoints 239: const VcsEndpoints = ClientApi.groups["server.vcs"].endpoints 240: const WebSearchEndpoints = ClientApi.groups["server.websearch"].endpoints 241: const WorktreeEndpoints = ClientApi.groups["server.worktree"].endpoints 242: const context = yield* Effect.context<Scope.Scope>() 243: const streams = yield* makeStreams() 244: 245: // Run a hook registration on the plugin scope and resolve once it is registered. 246: const register = (effect: Effect.Effect<HostRegistration, never, ...
Found 4 matches
/home/byk/Code/opencode-lore/packages/core/src/fetch-interceptor.ts:
Line 24: onRequestHeaders?: (headers: Headers) => void;
Line 413: if (!config.onRequestHeaders) return;
Line 415: config.onRequestHeaders(headers);
Line 417: log.error("fetch-interceptor: onRequestHeaders() failed:", e);
<path>/home/byk/Code/opencode-lore/packages/core/src/fetch-interceptor.ts</path>
<type>file</type>
<content>
1: /**
2: * Fetch-level interception for transparent LLM API proxy routing.
3: *
4: * Instead of overwriting provider baseURLs early (which loses original auth
5: * and URL context), this interceptor wraps `globalThis.fetch` to redirect
6: * outgoing LLM API calls through the Lore gateway at the HTTP level.
7: *
8: * The SDK builds requests normally (correct auth, correct URL for each
9: * provider), and the interceptor transparently reroutes them through the
10: * gateway while preserving all original headers.
11: */
12: import * as log from "./log";
13:
14: /** Configuration for the fetch interceptor. */
15: export type FetchInterceptorConfig = {
16: /** Base URL of the Lore gateway (e.g., "http://127.0.0.1:3207"). */
17: gatewayBase: string;
18: /**
19: * Dynamic headers to inject on every intercepted request. ...
Found 6 matches
/home/byk/Code/opencode-lore/packages/pi/src/index.ts:
Line 143: onRequestHeaders: (headers) => {
/home/byk/Code/opencode-lore/packages/core/test/fetch-interceptor-install.test.ts:
Line 51: onRequestHeaders: (headers) => {
/home/byk/Code/opencode-lore/packages/core/src/fetch-interceptor.ts:
Line 24: onRequestHeaders?: (headers: Headers) => void;
Line 413: if (!config.onRequestHeaders) return;
Line 415: config.onRequestHeaders(headers);
Line 417: log.error("fetch-interceptor: onRequestHeaders() failed:", e);
Found 21 matches /home/byk/Code/opencode-lore/packages/gateway/src/pipeline.ts: Line 5457: * 1. **Known headers** — `x-lore-session-id` (stable, checked first), Line 5662: !!headers["x-parent-session-id"] || isClaudeCodeSubagent(headers); Line 5691: // false positive. The primary target (opencode x-lore-session-id) sends no Line 5864: // Sub-agent requests (carrying x-parent-session-id) are NOT merged into the Line 5927: // x-lore-session-id), but the request also contains a lower-priority Line 6154: // header-bearing case — e.g. opencode's x-lore-session-id — is handled in the Line 13609: * The caller must include a session-identifying header (e.g. x-lore-session-id) Line 15791: // Mark sub-agent sessions (x-parent-session-id OR x-claude-code-agent-id Line 15798: // Claude Code sub-agents do NOT carry x-parent-session-id (that header is Line 15804: const parentClientId = ...
<path>/home/byk/Code/opencode-lore/packages/gateway/src/pipeline.ts</path>
<type>file</type>
<content>
5435: state.prevRequestTime = state.lastRequestTime;
5436: state.lastRequestTime = Date.now();
5437:
5438: // Ensure recallStore exists (upgrade from older session state)
5439: if (!state.recallStore) {
5440: state.recallStore = new Map();
5441: }
5442: // Ensure upstreamByProvider exists (upgrade from older session state)
5443: if (!state.upstreamByProvider) {
5444: state.upstreamByProvider = new Map();
5445: }
5446: if (credentialFingerprint) {
5447: state.credentialFingerprint = credentialFingerprint;
5448: }
5449:
5450: return state;
5451: }
5452:
5453: /**
5454: * Identify or create a session from the incoming request.
5455: *
5456: * Uses a multi-tier strategy:
5457: * 1. **Known headers** — `x-lore-session-id` (stable, checked first),
5458: * `x-claude-code-session-id`, `x-session-id`, `x-session-affinity`. ...
Found 5 matches
/home/byk/Code/opencode-lore/packages/pi/src/index.ts:
Line 132: installFetchInterceptor({
Line 137: "x-lore-session-id": currentSessionID,
Line 143: onRequestHeaders: (headers) => {
Line 145: headers.get("x-lore-session-id") !== currentSessionID ||
Line 196: // requests carry the correct x-lore-session-id header.
Found 27 matches
/home/byk/Code/opencode-lore/packages/opencode/test/index.test.ts:
Line 267: // Only config, tool, and chat.headers hooks should be registered
/home/byk/Code/opencode-lore/packages/opencode/test/routing.e2e.test.ts:
Line 13: * 2. the `chat.headers` hook injects the `x-lore-*` attribution headers, and
Line 195: test("chat.headers injects x-lore attribution headers", async () => {
Line 202: } as unknown as Parameters<NonNullable<Hooks["chat.headers"]>>[0];
Line 206: await hooks["chat.headers"]?.(input, output);
Line 209: expect(output.headers["x-lore-provider"]).toBe("anthropic");
Line 217: // chat.headers would have attached on a real turn (the interceptor
Line 227: "x-lore-provider": "anthropic",
/home/byk/Code/opencode-lore/packages/opencode/test/subagent-detection.test.ts:
Line 5: * spawning session. The plugin's `chat.headers` hook resolves that parent via
Line 62: type ChatHeadersHook = ...
<path>/home/byk/Code/opencode-lore/packages/opencode/test/routing.e2e.test.ts</path>
<type>file</type>
<content>
180: // user's provider config untouched.
181: await hooks.config?.(cfg);
182: const provider = (
183: cfg.provider as Record<
184: string,
185: { options: { baseURL: string; apiKey: string } }
186: >
187: ).anthropic;
188: expect(provider.options.baseURL).toBe(`${baseURL}/v1`);
189: // Existing user options are preserved through the merge.
190: expect(provider.options.apiKey).toBe("x");
191: // And built-in compaction is disabled by the same hook.
192: expect(cfg.compaction).toEqual({ auto: false, prune: false });
193: });
194:
195: test("chat.headers injects x-lore attribution headers", async () => {
196: const input = {
197: sessionID: "oc-sess-1",
198: agent: "build",
199: model: { providerID: "anthropic", modelID: "claude-3-5-sonnet" },
200: provider: { id: "anthropic" ...
<path>/home/byk/Code/opencode-lore/packages/opencode/src/internal.ts</path> <type>file</type> <content> 1: /** 2: * Internal helpers for the Lore OpenCode plugin. 3: * 4: * These functions are intentionally kept OUT of the plugin entry module 5: * (`./index.ts`). OpenCode's legacy plugin loader treats EVERY function 6: * exported from a plugin module as a plugin instance and invokes it (see 7: * `getServerPlugin`/`getLegacyPlugins` in opencode's plugin loader). Exporting 8: * these helpers from the entry module caused them to be invoked as plugins and 9: * their return values pushed into the host's hooks array: 10: * `applyLoreProviderConfig` returns `undefined`, so the host crashed on the 11: * first hook dispatch with `undefined is not an object (evaluating 'A.event')` 12: * (the `?.` guards the `.event` property, not the `undefined` hook element). ...
Found 9 matches
/home/byk/Code/opencode-lore/packages/gateway/src/pipeline.ts:
Line 13233: if (!req.rawHeaders["x-lore-project"]) {
Line 13235: if (markerProject) req.rawHeaders["x-lore-project"] = markerProject;
Line 15577: if (!req.rawHeaders["x-lore-project"]) {
Line 15579: if (markerProject) req.rawHeaders["x-lore-project"] = markerProject;
Line 16062: `hdrProject=${req.rawHeaders["x-lore-project"] ? "present" : "absent"} ` +
/home/byk/Code/opencode-lore/packages/gateway/src/config.ts:
Line 1293: const raw = headers["x-lore-git-remote"];
Line 1320: const raw = headers["x-lore-project"];
/home/byk/Code/opencode-lore/packages/gateway/src/translate/types.ts:
Line 799: "x-lore-project",
Line 800: "x-lore-git-remote",
Found 16 matches
/home/byk/Code/opencode-lore/packages/core/src/git.d.ts:
Line 46: export declare function getGitRemote(path: string): string | null;
/home/byk/Code/opencode-lore/packages/core/src/index.ts:
Line 202: getGitRemote,
Line 330: discoverWorkspaceRoot,
/home/byk/Code/opencode-lore/packages/core/src/git.ts:
Line 101: export function getGitRemote(path: string): string | null {
/home/byk/Code/opencode-lore/packages/core/src/db.ts:
Line 13: import { getGitRemote } from "./git";
Line 5043: * `getGitRemote()` is per-path cached and already returns null in hosted mode,
Line 5050: const disk = getGitRemote(path); // null in hosted mode OR when not a repo
Line 5338: const remote = getGitRemote(path); // null in hosted mode OR when not a repo
/home/byk/Code/opencode-lore/packages/core/src/data.ts:
Line 31: import { getGitRemote } from "./git";
Line 1725: gitRemote = ...
Found 100 matches (more matches available)
/home/byk/Code/opencode-lore/packages/gateway/src/pipeline.ts:
Line 4926: const direct = state.upstreamByProvider.get(providerID);
Line 4928: for (const snapshot of state.upstreamByProvider.values()) {
Line 4951: | "upstreamByProvider"
Line 4961: const upstreamByProvider: Record<string, unknown> = Object.create(null);
Line 4962: for (const [providerID, snapshot] of state.upstreamByProvider) {
Line 4963: upstreamByProvider[providerID] = stripHeaders(snapshot);
Line 4970: upstreamByProvider,
Line 4979: upstreamByProvider: Map<string, UpstreamSnapshot>;
Line 4986: upstreamByProvider: new Map(
Line 4995: !isPlainRecord(parsed.upstreamByProvider)
Line 5000: const upstreamByProvider = new Map<string, UpstreamSnapshot>();
Line 5002: parsed.upstreamByProvider,
Line 5012: upstreamByProvider.set(providerID, snapshot);
Line 5021: const providerSnapshot = ...
No files found
<path>/home/byk/.config/systemd/user/opencode-v2-pilot.service</path> <type>file</type> <content> 1: [Unit] 2: Description=OpenCode V2 pilot server 3: After=network-online.target 4: Wants=network-online.target 5: 6: [Service] 7: Type=simple 8: WorkingDirectory=/home/byk 9: Environment=XDG_DATA_HOME=/home/byk/.local/share/opencode-v2-pilot/data 10: Environment=XDG_CACHE_HOME=/home/byk/.local/share/opencode-v2-pilot/cache 11: Environment=XDG_CONFIG_HOME=/home/byk/.local/share/opencode-v2-pilot/config 12: Environment=XDG_STATE_HOME=/home/byk/.local/share/opencode-v2-pilot/state 13: Environment=OPENCODE_CONFIG_DIR=/home/byk/.local/share/opencode-v2-pilot/config/opencode 14: Environment=OPENCODE_DB=/home/byk/.local/share/opencode-v2-pilot/data/opencode/opencode.db 15: ExecStart=/home/byk/Code/opencode-v2-pilot/packages/cli/dist-v2-pilot/cli-node-linux-x64/bin/opencode2-node serve --service 16: Restart=on-failure 17: RestartSec=3 18: TimeoutStopSec=30 19: 20: [Install] 21: ...
Found 89 matches
/home/byk/Code/opencode-lore/packages/gateway/src/pipeline.ts:
Line 139: extractProviderHeader,
Line 3794: * `providerID` (when known from the request route) selects the
Line 3801: export function getModelSpec(model: string, providerID?: string): ModelSpec {
Line 3802: const entry = getModelEntrySyncForProvider(providerID, model);
Line 4319: providerID: "anthropic",
Line 4330: providerID?: string,
Line 4332: ? (_sessionID, providerID) => ({
Line 4336: // worker MODEL's providerID (see llm-adapter), so this resolves per
Line 4338: scheme: workerKeyScheme(providerID),
Line 4341: : (sessionID, providerID) => {
Line 4342: if (sessionID) return resolveAuth(sessionID, providerID);
Line 4345: : resolveAuth(undefined, providerID);
Line 4420: ? matchingProviderSnapshot(state, effectiveModel.providerID)
Line 4428: ...
<path>/home/byk/Code/opencode-lore/packages/gateway/src/pipeline.ts</path>
<type>file</type>
<content>
6170: const sessionID = generateSessionID();
6171: return { sessionID, isNew: true, tier: 3 };
6172: }
6173:
6174: // ---------------------------------------------------------------------------
6175: // Upstream forwarding
6176: // ---------------------------------------------------------------------------
6177:
6178: type EffectiveUpstreamProtocol = UpstreamSnapshot["protocol"];
6179:
6180: type ResolvedRequestUpstreamRoute = {
6181: /** Explicit, sanitized X-Lore-Provider value (not inferred signals). */
6182: providerHeader?: string;
6183: /** Provider identity actually selected, including Copilot inference. */
6184: providerID?: string;
6185: headerUpstream?: string;
6186: headerUpstreamPath?: string;
6187: providerRoute: ReturnType<typeof resolveProviderRoute>;
6188: modelRoute: ReturnType<typeof resolveUpstreamRoute>;
6189: effectiveProtocol: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/schema/src/config/provider.ts</path>
<type>file</type>
<content>
1: export * as ConfigProvider from "./provider.js"
2:
3: import { Schema } from "effect"
4: import { Money } from "../money.js"
5: import { Capabilities, Compatibility, Family, ID, VariantID } from "../model.js"
6: import { Provider } from "../provider.js"
7: import { optional } from "../schema.js"
8:
9: const JsonRecord = Schema.Record(Schema.String, Schema.Json)
10:
11: export const Overlays = {
12: settings: JsonRecord.pipe(optional),
13: headers: Schema.Record(Schema.String, Schema.String).pipe(optional),
14: body: JsonRecord.pipe(optional),
15: }
16:
17: export class Request extends Schema.Class<Request>("Config.Provider.Request")({
18: headers: Overlays.headers,
19: body: Overlays.body,
20: }) {}
21:
22: class Cache extends Schema.Class<Cache>("Config.Model.Cost.Cache")({
23: read: Money.USDPerMillionTokens.pipe(optional),
24: write: ...
No files found
Found 10 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/v1/config/provider-options.ts:
Line 7: readonly headers?: Record<string, string>
Line 8: readonly body?: Record<string, unknown>
Line 12: const headers = options.headers
Line 13: const body = options.body
Line 14: const settings = Object.fromEntries(Object.entries(options).filter(([key]) => key !== "headers" && key !== "body"))
Line 16: typeof headers === "object" && headers !== null && !Array.isArray(headers)
Line 18: Object.entries(headers).filter((entry): entry is [string, string] => typeof entry[1] === "string"),
Line 21: const bodyOverlay = typeof body === "object" && body !== null && !Array.isArray(body) ? { ...body } : undefined
Line 24: headers: headerOverlay,
Line 25: body: bodyOverlay,
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/v1/config/provider-options.ts</path>
<type>file</type>
<content>
1: export * as ConfigProviderOptionsV1 from "./provider-options.js"
2:
3: type Options = Readonly<Record<string, unknown>>
4:
5: export interface ProviderResult {
6: readonly settings: Record<string, unknown>
7: readonly headers?: Record<string, string>
8: readonly body?: Record<string, unknown>
9: }
10:
11: export function provider(options: Options): ProviderResult {
12: const headers = options.headers
13: const body = options.body
14: const settings = Object.fromEntries(Object.entries(options).filter(([key]) => key !== "headers" && key !== "body"))
15: const headerOverlay =
16: typeof headers === "object" && headers !== null && !Array.isArray(headers)
17: ? Object.fromEntries(
18: Object.entries(headers).filter((entry): entry is [string, string] => typeof entry[1] === "string"),
19: )
20: : undefined
21: const ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/provider/openai.ts</path>
<type>file</type>
<content>
120: Effect.catchIf(addressInUse, () =>
121: Effect.fail(
122: new Error(
123: `OpenAI browser login needs local port ${callbackPort} or ${callbackFallbackPort}, but both are already in use. Stop the processes using those ports or choose ChatGPT Pro/Plus (headless), then try again.`,
124: ),
125: ),
126: ),
127: ),
128: ),
129: ),
130: ),
131: )
132: }
133:
134: function bindWithRetry(server: Server, port: number, attempts: number): Effect.Effect<void, Error> {
135: return bind(server, port).pipe(
136: Effect.catchIf(
137: (error) => addressInUse(error) && attempts > 1,
138: () => Effect.sleep(callbackBindRetryDelay).pipe(Effect.andThen(bindWithRetry(server, port, attempts - 1))),
139: ),
140: )
141: }
142:
143: ...
Found 1 matches /home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/provider/openai.ts: Line 158: signal: AbortSignal.any([signal, AbortSignal.timeout(2000)]),
Found 8 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/session/model-transport.ts:
Line 92: `${exchange.connect.url}:${Hash.sha256(JSON.stringify(Object.entries(exchange.connect.headers).sort(([a], [b]) => a.localeCompare(b))))}`
/home/byk/Code/opencode-v2-pilot/packages/core/src/session/model-request.ts:
Line 220: // Lets session.model.request hooks rewrite the base URL and headers before dispatch.
Line 227: headers: { ...request.http?.headers },
Line 237: headers: Object.keys(event.headers).length === 0 ? undefined : event.headers,
Line 258: before.request.headers.get("content-type") ?? undefined,
Line 266: { status: response.status, headers: response.headers },
Line 337: headers: sessionHeaders(session, app),
/home/byk/Code/opencode-v2-pilot/packages/core/src/session/runner/retry.ts:
Line 31: const override = error.reason.http?.headers["x-should-retry"]
Found 9 matches
/home/byk/Code/opencode-v2-pilot/packages/plugin-browser/src/proxy.ts:
Line 71: server.headersTimeout = 10_000
/home/byk/Code/opencode-v2-pilot/packages/core/src/v1/config/provider.ts:
Line 103: headerTimeout: Schema.optional(
/home/byk/Code/opencode-v2-pilot/packages/app/src/runtime/server/request-queue.ts:
Line 40: headersTimeoutMs?: number
Line 48: const headersTimeoutMs = input.headersTimeoutMs ?? requestHeadersTimeoutMs
Line 115: isSetupRequest(request.method, pathname) ? setupHeadersTimeoutMs : headersTimeoutMs,
/home/byk/Code/opencode-v2-pilot/packages/app/src/runtime/server/request-queue.test.ts:
Line 8: headersTimeoutMs?: number
Line 18: headersTimeoutMs: input?.headersTimeoutMs,
Line 109: const input = setup({ limit: 1, headersTimeoutMs: 10 })
Line 125: const input = setup({ limit: 4, headersTimeoutMs: 10, setupHeadersTimeoutMs: 200 })
Found 18 matches
/home/byk/Code/opencode-lore/packages/opencode/test/routing.e2e.test.ts:
Line 77: resetPipelineState: () => Promise<void>;
Line 97: await gw.resetPipelineState();
Line 151: const { setUpstreamInterceptor, resetPipelineState } =
Line 154: resetPipelineState: (opts?: { fast?: boolean }) => Promise<void>;
Line 161: await resetPipelineState({ fast: true });
/home/byk/Code/opencode-lore/packages/opencode/test/tui-silence.test.ts:
Line 14: * resets the flag after each test.
/home/byk/Code/opencode-lore/packages/opencode/src/index.ts:
Line 120: let processInitDone = false;
Line 234: function isInertTestEnv(): boolean {
Line 248: if (!processInitDone) {
Line 249: const inTestEnv = isInertTestEnv();
Line 291: const inTestEnv = isInertTestEnv();
Line 462: if (!processInitDone) {
Line 490: processInitDone = true;
/home/byk/Code/opencode-lore/packages/opencode/eval/backfill.ts:
Line ...
Found 18 matches
/home/byk/Code/opencode-lore/packages/opencode/test/index.test.ts:
Line 38: const hooks = await LorePlugin({
Line 211: // In NODE_ENV=test the plugin's init skips gateway start, so
/home/byk/Code/opencode-lore/packages/opencode/test/routing.e2e.test.ts:
Line 7: * `NODE_ENV=test` — this test forces the plugin active via
Line 8: * `LORE_OPENCODE_FORCE_ACTIVE=1` and points it at a controlled gateway via
Line 31: // NODE_ENV=test unless LORE_OPENCODE_FORCE_ACTIVE=1.)
Line 112: // Force the plugin's ACTIVE path while keeping NODE_ENV=test, and point
Line 116: "LORE_OPENCODE_FORCE_ACTIVE",
Line 119: "LORE_DISABLED",
Line 123: process.env.LORE_OPENCODE_FORCE_ACTIVE = "1";
Line 126: delete process.env.LORE_DISABLED;
Line 128: hooks = await LorePlugin({
/home/byk/Code/opencode-lore/packages/opencode/test/subagent-detection.test.ts:
Line 52: return ...
No files found
/home/byk/Code/opencode-lore/vitest.config.ts /home/byk/Code/opencode-lore/vitest.mutation.config.ts /home/byk/Code/opencode-lore/vitest.evals.config.ts
<path>/home/byk/Code/opencode-lore/vitest.config.ts</path>
<type>file</type>
<content>
1: import { defineConfig } from "vitest/config";
2: import path from "node:path";
3:
4: export default defineConfig({
5: // Alias @loreai/core and @loreai/gateway for test imports.
6: // MUST be at the top level of the vite config — putting this under
7: // `test.resolve.alias` does NOT work (vite's resolver is a top-level
8: // option, not a test.* option). The previous placement silently
9: // resolved to the stale dist build, masking real test failures.
10: resolve: {
11: alias: {
12: "@loreai/core": path.resolve(__dirname, "packages/core/src"),
13: "@loreai/gateway": path.resolve(__dirname, "packages/gateway/src"),
14: },
15: },
16: test: {
17: // Run all packages' tests
18: include: [
19: "packages/core/test/**/*.test.ts",
20: // Fast, pure unit tests for the eval suite's own logic (scorers,
21: // analysis). ...
Found 22 matches
/home/byk/Code/opencode-lore/packages/opencode/test/index.test.ts:
Line 3: import { LorePlugin } from "../src/index";
Line 37: type PluginInput = Parameters<typeof LorePlugin>[0];
Line 38: const hooks = await LorePlugin({
Line 54: describe("LorePlugin config hook", () => {
Line 61: expect(cfg.compaction).toEqual({ auto: false, prune: false });
Line 77: expect(agents["lore-distill"]).toEqual({
Line 82: expect(agents["lore-curator"]).toEqual({
Line 87: expect(agents["lore-query-expand"]).toEqual({
Line 118: expect(agents["my-agent"]).toEqual({
Line 170: expect(options.defaultHeaders).toEqual({ "X-Custom": "value" });
Line 228: expect(provider.openai.options).toEqual({
Line 252: describe("LorePlugin hooks", () => {
Line 256: expect(hooks.tool).toEqual({});
Line 278: describe("plugin entry module export shape", () => {
Line 287: // named `LorePlugin` and the same-reference ...
<path>/home/byk/Code/opencode-lore/packages/opencode/test/index.test.ts</path>
<type>file</type>
<content>
245: const anthropic = provider.anthropic as Record<string, unknown>;
246: expect((anthropic.options as Record<string, unknown>).baseURL).toBe(
247: "http://127.0.0.1:3207/v1",
248: );
249: });
250: });
251:
252: describe("LorePlugin hooks", () => {
253: test("returns an empty tool map", async () => {
254: const { hooks, cleanup } = await initPlugin();
255: try {
256: expect(hooks.tool).toEqual({});
257: } finally {
258: cleanup();
259: }
260: });
261:
262: test("returns only config and tool hooks (no event/transform hooks)", async () => {
263: const { hooks, cleanup } = await initPlugin();
264: try {
265: expect(hooks.config).toBeDefined();
266: expect(hooks.tool).toBeDefined();
267: // Only config, tool, and chat.headers hooks should be registered
268: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/host.ts</path>
<type>file</type>
<content>
1: export * as Host from "./host.js"
2:
3: import path from "node:path"
4: import { importModule, resolveModule } from "@opencode/util/runtime-import"
5:
6: export interface Target {
7: readonly directory: string
8: readonly name?: string
9: }
10:
11: export interface Entrypoints {
12: readonly server?: string
13: readonly tui?: string
14: readonly rpc?: string
15: }
16:
17: export function resolve(target: Target): Entrypoints {
18: const entry = (subpaths: readonly string[]) => {
19: for (const subpath of subpaths) {
20: const specifier = target.name
21: ? [target.name, subpath].filter(Boolean).join("/")
22: : path.resolve(target.directory, subpath || "index")
23: try {
24: return resolveModule(specifier, target.directory)
25: } catch (error) {
26: if (
27: !(error instanceof Error) ||
28: ...
<path>/home/byk/Code/opencode-lore/packages/opencode/package.json</path>
<type>file</type>
<content>
1: {
2: "name": "@loreai/opencode",
3: "version": "0.40.0",
4: "type": "module",
5: "license": "FSL-1.1-Apache-2.0",
6: "description": "Three-tier memory architecture for OpenCode — distillation, not summarization",
7: "main": "./src/index.ts",
8: "types": "./src/index.ts",
9: "exports": {
10: ".": {
11: "types": "./src/index.ts",
12: "bun": "./src/index.ts",
13: "default": "./src/index.ts"
14: }
15: },
16: "scripts": {
17: "typecheck": "tsc --noEmit",
18: "build": "echo '@loreai/opencode ships raw TS — no build step needed'"
19: },
20: "peerDependencies": {
21: "@opencode-ai/plugin": ">=1.1.0"
22: },
23: "dependencies": {
24: "@loreai/core": "workspace:*",
25: "@loreai/gateway": "workspace:*"
26: },
27: "devDependencies": {
28: "@opencode-ai/plugin": "^1.1.39",
29: "@opencode-ai/sdk": "^1.1.39",
30: ...
<path>/home/byk/Code/opencode-lore/packages/opencode/README.md</path>
<type>file</type>
<content>
1: # @loreai/opencode
2:
3: > **Experimental** — Under active development. APIs, storage format, and behavior may change.
4:
5: Three-tier memory architecture for [OpenCode](https://opencode.ai) — distillation, not summarization.
6:
7: An implementation of [Sanity's Nuum](https://www.sanity.io/blog/how-we-solved-the-agent-memory-problem) memory architecture and [Mastra's Observational Memory](https://mastra.ai/research/observational-memory) system as an OpenCode plugin. Preserves operational intelligence (file paths, error messages, exact decisions) rather than narrative summaries that lose the details agents need to keep working.
8:
9: ## Install
10:
11: Add to your project's `opencode.json`:
12:
13: ```json
14: {
15: "plugin": [
16: "@loreai/opencode"
17: ]
18: }
19: ```
20:
21: Restart OpenCode and the plugin will be installed automatically. ...
Found 2 matches /home/byk/Code/opencode-v2-pilot/packages/schema/src/permission.ts: Line 16: export const Source = Schema.Union([ Line 23: export type Source = typeof Source.Type
<path>/home/byk/Code/opencode-v2-pilot/packages/schema/src/permission.ts</path>
<type>file</type>
<content>
1: export * as Permission from "./permission.js"
2:
3: import { Schema } from "effect"
4: import { optional } from "./schema.js"
5: import { ephemeral, inventory } from "./event.js"
6: import { ascending } from "./identifier.js"
7: import { SessionID } from "./session-id.js"
8: import { statics } from "./schema.js"
9:
10: export const ID = Schema.String.check(Schema.isStartsWith("per")).pipe(
11: Schema.brand("Permission.ID"),
12: statics((schema) => ({ create: (id?: string) => schema.make(id ?? "per_" + ascending()) })),
13: )
14: export type ID = typeof ID.Type
15:
16: export const Source = Schema.Union([
17: Schema.Struct({
18: type: Schema.Literal("tool"),
19: messageID: Schema.String,
20: id: Schema.String,
21: }),
22: ]).annotate({ identifier: "Permission.Source" })
23: export type Source = typeof Source.Type
24:
25: const RequestFields = {
26: ...
Found 2 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/permission.ts:
Line 103: export interface Interface {
Line 105: readonly assert: (input: AssertInput) => Effect.Effect<void, Error | SessionErrors.NotFoundError>
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/permission.ts</path>
<type>file</type>
<content>
70: export class BlockedError extends Schema.TaggedError<BlockedError>()("Permission.BlockedError", {
71: rules: Permission.Ruleset,
72: permission: Schema.String,
73: resources: Schema.Array(Schema.String),
74: reason: Schema.String.pipe(Schema.optional),
75: }) {
76: override get message() {
77: return this.reason ?? `Permission denied: ${this.permission}`
78: }
79: }
80:
81: export class NotFoundError extends Schema.TaggedError<NotFoundError>()("Permission.NotFoundError", {
82: requestID: ID,
83: }) {}
84:
85: export type Error = BlockedError | CorrectedError
86:
87: export function evaluate(action: string, resource: string, ...rulesets: Permission.Ruleset[]): Permission.Rule {
88: return (
89: rulesets
90: .flat()
91: .findLast((rule) => Wildcard.match(action, rule.action) && Wildcard.match(resource, rule.resource)) ?? ...
Found 1 matches /home/byk/Code/opencode-v2-pilot/packages/core/src/permission.ts: Line 47: export type AssertInput = typeof AssertInput.Type
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/permission.ts</path>
<type>file</type>
<content>
30: resources: Permission.Request.fields.resources,
31: save: Permission.Request.fields.save,
32: metadata: Permission.Request.fields.metadata,
33: source: Permission.Request.fields.source,
34: }
35:
36: export const Request = Permission.Request
37: export type Request = typeof Request.Type
38:
39: export const Reply = Permission.Reply
40: export type Reply = typeof Reply.Type
41:
42: export const AssertInput = Schema.Struct({
43: id: ID.pipe(Schema.optional),
44: ...RequestFields,
45: agent: Agent.ID.pipe(Schema.optional),
46: }).annotate({ identifier: "Permission.AssertInput" })
47: export type AssertInput = typeof AssertInput.Type
48:
49: export const ReplyInput = Schema.Struct({
50: requestID: ID,
51: reply: Reply,
52: message: Schema.String.pipe(Schema.optional),
53: }).annotate({ identifier: "Permission.ReplyInput" })
54: export type ReplyInput = ...
byk 2122526 2118968 0 May28 pts/3 00:09:21 journalctl -u opencode -f byk 3836710 1 99 19:57 ? 01:44:04 /home/byk/.opencode/server/opencode-server --hostname=0.0.0.0 --port=4096 byk 3836719 1719524 0 19:57 pts/2 00:00:03 lore logs -f
No files found
Found 1 matches
/home/byk/Code/opencode-v2-pilot/packages/schema/src/config.ts:
Line 99: plugins: ConfigPlugin.Plugins.pipe(optional).annotate({
<path>/home/byk/Code/opencode-v2-pilot/packages/schema/src/config.ts</path>
<type>file</type>
<content>
88: description: "Named slash command definitions",
89: }),
90: instructions: Schema.String.pipe(Schema.Array, optional).annotate({
91: description: "Additional paths or URLs supplying ambient instructions",
92: }),
93: references: ConfigReference.Info.pipe(optional).annotate({
94: description: "Named local directories or Git repositories available as external context",
95: }),
96: websearch: ConfigWebSearch.Selection.pipe(optional).annotate({
97: description: "Web search provider selection",
98: }),
99: plugins: ConfigPlugin.Plugins.pipe(optional).annotate({
100: description: "Ordered plugin enablement directives and external package declarations",
101: }),
102: worktree: ConfigWorktree.Info.pipe(optional).annotate({
103: description: "Directory defaults for local worktree creation",
104: }),
105: warming: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/agent.ts</path>
<type>file</type>
<content>
1: export * as Agent from "./agent.js"
2:
3: import path from "path"
4: import { makeLocationNode } from "@opencode/util/effect/app-node"
5: import { Array, Context, Effect, Layer, Types } from "effect"
6: import { Agent } from "@opencode/schema/agent"
7: import { Global } from "@opencode/util/global"
8: import { Bus } from "./bus.js"
9: import { State } from "./state.js"
10:
11: const SHELL_OUTPUT_GLOB = (data: string) => path.join(data, "shell", "*", "*")
12: const TOOL_OUTPUT_GLOB = (data: string) => path.join(data, "tool-output", "*")
13:
14: export const ID = Agent.ID
15: export type ID = typeof ID.Type
16: export const Name = Agent.Name
17: export type Name = Agent.Name
18: export const defaultID = ID.make("build")
19:
20: export const Color = Agent.Color
21:
22: export const Info = Agent.Info
23: export type Info = Agent.Info
24:
25: export { Event } from ...
<path>/home/byk/Code/opencode-v2-pilot/packages/schema/src/agent.ts</path>
<type>file</type>
<content>
1: export * as Agent from "./agent.js"
2:
3: import { Schema } from "effect"
4: import { ephemeral, inventory } from "./event.js"
5: import { optional } from "./schema.js"
6: import { Model } from "./model.js"
7: import { Permission } from "./permission.js"
8: import { Provider } from "./provider.js"
9: import { PositiveInt, statics } from "./schema.js"
10:
11: const Updated = ephemeral({ type: "agent.updated", schema: {} })
12:
13: export const ID = Schema.String.pipe(Schema.brand("Agent.ID"))
14: export type ID = typeof ID.Type
15:
16: export const Name = Schema.String.pipe(Schema.brand("Agent.Name"))
17: export type Name = typeof Name.Type
18:
19: export const Color = Schema.String.annotate({ identifier: "Agent.Color" })
20: export type Color = typeof Color.Type
21:
22: export interface Info extends Schema.Schema.Type<typeof Info> {}
23: export const Info = ...
Found 2 matches
/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/agent.ts:
Line 6: export interface AgentEditor {
Line 10: update(id: string, update: (agent: DeepMutable<Agent.Info>) => void): void
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/agent.ts</path>
<type>file</type>
<content>
1: import type { AgentApi } from "@opencode/client/promise/api"
2: import type { Agent } from "@opencode/schema/agent"
3: import type { Transform } from "./registration.js"
4: import type { DeepMutable } from "./types.js"
5:
6: export interface AgentEditor {
7: list(): readonly DeepMutable<Agent.Info>[]
8: get(id: string): DeepMutable<Agent.Info> | undefined
9: default(id: string | undefined): void
10: update(id: string, update: (agent: DeepMutable<Agent.Info>) => void): void
11: remove(id: string): void
12: }
13:
14: export interface AgentDomain extends AgentApi {
15: readonly transform: Transform<AgentEditor>
16: readonly reload: () => Promise<void>
17: }
(End of file - total 17 lines)
</content>
<path>/home/byk/Code/opencode-lore/packages/opencode/test/gateway-smoke.test.ts</path>
<type>file</type>
<content>
1: import { describe, test, expect, afterAll } from "vitest";
2: import { probeGateway } from "../src/internal";
3:
4: /**
5: * Smoke tests for the in-process gateway startup.
6: *
7: * These exercise startGateway from @loreai/gateway directly (which is what
8: * the plugin's startInProcess delegates to). Tests use ephemeral ports so
9: * they don't collide with a running gateway.
10: */
11:
12: // Minimal view of the @loreai/gateway module surface used by these tests.
13: type GatewayServer = { stop: () => void; port: number; hosts: string[] };
14: type GatewayModule = {
15: loadConfig: () => { port: number } & Record<string, unknown>;
16: startServer: (config: unknown) => Promise<GatewayServer>;
17: };
18:
19: // Track shutdown handles to clean up after tests. ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/source-directory.ts</path>
<type>file</type>
<content>
1: export * as PluginSourceDirectory from "./source-directory.js"
2:
3: import { FSUtil } from "@opencode/util/fs-util"
4: import { Effect, Option } from "effect"
5: import path from "path"
6:
7: export const names = ["plugin", "plugins"] as const
8:
9: export const discover = Effect.fn("PluginSourceDirectory.discover")(function* (
10: fs: FSUtil.Interface,
11: directory: string,
12: ) {
13: const children = (yield* Effect.forEach(names, (source) =>
14: fs.readDirectoryEntries(path.join(directory, source)).pipe(
15: Effect.orElseSucceed(() => []),
16: Effect.map((entries) => entries.map((entry) => ({ ...entry, target: path.join(directory, source, entry.name) }))),
17: ),
18: ))
19: .flat()
20: .sort((a, b) => (a.target < b.target ? -1 : a.target > b.target ? 1 : 0))
21: const targets = yield* Effect.forEach(children, (entry) ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/config/plugin/source.ts</path>
<type>file</type>
<content>
100:
101: export const empty = makeLocationNode({
102: service: Service,
103: layer: Layer.succeed(
104: Service,
105: Service.of({
106: operations: () => Effect.succeed([]),
107: changes: () => Stream.never,
108: }),
109: ),
110: deps: [],
111: })
112:
113: function parse(input: ConfigPlugin.Plugin): Operation {
114: if (typeof input !== "string") {
115: return { type: "add", target: input.package, options: input.options ?? {} }
116: }
117: if (!input.startsWith("-")) return { type: "add", target: input, options: {} }
118: if (input.length === 1) throw new Error("Plugin remove operation requires a target")
119: return { type: "remove", target: input.slice(1) }
120: }
121:
122: const scan = Effect.fn("ConfigPluginSource.scan")(function* (
123: fs: FSUtil.Interface,
124: location: Location.Interface,
125: entries: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/types.ts</path>
<type>file</type>
<content>
1: export type DeepMutable<A> = A extends (...args: never[]) => unknown
2: ? A
3: : A extends ReadonlyMap<infer K, infer V>
4: ? Map<DeepMutable<K>, DeepMutable<V>>
5: : A extends ReadonlyArray<infer I>
6: ? DeepMutable<I>[]
7: : A extends object
8: ? { -readonly [K in keyof A]: DeepMutable<A[K]> }
9: : A
(End of file - total 9 lines)
</content>
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/config/plugin/source.ts</path>
<type>file</type>
<content>
1: export * as ConfigPluginSource from "./source.js"
2:
3: import { Directory, Document, type Entry } from "@opencode/schema/config"
4: import { ConfigPlugin } from "@opencode/schema/config/plugin"
5: import { FSUtil } from "@opencode/util/fs-util"
6: import { Host } from "@opencode/plugin/host"
7: import { makeLocationNode } from "@opencode/util/effect/app-node"
8: import { Context, Effect, Layer, Option, PubSub, Scope, Stream } from "effect"
9: import path from "path"
10: import { fileURLToPath, pathToFileURL } from "url"
11: import { Config } from "../../config.js"
12: import { Watcher } from "../../filesystem/watcher.js"
13: import { Location } from "../../location.js"
14: import { PluginSourceDirectory } from "../../plugin/source-directory.js"
15:
16: export type Operation =
17: | {
18: readonly type: "add"
19: readonly target: string
20: ...
<path>/home/byk/.local/share/opencode-v2-pilot/config/opencode/opencode.json</path>
<type>file</type>
<content>
1: {
2: "$schema": "https://opencode.ai/config.json"
3: }
(End of file - total 3 lines)
</content>
<path>/home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins</path> <type>directory</type> <entries> followup.ts pty.ts (2 entries) </entries>
Found 10 matches /home/byk/.local/share/opencode-v2-pilot/data/opencode/log/opencode.log: Line 48: timestamp=2026-09-08T18:40:37.500Z level=INFO run=9386f4fa msg="loading plugin" id=/home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/followup.ts entrypoint=file:///home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/followup.ts http.span=185 role=server Line 51: timestamp=2026-09-08T18:40:38.047Z level=INFO run=9386f4fa msg="loading plugin" id=/home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/pty.ts entrypoint=file:///home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/pty.ts http.span=732 role=server Line 76: timestamp=2026-09-08T18:45:40.850Z level=INFO run=9386f4fa msg="loading plugin" id=/home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/followup.ts entrypoint=file:///home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/followup.ts http.span=303535 role=server Line 77: ...
No files found
No files found
No files found
No files found
Found 74 matches
/home/byk/Code/opencode-v2-pilot/packages/cli/src/commands/handlers/plugin/update.ts:
Line 9: Commands.commands.plugin.commands.update,
Line 10: Effect.fn("cli.plugin.update")(function* (input) {
Line 14: process.stderr.write(`Failed to check ${item.runtime} plugin "${item.name}": ${item.error}${EOL}`)
Line 18: process.stdout.write("No plugin updates available" + EOL)
Line 28: ? Effect.promise(() => result.client.plugin.update({ location: result.location, targets: [item.target] }))
Line 38: process.stdout.write(`Updated ${item.item.runtime} plugin "${item.item.name}"${EOL}`)
Line 42: `Failed to update ${item.item.runtime} plugin "${item.item.name}": ${Cause.pretty(item.result.cause)}${EOL}`,
/home/byk/Code/opencode-v2-pilot/packages/cli/src/commands/handlers/plugin/remove.ts:
Line 13: Commands.commands.plugin.commands.remove,
Line 14: Effect.fn("cli.plugin.remove")(function* (input) {
Line 20: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/session/model-request.ts</path>
<type>file</type>
<content>
364: const hasHttpHooks =
365: (yield* hooks.has("session", "http.request", resolved.ref.providerID)) ||
366: (yield* hooks.has("session", "http.response", resolved.ref.providerID))
367: const webSocket =
368: resolved.capabilities.responsesWebsockets === true
369: ? yield* Config.boolean(responsesWebSocketFlag(resolved.ref.providerID)).pipe(
370: Config.withDefault(false),
371: Effect.orDie,
372: )
373: : false
374: const http = hasHttpHooks
375: ? httpMiddleware(hooks, {
376: sessionID: session.id,
377: agent: input.scope.agentID,
378: model: resolved.ref,
379: kind: input.kind,
380: })
381: : undefined
382: const options: StreamOptions = {
383: ...(http ? ...
Found 5 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/session/compaction.ts:
Line 88: buffer: number
Line 377: initial: () => ({ auto: true, buffer: DEFAULT_BUFFER, tokens: DEFAULT_KEEP_TOKENS }),
Line 381: if (settings.buffer !== undefined) editor.buffer = settings.buffer
Line 700: limit.input === undefined ? Number.POSITIVE_INFINITY : limit.input - config.buffer,
Line 701: context - Math.max(output, config.buffer),
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/session/compaction.ts</path>
<type>file</type>
<content>
355: "Return only the updated Markdown sections. Do not reproduce the `<conversation-checkpoint>`, `<summary>`, or `<recent-context>` wrapper tags from the previous checkpoint.",
356: ...shared,
357: ].join("\n\n")
358: }
359: return [
360: "You MUST summarize the conversation above into a structured summary that will be given to another agent to resume the work.",
361: ...shared,
362: ].join("\n\n")
363: }
364:
365: const hasSummarySection = (summary: string) =>
366: summary.split("\n").some((line) => SUMMARY_HEADINGS.includes(line.trim()))
367:
368: export const layer = Layer.effect(
369: Service,
370: Effect.gen(function* () {
371: const bus = yield* Bus.Service
372: const llm = yield* LLMClient.Service
373: const db = (yield* Database.Service).db
374:
375: const state = State.create<Settings, Editor>({
376: ...
Found 1 matches /home/byk/Code/opencode-v2-pilot/packages/core/src/session/compaction.ts: Line 380: if (settings.auto !== undefined) editor.auto = settings.auto
Found 4 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/session/runner/llm.ts:
Line 44: const compaction = yield* SessionCompaction.Service
/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/internal.ts:
Line 130: SessionCompaction.Service,
/home/byk/Code/opencode-v2-pilot/packages/core/src/config/plugin/compaction.ts:
Line 13: const compaction = yield* SessionCompaction.Service
Line 15: yield* compaction.transform((editor) => {
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/config/plugin/compaction.ts</path>
<type>file</type>
<content>
1: export * as ConfigCompactionPlugin from "./compaction.js"
2:
3: import { define } from "@opencode/plugin/effect/plugin"
4: import { Effect } from "effect"
5: import { Config } from "../../config.js"
6: import { SessionCompaction } from "../../session/compaction.js"
7: import { ConfigEntryObserver } from "./entry-observer.js"
8:
9: export const Plugin = define({
10: id: "opencode.config.compaction",
11: effect: Effect.fn(function* (ctx) {
12: const config = yield* Config.Service
13: const compaction = yield* SessionCompaction.Service
14: const loaded = yield* ConfigEntryObserver.observe(config, ctx.event, compaction.reload())
15: yield* compaction.transform((editor) => {
16: for (const entry of loaded.entries) {
17: if (entry.type !== "document" || !entry.info.compaction) continue
18: editor.configure({
19: ...
Found 5 matches
/home/byk/Code/opencode-lore/packages/gateway/src/cli/setup.ts:
Line 1962: export const OPENCODE_SETUP_PROVIDER_IDS = [
Line 2028: for (const id of OPENCODE_SETUP_PROVIDER_IDS) {
Line 2089: for (const id of OPENCODE_SETUP_PROVIDER_IDS) {
Line 2114: for (const id of OPENCODE_SETUP_PROVIDER_IDS) {
Line 2233: `[lore] provider.<id>.options.baseURL = "${baseUrl}" (all ${OPENCODE_SETUP_PROVIDER_IDS.length} providers, --no-plugin fallback)`,
<path>/home/byk/Code/opencode-lore/packages/gateway/src/cli/setup.ts</path> <type>file</type> <content> 1955: * setup writer must inject baseURLs directly into the persisted config. 1956: * 1957: * Sourced from opencode's `BUNDLED_PROVIDERS` (provider.ts:108-135) plus 1958: * the `custom()` dispatch table (provider.ts:169-953). Opencode's 1959: * `resolveSDK()` always passes `options.baseURL` to the @ai-sdk factory, 1960: * so setting it here routes every chat call through the gateway. 1961: */ 1962: export const OPENCODE_SETUP_PROVIDER_IDS = [ 1963: "amazon-bedrock", 1964: "anthropic", 1965: "azure", 1966: "google", 1967: "google-vertex", 1968: "google-vertex-anthropic", 1969: "openai", 1970: "openai-compatible", 1971: "openrouter", 1972: "xai", 1973: "mistral", 1974: "groq", 1975: "deepinfra", 1976: "cerebras", 1977: "cohere", 1978: "gateway", 1979: "togetherai", 1980: "perplexity", 1981: "vercel", 1982: "alibaba", 1983: ...
Found 3 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/provider/openai.ts:
Line 66: if (url.pathname !== "/auth/callback") {
Line 277: const apiID = draft.modelID ?? draft.id
Line 304: { providerID: Provider.ID.openai },
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/provider/openai.ts</path>
<type>file</type>
<content>
225: }),
226: refresh: (value) => refresh(headlessMethodID, value, app),
227: }) satisfies IntegrationOAuthMethodRegistration
228:
229: export const OpenAIPlugin = define({
230: id: "opencode.provider.openai",
231: effect: Effect.fn(function* (ctx) {
232: const bus = yield* Bus.Service
233: const loading = Semaphore.makeUnsafe(1)
234: let chatgpt: Credential.OAuth | undefined
235:
236: const load = Effect.fn("OpenAIPlugin.load")(function* () {
237: const connection = yield* ctx.integration.connection.active("openai")
238: const credential = connection
239: ? yield* ctx.integration.connection.resolve(connection).pipe(Effect.orElseSucceed(() => undefined))
240: : undefined
241: chatgpt =
242: credential?.type === "oauth" &&
243: (credential.methodID === browserMethodID || ...
Found 13 matches
/home/byk/Code/opencode-v2-pilot/packages/schema/src/provider.ts:
Line 38: settings: Schema.Record(Schema.String, Schema.Any).pipe(optional),
Line 39: headers: Schema.Record(Schema.String, Schema.String).pipe(optional),
Line 40: body: Schema.Record(Schema.String, Schema.Any).pipe(optional),
Line 48: settings: Settings.pipe(Schema.withConstructorDefault(Effect.succeed({}))),
Line 49: headers: Schema.Record(Schema.String, Schema.String),
Line 50: body: Schema.Record(Schema.String, Schema.Any),
Line 51: }).annotate({ identifier: "Provider.Request" })
/home/byk/Code/opencode-v2-pilot/packages/schema/src/config/provider.ts:
Line 12: settings: JsonRecord.pipe(optional),
Line 13: headers: Schema.Record(Schema.String, Schema.String).pipe(optional),
Line 14: body: JsonRecord.pipe(optional),
Line 17: export class Request extends Schema.Class<Request>("Config.Provider.Request")({
Line 18: headers: Overlays.headers,
Line ...
<path>/home/byk/Code/opencode-v2-pilot/packages/schema/src/provider.ts</path>
<type>file</type>
<content>
30:
31: export type Compaction = typeof Compaction.Type
32: export const Compaction = Schema.Union([
33: Schema.Struct({ mode: Schema.Literal("local") }),
34: Schema.Struct({ mode: Schema.Literal("provider"), threshold: PositiveInt.pipe(optional) }),
35: ]).annotate({ identifier: "Provider.Compaction" })
36:
37: export const Overlays = {
38: settings: Schema.Record(Schema.String, Schema.Any).pipe(optional),
39: headers: Schema.Record(Schema.String, Schema.String).pipe(optional),
40: body: Schema.Record(Schema.String, Schema.Any).pipe(optional),
41: }
42:
43: export const Settings = Schema.Record(Schema.String, Schema.Any).annotate({ identifier: "Provider.Settings" })
44: export type Settings = typeof Settings.Type
45:
46: export interface Request extends Schema.Schema.Type<typeof Request> {}
47: export const Request = Schema.Struct({
48: settings: ...
Found 1 matches
/home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/followup.ts:
Line 35: const session = await ctx.session.get({ sessionID })
<path>/home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/followup.ts</path>
<type>file</type>
<content>
1: import { Plugin } from "@opencode/plugin"
2: import { Schema } from "effect"
3:
4: const SUBAGENT_REFUSAL =
5: "Error: scheduled follow-ups are disabled in subagents. A subagent must finish its task and return a result synchronously."
6:
7: const DelayInput = Schema.Struct({
8: delay: Schema.String.annotate({
9: description: "How long to wait, such as 30s, 2m, or 1h. A bare number means seconds.",
10: }),
11: message: Schema.String.annotate({
12: description: "The instruction to deliver when the delay expires.",
13: }),
14: })
15:
16: const EmptyInput = Schema.Struct({})
17:
18: const CancelInput = Schema.Struct({
19: id: Schema.String.annotate({ description: "The follow-up ID to cancel, or all." }),
20: })
21:
22: export default Plugin.define({
23: id: "followup",
24: async setup(ctx) {
25: const pending = new Map<
26: string,
27: ...
Found 11 matches
/home/byk/Code/opencode-v2-pilot/packages/client/src/promise/generated/client.ts:
Line 558: create: (input?: SessionCreateInput, requestOptions?: RequestOptions) =>
Line 836: context: (input: SessionContextInput, requestOptions?: RequestOptions) =>
Line 840: path: `/api/session/${encodeURIComponent(input.sessionID)}/context`,
Line 1431: create: (input: FormCreateInput, requestOptions?: RequestOptions) =>
Line 1529: create: (input: PermissionCreateInput, requestOptions?: RequestOptions) =>
Line 1686: create: (input?: PtyCreateInput, requestOptions?: RequestOptions) =>
Line 1783: create: (input: ExperimentalPersistentPtyCreateInput, requestOptions?: RequestOptions) =>
Line 1896: create: (input: ShellCreateInput, requestOptions?: RequestOptions) =>
Line 1991: create: (input?: WorktreeCreateInput, requestOptions?: RequestOptions) =>
Line 2037: create: (input: ...
Found 1 matches /home/byk/Code/opencode-lore/packages/opencode/test/session-state.test.ts: Line 13: * level `currentProjectPath` global was overwritten by sibling project
<path>/home/byk/Code/opencode-lore/packages/opencode/test/session-state.test.ts</path> <type>file</type> <content> 1: /** 2: * Tests for per-project state in the OpenCode plugin (B2). 3: * 4: * The plugin function (`LorePlugin`) can be called multiple times in the 5: * same process — e.g., when the user has multiple OpenCode worktrees open 6: * in parallel, or when a sub-agent spawns a new project context. The 7: * per-project Map ensures that: 8: * - Each project gets its own registered project path + git remote 9: * - The `chat.headers` hook injects the right headers per request 10: * - Concurrent project registrations don't clobber each other 11: * 12: * Regression coverage for the "lore-config" bug variant where the module- 13: * level `currentProjectPath` global was overwritten by sibling project 14: * inits, causing requests to be misattributed. ...
Found 100 matches (more matches available)
/home/byk/Code/opencode-v2-pilot/packages/core/test/v1-migration.test.ts:
Line 319: part("prt_5", message.id, { type: "patch", hash: "snap_patch", files: ["a.ts", "b.ts"] }),
Line 320: part("prt_6", message.id, { type: "patch", hash: "snap_patch_2", files: ["b.ts", "c.ts"] }),
Line 343: snapshot: { start: "snap_start", end: "snap_end", files: ["a.ts", "b.ts", "c.ts"] },
/home/byk/Code/opencode-v2-pilot/packages/core/test/database-migration.test.ts:
Line 168: const result = await $`bun ${fileURLToPath(new URL("../script/migration.ts", import.meta.url))} --check`
/home/byk/Code/opencode-v2-pilot/packages/core/test/agent.test.ts:
Line 209: expect(Permission.evaluate("read", "src/index.ts", explore?.permissions ?? []).effect).toBe("allow")
/home/byk/Code/opencode-v2-pilot/packages/core/test/tool-read.test.ts:
Line 808: FileSystem.Entry.make({ path: RelativePath.make("index.ts"), ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/test/plugin/module.test.ts</path>
<type>file</type>
<content>
1: import { expect } from "bun:test"
2: import path from "node:path"
3: import { Deferred, Effect, Exit, Fiber, Layer, Schedule, Scope, Stream } from "effect"
4: import { AppNodeBuilder } from "@opencode/core/effect/app-node-builder"
5: import { Watcher } from "@opencode/core/filesystem/watcher"
6: import { PluginModule } from "@opencode/core/plugin/module"
7: import { Global } from "@opencode/util/global"
8: import { Npm } from "@opencode/util/npm"
9: import { tempGlobalLayer } from "../fixture/global"
10: import { tmpdirScoped } from "../fixture/tmpdir"
11: import { testEffect } from "../lib/effect"
12:
13: const it = testEffect(
14: Layer.merge(
15: AppNodeBuilder.build(Npm.node, [Global.node.replace(tempGlobalLayer)]),
16: Watcher.layer().pipe(Layer.provide(Watcher.nativeLayer)),
17: ),
18: )
19:
20: it.live("watches creation of an external helper with ...
No files found
Found 9 matches
/home/byk/Code/opencode-v2-pilot/packages/core/test/plugin.test.ts:
Line 16: import { fromPromise } from "@opencode/plugin/promise/adapter"
Line 436: it.live("retains Promise plugin groups for later registrations and ignores a disabled group's attempts", () =>
Line 441: const definition = fromPromise({
Line 447: throw new Error("late Promise failure")
Line 465: it.effect("exposes canonical permission assertions to Promise plugins", () =>
Line 469: const definition = fromPromise({
Line 482: await Effect.runPromise(Deferred.succeed(asserted, undefined))
Line 492: promisePermissionIt.effect("preserves Promise permission assertion outcomes through tool execution", () =>
Line 499: ...fromPromise({
Found 28 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin.ts:
Line 23: // One slot per requested definition in activation order, including ones whose setup failed, so
Line 24: // the prefix diff below stays index-aligned and a failed revision is not retried until it changes.
Line 52: error: `Plugin disabled after ${failure.state}.transform failed. Check server logs for details.`,
Line 82: yield* Effect.logWarning("failed to load plugin", {
Line 118: const nextInventory = [...Array.from(active.values()).map(slotInfo), ...failures]
Line 131: ([id, slot]) =>
Line 134: if (slot.activation && !slot.activation.failure)
Line 135: yield* Scope.close(slot.activation.scope, Exit.void)
Line 140: const slot = previous.get(definition.id)
Line 141: // Reordering healthy registrations does not authorize ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin.ts</path>
<type>file</type>
<content>
65: plugin.effect({ ...host, storage: PluginHost.storage(kv, plugin.id) }),
66: ).pipe(
67: grouped,
68: inherit,
69: Effect.updateContext((context: Context.Context<never>) =>
70: Context.make(Scope.Scope, activation.scope).pipe(
71: Context.add(Logger.CurrentLoggers, Context.get(context, Logger.CurrentLoggers)),
72: Context.add(References.MinimumLogLevel, Context.get(context, References.MinimumLogLevel)),
73: ),
74: ),
75: Effect.withSpan("Plugin.load", { attributes: { "plugin.id": plugin.id } }),
76: Effect.onExit((exit) =>
77: Exit.isFailure(exit) && !activation.failure ? Scope.close(activation.scope, exit) : Effect.void,
78: ),
79: Effect.exit,
80: )
81: if (activation.failure || Exit.isSuccess(exit)) return { activation } as const
82: ...
Found 6 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/supervisor.ts:
Line 6: import { ConfigPluginSource } from "../config/plugin/source.js"
Line 22: operations: readonly ConfigPluginSource.Operation[],
Line 121: const sources = yield* ConfigPluginSource.Service
Line 153: const operations = yield* sources.operations()
Line 199: // Make accepted work visible to awaitActivation before coalescing the burst.
Line 245: ConfigPluginSource.node,
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/supervisor.ts</path>
<type>file</type>
<content>
15: import { PluginUpdate } from "./update.js"
16: import { Watcher } from "../filesystem/watcher.js"
17:
18: const resolve = Effect.fn("PluginSupervisor.resolve")(function* (
19: modules: Effect.Success<ReturnType<typeof PluginModule.make>>,
20: pre: readonly Plugin.Generation[],
21: post: readonly Plugin.Generation[],
22: operations: readonly ConfigPluginSource.Operation[],
23: install: boolean,
24: running: ReadonlyMap<string, Plugin.Generation>,
25: ) {
26: const matches = (selector: string, target: string) =>
27: selector === "*" || (selector.endsWith(".*") ? target.startsWith(selector.slice(0, -1)) : selector === target)
28: const definitions = [...pre, ...post]
29: const enabled = new Set(definitions.map((plugin) => plugin.id))
30: const packages = new Map<string, Plugin.Generation>()
31: const pending = new Set<string>()
32: const ...
Found 59 matches
/home/byk/Code/opencode-v2-pilot/packages/core/test/config/provider.test.ts:
Line 45: compaction: { mode: "provider", threshold: 120_000 },
Line 48: reset: { compaction: { mode: "provider" } },
Line 49: threshold: { compaction: { mode: "provider", threshold: 90_000 } },
Line 63: expect(native.compaction).toEqual({ mode: "provider", threshold: 120_000 })
Line 65: mode: "provider",
Line 68: mode: "provider",
Line 186: { name: "omitted capabilities", legacy: {}, overrides: {} },
Line 189: legacy: { modalities: { input: ["text", "image", "pdf"] } },
Line 194: legacy: { modalities: { output: ["audio"] } },
Line 197: { name: "enabled tools", legacy: { tool_call: true }, overrides: { tools: true } },
Line 198: { name: "disabled tools", legacy: { tool_call: false }, overrides: { tools: false } },
Line 201: legacy: { modalities: { input: ...
No files found
Found 5 matches
/home/byk/Code/opencode-v2-pilot/packages/core/test/sqlite-bundle.test.ts:
Line 24: plugins: [externalizeBare],
/home/byk/Code/opencode-v2-pilot/packages/core/test/plugin/supervisor.test.ts:
Line 53: Instance.layer(ref, { discovery: false, plugins: [greeter("instance-greet")], replacements: bindings }),
/home/byk/Code/opencode-v2-pilot/packages/core/test/plugin/supervisor-reload.test.ts:
Line 145: await Bun.write(path.join(directory.path, ".opencode/opencode.json"), JSON.stringify({ plugins: [root] }))
Line 208: JSON.stringify({ plugins: [path.dirname(file)] }),
Line 303: Bun.write(path.join(directory.path, ".opencode/opencode.json"), JSON.stringify({ plugins: ["fixture-pkg"] })),
Found 3 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/config.ts:
Line 25: import { ConfigNormalize } from "./config/normalize.js"
Line 108: const result = ConfigNormalize.normalize(input)
Line 109: yield* Effect.forEach(result.diagnostics, (diagnostic) =>
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/config.ts</path>
<type>file</type>
<content>
85: Service,
86: Effect.gen(function* () {
87: const fs = yield* FSUtil.Service
88: const location = yield* Location.Service
89: const watcher = yield* Watcher.Service
90: const bus = yield* Bus.Service
91: const credentials = yield* Credential.Service
92: const wellknown = yield* WellKnown.Service
93: const reloadLock = Semaphore.makeUnsafe(1)
94: const decodeOptions = { errors: "all", onExcessProperty: "ignore", propertyOrder: "original" } as const
95: const decodeInfo = Schema.decodeUnknownOption(Info, decodeOptions)
96: const parseInfo = Effect.fn("Config.parseInfo")(function* (text: string, source: string) {
97: const errors: ParseError[] = []
98: const input: unknown = parse(text, errors, { allowTrailingComma: true })
99: if (errors.length) {
100: yield* ...
Found 8 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/config.ts:
Line 36: /** Returns location config documents and discovery sources from lowest to highest priority. */
Line 128: const loadFile = Effect.fnUntraced(function* (filepath: string) {
Line 163: ).pipe(Effect.map((documents) => documents.filter((document) => document !== undefined)))
Line 174: return yield* Effect.forEach(entries, loadWellknownEntry).pipe(Effect.map((documents) => documents.flat()))
Line 179: ...(yield* Effect.forEach(ConfigDiscovery.names, (file) => loadFile(path.join(directory, file))).pipe(
Line 189: const direct = yield* Effect.forEach(sources.direct, (filepath) => loadFile(filepath)).pipe(
Line 195: ? yield* loadFile(sources.explicit).pipe(
/home/byk/Code/opencode-v2-pilot/packages/core/src/v1/config/config.ts:
Line 43: skills: Schema.optional(ConfigSkillsV1.Info).annotate({ description: "Additional skill folder ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/config.ts</path>
<type>file</type>
<content>
25: import { ConfigNormalize } from "./config/normalize.js"
26: import { ConfigDiscovery } from "./config/discovery.js"
27: import { ConfigWatch } from "./config/watch.js"
28: import { WellKnown } from "./wellknown.js"
29:
30: export function latest<K extends keyof Info>(entries: readonly Entry[], key: K): Info[K] | undefined {
31: return entries.findLast((entry): entry is Document => entry.type === "document" && entry.info[key] !== undefined)
32: ?.info[key]
33: }
34:
35: export interface Interface {
36: /** Returns location config documents and discovery sources from lowest to highest priority. */
37: readonly entries: () => Effect.Effect<Entry[]>
38: /**
39: * Streams raw filesystem updates under config roots. ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/config.ts</path>
<type>file</type>
<content>
150: ),
151: )
152: return yield* Effect.forEach(configs, (config) =>
153: ConfigVariable.substitute({
154: type: "virtual",
155: source: entry.origin,
156: dir: entry.origin,
157: text: JSON.stringify(config),
158: env: variables,
159: }).pipe(
160: Effect.flatMap((text) => parseInfo(text, entry.origin)),
161: Effect.map((info) => (info ? new Document({ type: "document", info }) : undefined)),
162: ),
163: ).pipe(Effect.map((documents) => documents.filter((document) => document !== undefined)))
164: })
165:
166: const loadWellknown = Effect.fn("Config.loadWellknown")(function* () {
167: const entries = yield* wellknown
168: .entries()
169: .pipe(
170: Effect.catch((error) =>
171: ...
Found 10 matches /home/byk/Code/opencode-v2-pilot/packages/core/src/v1/config/provider.ts: Line 63: headers: Schema.optional(Schema.Record(Schema.String, Schema.String)), Line 106: "Timeout in milliseconds to wait for response headers. Provider integrations may set defaults. Set to false to disable timeout.", Line 110: "Timeout in milliseconds to wait for response headers. Provider integrations may set defaults. Set to false to disable timeout.", /home/byk/Code/opencode-v2-pilot/packages/core/src/config/plugin/provider.ts: Line 61: if (item.settings !== undefined) provider.settings = Provider.mergeOverlay(provider.settings, item.settings) Line 62: if (item.headers !== undefined) provider.headers = Provider.mergeHeaders(provider.headers, item.headers) Line 72: if (item.settings?.baseURL !== undefined && model.settings) delete model.settings.baseURL Line 81: if (config.settings !== undefined) ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/config/plugin/provider.ts</path>
<type>file</type>
<content>
40:
41: yield* ctx.catalog.transform((catalog) => {
42: const configuredDefault = Config.latest(loaded.entries, "model")
43: if (configuredDefault !== undefined)
44: catalog.model.default.set(configuredDefault.providerID, configuredDefault.model)
45: for (const [id, item] of configuredProviders(loaded.entries)) {
46: const providerID = id
47: const current = catalog.provider.get(providerID)
48: const source = catalog.provider.get(item.canonical ?? current?.provider.canonical ?? providerID)
49: const changed = item.canonical !== undefined && item.canonical !== current?.provider.canonical
50: catalog.provider.update(providerID, (provider) => {
51: if (changed && source && source.provider !== provider)
52: Object.assign(provider, structuredClone(source.provider), {
53: ...
No files found
Found 92 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/worktree.ts:
Line 113: readonly configure: (settings: { readonly directory: AbsolutePath }) => void
/home/byk/Code/opencode-v2-pilot/packages/core/src/provider.ts:
Line 141: export const Request = Provider.Request
Line 142: export type Request = Provider.Request
/home/byk/Code/opencode-v2-pilot/packages/core/src/models-dev.ts:
Line 91: ...(item.api ? { settings: { baseURL: item.api } } : {}),
Line 310: settings: { reasoning: { enabled: false } },
Line 314: settings: { reasoning: { enabled: true } },
Line 320: { id: Model.VariantID.make("none"), settings: { reasoning: { enabled: false } } },
Line 321: { id: Model.VariantID.make("thinking"), settings: { reasoning: { enabled: true } } },
Line 325: { id: Model.VariantID.make("none"), settings: { thinking: { type: "disabled" } } },
Line 328: settings: {
Line 337: settings: { ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/catalog.ts</path>
<type>file</type>
<content>
55: readonly small: (providerID: Provider.ID) => Effect.Effect<Model.Info | undefined>
56: }
57: }
58:
59: export class Service extends Context.Service<Service, Interface>()("@opencode/Catalog") {}
60:
61: const layer = Layer.effect(
62: Service,
63: Effect.gen(function* () {
64: const bus = yield* Bus.Service
65: const integrations = yield* Integration.Service
66:
67: const available = (provider: Provider.Info, integration: Integration.Info | undefined) => {
68: if (provider.activation === "disabled") return false
69: if (provider.activation === "enabled") return true
70: if (integration?.connections.length) return true
71: return provider.integrationID === undefined && !integration
72: }
73:
74: const projectModel = (model: Model.Info, provider: Provider.Info) => {
75: return {
76: ...model,
77: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/model-resolver.ts</path>
<type>file</type>
<content>
185: const module = yield* (dependencies?.loadPackage ?? Provider.loadPackage)(specifier).pipe(
186: Effect.mapError(() => unsupported(resolved)),
187: )
188: const settings = {
189: ...(credential ? Struct.omit(mapped, ["accessToken", "apiKey", "authToken"]) : mapped),
190: ...(resolved.canonical === undefined ? {} : { provider: resolved.canonical }),
191: ...nativeCredentialSettings(specifier, credential),
192: headers: Provider.mergeHeaders(mapping?.headers, resolved.headers),
193: body: Provider.mergeOverlay(mapping?.body, resolved.body),
194: }
195: return yield* Effect.try({
196: try: () => {
197: const runtime = module.model(resolved.modelID ?? resolved.id, settings)
198: return LanguageModel.update(runtime, {
199: provider: resolved.canonical ?? resolved.providerID,
200: compatibility: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/model-resolver.ts</path>
<type>file</type>
<content>
120: }
121: : model,
122: )
123: }
124:
125: export interface Dependencies {
126: readonly loadPackage?: (specifier: string) => Effect.Effect<Provider.ProviderPackage, Provider.LoadError>
127: readonly loadAISDK?: (model: Info) => Effect.Effect<LanguageModel, AISDK.InitError>
128: }
129:
130: export const fromCatalogModel = (
131: model: Info,
132: credential?: Credential.Value,
133: dependencies?: Dependencies,
134: ): Effect.Effect<
135: LanguageModel,
136: UnsupportedPackageError | UnresolvedProviderVariablesError | UnsupportedCompactionError
137: > =>
138: resolveCatalogModel(model, credential, dependencies).pipe(
139: Effect.flatMap((resolved) => validateProviderVariables(model, resolved)),
140: Effect.flatMap((resolved) => {
141: // Reject provider compaction policies up front so the misconfiguration surfaces before any ...
Found 10 matches
/home/byk/Code/opencode-v2-pilot/packages/schema/src/provider.ts:
Line 39: headers: Schema.Record(Schema.String, Schema.String).pipe(optional),
Line 40: body: Schema.Record(Schema.String, Schema.Any).pipe(optional),
Line 47: export const Request = Schema.Struct({
Line 48: settings: Settings.pipe(Schema.withConstructorDefault(Effect.succeed({}))),
Line 49: headers: Schema.Record(Schema.String, Schema.String),
Line 50: body: Schema.Record(Schema.String, Schema.Any),
/home/byk/Code/opencode-v2-pilot/packages/schema/src/config/provider.ts:
Line 13: headers: Schema.Record(Schema.String, Schema.String).pipe(optional),
Line 14: body: JsonRecord.pipe(optional),
Line 18: headers: Overlays.headers,
Line 19: body: Overlays.body,
Found 1 matches /home/byk/Code/opencode-v2-pilot/packages/core/src/model.ts: Line 29: export const Info = Model.Info
Found 2 matches
/home/byk/Code/opencode-v2-pilot/packages/schema/src/model.ts:
Line 99: export interface Info extends Schema.Schema.Type<typeof Info> {}
Line 100: export const Info = Schema.Struct({
<path>/home/byk/Code/opencode-v2-pilot/packages/schema/src/model.ts</path>
<type>file</type>
<content>
90: }),
91: }).annotate({ identifier: "Model.Cost" })
92:
93: export interface Variant extends Schema.Schema.Type<typeof Variant> {}
94: export const Variant = Schema.Struct({
95: id: VariantID,
96: ...Provider.Overlays,
97: }).annotate({ identifier: "Model.Variant" })
98:
99: export interface Info extends Schema.Schema.Type<typeof Info> {}
100: export const Info = Schema.Struct({
101: id: ID,
102: modelID: ID,
103: providerID: Provider.ID,
104: canonical: Provider.ID.pipe(optional),
105: family: Family.pipe(optional),
106: name: Schema.String,
107: compatibility: Compatibility.pipe(optional),
108: package: Provider.Package.pipe(optional),
109: compaction: Provider.Compaction.pipe(optional),
110: ...Provider.Overlays,
111: capabilities: Capabilities,
112: variants: Schema.Array(Variant),
113: time: Schema.Struct({
114: released: ...
Found 94 matches
/home/byk/Code/opencode-v2-pilot/packages/ai/src/provider-error.ts:
Line 103: const details = { message: input.message, body: input.rawBody, http: input.http, cause: input.cause }
/home/byk/Code/opencode-v2-pilot/packages/ai/src/llm.ts:
Line 53: http: requestHttp,
Line 64: http: requestHttp === undefined ? undefined : HttpOptions.make(requestHttp),
/home/byk/Code/opencode-v2-pilot/packages/ai/src/image.ts:
Line 39: http: input.http,
Line 102: http: Schema.optional(HttpOptions),
Line 148: http: input.http === undefined ? undefined : HttpOptions.make(input.http),
/home/byk/Code/opencode-v2-pilot/packages/ai/src/image-client.ts:
Line 36: http: mergeHttpOptions(request.model.http, request.http),
/home/byk/Code/opencode-v2-pilot/packages/ai/src/schema/options.ts:
Line 56: export const make = (input: Input) => (input instanceof HttpOptions ? ...
<path>/home/byk/Code/opencode-v2-pilot/packages/ai/src/route/client.ts</path>
<type>file</type>
<content>
130: if (!endpointBaseURL(route.endpoint))
131: throw new Error(`Route.model(${route.id}) requires an endpoint baseURL — configure it on the route first`)
132: return LanguageModel.make<Options, Compact>({
133: ...mapped,
134: provider,
135: route,
136: })
137: }
138:
139: const mergeRouteDefaults = (base: RouteDefaults | undefined, patch: RouteDefaultsInput): RouteDefaults => {
140: const headers = mergeHeaders(base?.headers, patch.headers)
141: return {
142: ...base,
143: ...patch,
144: headers,
145: generation: mergeGenerationOptions(generationOptions(base?.generation), generationOptions(patch.generation)),
146: providerOptions: mergeProviderOptions(base?.providerOptions, patch.providerOptions),
147: http: mergeHttpOptions(
148: base?.http,
149: httpOptions(patch.http),
150: headers === undefined ? ...
Found 10 matches
/home/byk/Code/opencode-lore/packages/opencode/test/index.test.ts:
Line 31: async function initPlugin() {
Line 37: type PluginInput = Parameters<typeof LorePlugin>[0];
Line 38: const hooks = await LorePlugin({
Line 40: project: { id: "test", path: tmpDir } as unknown as PluginInput["project"],
Line 44: $: {} as unknown as PluginInput["$"],
Line 56: const { hooks, cleanup } = await initPlugin();
Line 68: const { hooks, cleanup } = await initPlugin();
Line 110: const { hooks, cleanup } = await initPlugin();
Line 254: const { hooks, cleanup } = await initPlugin();
Line 263: const { hooks, cleanup } = await initPlugin();
<path>/home/byk/Code/opencode-lore/packages/opencode/test/index.test.ts</path>
<type>file</type>
<content>
1: import { describe, test, expect } from "vitest";
2: import { fileURLToPath } from "node:url";
3: import { LorePlugin } from "../src/index";
4: import { applyLoreProviderConfig } from "../src/internal";
5: import type { Plugin } from "@opencode-ai/plugin";
6:
7: /**
8: * Minimal mock of the OpenCode client. Only stubs the methods the plugin
9: * actually calls during initialization.
10: */
11: function createMockClient() {
12: return {
13: tui: {
14: showToast: () => Promise.resolve(),
15: },
16: session: {
17: get: () => Promise.resolve({ data: {} }),
18: list: () => Promise.resolve({ data: [] }),
19: create: () => Promise.resolve({ data: { id: "worker_1" } }),
20: messages: () => Promise.resolve({ data: [] }),
21: message: () => Promise.resolve({ data: null }),
22: prompt: () => Promise.resolve({ data: {} }),
23: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/tsconfig.json</path>
<type>file</type>
<content>
1: {
2: "$schema": "https://json.schemastore.org/tsconfig.json",
3: "extends": "@tsconfig/bun/tsconfig.json",
4: "compilerOptions": {
5: "rootDir": "src",
6: "outDir": "dist",
7: "declaration": true,
8: "lib": ["ESNext", "DOM", "DOM.Iterable"],
9: "noUncheckedIndexedAccess": false
10: },
11: "include": ["src"]
12: }
(End of file - total 12 lines)
</content>
No files found
No files found
<path>/home/byk/.local/share/opencode-v2-pilot/config/opencode/node_modules</path> <type>directory</type> <entries> .bin/ @msgpackr-extract/ @protobufjs/ @types/ ajv-draft-04/ ajv/ ast-types/ bun-pty/ bun-types/ csstype/ detect-libc/ effect/ fast-check/ fast-deep-equal/ fast-uri/ immer/ json-schema-traverse/ long/ msgpackr-extract/ msgpackr/ node-gyp-build-optional-packages/ protobufjs/ pure-rand/ require-from-string/ tinybench/ tslib/ undici-types/ valibot/ (28 entries) </entries>
No files found
Found 100 matches (more matches available)
/home/byk/Code/opencode-lore/packages/pi/test/internal.test.ts:
Line 57: expect(reg.headers["x-lore-session-id"]).toBe("sess-2");
Line 203: expect((init.headers as Record<string, string>)["x-lore-session-id"]).toBe(
/home/byk/Code/opencode-lore/packages/pi/test/extension.e2e.test.ts:
Line 159: expect(r.config.headers["x-lore-session-id"]).toBeTypeOf("string");
Line 178: const sid = after[0].config.headers["x-lore-session-id"];
/home/byk/Code/opencode-lore/packages/pi/src/internal.ts:
Line 311: "x-lore-session-id": sessionID,
Line 388: "x-lore-session-id": sessionID,
/home/byk/Code/opencode-lore/packages/pi/src/index.ts:
Line 137: "x-lore-session-id": currentSessionID,
Line 145: headers.get("x-lore-session-id") !== currentSessionID ||
Line 196: // requests carry the correct x-lore-session-id header. ...
No files found
Found 7 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/models-dev.ts:
Line 518: body: input.request?.body ? { ...input.request.body } : undefined,
/home/byk/Code/opencode-v2-pilot/packages/core/src/session/model-request.ts:
Line 254: if (before.request.body)
Line 311: agent: input.scope.contextAgentID ?? input.scope.agentID,
Line 333: { sessionID: session.id, agent: input.scope.agentID, model: resolved.ref, kind: input.kind },
Line 377: agent: input.scope.agentID,
/home/byk/Code/opencode-v2-pilot/packages/core/src/config/plugin/agent.ts:
Line 112: Object.assign(agent.request.headers, item.request.headers ?? {})
Line 113: Object.assign(agent.request.body, item.request.body ?? {})
No files found
No files found
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/session/runner/llm.ts</path>
<type>file</type>
<content>
1: export * as SessionRunnerLLM from "./llm.js"
2:
3: import { Message } from "@opencode/ai"
4: import { and, desc, eq, sql } from "drizzle-orm"
5: import { Cause, Effect, Exit, FiberMap, Layer } from "effect"
6: import { Database } from "../../database/database.js"
7: import { Bus } from "../../bus.js"
8: import { InstructionState } from "../instruction-state.js"
9: import { SessionCompaction } from "../compaction.js"
10: import { SessionContext } from "../context.js"
11: import { SessionEvent } from "../event.js"
12: import { SessionInbox } from "../inbox.js"
13: import { SessionHistory } from "../history.js"
14: import { SessionProviderContext } from "../provider-context.js"
15: import { SessionModelRequest } from "../model-request.js"
16: import { SessionModelTransport } from "../model-transport.js"
17: import { SessionMessage } from "../message.js"
18: import { ...
No files found
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/session/context.ts</path>
<type>file</type>
<content>
1: export * as SessionContext from "./context.js"
2:
3: import { Model } from "@opencode/schema/model"
4: import { Context, Effect, Layer } from "effect"
5: import { Agent } from "../agent.js"
6: import { Catalog } from "../catalog.js"
7: import { CodeModeInstructions } from "../codemode/instructions.js"
8: import { Database } from "../database/database.js"
9: import { makeLocationNode } from "@opencode/util/effect/app-node"
10: import { InstructionDiscovery } from "../instruction-discovery.js"
11: import { Instructions } from "../instructions/index.js"
12: import { InstructionBuiltIns } from "../instructions/builtins.js"
13: import { Location } from "../location.js"
14: import { McpInstructions } from "../mcp/instructions.js"
15: import { McpTool } from "../tool/mcp.js"
16: import { ReferenceInstructions } from "../reference/instructions.js"
17: import { SkillInstructions } ...
No files found
Found 3 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/session/model-request.ts:
Line 258: before.request.headers.get("content-type") ?? undefined,
Line 317: providerOptions: {},
Line 346: providerOptions: Object.keys(context.providerOptions).length === 0 ? undefined : context.providerOptions,
Found 4 matches /home/byk/Code/opencode-v2-pilot/packages/core/src/session/runner/llm.ts: Line 221: const stepLimitReached = loaded.agent.info.steps !== undefined && step >= loaded.agent.info.steps Line 223: agent: loaded.agent.info, Line 245: agent: loaded.agent.id, Line 252: agent: loaded.agent.id,
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/session/runner/llm.ts</path>
<type>file</type>
<content>
210: const compactionInput = {
211: context: loaded,
212: prepare: context.prepare,
213: }
214: if (compaction.required({ messages: loaded.messages, resolved: loaded.model, context: loaded })) {
215: const result = yield* compaction.compact(compactionInput)
216: if (result.status !== "completed") return yield* new StepFailedError({ error: result.error })
217: if (result.recoveredOverflow) recoverOverflow = false
218: assistantMessageID = SessionMessage.ID.create()
219: continue
220: }
221: const stepLimitReached = loaded.agent.info.steps !== undefined && step >= loaded.agent.info.steps
222: const transcript = SessionModelRequest.baseTranscript({
223: agent: loaded.agent.info,
224: model: loaded.model,
225: tools: ...
Found 1 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/session/model-request.ts:
Line 89: export const baseTranscript = (input: {
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/session/model-request.ts</path>
<type>file</type>
<content>
70: readonly contextAgentID?: Agent.ID
71: readonly model: SessionRunnerModel.Resolved
72: /** Omitted for requests that carry no tool definitions, such as titles. */
73: readonly tools?: Tool.Snapshot
74: }
75: readonly transcript: {
76: readonly system: Array<SystemPart>
77: readonly messages: Array<Message>
78: }
79: readonly toolChoice?: LLM.RequestInput["toolChoice"]
80: /**
81: * Session context hooks shape the agent conversation. Standalone requests
82: * such as titles opt out; compaction uses the selected Session context.
83: */
84: readonly contextHooks?: false
85: /** Stateful Session WebSocket channels require an explicit durable-runner opt-in. */
86: readonly webSocket?: "session"
87: }
88:
89: export const baseTranscript = (input: {
90: readonly agent: Agent.Info
91: readonly model: ...
Found 100 matches (more matches available)
/home/byk/Code/opencode-v2-pilot/services/updates/src/index.ts:
Line 58: useragent: request.headers.get("user-agent"),
Line 59: ip: request.headers.get("cf-connecting-ip"),
Line 80: const agent = request.headers.get("User-Agent")?.match(/^opencode\/(?:([^/]+)\/([^/]+)\/cli|(.*))$/)
Line 247: <span class="badge" data-variant="outline">${escape(request.headers.get("Cf-Access-Authenticated-User-Email") ?? "Cloudflare Access pending")}</span>
Line 408: const authorization = request.headers.get("Authorization")
Line 455: const origin = request.headers.get("Origin")
/home/byk/Code/opencode-v2-pilot/services/files/src/index.ts:
Line 39: const cacheControl = request.headers.get("Cache-Control") ?? ""
Line 44: !request.headers.has("If-Match") &&
Line 45: !request.headers.has("If-Unmodified-Since") &&
Line 46: !request.headers.has("If-Range")
Line 50: ...
No files found
Found 8 matches
/home/byk/Code/opencode-v2-pilot/packages/core/test/plugin/websearch-fixture.ts:
Line 36: if (request.body._tag !== "Uint8Array") throw new Error(`Unexpected request body: ${request.body._tag}`)
Line 40: body: JSON.parse(new TextDecoder().decode(request.body.body)),
/home/byk/Code/opencode-v2-pilot/packages/core/test/plugin/plan.test.ts:
Line 45: request: { settings: {}, headers: {}, body: {} },
/home/byk/Code/opencode-v2-pilot/packages/core/test/plugin/provider-opencode.test.ts:
Line 480: expect(request.body).toMatchObject({
Line 486: expect(request.body).not.toHaveProperty("reasoningEffort")
Line 487: expect(request.body).not.toHaveProperty("reasoningSummary")
Line 488: if (variant.id === "plain") expect(request.body).not.toHaveProperty("reasoning")
/home/byk/Code/opencode-v2-pilot/packages/core/test/plugin/host.ts:
Line 481: body: { ...value.request.body },
Found 100 matches (more matches available)
/home/byk/Code/opencode-v2-pilot/packages/web/src/middleware.ts:
Line 89: localeFromCookie(ctx.request.headers.get("cookie")) ??
Line 90: localeFromAcceptLanguage(ctx.request.headers.get("accept-language"))
/home/byk/Code/opencode-v2-pilot/packages/desktop/test/browser/native.ts:
Line 91: if (request.headers["if-none-match"] === '"v1"') {
Line 100: const crossOrigin = `http://${request.headers.host?.replace(/^[^:]+/, "localhost")}`
Line 109: .update(request.headers["sec-websocket-key"] + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11")
/home/byk/Code/opencode-v2-pilot/packages/http-recorder/test/redaction.test.ts:
Line 93: { path: "interactions[0].request.body", reason: "Google API key" },
Line 123: expect(JSON.parse(request.body)).toEqual({
/home/byk/Code/opencode-v2-pilot/packages/desktop/src/main/windows/protocol.ts:
Line 45: const range = ...
No files found
Found 13 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/models-dev.ts:
Line 517: headers: input.request?.headers ? { ...input.request.headers } : undefined,
Line 518: body: input.request?.body ? { ...input.request.body } : undefined,
/home/byk/Code/opencode-v2-pilot/packages/core/src/session/model-request.ts:
Line 254: if (before.request.body)
Line 258: before.request.headers.get("content-type") ?? undefined,
/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/provider/github-copilot.ts:
Line 274: const token = evt.request.headers.get("x-api-key")
Line 278: applyHeaders(evt.request.headers, token, ctx.app, requestMetadata(evt.request.url, body), true)
/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/provider/azure.ts:
Line 194: evt.request.headers.delete("api-key")
Line 195: evt.request.headers.delete("x-api-key")
Line 196: ...
No files found
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/session/runner/model.ts</path>
<type>file</type>
<content>
1: export * as SessionRunnerModel from "./model.js"
2:
3: import { makeLocationNode } from "@opencode/util/effect/app-node"
4: import { LanguageModel } from "@opencode/ai"
5: import { Model } from "@opencode/schema/model"
6: import { Provider } from "@opencode/schema/provider"
7: import { Context, Effect, Layer, Schema } from "effect"
8: import { ModelResolver } from "../../model-resolver.js"
9: import { SessionSchema } from "../schema.js"
10:
11: export class ModelNotSelectedError extends Schema.TaggedError<ModelNotSelectedError>()(
12: "SessionRunnerModel.ModelNotSelectedError",
13: { sessionID: SessionSchema.ID },
14: ) {
15: override get message() {
16: return `No model is available for session ${this.sessionID}`
17: }
18: }
19:
20: export class ModelUnavailableError extends Schema.TaggedError<ModelUnavailableError>()(
21: ...
No files found
Found 46 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/aisdk.ts:
Line 330: providerOptions: projected.settings,
Line 433: providerOptions: requestProviderOptions(request.providerOptions, packageName, modelID, optionKey),
Line 532: return [{ type: "text", text: part.text, providerOptions: metadataProviderOptions(part.providerMetadata) }]
Line 536: return [{ type: "reasoning", text: part.text, providerOptions: metadataProviderOptions(part.providerMetadata) }]
Line 545: providerOptions: metadataProviderOptions(part.providerMetadata),
Line 570: providerOptions: metadataProviderOptions(part.providerMetadata),
Line 615: input: LLMRequest["providerOptions"],
/home/byk/Code/opencode-v2-pilot/packages/core/src/aisdk-native.ts:
Line 101: providerOptions: {
Line 161: return { providerOptions: options }
Line 296: return { providerOptions: options }
Line 310: return { providerOptions: ...
Found 7 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/session/title.ts:
Line 66: const prepared = yield* context.prepare({
/home/byk/Code/opencode-v2-pilot/packages/core/src/session/compaction.ts:
Line 172: const transcript = SessionModelRequest.baseTranscript({
Line 421: const transcript = SessionModelRequest.baseTranscript({
/home/byk/Code/opencode-v2-pilot/packages/core/src/session/runner/llm.ts:
Line 222: const transcript = SessionModelRequest.baseTranscript({
Line 229: const prepared = yield* context.prepare({
/home/byk/Code/opencode-v2-pilot/packages/core/src/session/generate.ts:
Line 39: const transcript = SessionModelRequest.baseTranscript({
Line 46: const prepared = yield* context.prepare({
Found 28 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/session/compaction.ts:
Line 25: import { SessionModelRequest } from "./model-request.js"
Line 79: - Carry forward only user questions or requests that remain unanswered or require further action. Do not repeat ones that newer history has answered or resolved. Preserve exact wording when carrying one forward.
Line 348: "Return only the structured summary in the requested format. Do not include a preamble, explanation, or other commentary.",
Line 464: const request = prepared.request
Line 467: // History is selected before request hooks. Until that interface can select on the final route,
Line 468: // require routing in the catalog; never install a checkpoint that the next request would skip.
Line 472: SessionProviderContext.provenance({ model: request.model, ref: context.model.ref }),
Line 476: "Provider compaction requires the endpoint in provider/model ...
Found 2 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/config/plugin/agent.ts:
Line 112: Object.assign(agent.request.headers, item.request.headers ?? {})
Line 113: Object.assign(agent.request.body, item.request.body ?? {})
Found 13 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/session/compaction.ts:
Line 87: auto: boolean
Line 139: readonly enabled: () => boolean
Line 140: readonly required: (input: RequiredInput) => boolean
Line 377: initial: () => ({ auto: true, buffer: DEFAULT_BUFFER, tokens: DEFAULT_KEEP_TOKENS }),
Line 380: if (settings.auto !== undefined) editor.auto = settings.auto
Line 404: // Manual controls settle through the inbox; only automatic work needs a durable interruption record.
Line 406: input.reason === "auto"
Line 486: // Transient provider failures retry like any other request; only a known automatic overflow permits
Line 528: input.reason === "auto" && isContextOverflowFailure(cause)
Line 678: const request = { ...input, reason: "auto" as const }
Line 685: if (!config.auto) return false
Line 686: // Run the completed checkpoint before considering another ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/session/compaction.ts</path>
<type>file</type>
<content>
670: model: context.model.ref,
671: providerState,
672: text: summary,
673: recent: history.recent,
674: })
675: return { status: "completed" as const }
676: })
677: const compact = Effect.fn("SessionCompaction.compact")(function* (input: AutoInput): Effect.fn.Return<Outcome> {
678: const request = { ...input, reason: "auto" as const }
679: if (input.overflow) return yield* recoverLocally(request)
680: if (input.context.model.compaction?.mode !== "provider") return yield* execute(request)
681: return yield* executeProvider(request)
682: })
683: const required = (input: RequiredInput) => {
684: const config = state.get()
685: if (!config.auto) return false
686: // Run the completed checkpoint before considering another automatic compaction.
687: const last = ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/registration.ts</path>
<type>file</type>
<content>
1: export interface Registration {
2: readonly dispose: () => Promise<void>
3: }
4:
5: export interface ModelHookOptions {
6: /** Limits the hook to one provider. Unscoped hooks apply to every provider. */
7: readonly providerID?: string
8: }
9:
10: export type Hooks<Spec> = <Name extends keyof Spec>(
11: name: Name,
12: callback: (input: Spec[Name]) => Promise<void> | void,
13: ) => Promise<Registration>
14:
15: export type ModelHooks<Spec> = <Name extends keyof Spec>(
16: name: Name,
17: callback: (input: Spec[Name]) => Promise<void> | void,
18: options?: Spec[Name] extends { readonly model: unknown } ? ModelHookOptions : never,
19: ) => Promise<Registration>
20:
21: export type Transform<Input> = (callback: (input: Input) => void) => Promise<Registration>
(End of file - total 21 lines)
</content>
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/event.ts</path>
<type>file</type>
<content>
1: import type { EventApi } from "@opencode/client/promise/api"
2:
3: export interface EventDomain extends Pick<EventApi, "subscribe"> {}
(End of file - total 3 lines)
</content>
Found 1 matches /home/byk/Code/opencode-v2-pilot/packages/client/src/promise/generated/client.ts: Line 1667: subscribe: (requestOptions?: RequestOptions): AsyncIterable<EventSubscribeOutput> =>
<path>/home/byk/Code/opencode-v2-pilot/packages/client/src/promise/generated/client.ts</path>
<type>file</type>
<content>
1655: method: "POST",
1656: path: `/api/rpc/${encodeURIComponent(input.rpcID)}/${encodeURIComponent(input.method)}`,
1657: query: { location: input["location"] },
1658: body: { input: input["input"] },
1659: successStatus: 200,
1660: declaredStatuses: [400, 401, 500],
1661: empty: false,
1662: },
1663: requestOptions,
1664: ),
1665: },
1666: event: {
1667: subscribe: (requestOptions?: RequestOptions): AsyncIterable<EventSubscribeOutput> =>
1668: sse<EventSubscribeOutput>(
1669: { method: "GET", path: `/api/event`, successStatus: 200, declaredStatuses: [400, 401], empty: false },
1670: requestOptions,
1671: ),
1672: },
1673: pty: {
1674: list: (input?: PtyListInput, requestOptions?: ...
Found 1 matches /home/byk/Code/opencode-v2-pilot/packages/client/src/promise/generated/types.ts: Line 5820: export type EventSubscribeOutput = V2Event
Found 17 matches
/home/byk/Code/opencode-lore/packages/core/src/log.ts:
Line 4: * In TUI mode, all stderr output renders as red "error" text — confusing
Line 92: // printed to stderr — fatal inside a full-screen TUI (e.g. the Pi agent).
Line 104: // written to stdout/stderr corrupts that TUI. This is the exact class of bug
Line 106: // and `log.error` is just as fatal there as a stray `console.log`.
Line 108: // The host enables this switch once, on activation, via `silenceStderr()`.
Line 110: // registered {@link LogSink} (e.g. Sentry) — NEVER to stderr, for every level
Line 114: // keep full stderr visibility.
Line 124: // so one `silenceStderr()` call silences them all.
Line 132: * Silence ALL stderr output from the logger (`info`/`warn`/`notice`/`error`),
Line 140: export function silenceStderr(silenced = true): void {
Line 144: /** Whether stderr output is currently silenced (embedded/TUI mode). ...
Found 9 matches
/home/byk/Code/opencode-lore/packages/opencode/src/index.ts:
Line 131: // `currentProject` is a fallback for the fetch interceptor's `getHeaders()`
Line 142: let currentProject: { path: string; gitRemote: string } | undefined;
Line 171: const sessionParent = new Map<
Line 178: for (const [id, entry] of sessionParent) {
Line 179: if (entry.lastSeenAt < cutoff) sessionParent.delete(id);
Line 202: const cached = sessionParent.get(sessionID);
Line 210: sessionParent.set(sessionID, { parentID, lastSeenAt: Date.now() });
Line 335: currentProject = { path: thisProjectPath, gitRemote: thisGitRemote };
Line 476: const cur = currentProject;
Found 69 matches
/home/byk/Code/opencode-lore/packages/opencode/test/index.test.ts:
Line 3: import { LorePlugin } from "../src/index";
Line 5: import type { Plugin } from "@opencode-ai/plugin";
Line 8: * Minimal mock of the OpenCode client. Only stubs the methods the plugin
Line 28: * Initialize the plugin with a mock client and temp directory.
Line 29: * Returns the plugin hooks.
Line 33: const tmpDir = `${fileURLToPath(new URL(".", import.meta.url))}/__tmp_plugin_${Date.now()}__`;
Line 37: type PluginInput = Parameters<typeof LorePlugin>[0];
Line 38: const hooks = await LorePlugin({
Line 54: describe("LorePlugin config hook", () => {
Line 132: // a 404 from the gateway. The plugin must pin EVERY provider's baseURL
Line 211: // In NODE_ENV=test the plugin's init skips gateway start, so
Line 238: // Malformed: a string instead of an object. ...
No files found
Found 66 matches
/home/byk/Code/opencode-v2-pilot/packages/cli/src/session-target.ts:
Line 39: environment?: Readonly<Record<string, string>>
Line 74: if (input.environment !== undefined && location.workspaceID === undefined)
Line 76: .environment({ sessionID: session.id, variables: input.environment }, ...requestOptions(input.signal))
/home/byk/Code/opencode-v2-pilot/packages/cli/src/server-process.ts:
Line 35: Global.layerWith(process.env.OPENCODE_CONFIG_DIR ? { config: process.env.OPENCODE_CONFIG_DIR } : {}),
Line 45: const inherited = process.env.OPENCODE_PTY_HANDOFF
Line 46: delete process.env.OPENCODE_PTY_HANDOFF
Line 68: const environmentPassword = yield* Env.password
Line 69: // Keep the lease credential out of the environment inherited by tools.
Line 71: delete process.env.OPENCODE_PASSWORD
Line 72: delete process.env.OPENCODE_SERVER_PASSWORD
Line 77: : environmentPassword
Line ...
<path>/home/byk/Code/opencode-v2-pilot/packages/cli/src/services/service-config.ts</path>
<type>file</type>
<content>
80: function configKey(key: string): Key {
81: if (key === "hostname" || key === "port" || key === "password" || key === "cors" || key === "env") return key
82: throw new Error(`Unknown service config key: ${key}`)
83: }
84:
85: const paths = Effect.gen(function* () {
86: const fs = yield* FileSystem.FileSystem
87: const global = yield* Global.Service
88: const name = filename()
89: const legacy = legacyFilename()
90: const file = path.join(global.state, name)
91: return {
92: fs,
93: file,
94: legacyConfigFile: legacy ? path.join(global.config, legacy) : undefined,
95: legacyRegistrationFiles: [
96: ...(legacy ? [path.join(global.state, legacy)] : []),
97: ...(name !== "service.json" && OPENCODE_CHANNEL !== "local" ? [path.join(global.state, "service.json")] : []),
98: ],
99: configFile: path.join(global.config, ...
Found 5 matches
/home/byk/Code/opencode-v2-pilot/packages/cli/src/services/service-config.ts:
Line 14: export const Info = Schema.Struct({
Line 19: env: Schema.optional(Schema.Record(Schema.String, Schema.String)),
Line 109: env: (yield* read()).env,
Line 201: yield* write({ ...existing, env: { ...existing.env, [value]: nestedValue } })
Line 247: const { env: _existingEnv, ...rest } = existing
<path>/home/byk/Code/opencode-v2-pilot/packages/cli/src/services/service-config.ts</path>
<type>file</type>
<content>
1: import { Global } from "@opencode/util/global"
2: import { OPENCODE_CHANNEL, OPENCODE_VERSION } from "../version"
3: import { Hash } from "@opencode/util/hash"
4: import { Service } from "@opencode/client/effect/service"
5: import { Effect, FileSystem, Option, Schema } from "effect"
6: import { randomBytes } from "crypto"
7: import path from "path"
8: import { selfCommand } from "../util/process"
9:
10: // The CLI's service configuration file, plus the Service.EnsureOptions binding that
11: // points the client package's service operations at this CLI: which
12: // registration file (by channel), which version, and how to spawn opencode.
13:
14: export const Info = Schema.Struct({
15: hostname: Schema.optional(Schema.String),
16: port: Schema.optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1), Schema.isLessThanOrEqualTo(65_535))),
17: password: ...
Found 40 matches
/home/byk/Code/opencode-v2-pilot/packages/cli/src/server-process.ts:
Line 1: export * as ServerProcess from "./server-process"
Line 13: import { Env } from "./env"
Line 14: import { ServiceConfig } from "./services/service-config"
Line 28: // The process effect lives until server shutdown; tracing it would parent every request to one process-lifetime trace.
Line 35: Global.layerWith(process.env.OPENCODE_CONFIG_DIR ? { config: process.env.OPENCODE_CONFIG_DIR } : {}),
Line 45: const inherited = process.env.OPENCODE_PTY_HANDOFF
Line 46: delete process.env.OPENCODE_PTY_HANDOFF
Line 67: const { start } = yield* Effect.promise(() => import("@opencode/server/process"))
Line 68: const environmentPassword = yield* Env.password
Line 69: // Keep the lease credential out of the environment inherited by tools.
Line 71: delete process.env.OPENCODE_PASSWORD
Line 72: delete ...
<path>/home/byk/Code/opencode-v2-pilot/packages/cli/src/server-process.ts</path>
<type>file</type>
<content>
55: return yield* Effect.scoped(
56: Effect.gen(function* () {
57: const foreground = options.mode === "default"
58: const serviceOptions = options.mode === "service" ? yield* ServiceConfig.options() : undefined
59: const config = options.mode === "service" ? yield* ServiceConfig.read() : {}
60: const hostname = options.hostname ?? config.hostname ?? "127.0.0.1"
61: const port = options.port ?? config.port ?? (options.mode === "service" ? ServiceConfig.defaultPort() : undefined)
62: const incumbent =
63: serviceOptions !== undefined && port !== undefined
64: ? yield* Service.incumbent({ ...serviceOptions, url: serviceURL(hostname, port) })
65: : undefined
66: if (incumbent !== undefined) return
67: const { start } = yield* Effect.promise(() => import("@opencode/server/process"))
68: const ...
/home/byk/.cache/opencode/packages/@loreai/opencode@latest/node_modules/@loreai/opencode/package.json
<path>/home/byk/.cache/opencode/packages/@loreai/opencode@latest/node_modules/@loreai/opencode/package.json</path>
<type>file</type>
<content>
1: {
2: "name": "@loreai/opencode",
3: "version": "0.40.0",
4: "type": "module",
5: "license": "FSL-1.1-Apache-2.0",
6: "description": "Three-tier memory architecture for OpenCode — distillation, not summarization",
7: "main": "./src/index.ts",
8: "types": "./src/index.ts",
9: "exports": {
10: ".": {
11: "types": "./src/index.ts",
12: "bun": "./src/index.ts",
13: "default": "./src/index.ts"
14: }
15: },
16: "peerDependencies": {
17: "@opencode-ai/plugin": ">=1.1.0"
18: },
19: "dependencies": {
20: "@loreai/core": "0.40.0",
21: "@loreai/gateway": "0.40.0"
22: },
23: "devDependencies": {
24: "@opencode-ai/plugin": "^1.1.39",
25: "@opencode-ai/sdk": "^1.1.39",
26: "@types/bun": "^1.2.0"
27: },
28: "files": [
29: "src/",
30: "README.md",
31: "LICENSE"
32: ...
No files found
/home/byk/.cache/opencode/packages/@loreai/opencode@latest/node_modules/@opencode-ai/plugin/package.json
<path>/home/byk/.cache/opencode/packages/@loreai/opencode@latest/node_modules/@opencode-ai/plugin/package.json</path>
<type>file</type>
<content>
1: {
2: "$schema": "https://json.schemastore.org/package.json",
3: "name": "@opencode-ai/plugin",
4: "version": "1.18.15",
5: "type": "module",
6: "license": "MIT",
7: "scripts": {
8: "typecheck": "tsgo --noEmit",
9: "build": "tsc"
10: },
11: "exports": {
12: ".": {
13: "import": "./dist/index.js",
14: "types": "./dist/index.d.ts"
15: },
16: "./tool": {
17: "import": "./dist/tool.js",
18: "types": "./dist/tool.d.ts"
19: },
20: "./tui": {
21: "import": "./dist/tui.js",
22: "types": "./dist/tui.d.ts"
23: },
24: "./v2/effect": {
25: "import": "./dist/v2/effect/index.js",
26: "types": "./dist/v2/effect/index.d.ts"
27: },
28: "./v2/effect/integration": {
29: "import": "./dist/v2/effect/integration.js",
30: "types": ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts</path>
<type>file</type>
<content>
200: const compiled = {
201: decode: inputs.map((schema) => Schema.decodeUnknownEffect(schema)),
202: encode: Schema.encodeUnknownEffect(output),
203: noContent,
204: } satisfies CompiledEndpoint
205: compiledEndpoints.set(endpoint, compiled)
206: return compiled
207: }
208:
209: /**
210: * Adapts a Promise plugin into an Effect plugin so the existing Effect-only
211: * Core plugin runtime can run it unchanged.
212: *
213: * Hook registrations created during the async `setup` attach to the plugin's
214: * scope, so unloading the plugin disposes them. The captured fiber context
215: * preserves boot-time batching, so Promise-plugin transforms still coalesce
216: * into one reload per domain.
217: */
218: export function fromPromise(plugin: Plugin) {
219: return define({
220: id: plugin.id,
221: effect: (host) =>
222: ...
Found 3 matches /home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts: Line 598: yield* Effect.acquireRelease( Line 599: Effect.promise(() => Promise.resolve(plugin.setup(context2))), Line 600: (cleanup) => (cleanup ? Effect.promise(() => Promise.resolve(cleanup())) : Effect.void),
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts</path>
<type>file</type>
<content>
565: create: (input) => attempt((signal) => definition.create(input, { signal })),
566: remove: (input) => attempt((signal) => definition.remove(input, { signal })),
567: list: (directory) => attempt((signal) => definition.list(directory, { signal })),
568: }),
569: }),
570: ),
571: ),
572: },
573: session: {
574: hook: (name, callback, options) =>
575: register(
576: host.session.hook(name, (event) => Effect.promise(() => Promise.resolve(callback(event))), options),
577: ),
578: create: adaptApiMethod(SessionEndpoints["session.create"], host.session.create),
579: get: adaptApiMethod(SessionEndpoints["session.get"], ...
Found 24 matches
/home/byk/Code/opencode-lore/packages/core/src/fetch-interceptor.ts:
Line 5: * and URL context), this interceptor wraps `globalThis.fetch` to redirect
Line 317: * Returns a cleanup function that restores the original `globalThis.fetch`.
Line 320: * Process-global slot holding the original `globalThis.fetch` captured before
Line 322: * in `installFetchInterceptor()`: a non-null slot means some copy of this
Line 323: * module already patched `globalThis.fetch`, so later installs no-op instead
Line 338: * The slot is unset until `installFetchInterceptor()` is called, and released
Line 341: const ORIGINAL_FETCH_KEY = Symbol.for("lore.fetchInterceptor.originalFetch");
Line 344: function readOriginalFetchSlot(): typeof globalThis.fetch | null {
Line 346: (globalThis as Record<symbol, typeof globalThis.fetch | null | undefined>)[
Line 353: function writeOriginalFetchSlot(fn: typeof globalThis.fetch | null): void {
Line 354: ...
<path>/home/byk/Code/opencode-lore/packages/core/src/fetch-interceptor.ts</path> <type>file</type> <content> 310: * 1. Checks if the outgoing URL matches a known LLM API path 311: * 2. Rewrites the URL to the gateway, preserving the path 312: * 3. Adds `X-Lore-Upstream-URL` (base) and `X-Lore-Upstream-Path` (original 313: * endpoint pathname, for verbatim forwarding) 314: * 4. Injects dynamic `X-Lore-*` context headers from `getHeaders()` 315: * 5. Preserves ALL original headers (auth, content-type, etc.) 316: * 317: * Returns a cleanup function that restores the original `globalThis.fetch`. 318: */ 319: /** 320: * Process-global slot holding the original `globalThis.fetch` captured before 321: * any interceptor was installed. It backs the cross-copy double-install guard 322: * in `installFetchInterceptor()`: a non-null slot means some copy of this 323: * module already patched `globalThis.fetch`, so later installs no-op instead 324: * of stacking interceptors. ...
Found 5 matches
/home/byk/Code/opencode-v2-pilot/packages/ai/src/route/transport/http.ts:
Line 2: import { Headers, HttpClientRequest } from "effect/unstable/http"
Line 9: import { RequestExecutor } from "../executor.js"
Line 21: readonly request: HttpClientRequest.HttpClientRequest
Line 94: frames: prepared.framing.frame(RequestExecutor.responseStream(response)),
Line 95: http: RequestExecutor.responseHttp(response),
<path>/home/byk/Code/opencode-v2-pilot/packages/ai/src/route/transport/http.ts</path>
<type>file</type>
<content>
1: import { Effect } from "effect"
2: import { Headers, HttpClientRequest } from "effect/unstable/http"
3: import { Auth } from "../auth.js"
4: import { render as renderEndpoint } from "../endpoint.js"
5: import { Framing } from "../framing.js"
6: import type { HttpMiddleware, Transport, TransportPrepareInput } from "./index.js"
7: import * as ProviderShared from "../../protocols/shared.js"
8: import { mergeJsonRecords, type LLMRequest } from "../../schema/index.js"
9: import { RequestExecutor } from "../executor.js"
10:
11: export type JsonRequestInput<Body> = TransportPrepareInput<Body>
12:
13: export interface JsonRequestParts<Body = unknown> {
14: readonly url: string
15: readonly jsonBody: Body | Record<string, unknown>
16: readonly bodyText: string
17: readonly headers: Headers.Headers
18: }
19:
20: export interface HttpPrepared<Frame> {
21: readonly ...
<path>/home/byk/Code/opencode-v2-pilot/packages/ai/src/route/executor.ts</path>
<type>file</type>
<content>
120: const result = yield* response.text.pipe(Effect.result)
121: return yield* httpFailure({
122: message: providerMessage(response.status, result._tag === "Success" ? result.success : undefined),
123: url: response.request.url,
124: status: response.status,
125: responseHeaders: headerDetails(response.headers),
126: responseBody: result._tag === "Success" ? result.success : undefined,
127: cause: result._tag === "Failure" ? (result.failure.cause ?? result.failure) : undefined,
128: })
129: })
130:
131: /** Preserve HTTP diagnostics for executor and externally captured failures alike. */
132: export const httpFailure = (input: {
133: readonly message: string
134: readonly url?: string | undefined
135: readonly status?: number | undefined
136: readonly data?: unknown
137: readonly responseHeaders?: Record<string, ...
<path>/home/byk/Code/opencode-v2-pilot/packages/ai/src/route/executor.ts</path>
<type>file</type>
<content>
1: import { Cause, Context, Effect, Layer, Option, Schema, Stream } from "effect"
2: import {
3: FetchHttpClient,
4: Headers,
5: HttpClient,
6: HttpClientError,
7: HttpClientRequest,
8: HttpClientResponse,
9: } from "effect/unstable/http"
10: import { HttpContext, HttpRateLimitDetails, AIError, TransportError } from "../schema/index.js"
11: import { classifyProviderFailure } from "../provider-error.js"
12:
13: export interface Interface {
14: readonly execute: (
15: request: HttpClientRequest.HttpClientRequest,
16: middleware?: HttpMiddleware,
17: ) => Effect.Effect<HttpClientResponse.HttpClientResponse, AIError>
18: }
19:
20: export type HttpHandler = (
21: request: HttpClientRequest.HttpClientRequest,
22: ) => Effect.Effect<HttpClientResponse.HttpClientResponse, Error>
23: export type HttpMiddleware = (
24: request: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/ai/src/route/executor.ts</path>
<type>file</type>
<content>
225: export const responseStream = (response: HttpClientResponse.HttpClientResponse): Stream.Stream<Uint8Array, AIError> =>
226: response.stream.pipe(
227: Stream.mapError((error) =>
228: httpError({ error, request: response.request, operation: "read", http: responseHttp(response) }),
229: ),
230: )
231:
232: export const stream = (
233: executor: Interface,
234: request: HttpClientRequest.HttpClientRequest,
235: middleware?: HttpMiddleware,
236: ): Stream.Stream<Uint8Array, AIError> =>
237: Stream.unwrap(
238: Effect.gen(function* () {
239: const response = yield* executor.execute(request, middleware)
240: return responseStream(response)
241: }),
242: )
243:
244: export const layer: Layer.Layer<Service, never, HttpClient.HttpClient> = Layer.effect(
245: Service,
246: Effect.gen(function* () {
247: const http = yield* ...
Found 1 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/effect/app-node-platform.ts:
Line 13: export const llmClient = makeGlobalNode({ service: LLMClient.Service, layer: LLMClient.layer, deps: [requestExecutor] })
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/effect/app-node-platform.ts</path>
<type>file</type>
<content>
1: import { LLMClient, RequestExecutor } from "@opencode/ai/route"
2: import { Socket } from "effect/unstable/socket"
3: import { makeGlobalNode } from "@opencode/util/effect/app-node"
4: import { httpClient } from "@opencode/util/effect/app-node-platform"
5: import { WebSocketConstructor } from "./websocket-constructor.js"
6:
7: export const requestExecutor = makeGlobalNode({
8: service: RequestExecutor.Service,
9: layer: RequestExecutor.layer,
10: deps: [httpClient],
11: })
12:
13: export const llmClient = makeGlobalNode({ service: LLMClient.Service, layer: LLMClient.layer, deps: [requestExecutor] })
14:
15: export const webSocketConstructor = makeGlobalNode({
16: service: Socket.WebSocketConstructor,
17: layer: WebSocketConstructor.layer,
18: deps: [],
19: })
20:
21: export * as LayerNodePlatform from "./app-node-platform.js"
(End of file - total ...
Found 2 matches
/home/byk/Code/opencode-v2-pilot/packages/util/src/effect/app-node-platform.ts:
Line 6: import { FetchHttpClient, HttpClient } from "effect/unstable/http"
Line 11: export const httpClient = makeGlobalNode({ service: HttpClient.HttpClient, layer: FetchHttpClient.layer, deps: [] })
<path>/home/byk/Code/opencode-v2-pilot/packages/util/src/effect/app-node-platform.ts</path>
<type>file</type>
<content>
1: // Deep imports: the @effect/platform-node barrel eagerly pulls in undici,
2: // ioredis, and node:sqlite, which runtimes such as workerd cannot load.
3: import * as NodeFileSystem from "@effect/platform-node/NodeFileSystem"
4: import * as NodePath from "@effect/platform-node/NodePath"
5: import { FileSystem, Path } from "effect"
6: import { FetchHttpClient, HttpClient } from "effect/unstable/http"
7: import { makeGlobalNode } from "./app-node.js"
8:
9: export const filesystem = makeGlobalNode({ service: FileSystem.FileSystem, layer: NodeFileSystem.layer, deps: [] })
10: export const path = makeGlobalNode({ service: Path.Path, layer: NodePath.layer, deps: [] })
11: export const httpClient = makeGlobalNode({ service: HttpClient.HttpClient, layer: FetchHttpClient.layer, deps: [] })
12:
13: export * as LayerNodePlatform from "./app-node-platform.js"
(End of file - ...
Found 85 matches
/home/byk/Code/opencode-lore/packages/gateway/src/turn-temporal.ts:
Line 55: // Preserve persistence-time ordering without changing the owned snapshot.
/home/byk/Code/opencode-lore/packages/gateway/src/pidfile.ts:
Line 150: throw new Error(`Refusing PID file not owned by the current user: ${path}`);
/home/byk/Code/opencode-lore/packages/gateway/src/lifecycle-lock.ts:
Line 223: `Refusing lifecycle lock path not owned by the current user: ${path}`,
Line 1633: `Lifecycle lock is now owned by another operation: ${this.path}`,
/home/byk/Code/opencode-lore/packages/gateway/src/cache-analytics.ts:
Line 701: // divergence lands in the agent-owned host prompt, decide whether the
Line 966: // the agent-owned host prompt and the only CacheAligner relocation target
/home/byk/Code/opencode-lore/packages/gateway/src/pipeline.ts:
Line 1268: expectedUnowned: boolean;
Line 1375: expectedUnowned = false,
Line 1400: ...
<path>/home/byk/Code/opencode-lore/packages/gateway/src/cli/start.ts</path>
<type>file</type>
<content>
95: local?: boolean;
96: /** Allow non-loopback peers to access the dashboard and management API. */
97: allowRemoteManagement?: boolean;
98: /**
99: * When true, `lore start` daemonizes: it re-spawns itself detached, polls
100: * the gateway until healthy, prints the address + PID + log path, and exits 0.
101: * CLI: `--bg` / `--daemon`.
102: */
103: bg?: boolean;
104: /** @internal CLI-owned process boundary; never set by in-process plugins. */
105: processBoundary?: boolean;
106: }
107:
108: export interface GatewayHandle {
109: config: GatewayConfig;
110: port: number;
111: /** Whether this process owns the server (started it). False when reusing an existing instance. */
112: owned: boolean;
113: /** Owner-only token used to authenticate the gateway control endpoint. */
114: managementToken: string;
115: /** Shut down the gateway. ...
Found 1 matches /home/byk/Code/opencode-lore/packages/gateway/src/index.ts: Line 27: startGateway,
<path>/home/byk/Code/opencode-lore/packages/gateway/src/index.ts</path>
<type>file</type>
<content>
15:
16: // ---------------------------------------------------------------------------
17: // Library API
18: // ---------------------------------------------------------------------------
19:
20: export { loadConfig, DEFAULT_PORTS, DEFAULT_PORT } from "./config";
21: export type { GatewayConfig } from "./config";
22: export { startServer } from "./server";
23: export { handleRequest, resetPipelineState } from "./pipeline";
24: export { readPortFile } from "./portfile";
25: export { readGatewayProcessFile } from "./pidfile";
26: export {
27: startGateway,
28: probeGateway,
29: probeGatewayProcess,
30: probeGatewayProcessHost,
31: probeUrlFor,
32: } from "./cli/start";
33: export type { GatewayHandle, StartOptions } from "./cli/start";
34:
35: // ---------------------------------------------------------------------------
36: // CLI entry — called by dist/bin.cjs or `bun run ...
Found 5 matches
/home/byk/Code/opencode-lore/packages/core/src/git.ts:
Line 16: import { execSync } from "node:child_process";
Line 101: export function getGitRemote(path: string): string | null {
Line 112: const output = execSync("git remote -v", {
Line 196: execSync("git config user.name", {
Line 207: execSync("git config user.email", {
<path>/home/byk/Code/opencode-lore/packages/core/src/git.ts</path>
<type>file</type>
<content>
90: * Get the canonical git remote URL for a repository at the given path.
91: *
92: * Prefers `origin` (the canonical clone source) over `upstream`, then falls
93: * back to any other remote. Origin-first is deliberate: unrelated repos
94: * bootstrapped from a common template share an `upstream` but keep distinct
95: * `origin`s, so keying on the shared upstream would falsely merge them into one
96: * project. Returns null if the path is not in a git repo or has no remotes.
97: *
98: * Results are cached in-memory for the process lifetime to avoid repeated
99: * subprocess calls — `git remote -v` only runs once per unique path.
100: */
101: export function getGitRemote(path: string): string | null {
102: // In hosted mode, never run git subprocesses with client-controlled cwd.
103: if (isHostedMode()) return null;
104:
105: const cached = gitRemoteCache.get(path);
106: ...
File not found: /home/byk/Code/opencode-v2-pilot/packages/core/src/vcs/git.ts
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/vcs/git.ts</path>
<type>file</type>
<content>
1: export * as VcsGitPlugin from "./git.js"
2:
3: import { define } from "@opencode/plugin/effect/plugin"
4: import { Effect } from "effect"
5: import { ChildProcess } from "effect/unstable/process"
6: import { FileDiff } from "@opencode/schema/file-diff"
7: import { Base, BranchList, FileStatus, Info, Mode } from "@opencode/schema/vcs"
8: import { AppProcess } from "@opencode/util/process"
9: import { Location } from "../../location.js"
10: import type { Adapter, BranchOptions, DiffOptions } from "../../vcs.js"
11: import { DiffError } from "../../vcs.js"
12: import {
13: chunksByFile,
14: emptyPatch,
15: MAX_PATCH_BYTES,
16: MAX_TOTAL_PATCH_BYTES,
17: PATCH_CONTEXT_LINES,
18: } from "../../vcs/patch.js"
19: import type { Patch } from "../../vcs/patch.js"
20:
21: export const Plugin = define({
22: id: "opencode.vcs.git",
23: effect: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/catalog.ts</path>
<type>file</type>
<content>
1: import type { CatalogApi } from "@opencode/client/promise/api"
2: import type { Model } from "@opencode/schema/model"
3: import type { Provider } from "@opencode/schema/provider"
4: import type { Transform } from "./registration.js"
5: import type { DeepMutable } from "./types.js"
6:
7: export interface CatalogProviderRecord {
8: readonly provider: DeepMutable<Provider.Info>
9: readonly models: ReadonlyMap<string, DeepMutable<Model.Info>>
10: }
11:
12: export interface CatalogEditor {
13: readonly provider: {
14: list(): readonly CatalogProviderRecord[]
15: get(providerID: string): CatalogProviderRecord | undefined
16: update(providerID: string, update: (provider: DeepMutable<Provider.Info>) => void): void
17: remove(providerID: string): void
18: }
19: readonly model: {
20: get(providerID: string, modelID: string): DeepMutable<Model.Info> ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/catalog.ts</path>
<type>file</type>
<content>
86: const state = State.create<Data, Editor>({
87: name: "catalog",
88: initial: () => ({ providers: new Map() }),
89: editor: (editor) => {
90: const result: Editor = {
91: provider: {
92: list: () => Array.fromIterable(editor.providers.values()) as ProviderRecord[],
93: get: (providerID) => editor.providers.get(providerID),
94: update: (providerID, fn) => {
95: let current = editor.providers.get(providerID)
96: if (!current) {
97: current = {
98: provider: Provider.Info.empty(providerID) as Provider.MutableInfo,
99: models: new Map<Model.ID, Model.MutableInfo>(),
100: }
101: editor.providers.set(providerID, current)
102: }
103: fn(current.provider)
104: ...
No files found
Found 60 matches /home/byk/Code/opencode-lore/pnpm-lock.yaml: Line 226: '@opencode-ai/plugin': Line 372: prettier-plugin-astro: '>=0.11.0' Line 376: prettier-plugin-astro: Line 550: '@babel/helper-create-class-features-plugin@7.29.7': Line 578: '@babel/helper-plugin-utils@7.29.7': Line 613: '@babel/plugin-proposal-decorators@7.29.7': Line 619: '@babel/plugin-syntax-decorators@7.29.7': Line 625: '@babel/plugin-syntax-jsx@7.29.7': Line 631: '@babel/plugin-syntax-typescript@7.29.7': Line 637: '@babel/plugin-transform-destructuring@7.29.7': Line 643: '@babel/plugin-transform-explicit-resource-management@7.29.7': Line 649: '@babel/plugin-transform-modules-commonjs@7.29.7': Line 655: '@babel/plugin-transform-typescript@7.29.7': Line 961: '@expressive-code/plugin-frames@0.44.1': Line 964: '@expressive-code/plugin-shiki@0.44.1': Line 967: '@expressive-code/plugin-text-markers@0.44.1': Line 1406: ...
<path>/home/byk/Code/opencode-lore/pnpm-lock.yaml</path> <type>file</type> <content> 205: specifier: ^0.10.1 206: version: 0.10.1 207: onnxruntime-node: 208: specifier: 1.27.0 209: version: 1.27.0 210: tar: 211: specifier: '>=7.5.19' 212: version: 7.5.21 213: undici: 214: specifier: ^8.9.0 215: version: 8.9.0 216: 217: packages/opencode: 218: dependencies: 219: '@loreai/core': 220: specifier: workspace:* 221: version: link:../core 222: '@loreai/gateway': 223: specifier: workspace:* 224: version: link:../gateway 225: devDependencies: 226: '@opencode-ai/plugin': 227: specifier: ^1.1.39 228: version: 1.2.15 229: '@opencode-ai/sdk': 230: specifier: ^1.1.39 231: version: 1.2.15 232: '@types/bun': 233: specifier: ^1.2.0 234: version: 1.3.9 235: 236: packages/pi: 237: ...
Found 3 matches
/home/byk/Code/opencode-v2-pilot/packages/plugin/src/README.md:
Line 3: The Promise plugin API at `@opencode/plugin` is the async/await equivalent of `@opencode/plugin/effect`. It grants plugins the same two in-process capabilities:
Line 15: import { Plugin } from "@opencode/plugin"
/home/byk/Code/opencode-v2-pilot/packages/plugin/src/effect/README.md:
Line 11: import { Plugin } from "@opencode/plugin/effect"
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/README.md</path>
<type>file</type>
<content>
1: # OpenCode V2 Promise Plugin API
2:
3: The Promise plugin API at `@opencode/plugin` is the async/await equivalent of `@opencode/plugin/effect`. It grants plugins the same two in-process capabilities:
4:
5: - `hook` installs behavior at an OpenCode extension point.
6: - `reload` reruns every transform hook for a stateful domain.
7:
8: The Promise API uses Promises instead of Effects for setup, runtime hook
9: callbacks, hook registration, `reload`, and `Registration.dispose`. Transform
10: editor callbacks remain synchronous.
11:
12: ## Defining A Plugin
13:
14: ```ts
15: import { Plugin } from "@opencode/plugin"
16:
17: export default Plugin.define({
18: id: "example",
19: setup: async (ctx) => {
20: await ctx.catalog.transform((catalog) => {
21: catalog.provider.update("example", (provider) => {
22: provider.name = "Example"
23: })
24: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/README.md</path>
<type>file</type>
<content>
80: ## Runtime Hooks
81:
82: Runtime hooks intercept live operations:
83:
84: ```ts
85: await ctx.aisdk.hook("sdk", async (event) => {
86: if (event.package !== "@ai-sdk/xai") return
87: const mod = await import("@ai-sdk/xai")
88: event.sdk = mod.createXai(event.options)
89: })
90:
91: await ctx.aisdk.hook("language", (event) => {
92: if (event.model.providerID !== "xai") return
93: event.language = event.sdk.responses(event.model.modelID)
94: })
95: ```
96:
97: Session context is mutable immediately before provider dispatch:
98:
99: ```ts
100: await ctx.session.hook("context", (event) => {
101: event.tools.read.description = "Read a file using narrow line ranges."
102: delete event.tools.write
103: })
104:
105: await ctx.session.hook("retry", (event) => {
106: if (event.attempt >= 3) event.decision = { retry: false }
107: })
108: ```
109:
110: Promise tools ...
Found 1 matches
/home/byk/Code/opencode-v2-pilot/packages/client/src/promise/generated/types.ts:
Line 3723: export type SessionGetInput = { readonly sessionID: { readonly sessionID: string }["sessionID"] }
<path>/home/byk/Code/opencode-v2-pilot/packages/client/src/promise/generated/types.ts</path>
<type>file</type>
<content>
3710: }
3711:
3712: export type SessionImportOutput = { data: SessionInfo }["data"]
3713:
3714: export type SessionExportInput = {
3715: readonly sessionID: { readonly sessionID: string }["sessionID"]
3716: readonly sanitize?: { readonly sanitize?: boolean | undefined }["sanitize"]
3717: }
3718:
3719: export type SessionExportOutput = { data: SessionTransferData }["data"]
3720:
3721: export type SessionActiveOutput = { data: { [x: string]: SessionActive } }["data"]
3722:
3723: export type SessionGetInput = { readonly sessionID: { readonly sessionID: string }["sessionID"] }
3724:
3725: export type SessionGetOutput = { data: SessionInfo }["data"]
3726:
3727: export type SessionRemoveInput = { readonly sessionID: { readonly sessionID: string }["sessionID"] }
3728:
3729: export type SessionRemoveOutput = void
3730:
3731: export type SessionForkInput = ...
<path>/home/byk/Code/opencode-v2-pilot/packages/client/src/promise/generated/client.ts</path>
<type>file</type>
<content>
540: stats: (input?: SessionStatsInput, requestOptions?: RequestOptions) =>
541: request<{ readonly data: SessionStatsOutput }>(
542: {
543: method: "GET",
544: path: `/api/session/stats`,
545: query: {
546: from: input?.["from"],
547: to: input?.["to"],
548: project: input?.["project"],
549: timezone: input?.["timezone"],
550: tools: input?.["tools"],
551: },
552: successStatus: 200,
553: declaredStatuses: [400, 401],
554: empty: false,
555: },
556: requestOptions,
557: ).then((value) => value.data),
558: create: (input?: SessionCreateInput, requestOptions?: RequestOptions) =>
559: request<{ readonly data: SessionCreateOutput }>(
560: ...
Found 1 matches /home/byk/Code/opencode-v2-pilot/packages/client/src/promise/generated/client.ts: Line 612: get: (input: SessionGetInput, requestOptions?: RequestOptions) =>
<path>/home/byk/Code/opencode-v2-pilot/packages/client/src/promise/generated/client.ts</path>
<type>file</type>
<content>
604: method: "GET",
605: path: `/api/session/active`,
606: successStatus: 200,
607: declaredStatuses: [400, 401],
608: empty: false,
609: },
610: requestOptions,
611: ).then((value) => value.data),
612: get: (input: SessionGetInput, requestOptions?: RequestOptions) =>
613: request<{ readonly data: SessionGetOutput }>(
614: {
615: method: "GET",
616: path: `/api/session/${encodeURIComponent(input.sessionID)}`,
617: successStatus: 200,
618: declaredStatuses: [400, 401, 404],
619: empty: false,
620: },
621: requestOptions,
622: ).then((value) => value.data),
623: remove: (input: SessionRemoveInput, requestOptions?: RequestOptions) =>
624: ...
No files found
Found 5 matches /home/byk/Code/opencode-lore/packages/gateway/src/compaction.ts: Line 374: export const LORE_AGENT_HEADER = "x-lore-agent"; Line 378: * When `x-lore-agent` matches, the request is always a normal turn. Line 384: * When `x-lore-agent` matches, the request is always passthrough. Line 434: * 1. Explicit `x-lore-agent` header (OpenCode plugin) — authoritative signal. Line 446: const agentHeader = req.rawHeaders[LORE_AGENT_HEADER];
<path>/home/byk/Code/opencode-lore/packages/gateway/src/compaction.ts</path> <type>file</type> <content> 365: const match = PREVIOUS_SUMMARY_RE.exec(userText); 366: return match?.[1] ?? undefined; 367: } 368: 369: // --------------------------------------------------------------------------- 370: // isMetaRequest (replaces isTitleOrSummaryRequest) 371: // --------------------------------------------------------------------------- 372: 373: /** Header injected by the OpenCode plugin identifying the calling agent. */ 374: export const LORE_AGENT_HEADER = "x-lore-agent"; 375: 376: /** 377: * Agent names known to be primary conversation agents (NOT meta). 378: * When `x-lore-agent` matches, the request is always a normal turn. 379: */ 380: const PRIMARY_AGENTS = new Set(["coder", "code"]); 381: 382: /** 383: * Agent names known to be meta/housekeeping agents. 384: * When `x-lore-agent` matches, the request is always passthrough. ...
Found 5 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/session/title.ts:
Line 50: readonly agent: Agent.Info
Line 66: const prepared = yield* context.prepare({
Line 67: kind: "title",
Line 131: (yield* attempt({ session, agent: selection.agent, text, model: selection.selected })) ??
Line 133: ? yield* attempt({ session, agent: selection.agent, text, model: selection.primary })
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/session/title.ts</path>
<type>file</type>
<content>
45: const store = yield* SessionStore.Service
46: const db = (yield* Database.Service).db
47:
48: const attempt = Effect.fn("SessionTitle.attempt")(function* (input: {
49: readonly session: SessionSchema.Info
50: readonly agent: Agent.Info
51: readonly text: string
52: readonly model: SessionRunnerModel.Resolved
53: }) {
54: const chunks: string[] = []
55: let failed = false
56: let usage: SessionUsage.Recorded | undefined
57: const recordUsage = Effect.suspend(() =>
58: usage
59: ? bus.publish(SessionEvent.UsageRecorded, {
60: sessionID: input.session.id,
61: source: "title",
62: ...usage,
63: })
64: : Effect.void,
65: )
66: const prepared = yield* context.prepare({
67: kind: "title",
68: scope: { ...
No files found
Found 2 matches
/home/byk/Code/opencode-v2-pilot/packages/schema/src/provider.ts:
Line 7: export const ID = Schema.String.pipe(
Line 8: Schema.brand("Provider.ID"),
<path>/home/byk/Code/opencode-v2-pilot/packages/schema/src/provider.ts</path>
<type>file</type>
<content>
1: export * as Provider from "./provider.js"
2:
3: import { Effect, Schema } from "effect"
4: import { Integration } from "./integration.js"
5: import { optional, PositiveInt, statics } from "./schema.js"
6:
7: export const ID = Schema.String.pipe(
8: Schema.brand("Provider.ID"),
9: statics((schema) => ({
10: opencode: schema.make("opencode"),
11: anthropic: schema.make("anthropic"),
12: openai: schema.make("openai"),
13: google: schema.make("google"),
14: googleVertex: schema.make("google-vertex"),
15: githubCopilot: schema.make("github-copilot"),
16: amazonBedrock: schema.make("amazon-bedrock"),
17: azure: schema.make("azure"),
18: openrouter: schema.make("openrouter"),
19: mistral: schema.make("mistral"),
20: gitlab: schema.make("gitlab"),
(Showing lines 1-20 of 69. Use offset=21 to continue.)
</content>
Found 10 matches
/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/tool.ts:
Line 26: list(): readonly (Info & { readonly id: string })[]
Line 27: get(id: string): (Info & { readonly id: string }) | undefined
Line 33: update(id: string, update: (tool: Types.Mutable<Info>) => void): void
Line 34: remove(id: string): void
Line 40: readonly sessionID: Session.ID
Line 42: readonly messageID: SessionMessage.ID
Line 43: readonly id: Tool.CallID
Line 48: readonly sessionID: Session.ID
Line 50: readonly messageID: SessionMessage.ID
Line 51: readonly id: Tool.CallID
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/tool.ts</path>
<type>file</type>
<content>
1: export { CallID, Error } from "@opencode/schema/tool"
2: export type { Metadata, Options, Result } from "@opencode/schema/tool"
3:
4: import { Tool } from "@opencode/schema/tool"
5: import type { Agent } from "@opencode/schema/agent"
6: import type { Session } from "@opencode/schema/session"
7: import type { SessionMessage } from "@opencode/schema/session-message"
8: import type { Types } from "effect"
9: import type { Hooks, Transform } from "./registration.js"
10:
11: export interface ToolContext extends Omit<Tool.Context, "progress"> {
12: readonly progress: (update: Tool.Metadata) => Promise<void>
13: }
14:
15: export type Info<
16: Input extends Tool.ValueSchema<any> = Tool.ValueSchema<any>,
17: Output extends Tool.ValueSchema<any> | undefined = Tool.ValueSchema<any> | undefined,
18: > = Omit<Tool.Info<Input, Output>, "execute"> & {
19: readonly execute: ...
Found 2 matches
/home/byk/Code/opencode-lore/packages/core/src/fetch-interceptor.ts:
Line 148: export function detectProtocolFromBody(bodyStr: string): BodyProtocol | null {
Line 240: export function interceptUrlForProtocol(
Found 4 matches
/home/byk/Code/opencode-lore/packages/core/src/fetch-interceptor.ts:
Line 148: export function detectProtocolFromBody(bodyStr: string): BodyProtocol | null {
Line 240: export function interceptUrlForProtocol(
Line 281: export function shouldIntercept(url: string, gatewayBase: string): boolean {
Line 421: export function installFetchInterceptor(
<path>/home/byk/Code/opencode-lore/packages/core/src/fetch-interceptor.ts</path>
<type>file</type>
<content>
180: }
181:
182: type Rewrite = {
183: gatewayUrl: string;
184: upstreamBase: string;
185: /**
186: * The client's ORIGINAL upstream endpoint pathname (e.g. `/chat/completions`,
187: * `/v1/messages`, or a prefixed `/api/v1/chat/completions`). Forwarded to the
188: * gateway as `x-lore-upstream-path` so it can POST to the exact endpoint the
189: * SDK intended instead of synthesizing a canonical `/v1/...` path. This is the
190: * full pathname (NOT the post-base suffix) so the gateway can reconstruct the
191: * original URL as `origin(base) + pathname` regardless of any base prefix —
192: * required for providers whose endpoint omits `/v1` (GitHub Copilot's
193: * `/chat/completions`, issue #1052) or uses a non-standard prefix. ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/host.ts</path>
<type>file</type>
<content>
1: export * as PluginHost from "./host.js"
2:
3: import { Plugin } from "@opencode/plugin/effect"
4: import type { IntegrationMethodRegistration } from "@opencode/plugin/effect/integration"
5: import { EventManifest } from "@opencode/schema/event-manifest"
6: import type { Event } from "@opencode/schema/event"
7: import { ServerConfig } from "@opencode/schema/mcp"
8: import { App } from "../app.js"
9: import { Effect, Schema, Stream } from "effect"
10: import { Agent } from "../agent.js"
11: import { AISDK } from "../aisdk.js"
12: import { Catalog } from "../catalog.js"
13: import { Command } from "../command.js"
14: import { Credential } from "../credential.js"
15: import { Bus } from "../bus.js"
16: import { Integration } from "../integration.js"
17: import { KV } from "../kv.js"
18: import { Location } from "../location.js"
19: import { LocationServiceMap } from ...
Found 18 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/host.ts:
Line 43: readonly location: Location.Ref
Line 91: effect.pipe(Effect.map((data) => ({ location: locationInfo(), data })))
Line 115: return {
Line 116: location: new Location.Info({
Line 129: location: locationInfo(),
Line 361: return {
Line 362: location: new Location.Info({
Line 505: session: {
Line 513: location:
Line 567: return {
Line 584: if (result.next === undefined) return { entries }
Line 585: return { entries, next: result.next.slice(namespace.length) }
Line 594: return {
Line 601: return {
Line 606: return {
Line 617: return {
Line 623: return {
Line 628: return {
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/host.ts</path>
<type>file</type>
<content>
75: new Location.Info({
76: directory: location.directory,
77: workspaceID: location.workspaceID,
78: project: location.project,
79: })
80: const locationRef = (input?: { readonly location?: { readonly directory?: string; readonly workspace?: string } }) =>
81: input?.location === undefined
82: ? undefined
83: : Location.Ref.make({
84: directory: AbsolutePath.make(input.location.directory ?? location.directory),
85: workspaceID:
86: input.location.workspace === undefined ? location.workspaceID : Workspace.ID.make(input.location.workspace),
87: })
88: const isCurrentLocation = (ref: Location.Ref) =>
89: ref.directory === location.directory && ref.workspaceID === location.workspaceID
90: const response = <A, E, R>(effect: Effect.Effect<A, E, R>) =>
91: effect.pipe(Effect.map((data) => ({ ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/host.ts</path>
<type>file</type>
<content>
490: remove: (input) => atWorktree(locationRef(input), (service) => service.remove(input)),
491: reload: worktrees.reload,
492: transform: (callback) =>
493: worktrees.transform((editor) =>
494: callback({
495: add: (definition) =>
496: editor.add({
497: id: Worktree.StrategyID.make(definition.id),
498: create: (input) => definition.create(input).pipe(Effect.flatMap(decodeWorktree)),
499: remove: (input) => definition.remove(input),
500: list: (directory) => definition.list(directory).pipe(Effect.flatMap(decodeWorktrees)),
501: }),
502: }),
503: ),
504: },
505: session: {
506: hook: (name, callback, options) => hooks.register("session", name, callback, options),
507: create: (input) =>
508: ...
Found 35 matches
/home/byk/Code/opencode-v2-pilot/packages/protocol/src/groups/session.ts:
Line 128: export const makeSessionGroup = <I extends HttpApiMiddleware.AnyId, S>(sessionLocationMiddleware: Context.Key<I, S>) =>
Line 206: HttpApiEndpoint.get("session.export", "/api/session/:sessionID/export", {
Line 232: HttpApiEndpoint.get("session.get", "/api/session/:sessionID", {
Line 238: identifier: "v2.session.get",
Line 245: HttpApiEndpoint.delete("session.remove", "/api/session/:sessionID", {
Line 258: HttpApiEndpoint.post("session.fork", "/api/session/:sessionID/fork", {
Line 274: HttpApiEndpoint.post("session.switchAgent", "/api/session/:sessionID/agent", {
Line 290: HttpApiEndpoint.post("session.switchModel", "/api/session/:sessionID/model", {
Line 306: HttpApiEndpoint.post("session.rename", "/api/session/:sessionID/rename", {
Line 322: HttpApiEndpoint.post("session.move", ...
<path>/home/byk/Code/opencode-v2-pilot/packages/protocol/src/groups/session.ts</path>
<type>file</type>
<content>
225: summary: "List active sessions",
226: description:
227: "Retrieve foreground Session drains currently owned by this OpenCode process. Sessions absent from the result are inactive.",
228: }),
229: ),
230: )
231: .add(
232: HttpApiEndpoint.get("session.get", "/api/session/:sessionID", {
233: params: { sessionID: Session.ID },
234: success: Schema.Struct({ data: Session.Info }),
235: error: SessionNotFoundError,
236: }).annotateMerge(
237: OpenApi.annotations({
238: identifier: "v2.session.get",
239: summary: "Get session",
240: description: "Retrieve a session by ID.",
241: }),
242: ),
243: )
244: .add(
245: HttpApiEndpoint.delete("session.remove", "/api/session/:sessionID", {
246: params: { sessionID: ...
Found 17 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/config/normalize.ts:
Line 318: function normalizeCompaction(
Line 324: if (!isRecord(input.compaction)) {
Line 328: unsupportedIfPresent(input.compaction, "tail_turns", ["compaction", "tail_turns"], diagnostics)
Line 329: unsupportedIfPresent(input.compaction, "prune", ["compaction", "prune"], diagnostics)
Line 331: if (own(input.compaction, "auto")) {
Line 334: input.compaction.auto,
Line 340: const legacyTokens = own(input.compaction, "preserve_recent_tokens")
Line 343: input.compaction.preserve_recent_tokens,
Line 344: ["compaction", "preserve_recent_tokens"],
Line 348: const nativeKeep = isRecord(input.compaction.keep) ? input.compaction.keep : undefined
Line 349: if (own(input.compaction, "keep") && !nativeKeep) invalid(["compaction", "keep"], diagnostics)
Line 361: const legacyBuffer = own(input.compaction, "reserved")
Line 364: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/config/normalize.ts</path>
<type>file</type>
<content>
310: }
311: recognized.forEach(([key, field]) => {
312: const leaf = decodeEncoded(field, value[key], [...path, key], diagnostics)
313: if (leaf === undefined) return
314: overlay(timeout, key, leaf, [...path, key], diagnostics)
315: })
316: }
317:
318: function normalizeCompaction(
319: input: Record<string, unknown>,
320: encoded: Record<string, unknown>,
321: diagnostics: Diagnostic[],
322: ) {
323: if (!own(input, "compaction")) return
324: if (!isRecord(input.compaction)) {
325: invalid(["compaction"], diagnostics)
326: return
327: }
328: unsupportedIfPresent(input.compaction, "tail_turns", ["compaction", "tail_turns"], diagnostics)
329: unsupportedIfPresent(input.compaction, "prune", ["compaction", "prune"], diagnostics)
330: const result: Record<string, unknown> = {}
331: if (own(input.compaction, "auto")) {
332: ...
Found 32 matches /home/byk/Code/opencode-lore/packages/gateway/src/compaction.ts: Line 4: * Claude Code (and other clients using the same pattern) sends compaction Line 10: * `packages/opencode/src/agent/prompt/compaction.txt` and the Line 20: /** System prompt substrings that identify a compaction agent. */ Line 25: /** Last user message substrings that indicate a compaction request. */ Line 33: * Template section headers found in the `<template>` block of a compaction Line 35: * considered a compaction request. Line 76: // Usage scaling — prevent client auto-compaction in hosted gateway scenarios Line 93: * models can trigger premature compaction. Line 107: /** Tokens Claude Code reserves for the compaction summary output. */ Line 114: * Retained for cost-tracker's counterfactual "avoided compactions" estimate. ...
Found 47 matches
/home/byk/Code/opencode-lore/packages/gateway/test/session-retention.test.ts:
Line 61: "x-lore-agent": "coder",
/home/byk/Code/opencode-lore/packages/gateway/test/recall-exhaustion.test.ts:
Line 277: "x-lore-agent": "coder",
/home/byk/Code/opencode-lore/packages/gateway/test/recall-buffered-transaction.test.ts:
Line 732: "x-lore-agent": "coder",
/home/byk/Code/opencode-lore/packages/gateway/test/pipeline-streaming.test.ts:
Line 296: "x-lore-agent": "coder",
Line 1236: admissionRequest.rawHeaders["x-lore-agent"] = "title";
Line 2300: reopenedRequest.rawHeaders["x-lore-agent"] = "title";
Line 6365: rawHeaders: { "x-lore-agent": "title" },
Line 6398: rawHeaders: { "x-lore-agent": "title" },
Line 6437: "x-lore-agent": "title",
Line 6499: "x-lore-agent": "title",
Line 6583: "x-lore-agent": "title",
Line 6632: "x-lore-agent": ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/package.json</path>
<type>file</type>
<content>
1: {
2: "$schema": "https://json.schemastore.org/package.json",
3: "name": "@opencode/plugin",
4: "version": "1.18.15",
5: "type": "module",
6: "license": "MIT",
7: "scripts": {
8: "test": "bun test --only-failures",
9: "typecheck": "tsgo --noEmit",
10: "build": "tsc -p tsconfig.build.json"
11: },
12: "exports": {
13: ".": "./src/promise/index.ts",
14: "./effect": "./src/effect/index.ts",
15: "./host": "./src/host.ts",
16: "./tui": "./src/tui/index.ts",
17: "./*": "./src/*.ts"
18: },
19: "imports": {
20: "#plugin-source": {
21: "bun": "./src/source.bun.ts",
22: "node": "./src/source.node.ts",
23: "default": "./src/source.node.ts"
24: }
25: },
26: "files": [
27: "dist"
28: ],
29: "dependencies": {
30: "@ai-sdk/provider": "3.0.8",
31: "@opencode/ai": "workspace:*",
32: ...
Found 10 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/session/model-request.ts:
Line 201: readonly sessionID: SessionSchema.ID
Line 212: "x-opencode-project": session.projectID,
Line 213: "x-opencode-session": session.id,
Line 214: "x-opencode-client": app.name,
Line 217: const promptCacheKey = (sessionID: SessionSchema.ID) =>
Line 218: /^ses_[0-9a-f]{64}$/.test(sessionID) ? sessionID.slice(4) : sessionID
Line 310: sessionID: session.id,
Line 333: { sessionID: session.id, agent: input.scope.agentID, model: resolved.ref, kind: input.kind },
Line 340: promptCacheKey: promptCacheKey(session.fork?.sessionID ?? session.id),
Line 376: sessionID: session.id,
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/session/model-request.ts</path>
<type>file</type>
<content>
185: result: {
186: ...part.result,
187: value: part.result.value.map((item: Content) => {
188: if (item.type !== "file" || !isImage(item.mime) || imageBytes - removed <= IMAGE_BYTES_TARGET) return item
189: removed += Buffer.byteLength(item.uri)
190: return { type: "text" as const, text: IMAGE_REMOVED }
191: }),
192: },
193: }
194: }),
195: }),
196: )
197: }
198:
199: /** The identity a plugin hook sees for one outbound request. */
200: interface HookScope {
201: readonly sessionID: SessionSchema.ID
202: readonly agent: Agent.ID
203: readonly model: Model.Ref
204: readonly kind: SessionRequestKind
205: }
206:
207: const sessionHeaders = (session: Pick<SessionSchema.Info, "id" | "parentID" | "projectID">, app: App.Info) => ({
208: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/session/model-request.ts</path>
<type>file</type>
<content>
300: // The definition objects we hand to hooks, mapped back to their tools. Hooks rename a
301: // tool by moving its definition to a new key; recognizing the object recovers the tool.
302: const given = new Map(
303: tools.definitions.map(
304: (tool) => [{ description: tool.description, input: { ...tool.inputSchema } }, tool] as const,
305: ),
306: )
307: // Hooks mutate this record in place: edit descriptions and schemas, rename, or remove.
308: const definitions = Object.fromEntries(Array.from(given, ([definition, tool]) => [tool.name, definition]))
309: const context: PluginHooks.Domains["session"]["context"] = {
310: sessionID: session.id,
311: agent: input.scope.contextAgentID ?? input.scope.agentID,
312: model: resolved.ref,
313: system: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/plugin.ts</path>
<type>file</type>
<content>
1: import type { OpenCodeClient } from "@opencode/client"
2: import type { GenerateApi, PluginApi } from "@opencode/client/promise/api"
3: import type { Location } from "@opencode/schema/location"
4: import type { PluginOptions } from "../options.js"
5: import type { App } from "../app.js"
6: import type { AgentDomain } from "./agent.js"
7: import type { AISDKDomain } from "./aisdk.js"
8: import type { CatalogDomain } from "./catalog.js"
9: import type { CommandDomain } from "./command.js"
10: import type { EventDomain } from "./event.js"
11: import type { IntegrationDomain } from "./integration.js"
12: import type { MCPDomain } from "./mcp.js"
13: import type { PermissionDomain } from "./permission.js"
14: import type { ReferenceDomain } from "./reference.js"
15: import type { RpcDomain } from "./rpc.js"
16: import type { SessionDomain } from "./session.js"
17: import type ...
Found 1 matches /home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/session.ts: Line 37: export type SessionRequestKind = "primary" | "compaction" | "title" | "generate"
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/session.ts</path>
<type>file</type>
<content>
1: import type { SessionApi } from "@opencode/client/promise/api"
2: import type { GenerationOptionsFields, Message, SystemPart } from "@opencode/ai"
3: import type { Agent } from "@opencode/schema/agent"
4: import type { Model } from "@opencode/schema/model"
5: import type { PromptInput } from "@opencode/schema/prompt-input"
6: import type { Session } from "@opencode/schema/session"
7: import type { SessionInbox } from "@opencode/schema/session-inbox"
8: import type { SessionError } from "@opencode/schema/session-error"
9: import type { SessionMessage } from "@opencode/schema/session-message"
10: import type { JsonSchema, Types } from "effect"
11: import type { ModelHooks } from "./registration.js"
12:
13: export interface SessionPrompt {
14: readonly sessionID: Session.ID
15: readonly messageID: SessionMessage.ID
16: prompt: ...
<path>/home/byk/Code/opencode-lore/packages/opencode/src/index.ts</path>
<type>file</type>
<content>
1: import type { Hooks, Plugin, PluginInput } from "@opencode-ai/plugin";
2: import {
3: log,
4: getGitRemote,
5: discoverWorkspaceRoot,
6: installFetchInterceptor,
7: } from "@loreai/core";
8: // Helpers live in a separate module so they are NOT re-exported from this
9: // plugin entry. OpenCode's legacy plugin loader invokes every function
10: // exported from the entry module as a plugin; leaking these helpers pushed
11: // `undefined` into the host hooks array and crashed it on event dispatch
12: // (`undefined is not an object (evaluating 'A.event')`). See ./internal.ts.
13: import {
14: applyLoreProviderConfig,
15: gatewayAccessHeadersForRemote,
16: probeGateway,
17: shouldForwardUpstreamExtraHeader,
18: surfaceGatewayUnavailable,
19: } from "./internal";
20:
21: /**
22: * Lore plugin for OpenCode — transparent LLM proxy routing. ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/session/model-request.ts</path>
<type>file</type>
<content>
220: // Lets session.model.request hooks rewrite the base URL and headers before dispatch.
221: const applyModelHooks = (hooks: PluginHooks.Interface, scope: HookScope, request: LLMRequest) =>
222: Effect.gen(function* () {
223: const currentBaseURL = request.model.route.endpoint.baseURL
224: const event = yield* hooks.trigger("session", "model.request", {
225: ...scope,
226: baseURL: typeof currentBaseURL === "string" ? currentBaseURL : undefined,
227: headers: { ...request.http?.headers },
228: })
229: const route =
230: event.baseURL !== undefined && event.baseURL !== currentBaseURL
231: ? request.model.route.with({ endpoint: { baseURL: event.baseURL } })
232: : request.model.route
233: return LLMRequest.update(request, {
234: model: route === request.model.route ? request.model : ...
Found 100 matches (more matches available)
/home/byk/Code/opencode-lore/packages/pi/test/real-runtime.e2e.test.ts:
Line 131: process.env.LORE_GATEWAY_URL = baseURL;
Line 133: delete process.env.LORE_REMOTE_URL;
/home/byk/Code/opencode-lore/packages/pi/test/internal.test.ts:
Line 6: gatewayAccessHeadersForRemote,
Line 110: LORE_REMOTE_URL: "https://lore.example/",
Line 121: LORE_REMOTE_URL: "https://lore.example",
Line 124: expect(gatewayAccessHeadersForRemote(GW, env)).toEqual({});
Line 349: const previousRemote = process.env.LORE_REMOTE_URL;
Line 350: const previousGateway = process.env.LORE_GATEWAY_URL;
Line 353: process.env.LORE_REMOTE_URL =
Line 356: delete process.env.LORE_GATEWAY_URL;
Line 368: if (previousRemote === undefined) delete process.env.LORE_REMOTE_URL;
Line 369: else process.env.LORE_REMOTE_URL = previousRemote;
Line 370: if (previousGateway === undefined) delete ...
<path>/home/byk/Code/opencode-lore/packages/opencode/src/internal.ts</path> <type>file</type> <content> 1: /** 2: * Internal helpers for the Lore OpenCode plugin. 3: * 4: * These functions are intentionally kept OUT of the plugin entry module 5: * (`./index.ts`). OpenCode's legacy plugin loader treats EVERY function 6: * exported from a plugin module as a plugin instance and invokes it (see 7: * `getServerPlugin`/`getLegacyPlugins` in opencode's plugin loader). Exporting 8: * these helpers from the entry module caused them to be invoked as plugins and 9: * their return values pushed into the host's hooks array: 10: * `applyLoreProviderConfig` returns `undefined`, so the host crashed on the 11: * first hook dispatch with `undefined is not an object (evaluating 'A.event')` 12: * (the `?.` guards the `.event` property, not the `undefined` hook element). ...
Found 100 matches (more matches available) /home/byk/Code/opencode-lore/packages/gateway/src/server.ts: Line 249: "Conflicting provider authentication headers", Line 514: // providers that require authentication don't reject with 401. Line 567: provider: embeddings.provider, Line 713: * provider appends `/codex/responses` to the registered gateway baseUrl. The Line 818: // hook is assignment-based and never captures request or provider content. Line 866: // Provider keys authorize model providers, never this gateway. Enforce the Line 867: // separate access credential and all mixed-provider-auth pairs centrally, Line 1199: message: "Conflicting provider authentication headers", /home/byk/Code/opencode-lore/packages/gateway/src/worker-auth.ts: Line 9: * Mirror the worker adapter's provider-alias credential lookup for scheduling Line 11: * stored the same credential under `amazon-bedrock`, but unrelated providers ...
No files found
Found 7 matches /home/byk/Code/opencode-lore/packages/gateway/src/pipeline.ts: Line 127: providerRoutingValue, Line 5088: const providerRouting = providerRoutingValue(req); /home/byk/Code/opencode-lore/packages/gateway/src/translate/types.ts: Line 499: export function providerRoutingValue( /home/byk/Code/opencode-lore/packages/gateway/src/translate/openai-responses.ts: Line 27: providerRoutingValue, Line 966: const providerRouting = providerRoutingValue(req); /home/byk/Code/opencode-lore/packages/gateway/src/translate/openai.ts: Line 18: providerRoutingValue, Line 782: const providerRouting = providerRoutingValue(req);
<path>/home/byk/Code/opencode-lore/packages/gateway/src/translate/types.ts</path>
<type>file</type>
<content>
465: */
466: probeHeadSha?: string;
467: probeToolsSha?: string;
468: probePrefixSha?: string;
469: };
470:
471: /** Routing snapshot captured from a session request before upstream dispatch.
472: * Workers (distillation, curation) and the cache warmer use this
473: * to route through the same upstream with matching credentials.
474: * Single source of truth — replaces lastModel, lastProtocol,
475: * lastProviderID, lastUpstreamUrl, lastAnthropicBeta. */
476: export interface UpstreamSnapshot {
477: /** Resolved upstream base URL (e.g., "https://api.minimax.io/anthropic"). */
478: url: string;
479: /** Whether X-Lore-Upstream-URL, rather than administrator routing, selected it. */
480: callerSelected?: boolean;
481: /** Wire protocol used for the request. ...
Found 62 matches
/home/byk/Code/opencode-lore/packages/gateway/src/pipeline.ts:
Line 6207: req.rawHeaders["x-lore-upstream-url"]
Line 6249: if (req.rawHeaders["x-lore-upstream-url"] && !headerUpstream) {
Line 6405: // credentials. The user should set LORE_UPSTREAM_<PROVIDER>=<url>.
Line 6414: `Set LORE_UPSTREAM_${providerID.toUpperCase().replace(/-/g, "_")}=<url> ` +
Line 6606: // Apply user-supplied LORE_UPSTREAM_EXTRA_HEADERS as the final overlay so
Line 13377: "x-lore-upstream-url": sessionState.lastUpstream?.url ?? "",
Line 13383: fallbackHeaders["x-lore-upstream-url"] = trustedUpstream;
Line 14220: "x-lore-upstream-url": trustedUpstreamBase,
Line 14282: rawHeaders["x-lore-upstream-url"] &&
Line 14405: // Apply user-supplied LORE_UPSTREAM_EXTRA_HEADERS as a final overlay so
/home/byk/Code/opencode-lore/packages/gateway/src/config.ts:
Line 56: /** Upstream Anthropic API URL. Default: ...
<path>/home/byk/Code/opencode-lore/packages/gateway/src/config.ts</path>
<type>file</type>
<content>
540: config: Pick<GatewayConfig, "remoteGateway" | "hostedMode"> &
541: Partial<Pick<GatewayConfig, "callerUpstreamAllowlist">>,
542: upstreamUrl: string,
543: ): boolean {
544: if (!config.remoteGateway && !config.hostedMode) return true;
545: try {
546: const parsed = new URL(upstreamUrl);
547: if (parsed.protocol !== "https:") return false;
548: return (config.callerUpstreamAllowlist ?? []).includes(parsed.origin);
549: } catch {
550: return false;
551: }
552: }
553:
554: /**
555: * Extract and validate the `X-Lore-Upstream-URL` header from a request.
556: *
557: * Used by local/custom providers (vllm, llama.cpp, ollama, etc.) to tell the
558: * gateway where to forward the request when `resolveUpstreamRoute()` returns
559: * null. ...
Found 24 matches /home/byk/Code/opencode-lore/packages/gateway/src/config.ts: Line 56: /** Upstream Anthropic API URL. Default: "https://api.anthropic.com". Env: LORE_UPSTREAM_ANTHROPIC */ Line 58: /** Upstream OpenAI API URL. Default: "https://api.openai.com". Env: LORE_UPSTREAM_OPENAI */ Line 159: * Parsed from the curl-style env var `LORE_UPSTREAM_EXTRA_HEADERS` — newline- Line 165: * base-path-bound to `LORE_UPSTREAM_ANTHROPIC`, `LORE_UPSTREAM_OPENAI`, and Line 180: const env = process.env; Line 183: env.LORE_UPSTREAM_ANTHROPIC || "https://api.anthropic.com", Line 186: env.LORE_UPSTREAM_OPENAI || "https://api.openai.com", Line 235: env.LORE_UPSTREAM_EXTRA_HEADERS, Line 239: "LORE_UPSTREAM_EXTRA_HEADERS must configure at most one provider authentication mechanism", Line 244: "LORE_UPSTREAM_EXTRA_HEADERS cannot contain the gateway access header", Line 431: // `X-Lore-Provider: bedrock` header (PROVIDER_ROUTES) so ...
<path>/home/byk/Code/opencode-lore/packages/gateway/src/config.ts</path>
<type>file</type>
<content>
785: }
786: }
787:
788: // ---------------------------------------------------------------------------
789: // Provider-ID-based routing
790: // ---------------------------------------------------------------------------
791:
792: /**
793: * Route resolved from a provider ID header.
794: *
795: * `url` is null for providers that require user configuration via
796: * `LORE_UPSTREAM_<PROVIDER>` (local/self-hosted inference servers).
797: */
798: export type ProviderRoute = {
799: url: string | null;
800: /** Wire protocol for this upstream. When `null`, the ingress protocol is
801: * preserved — use this for proxy/aggregator providers (OpenCode Zen,
802: * Vercel AI Gateway, etc.) that accept whichever protocol the client sends. ...
Found 8 matches
/home/byk/Code/opencode-lore/packages/gateway/src/pipeline.ts:
Line 6258: let providerRoute = providerID ? resolveProviderRoute(providerID) : null;
Line 6270: providerRoute = resolveProviderRoute(providerID);
Line 6405: // credentials. The user should set LORE_UPSTREAM_<PROVIDER>=<url>.
Line 6414: `Set LORE_UPSTREAM_${providerID.toUpperCase().replace(/-/g, "_")}=<url> ` +
Line 6606: // Apply user-supplied LORE_UPSTREAM_EXTRA_HEADERS as the final overlay so
Line 14307: ? (resolveProviderRoute(fallbackProviderID) ??
Line 14405: // Apply user-supplied LORE_UPSTREAM_EXTRA_HEADERS as a final overlay so
Line 15997: const pr = resolveProviderRoute(pid);
<path>/home/byk/Code/opencode-lore/packages/gateway/src/pipeline.ts</path>
<type>file</type>
<content>
6185: headerUpstream?: string;
6186: headerUpstreamPath?: string;
6187: providerRoute: ReturnType<typeof resolveProviderRoute>;
6188: modelRoute: ReturnType<typeof resolveUpstreamRoute>;
6189: effectiveProtocol: EffectiveUpstreamProtocol;
6190: effectiveUpstreamBase: string;
6191: bedrockMantle: boolean;
6192: };
6193:
6194: /**
6195: * Preserve the legacy process-global credential only for a local, unambiguous
6196: * direct-provider request to the exact configured base. Remote/hosted gateways,
6197: * explicit provider selection, and client-selected URLs never populate it.
6198: */
6199: function captureLegacyGlobalAuth(
6200: req: GatewayRequest,
6201: config: GatewayConfig,
6202: cred: AuthCredential,
6203: ): string | undefined {
6204: if (usesRemoteSessionBinding(config)) return undefined;
6205: if (
6206: req.rawHeaders["x-lore-provider"] ...
Found 13 matches
/home/byk/Code/opencode-lore/packages/gateway/src/pipeline.ts:
Line 4434: effectiveOpts.upstreamProviderID = snapshot.providerID;
Line 6414: `Set LORE_UPSTREAM_${providerID.toUpperCase().replace(/-/g, "_")}=<url> ` +
/home/byk/Code/opencode-lore/packages/gateway/src/llm-adapter.ts:
Line 1495: // against misconfigured snapshots where upstreamProviderID and
Line 3482: opts?.upstreamProviderID !== undefined &&
Line 3483: workerProvidersEquivalent(opts.upstreamProviderID, model.providerID);
Line 3532: opts?.upstreamProviderID,
Line 4660: opts?.upstreamProviderID,
Line 4849: opts?.upstreamProviderID,
Line 5224: upstreamProviderID: options.model.providerID,
/home/byk/Code/opencode-lore/packages/gateway/src/batch-queue.ts:
Line 136: upstreamProviderID?: string;
Line 1163: upstreamProviderID: item.upstreamProviderID,
Line ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/module.ts</path>
<type>file</type>
<content>
1: export * as PluginModule from "./module.js"
2:
3: import type { Plugin } from "@opencode/plugin/effect/plugin"
4: import { Host } from "@opencode/plugin/host"
5: import { createPluginSources } from "@opencode/plugin/source"
6: import { Npm } from "@opencode/util/npm"
7: import { Deferred, Effect, FiberSet, PubSub, Schema, Stream } from "effect"
8: import path from "path"
9: import { stat } from "node:fs/promises"
10: import { fileURLToPath, pathToFileURL } from "url"
11: import type { ConfigPluginSource } from "../config/plugin/source.js"
12: import type { Generation } from "../plugin.js"
13: import { PluginPromise } from "./promise.js"
14: import { Watcher } from "../filesystem/watcher.js"
15:
16: export const make = Effect.fn("PluginModule.make")(function* () {
17: const watcher = yield* Watcher.Service
18: const scope = yield* Effect.scope
19: const runPromise = ...
Found 100 matches (more matches available)
/home/byk/Code/opencode-v2-pilot/packages/client/src/promise/generated/types.ts:
Line 313: export type PermissionSavedInfo = { id: string; projectID: string; action: string; resource: string }
Line 325: location: string
Line 448: type: "location-switched"
Line 449: location: LocationRef
Line 450: projectID?: string
Line 452: previous?: { location: LocationRef; projectID?: string; subpath?: string }
Line 455: export type SessionInboxMovePayload = { location: LocationRef; projectID: string; subpath?: string }
Line 462: location: LocationRef
Line 469: location?: LocationRef | undefined
Line 558: location?: LocationRef
Line 561: projectID: string
Line 562: location: LocationRef
Line 580: location?: LocationRef
Line 590: location?: LocationRef
Line 600: location?: LocationRef
Line 601: data: { sessionID: string; location: LocationRef; projectID: string; subpath?: string ...
<path>/home/byk/Code/opencode-v2-pilot/packages/client/src/promise/generated/types.ts</path>
<type>file</type>
<content>
1638: timeCreated: number
1639: type: "move"
1640: payload: SessionInboxMovePayload
1641: delivery: SessionInboxDelivery
1642: }
1643:
1644: export type SessionInfo = {
1645: id: string
1646: parentID?: string
1647: fork?: { sessionID: string; boundary: SessionForkBoundary }
1648: projectID: string
1649: agent?: string
1650: model?: ModelRef
1651: cost: MoneyUSD
1652: tokens: TokenUsageInfo
1653: outcome?: "succeeded" | "failed" | "interrupted"
1654: time: { created: number; updated: number; idle?: number; viewed?: number; archived?: number }
1655: title?: string
1656: location: LocationRef
1657: subpath?: string
1658: metadata?: SessionMetadata
1659: revert?: SessionRevert
1660: }
1661:
1662: export type SessionRevertStaged = {
1663: id: string
1664: created: number
1665: metadata?: { [x: string]: any }
1666: type: ...
Found 73 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/worktree.ts:
Line 138: ? Effect.fail(new UnsupportedLocationError({ directory: location.directory }))
/home/byk/Code/opencode-v2-pilot/packages/core/src/vcs.ts:
Line 64: directory: location.directory,
/home/byk/Code/opencode-v2-pilot/packages/core/src/snapshot.ts:
Line 109: const relative = path.relative(worktree, location.directory)
/home/byk/Code/opencode-v2-pilot/packages/core/src/shell.ts:
Line 259: cwd: input.cwd ?? location.directory,
/home/byk/Code/opencode-v2-pilot/packages/core/src/session.ts:
Line 246: const project = yield* projects.resolve(location.directory)
Line 257: subpath: RelativePath.make(path.relative(project.directory, location.directory).replaceAll("\\", "/")),
/home/byk/Code/opencode-v2-pilot/packages/core/src/rpc.ts:
Line 39: const ref = Location.Ref.make({ directory: location.directory, workspaceID: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/schema/src/location.ts</path>
<type>file</type>
<content>
1: export * as Location from "./location.js"
2:
3: import { Schema } from "effect"
4: import { AbsolutePath, optional } from "./schema.js"
5: import { ProjectID } from "./project-id.js"
6: import { WorkspaceID } from "./workspace-id.js"
7:
8: export interface Ref extends Schema.Schema.Type<typeof Ref> {}
9: export const Ref = Schema.Struct({
10: directory: AbsolutePath,
11: workspaceID: optional(WorkspaceID),
12: }).annotate({ identifier: "Location.Ref" })
13:
14: export class Info extends Schema.Class<Info>("Location.Info")({
15: directory: AbsolutePath,
16: workspaceID: optional(WorkspaceID),
17: project: Schema.Struct({
18: id: ProjectID,
19: directory: AbsolutePath,
20: canonical: AbsolutePath,
21: }),
22: }) {}
23:
24: export function response<S extends Schema.Top>(data: S) {
25: return Schema.Struct({ location: Info, data })
26: }
(End of file ...
<path>/home/byk/Code/opencode-v2-pilot/packages/schema/src/session.ts</path>
<type>file</type>
<content>
1: export * as Session from "./session.js"
2:
3: import { Schema } from "effect"
4: import { Agent } from "./agent.js"
5: import { Location } from "./location.js"
6: import { Model } from "./model.js"
7: import { Project } from "./project.js"
8: import { DateTimeUtcFromMillis, optional, RelativePath } from "./schema.js"
9: import { SessionEvent } from "./session-event.js"
10: import { SessionID } from "./session-id.js"
11: import { SessionMetadata } from "./session-metadata.js"
12: import { Money } from "./money.js"
13: import { TokenUsage } from "./token-usage.js"
14: import { Revert } from "./session-revert.js"
15: import { SessionFork } from "./session-fork.js"
16:
17: export const ID = SessionID
18: export type ID = SessionID
19:
20: export const Metadata = SessionMetadata
21: export type Metadata = SessionMetadata
22:
23: export const Event = SessionEvent
24:
25: export { ...
Found 14 matches /home/byk/.local/share/opencode-v2-pilot/data/opencode/log/opencode.log: Line 31: timestamp=2026-09-08T18:33:56.920Z level=INFO run=bd7d35a6 message="Sent HTTP response" http.span=1 role=server http.method=POST http.url=/api/plugin/await-activation http.status=401 Line 32: timestamp=2026-09-08T18:33:56.934Z level=INFO run=bd7d35a6 message="Sent HTTP response" http.span=1 role=server http.method=GET http.url=/api/plugin http.status=401 Line 33: timestamp=2026-09-08T18:35:00.837Z level=INFO run=bd7d35a6 message="Sent HTTP response" http.span=1 role=server http.method=POST http.url=/api/plugin/await-activation http.status=401 Line 48: timestamp=2026-09-08T18:40:37.500Z level=INFO run=9386f4fa msg="loading plugin" id=/home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/followup.ts entrypoint=file:///home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/followup.ts http.span=185 role=server Line 49: timestamp=2026-09-08T18:40:38.045Z ...
<path>/home/byk/.local/share/opencode-v2-pilot/data/opencode/log/opencode.log</path> <type>file</type> <content> 180: timestamp=2026-09-08T19:03:21.793Z level=INFO run=132dc9d8 message="watcher subscribe" path=/home/byk/.local/share/opencode-v2-pilot/config/opencode type=directory ignores=3 http.span=61 role=server 181: timestamp=2026-09-08T19:03:21.798Z level=INFO run=132dc9d8 message="watcher subscribe" path=/home/byk/.opencode type=directory ignores=3 http.span=66 role=server 182: timestamp=2026-09-08T19:03:21.800Z level=INFO run=132dc9d8 message="watcher subscribe" path=/ type=entries ignores=0 http.span=68 role=server 183: timestamp=2026-09-08T19:03:21.802Z level=INFO run=132dc9d8 message="watcher started" path=/ type=entries backend=node ignores=0 http.span=70 role=server 184: timestamp=2026-09-08T19:03:21.802Z level=INFO run=132dc9d8 message="watcher subscribe" path=/home type=entries ignores=0 http.span=70 role=server 185: timestamp=2026-09-08T19:03:21.802Z level=INFO ...
<path>/home/byk/.opencode/opencode.json</path>
<type>file</type>
<content>
1: {
2: "$schema": "https://opencode.ai/config.json",
3: "model": "openrouter/anthropic/claude-opus-4.8",
4: "permission": "allow",
5: "snapshot": false,
6: "autoupdate": false,
7: "server": {
8: "port": 4096,
9: "hostname": "0.0.0.0",
10: "mdns": false,
11: "cors": [
12: "http://labs:4096",
13: "https://opencode.sheep-fir.ts.net"
14: ]
15: },
16: "default_agent": "build",
17: }
(End of file - total 17 lines)
</content>
Found 3 matches /home/byk/Code/opencode-v2-pilot/packages/core/src/config/discovery.ts: Line 13: /** Eligible sources in priority order, including paths that may appear later. */ Line 27: const globalDirectory = AbsolutePath.make(global.config) Line 54: // Global sources must not re-enter through the project walk.
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/config/discovery.ts</path>
<type>file</type>
<content>
1: export * as ConfigDiscovery from "./discovery.js"
2:
3: import path from "path"
4: import { Effect } from "effect"
5: import { FSUtil } from "@opencode/util/fs-util"
6: import { Global } from "@opencode/util/global"
7: import { Location } from "../location.js"
8: import { AbsolutePath } from "../schema.js"
9: import type { Options } from "../config.js"
10:
11: export const names = ["opencode.json", "opencode.jsonc"]
12:
13: /** Eligible sources in priority order, including paths that may appear later. */
14: export interface Sources {
15: readonly global?: AbsolutePath
16: readonly explicit?: AbsolutePath
17: readonly direct: readonly AbsolutePath[]
18: readonly project: readonly { readonly path: AbsolutePath; readonly present: boolean }[]
19: readonly claude: readonly AbsolutePath[]
20: readonly agents: readonly AbsolutePath[]
21: }
22:
23: export const ...
Found 1 matches /home/byk/Code/opencode-v2-pilot/packages/core/src/config.ts: Line 216: const globalSupplementary = sources.global ? yield* loadDirectory(sources.global).pipe(Effect.orDie) : []
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/config.ts</path>
<type>file</type>
<content>
175: })
176:
177: const loadDirectory = Effect.fnUntraced(function* (directory: AbsolutePath) {
178: return [
179: ...(yield* Effect.forEach(ConfigDiscovery.names, (file) => loadFile(path.join(directory, file))).pipe(
180: Effect.map((configs) => configs.filter((config): config is Document => config !== undefined)),
181: )),
182: new Directory({ type: "directory", path: directory }),
183: ]
184: })
185:
186: const load = Effect.fn("Config.load")(function* (sources: ConfigDiscovery.Sources) {
187: const claude = yield* Effect.filter(sources.claude, (path) => fs.isDir(path))
188: const agents = yield* Effect.filter(sources.agents, (path) => fs.isDir(path))
189: const direct = yield* Effect.forEach(sources.direct, (filepath) => loadFile(filepath)).pipe(
190: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/config/plugin/source.ts</path>
<type>file</type>
<content>
95: export const node = makeLocationNode({
96: service: Service,
97: layer,
98: deps: [Config.node, FSUtil.node, Watcher.node, Location.node],
99: })
100:
101: export const empty = makeLocationNode({
102: service: Service,
103: layer: Layer.succeed(
104: Service,
105: Service.of({
106: operations: () => Effect.succeed([]),
107: changes: () => Stream.never,
108: }),
109: ),
110: deps: [],
111: })
112:
113: function parse(input: ConfigPlugin.Plugin): Operation {
114: if (typeof input !== "string") {
115: return { type: "add", target: input.package, options: input.options ?? {} }
116: }
117: if (!input.startsWith("-")) return { type: "add", target: input, options: {} }
118: if (input.length === 1) throw new Error("Plugin remove operation requires a target")
119: return { type: "remove", target: input.slice(1) }
120: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/host.ts</path>
<type>file</type>
<content>
1: export * as Host from "./host.js"
2:
3: import path from "node:path"
4: import { importModule, resolveModule } from "@opencode/util/runtime-import"
5:
6: export interface Target {
7: readonly directory: string
8: readonly name?: string
9: }
10:
11: export interface Entrypoints {
12: readonly server?: string
13: readonly tui?: string
14: readonly rpc?: string
15: }
16:
17: export function resolve(target: Target): Entrypoints {
18: const entry = (subpaths: readonly string[]) => {
19: for (const subpath of subpaths) {
20: const specifier = target.name
21: ? [target.name, subpath].filter(Boolean).join("/")
22: : path.resolve(target.directory, subpath || "index")
23: try {
24: return resolveModule(specifier, target.directory)
25: } catch (error) {
26: if (
27: !(error instanceof Error) ||
28: ...
No files found
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/tsconfig.build.json</path>
<type>file</type>
<content>
1: {
2: "$schema": "https://json.schemastore.org/tsconfig",
3: "extends": "./tsconfig.json",
4: "compilerOptions": {
5: "allowImportingTsExtensions": false,
6: "noEmit": false
7: }
8: }
(End of file - total 8 lines)
</content>
Found 36 matches /home/byk/Code/opencode-v2-pilot/bun.lock: Line 9: "@opencode/plugin": "workspace:*", Line 66: "@opencode/plugin-browser": "workspace:*", Line 123: "@opencode/plugin": "workspace:*", Line 361: "@opencode/plugin": "workspace:*", Line 362: "@opencode/plugin-browser": "workspace:*", Line 428: "@opencode/plugin-browser": "workspace:*", Line 551: "@opencode/plugin": "workspace:*", Line 565: "@opencode/plugin": "workspace:*", Line 577: "name": "@opencode/plugin", Line 616: "name": "@opencode/plugin-browser", Line 619: "@opencode/plugin": "workspace:*", Line 690: "@opencode/plugin": "workspace:*", Line 721: "@opencode/plugin": "workspace:*", Line 768: "@opencode/plugin": "workspace:*", Line 903: "@opencode/plugin": "workspace:*", Line 1451: "@babel/helper-create-class-features-plugin": ...
Found 18 matches
/home/byk/Code/opencode-lore/pnpm-lock.yaml:
Line 226: '@opencode-ai/plugin':
Line 1406: '@opencode-ai/plugin@1.2.15':
Line 6556: '@opencode-ai/plugin@1.2.15':
/home/byk/Code/opencode-lore/AGENTS.md:
Line 25: | `@loreai/opencode` | `packages/opencode/` | OpenCode plugin adapter — hooks into OpenCode's lifecycle via `@opencode-ai/plugin` |
/home/byk/Code/opencode-lore/packages/opencode/package.json:
Line 21: "@opencode-ai/plugin": ">=1.1.0"
Line 28: "@opencode-ai/plugin": "^1.1.39",
/home/byk/Code/opencode-lore/packages/opencode/test/index.test.ts:
Line 5: import type { Plugin } from "@opencode-ai/plugin";
/home/byk/Code/opencode-lore/packages/opencode/test/routing.e2e.test.ts:
Line 24: import type { Hooks, PluginInput } from "@opencode-ai/plugin";
/home/byk/Code/opencode-lore/packages/opencode/test/internal.test.ts:
Line 2: import type { PluginInput } from ...
Found 9 matches /home/byk/Code/opencode-lore/packages/opencode/README.md: Line 1: # @loreai/opencode Line 5: Three-tier memory architecture for [OpenCode](https://opencode.ai) — distillation, not summarization. Line 7: An implementation of [Sanity's Nuum](https://www.sanity.io/blog/how-we-solved-the-agent-memory-problem) memory architecture and [Mastra's Observational Memory](https://mastra.ai/research/observational-memory) system as an OpenCode plugin. Preserves operational intelligence (file paths, error messages, exact decisions) rather than narrative summaries that lose the details agents need to keep working. Line 11: Add to your project's `opencode.json`: Line 16: "@loreai/opencode" Line 21: Restart OpenCode and the plugin will be installed automatically. Line 23: > This package is also published as [`opencode-lore`](https://www.npmjs.com/package/opencode-lore) (legacy alias). Both names ship identical code at every release — either works. ...
<path>/home/byk/Code/opencode-lore/packages/opencode/README.md</path>
<type>file</type>
<content>
1: # @loreai/opencode
2:
3: > **Experimental** — Under active development. APIs, storage format, and behavior may change.
4:
5: Three-tier memory architecture for [OpenCode](https://opencode.ai) — distillation, not summarization.
6:
7: An implementation of [Sanity's Nuum](https://www.sanity.io/blog/how-we-solved-the-agent-memory-problem) memory architecture and [Mastra's Observational Memory](https://mastra.ai/research/observational-memory) system as an OpenCode plugin. Preserves operational intelligence (file paths, error messages, exact decisions) rather than narrative summaries that lose the details agents need to keep working.
8:
9: ## Install
10:
11: Add to your project's `opencode.json`:
12:
13: ```json
14: {
15: "plugin": [
16: "@loreai/opencode"
17: ]
18: }
19: ```
20:
21: Restart OpenCode and the plugin will be installed automatically. ...
Found 9 matches
/home/byk/Code/opencode-v2-pilot/packages/plugin-browser/src/proxy.ts:
Line 71: server.headersTimeout = 10_000
/home/byk/Code/opencode-v2-pilot/packages/core/src/v1/config/provider.ts:
Line 103: headerTimeout: Schema.optional(
/home/byk/Code/opencode-v2-pilot/packages/app/src/runtime/server/request-queue.ts:
Line 40: headersTimeoutMs?: number
Line 48: const headersTimeoutMs = input.headersTimeoutMs ?? requestHeadersTimeoutMs
Line 115: isSetupRequest(request.method, pathname) ? setupHeadersTimeoutMs : headersTimeoutMs,
/home/byk/Code/opencode-v2-pilot/packages/app/src/runtime/server/request-queue.test.ts:
Line 8: headersTimeoutMs?: number
Line 18: headersTimeoutMs: input?.headersTimeoutMs,
Line 109: const input = setup({ limit: 1, headersTimeoutMs: 10 })
Line 125: const input = setup({ limit: 4, headersTimeoutMs: 10, setupHeadersTimeoutMs: 200 })
Found 100 matches (more matches available)
/home/byk/Code/opencode-v2-pilot/packages/ai/src/provider-package.ts:
Line 6: readonly headers?: Readonly<Record<string, string>>
/home/byk/Code/opencode-v2-pilot/packages/ai/src/schema/options.ts:
Line 48: headers: Schema.optional(Schema.Record(Schema.String, Schema.String)),
Line 61: const headers = mergeStringRecords(...items.map((item) => item?.headers))
Line 63: if (!body && !headers && !query) return undefined
Line 64: return new HttpOptions({ body, headers, query })
/home/byk/Code/opencode-v2-pilot/packages/ai/src/schema/errors.ts:
Line 11: headers: Schema.Record(Schema.String, Schema.String),
/home/byk/Code/opencode-v2-pilot/packages/ai/src/route/protocol.ts:
Line 22: * headers, or which auth scheme to use. Those are deployment concerns owned
/home/byk/Code/opencode-v2-pilot/packages/ai/src/route/executor.ts:
Line 30: const headerDetails = (headers: Headers.Headers) =>
Line 31: ...
Your prior run returned an empty result. Complete the same read-only compatibility review now. You must inspect the exact current Lore source at /home/byk/Code/opencode-lore and current V2 source at /home/byk/Code/opencode-v2-pilot, then return substantive evidence or an exact blocker.
Required output:
Do not edit files, install dependencies, start/stop services, inspect secrets, or rely on memory. If access or a tool fails, name the exact path/tool/error. Return a concise report even if blocked.
<path>/home/byk/Code/opencode-lore/packages/opencode/package.json</path>
<type>file</type>
<content>
1: {
2: "name": "@loreai/opencode",
3: "version": "0.40.0",
4: "type": "module",
5: "license": "FSL-1.1-Apache-2.0",
6: "description": "Three-tier memory architecture for OpenCode — distillation, not summarization",
7: "main": "./src/index.ts",
8: "types": "./src/index.ts",
9: "exports": {
10: ".": {
11: "types": "./src/index.ts",
12: "bun": "./src/index.ts",
13: "default": "./src/index.ts"
14: }
15: },
16: "scripts": {
17: "typecheck": "tsc --noEmit",
18: "build": "echo '@loreai/opencode ships raw TS — no build step needed'"
19: },
20: "peerDependencies": {
21: "@opencode-ai/plugin": ">=1.1.0"
22: },
23: "dependencies": {
24: "@loreai/core": "workspace:*",
25: "@loreai/gateway": "workspace:*"
26: },
27: "devDependencies": {
28: "@opencode-ai/plugin": "^1.1.39",
29: "@opencode-ai/sdk": "^1.1.39",
30: ...
<path>/home/byk/.opencode</path> <type>directory</type> <entries> .gitignore bin/ bun.lock command/ env messages/ node_modules/ opencode.json opencode.json.tui-migration.bak package-lock.json package.json parts/ server.backups/ server.previous/ server/ tui.json (16 entries) </entries>
No files found
Found 1 matches /home/byk/Code/opencode-v2-pilot/packages/schema/src/config/plugin.ts: Line 1: export * as ConfigPlugin from "./plugin.js"
Found 1 matches
/home/byk/Code/opencode-v2-pilot/packages/schema/src/config.ts:
Line 99: plugins: ConfigPlugin.Plugins.pipe(optional).annotate({
<path>/home/byk/Code/opencode-v2-pilot/packages/schema/src/config.ts</path>
<type>file</type>
<content>
90: instructions: Schema.String.pipe(Schema.Array, optional).annotate({
91: description: "Additional paths or URLs supplying ambient instructions",
92: }),
93: references: ConfigReference.Info.pipe(optional).annotate({
94: description: "Named local directories or Git repositories available as external context",
95: }),
96: websearch: ConfigWebSearch.Selection.pipe(optional).annotate({
97: description: "Web search provider selection",
98: }),
99: plugins: ConfigPlugin.Plugins.pipe(optional).annotate({
100: description: "Ordered plugin enablement directives and external package declarations",
101: }),
102: worktree: ConfigWorktree.Info.pipe(optional).annotate({
103: description: "Directory defaults for local worktree creation",
104: }),
105: warming: ConfigWarming.Warming.pipe(optional).annotate({
106: description: "Keep recently active ...
Found 1 matches
/home/byk/Code/opencode-lore/packages/opencode/src/index.ts:
Line 379: "chat.headers": async (input, output) => {
<path>/home/byk/Code/opencode-lore/packages/opencode/src/internal.ts</path>
<type>file</type>
<content>
137: /**
138: * Check if the Lore gateway is reachable at the given base URL.
139: * Short timeout so this doesn't delay OpenCode startup noticeably.
140: */
141: export async function probeGateway(
142: baseURL: string,
143: timeoutMs = 1500,
144: ): Promise<boolean> {
145: const controller = new AbortController();
146: const timer = setTimeout(() => controller.abort(), timeoutMs);
147: try {
148: const url = `${baseURL}/health`;
149: if (isLoopbackUrl(url)) return await probeLoopback(url, controller.signal);
150: return (await fetch(url, { signal: controller.signal })).ok;
151: } catch {
152: return false;
153: } finally {
154: clearTimeout(timer);
155: }
156: }
157:
158: /**
159: * Surface a fatal "Lore is unavailable" condition to the user.
160: *
161: * In embedded/TUI mode the core logger's stderr is hard-silenced (see
162: * ...
No files found
Found 2 matches
/home/byk/Code/opencode-lore/packages/opencode/src/index.ts:
Line 208: const res = await client.session.get({ path: { id: sessionID } });
Line 209: const parentID = res.data?.parentID ?? null;
Found 69 matches
/home/byk/Code/opencode-v2-pilot/packages/core/test/plugin.test.ts:
Line 61: const plugins = yield* Plugin.Service
Line 73: yield* plugins.activate(scenario.before.map((id) => plugin(id)))
Line 75: yield* plugins.activate(scenario.after.map((id) => plugin(id, id === scenario.updated ? "2" : "1")))
Line 78: expect((yield* plugins.list()).map((plugin) => plugin.id)).toEqual(scenario.after.map((id) => Plugin.ID.make(id)))
Line 85: const plugins = yield* Plugin.Service
Line 94: yield* plugins.activate([plugin])
Line 95: yield* plugins.activate([{ ...plugin, source: { ...plugin.source, outdated: true } }])
Line 98: expect((yield* plugins.list())[0]?.source).toEqual({ type: "package", target: "fixture", outdated: true })
Line 104: const plugins = yield* Plugin.Service
Line 106: yield* plugins.awaitActivation
Line 114: yield* plugins.activate([definition])
Line 122: const plugins = ...
Found 8 matches
/home/byk/Code/opencode-v2-pilot/packages/core/test/plugin.test.ts:
Line 12: import { PluginModule } from "@opencode/core/plugin/module"
Line 102: it.live("loads a local plugin with its configured options", () =>
Line 107: const modules = yield* PluginModule.make().pipe(Effect.provide(Watcher.testLayer))
/home/byk/Code/opencode-v2-pilot/packages/core/test/plugin/supervisor-reload.test.ts:
Line 29: // Real Location boot with plugin-directory discovery, so local plugin files are loaded and reloaded.
Line 249: it.live("keeps the running generation when an updated local plugin fails to import", () =>
/home/byk/Code/opencode-v2-pilot/packages/core/test/plugin/module.test.ts:
Line 6: import { PluginModule } from "@opencode/core/plugin/module"
Line 25: const modules = yield* PluginModule.make()
Line 69: const modules = yield* PluginModule.make().pipe(
<path>/home/byk/Code/opencode-v2-pilot/packages/core/test/plugin/module.test.ts</path>
<type>file</type>
<content>
1: import { expect } from "bun:test"
2: import path from "node:path"
3: import { Deferred, Effect, Exit, Fiber, Layer, Schedule, Scope, Stream } from "effect"
4: import { AppNodeBuilder } from "@opencode/core/effect/app-node-builder"
5: import { Watcher } from "@opencode/core/filesystem/watcher"
6: import { PluginModule } from "@opencode/core/plugin/module"
7: import { Global } from "@opencode/util/global"
8: import { Npm } from "@opencode/util/npm"
9: import { tempGlobalLayer } from "../fixture/global"
10: import { tmpdirScoped } from "../fixture/tmpdir"
11: import { testEffect } from "../lib/effect"
12:
13: const it = testEffect(
14: Layer.merge(
15: AppNodeBuilder.build(Npm.node, [Global.node.replace(tempGlobalLayer)]),
16: Watcher.layer().pipe(Layer.provide(Watcher.nativeLayer)),
17: ),
18: )
19:
20: it.live("watches creation of an external helper with ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/event.ts</path>
<type>file</type>
<content>
1: import type { EventApi } from "@opencode/client/promise/api"
2:
3: export interface EventDomain extends Pick<EventApi, "subscribe"> {}
(End of file - total 3 lines)
</content>
Found 7 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/config/normalize.ts:
Line 14: import { ConfigPlugin } from "@opencode/schema/config/plugin"
Line 25: import { ConfigPluginV1 } from "../v1/config/plugin.js"
Line 185: const legacyPlugins = decodeList(input.plugin, ConfigPluginV1.Spec, ["plugin"], diagnostics, decodeValue).map(
Line 186: (plugin) => (typeof plugin === "string" ? plugin : { package: plugin[0], options: plugin[1] }),
Line 188: const nativePlugins = decodeList(input.plugins, ConfigPlugin.Plugin, ["plugins"], diagnostics, decodeEncoded)
Line 189: if (legacyPlugins.length || nativePlugins.length || Array.isArray(input.plugin) || Array.isArray(input.plugins))
Line 190: encoded.plugins = [...legacyPlugins, ...nativePlugins]
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/config/normalize.ts</path>
<type>file</type>
<content>
175: isRecord(input.provider) || isRecord(input.providers),
176: diagnostics,
177: )
178:
179: const toolRules = migrateTools(input.tools, diagnostics)
180: const permissionRules = migratePermissions(input.permission, diagnostics)
181: const nativePermissions = decodeList(input.permissions, Permission.Rule, ["permissions"], diagnostics, decodeEncoded)
182: const permissions = [...toolRules, ...permissionRules, ...nativePermissions]
183: if (permissions.length || Array.isArray(input.permissions)) encoded.permissions = permissions
184:
185: const legacyPlugins = decodeList(input.plugin, ConfigPluginV1.Spec, ["plugin"], diagnostics, decodeValue).map(
186: (plugin) => (typeof plugin === "string" ? plugin : { package: plugin[0], options: plugin[1] }),
187: )
188: const nativePlugins = decodeList(input.plugins, ConfigPlugin.Plugin, ["plugins"], ...
No files found
Found 37 matches
/home/byk/Code/opencode-v2-pilot/packages/app/test-browser/toast-owner.test.ts:
Line 3: import { showToast, toaster } from "@opencode/ui/toast"
Line 5: describe("showToast", () => {
Line 12: const first = showToast({ title: "Repeated error", description: "Try again" })
Line 13: const second = showToast({ title: "Repeated error", description: "Try again" })
Line 14: const different = showToast({ title: "Repeated error", description: "A different error" })
Line 24: const first = showToast("Dismiss and retry")
Line 27: const second = showToast("Dismiss and retry")
Line 34: const first = showToast("First toast")
Line 35: const topmost = showToast("Topmost toast")
Line 36: const repeated = showToast("First toast")
Line 53: const id = showToast({ description: "test", icon })
/home/byk/Code/opencode-v2-pilot/packages/app/src/shell/updates/action.ts:
Line 5: import { showToast } from ...
Found 2 matches /home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts: Line 598: yield* Effect.acquireRelease( Line 599: Effect.promise(() => Promise.resolve(plugin.setup(context2))),
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts</path> <type>file</type> <content> 575: register( 576: host.session.hook(name, (event) => Effect.promise(() => Promise.resolve(callback(event))), options), 577: ), 578: create: adaptApiMethod(SessionEndpoints["session.create"], host.session.create), 579: get: adaptApiMethod(SessionEndpoints["session.get"], host.session.get), 580: switchAgent: adaptApiMethod(SessionEndpoints["session.switchAgent"], host.session.switchAgent), 581: switchModel: adaptApiMethod(SessionEndpoints["session.switchModel"], host.session.switchModel), 582: prompt: adaptApiMethod(SessionEndpoints["session.prompt"], host.session.prompt), 583: generate: adaptApiMethod(SessionEndpoints["session.generate"], host.session.generate), 584: command: adaptApiMethod(SessionEndpoints["session.command"], ...
Found 6 matches
/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts:
Line 107: handler: (event: RpcEventPayload<Rpc.PortableDefinition>) => Promise<void> | void,
Line 288: const context2: PromiseContext = {
Line 289: app: host.app,
Line 290: location: host.location,
Line 333: event: {
Line 599: Effect.promise(() => Promise.resolve(plugin.setup(context2))),
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts</path>
<type>file</type>
<content>
275: }
276:
277: const transform =
278: <Editor>(domain: {
279: transform: (callback: (editor: Editor) => void) => Effect.Effect<HostRegistration, never, Scope.Scope>
280: }) =>
281: (callback: (editor: Editor) => void) =>
282: register(
283: domain.transform((editor) => {
284: callback(editor)
285: }),
286: )
287:
288: const context2: PromiseContext = {
289: app: host.app,
290: location: host.location,
291: options: host.options,
292: agent: {
293: get: adaptApiMethod(AgentEndpoints["agent.get"], host.agent.get),
294: list: adaptApiMethod(AgentEndpoints["agent.list"], host.agent.list),
295: transform: transform(host.agent),
296: reload: () => ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts</path>
<type>file</type>
<content>
515: callback({
516: add: (definition) => {
517: const base = definition.base?.bind(definition)
518: editor.add({
519: id: definition.id,
520: name: definition.name,
521: info: (input) => attempt((signal) => definition.info(input, { signal })),
522: base: base ? (input) => attempt((signal) => base(input, { signal })) : undefined,
523: branches: (input) => attempt((signal) => definition.branches(input, { signal })),
524: status: (input) => attempt((signal) => definition.status(input, { signal })),
525: diff: (input) => attempt((signal) => definition.diff(input, { signal })),
526: })
527: ...
Found 2 matches /home/byk/Code/opencode-lore/packages/core/src/index.ts: Line 57: export * as log from "./log"; Line 202: getGitRemote,
<path>/home/byk/Code/opencode-lore/packages/core/src/index.ts</path>
<type>file</type>
<content>
185: reinstallSyncCapture,
186: withTransaction,
187: withSavepoint,
188: ensureSessionRollup,
189: rebuildDirtySessionRollups,
190: rebuildAllSessionRollups,
191: close,
192: checkpointWal,
193: walSizeBytes,
194: vacuum,
195: dbFileSizeBytes,
196: freelistBytes,
197: autoVacuumMode,
198: incrementalVacuum,
199: } from "./db";
200: export {
201: normalizeRemoteUrl,
202: getGitRemote,
203: clearGitRemoteCache,
204: getGitUser,
205: clearGitUserCache,
206: } from "./git";
207: export {
208: GATEWAY_AUTH_HEADER,
209: KNOWN_SESSION_HEADERS,
210: CLAUDE_CODE_AGENT_ID_HEADER,
211: CLAUDE_CODE_PARENT_AGENT_ID_HEADER,
212: isCredentialHeaderName,
213: redactCredentialHeaderAssignments,
214: } from "./credential-headers";
215: export {
216: enableHostedMode,
217: isHostedMode,
218: _resetHostedModeForTest,
219: } from "./hosted";
(Showing ...
Found 2 matches /home/byk/Code/opencode-lore/packages/core/src/index.ts: Line 330: discoverWorkspaceRoot, Line 356: installFetchInterceptor,
<path>/home/byk/Code/opencode-lore/packages/core/src/index.ts</path>
<type>file</type>
<content>
320: loreFileExists,
321: clearLoreFileCache,
322: importLoreFileAs,
323: LORE_FILE,
324: AUTO_AGENTS_FILE,
325: AGENTS_FILE_CANDIDATES,
326: resolveAgentsFileName,
327: otherAgentsFileCandidate,
328: } from "./agents-file";
329: export {
330: discoverWorkspaceRoot,
331: resolveWorkspaces,
332: clearWorkspaceCache,
333: } from "./workspace";
334: export { workerSessionIDs, isWorkerSession } from "./worker";
335: export { asString } from "./coerce";
336: export { setReadPathTimingHook, type ReadPathTiming } from "./read-telemetry";
337: export {
338: recordVecReadLatency,
339: setVecReadLatencyHook,
340: VEC_LATENCY_WINDOW,
341: type VecReadLatencySample,
342: type VecReadLatencyStat,
343: vecReadLatencyStats,
344: vecReadLatencyTotalSamples,
345: formatVecReadLatencyHeartbeat,
346: _resetVecReadLatencyForTest,
347: } from "./vec-latency";
348: export ...
<path>/home/byk/Code/opencode-lore/packages/core/src/fetch-interceptor.ts</path>
<type>file</type>
<content>
405:
406: return headers;
407: }
408:
409: function observeRequestHeaders(
410: headers: Headers,
411: config: FetchInterceptorConfig,
412: ): void {
413: if (!config.onRequestHeaders) return;
414: try {
415: config.onRequestHeaders(headers);
416: } catch (e) {
417: log.error("fetch-interceptor: onRequestHeaders() failed:", e);
418: }
419: }
420:
421: export function installFetchInterceptor(
422: config: FetchInterceptorConfig,
423: ): () => void {
424: // Guard against double-install ACROSS ALL COPIES of this module in the
425: // process: a non-null shared slot means some copy already installed the
426: // interceptor. Installing again would capture the *first* interceptor as the
427: // "original", corrupting the chain (and, across copies, is the exact
428: // infinite-loop shape #1027 guards against). Return a no-op cleanup instead. ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/agent.ts</path>
<type>file</type>
<content>
65: const state = State.create<Data, Editor>({
66: name: "agent",
67: initial: () => ({ agents: new Map() }),
68: editor: (editor) => ({
69: list: () => Array.fromIterable(editor.agents.values()) as Info[],
70: get: (id) => editor.agents.get(id),
71: default: (id) => {
72: editor.default = id
73: },
74: update: (id, fn) => {
75: const defaults = Info.default(id)
76: const current =
77: editor.agents.get(id) ??
78: ({
79: ...defaults,
80: permissions: [...defaults.permissions, ...permissions],
81: } as Types.DeepMutable<Info>)
82: if (!editor.agents.has(id)) editor.agents.set(id, current)
83: fn(current)
84: current.id = id
85: },
86: remove: (id) => {
87: ...
Found 9 matches
/home/byk/Code/opencode-v2-pilot/packages/schema/src/config/agent.ts:
Line 15: description: Schema.String.pipe(optional),
Line 16: mode: Schema.Literals(["subagent", "primary", "all"]).pipe(optional),
Line 17: hidden: Schema.Boolean.pipe(optional),
/home/byk/Code/opencode-v2-pilot/packages/schema/src/agent.ts:
Line 22: export interface Info extends Schema.Schema.Type<typeof Info> {}
Line 29: description: Schema.String.pipe(optional),
Line 30: mode: Schema.Literals(["subagent", "primary", "all"]),
Line 31: hidden: Schema.Boolean,
Line 44: mode: "primary",
Line 45: hidden: false,
<path>/home/byk/Code/opencode-v2-pilot/packages/schema/src/agent.ts</path>
<type>file</type>
<content>
20: export type Color = typeof Color.Type
21:
22: export interface Info extends Schema.Schema.Type<typeof Info> {}
23: export const Info = Schema.Struct({
24: id: ID,
25: name: Name,
26: model: Model.Ref.pipe(optional),
27: request: Provider.Request,
28: system: Schema.String.pipe(optional),
29: description: Schema.String.pipe(optional),
30: mode: Schema.Literals(["subagent", "primary", "all"]),
31: hidden: Schema.Boolean,
32: color: Color.pipe(optional),
33: steps: PositiveInt.pipe(optional),
34: permissions: Permission.Ruleset,
35: })
36: .annotate({ identifier: "Agent.Info" })
37: .pipe(
38: statics(() => ({
39: default: (id: ID) =>
40: ({
41: id,
42: name: Name.make(id),
43: request: { settings: {}, headers: {}, body: {} },
44: mode: "primary",
45: hidden: false,
46: ...
ripgrep execution failed
No files found
<path>/home/byk/Code/opencode-lore/node_modules</path> <type>directory</type> <entries> .astro/ .bin/ .bun/ .modules.yaml .pnpm_patches/ .pnpm-workspace-state-v1.json .pnpm/ .vite-temp/ .vite/ @stryker-mutator/ @types/ @vitest/ binpatch/ esbuild/ fast-check/ linkinator/ onnxruntime-common onnxruntime-node oxfmt/ oxlint-tsgolint/ oxlint/ pg/ sharp tsx/ typescript/ vitest-evals/ vitest/ (27 entries) </entries>
No files found
No files found
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/session/title.ts</path>
<type>file</type>
<content>
93: if (failed) return
94: return chunks
95: .join("")
96: .split("\n")
97: .map((line) => line.trim())
98: .find((line) => line.length > 0)
99: })
100:
101: const generate = Effect.fn("SessionTitle.generate")(function* (sessionID: SessionSchema.ID) {
102: const session = yield* store.get(sessionID)
103: if (!session) return
104: const firstUser = yield* SessionHistory.firstUserMessage(db, session.id)
105: if (!firstUser) return
106: const text = !isUntitled(session)
107: ? yield* store.context(session.id).pipe(
108: Effect.map((messages) => {
109: const original = `Original request:\n${firstUser.text.slice(0, MAX_FIRST_MESSAGE_LENGTH)}`
110: const recent = messages
111: .flatMap((message) => {
112: if (message.type ...
Found 6 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/session/title.ts:
Line 128: const selection = yield* context.selectTitle(session)
/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/agent.ts:
Line 139: editor.update(Agent.ID.make("title"), (item) => {
/home/byk/Code/opencode-v2-pilot/packages/core/src/session/context.ts:
Line 60: readonly selectTitle: (session: SessionSchema.Info) => Effect.Effect<
Line 95: const selectTitle = Effect.fn("SessionContext.selectTitle")(function* (session: SessionSchema.Info) {
Line 96: const agent = yield* agents.get(Agent.ID.make("title"))
Line 176: return Service.of({ select, load, resolveModel, selectTitle, prepare: modelRequests.prepare })
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/agent.ts</path>
<type>file</type>
<content>
120: { action: "webfetch", resource: "*", effect: "allow" },
121: { action: "websearch", resource: "*", effect: "allow" },
122: { action: "read", resource: "*", effect: "allow" },
123: { action: "read", resource: "*.env", effect: "ask" },
124: { action: "read", resource: "*.env.*", effect: "ask" },
125: { action: "read", resource: "*.env.example", effect: "allow" },
126: { action: "subagent", resource: "*", effect: "deny" },
127: ],
128: [{ action: "external_directory", resource: "*", effect: "ask" }, ...externalDirectories],
129: ),
130: )
131: })
132:
133: editor.update(Agent.ID.make("compaction"), (item) => {
134: item.name = Agent.Name.make("Compaction")
135: item.mode = "primary"
136: item.hidden = ...
Found 100 matches (more matches available)
/home/byk/Code/opencode-lore/packages/gateway/test/session-retention.test.ts:
Line 62: "x-lore-session-id": header,
/home/byk/Code/opencode-lore/packages/gateway/test/pipeline-semantic-preparation.test.ts:
Line 116: { "x-lore-session-id": "source-window-pipeline" },
/home/byk/Code/opencode-lore/packages/gateway/test/recall-exhaustion.test.ts:
Line 276: "x-lore-session-id": session,
/home/byk/Code/opencode-lore/packages/gateway/test/max-tokens.test.ts:
Line 455: expect(isClaudeCodeClient({ "x-session-affinity": "nano-id-value" })).toBe(
/home/byk/Code/opencode-lore/packages/gateway/test/recall-buffered-transaction.test.ts:
Line 731: "x-lore-session-id": alias,
/home/byk/Code/opencode-lore/packages/gateway/test/pipeline-streaming.test.ts:
Line 369: sessionHeaders: { "x-lore-session-id": "recall-followup-abort" },
Line 450: sessionHeaders: { "x-lore-session-id": ...
<path>/home/byk/Code/opencode-lore/packages/core/src/credential-headers.ts</path> <type>file</type> <content> 1: /** Shared credential-header policy and free-text redaction. */ 2: 3: /** Internal gateway access credential. Never forward, learn, persist, or log. */ 4: export const GATEWAY_AUTH_HEADER = "x-lore-gateway-token"; 5: 6: /** 7: * Claude Code sub-agent (Task/Agent tool) correlation headers. 8: * 9: * A sub-agent request carries its own `x-claude-code-agent-id` (a fresh id per 10: * sub-agent invocation) AND the parent's `x-claude-code-session-id`. The main 11: * agent emits only the session-id (`x-claude-code-agent-id` is absent). 12: * `x-claude-code-parent-agent-id` carries the parent *agent* id (not the parent 13: * session id) and is never emitted by the main agent, so it never appears in 14: * the header session index. ...
Found 1 matches
/home/byk/Code/opencode-lore/packages/core/src/fetch-interceptor.ts:
Line 15: export type FetchInterceptorConfig = {
<path>/home/byk/Code/opencode-lore/packages/core/src/fetch-interceptor.ts</path>
<type>file</type>
<content>
1: /**
2: * Fetch-level interception for transparent LLM API proxy routing.
3: *
4: * Instead of overwriting provider baseURLs early (which loses original auth
5: * and URL context), this interceptor wraps `globalThis.fetch` to redirect
6: * outgoing LLM API calls through the Lore gateway at the HTTP level.
7: *
8: * The SDK builds requests normally (correct auth, correct URL for each
9: * provider), and the interceptor transparently reroutes them through the
10: * gateway while preserving all original headers.
11: */
12: import * as log from "./log";
13:
14: /** Configuration for the fetch interceptor. */
15: export type FetchInterceptorConfig = {
16: /** Base URL of the Lore gateway (e.g., "http://127.0.0.1:3207"). */
17: gatewayBase: string;
18: /**
19: * Dynamic headers to inject on every intercepted request. ...
Found 7 matches
/home/byk/Code/opencode-lore/packages/core/src/fetch-interceptor.ts:
Line 188: * gateway as `x-lore-upstream-path` so it can POST to the exact endpoint the
Line 368: function buildGatewayHeaders(
Line 385: headers.set("x-lore-upstream-url", upstreamBase);
Line 393: headers.set("x-lore-upstream-path", upstreamPath);
Line 399: for (const [k, v] of Object.entries(config.getHeaders())) {
Line 505: const headers = buildGatewayHeaders(
Line 529: const headers = buildGatewayHeaders(
<path>/home/byk/Code/opencode-lore/packages/core/src/fetch-interceptor.ts</path>
<type>file</type>
<content>
355: ORIGINAL_FETCH_KEY
356: ] = fn;
357: }
358:
359: /**
360: * Build the gateway-bound headers for an intercepted request: preserve all
361: * original headers (auth, content-type, etc.), set `X-Lore-Upstream-URL` to
362: * the resolved upstream base, `X-Lore-Upstream-Path` to the original endpoint
363: * pathname, and inject dynamic `X-Lore-*` context headers.
364: *
365: * Shared by both the URL-matched path (Path 1) and the body-detected path
366: * (Path 2) so header handling can never drift between them.
367: */
368: function buildGatewayHeaders(
369: input: RequestInfo | URL,
370: init: RequestInit | undefined,
371: upstreamBase: string,
372: upstreamPath: string,
373: config: FetchInterceptorConfig,
374: ): Headers {
375: // Handle both `fetch(url, {headers})` and `fetch(new Request(url, {headers}))`. ...
<path>/home/byk/Code/opencode-v2-pilot/packages/schema/src/config/compaction.ts</path>
<type>file</type>
<content>
1: export * as ConfigCompaction from "./compaction.js"
2:
3: import { Schema } from "effect"
4: import { NonNegativeInt, optional } from "../schema.js"
5:
6: export class Keep extends Schema.Class<Keep>("Config.Compaction.Keep")({
7: tokens: NonNegativeInt.pipe(optional),
8: }) {}
9:
10: export class Info extends Schema.Class<Info>("Config.Compaction")({
11: auto: Schema.Boolean.pipe(optional),
12: keep: Keep.pipe(optional),
13: buffer: NonNegativeInt.pipe(optional),
14: }) {}
(End of file - total 14 lines)
</content>
Found 24 matches
/home/byk/Code/opencode-v2-pilot/packages/util/src/npm.ts:
Line 24: readonly version?: string
Line 30: readonly resolve: (pkg: string) => Effect.Effect<Package>
Line 73: if (!result.name || !["version", "range", "tag"].includes(result.type)) return
Line 78: mutable: result.type !== "version",
Line 124: version: Schema.optional(Schema.String),
Line 128: packages: Schema.optional(Schema.Record(Schema.String, Schema.Struct({ resolved: Schema.optional(Schema.String) }))),
Line 183: return Option.isSome(manifest) ? manifest.value.version : undefined
Line 190: Option.isSome(lock) ? lock.value.packages?.[`node_modules/${name}`]?.resolved : undefined,
Line 199: const manifestVersion = Option.isSome(manifest) ? manifest.value.version : undefined
Line 201: const version = target?.type === "git" ? revision : manifestVersion
Line 205: ...(version ? ...
<path>/home/byk/Code/opencode-v2-pilot/packages/util/src/npm.ts</path>
<type>file</type>
<content>
340: { concurrency: "unbounded", discard: true },
341: )
342: })
343:
344: const add = Effect.fn("Npm.add")(function* (pkg: string) {
345: const target = yield* Effect.promise(() => parse(pkg))
346: const dir = directory(pkg, target)
347: return yield* install(pkg, target, dir, false)
348: }, Effect.scoped)
349:
350: const resolve = Effect.fn("Npm.resolve")(function* (pkg: string) {
351: const target = yield* Effect.promise(() => parse(pkg))
352: const root = directory(pkg, target)
353: const generation = yield* current(root)
354: const name = yield* installedName(pkg, generation ?? root, target)
355: const dir = path.join(generation ?? root, "node_modules", name)
356: if (!(yield* afs.existsSafe(dir))) return { directory: dir, name }
357: return yield* metadata(generation ?? ...
Found 2 matches
/home/byk/Code/opencode-v2-pilot/packages/util/src/npm.ts:
Line 225: ignoreScripts: true,
Line 375: const options = { ...(yield* NpmConfig.load(root)), preferOnline: true, noGitRevCache: true, ignoreScripts: true }
<path>/home/byk/Code/opencode-v2-pilot/packages/util/src/npm.ts</path>
<type>file</type>
<content>
205: ...(version ? { version } : {}),
206: ...(revision ? { revision } : {}),
207: }
208: })
209: const reify = (input: { dir: string; config?: string; add?: string[]; update?: boolean }) =>
210: Effect.gen(function* () {
211: const { Arborist } = yield* Effect.promise(() => import("@npmcli/arborist"))
212: const add = input.add ?? []
213: const options = {
214: ...(yield* NpmConfig.load(input.config ?? input.dir)),
215: ...(input.update ? { preferOnline: true, noGitRevCache: true } : {}),
216: // Audit reports are unused here, but Arborist waits for them before completing an install.
217: audit: false,
218: }
219: const arborist = new Arborist({
220: ...options,
221: path: input.dir,
222: binLinks: true,
223: progress: false,
224: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/util/src/runtime-import.ts</path>
<type>file</type>
<content>
1: export { importModule, resolveModule } from "#runtime-import"
(End of file - total 1 lines)
</content>
/home/byk/Code/opencode-v2-pilot/packages/util/src/runtime-import.ts
Found 1 matches
/home/byk/Code/opencode-v2-pilot/packages/util/package.json:
Line 27: "#runtime-import": {
<path>/home/byk/Code/opencode-v2-pilot/packages/util/package.json</path>
<type>file</type>
<content>
20: "./*": "./src/*.ts"
21: },
22: "imports": {
23: "#global-roots": {
24: "workerd": "./src/global-roots.workerd.ts",
25: "default": "./src/global-roots.ts"
26: },
27: "#runtime-import": {
28: "workerd": "./src/runtime/import.workerd.ts",
29: "bun": "./src/runtime/import.bun.ts",
30: "node": "./src/runtime/import.node.ts",
31: "default": "./src/runtime/import.bun.ts"
32: }
33: },
34: "scripts": {
35: "build": "bun run script/build.ts",
36: "test": "bun test --only-failures",
37: "typecheck": "tsgo --noEmit",
38: "typecheck:dist": "bun run build && bun typecheck --project tsconfig.dist.json"
39: },
40: "dependencies": {
41: "@effect/opentelemetry": "catalog:",
(Showing lines 20-41 of 69. Use offset=42 to continue.)
</content>
<path>/home/byk/Code/opencode-v2-pilot/packages/util/src/runtime/import.bun.ts</path>
<type>file</type>
<content>
1: import { pathToFileURL } from "node:url"
2:
3: export function importModule(specifier: string) {
4: return import(specifier) as Promise<unknown>
5: }
6:
7: export function resolveModule(specifier: string, directory: string) {
8: const resolved = Bun.resolveSync(specifier, directory)
9: return resolved.startsWith("node:") ? resolved : pathToFileURL(resolved).href
10: }
(End of file - total 10 lines)
</content>
Found 6 matches
/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/session.ts:
Line 39: export interface SessionModelRequest {
Line 43: readonly kind: SessionRequestKind
Line 52: readonly kind: SessionRequestKind
Line 60: readonly kind: SessionRequestKind
Line 76: export interface SessionHooks {
Line 101: readonly hook: ModelHooks<SessionHooks>
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/session.ts</path>
<type>file</type>
<content>
1: import type { SessionApi } from "@opencode/client/promise/api"
2: import type { GenerationOptionsFields, Message, SystemPart } from "@opencode/ai"
3: import type { Agent } from "@opencode/schema/agent"
4: import type { Model } from "@opencode/schema/model"
5: import type { PromptInput } from "@opencode/schema/prompt-input"
6: import type { Session } from "@opencode/schema/session"
7: import type { SessionInbox } from "@opencode/schema/session-inbox"
8: import type { SessionError } from "@opencode/schema/session-error"
9: import type { SessionMessage } from "@opencode/schema/session-message"
10: import type { JsonSchema, Types } from "effect"
11: import type { ModelHooks } from "./registration.js"
12:
13: export interface SessionPrompt {
14: readonly sessionID: Session.ID
15: readonly messageID: SessionMessage.ID
16: prompt: ...
<path>/home/byk/Code/opencode-lore/packages/opencode/src/index.ts</path>
<type>file</type>
<content>
1: import type { Hooks, Plugin, PluginInput } from "@opencode-ai/plugin";
2: import {
3: log,
4: getGitRemote,
5: discoverWorkspaceRoot,
6: installFetchInterceptor,
7: } from "@loreai/core";
8: // Helpers live in a separate module so they are NOT re-exported from this
9: // plugin entry. OpenCode's legacy plugin loader invokes every function
10: // exported from the entry module as a plugin; leaking these helpers pushed
11: // `undefined` into the host hooks array and crashed it on event dispatch
12: // (`undefined is not an object (evaluating 'A.event')`). See ./internal.ts.
13: import {
14: applyLoreProviderConfig,
15: gatewayAccessHeadersForRemote,
16: probeGateway,
17: shouldForwardUpstreamExtraHeader,
18: surfaceGatewayUnavailable,
19: } from "./internal";
20:
21: /**
22: * Lore plugin for OpenCode — transparent LLM proxy routing. ...
<path>/home/byk/Code/opencode-lore/packages/opencode/src/index.ts</path>
<type>file</type>
<content>
221:
222: /**
223: * Whether the plugin should stay inert (skip gateway probe/start and the
224: * process-wide fetch interceptor). True under test runners — `NODE_ENV=test`
225: * or a `.test.` argv entry — so unrelated package suites don't accidentally
226: * spin up a gateway or patch `globalThis.fetch`.
227: *
228: * Tests that need the active discovery → interceptor → routing path set
229: * `LORE_OPENCODE_FORCE_ACTIVE=1` and point the plugin at a controlled
230: * in-process gateway via `LORE_GATEWAY_URL`. The force flag keeps
231: * `NODE_ENV=test` (so `log` stays file-suppressed and the DB isolated) while
232: * exercising the real wiring. Mirrors the Pi extension's `LORE_PI_FORCE_ACTIVE`.
233: */
234: function isInertTestEnv(): boolean {
235: if (process.env.LORE_OPENCODE_FORCE_ACTIVE === "1") return false;
236: return (
237: process.env.NODE_ENV === "test" ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/plugin.ts</path>
<type>file</type>
<content>
1: import type { OpenCodeClient } from "@opencode/client"
2: import type { GenerateApi, PluginApi } from "@opencode/client/promise/api"
3: import type { Location } from "@opencode/schema/location"
4: import type { PluginOptions } from "../options.js"
5: import type { App } from "../app.js"
6: import type { AgentDomain } from "./agent.js"
7: import type { AISDKDomain } from "./aisdk.js"
8: import type { CatalogDomain } from "./catalog.js"
9: import type { CommandDomain } from "./command.js"
10: import type { EventDomain } from "./event.js"
11: import type { IntegrationDomain } from "./integration.js"
12: import type { MCPDomain } from "./mcp.js"
13: import type { PermissionDomain } from "./permission.js"
14: import type { ReferenceDomain } from "./reference.js"
15: import type { RpcDomain } from "./rpc.js"
16: import type { SessionDomain } from "./session.js"
17: import type ...
Found 6 matches
/home/byk/Code/opencode-v2-pilot/packages/protocol/src/groups/session.ts:
Line 164: summary: "Get session statistics",
Line 232: HttpApiEndpoint.get("session.get", "/api/session/:sessionID", {
Line 238: identifier: "v2.session.get",
Line 239: summary: "Get session",
Line 519: summary: "Get session context",
Line 708: summary: "Get session message",
<path>/home/byk/Code/opencode-v2-pilot/packages/protocol/src/groups/session.ts</path>
<type>file</type>
<content>
225: summary: "List active sessions",
226: description:
227: "Retrieve foreground Session drains currently owned by this OpenCode process. Sessions absent from the result are inactive.",
228: }),
229: ),
230: )
231: .add(
232: HttpApiEndpoint.get("session.get", "/api/session/:sessionID", {
233: params: { sessionID: Session.ID },
234: success: Schema.Struct({ data: Session.Info }),
235: error: SessionNotFoundError,
236: }).annotateMerge(
237: OpenApi.annotations({
238: identifier: "v2.session.get",
239: summary: "Get session",
240: description: "Retrieve a session by ID.",
241: }),
242: ),
243: )
244: .add(
245: HttpApiEndpoint.delete("session.remove", "/api/session/:sessionID", {
246: params: { sessionID: ...
No files found
No files found
No files found
<path>/home/byk/Code/opencode-v2-pilot/packages/client/src/promise/api.ts</path>
<type>file</type>
<content>
1: import type { OpenCode } from "./client.js"
2:
3: type Client = ReturnType<typeof OpenCode.make>
4:
5: export type { RpcApi, RpcCallOptions, RpcClient, RpcEventPayload } from "./rpc.js"
6:
7: export type AgentApi = Client["agent"]
8: export type CommandApi = Client["command"]
9: export type ConfigApi = Client["config"]
10: export type EventApi = Client["event"]
11: export type GenerateApi = Client["generate"]
12: export type IntegrationApi = Client["integration"]
13: export type McpApi = Client["mcp"]
14: export type ModelApi = Client["model"]
15: export type PluginApi = Client["plugin"]
16: export type PermissionApi = Client["permission"]
17: export type ProviderApi = Client["provider"]
18: export type ReferenceApi = Client["reference"]
19: export type WebSearchApi = Client["websearch"]
20: export type SessionApi = Client["session"]
21: export type SkillApi = ...
Found 16 matches
/home/byk/Code/opencode-v2-pilot/packages/client/src/promise/generated/client.ts:
Line 412: get: (requestOptions?: RequestOptions) =>
Line 419: get: (requestOptions?: RequestOptions) =>
Line 426: get: (input?: LocationGetInput, requestOptions?: RequestOptions) =>
Line 452: get: (input: AgentGetInput, requestOptions?: RequestOptions) =>
Line 496: body: { target: input?.["target"] },
Line 517: session: {
Line 612: get: (input: SessionGetInput, requestOptions?: RequestOptions) =>
Line 1093: get: (input: ProviderGetInput, requestOptions?: RequestOptions) =>
Line 1119: get: (input: IntegrationGetInput, requestOptions?: RequestOptions) =>
Line 1443: get: (input: FormGetInput, requestOptions?: RequestOptions) =>
Line 1560: get: (input: PermissionGetInput, requestOptions?: RequestOptions) =>
Line 1705: get: (input: PtyGetInput, requestOptions?: RequestOptions) =>
...
<path>/home/byk/Code/opencode-v2-pilot/packages/client/src/promise/generated/client.ts</path>
<type>file</type>
<content>
600: ).then((value) => value.data),
601: active: (requestOptions?: RequestOptions) =>
602: request<{ readonly data: SessionActiveOutput }>(
603: {
604: method: "GET",
605: path: `/api/session/active`,
606: successStatus: 200,
607: declaredStatuses: [400, 401],
608: empty: false,
609: },
610: requestOptions,
611: ).then((value) => value.data),
612: get: (input: SessionGetInput, requestOptions?: RequestOptions) =>
613: request<{ readonly data: SessionGetOutput }>(
614: {
615: method: "GET",
616: path: `/api/session/${encodeURIComponent(input.sessionID)}`,
617: successStatus: 200,
618: declaredStatuses: [400, 401, 404],
619: empty: false,
620: },
621: ...
Found 2 matches
/home/byk/Code/opencode-v2-pilot/packages/client/src/promise/generated/types.ts:
Line 3723: export type SessionGetInput = { readonly sessionID: { readonly sessionID: string }["sessionID"] }
Line 3725: export type SessionGetOutput = { data: SessionInfo }["data"]
Found 4 matches /home/byk/Code/opencode-v2-pilot/packages/schema/src/session-status-event.ts: Line 47: type: "session.idle", /home/byk/Code/opencode-v2-pilot/packages/schema/src/session-event.ts: Line 51: type: "session.created", Line 158: type: "session.deleted", Line 692: export type Event = typeof All.Type
Found 8 matches
/home/byk/Code/opencode-lore/packages/opencode/src/index.ts:
Line 127: // `ctx.project.id`. This prevents the "last project wins" race where a
Line 307: surfaceGatewayUnavailable(ctx.client, msg);
Line 312: // `ctx.project.id` so concurrent projects in the same process (e.g.,
Line 314: const thisProjectPath = discoverWorkspaceRoot(ctx.worktree || ctx.directory);
Line 318: const existingState = projectState.get(ctx.project.id);
Line 324: projectState.set(ctx.project.id, {
Line 394: ctx.client,
Line 463: const projectPath = discoverWorkspaceRoot(ctx.worktree || ctx.directory);
No files found
/home/byk/Code/opencode-v2-pilot/packages/plugin/src/tui/context.ts /home/byk/Code/opencode-v2-pilot/packages/plugin/src/tui/solid.ts /home/byk/Code/opencode-v2-pilot/packages/plugin/src/tui/plugin.ts /home/byk/Code/opencode-v2-pilot/packages/plugin/src/tui/index.ts
<path>/home/byk/Code/opencode-v2-pilot/packages/ai/src/route/transport/http.ts</path>
<type>file</type>
<content>
1: import { Effect } from "effect"
2: import { Headers, HttpClientRequest } from "effect/unstable/http"
3: import { Auth } from "../auth.js"
4: import { render as renderEndpoint } from "../endpoint.js"
5: import { Framing } from "../framing.js"
6: import type { HttpMiddleware, Transport, TransportPrepareInput } from "./index.js"
7: import * as ProviderShared from "../../protocols/shared.js"
8: import { mergeJsonRecords, type LLMRequest } from "../../schema/index.js"
9: import { RequestExecutor } from "../executor.js"
10:
11: export type JsonRequestInput<Body> = TransportPrepareInput<Body>
12:
13: export interface JsonRequestParts<Body = unknown> {
14: readonly url: string
15: readonly jsonBody: Body | Record<string, unknown>
16: readonly bodyText: string
17: readonly headers: Headers.Headers
18: }
19:
20: export interface HttpPrepared<Frame> {
21: readonly ...
Found 6 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/v1/config/migrate.ts:
Line 50: auto: info.compaction.auto,
/home/byk/Code/opencode-v2-pilot/packages/core/src/database/v1-migration.bun.ts:
Line 307: reason: compaction.auto ? "auto" : "manual",
/home/byk/Code/opencode-v2-pilot/packages/core/src/config/normalize.ts:
Line 334: input.compaction.auto,
/home/byk/Code/opencode-v2-pilot/packages/core/src/config/plugin/provider.ts:
Line 80: if (config.compaction !== undefined) model.compaction = { ...config.compaction }
/home/byk/Code/opencode-v2-pilot/packages/core/src/config/plugin/compaction.ts:
Line 10: id: "opencode.config.compaction",
Line 19: ...(entry.info.compaction.auto === undefined ? {} : { auto: entry.info.compaction.auto }),
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/config/plugin/compaction.ts</path>
<type>file</type>
<content>
1: export * as ConfigCompactionPlugin from "./compaction.js"
2:
3: import { define } from "@opencode/plugin/effect/plugin"
4: import { Effect } from "effect"
5: import { Config } from "../../config.js"
6: import { SessionCompaction } from "../../session/compaction.js"
7: import { ConfigEntryObserver } from "./entry-observer.js"
8:
9: export const Plugin = define({
10: id: "opencode.config.compaction",
11: effect: Effect.fn(function* (ctx) {
12: const config = yield* Config.Service
13: const compaction = yield* SessionCompaction.Service
14: const loaded = yield* ConfigEntryObserver.observe(config, ctx.event, compaction.reload())
15: yield* compaction.transform((editor) => {
16: for (const entry of loaded.entries) {
17: if (entry.type !== "document" || !entry.info.compaction) continue
18: editor.configure({
19: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/registration.ts</path>
<type>file</type>
<content>
1: export interface Registration {
2: readonly dispose: () => Promise<void>
3: }
4:
5: export interface ModelHookOptions {
6: /** Limits the hook to one provider. Unscoped hooks apply to every provider. */
7: readonly providerID?: string
8: }
9:
10: export type Hooks<Spec> = <Name extends keyof Spec>(
11: name: Name,
12: callback: (input: Spec[Name]) => Promise<void> | void,
13: ) => Promise<Registration>
14:
15: export type ModelHooks<Spec> = <Name extends keyof Spec>(
16: name: Name,
17: callback: (input: Spec[Name]) => Promise<void> | void,
18: options?: Spec[Name] extends { readonly model: unknown } ? ModelHookOptions : never,
19: ) => Promise<Registration>
20:
21: export type Transform<Input> = (callback: (input: Input) => void) => Promise<Registration>
(End of file - total 21 lines)
</content>
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/catalog.ts</path>
<type>file</type>
<content>
1: import type { CatalogApi } from "@opencode/client/promise/api"
2: import type { Model } from "@opencode/schema/model"
3: import type { Provider } from "@opencode/schema/provider"
4: import type { Transform } from "./registration.js"
5: import type { DeepMutable } from "./types.js"
6:
7: export interface CatalogProviderRecord {
8: readonly provider: DeepMutable<Provider.Info>
9: readonly models: ReadonlyMap<string, DeepMutable<Model.Info>>
10: }
11:
12: export interface CatalogEditor {
13: readonly provider: {
14: list(): readonly CatalogProviderRecord[]
15: get(providerID: string): CatalogProviderRecord | undefined
16: update(providerID: string, update: (provider: DeepMutable<Provider.Info>) => void): void
17: remove(providerID: string): void
18: }
19: readonly model: {
20: get(providerID: string, modelID: string): DeepMutable<Model.Info> ...
Found 2 matches
/home/byk/Code/opencode-v2-pilot/packages/schema/src/provider.ts:
Line 18: openrouter: schema.make("openrouter"),
Line 53: export interface Info extends Schema.Schema.Type<typeof Info> {}
<path>/home/byk/Code/opencode-v2-pilot/packages/schema/src/provider.ts</path>
<type>file</type>
<content>
35: ]).annotate({ identifier: "Provider.Compaction" })
36:
37: export const Overlays = {
38: settings: Schema.Record(Schema.String, Schema.Any).pipe(optional),
39: headers: Schema.Record(Schema.String, Schema.String).pipe(optional),
40: body: Schema.Record(Schema.String, Schema.Any).pipe(optional),
41: }
42:
43: export const Settings = Schema.Record(Schema.String, Schema.Any).annotate({ identifier: "Provider.Settings" })
44: export type Settings = typeof Settings.Type
45:
46: export interface Request extends Schema.Schema.Type<typeof Request> {}
47: export const Request = Schema.Struct({
48: settings: Settings.pipe(Schema.withConstructorDefault(Effect.succeed({}))),
49: headers: Schema.Record(Schema.String, Schema.String),
50: body: Schema.Record(Schema.String, Schema.Any),
51: }).annotate({ identifier: "Provider.Request" })
52:
53: export interface Info extends ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/index.ts</path>
<type>file</type>
<content>
1: export type { PluginOptions } from "../options.js"
2: export type { StorageEntry, StorageScanOptions, StorageScanResult } from "../storage.js"
3: export * as Plugin from "./plugin.js"
4:
5: export { Agent } from "@opencode/schema/agent"
6: export { Command } from "@opencode/schema/command"
7: export { Connection } from "@opencode/schema/connection"
8: export { Credential } from "@opencode/schema/credential"
9: export { Integration } from "@opencode/schema/integration"
10: export { Location } from "@opencode/schema/location"
11: export { Mcp } from "@opencode/schema/mcp"
12: export { Model } from "@opencode/schema/model"
13: export { PersistentPty } from "@opencode/schema/persistent-pty"
14: export { Provider } from "@opencode/schema/provider"
15: export { Reference } from "@opencode/schema/reference"
16: export { Rpc } from "@opencode/schema/rpc"
17: export { Skill } from ...
No files found
<path>/home/byk/.config/systemd/user/opencode-v2-pilot.service</path> <type>file</type> <content> 1: [Unit] 2: Description=OpenCode V2 pilot server 3: After=network-online.target 4: Wants=network-online.target 5: 6: [Service] 7: Type=simple 8: WorkingDirectory=/home/byk 9: Environment=XDG_DATA_HOME=/home/byk/.local/share/opencode-v2-pilot/data 10: Environment=XDG_CACHE_HOME=/home/byk/.local/share/opencode-v2-pilot/cache 11: Environment=XDG_CONFIG_HOME=/home/byk/.local/share/opencode-v2-pilot/config 12: Environment=XDG_STATE_HOME=/home/byk/.local/share/opencode-v2-pilot/state 13: Environment=OPENCODE_CONFIG_DIR=/home/byk/.local/share/opencode-v2-pilot/config/opencode 14: Environment=OPENCODE_DB=/home/byk/.local/share/opencode-v2-pilot/data/opencode/opencode.db 15: ExecStart=/home/byk/Code/opencode-v2-pilot/packages/cli/dist-v2-pilot/cli-node-linux-x64/bin/opencode2-node serve --service 16: Restart=on-failure 17: RestartSec=3 18: TimeoutStopSec=30 19: 20: [Install] 21: ...
Found 60 matches
/home/byk/.local/share/opencode-v2-pilot/config/opencode/node_modules/fast-check/lib/types57/fast-check.d.ts:
Line 1377: * While `gen` is easy to use, it may not shrink as well as tailored arbitraries based on `filter` or `map`.
Line 2671: //#region src/arbitrary/lorem.d.ts
Line 2673: * Constraints to be applied on {@link lorem}
Line 2688: * Type of strings that should be produced by {@link lorem}:
Line 2703: * For lorem ipsum string of words or sentences with maximal number of words or sentences
Line 2710: declare function lorem(constraints?: LoremConstraints): Arbitrary<string>;
Line 4799: export { Arbitrary, ArrayConstraints, AsyncCommand, AsyncPropertyHookFunction, BigIntArrayConstraints, BigIntConstraints, CloneValue, Command, CommandsContraints, ContextValue, DateConstraints, DepthContext, DepthIdentifier, DepthSize, DictionaryConstraints, DomainConstraints, DoubleConstraints, EmailAddressConstraints, Arbitraries as ...
Found 1 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/session/compaction.ts:
Line 145: export class Service extends Context.Service<Service, Interface>()("@opencode/SessionCompaction") {}
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/session/compaction.ts</path>
<type>file</type>
<content>
105: readonly resolved: SessionRunnerModel.Resolved
106: readonly context: SessionContext.Loaded
107: }
108:
109: export type ManualInput = {
110: readonly session: SessionSchema.Info
111: readonly messages: readonly SessionMessage.Info[]
112: readonly inputID: SessionMessage.ID
113: readonly started?: boolean
114: /** Empty compaction controls do not preflight model or instruction availability. */
115: readonly resolveContext: (
116: session: SessionSchema.Info,
117: ) => Effect.Effect<
118: SessionContext.Loaded & { readonly instructionUpdate: string },
119: SessionRunnerModel.Error | AgentNotFoundError | Instructions.InitializationBlocked
120: >
121: readonly prepare: SessionModelRequest.Interface["prepare"]
122: }
123:
124: type ExecuteInput = AutoInput & {
125: readonly reason: SessionMessage.Compaction["reason"]
126: readonly ...
Found 3 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/session/compaction.ts:
Line 93: configure: (settings: Partial<Settings>) => void
Line 379: configure: (settings) => {
Line 466: if (!provenance) return yield* reject("Provider compaction requires a stable, configured endpoint")
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/session/compaction.ts</path> <type>file</type> <content> 72: ## Additional Context 73: - [facts or references needed to continue the work that are not captured above; omit this section if none] 74: </template>` 75: 76: const SUMMARY_RULES = `Rules: 77: - Use terse bullets, not prose paragraphs. 78: - Preserve exact file paths, symbols, commands, error strings, URLs, and identifiers when known. 79: - Carry forward only user questions or requests that remain unanswered or require further action. Do not repeat ones that newer history has answered or resolved. Preserve exact wording when carrying one forward. 80: - Preserve consequential workflow state, including whether changes are uncommitted, committed, pushed, under review, or merged. 81: - Do not include ambient environment metadata such as the session ID, current working directory, repository root, current branch, or worktree path. ...
<path>/home/byk/Code/opencode-v2-pilot/packages/util/src/runtime/import.node.ts</path>
<type>file</type>
<content>
1: import { Script, constants } from "node:vm"
2: import { registerHooks } from "node:module"
3: import { statSync } from "node:fs"
4: import path from "node:path"
5: import { pathToFileURL } from "node:url"
6:
7: export async function importModule(specifier: string) {
8: const imported = (await new Script(`import(${JSON.stringify(specifier)})`, {
9: importModuleDynamically: constants.USE_MAIN_CONTEXT_DEFAULT_LOADER,
10: }).runInThisContext()) as unknown
11: if (typeof imported !== "object" || imported === null) return imported
12:
13: const module = imported as Record<string, unknown>
14: const exports = module["module.exports"]
15: if (exports !== module.default || (typeof exports !== "object" && typeof exports !== "function") || exports === null)
16: return imported
17: return Object.assign({}, module, exports)
18: }
19:
20: export function ...
No files found
<path>/home/byk/.local/share/opencode-v2-pilot/config/opencode</path> <type>directory</type> <entries> bun.lock node_modules/ opencode.json package.json plugins/ service-v2-pilot.json test/ tsconfig.json types/ (9 entries) </entries>
<path>/home/byk/.local/share/opencode-v2-pilot/config/opencode/opencode.json</path>
<type>file</type>
<content>
1: {
2: "$schema": "https://opencode.ai/config.json"
3: }
(End of file - total 3 lines)
</content>
/home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/pty.ts /home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/followup.ts
No files found
Found 9 matches
/home/byk/Code/opencode-v2-pilot/packages/util/src/npm.ts:
Line 272: const tree = yield* reify({ dir: staging, config: dir, add: [pkg], update })
/home/byk/Code/opencode-v2-pilot/packages/util/src/global.ts:
Line 39: readonly config: string
Line 53: config: Path.config,
Line 79: Effect.suspend(() => acquire({ config: process.env.OPENCODE_CONFIG_DIR ?? Path.config })),
/home/byk/Code/opencode-v2-pilot/packages/util/src/global-roots.workerd.ts:
Line 12: config: path.join(root, "config"),
/home/byk/Code/opencode-v2-pilot/packages/util/src/global-roots.ts:
Line 15: config: path.join(config!, app),
/home/byk/Code/opencode-v2-pilot/packages/util/src/cross-spawn-spawner.ts:
Line 144: extra: ReadonlyArray<{ fd: number; config: ChildProcess.AdditionalFdConfig }>,
Line 163: extra: ReadonlyArray<{ fd: number; config: ChildProcess.AdditionalFdConfig ...
<path>/home/byk/Code/opencode-v2-pilot/packages/util/src/global.ts</path>
<type>file</type>
<content>
45: }
46:
47: export function make(input: Partial<Interface> = {}): Interface {
48: // The acquired service canonicalizes default tmp; use it instead of Path.tmp for path comparisons.
49: return {
50: home: Path.home,
51: data: Path.data,
52: cache: Path.cache,
53: config: Path.config,
54: state: Path.state,
55: tmp: input.tmp ?? Path.tmp,
56: bin: Path.bin,
57: log: Path.log,
58: repos: Path.repos,
59: ...input,
60: }
61: }
62:
63: const acquire = (input: Partial<Interface>) =>
64: Effect.gen(function* () {
65: const service = Service.of(make(input))
66: yield* Effect.promise(() =>
67: Promise.all(
68: [service.data, service.config, service.state, service.log, service.bin, service.repos, service.tmp].map(
69: (directory) => fs.promises.mkdir(directory, { recursive: true }),
70: ),
71: ...
Found 21 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/config/normalize.ts:
Line 46: const unsupportedTopLevel = ["logLevel", "server", "subagent_depth", "layout"] as const
Line 70: const legacySnapshots = own(input, "snapshot")
Line 71: ? decodeEncoded(Schema.Boolean, input.snapshot, ["snapshot"], diagnostics)
Line 73: const legacyUpdate = own(input, "autoupdate")
Line 74: ? decodeValue(ConfigV1.Info.fields.autoupdate, input.autoupdate, ["autoupdate"], diagnostics)
Line 91: if (legacySnapshots !== undefined) encoded.snapshots = legacySnapshots
Line 93: legacyUpdate === undefined ? undefined : ConfigMigrateV1.migrate({ autoupdate: legacyUpdate }).update
Line 139: ? ConfigMigrateV1.migrate({ small_model: legacySmallModel }).agents?.title?.model
Line 149: model: migratedSmallModel,
Line 203: model: Info.fields.model,
Line 204: default_agent: Info.fields.default_agent,
Line 208: snapshots: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/config/normalize.ts</path>
<type>file</type>
<content>
35: }
36:
37: export type Result =
38: | {
39: readonly type: "normalized"
40: readonly encoded: Readonly<Record<string, unknown>>
41: readonly diagnostics: readonly Diagnostic[]
42: }
43: | { readonly type: "rejected"; readonly diagnostics: readonly Diagnostic[] }
44:
45: const options = { errors: "all", onExcessProperty: "ignore", propertyOrder: "original" } as const
46: const unsupportedTopLevel = ["logLevel", "server", "subagent_depth", "layout"] as const
47: const unsupportedExperimental = [
48: "disable_paste_summary",
49: "batch_tool",
50: "openTelemetry",
51: "primary_tools",
52: "continue_loop_on_deny",
53: ] as const
54: const unsupportedProvider = ["id", "whitelist", "blacklist"] as const
55: const unsupportedModel = ["release_date", "attachment", "reasoning", "temperature", "experimental"] as const
56:
57: export function ...
Found 2 matches /home/byk/Code/opencode-v2-pilot/packages/schema/src/config/plugin.ts: Line 12: export type Plugin = typeof Plugin.Type Line 14: export const Plugins = Plugin.pipe(Schema.Array)
<path>/home/byk/Code/opencode-v2-pilot/packages/schema/src/config/plugin.ts</path>
<type>file</type>
<content>
1: export * as ConfigPlugin from "./plugin.js"
2:
3: import { Schema } from "effect"
4: import { optional } from "../schema.js"
5:
6: export class Entry extends Schema.Class<Entry>("Config.Plugin.Entry")({
7: package: Schema.String,
8: options: Schema.Record(Schema.String, Schema.Unknown).pipe(optional),
9: }) {}
10:
11: export const Plugin = Schema.Union([Schema.String, Entry])
12: export type Plugin = typeof Plugin.Type
13:
14: export const Plugins = Plugin.pipe(Schema.Array)
(End of file - total 14 lines)
</content>
No files found
/home/byk/Code/opencode-v2-pilot/packages/plugin/src/source.ts /home/byk/Code/opencode-v2-pilot/packages/plugin/src/source.node.ts /home/byk/Code/opencode-v2-pilot/packages/plugin/src/source.bun.ts
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/source.ts</path>
<type>file</type>
<content>
1: import { readFileSync, readdirSync } from "node:fs"
2: import { fileURLToPath, pathToFileURL } from "node:url"
3: import path from "node:path"
4: import { Hash } from "@opencode/util/hash"
5:
6: // Keep source fingerprints and import attempts together. Filesystem events
7: // should reload changed local graphs, not repeat unchanged evaluations.
8: export function createPluginSources(watch: (file: string) => Promise<void>) {
9: const sources = new Map<string, Source>()
10: const cleanups: Array<() => void> = []
11: const watching = new Set<Promise<void>>()
12: return {
13: read: async (entrypoint: string) => {
14: await Promise.all(watching)
15: const previous = sources.get(entrypoint)
16: if (previous && [...previous.files].every(([file, item]) => item.digest === digest(file, item.directory)))
17: return previous.loaded
18:
19: const ...
No files found
Found 5 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/config/plugin/source.ts:
Line 14: import { PluginSourceDirectory } from "../../plugin/source-directory.js"
Line 130: PluginSourceDirectory.discover(fs, entry.path).pipe(
Line 195: PluginSourceDirectory.names.some((directory) => FSUtil.contains(path.join(entry.path, directory), file)),
/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/source-directory.ts:
Line 1: export * as PluginSourceDirectory from "./source-directory.js"
Line 9: export const discover = Effect.fn("PluginSourceDirectory.discover")(function* (
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/source-directory.ts</path>
<type>file</type>
<content>
1: export * as PluginSourceDirectory from "./source-directory.js"
2:
3: import { FSUtil } from "@opencode/util/fs-util"
4: import { Effect, Option } from "effect"
5: import path from "path"
6:
7: export const names = ["plugin", "plugins"] as const
8:
9: export const discover = Effect.fn("PluginSourceDirectory.discover")(function* (
10: fs: FSUtil.Interface,
11: directory: string,
12: ) {
13: const children = (yield* Effect.forEach(names, (source) =>
14: fs.readDirectoryEntries(path.join(directory, source)).pipe(
15: Effect.orElseSucceed(() => []),
16: Effect.map((entries) => entries.map((entry) => ({ ...entry, target: path.join(directory, source, entry.name) }))),
17: ),
18: ))
19: .flat()
20: .sort((a, b) => (a.target < b.target ? -1 : a.target > b.target ? 1 : 0))
21: const targets = yield* Effect.forEach(children, (entry) ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/package.json</path>
<type>file</type>
<content>
1: {
2: "$schema": "https://json.schemastore.org/package.json",
3: "name": "@opencode/plugin",
4: "version": "1.18.15",
5: "type": "module",
6: "license": "MIT",
7: "scripts": {
8: "test": "bun test --only-failures",
9: "typecheck": "tsgo --noEmit",
10: "build": "tsc -p tsconfig.build.json"
11: },
12: "exports": {
13: ".": "./src/promise/index.ts",
14: "./effect": "./src/effect/index.ts",
15: "./host": "./src/host.ts",
16: "./tui": "./src/tui/index.ts",
17: "./*": "./src/*.ts"
18: },
19: "imports": {
20: "#plugin-source": {
21: "bun": "./src/source.bun.ts",
22: "node": "./src/source.node.ts",
23: "default": "./src/source.node.ts"
24: }
25: },
26: "files": [
27: "dist"
28: ],
29: "dependencies": {
30: "@ai-sdk/provider": "3.0.8",
31: "@opencode/ai": "workspace:*",
32: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/agent.ts</path>
<type>file</type>
<content>
1: import type { AgentApi } from "@opencode/client/promise/api"
2: import type { Agent } from "@opencode/schema/agent"
3: import type { Transform } from "./registration.js"
4: import type { DeepMutable } from "./types.js"
5:
6: export interface AgentEditor {
7: list(): readonly DeepMutable<Agent.Info>[]
8: get(id: string): DeepMutable<Agent.Info> | undefined
9: default(id: string | undefined): void
10: update(id: string, update: (agent: DeepMutable<Agent.Info>) => void): void
11: remove(id: string): void
12: }
13:
14: export interface AgentDomain extends AgentApi {
15: readonly transform: Transform<AgentEditor>
16: readonly reload: () => Promise<void>
17: }
(End of file - total 17 lines)
</content>
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/session/model-request.ts</path>
<type>file</type>
<content>
300: // The definition objects we hand to hooks, mapped back to their tools. Hooks rename a
301: // tool by moving its definition to a new key; recognizing the object recovers the tool.
302: const given = new Map(
303: tools.definitions.map(
304: (tool) => [{ description: tool.description, input: { ...tool.inputSchema } }, tool] as const,
305: ),
306: )
307: // Hooks mutate this record in place: edit descriptions and schemas, rename, or remove.
308: const definitions = Object.fromEntries(Array.from(given, ([definition, tool]) => [tool.name, definition]))
309: const context: PluginHooks.Domains["session"]["context"] = {
310: sessionID: session.id,
311: agent: input.scope.contextAgentID ?? input.scope.agentID,
312: model: resolved.ref,
313: system: ...
Found 1 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/session/model-request.ts:
Line 207: const sessionHeaders = (session: Pick<SessionSchema.Info, "id" | "parentID" | "projectID">, app: App.Info) => ({
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/session/model-request.ts</path>
<type>file</type>
<content>
195: }),
196: )
197: }
198:
199: /** The identity a plugin hook sees for one outbound request. */
200: interface HookScope {
201: readonly sessionID: SessionSchema.ID
202: readonly agent: Agent.ID
203: readonly model: Model.Ref
204: readonly kind: SessionRequestKind
205: }
206:
207: const sessionHeaders = (session: Pick<SessionSchema.Info, "id" | "parentID" | "projectID">, app: App.Info) => ({
208: "x-session-affinity": session.id,
209: "X-Session-Id": session.id,
210: ...(session.parentID ? { "x-parent-session-id": session.parentID } : {}),
211: "User-Agent": App.useragent(app),
212: "x-opencode-project": session.projectID,
213: "x-opencode-session": session.id,
214: "x-opencode-client": app.name,
215: })
216:
217: const promptCacheKey = (sessionID: SessionSchema.ID) =>
218: /^ses_[0-9a-f]{64}$/.test(sessionID) ? sessionID.slice(4) : ...
No files found
No files found
<path>/home/byk/Code/opencode-v2-pilot/packages/schema/src/config/provider.ts</path>
<type>file</type>
<content>
1: export * as ConfigProvider from "./provider.js"
2:
3: import { Schema } from "effect"
4: import { Money } from "../money.js"
5: import { Capabilities, Compatibility, Family, ID, VariantID } from "../model.js"
6: import { Provider } from "../provider.js"
7: import { optional } from "../schema.js"
8:
9: const JsonRecord = Schema.Record(Schema.String, Schema.Json)
10:
11: export const Overlays = {
12: settings: JsonRecord.pipe(optional),
13: headers: Schema.Record(Schema.String, Schema.String).pipe(optional),
14: body: JsonRecord.pipe(optional),
15: }
16:
17: export class Request extends Schema.Class<Request>("Config.Provider.Request")({
18: headers: Overlays.headers,
19: body: Overlays.body,
20: }) {}
21:
22: class Cache extends Schema.Class<Cache>("Config.Model.Cost.Cache")({
23: read: Money.USDPerMillionTokens.pipe(optional),
24: write: ...
Found 2 matches /home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/session.ts: Line 37: export type SessionRequestKind = "primary" | "compaction" | "title" | "generate" /home/byk/Code/opencode-v2-pilot/packages/plugin/src/effect/session.ts: Line 37: export type SessionRequestKind = "primary" | "compaction" | "title" | "generate"
Found 13 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/hooks.ts:
Line 4: import type { SessionHooks } from "@opencode/plugin/effect/session"
Line 13: export interface Domains {
Line 15: readonly session: SessionHooks
Line 24: interface Failures extends Record<keyof Domains, unknown> {
Line 26: readonly session: NoFailures<SessionHooks>
Line 43: readonly has: <Domain extends keyof Domains>(
Line 45: name: keyof Domains[Domain] & keyof Failures[Domain],
Line 48: readonly register: <Domain extends keyof Domains, Name extends keyof Domains[Domain] & keyof Failures[Domain]>(
Line 51: callback: Callback<Domains[Domain][Name], Failures[Domain][Name]>,
Line 54: readonly trigger: <Domain extends keyof Domains, Name extends keyof Domains[Domain] & keyof Failures[Domain]>(
Line 57: event: Domains[Domain][Name],
Line 58: ) => Effect.Effect<Domains[Domain][Name], Failures[Domain][Name]>
Line 67: const key = ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/hooks.ts</path>
<type>file</type>
<content>
1: export * as PluginHooks from "./hooks.js"
2:
3: import type { AISDKHooks } from "@opencode/plugin/effect/aisdk"
4: import type { SessionHooks } from "@opencode/plugin/effect/session"
5: import type { ShellHooks } from "@opencode/plugin/effect/shell"
6: import type { ToolFailures, ToolHooks } from "@opencode/plugin/effect/tool"
7: import type { ModelHookOptions } from "@opencode/plugin/effect/registration"
8: import type { PermissionHooks } from "@opencode/plugin/effect/permission"
9: import { Context, Effect, Layer, Scope } from "effect"
10: import { makeLocationNode } from "@opencode/util/effect/app-node"
11: import { State } from "../state.js"
12:
13: export interface Domains {
14: readonly aisdk: AISDKHooks
15: readonly session: SessionHooks
16: readonly permission: PermissionHooks
17: readonly shell: ShellHooks
18: readonly tool: ToolHooks
19: }
20:
21: type ...
Found 6 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/session/compaction.ts:
Line 87: auto: boolean
Line 139: readonly enabled: () => boolean
Line 176: initial: input.context.initial,
Line 377: initial: () => ({ auto: true, buffer: DEFAULT_BUFFER, tokens: DEFAULT_KEEP_TOKENS }),
Line 425: initial: context.initial,
Line 744: enabled: () => state.get().auto,
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/session/compaction.ts</path>
<type>file</type>
<content>
368: export const layer = Layer.effect(
369: Service,
370: Effect.gen(function* () {
371: const bus = yield* Bus.Service
372: const llm = yield* LLMClient.Service
373: const db = (yield* Database.Service).db
374:
375: const state = State.create<Settings, Editor>({
376: name: "session-compaction",
377: initial: () => ({ auto: true, buffer: DEFAULT_BUFFER, tokens: DEFAULT_KEEP_TOKENS }),
378: editor: (editor) => ({
379: configure: (settings) => {
380: if (settings.auto !== undefined) editor.auto = settings.auto
381: if (settings.buffer !== undefined) editor.buffer = settings.buffer
382: if (settings.tokens !== undefined) editor.tokens = settings.tokens
383: },
384: }),
385: })
386: const failed = Effect.fnUntraced(function* (input: {
387: readonly sessionID: ...
Found 100 matches (more matches available)
/home/byk/Code/opencode-v2-pilot/packages/sdk/test/instances-effect.test.ts:
Line 65: yield* ctx.agent.transform((editor) =>
/home/byk/Code/opencode-v2-pilot/packages/server/test/session-instances.test.ts:
Line 85: yield* ctx.agent.transform((editor) =>
/home/byk/Code/opencode-v2-pilot/packages/core/test/session-runner.test.ts:
Line 1692: yield* agent.transform((editor) =>
Line 1711: yield* agent.transform((editor) =>
Line 1727: yield* agent.transform((editor) => {
Line 1749: yield* agent.transform((editor) =>
/home/byk/Code/opencode-v2-pilot/packages/core/test/catalog.test.ts:
Line 41: yield* catalog.transform((editor) =>
Line 65: yield* catalog.transform((editor) =>
Line 90: yield* catalog.transform((editor) => editor.provider.update(Provider.ID.make("test"), () => {}))
Line 101: yield* catalog.transform((editor) ...
<path>/home/byk/.local/share/opencode-v2-pilot/config/opencode/package.json</path>
<type>file</type>
<content>
1: {
2: "private": true,
3: "type": "module",
4: "dependencies": {
5: "effect": "file:/home/byk/Code/opencode-v2-pilot/node_modules/.bun/effect@4.0.0-rc.112/node_modules/effect"
6: },
7: "devDependencies": {
8: "@types/bun": "1.2.21"
9: }
10: }
(End of file - total 10 lines)
</content>
<path>/home/byk/Code/opencode-lore/AGENTS.md</path> <type>file</type> <content> 1: <!-- This section is maintained by the coding agent via lore (https://github.com/BYK/loreai) --> 2: ## Long-term Knowledge 3: 4: For long-term knowledge entries managed by [lore](https://github.com/BYK/loreai) (gotchas, patterns, decisions, architecture), see [`.lore.md`](.lore.md) in the project root. 5: <!-- End lore-managed section --> 6: 7: ## Review 8: 9: See [`quality/REVIEW.md`](quality/REVIEW.md) for the review heuristics and workflow — regression-test discipline, adversarial-order state setup, fan-out registry coverage, recurring bug-class batteries, and the two-reviewer rule. Every non-trivial PR requires an adversarial correctness review before merge. 10: 11: # Project Overview 12: 13: Lore is a **three-tier memory architecture** for AI coding agents. ...
Found 59 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/wellknown.ts:
Line 62: const http = HttpClient.filterStatusOk(yield* HttpClient.HttpClient)
Line 87: const http = HttpClient.filterStatusOk(yield* HttpClient.HttpClient)
Line 104: const http = yield* HttpClient.HttpClient
Line 110: const manifest = yield* inspect(origin).pipe(Effect.provideService(HttpClient.HttpClient, http))
Line 180: resolveEntry(entry, variables).pipe(Effect.provideService(HttpClient.HttpClient, http)),
/home/byk/Code/opencode-v2-pilot/packages/core/src/tool/plugin/webfetch.ts:
Line 71: if (url.protocol !== "http:" && url.protocol !== "https:") throw new Error("URL must use http:// or https://")
Line 74: const execute = (http: HttpClient.HttpClient, url: string, format: Format, userAgent = openCodeUserAgent) =>
Line 106: const http = yield* HttpClient.HttpClient
/home/byk/Code/opencode-v2-pilot/packages/core/src/models-dev.ts:
Line 587: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/internal.ts</path>
<type>file</type>
<content>
90: import { VcsHgPlugin } from "./vcs/hg.js"
91: import { OptimizePlugin } from "./optimize.js"
92: import { VariantPlugin } from "./variant.js"
93: import { VcsGitPlugin } from "./vcs/git.js"
94: import { WarmingPlugin } from "./warming.js"
95: import { WellKnownPlugin } from "../wellknown/plugin.js"
96:
97: const services = [
98: Agent.Service,
99: AppProcess.Service,
100: Catalog.Service,
101: Command.Service,
102: Config.Service,
103: Credential.Service,
104: Bus.Service,
105: Environment.Service,
106: FileAccess.Service,
107: FileMutation.Service,
108: Formatter.Service,
109: LocationWatcherPolicy.Service,
110: FileSystem.Service,
111: FSUtil.Service,
112: Global.Service,
113: HttpClient.HttpClient,
114: Image.Service,
115: InstructionDiscovery.Service,
116: Integration.Service,
117: Job.Service,
118: KV.Service,
119: ...
Found 39 matches
/home/byk/Code/opencode-v2-pilot/packages/sdk/test/transport.test.ts:
Line 3: import { FetchHttpClient } from "effect/unstable/http"
Line 35: ).pipe(Effect.provideService(FetchHttpClient.Fetch, ambient))
Line 52: expect(yield* FetchHttpClient.Fetch).toBe(ambient)
Line 53: }).pipe(Effect.provideService(FetchHttpClient.Fetch, ambient))
Line 59: yield* client.health.get().pipe(Effect.provideService(FetchHttpClient.Fetch, ambient), Effect.exit),
/home/byk/Code/opencode-v2-pilot/packages/sdk/src/effect/opencode.ts:
Line 7: import { FetchHttpClient, HttpClient } from "effect/unstable/http"
Line 38: const httpClient = yield* HttpClient.HttpClient.pipe(Effect.provide(FetchHttpClient.layer))
Line 42: // FetchHttpClient reads Fetch at request time; callers must not replace this host's in-process transport.
Line 43: HttpClient.transformResponse(httpClient, Effect.provideService(FetchHttpClient.Fetch, ...
<path>/home/byk/Code/opencode-v2-pilot/packages/util/src/effect/app-node-platform.ts</path>
<type>file</type>
<content>
1: // Deep imports: the @effect/platform-node barrel eagerly pulls in undici,
2: // ioredis, and node:sqlite, which runtimes such as workerd cannot load.
3: import * as NodeFileSystem from "@effect/platform-node/NodeFileSystem"
4: import * as NodePath from "@effect/platform-node/NodePath"
5: import { FileSystem, Path } from "effect"
6: import { FetchHttpClient, HttpClient } from "effect/unstable/http"
7: import { makeGlobalNode } from "./app-node.js"
8:
9: export const filesystem = makeGlobalNode({ service: FileSystem.FileSystem, layer: NodeFileSystem.layer, deps: [] })
10: export const path = makeGlobalNode({ service: Path.Path, layer: NodePath.layer, deps: [] })
11: export const httpClient = makeGlobalNode({ service: HttpClient.HttpClient, layer: FetchHttpClient.layer, deps: [] })
12:
13: export * as LayerNodePlatform from "./app-node-platform.js"
(End of file - ...
<path>/home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/followup.ts</path>
<type>file</type>
<content>
1: import { Plugin } from "@opencode/plugin"
2: import { Schema } from "effect"
3:
4: const SUBAGENT_REFUSAL =
5: "Error: scheduled follow-ups are disabled in subagents. A subagent must finish its task and return a result synchronously."
6:
7: const DelayInput = Schema.Struct({
8: delay: Schema.String.annotate({
9: description: "How long to wait, such as 30s, 2m, or 1h. A bare number means seconds.",
10: }),
11: message: Schema.String.annotate({
12: description: "The instruction to deliver when the delay expires.",
13: }),
14: })
15:
16: const EmptyInput = Schema.Struct({})
17:
18: const CancelInput = Schema.Struct({
19: id: Schema.String.annotate({ description: "The follow-up ID to cancel, or all." }),
20: })
21:
22: export default Plugin.define({
23: id: "followup",
24: async setup(ctx) {
25: const pending = new Map<
26: string,
27: ...
Found 2 matches
/home/byk/Code/opencode-v2-pilot/packages/schema/src/model.ts:
Line 14: export const Ref = Schema.Struct({
Line 39: export interface Ref extends Schema.Schema.Type<typeof Ref> {}
<path>/home/byk/Code/opencode-v2-pilot/packages/schema/src/model.ts</path>
<type>file</type>
<content>
8: export const ID = Schema.String.pipe(Schema.brand("Model.ID"))
9: export type ID = typeof ID.Type
10:
11: export const VariantID = Schema.String.pipe(Schema.brand("Model.VariantID"))
12: export type VariantID = typeof VariantID.Type
13:
14: export const Ref = Schema.Struct({
15: id: ID,
16: providerID: Provider.ID,
17: variant: VariantID.pipe(optional),
18: })
19: .annotate({ identifier: "Model.Ref" })
20: .pipe(
21: statics((schema) => ({
22: parse: (input: string) => {
23: const providerEnd = input.indexOf("/")
24: if (providerEnd <= 0) throw new Error(`Invalid model reference: ${input}`)
25: const providerID = input.slice(0, providerEnd)
26: const variantStart = input.indexOf("#", providerEnd + 1)
27: const id = input.slice(providerEnd + 1, variantStart === -1 ? ...
Found 6 matches
/home/byk/.local/share/opencode/repos/github.com/Effect-TS/effect-smol/packages/effect/src/unstable/http/FetchHttpClient.ts:
Line 6: * runtimes, and Node.js environments where `globalThis.fetch` is available, or
Line 25: * Defaults to `globalThis.fetch`.
Line 30: export const Fetch = Context.Reference<typeof globalThis.fetch>("effect/http/FetchHttpClient/Fetch", {
Line 31: defaultValue: () => globalThis.fetch
Line 50: "effect/http/FetchHttpClient/RequestInit"
Line 102: * runtimes with `globalThis.fetch`.
<path>/home/byk/.local/share/opencode/repos/github.com/Effect-TS/effect-smol/packages/effect/src/unstable/http/FetchHttpClient.ts</path>
<type>file</type>
<content>
20: /**
21: * Context reference for the `fetch` implementation used by the fetch-based HTTP client.
22: *
23: * **Details**
24: *
25: * Defaults to `globalThis.fetch`.
26: *
27: * @category services
28: * @since 4.0.0
29: */
30: export const Fetch = Context.Reference<typeof globalThis.fetch>("effect/http/FetchHttpClient/Fetch", {
31: defaultValue: () => globalThis.fetch
32: })
33:
34: /**
35: * Service that contains default fetch options for the fetch-based HTTP client.
36: *
(Showing lines 20-36 of 123. Use offset=37 to continue.)
</content>
Found 12 matches
/home/byk/Code/opencode-lore/packages/gateway/src/server.ts:
Line 782: `Use loadConfig() or startGateway() for a fully-populated config.`,
Line 1254: // error still propagate to startGateway()'s port-fallback/reuse logic.
Line 1280: // file descriptors, then re-throw for startGateway() to handle.
Line 1293: // Collect all ready promises so startGateway() can await them.
Line 1428: // error surfaces when startGateway() awaits it.
/home/byk/Code/opencode-lore/packages/gateway/src/cli/start.ts:
Line 108: export interface GatewayHandle {
Line 868: export async function startGateway(
Line 1309: const { config, port, owned, shutdown, processShutdown } = await startGateway(
/home/byk/Code/opencode-lore/packages/gateway/src/cli/invariant-check.ts:
Line 228: const gateway = await startGateway(startOpts);
/home/byk/Code/opencode-lore/packages/gateway/src/cli/import.ts:
Line 1302: const { config, owned, shutdown } = ...
<path>/home/byk/Code/opencode-lore/packages/gateway/src/cli/start.ts</path>
<type>file</type>
<content>
100: * the gateway until healthy, prints the address + PID + log path, and exits 0.
101: * CLI: `--bg` / `--daemon`.
102: */
103: bg?: boolean;
104: /** @internal CLI-owned process boundary; never set by in-process plugins. */
105: processBoundary?: boolean;
106: }
107:
108: export interface GatewayHandle {
109: config: GatewayConfig;
110: port: number;
111: /** Whether this process owns the server (started it). False when reusing an existing instance. */
112: owned: boolean;
113: /** Owner-only token used to authenticate the gateway control endpoint. */
114: managementToken: string;
115: /** Shut down the gateway. No-op when `owned` is false. */
116: shutdown: () => Promise<void>;
117: /** @internal One-shot CLI process shutdown shared by signals and control. */
118: processShutdown?: ProcessShutdownController;
119: }
120:
121: export interface ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/config/normalize.ts</path>
<type>file</type>
<content>
320: encoded: Record<string, unknown>,
321: diagnostics: Diagnostic[],
322: ) {
323: if (!own(input, "compaction")) return
324: if (!isRecord(input.compaction)) {
325: invalid(["compaction"], diagnostics)
326: return
327: }
328: unsupportedIfPresent(input.compaction, "tail_turns", ["compaction", "tail_turns"], diagnostics)
329: unsupportedIfPresent(input.compaction, "prune", ["compaction", "prune"], diagnostics)
330: const result: Record<string, unknown> = {}
331: if (own(input.compaction, "auto")) {
332: const value = decodeEncoded(
333: ConfigCompaction.Info.fields.auto,
334: input.compaction.auto,
335: ["compaction", "auto"],
336: diagnostics,
337: )
338: if (value !== undefined) result.auto = value
339: }
340: const legacyTokens = own(input.compaction, "preserve_recent_tokens")
341: ? ...
<path>/home/byk/Code/opencode-lore/packages/opencode/test/index.test.ts</path>
<type>file</type>
<content>
1: import { describe, test, expect } from "vitest";
2: import { fileURLToPath } from "node:url";
3: import { LorePlugin } from "../src/index";
4: import { applyLoreProviderConfig } from "../src/internal";
5: import type { Plugin } from "@opencode-ai/plugin";
6:
7: /**
8: * Minimal mock of the OpenCode client. Only stubs the methods the plugin
9: * actually calls during initialization.
10: */
11: function createMockClient() {
12: return {
13: tui: {
14: showToast: () => Promise.resolve(),
15: },
16: session: {
17: get: () => Promise.resolve({ data: {} }),
18: list: () => Promise.resolve({ data: [] }),
19: create: () => Promise.resolve({ data: { id: "worker_1" } }),
20: messages: () => Promise.resolve({ data: [] }),
21: message: () => Promise.resolve({ data: null }),
22: prompt: () => Promise.resolve({ data: {} }),
23: ...
Found 12 matches
/home/byk/Code/opencode-lore/packages/opencode/test/index.test.ts:
Line 158: defaultHeaders: { "X-Custom": "value" },
Line 170: expect(options.defaultHeaders).toEqual({ "X-Custom": "value" });
Line 173: test("disables OpenCode's default OpenAI header timeout when Lore routes the provider", () => {
Line 278: describe("plugin entry module export shape", () => {
Line 287: // named `LorePlugin` and the same-reference `default`) — nothing else.
Line 288: test("exports only the plugin (LorePlugin + same-ref default)", async () => {
Line 291: // The default export must be the LorePlugin function reference.
Line 292: expect(typeof mod.default).toBe("function");
Line 293: expect(mod.default).toBe(mod.LorePlugin);
Line 295: // The ONLY export keys allowed are `LorePlugin` and `default`. Any other
Line 300: expect(Object.keys(mod).sort()).toEqual(["LorePlugin", "default"]);
Line 303: // host invokes ...
<path>/home/byk/Code/opencode-lore/packages/opencode/test/index.test.ts</path>
<type>file</type>
<content>
270: expect(hooks["experimental.chat.messages.transform"]).toBeUndefined();
271: expect(hooks["experimental.session.compacting"]).toBeUndefined();
272: } finally {
273: cleanup();
274: }
275: });
276: });
277:
278: describe("plugin entry module export shape", () => {
279: // Regression guard for the v1.17.4 crash (`undefined is not an object
280: // (evaluating 'A.event')`). OpenCode's legacy plugin loader iterates
281: // `Object.values(mod)` (`getLegacyPlugins`/`getServerPlugin`): every
282: // FUNCTION export is invoked as a plugin (and its return value pushed into
283: // the host hooks array — `applyLoreProviderConfig` returned `undefined`,
284: // which then crashed the dispatch loops), and every NON-function export
285: // makes the loader throw `Plugin export is not a function`, dropping the
286: // plugin entirely. ...
No files found
Found 3 matches
/home/byk/.opencode/node_modules/@opencode-ai/plugin/dist/index.d.ts:
Line 10: export type PluginInput = {
Line 18: export type Plugin = (input: PluginInput) => Promise<Hooks>;
Line 108: export interface Hooks {
<path>/home/byk/.opencode/node_modules/@opencode-ai/plugin/dist/index.d.ts</path>
<type>file</type>
<content>
1: import type { Event, createOpencodeClient, Project, Model, Provider, Permission, UserMessage, Message, Part, Auth, Config } from "@opencode-ai/sdk";
2: import type { BunShell } from "./shell";
3: import { type ToolDefinition } from "./tool";
4: export * from "./tool";
5: export type ProviderContext = {
6: source: "env" | "config" | "custom" | "api";
7: info: Provider;
8: options: Record<string, any>;
9: };
10: export type PluginInput = {
11: client: ReturnType<typeof createOpencodeClient>;
12: project: Project;
13: directory: string;
14: worktree: string;
15: serverUrl: URL;
16: $: BunShell;
17: };
18: export type Plugin = (input: PluginInput) => Promise<Hooks>;
19: export type AuthHook = {
20: provider: string;
21: loader?: (auth: () => Promise<Auth>, provider: Provider) => Promise<Record<string, any>>;
22: methods: ({
23: ...
Found 3 matches /home/byk/Code/opencode-lore/packages/core/package.json: Line 7: "main": "./dist/node/index.js", Line 8: "types": "./dist/node/index.d.ts", Line 11: "types": "./dist/types/index.d.ts",
<path>/home/byk/Code/opencode-lore/packages/core/package.json</path>
<type>file</type>
<content>
1: {
2: "name": "@loreai/core",
3: "version": "0.40.0",
4: "type": "module",
5: "license": "FSL-1.1-Apache-2.0",
6: "description": "Shared memory engine for Lore — three-tier storage, distillation, gradient context management",
7: "main": "./dist/node/index.js",
8: "types": "./dist/node/index.d.ts",
9: "exports": {
10: ".": {
11: "types": "./dist/types/index.d.ts",
12: "development": "./src/index.ts",
13: "bun": "./dist/bun/index.js",
14: "default": "./dist/node/index.js"
15: }
16: },
17: "imports": {
18: "#db/driver": {
19: "bun": "./src/db/driver.bun.ts",
20: "default": "./src/db/driver.node.ts"
21: }
22: },
23: "scripts": {
24: "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.eval.json",
25: "build": "tsx script/build.ts"
26: },
27: "dependencies": {
28: "@hpke/core": "^1.9.0",
29: ...
<path>/home/byk/Code/opencode-lore/packages/gateway/package.json</path>
<type>file</type>
<content>
1: {
2: "name": "@loreai/gateway",
3: "version": "0.40.0",
4: "type": "module",
5: "license": "FSL-1.1-Apache-2.0",
6: "description": "Lore as a transparent LLM proxy — context management for any AI coding client",
7: "main": "./dist/index.cjs",
8: "types": "./dist/index.d.cts",
9: "exports": {
10: ".": {
11: "types": "./dist/index.d.cts",
12: "bun": "./dist/index.bun.js",
13: "require": "./dist/index.cjs",
14: "default": "./dist/index.cjs"
15: }
16: },
17: "bin": {
18: "lore": "./dist/bin.cjs",
19: "lore-gateway": "./dist/bin.cjs"
20: },
21: "scripts": {
22: "typecheck": "tsc --noEmit",
23: "build": "tsx script/build.ts",
24: "bundle": "tsx script/bundle.ts",
25: "build:binary": "tsx script/build.ts --binary",
26: "build:binary:sea": "tsx script/build-binary-sea.ts",
27: "start": "tsx ...
<path>/home/byk/.local/share/opencode/repos/github.com/Effect-TS/effect-smol/packages/effect/src/unstable/http/FetchHttpClient.ts</path> <type>file</type> <content> 90: } 91: return send(undefined) 92: }) 93: 94: /** 95: * Layer that provides an `HttpClient` implementation backed by the configured 96: * `Fetch` function. 97: * 98: * **When to use** 99: * 100: * Use when an Effect program should execute `HttpClient` requests through the 101: * platform `fetch` implementation, especially in browser, edge, or Node.js 102: * runtimes with `globalThis.fetch`. 103: * 104: * **Details** 105: * 106: * The layer uses the current `Fetch` reference and optional `RequestInit` 107: * service for each request. Request-specific method, headers, body, and abort 108: * signal are supplied by the client and override matching `RequestInit` fields. ...
<path>/home/byk/.local/share/opencode/repos/github.com/Effect-TS/effect-smol/packages/effect/src/unstable/http/FetchHttpClient.ts</path>
<type>file</type>
<content>
55: const options: globalThis.RequestInit = fiber.context.mapUnsafe.get(RequestInit.key) ?? {}
56: let headers = options.headers ? Headers.merge(Headers.fromInput(options.headers), request.headers) : request.headers
57: if (headers["content-length"]) {
58: headers = Headers.remove(headers, "content-length")
59: }
60: const send = (body: BodyInit | undefined) =>
61: Effect.map(
62: Effect.tryPromise({
63: try: () =>
64: fetch(url, {
65: ...options,
66: method: request.method,
67: headers,
68: body,
69: duplex: request.body._tag === "Stream" ? "half" : undefined,
70: signal
71: } as any),
72: catch: (cause) =>
73: new HttpClientError.HttpClientError({
74: reason: new ...
<path>/home/byk/.local/share/opencode/repos/github.com/Effect-TS/effect-smol/packages/effect/src/unstable/http/FetchHttpClient.ts</path>
<type>file</type>
<content>
42: * **Details**
43: *
44: * Request-specific method, headers, body, and abort signal are supplied by the client when a request is executed.
45: *
46: * @category services
47: * @since 4.0.0
48: */
49: export class RequestInit extends Context.Service<RequestInit, globalThis.RequestInit>()(
50: "effect/http/FetchHttpClient/RequestInit"
51: ) {}
52:
53: const fetch: HttpClient.HttpClient = HttpClient.make((request, url, signal, fiber) => {
54: const fetch = fiber.getRef(Fetch)
55: const options: globalThis.RequestInit = fiber.context.mapUnsafe.get(RequestInit.key) ?? {}
56: let headers = options.headers ? Headers.merge(Headers.fromInput(options.headers), request.headers) : request.headers
57: if (headers["content-length"]) {
58: headers = Headers.remove(headers, "content-length")
59: }
60: const ...
<path>/home/byk/Code/opencode-lore/pnpm-lock.yaml</path> <type>file</type> <content> 210: tar: 211: specifier: '>=7.5.19' 212: version: 7.5.21 213: undici: 214: specifier: ^8.9.0 215: version: 8.9.0 216: 217: packages/opencode: 218: dependencies: 219: '@loreai/core': 220: specifier: workspace:* 221: version: link:../core 222: '@loreai/gateway': 223: specifier: workspace:* 224: version: link:../gateway 225: devDependencies: 226: '@opencode-ai/plugin': 227: specifier: ^1.1.39 228: version: 1.2.15 229: '@opencode-ai/sdk': 230: specifier: ^1.1.39 231: version: 1.2.15 232: '@types/bun': 233: specifier: ^1.2.0 234: version: 1.3.9 235: 236: packages/pi: 237: dependencies: 238: '@loreai/core': 239: specifier: workspace:* (Showing lines 210-239 of 10805. Use offset=240 to continue.) </content>
Found 3 matches
/home/byk/Code/opencode-v2-pilot/packages/ai/src/providers/anthropic.ts:
Line 6: import { AnthropicMessages } from "../protocols/anthropic-messages.js"
Line 44: baseURL: baseURL ?? AnthropicMessages.DEFAULT_BASE_URL,
Line 63: baseURL: settings.baseURL,
<path>/home/byk/Code/opencode-v2-pilot/packages/ai/src/providers/anthropic.ts</path>
<type>file</type>
<content>
32: const auth = (options: ProviderAuthOption<"optional">) => {
33: if ("auth" in options && options.auth) return options.auth
34: return Auth.optional("apiKey" in options ? options.apiKey : undefined, "apiKey")
35: .orElse(Auth.config("ANTHROPIC_API_KEY"))
36: .pipe(Auth.header("x-api-key"))
37: }
38:
39: export const configure = (input: Config = {}) => {
40: const { apiKey: _, auth: _auth, baseURL, ...rest } = input
41: const compatible = AnthropicCompatible.configure({
42: ...rest,
43: auth: auth(input),
44: baseURL: baseURL ?? AnthropicMessages.DEFAULT_BASE_URL,
45: provider: id,
46: })
47: return {
48: id,
49: model: (modelID: string | ModelID) => compatible.model(modelID),
50: configure,
51: }
52: }
53:
54: export const provider = configure()
55: export const model: ProviderPackage.Definition<Settings, ...
Found 6 matches
/home/byk/Code/opencode-v2-pilot/packages/ai/src/providers/anthropic-compatible.ts:
Line 17: readonly baseURL: string
Line 26: readonly baseURL: string
Line 39: if (!input.baseURL) throw new Error("Anthropic-compatible providers require a baseURL")
Line 41: const { provider: _, baseURL, apiKey: _apiKey, auth: _auth, ...rest } = input
Line 45: endpoint: { baseURL },
Line 68: baseURL: settings.baseURL,
<path>/home/byk/Code/opencode-v2-pilot/packages/ai/src/providers/anthropic-compatible.ts</path>
<type>file</type>
<content>
34: if ("auth" in input && input.auth) return input.auth
35: return Auth.optional("apiKey" in input ? input.apiKey : undefined, "apiKey").pipe(Auth.header("x-api-key"))
36: }
37:
38: export const configure = (input: Config) => {
39: if (!input.baseURL) throw new Error("Anthropic-compatible providers require a baseURL")
40: const provider = input.provider ?? "anthropic-compatible"
41: const { provider: _, baseURL, apiKey: _apiKey, auth: _auth, ...rest } = input
42: const route = AnthropicMessages.route.with({
43: ...rest,
44: provider,
45: endpoint: { baseURL },
46: auth: auth(input),
47: })
48: return {
49: id: ProviderID.make(provider),
50: model: (modelID: string | ModelID) => route.model<AnthropicMessages.ProviderOptionsInput>({ id: modelID }),
51: configure,
52: }
53: }
54:
55: export const provider = {
56: ...
Found 3 matches /home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/provider/anthropic.ts: Line 10: if (!Provider.isAISDK(item.provider.package)) continue Line 11: if (Provider.packageName(item.provider.package) !== "@ai-sdk/anthropic") continue Line 23: if (evt.package !== "@ai-sdk/anthropic") return
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/provider/anthropic.ts</path>
<type>file</type>
<content>
1: import { Effect } from "effect"
2: import { define } from "@opencode/plugin/effect/plugin"
3: import { Provider } from "../../provider.js"
4:
5: export const AnthropicPlugin = define({
6: id: "opencode.provider.anthropic",
7: effect: Effect.fn(function* (ctx) {
8: yield* ctx.catalog.transform((evt) => {
9: for (const item of evt.provider.list()) {
10: if (!Provider.isAISDK(item.provider.package)) continue
11: if (Provider.packageName(item.provider.package) !== "@ai-sdk/anthropic") continue
12: evt.provider.update(item.provider.id, (provider) => {
13: provider.headers = {
14: ...provider.headers,
15: "anthropic-beta": "interleaved-thinking-2025-05-14,fine-grained-tool-streaming-2025-05-14",
16: }
17: })
18: }
19: })
20: yield* ctx.aisdk.hook(
21: ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/app.ts</path>
<type>file</type>
<content>
1: export interface App {
2: readonly name: string
3: readonly version: string
4: readonly channel: string
5: }
(End of file - total 5 lines)
</content>
Found 40 matches
/home/byk/Code/opencode-v2-pilot/packages/ai/src/protocols/anthropic-messages.ts:
Line 35: const ADAPTER = "anthropic-messages"
Line 36: export const DEFAULT_BASE_URL = "https://api.anthropic.com/v1"
Line 37: export const PATH = "/messages"
Line 356: messages: Schema.Array(AnthropicMessage),
Line 475: // across `tools`, `system`, and `messages`. Beyond the cap the API returns a
Line 779: const baseURL = (request.model.route.endpoint.baseURL ?? "").toLowerCase()
Line 785: baseURL.includes("api.kimi.com/coding") ||
Line 786: baseURL.includes("api.moonshot.ai/anthropic") ||
Line 787: baseURL.includes("api.moonshot.cn/anthropic")
Line 790: if (provider.includes("xiaomi") || model.includes("mimo") || baseURL.includes("xiaomimimo.com")) return false
Line 794: // Mid-conversation system messages became available with Opus 4.8 and version
Line 808: const endsInServerToolUse = (message: LLMRequest["messages"][number]) => {
...
<path>/home/byk/Code/opencode-v2-pilot/packages/ai/src/protocols/anthropic-messages.ts</path>
<type>file</type>
<content>
1668: }
1669:
1670: export const route = Route.make({
1671: id: ADAPTER,
1672: provider: "anthropic",
1673: providerMetadataKey: "anthropic",
1674: protocol,
1675: endpoint: Endpoint.path((input) => (input.request.model.provider === "anthropic" ? `${PATH}?beta=true` : PATH), {
1676: baseURL: DEFAULT_BASE_URL,
1677: }),
1678: auth: Auth.none,
1679: transport: transport<AnthropicMessagesBody>(),
1680: headers: () => ({ "anthropic-version": "2023-06-01" }),
1681: })
1682:
1683: export * as AnthropicMessages from "./anthropic-messages.js"
(End of file - total 1683 lines)
</content>
<path>/home/byk/Code/opencode-lore/package.json</path>
<type>file</type>
<content>
1: {
2: "name": "lore-monorepo",
3: "private": true,
4: "type": "module",
5: "license": "FSL-1.1-Apache-2.0",
6: "description": "Monorepo root for Lore — three-tier memory architecture",
7: "main": "./packages/opencode/src/index.ts",
8: "exports": {
9: ".": "./packages/opencode/src/index.ts"
10: },
11: "packageManager": "pnpm@10.28.0",
12: "volta": {
13: "node": "24.16.0",
14: "pnpm": "10.28.0"
15: },
16: "pnpm": {
17: "onlyBuiltDependencies": [
18: "esbuild",
19: "onnxruntime-node",
20: "sharp"
21: ],
22: "overrides": {
23: "basic-ftp": "5.3.1",
24: "ip-address": "10.2.0",
25: "fast-xml-parser": "5.7.3",
26: "@huggingface/hub": "2.11.0",
27: "onnxruntime-node": "1.27.0",
28: "yaml": ">=2.8.3",
29: "esbuild": ">=0.28.1",
30: "@opentelemetry/core": ">=2.8.0",
31: "protobufjs": ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/config/plugin/provider.ts</path>
<type>file</type>
<content>
1: export * as ConfigProviderPlugin from "./provider.js"
2:
3: import { define } from "@opencode/plugin/effect/plugin"
4: import { Document, type Entry } from "@opencode/schema/config"
5: import { Money } from "@opencode/schema/money"
6: import { Effect } from "effect"
7: import { Config } from "../../config.js"
8: import { Provider } from "../../provider.js"
9: import { ConfigEntryObserver } from "./entry-observer.js"
10:
11: export const Plugin = define({
12: id: "opencode.config.provider",
13: effect: Effect.fn(function* (ctx) {
14: const config = yield* Config.Service
15: const loaded = yield* ConfigEntryObserver.observe(
16: config,
17: ctx.event,
18: ctx.integration.reload().pipe(Effect.andThen(ctx.catalog.reload())),
19: )
20: yield* ctx.integration.transform((integrations) => {
21: for (const [id, provider] of ...
Found 30 matches
/home/byk/Code/opencode-v2-pilot/packages/core/test/tool-registry.test.ts:
Line 1081: it.effect("executes the tool advertised in a model request", () =>
Line 1108: it.effect("executes and reports progress for codemode tools advertised in a model request", () =>
/home/byk/Code/opencode-v2-pilot/packages/core/test/session-title.test.ts:
Line 276: yield* hooks.register("session", "model.request", (event) =>
/home/byk/Code/opencode-v2-pilot/packages/core/test/session-runner.test.ts:
Line 564: // Pause coordinated Session.resume at its first model request, not a direct runner drain.
Line 587: // Subscribe before resuming; model requests can arrive before retry backoff is scheduled.
Line 1517: yield* hooks.register("session", "model.request", (event) =>
Line 1770: scenario("fails before the model request when the selected agent is unavailable", function* (s) {
Line 2405: yield* hooks.register("session", "model.request", ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/test/session-model-request-hooks.test.ts</path>
<type>file</type>
<content>
1: import { describe, expect } from "bun:test"
2: import { OpenAIChat } from "@opencode/ai/protocols"
3: import { Agent } from "@opencode/schema/agent"
4: import { Money } from "@opencode/schema/money"
5: import { Session } from "@opencode/schema/session"
6: import type { SessionRequestKind } from "@opencode/plugin/effect/session"
7: import { Location } from "@opencode/core/location"
8: import { PluginHooks } from "@opencode/core/plugin/hooks"
9: import { Project } from "@opencode/core/project"
10: import { AbsolutePath } from "@opencode/core/schema"
11: import { SessionModelRequest } from "@opencode/core/session/model-request"
12: import { SessionModelTransport } from "@opencode/core/session/model-transport"
13: import { SessionRunnerModel } from "@opencode/core/session/runner/model"
14: import { DateTime, Effect } from "effect"
15: import { ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts</path> <type>file</type> <content> 225: ) 226: const AgentEndpoints = ClientApi.groups["server.agent"].endpoints 227: const CommandEndpoints = ClientApi.groups["server.command"].endpoints 228: const ExperimentalEndpoints = ClientApi.groups["server.experimental"].endpoints 229: const GenerateEndpoints = ClientApi.groups["server.generate"].endpoints 230: const IntegrationEndpoints = ClientApi.groups["server.integration"].endpoints 231: const McpEndpoints = ClientApi.groups["server.mcp"].endpoints 232: const ModelEndpoints = ClientApi.groups["server.model"].endpoints 233: const PluginEndpoints = ClientApi.groups["server.plugin"].endpoints 234: const PermissionEndpoints = ClientApi.groups["server.permission"].endpoints 235: const ProviderEndpoints = ClientApi.groups["server.provider"].endpoints 236: const ...
/home/byk/Code/opencode-lore/packages/opencode/test/index.test.ts /home/byk/Code/opencode-lore/packages/opencode/test/routing.e2e.test.ts /home/byk/Code/opencode-lore/packages/opencode/test/internal.test.ts /home/byk/Code/opencode-lore/packages/opencode/test/gateway-smoke.test.ts /home/byk/Code/opencode-lore/packages/opencode/test/subagent-detection.test.ts /home/byk/Code/opencode-lore/packages/opencode/test/tui-silence.test.ts /home/byk/Code/opencode-lore/packages/opencode/test/session-state.test.ts
Found 57 matches
/home/byk/Code/opencode-lore/packages/opencode/test/routing.e2e.test.ts:
Line 208: expect(output.headers["x-lore-agent"]).toBe("build");
Line 226: "x-lore-agent": "build",
/home/byk/Code/opencode-lore/packages/opencode/test/session-state.test.ts:
Line 119: expect(output.headers["x-lore-agent"]).toBe("coder");
/home/byk/Code/opencode-lore/packages/opencode/src/index.ts:
Line 387: output.headers["x-lore-agent"] = input.agent;
/home/byk/Code/opencode-lore/packages/gateway/test/session-retention.test.ts:
Line 61: "x-lore-agent": "coder",
/home/byk/Code/opencode-lore/packages/gateway/test/recall-exhaustion.test.ts:
Line 277: "x-lore-agent": "coder",
/home/byk/Code/opencode-lore/packages/gateway/test/recall-buffered-transaction.test.ts:
Line 732: "x-lore-agent": "coder",
/home/byk/Code/opencode-lore/packages/gateway/test/pipeline-streaming.test.ts:
Line 296: "x-lore-agent": "coder",
Line ...
<path>/home/byk/Code/opencode-lore/packages/gateway/src/compaction.ts</path>
<type>file</type>
<content>
360: */
361: export function extractPreviousSummary(
362: req: GatewayRequest,
363: ): string | undefined {
364: const userText = lastUserText(req);
365: const match = PREVIOUS_SUMMARY_RE.exec(userText);
366: return match?.[1] ?? undefined;
367: }
368:
369: // ---------------------------------------------------------------------------
370: // isMetaRequest (replaces isTitleOrSummaryRequest)
371: // ---------------------------------------------------------------------------
372:
373: /** Header injected by the OpenCode plugin identifying the calling agent. */
374: export const LORE_AGENT_HEADER = "x-lore-agent";
375:
376: /**
377: * Agent names known to be primary conversation agents (NOT meta).
378: * When `x-lore-agent` matches, the request is always a normal turn. ...
Found 24 matches /home/byk/Code/opencode-lore/packages/gateway/src/compaction.ts: Line 4: * Claude Code (and other clients using the same pattern) sends compaction Line 10: * `packages/opencode/src/agent/prompt/compaction.txt` and the Line 20: /** System prompt substrings that identify a compaction agent. */ Line 25: /** Last user message substrings that indicate a compaction request. */ Line 33: * Template section headers found in the `<template>` block of a compaction Line 35: * considered a compaction request. Line 76: // Usage scaling — prevent client auto-compaction in hosted gateway scenarios Line 93: * models can trigger premature compaction. Line 107: /** Tokens Claude Code reserves for the compaction summary output. */ Line 114: * Retained for cost-tracker's counterfactual "avoided compactions" estimate. ...
<path>/home/byk/Code/opencode-lore/packages/gateway/src/compaction.ts</path>
<type>file</type>
<content>
255: }
256: : {}),
257: };
258: }
259:
260: // ---------------------------------------------------------------------------
261: // isStructuralCompaction — session-aware detection
262: // ---------------------------------------------------------------------------
263:
264: /**
265: * Detect compaction via structural session signals — no prompt pattern
266: * matching needed. Works regardless of compaction prompt format changes.
267: *
268: * Signal: a known session previously had many messages (>10), but the
269: * current request has very few (≤3) — a >50 % drop. This is the
270: * hallmark of Claude Code replacing its entire message history with a
271: * compaction summary.
272: */
273: export function isStructuralCompaction(
274: req: GatewayRequest,
275: priorState?: { messageCount: number },
276: ): boolean {
277: if (!priorState || ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/agent.ts</path>
<type>file</type>
<content>
1: export * as AgentPlugin from "./agent.js"
2:
3: import { define } from "@opencode/plugin/effect/plugin"
4: import { Effect } from "effect"
5: import { Agent } from "../agent.js"
6: import { Permission } from "../permission.js"
7:
8: const PROMPT_EXPLORE = `You are a file search specialist. You excel at thoroughly navigating and exploring codebases.
9:
10: Your strengths:
11: - Rapidly finding files using glob patterns
12: - Searching code and text with powerful regex patterns
13: - Reading and analyzing file contents
14:
15: Guidelines:
16: - Use Glob for broad file pattern matching
17: - Use Grep for searching file contents with regex
18: - Use Read when you know the specific file path you need to read
19: - Adapt your search approach based on the thoroughness level specified by the caller
20: - Return file paths as absolute paths in your final response
21: - For clear ...
Found 3 matches
/home/byk/Code/opencode-lore/packages/core/src/fetch-interceptor.ts:
Line 204: function interceptUrl(upstream: URL, gateway: URL): Rewrite | null {
Line 240: export function interceptUrlForProtocol(
Line 281: export function shouldIntercept(url: string, gatewayBase: string): boolean {
<path>/home/byk/Code/opencode-lore/packages/core/src/fetch-interceptor.ts</path>
<type>file</type>
<content>
174: }
175:
176: return null;
177: } catch {
178: return null;
179: }
180: }
181:
182: type Rewrite = {
183: gatewayUrl: string;
184: upstreamBase: string;
185: /**
186: * The client's ORIGINAL upstream endpoint pathname (e.g. `/chat/completions`,
187: * `/v1/messages`, or a prefixed `/api/v1/chat/completions`). Forwarded to the
188: * gateway as `x-lore-upstream-path` so it can POST to the exact endpoint the
189: * SDK intended instead of synthesizing a canonical `/v1/...` path. This is the
190: * full pathname (NOT the post-base suffix) so the gateway can reconstruct the
191: * original URL as `origin(base) + pathname` regardless of any base prefix —
192: * required for providers whose endpoint omits `/v1` (GitHub Copilot's
193: * `/chat/completions`, issue #1052) or uses a non-standard prefix. ...
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/source.node.ts</path>
<type>file</type>
<content>
1: import { registerHooks } from "node:module"
2: import path from "node:path"
3: import { fileURLToPath } from "node:url"
4: import { localSource } from "./source.js"
5: import { Host } from "./host.js"
6:
7: let generation = Date.now()
8:
9: export async function prepareSource(entrypoint: string, track: (file: string, directory?: boolean) => void) {
10: const version = String(++generation)
11: const fresh = (specifier: string) => {
12: const url = new URL(specifier)
13: url.searchParams.set("__opencode_reload", version)
14: return url.href
15: }
16: const hook = registerHooks({
17: resolve(specifier, context, nextResolve) {
18: if (!context.parentURL || new URL(context.parentURL).searchParams.get("__opencode_reload") !== version)
19: return nextResolve(specifier, context)
20: const local =
21: specifier.startsWith("./") || ...
/home/byk/Code/opencode-lore/vitest.config.ts /home/byk/Code/opencode-lore/vitest.mutation.config.ts /home/byk/Code/opencode-lore/vitest.evals.config.ts
<path>/home/byk/Code/opencode-lore/vitest.config.ts</path>
<type>file</type>
<content>
1: import { defineConfig } from "vitest/config";
2: import path from "node:path";
3:
4: export default defineConfig({
5: // Alias @loreai/core and @loreai/gateway for test imports.
6: // MUST be at the top level of the vite config — putting this under
7: // `test.resolve.alias` does NOT work (vite's resolver is a top-level
8: // option, not a test.* option). The previous placement silently
9: // resolved to the stale dist build, masking real test failures.
10: resolve: {
11: alias: {
12: "@loreai/core": path.resolve(__dirname, "packages/core/src"),
13: "@loreai/gateway": path.resolve(__dirname, "packages/gateway/src"),
14: },
15: },
16: test: {
17: // Run all packages' tests
18: include: [
19: "packages/core/test/**/*.test.ts",
20: // Fast, pure unit tests for the eval suite's own logic (scorers,
21: // analysis). ...
/home/byk/Code/opencode-v2-pilot/packages/plugin/test/host.test.ts
Found 1 matches /home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/session.ts: Line 37: export type SessionRequestKind = "primary" | "compaction" | "title" | "generate"
No files found
<path>/home/byk/Code/opencode-v2-pilot/packages/core/test/plugin.test.ts</path>
<type>file</type>
<content>
100: )
101:
102: it.live("loads a local plugin with its configured options", () =>
103: Effect.gen(function* () {
104: const plugins = yield* Plugin.Service
105: const commands = yield* Command.Service
106: yield* plugins.awaitActivation
107: const modules = yield* PluginModule.make().pipe(Effect.provide(Watcher.testLayer))
108: const definition = yield* modules.load({
109: type: "add",
110: target: path.join(import.meta.dir, "plugin/fixtures/greeting.ts"),
111: options: { description: "Configured greeting" },
112: })
113: if ("pending" in definition) return yield* Effect.die("Local plugin was not loaded")
114: yield* plugins.activate([definition])
115:
116: expect(yield* commands.get("greet")).toMatchObject({ description: "Configured greeting" })
117: }),
118: )
119:
120: it.effect("unloading a plugin removes its ...
<path>/home/byk/Code/opencode-v2-pilot/packages/core/test/plugin/fixtures/greeting.ts</path>
<type>file</type>
<content>
1: import { Plugin } from "@opencode/plugin"
2:
3: export default Plugin.define({
4: id: "greeting",
5: async setup(ctx) {
6: await ctx.command.transform((editor) =>
7: editor.add({
8: name: "greet",
9: description: ctx.options.description,
10: execute: async () => {},
11: }),
12: )
13: },
14: })
(End of file - total 14 lines)
</content>
/home/byk/Code/opencode-lore/packages/opencode/tsconfig.json
<path>/home/byk/Code/opencode-lore/packages/opencode/tsconfig.json</path>
<type>file</type>
<content>
1: {
2: "extends": "../../tsconfig.base.json",
3: "compilerOptions": {
4: "noEmit": true,
5: "types": ["bun"],
6: "paths": {
7: "@loreai/core": ["../core/src/index.ts"]
8: }
9: },
10: "include": ["src", "test", "script", "scripts", "eval"]
11: }
(End of file - total 11 lines)
</content>
<path>/home/byk/.local/share/opencode-v2-pilot/config/opencode/service-v2-pilot.json</path>
<type>file</type>
<content>
1: {
2: "hostname": "127.0.0.1",
3: "port": 14104,
4: "password": "0ZEDypl6r2V8gYMw+bfbOvabqO7NvvaG6+m/NvAHxJg="
5: }
(End of file - total 5 lines)
</content>
<path>/home/byk/Code/opencode-v2-pilot/packages/schema/src/config.ts</path>
<type>file</type>
<content>
60: snapshots: Schema.Boolean.pipe(optional).annotate({
61: description: "Enable snapshots used for undo and revert behavior",
62: }),
63: watcher: ConfigWatcher.Info.pipe(optional).annotate({
64: description: "Filesystem watcher configuration",
65: }),
66: formatter: ConfigFormatter.Info.pipe(optional).annotate({
67: description: "Enable built-in formatters or configure formatter overrides",
68: }),
69: lsp: ConfigLSP.Info.pipe(optional).annotate({
70: description: "Enable built-in language servers or configure server overrides",
71: }),
72: media: ConfigMedia.Info.pipe(optional).annotate({
73: description: "Media processing configuration",
74: }),
75: tool_output: ConfigToolOutput.Info.pipe(optional).annotate({
76: description: "Tool output truncation thresholds",
77: }),
78: mcp: ConfigMCP.Info.pipe(optional).annotate({
79: ...
Found 22 matches /home/byk/.local/share/opencode-v2-pilot/data/opencode/log/opencode.log: Line 48: timestamp=2026-09-08T18:40:37.500Z level=INFO run=9386f4fa msg="loading plugin" id=/home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/followup.ts entrypoint=file:///home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/followup.ts http.span=185 role=server Line 49: timestamp=2026-09-08T18:40:38.045Z level=INFO run=9386f4fa message="watcher subscribe" path=/home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/followup.ts type=file ignores=0 http.span=730 role=server Line 50: timestamp=2026-09-08T18:40:38.045Z level=INFO run=9386f4fa message="watcher started" path=/home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/followup.ts type=file backend=node ignores=0 http.span=730 role=server Line 51: timestamp=2026-09-08T18:40:38.047Z level=INFO run=9386f4fa msg="loading plugin" ...
Found 5 matches
/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin.ts:
Line 15: export { awaitActivation, type Generation, type Interface, Service } from "./plugin/service.js"
Line 167: yield* Effect.logError("failed to restore plugin; deactivating", {
Line 225: Effect.logError("failed to report disabled plugin", {
Line 253: awaitActivation: ready.await,
Line 290: state: failure === undefined ? { status: "active" } : { status: "failed", ...failure },
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin.ts</path>
<type>file</type>
<content>
115: if (entry) active.set(definition.id, { ...entry, plugin: definition })
116: }
117: if (prefix === definitions.length && active.size === definitions.length) {
118: const nextInventory = [...Array.from(active.values()).map(slotInfo), ...failures]
119: if (JSON.stringify(inventory) === JSON.stringify(nextInventory)) return
120: inventory = nextInventory
121: yield* bus.publish(Plugin.Event.Updated, {})
122: return
123: }
124:
125: yield* State.batch(
126: Effect.gen(function* () {
127: // Registrations are ordered by setup, so only the unchanged prefix can stay alive.
128: const previous = new Map(Array.from(active.entries()).slice(prefix))
129: yield* ...
<path>/home/byk/Code/opencode-v2-pilot/packages/schema/src/provider.ts</path>
<type>file</type>
<content>
1: export * as Provider from "./provider.js"
2:
3: import { Effect, Schema } from "effect"
4: import { Integration } from "./integration.js"
5: import { optional, PositiveInt, statics } from "./schema.js"
6:
7: export const ID = Schema.String.pipe(
8: Schema.brand("Provider.ID"),
9: statics((schema) => ({
10: opencode: schema.make("opencode"),
11: anthropic: schema.make("anthropic"),
12: openai: schema.make("openai"),
13: google: schema.make("google"),
14: googleVertex: schema.make("google-vertex"),
15: githubCopilot: schema.make("github-copilot"),
16: amazonBedrock: schema.make("amazon-bedrock"),
17: azure: schema.make("azure"),
18: openrouter: schema.make("openrouter"),
19: mistral: schema.make("mistral"),
20: gitlab: schema.make("gitlab"),
21: })),
22: )
23: export type ID = typeof ID.Type
24:
25: export const Package = ...
Found 15 matches
/home/byk/Code/opencode-lore/.lore.md:
Line 62: * **Gateway startup, process-boundary, and daemon ownership invariants**: CLI startup alone owns StartOptions.processBoundary because signals and shutdown affect the host process; embedded plugins never request lifecycle control. Quiet in-process callers use { quiet:true, local:true }, route notices through file logging, and must not write lifecycle text into full-screen TUIs. Local mode clears hosted and remote-gateway state before validation so process-wide defaults cannot disable local discovery, imports, configuration, or watching. Daemon records contain pid, processIdentity, and an owner-only token: PID reuse makes numeric ownership insufficient. Reuse, termination, and discovery cleanup require the exact recorded generation, and records are removed only while every identity field still matches. ...
<path>/home/byk/Code/opencode-lore</path> <type>directory</type> <entries> .craft.yml .git/ .github/ .gitignore .jj/ .lore.md .opencode/ .oxfmtrc.json .oxlintrc.json .plans/ .sentryclirc .vendor-build/ .worktrees/ AGENTS.md CHANGELOG.md codecov.yml LICENSE local_cache/ node_modules/ package.json packages/ patches/ pnpm-lock.yaml pnpm-workspace.yaml quality/ README.md scripts/ stryker.config.mjs supabase/ tsconfig.base.json tsconfig.json vitest.config.ts vitest.evals.config.ts vitest.mutation.config.ts (34 entries) </entries>
<path>/home/byk/Code/opencode-v2-pilot/packages/plugin/src/source.ts</path>
<type>file</type>
<content>
53: function digest(file: string, directory: boolean) {
54: try {
55: return Hash.sha256(directory ? JSON.stringify(readdirSync(file).sort()) : readFileSync(file))
56: } catch {
57: return "missing"
58: }
59: }
60:
61: export function localSource(spec: string, directory: string) {
62: if (spec.startsWith("file://")) return new URL(spec)
63: if (spec.startsWith("./") || spec.startsWith("../") || path.isAbsolute(spec))
64: return pathToFileURL(path.resolve(directory, spec))
65: return undefined
66: }
(End of file - total 66 lines)
</content>
<path>/home/byk/Code/opencode-lore/.opencode</path> <type>directory</type> <entries> .gitignore bun.lock node_modules/ package-lock.json package.json plans/ (6 entries) </entries>
<path>/home/byk/Code/opencode-v2-pilot/packages/core/src/session/title.ts</path>
<type>file</type>
<content>
1: export * as SessionTitle from "./title.js"
2:
3: import { isDeepStrictEqual } from "node:util"
4: import { LLMClient, LLMEvent, Message, SystemPart } from "@opencode/ai"
5: import type { Agent } from "@opencode/schema/agent"
6: import { Context, DateTime, Effect, Layer, Stream } from "effect"
7: import { Database } from "../database/database.js"
8: import { Bus } from "../bus.js"
9: import { makeLocationNode } from "@opencode/util/effect/app-node"
10: import { isExactRootFallback } from "@opencode/util/session-title-fallback"
11: import { llmClient } from "../effect/app-node-platform.js"
12: import { SessionContext } from "./context.js"
13: import { SessionEvent } from "./event.js"
14: import { SessionHistory } from "./history.js"
15: import type { SessionRunnerModel } from "./runner/model.js"
16: import { SessionSchema } from "./schema.js"
17: import { SessionUsage } from ...
* 🔴 (01:48) User stated gateway lifecycle ownership invariants: CLI startup alone owns `StartOptions.processBoundary` because signals and shutdown affect the host process; embedded plugins never request lifecycle control. Quiet in-process callers use `{ quiet:true, local:true }`, route notices through file logging, and must not write lifecycle text into full-screen TUIs. * 🔴 (01:48) User stated…
* 🔴 (01:57) User showed `/home/byk/Code/opencode-v2-pilot/packages/core/src/session/title.ts` lines 1–92 of 158. The module re-exports `SessionTitle` from `"./title.js"` and imports `isDeepStrictEqual` from `"node:util"`; `LLMClient`, `LLMEvent`, `Message`, and `SystemPart` from `"@opencode/ai"`; type `Agent` from `"@opencode/schema/agent"`; `Context`, `DateTime`, `Effect`, `Layer`, and `Stream`…
* 🔴 (01:33) User showed `/home/byk/Code/opencode-v2-pilot/packages/schema/src/provider.ts` lines 1–37. The module re-exports `Provider` from `"./provider.js"`; imports `{ Effect, Schema }` from `"effect"`, `{ Integration }` from `"./integration.js"`, and `{ optional, PositiveInt, statics }` from `"./schema.js"`. * 🔴 (01:33) User showed provider `ID` in `/home/byk/Code/opencode-v2-pilot/packages…
* 🔴 (01:32) User stated a concurrency-safety directive for `/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin.ts`: user finalizers may await readiness, so never join them under the activation lock or readiness hold. * 🔴 (01:32) User showed the `pendingFailures` worker in `/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin.ts` lines 182–236: it logs transform failures, updates inv…
* 🔴 (01:23) User provided 5 matches from `/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin.ts`: line 15 exports `awaitActivation`, `type Generation`, `type Interface`, and `Service` from `"./plugin/service.js"`; line 167 logs `Effect.logError("failed to restore plugin; deactivating", {`; line 225 logs `Effect.logError("failed to report disabled plugin", {`; line 253 assigns `awaitActiva…
* 🔴 (01:23) User provided 22 matches from `/home/byk/.local/share/opencode-v2-pilot/data/opencode/log/opencode.log` showing plugin loading and watcher lifecycle activity for `/home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/followup.ts` and `/home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/pty.ts`. * 🔴 (01:23) In run `9386f4fa`, `followup.ts` loaded at `2026-09-0…
* 🔴 (01:16) User provided lines 60–91 of `/home/byk/Code/opencode-v2-pilot/packages/schema/src/config.ts`. The config schema defines optional fields: `snapshots: Schema.Boolean` (“Enable snapshots used for undo and revert behavior”); `watcher: ConfigWatcher.Info` (“Filesystem watcher configuration”); `formatter: ConfigFormatter.Info` (“Enable built-in formatters or configure formatter overrides”…
* 🔴 (01:14) User provided the complete 5-line JSON configuration file `/home/byk/.local/share/opencode-v2-pilot/config/opencode/service-v2-pilot.json`; it sets `"hostname"` to `"127.0.0.1"` and `"port"` to `14104`. * 🔴 (01:14) User provided a password in `/home/byk/.local/share/opencode-v2-pilot/config/opencode/service-v2-pilot.json`; the secret value is omitted.
* 🔴 (01:09) User provided the path `/home/byk/Code/opencode-lore/packages/opencode/tsconfig.json`. * 🔴 (01:10) User provided the complete 11-line file `/home/byk/Code/opencode-lore/packages/opencode/tsconfig.json`. * 🔴 (01:10) `/home/byk/Code/opencode-lore/packages/opencode/tsconfig.json` extends `../../tsconfig.base.json`; sets `compilerOptions.noEmit` to `true`, `compilerOptions.types` to `[…
* 🔴 (01:08) User provided the complete 14-line file `/home/byk/Code/opencode-v2-pilot/packages/core/test/plugin/fixtures/greeting.ts`. * 🔴 (01:08) `/home/byk/Code/opencode-v2-pilot/packages/core/test/plugin/fixtures/greeting.ts` imports `Plugin` from `"@opencode/plugin"` and default-exports `Plugin.define({ id: "greeting", async setup(ctx) { ... } })`. * 🔴 (01:08) The `greeting` plugin’s `setu…
Date: September 9, 2026 * 🟡 (01:06) Tool search returned `No files found`; the search target/query was not shown. * 🔴 (01:07) User provided lines 100-219 of `/home/byk/Code/opencode-v2-pilot/packages/core/test/plugin.test.ts` (file has at least 652 lines). * 🔴 (01:07) `/home/byk/Code/opencode-v2-pilot/packages/core/test/plugin.test.ts` lines 102-118 define `it.live("loads a local plugin with i…
* 🔴 (01:02) User identified the test file `/home/byk/Code/opencode-v2-pilot/packages/plugin/test/host.test.ts`. * 🔴 (01:04) Search found exactly 1 match: line 37 of `/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/session.ts` defines `export type SessionRequestKind = "primary" | "compaction" | "title" | "generate"`.
* 🔴 (00:52) `/home/byk/Code/opencode-v2-pilot/packages/plugin/src/source.node.ts` imports `registerHooks` from `node:module`, `path` from `node:path`, `fileURLToPath` from `node:url`, `localSource` from `./source.js`, and `Host` from `./host.js`; module-level `generation` starts at `Date.now()`. * 🔴 (00:52) `prepareSource(entrypoint: string, track: (file: string, directory?: boolean) => void)` …
* 🔴 (00:48) In `/home/byk/Code/opencode-lore/packages/core/src/fetch-interceptor.ts`, `type Rewrite` has 3 string fields: `gatewayUrl`, `upstreamBase`, and `upstreamPath`. `upstreamPath` preserves the client’s full original endpoint pathname for forwarding as `x-lore-upstream-path`, including endpoints omitting `/v1` such as GitHub Copilot’s `/chat/completions` (issue #1052) and endpoints with n…
* 🔴 (00:45) Search found 3 matches in `/home/byk/Code/opencode-lore/packages/core/src/fetch-interceptor.ts`: line 204 defines `function interceptUrl(upstream: URL, gateway: URL): Rewrite | null {`; line 240 defines `export function interceptUrlForProtocol(`; line 281 defines `export function shouldIntercept(url: string, gatewayBase: string): boolean {`.
* 🔴 (00:44) `/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/agent.ts` imports `define` from `@opencode/plugin/effect/plugin`, `Effect` from `effect`, `Agent` from `../agent.js`, and `Permission` from `../permission.js`; it exports the module namespace as `AgentPlugin` from `./agent.js`. * 🔴 (00:44) `PROMPT_EXPLORE` defines a file-search specialist skilled in glob matching, regex cont…
* 🔴 (00:42) `/home/byk/Code/opencode-lore/packages/gateway/src/compaction.ts` defines `isStructuralCompaction(req: GatewayRequest, priorState?: { messageCount: number }): boolean` at lines 273–280. It returns `false` when `priorState` is absent or `priorState.messageCount <= 10`; otherwise it detects compaction only when `req.messages.length <= 3` and the current count is less than 50% of the pr…
* 🔴 (00:38) Search found exactly 24 matches for `compaction` in `/home/byk/Code/opencode-lore/packages/gateway/src/compaction.ts`, at lines 4, 10, 20, 25, 33, 35, 76, 93, 107, 114, 138, 164, 165, 265, 266, 271, 287, 303, 319, 346, 479, 483, 492, and 578. * 🔴 (00:38) The matches identify key compaction-related sections in `/home/byk/Code/opencode-lore/packages/gateway/src/compaction.ts`: system-…
* 🔴 (00:37) User established that when `x-lore-agent` matches a primary agent, the request is always a normal turn; `PRIMARY_AGENTS = new Set(["coder", "code"])` in `/home/byk/Code/opencode-lore/packages/gateway/src/compaction.ts` lines 377–380. * 🔴 (00:37) User established that when `x-lore-agent` matches a meta/housekeeping agent, the request is always passthrough; `META_AGENTS = new Set(["ti…
* 🔴 (00:36) User established the `x-lore-agent` routing rule: when it matches the relevant agent classification, the request is “always a normal turn.” * 🔴 (00:36) User established the `x-lore-agent` routing rule: when it matches the relevant agent classification, the request is “always passthrough.” * 🔴 (00:36) Code search found exactly 57 matches for `x-lore-agent`; `/home/byk/Code/opencode-…
* 🟡 (00:35) `/home/byk/Code/opencode-lore/packages/opencode/test/` contains 7 listed test files: `index.test.ts`, `routing.e2e.test.ts`, `internal.test.ts`, `gateway-smoke.test.ts`, `subagent-detection.test.ts`, `tui-silence.test.ts`, and `session-state.test.ts`.
* 🟡 (00:30) `/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts` lines 226–241 bind endpoint collections from `ClientApi.groups`: `AgentEndpoints` → `"server.agent"`, `CommandEndpoints` → `"server.command"`, `ExperimentalEndpoints` → `"server.experimental"`, `GenerateEndpoints` → `"server.generate"`, `IntegrationEndpoints` → `"server.integration"`, `McpEndpoints` → `"server.…
* 🟡 (00:29) `/home/byk/Code/opencode-v2-pilot/packages/core/test/session-model-request-hooks.test.ts` is an 80-line Bun test file using `testEffect(PluginTestLayer)` and defines `const it = testEffect(PluginTestLayer)`. * 🟡 (00:29) `session-model-request-hooks.test.ts` defines `KINDS: ReadonlyArray<SessionRequestKind> = ["primary", "compaction", "title", "generate"]`, preserving that exact requ…
* 🟡 (00:24) `/home/byk/Code/opencode-v2-pilot/packages/core/src/config/plugin/provider.ts` exports the namespace `ConfigProviderPlugin` from `./provider.js` and imports `define` from `@opencode/plugin/effect/plugin`, `Document` and `Entry` from `@opencode/schema/config`, `Money` from `@opencode/schema/money`, `Effect` from `effect`, `Config`, `Provider`, and `ConfigEntryObserver`. * 🟡 (00:24) `…
* 🟡 (00:23) `/home/byk/Code/opencode-lore/package.json` identifies the private ESM package as `"name": "lore-monorepo"`, license `FSL-1.1-Apache-2.0`, description `"Monorepo root for Lore — three-tier memory architecture"`, main entry `./packages/opencode/src/index.ts`, and `"."` export `./packages/opencode/src/index.ts`. * 🟡 (00:23) `/home/byk/Code/opencode-lore/package.json` pins package mana…
Date: September 9, 2026 * 🟡 (00:21) `/home/byk/Code/opencode-v2-pilot/packages/ai/src/protocols/anthropic-messages.ts` defines `route = Route.make(...)` at lines 1670–1681 with `id: ADAPTER`, `provider: "anthropic"`, `providerMetadataKey: "anthropic"`, and `protocol`. * 🟡 (00:21) The route endpoint at line 1675 uses `Endpoint.path((input) => (input.request.model.provider === "anthropic" ? \`${P…
Date: September 9, 2026 * 🟡 (00:17) Search found exactly 40 matches for the current query in `/home/byk/Code/opencode-v2-pilot/packages/ai/src/protocols/anthropic-messages.ts`, at lines 35, 36, 37, 356, 475, 779, 785–787, 790, 794, 808, 814–815, 818, 828, 830, 841, 859, 862, 864, 867, 872, 874–875, 893, 948, 951, 967, 969–970, 973, 1067, 1092, 1102, 1548, 1639, 1646, 1676, and 1683. * 🟡 (00:17)…
* 🟡 (00:17) `/home/byk/Code/opencode-v2-pilot/packages/plugin/src/app.ts` defines and exports interface `App` with 3 `readonly string` properties: `name`, `version`, and `channel`. The file contains 5 lines.
* 🟡 (00:14) Search found 3 references to `@ai-sdk/anthropic` in `/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/provider/anthropic.ts`: line 10 checks `Provider.isAISDK(item.provider.package)`, line 11 compares `Provider.packageName(item.provider.package) !== "@ai-sdk/anthropic"`, and line 23 returns unless `evt.package === "@ai-sdk/anthropic"`. * 🟡 (00:15) `/home/byk/Code/opencode-v…
Date: September 9, 2026 * 🟡 (00:13) `/home/byk/Code/opencode-v2-pilot/packages/ai/src/providers/anthropic-compatible.ts:34-35` defines auth resolution: returns `input.auth` when present and truthy; otherwise uses `Auth.optional("apiKey" in input ? input.apiKey : undefined, "apiKey").pipe(Auth.header("x-api-key"))`. * 🟡 (00:13) `/home/byk/Code/opencode-v2-pilot/packages/ai/src/providers/anthropi…
Date: September 9, 2026 * 🟡 (00:12) Search found 6 `baseURL` matches in `/home/byk/Code/opencode-v2-pilot/packages/ai/src/providers/anthropic-compatible.ts`: line 17 declares `readonly baseURL: string`; line 26 declares `readonly baseURL: string`; line 39 throws `Error("Anthropic-compatible providers require a baseURL")` when `!input.baseURL`; line 41 destructures `const { provider: _, baseURL, …
Date: September 9, 2026 * 🟡 (00:11) `/home/byk/Code/opencode-v2-pilot/packages/ai/src/providers/anthropic.ts` lines 32–37 define `auth(options: ProviderAuthOption<"optional">)`: returns `options.auth` when present and truthy; otherwise uses `Auth.optional("apiKey" in options ? options.apiKey : undefined, "apiKey").orElse(Auth.config("ANTHROPIC_API_KEY")).pipe(Auth.header("x-api-key"))`. * 🟡 (00…
* 🔴 (00:08) Search found 3 matches in `/home/byk/Code/opencode-v2-pilot/packages/ai/src/providers/anthropic.ts`: line 6 imports `AnthropicMessages` from `"../protocols/anthropic-messages.js"`; line 44 sets `baseURL: baseURL ?? AnthropicMessages.DEFAULT_BASE_URL`; line 63 sets `baseURL: settings.baseURL`.
Date: September 9, 2026 * 🟡 (00:07) `/home/byk/Code/opencode-lore/pnpm-lock.yaml:210-215` locks `tar` with specifier `'>=7.5.19'` to version `7.5.21`, and `undici` with specifier `^8.9.0` to version `8.9.0`. * 🟡 (00:07) `/home/byk/Code/opencode-lore/pnpm-lock.yaml:217-234` defines `packages/opencode` dependencies `@loreai/core` (`workspace:*`, `link:../core`) and `@loreai/gateway` (`workspace:*…
Date: September 9, 2026 * 🟡 (00:04) In `/home/byk/.local/share/opencode/repos/github.com/Effect-TS/effect-smol/packages/effect/src/unstable/http/FetchHttpClient.ts:42-51`, `RequestInit` is documented as supplying request-specific method, headers, body, and abort signal when executing a request; it is declared as `export class RequestInit extends Context.Service<RequestInit, globalThis.RequestIni…
Date: September 9, 2026 * 🟡 (00:01) In `/home/byk/.local/share/opencode/repos/github.com/Effect-TS/effect-smol/packages/effect/src/unstable/http/FetchHttpClient.ts:55-59`, request options are read from `fiber.context.mapUnsafe.get(RequestInit.key) ?? {}`; configured headers are merged via `Headers.merge(Headers.fromInput(options.headers), request.headers)`, giving request headers precedence, and…
* 🟡 (23:59) `/home/byk/Code/opencode-lore/packages/gateway/package.json` identifies package `@loreai/gateway` version `0.40.0`, with `"type": "module"`, license `FSL-1.1-Apache-2.0`, and description `"Lore as a transparent LLM proxy — context management for any AI coding client"`. * 🟡 (23:59) `/home/byk/Code/opencode-lore/packages/gateway/package.json` sets `"main": "./dist/index.cjs"` and `"ty…
* 🟡 (23:56) `/home/byk/Code/opencode-lore/packages/core/package.json` identifies package `@loreai/core` version `0.40.0`, with `"type": "module"`, license `FSL-1.1-Apache-2.0`, and description `"Shared memory engine for Lore — three-tier storage, distillation, gradient context management"`. * 🟡 (23:56) `/home/byk/Code/opencode-lore/packages/core/package.json` defines conditional root exports: `…
Date: Sep 8, 2026 * 🟡 (23:54) Search found 3 build-path matches in `/home/byk/Code/opencode-lore/packages/core/package.json`: line 7 has `"main": "./dist/node/index.js"`, line 8 has `"types": "./dist/node/index.d.ts"`, and line 11 has `"types": "./dist/types/index.d.ts"`.
Date: Sep 8, 2026 * 🟡 (23:53) Tool displayed lines 1-155 of 232 from `/home/byk/.opencode/node_modules/@opencode-ai/plugin/dist/index.d.ts`; imports include `Event`, `createOpencodeClient`, `Project`, `Model`, `Provider`, `Permission`, `UserMessage`, `Message`, `Part`, `Auth`, and `Config` from `@opencode-ai/sdk`, `BunShell` from `./shell`, and `ToolDefinition` from `./tool`; the file also re-ex…
Date: Sep 8, 2026 * 🟢 (23:49) A tool search returned `No files found`; the searched path or pattern was not included. * 🟡 (23:52) A tool search found 3 declarations in `/home/byk/.opencode/node_modules/@opencode-ai/plugin/dist/index.d.ts`: line 10 `export type PluginInput = {`, line 18 `export type Plugin = (input: PluginInput) => Promise<Hooks>;`, and line 108 `export interface Hooks {`.
Date: Sep 8, 2026 * 🟡 (23:48) `/home/byk/Code/opencode-lore/packages/opencode/test/index.test.ts` documents the v1.17.4 crash `undefined is not an object (evaluating 'A.event')`: OpenCode’s legacy `getLegacyPlugins`/`getServerPlugin` loader iterates `Object.values(mod)`, invokes every function export as a plugin, and pushes each return value into the host hooks array; the accidentally exported `…
* 🟡 (23:47) Search found 12 matches in `/home/byk/Code/opencode-lore/packages/opencode/test/index.test.ts`, including custom provider headers at lines 158 and 170, OpenAI header-timeout handling at line 173, and plugin entry-module export-shape tests at lines 278-303. * 🟡 (23:47) `/home/byk/Code/opencode-lore/packages/opencode/test/index.test.ts` lines 158 and 170 configure and assert `defaultH…
Date: September 8, 2026 * 🟡 (23:44) `/home/byk/Code/opencode-lore/packages/opencode/test/index.test.ts` lines 11-51 define `createMockClient()` and `initPlugin()`: the mock stubs `tui.showToast` plus `session.get`, `session.list`, `session.create`, `session.messages`, `session.message`, and `session.prompt`; plugin initialization uses a timestamped `__tmp_plugin_${Date.now()}__` directory, proje…
* 🟡 (23:43) `/home/byk/Code/opencode-v2-pilot/packages/core/src/config/normalize.ts` lines 320-359 normalize `compaction`: absent `compaction` returns immediately; non-record values call `invalid(["compaction"], diagnostics)`; `tail_turns` and `prune` are rejected via `unsupportedIfPresent(...)`. * 🟡 (23:43) `/home/byk/Code/opencode-v2-pilot/packages/core/src/config/normalize.ts` lines 330-339 …
Date: Sep 8, 2026 * 🔴 (23:41) User specified that `processBoundary?: boolean` in `/home/byk/Code/opencode-lore/packages/gateway/src/cli/start.ts` is an internal CLI-owned process boundary and is never set by in-process plugins. * 🟡 (23:41) `/home/byk/Code/opencode-lore/packages/gateway/src/cli/start.ts` lines 100-105 document `bg?: boolean` as keeping the gateway running until healthy, printing…
Date: Sep 8, 2026 * 🟡 (23:28) Search in `/home/byk/Code/opencode-v2-pilot` found 39 `FetchHttpClient`/HTTP-client references: `packages/sdk/test/transport.test.ts` lines 3, 35, 52, 53, 59 use `FetchHttpClient.Fetch` and ambient service injection; `packages/sdk/src/effect/opencode.ts` lines 7, 38, 42-43 import `FetchHttpClient, HttpClient`, construct the client with `Effect.provide(FetchHttpClien…
Date: Sep 8, 2026 * 🟡 (23:38) Search found 12 references related to `startGateway` in `/home/byk/Code/opencode-lore`: `packages/gateway/src/server.ts` lines 782 (`Use loadConfig() or startGateway() for a fully-populated config.`), 1254 (port-fallback/reuse logic), 1280 (re-throw for `startGateway()`), 1293 (collect ready promises), and 1428 (awaited error surfaces); `packages/gateway/src/cli/sta…
Date: Sep 8, 2026 * 🟡 (23:36) Search found 6 references related to `globalThis.fetch` in `/home/byk/.local/share/opencode/repos/github.com/Effect-TS/effect-smol/packages/effect/src/unstable/http/FetchHttpClient.ts`: line 6 documents Node.js environments where `globalThis.fetch` is available; line 25 says the client defaults to `globalThis.fetch`; lines 30–31 define `Fetch` as `Context.Reference<…
Date: Sep 8, 2026 * 🟡 (23:28) `/home/byk/Code/opencode-v2-pilot/packages/util/src/effect/app-node-platform.ts` uses deep imports `@effect/platform-node/NodeFileSystem` and `@effect/platform-node/NodePath` because the `@effect/platform-node` barrel eagerly imports `undici`, `ioredis`, and `node:sqlite`, which runtimes such as `workerd` cannot load. * 🟡 (23:28) `/home/byk/Code/opencode-v2-pilot/p…