@mono-agent/agent-runtime 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,6 +24,9 @@ export const RUNTIME_CAPABILITIES = {
24
24
  // The pi bridge keeps a pi-agent-core Session transcript per provider
25
25
  // session id and seeds Agent initialState.messages on resume.
26
26
  supports_session_resume: true,
27
+ // The pi-native bridge does not (yet) wire native subagents / an AskAgent
28
+ // tool, so advertise no support rather than letting callers expect it.
29
+ supports_native_subagents: false,
27
30
  },
28
31
  codex: {
29
32
  runtime: "cli",
@@ -35,7 +35,9 @@ const builtinBridgeSpecs = {
35
35
  id: "pi",
36
36
  supports: (ref) => ref?.sdk === "pi",
37
37
  capabilities: () => runtimeCapabilities("pi"),
38
- load: async () => (await import("../providers/pi-sdk.js")).piRuntimeBridge,
38
+ // The pi-native AgentHarness bridge is the sole pi runtime path. The
39
+ // hand-rolled pi-sdk bridge was removed once native reached parity.
40
+ load: async () => (await import("../providers/pi-native.js")).piNativeRuntimeBridge,
39
41
  },
40
42
  };
41
43
 
@@ -49,7 +51,7 @@ export function listRuntimeBridges() {
49
51
 
50
52
  export async function resolveRuntimeBridge(modelRef, options = {}) {
51
53
  for (const spec of Object.values(builtinBridgeSpecs)) {
52
- if (spec.supports(modelRef, options)) return spec.load();
54
+ if (spec.supports(modelRef, options)) return spec.load(options);
53
55
  }
54
56
  throw new Error(`unsupported sdk: ${modelRef?.sdk || "unknown"}`);
55
57
  }
@@ -191,21 +191,37 @@ function normaliseChain(chain) {
191
191
 
192
192
  function entrySatisfiesRequirements(entry, options) {
193
193
  const requires = entry.requires;
194
- if (!requires) return true;
194
+ // Synthesize effective requirements: merge the entry's own `requires` with
195
+ // requirements inferred from per-run options, so a chain entry that carries
196
+ // no explicit `requires` (the agent-host + runtime-adapter paths cannot carry
197
+ // one today) still respects option-implied capability needs. Each option
198
+ // inference defers to an explicit entry pin, never overriding it.
199
+ const effectiveRequires = { ...(requires || null) };
200
+ // Honour request-time outputSchema → require structured_output unless the
201
+ // entry already pins it.
202
+ if (options.outputSchema && effectiveRequires.structured_output === undefined) {
203
+ effectiveRequires.structured_output = true;
204
+ }
205
+ // Honour native-subagent teammates → require supports_native_subagents unless
206
+ // the entry already pins it. A pi entry (supports_native_subagents:false) then
207
+ // fails here rather than silently dropping the teammates.
208
+ if (
209
+ Array.isArray(options.nativeSubagents?.teammates)
210
+ && options.nativeSubagents.teammates.length > 0
211
+ && effectiveRequires.supports_native_subagents === undefined
212
+ ) {
213
+ effectiveRequires.supports_native_subagents = true;
214
+ }
215
+ if (Object.keys(effectiveRequires).length === 0) return true;
195
216
  let caps;
196
217
  try {
197
218
  caps = runtimeCapabilities(entry.model);
198
219
  } catch {
199
220
  return false;
200
221
  }
201
- for (const [key, expected] of Object.entries(requires)) {
222
+ for (const [key, expected] of Object.entries(effectiveRequires)) {
202
223
  if (caps[key] !== expected) return false;
203
224
  }
204
- // Honour request-time outputSchema → require structured_output unless
205
- // already specified.
206
- if (options.outputSchema && requires.structured_output !== false && caps.structured_output === false) {
207
- return false;
208
- }
209
225
  return true;
210
226
  }
211
227
 
@@ -1,8 +1,9 @@
1
1
  // Provider session registries.
2
2
  //
3
3
  // Bridges that support continuous provider sessions (codex-app keeps the
4
- // app-server subprocess + thread alive, pi-sdk keeps a pi Session transcript)
5
- // register their live sessions here, keyed by provider session id. The host
4
+ // app-server subprocess + thread alive, pi-native keeps a pi Session
5
+ // transcript) register their live sessions here, keyed by provider session id.
6
+ // The host
6
7
  // owns session lifetime policy (which conversation maps to which session,
7
8
  // when to resume, when to retire); these registries only make sure nothing
8
9
  // leaks if the host forgets: every entry carries an idle TTL backstop with an
package/src/ai/types.js CHANGED
@@ -27,7 +27,6 @@
27
27
  * @property {string} [runArtifactDir]
28
28
  * @property {AbortSignal} [abortSignal]
29
29
  * @property {Object} [liveInput]
30
- * @property {"auto"|"concise"|"detailed"|"off"|"on"|null} [piReasoningSummary]
31
30
  * @property {Object} [settings]
32
31
  * @property {Object} [nativeSubagents] Same-runtime teammate helpers exposed through native provider subagent surfaces.
33
32
  * @property {(event: RuntimeEvent) => void} [onEvent]
package/src/runtime.js CHANGED
@@ -6,8 +6,9 @@
6
6
  // method that resolves the right provider bridge based on `options.model` +
7
7
  // `options.executionMode`.
8
8
  //
9
- // All four built-in bridges (claude-sdk, claude-cli, pi-sdk, codex-app)
10
- // register themselves on import via the runtime registry. Hosts that need
9
+ // The built-in bridges (claude-sdk, claude-cli, pi-native, codex-app,
10
+ // opencode-app) register themselves on import via the runtime registry. Hosts
11
+ // that need
11
12
  // finer control can keep using the named exports (resolveRuntimeBridge,
12
13
  // generateClaudeResponse, etc.) directly.
13
14
  //