@oh-my-ai-sdk/omakase 0.1.0 → 0.2.0-beta.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/README.md +254 -22
- package/dist/approval.d.ts +9 -0
- package/dist/cell-checker.d.ts +46 -0
- package/dist/cell-checker.js +311 -0
- package/dist/cell-contract.d.ts +43 -0
- package/dist/cell-contract.js +1 -0
- package/dist/cell-declarations.d.ts +16 -0
- package/dist/cell-declarations.js +209 -0
- package/dist/cell-source.d.ts +12 -0
- package/dist/cell-source.js +29 -0
- package/dist/cell.d.ts +14 -0
- package/dist/cell.js +104 -0
- package/dist/cli.js +16 -4
- package/dist/code-mode.d.ts +3 -0
- package/dist/code-mode.js +2 -2
- package/dist/durable-bridge.d.ts +39 -0
- package/dist/durable-bridge.js +81 -0
- package/dist/durable-engine.d.ts +15 -0
- package/dist/durable-engine.js +102 -0
- package/dist/durable-host.d.ts +24 -0
- package/dist/durable-host.js +315 -0
- package/dist/durable-ownership.d.ts +24 -0
- package/dist/durable-ownership.js +99 -0
- package/dist/durable-protocol.d.ts +60 -0
- package/dist/durable-protocol.js +15 -0
- package/dist/durable-worker/licenses/@jridgewell/resolve-uri/LICENSE +19 -0
- package/dist/durable-worker/licenses/@jridgewell/sourcemap-codec/LICENSE +19 -0
- package/dist/durable-worker/licenses/@jridgewell/trace-mapping/LICENSE +19 -0
- package/dist/durable-worker/licenses/@vercel/functions/LICENSE +202 -0
- package/dist/durable-worker/licenses/@vercel/oidc/LICENSE +202 -0
- package/dist/durable-worker/licenses/@workflow/core/LICENSE.md +201 -0
- package/dist/durable-worker/licenses/@workflow/errors/LICENSE.md +201 -0
- package/dist/durable-worker/licenses/@workflow/serde/LICENSE.md +3 -0
- package/dist/durable-worker/licenses/@workflow/utils/LICENSE.md +201 -0
- package/dist/durable-worker/licenses/@workflow/world/LICENSE.md +201 -0
- package/dist/durable-worker/licenses/@workflow/world-local/LICENSE.md +201 -0
- package/dist/durable-worker/licenses/@workflow/world-vercel/LICENSE.md +201 -0
- package/dist/durable-worker/licenses/cbor-extract/LICENSE +21 -0
- package/dist/durable-worker/licenses/cbor-x/LICENSE +21 -0
- package/dist/durable-worker/licenses/debug/LICENSE +20 -0
- package/dist/durable-worker/licenses/detect-libc/LICENSE +201 -0
- package/dist/durable-worker/licenses/devalue/LICENSE +7 -0
- package/dist/durable-worker/licenses/nanoid/LICENSE +20 -0
- package/dist/durable-worker/licenses/node-gyp-build-optional-packages/LICENSE +21 -0
- package/dist/durable-worker/licenses/picocolors/LICENSE +15 -0
- package/dist/durable-worker/licenses/semver/LICENSE +15 -0
- package/dist/durable-worker/licenses/ulid/LICENSE +21 -0
- package/dist/durable-worker/licenses/undici/LICENSE +21 -0
- package/dist/durable-worker/licenses/workflow/LICENSE.md +201 -0
- package/dist/durable-worker/licenses/zod/LICENSE +21 -0
- package/dist/durable-worker/manifest.json +13 -0
- package/dist/durable-worker/steps.mjs +61012 -0
- package/dist/durable-worker/versions.json +39 -0
- package/dist/durable-worker/worker.mjs +62256 -0
- package/dist/durable-worker/workflows.mjs +64759 -0
- package/dist/durable-worker/world-local/dist/index.mjs +45215 -0
- package/dist/durable-worker/world-local/package.json +58 -0
- package/dist/durable-worker-client.d.ts +16 -0
- package/dist/durable-worker-client.js +320 -0
- package/dist/execution-policy.d.ts +7 -0
- package/dist/execution-policy.js +21 -0
- package/dist/frontend.d.ts +10 -0
- package/dist/frontend.js +27 -8
- package/dist/host.d.ts +5 -2
- package/dist/host.js +39 -15
- package/dist/index.d.ts +4 -1
- package/dist/index.js +3 -1
- package/dist/marker.d.ts +2 -0
- package/dist/marker.js +2 -0
- package/dist/mcp-server.d.ts +5 -2
- package/dist/mcp-server.js +16 -6
- package/dist/skill-discovery.d.ts +2 -0
- package/dist/skill-discovery.js +4 -0
- package/dist/skills-cli.js +0 -0
- package/dist/skills-server.d.ts +1 -1
- package/dist/skills-server.js +21 -2
- package/dist/skills.js +11 -3
- package/dist/type-guard.d.ts +4 -0
- package/dist/type-guard.js +6 -0
- package/dist/workflow-host.d.ts +10 -0
- package/dist/workflow-host.js +92 -0
- package/dist/workflow.d.ts +68 -0
- package/dist/workflow.js +73 -0
- package/package.json +15 -4
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# Omakase
|
|
2
2
|
|
|
3
|
-
A local tool host for Claude Code, Codex and native AI SDK
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
A local tool host for Claude Code, Codex and native AI SDK agents.
|
|
4
|
+
One package and one MCP server expose one `cell` tool. Ordinary execution remains
|
|
5
|
+
the default; `execution: "durable"` opts into the WDK-backed beta. Both use the
|
|
6
|
+
same live tool catalog, bindings, validation and host permission policy.
|
|
7
7
|
|
|
8
8
|
The bundled skills MCP service owns collections and exposes one `list` tool plus
|
|
9
9
|
standard skill/resource endpoints. One regular reader handles local files and
|
|
@@ -15,6 +15,12 @@ Requires Node.js22.13 or newer. No model key is needed by the host: your existin
|
|
|
15
15
|
Claude/Codex session supplies the model. Configuration stays outside harness MCP
|
|
16
16
|
registration.
|
|
17
17
|
|
|
18
|
+
For a local beta candidate, install its packed `.tgz` with `bun add /absolute/path/to/archive.tgz`
|
|
19
|
+
and configure your MCP client with the absolute path to that installation's
|
|
20
|
+
`node_modules/.bin/omakase`. The registry commands below require the `beta`
|
|
21
|
+
dist-tag to have been published; building or installing a local candidate does
|
|
22
|
+
not publish it.
|
|
23
|
+
|
|
18
24
|
Create `~/.config/omakase/host.config.mjs` (or
|
|
19
25
|
`$XDG_CONFIG_HOME/omakase/host.config.mjs`):
|
|
20
26
|
|
|
@@ -35,8 +41,8 @@ remote pulls are explicit application operations. Nothing is copied into native
|
|
|
35
41
|
harness skill directories.
|
|
36
42
|
|
|
37
43
|
```sh
|
|
38
|
-
claude mcp add --scope user --transport stdio omakase -- npx -y @oh-my-ai-sdk/omakase
|
|
39
|
-
codex mcp add omakase -- npx -y @oh-my-ai-sdk/omakase
|
|
44
|
+
claude mcp add --scope user --transport stdio omakase -- npx -y @oh-my-ai-sdk/omakase@beta
|
|
45
|
+
codex mcp add omakase -- npx -y @oh-my-ai-sdk/omakase@beta
|
|
40
46
|
```
|
|
41
47
|
|
|
42
48
|
Restart the client and ask it to use Omakase to list and read a skill. Automatic
|
|
@@ -44,18 +50,121 @@ skill-name injection into harness prompts is not implemented. Native skills can
|
|
|
44
50
|
remain installed while you try this route.
|
|
45
51
|
|
|
46
52
|
For a fixed config path, launch
|
|
47
|
-
`npx -y @oh-my-ai-sdk/omakase --config /absolute/host.config.mjs`.
|
|
53
|
+
`npx -y @oh-my-ai-sdk/omakase@beta --config /absolute/host.config.mjs`.
|
|
48
54
|
Existing `--mcp-config /absolute/.mcp.json` imports ordinary downstream MCP tools.
|
|
49
|
-
Use `--help` for CLI options. Each invocation owns
|
|
50
|
-
|
|
55
|
+
Use `--help` for CLI options. Each invocation owns one live host. The durable
|
|
56
|
+
worker is included in the same installation and starts only on the first durable
|
|
57
|
+
call; ordinary calls and catalog inspection do not start it.
|
|
58
|
+
|
|
59
|
+
## Execution modes (beta)
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
cell({ code: 'return await skills.list({ server: "self" });' });
|
|
63
|
+
cell({ code: 'return await skills.list({ server: "self" });', execution: 'ordinary' });
|
|
64
|
+
cell({ code: 'return await skills.list({ server: "self" });', execution: 'durable' });
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
`code` accepts a JavaScript or TypeScript function body with top-level `await`
|
|
68
|
+
and `return`; an omitted return becomes `null`. Results still pass runtime JSON
|
|
69
|
+
validation. `{}` inspects the catalog without executing tools or loading the
|
|
70
|
+
compiler. A mode without code is invalid.
|
|
71
|
+
|
|
72
|
+
Both modes run semantic preflight with pinned TypeScript
|
|
73
|
+
`7.1.0-dev.20260902.1` before **any** tool effect, using the admitted catalog's
|
|
74
|
+
input/output schemas. Diagnostics include cell locations and `TS` codes.
|
|
75
|
+
The native compiler starts lazily and is reused until the last owning host
|
|
76
|
+
closes. Guest declarations do not expose Node, Bun, filesystem imports, or
|
|
77
|
+
`fetch`; host capabilities remain explicit tools. Checking is not a security
|
|
78
|
+
boundary. Tools without an output schema return `unknown`: narrow their results
|
|
79
|
+
before accessing fields. Runtime validation and permissions remain authoritative.
|
|
80
|
+
|
|
81
|
+
`parallel()` takes thunks and returns a typed tuple of
|
|
82
|
+
`{ok:true,value}` or `{ok:false,error:string}` outcomes:
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
const [title, count] = await parallel([
|
|
86
|
+
async () => "report",
|
|
87
|
+
async () => 3,
|
|
88
|
+
]);
|
|
89
|
+
if (!title.ok || !count.ok) throw new Error("A branch failed");
|
|
90
|
+
return { title: title.value.toUpperCase(), count: count.value + 1 };
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Use `Promise.all` when a rejected branch should reject the combined expression.
|
|
94
|
+
Tool bridges are lazy: start independent work together rather than constructing
|
|
95
|
+
unawaited calls and awaiting them sequentially. A fast branch can await a
|
|
96
|
+
dependent tool inside its own async function while a slow sibling is unfinished.
|
|
97
|
+
Durable recovery reuses the admitted prepared source and tool contract; it does
|
|
98
|
+
not type-check the cell again. Catalog-contract drift fails closed on advancement.
|
|
99
|
+
|
|
100
|
+
Ordinary mode uses the existing AI SDK Code Mode caller. Durable mode promotes
|
|
101
|
+
the tested `run@2.1.7` cell engine and uses separate WDK checkpoints for guest
|
|
102
|
+
advancement and each tool invocation, not one retryable step around the cell.
|
|
103
|
+
The worker bundles stock `workflow@4.8.12`, `@workflow/core@4.8.12` and
|
|
104
|
+
`@workflow/world-local@4.4.2`; it does not use the monorepo's Workflow patches.
|
|
105
|
+
Registered functions stay in the server, so no second tool registry or host
|
|
106
|
+
configuration is reconstructed in the worker.
|
|
107
|
+
|
|
108
|
+
Both modes use the same configured approval port. MCP approvals require a client
|
|
109
|
+
with form elicitation support; missing support fails closed. A denied operation
|
|
110
|
+
does not enter its tool body. Durable mode rejects tools explicitly marked
|
|
111
|
+
`metadata.omakase.replay: "unsafe"` before body entry. Missing metadata retains
|
|
112
|
+
the existing legacy policy; it is not evidence that an external effect is safe.
|
|
113
|
+
Approval policies may be consulted more than once during admission and replay;
|
|
114
|
+
keep the decision check safe to repeat. An effect belongs in the tool body,
|
|
115
|
+
not in the approval policy.
|
|
116
|
+
|
|
117
|
+
**Recovery boundary:** this beta automatically replaces a failed WDK worker and
|
|
118
|
+
reattaches accepted calls to their original runs while the MCP server stays alive.
|
|
119
|
+
Completed checkpoints and parent receipts are reused; a still-running tool in the
|
|
120
|
+
parent is reattached rather than invoked again. Whole-MCP-server replacement,
|
|
121
|
+
cross-machine recovery and reconnecting a lost client request are not supported.
|
|
122
|
+
An ambiguous entered-but-unsettled receipt is refused as `OUTCOME_UNKNOWN`; this
|
|
123
|
+
is not an exactly-once guarantee for external systems.
|
|
124
|
+
|
|
125
|
+
`OMAKASE_DURABLE_DIR` optionally selects an absolute private state directory.
|
|
126
|
+
Otherwise each server gets a directory below `~/.local/share/omakase/durable/`.
|
|
127
|
+
Each live durable host holds a kernel-released SQLite exclusive transaction on
|
|
128
|
+
`ownership.sqlite`. Competing hosts cannot own the same directory. After a host
|
|
129
|
+
crash, a new owner starts a **fresh** `generations/<id>/` World; this permits new
|
|
130
|
+
work, not recovery of the previous host's calls. Worker replacement within one
|
|
131
|
+
generation still resumes its original runs.
|
|
132
|
+
|
|
133
|
+
World history, admissions, receipts, continuation keys and replaced ownership
|
|
134
|
+
pointers are retained without automatic pruning. Keep the directory private.
|
|
135
|
+
Archive/prune a retired directory only after its hosts and workers are stopped
|
|
136
|
+
and unknown external outcomes have been reconciled. Never remove or replace
|
|
137
|
+
`ownership.sqlite` while any host may use it. Graceful close holds ownership
|
|
138
|
+
until active bridge handlers finish their state writes.
|
|
139
|
+
|
|
140
|
+
Upgrading an earlier beta with a PID-only `host.lock` requires stopping that
|
|
141
|
+
server first. If it crashed, archive the legacy pointer only after confirming
|
|
142
|
+
the process is stopped, or use a fresh directory. Ambiguous legacy ownership
|
|
143
|
+
fails closed rather than bypassing the old lock.
|
|
144
|
+
|
|
145
|
+
Request cancellation does not cancel an accepted durable run while its server
|
|
146
|
+
remains alive. Closing the server stops its worker and drains admitted handlers.
|
|
147
|
+
Repeating `cell` creates a new intent, **not** a resume request; tools still need
|
|
148
|
+
application idempotency or reconciliation for external effects.
|
|
149
|
+
|
|
150
|
+
Keep ordinary mode for work that does not need these checkpoints. Parent–child
|
|
151
|
+
agent enhancements and legacy Flow migration are not included in this beta.
|
|
152
|
+
|
|
51
153
|
|
|
52
154
|
## Skill reads through Code Mode
|
|
53
155
|
|
|
54
|
-
Call `
|
|
156
|
+
Call `cell({})` to inspect the current full leaf catalog. Submit the following
|
|
157
|
+
body as `cell({ code: "..." })`:
|
|
55
158
|
|
|
56
|
-
```
|
|
159
|
+
```ts
|
|
57
160
|
const listed = await skills.list({server: 'self'});
|
|
58
|
-
|
|
161
|
+
if (!listed || typeof listed !== "object" || !("structuredContent" in listed))
|
|
162
|
+
throw new Error("Missing skill list");
|
|
163
|
+
const data = listed.structuredContent;
|
|
164
|
+
if (!data || typeof data !== "object" || !("entries" in data) || !Array.isArray(data.entries))
|
|
165
|
+
throw new Error("Invalid skill entries");
|
|
166
|
+
const entry = data.entries.find(s => s?.frontmatter?.name === "eli5");
|
|
167
|
+
if (!entry || typeof entry.uri !== "string") throw new Error("Skill not found");
|
|
59
168
|
return await tools.read({path: entry.uri});
|
|
60
169
|
```
|
|
61
170
|
|
|
@@ -95,10 +204,13 @@ execute-free declarations with trusted binding/executor seams, host availability
|
|
|
95
204
|
and per-call approval policies. These are application configuration, never
|
|
96
205
|
model-issued grants. Existing approval adapters support trusted callbacks,
|
|
97
206
|
native SDK approval messages and request-scoped MCP elicitation; client support
|
|
98
|
-
varies.
|
|
207
|
+
varies. Ordinary approval state stays in memory. In the durable beta, the live
|
|
208
|
+
host retains approval state across worker replacement; whole-host recovery is
|
|
209
|
+
not claimed.
|
|
99
210
|
|
|
100
211
|
Exports: root host/caller/reader APIs, `/mcp-sdk` for the official SDK client,
|
|
101
|
-
`/skills-server` for the standalone service
|
|
212
|
+
`/skills-server` for the standalone service, `/skills-host` for the bundled host,
|
|
213
|
+
and `/workflow` plus `/workflow-host` for Workflow-backed cells.
|
|
102
214
|
For custom ESM CLI factories, import APIs from your own installed dependencies;
|
|
103
215
|
the injected helper covers the simple skills configuration shown above.
|
|
104
216
|
|
|
@@ -108,12 +220,132 @@ Trusted local single-user implementation. Node22.13+, QuickJS glue execution,
|
|
|
108
220
|
input/output validation, cancellation and bounded source/result/bridge calls.
|
|
109
221
|
QuickJS limits do not bound arbitrary native effects or undo completed operations.
|
|
110
222
|
Tools requiring unsupported provider/context/approval semantics are rejected.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
The
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
223
|
+
This is not a hostile-code sandbox or a production multi-user authorization
|
|
224
|
+
system. Collections are application-configured; skill management and harness
|
|
225
|
+
disclosure hooks are not added by this beta.
|
|
226
|
+
|
|
227
|
+
The existing programmatic `createCodeModeCaller` and `createToolHostFrontend`
|
|
228
|
+
APIs still use `code_mode({ js })`. The CLI now registers only `cell({ code,
|
|
229
|
+
execution? })`; there is no second MCP entrypoint or automatic durable fallback.
|
|
230
|
+
Release verification must exercise an installed archive without monorepo patches,
|
|
231
|
+
workspace links or dev dependencies. The combined MCP acceptance also checks real
|
|
232
|
+
approval decisions, independent progress, worker replacement and effect receipts.
|
|
119
233
|
License: Apache-2.0.
|
|
234
|
+
|
|
235
|
+
## Consumer-owned Workflow adapter (earlier prototype)
|
|
236
|
+
|
|
237
|
+
`./workflow` exports a workflow-safe `runWorkflowCell` driver and an ordinary
|
|
238
|
+
`createWorkflowCodeModeTool` wrapper compatible with the existing MCP facade.
|
|
239
|
+
`./workflow-host` exports `advanceWorkflowCell` for a consumer-owned `"use step"`
|
|
240
|
+
function. The application recreates its trusted host inside that step and supplies
|
|
241
|
+
its stable signing key. `maxAgeMs` sets the trusted continuation lifetime;
|
|
242
|
+
the upstream default is one hour, so durable human waits need an explicitly
|
|
243
|
+
appropriate lifetime. Expired continuations cannot resume merely because the
|
|
244
|
+
workflow itself is durable. Registered tools keep their ordinary AI SDK schemas.
|
|
245
|
+
|
|
246
|
+
```ts
|
|
247
|
+
// Called in workflow scope; the application supplies compiled step functions.
|
|
248
|
+
const value = await runWorkflowCell({ js, toolCallId }, {
|
|
249
|
+
advance: advanceCell, // "use step": recreate host, call advanceWorkflowCell
|
|
250
|
+
execute: request => dispatchRegisteredOperation(request),
|
|
251
|
+
});
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
The dispatcher runs **from workflow scope**, so functions marked `"use step"`
|
|
255
|
+
retain their own checkpoints. Ordinary pure functions can use the same dispatcher.
|
|
256
|
+
Host admission validates input, availability, bindings and policy before exposing
|
|
257
|
+
an operation; continuation rechecks admission and validates the returned output.
|
|
258
|
+
The dispatcher must resolve the approved `bindingId` to the same trusted target;
|
|
259
|
+
the adapter deliberately serializes identifiers, never live target objects.
|
|
260
|
+
|
|
261
|
+
Parallel guest calls dispatch concurrently. The driver retains unfinished calls by
|
|
262
|
+
call ID and supplies finished results in their recorded completion order, so a
|
|
263
|
+
fast branch can request its next tool without waiting for siblings. Calls with
|
|
264
|
+
identical arguments still receive separate identities. Already dispatched work
|
|
265
|
+
remains accounted for even when a guest race chooses a winner.
|
|
266
|
+
|
|
267
|
+
This path requires the carried patches for Code Mode 1.0.84 and `run` 2.0.0.
|
|
268
|
+
They add opt-in incremental continuation, arbitrary authenticated pending-result
|
|
269
|
+
selection and fresh worker idle acknowledgments. Default Code Mode callers keep
|
|
270
|
+
full-batch continuation. The host refuses an unpatched SDK rather than silently
|
|
271
|
+
attach a result to the wrong pending call.
|
|
272
|
+
|
|
273
|
+
For streaming under Workflow 5.0.1, apply its carried patch and configure
|
|
274
|
+
`WORKFLOW_MAX_INLINE_STEPS=0` in the workflow execution backend. It queues steps
|
|
275
|
+
individually and replays after each completion; default inline batching is
|
|
276
|
+
unchanged. This adds queue hops in exchange for independent branch progress.
|
|
277
|
+
The lab's direct Workflow control and cell streaming test exercise the same
|
|
278
|
+
250 ms slow / 10 ms fast fixture.
|
|
279
|
+
|
|
280
|
+
This prototype still reads **authenticated, readonly internal batch metadata
|
|
281
|
+
from pinned Code Mode 1.0.84**. Upstream documents continuations as opaque; this
|
|
282
|
+
shim and the owned patch API are pinned integration code, not compatibility
|
|
283
|
+
claims for other SDK versions.
|
|
284
|
+
|
|
285
|
+
Both cell adapters accept a trusted `prelude` string for helper libraries, such as
|
|
286
|
+
Flow's `CELL_FLOW_SOURCE`; the host does not depend on Flow. Native/MCP callers use
|
|
287
|
+
`createWorkflowCodeModeTool` with a callback that starts or resumes the cell
|
|
288
|
+
workflow. WFA can use a callback that runs it in the parent workflow. Empty-input
|
|
289
|
+
catalog inspection requires the optional trusted catalog callback.
|
|
290
|
+
|
|
291
|
+
Interactive approvals remain unsupported on the Workflow path: in-memory approval
|
|
292
|
+
records are not durable and cannot be resumed after host recreation. Denied calls
|
|
293
|
+
remain denied. Admission/binding policy can change between suspension and resume;
|
|
294
|
+
reconciliation is application-owned. A checkpoint does not provide exactly-once
|
|
295
|
+
external effects or decide whether uncertain operations are safe to retry.
|
|
296
|
+
Cancellation of an MCP request does not automatically cancel a durable workflow:
|
|
297
|
+
the wrapper passes the abort signal to the application's start/resume callback,
|
|
298
|
+
which owns that lifecycle. Default guest limits match the ordinary caller.
|
|
299
|
+
|
|
300
|
+
### Replay constraints at execution
|
|
301
|
+
|
|
302
|
+
Tool authors may declare `metadata: { omakase: { replay: 'unsafe' } }` when
|
|
303
|
+
executing an unfinished invocation again could duplicate an effect. `safe` permits
|
|
304
|
+
such execution; it does not guarantee exactly-once effects or enable retries.
|
|
305
|
+
Disclosure and checkpoint storage remain independent.
|
|
306
|
+
|
|
307
|
+
The host captures this constraint at registration. Its ordinary SDK executor
|
|
308
|
+
has `replays: false`. A custom `HostExecutor` declares `replays: false` for
|
|
309
|
+
single-attempt execution or `true` if recovery/retries can invoke the implementation
|
|
310
|
+
again. Unsafe tools are rejected before invocation when the executor declares
|
|
311
|
+
`true` or leaves the behavior unspecified, including snapshot executor overrides.
|
|
312
|
+
Executor declarations are trusted application contracts, not model inputs.
|
|
313
|
+
Tools without replay metadata retain legacy behavior; invalid declarations fail
|
|
314
|
+
registration rather than silently becoming safe.
|
|
315
|
+
|
|
316
|
+
Both Workflow cell adapters conservatively declare `replays: true`. Their
|
|
317
|
+
interruption requests carry the captured policy, and the prototype leaf dispatchers
|
|
318
|
+
check the current declaration again before executing. Unsafe implementations are
|
|
319
|
+
therefore unavailable through these durable paths, even with zero automatic
|
|
320
|
+
retries; no safe recovery policy for an unknown in-flight outcome is claimed.
|
|
321
|
+
Committed-result reuse is not implementation replay. The host does not intercept
|
|
322
|
+
retries inside a tool implementation or make arbitrary external side effects
|
|
323
|
+
exactly once.
|
|
324
|
+
|
|
325
|
+
## Automatic releases
|
|
326
|
+
|
|
327
|
+
Merging a new package version to `main` triggers `release.yml`. The publisher
|
|
328
|
+
requires successful CI on that exact commit, builds once, and runs the installed
|
|
329
|
+
ordinary/durable MCP proof before publishing the tested tarball. It checks npm's
|
|
330
|
+
integrity and repeats the proof against a registry installation. Published
|
|
331
|
+
versions are immutable; normal pushes skip versions already on npm.
|
|
332
|
+
|
|
333
|
+
Prereleases use their named `alpha`, `beta`, or `rc` channel; only stable versions
|
|
334
|
+
update `latest`. Install the durable beta with `@oh-my-ai-sdk/omakase@beta`.
|
|
335
|
+
|
|
336
|
+
One-time npm setup: in this package's **Settings → Trusted publishing**, authorize
|
|
337
|
+
GitHub owner `archeism`, repository `oh-my-ai`, workflow **`release.yml`**, environment
|
|
338
|
+
**`npm-omakase`**, with direct **`npm publish`** allowed. The GitHub environment
|
|
339
|
+
permits only branch `main`, with no required reviewers or per-release approval.
|
|
340
|
+
A staged-publish permission alone does not enable automatic releases. No npm token secret is used.
|
|
341
|
+
See [npm's trusted-publisher setup](https://docs.npmjs.com/trusted-publishers/).
|
|
342
|
+
|
|
343
|
+
After fixing a publishing failure, retry from reviewed `main`:
|
|
344
|
+
|
|
345
|
+
```sh
|
|
346
|
+
gh workflow run release.yml --repo archeism/oh-my-ai --ref main
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
The retry also checks the registry installation when the version already exists.
|
|
350
|
+
The run retains its tarball and proof receipts for 14 days. A green merge without
|
|
351
|
+
a successful publication and registry proof is not a completed release.
|
package/dist/approval.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import type { ToolReplayPolicy } from './execution-policy.js';
|
|
1
2
|
import type { ToolHost } from './host.js';
|
|
2
3
|
import type { JSONValue } from 'ai';
|
|
4
|
+
import type { ToolExecutionOptions } from 'ai';
|
|
5
|
+
import type { WorkflowToolRequest } from './workflow.js';
|
|
3
6
|
export type HostApprovalStatus = 'approved' | 'denied' | 'user-approval' | 'not-applicable';
|
|
4
7
|
export interface HostInvocation {
|
|
8
|
+
readonly replay?: ToolReplayPolicy;
|
|
5
9
|
readonly executionId: string;
|
|
6
10
|
readonly sessionId?: string;
|
|
7
11
|
readonly harnessId?: string;
|
|
@@ -39,8 +43,13 @@ export interface HostControl {
|
|
|
39
43
|
sessionId?: string;
|
|
40
44
|
harnessId?: string;
|
|
41
45
|
signal?: AbortSignal;
|
|
46
|
+
deferApproval?: boolean;
|
|
42
47
|
}): HostExecution;
|
|
48
|
+
/** Re-admit a previously bound durable request through its original executor. */
|
|
49
|
+
invokeBound(request: WorkflowToolRequest, options: ToolExecutionOptions<any>): Promise<unknown>;
|
|
43
50
|
recordCount(): number;
|
|
51
|
+
/** Bind internal resources to host.close without reserving a tool namespace. */
|
|
52
|
+
addDisposer(dispose: () => Promise<void>): void;
|
|
44
53
|
}
|
|
45
54
|
export declare function registerHostControl(host: ToolHost, control: HostControl): void;
|
|
46
55
|
export declare function getHostControl(host: ToolHost): HostControl;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { ToolHost } from './host.js';
|
|
2
|
+
/**
|
|
3
|
+
* Semantic TypeScript 7.1 preflight for cell sources, adapted from
|
|
4
|
+
* labs/oma/src/ts71-native-checker.prototype.ts for the virtual-only cell
|
|
5
|
+
* sandbox: no workspace discovery, no Bun/Node ambient types, one synthetic
|
|
6
|
+
* module checked against the exact generated guest contract. The native
|
|
7
|
+
* compiler modules are imported lazily so catalog-only cold paths never load
|
|
8
|
+
* or spawn the compiler child.
|
|
9
|
+
*/
|
|
10
|
+
export type CellPreflightDiagnosticCategory = 'error' | 'warning' | 'suggestion' | 'message';
|
|
11
|
+
export type CellPreflightDiagnostic = Readonly<{
|
|
12
|
+
category: CellPreflightDiagnosticCategory;
|
|
13
|
+
code: number;
|
|
14
|
+
message: string;
|
|
15
|
+
origin: 'cell' | 'context' | 'global';
|
|
16
|
+
line?: number;
|
|
17
|
+
column?: number;
|
|
18
|
+
}>;
|
|
19
|
+
export type CellPreflightResult = Readonly<{
|
|
20
|
+
ok: boolean;
|
|
21
|
+
version: string;
|
|
22
|
+
generation: number;
|
|
23
|
+
cache: 'cold' | 'incremental';
|
|
24
|
+
diagnostics: readonly CellPreflightDiagnostic[];
|
|
25
|
+
summary: Readonly<{
|
|
26
|
+
total: number;
|
|
27
|
+
returned: number;
|
|
28
|
+
truncated: boolean;
|
|
29
|
+
}>;
|
|
30
|
+
}>;
|
|
31
|
+
export interface CellTypeCompiler {
|
|
32
|
+
check(source: string, declarations: string): Promise<CellPreflightResult>;
|
|
33
|
+
transpile(code: string): Promise<string>;
|
|
34
|
+
}
|
|
35
|
+
export type CellCompilerStatus = Readonly<{
|
|
36
|
+
loaded: boolean;
|
|
37
|
+
serversSpawned: number;
|
|
38
|
+
serversDisposed: number;
|
|
39
|
+
checks: number;
|
|
40
|
+
transpiles: number;
|
|
41
|
+
}>;
|
|
42
|
+
/** Real laziness probe for tests: the compiler child must stay unloaded on catalog-only cold paths. */
|
|
43
|
+
export declare function cellCompilerStatus(): CellCompilerStatus;
|
|
44
|
+
export declare function acquireCellTypeCompiler(host: ToolHost): Promise<CellTypeCompiler>;
|
|
45
|
+
/** One actionable failure message; TS codes stay greppable (TS1234). */
|
|
46
|
+
export declare function formatCellPreflightFailure(result: CellPreflightResult): string;
|