@justin06lee/yagami 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -144,6 +144,33 @@ This resolves the parts of embedding Claude Code that every host would otherwise
144
144
 
145
145
  For a lower-level handle, `claudeCodeSession(prompt, { options })` returns the raw Agent SDK `Query`.
146
146
 
147
+ ### Building a UI on any other harness
148
+
149
+ The same idea works for the non-Claude harnesses — verbatim. Codex and every ACP agent implement `SessionProvider.openSession()`: a live, warm session on the harness's own engine (`codex app-server` — what the Codex TUI runs on; a persistent ACP connection for OpenCode, Gemini, and friends), with the harness's own config, sandbox, and approval flow. Nothing is overridden unless you pass `native` overrides; approval requests are forwarded to your handler exactly as the harness's own UI would prompt.
150
+
151
+ ```ts
152
+ import { createProvider, isSessionProvider } from "@justin06lee/yagami";
153
+
154
+ const codex = createProvider("codex", {}, { appName: "my-app" });
155
+ if (isSessionProvider(codex)) {
156
+ const session = codex.openSession({
157
+ cwd: "/path/to/project",
158
+ permissions: {
159
+ decide: async (req) => (await showDialog(req.tool, req.input)) ? "allow" : "deny",
160
+ }, // "allow_always" answers like the TUI's "don't ask again"
161
+ });
162
+ for await (const ev of session.send("fix the failing test")) {
163
+ // normalized AgentEvents: text / thinking / tool_call (started→completed,
164
+ // with inputs and outputs) / permission / done (usage, stop reason)
165
+ }
166
+ session.send("now add a test"); // same warm thread, context carries
167
+ await session.interrupt();
168
+ await session.close(); // session.id resumes it later via { resume }
169
+ }
170
+ ```
171
+
172
+ `ProviderSessionOptions` takes `cwd`, `model`, `resume`, `effort`, `systemPrompt` (extra developer instructions where the harness supports them), and a `native` escape hatch (Codex: `{ sandbox, approvalPolicy, config }`; ACP: `{ mode }`). The completion-turn `run()` path stays for API-style callers; sessions are for hosts that want the real interactive agent.
173
+
147
174
  The server is also embeddable: `import { startYagami } from "@justin06lee/yagami/server"`.
148
175
 
149
176
  ## Providers
@@ -10,7 +10,7 @@ import {
10
10
  toApiError,
11
11
  toChatCompletion,
12
12
  yagamiConfigDir
13
- } from "./chunk-2UG5CR5X.js";
13
+ } from "./chunk-ZYHC7PXX.js";
14
14
 
15
15
  // src/server.ts
16
16
  import { serve } from "@hono/node-server";
@@ -374,4 +374,4 @@ export {
374
374
  maskKey,
375
375
  startYagami
376
376
  };
377
- //# sourceMappingURL=chunk-GPX47OIO.js.map
377
+ //# sourceMappingURL=chunk-D2PNH6GV.js.map