@jive-sh/skill-sync 0.7.1 → 0.7.2-latest-darwin-arm64
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/multi-call-binary +4 -0
- package/package.json +11 -36
- package/README.md +0 -187
- package/bin/package.json +0 -1
- package/bin/skill-sync +0 -614
- package/bin/skill-sync-daemon +0 -614
- package/dist/daemons/skill-sync-daemon.js +0 -634
- package/dist/daemons/skill-sync-daemon.js.map +0 -1
- package/dist/entrypoints/skill-sync.js +0 -7
- package/dist/entrypoints/skill-sync.js.map +0 -1
- package/dist/index.js +0 -10
- package/dist/index.js.map +0 -1
- package/dist/internal/agents/agent-tool.js +0 -102
- package/dist/internal/agents/agent-tool.js.map +0 -1
- package/dist/internal/agents/claude.js +0 -424
- package/dist/internal/agents/claude.js.map +0 -1
- package/dist/internal/agents/codex.js +0 -270
- package/dist/internal/agents/codex.js.map +0 -1
- package/dist/internal/agents/command.js +0 -219
- package/dist/internal/agents/command.js.map +0 -1
- package/dist/internal/agents/grok.js +0 -170
- package/dist/internal/agents/grok.js.map +0 -1
- package/dist/internal/agents/index.js +0 -70
- package/dist/internal/agents/index.js.map +0 -1
- package/dist/internal/cli.js +0 -185
- package/dist/internal/cli.js.map +0 -1
- package/dist/internal/config.js +0 -131
- package/dist/internal/config.js.map +0 -1
- package/dist/internal/control.js +0 -113
- package/dist/internal/control.js.map +0 -1
- package/dist/internal/daemon-control/impl.js +0 -68
- package/dist/internal/daemon-control/impl.js.map +0 -1
- package/dist/internal/daemon-control/interface.js +0 -4
- package/dist/internal/daemon-control/interface.js.map +0 -1
- package/dist/internal/folders.js +0 -47
- package/dist/internal/folders.js.map +0 -1
- package/dist/internal/local-skills.js +0 -43
- package/dist/internal/local-skills.js.map +0 -1
- package/dist/internal/path.js +0 -36
- package/dist/internal/path.js.map +0 -1
- package/dist/internal/server.js +0 -80
- package/dist/internal/server.js.map +0 -1
- package/dist/internal/skill-check.js +0 -83
- package/dist/internal/skill-check.js.map +0 -1
- package/dist/internal/skill-refinement/evals/cases.js +0 -143
- package/dist/internal/skill-refinement/evals/cases.js.map +0 -1
- package/dist/internal/skill-refinement/evals/opus-action-judge-original.json +0 -350
- package/dist/internal/skill-refinement/evals/opus-judge-original.json +0 -165
- package/dist/internal/skill-refinement/feedback/intake.js +0 -52
- package/dist/internal/skill-refinement/feedback/intake.js.map +0 -1
- package/dist/internal/skill-refinement/jev/impl.js +0 -51
- package/dist/internal/skill-refinement/jev/impl.js.map +0 -1
- package/dist/internal/skill-refinement/jev/interface.js +0 -14
- package/dist/internal/skill-refinement/jev/interface.js.map +0 -1
- package/dist/internal/skill-refinement/paths.js +0 -62
- package/dist/internal/skill-refinement/paths.js.map +0 -1
- package/dist/internal/skill-refinement/platform.js +0 -68
- package/dist/internal/skill-refinement/platform.js.map +0 -1
- package/dist/internal/skill-refinement/service.js +0 -238
- package/dist/internal/skill-refinement/service.js.map +0 -1
- package/dist/internal/skill-refinement/skills/skill-text.js +0 -149
- package/dist/internal/skill-refinement/skills/skill-text.js.map +0 -1
- package/dist/internal/skill-refinement/workflow/skill-refinement.js +0 -501
- package/dist/internal/skill-refinement/workflow/skill-refinement.js.map +0 -1
- package/dist/internal/skill-refinement/writer/impl.js +0 -69
- package/dist/internal/skill-refinement/writer/impl.js.map +0 -1
- package/dist/internal/skill-refinement/writer/interface.js +0 -10
- package/dist/internal/skill-refinement/writer/interface.js.map +0 -1
- package/dist/internal/sync.js +0 -182
- package/dist/internal/sync.js.map +0 -1
- package/dist/internal/wire.js +0 -31
- package/dist/internal/wire.js.map +0 -1
- package/install.cjs +0 -614
- package/src/daemons/skill-sync-daemon.ts +0 -639
- package/src/entrypoints/skill-sync.ts +0 -12
- package/src/index.ts +0 -15
- package/src/internal/agents/agent-tool.ts +0 -149
- package/src/internal/agents/claude.ts +0 -442
- package/src/internal/agents/codex.ts +0 -288
- package/src/internal/agents/command.ts +0 -257
- package/src/internal/agents/grok.ts +0 -174
- package/src/internal/agents/index.ts +0 -74
- package/src/internal/cli.ts +0 -217
- package/src/internal/config.ts +0 -172
- package/src/internal/control.ts +0 -157
- package/src/internal/daemon-control/impl.ts +0 -80
- package/src/internal/daemon-control/interface.ts +0 -40
- package/src/internal/folders.ts +0 -50
- package/src/internal/local-skills.ts +0 -58
- package/src/internal/path.ts +0 -32
- package/src/internal/server.ts +0 -76
- package/src/internal/skill-check.ts +0 -97
- package/src/internal/skill-refinement/evals/cases.ts +0 -167
- package/src/internal/skill-refinement/evals/opus-action-judge-original.json +0 -350
- package/src/internal/skill-refinement/evals/opus-judge-original.json +0 -165
- package/src/internal/skill-refinement/feedback/intake.ts +0 -66
- package/src/internal/skill-refinement/jev/impl.ts +0 -63
- package/src/internal/skill-refinement/jev/interface.ts +0 -51
- package/src/internal/skill-refinement/paths.ts +0 -87
- package/src/internal/skill-refinement/platform.ts +0 -72
- package/src/internal/skill-refinement/service.ts +0 -283
- package/src/internal/skill-refinement/skills/skill-text.ts +0 -213
- package/src/internal/skill-refinement/workflow/skill-refinement.ts +0 -569
- package/src/internal/skill-refinement/writer/impl.ts +0 -79
- package/src/internal/skill-refinement/writer/interface.ts +0 -29
- package/src/internal/sync.ts +0 -216
- package/src/internal/wire.ts +0 -439
package/src/internal/wire.ts
DELETED
|
@@ -1,439 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The shapes the daemon and the service exchange.
|
|
3
|
-
*
|
|
4
|
-
* Declared in the library and imported by the service so there is one definition rather than two that
|
|
5
|
-
* drift. The service depends on the library; nothing goes the other way.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export interface RemoteFile {
|
|
9
|
-
readonly path: string;
|
|
10
|
-
/** Null when the file is deleted; the row stays, so the deletion reaches every machine. */
|
|
11
|
-
readonly hash: string | null;
|
|
12
|
-
/** When this version was edited, in milliseconds since the epoch. The latest edit wins. */
|
|
13
|
-
readonly editedAt: number;
|
|
14
|
-
readonly updatedBy: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface ListFilesResponse {
|
|
18
|
-
/** Highest sequence number in this page; the caller sends it back as `since`. */
|
|
19
|
-
readonly cursor: number;
|
|
20
|
-
readonly files: ReadonlyArray<RemoteFile>;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Taken only when `editedAt` is later than the edit the server holds; refused with 409 otherwise. The edit is
|
|
25
|
-
* recorded as the token's machine's, so the request does not name one.
|
|
26
|
-
*/
|
|
27
|
-
export interface PutFileRequest {
|
|
28
|
-
readonly path: string;
|
|
29
|
-
/** When the file was edited: its modification time, or for a deletion, when it was noticed. */
|
|
30
|
-
readonly editedAt: number;
|
|
31
|
-
/** Null to delete. */
|
|
32
|
-
readonly hash: string | null;
|
|
33
|
-
/** Base64, absent for a delete. */
|
|
34
|
-
readonly content: string | null;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* `POST /cli/sign-in-requests` with `{ machine }`: a request to sign that machine in, approved with the passkey on
|
|
39
|
-
* the page at `url`, from this computer or any other. The daemon keeps `claimSecret` in memory and claims the
|
|
40
|
-
* request with it (`SignInClaim`); `url` carries only the request's id, so whoever sees the page cannot claim it.
|
|
41
|
-
*/
|
|
42
|
-
export interface SignInRequestCreated {
|
|
43
|
-
readonly url: string;
|
|
44
|
-
readonly claimSecret: string;
|
|
45
|
-
readonly expiresAt: number;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/** `POST /cli/sign-in-requests/claim` with `{ claimSecret }`: the machine's token, once, after the passkey approved it. */
|
|
49
|
-
export type SignInClaim =
|
|
50
|
-
| { readonly state: "pending" }
|
|
51
|
-
| { readonly state: "approved"; readonly token: string }
|
|
52
|
-
/** Expired, already claimed, or never created. */
|
|
53
|
-
| { readonly state: "expired" };
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* The header every daemon request names its configured machine in (`machine` in `~/.jive/skill-sync.json`).
|
|
57
|
-
* The service names a machine only from its token's row, and refuses a request whose header names another
|
|
58
|
-
* machine (`MachineMismatch`), so a token copied from one machine onto another cannot write as the first.
|
|
59
|
-
*/
|
|
60
|
-
export const MACHINE_HEADER = "x-skill-sync-machine";
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* The service's answer, with status 403, to a request whose `MACHINE_HEADER` is not the machine its token was
|
|
64
|
-
* issued to. `tokenMachine` is the machine the token belongs to.
|
|
65
|
-
*/
|
|
66
|
-
export interface MachineMismatch {
|
|
67
|
-
readonly error: string;
|
|
68
|
-
readonly tokenMachine: string;
|
|
69
|
-
}
|
|
70
|
-
export const MACHINE_MISMATCH_STATUS = 403;
|
|
71
|
-
|
|
72
|
-
/** Where a folder's sync stands, as the dashboard shows it. `attention` means a cycle failed; `detail` says why. */
|
|
73
|
-
export type FolderState = "idle" | "attention";
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* A skill is a top-level entry of a skills folder — usually a directory like `jive/` holding `SKILL.md`
|
|
77
|
-
* and its files — and it is the unit of opting in: all of its files sync, or none do, so a skill never
|
|
78
|
-
* arrives half-present on another machine.
|
|
79
|
-
*/
|
|
80
|
-
export const skillOf = (path: string): string => path.split("/")[0]!;
|
|
81
|
-
|
|
82
|
-
/** A file and the SHA-256 of its content — the same hash the server stores, so copies can be compared. */
|
|
83
|
-
export interface FileHash {
|
|
84
|
-
readonly path: string;
|
|
85
|
-
readonly hash: string;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/** One skill as a folder holds it. */
|
|
89
|
-
export interface LocalSkill {
|
|
90
|
-
readonly name: string;
|
|
91
|
-
readonly files: ReadonlyArray<FileHash>;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* `POST /folders`: every folder this machine found, with the skills in each, for the dashboard. Answered
|
|
96
|
-
* with the enabled folders, each with the synced list: the daemon pushes and pulls exactly those skills,
|
|
97
|
-
* and never touches any other.
|
|
98
|
-
*/
|
|
99
|
-
export interface FoldersRequest {
|
|
100
|
-
readonly folders: ReadonlyArray<{ readonly path: string; readonly skills: ReadonlyArray<LocalSkill> }>;
|
|
101
|
-
}
|
|
102
|
-
export interface FolderPrefs {
|
|
103
|
-
readonly path: string;
|
|
104
|
-
readonly skills: ReadonlyArray<string>;
|
|
105
|
-
}
|
|
106
|
-
export interface FoldersResponse {
|
|
107
|
-
readonly folders: ReadonlyArray<FolderPrefs>;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Whether a name can be a skill's: lowercase letters and digits in hyphen-joined words, at most 64
|
|
112
|
-
* characters, which is what Claude, Codex and Grok accept as a skill name. The daemon checks it before
|
|
113
|
-
* asking, and the service again before writing, so both judge a name by this one rule.
|
|
114
|
-
*/
|
|
115
|
-
export const isSkillName = (name: string): boolean => name.length <= 64 && /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(name);
|
|
116
|
-
|
|
117
|
-
/** `PUT /skills/<name>`: puts a skill on the synced list. `added` is false when it was already on it. */
|
|
118
|
-
export interface AddSkillResponse {
|
|
119
|
-
readonly added: boolean;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/** `GET /skills`: the synced list, as `skill-sync list` shows it. Deleted skills are not on it. */
|
|
123
|
-
export interface ListSkillsResponse {
|
|
124
|
-
readonly skills: ReadonlyArray<ListedSkill>;
|
|
125
|
-
}
|
|
126
|
-
export interface ListedSkill {
|
|
127
|
-
readonly name: string;
|
|
128
|
-
/** Live files on the server; zero for a skill ticked before any machine has pushed it. */
|
|
129
|
-
readonly files: number;
|
|
130
|
-
/** The latest edit of any of its files, and the display name of the machine it came from; null with no files. */
|
|
131
|
-
readonly editedAt: number | null;
|
|
132
|
-
readonly editedBy: string | null;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* The header a daemon names its own version in when it opens its WebSocket to the hub, so the dashboard
|
|
137
|
-
* can show which version each machine runs. Daemons before 0.4.6 do not send it.
|
|
138
|
-
*/
|
|
139
|
-
export const DAEMON_VERSION_HEADER = "x-skill-sync-version";
|
|
140
|
-
|
|
141
|
-
/** One usage limit of an account: how much of it is used and when it starts over. */
|
|
142
|
-
export interface UsageWindow {
|
|
143
|
-
/**
|
|
144
|
-
* The limit's name, the same for every tool and machine so the dashboard gives each one a column:
|
|
145
|
-
* `5-hour`, `weekly`, or a limit on one model, such as `weekly Fable`.
|
|
146
|
-
*/
|
|
147
|
-
readonly name: string;
|
|
148
|
-
/** How long the window is, in minutes (300 for five hours, 10080 for a week); null when the tool does not say. */
|
|
149
|
-
readonly minutes: number | null;
|
|
150
|
-
/** Percent of the limit used, from 0 to 100. */
|
|
151
|
-
readonly usedPercent: number;
|
|
152
|
-
/** When the window starts over, in milliseconds since the epoch; null when no window is running. */
|
|
153
|
-
readonly resetsAt: number | null;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/** Money as the tool records it: an amount in the currency's smallest unit, so 1234 with exponent 2 is 12.34. */
|
|
157
|
-
export interface Money {
|
|
158
|
-
readonly amountMinor: number;
|
|
159
|
-
readonly currency: string;
|
|
160
|
-
readonly exponent: number;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Which account a tool is signed in to, as its own CLI reports it (`claude auth status`, Codex's
|
|
165
|
-
* `account/read`). The same account signed in on several machines has the same `id`, so the dashboard
|
|
166
|
-
* shows it once.
|
|
167
|
-
*/
|
|
168
|
-
export interface AccountIdentity {
|
|
169
|
-
/** Claude's organization id; Codex's email. */
|
|
170
|
-
readonly id: string;
|
|
171
|
-
/** The email the account is signed in with. */
|
|
172
|
-
readonly email: string;
|
|
173
|
-
/** The plan as the tool names it (`max`, `pro`); null when it does not say. */
|
|
174
|
-
readonly plan: string | null;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* The account's plan limits, which its provider counts across every machine it is used on.
|
|
179
|
-
*
|
|
180
|
-
* `reading`: `asOf` is when they were read. `source` says from where: `account` when the tool's CLI fetched
|
|
181
|
-
* them from its service for this reading (`claude /usage`, Codex's `account/rateLimits/read`), `saved`
|
|
182
|
-
* when the CLI could not be run and they come from the tool's own record of its last fetch, which is as
|
|
183
|
-
* old as the tool's last use of the account. `none`: the account has no plan limits, or the tool offers
|
|
184
|
-
* no way to read them; `reason` says which. `unknown`: reading them failed; `reason` says why.
|
|
185
|
-
*/
|
|
186
|
-
export type AccountLimits =
|
|
187
|
-
| {
|
|
188
|
-
readonly state: "reading";
|
|
189
|
-
readonly asOf: number;
|
|
190
|
-
readonly source: "account" | "saved";
|
|
191
|
-
/** With `saved`: why the CLI was not asked, or failed. */
|
|
192
|
-
readonly cliFailure?: string;
|
|
193
|
-
readonly windows: ReadonlyArray<UsageWindow>;
|
|
194
|
-
/** Spent beyond the plan, when the account pays for usage past its limits; absent when it does not. */
|
|
195
|
-
readonly spent?: { readonly used: Money; readonly limit: Money | null };
|
|
196
|
-
}
|
|
197
|
-
| { readonly state: "none"; readonly reason: string }
|
|
198
|
-
| { readonly state: "unknown"; readonly reason: string };
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* One session's use as one machine's files record it, keyed by the session id its tool gives it. The same
|
|
202
|
-
* session can be on several machines, when session files are copied or synced between them; the service
|
|
203
|
-
* counts it once (`LocalUseTotal`).
|
|
204
|
-
*/
|
|
205
|
-
export interface SessionUse {
|
|
206
|
-
readonly id: string;
|
|
207
|
-
/** Cost in the currency's smallest unit for `spend`, tokens for `tokens`. */
|
|
208
|
-
readonly amount: number;
|
|
209
|
-
/** When the session was last active, in milliseconds since the epoch. */
|
|
210
|
-
readonly lastActiveAt: number;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Each session of the account this machine's files show as active over the last `periodDays` days.
|
|
215
|
-
*
|
|
216
|
-
* `spend`: the tool's own cost figure for each session: Claude Code's estimate at list price, which it saves
|
|
217
|
-
* when a session ends, is cleared, resumed or forked, so a running session counts as of its last save; Grok's,
|
|
218
|
-
* from `grok usage`. `tokens`: the tokens Codex counted, cached input included.
|
|
219
|
-
*/
|
|
220
|
-
export type LocalUse =
|
|
221
|
-
| {
|
|
222
|
-
readonly state: "spend";
|
|
223
|
-
readonly periodDays: number;
|
|
224
|
-
readonly currency: string;
|
|
225
|
-
readonly exponent: number;
|
|
226
|
-
readonly sessions: ReadonlyArray<SessionUse>;
|
|
227
|
-
/** Claude Code could not price a model in at least one session, so the true cost is higher. */
|
|
228
|
-
readonly partial: boolean;
|
|
229
|
-
/** `bedrock` when the account's settings or the model IDs its sessions used say so; null when nothing says. */
|
|
230
|
-
readonly provider: "bedrock" | null;
|
|
231
|
-
}
|
|
232
|
-
| {
|
|
233
|
-
readonly state: "tokens";
|
|
234
|
-
readonly periodDays: number;
|
|
235
|
-
readonly sessions: ReadonlyArray<SessionUse>;
|
|
236
|
-
}
|
|
237
|
-
| { readonly state: "none" }
|
|
238
|
-
| { readonly state: "unknown"; readonly reason: string };
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Use added up over sessions, each session counted once, as the dashboard shows it: for one machine, the
|
|
242
|
-
* sessions counted on it; for an account, every machine's. A session found on several machines counts on the
|
|
243
|
-
* one where it was last active, and on a tie on the machine that reported it first (`groupAccounts`).
|
|
244
|
-
*/
|
|
245
|
-
export type LocalUseTotal =
|
|
246
|
-
| {
|
|
247
|
-
readonly state: "spend";
|
|
248
|
-
/** When the newest session counted was last active. */
|
|
249
|
-
readonly asOf: number;
|
|
250
|
-
readonly periodDays: number;
|
|
251
|
-
readonly spent: Money;
|
|
252
|
-
readonly sessions: number;
|
|
253
|
-
/** Claude Code could not price a model in at least one session, so the true cost is higher. */
|
|
254
|
-
readonly partial: boolean;
|
|
255
|
-
/** `bedrock` when the account's settings or the model IDs its sessions used say so; null when nothing says. */
|
|
256
|
-
readonly provider: "bedrock" | null;
|
|
257
|
-
}
|
|
258
|
-
| {
|
|
259
|
-
readonly state: "tokens";
|
|
260
|
-
readonly periodDays: number;
|
|
261
|
-
readonly count: number;
|
|
262
|
-
readonly sessions: number;
|
|
263
|
-
/** In a total over machines: one machine's could not be read, so the true count is higher. */
|
|
264
|
-
readonly partial?: true;
|
|
265
|
-
}
|
|
266
|
-
| { readonly state: "none" }
|
|
267
|
-
| { readonly state: "unknown"; readonly reason: string };
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* One Claude, Codex or Grok account on a machine. Never a credential: the CLIs make the authenticated
|
|
271
|
-
* calls, and only these numbers and the account's email leave the machine.
|
|
272
|
-
*/
|
|
273
|
-
export interface AccountUsage {
|
|
274
|
-
readonly tool: "claude" | "codex" | "grok";
|
|
275
|
-
/** The account's folder in the home directory, such as `.claude-work` or `.codex`. */
|
|
276
|
-
readonly home: string;
|
|
277
|
-
/** Null when the tool is signed out, or cannot say who is signed in (Grok). */
|
|
278
|
-
readonly identity: AccountIdentity | null;
|
|
279
|
-
readonly limits: AccountLimits;
|
|
280
|
-
readonly local: LocalUse;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
/** Daemon → hub, over the daemon's WebSocket. */
|
|
284
|
-
export type DaemonMessage =
|
|
285
|
-
| {
|
|
286
|
-
readonly type: "status";
|
|
287
|
-
readonly folder: string;
|
|
288
|
-
readonly state: FolderState;
|
|
289
|
-
readonly detail?: string;
|
|
290
|
-
/** A one-line summary of what the last cycle changed, when it changed anything. */
|
|
291
|
-
readonly activity?: string;
|
|
292
|
-
}
|
|
293
|
-
/** Every account on the machine, sent on connecting and whenever a number changes. The hub drops entries in the shape daemons before 0.5.0 sent. */
|
|
294
|
-
| { readonly type: "usage"; readonly accounts: ReadonlyArray<AccountUsage> }
|
|
295
|
-
/** The machine's skill refinement workflow, sent on connecting and whenever what the dashboard draws changes. */
|
|
296
|
-
| { readonly type: "refinement"; readonly refinement: Refinement };
|
|
297
|
-
|
|
298
|
-
/** Hub → daemon. `prefs` replaces what syncs; `changed` means another write landed on the server; `setLimit` comes from the dashboard. */
|
|
299
|
-
export type HubToDaemon =
|
|
300
|
-
| { readonly type: "prefs"; readonly folders: ReadonlyArray<FolderPrefs> }
|
|
301
|
-
| { readonly type: "changed" }
|
|
302
|
-
| ({ readonly type: "setLimit" } & LimitChange);
|
|
303
|
-
|
|
304
|
-
/** Which of a workflow's two limits a dashboard control sets: how many runs it keeps going, or how many may be on an agent at once. */
|
|
305
|
-
export type LimitName = "runs" | "agents";
|
|
306
|
-
|
|
307
|
-
/** One limit of one workflow on one machine, set from the dashboard: a whole number, or none for the run limit's default. */
|
|
308
|
-
export interface LimitChange {
|
|
309
|
-
readonly workflow: string;
|
|
310
|
-
readonly limit: LimitName;
|
|
311
|
-
readonly value: number | null;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
/**
|
|
315
|
-
* Everything `@jive-sh/workflow-platform`'s `WorkflowsDashboard` draws for one machine: its `WorkflowsPageData` (every
|
|
316
|
-
* workflow with its queue and limits, and its runs now), and each workflow's figures over the last day, which the dashboard
|
|
317
|
-
* reads from the service's figures route when a workflow is opened, all read when the daemon reports. The platform defines
|
|
318
|
-
* each part; only the daemon builds them and only the dashboard reads them, so here they are objects the hub stores as
|
|
319
|
-
* they are. The machine has no CPU limit, so `cpu.use` is none.
|
|
320
|
-
*/
|
|
321
|
-
export interface RefinementPageData {
|
|
322
|
-
readonly view: object;
|
|
323
|
-
readonly runsNow: ReadonlyArray<object>;
|
|
324
|
-
readonly cpu: { readonly limit: number; readonly use: null };
|
|
325
|
-
/** Each workflow's `WorkflowFigures`, by its name. */
|
|
326
|
-
readonly figures: Readonly<Record<string, object>>;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
/** A machine's skill refinement workflow: running, with what the dashboard draws, or why not. */
|
|
330
|
-
export type Refinement =
|
|
331
|
-
| { readonly state: "running"; readonly data: RefinementPageData }
|
|
332
|
-
| { readonly state: "notRunning"; readonly reason: string };
|
|
333
|
-
|
|
334
|
-
/** Hub → dashboard, beside the snapshot: one machine's refinement as it last reported it, which outlives its connection. */
|
|
335
|
-
export interface MachineRefinement {
|
|
336
|
-
readonly type: "refinement";
|
|
337
|
-
readonly machine: string;
|
|
338
|
-
readonly reportedAt: number;
|
|
339
|
-
readonly refinement: Refinement;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
export interface SkillView {
|
|
343
|
-
readonly name: string;
|
|
344
|
-
/** On the list of synced skills, which every enabled folder sends and receives. */
|
|
345
|
-
readonly synced: boolean;
|
|
346
|
-
/** The folder has a copy on disk. */
|
|
347
|
-
readonly local: boolean;
|
|
348
|
-
readonly files: ReadonlyArray<FileHash>;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
export interface FolderView {
|
|
352
|
-
readonly path: string;
|
|
353
|
-
readonly enabled: boolean;
|
|
354
|
-
readonly state: FolderState;
|
|
355
|
-
readonly detail: string | null;
|
|
356
|
-
readonly lastActivityAt: number | null;
|
|
357
|
-
readonly lastActivity: string | null;
|
|
358
|
-
readonly skills: ReadonlyArray<SkillView>;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
export interface MachineView {
|
|
362
|
-
/** The name the machine's daemon uses; it identifies the machine and never changes. */
|
|
363
|
-
readonly machine: string;
|
|
364
|
-
/** What the dashboard calls it: renamed there, or the machine name until then. */
|
|
365
|
-
readonly name: string;
|
|
366
|
-
/** True while this machine's daemon holds a connection to the hub. */
|
|
367
|
-
readonly online: boolean;
|
|
368
|
-
/** The version its connected daemon runs; null while offline, or when the daemon is too old to say. */
|
|
369
|
-
readonly daemonVersion: string | null;
|
|
370
|
-
readonly lastSeen: number | null;
|
|
371
|
-
readonly folders: ReadonlyArray<FolderView>;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
/** A skill on the synced list, as the server holds it: the version every enabled folder converges on. */
|
|
375
|
-
export interface SyncedSkill {
|
|
376
|
-
readonly name: string;
|
|
377
|
-
readonly files: ReadonlyArray<FileHash & { readonly updatedBy: string; readonly editedAt: number }>;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
/** Hub → dashboard: the whole picture, resent on every change. It is small, and a diff protocol is not. */
|
|
381
|
-
export interface Snapshot {
|
|
382
|
-
readonly type: "snapshot";
|
|
383
|
-
/** The deployed service version. A dashboard built by another version reloads itself. */
|
|
384
|
-
readonly version: string;
|
|
385
|
-
/** The `latest` version of this package on npm, which every daemon upgrades to; null if npm could not be reached. */
|
|
386
|
-
readonly publishedVersion: string | null;
|
|
387
|
-
/** Display name for every machine name that appears anywhere in the snapshot, including old log entries. */
|
|
388
|
-
readonly names: Readonly<Record<string, string>>;
|
|
389
|
-
readonly skills: ReadonlyArray<SyncedSkill>;
|
|
390
|
-
readonly machines: ReadonlyArray<MachineView>;
|
|
391
|
-
readonly accounts: ReadonlyArray<AccountView>;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
/** One machine's latest reading of one account folder, as the service keeps it, offline machines included. */
|
|
395
|
-
export interface MachineAccountReading {
|
|
396
|
-
readonly machine: string;
|
|
397
|
-
/** When the machine's daemon last sent this account. */
|
|
398
|
-
readonly reportedAt: number;
|
|
399
|
-
readonly usage: AccountUsage;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
/** One machine's reading as the dashboard shows it: its local use is the sessions counted on this machine. */
|
|
403
|
-
export interface MachineAccountView {
|
|
404
|
-
readonly machine: string;
|
|
405
|
-
readonly reportedAt: number;
|
|
406
|
-
readonly usage: Omit<AccountUsage, "local"> & { readonly local: LocalUseTotal };
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
/**
|
|
410
|
-
* Which account a dashboard row is: its email, else the id its tool gives, else one folder on one machine,
|
|
411
|
-
* for an account its tool cannot name (Grok, Amazon Bedrock, signed out).
|
|
412
|
-
*/
|
|
413
|
-
export type AccountKey =
|
|
414
|
-
| { readonly kind: "email"; readonly email: string }
|
|
415
|
-
| { readonly kind: "id"; readonly id: string }
|
|
416
|
-
| { readonly kind: "unidentified"; readonly machine: string; readonly home: string };
|
|
417
|
-
|
|
418
|
-
/** One account across every machine that has reported it. */
|
|
419
|
-
export interface AccountView {
|
|
420
|
-
readonly tool: AccountUsage["tool"];
|
|
421
|
-
readonly key: AccountKey;
|
|
422
|
-
readonly identity: AccountIdentity | null;
|
|
423
|
-
/** From the freshest reading any machine sent: the provider counts every machine's use against one limit. */
|
|
424
|
-
readonly limits: AccountLimits;
|
|
425
|
-
/** Every machine's sessions added up, each session once; `partial` when a machine's could not be read. */
|
|
426
|
-
readonly localTotal: LocalUseTotal;
|
|
427
|
-
/** Each machine's latest reading, by machine name. */
|
|
428
|
-
readonly machines: ReadonlyArray<MachineAccountView>;
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
/** Dashboard → hub. */
|
|
432
|
-
export type DashboardMessage =
|
|
433
|
-
| { readonly type: "setFolder"; readonly machine: string; readonly path: string; readonly enabled: boolean }
|
|
434
|
-
/** Adds a skill to the synced list, or removes it: one list for every machine and folder. */
|
|
435
|
-
| { readonly type: "setSkill"; readonly skill: string; readonly synced: boolean }
|
|
436
|
-
/** An empty name restores the machine name. */
|
|
437
|
-
| { readonly type: "renameMachine"; readonly machine: string; readonly name: string }
|
|
438
|
-
/** A limit of a machine's workflow, passed to that machine's daemon. */
|
|
439
|
-
| ({ readonly type: "setLimit"; readonly machine: string } & LimitChange);
|