@knpkv/herdr-approvals 0.2.0

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 (133) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +22 -0
  3. package/dist/activity-history.d.ts +36 -0
  4. package/dist/activity-history.d.ts.map +1 -0
  5. package/dist/activity-history.js +233 -0
  6. package/dist/activity-history.js.map +1 -0
  7. package/dist/approval-app-view.d.ts +26 -0
  8. package/dist/approval-app-view.d.ts.map +1 -0
  9. package/dist/approval-app-view.js +79 -0
  10. package/dist/approval-app-view.js.map +1 -0
  11. package/dist/approval-client.d.ts +2 -0
  12. package/dist/approval-client.d.ts.map +1 -0
  13. package/dist/approval-client.js +520 -0
  14. package/dist/approval-client.js.map +1 -0
  15. package/dist/approval-sw.js +28 -0
  16. package/dist/approval-sw.js.map +7 -0
  17. package/dist/approval-url.d.ts +37 -0
  18. package/dist/approval-url.d.ts.map +1 -0
  19. package/dist/approval-url.js +37 -0
  20. package/dist/approval-url.js.map +1 -0
  21. package/dist/approval.js +188 -0
  22. package/dist/approval.js.map +7 -0
  23. package/dist/auth.d.ts +10 -0
  24. package/dist/auth.d.ts.map +1 -0
  25. package/dist/auth.js +14 -0
  26. package/dist/auth.js.map +1 -0
  27. package/dist/bin.d.ts +3 -0
  28. package/dist/bin.d.ts.map +1 -0
  29. package/dist/bin.js +47 -0
  30. package/dist/bin.js.map +1 -0
  31. package/dist/connect-entry.d.ts +2 -0
  32. package/dist/connect-entry.d.ts.map +1 -0
  33. package/dist/connect-entry.js +2 -0
  34. package/dist/connect-entry.js.map +1 -0
  35. package/dist/connect.js +188 -0
  36. package/dist/connect.js.map +7 -0
  37. package/dist/dashboard-model.d.ts +719 -0
  38. package/dist/dashboard-model.d.ts.map +1 -0
  39. package/dist/dashboard-model.js +83 -0
  40. package/dist/dashboard-model.js.map +1 -0
  41. package/dist/dashboard-view.d.ts +42 -0
  42. package/dist/dashboard-view.d.ts.map +1 -0
  43. package/dist/dashboard-view.js +194 -0
  44. package/dist/dashboard-view.js.map +1 -0
  45. package/dist/errors.d.ts +33 -0
  46. package/dist/errors.d.ts.map +1 -0
  47. package/dist/errors.js +12 -0
  48. package/dist/errors.js.map +1 -0
  49. package/dist/fleetctl-submission.d.ts +68 -0
  50. package/dist/fleetctl-submission.d.ts.map +1 -0
  51. package/dist/fleetctl-submission.js +31 -0
  52. package/dist/fleetctl-submission.js.map +1 -0
  53. package/dist/fleetctl.d.ts +22 -0
  54. package/dist/fleetctl.d.ts.map +1 -0
  55. package/dist/fleetctl.js +264 -0
  56. package/dist/fleetctl.js.map +1 -0
  57. package/dist/geist-latin-wght-normal.woff2 +0 -0
  58. package/dist/geist-mono-latin-wght-normal.woff2 +0 -0
  59. package/dist/http.d.ts +1512 -0
  60. package/dist/http.d.ts.map +1 -0
  61. package/dist/http.js +1653 -0
  62. package/dist/http.js.map +1 -0
  63. package/dist/index.css +2 -0
  64. package/dist/index.css.map +7 -0
  65. package/dist/index.d.ts +12 -0
  66. package/dist/index.d.ts.map +1 -0
  67. package/dist/index.js +12 -0
  68. package/dist/index.js.map +1 -0
  69. package/dist/internal/config-path.d.ts +3 -0
  70. package/dist/internal/config-path.d.ts.map +1 -0
  71. package/dist/internal/config-path.js +3 -0
  72. package/dist/internal/config-path.js.map +1 -0
  73. package/dist/internal/dashboard-pending-state.d.ts +49 -0
  74. package/dist/internal/dashboard-pending-state.d.ts.map +1 -0
  75. package/dist/internal/dashboard-pending-state.js +98 -0
  76. package/dist/internal/dashboard-pending-state.js.map +1 -0
  77. package/dist/internal/fleet-follow.d.ts +54 -0
  78. package/dist/internal/fleet-follow.d.ts.map +1 -0
  79. package/dist/internal/fleet-follow.js +10 -0
  80. package/dist/internal/fleet-follow.js.map +1 -0
  81. package/dist/internal/fleet-request.d.ts +4 -0
  82. package/dist/internal/fleet-request.d.ts.map +1 -0
  83. package/dist/internal/fleet-request.js +11 -0
  84. package/dist/internal/fleet-request.js.map +1 -0
  85. package/dist/internal/html.d.ts +3 -0
  86. package/dist/internal/html.d.ts.map +1 -0
  87. package/dist/internal/html.js +8 -0
  88. package/dist/internal/html.js.map +1 -0
  89. package/dist/internal/websocket.d.ts +4 -0
  90. package/dist/internal/websocket.d.ts.map +1 -0
  91. package/dist/internal/websocket.js +12 -0
  92. package/dist/internal/websocket.js.map +1 -0
  93. package/dist/model.d.ts +40 -0
  94. package/dist/model.d.ts.map +1 -0
  95. package/dist/model.js +53 -0
  96. package/dist/model.js.map +1 -0
  97. package/dist/operations.d.ts +72 -0
  98. package/dist/operations.d.ts.map +1 -0
  99. package/dist/operations.js +284 -0
  100. package/dist/operations.js.map +1 -0
  101. package/dist/push-policy.d.ts +3 -0
  102. package/dist/push-policy.d.ts.map +1 -0
  103. package/dist/push-policy.js +3 -0
  104. package/dist/push-policy.js.map +1 -0
  105. package/dist/push-sender.d.ts +18 -0
  106. package/dist/push-sender.d.ts.map +1 -0
  107. package/dist/push-sender.js +33 -0
  108. package/dist/push-sender.js.map +1 -0
  109. package/dist/push-subscription.d.ts +17 -0
  110. package/dist/push-subscription.d.ts.map +1 -0
  111. package/dist/push-subscription.js +62 -0
  112. package/dist/push-subscription.js.map +1 -0
  113. package/dist/push-worker.d.ts +20 -0
  114. package/dist/push-worker.d.ts.map +1 -0
  115. package/dist/push-worker.js +32 -0
  116. package/dist/push-worker.js.map +1 -0
  117. package/dist/pwa.d.ts +39 -0
  118. package/dist/pwa.d.ts.map +1 -0
  119. package/dist/pwa.js +51 -0
  120. package/dist/pwa.js.map +1 -0
  121. package/dist/shell-view.d.ts +20 -0
  122. package/dist/shell-view.d.ts.map +1 -0
  123. package/dist/shell-view.js +86 -0
  124. package/dist/shell-view.js.map +1 -0
  125. package/dist/store.d.ts +46 -0
  126. package/dist/store.d.ts.map +1 -0
  127. package/dist/store.js +291 -0
  128. package/dist/store.js.map +1 -0
  129. package/dist/work-checkpoint.d.ts +107 -0
  130. package/dist/work-checkpoint.d.ts.map +1 -0
  131. package/dist/work-checkpoint.js +37 -0
  132. package/dist/work-checkpoint.js.map +1 -0
  133. package/package.json +90 -0
