@jive-sh/skill-sync 0.4.7 → 0.4.8-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 -39
- package/README.md +0 -69
- package/bin/package.json +0 -1
- package/bin/skill-sync +0 -576
- package/bin/skill-sync-daemon +0 -576
- package/dist/daemons/skill-sync-daemon.js +0 -432
- package/dist/daemons/skill-sync-daemon.js.map +0 -1
- package/dist/entrypoints/skill-sync.js +0 -140
- 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/config.js +0 -149
- package/dist/internal/config.js.map +0 -1
- package/dist/internal/control.js +0 -101
- package/dist/internal/control.js.map +0 -1
- package/dist/internal/folders.js +0 -46
- package/dist/internal/folders.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 -32
- package/dist/internal/server.js.map +0 -1
- package/dist/internal/sync.js +0 -162
- package/dist/internal/sync.js.map +0 -1
- package/dist/internal/wire.js +0 -18
- package/dist/internal/wire.js.map +0 -1
- package/install.cjs +0 -576
- package/src/daemons/skill-sync-daemon.ts +0 -426
- package/src/entrypoints/skill-sync.ts +0 -143
- package/src/index.ts +0 -15
- package/src/internal/config.ts +0 -191
- package/src/internal/control.ts +0 -127
- package/src/internal/folders.ts +0 -49
- package/src/internal/path.ts +0 -32
- package/src/internal/server.ts +0 -34
- package/src/internal/sync.ts +0 -197
- package/src/internal/wire.ts +0 -164
package/src/internal/wire.ts
DELETED
|
@@ -1,164 +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
|
-
/** `GET /skills`: the synced list, as `skill-sync list` shows it. Deleted skills are not on it. */
|
|
74
|
-
export interface ListSkillsResponse {
|
|
75
|
-
readonly skills: ReadonlyArray<ListedSkill>;
|
|
76
|
-
}
|
|
77
|
-
export interface ListedSkill {
|
|
78
|
-
readonly name: string;
|
|
79
|
-
/** Live files on the server; zero for a skill ticked before any machine has pushed it. */
|
|
80
|
-
readonly files: number;
|
|
81
|
-
/** The latest edit of any of its files, and the display name of the machine it came from; null with no files. */
|
|
82
|
-
readonly editedAt: number | null;
|
|
83
|
-
readonly editedBy: string | null;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* The header a daemon names its own version in when it opens its WebSocket to the hub, so the dashboard
|
|
88
|
-
* can show which version each machine runs. Daemons before 0.4.6 do not send it.
|
|
89
|
-
*/
|
|
90
|
-
export const DAEMON_VERSION_HEADER = "x-skill-sync-version";
|
|
91
|
-
|
|
92
|
-
/** Daemon → hub, over the daemon's WebSocket. */
|
|
93
|
-
export type DaemonMessage = {
|
|
94
|
-
readonly type: "status";
|
|
95
|
-
readonly folder: string;
|
|
96
|
-
readonly state: FolderState;
|
|
97
|
-
readonly detail?: string;
|
|
98
|
-
/** A one-line summary of what the last cycle changed, when it changed anything. */
|
|
99
|
-
readonly activity?: string;
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
/** Hub → daemon. `prefs` replaces what syncs; `changed` means another write landed on the server. */
|
|
103
|
-
export type HubToDaemon =
|
|
104
|
-
| { readonly type: "prefs"; readonly folders: ReadonlyArray<FolderPrefs> }
|
|
105
|
-
| { readonly type: "changed" };
|
|
106
|
-
|
|
107
|
-
export interface SkillView {
|
|
108
|
-
readonly name: string;
|
|
109
|
-
/** On the list of synced skills, which every enabled folder sends and receives. */
|
|
110
|
-
readonly synced: boolean;
|
|
111
|
-
/** The folder has a copy on disk. */
|
|
112
|
-
readonly local: boolean;
|
|
113
|
-
readonly files: ReadonlyArray<FileHash>;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export interface FolderView {
|
|
117
|
-
readonly path: string;
|
|
118
|
-
readonly enabled: boolean;
|
|
119
|
-
readonly state: FolderState;
|
|
120
|
-
readonly detail: string | null;
|
|
121
|
-
readonly lastActivityAt: number | null;
|
|
122
|
-
readonly lastActivity: string | null;
|
|
123
|
-
readonly skills: ReadonlyArray<SkillView>;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export interface MachineView {
|
|
127
|
-
/** The name the machine's daemon uses; it identifies the machine and never changes. */
|
|
128
|
-
readonly machine: string;
|
|
129
|
-
/** What the dashboard calls it: renamed there, or the machine name until then. */
|
|
130
|
-
readonly name: string;
|
|
131
|
-
/** True while this machine's daemon holds a connection to the hub. */
|
|
132
|
-
readonly online: boolean;
|
|
133
|
-
/** The version its connected daemon runs; null while offline, or when the daemon is too old to say. */
|
|
134
|
-
readonly daemonVersion: string | null;
|
|
135
|
-
readonly lastSeen: number | null;
|
|
136
|
-
readonly folders: ReadonlyArray<FolderView>;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/** A skill on the synced list, as the server holds it: the version every enabled folder converges on. */
|
|
140
|
-
export interface SyncedSkill {
|
|
141
|
-
readonly name: string;
|
|
142
|
-
readonly files: ReadonlyArray<FileHash & { readonly updatedBy: string; readonly editedAt: number }>;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/** Hub → dashboard: the whole picture, resent on every change. It is small, and a diff protocol is not. */
|
|
146
|
-
export interface Snapshot {
|
|
147
|
-
readonly type: "snapshot";
|
|
148
|
-
/** The deployed service version. A dashboard built by another version reloads itself. */
|
|
149
|
-
readonly version: string;
|
|
150
|
-
/** The `latest` version of this package on npm, which every daemon upgrades to; null if npm could not be reached. */
|
|
151
|
-
readonly publishedVersion: string | null;
|
|
152
|
-
/** Display name for every machine name that appears anywhere in the snapshot, including old log entries. */
|
|
153
|
-
readonly names: Readonly<Record<string, string>>;
|
|
154
|
-
readonly skills: ReadonlyArray<SyncedSkill>;
|
|
155
|
-
readonly machines: ReadonlyArray<MachineView>;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/** Dashboard → hub. */
|
|
159
|
-
export type DashboardMessage =
|
|
160
|
-
| { readonly type: "setFolder"; readonly machine: string; readonly path: string; readonly enabled: boolean }
|
|
161
|
-
/** Adds a skill to the synced list, or removes it: one list for every machine and folder. */
|
|
162
|
-
| { readonly type: "setSkill"; readonly skill: string; readonly synced: boolean }
|
|
163
|
-
/** An empty name restores the machine name. */
|
|
164
|
-
| { readonly type: "renameMachine"; readonly machine: string; readonly name: string };
|