orizu 0.5.20 → 0.5.21
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/dist/archive-artifacts-cli.d.ts +50 -0
- package/dist/archive-artifacts-cli.d.ts.map +1 -0
- package/dist/artifact-archive.d.ts +48 -0
- package/dist/artifact-archive.d.ts.map +1 -0
- package/dist/artifact-pull.d.ts +22 -0
- package/dist/artifact-pull.d.ts.map +1 -0
- package/dist/banner.d.ts +3 -0
- package/dist/banner.d.ts.map +1 -0
- package/dist/connectors-cli.d.ts +31 -0
- package/dist/connectors-cli.d.ts.map +1 -0
- package/dist/credentials.d.ts +46 -0
- package/dist/credentials.d.ts.map +1 -0
- package/dist/csv.d.ts +49 -0
- package/dist/csv.d.ts.map +1 -0
- package/dist/dataset-download.d.ts +6 -0
- package/dist/dataset-download.d.ts.map +1 -0
- package/dist/dataset-edit-rows.d.ts +10 -0
- package/dist/dataset-edit-rows.d.ts.map +1 -0
- package/dist/dataset-upload-snapshot.d.ts +13 -0
- package/dist/dataset-upload-snapshot.d.ts.map +1 -0
- package/dist/daytona-slice-rehearsal.d.ts +89 -0
- package/dist/daytona-slice-rehearsal.d.ts.map +1 -0
- package/dist/daytona-slice.d.ts +106 -0
- package/dist/daytona-slice.d.ts.map +1 -0
- package/dist/deploy-key-merge-core.d.ts +121 -0
- package/dist/deploy-key-merge-core.d.ts.map +1 -0
- package/dist/diff-comments-cli.d.ts +12 -0
- package/dist/diff-comments-cli.d.ts.map +1 -0
- package/dist/diff-comments-cli.js +3 -0
- package/dist/egress-allowlist-cli.d.ts +23 -0
- package/dist/egress-allowlist-cli.d.ts.map +1 -0
- package/dist/egress-policy.d.ts +108 -0
- package/dist/egress-policy.d.ts.map +1 -0
- package/dist/error-response.d.ts +9 -0
- package/dist/error-response.d.ts.map +1 -0
- package/dist/file-parser.d.ts +5 -0
- package/dist/file-parser.d.ts.map +1 -0
- package/dist/gepa-engine-dispatch.d.ts +9 -0
- package/dist/gepa-engine-dispatch.d.ts.map +1 -0
- package/dist/gepa-engine-dispatch.js +48 -2
- package/dist/gepa-python-command.d.ts +6 -0
- package/dist/gepa-python-command.d.ts.map +1 -0
- package/dist/gepa-python-paths.d.ts +6 -0
- package/dist/gepa-python-paths.d.ts.map +1 -0
- package/dist/gepa-python-paths.js +6 -3
- package/dist/git-credential.d.ts +69 -0
- package/dist/git-credential.d.ts.map +1 -0
- package/dist/git-recovery-environment.d.ts +31 -0
- package/dist/git-recovery-environment.d.ts.map +1 -0
- package/dist/github-setup.d.ts +122 -0
- package/dist/github-setup.d.ts.map +1 -0
- package/dist/global-flags.d.ts +12 -0
- package/dist/global-flags.d.ts.map +1 -0
- package/dist/help.d.ts +46 -0
- package/dist/help.d.ts.map +1 -0
- package/dist/help.js +91 -23
- package/dist/hosted-boot.d.ts +273 -0
- package/dist/hosted-boot.d.ts.map +1 -0
- package/dist/hosted-bootstrap-rehearsal.d.ts +86 -0
- package/dist/hosted-bootstrap-rehearsal.d.ts.map +1 -0
- package/dist/hosted-bootstrap.d.ts +188 -0
- package/dist/hosted-bootstrap.d.ts.map +1 -0
- package/dist/hosted-broker-server.d.ts +50 -0
- package/dist/hosted-broker-server.d.ts.map +1 -0
- package/dist/hosted-git-http-server.d.ts +36 -0
- package/dist/hosted-git-http-server.d.ts.map +1 -0
- package/dist/hosted-harness-claude.d.ts +195 -0
- package/dist/hosted-harness-claude.d.ts.map +1 -0
- package/dist/hosted-harness-opencode.d.ts +227 -0
- package/dist/hosted-harness-opencode.d.ts.map +1 -0
- package/dist/hosted-harness.d.ts +118 -0
- package/dist/hosted-harness.d.ts.map +1 -0
- package/dist/hosted-harvest.d.ts +68 -0
- package/dist/hosted-harvest.d.ts.map +1 -0
- package/dist/hosted-headless.d.ts +72 -0
- package/dist/hosted-headless.d.ts.map +1 -0
- package/dist/hosted-loop-lifecycle.d.ts +206 -0
- package/dist/hosted-loop-lifecycle.d.ts.map +1 -0
- package/dist/hosted-loop.d.ts +170 -0
- package/dist/hosted-loop.d.ts.map +1 -0
- package/dist/hosted-run-event-sink.d.ts +222 -0
- package/dist/hosted-run-event-sink.d.ts.map +1 -0
- package/dist/hosted-runtime-assets.d.ts +186 -0
- package/dist/hosted-runtime-assets.d.ts.map +1 -0
- package/dist/hosted-session-cli.d.ts +258 -0
- package/dist/hosted-session-cli.d.ts.map +1 -0
- package/dist/hosted-skill-staging.d.ts +73 -0
- package/dist/hosted-skill-staging.d.ts.map +1 -0
- package/dist/http.d.ts +8 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +88 -92
- package/dist/instruction-set-gepa-launch.d.ts +3 -0
- package/dist/instruction-set-gepa-launch.d.ts.map +1 -0
- package/dist/instruction-set-gepa-launch.js +15 -0
- package/dist/instruction-set-loader.d.ts +6 -0
- package/dist/instruction-set-loader.d.ts.map +1 -0
- package/dist/instruction-set-loader.js +59 -0
- package/dist/instruction-set-manifest.d.ts +14 -0
- package/dist/instruction-set-manifest.d.ts.map +1 -0
- package/dist/instruction-set-manifest.js +162 -0
- package/dist/instruction-sets-cli.d.ts +40 -0
- package/dist/instruction-sets-cli.d.ts.map +1 -0
- package/dist/instruction-sets-cli.js +361 -0
- package/dist/json-response.d.ts +4 -0
- package/dist/json-response.d.ts.map +1 -0
- package/dist/jsonl-stream.d.ts +8 -0
- package/dist/jsonl-stream.d.ts.map +1 -0
- package/dist/kill-switch-cli.d.ts +30 -0
- package/dist/kill-switch-cli.d.ts.map +1 -0
- package/dist/loopback-serve.d.ts +25 -0
- package/dist/loopback-serve.d.ts.map +1 -0
- package/dist/manifests-cli.d.ts +22 -0
- package/dist/manifests-cli.d.ts.map +1 -0
- package/dist/markdown-report-input.d.ts +7 -0
- package/dist/markdown-report-input.d.ts.map +1 -0
- package/dist/merge-job.d.ts +155 -0
- package/dist/merge-job.d.ts.map +1 -0
- package/dist/model-configs-cli.d.ts +19 -0
- package/dist/model-configs-cli.d.ts.map +1 -0
- package/dist/model-configs-cli.js +104 -0
- package/dist/optimization-export-cli.d.ts +19 -0
- package/dist/optimization-export-cli.d.ts.map +1 -0
- package/dist/optimizations-list-cli.d.ts +20 -0
- package/dist/optimizations-list-cli.d.ts.map +1 -0
- package/dist/optimizations-promote-cli.d.ts +8 -0
- package/dist/optimizations-promote-cli.d.ts.map +1 -0
- package/dist/optimizations-promote-cli.js +34 -0
- package/dist/option-validation.d.ts +15 -0
- package/dist/option-validation.d.ts.map +1 -0
- package/dist/preview-runtime.d.ts +63 -0
- package/dist/preview-runtime.d.ts.map +1 -0
- package/dist/prompt-draft-push.d.ts +60 -0
- package/dist/prompt-draft-push.d.ts.map +1 -0
- package/dist/prompt-label-cli.d.ts +11 -0
- package/dist/prompt-label-cli.d.ts.map +1 -0
- package/dist/prompt-label-cli.js +29 -0
- package/dist/prompt-length-wire.d.ts +28 -0
- package/dist/prompt-length-wire.d.ts.map +1 -0
- package/dist/prompt-report-cli.d.ts +10 -0
- package/dist/prompt-report-cli.d.ts.map +1 -0
- package/dist/prompt-summary-table.d.ts +15 -0
- package/dist/prompt-summary-table.d.ts.map +1 -0
- package/dist/prompt-summary-table.js +6 -0
- package/dist/registration-tag-warning.d.ts +32 -0
- package/dist/registration-tag-warning.d.ts.map +1 -0
- package/dist/report-comments-cli.d.ts +16 -0
- package/dist/report-comments-cli.d.ts.map +1 -0
- package/dist/report-markdown-blankness.d.ts +2 -0
- package/dist/report-markdown-blankness.d.ts.map +1 -0
- package/dist/report-replacement-warning.d.ts +17 -0
- package/dist/report-replacement-warning.d.ts.map +1 -0
- package/dist/repository-backup-core.d.ts +225 -0
- package/dist/repository-backup-core.d.ts.map +1 -0
- package/dist/repository-recovery-manifest.d.ts +83 -0
- package/dist/repository-recovery-manifest.d.ts.map +1 -0
- package/dist/run-event-digest.d.ts +74 -0
- package/dist/run-event-digest.d.ts.map +1 -0
- package/dist/runner-dir-verify.d.ts +66 -0
- package/dist/runner-dir-verify.d.ts.map +1 -0
- package/dist/runner-instruction-set-contract.d.ts +24 -0
- package/dist/runner-instruction-set-contract.d.ts.map +1 -0
- package/dist/runner-instruction-set-contract.js +50 -0
- package/dist/sandbox-hygiene.d.ts +45 -0
- package/dist/sandbox-hygiene.d.ts.map +1 -0
- package/dist/sandbox-provider.d.ts +193 -0
- package/dist/sandbox-provider.d.ts.map +1 -0
- package/dist/scorer-draft-push.d.ts +50 -0
- package/dist/scorer-draft-push.d.ts.map +1 -0
- package/dist/scorers-cli.d.ts +20 -0
- package/dist/scorers-cli.d.ts.map +1 -0
- package/dist/scorers-cli.js +22 -0
- package/dist/scorers-verify-parity-bridge.d.ts +16 -0
- package/dist/scorers-verify-parity-bridge.d.ts.map +1 -0
- package/dist/scorers-verify-parity-bridge.js +90 -0
- package/dist/scorers-verify-parity.d.ts +81 -0
- package/dist/scorers-verify-parity.d.ts.map +1 -0
- package/dist/scorers-verify-parity.js +502 -0
- package/dist/scores-accept-cli.d.ts +21 -0
- package/dist/scores-accept-cli.d.ts.map +1 -0
- package/dist/secret-redaction.d.ts +47 -0
- package/dist/secret-redaction.d.ts.map +1 -0
- package/dist/session-timeline.d.ts +54 -0
- package/dist/session-timeline.d.ts.map +1 -0
- package/dist/setup-prompt.d.ts +5 -0
- package/dist/setup-prompt.d.ts.map +1 -0
- package/dist/skill-installer.d.ts +68 -0
- package/dist/skill-installer.d.ts.map +1 -0
- package/dist/skilled-proposer-launch.d.ts +7 -0
- package/dist/skilled-proposer-launch.d.ts.map +1 -0
- package/dist/skilled-proposer-launch.js +60 -0
- package/dist/smoke.d.ts +102 -0
- package/dist/smoke.d.ts.map +1 -0
- package/dist/start-intent.d.ts +12 -0
- package/dist/start-intent.d.ts.map +1 -0
- package/dist/task-assignment-manifest.d.ts +15 -0
- package/dist/task-assignment-manifest.d.ts.map +1 -0
- package/dist/task-create-error.d.ts +18 -0
- package/dist/task-create-error.d.ts.map +1 -0
- package/dist/team-connectors-cli.d.ts +29 -0
- package/dist/team-connectors-cli.d.ts.map +1 -0
- package/dist/types.d.ts +39 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/vercel-sandbox-provider.d.ts +156 -0
- package/dist/vercel-sandbox-provider.d.ts.map +1 -0
- package/dist/workbench-cli.d.ts +233 -0
- package/dist/workbench-cli.d.ts.map +1 -0
- package/dist/workspace-sync.d.ts +207 -0
- package/dist/workspace-sync.d.ts.map +1 -0
- package/dist/workspace.d.ts +92 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/zip-draft-push.d.ts +55 -0
- package/dist/zip-draft-push.d.ts.map +1 -0
- package/package.json +14 -1
- package/requirements/README.md +138 -0
- package/requirements/skilled-proposer.in +66 -0
- package/requirements/skilled-proposer.lock +265 -0
- package/scripts/ensure-skilled-proposer-venv.mjs +5 -0
- package/scripts/refresh-skilled-proposer-lock.mjs +256 -0
- package/src/diff-comments-cli.ts +4 -0
- package/src/gepa-engine-dispatch.ts +42 -2
- package/src/gepa-python-paths.ts +6 -3
- package/src/help.ts +93 -23
- package/src/index.ts +99 -126
- package/src/instruction-set-gepa-launch.ts +28 -0
- package/src/instruction-set-loader.ts +37 -0
- package/src/instruction-set-manifest.ts +120 -0
- package/src/instruction-sets-cli.ts +306 -0
- package/src/model-configs-cli.ts +119 -0
- package/src/optimizations-promote-cli.ts +41 -0
- package/src/prompt-label-cli.ts +55 -0
- package/src/prompt-summary-table.ts +12 -0
- package/src/runner-instruction-set-contract.ts +64 -0
- package/src/scorers-cli.ts +40 -0
- package/src/scorers-verify-parity-bridge.ts +90 -0
- package/src/scorers-verify-parity.ts +564 -0
- package/src/skilled-proposer-launch.ts +89 -0
- package/src/skilled-proposer-venv-manager.mjs +757 -0
- package/tsconfig.json +2 -0
- package/vendor/orizu-gepa/src/orizu_gepa_connector/__init__.py +2 -1
- package/vendor/orizu-gepa/src/orizu_gepa_connector/adapter.py +8 -2
- package/vendor/orizu-gepa/src/orizu_gepa_connector/callbacks.py +17 -3
- package/vendor/orizu-gepa/src/orizu_gepa_connector/engine.py +100 -8
- package/vendor/orizu-gepa/src/orizu_gepa_connector/instruction_set_loader.py +52 -0
- package/vendor/orizu-gepa/src/orizu_gepa_connector/reflection.py +92 -12
- package/vendor/orizu-gepa/src/orizu_gepa_connector/runtime.py +100 -22
- package/vendor/orizu-gepa/src/orizu_gepa_connector/skilled_proposer_bridge.py +381 -0
- package/vendor/orizu-gepa/src/orizu_gepa_connector/stop_conditions.py +17 -0
- package/vendor/orizu-gepa/src/orizu_gepa_connector/translator.py +2 -1
- package/vendor/orizu-gepa-python/src/orizu_gepa/client.py +52 -7
- package/vendor/orizu-gepa-python/src/orizu_gepa/local_log.py +4 -1
- package/vendor/orizu-gepa-python/src/orizu_gepa/optimizer.py +10 -5
- package/vendor/orizu-gepa-python/src/orizu_gepa/reflection.py +323 -68
- package/vendor/orizu-gepa-python/src/orizu_gepa/runner.py +207 -13
- package/vendor/skills/orizu-cli/SKILL.md +2 -0
- package/vendor/skills/orizu-cli/references/cli-reference.md +85 -1
- package/vendor/skills/orizu-cli/references/migrate-existing-gepa-setup.md +303 -0
- package/vendor/skills/orizu-cli/references/optimization-with-gepa.md +25 -0
- package/vendor/skills/orizu-cli/references/prompt-control-plane.md +108 -8
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { type ReadStream } from 'node:fs';
|
|
2
|
+
import { type RecoveryCredentialHelperInvocation } from './git-recovery-environment.js';
|
|
3
|
+
import { type FrozenRepositoryDatabasePin, type RepositoryBackupAdmissionEnvelopeVersion, type RepositoryRecoveryManifest, type RepositoryRecoveryRef, type RepositoryRefBindingMode } from './repository-recovery-manifest.js';
|
|
4
|
+
export interface RepositoryBackupLimits {
|
|
5
|
+
maxRefs: number;
|
|
6
|
+
maxObjects: number;
|
|
7
|
+
maxObjectBytes: number;
|
|
8
|
+
maxSingleObjectBytes: number;
|
|
9
|
+
maxCommits: number;
|
|
10
|
+
maxTreeEntries: number;
|
|
11
|
+
maxDatabasePins: number;
|
|
12
|
+
maxQuarantineBytes: number;
|
|
13
|
+
maxManifestBytes: number;
|
|
14
|
+
maxBundleBytes: number;
|
|
15
|
+
maxGitOutputBytes: number;
|
|
16
|
+
maxGitInputBytes: number;
|
|
17
|
+
/**
|
|
18
|
+
* Hard memory ceiling requested for the complete isolated job, not merely
|
|
19
|
+
* the Node.js heap or one Git child.
|
|
20
|
+
*/
|
|
21
|
+
maxMemoryBytes: number;
|
|
22
|
+
/**
|
|
23
|
+
* Hard task ceiling requested for the complete job process tree. Production
|
|
24
|
+
* boundaries count threads as tasks so Git cannot bypass it with workers.
|
|
25
|
+
*/
|
|
26
|
+
maxProcessCount: number;
|
|
27
|
+
commandTimeoutMs: number;
|
|
28
|
+
overallTimeoutMs: number;
|
|
29
|
+
}
|
|
30
|
+
export declare const MAX_REPOSITORY_BACKUP_MEMORY_BYTES: number;
|
|
31
|
+
export declare const MAX_REPOSITORY_BACKUP_PROCESS_COUNT = 64;
|
|
32
|
+
export declare const DEFAULT_REPOSITORY_BACKUP_LIMITS: Readonly<RepositoryBackupLimits>;
|
|
33
|
+
export interface RepositoryRefAdvertisement {
|
|
34
|
+
headTarget: string | null;
|
|
35
|
+
headObjectId: string | null;
|
|
36
|
+
refs: RepositoryRecoveryRef[];
|
|
37
|
+
peeledRefs: RepositoryRecoveryRef[];
|
|
38
|
+
}
|
|
39
|
+
export interface CloudflareArtifactsRepositoryTarget {
|
|
40
|
+
accountId: string;
|
|
41
|
+
namespace: string;
|
|
42
|
+
repository: string;
|
|
43
|
+
}
|
|
44
|
+
export interface RepositoryBackupExecutionBoundaryRequest {
|
|
45
|
+
/**
|
|
46
|
+
* The hard quota that must apply to the complete job filesystem, including
|
|
47
|
+
* source quarantine, bundle, manifest, and independent restore quarantine.
|
|
48
|
+
*/
|
|
49
|
+
quotaBytes: number;
|
|
50
|
+
/**
|
|
51
|
+
* Hard total-memory ceiling for the job and all descendants. This must be
|
|
52
|
+
* independently enforced by the execution platform, not by a heap flag.
|
|
53
|
+
*/
|
|
54
|
+
maxMemoryBytes: number;
|
|
55
|
+
/**
|
|
56
|
+
* Hard process/thread-task ceiling for the job and all descendants.
|
|
57
|
+
*/
|
|
58
|
+
maxProcessCount: number;
|
|
59
|
+
purpose: 'create-and-verify' | 'verify-existing';
|
|
60
|
+
/**
|
|
61
|
+
* Hard wall for the complete filesystem-scoped operation. Production
|
|
62
|
+
* boundaries must terminate the job process and all descendants when this
|
|
63
|
+
* expires; an in-process AbortSignal alone is not an isolation boundary.
|
|
64
|
+
*/
|
|
65
|
+
timeoutMs: number;
|
|
66
|
+
}
|
|
67
|
+
export interface RepositoryBackupExecutionFilesystem {
|
|
68
|
+
/** Empty, absolute filesystem root dedicated to exactly this job. */
|
|
69
|
+
rootPath: string;
|
|
70
|
+
quotaBytes: number;
|
|
71
|
+
maxMemoryBytes: number;
|
|
72
|
+
maxProcessCount: number;
|
|
73
|
+
isolation: 'per-job';
|
|
74
|
+
/**
|
|
75
|
+
* `hard` means the execution platform enforces quota independently of this
|
|
76
|
+
* process (for example, a sandbox volume/filesystem quota). The test-only
|
|
77
|
+
* mode is accepted only for explicit local fixtures.
|
|
78
|
+
*/
|
|
79
|
+
quotaEnforcement: 'hard' | 'test-only-unenforced';
|
|
80
|
+
/**
|
|
81
|
+
* These attest that the boundary applied the requested limits to the whole
|
|
82
|
+
* job process tree before invoking the operation.
|
|
83
|
+
*/
|
|
84
|
+
memoryEnforcement: 'hard' | 'test-only-unenforced';
|
|
85
|
+
processCountEnforcement: 'hard' | 'test-only-unenforced';
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Production execution boundary. Implementations must provision a new,
|
|
89
|
+
* isolated filesystem with the exact requested hard quota, invoke `operation`
|
|
90
|
+
* exactly once, wait for it to settle, then destroy the filesystem. Merely
|
|
91
|
+
* pointing at a shared host temp directory does not satisfy this contract.
|
|
92
|
+
*/
|
|
93
|
+
export interface RepositoryBackupExecutionBoundary {
|
|
94
|
+
withJobFilesystem<T>(request: RepositoryBackupExecutionBoundaryRequest, operation: (filesystem: RepositoryBackupExecutionFilesystem) => Promise<T>): Promise<T>;
|
|
95
|
+
}
|
|
96
|
+
export interface PathBackedRepositoryBackupArtifact {
|
|
97
|
+
/**
|
|
98
|
+
* Valid only for the duration of consumeVerifiedArtifacts. Callers should
|
|
99
|
+
* stream it and must not retain the path after the callback resolves.
|
|
100
|
+
*/
|
|
101
|
+
path: string;
|
|
102
|
+
byteCount: number;
|
|
103
|
+
sha256: string;
|
|
104
|
+
openStream(): ReadStream;
|
|
105
|
+
}
|
|
106
|
+
export interface VerifiedRepositoryBackupArtifacts {
|
|
107
|
+
manifest: PathBackedRepositoryBackupArtifact;
|
|
108
|
+
bundle: PathBackedRepositoryBackupArtifact;
|
|
109
|
+
}
|
|
110
|
+
export interface RepositoryBackupDeadline {
|
|
111
|
+
/**
|
|
112
|
+
* Aborts at the same absolute deadline as the complete backup operation.
|
|
113
|
+
* Streaming implementations must pass this signal to every provider read,
|
|
114
|
+
* upload, and checksum/readback request.
|
|
115
|
+
*/
|
|
116
|
+
signal: AbortSignal;
|
|
117
|
+
deadlineMs: number;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Deterministic scheduler seam for local recovery fixtures. Production
|
|
121
|
+
* callers always use the platform timer and cannot override the overall wall.
|
|
122
|
+
*/
|
|
123
|
+
export interface RepositoryBackupTestDeadlineScheduler {
|
|
124
|
+
schedule(callback: () => void, delayMs: number): unknown;
|
|
125
|
+
cancel(handle: unknown): void;
|
|
126
|
+
}
|
|
127
|
+
export interface RepositoryBackupArtifactDestinations {
|
|
128
|
+
/**
|
|
129
|
+
* Create both files without following links and finish all writes before
|
|
130
|
+
* returning. Production implementations stream downloads into these paths.
|
|
131
|
+
*/
|
|
132
|
+
manifestPath: string;
|
|
133
|
+
bundlePath: string;
|
|
134
|
+
}
|
|
135
|
+
export interface CreateVerifiedRepositoryBackupInput<TArtifactResult = unknown> {
|
|
136
|
+
/**
|
|
137
|
+
* Immutable admission policy frozen by the backup job. A new limit set
|
|
138
|
+
* receives a new version; an existing version is never reinterpreted.
|
|
139
|
+
*/
|
|
140
|
+
admissionEnvelopeVersion: RepositoryBackupAdmissionEnvelopeVersion;
|
|
141
|
+
/**
|
|
142
|
+
* Secret-free remote locator. Production authentication is supplied only by
|
|
143
|
+
* the trusted backup worker's command-scoped exact-path helper below.
|
|
144
|
+
*/
|
|
145
|
+
remoteUrl: string;
|
|
146
|
+
/**
|
|
147
|
+
* Exact provider identity frozen by the backup job. Every production remote
|
|
148
|
+
* is reconstructed from this tuple and compared byte-for-byte before Git is
|
|
149
|
+
* spawned, so an attacker-controlled locator cannot redirect the
|
|
150
|
+
* operation-scoped credential helper to another origin or repository.
|
|
151
|
+
*/
|
|
152
|
+
cloudflareArtifactsTarget?: CloudflareArtifactsRepositoryTarget;
|
|
153
|
+
/**
|
|
154
|
+
* Test-only/local-rehearsal escape hatch. Production callers accept HTTPS
|
|
155
|
+
* only. `file://` is never inferred from an ambient Git config.
|
|
156
|
+
*/
|
|
157
|
+
allowLocalRemote?: boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Optional trusted executable invocation; arguments may identify an opaque
|
|
160
|
+
* operation but must never contain a token/password. The helper obtains a
|
|
161
|
+
* one-use credential when Git asks and store/erase remain no-ops.
|
|
162
|
+
*/
|
|
163
|
+
credentialHelper?: RecoveryCredentialHelperInvocation;
|
|
164
|
+
requiredRef: string;
|
|
165
|
+
/**
|
|
166
|
+
* Exact is required for immutable publication/bootstrap/recovery refs.
|
|
167
|
+
* Reachability keeps a frozen historical merge/scheduled commit executable
|
|
168
|
+
* after its provenance branch advances.
|
|
169
|
+
*/
|
|
170
|
+
requiredRefBindingMode?: RepositoryRefBindingMode;
|
|
171
|
+
requiredCommitSha: string;
|
|
172
|
+
databasePins: readonly FrozenRepositoryDatabasePin[];
|
|
173
|
+
limits?: Partial<RepositoryBackupLimits>;
|
|
174
|
+
executionBoundary: RepositoryBackupExecutionBoundary;
|
|
175
|
+
/**
|
|
176
|
+
* Test-only scheduler for deterministic deadline tests. It is rejected
|
|
177
|
+
* unless the remote is an explicit local fixture and the execution boundary
|
|
178
|
+
* attests that every resource limit is test-only and unenforced.
|
|
179
|
+
*/
|
|
180
|
+
testDeadlineScheduler?: RepositoryBackupTestDeadlineScheduler;
|
|
181
|
+
/**
|
|
182
|
+
* Runs only after source-side and independent restore verification. Stream
|
|
183
|
+
* both path-backed artifacts to durable storage before returning; the
|
|
184
|
+
* execution boundary destroys every path after this callback settles.
|
|
185
|
+
*/
|
|
186
|
+
consumeVerifiedArtifacts: (artifacts: VerifiedRepositoryBackupArtifacts, deadline: RepositoryBackupDeadline) => Promise<TArtifactResult>;
|
|
187
|
+
}
|
|
188
|
+
export interface VerifiedRepositoryBackup<TArtifactResult = unknown> {
|
|
189
|
+
manifest: RepositoryRecoveryManifest;
|
|
190
|
+
/**
|
|
191
|
+
* Plaintext artifact hashes. Storage code must verify the uploaded
|
|
192
|
+
* FULL_OBJECT checksum and separately record exact object version, KMS key,
|
|
193
|
+
* and retention evidence. Neither value is a ciphertext hash.
|
|
194
|
+
*/
|
|
195
|
+
manifestSha256: string;
|
|
196
|
+
bundleSha256: string;
|
|
197
|
+
manifestByteCount: number;
|
|
198
|
+
bundleByteCount: number;
|
|
199
|
+
artifactResult: TArtifactResult;
|
|
200
|
+
advertisementBefore: RepositoryRefAdvertisement;
|
|
201
|
+
advertisementAfter: RepositoryRefAdvertisement;
|
|
202
|
+
}
|
|
203
|
+
export interface VerifyRepositoryBackupBundleInput {
|
|
204
|
+
/**
|
|
205
|
+
* Exact version frozen by the backup attempt. It must match the persisted
|
|
206
|
+
* manifest before any restored evidence is accepted.
|
|
207
|
+
*/
|
|
208
|
+
admissionEnvelopeVersion: RepositoryBackupAdmissionEnvelopeVersion;
|
|
209
|
+
limits?: Partial<RepositoryBackupLimits> | RepositoryBackupLimits;
|
|
210
|
+
executionBoundary: RepositoryBackupExecutionBoundary;
|
|
211
|
+
/**
|
|
212
|
+
* Stream existing artifacts into the exact fresh paths supplied by the
|
|
213
|
+
* verifier. This avoids accepting or copying a multi-gigabyte Buffer.
|
|
214
|
+
*/
|
|
215
|
+
stageArtifacts: (destinations: RepositoryBackupArtifactDestinations, deadline: RepositoryBackupDeadline) => Promise<void>;
|
|
216
|
+
}
|
|
217
|
+
export interface RepositoryBackupVerificationReceipt {
|
|
218
|
+
refsVerified: number;
|
|
219
|
+
objectsVerified: number;
|
|
220
|
+
databasePinsVerified: number;
|
|
221
|
+
}
|
|
222
|
+
export declare function assertStableRepositoryRefAdvertisement(before: RepositoryRefAdvertisement, after: RepositoryRefAdvertisement): void;
|
|
223
|
+
export declare function verifyRepositoryBackupBundle(input: VerifyRepositoryBackupBundleInput): Promise<RepositoryBackupVerificationReceipt>;
|
|
224
|
+
export declare function createVerifiedRepositoryBackup<TArtifactResult>(input: CreateVerifiedRepositoryBackupInput<TArtifactResult>): Promise<VerifiedRepositoryBackup<TArtifactResult>>;
|
|
225
|
+
//# sourceMappingURL=repository-backup-core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository-backup-core.d.ts","sourceRoot":"","sources":["../src/repository-backup-core.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,SAAS,CAAA;AAY3D,OAAO,EAEL,KAAK,kCAAkC,EACxC,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAML,KAAK,2BAA2B,EAEhC,KAAK,wCAAwC,EAC7C,KAAK,0BAA0B,EAE/B,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAI9B,MAAM,mCAAmC,CAAA;AAE1C,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;IAClB,cAAc,EAAE,MAAM,CAAA;IACtB,oBAAoB,EAAE,MAAM,CAAA;IAC5B,UAAU,EAAE,MAAM,CAAA;IAClB,cAAc,EAAE,MAAM,CAAA;IACtB,eAAe,EAAE,MAAM,CAAA;IACvB,kBAAkB,EAAE,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B,eAAe,EAAE,MAAM,CAAA;IACvB,oBAAoB,EAAE,MAAM,CAAA;CAC7B;AAw1BD,wBAAgB,sCAAsC,CACpD,MAAM,EAAE,0BAA0B,EAClC,KAAK,EAAE,0BAA0B,GAChC,IAAI,CAIN;AAu8BD,wBAAsB,4BAA4B,CAChD,KAAK,EAAE,iCAAiC,GACvC,OAAO,CAAC,mCAAmC,CAAC,CA8C9C;AAED,wBAAsB,8BAA8B,CAAC,eAAe,EAClE,KAAK,EAAE,mCAAmC,CAAC,eAAe,CAAC,GAC1D,OAAO,CAAC,wBAAwB,CAAC,eAAe,CAAC,CAAC,CA+VpD"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
export declare const REPOSITORY_RECOVERY_MANIFEST_KIND: "orizu.repository-recovery-manifest";
|
|
2
|
+
export declare const REPOSITORY_RECOVERY_MANIFEST_VERSION: 1;
|
|
3
|
+
export declare const REPOSITORY_BACKUP_ADMISSION_ENVELOPE_VERSION: 1;
|
|
4
|
+
export type RepositoryBackupAdmissionEnvelopeVersion = typeof REPOSITORY_BACKUP_ADMISSION_ENVELOPE_VERSION;
|
|
5
|
+
export type GitObjectType = 'blob' | 'commit' | 'tag' | 'tree';
|
|
6
|
+
export interface RepositoryRecoveryRef {
|
|
7
|
+
name: string;
|
|
8
|
+
objectId: string;
|
|
9
|
+
}
|
|
10
|
+
export interface RepositoryRecoveryObject {
|
|
11
|
+
objectId: string;
|
|
12
|
+
type: GitObjectType;
|
|
13
|
+
size: number;
|
|
14
|
+
}
|
|
15
|
+
export type RepositoryRefBindingMode = 'exact' | 'reachability';
|
|
16
|
+
export type RepositoryDatabasePinRefBindingMode = RepositoryRefBindingMode;
|
|
17
|
+
export type RepositoryDatabasePinPathObjectType = 'blob' | 'tree';
|
|
18
|
+
export interface FrozenRepositoryDatabasePin {
|
|
19
|
+
pinId: string;
|
|
20
|
+
kind: string;
|
|
21
|
+
commitSha: string;
|
|
22
|
+
/** Frozen provenance ref. Reachability mode does not imply it is still at commitSha. */
|
|
23
|
+
ref: string;
|
|
24
|
+
/** Whether the provenance ref tip itself is frozen or only commit reachability is. */
|
|
25
|
+
refBindingMode: RepositoryDatabasePinRefBindingMode;
|
|
26
|
+
path?: string;
|
|
27
|
+
pathObjectType?: RepositoryDatabasePinPathObjectType;
|
|
28
|
+
pathObjectId?: string;
|
|
29
|
+
/** Optional byte-level proof for blob pins; tree identity is the Git object ID. */
|
|
30
|
+
contentSha256?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface RepositoryRecoveryManifestInput {
|
|
33
|
+
admissionEnvelopeVersion: RepositoryBackupAdmissionEnvelopeVersion;
|
|
34
|
+
objectFormat: 'sha1';
|
|
35
|
+
headTarget: string | null;
|
|
36
|
+
headObjectId: string | null;
|
|
37
|
+
requiredRef: string;
|
|
38
|
+
requiredRefBindingMode: RepositoryRefBindingMode;
|
|
39
|
+
requiredCommitSha: string;
|
|
40
|
+
refs: readonly RepositoryRecoveryRef[];
|
|
41
|
+
objects: readonly RepositoryRecoveryObject[];
|
|
42
|
+
databasePins: readonly FrozenRepositoryDatabasePin[];
|
|
43
|
+
}
|
|
44
|
+
export interface RepositoryRecoveryManifest {
|
|
45
|
+
kind: typeof REPOSITORY_RECOVERY_MANIFEST_KIND;
|
|
46
|
+
version: typeof REPOSITORY_RECOVERY_MANIFEST_VERSION;
|
|
47
|
+
admissionEnvelopeVersion: RepositoryBackupAdmissionEnvelopeVersion;
|
|
48
|
+
objectFormat: 'sha1';
|
|
49
|
+
headTarget: string | null;
|
|
50
|
+
headObjectId: string | null;
|
|
51
|
+
requiredRef: string;
|
|
52
|
+
requiredRefBindingMode: RepositoryRefBindingMode;
|
|
53
|
+
requiredCommitSha: string;
|
|
54
|
+
refs: RepositoryRecoveryRef[];
|
|
55
|
+
objects: RepositoryRecoveryObject[];
|
|
56
|
+
databasePins: FrozenRepositoryDatabasePin[];
|
|
57
|
+
totals: {
|
|
58
|
+
refCount: number;
|
|
59
|
+
objectCount: number;
|
|
60
|
+
objectBytes: number;
|
|
61
|
+
databasePinCount: number;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
export declare function assertSha1ObjectId(value: string, label?: string): void;
|
|
65
|
+
export declare function assertSha256(value: string, label?: string): void;
|
|
66
|
+
/**
|
|
67
|
+
* A deliberately explicit subset of `git check-ref-format`. Recovery accepts
|
|
68
|
+
* every ordinary `refs/*` namespace, but never pseudo refs or replace refs:
|
|
69
|
+
* importing `refs/replace/*` would change object resolution during verification.
|
|
70
|
+
*/
|
|
71
|
+
export declare function assertRecoveryRefName(value: string, label?: string): void;
|
|
72
|
+
export declare function assertSafeRecoveryPath(value: string, label?: string): void;
|
|
73
|
+
export declare function canonicalizeRepositoryRecoveryManifest(input: RepositoryRecoveryManifestInput): RepositoryRecoveryManifest;
|
|
74
|
+
export declare function serializeRepositoryRecoveryManifest(manifest: RepositoryRecoveryManifest): Buffer;
|
|
75
|
+
/**
|
|
76
|
+
* Parse persisted evidence without silently upgrading, normalizing, or
|
|
77
|
+
* discarding fields. The byte comparison rejects duplicate JSON keys,
|
|
78
|
+
* unexpected fields, changed totals, non-canonical ordering/whitespace, and
|
|
79
|
+
* any future manifest version this runtime does not explicitly understand.
|
|
80
|
+
*/
|
|
81
|
+
export declare function parseRepositoryRecoveryManifestBytes(bytes: Uint8Array): RepositoryRecoveryManifest;
|
|
82
|
+
export declare function sha256Hex(bytes: Uint8Array): string;
|
|
83
|
+
//# sourceMappingURL=repository-recovery-manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository-recovery-manifest.d.ts","sourceRoot":"","sources":["../src/repository-recovery-manifest.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iCAAiC,EAC5C,oCAA6C,CAAA;AAC/C,eAAO,MAAM,oCAAoC,EAAG,CAAU,CAAA;AAC9D,eAAO,MAAM,4CAA4C,EAAG,CAAU,CAAA;AAEtE,MAAM,MAAM,wCAAwC,GAClD,OAAO,4CAA4C,CAAA;AAEr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AS,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAEnD"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared compact per-event digest renderer for workbench-run tails (ALI-1045).
|
|
3
|
+
*
|
|
4
|
+
* Used by BOTH `orizu run tail` (human mode) and the `--tail` attached to
|
|
5
|
+
* `orizu session start --hosted`, so the operator watching a live hosted run
|
|
6
|
+
* can see at a glance what the agent said, which tool it called with what
|
|
7
|
+
* args, and what came back — enough to spot a stall, an unanswerable question,
|
|
8
|
+
* or a misdirection within seconds, without a second terminal.
|
|
9
|
+
*
|
|
10
|
+
* THREAT MODEL: the sandboxed agent AUTHORS these payloads and this renderer
|
|
11
|
+
* writes to the OPERATOR'S terminal — treat every field as hostile.
|
|
12
|
+
*
|
|
13
|
+
* Contract:
|
|
14
|
+
* - ONE line per event, prefixed `#<sequence> <eventType>`.
|
|
15
|
+
* - Every field that reaches the output is capped (FIELD_MAX for tool /
|
|
16
|
+
* status / eventType, TOKEN_TEXT_MAX for prose/output, SUMMARY_MAX for
|
|
17
|
+
* args/JSON) and the WHOLE assembled line is bounded by LINE_MAX.
|
|
18
|
+
* - The final line is sanitized as the LAST step: all C0/C1 control bytes
|
|
19
|
+
* (ESC, BEL, backspace, CR/LF, DEL, 0x80-0x9F, …) are stripped, so a
|
|
20
|
+
* hostile payload can never emit terminal escape sequences (OSC-52
|
|
21
|
+
* clipboard writes, CSI clear/spoof) or extra lines at the operator; the
|
|
22
|
+
* same pass strips Unicode bidi controls, U+2028/U+2029 separators, and
|
|
23
|
+
* zero-width characters, so a payload cannot visually reorder, split, or
|
|
24
|
+
* spoof the line either (see CONTROL_CHARS).
|
|
25
|
+
* - Bounded work per event: raw strings are sliced to a working window of
|
|
26
|
+
* WORK_FACTOR x the display cap BEFORE any regex normalization; JSON
|
|
27
|
+
* summaries first take a BOUNDED PROJECTION of the payload (max
|
|
28
|
+
* PROJECTION_MAX_ITEMS entries per level, PROJECTION_MAX_DEPTH deep,
|
|
29
|
+
* PROJECTION_MAX_NODES containers) so JSON.stringify never traverses a
|
|
30
|
+
* payload-sized structure, then slice oversized string fields via the
|
|
31
|
+
* replacer — a megabyte payload costs O(display size), not O(payload).
|
|
32
|
+
* - NEVER throws: malformed payloads degrade to the bare `#<seq> <type>`
|
|
33
|
+
* line; hostile objects (throwing getters) degrade to `#? unknown`. Full
|
|
34
|
+
* fidelity stays in the JSON streams (`--json` on either command).
|
|
35
|
+
*
|
|
36
|
+
* Event payload shapes come from the hosted harness seam
|
|
37
|
+
* (hosted-harness-{claude,opencode}.ts → hosted-run-event-sink.ts):
|
|
38
|
+
* agent_token { messageId, text } (coalesced snapshot)
|
|
39
|
+
* agent_tool_call { tool, args, callId, status }
|
|
40
|
+
* agent_tool_result { callId, status, output[, tool] }
|
|
41
|
+
* agent_step_finish { cost, tokens, reason } (tokens shape varies)
|
|
42
|
+
*/
|
|
43
|
+
/** Max chars of streamed agent text / tool output shown per digest line. */
|
|
44
|
+
export declare const TOKEN_TEXT_MAX = 120;
|
|
45
|
+
/** Max chars of arg/JSON summaries shown per digest line. */
|
|
46
|
+
export declare const SUMMARY_MAX = 160;
|
|
47
|
+
/** Max chars for short identifier-ish fields: tool names, statuses, eventType. */
|
|
48
|
+
export declare const FIELD_MAX = 60;
|
|
49
|
+
/** Hard backstop for a whole assembled digest line (prefix + segments + slack). */
|
|
50
|
+
export declare const LINE_MAX = 360;
|
|
51
|
+
interface ProjectionState {
|
|
52
|
+
nodes: number;
|
|
53
|
+
seen: WeakSet<object>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Build a bounded clone of a hostile payload BEFORE serialization, so
|
|
57
|
+
* JSON.stringify never traverses payload-sized structures (huge arrays, many
|
|
58
|
+
* properties, deep nesting): at most PROJECTION_MAX_ITEMS entries per level,
|
|
59
|
+
* PROJECTION_MAX_DEPTH levels, PROJECTION_MAX_NODES containers total. Cut
|
|
60
|
+
* points and repeated/cyclic references become the '…' marker. Exported for
|
|
61
|
+
* tests only.
|
|
62
|
+
*/
|
|
63
|
+
export declare function boundedJsonProjection(value: unknown, depth?: number, state?: ProjectionState): unknown;
|
|
64
|
+
/** The old (pre-ALI-1045) types-only line — kept for `--quiet`. */
|
|
65
|
+
export declare function formatRunEventTypeLine(event: unknown): string;
|
|
66
|
+
/**
|
|
67
|
+
* One compact human line for a workbench-run event: `#<seq> <type> <digest>`.
|
|
68
|
+
* Never throws; degrades to the bare `#<seq> <type>` line on any malformed or
|
|
69
|
+
* missing payload field, and to `#? unknown` when the envelope itself is
|
|
70
|
+
* hostile (throwing getters, revoked proxies).
|
|
71
|
+
*/
|
|
72
|
+
export declare function formatRunEventDigest(event: unknown): string;
|
|
73
|
+
export {};
|
|
74
|
+
//# sourceMappingURL=run-event-digest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-event-digest.d.ts","sourceRoot":"","sources":["../src/run-event-digest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,4EAA4E;AAC5E,eAAO,MAAM,cAAc,MAAM,CAAA;AACjC,6DAA6D;AAC7D,eAAO,MAAM,WAAW,MAAM,CAAA;AAC9B,kFAAkF;AAClF,eAAO,MAAM,SAAS,KAAK,CAAA;AAC3B,mFAAmF;AACnF,eAAO,MAAM,QAAQ,MAAM,CAAA;AAyD3B,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;CACtB;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,OAAO,EACd,KAAK,SAAI,EACT,KAAK,GAAE,eAAmD,GACzD,OAAO,CA+BT;AA+ID,mEAAmE;AACnE,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAO7D;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAkB3D"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ALI-1159 (ADR-007): ad-hoc `--runner-dir` bytes may only execute when they
|
|
3
|
+
* ARE a registered runner version. Runs that execute local runner bytes stamp
|
|
4
|
+
* a registered `runner_version_id` into every result record; before this
|
|
5
|
+
* guard, nothing tied those bytes to that version — a run could produce live
|
|
6
|
+
* Orizu records from runner bytes that were never registered or committed
|
|
7
|
+
* anywhere (the GEPA-adapter loss on orizu-workbench-demo). The check is the
|
|
8
|
+
* same deterministic-zip content sha the push paths record: identical
|
|
9
|
+
* directory bytes hash to the registered version's `content_sha256`.
|
|
10
|
+
*
|
|
11
|
+
* Lives outside index.ts per the CLI line ratchet (ALI-976).
|
|
12
|
+
*/
|
|
13
|
+
/** Test seam; defaults to the authenticated CLI fetcher. */
|
|
14
|
+
export interface VerifyRunnerDirInput {
|
|
15
|
+
runnerVersionId: string;
|
|
16
|
+
dir: string;
|
|
17
|
+
/** The CLI flag the dir arrived on (for the error message). */
|
|
18
|
+
flag: string;
|
|
19
|
+
fetcher?: (path: string, init?: RequestInit) => Promise<Response>;
|
|
20
|
+
}
|
|
21
|
+
export interface VerifiedRunnerSnapshot {
|
|
22
|
+
/**
|
|
23
|
+
* Temp directory holding EXACTLY the verified file set, materialized from
|
|
24
|
+
* the same in-memory bytes the hash covered (codex round 4 on #1447):
|
|
25
|
+
* execution from here is immune to post-hash mutation of the original dir,
|
|
26
|
+
* and hash-excluded entries (.env, .git, .orizu, caches, symlinks) simply
|
|
27
|
+
* do not exist at runtime.
|
|
28
|
+
*/
|
|
29
|
+
snapshotDir: string;
|
|
30
|
+
cleanup: () => void;
|
|
31
|
+
}
|
|
32
|
+
export declare function verifyRunnerDirRegistered(input: VerifyRunnerDirInput): Promise<VerifiedRunnerSnapshot>;
|
|
33
|
+
/**
|
|
34
|
+
* The runner contract executes `manifest.json`'s `command` with cwd at the
|
|
35
|
+
* artifact root. Every command entry must stay INSIDE the snapshot: absolute
|
|
36
|
+
* entries and `..` escapes are refused (a bare program name like `node` is
|
|
37
|
+
* PATH-resolved — interpreters are environment, not artifact bytes). Missing
|
|
38
|
+
* or malformed manifests are refused here too, so no snapshot can outlive a
|
|
39
|
+
* runner that could never execute.
|
|
40
|
+
*/
|
|
41
|
+
export declare function assertSnapshotManifestConfined(snapshotDir: string, flag: string): void;
|
|
42
|
+
/** Extract a flag value accepting BOTH argparse forms: `--flag value` and
|
|
43
|
+
* `--flag=value` (codex P1 on #1447 — the equals form bypassed `getArg`). */
|
|
44
|
+
export declare function extractFlagValue(args: string[], flag: string): string | null;
|
|
45
|
+
export interface GepaVerifiedArgs {
|
|
46
|
+
/** The forwarded argv with each runner-dir flag REWRITTEN to its verified
|
|
47
|
+
* snapshot path — Python executes the hashed bytes, not the mutable dir. */
|
|
48
|
+
args: string[];
|
|
49
|
+
/** The snapshot dirs, for the ORIZU_VERIFIED_RUNNER_DIRS handshake. */
|
|
50
|
+
verifiedDirs: string[];
|
|
51
|
+
cleanup: () => void;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Verify the run-gepa wrapper's two ad-hoc runner dirs (candidate + scorer)
|
|
55
|
+
* against the FORWARDED argv before the Python optimizer is spawned —
|
|
56
|
+
* scanning the same tokens Python will parse, in both argparse forms, so no
|
|
57
|
+
* spelling of the flags can slip past verification. FAIL-CLOSED: if either
|
|
58
|
+
* half of a pair is present but the pair is incomplete, the wrapper refuses
|
|
59
|
+
* here rather than forwarding an unverified pair to argparse. A pair that is
|
|
60
|
+
* entirely absent is left to the Python CLI's required-argument validation —
|
|
61
|
+
* it cannot execute without both. On success each dir flag is REWRITTEN to
|
|
62
|
+
* the verified snapshot (codex round 4): the optimizer runs the exact hashed
|
|
63
|
+
* bytes, immune to post-hash mutation of the original dirs.
|
|
64
|
+
*/
|
|
65
|
+
export declare function verifyGepaRunnerDirsFromArgs(args: string[], fetcher?: (path: string, init?: RequestInit) => Promise<Response>): Promise<GepaVerifiedArgs>;
|
|
66
|
+
//# sourceMappingURL=runner-dir-verify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner-dir-verify.d.ts","sourceRoot":"","sources":["../src/runner-dir-verify.ts"],"names":[],"mappings":"AAYA;;;;;;;;;;;GAWG;AAEH,4DAA4D;AAC5D,MAAM,WAAW,oBAAoB;IACnC,eAAe,EAAE,MAAM,CAAA;IACvB,GAAG,EAAE,MAAM,CAAA;IACX,+DAA+D;IAC/D,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;CAClE;AA6DD,MAAM,WAAW,sBAAsB;IACrC;;;;;;OAMG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB;AAED,wBAAsB,yBAAyB,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CA4F5G;AAonBD;;;;;;;GAOG;AACH,wBAAgB,8BAA8B,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CA0EtF;AAYD;6EAC6E;AAC7E,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAY5E;AAoBD,MAAM,WAAW,gBAAgB;IAC/B;gFAC4E;IAC5E,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,uEAAuE;IACvE,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,GAChE,OAAO,CAAC,gBAAgB,CAAC,CAmD3B"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type SyncSet } from './instruction-sets-cli.js';
|
|
2
|
+
export interface RunnerInstructionSet {
|
|
3
|
+
name: string;
|
|
4
|
+
modelConfig: Record<string, unknown>;
|
|
5
|
+
shape: string[];
|
|
6
|
+
profileVersionId: string;
|
|
7
|
+
modelConfigSettingsVersionId?: string;
|
|
8
|
+
versionNumber: number;
|
|
9
|
+
promptComponentKey?: string;
|
|
10
|
+
components: Record<string, string>;
|
|
11
|
+
pinnedComponents?: Record<string, {
|
|
12
|
+
repoPath: string;
|
|
13
|
+
contentSha: string;
|
|
14
|
+
commitSha: string;
|
|
15
|
+
}>;
|
|
16
|
+
}
|
|
17
|
+
export declare function runnerInstructionSetSyncSet(instructionSet: RunnerInstructionSet): SyncSet;
|
|
18
|
+
export declare function runnerInputPrompt(promptContext: {
|
|
19
|
+
body?: string | null;
|
|
20
|
+
bodyKind: string;
|
|
21
|
+
providerSettings: Record<string, unknown>;
|
|
22
|
+
}): Record<string, unknown>;
|
|
23
|
+
export declare function runnerInputInstructionSet(instructionSet: RunnerInstructionSet): Record<string, unknown>;
|
|
24
|
+
//# sourceMappingURL=runner-instruction-set-contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner-instruction-set-contract.d.ts","sourceRoot":"","sources":["../src/runner-instruction-set-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,OAAO,EAAE,MAAM,2BAA2B,CAAA;AAE5E,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACpC,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,gBAAgB,EAAE,MAAM,CAAA;IACxB,4BAA4B,CAAC,EAAE,MAAM,CAAA;IACrC,aAAa,EAAE,MAAM,CAAA;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAClC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC/F;AAED,wBAAgB,2BAA2B,CAAC,cAAc,EAAE,oBAAoB,GAAG,OAAO,CAwBzF;AAED,wBAAgB,iBAAiB,CAC/B,aAAa,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GACnG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CASzB;AAED,wBAAgB,yBAAyB,CAAC,cAAc,EAAE,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAUvG"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export function runnerInstructionSetSyncSet(instructionSet) {
|
|
2
|
+
const modelConfigIdentity = typeof instructionSet.modelConfig.identity === 'string'
|
|
3
|
+
? instructionSet.modelConfig.identity
|
|
4
|
+
: '';
|
|
5
|
+
if (!modelConfigIdentity)
|
|
6
|
+
throw new Error('Runner exec context instruction set has no model config identity');
|
|
7
|
+
const missingKey = instructionSet.shape.find(key => !(key in instructionSet.components) && !(key in (instructionSet.pinnedComponents || {})));
|
|
8
|
+
if (missingKey)
|
|
9
|
+
throw new Error('instruction_set_tuple_incomplete');
|
|
10
|
+
const components = Object.fromEntries(Object.entries(instructionSet.components).map(([key, body]) => [key, { body }]));
|
|
11
|
+
for (const [key, pin] of Object.entries(instructionSet.pinnedComponents || {}))
|
|
12
|
+
components[key] = pin;
|
|
13
|
+
const material = {
|
|
14
|
+
profileVersionId: instructionSet.profileVersionId,
|
|
15
|
+
versionNumber: instructionSet.versionNumber,
|
|
16
|
+
modelConfigIdentity,
|
|
17
|
+
// syncToDisk's long-lived manifest requires provenance; this execution
|
|
18
|
+
// path has no resolver decision to expose, only an exact profile version.
|
|
19
|
+
resolvedFrom: 'exact_profile_version',
|
|
20
|
+
components,
|
|
21
|
+
};
|
|
22
|
+
return {
|
|
23
|
+
name: instructionSet.name,
|
|
24
|
+
shape: instructionSet.shape,
|
|
25
|
+
default: material,
|
|
26
|
+
profiles: [{ modelConfigIdentity, resolvedFrom: 'exact_profile_version', production: material }],
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export function runnerInputPrompt(promptContext) {
|
|
30
|
+
const prompt = {
|
|
31
|
+
body_kind: promptContext.bodyKind,
|
|
32
|
+
provider_settings: promptContext.providerSettings,
|
|
33
|
+
};
|
|
34
|
+
// The route owns this decision. Preserve its response shape exactly so an
|
|
35
|
+
// implicit wrapped prompt remains compatible with existing runners.
|
|
36
|
+
if ('body' in promptContext)
|
|
37
|
+
prompt.body = promptContext.body;
|
|
38
|
+
return prompt;
|
|
39
|
+
}
|
|
40
|
+
export function runnerInputInstructionSet(instructionSet) {
|
|
41
|
+
return {
|
|
42
|
+
name: instructionSet.name,
|
|
43
|
+
model_config: instructionSet.modelConfig,
|
|
44
|
+
shape: instructionSet.shape,
|
|
45
|
+
...(instructionSet.modelConfigSettingsVersionId ? { model_config_settings_version_id: instructionSet.modelConfigSettingsVersionId } : {}),
|
|
46
|
+
...(instructionSet.promptComponentKey ? { prompt_component_key: instructionSet.promptComponentKey } : {}),
|
|
47
|
+
components: instructionSet.components,
|
|
48
|
+
...(Object.keys(instructionSet.pinnedComponents || {}).length > 0 ? { pinned_components: instructionSet.pinnedComponents } : {}),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider-neutral sandbox token-hygiene sweep (ALI-973 / ALI-1050).
|
|
3
|
+
*
|
|
4
|
+
* Extracted out of `daytona-slice.ts` so the hygiene helper carries NO Daytona
|
|
5
|
+
* coupling: it works against any `SandboxProvider`/`SandboxSession` (ADR-003
|
|
6
|
+
* seam) and is imported by the shipped hosted-bootstrap path (`hosted-bootstrap
|
|
7
|
+
* .ts`) as well as the founder-only Daytona slice. Keeping it here means the
|
|
8
|
+
* shipped code never transitively reaches the optional `@daytonaio/sdk`.
|
|
9
|
+
*/
|
|
10
|
+
import type { SandboxSession } from './sandbox-provider.js';
|
|
11
|
+
export interface HygieneFinding {
|
|
12
|
+
location: string;
|
|
13
|
+
marker: string;
|
|
14
|
+
}
|
|
15
|
+
export interface HygieneProbe {
|
|
16
|
+
location: string;
|
|
17
|
+
/** Shell command whose stdout is scanned for tokens + markers. */
|
|
18
|
+
command: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The list of places a short-lived git token can leak inside a sandbox after a
|
|
22
|
+
* transient clone+push. List-driven so it is trivial to extend. `${repo}` is
|
|
23
|
+
* substituted with the repo path. Ordered from the repo-local stores outward to
|
|
24
|
+
* global config, the credential cache, the reflog, shell history, and the live
|
|
25
|
+
* process listing / argv — the exact surfaces the Daytona-support question names.
|
|
26
|
+
*/
|
|
27
|
+
export declare function tokenLeakProbes(repoPath: string): HygieneProbe[];
|
|
28
|
+
/**
|
|
29
|
+
* Grep the sandbox filesystem + process table for token values and the
|
|
30
|
+
* `x-access-token` marker across every known leak surface (see `tokenLeakProbes`).
|
|
31
|
+
* Returns every finding; an empty array means the transient operations left no
|
|
32
|
+
* residue. This is the load-bearing check the whole slice exists to make.
|
|
33
|
+
*
|
|
34
|
+
* NOTE (local-sim): the reflog/config/credential-store/history probes run
|
|
35
|
+
* meaningfully in local-sim, but `ps`/argv coverage is only decisive on the live
|
|
36
|
+
* Daytona run (local-sim runs the git clone via a child process on the host, not
|
|
37
|
+
* inside an isolated PID namespace). The WS-F memo marks that probe live-only.
|
|
38
|
+
*/
|
|
39
|
+
export declare function sweepForTokenResidue(session: SandboxSession, opts: {
|
|
40
|
+
tokens: string[];
|
|
41
|
+
repoPath: string;
|
|
42
|
+
markers?: string[];
|
|
43
|
+
probes?: HygieneProbe[];
|
|
44
|
+
}): Promise<HygieneFinding[]>;
|
|
45
|
+
//# sourceMappingURL=sandbox-hygiene.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox-hygiene.d.ts","sourceRoot":"","sources":["../src/sandbox-hygiene.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAE3D,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,kEAAkE;IAClE,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,EAAE,CAYhE;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,CAAC,EAAE,YAAY,EAAE,CAAA;CAAE,GACxF,OAAO,CAAC,cAAc,EAAE,CAAC,CAoB3B"}
|