@oisin-ee/oisinpi 0.9.0 → 0.9.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @oisin-ee/oisinpi
2
2
 
3
+ ## 0.9.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`bcba2d4`](https://github.com/oisin-ee/oisinpi/commit/bcba2d42673c2cf12c23b62079c2a96c0b098e30)]:
8
+ - @oisin-ee/pi-tiers@0.9.1
9
+ - @oisin-ee/pi-guardrails@0.9.1
10
+ - @oisin-ee/pi-prewalk@0.9.1
11
+ - @oisin-ee/pi-todo@0.9.1
12
+
3
13
  ## 0.9.0
4
14
 
5
15
  ### Minor Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oisin-ee/pi-guardrails",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "Agent guardrails for pi, Claude Code, and Codex: Git safety, no waiting, no typing into other agents, GitOps-only clusters.",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oisin-ee/pi-prewalk",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "A one-shot planner-to-executor handoff for pi, with branch-backed Rust rules.",
5
5
  "keywords": [
6
6
  "pi-extension",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oisin-ee/pi-tiers",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "Sticky virtual model tiers with quota-aware recovery for pi.",
5
5
  "keywords": [
6
6
  "pi-extension",
@@ -9,6 +9,7 @@ import type { Context } from "./ports.ts";
9
9
  import type { Router } from "./router.ts";
10
10
  import type { Tiers } from "./config.ts";
11
11
  import { classify } from "./policy.ts";
12
+ import { listed } from "./router.ts";
12
13
 
13
14
  const ZERO = 0,
14
15
  ONE = 1;
@@ -76,7 +77,8 @@ class Recovery {
76
77
  }
77
78
  const tier = ctx.model.id,
78
79
  state = branchState(ctx.sessionManager.getBranch(), tier),
79
- targets = this.#tiers.get(tier),
80
+ tierTargets = this.#tiers.get(tier),
81
+ targets = tierTargets === undefined ? undefined : listed(tierTargets, ctx),
80
82
  message = event.context.contextMessages.findLast((item) => item.role === "assistant"),
81
83
  entry = event.context.contextEntries.findLast(
82
84
  (item: Readonly<{ sourceEntry: SessionEntry; messages: readonly unknown[] }>) =>
@@ -10,7 +10,23 @@ import type { Window } from "./quota.ts";
10
10
 
11
11
  const ZERO = 0,
12
12
  ONE = 1,
13
- CACHE_MS = 60_000;
13
+ CACHE_MS = 60_000,
14
+ /**
15
+ * Keeps only targets the model registry lists, so a provider model that is not
16
+ * configured yet behaves like an unavailable target instead of a terminal error.
17
+ * @param {readonly string[]} targets Ordered tier.
18
+ * @param {Context} ctx Pi authority.
19
+ * @returns {readonly string[]} Listed targets, in tier order.
20
+ */
21
+ listed = (targets: readonly string[], ctx: Context): readonly string[] => {
22
+ const available = new Set(
23
+ ctx.modelRegistry.getAvailable().map((candidate) => `${candidate.provider}/${candidate.id}`),
24
+ );
25
+ return targets.filter((reference) => {
26
+ const parsed = target(reference);
27
+ return available.has(`${parsed.provider}/${parsed.id}`);
28
+ });
29
+ };
14
30
 
15
31
  /** Sticky routing with host-wide quota and gateway health. */
16
32
  class Router {
@@ -139,19 +155,20 @@ class Router {
139
155
 
140
156
  /**
141
157
  * Routes a tier without fabricating conversation messages.
142
- * @param {readonly string[]} targets Ordered physical models.
158
+ * @param {readonly string[]} tier Ordered physical models, listed or not.
143
159
  * @param {Request} request Pi request.
144
160
  * @param {Context} ctx Pi authority.
145
161
  * @returns {Promise<ModelRoute<State>>} Physical dispatch.
146
162
  */
147
163
  public async route(
148
- targets: readonly string[],
164
+ tier: readonly string[],
149
165
  request: Request,
150
166
  ctx: Context,
151
167
  ): Promise<ModelRoute<State>> {
152
168
  request.signal?.throwIfAborted();
153
169
  await this.#refresh();
154
- const previous =
170
+ const targets = listed(tier, ctx),
171
+ previous =
155
172
  request.reason === "direct"
156
173
  ? undefined
157
174
  : (branchState(ctx.sessionManager.getBranch(), request.model.id) ?? request.state),
@@ -163,7 +180,9 @@ class Router {
163
180
  state = await this.#retry(request, current),
164
181
  health = await this.#effects.read(),
165
182
  chosen =
166
- !state.attempted.includes(state.chosen) && this.#available(state.chosen, health)
183
+ targets.includes(state.chosen) &&
184
+ !state.attempted.includes(state.chosen) &&
185
+ this.#available(state.chosen, health)
167
186
  ? state.chosen
168
187
  : await this.next(targets, state);
169
188
  if (chosen === undefined) {
@@ -173,4 +192,4 @@ class Router {
173
192
  }
174
193
  }
175
194
 
176
- export { Router };
195
+ export { Router, listed };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oisin-ee/pi-todo",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "A todo tool for pi with a Rust core: one active task, state on the session branch.",
5
5
  "keywords": [
6
6
  "pi-extension",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oisin-ee/oisinpi",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "Oisin's pi packages in one install: prewalk, todo, tiers, and guardrails.",
5
5
  "keywords": [
6
6
  "guardrails",
@@ -17,10 +17,10 @@
17
17
  },
18
18
  "type": "module",
19
19
  "dependencies": {
20
- "@oisin-ee/pi-guardrails": "0.9.0",
21
- "@oisin-ee/pi-prewalk": "0.9.0",
22
- "@oisin-ee/pi-tiers": "0.9.0",
23
- "@oisin-ee/pi-todo": "0.9.0"
20
+ "@oisin-ee/pi-guardrails": "0.9.1",
21
+ "@oisin-ee/pi-prewalk": "0.9.1",
22
+ "@oisin-ee/pi-tiers": "0.9.1",
23
+ "@oisin-ee/pi-todo": "0.9.1"
24
24
  },
25
25
  "bundleDependencies": [
26
26
  "@oisin-ee/pi-guardrails",