@justin06lee/yagami 0.5.0 → 0.6.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 +30 -0
- package/dist/{chunk-GPX47OIO.js → chunk-D2PNH6GV.js} +2 -2
- package/dist/{chunk-2UG5CR5X.js → chunk-ZYHC7PXX.js} +615 -8
- package/dist/chunk-ZYHC7PXX.js.map +1 -0
- package/dist/cli.js +2 -2
- package/dist/{hostConfig-Bzr9JB8R.d.ts → hostConfig-HmZ3z297.d.ts} +95 -2
- package/dist/index.d.ts +23 -6
- package/dist/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +2 -2
- package/dist/server.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-2UG5CR5X.js.map +0 -1
- /package/dist/{chunk-GPX47OIO.js.map → chunk-D2PNH6GV.js.map} +0 -0
package/README.md
CHANGED
|
@@ -137,6 +137,9 @@ session.send("now add a test for the edge case"); // next turn resumes the sam
|
|
|
137
137
|
await session.interrupt(); // the CLI's Esc
|
|
138
138
|
await session.setModel("opus"); // the CLI's /model
|
|
139
139
|
await session.setPermissionMode("plan"); // shift+tab
|
|
140
|
+
// the CLI's /rewind: restore tracked files to their state at a user
|
|
141
|
+
// message's uuid (needs options: { enableFileCheckpointing: true })
|
|
142
|
+
await session.rewindFiles(userMessageUuid);
|
|
140
143
|
session.close();
|
|
141
144
|
```
|
|
142
145
|
|
|
@@ -144,6 +147,33 @@ This resolves the parts of embedding Claude Code that every host would otherwise
|
|
|
144
147
|
|
|
145
148
|
For a lower-level handle, `claudeCodeSession(prompt, { options })` returns the raw Agent SDK `Query`.
|
|
146
149
|
|
|
150
|
+
### Building a UI on any other harness
|
|
151
|
+
|
|
152
|
+
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.
|
|
153
|
+
|
|
154
|
+
```ts
|
|
155
|
+
import { createProvider, isSessionProvider } from "@justin06lee/yagami";
|
|
156
|
+
|
|
157
|
+
const codex = createProvider("codex", {}, { appName: "my-app" });
|
|
158
|
+
if (isSessionProvider(codex)) {
|
|
159
|
+
const session = codex.openSession({
|
|
160
|
+
cwd: "/path/to/project",
|
|
161
|
+
permissions: {
|
|
162
|
+
decide: async (req) => (await showDialog(req.tool, req.input)) ? "allow" : "deny",
|
|
163
|
+
}, // "allow_always" answers like the TUI's "don't ask again"
|
|
164
|
+
});
|
|
165
|
+
for await (const ev of session.send("fix the failing test")) {
|
|
166
|
+
// normalized AgentEvents: text / thinking / tool_call (started→completed,
|
|
167
|
+
// with inputs and outputs) / permission / done (usage, stop reason)
|
|
168
|
+
}
|
|
169
|
+
session.send("now add a test"); // same warm thread, context carries
|
|
170
|
+
await session.interrupt();
|
|
171
|
+
await session.close(); // session.id resumes it later via { resume }
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
`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.
|
|
176
|
+
|
|
147
177
|
The server is also embeddable: `import { startYagami } from "@justin06lee/yagami/server"`.
|
|
148
178
|
|
|
149
179
|
## Providers
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
toApiError,
|
|
11
11
|
toChatCompletion,
|
|
12
12
|
yagamiConfigDir
|
|
13
|
-
} from "./chunk-
|
|
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-
|
|
377
|
+
//# sourceMappingURL=chunk-D2PNH6GV.js.map
|