clinkx 1.4.0 → 1.4.2

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 (64) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/clinkx-workflows/dist/dashboard-ui/assets/{index-DSOtuS0p.js → index-CX4FrhYN.js} +1 -1
  3. package/clinkx-workflows/dist/dashboard-ui/index.html +1 -1
  4. package/clinkx-workflows/dist/settings/registry.js +5 -0
  5. package/clinkx-workflows/dist/settings/registry.js.map +1 -1
  6. package/dist/dashboard-cli.d.ts +11 -3
  7. package/dist/dashboard-cli.js +149 -32
  8. package/dist/dashboard-cli.js.map +1 -1
  9. package/dist/dashboard-companion/client.d.ts +14 -0
  10. package/dist/dashboard-companion/client.js +16 -0
  11. package/dist/dashboard-companion/client.js.map +1 -1
  12. package/dist/dashboard-companion/credential-expectation.d.ts +23 -0
  13. package/dist/dashboard-companion/credential-expectation.js +50 -0
  14. package/dist/dashboard-companion/credential-expectation.js.map +1 -0
  15. package/dist/dashboard-companion/host-channel.d.ts +36 -0
  16. package/dist/dashboard-companion/host-channel.js +78 -0
  17. package/dist/dashboard-companion/host-channel.js.map +1 -0
  18. package/dist/dashboard-companion/host-status.d.ts +179 -0
  19. package/dist/dashboard-companion/host-status.js +122 -0
  20. package/dist/dashboard-companion/host-status.js.map +1 -0
  21. package/dist/dashboard-companion/standalone-assets.d.ts +8 -0
  22. package/dist/dashboard-companion/standalone-assets.js +7 -1
  23. package/dist/dashboard-companion/standalone-assets.js.map +1 -1
  24. package/dist/dashboard-companion/standalone-entry.js +34 -13
  25. package/dist/dashboard-companion/standalone-entry.js.map +1 -1
  26. package/dist/desktop-host/child-env.d.ts +23 -0
  27. package/dist/desktop-host/child-env.js +70 -0
  28. package/dist/desktop-host/child-env.js.map +1 -0
  29. package/dist/desktop-host/daemon-entry.d.ts +2 -0
  30. package/dist/desktop-host/daemon-entry.js +50 -0
  31. package/dist/desktop-host/daemon-entry.js.map +1 -0
  32. package/dist/desktop-host/daemon-env.d.ts +12 -0
  33. package/dist/desktop-host/daemon-env.js +35 -0
  34. package/dist/desktop-host/daemon-env.js.map +1 -0
  35. package/dist/desktop-host/daemon-protocol.d.ts +210 -0
  36. package/dist/desktop-host/daemon-protocol.js +56 -0
  37. package/dist/desktop-host/daemon-protocol.js.map +1 -0
  38. package/dist/desktop-host/daemon.d.ts +50 -0
  39. package/dist/desktop-host/daemon.js +441 -0
  40. package/dist/desktop-host/daemon.js.map +1 -0
  41. package/dist/desktop-host/enrollment.d.ts +17 -0
  42. package/dist/desktop-host/enrollment.js +25 -0
  43. package/dist/desktop-host/enrollment.js.map +1 -0
  44. package/dist/desktop-host/import.d.ts +14 -0
  45. package/dist/desktop-host/import.js +95 -0
  46. package/dist/desktop-host/import.js.map +1 -0
  47. package/dist/desktop-host/profile.d.ts +130 -0
  48. package/dist/desktop-host/profile.js +176 -0
  49. package/dist/desktop-host/profile.js.map +1 -0
  50. package/dist/desktop-host/service.d.ts +6 -0
  51. package/dist/desktop-host/service.js +7 -0
  52. package/dist/desktop-host/service.js.map +1 -0
  53. package/dist/desktop-host/supervisor.d.ts +57 -0
  54. package/dist/desktop-host/supervisor.js +256 -0
  55. package/dist/desktop-host/supervisor.js.map +1 -0
  56. package/dist/desktop-host/view-state.d.ts +138 -0
  57. package/dist/desktop-host/view-state.js +27 -0
  58. package/dist/desktop-host/view-state.js.map +1 -0
  59. package/dist/registry.d.ts +7 -0
  60. package/dist/registry.js +21 -7
  61. package/dist/registry.js.map +1 -1
  62. package/docs/verification/README.md +28 -2
  63. package/docs/verification/workflow-handoff.md +86 -0
  64. package/package.json +2 -2
