@jive-sh/skill-sync 0.6.1 → 0.6.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.
Files changed (70) hide show
  1. package/multi-call-binary +4 -0
  2. package/package.json +11 -36
  3. package/README.md +0 -146
  4. package/bin/package.json +0 -1
  5. package/bin/skill-sync +0 -614
  6. package/bin/skill-sync-daemon +0 -614
  7. package/dist/daemons/skill-sync-daemon.js +0 -499
  8. package/dist/daemons/skill-sync-daemon.js.map +0 -1
  9. package/dist/entrypoints/skill-sync.js +0 -7
  10. package/dist/entrypoints/skill-sync.js.map +0 -1
  11. package/dist/index.js +0 -10
  12. package/dist/index.js.map +0 -1
  13. package/dist/internal/agents/agent-tool.js +0 -92
  14. package/dist/internal/agents/agent-tool.js.map +0 -1
  15. package/dist/internal/agents/claude.js +0 -422
  16. package/dist/internal/agents/claude.js.map +0 -1
  17. package/dist/internal/agents/codex.js +0 -266
  18. package/dist/internal/agents/codex.js.map +0 -1
  19. package/dist/internal/agents/command.js +0 -158
  20. package/dist/internal/agents/command.js.map +0 -1
  21. package/dist/internal/agents/grok.js +0 -172
  22. package/dist/internal/agents/grok.js.map +0 -1
  23. package/dist/internal/agents/index.js +0 -70
  24. package/dist/internal/agents/index.js.map +0 -1
  25. package/dist/internal/cli.js +0 -161
  26. package/dist/internal/cli.js.map +0 -1
  27. package/dist/internal/config.js +0 -131
  28. package/dist/internal/config.js.map +0 -1
  29. package/dist/internal/control.js +0 -113
  30. package/dist/internal/control.js.map +0 -1
  31. package/dist/internal/daemon-control/impl.js +0 -62
  32. package/dist/internal/daemon-control/impl.js.map +0 -1
  33. package/dist/internal/daemon-control/interface.js +0 -4
  34. package/dist/internal/daemon-control/interface.js.map +0 -1
  35. package/dist/internal/folders.js +0 -47
  36. package/dist/internal/folders.js.map +0 -1
  37. package/dist/internal/local-skills.js +0 -43
  38. package/dist/internal/local-skills.js.map +0 -1
  39. package/dist/internal/path.js +0 -36
  40. package/dist/internal/path.js.map +0 -1
  41. package/dist/internal/server.js +0 -32
  42. package/dist/internal/server.js.map +0 -1
  43. package/dist/internal/skill-check.js +0 -83
  44. package/dist/internal/skill-check.js.map +0 -1
  45. package/dist/internal/sync.js +0 -183
  46. package/dist/internal/sync.js.map +0 -1
  47. package/dist/internal/wire.js +0 -24
  48. package/dist/internal/wire.js.map +0 -1
  49. package/install.cjs +0 -614
  50. package/src/daemons/skill-sync-daemon.ts +0 -491
  51. package/src/entrypoints/skill-sync.ts +0 -12
  52. package/src/index.ts +0 -15
  53. package/src/internal/agents/agent-tool.ts +0 -136
  54. package/src/internal/agents/claude.ts +0 -440
  55. package/src/internal/agents/codex.ts +0 -283
  56. package/src/internal/agents/command.ts +0 -196
  57. package/src/internal/agents/grok.ts +0 -176
  58. package/src/internal/agents/index.ts +0 -74
  59. package/src/internal/cli.ts +0 -194
  60. package/src/internal/config.ts +0 -172
  61. package/src/internal/control.ts +0 -153
  62. package/src/internal/daemon-control/impl.ts +0 -74
  63. package/src/internal/daemon-control/interface.ts +0 -38
  64. package/src/internal/folders.ts +0 -50
  65. package/src/internal/local-skills.ts +0 -58
  66. package/src/internal/path.ts +0 -32
  67. package/src/internal/server.ts +0 -34
  68. package/src/internal/skill-check.ts +0 -97
  69. package/src/internal/sync.ts +0 -217
  70. package/src/internal/wire.ts +0 -315
