@oh-my-ai-sdk/omakase 0.0.0-stage → 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/LICENSE +201 -0
- package/README.md +350 -2
- package/dist/approval.d.ts +60 -0
- package/dist/approval.js +22 -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.d.ts +2 -0
- package/dist/cli.js +144 -0
- package/dist/code-mode.d.ts +43 -0
- package/dist/code-mode.js +192 -0
- 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 +27 -0
- package/dist/frontend.js +92 -0
- package/dist/host.d.ts +38 -0
- package/dist/host.js +261 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +11 -0
- package/dist/marker.d.ts +2 -0
- package/dist/marker.js +2 -0
- package/dist/mcp-approval.d.ts +4 -0
- package/dist/mcp-approval.js +30 -0
- package/dist/mcp-config.d.ts +6 -0
- package/dist/mcp-config.js +61 -0
- package/dist/mcp-sdk-source.d.ts +56 -0
- package/dist/mcp-sdk-source.js +119 -0
- package/dist/mcp-server.d.ts +9 -0
- package/dist/mcp-server.js +36 -0
- package/dist/mcp-source.d.ts +3 -0
- package/dist/mcp-source.js +27 -0
- package/dist/read.d.ts +39 -0
- package/dist/read.js +117 -0
- package/dist/schema.d.ts +7 -0
- package/dist/schema.js +128 -0
- package/dist/skill-discovery.d.ts +2 -0
- package/dist/skill-discovery.js +4 -0
- package/dist/skills-cli.d.ts +2 -0
- package/dist/skills-cli.js +66 -0
- package/dist/skills-host.d.ts +9 -0
- package/dist/skills-host.js +56 -0
- package/dist/skills-server.d.ts +39 -0
- package/dist/skills-server.js +319 -0
- package/dist/skills.d.ts +34 -0
- package/dist/skills.js +209 -0
- 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/examples/skills-server.config.mjs +32 -0
- package/examples/skills-service.config.mjs +17 -0
- package/package.json +85 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,351 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Omakase
|
|
2
2
|
|
|
3
|
-
|
|
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
|
+
|
|
8
|
+
The bundled skills MCP service owns collections and exposes one `list` tool plus
|
|
9
|
+
standard skill/resource endpoints. One regular reader handles local files and
|
|
10
|
+
configured URI sources. No model-facing registry-management tools.
|
|
11
|
+
|
|
12
|
+
## CLI setup
|
|
13
|
+
|
|
14
|
+
Requires Node.js22.13 or newer. No model key is needed by the host: your existing
|
|
15
|
+
Claude/Codex session supplies the model. Configuration stays outside harness MCP
|
|
16
|
+
registration.
|
|
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
|
+
|
|
24
|
+
Create `~/.config/omakase/host.config.mjs` (or
|
|
25
|
+
`$XDG_CONFIG_HOME/omakase/host.config.mjs`):
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
export default async ({ createSkillsHost }) => createSkillsHost({
|
|
29
|
+
collections: [
|
|
30
|
+
{ id: 'try', directory: '/absolute/path/to/your/skills' },
|
|
31
|
+
// { id: 'public', github: 'https://github.com/owner/repo', path: 'skills' },
|
|
32
|
+
],
|
|
33
|
+
cwd: '/absolute/path/to/workspace',
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The CLI supplies `createSkillsHost` to your factory, so the config needs no package
|
|
38
|
+
imports and works when launched from the npx cache. Local collections are scanned
|
|
39
|
+
atomically and refreshed every second. GitHub sources are public HTTPS repositories;
|
|
40
|
+
remote pulls are explicit application operations. Nothing is copied into native
|
|
41
|
+
harness skill directories.
|
|
42
|
+
|
|
43
|
+
```sh
|
|
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
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Restart the client and ask it to use Omakase to list and read a skill. Automatic
|
|
49
|
+
skill-name injection into harness prompts is not implemented. Native skills can
|
|
50
|
+
remain installed while you try this route.
|
|
51
|
+
|
|
52
|
+
For a fixed config path, launch
|
|
53
|
+
`npx -y @oh-my-ai-sdk/omakase@beta --config /absolute/host.config.mjs`.
|
|
54
|
+
Existing `--mcp-config /absolute/.mcp.json` imports ordinary downstream MCP tools.
|
|
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
|
+
|
|
153
|
+
|
|
154
|
+
## Skill reads through Code Mode
|
|
155
|
+
|
|
156
|
+
Call `cell({})` to inspect the current full leaf catalog. Submit the following
|
|
157
|
+
body as `cell({ code: "..." })`:
|
|
158
|
+
|
|
159
|
+
```ts
|
|
160
|
+
const listed = await skills.list({server: 'self'});
|
|
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");
|
|
168
|
+
return await tools.read({path: entry.uri});
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
`skills.list({})` selects own plus configured peers. `server: 'self'` selects
|
|
172
|
+
registered collections; another server ID selects a configured peer. Peer discovery
|
|
173
|
+
never registers peer skills locally. MCP tool results retain their envelopes.
|
|
174
|
+
Supporting files have readable addresses in `entry.readResources`. Remote gateway
|
|
175
|
+
reads verify manifest membership, size and digest. Scripts are read as data.
|
|
176
|
+
|
|
177
|
+
`tools.read({path})` also accepts real local paths, `file:` URIs and configured
|
|
178
|
+
resolver schemes. It returns UTF-8 text or a base64 blob. Mounted MCP addresses
|
|
179
|
+
select a configured connection and use `resources/read`; unknown schemes fail.
|
|
180
|
+
The reader is trusted filesystem access, not confinement.
|
|
181
|
+
|
|
182
|
+
Avoid shadowing namespace aliases: use `const listed = await skills.list(...)`,
|
|
183
|
+
not `const skills = await skills.list(...)`. Canonical
|
|
184
|
+
`await tools['skills.list']({...})` access also works. Await every tool call.
|
|
185
|
+
|
|
186
|
+
## Native use and custom hosts
|
|
187
|
+
|
|
188
|
+
```ts
|
|
189
|
+
import { ToolLoopAgent } from 'ai';
|
|
190
|
+
import { createCodeModeCaller } from '@oh-my-ai-sdk/omakase';
|
|
191
|
+
import { createSkillsHost } from '@oh-my-ai-sdk/omakase/skills-host';
|
|
192
|
+
|
|
193
|
+
const host = await createSkillsHost({collections: [{id: 'try', directory: '/absolute/skills'}]});
|
|
194
|
+
try {
|
|
195
|
+
const agent = new ToolLoopAgent({model, tools: {code_mode: createCodeModeCaller(host)}});
|
|
196
|
+
await agent.generate({prompt: 'Use Omakase to read ELI5 and follow its instructions.'});
|
|
197
|
+
} finally { await host.close(); }
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
`model` is supplied by your application. `createToolHost()` accepts ordinary
|
|
201
|
+
AI SDK ToolSet values; `host.register('local', tools)` creates qualified names such
|
|
202
|
+
as `local.add`. Snapshots expose only mediated wrappers. The core also supports
|
|
203
|
+
execute-free declarations with trusted binding/executor seams, host availability
|
|
204
|
+
and per-call approval policies. These are application configuration, never
|
|
205
|
+
model-issued grants. Existing approval adapters support trusted callbacks,
|
|
206
|
+
native SDK approval messages and request-scoped MCP elicitation; client support
|
|
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.
|
|
210
|
+
|
|
211
|
+
Exports: root host/caller/reader APIs, `/mcp-sdk` for the official SDK client,
|
|
212
|
+
`/skills-server` for the standalone service, `/skills-host` for the bundled host,
|
|
213
|
+
and `/workflow` plus `/workflow-host` for Workflow-backed cells.
|
|
214
|
+
For custom ESM CLI factories, import APIs from your own installed dependencies;
|
|
215
|
+
the injected helper covers the simple skills configuration shown above.
|
|
216
|
+
|
|
217
|
+
## Bounds and release status
|
|
218
|
+
|
|
219
|
+
Trusted local single-user implementation. Node22.13+, QuickJS glue execution,
|
|
220
|
+
input/output validation, cancellation and bounded source/result/bridge calls.
|
|
221
|
+
QuickJS limits do not bound arbitrary native effects or undo completed operations.
|
|
222
|
+
Tools requiring unsupported provider/context/approval semantics are rejected.
|
|
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.
|
|
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.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { ToolReplayPolicy } from './execution-policy.js';
|
|
2
|
+
import type { ToolHost } from './host.js';
|
|
3
|
+
import type { JSONValue } from 'ai';
|
|
4
|
+
import type { ToolExecutionOptions } from 'ai';
|
|
5
|
+
import type { WorkflowToolRequest } from './workflow.js';
|
|
6
|
+
export type HostApprovalStatus = 'approved' | 'denied' | 'user-approval' | 'not-applicable';
|
|
7
|
+
export interface HostInvocation {
|
|
8
|
+
readonly replay?: ToolReplayPolicy;
|
|
9
|
+
readonly executionId: string;
|
|
10
|
+
readonly sessionId?: string;
|
|
11
|
+
readonly harnessId?: string;
|
|
12
|
+
readonly bindingId?: string;
|
|
13
|
+
readonly toolCallId: string;
|
|
14
|
+
readonly parentToolCallId?: string;
|
|
15
|
+
readonly caller: string;
|
|
16
|
+
readonly toolName: string;
|
|
17
|
+
readonly input: JSONValue;
|
|
18
|
+
}
|
|
19
|
+
export type HostApprovalPolicy = (invocation: HostInvocation) => HostApprovalStatus | Promise<HostApprovalStatus>;
|
|
20
|
+
export interface ApprovalRequest extends HostInvocation {
|
|
21
|
+
readonly approvalId: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ApprovalDecision {
|
|
24
|
+
readonly approvalId: string;
|
|
25
|
+
readonly approved: boolean;
|
|
26
|
+
readonly reason?: string;
|
|
27
|
+
}
|
|
28
|
+
export type RequestApproval = (request: ApprovalRequest, options: {
|
|
29
|
+
signal: AbortSignal;
|
|
30
|
+
}) => Promise<ApprovalDecision>;
|
|
31
|
+
export interface HostExecution {
|
|
32
|
+
executionId: string;
|
|
33
|
+
signal: AbortSignal;
|
|
34
|
+
run<T>(action: () => Promise<T>, resumeApprovalId?: string): Promise<T>;
|
|
35
|
+
request(approvalId: string): ApprovalRequest;
|
|
36
|
+
settle(decision: ApprovalDecision): void;
|
|
37
|
+
finish(): void;
|
|
38
|
+
}
|
|
39
|
+
export interface HostControl {
|
|
40
|
+
beginExecution(options: {
|
|
41
|
+
parentToolCallId?: string;
|
|
42
|
+
caller: string;
|
|
43
|
+
sessionId?: string;
|
|
44
|
+
harnessId?: string;
|
|
45
|
+
signal?: AbortSignal;
|
|
46
|
+
deferApproval?: boolean;
|
|
47
|
+
}): HostExecution;
|
|
48
|
+
/** Re-admit a previously bound durable request through its original executor. */
|
|
49
|
+
invokeBound(request: WorkflowToolRequest, options: ToolExecutionOptions<any>): Promise<unknown>;
|
|
50
|
+
recordCount(): number;
|
|
51
|
+
/** Bind internal resources to host.close without reserving a tool namespace. */
|
|
52
|
+
addDisposer(dispose: () => Promise<void>): void;
|
|
53
|
+
}
|
|
54
|
+
export declare function registerHostControl(host: ToolHost, control: HostControl): void;
|
|
55
|
+
export declare function getHostControl(host: ToolHost): HostControl;
|
|
56
|
+
export declare class HostApprovalRequired extends Error {
|
|
57
|
+
readonly request: ApprovalRequest;
|
|
58
|
+
constructor(request: ApprovalRequest);
|
|
59
|
+
}
|
|
60
|
+
export declare function isHostApprovalRequired(value: unknown): value is HostApprovalRequired;
|
package/dist/approval.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const controls = new WeakMap();
|
|
2
|
+
export function registerHostControl(host, control) { controls.set(host, control); }
|
|
3
|
+
export function getHostControl(host) {
|
|
4
|
+
const control = controls.get(host);
|
|
5
|
+
if (!control)
|
|
6
|
+
throw new Error('Unknown tool host');
|
|
7
|
+
return control;
|
|
8
|
+
}
|
|
9
|
+
// Identity, rather than a structural payload, identifies host control flow.
|
|
10
|
+
const required = new WeakSet();
|
|
11
|
+
export class HostApprovalRequired extends Error {
|
|
12
|
+
request;
|
|
13
|
+
constructor(request) {
|
|
14
|
+
super(`Approval required for ${request.toolName}`);
|
|
15
|
+
this.request = request;
|
|
16
|
+
this.name = 'HostApprovalRequired';
|
|
17
|
+
required.add(this);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export function isHostApprovalRequired(value) {
|
|
21
|
+
return typeof value === 'object' && value !== null && required.has(value);
|
|
22
|
+
}
|