Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/base/agent-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
defineAgent,
type HostProcesses,
type JsonValue,
type TraceProviderDeclaration,
} from "@ora-space/plugin-sdk";

/**
Expand Down Expand Up @@ -112,6 +113,9 @@ export abstract class AgentPlugin {
* handler module the same way `onStart` and friends are mounted above.
*/
effects: AgentEffectDefinition | undefined = undefined;

/** Trace files this provider writes; Ora resolves these only for authorized consumers. */
traceProviders: readonly TraceProviderDeclaration[] = [];
}

/** One entry of the flattened dispatch table, already bound to its plugin instance. */
Expand Down Expand Up @@ -150,6 +154,7 @@ export async function runAgentPlugin(
| void
| Promise<void>,
effects: plugin.effects,
traceProviders: plugin.traceProviders,
});
const processes = createHostProcesses(definition);
await plugin.onActivate({ pluginId: options.pluginId, processes });
Expand Down
10 changes: 10 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type {
AgentStartContext,
HostProcesses,
JsonValue,
TraceProviderDeclaration,
} from "@ora-space/plugin-sdk";
import { AGENT_METHODS } from "@ora-space/plugin-sdk";
import {
Expand Down Expand Up @@ -63,6 +64,15 @@ class OpenCodeAgentPlugin extends AgentPlugin {

override readonly effects = this.#effects.definition;

/** The managed OpenCode trace logger writes one NDJSON file per provider session. */
override readonly traceProviders: readonly TraceProviderDeclaration[] = [{
providerId: "opencode",
format: "ora/trace.opencode-ndjson.v1",
root: "home",
directory: ".local/share/opencode/trace",
fileNameTemplate: "{provider_session_id}.ndjson",
}];

override onActivate(context: PluginContext): void {
console.info(`${context.pluginId} activated`);
this.#processes = context.processes;
Expand Down
Loading