@@ -0,0 +1,12 @@
1
+ export * from "./approval-url.js";
2
+ export * from "./dashboard-model.js";
3
+ export * from "./errors.js";
4
+ export * from "./http.js";
5
+ export * from "./model.js";
6
+ export * from "./push-sender.js";
7
+ export * from "./push-subscription.js";
8
+ export * from "./push-worker.js";
9
+ export * from "./pwa.js";
10
+ export * from "./shell-view.js";
11
+ export * from "./store.js";
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AACpC,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAA;AAChC,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,12 @@
1
+ export * from "./approval-url.js";
2
+ export * from "./dashboard-model.js";
3
+ export * from "./errors.js";
4
+ export * from "./http.js";
5
+ export * from "./model.js";
6
+ export * from "./push-sender.js";
7
+ export * from "./push-subscription.js";
8
+ export * from "./push-worker.js";
9
+ export * from "./pwa.js";
10
+ export * from "./shell-view.js";
11
+ export * from "./store.js";
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AACpC,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAA;AAChC,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { Config } from "effect";
2
+ export declare const fleetConfigPath: Config.Config<string>;
3
+ //# sourceMappingURL=config-path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-path.d.ts","sourceRoot":"","sources":["../../src/internal/config-path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,eAAO,MAAM,eAAe,uBAM3B,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { Config } from "effect";
2
+ export const fleetConfigPath = Config.string("FLEET_CONFIG_PATH").pipe(Config.orElse(() => Config.string("HOME").pipe(Config.map((home) => `${home}/.config/fleet/config.json`))));
3
+ //# sourceMappingURL=config-path.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-path.js","sourceRoot":"","sources":["../../src/internal/config-path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,IAAI,CACpE,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CACjB,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CACxB,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,IAAI,4BAA4B,CAAC,CAC1D,CACF,CACF,CAAA"}
@@ -0,0 +1,49 @@
1
+ import type { JobRecord, PendingApprovalCursor } from "@knpkv/herdr-fleet/model";
2
+ import { type Cause, Exit } from "effect";
3
+ import type { DashboardHistoryPage, DashboardSnapshot, FleetPendingApprovals, PendingApprovalContinuation, PendingApprovalTarget } from "../dashboard-model.js";
4
+ export interface DashboardPendingState extends FleetPendingApprovals {
5
+ readonly generation: number;
6
+ }
7
+ export interface DashboardPendingRequest {
8
+ readonly continuation: PendingApprovalContinuation;
9
+ readonly generation: number;
10
+ }
11
+ export type DashboardPendingLoadResult<E> = {
12
+ readonly _tag: "Idle";
13
+ } | {
14
+ readonly _tag: "Success";
15
+ } | {
16
+ readonly _tag: "Failure";
17
+ readonly cause: Cause.Cause<E>;
18
+ };
19
+ export type PendingApprovalTargetRevalidation = {
20
+ readonly _tag: "Found";
21
+ readonly target: PendingApprovalTarget;
22
+ } | {
23
+ readonly _tag: "Missing";
24
+ } | {
25
+ readonly _tag: "Retry";
26
+ };
27
+ export interface DashboardHistoryState {
28
+ readonly generation: number;
29
+ readonly nextCursor: PendingApprovalCursor | null;
30
+ readonly records: ReadonlyArray<JobRecord>;
31
+ }
32
+ export interface DashboardHistoryRequest {
33
+ readonly cursor: PendingApprovalCursor;
34
+ readonly generation: number;
35
+ }
36
+ export declare const dashboardPendingState: (generation: number, page: FleetPendingApprovals) => DashboardPendingState;
37
+ export declare const dashboardHistoryState: (generation: number, records: ReadonlyArray<JobRecord>, nextCursor: PendingApprovalCursor | null) => DashboardHistoryState;
38
+ export declare const mergeDashboardHistoryPage: (state: DashboardHistoryState, request: DashboardHistoryRequest, page: DashboardHistoryPage) => DashboardHistoryState;
39
+ export declare const dashboardPendingBadgeCount: (state: FleetPendingApprovals) => number | null;
40
+ export declare const pendingApprovalTargetAfterRevalidation: (current: PendingApprovalTarget | null, result: PendingApprovalTargetRevalidation) => PendingApprovalTarget | null;
41
+ export declare const dashboardHasPendingApprovalTarget: (snapshot: DashboardSnapshot, target: {
42
+ readonly host: string;
43
+ readonly jobId: string;
44
+ }) => boolean;
45
+ export declare const withPendingApprovalTarget: (snapshot: DashboardSnapshot, target: PendingApprovalTarget | null) => DashboardSnapshot;
46
+ export declare const mergeDashboardPendingPage: (state: DashboardPendingState, request: DashboardPendingRequest, page: FleetPendingApprovals) => DashboardPendingState;
47
+ export declare const rotateFailedDashboardPendingPage: (state: DashboardPendingState, request: DashboardPendingRequest) => DashboardPendingState;
48
+ export declare const loadDashboardPendingPage: <E>(observedState: DashboardPendingState, load: (continuation: PendingApprovalContinuation) => Promise<Exit.Exit<FleetPendingApprovals, E>>, update: (transition: (state: DashboardPendingState) => DashboardPendingState) => void) => Promise<DashboardPendingLoadResult<E>>;
49
+ //# sourceMappingURL=dashboard-pending-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dashboard-pending-state.d.ts","sourceRoot":"","sources":["../../src/internal/dashboard-pending-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AAChF,OAAO,EAAE,KAAK,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AACzC,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,EACrB,2BAA2B,EAC3B,qBAAqB,EACtB,MAAM,uBAAuB,CAAA;AAE9B,MAAM,WAAW,qBAAsB,SAAQ,qBAAqB;IAClE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAC5B;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,YAAY,EAAE,2BAA2B,CAAA;IAClD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAC5B;AAED,MAAM,MAAM,0BAA0B,CAAC,CAAC,IACpC;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACzB;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,GAC5B;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;CAAE,CAAA;AAEhE,MAAM,MAAM,iCAAiC,GACzC;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAA;CAAE,GAClE;IAAE,QAAQ,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AAgC,UACpC,qBAAqB,WACnB,uBAAuB,KAC/B,qBAaF,CAAA;AAED,eAAO,MAAM,wBAAwB,GAAU,CAAC,iBAC/B,qBAAqB,QAC9B,CAAC,YAAY,EAAE,2BAA2B,KAAK,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAC,UACzF,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,qBAAqB,KAAK,IAAI,KACpF,OAAO,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAWvC,CAAA"}
@@ -0,0 +1,98 @@
1
+ import { Exit } from "effect";
2
+ const sameContinuation = (left, right) => left.host.toLowerCase() === right.host.toLowerCase() &&
3
+ left.cursor.createdAt === right.cursor.createdAt &&
4
+ left.cursor.id === right.cursor.id;
5
+ const sameCursor = (left, right) => left.createdAt === right.createdAt && left.id === right.id;
6
+ const requestedIndex = (state, request) => state.generation === request.generation
7
+ ? state.nextCursors.findIndex((candidate) => sameContinuation(candidate, request.continuation))
8
+ : -1;
9
+ export const dashboardPendingState = (generation, page) => ({
10
+ ...page,
11
+ generation
12
+ });
13
+ export const dashboardHistoryState = (generation, records, nextCursor) => ({ generation, nextCursor, records });
14
+ export const mergeDashboardHistoryPage = (state, request, page) => state.generation !== request.generation ||
15
+ state.nextCursor === null ||
16
+ !sameCursor(state.nextCursor, request.cursor)
17
+ ? state
18
+ : {
19
+ ...state,
20
+ nextCursor: page.nextCursor,
21
+ records: [...state.records, ...page.records]
22
+ };
23
+ export const dashboardPendingBadgeCount = (state) => state.nextCursors.length === 0 && state.failures.length === 0
24
+ ? state.local.length + state.remote.length
25
+ : null;
26
+ export const pendingApprovalTargetAfterRevalidation = (current, result) => result._tag === "Found" ? result.target : result._tag === "Missing" ? null : current;
27
+ export const dashboardHasPendingApprovalTarget = (snapshot, target) => snapshot.pendingApprovals.local.some(({ id }) => id === target.jobId && snapshot.host.toLowerCase() === target.host.toLowerCase()) ||
28
+ snapshot.pendingApprovals.remote.some(({ approval, host }) => approval.id === target.jobId && host.toLowerCase() === target.host.toLowerCase());
29
+ export const withPendingApprovalTarget = (snapshot, target) => {
30
+ if (target === null)
31
+ return snapshot;
32
+ if (target._tag === "local") {
33
+ return snapshot.pendingApprovals.local.some(({ id }) => id === target.record.id)
34
+ ? snapshot
35
+ : {
36
+ ...snapshot,
37
+ pendingApprovals: {
38
+ ...snapshot.pendingApprovals,
39
+ local: [...snapshot.pendingApprovals.local, target.record]
40
+ }
41
+ };
42
+ }
43
+ return snapshot.pendingApprovals.remote.some(({ approval, host }) => approval.id === target.remote.approval.id && host.toLowerCase() === target.remote.host.toLowerCase())
44
+ ? snapshot
45
+ : {
46
+ ...snapshot,
47
+ pendingApprovals: {
48
+ ...snapshot.pendingApprovals,
49
+ remote: [...snapshot.pendingApprovals.remote, target.remote]
50
+ }
51
+ };
52
+ };
53
+ export const mergeDashboardPendingPage = (state, request, page) => {
54
+ const index = requestedIndex(state, request);
55
+ if (index < 0)
56
+ return state;
57
+ return {
58
+ failures: [...state.failures, ...page.failures],
59
+ generation: state.generation,
60
+ local: [...state.local, ...page.local],
61
+ nextCursors: [
62
+ ...state.nextCursors.slice(0, index),
63
+ ...page.nextCursors,
64
+ ...state.nextCursors.slice(index + 1)
65
+ ],
66
+ remote: [...state.remote, ...page.remote]
67
+ };
68
+ };
69
+ export const rotateFailedDashboardPendingPage = (state, request) => {
70
+ const index = requestedIndex(state, request);
71
+ if (index < 0 || state.nextCursors.length < 2)
72
+ return state;
73
+ const failed = state.nextCursors[index];
74
+ if (failed === undefined)
75
+ return state;
76
+ return {
77
+ ...state,
78
+ nextCursors: [
79
+ ...state.nextCursors.slice(0, index),
80
+ ...state.nextCursors.slice(index + 1),
81
+ failed
82
+ ]
83
+ };
84
+ };
85
+ export const loadDashboardPendingPage = async (observedState, load, update) => {
86
+ const continuation = observedState.nextCursors.at(0);
87
+ if (continuation === undefined)
88
+ return { _tag: "Idle" };
89
+ const request = { continuation, generation: observedState.generation };
90
+ const exit = await load(continuation);
91
+ if (Exit.isFailure(exit)) {
92
+ update((state) => rotateFailedDashboardPendingPage(state, request));
93
+ return { _tag: "Failure", cause: exit.cause };
94
+ }
95
+ update((state) => mergeDashboardPendingPage(state, request, exit.value));
96
+ return { _tag: "Success" };
97
+ };
98
+ //# sourceMappingURL=dashboard-pending-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dashboard-pending-state.js","sourceRoot":"","sources":["../../src/internal/dashboard-pending-state.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,IAAI,EAAE,MAAM,QAAQ,CAAA;AAuCzC,MAAM,gBAAgB,GAAG,CACvB,IAAiC,EACjC,KAAkC,EACzB,EAAE,CACX,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE;IACpD,IAAI,CAAC,MAAM,CAAC,SAAS,KAAK,KAAK,CAAC,MAAM,CAAC,SAAS;IAChD,IAAI,CAAC,MAAM,CAAC,EAAE,KAAK,KAAK,CAAC,MAAM,CAAC,EAAE,CAAA;AAEpC,MAAM,UAAU,GAAG,CAAC,IAA2B,EAAE,KAA4B,EAAW,EAAE,CACxF,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,SAAS,IAAI,IAAI,CAAC,EAAE,KAAK,KAAK,CAAC,EAAE,CAAA;AAE5D,MAAM,cAAc,GAAG,CACrB,KAA4B,EAC5B,OAAgC,EACxB,EAAE,CACV,KAAK,CAAC,UAAU,KAAK,OAAO,CAAC,UAAU;IACrC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,gBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/F,CAAC,CAAC,CAAC,CAAC,CAAA;AAER,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,UAAkB,EAClB,IAA2B,EACJ,EAAE,CAAC,CAAC;IAC3B,GAAG,IAA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;IACxE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAA;AAC5B,CAAC,CAAA"}
@@ -0,0 +1,54 @@
1
+ import type { JobRecord } from "@knpkv/herdr-fleet";
2
+ import { Effect } from "effect";
3
+ export declare const followJob: <E, R>(poll: Effect.Effect<JobRecord, E, R>) => Effect.Effect<{
4
+ readonly id: string;
5
+ readonly createdAt: number;
6
+ readonly updatedAt: number;
7
+ readonly actor: string;
8
+ readonly hash: string;
9
+ readonly approvalNonce: string | null;
10
+ readonly approvalExpiresAt?: number | null;
11
+ readonly approvedBy: string | null;
12
+ readonly approvedAt?: number | null;
13
+ readonly rejectedBy?: string | null;
14
+ readonly rejectedAt?: number | null;
15
+ readonly expiredAt?: number | null;
16
+ readonly status: "expired" | "failed" | "interrupted" | "pending_approval" | "queued" | "rejected" | "running" | "succeeded";
17
+ readonly payload: {
18
+ readonly kind: "nix.check";
19
+ } | {
20
+ readonly kind: "nix.apply";
21
+ readonly ref: string;
22
+ } | {
23
+ readonly kind: "agent.delegate";
24
+ readonly repository: string;
25
+ readonly prompt: string;
26
+ readonly mode: "consult" | "review" | "work";
27
+ readonly channel?: "coordinator_chat";
28
+ } | {
29
+ readonly kind: "agent.message";
30
+ readonly session: string;
31
+ readonly message: string;
32
+ } | {
33
+ readonly kind: "browser.mcp.recover";
34
+ };
35
+ readonly result: string | null;
36
+ readonly error: string | null;
37
+ readonly worker?: {
38
+ readonly host: string;
39
+ readonly agentId: string;
40
+ readonly name: string;
41
+ readonly paneId: string;
42
+ readonly relationship?: {
43
+ readonly parentAgentId: string;
44
+ readonly relation: "delegated" | "pair" | "review";
45
+ };
46
+ };
47
+ readonly connectTarget?: {
48
+ readonly host: string;
49
+ readonly agentId: string;
50
+ readonly url: string;
51
+ };
52
+ readonly workerTerminalObservedAt?: number | null;
53
+ }, E, R>;
54
+ //# sourceMappingURL=fleet-follow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fleet-follow.d.ts","sourceRoot":"","sources":["../../src/internal/fleet-follow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAE,MAAM,EAAY,MAAM,QAAQ,CAAA;AAUzC,eAAO,MAAM,SAAS,GAAI,CAAC,EAAE,CAAC,QACtB,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAYnC,CAAA"}
@@ -0,0 +1,10 @@
1
+ import { Effect, Schedule } from "effect";
2
+ const terminalStatuses = new Set([
3
+ "expired",
4
+ "failed",
5
+ "interrupted",
6
+ "rejected",
7
+ "succeeded"
8
+ ]);
9
+ export const followJob = (poll) => poll.pipe(Effect.repeat(Schedule.passthrough(Schedule.spaced("1 second").pipe(Schedule.while(({ input }) => !terminalStatuses.has(input.status))))));
10
+ //# sourceMappingURL=fleet-follow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fleet-follow.js","sourceRoot":"","sources":["../../src/internal/fleet-follow.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAEzC,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC;IAC/B,SAAS;IACT,QAAQ;IACR,aAAa;IACb,UAAU;IACV,WAAW;CACZ,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,IAAoC,EACpC,EAAE,CACF,IAAI,CAAC,IAAI,CACP,MAAM,CAAC,MAAM,CACX,QAAQ,CAAC,WAAW,CAClB,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAC9B,QAAQ,CAAC,KAAK,CACZ,CAAC,EAAE,KAAK,EAAiC,EAAE,EAAE,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAClF,CACF,CACF,CACF,CACF,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { FleetOperationError } from "@knpkv/herdr-fleet";
2
+ import { Effect } from "effect";
3
+ export declare const withFleetRequestTimeout: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E | FleetOperationError, R>;
4
+ //# sourceMappingURL=fleet-request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fleet-request.d.ts","sourceRoot":"","sources":["../../src/internal/fleet-request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,eAAO,MAAM,uBAAuB,GAAI,CAAC,EAAE,CAAC,EAAE,CAAC,UACrC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,iDAc7B,CAAA"}
@@ -0,0 +1,11 @@
1
+ import { FleetOperationError } from "@knpkv/herdr-fleet";
2
+ import { Effect } from "effect";
3
+ export const withFleetRequestTimeout = (effect) => effect.pipe(Effect.timeoutOrElse({
4
+ duration: "10 seconds",
5
+ orElse: () => Effect.fail(new FleetOperationError({
6
+ cause: "10 seconds",
7
+ detail: "fleet request timed out after 10 seconds",
8
+ operation: "fleet.request.timeout"
9
+ }))
10
+ }));
11
+ //# sourceMappingURL=fleet-request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fleet-request.js","sourceRoot":"","sources":["../../src/internal/fleet-request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,MAA8B,EAC9B,EAAE,CACF,MAAM,CAAC,IAAI,CACT,MAAM,CAAC,aAAa,CAAC;IACnB,QAAQ,EAAE,YAAY;IACtB,MAAM,EAAE,GAAG,EAAE,CACX,MAAM,CAAC,IAAI,CACT,IAAI,mBAAmB,CAAC;QACtB,KAAK,EAAE,YAAY;QACnB,MAAM,EAAE,0CAA0C;QAClD,SAAS,EAAE,uBAAuB;KACnC,CAAC,CACH;CACJ,CAAC,CACH,CAAA"}
@@ -0,0 +1,3 @@
1
+ export declare const escapeHtmlText: (value: string) => string;
2
+ export declare const dashboardDocumentTitle: (host: string) => string;
3
+ //# sourceMappingURL=html.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/internal/html.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,UAAW,MAAM,KAAG,MAMlB,CAAA;AAE7B,eAAO,MAAM,sBAAsB,SAAU,MAAM,KAAG,MAAmD,CAAA"}
@@ -0,0 +1,8 @@
1
+ export const escapeHtmlText = (value) => value
2
+ .replaceAll("&", "&amp;")
3
+ .replaceAll("<", "&lt;")
4
+ .replaceAll(">", "&gt;")
5
+ .replaceAll("\"", "&quot;")
6
+ .replaceAll("'", "&#39;");
7
+ export const dashboardDocumentTitle = (host) => `Host activity · ${escapeHtmlText(host)}`;
8
+ //# sourceMappingURL=html.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html.js","sourceRoot":"","sources":["../../src/internal/html.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAa,EAAU,EAAE,CACtD,KAAK;KACF,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC;KACxB,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC;KACvB,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC;KACvB,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC;KAC1B,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;AAE7B,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,mBAAmB,cAAc,CAAC,IAAI,CAAC,EAAE,CAAA"}
@@ -0,0 +1,4 @@
1
+ export declare const relayTerminalCloseCode: (code: number) => number;
2
+ export declare const terminalBufferLimitBytes: number;
3
+ export declare const terminalBufferCanAccept: (bufferedBytes: number, payloadBytes: number) => boolean;
4
+ //# sourceMappingURL=websocket.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"websocket.d.ts","sourceRoot":"","sources":["../../src/internal/websocket.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,SAAU,MAAM,KAAG,MAQ3C,CAAA;AAEX,eAAO,MAAM,wBAAwB,QAAc,CAAA;AAEnD,eAAO,MAAM,uBAAuB,kBACnB,MAAM,gBACP,MAAM,KACnB,OAEuD,CAAA"}
@@ -0,0 +1,12 @@
1
+ export const relayTerminalCloseCode = (code) => (code >= 1_000 &&
2
+ code <= 1_014 &&
3
+ code !== 1_004 &&
4
+ code !== 1_005 &&
5
+ code !== 1_006) ||
6
+ (code >= 3_000 && code <= 4_999)
7
+ ? code
8
+ : 4_503;
9
+ export const terminalBufferLimitBytes = 1024 * 1024;
10
+ export const terminalBufferCanAccept = (bufferedBytes, payloadBytes) => bufferedBytes === 0 ||
11
+ bufferedBytes + payloadBytes <= terminalBufferLimitBytes;
12
+ //# sourceMappingURL=websocket.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"websocket.js","sourceRoot":"","sources":["../../src/internal/websocket.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,IAAY,EAAU,EAAE,CAC7D,CAAC,IAAI,IAAI,KAAK;IACV,IAAI,IAAI,KAAK;IACb,IAAI,KAAK,KAAK;IACd,IAAI,KAAK,KAAK;IACd,IAAI,KAAK,KAAK,CAAC;IACjB,CAAC,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,CAAC;IAChC,CAAC,CAAC,IAAI;IACN,CAAC,CAAC,KAAK,CAAA;AAEX,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,GAAG,IAAI,CAAA;AAEnD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,aAAqB,EACrB,YAAoB,EACX,EAAE,CACX,aAAa,KAAK,CAAC;IACnB,aAAa,GAAG,YAAY,IAAI,wBAAwB,CAAA"}
@@ -0,0 +1,40 @@
1
+ import { Schema } from "effect";
2
+ export declare const VapidKeyPair: Schema.Struct<{
3
+ readonly privateKey: Schema.String;
4
+ readonly publicKey: Schema.String;
5
+ }>;
6
+ export type VapidKeyPair = typeof VapidKeyPair.Type;
7
+ export declare const PushSubscriptionRecord: Schema.Struct<{
8
+ readonly endpoint: Schema.String;
9
+ readonly expirationTime: Schema.NullOr<Schema.Number>;
10
+ readonly keys: Schema.Struct<{
11
+ readonly auth: Schema.String;
12
+ readonly p256dh: Schema.String;
13
+ }>;
14
+ }>;
15
+ export type PushSubscriptionRecord = typeof PushSubscriptionRecord.Type;
16
+ export declare const PushSubscriptionRemoval: Schema.Struct<{
17
+ readonly endpoint: Schema.String;
18
+ }>;
19
+ export type PushSubscriptionRemoval = typeof PushSubscriptionRemoval.Type;
20
+ export declare const ApprovalNotificationCandidate: Schema.Struct<{
21
+ readonly host: Schema.String;
22
+ readonly jobId: Schema.String;
23
+ }>;
24
+ export type ApprovalNotificationCandidate = typeof ApprovalNotificationCandidate.Type;
25
+ export declare const ApprovalPushPayload: Schema.Struct<{
26
+ readonly host: Schema.String;
27
+ readonly jobId: Schema.String;
28
+ readonly pendingCount: Schema.NullOr<Schema.Number>;
29
+ }>;
30
+ export type ApprovalPushPayload = typeof ApprovalPushPayload.Type;
31
+ export declare const PushPublicConfiguration: Schema.Struct<{
32
+ readonly canonicalUrl: Schema.String;
33
+ readonly enabled: Schema.Boolean;
34
+ readonly publicKey: Schema.NullOr<Schema.String>;
35
+ }>;
36
+ export type PushPublicConfiguration = typeof PushPublicConfiguration.Type;
37
+ export declare const PushSubscriptionStatus: Schema.Struct<{
38
+ readonly subscribed: Schema.Boolean;
39
+ }>;
40
+ //# sourceMappingURL=model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AA2B/B,eAAO,MAAM,YAAY;;;EAGvB,CAAA;AACF,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC,IAAI,CAAA;AAEnD,eAAO,MAAM,sBAAsB;;;;;;;EAYjC,CAAA;AACF,MAAM,MAAM,sBAAsB,GAAG,OAAO,sBAAsB,CAAC,IAAI,CAAA;AAEvE,eAAO,MAAM,uBAAuB;;EAElC,CAAA;AACF,MAAM,MAAM,uBAAuB,GAAG,OAAO,uBAAuB,CAAC,IAAI,CAAA;AAEzE,eAAO,MAAM,6BAA6B;;;EAGxC,CAAA;AACF,MAAM,MAAM,6BAA6B,GAAG,OAAO,6BAA6B,CAAC,IAAI,CAAA;AAErF,eAAO,MAAM,mBAAmB;;;;EAI9B,CAAA;AACF,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAC,IAAI,CAAA;AAEjE,eAAO,MAAM,uBAAuB;;;;EAIlC,CAAA;AACF,MAAM,MAAM,uBAAuB,GAAG,OAAO,uBAAuB,CAAC,IAAI,CAAA;AAEzE,eAAO,MAAM,sBAAsB;;EAEjC,CAAA"}
package/dist/model.js ADDED
@@ -0,0 +1,53 @@
1
+ import { Schema } from "effect";
2
+ const BoundedIdentifier = Schema.String.check(Schema.isNonEmpty(), Schema.isMaxLength(256));
3
+ const Base64Url = Schema.String.check(Schema.isNonEmpty(), Schema.isMaxLength(512), Schema.isPattern(/^[A-Za-z0-9_-]+$/));
4
+ const safePushEndpoint = (value) => {
5
+ try {
6
+ const url = new URL(value);
7
+ const ipLiteral = url.hostname.includes(":") || /^\d+(?:\.\d+){3}$/.test(url.hostname);
8
+ return url.protocol === "https:" &&
9
+ url.username === "" &&
10
+ url.password === "" &&
11
+ !ipLiteral &&
12
+ url.hostname !== "localhost" &&
13
+ !url.hostname.endsWith(".localhost");
14
+ }
15
+ catch {
16
+ return false;
17
+ }
18
+ };
19
+ export const VapidKeyPair = Schema.Struct({
20
+ privateKey: Base64Url,
21
+ publicKey: Base64Url
22
+ });
23
+ export const PushSubscriptionRecord = Schema.Struct({
24
+ endpoint: Schema.String.check(Schema.isMaxLength(2_048), Schema.makeFilter(safePushEndpoint, {
25
+ expected: "an HTTPS push endpoint with a DNS hostname and no credentials"
26
+ })),
27
+ expirationTime: Schema.NullOr(Schema.Number),
28
+ keys: Schema.Struct({
29
+ auth: Base64Url,
30
+ p256dh: Base64Url
31
+ })
32
+ });
33
+ export const PushSubscriptionRemoval = Schema.Struct({
34
+ endpoint: PushSubscriptionRecord.fields.endpoint
35
+ });
36
+ export const ApprovalNotificationCandidate = Schema.Struct({
37
+ host: BoundedIdentifier,
38
+ jobId: BoundedIdentifier
39
+ });
40
+ export const ApprovalPushPayload = Schema.Struct({
41
+ host: ApprovalNotificationCandidate.fields.host,
42
+ jobId: ApprovalNotificationCandidate.fields.jobId,
43
+ pendingCount: Schema.NullOr(Schema.Number)
44
+ });
45
+ export const PushPublicConfiguration = Schema.Struct({
46
+ canonicalUrl: Schema.String,
47
+ enabled: Schema.Boolean,
48
+ publicKey: Schema.NullOr(Base64Url)
49
+ });
50
+ export const PushSubscriptionStatus = Schema.Struct({
51
+ subscribed: Schema.Boolean
52
+ });
53
+ //# sourceMappingURL=model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAC3C,MAAM,CAAC,UAAU,EAAE,EACnB,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CACxB,CAAA;AACD,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CACnC,MAAM,CAAC,UAAU,EAAE,EACnB,MAAM,CAAC,WAAW,CAAC,GAAG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,uBAAuB,GAAG,MAAM,CAAC,MAAM,CAAC;IACnD,QAAQ,EAAE,sBAAsB,CAAC,MAAM,CAAC,QAAQ;CACjD,CAAC,CAAA;AAGF,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC,MAAM,CAAC;IACzD,IAAI,EAAE,iBAAiB;IACvB,KAAK,EAAE,iBAAiB;CACzB,CAAC,CAAA;AAGF,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC/C,IAAI,EAAE,6BAA6B,CAAC,MAAM,CAAC,IAAI;IAC/C,KAAK,EAAE,6BAA6B,CAAC,MAAM,CAAC,KAAK;IACjD,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;CAC3C,CAAC,CAAA;AAGF,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,CAAC;IACnD,YAAY,EAAE,MAAM,CAAC,MAAM;IAC3B,OAAO,EAAE,MAAM,CAAC,OAAO;IACvB,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC;CACpC,CAAC,CAAA;AAGF,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,CAAC;IAClD,UAAU,EAAE,MAAM,CAAC,OAAO;CAC3B,CAAC,CAAA"}
@@ -0,0 +1,72 @@
1
+ import { type AgentDelegate, type CoreJobPayload, FleetOperationError, type LocalJobPayload, type WorkerStarted } from "@knpkv/herdr-fleet";
2
+ import { Effect, Path } from "effect";
3
+ import { ChildProcessSpawner } from "effect/unstable/process";
4
+ /**
5
+ * Reserves transport-envelope headroom when one-byte control output expands to
6
+ * six JSON bytes beside the largest accepted job payload.
7
+ */
8
+ export declare const commandOutputMaxBytes: number;
9
+ export declare const makeHostOperations: (config: {
10
+ readonly host: string;
11
+ readonly repository: string;
12
+ readonly stateDirectory: string;
13
+ readonly crossHost: boolean;
14
+ readonly port: number;
15
+ readonly localPort: number;
16
+ readonly approvalPort: number;
17
+ readonly allowedUsers: readonly string[];
18
+ readonly approvalNodes: readonly string[];
19
+ readonly machines: readonly {
20
+ readonly host: string;
21
+ readonly nodeId: string;
22
+ }[];
23
+ readonly applyMachines: readonly string[];
24
+ readonly checkCommand: readonly string[];
25
+ readonly applyCommand: readonly string[] | null;
26
+ readonly browserMcpRecoverCommand: readonly string[] | null;
27
+ readonly coordinatorCommand: readonly string[];
28
+ readonly herdrCommand: string;
29
+ readonly tailscaleCommand: string;
30
+ readonly approvalTls: {
31
+ readonly certificatePath: string;
32
+ readonly privateKeyPath: string;
33
+ } | null;
34
+ readonly approvalHub: {
35
+ readonly host: string;
36
+ readonly nodeId: string;
37
+ readonly url: string;
38
+ };
39
+ readonly pushAllowedOrigins: readonly string[];
40
+ readonly pushSubject: string;
41
+ }) => Effect.Effect<{
42
+ inspect: () => Effect.Effect<{
43
+ applyConfigured: boolean;
44
+ branch: string;
45
+ dirty: boolean;
46
+ repository: string;
47
+ revision: string;
48
+ }, FleetOperationError, never>;
49
+ listAgents: () => Effect.Effect<{
50
+ readonly agents: readonly {
51
+ readonly agentId: string | null;
52
+ readonly activityRevision: number;
53
+ readonly kind: string;
54
+ readonly name: string;
55
+ readonly paneId: string;
56
+ readonly parentAgentId: string | null;
57
+ readonly relation: "delegated" | "pair" | "review" | null;
58
+ readonly status: string;
59
+ readonly work: string;
60
+ }[];
61
+ readonly available: boolean;
62
+ readonly error: string | null;
63
+ } | {
64
+ agents: never[];
65
+ available: boolean;
66
+ error: string;
67
+ }, never, never>;
68
+ run: (payload: CoreJobPayload, workerStarted: WorkerStarted, jobId: string) => Effect.Effect<string, FleetOperationError, never>;
69
+ runLocal: (payload: LocalJobPayload) => Effect.Effect<string, FleetOperationError, never>;
70
+ runCoordinatorChat: (payload: AgentDelegate, workerStarted: WorkerStarted, jobId: string) => Effect.Effect<string, FleetOperationError, never>;
71
+ }, never, ChildProcessSpawner.ChildProcessSpawner | Path.Path>;
72
+ //# sourceMappingURL=operations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,aAAa,EAIlB,KAAK,cAAc,EACnB,mBAAmB,EAGnB,KAAK,eAAe,EACpB,KAAK,aAAa,EACnB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAuB,MAAM,QAAQ,CAAA;AAC1D,OAAO,EAAgB,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AA4C3E;;;GAGG;AACH,eAAO,MAAM,qBAAqB,QAAa,CAAA;AAiE/C,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAmQA,cAAc,iBAAiB,aAAa,SAAS,MAAM;wBAwC7D,eAAe;kCAY/B,aAAa,iBACP,aAAa,SACrB,MAAM;8DAqBf,CAAA"}