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,222 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RunEventSink — the RunAPI event bridge (ALI-926 / P3.4, interface 2 of
|
|
3
|
+
* ADR-005's swappability contract; the full realization of audit §4b).
|
|
4
|
+
*
|
|
5
|
+
* This is the transport half that `bridge.py`'s WebSocket client is NOT: it maps
|
|
6
|
+
* normalized `HarnessEvent`s onto Orizu's append-only, client-sequenced
|
|
7
|
+
* `workbench_run_events` and terminal PATCH. It extends the seed
|
|
8
|
+
* `createBootstrapRunEventSink` (`hosted-bootstrap.ts`) into the complete bridge:
|
|
9
|
+
* kind-to-event-type mapping, token coalescing, monotonic client-sequenced
|
|
10
|
+
* allocation (gaps tolerated on an ambiguous append failure, but NEVER a content
|
|
11
|
+
* swap at a committed sequence — see the P2-4 burn rule in `postEvent`),
|
|
12
|
+
* critical-event delivery guarantees, terminal-via-PATCH, reconnect/resume, and
|
|
13
|
+
* the "Orizu records win" disagreement rule. A retried POST is an idempotent 200
|
|
14
|
+
* ONLY for a content-identical replay (same eventId, same sequence, same
|
|
15
|
+
* payload); a burned sequence after an ambiguous error leaves a server-visible
|
|
16
|
+
* gap, which is acceptable.
|
|
17
|
+
*
|
|
18
|
+
* ── Disagreement rule (Orizu records win) ────────────────────────────────────
|
|
19
|
+
* Orizu's RunAPI is the source of truth; the OpenCode-side session state is a
|
|
20
|
+
* cache/UX layer. If the harness reports state that CONTRADICTS a terminal Orizu
|
|
21
|
+
* run status — e.g. it keeps streaming parts after the run was finished — the
|
|
22
|
+
* sink REFUSES to append: once `finish()` succeeds the sink is SEALED, and any
|
|
23
|
+
* later `append()` throws `RunTerminalError` locally rather than POSTing. The
|
|
24
|
+
* sink never un-terminates a run and never invents a new one. A run-gone/terminal
|
|
25
|
+
* signal from the server (append 404/410, or a persistent terminal-status 409 on
|
|
26
|
+
* the finish PATCH) is likewise accepted as truth, sealing the sink. Note the
|
|
27
|
+
* narrow classifications: a 403 is NOT "terminal" — it is a `RunAuthError`
|
|
28
|
+
* (revoked bearer or lost access) that does not seal, and a 409 whose run is
|
|
29
|
+
* still running does NOT report success. The harness is a subordinate producer;
|
|
30
|
+
* the server record wins every disagreement.
|
|
31
|
+
*
|
|
32
|
+
* ── Artifact-ref decision (transcript/summary) ───────────────────────────────
|
|
33
|
+
* The audit points at `lib/primitive-artifact-writer.server.ts`, but that is
|
|
34
|
+
* server-only Supabase/object-store code the sandbox cannot import, and the
|
|
35
|
+
* CLI's existing artifact write paths (`orizu runners/prompts/... push`) are all
|
|
36
|
+
* PROJECT-scoped versioned-primitive uploads — there is NO run-scoped artifact
|
|
37
|
+
* write path today. Per ADR-003 (do not invent a new storage convention), a
|
|
38
|
+
* transcript is recorded as a BOUNDED-TAIL run event (`agent_transcript`,
|
|
39
|
+
* `TRANSCRIPT_TAIL_MAX_CHARS`) appended BEFORE the terminal PATCH (a post-terminal
|
|
40
|
+
* append would be refused by the seal). TODO(P3.6/ALI-928): when a run-scoped
|
|
41
|
+
* artifact-ref CLI path lands, swap the tail event for a real object ref.
|
|
42
|
+
*/
|
|
43
|
+
import type { HarnessEvent, HarnessEventKind } from './hosted-harness.js';
|
|
44
|
+
export type HostedFetch = (url: string, init?: RequestInit) => Promise<Response>;
|
|
45
|
+
export declare const EGRESS_ALLOWED_EVENT_TYPE = "egress_allowed";
|
|
46
|
+
export declare const EGRESS_BLOCKED_EVENT_TYPE = "egress_blocked";
|
|
47
|
+
/** The RunAPI event type a harness kind maps to, or null if it is not appendable
|
|
48
|
+
* (terminal kinds route through the PATCH; deferred kinds have no mapping yet). */
|
|
49
|
+
export declare function eventTypeForKind(kind: HarnessEventKind): string | null;
|
|
50
|
+
export declare const AGENT_TOKEN_EVENT_TYPE = "agent_token";
|
|
51
|
+
export declare const AGENT_TRANSCRIPT_EVENT_TYPE = "agent_transcript";
|
|
52
|
+
/** Bounded tail size for the transcript stopgap (see artifact-ref decision). */
|
|
53
|
+
export declare const TRANSCRIPT_TAIL_MAX_CHARS = 16384;
|
|
54
|
+
export declare const CREDENTIAL_ROTATED_EVENT_TYPE = "credential_rotated";
|
|
55
|
+
export declare const CREDENTIAL_MINT_FAILED_EVENT_TYPE = "credential_mint_failed";
|
|
56
|
+
export type TerminalStatus = 'succeeded' | 'failed' | 'cancelled';
|
|
57
|
+
export interface FinishOptions {
|
|
58
|
+
summary?: Record<string, unknown>;
|
|
59
|
+
evidence?: Record<string, unknown>;
|
|
60
|
+
/** Full agent transcript; stored as a bounded-tail `agent_transcript` event
|
|
61
|
+
* BEFORE the terminal PATCH (see the artifact-ref decision docblock). */
|
|
62
|
+
transcript?: string;
|
|
63
|
+
}
|
|
64
|
+
export interface RunEventSink {
|
|
65
|
+
/** Map + coalesce + POST a harness event. Owns per-run monotonic sequence.
|
|
66
|
+
* Terminal kinds are rejected (they must go through `finish`). */
|
|
67
|
+
append(event: HarnessEvent): Promise<void>;
|
|
68
|
+
/** Force-flush any coalesced token snapshots (also runs on every structural
|
|
69
|
+
* event and on `finish`). Exposed so callers can flush on a timer if desired. */
|
|
70
|
+
flushTokens(): Promise<void>;
|
|
71
|
+
/** Terminal transition via PATCH; records the transcript tail first, then CAS. */
|
|
72
|
+
finish(status: TerminalStatus, opts?: FinishOptions): Promise<void>;
|
|
73
|
+
/** True once a terminal transition has landed and the sink is sealed. */
|
|
74
|
+
readonly sealed: boolean;
|
|
75
|
+
/** The next sequence the sink will attempt to allocate (test/resume aid). */
|
|
76
|
+
readonly nextSequence: number;
|
|
77
|
+
/** Events the sink has confirmed appended, in order (redacted payloads). */
|
|
78
|
+
readonly recorded: readonly AppendedRunEvent[];
|
|
79
|
+
}
|
|
80
|
+
export interface AppendedRunEvent {
|
|
81
|
+
eventId: string;
|
|
82
|
+
sequence: number;
|
|
83
|
+
eventType: string;
|
|
84
|
+
payload: Record<string, unknown>;
|
|
85
|
+
}
|
|
86
|
+
/** Raised when an append is attempted against a run the sink knows is terminal. */
|
|
87
|
+
export declare class RunTerminalError extends Error {
|
|
88
|
+
constructor(message: string);
|
|
89
|
+
}
|
|
90
|
+
/** Raised when a critical event (or the terminal PATCH) is undeliverable after
|
|
91
|
+
* the bounded retry budget — the caller MUST treat the run as compromised. */
|
|
92
|
+
export declare class CriticalDeliveryError extends Error {
|
|
93
|
+
constructor(message: string);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Raised when `finish()` itself is undeliverable (ALI-1065 finding 2): a
|
|
97
|
+
* CriticalDeliveryError thrown WHILE DELIVERING A TERMINAL TRANSITION, carrying
|
|
98
|
+
* the intended status + finish options so the caller can retry the delivery
|
|
99
|
+
* with the ORIGINAL outcome. Before this, the error surfaced as a bare
|
|
100
|
+
* CriticalDeliveryError and the loop's generic catch re-finished the run
|
|
101
|
+
* 'failed' — a ~1s transport blip on the SUCCESS terminal recorded a succeeded
|
|
102
|
+
* run as failed. Subclasses CriticalDeliveryError so existing classification
|
|
103
|
+
* (drop-vs-surface) is unchanged.
|
|
104
|
+
*/
|
|
105
|
+
export declare class TerminalDeliveryError extends CriticalDeliveryError {
|
|
106
|
+
readonly intendedStatus: TerminalStatus;
|
|
107
|
+
readonly finishOptions: FinishOptions | undefined;
|
|
108
|
+
constructor(message: string, intendedStatus: TerminalStatus, finishOptions?: FinishOptions);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Raised on a 403 from the RunAPI. Named for what a 403 actually is — NOT "the
|
|
112
|
+
* run is terminal" (that is 404/410). A 403 means the caller may no longer write
|
|
113
|
+
* this run: the session bearer was revoked, OR the agent lost access to the run
|
|
114
|
+
* (e.g. its session was reassigned). The write definitely did not land, so the
|
|
115
|
+
* sink does NOT seal and does NOT burn the sequence; the caller decides whether
|
|
116
|
+
* to re-authenticate or abandon the run.
|
|
117
|
+
*/
|
|
118
|
+
export declare class RunAuthError extends Error {
|
|
119
|
+
constructor(message: string);
|
|
120
|
+
}
|
|
121
|
+
export interface CreateRunEventSinkOptions {
|
|
122
|
+
apiBaseUrl: string;
|
|
123
|
+
runId: string;
|
|
124
|
+
/**
|
|
125
|
+
* The Orizu bearer, EITHER a fixed string OR a provider resolved per request.
|
|
126
|
+
* A provider (e.g. one that reads the rotated 0600 bearer file) lets the sink
|
|
127
|
+
* pick up a host-side token rotation without being rebuilt: every request
|
|
128
|
+
* resolves the current value, and on a 401/403 the sink re-resolves ONCE and
|
|
129
|
+
* retries before classifying the failure (fresh token after rotation).
|
|
130
|
+
*/
|
|
131
|
+
bearer: string | (() => string);
|
|
132
|
+
fetchImpl?: HostedFetch;
|
|
133
|
+
/**
|
|
134
|
+
* Verbatim secrets to strip from every payload before it leaves the sandbox.
|
|
135
|
+
*
|
|
136
|
+
* THIS IS THE REDACTION GUARANTEE. Exact-match on these values is the control
|
|
137
|
+
* we rely on — ANY secret that is present in the sandbox (the run bearer is
|
|
138
|
+
* added automatically; also pass every minted repo token, model-provider API
|
|
139
|
+
* key, and any credential a customer setup step injects) MUST appear in this
|
|
140
|
+
* list. Whatever is here is scrubbed wherever it appears, even mid-string and
|
|
141
|
+
* regardless of its shape. The token-shape patterns in `secret-redaction.ts`
|
|
142
|
+
* are only defense-in-depth for credentials no one declared; never treat a
|
|
143
|
+
* shape match as the primary safeguard.
|
|
144
|
+
*/
|
|
145
|
+
redactSecretsList?: readonly string[];
|
|
146
|
+
now?: () => number;
|
|
147
|
+
/** First sequence to allocate (resume sets this to server cursor + 1). */
|
|
148
|
+
startSequence?: number;
|
|
149
|
+
/** eventId namespace; deterministic ids `<prefix>:<sequence>` make a replayed
|
|
150
|
+
* event an idempotent 200 (never a 409 same-sequence-different-eventId). */
|
|
151
|
+
eventIdPrefix?: string;
|
|
152
|
+
/** Bounded retry budget for critical deliveries (append critical + finish). */
|
|
153
|
+
maxCriticalAttempts?: number;
|
|
154
|
+
/**
|
|
155
|
+
* Bounded retry budget for NON-critical appends (agent_tool_call, agent_step_*,
|
|
156
|
+
* token snapshots) before the event is DROPPED. Retries only on transient
|
|
157
|
+
* network/5xx failures; on exhaustion the event is dropped (never thrown), so a
|
|
158
|
+
* single bad POST in a multi-hour run never fails the whole run (ALI-1061).
|
|
159
|
+
* Default 3.
|
|
160
|
+
*/
|
|
161
|
+
maxNonCriticalAttempts?: number;
|
|
162
|
+
/** Injectable backoff sleep (tests pass a no-op to avoid real delays). */
|
|
163
|
+
sleepImpl?: (ms: number) => Promise<void>;
|
|
164
|
+
/** Local diagnostic sink for disagreement-rule logs (never throws). */
|
|
165
|
+
onDiagnostic?: (message: string) => void;
|
|
166
|
+
}
|
|
167
|
+
export declare function createRunEventSink(options: CreateRunEventSinkOptions): RunEventSink;
|
|
168
|
+
export interface ResumeRunEventSinkOptions extends Omit<CreateRunEventSinkOptions, 'startSequence'> {
|
|
169
|
+
/** Page size for the cursor tail while discovering the latest sequence. */
|
|
170
|
+
pageSize?: number;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Rebuild a sink after a restart WITHOUT losing run continuity (acceptance:
|
|
174
|
+
* "reconnect/resume without losing run continuity"). Walks the events GET
|
|
175
|
+
* cursor tail to the end to learn the server's latest sequence, then returns a
|
|
176
|
+
* fresh sink whose first allocation is `latest + 1`.
|
|
177
|
+
*
|
|
178
|
+
* ── QUIESCE PRECONDITION (single-writer handoff) ─────────────────────────────
|
|
179
|
+
* This is safe ONLY when the predecessor sink has FULLY STOPPED before resume
|
|
180
|
+
* runs — the RunAPI is single-writer-per-run (see the events route), and resume
|
|
181
|
+
* assumes it is the sole writer while it reads the tail and picks the next
|
|
182
|
+
* sequence. It does NOT coordinate with a live predecessor. If a still-in-flight
|
|
183
|
+
* commit from a not-yet-dead sink lands AFTER we read the cursor, that sink and
|
|
184
|
+
* this one can both target the same next sequence. We do not claim "no
|
|
185
|
+
* collision": deterministic eventIds (`<runId>:<sequence>`) make an identical
|
|
186
|
+
* replay an idempotent 200, but two DIFFERENT payloads racing one sequence is a
|
|
187
|
+
* real conflict — bounded, not eliminated, by the P2-4 burn rule (the loser
|
|
188
|
+
* burns its candidate and advances rather than swapping committed content).
|
|
189
|
+
* Callers MUST ensure the predecessor is quiesced; treat overlap as a bug.
|
|
190
|
+
*
|
|
191
|
+
* ── STUCK-RUNNING RECOVERY (out of scope here) ───────────────────────────────
|
|
192
|
+
* If a sink crashes BETWEEN its last append and finish(), the run is left with
|
|
193
|
+
* status='running' server-side and no terminal event — resume can continue
|
|
194
|
+
* appending, but nothing in THIS module will time out and finalize an abandoned
|
|
195
|
+
* run whose writer never came back. A server-side watchdog owns that recovery
|
|
196
|
+
* (G6 / ALI-1007); it is deliberately not implemented in the sandbox client.
|
|
197
|
+
*/
|
|
198
|
+
export declare function resumeRunEventSink(options: ResumeRunEventSinkOptions): Promise<RunEventSink>;
|
|
199
|
+
export interface DrainOptions {
|
|
200
|
+
/** Transcript captured by the caller, stored on the terminal transition. */
|
|
201
|
+
transcript?: string;
|
|
202
|
+
summary?: Record<string, unknown>;
|
|
203
|
+
evidence?: Record<string, unknown>;
|
|
204
|
+
/**
|
|
205
|
+
* Hook invoked AFTER the stream yields its terminal event but BEFORE `finish()`
|
|
206
|
+
* seals the sink, on EVERY terminal path (success, failure, abnormal end). Used
|
|
207
|
+
* by the loop's end-of-run auto-harvest (ALI-1036) so `work_persisted` /
|
|
208
|
+
* `work_none` / `work_persist_failed` can still be appended while the sink is
|
|
209
|
+
* writable. Its own failure must never change the run's terminal status — the
|
|
210
|
+
* hook itself is responsible for swallowing errors.
|
|
211
|
+
*/
|
|
212
|
+
beforeFinish?: () => Promise<void>;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Consume a harness `runPrompt` stream into a sink: structural events are
|
|
216
|
+
* appended (with token coalescing), and the single terminal event
|
|
217
|
+
* (`execution_complete` / `error`) is routed to `finish()` — NEVER appended.
|
|
218
|
+
* This is the event bridge's happy-path driver; the terminal event decides the
|
|
219
|
+
* run's final status.
|
|
220
|
+
*/
|
|
221
|
+
export declare function drainHarnessToSink(events: AsyncIterable<HarnessEvent>, sink: RunEventSink, opts?: DrainOptions): Promise<TerminalStatus>;
|
|
222
|
+
//# sourceMappingURL=hosted-run-event-sink.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosted-run-event-sink.d.ts","sourceRoot":"","sources":["../src/hosted-run-event-sink.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAIzE,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;AAUhF,eAAO,MAAM,yBAAyB,mBAAmB,CAAA;AACzD,eAAO,MAAM,yBAAyB,mBAAmB,CAAA;AA8BzD;oFACoF;A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BD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,YAAY,CAwUnF;AAID,MAAM,WAAW,yBAA0B,SAAQ,IAAI,CAAC,yBAAyB,EAAE,eAAe,CAAC;IACjG,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,YAAY,CAAC,CAyBvB;AAID,MAAM,WAAW,YAAY;IAC3B,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAClC;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CACnC;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,aAAa,CAAC,YAAY,CAAC,EACnC,IAAI,EAAE,YAAY,EAClB,IAAI,GAAE,YAAiB,GACtB,OAAO,CAAC,cAAc,CAAC,CAoFzB"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In-sandbox runtime assets for the hosted bootstrap (ALI-925, per ADR-005).
|
|
3
|
+
*
|
|
4
|
+
* Ports the DESIGN — not the code — of OpenInspect's
|
|
5
|
+
* `sandbox_runtime/credentials/git_credential_helper.py` into a self-contained
|
|
6
|
+
* script asset that Orizu writes into the sandbox and registers as a git
|
|
7
|
+
* `credential.helper`. On every git op git spawns the script; the script mints a
|
|
8
|
+
* fresh, downscoped, audited token from Orizu's per-repo broker
|
|
9
|
+
* (`POST /api/cli/workspaces/{id}/repo-token`) and hands it to git, caching to a
|
|
10
|
+
* 0600 run-scoped file with an expiry-refresh buffer. It NEVER echoes the token
|
|
11
|
+
* and reads the bearer only from a run-scoped 0600 file (G3): the bearer is
|
|
12
|
+
* never baked into git config, the clone URL, or any long-lived file.
|
|
13
|
+
*
|
|
14
|
+
* Deliberately self-contained (no `orizu` package import) so it works even when
|
|
15
|
+
* the CLI-install step fails — the credential path must not depend on it. The
|
|
16
|
+
* script is emitted as CommonJS (`.cjs`) so it runs unchanged under both `node`
|
|
17
|
+
* (>=18, for global `fetch`) and `bun`, whichever the sandbox image ships.
|
|
18
|
+
*
|
|
19
|
+
* The boot context is split so no secret lands in a value git persists:
|
|
20
|
+
* - `boot.json` — non-secret config + the PATHS of the bearer/cache files;
|
|
21
|
+
* - `<bearer>` — the Orizu bearer, 0600, run-scoped, reaped at teardown;
|
|
22
|
+
* - `<cache>` — the minted repo token, 0600, written by the script itself.
|
|
23
|
+
* git config holds only `credential.helper = !<runtime> <script> <boot.json>`.
|
|
24
|
+
*/
|
|
25
|
+
export declare const HELPER_SCRIPT_BASENAME = "orizu-git-credential-helper.cjs";
|
|
26
|
+
export declare const BOOT_CONTEXT_BASENAME = "boot.json";
|
|
27
|
+
export declare const BEARER_BASENAME = "bearer";
|
|
28
|
+
export declare const REPO_CRED_CACHE_BASENAME = "repo-cred.json";
|
|
29
|
+
/** Refresh a cached token this long before its stated expiry (5 minutes). */
|
|
30
|
+
export declare const DEFAULT_CACHE_REFRESH_BUFFER_MS: number;
|
|
31
|
+
/** Customer setup hook path, relative to the repo root (mirrors OpenInspect's
|
|
32
|
+
* `.openinspect/setup.sh` — fresh-boot only, non-fatal, output captured). */
|
|
33
|
+
export declare const SETUP_HOOK_RELATIVE_PATH = ".orizu/setup.sh";
|
|
34
|
+
/**
|
|
35
|
+
* The git author identity for hosted-agent commits. Bootstrap configures it
|
|
36
|
+
* repo-LOCAL in the sandbox clone (never --global) so agent `git commit` works
|
|
37
|
+
* out of the box — the sandbox has no ambient identity and commits died with
|
|
38
|
+
* "Author identity unknown" (ALI-1036, found live in QA-3). The loop uses the
|
|
39
|
+
* same identity for run-event attribution; keep them identical.
|
|
40
|
+
*/
|
|
41
|
+
export declare const AGENT_GIT_IDENTITY: {
|
|
42
|
+
readonly name: "Orizu Agent";
|
|
43
|
+
readonly email: "agent@orizu.ai";
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Standing preamble wrapped around every hosted task prompt so a NATURAL task
|
|
47
|
+
* ("review X and update the readme") runs unattended with zero magic words. The
|
|
48
|
+
* agent is told to work autonomously (never block on the human), commit as it
|
|
49
|
+
* goes, and treat Orizu — not the repo — as the home for production pointers and
|
|
50
|
+
* run metadata. An end-of-run auto-harvest (ALI-1036, `harvestWorkspace`) is the
|
|
51
|
+
* safety net for anything left uncommitted; the preamble names it so the agent
|
|
52
|
+
* knows partial work is preserved.
|
|
53
|
+
*/
|
|
54
|
+
export declare const HOSTED_TASK_PREAMBLE: string;
|
|
55
|
+
/** Delimiter separating the standing preamble from the verbatim user task. */
|
|
56
|
+
export declare const HOSTED_TASK_DELIMITER = "--- YOUR TASK ---";
|
|
57
|
+
/**
|
|
58
|
+
* Compose the full hosted prompt: the standing preamble, a clear delimiter, then
|
|
59
|
+
* the user's task VERBATIM beneath it. Passing an empty preamble yields the task
|
|
60
|
+
* unchanged (an explicit opt-out for tests / callers that scaffold elsewhere).
|
|
61
|
+
*/
|
|
62
|
+
export declare function composeHostedTaskPrompt(task: string, preamble?: string): string;
|
|
63
|
+
/**
|
|
64
|
+
* Absolute path of the marker the pre-baked hosted-runtime image writes at build
|
|
65
|
+
* time (see packages/cli/hosted-runtime-image/Dockerfile). Its presence — plus
|
|
66
|
+
* the boot-context `prebaked` flag — tells the runtime the CLI + OpenCode are
|
|
67
|
+
* already on PATH, so the from-scratch install steps must be SKIPPED (they would
|
|
68
|
+
* otherwise fail under G5 default-deny egress).
|
|
69
|
+
*/
|
|
70
|
+
export declare const PREBAKED_MARKER_PATH = "/opt/orizu/prebaked.json";
|
|
71
|
+
/**
|
|
72
|
+
* The schema of `/opt/orizu/prebaked.json`. Records the exact versions baked into
|
|
73
|
+
* the image so a run (and audit) can tell WHICH runtime it booted on. `builtFor`
|
|
74
|
+
* is a constant guard so a stray same-named file from another toolchain is not
|
|
75
|
+
* mistaken for our marker.
|
|
76
|
+
*/
|
|
77
|
+
export interface PrebakedMarker {
|
|
78
|
+
cliVersion: string;
|
|
79
|
+
opencodeVersion: string;
|
|
80
|
+
claudeSdkVersion: string;
|
|
81
|
+
/**
|
|
82
|
+
* Braintrust eval tooling pins (ALI-1048) — OPTIONAL because pre-ALI-1048
|
|
83
|
+
* markers do not carry them (older snapshots stay valid). Py = the PyPI
|
|
84
|
+
* `braintrust` package (Highlight's python eval harness), Npm = the npm
|
|
85
|
+
* `braintrust` package (TS SDK + `bt` CLI).
|
|
86
|
+
*/
|
|
87
|
+
braintrustPyVersion?: string;
|
|
88
|
+
braintrustNpmVersion?: string;
|
|
89
|
+
builtFor: 'vercel-sandbox';
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Parse + validate a pre-baked marker file's contents. Returns the typed marker
|
|
93
|
+
* when the JSON is well-formed AND carries the expected `builtFor` guard with
|
|
94
|
+
* string version fields; returns null otherwise (missing file → caller passes an
|
|
95
|
+
* empty/whitespace string; malformed JSON; wrong shape). Never throws, so a
|
|
96
|
+
* belt-and-braces filesystem probe can call it on best-effort file reads.
|
|
97
|
+
*/
|
|
98
|
+
export declare function parsePrebakedMarker(raw: string): PrebakedMarker | null;
|
|
99
|
+
/**
|
|
100
|
+
* The non-secret boot context the helper script reads. Paths are ABSOLUTE so
|
|
101
|
+
* the helper resolves them regardless of git's cwd at invocation time.
|
|
102
|
+
*/
|
|
103
|
+
export interface HostedBootContext {
|
|
104
|
+
apiBaseUrl: string;
|
|
105
|
+
workspaceId: string;
|
|
106
|
+
sessionId: string;
|
|
107
|
+
runId: string;
|
|
108
|
+
sessionBranch: string;
|
|
109
|
+
repoFullName: string;
|
|
110
|
+
/** VCS host the helper will serve credentials for (default github.com). */
|
|
111
|
+
host: string;
|
|
112
|
+
/** Absolute path to the 0600 file holding the Orizu bearer. */
|
|
113
|
+
bearerFile: string;
|
|
114
|
+
/** Absolute path to the 0600 minted-token cache the script maintains. */
|
|
115
|
+
cacheFile: string;
|
|
116
|
+
/**
|
|
117
|
+
* PULL MODE (ALI-1057, DO-path hosted agent): the coordinator agent-token URL.
|
|
118
|
+
* When SET, the helper GETs a FRESH short-lived Orizu bearer here per mint —
|
|
119
|
+
* `Authorization: Bearer <boot secret read from bootSecretFile>` — instead of
|
|
120
|
+
* reading the host-written 0600 `bearerFile`. Everything downstream (POST the
|
|
121
|
+
* repo-token broker with that bearer → serve the GitHub x-access-token to git)
|
|
122
|
+
* is byte-identical to the operator/file path. When UNSET the helper stays in
|
|
123
|
+
* file mode and reads `bearerFile` exactly as before. This is the ONLY DO-path
|
|
124
|
+
* difference: the bearer SOURCE is HTTP, not a 0600 file.
|
|
125
|
+
*/
|
|
126
|
+
agentTokenUrl?: string;
|
|
127
|
+
/**
|
|
128
|
+
* PULL MODE: absolute path to the 0600 file holding the durable BOOT SECRET —
|
|
129
|
+
* the sandbox's bootstrap identity, used to authenticate the agent-token GET.
|
|
130
|
+
* Required when `agentTokenUrl` is set; ignored in file mode.
|
|
131
|
+
*/
|
|
132
|
+
bootSecretFile?: string;
|
|
133
|
+
/**
|
|
134
|
+
* Broker purpose vocabulary, INJECTABLE so a later slice can flip the whole
|
|
135
|
+
* script from write/read to session_write/session_read without editing it. The
|
|
136
|
+
* helper POSTs `primary` first and falls back to `fallback` ONLY on a 403
|
|
137
|
+
* (unauthorized-for-primary). A 400 is treated as vocabulary drift and fails
|
|
138
|
+
* loudly — it means the broker does not recognise the requested purpose.
|
|
139
|
+
*/
|
|
140
|
+
tokenPurposes: {
|
|
141
|
+
primary: string;
|
|
142
|
+
fallback: string;
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Hosts (lowercased) for which the helper may serve credentials over plain
|
|
146
|
+
* HTTP instead of HTTPS. Production leaves this UNSET → https-only. The
|
|
147
|
+
* local-sim rehearsal sets it to the loopback git server's host so the
|
|
148
|
+
* clone-through-helper path can be proven without TLS. Secure by default.
|
|
149
|
+
*/
|
|
150
|
+
insecureHttpHosts?: readonly string[];
|
|
151
|
+
/** Refresh buffer in ms (overridable so tests can force a refresh). */
|
|
152
|
+
cacheBufferMs: number;
|
|
153
|
+
}
|
|
154
|
+
export declare function serializeBootContext(ctx: HostedBootContext): string;
|
|
155
|
+
/**
|
|
156
|
+
* The opaque git-password rule, as a pattern SOURCE string.
|
|
157
|
+
*
|
|
158
|
+
* ALI-1285: the Artifacts contract declares the credential opaque
|
|
159
|
+
* (`plaintext: string`), so only transport-usable shape is enforced — bounded,
|
|
160
|
+
* no whitespace, no control characters, at least 16 characters. Mirrors
|
|
161
|
+
* `workers/artifacts-runtime/contracts.ts` GIT_PASSWORD.
|
|
162
|
+
*
|
|
163
|
+
* It is kept as a SOURCE STRING, not a regex literal, because the rendered
|
|
164
|
+
* credential helper must embed the identical rule. A regex literal written
|
|
165
|
+
* inline in the renderer's template has its escapes consumed by the OUTER
|
|
166
|
+
* template literal before emission, which silently produced
|
|
167
|
+
* `[^s<NUL>-<US><DEL>]` — rejecting every credential containing `s` while
|
|
168
|
+
* accepting spaces and NBSP. Emitting via `JSON.stringify` of this constant
|
|
169
|
+
* makes the two layers provably identical, and
|
|
170
|
+
* `test/cli/hosted-credential-helper.test.ts` asserts that at the RENDERED
|
|
171
|
+
* layer by executing the emitted validator.
|
|
172
|
+
*/
|
|
173
|
+
export declare const HOSTED_OPAQUE_GIT_PASSWORD_SOURCE = "^[^\\s\\u0000-\\u001f\\u007f]{16,1024}$";
|
|
174
|
+
export declare const HOSTED_OPAQUE_GIT_PASSWORD: RegExp;
|
|
175
|
+
/**
|
|
176
|
+
* The git credential-helper script, as a self-contained CommonJS source string.
|
|
177
|
+
* Implements the `get` action (mint/emit); `store`/`erase` are no-ops because
|
|
178
|
+
* the broker owns credential truth and the script never persists what git hands
|
|
179
|
+
* back. Diagnostics go to stderr only — stdout is reserved for git's protocol.
|
|
180
|
+
*
|
|
181
|
+
* NOTE: this is a rendered ARTIFACT, exercised end-to-end as a subprocess in
|
|
182
|
+
* `test/cli/hosted-credential-helper.test.ts`; that subprocess test is the
|
|
183
|
+
* source of truth for its behavior.
|
|
184
|
+
*/
|
|
185
|
+
export declare function renderCredentialHelperScript(): string;
|
|
186
|
+
//# sourceMappingURL=hosted-runtime-assets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosted-runtime-assets.d.ts","sourceRoot":"","sources":["../src/hosted-runtime-assets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,eAAO,MAAM,sBAAsB,oCAAoC,CAAA;AACvE,eAAO,MAAM,qBAAqB,cAAc,CAAA;AAChD,eAAO,MAAM,eAAe,WAAW,CAAA;AACvC,eAAO,MAAM,wBAAwB,mBAAmB,CAAA;AAExD,6EAA6E;AAC7E,eAAO,MAAM,+BAA+B,QAAgB,CAAA;AAE5D;8EAC8E;AAC9E,eAAO,MAAM,wBAAwB,oBAAoB,CAAA;AAEzD;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;;;CAA4D,CAAA;AAI3F;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,QAK6C,CAAA;AAE9E,8EAA8E;AAC9E,eAAO,MAAM,qBAAqB,sBAAsB,CAAA;AAExD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,MAA6B,GAAG,MAAM,CAGrG;AAID;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,6BAA6B,CAAA;AAE9D;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAA;IAClB,eAAe,EAAE,MAAM,CAAA;IACvB,gBAAgB,EAAE,MAAM,CAAA;IACxB;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,MAAM,C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