feat: introduced omptype validation package and migrated workspace dependencies
- Introduce `@oh-my-pi/omptype` as a new ArkType-compatible schema validation package featuring a lazy JIT runtime, JSON Schema emission, and compatibility adapters. - Replace `arktype` across workspace packages and test utilities with `@oh-my-pi/omptype`. - Add benchmark suites, tests, and documentation for the new validation engine and adapters. - Update workspace build, test runner, and release configurations to include the new package.
This commit is contained in:
@@ -17,6 +17,7 @@ This repo contains multiple packages, but **`packages/coding-agent/`** is the pr
|
||||
| `packages/tui` | Terminal UI library with differential rendering |
|
||||
| `packages/natives` | Bindings for native text/image/grep operations |
|
||||
| `packages/stats` | Local observability dashboard (`omp stats`) |
|
||||
| `packages/omptype` | ArkType-compatible schema validation with a lazy JIT runtime |
|
||||
| `packages/utils` | Shared utilities (logger, streams, temp files) |
|
||||
| `crates/pi-natives` | Rust crate for performance-critical text/grep ops |
|
||||
|
||||
|
||||
@@ -606,6 +606,7 @@ For architecture and contribution guidelines, see [packages/coding-agent/DEVELOP
|
||||
| **[@oh-my-pi/pi-tui](packages/tui)** | Terminal UI library with differential rendering |
|
||||
| **[@oh-my-pi/pi-natives](packages/natives)** | N-API bindings for grep, shell, image, text, syntax highlighting, and more |
|
||||
| **[@oh-my-pi/omp-stats](packages/stats)** | Local observability dashboard for AI usage statistics |
|
||||
| **[@oh-my-pi/omptype](packages/omptype)** | ArkType-compatible schema validation with lazy JIT compilation |
|
||||
| **[@oh-my-pi/pi-utils](packages/utils)** | Shared utilities (logging, streams, dirs/env/process helpers) |
|
||||
| **[@oh-my-pi/pi-wire](packages/wire)** | Shared collab live-session protocol types and relay constants |
|
||||
| **[@oh-my-pi/hashline](packages/hashline)** | Line-anchored patch language and applier behind the `edit` tool |
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
"packages/*/src/**/*.ts",
|
||||
"packages/*/src/**/*.tsx",
|
||||
"packages/*/test/**/*.ts",
|
||||
"packages/*/bench/**/*.ts",
|
||||
"packages/*/examples/**/*.ts",
|
||||
"packages/*/scripts/**/*.ts",
|
||||
"packages/*/*.ts",
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
"@opentelemetry/api": "catalog:",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@oh-my-pi/omptype": "catalog:",
|
||||
"@opentelemetry/context-async-hooks": "catalog:",
|
||||
"@opentelemetry/sdk-trace-base": "catalog:",
|
||||
"@types/bun": "catalog:",
|
||||
@@ -42,10 +43,10 @@
|
||||
"version": "17.2.6",
|
||||
"dependencies": {
|
||||
"@bufbuild/protobuf": "catalog:",
|
||||
"@oh-my-pi/omptype": "catalog:",
|
||||
"@oh-my-pi/pi-catalog": "catalog:",
|
||||
"@oh-my-pi/pi-utils": "catalog:",
|
||||
"@oh-my-pi/pi-wire": "catalog:",
|
||||
"arktype": "catalog:",
|
||||
"zod": "catalog:",
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -66,8 +67,8 @@
|
||||
"version": "17.2.6",
|
||||
"dependencies": {
|
||||
"@bufbuild/protobuf": "catalog:",
|
||||
"@oh-my-pi/omptype": "catalog:",
|
||||
"@oh-my-pi/pi-utils": "catalog:",
|
||||
"arktype": "catalog:",
|
||||
"zod": "catalog:",
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -87,6 +88,7 @@
|
||||
"@mozilla/readability": "catalog:",
|
||||
"@oh-my-pi/hashline": "catalog:",
|
||||
"@oh-my-pi/omp-stats": "catalog:",
|
||||
"@oh-my-pi/omptype": "catalog:",
|
||||
"@oh-my-pi/pi-agent-core": "catalog:",
|
||||
"@oh-my-pi/pi-ai": "catalog:",
|
||||
"@oh-my-pi/pi-catalog": "catalog:",
|
||||
@@ -110,7 +112,6 @@
|
||||
"@puppeteer/browsers": "catalog:",
|
||||
"@types/turndown": "catalog:",
|
||||
"@xterm/headless": "catalog:",
|
||||
"arktype": "catalog:",
|
||||
"chalk": "catalog:",
|
||||
"fast-xml-parser": "catalog:",
|
||||
"handlebars": "catalog:",
|
||||
@@ -228,6 +229,16 @@
|
||||
"@types/bun": "catalog:",
|
||||
},
|
||||
},
|
||||
"packages/omptype": {
|
||||
"name": "@oh-my-pi/omptype",
|
||||
"version": "17.2.6",
|
||||
"devDependencies": {
|
||||
"@sinclair/typebox": "^0.34.0",
|
||||
"@types/bun": "catalog:",
|
||||
"arktype": "2.2.3",
|
||||
"zod": "catalog:",
|
||||
},
|
||||
},
|
||||
"packages/snapcompact": {
|
||||
"name": "@oh-my-pi/snapcompact",
|
||||
"version": "17.2.6",
|
||||
@@ -381,6 +392,7 @@
|
||||
"@napi-rs/cli": "3.7.2",
|
||||
"@oh-my-pi/hashline": "17.2.6",
|
||||
"@oh-my-pi/omp-stats": "17.2.6",
|
||||
"@oh-my-pi/omptype": "17.2.6",
|
||||
"@oh-my-pi/pi-agent-core": "17.2.6",
|
||||
"@oh-my-pi/pi-ai": "17.2.6",
|
||||
"@oh-my-pi/pi-catalog": "17.2.6",
|
||||
@@ -413,7 +425,6 @@
|
||||
"@types/turndown": "5.0.6",
|
||||
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
||||
"@xterm/headless": "^6.0.0",
|
||||
"arktype": "2.2.3",
|
||||
"chalk": "^5.6.2",
|
||||
"chart.js": "^4.5.1",
|
||||
"date-fns": "^4.4.0",
|
||||
@@ -788,6 +799,8 @@
|
||||
|
||||
"@oh-my-pi/omp-stats": ["@oh-my-pi/omp-stats@workspace:packages/stats"],
|
||||
|
||||
"@oh-my-pi/omptype": ["@oh-my-pi/omptype@workspace:packages/omptype"],
|
||||
|
||||
"@oh-my-pi/pi-agent-core": ["@oh-my-pi/pi-agent-core@workspace:packages/agent"],
|
||||
|
||||
"@oh-my-pi/pi-ai": ["@oh-my-pi/pi-ai@workspace:packages/ai"],
|
||||
@@ -902,6 +915,8 @@
|
||||
|
||||
"@rolldown/pluginutils": ["@rolldown/pluginutils@1.0.1", "", {}, "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw=="],
|
||||
|
||||
"@sinclair/typebox": ["@sinclair/typebox@0.34.52", "", {}, "sha512-XiMQh7qqVlxZzcVD+kkGMNGMzcTrDMLWI7S4x7z1MkCkbDPrekpZXEUK0eZqZFMuHQg2a2DZOcDIh9o5v3Gonw=="],
|
||||
|
||||
"@sindresorhus/is": ["@sindresorhus/is@4.6.0", "", {}, "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw=="],
|
||||
|
||||
"@so-ric/colorspace": ["@so-ric/colorspace@1.1.6", "", { "dependencies": { "color": "^5.0.2", "text-hex": "1.0.x" } }, "sha512-/KiKkpHNOBgkFJwu9sh48LkHSMYGyuTcSFK/qMBdnOAlrRJzRSXAOFB5qwzaVQuDl8wAvHVMkaASQDReTahxuw=="],
|
||||
|
||||
@@ -1,169 +0,0 @@
|
||||
# ArkType Guide (for migrating Zod → ArkType in this repo)
|
||||
|
||||
Pinned to **arktype 2.2.3** (workspace catalog). Author types with
|
||||
`import { type } from "arktype"`.
|
||||
|
||||
> **Scope rule (READ FIRST).** Zod stays supported at the **external boundary** — `Tool.parameters`
|
||||
> accepts Zod _or_ ArkType _or_ JSON Schema, and the public `pi.zod` extension API + the Zod-backed
|
||||
> `typebox` shim are untouched. Migrate **internal** schemas to ArkType. If a file genuinely cannot be
|
||||
> expressed cleanly in ArkType (see "Resilient parsing" below) and it parses an external/untrusted
|
||||
> payload, it MAY stay on Zod — say so in your report rather than shipping broken ArkType.
|
||||
|
||||
## The detection contract (don't break it)
|
||||
|
||||
`packages/ai/src/utils/schema/wire.ts` distinguishes the three schema kinds:
|
||||
|
||||
- **ArkType** = a _callable function_ with `.toJsonSchema` and `.assert` methods (`isArkSchema`).
|
||||
- **Zod** = a non-callable object carrying `_zod` + `.parse` (`isZodSchema`).
|
||||
- **JSON Schema** = a plain object.
|
||||
|
||||
So an ArkType `Type` is a function. NEVER detect it via `$`/`_arktype`/`__arktype` markers — those
|
||||
don't exist. `isArkSchema`, `arkToWireSchema`, `isZodSchema`, `zodToWireSchema` all remain exported.
|
||||
|
||||
At the provider boundary, `toolWireSchema()` calls ArkType's
|
||||
`toJsonSchema({ target: "draft-2020-12", fallback: ctx => ctx.base })`, drops
|
||||
`$schema`, prunes the unconstrained branch emitted for `T | undefined`, and
|
||||
closes every declared object with `additionalProperties: false`. Predicates and
|
||||
morphs therefore validate locally but degrade to their base schema on the wire.
|
||||
A `T | undefined` property remains required: use an optional `?` key when the
|
||||
model may omit it.
|
||||
|
||||
Runtime validation and wire emission deliberately differ for undeclared keys:
|
||||
a plain ArkType object preserves extras during local validation, while
|
||||
`toolWireSchema()` closes its declared object for provider generation.
|
||||
`"+": "reject"` rejects locally, and the shared tool-validation pipeline strips
|
||||
root and nested extras before dispatch.
|
||||
|
||||
## Core translation table (Zod → ArkType)
|
||||
|
||||
| Zod | ArkType |
|
||||
| ------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
|
||||
| `z.object({ a: ... })` | `type({ a: ... })` |
|
||||
| `z.string()` / `z.number()` / `z.boolean()` | `"string"` / `"number"` / `"boolean"` |
|
||||
| `z.number().int()` | `"number.integer"` |
|
||||
| `z.literal("x")` | `"'x'"` ; `z.literal(5)` → `"5"` |
|
||||
| `z.enum(["a","b"])` (static) | `"'a' \| 'b'"` |
|
||||
| `z.enum(RUNTIME_ARRAY)` (dynamic) | `type.enumerated(...RUNTIME_ARRAY)` — NOT `type(arr.join("\|"))` |
|
||||
| `z.array(z.string())` | `"string[]"` |
|
||||
| `z.array(Item)` (Item is a `type`) | `Item.array()` |
|
||||
| `z.union([A,B])` | `A.or(B)` or `"a \| b"` |
|
||||
| `z.record(z.string(), z.number())` | `type({ "[string]": "number" })` — use the real value type, NOT `"unknown"` unless it was `z.unknown()` |
|
||||
| `z.unknown()` / `z.any()` | `"unknown"` |
|
||||
| `z.null()` | `"null"` |
|
||||
| `z.nullable(X)` | `X.or("null")` or `"X \| null"` |
|
||||
| field `.optional()` | optional **key**: `{ "a?": "string" }` (NOT a value method) |
|
||||
| string length `.min(n)`/`.max(n)` | `"string >= n"` / `"string <= n"` / `"1 <= string <= 10"` |
|
||||
| number `.min/.max/.gt/.lt` | `"number >= n"` / `"number > n"` / `"1 <= number <= 10"` |
|
||||
| dynamic bound (runtime var) | chain methods: `type("string").atLeastLength(1).atMostLength(MAX)` — NOT a template string |
|
||||
| `.describe("d")` | `.describe("d")` (emits JSON Schema `description`) |
|
||||
| `.strict()` (reject extras) | add key `"+": "reject"`: `type({ "+": "reject", ... })` |
|
||||
| `.strip()` (drop extras — Zod default) | add key `"+": "delete"` |
|
||||
| `.passthrough()` / `.loose()` | drop it (ArkType keeps undeclared keys by default) |
|
||||
| `.refine(fn, msg)` | `.narrow((d, ctx) => fn(d) \|\| ctx.mustBe("<expectation>"))` |
|
||||
| `z.infer<typeof S>` | `typeof S.infer` |
|
||||
| `z.input<typeof S>` | `typeof S.inferIn` |
|
||||
|
||||
## FOOTGUNS (these caused real breakage — avoid them)
|
||||
|
||||
1. **Never put `.default()` on an optional `?` key.** `z.X.default(v).optional()` in Zod is
|
||||
**output-optional** (default applied in code via `?? `) → translate to an **optional key, no
|
||||
default**: `"limit?": "number"`. Only `z.X.default(v)` _without_ `.optional()` (output-required)
|
||||
becomes `field: type("number").default(v)` (key has NO `?`).
|
||||
2. **`.default()` only works as an object-property value.** `type("number = 0")` standalone throws —
|
||||
use it inline (`type({ count: "number = 0" })`) or `.default()` on a non-optional key.
|
||||
3. **A described literal union emits `anyOf` of `const`, not `enum`.** That is correct and validates
|
||||
identically; assert semantic wire properties (`description`, required, `additionalProperties`), not
|
||||
the exact `enum` vs `anyOf` shape.
|
||||
4. **`type()` needs a statically-known definition.** A runtime-built string (`type(arr.join("|"))`,
|
||||
`type(\`1 <= string <= ${MAX}\`)`) fails TS. Use `type.enumerated(...)` / chain methods instead.
|
||||
5. **Integer ranges:** `"1 <= number.integer <= 3600"` (NOT `"number.integer >= 1 <= 3600"`).
|
||||
6. **`toolWireSchema()` removes `$schema` automatically.** If you call
|
||||
`toJsonSchema()` directly for some other boundary, strip its `$schema`
|
||||
metadata there.
|
||||
|
||||
## Validating with a schema (replacing `.parse` / `.safeParse`)
|
||||
|
||||
ArkType `Type` is **invoked** to validate; failure returns an `ArkErrors` instance:
|
||||
|
||||
```ts
|
||||
import { type } from "arktype";
|
||||
const out = schema(value);
|
||||
if (out instanceof type.errors) {
|
||||
// out.summary -> human message; out.map(e => `${e.path}: ${e.message}`)
|
||||
throw new Error(out.summary);
|
||||
}
|
||||
// else `out` is the validated/morphed value
|
||||
```
|
||||
|
||||
- `.parse(x)` → `const out = schema(x); if (out instanceof type.errors) throw new Error(out.summary); use out;`
|
||||
- `.safeParse(x).success` → `!(schema(x) instanceof type.errors)`
|
||||
- NEVER use `.allows()` for tool validation — it skips morphs/defaults/narrows.
|
||||
- `.infer` (output) and `.inferIn` (input) are inference-only properties (no runtime value).
|
||||
|
||||
## Advanced
|
||||
|
||||
### Scopes (reusable aliases / mutually-referential schemas)
|
||||
|
||||
Replace a cluster of cross-referencing Zod schemas with a scope, then `.export()` to a module:
|
||||
|
||||
```ts
|
||||
import { scope } from "arktype";
|
||||
const myScope = scope({
|
||||
inner: { id: "string" },
|
||||
outer: { inner: "inner", tags: "string[]" },
|
||||
});
|
||||
const m = myScope.export(); // Module — m.outer, m.inner are Type instances
|
||||
```
|
||||
|
||||
Use `.export()` — NOT `.compile()` (that method does not exist on a Scope).
|
||||
|
||||
### Morphs / transforms (replacing `.transform()`)
|
||||
|
||||
```ts
|
||||
const n = type("string").pipe((s) => Number.parseInt(s)); // validate then transform
|
||||
const o = type("string").to("number.integer"); // .to(def) == .pipe(type(def))
|
||||
```
|
||||
|
||||
### narrow (cross-field / post-validation predicate, replacing `.refine`)
|
||||
|
||||
`narrow` runs AFTER all validators/morphs (output side). `ctx.mustBe("<expectation>")` returns `false`
|
||||
and records `must be <expectation>`:
|
||||
|
||||
```ts
|
||||
type({ action: "string", "body?": "string" }).narrow(
|
||||
(p, ctx) =>
|
||||
p.action === "delete" ||
|
||||
p.body !== undefined ||
|
||||
ctx.mustBe("a body unless deleting"),
|
||||
);
|
||||
```
|
||||
|
||||
### Resilient parsing (replacing Zod `.catch(fallback)`)
|
||||
|
||||
ArkType has **no built-in `.catch()`**. For "parse, else fallback", wrap the unsafe work in a morph:
|
||||
|
||||
```ts
|
||||
const resilient = type("unknown").pipe((raw) => {
|
||||
const out = innerSchema(raw);
|
||||
return out instanceof type.errors ? FALLBACK : out; // never throws
|
||||
});
|
||||
```
|
||||
|
||||
For "missing → default", use the `=` default syntax (`"number = 5"`). If a parser relies heavily on
|
||||
per-field `.catch()` over an untrusted external payload and the morph rewrite gets unwieldy, that file
|
||||
is a candidate to **stay on Zod** (external-boundary exception) — note it in your report.
|
||||
|
||||
### Defaults recap
|
||||
|
||||
- `type({ count: "number = 0", flag: "boolean = false" })` — inline, output-required, wire `default`.
|
||||
- `type({ x: type("number").describe("d").default(0) })` — `.default()` on a NON-optional key when you
|
||||
also need `.describe()`.
|
||||
|
||||
## When you finish a file
|
||||
|
||||
- Replace `import { z } from "zod/v4"` with `import { type } from "arktype"` (keep `z` only if still used).
|
||||
- Preserve every `.describe()` string and field optionality exactly.
|
||||
- Convert every `.parse`/`.safeParse` call site in the file.
|
||||
- Run the focused tests that exercise the migrated schema and the affected package's type check.
|
||||
- Report any `.strict`→`"+"`, `.refine`→`.narrow`, `.catch`→morph conversion,
|
||||
and any file intentionally left on Zod with the reason.
|
||||
@@ -0,0 +1,109 @@
|
||||
# omptype Guide (schema authoring in this repo)
|
||||
|
||||
Internal schemas use **`@oh-my-pi/omptype`** — an ArkType-compatible validator
|
||||
with a lazy JIT runtime (`packages/omptype`). Author types with
|
||||
`import { type } from "@oh-my-pi/omptype"`.
|
||||
|
||||
> **Scope rule.** Zod stays supported at the **external boundary** — `Tool.parameters`
|
||||
> accepts Zod _or_ omptype _or_ JSON Schema, and the public `pi.zod` extension API is
|
||||
> untouched. Internal schemas use omptype.
|
||||
|
||||
## Why omptype (perf contract)
|
||||
|
||||
- `type()` construction is ~100x cheaper than arktype (no eager codegen, no node interning).
|
||||
- The first two calls run an interpreter; the third call JIT-compiles a specialized
|
||||
validator via `new Function`. Hot-path validation is tens of nanoseconds; failures
|
||||
allocate one small error object with lazy message building.
|
||||
- There is no `jitless` switch and no `scope()` — lazy JIT removed the startup tax
|
||||
those existed to dodge. Import `type` directly.
|
||||
|
||||
## The detection contract (don't break it)
|
||||
|
||||
`packages/ai/src/utils/schema/wire.ts` distinguishes the three schema kinds:
|
||||
|
||||
- **omptype** = a _callable function_ with `.toJsonSchema` and `.assert` methods (`isArkSchema`).
|
||||
- **Zod** = a non-callable object carrying `_zod` + `.parse` (`isZodSchema`).
|
||||
- **JSON Schema** = a plain object.
|
||||
|
||||
At the provider boundary, `toolWireSchema()` calls `toJsonSchema()`, prunes
|
||||
`T | undefined` branches, and closes declared objects with
|
||||
`additionalProperties: false`. Predicates (`.narrow`) and morphs (`.pipe`)
|
||||
validate locally but degrade to their base schema on the wire.
|
||||
|
||||
## Definition language (arktype-compatible subset)
|
||||
|
||||
| Construct | Form |
|
||||
| -------------------------- | ----------------------------------------------------------------- |
|
||||
| Primitives | `"string"`, `"number"`, `"boolean"`, `"null"`, `"undefined"`, `"unknown"`, `"object"`, `"bigint"` |
|
||||
| Integer | `"number.integer"` |
|
||||
| URL string | `"string.url"` |
|
||||
| Literals | `"'x'"`, `"5"`, `"true"` |
|
||||
| Unions | `"'a' \| 'b'"`, `"string \| null"` |
|
||||
| Arrays | `"string[]"`, `"(string \| number)[]"`, `[def, "[]"]` |
|
||||
| Bounds | `"number >= 0"`, `"0 < number <= 3600"`, `"1 <= string <= 10"` |
|
||||
| Optional key | `{ "limit?": "number" }` or value-suffix `{ limit: "number?" }` |
|
||||
| Defaults | `{ count: "number = 10" }`, `type("string[]").default(() => [])` |
|
||||
| Undeclared keys | `"+": "reject"` (fail) / `"+": "delete"` (strip) / default keep |
|
||||
| Records | `{ "[string]": "number" }` — NOT `"Record<string, number>"` |
|
||||
| Runtime enums | `type.enumerated(...RUNTIME_ARRAY)` |
|
||||
| Runtime-built object defs | `type.raw({...})` (returns `BaseType`) |
|
||||
| Keyword statics | `type.number.atLeast(5).atMost(300)`, `type.string` |
|
||||
|
||||
## Validating (same as arktype)
|
||||
|
||||
```ts
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
const out = schema(value);
|
||||
if (out instanceof type.errors) {
|
||||
// out.summary → human message; entries have .path (array) and .problem
|
||||
throw new Error(out.summary);
|
||||
}
|
||||
// `out` is the validated/morphed value (defaults filled, extras stripped)
|
||||
```
|
||||
|
||||
- Failure returns an `OmpErrors` (array of `OmpError`); `type.errors === OmpErrors`.
|
||||
- Validation is fast-fail: one error entry per failure.
|
||||
- Morphs never mutate the input; when defaults/`"+": "delete"`/pipes apply, a fresh
|
||||
object is returned.
|
||||
- NEVER use `.allows()` for tool validation — it skips morphs/defaults/pipes.
|
||||
- `.infer` / `.inferIn` are inference-only properties.
|
||||
- Definition mistakes (bad DSL, illegal composition) throw `OmpTypeError` at
|
||||
`type()` time.
|
||||
|
||||
## Methods
|
||||
|
||||
`.describe(d)`, `.default(v | () => v)`, `.or(TypeOrStringDef)`, `.and(Type)`,
|
||||
`.array()`, `.atLeastLength(n)` / `.atMostLength(n)` (string/array),
|
||||
`.atLeast(n)` / `.atMost(n)` (number), `.pipe(fn)`, `.narrow(fn)` (with
|
||||
`ctx.mustBe("...")`), `.allows(v)`, `.assert(v)`, `.toJsonSchema()`.
|
||||
|
||||
Note on `.or()` typing: schema and string operands infer precisely;
|
||||
object-literal operands degrade — wrap them with `type({...})` first.
|
||||
|
||||
## Zod → omptype translation (for new code)
|
||||
|
||||
| Zod | omptype |
|
||||
| ---------------------------------- | ----------------------------------------------------------- |
|
||||
| `z.object({ a: ... })` | `type({ a: ... })` |
|
||||
| `z.enum(["a","b"])` (static) | `"'a' \| 'b'"` |
|
||||
| `z.enum(RUNTIME_ARRAY)` | `type.enumerated(...RUNTIME_ARRAY)` |
|
||||
| `z.record(z.string(), z.number())` | `type({ "[string]": "number" })` |
|
||||
| `.optional()` | optional key `{ "a?": "string" }` |
|
||||
| `.strict()` / `.strip()` | `"+": "reject"` / `"+": "delete"` |
|
||||
| `.refine(fn, msg)` | `.narrow((d, ctx) => fn(d) \|\| ctx.mustBe("<expect>"))` |
|
||||
| `.transform(fn)` | `.pipe(fn)` |
|
||||
| `.catch(fallback)` | `type("unknown").pipe(raw => { const out = inner(raw); return out instanceof type.errors ? FALLBACK : out; })` |
|
||||
| `z.infer<typeof S>` | `typeof S.infer` |
|
||||
|
||||
## Adapters
|
||||
|
||||
For TypeBox-style or Zod-style authoring backed by the omptype runtime:
|
||||
|
||||
```ts
|
||||
import { Type, type Static } from "@oh-my-pi/omptype/typebox";
|
||||
import { z } from "@oh-my-pi/omptype/zod";
|
||||
```
|
||||
|
||||
Both produce real omptype schemas (JIT validation, `toJsonSchema`, wire
|
||||
detection). Use them for extension-facing surfaces; internal code authors
|
||||
the string DSL directly.
|
||||
@@ -46,6 +46,16 @@ Sources: [`packages/stats/README.md`](../packages/stats/README.md), [`packages/s
|
||||
- Outputs: dashboard metrics and API endpoints including `/api/stats`, `/api/stats/models`, `/api/stats/folders`, `/api/stats/timeseries`, and `/api/sync`.
|
||||
- Side effects/limits: syncs session files before output; long-running dashboard stops on `Ctrl+C` and closes the stats database.
|
||||
|
||||
### `packages/omptype` — schema validation library
|
||||
|
||||
Sources: [`packages/omptype/README.md`](../packages/omptype/README.md), [`packages/omptype/package.json`](../packages/omptype/package.json), and the repository [omptype authoring guide](./omptype-guide.md).
|
||||
|
||||
- Package: public `@oh-my-pi/omptype`; install with `bun add @oh-my-pi/omptype`; requires Bun 1.3.14 or newer.
|
||||
- Feature: callable ArkType-compatible schemas with cheap interpreted startup, lazy hot-path compilation, validation errors, defaults and morphs, and JSON Schema emission.
|
||||
- Public surfaces: `@oh-my-pi/omptype` for native authoring, `@oh-my-pi/omptype/typebox` and `/zod` for compatibility builders, and `/ark` for the alias-free ArkType compatibility facade.
|
||||
- Runtime behavior: schema calls return the validated value or `type.errors`; `.assert()` returns the value or throws; `.allows()` performs a boolean check.
|
||||
- Limits: this is an intentionally focused compatibility surface rather than a complete implementation of every ArkType, TypeBox, or Zod API.
|
||||
|
||||
### `packages/typescript-edit-benchmark` — TypeScript edit fixture engine
|
||||
|
||||
Sources: [`packages/typescript-edit-benchmark/package.json`](../packages/typescript-edit-benchmark/package.json), [`packages/typescript-edit-benchmark/src/generate.ts`](../packages/typescript-edit-benchmark/src/generate.ts), [`packages/typescript-edit-benchmark/src/tasks.ts`](../packages/typescript-edit-benchmark/src/tasks.ts), [`packages/typescript-edit-benchmark/src/verify.ts`](../packages/typescript-edit-benchmark/src/verify.ts), and the runner in [`packages/metaharness/adapters/edit/cli.ts`](../packages/metaharness/adapters/edit/cli.ts).
|
||||
|
||||
+2
-2
@@ -28,6 +28,7 @@
|
||||
"@napi-rs/cli": "3.7.2",
|
||||
"@oh-my-pi/hashline": "17.2.6",
|
||||
"@oh-my-pi/omp-stats": "17.2.6",
|
||||
"@oh-my-pi/omptype": "17.2.6",
|
||||
"@oh-my-pi/pi-agent-core": "17.2.6",
|
||||
"@oh-my-pi/pi-ai": "17.2.6",
|
||||
"@oh-my-pi/pi-catalog": "17.2.6",
|
||||
@@ -60,7 +61,6 @@
|
||||
"@types/turndown": "5.0.6",
|
||||
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
||||
"@xterm/headless": "^6.0.0",
|
||||
"arktype": "2.2.3",
|
||||
"chalk": "^5.6.2",
|
||||
"chart.js": "^4.5.1",
|
||||
"date-fns": "^4.4.0",
|
||||
@@ -117,7 +117,7 @@
|
||||
"build:native": "bun --cwd=packages/natives run build",
|
||||
"test": "bun scripts/ci-test-ts.ts local",
|
||||
"test:ts": "bun scripts/ci-test-ts.ts local-ts",
|
||||
"test:scripts": "bun test scripts/ci-release-build-binaries.test.ts scripts/musl-release.test.ts",
|
||||
"test:scripts": "bun test scripts/ci-release-build-binaries.test.ts scripts/musl-release.test.ts scripts/ci-release-publish.test.ts",
|
||||
"test:rs": "bun scripts/run-rs-task.ts test:rs",
|
||||
"check": "bun run --parallel check:ts check:rs",
|
||||
"check:ts": "bun run check:tools && bun run --workspaces --if-present check",
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Changed
|
||||
|
||||
- Replaced arktype with `@oh-my-pi/omptype` in tests and test utilities.
|
||||
|
||||
## [17.2.6] - 2026-08-03
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
"@opentelemetry/api": "catalog:"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@oh-my-pi/omptype": "catalog:",
|
||||
"@opentelemetry/context-async-hooks": "catalog:",
|
||||
"@opentelemetry/sdk-trace-base": "catalog:",
|
||||
"@types/bun": "catalog:"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { describe, expect, it, vi } from "bun:test";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { Agent } from "@oh-my-pi/pi-agent-core";
|
||||
import {
|
||||
agentLoop,
|
||||
@@ -20,7 +21,6 @@ import type { AssistantMessage, AssistantMessageEvent, Context, Message, ToolRes
|
||||
import { createMockModel, type MockResponse } from "@oh-my-pi/pi-ai/providers/mock";
|
||||
import { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream";
|
||||
import { INTENT_FIELD } from "@oh-my-pi/pi-wire";
|
||||
import { type } from "arktype";
|
||||
import { createAssistantMessage, createUserMessage } from "./helpers";
|
||||
|
||||
declare module "@oh-my-pi/pi-agent-core/types" {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { AppendOnlyContextManager, AppendOnlyLog, StablePrefix } from "@oh-my-pi/pi-agent-core/append-only-context";
|
||||
import type { AgentContext, AgentTool } from "@oh-my-pi/pi-agent-core/types";
|
||||
import type { Message, Tool, ToolExample } from "@oh-my-pi/pi-ai";
|
||||
import { INTENT_FIELD } from "@oh-my-pi/pi-wire";
|
||||
import { type } from "arktype";
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Helpers
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { normalizeTools } from "@oh-my-pi/pi-agent-core/agent-loop";
|
||||
import type { AgentTool } from "@oh-my-pi/pi-agent-core/types";
|
||||
import { INTENT_FIELD } from "@oh-my-pi/pi-wire";
|
||||
import { type } from "arktype";
|
||||
|
||||
const toolSchema = type({
|
||||
path: type("string").describe("where to read"),
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { afterEach, describe, expect, it } from "bun:test";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { agentLoop, agentPauseGate } from "@oh-my-pi/pi-agent-core";
|
||||
import type { AgentContext, AgentLoopConfig, AgentMessage, AgentTool } from "@oh-my-pi/pi-agent-core/types";
|
||||
import type { Message } from "@oh-my-pi/pi-ai";
|
||||
import { createMockModel } from "@oh-my-pi/pi-ai/providers/mock";
|
||||
import { type } from "arktype";
|
||||
import { createUserMessage } from "./helpers";
|
||||
|
||||
function identityConverter(messages: AgentMessage[]): Message[] {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { agentLoop } from "@oh-my-pi/pi-agent-core/agent-loop";
|
||||
import type { AgentContext, AgentLoopConfig, AgentMessage, AgentTool } from "@oh-my-pi/pi-agent-core/types";
|
||||
import type { AssistantMessage, Context, Message, TextContent, ToolResultMessage } from "@oh-my-pi/pi-ai";
|
||||
import { createMockModel } from "@oh-my-pi/pi-ai/providers/mock";
|
||||
import { type } from "arktype";
|
||||
import { createUserMessage } from "./helpers";
|
||||
|
||||
function identityConverter(messages: AgentMessage[]): Message[] {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { agentLoop } from "@oh-my-pi/pi-agent-core/agent-loop";
|
||||
import type {
|
||||
AgentContext,
|
||||
@@ -9,7 +10,6 @@ import type {
|
||||
} from "@oh-my-pi/pi-agent-core/types";
|
||||
import type { Message, ToolChoice } from "@oh-my-pi/pi-ai";
|
||||
import { createMockModel } from "@oh-my-pi/pi-ai/providers/mock";
|
||||
import { type } from "arktype";
|
||||
import { createUserMessage } from "./helpers";
|
||||
|
||||
function identityConverter(messages: AgentMessage[]): Message[] {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import type { AgentTool, AgentToolResult } from "@oh-my-pi/pi-agent-core/types";
|
||||
import { type } from "arktype";
|
||||
|
||||
export interface CalculateResult extends AgentToolResult<undefined> {
|
||||
content: Array<{ type: "text"; text: string }>;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import type { AgentTool, AgentToolResult } from "@oh-my-pi/pi-agent-core/types";
|
||||
import { type } from "arktype";
|
||||
|
||||
export interface GetCurrentTimeResult extends AgentToolResult<{ utcTimestamp: number }> {}
|
||||
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Changed
|
||||
|
||||
- Replaced arktype with `@oh-my-pi/omptype`, an ArkType-compatible validator with lazy JIT compilation: ~100x faster schema construction and 60-100x faster hot-path validation. `packages/ai` re-exports `type`/`Type` from omptype; the wire schema detection contract (`isArkSchema`) is unchanged.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed OpenAI-Codex (ChatGPT OAuth) requests failing with `Unsupported service_tier: auto` on default/legacy sessions. `shouldSendServiceTier` no longer forwards `auto` on the wire — it is OpenAI's implicit default, so omitting `service_tier` is equivalent, and the Codex endpoint rejects an explicit `auto`. Explicit `default`/`flex`/`scale`/`priority` are unaffected ([#7517](https://github.com/can1357/oh-my-pi/issues/7517)).
|
||||
|
||||
@@ -38,10 +38,10 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@bufbuild/protobuf": "catalog:",
|
||||
"@oh-my-pi/omptype": "catalog:",
|
||||
"@oh-my-pi/pi-catalog": "catalog:",
|
||||
"@oh-my-pi/pi-utils": "catalog:",
|
||||
"@oh-my-pi/pi-wire": "catalog:",
|
||||
"arktype": "catalog:",
|
||||
"zod": "catalog:"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
* `omp auth-broker status` (liveness checks). All endpoints except
|
||||
* `/v1/healthz` require a bearer token.
|
||||
*/
|
||||
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { readSseEvents } from "@oh-my-pi/pi-utils";
|
||||
import { type } from "arktype";
|
||||
import type { AuthCredential, DisabledCredentialSummary } from "../auth-storage";
|
||||
import type {
|
||||
ClientUsageReportRequest,
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
* Transport security is delegated to the operator (Tailscale / Wireguard);
|
||||
* the server only checks a bearer token against an allow-list per request.
|
||||
*/
|
||||
|
||||
import { type Type, type } from "@oh-my-pi/omptype";
|
||||
import { logger } from "@oh-my-pi/pi-utils";
|
||||
import { type Type, type } from "arktype";
|
||||
import type { AuthStorage, StoredCredentialBlock } from "../auth-storage";
|
||||
import { parseBind } from "../utils/parse-bind";
|
||||
import { AuthBrokerRefresher, type AuthBrokerRefresherSchedule } from "./refresher";
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* exception (standard type keeps extra keys): it preserves provider-specific extension fields so
|
||||
* they round-trip through the broker instead of being dropped (see below).
|
||||
*/
|
||||
import { scope, type Type } from "arktype";
|
||||
import { type Type, type } from "@oh-my-pi/omptype";
|
||||
import {
|
||||
type ApiKeyCredential,
|
||||
type AuthCredential,
|
||||
@@ -84,11 +84,6 @@ export interface AuthBrokerWireSchemas {
|
||||
}
|
||||
|
||||
function buildAuthBrokerWireSchemas(): AuthBrokerWireSchemas {
|
||||
// Wire schemas validate only a handful of times per process, so ArkType's
|
||||
// definition-time JIT codegen is startup tax. A local jitless scope skips
|
||||
// that codegen and uses interpreted traversal; correctness is unchanged.
|
||||
const { type } = scope({}, { jitless: true });
|
||||
|
||||
// ─── Credential payloads ───────────────────────────────────────────────────
|
||||
|
||||
/** Real OAuth credential (broker-side) — refresh token is the actual upstream value. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export { type Type, type } from "arktype";
|
||||
export { type Type, type } from "@oh-my-pi/omptype";
|
||||
export { type ZodType, z } from "zod/v4";
|
||||
export * from "./api-registry";
|
||||
export type * from "./auth-broker";
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* and options.
|
||||
*/
|
||||
|
||||
import { type } from "arktype";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import type {
|
||||
ContentBlockParam,
|
||||
ImageBlockParam,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { Effort } from "@oh-my-pi/pi-catalog/effort";
|
||||
import { logger } from "@oh-my-pi/pi-utils";
|
||||
import { type } from "arktype";
|
||||
import { captureRequestHeaders, resolvePromptCacheKey } from "../auth-gateway/http";
|
||||
import * as AIError from "../error";
|
||||
import type {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
||||
import { scheduler } from "node:timers/promises";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { calculateCost } from "@oh-my-pi/pi-catalog/models";
|
||||
import {
|
||||
ANTIGRAVITY_SYSTEM_INSTRUCTION,
|
||||
@@ -13,7 +14,6 @@ import {
|
||||
getGeminiCliHeaders,
|
||||
} from "@oh-my-pi/pi-catalog/wire/gemini-headers";
|
||||
import { extractHttpStatusFromError, fetchWithRetry, readSseJson } from "@oh-my-pi/pi-utils";
|
||||
import { type } from "arktype";
|
||||
import * as AIError from "../error";
|
||||
import type {
|
||||
Api,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* `stream_options.include_obfuscation`) — does not trip 400s on shapes we simply ignore.
|
||||
*/
|
||||
|
||||
import { type } from "arktype";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import type {
|
||||
ChatCompletionContentPart,
|
||||
ChatCompletionCreateParams,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { type } from "arktype";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { resolvePromptCacheKey } from "../auth-gateway/http";
|
||||
/**
|
||||
* Parsed inbound OpenAI chat-completions request, ready to feed into pi-ai
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import * as os from "node:os";
|
||||
import { scheduler } from "node:timers/promises";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { calculateCost } from "@oh-my-pi/pi-catalog/models";
|
||||
import {
|
||||
CODEX_BASE_URL,
|
||||
@@ -19,7 +20,6 @@ import {
|
||||
readSseJson,
|
||||
structuredCloneJSON,
|
||||
} from "@oh-my-pi/pi-utils";
|
||||
import { type } from "arktype";
|
||||
import packageJson from "../../package.json" with { type: "json" };
|
||||
import * as AIError from "../error";
|
||||
import { getEnvApiKey, isOfficialCodexApiUrl } from "../stream";
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* is a worse outcome than dropping them on the floor.
|
||||
*/
|
||||
|
||||
import { type } from "arktype";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import type {
|
||||
EasyInputMessage,
|
||||
ResponseCreateParams,
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
* Inverse direction (source-of-truth for item shapes): ../../providers/openai-responses.ts
|
||||
*/
|
||||
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { logger, structuredCloneJSON } from "@oh-my-pi/pi-utils";
|
||||
import { type } from "arktype";
|
||||
import { resolvePromptCacheKey } from "../auth-gateway/http";
|
||||
import type { AuthGatewayStreamControl, AuthGatewayParsedRequest as ParsedRequest } from "../auth-gateway/types";
|
||||
import * as AIError from "../error";
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
export * from "@oh-my-pi/pi-catalog/effort";
|
||||
export * from "@oh-my-pi/pi-catalog/types";
|
||||
|
||||
import type { Type } from "@oh-my-pi/omptype";
|
||||
import type {
|
||||
DeleteArgs,
|
||||
DeleteResult,
|
||||
@@ -35,7 +36,6 @@ import type {
|
||||
import type { Effort } from "@oh-my-pi/pi-catalog/effort";
|
||||
import { isOpenAIModelId } from "@oh-my-pi/pi-catalog/identity/family";
|
||||
import type { Api, FetchImpl, KnownApi, Model, Provider, ThinkingBudgets, Usage } from "@oh-my-pi/pi-catalog/types";
|
||||
import type { Type } from "arktype";
|
||||
import type { ZodType, z } from "zod/v4";
|
||||
import type { ApiKey } from "./auth-retry";
|
||||
import type { BedrockOptions } from "./providers/amazon-bedrock";
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Provides a normalized schema to represent multiple limit windows, model tiers,
|
||||
* and shared quotas across providers.
|
||||
*/
|
||||
import { type } from "arktype";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import type { FetchImpl, Provider } from "./types";
|
||||
export type UsageUnit = "percent" | "tokens" | "requests" | "usd" | "minutes" | "bytes" | "unknown";
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
* JSON Schema dialect.
|
||||
*/
|
||||
|
||||
import type { Type } from "arktype";
|
||||
import type { Type } from "@oh-my-pi/omptype";
|
||||
// We import the Zod *value* (z) for runtime APIs. Marker checks rely on the
|
||||
// `_zod` symbol that every Zod v4 schema instance carries.
|
||||
import { type ZodType, z } from "zod/v4";
|
||||
|
||||
@@ -22,8 +22,9 @@
|
||||
* keeps the schema in charge of acceptance — we never invent values, only
|
||||
* massage shapes the LLM almost got right.
|
||||
*/
|
||||
|
||||
import { type Type, type } from "@oh-my-pi/omptype";
|
||||
import { structuredCloneJSON } from "@oh-my-pi/pi-utils";
|
||||
import { type Type, type } from "arktype";
|
||||
import type { ZodType } from "zod/v4";
|
||||
import type { $ZodIssue as ZodIssue } from "zod/v4/core";
|
||||
import * as AIError from "../error";
|
||||
|
||||
@@ -3,6 +3,7 @@ import * as fs from "node:fs";
|
||||
import * as os from "node:os";
|
||||
import * as path from "node:path";
|
||||
import * as tls from "node:tls";
|
||||
import { type as arkType } from "@oh-my-pi/omptype";
|
||||
import { Effort } from "@oh-my-pi/pi-ai";
|
||||
import {
|
||||
applyClaudeToolPrefix,
|
||||
@@ -32,7 +33,6 @@ import type {
|
||||
} from "@oh-my-pi/pi-ai/types";
|
||||
import { buildModel } from "@oh-my-pi/pi-catalog/build";
|
||||
import { removeSyncWithRetries } from "@oh-my-pi/pi-utils";
|
||||
import { type as arkType } from "arktype";
|
||||
import { withEnv } from "./helpers";
|
||||
|
||||
const ANTHROPIC_MODEL_SPEC: ModelSpec<"anthropic-messages"> = {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import {
|
||||
buildTransformedCodexRequestBody,
|
||||
convertOpenAICodexResponsesTools as convertCodexTools,
|
||||
@@ -18,7 +19,6 @@ import {
|
||||
} from "@oh-my-pi/pi-ai/providers/openai-shared";
|
||||
import type { AssistantMessage, Model, ModelSpec, Tool, ToolResultMessage } from "@oh-my-pi/pi-ai/types";
|
||||
import { buildModel } from "@oh-my-pi/pi-catalog/build";
|
||||
import { type } from "arktype";
|
||||
|
||||
const GRAMMAR = [
|
||||
"// top-level comment",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { Type, type } from "@oh-my-pi/omptype";
|
||||
import * as wireSchemas from "@oh-my-pi/pi-ai/auth-broker/wire-schemas";
|
||||
import { Type, type } from "arktype";
|
||||
|
||||
const REFRESHER = {
|
||||
enabled: false,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import type { Tool } from "@oh-my-pi/pi-ai/types";
|
||||
import { validateToolArguments } from "@oh-my-pi/pi-ai/utils/validation";
|
||||
import { type } from "arktype";
|
||||
|
||||
describe("Eval-tool language whitespace normalization", () => {
|
||||
it("trims a trailing newline on the ArkType-emitted language enum", () => {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { streamOpenAICompletions } from "@oh-my-pi/pi-ai/providers/openai-completions";
|
||||
import type { Context, Model, ModelSpec, Tool } from "@oh-my-pi/pi-ai/types";
|
||||
import { buildModel } from "@oh-my-pi/pi-catalog/build";
|
||||
import { Effort } from "@oh-my-pi/pi-catalog/effort";
|
||||
import { getBundledModel } from "@oh-my-pi/pi-catalog/models";
|
||||
import { type } from "arktype";
|
||||
|
||||
const echoTool: Tool = {
|
||||
name: "echo",
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
* requires when tool history is present.
|
||||
*/
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { streamOpenAICompletions } from "@oh-my-pi/pi-ai/providers/openai-completions";
|
||||
import type { AssistantMessage, Context, Model, ModelSpec, Tool } from "@oh-my-pi/pi-ai/types";
|
||||
import { buildModel } from "@oh-my-pi/pi-catalog/build";
|
||||
import { getBundledModel } from "@oh-my-pi/pi-catalog/models";
|
||||
import { type } from "arktype";
|
||||
|
||||
function abortedSignal(): AbortSignal {
|
||||
const controller = new AbortController();
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
* reasoning for that single turn rather than dropping `tool_choice` outright.
|
||||
*/
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { streamOpenAICompletions } from "@oh-my-pi/pi-ai/providers/openai-completions";
|
||||
import type { Context, Model, ModelSpec, Tool } from "@oh-my-pi/pi-ai/types";
|
||||
import { buildModel } from "@oh-my-pi/pi-catalog/build";
|
||||
import { getBundledModel } from "@oh-my-pi/pi-catalog/models";
|
||||
import { type } from "arktype";
|
||||
|
||||
const echoTool: Tool = {
|
||||
name: "echo",
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { streamOpenAICompletions } from "@oh-my-pi/pi-ai/providers/openai-completions";
|
||||
import type { Context, Model, Tool } from "@oh-my-pi/pi-ai/types";
|
||||
import { getBundledModel } from "@oh-my-pi/pi-catalog/models";
|
||||
import { type } from "arktype";
|
||||
|
||||
const echoTool: Tool = {
|
||||
name: "echo",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import {
|
||||
buildTransformedCodexRequestBody,
|
||||
convertCodexResponsesMessages,
|
||||
@@ -20,7 +21,6 @@ import {
|
||||
import type { AssistantMessage, Context, Model, ModelSpec, Tool, ToolResultMessage } from "@oh-my-pi/pi-ai/types";
|
||||
import { sanitizeOpenAIResponsesHistoryItemsForReplay } from "@oh-my-pi/pi-ai/utils";
|
||||
import { buildModel } from "@oh-my-pi/pi-catalog/build";
|
||||
import { type } from "arktype";
|
||||
|
||||
function model<TApi extends "openai-responses" | "openai-codex-responses">(
|
||||
api: TApi,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "bun:test";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import {
|
||||
convertCodexResponsesMessages,
|
||||
streamOpenAICodexResponses,
|
||||
@@ -10,7 +11,6 @@ import { createOpenAIResponsesHistoryPayload, truncateResponseItemId } from "@oh
|
||||
import { buildModel } from "@oh-my-pi/pi-catalog/build";
|
||||
import { type GeneratedProvider, getBundledModel } from "@oh-my-pi/pi-catalog/models";
|
||||
import * as piUtils from "@oh-my-pi/pi-utils";
|
||||
import { type } from "arktype";
|
||||
|
||||
const TEST_INSTALLATION_ID = "00000000-0000-4000-8000-000000000001";
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { buildParams, convertTools } from "@oh-my-pi/pi-ai/providers/openai-responses";
|
||||
import type { Context, Model, ModelSpec, Tool } from "@oh-my-pi/pi-ai/types";
|
||||
import { findStrictToolSchemaViolation } from "@oh-my-pi/pi-ai/utils/schema";
|
||||
import { buildModel } from "@oh-my-pi/pi-catalog/build";
|
||||
import { type } from "arktype";
|
||||
|
||||
function makeModel(): Model<"openai-responses"> {
|
||||
return buildModel({
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { streamOpenAICompletions } from "@oh-my-pi/pi-ai/providers/openai-completions";
|
||||
import { streamOpenAIResponses } from "@oh-my-pi/pi-ai/providers/openai-responses";
|
||||
import type {
|
||||
@@ -12,7 +13,6 @@ import type {
|
||||
} from "@oh-my-pi/pi-ai/types";
|
||||
import { buildModel } from "@oh-my-pi/pi-catalog/build";
|
||||
import { getBundledModel } from "@oh-my-pi/pi-catalog/models";
|
||||
import { type } from "arktype";
|
||||
|
||||
const testTool: Tool = {
|
||||
name: "echo",
|
||||
@@ -271,7 +271,7 @@ describe("OpenAI tool strict mode", () => {
|
||||
name: "dynamic_map",
|
||||
description: "Dynamic object map",
|
||||
parameters: type({
|
||||
values: "Record<string, string>?",
|
||||
"values?": { "[string]": "string" },
|
||||
}),
|
||||
},
|
||||
],
|
||||
|
||||
@@ -2,6 +2,7 @@ import { afterEach, beforeEach, describe, expect, test, vi } from "bun:test";
|
||||
import * as fs from "node:fs/promises";
|
||||
import * as os from "node:os";
|
||||
import * as path from "node:path";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { AuthStorage, REMOTE_REFRESH_SENTINEL, SqliteAuthCredentialStore } from "@oh-my-pi/pi-ai";
|
||||
import {
|
||||
AuthBrokerClient,
|
||||
@@ -15,7 +16,6 @@ import {
|
||||
import { snapshotResponseSchema } from "@oh-my-pi/pi-ai/auth-broker/wire-schemas";
|
||||
import * as oauthUtils from "@oh-my-pi/pi-ai/registry/oauth";
|
||||
import type { UsageLimit, UsageReport } from "@oh-my-pi/pi-ai/usage";
|
||||
import { type } from "arktype";
|
||||
import { removeWithRetries } from "../../utils/src/temp";
|
||||
|
||||
function requireLimit(report: UsageReport, id: string): UsageLimit {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import type { Tool } from "@oh-my-pi/pi-ai/types";
|
||||
import { isArkSchema, toolWireSchema } from "@oh-my-pi/pi-ai/utils/schema";
|
||||
import { validateToolArguments } from "@oh-my-pi/pi-ai/utils/validation";
|
||||
import { type } from "arktype";
|
||||
import { z } from "zod/v4";
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { normalizeAnthropicToolSchema } from "@oh-my-pi/pi-ai/providers/anthropic";
|
||||
import type { Tool } from "@oh-my-pi/pi-ai/types";
|
||||
import {
|
||||
@@ -13,7 +14,6 @@ import {
|
||||
toolWireSchema,
|
||||
zodToWireSchema,
|
||||
} from "@oh-my-pi/pi-ai/utils/schema";
|
||||
import { type } from "arktype";
|
||||
import { z } from "zod/v4";
|
||||
|
||||
describe("isZodSchema", () => {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { type ChildProcess, execSync, spawn } from "node:child_process";
|
||||
import * as fs from "node:fs/promises";
|
||||
import * as os from "node:os";
|
||||
import * as path from "node:path";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { Effort } from "@oh-my-pi/pi-ai";
|
||||
import { __resetVertexTokenCache } from "@oh-my-pi/pi-ai/providers/google-auth";
|
||||
import { complete, getEnvApiKey, stream } from "@oh-my-pi/pi-ai/stream";
|
||||
@@ -10,7 +11,6 @@ import type { Api, Context, ImageContent, Model, OptionsForApi, Tool, ToolResult
|
||||
import { buildModel } from "@oh-my-pi/pi-catalog/build";
|
||||
import { getBundledModel } from "@oh-my-pi/pi-catalog/models";
|
||||
import { $which } from "@oh-my-pi/pi-utils";
|
||||
import { type } from "arktype";
|
||||
import { removeWithRetries } from "../../utils/src/temp";
|
||||
import { e2eApiKey, resolveApiKey } from "./oauth";
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { complete } from "@oh-my-pi/pi-ai/stream";
|
||||
import type { Api, Context, Model, OptionsForApi, Tool } from "@oh-my-pi/pi-ai/types";
|
||||
import { getBundledModel } from "@oh-my-pi/pi-catalog/models";
|
||||
import { type } from "arktype";
|
||||
import { e2eApiKey, resolveApiKey } from "./oauth";
|
||||
|
||||
// Resolve OAuth tokens at module level (async, runs before tests)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { type } from "arktype";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { renderToolInventory } from "../src/dialect/inventory";
|
||||
import type { InbandTool } from "../src/dialect/types";
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { complete } from "@oh-my-pi/pi-ai/stream";
|
||||
import type { Api, Context, Model, OptionsForApi, ToolResultMessage } from "@oh-my-pi/pi-ai/types";
|
||||
import { getBundledModel } from "@oh-my-pi/pi-catalog/models";
|
||||
import { type } from "arktype";
|
||||
import { e2eApiKey, resolveApiKey } from "./oauth";
|
||||
|
||||
// Empty schema for test tools - must be proper OBJECT type for Cloud Code Assist
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
*/
|
||||
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { usageReportSchema } from "@oh-my-pi/pi-ai";
|
||||
import { usageResponseSchema } from "@oh-my-pi/pi-ai/auth-broker/wire-schemas";
|
||||
import { type } from "arktype";
|
||||
|
||||
const DISCLAIMER = "OMP-observed spend only; OpenCode usage outside OMP is not included.";
|
||||
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Changed
|
||||
|
||||
- Replaced arktype with `@oh-my-pi/omptype` for discovery payload schemas (same definition DSL, lazy JIT validation).
|
||||
|
||||
## [17.2.6] - 2026-08-03
|
||||
|
||||
### Added
|
||||
|
||||
@@ -35,8 +35,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@bufbuild/protobuf": "catalog:",
|
||||
"@oh-my-pi/omptype": "catalog:",
|
||||
"@oh-my-pi/pi-utils": "catalog:",
|
||||
"arktype": "catalog:",
|
||||
"zod": "catalog:"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { type } from "arktype";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import type { ModelSpec } from "../types";
|
||||
import { discoveryFetch, toPositiveNumber } from "../utils";
|
||||
import {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { type } from "arktype";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { parseKnownModel, semverEqual } from "../identity/classify";
|
||||
import type { FetchImpl, ModelSpec } from "../types";
|
||||
import { discoveryFetch } from "../utils";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as http2 from "node:http2";
|
||||
import { create, fromBinary, toBinary } from "@bufbuild/protobuf";
|
||||
import { type } from "arktype";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { isKimiK3ModelId } from "../identity";
|
||||
import { bareModelId, parseGlmModel, semverGte } from "../identity/classify";
|
||||
import { getBundledModels } from "../models";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { type } from "arktype";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { getBundledModels } from "../models";
|
||||
import { toModelSpec } from "../provider-models/bundled-references";
|
||||
import type { FetchImpl, Model, ModelSpec } from "../types";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { type } from "arktype";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import type { Api, FetchImpl, ModelSpec, Provider } from "../types";
|
||||
import { discoveryFetch } from "../utils";
|
||||
|
||||
|
||||
@@ -2,8 +2,13 @@
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Changed
|
||||
|
||||
- Replaced arktype with `@oh-my-pi/omptype` across all tool parameter and config schemas: ~100x faster schema construction removes the arktype startup tax (the `scope({}, { jitless: true })` workarounds are gone). Config schema errors now report via `OmpErrors` entries with the same `path`/`problem` shape.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed extension/custom/hook tool wrappers stripping schema methods off `parameters`: `applyToolProxy` bound every callable property, and binding a schema (a plain function carrying `toJsonSchema`/`assert`) dropped those properties, breaking wire-schema detection and crashing the status-line token estimator with `JSON.stringify(schema) === undefined`. Prototype methods are still bound; own data properties and schema callables now pass through untouched.
|
||||
- Fixed bug where `agent()` calls in eval cells ignored turn cancellation and continued running indefinitely
|
||||
- Fixed the built-in `tail` printing `tail: Broken pipe` and failing when a downstream pipeline reader exited early (e.g. `tail -c N file.jsonl | jq …` with jq aborting on a parse error); it now exits silently with 141 (128+SIGPIPE) like a real tail, in every output path including `--follow`.
|
||||
- Fixed the in-process ps shell builtin rejecting common procps/BSD format specifiers (`ps -o tpgid,...` failed with `unknown output format specifier`); added `tpgid`, `pri`, `flags`, real/effective user and group columns, `wchan`, fault counters, `sz`, and the STAT `+` foreground flag.
|
||||
@@ -2264,7 +2269,7 @@
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed `omp install` of legacy pi extensions failing with `Cannot find module '/$bunfs/root/packages/coding-agent/src/extensibility/typebox.js'` on every released `omp-<platform>-<arch>` binary. Commit `dc5c93462f` removed worker entrypoints from `scripts/ci-release-build-binaries.ts`; the inline comment then claimed the legacy-shim and package-barrel entrypoints (`typebox.ts`, `legacy-pi-{ai,coding-agent}-shim.ts`, `packages/{agent,natives,tui,utils}/...`) were "still" passed to `bun build --compile`, but they had never been re-added. The release binaries shipped without those files in bunfs, so `legacy-pi-compat.ts` redirected `typebox` imports to a bunfs path that didn't exist. `__resolveTypeBoxShimPath` now mirrors `__validateLegacyPiPackageRootOverrides` (#2168) by dropping the override when the shim file is missing, so a missing shim falls through to native `node_modules` resolution instead of emitting a dead bunfs URL ([#3414](https://github.com/can1357/oh-my-pi/issues/3414)).
|
||||
- Fixed `omp install` of legacy pi extensions failing because the compiled binary omitted the coding-agent TypeBox shim on every released `omp-<platform>-<arch>` binary. Commit `dc5c93462f` removed worker entrypoints from `scripts/ci-release-build-binaries.ts`; the inline comment then claimed the legacy-shim and package-barrel entrypoints (`typebox.ts`, `legacy-pi-{ai,coding-agent}-shim.ts`, `packages/{agent,natives,tui,utils}/...`) were "still" passed to `bun build --compile`, but they had never been re-added. The release binaries shipped without those files in bunfs, so `legacy-pi-compat.ts` redirected `typebox` imports to a bunfs path that didn't exist. `__resolveTypeBoxShimPath` now mirrors `__validateLegacyPiPackageRootOverrides` (#2168) by dropping the override when the shim file is missing, so a missing shim falls through to native `node_modules` resolution instead of emitting a dead bunfs URL ([#3414](https://github.com/can1357/oh-my-pi/issues/3414)).
|
||||
- Fixed every legacy `@(scope)/pi-*` and `@sinclair/typebox` import failing to load on the `omp-darwin-arm64` release binary (and any other `omp` built with Bun 1.3.14). `__validateLegacyPiPackageRootOverrides` and the `rewriteLegacyPiImports` emit path both depended on `--compile` extras being reachable as `/$bunfs/root/...` filesystem entries, but Bun 1.3.14 stopped exposing them through every API (`fs.existsSync`, `Bun.file().exists()`, `Bun.resolveSync`, `await import()` on the bunfs path or its `file://` URL all fail; only `/$bunfs/root/<binary-name>` itself answers). `legacy-pi-compat.ts` now keeps a JS-heap reference to every bundled pi-* surface in a lazy-loaded sibling `legacy-pi-bundled-registry.ts` and serves them through an `omp-legacy-pi-bundled:` virtual namespace whose `Bun.plugin().onLoad` returns synthetic re-exports — no bunfs path ever leaves the module in compiled mode, and dev / source-link / installed-package modes keep the historical `file://` rewrite. The matching `--compile` extras in `scripts/build-binary.ts`, the shared `scripts/binary-entrypoints.ts` list, and the dead `BUNFS_PACKAGE_ROOT` / `bunfsPath` / `__computeBunfsPackageRoot` / `__joinBunfsPath` helpers are gone. ([#3423](https://github.com/can1357/oh-my-pi/issues/3423))
|
||||
|
||||
## [16.1.17] - 2026-06-24
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
import { initTheme } from "../src/modes/theme/theme";
|
||||
import { truncateToVisualLines } from "../src/modes/components/visual-truncate";
|
||||
import { WelcomeComponent } from "../src/modes/components/welcome";
|
||||
import type { AssistantMessage } from "@oh-my-pi/pi-ai";
|
||||
import { Editor } from "@oh-my-pi/pi-tui";
|
||||
import { AssistantMessageComponent } from "../src/modes/components/assistant-message";
|
||||
import { TranscriptContainer } from "../src/modes/components/transcript-container";
|
||||
import { Settings } from "../src/config/settings";
|
||||
import { getEditorTheme } from "../src/modes/theme/theme";
|
||||
import { BlockUnitCounter, buildDisplayMessage, nextStep, visibleUnits } from "../src/modes/controllers/streaming-reveal";
|
||||
import * as fs from "node:fs";
|
||||
import * as os from "node:os";
|
||||
import * as path from "node:path";
|
||||
import * as fs from "node:fs";
|
||||
import { ReadTool } from "../src/tools/read";
|
||||
import type { AssistantMessage } from "@oh-my-pi/pi-ai";
|
||||
import { Editor } from "@oh-my-pi/pi-tui";
|
||||
import { Settings } from "../src/config/settings";
|
||||
import { AssistantMessageComponent } from "../src/modes/components/assistant-message";
|
||||
import { TranscriptContainer } from "../src/modes/components/transcript-container";
|
||||
import { truncateToVisualLines } from "../src/modes/components/visual-truncate";
|
||||
import { WelcomeComponent } from "../src/modes/components/welcome";
|
||||
import {
|
||||
BlockUnitCounter,
|
||||
buildDisplayMessage,
|
||||
nextStep,
|
||||
visibleUnits,
|
||||
} from "../src/modes/controllers/streaming-reveal";
|
||||
import { getEditorTheme, initTheme } from "../src/modes/theme/theme";
|
||||
import type { ToolSession } from "../src/tools";
|
||||
import { ReadTool } from "../src/tools/read";
|
||||
|
||||
const ITERATIONS = 500;
|
||||
const WIDTH = 100;
|
||||
@@ -41,13 +45,19 @@ bench("truncateToVisualLines", () => {
|
||||
truncateToVisualLines(longText, 20, WIDTH, 1);
|
||||
});
|
||||
|
||||
const welcome = new WelcomeComponent("8.12.3", "claude-3.7", "anthropic", [
|
||||
{ name: "Test session", timeAgo: "2m" },
|
||||
{ name: "Another session", timeAgo: "1h" },
|
||||
], [
|
||||
{ name: "tsserver", status: "ready", fileTypes: ["ts", "tsx", "js"] },
|
||||
{ name: "rust-analyzer", status: "connecting", fileTypes: ["rs"] },
|
||||
]);
|
||||
const welcome = new WelcomeComponent(
|
||||
"8.12.3",
|
||||
"claude-3.7",
|
||||
"anthropic",
|
||||
[
|
||||
{ name: "Test session", timeAgo: "2m" },
|
||||
{ name: "Another session", timeAgo: "1h" },
|
||||
],
|
||||
[
|
||||
{ name: "tsserver", status: "ready", fileTypes: ["ts", "tsx", "js"] },
|
||||
{ name: "rust-analyzer", status: "connecting", fileTypes: ["rs"] },
|
||||
],
|
||||
);
|
||||
|
||||
bench("WelcomeComponent.render", () => {
|
||||
welcome.render(WIDTH);
|
||||
@@ -83,7 +93,14 @@ function makeTextMessage(text: string): AssistantMessage {
|
||||
api: "anthropic-messages",
|
||||
provider: "anthropic",
|
||||
model: "bench",
|
||||
usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, totalTokens: 0, cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 } },
|
||||
usage: {
|
||||
input: 0,
|
||||
output: 0,
|
||||
cacheRead: 0,
|
||||
cacheWrite: 0,
|
||||
totalTokens: 0,
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },
|
||||
},
|
||||
stopReason: "stop",
|
||||
timestamp: 0,
|
||||
};
|
||||
@@ -152,7 +169,13 @@ try {
|
||||
// text block — the shape C2 targets. Current code re-lexes BOTH every tick;
|
||||
// after C2 the finalized thinking block stays L1-cached and only the tail re-lexes.
|
||||
function makeThinkingPlusText(thinking: string, text: string): AssistantMessage {
|
||||
return { ...makeTextMessage(text), content: [{ type: "thinking", thinking }, { type: "text", text }] };
|
||||
return {
|
||||
...makeTextMessage(text),
|
||||
content: [
|
||||
{ type: "thinking", thinking },
|
||||
{ type: "text", text },
|
||||
],
|
||||
};
|
||||
}
|
||||
console.log("\nstreamingRevealMultiBlock (C2: finalized thinking block + growing text):");
|
||||
try {
|
||||
@@ -174,7 +197,9 @@ try {
|
||||
steps++;
|
||||
}
|
||||
const ms = (Bun.nanoseconds() - start) / 1e6;
|
||||
console.log(` text=${n} (+2500 thinking): ${ms.toFixed(2)}ms total over ${steps} steps (${(ms / steps).toFixed(4)}ms/step)`);
|
||||
console.log(
|
||||
` text=${n} (+2500 thinking): ${ms.toFixed(2)}ms total over ${steps} steps (${(ms / steps).toFixed(4)}ms/step)`,
|
||||
);
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(` (skipped: ${(err as Error).message})`);
|
||||
|
||||
@@ -121,5 +121,9 @@ const msPerStep = elapsedMs / totalTicks;
|
||||
|
||||
console.log(`METRIC reveal_ms_per_episode=${msPerEpisode.toFixed(4)}`);
|
||||
console.log(`METRIC reveal_ms_per_step=${msPerStep.toFixed(5)}`);
|
||||
console.log(`ASI graphemes=${graphemes} episodes=${MEASURE_EPISODES} ticks_per_episode=${(totalTicks / MEASURE_EPISODES).toFixed(2)} warmup=${WARMUP_EPISODES}`);
|
||||
console.log(`(reveal: ${graphemes} graphemes, ${(totalTicks / MEASURE_EPISODES).toFixed(1)} ticks/episode, ${msPerEpisode.toFixed(3)} ms/episode, ${msPerStep.toFixed(4)} ms/step)`);
|
||||
console.log(
|
||||
`ASI graphemes=${graphemes} episodes=${MEASURE_EPISODES} ticks_per_episode=${(totalTicks / MEASURE_EPISODES).toFixed(2)} warmup=${WARMUP_EPISODES}`,
|
||||
);
|
||||
console.log(
|
||||
`(reveal: ${graphemes} graphemes, ${(totalTicks / MEASURE_EPISODES).toFixed(1)} ticks/episode, ${msPerEpisode.toFixed(3)} ms/episode, ${msPerStep.toFixed(4)} ms/step)`,
|
||||
);
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
"@mozilla/readability": "catalog:",
|
||||
"@oh-my-pi/hashline": "catalog:",
|
||||
"@oh-my-pi/omp-stats": "catalog:",
|
||||
"@oh-my-pi/omptype": "catalog:",
|
||||
"@oh-my-pi/pi-agent-core": "catalog:",
|
||||
"@oh-my-pi/pi-ai": "catalog:",
|
||||
"@oh-my-pi/pi-catalog": "catalog:",
|
||||
@@ -77,7 +78,6 @@
|
||||
"@puppeteer/browsers": "catalog:",
|
||||
"@types/turndown": "catalog:",
|
||||
"@xterm/headless": "catalog:",
|
||||
"arktype": "catalog:",
|
||||
"chalk": "catalog:",
|
||||
"fast-xml-parser": "catalog:",
|
||||
"handlebars": "catalog:",
|
||||
|
||||
@@ -24,7 +24,7 @@ const BUNDLED_PACKAGES: readonly BundledPackage[] = [
|
||||
];
|
||||
|
||||
const TYPEBOX_MODULE_KEY = "typebox";
|
||||
const TYPEBOX_SHIM = "typebox.ts";
|
||||
const TYPEBOX_COMPAT_MODULE = "legacy-typebox.ts";
|
||||
const SKIPPED_WILDCARD_BASENAMES = new Set(["index"]);
|
||||
const MAIN_THREAD_UNSAFE_WILDCARD_BASENAMES = new Set(["worker-entry"]);
|
||||
|
||||
@@ -172,7 +172,7 @@ export async function collectBundledPiEntries(): Promise<BundledPiEntry[]> {
|
||||
}
|
||||
}
|
||||
|
||||
addEntry(TYPEBOX_MODULE_KEY, "bundledTypeBoxShim", shimSpecifier(TYPEBOX_SHIM));
|
||||
addEntry(TYPEBOX_MODULE_KEY, "bundledTypeBoxShim", shimSpecifier(TYPEBOX_COMPAT_MODULE));
|
||||
return entries;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import type {
|
||||
AgentIdentity,
|
||||
AgentTelemetryConfig,
|
||||
@@ -7,7 +8,6 @@ import type {
|
||||
AgentToolUpdateCallback,
|
||||
} from "@oh-my-pi/pi-agent-core";
|
||||
import { escapeXmlAttribute, escapeXmlText } from "@oh-my-pi/pi-utils";
|
||||
import { type } from "arktype";
|
||||
import adviseDescription from "../prompts/advisor/advise-tool.md" with { type: "text" };
|
||||
|
||||
const adviseSchema = type({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as fs from "node:fs/promises";
|
||||
import * as path from "node:path";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { isEnoent, logger } from "@oh-my-pi/pi-utils";
|
||||
import { type } from "arktype";
|
||||
import { YAML } from "bun";
|
||||
import { expandAtImports } from "../discovery/at-imports";
|
||||
import { BUILTIN_TOOL_NAMES, normalizeToolNames } from "../tools/builtin-names";
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import * as path from "node:path";
|
||||
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { Text } from "@oh-my-pi/pi-tui";
|
||||
import { type } from "arktype";
|
||||
import type { ToolDefinition } from "../../extensibility/extensions";
|
||||
import type { Theme } from "../../modes/theme/theme";
|
||||
import { replaceTabs, truncateToWidth } from "../../tools/render-utils";
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import * as fs from "node:fs";
|
||||
import * as path from "node:path";
|
||||
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { Text } from "@oh-my-pi/pi-tui";
|
||||
import { type } from "arktype";
|
||||
import type { ToolDefinition } from "../../extensibility/extensions";
|
||||
import type { Theme } from "../../modes/theme/theme";
|
||||
import { replaceTabs, truncateToWidth } from "../../tools/render-utils";
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import * as fs from "node:fs";
|
||||
import * as path from "node:path";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { Text } from "@oh-my-pi/pi-tui";
|
||||
import { formatBytes } from "@oh-my-pi/pi-utils";
|
||||
import { type } from "arktype";
|
||||
import { executeBash } from "../../exec/bash-executor";
|
||||
import type { ToolDefinition } from "../../extensibility/extensions";
|
||||
import type { Theme } from "../../modes/theme/theme";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { Text } from "@oh-my-pi/pi-tui";
|
||||
import { type } from "arktype";
|
||||
import type { ToolDefinition } from "../../extensibility/extensions";
|
||||
import type { Theme } from "../../modes/theme/theme";
|
||||
import { replaceTabs, truncateToWidth } from "../../tools/render-utils";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { prompt } from "@oh-my-pi/pi-utils";
|
||||
import { type } from "arktype";
|
||||
import analyzeFilePrompt from "../../../commit/agentic/prompts/analyze-file.md" with { type: "text" };
|
||||
import type { CommitAgentState } from "../../../commit/agentic/state";
|
||||
import type { NumstatEntry } from "../../../commit/types";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { type } from "arktype";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import type { CommitAgentState } from "../../../commit/agentic/state";
|
||||
import type { CustomTool } from "../../../extensibility/custom-tools/types";
|
||||
import * as git from "../../../utils/git";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { type } from "arktype";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import type { DiffHunk, FileHunks } from "../../../commit/types";
|
||||
import type { CustomTool } from "../../../extensibility/custom-tools/types";
|
||||
import * as git from "../../../utils/git";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { type } from "arktype";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import type { CommitAgentState, GitOverviewSnapshot } from "../../../commit/agentic/state";
|
||||
import { extractScopeCandidates } from "../../../commit/analysis/scope";
|
||||
import type { CustomTool } from "../../../extensibility/custom-tools/types";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { type } from "arktype";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import type { CommitAgentState } from "../../../commit/agentic/state";
|
||||
import { CHANGELOG_CATEGORIES, type ChangelogCategory } from "../../../commit/types";
|
||||
import type { CustomTool } from "../../../extensibility/custom-tools/types";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { type } from "arktype";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import type { CommitAgentState } from "../../../commit/agentic/state";
|
||||
import {
|
||||
capDetails,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { type } from "arktype";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import type { CustomTool } from "../../../extensibility/custom-tools/types";
|
||||
import * as git from "../../../utils/git";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { type } from "arktype";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
|
||||
export const commitTypeSchema = type(
|
||||
"'feat' | 'fix' | 'refactor' | 'perf' | 'docs' | 'test' | 'build' | 'ci' | 'chore' | 'style' | 'revert'",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { type } from "arktype";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import type { CommitAgentState, SplitCommitGroup, SplitCommitPlan } from "../../../commit/agentic/state";
|
||||
import { computeDependencyOrder } from "../../../commit/agentic/topo-sort";
|
||||
import {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import type { ThinkingLevel } from "@oh-my-pi/pi-agent-core";
|
||||
import type { Api, ApiKey, AssistantMessage, Model } from "@oh-my-pi/pi-ai";
|
||||
import { completeSimple, validateToolCall } from "@oh-my-pi/pi-ai";
|
||||
import { prompt } from "@oh-my-pi/pi-utils";
|
||||
import { type } from "arktype";
|
||||
import summarySystemPrompt from "../../commit/prompts/summary-system.md" with { type: "text" };
|
||||
import summaryUserPrompt from "../../commit/prompts/summary-user.md" with { type: "text" };
|
||||
import type { CommitSummary } from "../../commit/types";
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import type { ThinkingLevel } from "@oh-my-pi/pi-agent-core";
|
||||
import type { Api, ApiKey, AssistantMessage, Model } from "@oh-my-pi/pi-ai";
|
||||
import { completeSimple, validateToolCall } from "@oh-my-pi/pi-ai";
|
||||
import { prompt } from "@oh-my-pi/pi-utils";
|
||||
import { type } from "arktype";
|
||||
import changelogSystemPrompt from "../../commit/prompts/changelog-system.md" with { type: "text" };
|
||||
import changelogUserPrompt from "../../commit/prompts/changelog-user.md" with { type: "text" };
|
||||
import type { ChangelogGenerationResult } from "../../commit/types";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as fs from "node:fs";
|
||||
import * as path from "node:path";
|
||||
import { OmpErrors, type Type } from "@oh-my-pi/omptype";
|
||||
import { getAgentDir, isEnoent, logger } from "@oh-my-pi/pi-utils";
|
||||
import { ArkErrors, type Type } from "arktype";
|
||||
import { JSONC, YAML } from "bun";
|
||||
|
||||
/** Minimal subset of the AJV ConfigSchemaError shape this module actually relies on. */
|
||||
@@ -252,7 +252,7 @@ export class ConfigFile<T> implements IConfigFile<T> {
|
||||
}
|
||||
|
||||
const checked = this.schema(parsed);
|
||||
if (checked instanceof ArkErrors) {
|
||||
if (checked instanceof OmpErrors) {
|
||||
const schemaErrors: ConfigSchemaError[] = checked.map(error => ({
|
||||
instancePath: error.path.length === 0 ? "root" : error.path.join("."),
|
||||
message: error.problem,
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { once } from "@oh-my-pi/pi-utils";
|
||||
import { scope } from "arktype";
|
||||
|
||||
export const getModelsConfigSchemaBundle = once(() => {
|
||||
// Config schemas validate at most a handful of times per process (on config
|
||||
// load), so the eager JIT codegen ArkType runs at definition time is pure
|
||||
// startup tax. A local jitless scope skips that codegen and falls back to
|
||||
// interpreted traversal — ~65% cheaper to construct, validation correctness
|
||||
// unchanged. (No `name`: duplicate module instances would collide.)
|
||||
const { type } = scope({}, { jitless: true });
|
||||
|
||||
const OpenRouterRoutingSchema = type({
|
||||
"only?": "string[]",
|
||||
"order?": "string[]",
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* deliberately permissive (allows extra keys) so providers can attach extra
|
||||
* keys without rejection; only `input` is required.
|
||||
*/
|
||||
import { type } from "arktype";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
|
||||
export const hashlineEditParamsSchema = type({
|
||||
input: "string",
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* the `patch` mode.
|
||||
*/
|
||||
|
||||
import { type } from "arktype";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { parseApplyPatch, parseApplyPatchStreaming } from "../apply-patch/parser";
|
||||
import { ApplyPatchError } from "../diff";
|
||||
import type { PatchEditEntry } from "./patch";
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
|
||||
import * as fs from "node:fs";
|
||||
import * as path from "node:path";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import type { AgentToolResult } from "@oh-my-pi/pi-agent-core";
|
||||
import { isEnoent } from "@oh-my-pi/pi-utils";
|
||||
import { type } from "arktype";
|
||||
import {
|
||||
type FileDiagnosticsResult,
|
||||
flushLspWritethroughBatch,
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
* Provides both character-level and line-level fuzzy matching with progressive
|
||||
* fallback strategies for finding text in files.
|
||||
*/
|
||||
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import type { AgentToolResult } from "@oh-my-pi/pi-agent-core";
|
||||
import { type } from "arktype";
|
||||
import type { FileDiagnosticsResult, WritethroughCallback, WritethroughDeferredHandle } from "../../lsp";
|
||||
import type { ToolSession } from "../../tools";
|
||||
import { routeWriteThroughBridge } from "../../tools/acp-bridge";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Host-side handler for the eval `agent()` helper.
|
||||
*/
|
||||
import { type } from "arktype";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import {
|
||||
buildStructuredSubagentRecoveryHint,
|
||||
runStructuredSubagent,
|
||||
|
||||
@@ -11,10 +11,11 @@
|
||||
* The call is oneshot and toolless from the model's perspective — pure text
|
||||
* in, text (or, with `schema`, a structured object) out.
|
||||
*/
|
||||
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import { instrumentedCompleteSimple, resolveTelemetry } from "@oh-my-pi/pi-agent-core";
|
||||
import { type Api, Effort, type Model, type Tool } from "@oh-my-pi/pi-ai";
|
||||
import { getSupportedEfforts } from "@oh-my-pi/pi-catalog/model-thinking";
|
||||
import { type } from "arktype";
|
||||
import { extractTextContent, extractToolCall, parseJsonPayload } from "../commit/utils";
|
||||
|
||||
import {
|
||||
@@ -46,7 +47,7 @@ const completionArgsSchema = type({
|
||||
prompt: "string>0",
|
||||
"model?": "'smol'|'default'|'slow'",
|
||||
"system?": "string",
|
||||
"schema?": "Record<string,unknown>",
|
||||
"schema?": { "[string]": "unknown" },
|
||||
});
|
||||
|
||||
export interface EvalCompletionBridgeOptions {
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
*/
|
||||
import * as fs from "node:fs";
|
||||
import * as path from "node:path";
|
||||
import * as arktype from "@oh-my-pi/omptype";
|
||||
import * as zodModule from "@oh-my-pi/omptype/zod";
|
||||
import { getAgentDir, getProjectDir, isEnoent, logger } from "@oh-my-pi/pi-utils";
|
||||
import * as arktype from "arktype";
|
||||
import * as zodModule from "zod/v4";
|
||||
import { getConfigDirs } from "../../config";
|
||||
import { execCommand } from "../../exec/exec";
|
||||
// Runtime self-reference: dereference this namespace only inside loader functions to keep the index.ts cycle safe.
|
||||
import * as PiCodingAgent from "../../index";
|
||||
import * as typebox from "../typebox";
|
||||
import * as typebox from "../legacy-typebox";
|
||||
import { GreenCommand } from "./bundled/ci-green";
|
||||
import { ReviewCommand } from "./bundled/review";
|
||||
import type {
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
* Unlike markdown commands which expand to prompts, custom commands can execute
|
||||
* arbitrary logic with full access to the hook context.
|
||||
*/
|
||||
import type * as arktype from "arktype";
|
||||
import type * as zod from "zod/v4";
|
||||
import type * as arktype from "@oh-my-pi/omptype";
|
||||
import type * as TypeBox from "@oh-my-pi/omptype/typebox";
|
||||
import type * as zod from "@oh-my-pi/omptype/zod";
|
||||
import type { ExecOptions, ExecResult, HookCommandContext } from "../../extensibility/hooks/types";
|
||||
import type * as PiCodingAgent from "../../index";
|
||||
import type * as TypeBox from "../typebox";
|
||||
|
||||
// Re-export for custom commands to use
|
||||
export type { ExecOptions, ExecResult, HookCommandContext };
|
||||
@@ -27,7 +27,7 @@ export interface CustomCommandAPI {
|
||||
typebox: typeof TypeBox;
|
||||
/** Injected arktype module for validation in custom commands. */
|
||||
arktype: typeof arktype;
|
||||
/** Injected zod/v4 module for canonical command validation. */
|
||||
/** Injected omptype-backed zod facade for command validation. */
|
||||
zod: typeof zod;
|
||||
/** Injected pi-coding-agent exports */
|
||||
pi: typeof PiCodingAgent;
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
* CustomToolAPI to avoid import resolution issues with custom tools loaded from user directories.
|
||||
*/
|
||||
import * as path from "node:path";
|
||||
import { type } from "@oh-my-pi/omptype";
|
||||
import * as zodModule from "@oh-my-pi/omptype/zod";
|
||||
import type { AgentToolResult } from "@oh-my-pi/pi-agent-core";
|
||||
import { logger } from "@oh-my-pi/pi-utils";
|
||||
import { type } from "arktype";
|
||||
import * as zodModule from "zod/v4";
|
||||
import { toolCapability } from "../../capability/tool";
|
||||
import { type CustomTool, loadCapability } from "../../discovery";
|
||||
import type { ExecOptions } from "../../exec/exec";
|
||||
@@ -17,7 +17,7 @@ import type { HookUIContext } from "../../extensibility/hooks/types";
|
||||
import { getAllPluginToolPaths } from "../../extensibility/plugins/loader";
|
||||
// Runtime self-reference: dereference this namespace only inside loader functions to keep the index.ts cycle safe.
|
||||
import * as PiCodingAgent from "../../index";
|
||||
import * as typebox from "../typebox";
|
||||
import * as typebox from "../legacy-typebox";
|
||||
import { createNoOpUIContext, resolvePath, withHostGuard } from "../utils";
|
||||
import type { CustomToolAPI, CustomToolFactory, LoadedCustomTool, ToolLoadError } from "./types";
|
||||
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
* Custom tools are TypeScript modules that define additional tools for the agent.
|
||||
* They can provide custom rendering for tool calls and results in the TUI.
|
||||
*/
|
||||
|
||||
import type { type as ArkType } from "@oh-my-pi/omptype";
|
||||
import type * as TypeBox from "@oh-my-pi/omptype/typebox";
|
||||
import type * as zod from "@oh-my-pi/omptype/zod";
|
||||
import type {
|
||||
AgentToolResult,
|
||||
AgentToolUpdateCallback,
|
||||
@@ -16,8 +20,6 @@ import type { CompactionResult } from "@oh-my-pi/pi-agent-core/compaction";
|
||||
import type { FetchImpl, Model, Static, TSchema } from "@oh-my-pi/pi-ai";
|
||||
import type { Component } from "@oh-my-pi/pi-tui";
|
||||
import type { logger as PiLogger } from "@oh-my-pi/pi-utils";
|
||||
import type { type as ArkType } from "arktype";
|
||||
import type * as zod from "zod/v4";
|
||||
import type { Rule } from "../../capability/rule";
|
||||
import type { ModelRegistry } from "../../config/model-registry";
|
||||
import type { Settings } from "../../config/settings";
|
||||
@@ -29,7 +31,6 @@ import type { Theme } from "../../modes/theme/theme";
|
||||
import type { ReadonlySessionManager } from "../../session/session-manager";
|
||||
import type { TodoItem } from "../../tools/todo";
|
||||
import type { RecoveredRetryError } from "../shared-events";
|
||||
import type * as TypeBox from "../typebox";
|
||||
|
||||
/** Alias for clarity */
|
||||
export type CustomToolUIContext = HookUIContext;
|
||||
@@ -69,7 +70,7 @@ export interface CustomToolAPI {
|
||||
typebox: typeof TypeBox;
|
||||
/** Injected arktype module for arktype-authored custom tools. */
|
||||
arktype: typeof ArkType;
|
||||
/** Injected zod/v4 module for canonical parameter schemas. */
|
||||
/** Injected omptype-backed zod facade for parameter schemas. */
|
||||
zod: typeof zod;
|
||||
/** Injected pi-coding-agent exports */
|
||||
pi: typeof PiCodingAgent;
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
import type * as fs1 from "node:fs";
|
||||
import * as fs from "node:fs/promises";
|
||||
import * as path from "node:path";
|
||||
import { Type } from "@oh-my-pi/omptype";
|
||||
import * as zodModule from "@oh-my-pi/omptype/zod";
|
||||
import type { ThinkingLevel } from "@oh-my-pi/pi-agent-core";
|
||||
import type {
|
||||
ImageContent,
|
||||
@@ -16,8 +18,6 @@ import type {
|
||||
} from "@oh-my-pi/pi-ai";
|
||||
import type { KeyId } from "@oh-my-pi/pi-tui";
|
||||
import { hasFsCode, isEacces, isEnoent, logger } from "@oh-my-pi/pi-utils";
|
||||
import { Type } from "arktype";
|
||||
import * as zodModule from "zod/v4";
|
||||
import { type ExtensionModule, extensionModuleCapability } from "../../capability/extension-module";
|
||||
import { type Hook, hookCapability } from "../../capability/hook";
|
||||
import { isServiceTierFamily, isServiceTierForFamily } from "../../config/service-tier";
|
||||
@@ -29,9 +29,9 @@ import { execCommand } from "../../exec/exec";
|
||||
import * as PiCodingAgent from "../../index";
|
||||
import type { CustomMessagePayload } from "../../session/messages";
|
||||
import { EventBus } from "../../utils/event-bus";
|
||||
import * as TypeBox from "../legacy-typebox";
|
||||
import { installLegacyPiSpecifierShim, loadLegacyPiModule } from "../plugins/legacy-pi-compat";
|
||||
import { getAllPluginExtensionPaths } from "../plugins/loader";
|
||||
import * as TypeBox from "../typebox";
|
||||
|
||||
import { resolvePath, withHostGuard } from "../utils";
|
||||
import type {
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
* - Register commands, keyboard shortcuts, and CLI flags
|
||||
* - Interact with the user via UI primitives
|
||||
*/
|
||||
|
||||
import type { Type as arktype } from "@oh-my-pi/omptype";
|
||||
import type * as TypeBox from "@oh-my-pi/omptype/typebox";
|
||||
import type * as zod from "@oh-my-pi/omptype/zod";
|
||||
import type {
|
||||
AgentMessage,
|
||||
AgentToolResult,
|
||||
@@ -36,8 +40,6 @@ import type {
|
||||
import type { OAuthCredentials, OAuthLoginCallbacks } from "@oh-my-pi/pi-ai/oauth/types";
|
||||
import type { AutocompleteItem, AutocompleteProvider, Component, EditorTheme, KeyId, TUI } from "@oh-my-pi/pi-tui";
|
||||
import type { logger as PiLogger } from "@oh-my-pi/pi-utils";
|
||||
import type { Type as arktype } from "arktype";
|
||||
import type * as zod from "zod/v4";
|
||||
import type { KeybindingsManager } from "../../config/keybindings";
|
||||
import type { ModelRegistry } from "../../config/model-registry";
|
||||
import type { EditToolDetails } from "../../edit";
|
||||
@@ -102,7 +104,6 @@ import type {
|
||||
TurnStartEvent,
|
||||
} from "../shared-events";
|
||||
import type { SlashCommandInfo } from "../slash-commands";
|
||||
import type * as TypeBox from "../typebox";
|
||||
|
||||
export type { AppKeybinding, KeybindingsManager } from "../../config/keybindings";
|
||||
export type { ExecOptions, ExecResult } from "../../exec/exec";
|
||||
@@ -1113,7 +1114,7 @@ export interface ExtensionAPI {
|
||||
|
||||
/** Injected arktype module for arktype-authored extension tools (canonical going forward). */
|
||||
arktype: typeof arktype;
|
||||
/** Injected zod/v4 module for canonical extension tool parameter schemas. */
|
||||
/** Injected omptype-backed zod facade for extension tool parameter schemas. */
|
||||
zod: typeof zod;
|
||||
|
||||
/** Injected pi-coding-agent exports for accessing SDK utilities */
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
* Hook loader - loads TypeScript hook modules using native Bun import.
|
||||
*/
|
||||
import * as path from "node:path";
|
||||
import * as arktype from "@oh-my-pi/omptype";
|
||||
import * as zodModule from "@oh-my-pi/omptype/zod";
|
||||
import { logger } from "@oh-my-pi/pi-utils";
|
||||
import * as arktype from "arktype";
|
||||
import * as zodModule from "zod/v4";
|
||||
import { hookCapability } from "../../capability/hook";
|
||||
import type { Hook } from "../../discovery";
|
||||
import { loadCapability } from "../../discovery";
|
||||
// Runtime self-reference: dereference this namespace only inside loader functions to keep the index.ts cycle safe.
|
||||
import * as PiCodingAgent from "../../index";
|
||||
import type { CustomMessagePayload } from "../../session/messages";
|
||||
import * as typebox from "../typebox";
|
||||
import * as typebox from "../legacy-typebox";
|
||||
import { resolvePath, withHostGuard } from "../utils";
|
||||
import { execCommand } from "./runner";
|
||||
import type { ExecOptions, HookAPI, HookFactory, HookMessageRenderer, RegisteredCommand } from "./types";
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user