@@ -1,315 +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
- /** Taken only when `editedAt` is later than the edit the server holds; refused with 409 otherwise. */
24
- export interface PutFileRequest {
25
- readonly path: string;
26
- /** When the file was edited: its modification time, or for a deletion, when it was noticed. */
27
- readonly editedAt: number;
28
- /** Null to delete. */
29
- readonly hash: string | null;
30
- /** Base64, absent for a delete. */
31
- readonly content: string | null;
32
- readonly machine: string;
33
- }
34
-
35
- /** Where a folder's sync stands, as the dashboard shows it. `attention` means a cycle failed; `detail` says why. */
36
- export type FolderState = "idle" | "attention";
37
-
38
- /**
39
- * A skill is a top-level entry of a skills folder — usually a directory like `jive/` holding `SKILL.md`
40
- * and its files — and it is the unit of opting in: all of its files sync, or none do, so a skill never
41
- * arrives half-present on another machine.
42
- */
43
- export const skillOf = (path: string): string => path.split("/")[0]!;
44
-
45
- /** A file and the SHA-256 of its content — the same hash the server stores, so copies can be compared. */
46
- export interface FileHash {
47
- readonly path: string;
48
- readonly hash: string;
49
- }
50
-
51
- /** One skill as a folder holds it. */
52
- export interface LocalSkill {
53
- readonly name: string;
54
- readonly files: ReadonlyArray<FileHash>;
55
- }
56
-
57
- /**
58
- * `POST /folders`: every folder this machine found, with the skills in each, for the dashboard. Answered
59
- * with the enabled folders, each with the synced list: the daemon pushes and pulls exactly those skills,
60
- * and never touches any other.
61
- */
62
- export interface FoldersRequest {
63
- readonly folders: ReadonlyArray<{ readonly path: string; readonly skills: ReadonlyArray<LocalSkill> }>;
64
- }
65
- export interface FolderPrefs {
66
- readonly path: string;
67
- readonly skills: ReadonlyArray<string>;
68
- }
69
- export interface FoldersResponse {
70
- readonly folders: ReadonlyArray<FolderPrefs>;
71
- }
72
-
73
- /**
74
- * Whether a name can be a skill's: lowercase letters and digits in hyphen-joined words, at most 64
75
- * characters, which is what Claude, Codex and Grok accept as a skill name. The daemon checks it before
76
- * asking, and the service again before writing, so both judge a name by this one rule.
77
- */
78
- export const isSkillName = (name: string): boolean => name.length <= 64 && /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(name);
79
-
80
- /** `PUT /skills/<name>`: puts a skill on the synced list. `added` is false when it was already on it. */
81
- export interface AddSkillResponse {
82
- readonly added: boolean;
83
- }
84
-
85
- /** `GET /skills`: the synced list, as `skill-sync list` shows it. Deleted skills are not on it. */
86
- export interface ListSkillsResponse {
87
- readonly skills: ReadonlyArray<ListedSkill>;
88
- }
89
- export interface ListedSkill {
90
- readonly name: string;
91
- /** Live files on the server; zero for a skill ticked before any machine has pushed it. */
92
- readonly files: number;
93
- /** The latest edit of any of its files, and the display name of the machine it came from; null with no files. */
94
- readonly editedAt: number | null;
95
- readonly editedBy: string | null;
96
- }
97
-
98
- /**
99
- * The header a daemon names its own version in when it opens its WebSocket to the hub, so the dashboard
100
- * can show which version each machine runs. Daemons before 0.4.6 do not send it.
101
- */
102
- export const DAEMON_VERSION_HEADER = "x-skill-sync-version";
103
-
104
- /** One usage limit of an account: how much of it is used and when it starts over. */
105
- export interface UsageWindow {
106
- /**
107
- * The limit's name, the same for every tool and machine so the dashboard gives each one a column:
108
- * `5-hour`, `weekly`, or a limit on one model, such as `weekly Fable`.
109
- */
110
- readonly name: string;
111
- /** How long the window is, in minutes (300 for five hours, 10080 for a week); null when the tool does not say. */
112
- readonly minutes: number | null;
113
- /** Percent of the limit used, from 0 to 100. */
114
- readonly usedPercent: number;
115
- /** When the window starts over, in milliseconds since the epoch; null when no window is running. */
116
- readonly resetsAt: number | null;
117
- }
118
-
119
- /** Money as the tool records it: an amount in the currency's smallest unit, so 1234 with exponent 2 is 12.34. */
120
- export interface Money {
121
- readonly amountMinor: number;
122
- readonly currency: string;
123
- readonly exponent: number;
124
- }
125
-
126
- /**
127
- * Which account a tool is signed in to, as its own CLI reports it (`claude auth status`, Codex's
128
- * `account/read`). The same account signed in on several machines has the same `id`, so the dashboard
129
- * shows it once.
130
- */
131
- export interface AccountIdentity {
132
- /** Claude's organization id; Codex's email. */
133
- readonly id: string;
134
- /** The email the account is signed in with. */
135
- readonly email: string;
136
- /** The plan as the tool names it (`max`, `pro`); null when it does not say. */
137
- readonly plan: string | null;
138
- }
139
-
140
- /**
141
- * The account's plan limits, which its provider counts across every machine it is used on.
142
- *
143
- * `reading`: `asOf` is when they were read. `source` says from where: `account` when the tool's CLI fetched
144
- * them from its service for this reading (`claude /usage`, Codex's `account/rateLimits/read`), `saved`
145
- * when the CLI could not be run and they come from the tool's own record of its last fetch, which is as
146
- * old as the tool's last use of the account. `none`: the account has no plan limits, or the tool offers
147
- * no way to read them; `reason` says which. `unknown`: reading them failed; `reason` says why.
148
- */
149
- export type AccountLimits =
150
- | {
151
- readonly state: "reading";
152
- readonly asOf: number;
153
- readonly source: "account" | "saved";
154
- /** With `saved`: why the CLI was not asked, or failed. */
155
- readonly cliFailure?: string;
156
- readonly windows: ReadonlyArray<UsageWindow>;
157
- /** Spent beyond the plan, when the account pays for usage past its limits; absent when it does not. */
158
- readonly spent?: { readonly used: Money; readonly limit: Money | null };
159
- }
160
- | { readonly state: "none"; readonly reason: string }
161
- | { readonly state: "unknown"; readonly reason: string };
162
-
163
- /**
164
- * What this machine's sessions of the account used over the last `periodDays` days, read from the files
165
- * the tool writes on this machine. Other machines' use of the same account is not in it.
166
- *
167
- * `spend`: the sum of the tool's own cost figure for each session: Claude Code's estimate at list price,
168
- * which it saves when a session ends, is cleared, resumed or forked, so a running session counts as of
169
- * its last save; Grok's, from `grok usage`. `tokens`: the tokens Codex counted, cached input included.
170
- */
171
- export type LocalUse =
172
- | {
173
- readonly state: "spend";
174
- /** When the newest session counted was last active. */
175
- readonly asOf: number;
176
- readonly periodDays: number;
177
- readonly spent: Money;
178
- readonly sessions: number;
179
- /** Claude Code could not price a model in at least one session, so the true cost is higher. */
180
- readonly partial: boolean;
181
- /** `bedrock` when the account's settings or the model IDs its sessions used say so; null when nothing says. */
182
- readonly provider: "bedrock" | null;
183
- }
184
- | {
185
- readonly state: "tokens";
186
- readonly periodDays: number;
187
- readonly count: number;
188
- readonly sessions: number;
189
- /** In a total over machines: one machine's could not be read, so the true count is higher. */
190
- readonly partial?: true;
191
- }
192
- | { readonly state: "none" }
193
- | { readonly state: "unknown"; readonly reason: string };
194
-
195
- /**
196
- * One Claude, Codex or Grok account on a machine. Never a credential: the CLIs make the authenticated
197
- * calls, and only these numbers and the account's email leave the machine.
198
- */
199
- export interface AccountUsage {
200
- readonly tool: "claude" | "codex" | "grok";
201
- /** The account's folder in the home directory, such as `.claude-work` or `.codex`. */
202
- readonly home: string;
203
- /** Null when the tool is signed out, or cannot say who is signed in (Grok). */
204
- readonly identity: AccountIdentity | null;
205
- readonly limits: AccountLimits;
206
- readonly local: LocalUse;
207
- }
208
-
209
- /** Daemon → hub, over the daemon's WebSocket. */
210
- export type DaemonMessage =
211
- | {
212
- readonly type: "status";
213
- readonly folder: string;
214
- readonly state: FolderState;
215
- readonly detail?: string;
216
- /** A one-line summary of what the last cycle changed, when it changed anything. */
217
- readonly activity?: string;
218
- }
219
- /** 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. */
220
- | { readonly type: "usage"; readonly accounts: ReadonlyArray<AccountUsage> };
221
-
222
- /** Hub → daemon. `prefs` replaces what syncs; `changed` means another write landed on the server. */
223
- export type HubToDaemon =
224
- | { readonly type: "prefs"; readonly folders: ReadonlyArray<FolderPrefs> }
225
- | { readonly type: "changed" };
226
-
227
- export interface SkillView {
228
- readonly name: string;
229
- /** On the list of synced skills, which every enabled folder sends and receives. */
230
- readonly synced: boolean;
231
- /** The folder has a copy on disk. */
232
- readonly local: boolean;
233
- readonly files: ReadonlyArray<FileHash>;
234
- }
235
-
236
- export interface FolderView {
237
- readonly path: string;
238
- readonly enabled: boolean;
239
- readonly state: FolderState;
240
- readonly detail: string | null;
241
- readonly lastActivityAt: number | null;
242
- readonly lastActivity: string | null;
243
- readonly skills: ReadonlyArray<SkillView>;
244
- }
245
-
246
- export interface MachineView {
247
- /** The name the machine's daemon uses; it identifies the machine and never changes. */
248
- readonly machine: string;
249
- /** What the dashboard calls it: renamed there, or the machine name until then. */
250
- readonly name: string;
251
- /** True while this machine's daemon holds a connection to the hub. */
252
- readonly online: boolean;
253
- /** The version its connected daemon runs; null while offline, or when the daemon is too old to say. */
254
- readonly daemonVersion: string | null;
255
- readonly lastSeen: number | null;
256
- readonly folders: ReadonlyArray<FolderView>;
257
- }
258
-
259
- /** A skill on the synced list, as the server holds it: the version every enabled folder converges on. */
260
- export interface SyncedSkill {
261
- readonly name: string;
262
- readonly files: ReadonlyArray<FileHash & { readonly updatedBy: string; readonly editedAt: number }>;
263
- }
264
-
265
- /** Hub → dashboard: the whole picture, resent on every change. It is small, and a diff protocol is not. */
266
- export interface Snapshot {
267
- readonly type: "snapshot";
268
- /** The deployed service version. A dashboard built by another version reloads itself. */
269
- readonly version: string;
270
- /** The `latest` version of this package on npm, which every daemon upgrades to; null if npm could not be reached. */
271
- readonly publishedVersion: string | null;
272
- /** Display name for every machine name that appears anywhere in the snapshot, including old log entries. */
273
- readonly names: Readonly<Record<string, string>>;
274
- readonly skills: ReadonlyArray<SyncedSkill>;
275
- readonly machines: ReadonlyArray<MachineView>;
276
- readonly accounts: ReadonlyArray<AccountView>;
277
- }
278
-
279
- /** One machine's latest reading of one account folder, as the service keeps it, offline machines included. */
280
- export interface MachineAccountReading {
281
- readonly machine: string;
282
- /** When the machine's daemon last sent this account. */
283
- readonly reportedAt: number;
284
- readonly usage: AccountUsage;
285
- }
286
-
287
- /**
288
- * Which account a dashboard row is: its email, else the id its tool gives, else one folder on one machine,
289
- * for an account its tool cannot name (Grok, Amazon Bedrock, signed out).
290
- */
291
- export type AccountKey =
292
- | { readonly kind: "email"; readonly email: string }
293
- | { readonly kind: "id"; readonly id: string }
294
- | { readonly kind: "unidentified"; readonly machine: string; readonly home: string };
295
-
296
- /** One account across every machine that has reported it. */
297
- export interface AccountView {
298
- readonly tool: AccountUsage["tool"];
299
- readonly key: AccountKey;
300
- readonly identity: AccountIdentity | null;
301
- /** From the freshest reading any machine sent: the provider counts every machine's use against one limit. */
302
- readonly limits: AccountLimits;
303
- /** Every machine's local use added up; `partial` when a machine's could not be read. */
304
- readonly localTotal: LocalUse;
305
- /** Each machine's latest reading, by machine name. */
306
- readonly machines: ReadonlyArray<MachineAccountReading>;
307
- }
308
-
309
- /** Dashboard → hub. */
310
- export type DashboardMessage =
311
- | { readonly type: "setFolder"; readonly machine: string; readonly path: string; readonly enabled: boolean }
312
- /** Adds a skill to the synced list, or removes it: one list for every machine and folder. */
313
- | { readonly type: "setSkill"; readonly skill: string; readonly synced: boolean }
314
- /** An empty name restores the machine name. */
315
- | { readonly type: "renameMachine"; readonly machine: string; readonly name: string };