@ricsam/r5d-worker 0.0.137 → 0.0.138
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/README.md +4 -94
- package/dist/cjs/package.json +1 -1
- package/dist/mjs/main.mjs +46 -7543
- package/dist/mjs/package.json +1 -1
- package/dist/mjs/personal/action-scheduler.mjs +31 -0
- package/dist/mjs/personal/client.mjs +215 -0
- package/dist/mjs/personal/runtime.mjs +328 -0
- package/dist/mjs/personal/tcp.mjs +217 -0
- package/dist/mjs/runtime/adapter.mjs +42 -0
- package/dist/mjs/runtime/client.mjs +95 -0
- package/dist/mjs/runtime/daemon.mjs +131 -0
- package/dist/mjs/runtime/executor.mjs +436 -0
- package/dist/mjs/runtime/index.mjs +15 -0
- package/dist/mjs/runtime/protocol.mjs +139 -0
- package/dist/mjs/runtime/pty-host.mjs +156 -0
- package/dist/mjs/runtime/pty.mjs +127 -0
- package/dist/mjs/runtime/releases/artifacts.mjs +201 -0
- package/dist/mjs/runtime/releases/grants.mjs +93 -0
- package/dist/mjs/runtime/releases/main.mjs +101 -0
- package/dist/mjs/runtime/releases/manager.mjs +541 -0
- package/dist/mjs/runtime/releases/process.mjs +88 -0
- package/dist/mjs/runtime/releases/retirement.mjs +18 -0
- package/dist/mjs/runtime/releases/rpc-client.mjs +184 -0
- package/dist/mjs/runtime/releases/rpc-main.mjs +213 -0
- package/dist/mjs/runtime/releases/rpc-protocol.mjs +103 -0
- package/dist/mjs/runtime/storage.mjs +156 -0
- package/dist/mjs/runtime/workspace/artifacts.mjs +121 -0
- package/dist/mjs/runtime/workspace/authority.mjs +1355 -0
- package/dist/mjs/runtime/workspace/contracts.mjs +60 -0
- package/dist/mjs/runtime/workspace/file-write.mjs +23 -0
- package/dist/mjs/runtime/workspace/files.mjs +308 -0
- package/dist/mjs/runtime/workspace/http-body.mjs +45 -0
- package/dist/mjs/runtime/workspace/storage-client.mjs +59 -0
- package/dist/mjs/runtime/workspace/storage-wire.mjs +53 -0
- package/dist/types/main.d.ts +0 -1167
- package/dist/types/personal/action-scheduler.d.ts +23 -0
- package/dist/types/personal/client.d.ts +14 -0
- package/dist/types/personal/runtime.d.ts +121 -0
- package/dist/types/personal/tcp.d.ts +14 -0
- package/dist/types/runtime/client.d.ts +3 -1
- package/dist/types/runtime/executor.d.ts +6 -1
- package/dist/types/runtime/protocol.d.ts +176 -4
- package/dist/types/runtime/pty.d.ts +1 -0
- package/dist/types/runtime/releases/artifacts.d.ts +51 -0
- package/dist/types/runtime/releases/grants.d.ts +16 -0
- package/dist/types/runtime/releases/manager.d.ts +145 -0
- package/dist/types/runtime/releases/process.d.ts +14 -0
- package/dist/types/runtime/releases/retirement.d.ts +15 -0
- package/dist/types/runtime/releases/rpc-client.d.ts +52 -0
- package/dist/types/runtime/releases/rpc-main.d.ts +10 -0
- package/dist/types/runtime/releases/rpc-protocol.d.ts +1139 -0
- package/dist/types/runtime/workspace/artifacts.d.ts +30 -0
- package/dist/types/runtime/workspace/authority.d.ts +338 -0
- package/dist/types/runtime/workspace/contracts.d.ts +86 -0
- package/dist/types/runtime/workspace/file-write.d.ts +14 -0
- package/dist/types/runtime/workspace/files.d.ts +21 -0
- package/dist/types/runtime/workspace/http-body.d.ts +9 -0
- package/dist/types/runtime/workspace/storage-client.d.ts +23 -0
- package/dist/types/runtime/workspace/storage-wire.d.ts +138 -0
- package/package.json +8 -6
- package/dist/cjs/atomic-rename.cjs +0 -303
- package/dist/cjs/browser-upload.cjs +0 -73
- package/dist/cjs/cli-update.cjs +0 -108
- package/dist/cjs/command-launcher.cjs +0 -423
- package/dist/cjs/control-command-policy.cjs +0 -177
- package/dist/cjs/git-blob-hash.cjs +0 -41
- package/dist/cjs/git-identity.cjs +0 -39
- package/dist/cjs/git-process-environment.cjs +0 -133
- package/dist/cjs/inline-output.cjs +0 -62
- package/dist/cjs/main.cjs +0 -7517
- package/dist/cjs/managed-paths.cjs +0 -215
- package/dist/cjs/plan-lint.cjs +0 -165
- package/dist/cjs/plan-parser.cjs +0 -127
- package/dist/cjs/plan-paths.cjs +0 -53
- package/dist/cjs/port-forward-client.cjs +0 -206
- package/dist/cjs/process-tree.cjs +0 -117
- package/dist/cjs/project-checkout-garbage.cjs +0 -219
- package/dist/cjs/project-mirror-fetch-policy.cjs +0 -82
- package/dist/cjs/project-mirror-refs-token.cjs +0 -85
- package/dist/cjs/project-workspace-state.cjs +0 -972
- package/dist/cjs/project-worktrees.cjs +0 -1713
- package/dist/cjs/pty-output-coalescer.cjs +0 -87
- package/dist/cjs/recovery-journal-protocol.cjs +0 -56
- package/dist/cjs/recovery-journal-runtime.cjs +0 -133
- package/dist/cjs/recovery-journal-thread.cjs +0 -9
- package/dist/cjs/recovery-journal.cjs +0 -742
- package/dist/cjs/recovery-output-window.cjs +0 -77
- package/dist/cjs/recovery-protocol.cjs +0 -31
- package/dist/cjs/recovery-store.cjs +0 -252
- package/dist/cjs/registry-auth.cjs +0 -310
- package/dist/cjs/repository-transition-policy.cjs +0 -49
- package/dist/cjs/runtime-version.cjs +0 -88
- package/dist/cjs/session-file-mutations.cjs +0 -61
- package/dist/cjs/supervisor.cjs +0 -147
- package/dist/cjs/three-way-merge.cjs +0 -346
- package/dist/cjs/working-tree-mirror.cjs +0 -1872
- package/dist/cjs/workspace-automatic-sync-policy.cjs +0 -79
- package/dist/cjs/workspace-branch-incarnation-policy.cjs +0 -37
- package/dist/cjs/workspace-command-sync-policy.cjs +0 -112
- package/dist/cjs/workspace-command-targets.cjs +0 -63
- package/dist/cjs/workspace-filesystem-executor-thread.cjs +0 -36
- package/dist/cjs/workspace-filesystem-executor.cjs +0 -327
- package/dist/cjs/workspace-filesystem-job-types.cjs +0 -144
- package/dist/cjs/workspace-filesystem-jobs.cjs +0 -59
- package/dist/cjs/workspace-git-sync.cjs +0 -3595
- package/dist/cjs/workspace-hydration-ledger.cjs +0 -83
- package/dist/cjs/workspace-hydration-merge.cjs +0 -448
- package/dist/cjs/workspace-hydration-recovery-state.cjs +0 -53
- package/dist/cjs/workspace-incident-state.cjs +0 -37
- package/dist/cjs/workspace-merge-projection.cjs +0 -628
- package/dist/cjs/workspace-mount-boundary.cjs +0 -71
- package/dist/cjs/workspace-mount-hold-fence.cjs +0 -120
- package/dist/cjs/workspace-mutation-gate.cjs +0 -127
- package/dist/cjs/workspace-path-move.cjs +0 -195
- package/dist/cjs/workspace-preserve-only-policy.cjs +0 -36
- package/dist/cjs/workspace-project-config-policy.cjs +0 -53
- package/dist/cjs/workspace-projection-ledger.cjs +0 -81
- package/dist/cjs/workspace-publication-evidence.cjs +0 -46
- package/dist/cjs/workspace-sync-coalescer.cjs +0 -58
- package/dist/mjs/atomic-rename.mjs +0 -261
- package/dist/mjs/browser-upload.mjs +0 -42
- package/dist/mjs/command-launcher.mjs +0 -393
- package/dist/mjs/control-command-policy.mjs +0 -146
- package/dist/mjs/git-blob-hash.mjs +0 -16
- package/dist/mjs/git-identity.mjs +0 -15
- package/dist/mjs/git-process-environment.mjs +0 -105
- package/dist/mjs/inline-output.mjs +0 -37
- package/dist/mjs/managed-paths.mjs +0 -174
- package/dist/mjs/plan-lint.mjs +0 -129
- package/dist/mjs/plan-parser.mjs +0 -94
- package/dist/mjs/plan-paths.mjs +0 -25
- package/dist/mjs/port-forward-client.mjs +0 -172
- package/dist/mjs/project-checkout-garbage.mjs +0 -178
- package/dist/mjs/project-mirror-fetch-policy.mjs +0 -56
- package/dist/mjs/project-mirror-refs-token.mjs +0 -53
- package/dist/mjs/project-workspace-state.mjs +0 -937
- package/dist/mjs/project-worktrees.mjs +0 -1657
- package/dist/mjs/pty-output-coalescer.mjs +0 -61
- package/dist/mjs/recovery-journal-protocol.mjs +0 -30
- package/dist/mjs/recovery-journal-runtime.mjs +0 -112
- package/dist/mjs/recovery-journal-thread.mjs +0 -8
- package/dist/mjs/recovery-journal.mjs +0 -694
- package/dist/mjs/recovery-output-window.mjs +0 -53
- package/dist/mjs/recovery-protocol.mjs +0 -6
- package/dist/mjs/recovery-store.mjs +0 -217
- package/dist/mjs/registry-auth.mjs +0 -269
- package/dist/mjs/repository-transition-policy.mjs +0 -22
- package/dist/mjs/runtime-version.mjs +0 -54
- package/dist/mjs/session-file-mutations.mjs +0 -37
- package/dist/mjs/supervisor.mjs +0 -114
- package/dist/mjs/three-way-merge.mjs +0 -318
- package/dist/mjs/working-tree-mirror.mjs +0 -1817
- package/dist/mjs/workspace-automatic-sync-policy.mjs +0 -48
- package/dist/mjs/workspace-branch-incarnation-policy.mjs +0 -13
- package/dist/mjs/workspace-command-sync-policy.mjs +0 -84
- package/dist/mjs/workspace-command-targets.mjs +0 -37
- package/dist/mjs/workspace-filesystem-executor-thread.mjs +0 -38
- package/dist/mjs/workspace-filesystem-executor.mjs +0 -287
- package/dist/mjs/workspace-filesystem-job-types.mjs +0 -116
- package/dist/mjs/workspace-filesystem-jobs.mjs +0 -55
- package/dist/mjs/workspace-git-sync.mjs +0 -3553
- package/dist/mjs/workspace-hydration-ledger.mjs +0 -58
- package/dist/mjs/workspace-hydration-merge.mjs +0 -414
- package/dist/mjs/workspace-hydration-recovery-state.mjs +0 -29
- package/dist/mjs/workspace-incident-state.mjs +0 -12
- package/dist/mjs/workspace-merge-projection.mjs +0 -594
- package/dist/mjs/workspace-mount-boundary.mjs +0 -37
- package/dist/mjs/workspace-mount-hold-fence.mjs +0 -95
- package/dist/mjs/workspace-mutation-gate.mjs +0 -103
- package/dist/mjs/workspace-path-move.mjs +0 -160
- package/dist/mjs/workspace-preserve-only-policy.mjs +0 -11
- package/dist/mjs/workspace-project-config-policy.mjs +0 -27
- package/dist/mjs/workspace-projection-ledger.mjs +0 -57
- package/dist/mjs/workspace-publication-evidence.mjs +0 -21
- package/dist/mjs/workspace-sync-coalescer.mjs +0 -34
- package/dist/types/atomic-rename.d.ts +0 -78
- package/dist/types/browser-upload.d.ts +0 -7
- package/dist/types/command-launcher.d.ts +0 -104
- package/dist/types/control-command-policy.d.ts +0 -53
- package/dist/types/git-blob-hash.d.ts +0 -10
- package/dist/types/git-identity.d.ts +0 -9
- package/dist/types/git-process-environment.d.ts +0 -9
- package/dist/types/inline-output.d.ts +0 -3
- package/dist/types/managed-paths.d.ts +0 -19
- package/dist/types/plan-lint.d.ts +0 -16
- package/dist/types/plan-parser.d.ts +0 -38
- package/dist/types/plan-paths.d.ts +0 -36
- package/dist/types/port-forward-client.d.ts +0 -8
- package/dist/types/project-checkout-garbage.d.ts +0 -86
- package/dist/types/project-mirror-fetch-policy.d.ts +0 -84
- package/dist/types/project-mirror-refs-token.d.ts +0 -53
- package/dist/types/project-workspace-state.d.ts +0 -188
- package/dist/types/project-worktrees.d.ts +0 -397
- package/dist/types/pty-output-coalescer.d.ts +0 -20
- package/dist/types/recovery-journal-protocol.d.ts +0 -35
- package/dist/types/recovery-journal-runtime.d.ts +0 -12
- package/dist/types/recovery-journal-stall-fixture.d.ts +0 -1
- package/dist/types/recovery-journal-thread.d.ts +0 -1
- package/dist/types/recovery-journal.d.ts +0 -248
- package/dist/types/recovery-output-window.d.ts +0 -19
- package/dist/types/recovery-protocol.d.ts +0 -59
- package/dist/types/recovery-store.d.ts +0 -52
- package/dist/types/registry-auth.d.ts +0 -47
- package/dist/types/repository-transition-policy.d.ts +0 -26
- package/dist/types/runtime-version.d.ts +0 -1
- package/dist/types/session-file-mutations.d.ts +0 -22
- package/dist/types/supervisor-daemonized-fixture.d.ts +0 -1
- package/dist/types/supervisor-launcher-cleanup-fixture.d.ts +0 -1
- package/dist/types/supervisor-signal-fixture.d.ts +0 -1
- package/dist/types/supervisor.d.ts +0 -23
- package/dist/types/three-way-merge.d.ts +0 -77
- package/dist/types/working-tree-mirror.d.ts +0 -424
- package/dist/types/workspace-automatic-sync-policy.d.ts +0 -57
- package/dist/types/workspace-branch-incarnation-policy.d.ts +0 -14
- package/dist/types/workspace-command-sync-policy.d.ts +0 -57
- package/dist/types/workspace-command-targets.d.ts +0 -37
- package/dist/types/workspace-filesystem-executor-thread.d.ts +0 -1
- package/dist/types/workspace-filesystem-executor.d.ts +0 -123
- package/dist/types/workspace-filesystem-job-types.d.ts +0 -302
- package/dist/types/workspace-filesystem-jobs.d.ts +0 -7
- package/dist/types/workspace-git-sync.d.ts +0 -514
- package/dist/types/workspace-hydration-ledger.d.ts +0 -76
- package/dist/types/workspace-hydration-merge.d.ts +0 -103
- package/dist/types/workspace-hydration-recovery-state.d.ts +0 -10
- package/dist/types/workspace-incident-state.d.ts +0 -19
- package/dist/types/workspace-merge-projection.d.ts +0 -69
- package/dist/types/workspace-mount-boundary.d.ts +0 -10
- package/dist/types/workspace-mount-hold-fence.d.ts +0 -42
- package/dist/types/workspace-mutation-gate.d.ts +0 -42
- package/dist/types/workspace-path-move.d.ts +0 -21
- package/dist/types/workspace-preserve-only-policy.d.ts +0 -15
- package/dist/types/workspace-project-config-policy.d.ts +0 -48
- package/dist/types/workspace-projection-ledger.d.ts +0 -59
- package/dist/types/workspace-publication-evidence.d.ts +0 -17
- package/dist/types/workspace-sync-coalescer.d.ts +0 -28
- /package/dist/types/{credential-authority-lock-fixture.d.ts → runtime/releases/main.d.ts} +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type PersonalQueuedAction = {
|
|
2
|
+
id: string;
|
|
3
|
+
requestHash: string;
|
|
4
|
+
request: {
|
|
5
|
+
kind?: string;
|
|
6
|
+
sessionId?: string;
|
|
7
|
+
command?: {
|
|
8
|
+
method?: string;
|
|
9
|
+
streamId?: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
/** Native receipts own effects. This only admits bounded independent transport
|
|
14
|
+
* lanes; mutations keep their original global order and each TCP stream is serial. */
|
|
15
|
+
export declare class PersonalActionScheduler {
|
|
16
|
+
private readonly execute;
|
|
17
|
+
private readonly failed;
|
|
18
|
+
private readonly limit;
|
|
19
|
+
private readonly active;
|
|
20
|
+
constructor(execute: (action: PersonalQueuedAction) => Promise<void>, failed: (error: unknown) => void, limit?: number);
|
|
21
|
+
accept(actions: PersonalQueuedAction[]): void;
|
|
22
|
+
drain(): Promise<void>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type PersonalWorkerOptions = {
|
|
2
|
+
label: string;
|
|
3
|
+
baseUrl: string;
|
|
4
|
+
credential: string;
|
|
5
|
+
root: string;
|
|
6
|
+
cliEntrypoint?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function parsePersonalWorkerOptions(args: string[], environment?: Record<string, string | undefined>): PersonalWorkerOptions;
|
|
9
|
+
/** HTTP reconnects never replace the local source/PTY keeper. */
|
|
10
|
+
export declare function startPersonalWorker(options: PersonalWorkerOptions, version: string): Promise<{
|
|
11
|
+
resourceId: string;
|
|
12
|
+
root: string;
|
|
13
|
+
close(): Promise<void>;
|
|
14
|
+
}>;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { WorkspaceAuthority } from "../runtime/workspace/authority";
|
|
3
|
+
import { type StorageTransport } from "../runtime/workspace/storage-client";
|
|
4
|
+
export declare const PersonalWorkerGrant: z.ZodObject<{
|
|
5
|
+
installationId: z.ZodString;
|
|
6
|
+
userId: z.ZodString;
|
|
7
|
+
resourceId: z.ZodString;
|
|
8
|
+
instanceId: z.ZodString;
|
|
9
|
+
label: z.ZodOptional<z.ZodString>;
|
|
10
|
+
workerFence: z.ZodObject<{
|
|
11
|
+
installationId: z.ZodString;
|
|
12
|
+
resourceType: z.ZodString;
|
|
13
|
+
resourceId: z.ZodString;
|
|
14
|
+
ownerId: z.ZodString;
|
|
15
|
+
epoch: z.ZodNumber;
|
|
16
|
+
}, z.core.$strict>;
|
|
17
|
+
workerHello: z.ZodObject<{
|
|
18
|
+
installationId: z.ZodString;
|
|
19
|
+
instanceId: z.ZodString;
|
|
20
|
+
releaseId: z.ZodString;
|
|
21
|
+
role: z.ZodEnum<{
|
|
22
|
+
web: "web";
|
|
23
|
+
scheduler: "scheduler";
|
|
24
|
+
runner: "runner";
|
|
25
|
+
gateway: "gateway";
|
|
26
|
+
"worker-adapter": "worker-adapter";
|
|
27
|
+
"browser-adapter": "browser-adapter";
|
|
28
|
+
executor: "executor";
|
|
29
|
+
keeper: "keeper";
|
|
30
|
+
storage: "storage";
|
|
31
|
+
}>;
|
|
32
|
+
protocol: z.ZodObject<{
|
|
33
|
+
min: z.ZodNumber;
|
|
34
|
+
max: z.ZodNumber;
|
|
35
|
+
}, z.core.$strict>;
|
|
36
|
+
capabilities: z.ZodArray<z.ZodString>;
|
|
37
|
+
}, z.core.$strict>;
|
|
38
|
+
leaseExpiresAt: z.ZodCoercedNumber<unknown>;
|
|
39
|
+
}, z.core.$loose>;
|
|
40
|
+
export declare const PersonalWorkspaceRequest: z.ZodObject<{
|
|
41
|
+
protocol: z.ZodLiteral<1>;
|
|
42
|
+
userId: z.ZodString;
|
|
43
|
+
sessionId: z.ZodString;
|
|
44
|
+
workbench: z.ZodObject<{
|
|
45
|
+
id: z.ZodString;
|
|
46
|
+
repositoryId: z.ZodString;
|
|
47
|
+
branch: z.ZodString;
|
|
48
|
+
sessionId: z.ZodString;
|
|
49
|
+
sharedSessionId: z.ZodOptional<z.ZodString>;
|
|
50
|
+
}, z.core.$strict>;
|
|
51
|
+
sourceWorkbench: z.ZodOptional<z.ZodObject<{
|
|
52
|
+
id: z.ZodString;
|
|
53
|
+
repositoryId: z.ZodString;
|
|
54
|
+
branch: z.ZodString;
|
|
55
|
+
sessionId: z.ZodString;
|
|
56
|
+
sharedSessionId: z.ZodOptional<z.ZodString>;
|
|
57
|
+
}, z.core.$strict>>;
|
|
58
|
+
sharedWorkbenches: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
59
|
+
id: z.ZodString;
|
|
60
|
+
repositoryId: z.ZodString;
|
|
61
|
+
branch: z.ZodString;
|
|
62
|
+
sessionId: z.ZodString;
|
|
63
|
+
sharedSessionId: z.ZodOptional<z.ZodString>;
|
|
64
|
+
}, z.core.$strict>>>;
|
|
65
|
+
kind: z.ZodEnum<{
|
|
66
|
+
inspect: "inspect";
|
|
67
|
+
terminal: "terminal";
|
|
68
|
+
product: "product";
|
|
69
|
+
agent: "agent";
|
|
70
|
+
tcp: "tcp";
|
|
71
|
+
}>;
|
|
72
|
+
command: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
73
|
+
credentials: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
74
|
+
id: z.ZodString;
|
|
75
|
+
installationId: z.ZodString;
|
|
76
|
+
userId: z.ZodString;
|
|
77
|
+
generation: z.ZodNumber;
|
|
78
|
+
env: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
79
|
+
files: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
80
|
+
}, z.core.$strict>>>;
|
|
81
|
+
}, z.core.$strict>;
|
|
82
|
+
export type PersonalWorkerRuntime = Awaited<ReturnType<typeof openPersonalWorkerRuntime>>;
|
|
83
|
+
/** The host owns this keeper independently of every replaceable remote web/gateway generation. */
|
|
84
|
+
export declare function openPersonalWorkerRuntime(options: {
|
|
85
|
+
root: string;
|
|
86
|
+
grant: z.infer<typeof PersonalWorkerGrant>;
|
|
87
|
+
storage: (sessionId: string) => StorageTransport;
|
|
88
|
+
cliEntrypoint?: string;
|
|
89
|
+
}): Promise<{
|
|
90
|
+
grant: {
|
|
91
|
+
[x: string]: unknown;
|
|
92
|
+
installationId: string;
|
|
93
|
+
userId: string;
|
|
94
|
+
resourceId: string;
|
|
95
|
+
instanceId: string;
|
|
96
|
+
workerFence: {
|
|
97
|
+
installationId: string;
|
|
98
|
+
resourceType: string;
|
|
99
|
+
resourceId: string;
|
|
100
|
+
ownerId: string;
|
|
101
|
+
epoch: number;
|
|
102
|
+
};
|
|
103
|
+
workerHello: {
|
|
104
|
+
installationId: string;
|
|
105
|
+
instanceId: string;
|
|
106
|
+
releaseId: string;
|
|
107
|
+
role: "web" | "scheduler" | "runner" | "gateway" | "worker-adapter" | "browser-adapter" | "executor" | "keeper" | "storage";
|
|
108
|
+
protocol: {
|
|
109
|
+
min: number;
|
|
110
|
+
max: number;
|
|
111
|
+
};
|
|
112
|
+
capabilities: string[];
|
|
113
|
+
};
|
|
114
|
+
leaseExpiresAt: number;
|
|
115
|
+
label?: string | undefined;
|
|
116
|
+
};
|
|
117
|
+
renew: (value: unknown) => Promise<void>;
|
|
118
|
+
dispatch: (raw: unknown) => Promise<any>;
|
|
119
|
+
authority: WorkspaceAuthority;
|
|
120
|
+
close(): Promise<void>;
|
|
121
|
+
}>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare class PersonalTcpError extends Error {
|
|
2
|
+
readonly code: string;
|
|
3
|
+
constructor(code: string);
|
|
4
|
+
}
|
|
5
|
+
/** The local worker owns sockets; replaceable web processes relay immutable bytes only. */
|
|
6
|
+
export declare class PersonalTcpManager {
|
|
7
|
+
private readonly authorizeConnect?;
|
|
8
|
+
private readonly db;
|
|
9
|
+
private readonly sockets;
|
|
10
|
+
constructor(directory: string, authorizeConnect?: ((sessionId: string, port: number) => Promise<void>) | undefined);
|
|
11
|
+
private stream;
|
|
12
|
+
dispatch(sessionId: string, raw: unknown): Promise<Record<string, unknown>>;
|
|
13
|
+
close(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { OperationEnvelope, OwnershipFence } from "@ricsam/r5d-api/runtime-protocol";
|
|
2
|
-
import { AdapterConfig, type ActionReceipt, type ExecutorCommand, type PollResult, type RunIdentity, type RunReceipt } from "./protocol";
|
|
2
|
+
import { AdapterConfig, type ActionReceipt, type AdapterGrant, type AdapterRegistration, type ExecutorCommand, type PollResult, type RunIdentity, type RunReceipt } from "./protocol";
|
|
3
3
|
/** Stateless one-request connections: disconnect/timeout never implies the operation did not happen. */
|
|
4
4
|
export declare class HostExecutorClient {
|
|
5
5
|
readonly config: ReturnType<typeof AdapterConfig.parse>;
|
|
6
6
|
constructor(config: AdapterConfig);
|
|
7
7
|
request<T = unknown>(command: ExecutorCommand): Promise<T>;
|
|
8
8
|
status(): Promise<unknown>;
|
|
9
|
+
registerAdapter(grant: AdapterGrant): Promise<AdapterRegistration>;
|
|
10
|
+
retireAdapter(principalId: string): Promise<AdapterRegistration>;
|
|
9
11
|
setAuthority(fence: OwnershipFence, validUntil: number): Promise<unknown>;
|
|
10
12
|
start(operation: OperationEnvelope): Promise<RunReceipt>;
|
|
11
13
|
poll(run: RunIdentity, stdoutOffset?: number, stderrOffset?: number, maxBytes?: number): Promise<PollResult>;
|
|
@@ -8,6 +8,7 @@ export declare class HostExecutor {
|
|
|
8
8
|
private readonly nativePty?;
|
|
9
9
|
readonly config: ResolvedConfig;
|
|
10
10
|
readonly store: ExecutorStore;
|
|
11
|
+
private readonly adapters;
|
|
11
12
|
readonly hello: RuntimeHello;
|
|
12
13
|
private readonly active;
|
|
13
14
|
private readonly leaseTimer;
|
|
@@ -15,12 +16,16 @@ export declare class HostExecutor {
|
|
|
15
16
|
private poisoned;
|
|
16
17
|
private serial;
|
|
17
18
|
constructor(config: ExecutorConfig, nativePty?: PtyModule | undefined);
|
|
18
|
-
/**
|
|
19
|
+
/** Authority is synchronous and authenticated; never queue lease renewal behind a blocked OS write.
|
|
20
|
+
* Resource commands retain one ordered admission/action boundary. Commands already admitted may
|
|
21
|
+
* complete after promotion; queued commands and yielded admission hashes must recheck the fence.
|
|
22
|
+
*/
|
|
19
23
|
handle(input: unknown): Promise<unknown>;
|
|
20
24
|
private authenticate;
|
|
21
25
|
private authority;
|
|
22
26
|
private workerFence;
|
|
23
27
|
private authorize;
|
|
28
|
+
private authorizeAdmission;
|
|
24
29
|
private receipt;
|
|
25
30
|
private dispatch;
|
|
26
31
|
private output;
|
|
@@ -2,18 +2,18 @@ import { z } from "zod";
|
|
|
2
2
|
export declare const EXECUTOR_CAPABILITY = "host-executor-v1";
|
|
3
3
|
export declare const MAX_FRAME_BYTES: number;
|
|
4
4
|
export declare const Lane: z.ZodEnum<{
|
|
5
|
-
control: "control";
|
|
6
5
|
general: "general";
|
|
7
6
|
utility: "utility";
|
|
7
|
+
control: "control";
|
|
8
8
|
}>;
|
|
9
9
|
export declare const ShellPayload: z.ZodObject<{
|
|
10
10
|
argv: z.ZodArray<z.ZodString>;
|
|
11
11
|
cwd: z.ZodString;
|
|
12
12
|
env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
13
13
|
lane: z.ZodDefault<z.ZodEnum<{
|
|
14
|
-
control: "control";
|
|
15
14
|
general: "general";
|
|
16
15
|
utility: "utility";
|
|
16
|
+
control: "control";
|
|
17
17
|
}>>;
|
|
18
18
|
interactive: z.ZodDefault<z.ZodBoolean>;
|
|
19
19
|
pty: z.ZodOptional<z.ZodObject<{
|
|
@@ -40,7 +40,119 @@ export declare const RunIdentity: z.ZodObject<{
|
|
|
40
40
|
}, z.core.$strict>;
|
|
41
41
|
}, z.core.$strict>;
|
|
42
42
|
export type RunIdentity = z.infer<typeof RunIdentity>;
|
|
43
|
+
export declare const Principal: z.ZodObject<{
|
|
44
|
+
id: z.ZodString;
|
|
45
|
+
tokenHash: z.ZodString;
|
|
46
|
+
role: z.ZodEnum<{
|
|
47
|
+
controller: "controller";
|
|
48
|
+
adapter: "adapter";
|
|
49
|
+
}>;
|
|
50
|
+
ownerId: z.ZodString;
|
|
51
|
+
userIds: z.ZodArray<z.ZodString>;
|
|
52
|
+
cwdRoots: z.ZodArray<z.ZodString>;
|
|
53
|
+
lanes: z.ZodArray<z.ZodEnum<{
|
|
54
|
+
general: "general";
|
|
55
|
+
utility: "utility";
|
|
56
|
+
control: "control";
|
|
57
|
+
}>>;
|
|
58
|
+
credentialIds: z.ZodArray<z.ZodString>;
|
|
59
|
+
}, z.core.$strict>;
|
|
60
|
+
/** Only an authenticated controller may install this immutable generation grant. */
|
|
61
|
+
export declare const AdapterGrant: z.ZodObject<{
|
|
62
|
+
installationId: z.ZodString;
|
|
63
|
+
workerId: z.ZodString;
|
|
64
|
+
principal: z.ZodObject<{
|
|
65
|
+
id: z.ZodString;
|
|
66
|
+
tokenHash: z.ZodString;
|
|
67
|
+
ownerId: z.ZodString;
|
|
68
|
+
userIds: z.ZodArray<z.ZodString>;
|
|
69
|
+
cwdRoots: z.ZodArray<z.ZodString>;
|
|
70
|
+
lanes: z.ZodArray<z.ZodEnum<{
|
|
71
|
+
general: "general";
|
|
72
|
+
utility: "utility";
|
|
73
|
+
control: "control";
|
|
74
|
+
}>>;
|
|
75
|
+
credentialIds: z.ZodArray<z.ZodString>;
|
|
76
|
+
role: z.ZodLiteral<"adapter">;
|
|
77
|
+
}, z.core.$strict>;
|
|
78
|
+
hello: z.ZodObject<{
|
|
79
|
+
installationId: z.ZodString;
|
|
80
|
+
instanceId: z.ZodString;
|
|
81
|
+
releaseId: z.ZodString;
|
|
82
|
+
role: z.ZodEnum<{
|
|
83
|
+
web: "web";
|
|
84
|
+
scheduler: "scheduler";
|
|
85
|
+
runner: "runner";
|
|
86
|
+
gateway: "gateway";
|
|
87
|
+
"worker-adapter": "worker-adapter";
|
|
88
|
+
"browser-adapter": "browser-adapter";
|
|
89
|
+
executor: "executor";
|
|
90
|
+
keeper: "keeper";
|
|
91
|
+
storage: "storage";
|
|
92
|
+
}>;
|
|
93
|
+
protocol: z.ZodObject<{
|
|
94
|
+
min: z.ZodNumber;
|
|
95
|
+
max: z.ZodNumber;
|
|
96
|
+
}, z.core.$strict>;
|
|
97
|
+
capabilities: z.ZodArray<z.ZodString>;
|
|
98
|
+
}, z.core.$strict>;
|
|
99
|
+
artifactDigest: z.ZodString;
|
|
100
|
+
}, z.core.$strict>;
|
|
101
|
+
export type AdapterGrant = z.infer<typeof AdapterGrant>;
|
|
102
|
+
export type AdapterRegistration = {
|
|
103
|
+
principalId: string;
|
|
104
|
+
ownerId: string;
|
|
105
|
+
releaseId: string;
|
|
106
|
+
artifactDigest: string;
|
|
107
|
+
grantDigest: string;
|
|
108
|
+
state: "registered" | "retired";
|
|
109
|
+
};
|
|
43
110
|
export declare const ExecutorCommand: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
111
|
+
method: z.ZodLiteral<"adapter.register">;
|
|
112
|
+
grant: z.ZodObject<{
|
|
113
|
+
installationId: z.ZodString;
|
|
114
|
+
workerId: z.ZodString;
|
|
115
|
+
principal: z.ZodObject<{
|
|
116
|
+
id: z.ZodString;
|
|
117
|
+
tokenHash: z.ZodString;
|
|
118
|
+
ownerId: z.ZodString;
|
|
119
|
+
userIds: z.ZodArray<z.ZodString>;
|
|
120
|
+
cwdRoots: z.ZodArray<z.ZodString>;
|
|
121
|
+
lanes: z.ZodArray<z.ZodEnum<{
|
|
122
|
+
general: "general";
|
|
123
|
+
utility: "utility";
|
|
124
|
+
control: "control";
|
|
125
|
+
}>>;
|
|
126
|
+
credentialIds: z.ZodArray<z.ZodString>;
|
|
127
|
+
role: z.ZodLiteral<"adapter">;
|
|
128
|
+
}, z.core.$strict>;
|
|
129
|
+
hello: z.ZodObject<{
|
|
130
|
+
installationId: z.ZodString;
|
|
131
|
+
instanceId: z.ZodString;
|
|
132
|
+
releaseId: z.ZodString;
|
|
133
|
+
role: z.ZodEnum<{
|
|
134
|
+
web: "web";
|
|
135
|
+
scheduler: "scheduler";
|
|
136
|
+
runner: "runner";
|
|
137
|
+
gateway: "gateway";
|
|
138
|
+
"worker-adapter": "worker-adapter";
|
|
139
|
+
"browser-adapter": "browser-adapter";
|
|
140
|
+
executor: "executor";
|
|
141
|
+
keeper: "keeper";
|
|
142
|
+
storage: "storage";
|
|
143
|
+
}>;
|
|
144
|
+
protocol: z.ZodObject<{
|
|
145
|
+
min: z.ZodNumber;
|
|
146
|
+
max: z.ZodNumber;
|
|
147
|
+
}, z.core.$strict>;
|
|
148
|
+
capabilities: z.ZodArray<z.ZodString>;
|
|
149
|
+
}, z.core.$strict>;
|
|
150
|
+
artifactDigest: z.ZodString;
|
|
151
|
+
}, z.core.$strict>;
|
|
152
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
153
|
+
method: z.ZodLiteral<"adapter.retire">;
|
|
154
|
+
principalId: z.ZodString;
|
|
155
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
44
156
|
method: z.ZodLiteral<"status">;
|
|
45
157
|
}, z.core.$strict>, z.ZodObject<{
|
|
46
158
|
method: z.ZodLiteral<"authority">;
|
|
@@ -167,6 +279,51 @@ export declare const ExecutorRequest: z.ZodObject<{
|
|
|
167
279
|
capabilities: z.ZodArray<z.ZodString>;
|
|
168
280
|
}, z.core.$strict>;
|
|
169
281
|
command: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
282
|
+
method: z.ZodLiteral<"adapter.register">;
|
|
283
|
+
grant: z.ZodObject<{
|
|
284
|
+
installationId: z.ZodString;
|
|
285
|
+
workerId: z.ZodString;
|
|
286
|
+
principal: z.ZodObject<{
|
|
287
|
+
id: z.ZodString;
|
|
288
|
+
tokenHash: z.ZodString;
|
|
289
|
+
ownerId: z.ZodString;
|
|
290
|
+
userIds: z.ZodArray<z.ZodString>;
|
|
291
|
+
cwdRoots: z.ZodArray<z.ZodString>;
|
|
292
|
+
lanes: z.ZodArray<z.ZodEnum<{
|
|
293
|
+
general: "general";
|
|
294
|
+
utility: "utility";
|
|
295
|
+
control: "control";
|
|
296
|
+
}>>;
|
|
297
|
+
credentialIds: z.ZodArray<z.ZodString>;
|
|
298
|
+
role: z.ZodLiteral<"adapter">;
|
|
299
|
+
}, z.core.$strict>;
|
|
300
|
+
hello: z.ZodObject<{
|
|
301
|
+
installationId: z.ZodString;
|
|
302
|
+
instanceId: z.ZodString;
|
|
303
|
+
releaseId: z.ZodString;
|
|
304
|
+
role: z.ZodEnum<{
|
|
305
|
+
web: "web";
|
|
306
|
+
scheduler: "scheduler";
|
|
307
|
+
runner: "runner";
|
|
308
|
+
gateway: "gateway";
|
|
309
|
+
"worker-adapter": "worker-adapter";
|
|
310
|
+
"browser-adapter": "browser-adapter";
|
|
311
|
+
executor: "executor";
|
|
312
|
+
keeper: "keeper";
|
|
313
|
+
storage: "storage";
|
|
314
|
+
}>;
|
|
315
|
+
protocol: z.ZodObject<{
|
|
316
|
+
min: z.ZodNumber;
|
|
317
|
+
max: z.ZodNumber;
|
|
318
|
+
}, z.core.$strict>;
|
|
319
|
+
capabilities: z.ZodArray<z.ZodString>;
|
|
320
|
+
}, z.core.$strict>;
|
|
321
|
+
artifactDigest: z.ZodString;
|
|
322
|
+
}, z.core.$strict>;
|
|
323
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
324
|
+
method: z.ZodLiteral<"adapter.retire">;
|
|
325
|
+
principalId: z.ZodString;
|
|
326
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
170
327
|
method: z.ZodLiteral<"status">;
|
|
171
328
|
}, z.core.$strict>, z.ZodObject<{
|
|
172
329
|
method: z.ZodLiteral<"authority">;
|
|
@@ -264,12 +421,21 @@ export declare const ExecutorRequest: z.ZodObject<{
|
|
|
264
421
|
actionId: z.ZodString;
|
|
265
422
|
}, z.core.$strict>], "method">;
|
|
266
423
|
}, z.core.$strict>;
|
|
424
|
+
export declare const ExecutorCredential: z.ZodObject<{
|
|
425
|
+
id: z.ZodString;
|
|
426
|
+
installationId: z.ZodString;
|
|
427
|
+
userId: z.ZodString;
|
|
428
|
+
generation: z.ZodNumber;
|
|
429
|
+
env: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
430
|
+
files: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
431
|
+
}, z.core.$strict>;
|
|
267
432
|
export declare const ExecutorConfig: z.ZodObject<{
|
|
268
433
|
installationId: z.ZodString;
|
|
269
434
|
workerId: z.ZodString;
|
|
270
435
|
instanceId: z.ZodString;
|
|
271
436
|
releaseId: z.ZodString;
|
|
272
437
|
stateDir: z.ZodString;
|
|
438
|
+
productCredentialDirectory: z.ZodOptional<z.ZodString>;
|
|
273
439
|
capacity: z.ZodObject<{
|
|
274
440
|
general: z.ZodNumber;
|
|
275
441
|
utility: z.ZodNumber;
|
|
@@ -289,9 +455,9 @@ export declare const ExecutorConfig: z.ZodObject<{
|
|
|
289
455
|
userIds: z.ZodArray<z.ZodString>;
|
|
290
456
|
cwdRoots: z.ZodArray<z.ZodString>;
|
|
291
457
|
lanes: z.ZodArray<z.ZodEnum<{
|
|
292
|
-
control: "control";
|
|
293
458
|
general: "general";
|
|
294
459
|
utility: "utility";
|
|
460
|
+
control: "control";
|
|
295
461
|
}>>;
|
|
296
462
|
credentialIds: z.ZodArray<z.ZodString>;
|
|
297
463
|
}, z.core.$strict>>;
|
|
@@ -368,5 +534,11 @@ export type PollResult = {
|
|
|
368
534
|
};
|
|
369
535
|
export declare class ExecutorError extends Error {
|
|
370
536
|
readonly code: string;
|
|
371
|
-
|
|
537
|
+
/** Authenticated start rejection only: stale_fence may retry same ID; capacity_busy must not auto-retry. */
|
|
538
|
+
readonly rejectedBeforeAdmission: boolean;
|
|
539
|
+
constructor(code: string, message?: string,
|
|
540
|
+
/** Authenticated start rejection only: stale_fence may retry same ID; capacity_busy must not auto-retry. */
|
|
541
|
+
rejectedBeforeAdmission?: boolean);
|
|
372
542
|
}
|
|
543
|
+
export declare function isStartNonAdmissionCode(code: unknown): code is "stale_fence" | "capacity_busy";
|
|
544
|
+
export declare function isDefiniteStartRejection(error: unknown): error is ExecutorError;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const AdapterManifest: z.ZodObject<{
|
|
3
|
+
version: z.ZodLiteral<1>;
|
|
4
|
+
installationId: z.ZodString;
|
|
5
|
+
workerId: z.ZodString;
|
|
6
|
+
hello: z.ZodObject<{
|
|
7
|
+
installationId: z.ZodString;
|
|
8
|
+
instanceId: z.ZodString;
|
|
9
|
+
releaseId: z.ZodString;
|
|
10
|
+
role: z.ZodEnum<{
|
|
11
|
+
web: "web";
|
|
12
|
+
scheduler: "scheduler";
|
|
13
|
+
runner: "runner";
|
|
14
|
+
gateway: "gateway";
|
|
15
|
+
"worker-adapter": "worker-adapter";
|
|
16
|
+
"browser-adapter": "browser-adapter";
|
|
17
|
+
executor: "executor";
|
|
18
|
+
keeper: "keeper";
|
|
19
|
+
storage: "storage";
|
|
20
|
+
}>;
|
|
21
|
+
protocol: z.ZodObject<{
|
|
22
|
+
min: z.ZodNumber;
|
|
23
|
+
max: z.ZodNumber;
|
|
24
|
+
}, z.core.$strict>;
|
|
25
|
+
capabilities: z.ZodArray<z.ZodString>;
|
|
26
|
+
}, z.core.$strict>;
|
|
27
|
+
entrypoint: z.ZodString;
|
|
28
|
+
files: z.ZodArray<z.ZodObject<{
|
|
29
|
+
path: z.ZodString;
|
|
30
|
+
sha256: z.ZodString;
|
|
31
|
+
size: z.ZodNumber;
|
|
32
|
+
executable: z.ZodBoolean;
|
|
33
|
+
}, z.core.$strict>>;
|
|
34
|
+
}, z.core.$strict>;
|
|
35
|
+
export type AdapterManifest = z.infer<typeof AdapterManifest>;
|
|
36
|
+
export declare const bytesHash: (bytes: Uint8Array) => string;
|
|
37
|
+
export declare function within(root: string, path: string): boolean;
|
|
38
|
+
/** Check every ancestor, not just a leaf. World-writable sticky /tmp is allowed, symlink ancestors are not. */
|
|
39
|
+
export declare function canonicalDirectory(path: string): string;
|
|
40
|
+
export declare function outsideWorkspaces(path: string, workspaceRoots: string[]): void;
|
|
41
|
+
/** No network, package manager, archive extraction, shell commands or in-place overwrite. */
|
|
42
|
+
export declare class ImmutableAdapterArtifacts {
|
|
43
|
+
readonly root: string;
|
|
44
|
+
private readonly installationId;
|
|
45
|
+
private readonly workerId;
|
|
46
|
+
private readonly workspaceRoots;
|
|
47
|
+
constructor(root: string, installationId: string, workerId: string, workspaceRoots: string[]);
|
|
48
|
+
private approved;
|
|
49
|
+
stage(source: string, input: AdapterManifest, approvalDigest: string): string;
|
|
50
|
+
verify(input: AdapterManifest, approvalDigest: string): string;
|
|
51
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Database } from "bun:sqlite";
|
|
2
|
+
import { type RuntimeHello } from "@ricsam/r5d-api/runtime-protocol";
|
|
3
|
+
import { AdapterGrant, type AdapterRegistration, type Principal, type ResolvedConfig } from "../protocol";
|
|
4
|
+
export declare const digest: (value: unknown) => string;
|
|
5
|
+
/** Keeper-owned registry. Durable tombstones prevent token/owner/release rebinding after retirement. */
|
|
6
|
+
export declare class AdapterGrantRegistry {
|
|
7
|
+
private readonly db;
|
|
8
|
+
private readonly config;
|
|
9
|
+
constructor(db: Database, config: ResolvedConfig);
|
|
10
|
+
private rows;
|
|
11
|
+
find(id: string): AdapterGrant | undefined;
|
|
12
|
+
hasOwner(owner: string): boolean;
|
|
13
|
+
list(): AdapterRegistration[];
|
|
14
|
+
register(controller: Principal, input: AdapterGrant, keeperHello: RuntimeHello): AdapterRegistration;
|
|
15
|
+
retire(controller: Principal, id: string, authoritativeOwner?: string): AdapterRegistration;
|
|
16
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { OwnershipFence, RuntimeHello } from "@ricsam/r5d-api/runtime-protocol";
|
|
3
|
+
import { HostExecutorClient } from "../client";
|
|
4
|
+
import { AdapterConfig, AdapterGrant, ExecutorCommand, type AdapterRegistration } from "../protocol";
|
|
5
|
+
import { AdapterManifest, ImmutableAdapterArtifacts } from "./artifacts";
|
|
6
|
+
import { AdapterRetirementCompletion } from "./retirement";
|
|
7
|
+
import type { DeliveryReceipt } from "./rpc-protocol";
|
|
8
|
+
export declare const ReleaseManagerConfig: z.ZodObject<{
|
|
9
|
+
installationId: z.ZodString;
|
|
10
|
+
workerId: z.ZodString;
|
|
11
|
+
stateDir: z.ZodString;
|
|
12
|
+
artifactsDir: z.ZodString;
|
|
13
|
+
workspaceRoots: z.ZodArray<z.ZodString>;
|
|
14
|
+
runtimePath: z.ZodString;
|
|
15
|
+
runtimeSha256: z.ZodString;
|
|
16
|
+
controller: z.ZodObject<{
|
|
17
|
+
socketPath: z.ZodString;
|
|
18
|
+
principalId: z.ZodString;
|
|
19
|
+
token: z.ZodString;
|
|
20
|
+
hello: z.ZodObject<{
|
|
21
|
+
installationId: z.ZodString;
|
|
22
|
+
instanceId: z.ZodString;
|
|
23
|
+
releaseId: z.ZodString;
|
|
24
|
+
role: z.ZodEnum<{
|
|
25
|
+
web: "web";
|
|
26
|
+
scheduler: "scheduler";
|
|
27
|
+
runner: "runner";
|
|
28
|
+
gateway: "gateway";
|
|
29
|
+
"worker-adapter": "worker-adapter";
|
|
30
|
+
"browser-adapter": "browser-adapter";
|
|
31
|
+
executor: "executor";
|
|
32
|
+
keeper: "keeper";
|
|
33
|
+
storage: "storage";
|
|
34
|
+
}>;
|
|
35
|
+
protocol: z.ZodObject<{
|
|
36
|
+
min: z.ZodNumber;
|
|
37
|
+
max: z.ZodNumber;
|
|
38
|
+
}, z.core.$strict>;
|
|
39
|
+
capabilities: z.ZodArray<z.ZodString>;
|
|
40
|
+
}, z.core.$strict>;
|
|
41
|
+
timeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
42
|
+
}, z.core.$strict>;
|
|
43
|
+
}, z.core.$strict>;
|
|
44
|
+
export type ReleaseManagerConfig = z.input<typeof ReleaseManagerConfig>;
|
|
45
|
+
export type ReleaseRecord = {
|
|
46
|
+
principalId: string;
|
|
47
|
+
manifest: AdapterManifest;
|
|
48
|
+
artifactDigest: string;
|
|
49
|
+
grant: AdapterGrant;
|
|
50
|
+
phase: "staged" | "ready" | "active" | "retained" | "retired";
|
|
51
|
+
retirementCompletion?: AdapterRetirementCompletion;
|
|
52
|
+
};
|
|
53
|
+
type KeeperStatus = {
|
|
54
|
+
hello: RuntimeHello;
|
|
55
|
+
workerId: string;
|
|
56
|
+
authority: {
|
|
57
|
+
fence: OwnershipFence;
|
|
58
|
+
validUntil: number;
|
|
59
|
+
} | null;
|
|
60
|
+
degraded: boolean;
|
|
61
|
+
adapters: AdapterRegistration[];
|
|
62
|
+
};
|
|
63
|
+
type Call = {
|
|
64
|
+
id: string;
|
|
65
|
+
principal: string;
|
|
66
|
+
hash: string;
|
|
67
|
+
state: "pending" | "completed" | "unknown";
|
|
68
|
+
acknowledged: number;
|
|
69
|
+
};
|
|
70
|
+
/** Local installation agent, independently supervised from the keeper. Its controller token is never passed to adapters. */
|
|
71
|
+
export declare class WorkerAdapterReleases {
|
|
72
|
+
readonly invocation: `${string}-${string}-${string}-${string}-${string}`;
|
|
73
|
+
readonly config: z.output<typeof ReleaseManagerConfig>;
|
|
74
|
+
readonly artifacts: ImmutableAdapterArtifacts;
|
|
75
|
+
readonly controller: HostExecutorClient;
|
|
76
|
+
private readonly db;
|
|
77
|
+
private readonly lock;
|
|
78
|
+
private readonly ackKey;
|
|
79
|
+
private readonly children;
|
|
80
|
+
private readonly deliveries;
|
|
81
|
+
private probes;
|
|
82
|
+
private readonly retiring;
|
|
83
|
+
private serial;
|
|
84
|
+
private closing;
|
|
85
|
+
private closed?;
|
|
86
|
+
constructor(input: ReleaseManagerConfig);
|
|
87
|
+
private verifyRuntime;
|
|
88
|
+
private exclusive;
|
|
89
|
+
list(): ReleaseRecord[];
|
|
90
|
+
calls(): Call[];
|
|
91
|
+
transitions(): unknown[];
|
|
92
|
+
private get;
|
|
93
|
+
private put;
|
|
94
|
+
private configPath;
|
|
95
|
+
private keeper;
|
|
96
|
+
/** Approval digest must come from the authenticated release ledger, not the source directory itself. */
|
|
97
|
+
stage(input: {
|
|
98
|
+
source: string;
|
|
99
|
+
manifest: AdapterManifest;
|
|
100
|
+
approvalDigest: string;
|
|
101
|
+
grant: AdapterGrant;
|
|
102
|
+
adapter: AdapterConfig;
|
|
103
|
+
}): Promise<ReleaseRecord>;
|
|
104
|
+
launch(id: string): Promise<{
|
|
105
|
+
pid: number;
|
|
106
|
+
}>;
|
|
107
|
+
/** Fence/lease are the committed DB grant from the separately authenticated controller, not a locally invented epoch. */
|
|
108
|
+
promote(id: string, inputFence: OwnershipFence, validUntil: number): Promise<void>;
|
|
109
|
+
private recordAuthority;
|
|
110
|
+
/** Recovery reads the keeper, never replays a promotion or kills a remembered PID. */
|
|
111
|
+
reconcile(): Promise<KeeperStatus>;
|
|
112
|
+
bindRpcPrincipals(principals: unknown): void;
|
|
113
|
+
/** Actual child request, independent of the delivery/admin queues; never substitutes direct executor status. */
|
|
114
|
+
probe(id: string, hello: RuntimeHello): Promise<KeeperStatus & {
|
|
115
|
+
adapterPid: number;
|
|
116
|
+
}>;
|
|
117
|
+
delivery(callId: string): DeliveryReceipt | null;
|
|
118
|
+
private ackToken;
|
|
119
|
+
private saveDelivery;
|
|
120
|
+
/** Stable transport ID: persisted completed outcomes replay exactly; unknown never redispatches. */
|
|
121
|
+
deliver(callId: string, id: string, hello: RuntimeHello, requesterId: string, command: ExecutorCommand): Promise<DeliveryReceipt>;
|
|
122
|
+
observe(id: string, hello: RuntimeHello, requesterId: string, command: ExecutorCommand): Promise<DeliveryReceipt>;
|
|
123
|
+
private dispatchDelivery;
|
|
124
|
+
acknowledgeDelivery(callId: string, responseDigest: string, ackToken: string, requesterId: string): {
|
|
125
|
+
callId: string;
|
|
126
|
+
responseDigest: string;
|
|
127
|
+
acknowledged: true;
|
|
128
|
+
};
|
|
129
|
+
/** Admin-only attestation to independently durable reconciliation. Never replays or changes the unknown outcome. */
|
|
130
|
+
settleUnknownDelivery(callId: string, evidenceDigest: string): DeliveryReceipt;
|
|
131
|
+
deliveryDrain(id: string): {
|
|
132
|
+
unsettled: number;
|
|
133
|
+
unknown: number;
|
|
134
|
+
};
|
|
135
|
+
/** Stable callId journals delivery; reusing it never dispatches twice. Explicit retry uses reconcileCall. */
|
|
136
|
+
request<T = unknown>(callId: string, id: string, command: ExecutorCommand): Promise<T>;
|
|
137
|
+
reconcileCall<T = unknown>(callId: string, id: string, command: ExecutorCommand): Promise<T>;
|
|
138
|
+
private dispatch;
|
|
139
|
+
/** Called only after the controller's durable inbox/outbox has recorded the result OR explicit unknown reconciliation. */
|
|
140
|
+
acknowledge(callId: string): Promise<void>;
|
|
141
|
+
retire(id: string, retirementIntentDigest?: string): Promise<void>;
|
|
142
|
+
stopAdapter(id: string): Promise<void>;
|
|
143
|
+
close(): Promise<void>;
|
|
144
|
+
}
|
|
145
|
+
export {};
|