clinkx 1.1.2 → 1.3.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.
- package/CHANGELOG.md +63 -0
- package/README.md +67 -14
- package/clinkx-workflows/dist/allowed-roots.js +2 -0
- package/clinkx-workflows/dist/allowed-roots.js.map +1 -1
- package/clinkx-workflows/dist/architecture-arena/admission.d.ts +16 -0
- package/clinkx-workflows/dist/architecture-arena/admission.js +107 -0
- package/clinkx-workflows/dist/architecture-arena/admission.js.map +1 -0
- package/clinkx-workflows/dist/architecture-arena/contract.d.ts +1368 -0
- package/clinkx-workflows/dist/architecture-arena/contract.js +254 -0
- package/clinkx-workflows/dist/architecture-arena/contract.js.map +1 -0
- package/clinkx-workflows/dist/architecture-arena/runtime.d.ts +53 -0
- package/clinkx-workflows/dist/architecture-arena/runtime.js +511 -0
- package/clinkx-workflows/dist/architecture-arena/runtime.js.map +1 -0
- package/clinkx-workflows/dist/architecture-comparison/admission.d.ts +17 -1
- package/clinkx-workflows/dist/architecture-comparison/admission.js +27 -4
- package/clinkx-workflows/dist/architecture-comparison/admission.js.map +1 -1
- package/clinkx-workflows/dist/architecture-comparison/contract.d.ts +59 -62
- package/clinkx-workflows/dist/architecture-comparison/contract.js +4 -21
- package/clinkx-workflows/dist/architecture-comparison/contract.js.map +1 -1
- package/clinkx-workflows/dist/architecture-comparison/runtime.d.ts +4 -3
- package/clinkx-workflows/dist/architecture-comparison/runtime.js +22 -67
- package/clinkx-workflows/dist/architecture-comparison/runtime.js.map +1 -1
- package/clinkx-workflows/dist/artifacts.d.ts +19 -4
- package/clinkx-workflows/dist/artifacts.js +16 -7
- package/clinkx-workflows/dist/artifacts.js.map +1 -1
- package/clinkx-workflows/dist/backend.d.ts +30 -0
- package/clinkx-workflows/dist/child-env.d.ts +3 -1
- package/clinkx-workflows/dist/child-env.js +6 -2
- package/clinkx-workflows/dist/child-env.js.map +1 -1
- package/clinkx-workflows/dist/clink-client.d.ts +8 -2
- package/clinkx-workflows/dist/clink-client.js +4 -2
- package/clinkx-workflows/dist/clink-client.js.map +1 -1
- package/clinkx-workflows/dist/config.d.ts +28 -5
- package/clinkx-workflows/dist/config.js +137 -20
- package/clinkx-workflows/dist/config.js.map +1 -1
- package/clinkx-workflows/dist/contained-file.js +9 -0
- package/clinkx-workflows/dist/contained-file.js.map +1 -1
- package/clinkx-workflows/dist/context-preflight.d.ts +6 -0
- package/clinkx-workflows/dist/context-preflight.js.map +1 -1
- package/clinkx-workflows/dist/council-execution-policy.d.ts +3 -1
- package/clinkx-workflows/dist/council-execution-policy.js +4 -0
- package/clinkx-workflows/dist/council-execution-policy.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/contracts.d.ts +586 -586
- package/clinkx-workflows/dist/dashboard/progress-report-contract.d.ts +28 -28
- package/clinkx-workflows/dist/dashboard/session-log-contract.d.ts +32 -32
- package/clinkx-workflows/dist/dashboard/session-log-identity.js +2 -1
- package/clinkx-workflows/dist/dashboard/session-log-identity.js.map +1 -1
- package/clinkx-workflows/dist/dashboard-ui/assets/index-DRId2DVA.js +119 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/style-CHAw57y5.css +1 -0
- package/clinkx-workflows/dist/dashboard-ui/index.html +2 -2
- package/clinkx-workflows/dist/delegate-signature.d.ts +4 -3
- package/clinkx-workflows/dist/delegate-signature.js +4 -3
- package/clinkx-workflows/dist/delegate-signature.js.map +1 -1
- package/clinkx-workflows/dist/durable-file.d.ts +69 -0
- package/clinkx-workflows/dist/durable-file.js +145 -0
- package/clinkx-workflows/dist/durable-file.js.map +1 -0
- package/clinkx-workflows/dist/engine.d.ts +42 -7
- package/clinkx-workflows/dist/engine.js +196 -24
- package/clinkx-workflows/dist/engine.js.map +1 -1
- package/clinkx-workflows/dist/ping-pong/admission.d.ts +127 -0
- package/clinkx-workflows/dist/ping-pong/admission.js +522 -0
- package/clinkx-workflows/dist/ping-pong/admission.js.map +1 -0
- package/clinkx-workflows/dist/ping-pong/contract.d.ts +2539 -0
- package/clinkx-workflows/dist/ping-pong/contract.js +819 -0
- package/clinkx-workflows/dist/ping-pong/contract.js.map +1 -0
- package/clinkx-workflows/dist/ping-pong/control.d.ts +67 -0
- package/clinkx-workflows/dist/ping-pong/control.js +12 -0
- package/clinkx-workflows/dist/ping-pong/control.js.map +1 -0
- package/clinkx-workflows/dist/ping-pong/runtime-handle.d.ts +24 -0
- package/clinkx-workflows/dist/ping-pong/runtime-handle.js +55 -0
- package/clinkx-workflows/dist/ping-pong/runtime-handle.js.map +1 -0
- package/clinkx-workflows/dist/ping-pong/runtime.d.ts +235 -0
- package/clinkx-workflows/dist/ping-pong/runtime.js +1183 -0
- package/clinkx-workflows/dist/ping-pong/runtime.js.map +1 -0
- package/clinkx-workflows/dist/ping-pong/settle.d.ts +57 -0
- package/clinkx-workflows/dist/ping-pong/settle.js +58 -0
- package/clinkx-workflows/dist/ping-pong/settle.js.map +1 -0
- package/clinkx-workflows/dist/ping-pong/sidecar.d.ts +65 -0
- package/clinkx-workflows/dist/ping-pong/sidecar.js +138 -0
- package/clinkx-workflows/dist/ping-pong/sidecar.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/publication.d.ts +2 -1
- package/clinkx-workflows/dist/plan-review/publication.js +5 -6
- package/clinkx-workflows/dist/plan-review/publication.js.map +1 -1
- package/clinkx-workflows/dist/plan-review/snapshot.d.ts +3 -2
- package/clinkx-workflows/dist/plan-review/snapshot.js +8 -8
- package/clinkx-workflows/dist/plan-review/snapshot.js.map +1 -1
- package/clinkx-workflows/dist/recipe-host.d.ts +315 -0
- package/clinkx-workflows/dist/recipe-host.js +183 -0
- package/clinkx-workflows/dist/recipe-host.js.map +1 -0
- package/clinkx-workflows/dist/recipe-seats.d.ts +96 -0
- package/clinkx-workflows/dist/recipe-seats.js +163 -0
- package/clinkx-workflows/dist/recipe-seats.js.map +1 -0
- package/clinkx-workflows/dist/recipe-shared/evidence.d.ts +67 -0
- package/clinkx-workflows/dist/recipe-shared/evidence.js +111 -0
- package/clinkx-workflows/dist/recipe-shared/evidence.js.map +1 -0
- package/clinkx-workflows/dist/reducers/index.d.ts +9 -1
- package/clinkx-workflows/dist/reducers/index.js +30 -0
- package/clinkx-workflows/dist/reducers/index.js.map +1 -1
- package/clinkx-workflows/dist/root-path-validation.d.ts +12 -0
- package/clinkx-workflows/dist/root-path-validation.js +63 -0
- package/clinkx-workflows/dist/root-path-validation.js.map +1 -0
- package/clinkx-workflows/dist/rosters.d.ts +1 -0
- package/clinkx-workflows/dist/rosters.js +16 -6
- package/clinkx-workflows/dist/rosters.js.map +1 -1
- package/clinkx-workflows/dist/run-lock-reclaim.d.ts +44 -0
- package/clinkx-workflows/dist/run-lock-reclaim.js +86 -0
- package/clinkx-workflows/dist/run-lock-reclaim.js.map +1 -0
- package/clinkx-workflows/dist/server.js +5 -2
- package/clinkx-workflows/dist/server.js.map +1 -1
- package/clinkx-workflows/dist/state-schema.d.ts +24 -0
- package/clinkx-workflows/dist/state-schema.js +4 -1
- package/clinkx-workflows/dist/state-schema.js.map +1 -1
- package/clinkx-workflows/dist/state.d.ts +185 -4
- package/clinkx-workflows/dist/state.js +684 -88
- package/clinkx-workflows/dist/state.js.map +1 -1
- package/clinkx-workflows/dist/transport.d.ts +2 -1
- package/clinkx-workflows/dist/transport.js +5 -0
- package/clinkx-workflows/dist/transport.js.map +1 -1
- package/clinkx-workflows/dist/validators/architecture-arena.d.ts +6 -0
- package/clinkx-workflows/dist/validators/architecture-arena.js +16 -0
- package/clinkx-workflows/dist/validators/architecture-arena.js.map +1 -0
- package/clinkx-workflows/dist/validators/index.js +4 -0
- package/clinkx-workflows/dist/validators/index.js.map +1 -1
- package/clinkx-workflows/dist/validators/ping-pong.d.ts +6 -0
- package/clinkx-workflows/dist/validators/ping-pong.js +10 -0
- package/clinkx-workflows/dist/validators/ping-pong.js.map +1 -0
- package/clinkx-workflows/dist/workflow-completion.d.ts +83 -0
- package/clinkx-workflows/dist/workflow-completion.js +250 -0
- package/clinkx-workflows/dist/workflow-completion.js.map +1 -0
- package/clinkx-workflows/dist/workflow-tools.d.ts +53 -6
- package/clinkx-workflows/dist/workflow-tools.js +1123 -65
- package/clinkx-workflows/dist/workflow-tools.js.map +1 -1
- package/clinkx-workflows/dist/workflow-verification-contract.d.ts +4 -4
- package/clinkx-workflows/templates/architecture-arena/candidate.txt +39 -0
- package/clinkx-workflows/templates/architecture-arena/judge.txt +34 -0
- package/clinkx-workflows/templates/ping-pong/implement.txt +14 -0
- package/clinkx-workflows/templates/ping-pong/remediate.txt +14 -0
- package/clinkx-workflows/templates/ping-pong/review.txt +27 -0
- package/clinkx-workflows/workflows/architecture-arena.yaml +127 -0
- package/clinkx-workflows/workflows/ping-pong.yaml +158 -0
- package/dist/allowed-roots.d.ts +1 -1
- package/dist/allowed-roots.js +124 -14
- package/dist/allowed-roots.js.map +1 -1
- package/dist/context-builder/bundle.js +4 -3
- package/dist/context-builder/bundle.js.map +1 -1
- package/dist/context-builder/config.d.ts +1 -0
- package/dist/context-builder/config.js +21 -9
- package/dist/context-builder/config.js.map +1 -1
- package/dist/context-builder/delegate-packet.d.ts +1 -0
- package/dist/context-builder/delegate-packet.js +66 -7
- package/dist/context-builder/delegate-packet.js.map +1 -1
- package/dist/context-builder/delegate-validation.d.ts +12 -3
- package/dist/context-builder/delegate-validation.js +23 -13
- package/dist/context-builder/delegate-validation.js.map +1 -1
- package/dist/context-builder/external-gaps.d.ts +14 -3
- package/dist/context-builder/external-gaps.js +124 -18
- package/dist/context-builder/external-gaps.js.map +1 -1
- package/dist/context-builder/handler.js +108 -191
- package/dist/context-builder/handler.js.map +1 -1
- package/dist/context-builder/mutation-lock.d.ts +4 -0
- package/dist/context-builder/mutation-lock.js +7 -1
- package/dist/context-builder/mutation-lock.js.map +1 -1
- package/dist/context-builder/review-coverage.js +27 -1
- package/dist/context-builder/review-coverage.js.map +1 -1
- package/dist/context-builder/secrets.js +1 -1
- package/dist/context-builder/secrets.js.map +1 -1
- package/dist/context-builder/storage.d.ts +10 -2
- package/dist/context-builder/storage.js +213 -16
- package/dist/context-builder/storage.js.map +1 -1
- package/dist/context-builder/versions.d.ts +10 -4
- package/dist/context-builder/versions.js +10 -4
- package/dist/context-builder/versions.js.map +1 -1
- package/dist/context-builder/workflow-runner.js +33 -24
- package/dist/context-builder/workflow-runner.js.map +1 -1
- package/dist/dashboard-cli.d.ts +8 -0
- package/dist/dashboard-cli.js +155 -86
- package/dist/dashboard-cli.js.map +1 -1
- package/dist/dashboard-companion/client.d.ts +10 -0
- package/dist/dashboard-companion/client.js +43 -1
- package/dist/dashboard-companion/client.js.map +1 -1
- package/dist/dashboard-companion/config.d.ts +19 -1
- package/dist/dashboard-companion/config.js +104 -3
- package/dist/dashboard-companion/config.js.map +1 -1
- package/dist/dashboard-companion/protocol.d.ts +16 -0
- package/dist/dashboard-companion/protocol.js +38 -1
- package/dist/dashboard-companion/protocol.js.map +1 -1
- package/dist/dashboard-companion/workstation-binding.d.ts +69 -0
- package/dist/dashboard-companion/workstation-binding.js +192 -0
- package/dist/dashboard-companion/workstation-binding.js.map +1 -0
- package/dist/dashboard-gateway/admin-cli.d.ts +10 -0
- package/dist/dashboard-gateway/admin-cli.js +266 -0
- package/dist/dashboard-gateway/admin-cli.js.map +1 -0
- package/dist/dashboard-gateway/config.d.ts +50 -0
- package/dist/dashboard-gateway/config.js +235 -1
- package/dist/dashboard-gateway/config.js.map +1 -1
- package/dist/dashboard-gateway/connection-registry.d.ts +100 -0
- package/dist/dashboard-gateway/connection-registry.js +228 -0
- package/dist/dashboard-gateway/connection-registry.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/account-auth.d.ts +78 -0
- package/dist/dashboard-gateway/control-plane/account-auth.js +198 -0
- package/dist/dashboard-gateway/control-plane/account-auth.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/billing.d.ts +264 -0
- package/dist/dashboard-gateway/control-plane/billing.js +787 -0
- package/dist/dashboard-gateway/control-plane/billing.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/contracts.d.ts +1293 -0
- package/dist/dashboard-gateway/control-plane/contracts.js +280 -0
- package/dist/dashboard-gateway/control-plane/contracts.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/cookies.d.ts +13 -0
- package/dist/dashboard-gateway/control-plane/cookies.js +46 -0
- package/dist/dashboard-gateway/control-plane/cookies.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/credentials.d.ts +63 -0
- package/dist/dashboard-gateway/control-plane/credentials.js +66 -0
- package/dist/dashboard-gateway/control-plane/credentials.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/entitlements.d.ts +118 -0
- package/dist/dashboard-gateway/control-plane/entitlements.js +329 -0
- package/dist/dashboard-gateway/control-plane/entitlements.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/errors.d.ts +17 -0
- package/dist/dashboard-gateway/control-plane/errors.js +23 -0
- package/dist/dashboard-gateway/control-plane/errors.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/hosts.d.ts +6 -0
- package/dist/dashboard-gateway/control-plane/hosts.js +16 -0
- package/dist/dashboard-gateway/control-plane/hosts.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/http.d.ts +34 -0
- package/dist/dashboard-gateway/control-plane/http.js +331 -0
- package/dist/dashboard-gateway/control-plane/http.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/schema.d.ts +9 -0
- package/dist/dashboard-gateway/control-plane/schema.js +247 -0
- package/dist/dashboard-gateway/control-plane/schema.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/secrets.d.ts +20 -0
- package/dist/dashboard-gateway/control-plane/secrets.js +39 -0
- package/dist/dashboard-gateway/control-plane/secrets.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/store.d.ts +579 -0
- package/dist/dashboard-gateway/control-plane/store.js +1115 -0
- package/dist/dashboard-gateway/control-plane/store.js.map +1 -0
- package/dist/dashboard-gateway/cookie-boundary.d.ts +60 -0
- package/dist/dashboard-gateway/cookie-boundary.js +205 -0
- package/dist/dashboard-gateway/cookie-boundary.js.map +1 -0
- package/dist/dashboard-gateway/index.js +271 -494
- package/dist/dashboard-gateway/index.js.map +1 -1
- package/dist/dashboard-gateway/main.js +7 -2
- package/dist/dashboard-gateway/main.js.map +1 -1
- package/dist/dashboard-gateway/routing.d.ts +43 -0
- package/dist/dashboard-gateway/routing.js +65 -0
- package/dist/dashboard-gateway/routing.js.map +1 -0
- package/dist/dashboard-gateway/tenant-gateway.d.ts +56 -0
- package/dist/dashboard-gateway/tenant-gateway.js +989 -0
- package/dist/dashboard-gateway/tenant-gateway.js.map +1 -0
- package/dist/dashboard-gateway/tenant-main.d.ts +41 -0
- package/dist/dashboard-gateway/tenant-main.js +303 -0
- package/dist/dashboard-gateway/tenant-main.js.map +1 -0
- package/dist/dashboard-gateway/tunnel-errors.d.ts +16 -0
- package/dist/dashboard-gateway/tunnel-errors.js +22 -0
- package/dist/dashboard-gateway/tunnel-errors.js.map +1 -0
- package/dist/dashboard-gateway/tunnel-http.d.ts +21 -0
- package/dist/dashboard-gateway/tunnel-http.js +175 -0
- package/dist/dashboard-gateway/tunnel-http.js.map +1 -0
- package/dist/handler.d.ts +6 -0
- package/dist/handler.js +17 -1
- package/dist/handler.js.map +1 -1
- package/dist/local-clink-backend.d.ts +2 -1
- package/dist/local-clink-backend.js +28 -4
- package/dist/local-clink-backend.js.map +1 -1
- package/dist/parsers/extract.d.ts +19 -1
- package/dist/parsers/extract.js +68 -3
- package/dist/parsers/extract.js.map +1 -1
- package/dist/pipeline.d.ts +17 -1
- package/dist/pipeline.js +34 -6
- package/dist/pipeline.js.map +1 -1
- package/dist/process-group.d.ts +65 -0
- package/dist/process-group.js +153 -0
- package/dist/process-group.js.map +1 -0
- package/dist/progress-report/schema.d.ts +23 -23
- package/dist/project-verification/files.js +1 -1
- package/dist/project-verification/files.js.map +1 -1
- package/dist/project-verification/process.js +23 -44
- package/dist/project-verification/process.js.map +1 -1
- package/dist/project-verification/service.js +9 -1
- package/dist/project-verification/service.js.map +1 -1
- package/dist/prompt.d.ts +7 -0
- package/dist/prompt.js +18 -1
- package/dist/prompt.js.map +1 -1
- package/dist/recipe-host/git-trust.d.ts +43 -0
- package/dist/recipe-host/git-trust.js +360 -0
- package/dist/recipe-host/git-trust.js.map +1 -0
- package/dist/recipe-host/git.d.ts +42 -0
- package/dist/recipe-host/git.js +207 -0
- package/dist/recipe-host/git.js.map +1 -0
- package/dist/recipe-host/native-recipe-host.d.ts +127 -0
- package/dist/recipe-host/native-recipe-host.js +880 -0
- package/dist/recipe-host/native-recipe-host.js.map +1 -0
- package/dist/recipe-host/seat-cwd.d.ts +16 -0
- package/dist/recipe-host/seat-cwd.js +170 -0
- package/dist/recipe-host/seat-cwd.js.map +1 -0
- package/dist/registry.d.ts +1 -1
- package/dist/registry.js +5 -1
- package/dist/registry.js.map +1 -1
- package/dist/runner.d.ts +43 -1
- package/dist/runner.js +234 -35
- package/dist/runner.js.map +1 -1
- package/dist/server.js +21 -6
- package/dist/server.js.map +1 -1
- package/docs/configuration.md +181 -15
- package/docs/engineering-recipes.md +291 -0
- package/docs/security.md +87 -0
- package/docs/verification/project-checks.md +24 -2
- package/package.json +5 -1
- package/scripts/provider-doctor-core.mjs +21 -5
- package/clinkx-workflows/dist/dashboard-ui/assets/index-BdpmbPps.js +0 -115
- package/clinkx-workflows/dist/dashboard-ui/assets/style-Im5i1iAs.css +0 -1
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Crash-durable file publication for run state and the files it references.
|
|
3
|
+
*
|
|
4
|
+
* Replace mode writes a unique same-directory temporary opened
|
|
5
|
+
* `O_CREAT|O_EXCL|O_NOFOLLOW`, applies the mode with `fchmod` (never trusting
|
|
6
|
+
* the umask: the dashboard container reads run files as another user), fsyncs
|
|
7
|
+
* and closes it, renames it over the target, then fsyncs the parent
|
|
8
|
+
* directory. Exclusive mode keeps the `wx` create-once contract by creating
|
|
9
|
+
* and writing the target itself under the same flags, then fsyncing the
|
|
10
|
+
* parent directory.
|
|
11
|
+
*
|
|
12
|
+
* A write, fchmod, fsync, close or rename failure removes the file this call
|
|
13
|
+
* created: the temporary in replace mode, where the target is untouched until
|
|
14
|
+
* the rename; the target itself in exclusive mode, where it is visible under
|
|
15
|
+
* its final name while being written. An existing target makes exclusive mode
|
|
16
|
+
* fail with EEXIST and is never removed. Only a failed directory fsync after
|
|
17
|
+
* that point is a `DurablePublishError`, so callers know the new bytes are
|
|
18
|
+
* already there.
|
|
19
|
+
*/
|
|
20
|
+
export interface DurableWriteOptions {
|
|
21
|
+
readonly mode: number;
|
|
22
|
+
/** Create-only: fail with EEXIST instead of replacing an existing target. */
|
|
23
|
+
readonly exclusive?: boolean | undefined;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The persistence seam. Production paths always resolve to
|
|
27
|
+
* `durableFileWriter`; tests that do not exercise durability may pass a fast
|
|
28
|
+
* writer through the store/tool options (there is deliberately no env switch).
|
|
29
|
+
*/
|
|
30
|
+
export interface FileWriter {
|
|
31
|
+
writeFile(path: string, data: string | Uint8Array, options: DurableWriteOptions): Promise<void>;
|
|
32
|
+
/** Make a directory's entries (a new child directory, a rename) durable. */
|
|
33
|
+
syncDirectory(path: string): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
/** The new bytes are visible at `path`; only the directory fsync failed. */
|
|
36
|
+
export declare class DurablePublishError extends Error {
|
|
37
|
+
readonly path: string;
|
|
38
|
+
readonly published: true;
|
|
39
|
+
constructor(path: string, cause: unknown);
|
|
40
|
+
}
|
|
41
|
+
export interface DurableFileHandle {
|
|
42
|
+
writeFile(data: string | Uint8Array): Promise<void>;
|
|
43
|
+
chmod(mode: number): Promise<void>;
|
|
44
|
+
sync(): Promise<void>;
|
|
45
|
+
stat(): Promise<{
|
|
46
|
+
readonly dev: number | bigint;
|
|
47
|
+
}>;
|
|
48
|
+
close(): Promise<void>;
|
|
49
|
+
}
|
|
50
|
+
/** Filesystem operations the writer uses; injectable for order/fault tests. */
|
|
51
|
+
export interface DurableFsOps {
|
|
52
|
+
open(path: string, flags: number, mode?: number): Promise<DurableFileHandle>;
|
|
53
|
+
rename(from: string, to: string): Promise<void>;
|
|
54
|
+
unlink(path: string): Promise<void>;
|
|
55
|
+
}
|
|
56
|
+
export interface DurableFileWriterDeps {
|
|
57
|
+
readonly fs?: DurableFsOps | undefined;
|
|
58
|
+
readonly tempSuffix?: (() => string) | undefined;
|
|
59
|
+
readonly warn?: ((fields: Record<string, unknown>, message: string) => void) | undefined;
|
|
60
|
+
}
|
|
61
|
+
export declare function createDurableFileWriter(deps?: DurableFileWriterDeps): FileWriter;
|
|
62
|
+
export declare const durableFileWriter: FileWriter;
|
|
63
|
+
export declare function resolveFileWriter(writer: FileWriter | undefined): FileWriter;
|
|
64
|
+
/**
|
|
65
|
+
* `mkdir -p` whose newly created entries are durable: each directory this call
|
|
66
|
+
* created is fsynced into its parent, so a file later published beneath it
|
|
67
|
+
* cannot outlive its own path after a crash. Existing directories cost nothing.
|
|
68
|
+
*/
|
|
69
|
+
export declare function mkdirDurable(writer: FileWriter, path: string, mode?: number): Promise<void>;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { randomBytes } from "node:crypto";
|
|
2
|
+
import { constants as fsConstants } from "node:fs";
|
|
3
|
+
import { mkdir, open, rename, unlink } from "node:fs/promises";
|
|
4
|
+
import { basename, dirname, join, relative, sep } from "node:path";
|
|
5
|
+
import { logger } from "./logger.js";
|
|
6
|
+
/** The new bytes are visible at `path`; only the directory fsync failed. */
|
|
7
|
+
export class DurablePublishError extends Error {
|
|
8
|
+
path;
|
|
9
|
+
published = true;
|
|
10
|
+
constructor(path, cause) {
|
|
11
|
+
super(`published ${path} but could not fsync its directory: ${cause instanceof Error ? cause.message : String(cause)}`, { cause });
|
|
12
|
+
this.path = path;
|
|
13
|
+
this.name = "DurablePublishError";
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const CREATE_FLAGS = fsConstants.O_WRONLY | fsConstants.O_CREAT | fsConstants.O_EXCL | fsConstants.O_NOFOLLOW;
|
|
17
|
+
const DIRECTORY_FLAGS = fsConstants.O_RDONLY | (fsConstants.O_DIRECTORY ?? 0);
|
|
18
|
+
const nodeFs = {
|
|
19
|
+
open: async (path, flags, mode) => await open(path, flags, mode),
|
|
20
|
+
rename,
|
|
21
|
+
unlink,
|
|
22
|
+
};
|
|
23
|
+
function errnoCode(error) {
|
|
24
|
+
return typeof error === "object" && error !== null && "code" in error
|
|
25
|
+
? String(error.code)
|
|
26
|
+
: undefined;
|
|
27
|
+
}
|
|
28
|
+
export function createDurableFileWriter(deps = {}) {
|
|
29
|
+
const fs = deps.fs ?? nodeFs;
|
|
30
|
+
const tempSuffix = deps.tempSuffix ?? (() => `${String(process.pid)}.${randomBytes(8).toString("hex")}`);
|
|
31
|
+
const warn = deps.warn ?? ((fields, message) => logger.warn(fields, message));
|
|
32
|
+
// Some filesystems (certain network/FUSE mounts) reject a directory fsync.
|
|
33
|
+
// That is tolerated, but reported once per filesystem rather than per write.
|
|
34
|
+
const warnedFilesystems = new Set();
|
|
35
|
+
async function syncDirectory(path) {
|
|
36
|
+
const handle = await fs.open(path, DIRECTORY_FLAGS);
|
|
37
|
+
try {
|
|
38
|
+
try {
|
|
39
|
+
await handle.sync();
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
const code = errnoCode(error);
|
|
43
|
+
if (code !== "EINVAL" && code !== "ENOTSUP")
|
|
44
|
+
throw error;
|
|
45
|
+
const key = await handle.stat().then((stat) => String(stat.dev), () => path);
|
|
46
|
+
if (!warnedFilesystems.has(key)) {
|
|
47
|
+
warnedFilesystems.add(key);
|
|
48
|
+
warn({ directory: path, code }, "directory fsync is unsupported on this filesystem; renames are not crash-durable here");
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
finally {
|
|
53
|
+
await handle.close();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Create `path` (never following or reusing an existing entry), write, fchmod
|
|
58
|
+
* and fsync it. Any failure after creation removes the file it created.
|
|
59
|
+
*/
|
|
60
|
+
async function createSynced(path, data, mode) {
|
|
61
|
+
const handle = await fs.open(path, CREATE_FLAGS, mode);
|
|
62
|
+
try {
|
|
63
|
+
await handle.writeFile(data);
|
|
64
|
+
await handle.chmod(mode);
|
|
65
|
+
await handle.sync();
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
await handle.close().catch(() => { });
|
|
69
|
+
await discard(path);
|
|
70
|
+
throw error;
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
await handle.close();
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
await discard(path);
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
async function discard(path) {
|
|
81
|
+
try {
|
|
82
|
+
await fs.unlink(path);
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
if (errnoCode(error) !== "ENOENT") {
|
|
86
|
+
warn({ path, err: error instanceof Error ? error.message : String(error) }, "failed to remove an unpublished durable-write file");
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
async function publishDirectory(target) {
|
|
91
|
+
try {
|
|
92
|
+
await syncDirectory(dirname(target));
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
throw new DurablePublishError(target, error);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
syncDirectory,
|
|
100
|
+
async writeFile(path, data, options) {
|
|
101
|
+
if (options.exclusive === true) {
|
|
102
|
+
await createSynced(path, data, options.mode);
|
|
103
|
+
await publishDirectory(path);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const temporary = join(dirname(path), `.${basename(path)}.${tempSuffix()}.tmp`);
|
|
107
|
+
await createSynced(temporary, data, options.mode);
|
|
108
|
+
try {
|
|
109
|
+
await fs.rename(temporary, path);
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
await discard(temporary);
|
|
113
|
+
throw error;
|
|
114
|
+
}
|
|
115
|
+
await publishDirectory(path);
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
export const durableFileWriter = createDurableFileWriter();
|
|
120
|
+
export function resolveFileWriter(writer) {
|
|
121
|
+
return writer ?? durableFileWriter;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* `mkdir -p` whose newly created entries are durable: each directory this call
|
|
125
|
+
* created is fsynced into its parent, so a file later published beneath it
|
|
126
|
+
* cannot outlive its own path after a crash. Existing directories cost nothing.
|
|
127
|
+
*/
|
|
128
|
+
export async function mkdirDurable(writer, path, mode) {
|
|
129
|
+
const first = await mkdir(path, { recursive: true, ...(mode === undefined ? {} : { mode }) });
|
|
130
|
+
if (first === undefined)
|
|
131
|
+
return;
|
|
132
|
+
const created = [first];
|
|
133
|
+
const rest = relative(first, path);
|
|
134
|
+
if (rest !== "") {
|
|
135
|
+
let current = first;
|
|
136
|
+
for (const part of rest.split(sep)) {
|
|
137
|
+
current = join(current, part);
|
|
138
|
+
created.push(current);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
for (const directory of created) {
|
|
142
|
+
await writer.syncDirectory(dirname(directory));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=durable-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"durable-file.js","sourceRoot":"","sources":["../src/durable-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAA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AAE,IAAY,EAAE,IAAa;IAChF,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;IAC9F,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO;IAChC,MAAM,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC;IACxB,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACnC,IAAI,IAAI,KAAK,EAAE,EAAE,CAAC;QAChB,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;YACnC,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YAC9B,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IACD,KAAK,MAAM,SAAS,IAAI,OAAO,EAAE,CAAC;QAChC,MAAM,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;IACjD,CAAC;AACH,CAAC"}
|
|
@@ -62,12 +62,13 @@
|
|
|
62
62
|
* isError: true with termination_reason: "wall" or "idle", which the
|
|
63
63
|
* workflow engine treats as a transient failure eligible for retry.
|
|
64
64
|
*/
|
|
65
|
+
import { type FileWriter } from "./durable-file.js";
|
|
65
66
|
import type { NormalizedWorkflowDefinition } from "./definition-normalizer.js";
|
|
66
67
|
import type { PlanReviewCallBinding } from "./plan-review/run-state.js";
|
|
67
68
|
import { type CouncilPlanReviewError } from "./plan-review/publication.js";
|
|
68
69
|
import { type ChildFailureMetadata } from "./errors.js";
|
|
69
70
|
import { type FidelityReport } from "./fidelity.js";
|
|
70
|
-
import type { CallState, FailureClass, RunStatus } from "./state-schema.js";
|
|
71
|
+
import type { CallFailureKind, CallState, FailureClass, RunStatus } from "./state-schema.js";
|
|
71
72
|
import type { InvocationAuditWrite, ObservedInvocationV1 } from "./dashboard/invocation-contract.js";
|
|
72
73
|
import type { ClinkBackend } from "./backend.js";
|
|
73
74
|
import type { ValidatorRegistry } from "./validators/index.js";
|
|
@@ -75,6 +76,7 @@ import { type ArtifactRecord } from "./artifacts.js";
|
|
|
75
76
|
import type { PlanReviewContextPolicy, PlanReviewContextProvenance } from "./plan-review/run-state.js";
|
|
76
77
|
import type { ContextBuilderMetricsShape, ContextBuilderRunner, LightCallerProvenance, PreflightContextResult, WorkflowContext } from "./context-preflight.js";
|
|
77
78
|
import type { VerifiedRepairRuntime } from "./verified-repair/runtime.js";
|
|
79
|
+
import type { PingPongRuntime } from "./ping-pong/runtime.js";
|
|
78
80
|
import { type WorkflowContextPolicy, type WorkflowContextRequestedMode, type WorkflowContextEffectiveMode } from "./context-mode-resolver.js";
|
|
79
81
|
/**
|
|
80
82
|
* Maps a runner's {@link PreflightContextResult} to the persisted {@link WorkflowContext}.
|
|
@@ -107,15 +109,19 @@ export interface WorkflowExecutionResult {
|
|
|
107
109
|
readonly stages: readonly ExecutedStage[];
|
|
108
110
|
readonly artifactsDir: string;
|
|
109
111
|
}
|
|
112
|
+
/** A persisted failed call replayed on resume, with its recorded provenance. */
|
|
113
|
+
export interface EngineResumeFailedCall {
|
|
114
|
+
readonly stageId: string;
|
|
115
|
+
readonly callId: string;
|
|
116
|
+
readonly error: string;
|
|
117
|
+
readonly terminal: boolean;
|
|
118
|
+
readonly failureClass?: FailureClass | undefined;
|
|
119
|
+
readonly failureKind?: CallFailureKind | undefined;
|
|
120
|
+
}
|
|
110
121
|
export interface EngineResumeState {
|
|
111
122
|
readonly completedCalls?: ReadonlyMap<string, ExecutedCall> | undefined;
|
|
112
123
|
readonly preparedInputs?: ReadonlyMap<string, Readonly<Record<string, unknown>>> | undefined;
|
|
113
|
-
readonly failedCalls?: ReadonlyMap<string,
|
|
114
|
-
readonly stageId: string;
|
|
115
|
-
readonly callId: string;
|
|
116
|
-
readonly error: string;
|
|
117
|
-
readonly terminal: boolean;
|
|
118
|
-
}> | undefined;
|
|
124
|
+
readonly failedCalls?: ReadonlyMap<string, EngineResumeFailedCall> | undefined;
|
|
119
125
|
readonly nextRetryCounts?: ReadonlyMap<string, number> | undefined;
|
|
120
126
|
}
|
|
121
127
|
type HookResult = Promise<void> | void;
|
|
@@ -155,6 +161,8 @@ export interface EngineCallStateChange {
|
|
|
155
161
|
readonly outputText?: string | undefined;
|
|
156
162
|
readonly error?: string | undefined;
|
|
157
163
|
readonly failureClass?: FailureClass | undefined;
|
|
164
|
+
/** Structured provenance on a failed emit; absent clears any prior value. */
|
|
165
|
+
readonly failureKind?: CallFailureKind | undefined;
|
|
158
166
|
readonly fidelity?: FidelityReport | undefined;
|
|
159
167
|
readonly artifact?: ArtifactRecord | undefined;
|
|
160
168
|
readonly childDebugMetadata?: ChildFailureMetadata | undefined;
|
|
@@ -256,6 +264,10 @@ export interface WorkflowEngineOptions {
|
|
|
256
264
|
readonly terminalResultPolicy?: EngineTerminalResultPolicy | undefined;
|
|
257
265
|
/** Prepared root-host capability for the validated fixed repair workflow. */
|
|
258
266
|
readonly verifiedRepair?: VerifiedRepairRuntime | undefined;
|
|
267
|
+
/** Prepared ping-pong runtime (root recipe host); required for the ping-pong topology. */
|
|
268
|
+
readonly pingPong?: PingPongRuntime | undefined;
|
|
269
|
+
/** Test seam for call-artifact and recipe-evidence writes; production omits it. */
|
|
270
|
+
readonly fileWriter?: FileWriter | undefined;
|
|
259
271
|
/**
|
|
260
272
|
* Optional root-injected model/effort provenance audit. The engine has no
|
|
261
273
|
* adapter registry and cannot derive `adapter_pin` itself. Standalone
|
|
@@ -298,7 +310,9 @@ export declare class WorkflowEngine {
|
|
|
298
310
|
private readonly planReviewDeliveredAliases;
|
|
299
311
|
private readonly artifactStore;
|
|
300
312
|
private readonly architectureComparison;
|
|
313
|
+
private readonly architectureArena;
|
|
301
314
|
private readonly verifiedRepair;
|
|
315
|
+
private readonly pingPong;
|
|
302
316
|
private readonly architectureResume;
|
|
303
317
|
private readonly contextBuilderRunner;
|
|
304
318
|
private readonly contextDefault;
|
|
@@ -390,8 +404,29 @@ export declare class WorkflowEngine {
|
|
|
390
404
|
private isCorrectiveRetryEligible;
|
|
391
405
|
private buildCorrectiveRetrySuffix;
|
|
392
406
|
private invokeCall;
|
|
407
|
+
/**
|
|
408
|
+
* Ping-pong seat dispatch: recipe call options (worktree cwd, confirmed
|
|
409
|
+
* exit), operation intent before and result after every attempt, and two
|
|
410
|
+
* in-place retry arms with independent counters: busy-before-spawn,
|
|
411
|
+
* bounded by PP_BUSY_ATTEMPTS, and the runtime-decided reviewer retry
|
|
412
|
+
* (D-C), bounded by PP_REVIEWER_RETRIES and dispatched with the rebuilt
|
|
413
|
+
* packet.
|
|
414
|
+
*/
|
|
415
|
+
private invokePingPongCall;
|
|
416
|
+
/**
|
|
417
|
+
* The dispatched prompt with its trailing ping-pong packet replaced by the
|
|
418
|
+
* rebuilt one, re-checked against the prompt budget. Fails closed when the
|
|
419
|
+
* prompt does not end with the packet it was dispatched with.
|
|
420
|
+
*/
|
|
421
|
+
private rebuildPingPongInput;
|
|
393
422
|
private computeDispatchDeadline;
|
|
394
423
|
private prepareDispatchInput;
|
|
424
|
+
/** Prompt-budget estimate of a fully built call input (prompt, context, files, images). */
|
|
425
|
+
private estimateInputPromptBudget;
|
|
426
|
+
/**
|
|
427
|
+
* The artifact (and any recipe evidence it updates) is durable before it
|
|
428
|
+
* returns, so the succeeded call state that names it is published second.
|
|
429
|
+
*/
|
|
395
430
|
private maybeWriteArtifact;
|
|
396
431
|
private resolveDynamicPaths;
|
|
397
432
|
private resolveDynamicPathVariable;
|