@@ -0,0 +1,210 @@
1
+ import { z } from "zod";
2
+ import { type DaemonOp } from "./view-state.js";
3
+ export declare const DaemonRequestSchema: z.ZodDiscriminatedUnion<"op", [z.ZodObject<{
4
+ id: z.ZodString;
5
+ op: z.ZodLiteral<"get-state">;
6
+ }, "strip", z.ZodTypeAny, {
7
+ op: "get-state";
8
+ id: string;
9
+ }, {
10
+ op: "get-state";
11
+ id: string;
12
+ }>, z.ZodObject<{
13
+ id: z.ZodString;
14
+ op: z.ZodLiteral<"save-setup">;
15
+ input: z.ZodObject<{
16
+ workstationKey: z.ZodOptional<z.ZodString>;
17
+ roots: z.ZodObject<{
18
+ state: z.ZodString;
19
+ contextRuns: z.ZodString;
20
+ workspace: z.ZodString;
21
+ settings: z.ZodString;
22
+ }, "strict", z.ZodTypeAny, {
23
+ state: string;
24
+ settings: string;
25
+ contextRuns: string;
26
+ workspace: string;
27
+ }, {
28
+ state: string;
29
+ settings: string;
30
+ contextRuns: string;
31
+ workspace: string;
32
+ }>;
33
+ lifecycle: z.ZodObject<{
34
+ keepRunningInBackground: z.ZodBoolean;
35
+ startAtLogin: z.ZodBoolean;
36
+ }, "strict", z.ZodTypeAny, {
37
+ keepRunningInBackground: boolean;
38
+ startAtLogin: boolean;
39
+ }, {
40
+ keepRunningInBackground: boolean;
41
+ startAtLogin: boolean;
42
+ }>;
43
+ service: z.ZodOptional<z.ZodObject<{
44
+ origin: z.ZodString;
45
+ gatewayUrl: z.ZodString;
46
+ mode: z.ZodEnum<["tenant", "legacy"]>;
47
+ }, "strict", z.ZodTypeAny, {
48
+ mode: "legacy" | "tenant";
49
+ origin: string;
50
+ gatewayUrl: string;
51
+ }, {
52
+ mode: "legacy" | "tenant";
53
+ origin: string;
54
+ gatewayUrl: string;
55
+ }>>;
56
+ createMissingFolders: z.ZodBoolean;
57
+ importFrom: z.ZodOptional<z.ZodString>;
58
+ }, "strict", z.ZodTypeAny, {
59
+ roots: {
60
+ state: string;
61
+ settings: string;
62
+ contextRuns: string;
63
+ workspace: string;
64
+ };
65
+ lifecycle: {
66
+ keepRunningInBackground: boolean;
67
+ startAtLogin: boolean;
68
+ };
69
+ createMissingFolders: boolean;
70
+ service?: {
71
+ mode: "legacy" | "tenant";
72
+ origin: string;
73
+ gatewayUrl: string;
74
+ } | undefined;
75
+ workstationKey?: string | undefined;
76
+ importFrom?: string | undefined;
77
+ }, {
78
+ roots: {
79
+ state: string;
80
+ settings: string;
81
+ contextRuns: string;
82
+ workspace: string;
83
+ };
84
+ lifecycle: {
85
+ keepRunningInBackground: boolean;
86
+ startAtLogin: boolean;
87
+ };
88
+ createMissingFolders: boolean;
89
+ service?: {
90
+ mode: "legacy" | "tenant";
91
+ origin: string;
92
+ gatewayUrl: string;
93
+ } | undefined;
94
+ workstationKey?: string | undefined;
95
+ importFrom?: string | undefined;
96
+ }>;
97
+ }, "strip", z.ZodTypeAny, {
98
+ op: "save-setup";
99
+ id: string;
100
+ input: {
101
+ roots: {
102
+ state: string;
103
+ settings: string;
104
+ contextRuns: string;
105
+ workspace: string;
106
+ };
107
+ lifecycle: {
108
+ keepRunningInBackground: boolean;
109
+ startAtLogin: boolean;
110
+ };
111
+ createMissingFolders: boolean;
112
+ service?: {
113
+ mode: "legacy" | "tenant";
114
+ origin: string;
115
+ gatewayUrl: string;
116
+ } | undefined;
117
+ workstationKey?: string | undefined;
118
+ importFrom?: string | undefined;
119
+ };
120
+ }, {
121
+ op: "save-setup";
122
+ id: string;
123
+ input: {
124
+ roots: {
125
+ state: string;
126
+ settings: string;
127
+ contextRuns: string;
128
+ workspace: string;
129
+ };
130
+ lifecycle: {
131
+ keepRunningInBackground: boolean;
132
+ startAtLogin: boolean;
133
+ };
134
+ createMissingFolders: boolean;
135
+ service?: {
136
+ mode: "legacy" | "tenant";
137
+ origin: string;
138
+ gatewayUrl: string;
139
+ } | undefined;
140
+ workstationKey?: string | undefined;
141
+ importFrom?: string | undefined;
142
+ };
143
+ }>, z.ZodObject<{
144
+ id: z.ZodString;
145
+ op: z.ZodLiteral<"connect">;
146
+ }, "strip", z.ZodTypeAny, {
147
+ op: "connect";
148
+ id: string;
149
+ }, {
150
+ op: "connect";
151
+ id: string;
152
+ }>, z.ZodObject<{
153
+ id: z.ZodString;
154
+ op: z.ZodLiteral<"disconnect">;
155
+ }, "strip", z.ZodTypeAny, {
156
+ op: "disconnect";
157
+ id: string;
158
+ }, {
159
+ op: "disconnect";
160
+ id: string;
161
+ }>, z.ZodObject<{
162
+ id: z.ZodString;
163
+ op: z.ZodLiteral<"recover">;
164
+ action: z.ZodEnum<["new-enrollment", "reset-binding"]>;
165
+ }, "strip", z.ZodTypeAny, {
166
+ op: "recover";
167
+ id: string;
168
+ action: "new-enrollment" | "reset-binding";
169
+ }, {
170
+ op: "recover";
171
+ id: string;
172
+ action: "new-enrollment" | "reset-binding";
173
+ }>, z.ZodObject<{
174
+ id: z.ZodString;
175
+ op: z.ZodLiteral<"diagnostics">;
176
+ }, "strip", z.ZodTypeAny, {
177
+ op: "diagnostics";
178
+ id: string;
179
+ }, {
180
+ op: "diagnostics";
181
+ id: string;
182
+ }>, z.ZodObject<{
183
+ id: z.ZodString;
184
+ op: z.ZodLiteral<"shutdown">;
185
+ }, "strip", z.ZodTypeAny, {
186
+ op: "shutdown";
187
+ id: string;
188
+ }, {
189
+ op: "shutdown";
190
+ id: string;
191
+ }>, z.ZodObject<{
192
+ op: z.ZodLiteral<"key-stored">;
193
+ ok: z.ZodBoolean;
194
+ error: z.ZodOptional<z.ZodString>;
195
+ }, "strip", z.ZodTypeAny, {
196
+ op: "key-stored";
197
+ ok: boolean;
198
+ error?: string | undefined;
199
+ }, {
200
+ op: "key-stored";
201
+ ok: boolean;
202
+ error?: string | undefined;
203
+ }>]>;
204
+ export type DaemonRequest = z.infer<typeof DaemonRequestSchema>;
205
+ export type DaemonRequestWithId = Extract<DaemonRequest, {
206
+ id: string;
207
+ }>;
208
+ export declare function formatDaemonRequest(request: DaemonRequest): string;
209
+ export declare function parseDaemonRequestLine(line: string): DaemonRequest;
210
+ export declare function isDaemonOp(value: string): value is DaemonOp;
@@ -0,0 +1,56 @@
1
+ import { z } from "zod";
2
+ import { DAEMON_OPS, SetupInputSchema } from "./view-state.js";
3
+ import { HostStatusProtocolError, MAX_HOST_STATUS_LINE_BYTES } from "../dashboard-companion/host-status.js";
4
+ /**
5
+ * Requests a supervising shell sends to the host daemon over its stdin: one
6
+ * JSON object per line, answered on stdout by a `response` event (same id)
7
+ * plus `state` pushes whenever anything changes. The daemon and its shell
8
+ * ship as a pair; unknown ops fail with a machine-readable error instead of
9
+ * being ignored.
10
+ */
11
+ const op = z.enum(DAEMON_OPS);
12
+ export const DaemonRequestSchema = z.discriminatedUnion("op", [
13
+ z.object({ id: z.string().regex(/^[A-Za-z0-9_-]{1,64}$/), op: z.literal("get-state") }),
14
+ z.object({ id: z.string().regex(/^[A-Za-z0-9_-]{1,64}$/), op: z.literal("save-setup"), input: SetupInputSchema }),
15
+ z.object({ id: z.string().regex(/^[A-Za-z0-9_-]{1,64}$/), op: z.literal("connect") }),
16
+ z.object({ id: z.string().regex(/^[A-Za-z0-9_-]{1,64}$/), op: z.literal("disconnect") }),
17
+ z.object({
18
+ id: z.string().regex(/^[A-Za-z0-9_-]{1,64}$/),
19
+ op: z.literal("recover"),
20
+ action: z.enum(["new-enrollment", "reset-binding"]),
21
+ }),
22
+ z.object({ id: z.string().regex(/^[A-Za-z0-9_-]{1,64}$/), op: z.literal("diagnostics") }),
23
+ z.object({ id: z.string().regex(/^[A-Za-z0-9_-]{1,64}$/), op: z.literal("shutdown") }),
24
+ z.object({ op: z.literal("key-stored"), ok: z.boolean(), error: z.string().max(1_000).optional() }),
25
+ ]);
26
+ export function formatDaemonRequest(request) {
27
+ const line = `${JSON.stringify(DaemonRequestSchema.parse(request))}\n`;
28
+ if (Buffer.byteLength(line) > MAX_HOST_STATUS_LINE_BYTES) {
29
+ throw new HostStatusProtocolError("daemon request exceeds the size limit");
30
+ }
31
+ return line;
32
+ }
33
+ export function parseDaemonRequestLine(line) {
34
+ if (Buffer.byteLength(line) > MAX_HOST_STATUS_LINE_BYTES) {
35
+ throw new HostStatusProtocolError("daemon request line exceeds the size limit");
36
+ }
37
+ let value;
38
+ try {
39
+ value = JSON.parse(line);
40
+ }
41
+ catch {
42
+ throw new HostStatusProtocolError("daemon request line is not JSON");
43
+ }
44
+ const parsed = DaemonRequestSchema.safeParse(value);
45
+ if (!parsed.success) {
46
+ const attempted = typeof value?.op === "string"
47
+ ? value.op
48
+ : "unknown";
49
+ throw new HostStatusProtocolError(`invalid daemon request (${attempted})`);
50
+ }
51
+ return parsed.data;
52
+ }
53
+ export function isDaemonOp(value) {
54
+ return DAEMON_OPS.includes(value);
55
+ }
56
+ //# sourceMappingURL=daemon-protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daemon-protocol.js","sourceRoot":"","sources":["../../src/desktop-host/daemon-protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAiB,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAE5G;;;;;;GAMG;AACH,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AAE9B,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,kBAAkB,CAAC,IAAI,EAAE;IAC5D,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,uBAAuB,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;IACvF,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,uBAAuB,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC;IACjH,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,uBAAuB,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,C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0BAA0B,EAAE,CAAC;QACzD,MAAM,IAAI,uBAAuB,CAAC,uCAAuC,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,IAAY;IACjD,IAAI,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,0BAA0B,EAAE,CAAC;QACzD,MAAM,IAAI,uBAAuB,CAAC,4CAA4C,CAAC,CAAC;IAClF,CAAC;IACD,IAAI,KAAc,CAAC;IACnB,IAAI,CAAC;QACH,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,uBAAuB,CAAC,iCAAiC,CAAC,CAAC;IACvE,CAAC;IACD,MAAM,MAAM,GAAG,mBAAmB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACpD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,SAAS,GAAG,OAAQ,KAA0B,EAAE,EAAE,KAAK,QAAQ;YACnE,CAAC,CAAE,KAAwB,CAAC,EAAE;YAC9B,CAAC,CAAC,SAAS,CAAC;QACd,MAAM,IAAI,uBAAuB,CAAC,2BAA2B,SAAS,GAAG,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,OAAQ,UAAgC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC3D,CAAC"}
@@ -0,0 +1,50 @@
1
+ import { type DesktopService } from "./profile.js";
2
+ import { type DesktopViewState, type RecoveryAction } from "./view-state.js";
3
+ /** Where the shell puts the keychain-held key and the app-data location. */
4
+ export declare const DESKTOP_KEY_ENV = "CLINKX_DESKTOP_WORKSTATION_KEY";
5
+ export declare const DESKTOP_APP_DATA_ENV = "CLINKX_DESKTOP_APP_DATA";
6
+ export declare const DESKTOP_VAULT_ENV = "CLINKX_DESKTOP_VAULT";
7
+ export interface DesktopDaemonIo {
8
+ readonly stdin: NodeJS.ReadableStream;
9
+ readonly stdout: NodeJS.WritableStream;
10
+ }
11
+ export interface DesktopDaemonOptions {
12
+ readonly appData: string;
13
+ readonly home: string;
14
+ readonly tmpdir: string;
15
+ readonly platform: NodeJS.Platform;
16
+ readonly ambient: NodeJS.ProcessEnv;
17
+ readonly service?: DesktopService;
18
+ readonly companionOverride?: {
19
+ readonly executable: string;
20
+ readonly prefixArgs?: readonly string[];
21
+ };
22
+ readonly enrollmentPollMs?: number;
23
+ readonly stopTimeoutMs?: number;
24
+ readonly io?: DesktopDaemonIo;
25
+ }
26
+ /**
27
+ * The host daemon: the Electron-free controller from the first launcher
28
+ * release, now running inside the companion executable itself. A thin shell
29
+ * (Tauri) spawns this process with `--host-daemon`, holds the workstation key
30
+ * in the OS keychain, and exchanges newline-delimited JSON: requests on the
31
+ * daemon's stdin, `state`/`response` events on its stdout. One binary plays
32
+ * both roles — this process supervises a child of itself running the
33
+ * dashboard companion.
34
+ */
35
+ export declare class DesktopDaemon {
36
+ #private;
37
+ constructor(options: DesktopDaemonOptions);
38
+ /** Serve requests until a shutdown request (or stdin EOF) completes. */
39
+ run(): Promise<void>;
40
+ state(): DesktopViewState;
41
+ enrollmentCode(): string | undefined;
42
+ startCompanion(): Promise<void>;
43
+ stopCompanion(): Promise<void>;
44
+ saveSetup(raw: unknown): Promise<void>;
45
+ recover(action: RecoveryAction): Promise<void>;
46
+ diagnostics(): string;
47
+ /** Stop and wait, completing the companion's cleanup before the daemon exits. */
48
+ shutdown(): Promise<void>;
49
+ }
50
+ export declare function daemonFatalMessage(error: unknown): string;