portable-agent-layer 0.107.0 → 0.108.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "portable-agent-layer",
3
- "version": "0.107.0",
3
+ "version": "0.108.0",
4
4
  "description": "PAL — Portable Agent Layer: persistent personal context for AI coding assistants",
5
5
  "type": "module",
6
6
  "bin": {
@@ -69,7 +69,8 @@
69
69
  "eval:goal-links": "bun eval/run.ts goal-links",
70
70
  "eval:waiting-on": "bun eval/run.ts waiting-on",
71
71
  "eval:reaction": "bun eval/run.ts reaction",
72
- "eval:correction-check": "bun eval/run.ts correction-check"
72
+ "eval:correction-check": "bun eval/run.ts correction-check",
73
+ "eval:entity-extraction": "bun eval/entity-extraction/build-prompt.ts && bun eval/run.ts entity-extraction"
73
74
  },
74
75
  "lint-staged": {
75
76
  "*.ts": [
package/src/cli/infer.ts CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  import { readFileSync } from "node:fs";
8
8
  import { z } from "zod";
9
- import { inference } from "../hooks/lib/inference";
9
+ import { inference, plannedInferenceRoute } from "../hooks/lib/inference";
10
10
  import { INFERENCE_TIERS, type InferenceTier } from "../hooks/lib/models";
11
11
  import { leaf } from "../tools/lib/command";
12
12
 
@@ -19,9 +19,11 @@ interface InferValues {
19
19
  timeout?: string;
20
20
  caller?: string;
21
21
  web?: boolean;
22
+ route?: boolean;
22
23
  }
23
24
 
24
25
  type Infer = typeof inference;
26
+ type PlanRoute = typeof plannedInferenceRoute;
25
27
 
26
28
  class InferInputError extends Error {}
27
29
 
@@ -115,6 +117,19 @@ export async function inferFromCli(
115
117
  return 0;
116
118
  }
117
119
 
120
+ export function routeFromCli(
121
+ values: InferValues,
122
+ plan: PlanRoute = plannedInferenceRoute
123
+ ): number {
124
+ try {
125
+ console.log(JSON.stringify(plan(tierOf(values.tier), values.caller)));
126
+ return 0;
127
+ } catch (err) {
128
+ console.error(err instanceof Error ? err.message : String(err));
129
+ return 1;
130
+ }
131
+ }
132
+
118
133
  export const inferCommand = leaf({
119
134
  summary: "Run one inference call on the active agent's model; prompt on stdin",
120
135
  options: {
@@ -143,6 +158,11 @@ export const inferCommand = leaf({
143
158
  type: "boolean",
144
159
  description: "Let the model search and read the web (Claude, Codex, Copilot)",
145
160
  },
161
+ route: {
162
+ type: "boolean",
163
+ description: "Print the agent, route and model as JSON instead of calling",
164
+ },
146
165
  },
147
- run: async ({ values }) => inferFromCli(values, await Bun.stdin.text()),
166
+ run: async ({ values }) =>
167
+ values.route ? routeFromCli(values) : inferFromCli(values, await Bun.stdin.text()),
148
168
  });
@@ -217,6 +217,13 @@ function plannedRoute(opts: InferenceOptions): { route: string; model: string |
217
217
  return { route, model: null };
218
218
  }
219
219
 
220
+ export function plannedInferenceRoute(
221
+ tier: InferenceTier,
222
+ caller?: string
223
+ ): { agent: string; route: string; model: string | null } {
224
+ return { agent: previewRoute().agent, ...plannedRoute({ user: "", tier, caller }) };
225
+ }
226
+
220
227
  export async function inference(opts: InferenceOptions): Promise<InferenceResult> {
221
228
  const started = performance.now();
222
229
  const result = await checkedInference(opts);