@computesdk/loops 0.1.9 → 0.1.11
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/API.md +34 -0
- package/README.md +67 -4
- package/bin/pi-rpc-startup.mjs +8 -0
- package/client.ts +27 -0
- package/dist/assets/{abnfDiagram-VCTEODGH-DdEKagjG.js → abnfDiagram-VCTEODGH-DCYXdRzD.js} +1 -1
- package/dist/assets/{arc-CBrypTBE.js → arc-C0Zv4bRf.js} +1 -1
- package/dist/assets/{architectureDiagram-5GKGNRK7-DZ_brcx7.js → architectureDiagram-5GKGNRK7-udHqlZFO.js} +1 -1
- package/dist/assets/{blockDiagram-I7D4REHJ-Cz2ERHQY.js → blockDiagram-I7D4REHJ-DkwphONO.js} +1 -1
- package/dist/assets/{c4Diagram-7LVT6UL2-C6EJYPYB.js → c4Diagram-7LVT6UL2-C0Qkqogh.js} +1 -1
- package/dist/assets/channel-vsnAMebC.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-CG7fAgGK.js → chunk-2Q5K7J3B-BQDQoQmL.js} +1 -1
- package/dist/assets/{chunk-5VM5RSS4-1d5Juq9g.js → chunk-5VM5RSS4-CvqeMalj.js} +1 -1
- package/dist/assets/{chunk-F27PBJKO-BLhdtado.js → chunk-F27PBJKO-D_B9YCM7.js} +1 -1
- package/dist/assets/{chunk-IMKFNOWR-DGMwnpoO.js → chunk-IMKFNOWR-BYIRSti2.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-Z3FJy7jQ.js → chunk-JWPE2WC7-BPJdwBVM.js} +1 -1
- package/dist/assets/{chunk-POPQ4Y6H-H3kLw708.js → chunk-POPQ4Y6H-lztII1aN.js} +1 -1
- package/dist/assets/{chunk-SVP7TREG-DE1-aaSq.js → chunk-SVP7TREG-DoYdkbun.js} +1 -1
- package/dist/assets/{chunk-TICWLB2K-BZ6DWCyL.js → chunk-TICWLB2K-CjnLsube.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-B0wzl075.js → chunk-XXDRQBXY-Jsq5tSht.js} +1 -1
- package/dist/assets/classDiagram-ZZMXUADV-Dql6Ch3d.js +1 -0
- package/dist/assets/classDiagram-v2-VYDZK3BY-Dql6Ch3d.js +1 -0
- package/dist/assets/{cose-bilkent-JH36ORCC-Ch1VTcLM.js → cose-bilkent-JH36ORCC-BIP9YsAI.js} +1 -1
- package/dist/assets/{cynefin-OW5HDTMX-CZXtBHB9.js → cynefin-OW5HDTMX-wj1eU8-l.js} +1 -1
- package/dist/assets/{cynefinDiagram-5FMLGOSQ-CUnTwdfR.js → cynefinDiagram-5FMLGOSQ-DW6veCDh.js} +1 -1
- package/dist/assets/{dagre-GXQ25YYZ-B_Ttt5bQ.js → dagre-GXQ25YYZ-ChQ1GCij.js} +1 -1
- package/dist/assets/{diagram-S7CK7UJ4-B5dbIi3W.js → diagram-S7CK7UJ4-B0pgpZ9e.js} +1 -1
- package/dist/assets/{diagram-UQ7AKVKN-CXqSDNYw.js → diagram-UQ7AKVKN-BoNV14ty.js} +1 -1
- package/dist/assets/{diagram-VSXAHHWV-D1bxrNKq.js → diagram-VSXAHHWV-CpDQf6Z1.js} +1 -1
- package/dist/assets/{diagram-VX7I27RA-CruFrG5p.js → diagram-VX7I27RA-BzTGDavi.js} +1 -1
- package/dist/assets/{diagram-Z3DM3KII-BRPunBma.js → diagram-Z3DM3KII-B5bOyrqx.js} +1 -1
- package/dist/assets/{ebnfDiagram-PWID7BFC-Bj57oII-.js → ebnfDiagram-PWID7BFC-z4WVJ94j.js} +1 -1
- package/dist/assets/{erDiagram-RLTQ6QDP-CDv7flCN.js → erDiagram-RLTQ6QDP-iCda9mWB.js} +1 -1
- package/dist/assets/{flowDiagram-HODETNUW-B6g-MRgn.js → flowDiagram-HODETNUW-DGAIDu__.js} +1 -1
- package/dist/assets/{ganttDiagram-EL5Y4UJY-BMxDQ5GW.js → ganttDiagram-EL5Y4UJY-C_TD7p_8.js} +1 -1
- package/dist/assets/{gitGraphDiagram-WWUBYQGX-D0AGhPhc.js → gitGraphDiagram-WWUBYQGX-BhyVS4hu.js} +1 -1
- package/dist/assets/{highlighted-body-JLMTFACH-CKWVqtZJ.js → highlighted-body-JLMTFACH-DmjzCqfz.js} +1 -1
- package/dist/assets/index-Cfkb4x7R.js +902 -0
- package/dist/assets/index-D-CIRYJ5.css +1 -0
- package/dist/assets/{infoDiagram-27XIBGKW-Y8WvdJTY.js → infoDiagram-27XIBGKW-VKT9hRl2.js} +1 -1
- package/dist/assets/{ishikawaDiagram-5VMMS53U-DvwGVY_t.js → ishikawaDiagram-5VMMS53U-CTbJYQrg.js} +1 -1
- package/dist/assets/{journeyDiagram-3NMN7TZE-BgiQ1SZH.js → journeyDiagram-3NMN7TZE-CuRQRZVc.js} +1 -1
- package/dist/assets/{kanban-definition-UXKFOSKX-CYHv1Q-j.js → kanban-definition-UXKFOSKX-ConV4y36.js} +1 -1
- package/dist/assets/{layout-DDEx8snc.js → layout-dfLpQ9-g.js} +1 -1
- package/dist/assets/{linear-Yy___T_L.js → linear-jzcXY-L-.js} +1 -1
- package/dist/assets/{mindmap-definition-YA3MSWOX-0NL31y0F.js → mindmap-definition-YA3MSWOX-BZ44_mmM.js} +1 -1
- package/dist/assets/{pegDiagram-XKGWAZYB-DvZDGnQm.js → pegDiagram-XKGWAZYB-qwQPRnqR.js} +1 -1
- package/dist/assets/{pieDiagram-E7YTZNPT-BW9LA7eU.js → pieDiagram-E7YTZNPT-C41zts6x.js} +1 -1
- package/dist/assets/{quadrantDiagram-AXDQQJYC-TVHWsAYs.js → quadrantDiagram-AXDQQJYC-Bz7te34m.js} +1 -1
- package/dist/assets/{railroadDiagram-O6MQD6OU-BCbDFKKB.js → railroadDiagram-O6MQD6OU-DQYw8Oka.js} +1 -1
- package/dist/assets/{requirementDiagram-BXWQKSXE-blerqPMI.js → requirementDiagram-BXWQKSXE-C-WJyiUK.js} +1 -1
- package/dist/assets/{sankeyDiagram-P5KCCOFB-sj1di0Zb.js → sankeyDiagram-P5KCCOFB-BikqKGtk.js} +1 -1
- package/dist/assets/{sequenceDiagram-WJ2MYXX4-K41SK9p7.js → sequenceDiagram-WJ2MYXX4-009Ku6v1.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-DrUx6LOV.js → sizeCapture-INFHLROL-BtG1hGpf.js} +1 -1
- package/dist/assets/{stateDiagram-D77RDMKH-CjUNT9OC.js → stateDiagram-D77RDMKH-BX2Uia62.js} +1 -1
- package/dist/assets/stateDiagram-v2-MP3YSRHH-BpIwsc6N.js +1 -0
- package/dist/assets/{swimlanes-42K2YHIH-CuY-VJSs.js → swimlanes-42K2YHIH-oE_h5Q_J.js} +1 -1
- package/dist/assets/swimlanesDiagram-VR7AAH4N-CAtySeEC.js +8 -0
- package/dist/assets/{timeline-definition-24CTP7MA-CNZF8Fxm.js → timeline-definition-24CTP7MA-tmMXsAa-.js} +1 -1
- package/dist/assets/{vennDiagram-4TSXK5OY-Dg_Ym6Si.js → vennDiagram-4TSXK5OY-D3FmrVNo.js} +1 -1
- package/dist/assets/{wardleyDiagram-VM6X3IG4-DxMdS5qv.js → wardleyDiagram-VM6X3IG4-JGmd8Ley.js} +1 -1
- package/dist/assets/{xychartDiagram-S5SC5T6Z-BdXcE79M.js → xychartDiagram-S5SC5T6Z-CVriivaU.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/server.mjs +691 -129
- package/package.json +4 -4
- package/src/shared/types.ts +40 -0
- package/dist/assets/channel-B0rZ0iC3.js +0 -1
- package/dist/assets/classDiagram-ZZMXUADV-CVR-qi7G.js +0 -1
- package/dist/assets/classDiagram-v2-VYDZK3BY-CVR-qi7G.js +0 -1
- package/dist/assets/index-DbE5Rq8K.css +0 -1
- package/dist/assets/index-pVnDDZ5G.js +0 -902
- package/dist/assets/stateDiagram-v2-MP3YSRHH-BlkYl1y8.js +0 -1
- package/dist/assets/swimlanesDiagram-VR7AAH4N-9dXcUy7L.js +0 -8
package/API.md
CHANGED
|
@@ -49,6 +49,40 @@ await loops.prompt(chat, "make search() faster; bench is node bench.mjs");
|
|
|
49
49
|
| `GET /sheet?run=&f=` | `image/png` — the round's contact sheet |
|
|
50
50
|
| `GET /size?run=` | `{ bytes, dirs }` — what a run's worktrees hold (what `clean` would free) |
|
|
51
51
|
| `GET /ui?chat=` | `extension_ui_request[]` still waiting for an answer |
|
|
52
|
+
| `GET /commands?chat=` | `{ commands: [{ name, source, description? }], supported, setupBlocked, error? }` — this writer's extension/template/skill catalog, not terminal builtins |
|
|
53
|
+
| `GET /models?chat=` | `{ models: [{ provider, id, name?, input? }], current?: { provider, id }, setupBlocked, error?, requiresRestart?, warning? }` — sanitized Pi metadata; idle reads refresh public metadata without a model request |
|
|
54
|
+
| `GET /providers` | `{ providers: [{ id, name, oauth, apiKey, connected }], flow? }` — stored-presence metadata and the bounded current login interaction; never credentials |
|
|
55
|
+
|
|
56
|
+
### Pi session and provider actions
|
|
57
|
+
|
|
58
|
+
| Route | Body | Effect |
|
|
59
|
+
|---|---|---|
|
|
60
|
+
| `POST /commands/run` | `{ chat, name, args? }` | Validate the exact name against this writer's current catalog, then send the command; unknown/native-only commands never fall through to model text |
|
|
61
|
+
| `POST /models` | `{ chat, provider, modelId }` | Select the exact catalog model in this chat only; returns `{ ok, current: { provider, id } }` after Pi confirms |
|
|
62
|
+
| `POST /compact` | `{ chat, customInstructions? }` | Explicitly request a potentially paid compaction; returns `{ ok, result }` after completion |
|
|
63
|
+
| `POST /providers/login` | `{ provider }` | Start Pi's OAuth login; returns `{ flow }` |
|
|
64
|
+
| `POST /providers/key` | `{ provider, key }` | Submit a literal API key to Pi's login flow; returns `{ flow }`, which may still need prompts |
|
|
65
|
+
| `POST /providers/answer` | `{ id, promptId, value }` | Answer that exact current login prompt; selections use stable option IDs |
|
|
66
|
+
| `POST /providers/cancel` | `{ id }` | Cancel the exact pending login flow and release its callback resources |
|
|
67
|
+
|
|
68
|
+
All routes share the existing token/origin/Host guards under both API prefixes. Provider responses are
|
|
69
|
+
`Cache-Control: no-store`; API keys, OAuth credentials, and raw SDK model headers/base URLs are never returned.
|
|
70
|
+
Model IDs are separate `provider`/`modelId` fields, not guessed composite-ID parsing. Session model and compaction
|
|
71
|
+
mutations are idle-only and do not replace the writer. `ChatState.sessionActions` reports `setupBlocked`, `busy`,
|
|
72
|
+
and `compaction: { status, startedAt?, finishedAt?, result?, error? }`. Completion comes from actual Pi state.
|
|
73
|
+
A mutation deadline can return `504 { error, uncertain: true }` while Pi is still working; the completion observer
|
|
74
|
+
and lock remain active. Inspect streamed state and **never automatically retry** compaction.
|
|
75
|
+
|
|
76
|
+
Login is a separate, server-wide, in-memory interaction, not chat history. A flow has `id`, `provider`, and
|
|
77
|
+
`status` (`pending`, `succeeded`, `failed`, `cancelled`, `expired`). Pending flows can include an HTTPS
|
|
78
|
+
`authorizationUrl`, `instructions`, `deviceCode: { userCode, verificationUri, expiresInSeconds? }`, and
|
|
79
|
+
`prompt: { id, type, message, placeholder?, allowEmpty?, options?: [{ id, label, description? }] }`.
|
|
80
|
+
Prompt types are `text`, `secret`, `select`, or `manual_code`. Poll status only while needed; stale prompt IDs,
|
|
81
|
+
duplicate answers, overlapping flows, and command-style API keys are refused. The maximum login lifetime is
|
|
82
|
+
15 minutes (a provider can shorten it); terminal interactions briefly retain only status, never codes/URLs.
|
|
83
|
+
`succeeded` means Pi committed credentials, not a live account/plan verification. Credential changes refresh
|
|
84
|
+
idle writers' metadata; selecting a model remains explicit. Custom RPC implementations lacking refresh support
|
|
85
|
+
report `requiresRestart` rather than silently restarting a session.
|
|
52
86
|
|
|
53
87
|
### The event stream
|
|
54
88
|
|
package/README.md
CHANGED
|
@@ -18,8 +18,47 @@ Installed from npm it is one command, and that is the one to hand someone:
|
|
|
18
18
|
npx @computesdk/loops serve
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
It is a **client of a real Pi session**, not a re-implementation of one.
|
|
22
|
-
the session is the durable record, and `.pi/loops/` is a rebuildable index plus
|
|
21
|
+
It is a **client of a real Pi session**, not a re-implementation of one. Chat state uses RPC and SSE rather than
|
|
22
|
+
polling or another database: the session is the durable record, and `.pi/loops/` is a rebuildable index plus its worktrees.
|
|
23
|
+
|
|
24
|
+
## Commands, providers, and chat models
|
|
25
|
+
|
|
26
|
+
Open **Commands** or press **Cmd/Ctrl K**. Typing `/` in the composer opens the same keyboard-navigable menu.
|
|
27
|
+
Pi discovers that chat's extension commands, prompt templates, and skills; their exact names and source are shown.
|
|
28
|
+
Choosing one inserts it into the composer—review its arguments and explicitly Send. Unknown slash commands are
|
|
29
|
+
rejected without sending them to the model. This is not an emulation of Pi's full terminal interface.
|
|
30
|
+
|
|
31
|
+
| App action | Behavior |
|
|
32
|
+
|---|---|
|
|
33
|
+
| `/new` | Create a new app chat in the selected workspace; retain the old chat and its draft |
|
|
34
|
+
| `/model` | Choose an exact provider/model from this writer's available catalog |
|
|
35
|
+
| `/compact` | Confirm a potentially paid compaction; show Pi's progress/result without automatically retrying |
|
|
36
|
+
| `/login` | Connect a provider using Pi's OAuth/API-key flow |
|
|
37
|
+
|
|
38
|
+
Discovered Pi names win collisions. The corresponding app action moves to an available `app:` alias displayed
|
|
39
|
+
in the menu, instead of silently shadowing an extension, template, or skill. Model selection changes the parent
|
|
40
|
+
chat only; it does not rewrite loop role/attempt configuration or global defaults. Model changes and compaction require an idle
|
|
41
|
+
parent and no running background loops. Neither operation replaces the Pi session or creates another writer.
|
|
42
|
+
|
|
43
|
+
**Connect provider** also works before selecting a chat. Pi's public provider metadata determines the available
|
|
44
|
+
login methods. OAuth supports browser authorization, manual callback/code prompts for remote VMs, and device-code
|
|
45
|
+
flows when offered by the provider. Finish the provider's instructions in the dialog; on a remote VM, a localhost
|
|
46
|
+
redirect may fail on your laptop, in which case copy its full callback URL into Pi's manual prompt. Closing the
|
|
47
|
+
dialog cancels its pending flow. Expiry, cancellation, and server shutdown clean up callback listeners.
|
|
48
|
+
Cancellation cannot undo a credential already committed or revoke an account grant.
|
|
49
|
+
|
|
50
|
+
API keys and authorization responses go only in JSON to the dialog's pinned server with its pinned bearer.
|
|
51
|
+
They are not written to chat, URLs, logs, or browser storage. Pi owns credential persistence and OAuth refresh;
|
|
52
|
+
the UI does not copy or implement provider token storage. A submitted key can require follow-up prompts:
|
|
53
|
+
**Connected** means Pi confirmed persistence, not that a paid verification request succeeded. Merely opening
|
|
54
|
+
the dialog lists stored-presence metadata and does not execute configured credential commands or sign in.
|
|
55
|
+
There is one bounded, in-memory login flow per server; its status is polled only while the dialog is open/pending.
|
|
56
|
+
|
|
57
|
+
After login, idle writers refresh Pi's public model runtime without a model request or automatic model switch.
|
|
58
|
+
The bundled SHA-pinned RPC adapter adds this metadata refresh; custom Pi executables without it show a restart
|
|
59
|
+
warning and are never restarted automatically. Startup extension decisions remain separate and must be answered
|
|
60
|
+
before that writer's commands/models are available. Loop settings retain role configuration and checks, while
|
|
61
|
+
their former key-only panel now opens the shared provider dialog.
|
|
23
62
|
|
|
24
63
|
| What the UI shows | Where it comes from |
|
|
25
64
|
|---|---|
|
|
@@ -98,8 +137,8 @@ It prints the address and opens it:
|
|
|
98
137
|
```
|
|
99
138
|
|
|
100
139
|
`--no-open` (or `LOOPS_UI_OPEN=0`) prints the address without launching a browser. When the URL carries a token — off
|
|
101
|
-
loopback — the opened address is the attach form, `/?server=…&token
|
|
102
|
-
address bar.
|
|
140
|
+
loopback — the opened address is the attach form, `/?server=…&token=…`. The app adopts it once and removes the token
|
|
141
|
+
from the address bar and current history entry. A non-secret external server address stays in navigation links.
|
|
103
142
|
|
|
104
143
|
A loop needs the engine, so the boot says when it is missing rather than leaving you to find out on the first prompt:
|
|
105
144
|
if the selected Pi executable or an `--extensions` path does not exist, it prints what is wrong and the fix under `!! a loop
|
|
@@ -108,6 +147,30 @@ repos and read what already ran.
|
|
|
108
147
|
|
|
109
148
|
A **workspace is a directory on the connected VM**, with its chats, runs, and `.pi/loops.json`.
|
|
110
149
|
`+` opens the launcher: choose a recent workspace, browse the VM's directories, or paste an absolute path (`~/` works).
|
|
150
|
+
|
|
151
|
+
### Navigation links
|
|
152
|
+
|
|
153
|
+
Workspaces, chats, and loop views have bookmarkable URLs:
|
|
154
|
+
|
|
155
|
+
```text
|
|
156
|
+
/workspaces
|
|
157
|
+
/workspaces/<workspace-id>
|
|
158
|
+
/workspaces/<workspace-id>/chats/<chat-id>
|
|
159
|
+
/workspaces/<workspace-id>/chats/<chat-id>/loops/<run-id>
|
|
160
|
+
/workspaces/<workspace-id>/chats/<chat-id>/loops/<run-id>?round=2&attempt=R2-safe
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
IDs and attempt names are URL-encoded, durable identifiers, not display titles. Links support copy-link,
|
|
164
|
+
new tabs, reload, and browser Back/Forward. Explicit links take precedence over remembered selections;
|
|
165
|
+
only the legacy bare `/` entry restores the last selection and replaces itself with its concrete URL.
|
|
166
|
+
Opening a link never creates a chat or rebinds its directory. A known closed workspace reopens with the
|
|
167
|
+
same ID. Unknown, unavailable, or mismatched targets show an error and recovery links, not another
|
|
168
|
+
chat's content or actions. Round/attempt focus is validated against that chat's actual loop history.
|
|
169
|
+
|
|
170
|
+
When attached to another backend, links include `?server=…` (alongside any round/attempt parameters),
|
|
171
|
+
but never its bearer token. Recipients need their own access to that server. A server-only link cannot
|
|
172
|
+
forward another backend's saved credential; same-origin authenticated links retain their token on reload.
|
|
173
|
+
An explicit link without a server parameter refers to the origin serving the UI, not a stale attached-server preference.
|
|
111
174
|
Home, Up, breadcrumbs, and Show hidden navigate the server's filesystem, not the browser's computer.
|
|
112
175
|
The picker shows whether Git has a commit; opening a directory never initializes Git or edits the project.
|
|
113
176
|
|
package/bin/pi-rpc-startup.mjs
CHANGED
|
@@ -21,6 +21,14 @@ export function patchRpcStartup(source) {
|
|
|
21
21
|
' timeoutId = setTimeout(() => {\n cleanup();\n if (!shuttingDown) output({ type: "extension_ui_request_cancelled", id });\n resolve(defaultValue);\n }, opts.timeout);');
|
|
22
22
|
replaceOnce(' const command = parsed;\n try {\n const response = await handleCommand(command);',
|
|
23
23
|
' const command = parsed;\n try {\n await initialization;\n if (shuttingDown) return;\n const response = await handleCommand(command);');
|
|
24
|
+
// Login happens in the browser-facing server. Refresh this writer's public
|
|
25
|
+
// runtime without restarting its session, selecting a model, or making a model request.
|
|
26
|
+
replaceOnce(' case "get_available_models": {',
|
|
27
|
+
` case "refresh_available_models": {
|
|
28
|
+
await session.modelRuntime.refresh({ allowNetwork: false });
|
|
29
|
+
return success(id, "refresh_available_models", { models: session.modelRuntime.getAvailableSnapshot() });
|
|
30
|
+
}
|
|
31
|
+
case "get_available_models": {`);
|
|
24
32
|
replaceOnce(' // Keep process alive forever\n return new Promise(() => { });',
|
|
25
33
|
` registerSignalHandlers();
|
|
26
34
|
// Start binding only after the input reader is attached. UI replies bypass
|
package/client.ts
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
// reach into this package's internals.
|
|
6
6
|
import type { ChatInfo, ChatState, DoctorReport, ModelOption, ParentItem, Question, Run, Workspace } from "./src/shared/types.ts";
|
|
7
7
|
export type { ChatInfo, ChatState, DoctorReport, ModelOption, ParentItem, Question, Run, RunAttempt, RunRound, RunEvent, Workspace } from "./src/shared/types.ts";
|
|
8
|
+
import type { CommandCatalog, ModelIdentity, ProviderFlow, ProviderSnapshot, SessionModelCatalog } from "./src/shared/types.ts";
|
|
9
|
+
export type { CommandCatalog, ModelIdentity, ProviderFlow, ProviderSnapshot, ProviderSummary, SessionActions, SessionCommand, SessionModel, SessionModelCatalog } from "./src/shared/types.ts";
|
|
8
10
|
|
|
9
11
|
export type ClientOptions = {
|
|
10
12
|
/** `http://box:3000` — no trailing slash needed. */
|
|
@@ -111,6 +113,31 @@ export class LoopsClient {
|
|
|
111
113
|
|
|
112
114
|
abort(chat: string) { return this.call<{ ok: boolean }>("/abort", { method: "POST", json: { chat } }); }
|
|
113
115
|
|
|
116
|
+
/** This writer's dynamic extension/template/skill catalog, not Pi's terminal builtins. */
|
|
117
|
+
commands(chat: string) { return this.call<CommandCatalog>(`/commands?chat=${encodeURIComponent(chat)}`); }
|
|
118
|
+
runCommand(chat: string, name: string, args = "") {
|
|
119
|
+
return this.call<{ disposition: string }>("/commands/run", { method: "POST", json: { chat, name, args } });
|
|
120
|
+
}
|
|
121
|
+
sessionModels(chat: string) { return this.call<SessionModelCatalog>(`/models?chat=${encodeURIComponent(chat)}`); }
|
|
122
|
+
/** Changes this chat only; loop role/attempt models remain engine configuration. */
|
|
123
|
+
setSessionModel(chat: string, provider: string, modelId: string) {
|
|
124
|
+
return this.call<{ ok: boolean; current: ModelIdentity }>("/models", { method: "POST", json: { chat, provider, modelId } });
|
|
125
|
+
}
|
|
126
|
+
/** Explicit paid operation. A timeout is uncertain delivery, never a reason to retry automatically. */
|
|
127
|
+
compact(chat: string, customInstructions?: string) {
|
|
128
|
+
return this.call<{ ok: boolean; result: unknown }>("/compact", { method: "POST", json: { chat, customInstructions } });
|
|
129
|
+
}
|
|
130
|
+
providers() { return this.call<ProviderSnapshot>("/providers"); }
|
|
131
|
+
loginProvider(provider: string) { return this.call<{ flow: ProviderFlow }>("/providers/login", { method: "POST", json: { provider } }); }
|
|
132
|
+
/** Secret input is sent only in JSON to this client's fixed server. Completion is flow.status === succeeded. */
|
|
133
|
+
setProviderKey(provider: string, key: string) {
|
|
134
|
+
return this.call<{ flow: ProviderFlow }>("/providers/key", { method: "POST", json: { provider, key } });
|
|
135
|
+
}
|
|
136
|
+
answerProviderLogin(id: string, promptId: string, value: string) {
|
|
137
|
+
return this.call<{ flow: ProviderFlow }>("/providers/answer", { method: "POST", json: { id, promptId, value } });
|
|
138
|
+
}
|
|
139
|
+
cancelProviderLogin(id: string) { return this.call<{ flow: ProviderFlow }>("/providers/cancel", { method: "POST", json: { id } }); }
|
|
140
|
+
|
|
114
141
|
/** Answer a queued question (a needs-you card). */
|
|
115
142
|
answer(chat: string, question: string, choice: string) {
|
|
116
143
|
return this.call<{ ok: boolean }>("/answer", { method: "POST", json: { chat, question, choice } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as p,r as u,d as a}from"./chunk-SVP7TREG-
|
|
1
|
+
import{g as p,r as u,d as a}from"./chunk-SVP7TREG-DoYdkbun.js";import{p as f}from"./chunk-JWPE2WC7-BPJdwBVM.js";import{_ as n,l as o}from"./index-Cfkb4x7R.js";import{M as c,b as d}from"./cynefin-OW5HDTMX-wj1eU8-l.js";var v=d().RailroadAbnf.parser.LangiumParser,l=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),i=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:i,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return l(e.element);case"AbnfOptionalGroup":return{type:"optional",element:l(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:l(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},w={parser:R,db:a,renderer:u,styles:p};export{w as diagram};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{K as ln,L as an,M as y,N as tn,O as X,P as O,Q as _,S as un,T as rn,V as $,X as o,Y as M,Z as sn,$ as on,a0 as fn}from"./index-
|
|
1
|
+
import{K as ln,L as an,M as y,N as tn,O as X,P as O,Q as _,S as un,T as rn,V as $,X as o,Y as M,Z as sn,$ as on,a0 as fn}from"./index-Cfkb4x7R.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,D,S,v,A,N,a){var E=D-l,i=S-h,n=N-v,d=a-A,u=d*E-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*E,h+u*i]}function G(l,h,D,S,v,A,N){var a=l-D,E=h-S,i=(N?A:-A)/$(a*a+E*E),n=i*E,d=-i*a,u=l+n,s=h+d,f=D+n,c=S+d,Q=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,I=(g<0?-1:1)*$(fn(0,T*T*R-P*P)),K=(P*g-m*I)/R,L=(-P*m-g*I)/R,w=(P*g+m*I)/R,p=(-P*m+g*I)/R,x=K-Q,e=L-t,r=w-Q,V=p-t;return x*x+e*e>r*r+V*V&&(K=w,L=p),{cx:K,cy:L,x01:-n,y01:-d,x11:K*(v/T-1),y11:L*(v/T-1)}}function hn(){var l=cn,h=yn,D=M(0),S=null,v=gn,A=dn,N=mn,a=null,E=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-an,c=A.apply(this,arguments)-an,Q=un(c-f),t=c>f;if(a||(a=n=E()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(Q>tn-y)a.moveTo(s*X(f),s*O(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*X(c),u*O(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=Q,I=Q,K=N.apply(this,arguments)/2,L=K>y&&(S?+S.apply(this,arguments):$(u*u+s*s)),w=_(un(s-u)/2,+D.apply(this,arguments)),p=w,x=w,e,r;if(L>y){var V=sn(L/u*O(K)),j=sn(L/s*O(K));(P-=V*2)>y?(V*=t?1:-1,R+=V,T-=V):(P=0,R=T=(f+c)/2),(I-=j*2)>y?(j*=t?1:-1,m+=j,g-=j):(I=0,m=g=(f+c)/2)}var Y=s*X(m),Z=s*O(m),z=u*X(T),B=u*O(T);if(w>y){var C=s*X(g),F=s*O(g),H=u*X(R),J=u*O(R),q;if(Q<rn)if(q=pn(Y,Z,H,J,C,F,z,B)){var U=Y-q[0],W=Z-q[1],k=C-q[0],b=F-q[1],nn=1/O(on((U*k+W*b)/($(U*U+W*W)*$(k*k+b*b)))/2),en=$(q[0]*q[0]+q[1]*q[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}I>y?x>y?(e=G(H,J,Y,Z,s,x,t),r=G(C,F,z,B,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(Y,Z),a.arc(0,0,s,m,g,!t)):a.moveTo(Y,Z),!(u>y)||!(P>y)?a.lineTo(z,B):p>y?(e=G(z,B,C,F,u,-p,t),r=G(Y,Z,H,J,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-rn/2;return[X(d)*n,O(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:M(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:M(+n),i):h},i.cornerRadius=function(n){return arguments.length?(D=typeof n=="function"?n:M(+n),i):D},i.padRadius=function(n){return arguments.length?(S=n==null?null:typeof n=="function"?n:M(+n),i):S},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:M(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:M(+n),i):A},i.padAngle=function(n){return arguments.length?(N=typeof n=="function"?n:M(+n),i):N},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
|