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,258 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `orizu session start --hosted` — host-side driver for a CLI-triggered hosted
|
|
3
|
+
* agent session (ALI-928 / P3.5, per ADR-005). Also the thin dispatch home for
|
|
4
|
+
* the in-sandbox `orizu internal hosted-loop` (delegated to `hosted-loop.ts`).
|
|
5
|
+
*
|
|
6
|
+
* A human runs this with their NORMAL login. `startHostedSession` then:
|
|
7
|
+
* (a) opens a workspace session (its own session branch is cut server-side);
|
|
8
|
+
* (b) mints a session-scoped AGENT token (the sandbox's Orizu bearer);
|
|
9
|
+
* (c) starts a workbench run WITH THE AGENT BEARER (actor_type='agent');
|
|
10
|
+
* (d) creates the sandbox via a SandboxProvider (timeout from --duration,
|
|
11
|
+
* default 60m, cap 24h — never Vercel's 5m default);
|
|
12
|
+
* (e) bootstraps the sandbox (agent bearer in a 0600 file; broker purposes
|
|
13
|
+
* session_write/session_read chosen from bearerKind='agent');
|
|
14
|
+
* (f) launches the hosted-loop DETACHED so the CLI can exit;
|
|
15
|
+
* (g) READINESS-GATES on the loop's first event (bounded); on failure it
|
|
16
|
+
* destroys the sandbox + exits non-zero. Detached mode then prints when the
|
|
17
|
+
* sandbox self-terminates (it lives to --duration; session-end reaping is
|
|
18
|
+
* G6/ALI-1007). Attached (--tail) mode rotates + keeps the box alive +
|
|
19
|
+
* streams the tail, and REAPS the sandbox when the run terminates.
|
|
20
|
+
*
|
|
21
|
+
* TOKEN TTL vs LONG SESSIONS (decided): while attached (--tail), the CLI
|
|
22
|
+
* re-mints the agent token before expiry (default 55m) and ATOMICALLY overwrites
|
|
23
|
+
* the 0600 bearer file (temp + mv). Rotation keeps BOTH git ops and event
|
|
24
|
+
* recording alive: the in-sandbox credential helper reads the bearer per-op, AND
|
|
25
|
+
* the loop's RunEventSink resolves it per request (bearer PROVIDER + a one-shot
|
|
26
|
+
* re-resolve-and-retry on 401/403). Each rotation also extendTimeout()s the
|
|
27
|
+
* sandbox by the rotation interval (bounded by the 24h cap). A failed mint
|
|
28
|
+
* fast-retries (60s) and gives up loudly before expiry. If the host disconnects,
|
|
29
|
+
* tokens expire within the TTL (≤60m) and the loop finishes 'failed' cleanly; the
|
|
30
|
+
* sandbox timeout is independent (configurable to 24h). Documented in the
|
|
31
|
+
* secrets-policy doc §8 + the command help.
|
|
32
|
+
*
|
|
33
|
+
* Everything the command needs (provider, fetch, repo resolution, loop launch)
|
|
34
|
+
* is injectable, so the whole flow runs in-process against fakes in the
|
|
35
|
+
* local-sim end-to-end test.
|
|
36
|
+
*/
|
|
37
|
+
import { type SandboxEgressPolicy, type SandboxProvider, type SandboxSession } from './sandbox-provider.js';
|
|
38
|
+
import { type HostedFetch, type HostedRuntimePaths } from './hosted-bootstrap.js';
|
|
39
|
+
import { DEFAULT_HOSTED_MODEL, type HostedLoopContext } from './hosted-loop.js';
|
|
40
|
+
import { type StartIntentIdGenerator } from './start-intent.js';
|
|
41
|
+
export { DEFAULT_HOSTED_MODEL };
|
|
42
|
+
export declare const DEFAULT_DURATION_MINUTES = 60;
|
|
43
|
+
export declare const MAX_DURATION_MINUTES: number;
|
|
44
|
+
export declare const DEFAULT_ROTATION_INTERVAL_MS: number;
|
|
45
|
+
/** After a mint failure, retry the rotation on this short interval (not the full
|
|
46
|
+
* 55m) so a transient outage does not silently ride the token to expiry. */
|
|
47
|
+
export declare const ROTATION_FAST_RETRY_MS: number;
|
|
48
|
+
export declare const DEFAULT_AGENT_TOKEN_TTL_MINUTES = 60;
|
|
49
|
+
/** Readiness gate: how long to poll the run's events for the loop's first event
|
|
50
|
+
* before declaring the detached launch a failure. */
|
|
51
|
+
export declare const DEFAULT_READINESS_TIMEOUT_MS: number;
|
|
52
|
+
export declare const DEFAULT_READINESS_POLL_MS = 500;
|
|
53
|
+
/** Must match the coordinator Worker's session-start request ceiling. */
|
|
54
|
+
export declare const MAX_HOSTED_START_BODY_BYTES: number;
|
|
55
|
+
/** Non-secret placeholder OpenCode uses to form requests; the firewall proxy
|
|
56
|
+
* overrides the real Anthropic header (model-key brokering). NEVER a real key. */
|
|
57
|
+
export declare const ANTHROPIC_DUMMY_KEY = "sk-ant-orizu-proxy-broker-placeholder";
|
|
58
|
+
/** The broker currently drains repository lifecycle work once per minute. A
|
|
59
|
+
* durable provider `waiting` response can therefore cost a full cron period;
|
|
60
|
+
* use the server-advertised cadence and retain a five-minute resume window. */
|
|
61
|
+
export declare const REPOSITORY_PROVISIONING_RETRY_MS = 60000;
|
|
62
|
+
export declare const REPOSITORY_PROVISIONING_MAX_WAIT_MS: number;
|
|
63
|
+
/** Backward-compatible names for existing operator-path callers/tests. */
|
|
64
|
+
export declare const OPERATOR_REPOSITORY_PENDING_RETRY_MS = 60000;
|
|
65
|
+
/** @deprecated The runtime is delay-budgeted, not retry-counted. This retains
|
|
66
|
+
* the old exported symbol as the maximum count implied by the 1s wire floor. */
|
|
67
|
+
export declare const OPERATOR_REPOSITORY_PENDING_MAX_RETRIES: number;
|
|
68
|
+
/** A bounded repository wait exhausted without losing the immutable hosted
|
|
69
|
+
* start identity. Both server- and operator-provisioned paths expose the same
|
|
70
|
+
* structured recovery contract. */
|
|
71
|
+
export declare class HostedSessionRepositoryPendingError extends Error {
|
|
72
|
+
readonly sessionId: string;
|
|
73
|
+
readonly startIntentId: string;
|
|
74
|
+
readonly resumeCommand: string;
|
|
75
|
+
constructor(input: {
|
|
76
|
+
readonly sessionId: string;
|
|
77
|
+
readonly startIntentId: string;
|
|
78
|
+
readonly resumeCommand: string;
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/** Base-relative fetch (base already applied) — the host-side human fetcher. */
|
|
82
|
+
export type HostFetcher = (path: string, init?: RequestInit) => Promise<Response>;
|
|
83
|
+
/** Build a base-relative fetcher that authenticates with a specific bearer
|
|
84
|
+
* (used for the AGENT-bearer run-start against the absolute API base). */
|
|
85
|
+
export declare function bearerFetcher(apiBaseUrl: string, bearer: string, rawFetch: HostedFetch): HostFetcher;
|
|
86
|
+
export interface LaunchLoopParams {
|
|
87
|
+
session: SandboxSession;
|
|
88
|
+
context: HostedLoopContext;
|
|
89
|
+
/** Sandbox-relative + absolute paths for the run-scoped loop files. */
|
|
90
|
+
taskRel: string;
|
|
91
|
+
contextRel: string;
|
|
92
|
+
contextAbs: string;
|
|
93
|
+
logRel: string;
|
|
94
|
+
taskPrompt: string;
|
|
95
|
+
/** Agent bearer, handed through so an injected in-process launcher can run
|
|
96
|
+
* the loop without re-reading the 0600 file. */
|
|
97
|
+
bearer: string;
|
|
98
|
+
}
|
|
99
|
+
export interface RepoResolution {
|
|
100
|
+
repoFullName: string;
|
|
101
|
+
cloneUrl: string;
|
|
102
|
+
}
|
|
103
|
+
export interface StartHostedSessionOptions {
|
|
104
|
+
/** Host-side human fetcher (base-relative, authed with the human login). */
|
|
105
|
+
fetcher: HostFetcher;
|
|
106
|
+
/** Absolute Orizu API base — baked into the sandbox boot context. */
|
|
107
|
+
apiBaseUrl: string;
|
|
108
|
+
provider: SandboxProvider;
|
|
109
|
+
workspaceId: string;
|
|
110
|
+
task: string;
|
|
111
|
+
projectSlug?: string | null;
|
|
112
|
+
/** Immutable response-loss identity. Supply both fields to resume the exact
|
|
113
|
+
* pending repository; omitting both creates a fresh UUIDv4 intent. */
|
|
114
|
+
startIntentId?: string;
|
|
115
|
+
reconcileSessionId?: string;
|
|
116
|
+
model?: string;
|
|
117
|
+
reasoningEffort?: string;
|
|
118
|
+
/** Sandbox session length (minutes); default 60, hard-capped at 24h. */
|
|
119
|
+
durationMinutes?: number;
|
|
120
|
+
runtime?: string;
|
|
121
|
+
/**
|
|
122
|
+
* Pre-baked custom VCR image ref (ALI-1017), e.g. 'orizu-hosted-runtime:v1'.
|
|
123
|
+
* When set, it is passed to `Sandbox.create({ image })` AND flips the `prebaked`
|
|
124
|
+
* flag on BOTH the bootstrap and the loop together — so the sandbox image and
|
|
125
|
+
* the install-skip decision can never disagree. When unset, the from-scratch
|
|
126
|
+
* install path runs (local-sim / base runtime). Default: env ORIZU_HOSTED_IMAGE.
|
|
127
|
+
*/
|
|
128
|
+
hostedImage?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Pre-baked Vercel Sandbox SNAPSHOT id (ALI-1017, zero-Docker path). Parallel to
|
|
131
|
+
* `hostedImage`: when set it is passed to `Sandbox.create({ source:{ type:'snapshot' }})`
|
|
132
|
+
* AND flips the `prebaked` flag on bootstrap + loop together. Mutually exclusive
|
|
133
|
+
* with `hostedImage` — both set is a hard error. Default: env ORIZU_HOSTED_SNAPSHOT.
|
|
134
|
+
*/
|
|
135
|
+
hostedSnapshot?: string;
|
|
136
|
+
title?: string;
|
|
137
|
+
/** Attach: rotate the bearer + stream the run tail until it terminates. */
|
|
138
|
+
tail?: boolean;
|
|
139
|
+
/** Host-side model key; injected at the firewall proxy, never into the sandbox. */
|
|
140
|
+
modelApiKey?: string;
|
|
141
|
+
/** @deprecated The credential-helper host is derived from the resolved clone
|
|
142
|
+
* URL. Kept only as a source-compatible no-op for older library callers. */
|
|
143
|
+
host?: string;
|
|
144
|
+
/** Loopback hosts the helper may serve over plain HTTP (rehearsal only). */
|
|
145
|
+
insecureHttpHosts?: readonly string[];
|
|
146
|
+
rawFetch?: HostedFetch;
|
|
147
|
+
resolveRepo?: (workspaceId: string) => Promise<RepoResolution>;
|
|
148
|
+
launchLoop?: (params: LaunchLoopParams) => Promise<void>;
|
|
149
|
+
/** Build the sandbox egress policy from the resolved inputs. Default: G5
|
|
150
|
+
* `buildEgressPolicy` — DEFAULT-DENY base allowlist (Orizu API + model provider
|
|
151
|
+
* + git) with the model-key broker composed on, plus the per-team additive
|
|
152
|
+
* domains. Injectable for tests. */
|
|
153
|
+
buildEgressPolicy?: (input: {
|
|
154
|
+
modelApiKey?: string;
|
|
155
|
+
extraDomains: readonly string[];
|
|
156
|
+
repositoryHost: string;
|
|
157
|
+
}) => SandboxEgressPolicy | undefined;
|
|
158
|
+
/** Resolve the per-team ADDITIVE egress domains for this workspace's team
|
|
159
|
+
* (base hosts are code-owned and always present). Default: no extra domains —
|
|
160
|
+
* the production CLI injects a route-backed resolver. */
|
|
161
|
+
resolveExtraEgressDomains?: (workspaceId: string) => Promise<readonly string[]>;
|
|
162
|
+
/** Injectable bounded wait used while the server prepares an Artifacts fork. */
|
|
163
|
+
repositorySleep?: (ms: number) => Promise<void>;
|
|
164
|
+
/** Injectable UUIDv4 generator; one value is replayed for every retry. */
|
|
165
|
+
generateStartIntentId?: StartIntentIdGenerator;
|
|
166
|
+
rotationIntervalMs?: number;
|
|
167
|
+
agentTokenTtlMinutes?: number;
|
|
168
|
+
now?: () => number;
|
|
169
|
+
/** Readiness gate bound (ms); default 30s. */
|
|
170
|
+
readinessTimeoutMs?: number;
|
|
171
|
+
/** Readiness poll interval (ms); default 500ms. */
|
|
172
|
+
readinessPollMs?: number;
|
|
173
|
+
/** Test seam: override the readiness probe entirely (resolves ready/not). */
|
|
174
|
+
waitForReady?: (params: ReadinessParams) => Promise<boolean>;
|
|
175
|
+
logLine?: (line: string) => void;
|
|
176
|
+
onTailEvent?: (event: Record<string, unknown>) => void;
|
|
177
|
+
/** Test hook: the live sandbox + its run-scoped paths, after a successful
|
|
178
|
+
* bootstrap (used by the e2e for residue-sweep + bearer-file inspection). */
|
|
179
|
+
onSandboxReady?: (info: {
|
|
180
|
+
session: SandboxSession;
|
|
181
|
+
paths: HostedRuntimePaths;
|
|
182
|
+
}) => void;
|
|
183
|
+
/** Await the tail loop when attached (tests pass a bounded tailer). */
|
|
184
|
+
tailImpl?: (params: TailParams) => Promise<void>;
|
|
185
|
+
}
|
|
186
|
+
export interface TailParams {
|
|
187
|
+
fetcher: HostFetcher;
|
|
188
|
+
runId: string;
|
|
189
|
+
onEvent?: (event: Record<string, unknown>) => void;
|
|
190
|
+
}
|
|
191
|
+
export interface ReadinessParams {
|
|
192
|
+
fetcher: HostFetcher;
|
|
193
|
+
runId: string;
|
|
194
|
+
timeoutMs: number;
|
|
195
|
+
pollMs: number;
|
|
196
|
+
now: () => number;
|
|
197
|
+
sleep: (ms: number) => Promise<void>;
|
|
198
|
+
log: (line: string) => void;
|
|
199
|
+
}
|
|
200
|
+
export interface StartHostedSessionResult {
|
|
201
|
+
ok: boolean;
|
|
202
|
+
sessionId: string;
|
|
203
|
+
runId: string;
|
|
204
|
+
sandboxId: string;
|
|
205
|
+
repoFullName: string;
|
|
206
|
+
sessionBranch: string;
|
|
207
|
+
agentUserId: string | null;
|
|
208
|
+
bootstrapOk: boolean;
|
|
209
|
+
error: string | null;
|
|
210
|
+
}
|
|
211
|
+
export declare function repositoryResolutionFromMint(minted: Record<string, unknown>): RepoResolution;
|
|
212
|
+
export declare function startHostedSession(opts: StartHostedSessionOptions): Promise<StartHostedSessionResult>;
|
|
213
|
+
export interface HostedCommandIo {
|
|
214
|
+
print: (line: string) => void;
|
|
215
|
+
printErr?: (line: string) => void;
|
|
216
|
+
json?: boolean;
|
|
217
|
+
}
|
|
218
|
+
/** Printed on EVERY `--operator` use (founder-locked: deprecate NOW, remove
|
|
219
|
+
* after Phase 6 validation). Loud on purpose. */
|
|
220
|
+
export declare const OPERATOR_DEPRECATION_WARNING: string;
|
|
221
|
+
/**
|
|
222
|
+
* Default hosted path (ALI-1055 cutover): POST the server's hosted-sessions
|
|
223
|
+
* route and let the Durable Object coordinator own the sandbox lifetime. The
|
|
224
|
+
* CLI never reads VERCEL_* or a model key on this path — the server holds them.
|
|
225
|
+
*/
|
|
226
|
+
/** Bounded reconcile of a start that the coordinator reported still-in-flight
|
|
227
|
+
* (R7 P4). Each retry re-pokes the SAME session by its returned sessionId, so
|
|
228
|
+
* a race that momentarily answers start_pending never spawns a duplicate.
|
|
229
|
+
*
|
|
230
|
+
* R8 P2 — the retry budget must OUTLIVE a stale start lease. If a start-lease
|
|
231
|
+
* owner crashed WITHOUT running its release, the lease lingers until its TTL
|
|
232
|
+
* (the coordinator's START_LEASE_TTL_MS = 3 × CALLBACK_TIMEOUT_MS = 30s), and
|
|
233
|
+
* every duplicate poke sees it and answers start_pending. So the CLI's OWN
|
|
234
|
+
* cumulative backoff (independent of server-side watch time) must exceed that
|
|
235
|
+
* TTL plus margin, so the CLI keeps polling until the lease expires and a
|
|
236
|
+
* retry then wins — rather than giving up while the crashed owner's lease
|
|
237
|
+
* still lingers. COORDINATOR_START_LEASE_TTL_MS mirrors the worker constant
|
|
238
|
+
* and is pinned to it by a contract test in the CLI suite. */
|
|
239
|
+
export declare const COORDINATOR_START_LEASE_TTL_MS = 30000;
|
|
240
|
+
export declare const HOSTED_START_PENDING_RETRY_MS = 2000;
|
|
241
|
+
export declare const HOSTED_START_PENDING_MAX_RETRIES: number;
|
|
242
|
+
export declare function startHostedViaServer(args: readonly string[], workspaceId: string, task: string, tail: boolean, io: HostedCommandIo, fetcher?: HostFetcher, sleep?: (ms: number) => Promise<void>, generateStartIntentId?: StartIntentIdGenerator): Promise<number>;
|
|
243
|
+
/** Test seams for `hostedCommand` dispatch (server default vs operator hatch). */
|
|
244
|
+
export interface HostedCommandDeps {
|
|
245
|
+
startViaServer?: typeof startHostedViaServer;
|
|
246
|
+
startViaOperator?: (args: string[], workspaceId: string, task: string, tail: boolean, io: HostedCommandIo) => Promise<number>;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Dispatch `orizu internal hosted-loop` (in-sandbox) and `orizu session start
|
|
250
|
+
* --hosted` (host-side). Kept out of index.ts so the CLI entrypoint stays a thin
|
|
251
|
+
* dispatcher (ALI-976 ratchet).
|
|
252
|
+
*
|
|
253
|
+
* ALI-1055 cutover: the DEFAULT is the server path (POST /api/cli/hosted-sessions
|
|
254
|
+
* → DO coordinator). `--operator` keeps the old client-provisioned flow as a
|
|
255
|
+
* DEPRECATED escape hatch (loud warning on every use; removal after Phase 6).
|
|
256
|
+
*/
|
|
257
|
+
export declare function hostedCommand(args: string[], io: HostedCommandIo, deps?: HostedCommandDeps): Promise<number>;
|
|
258
|
+
//# sourceMappingURL=hosted-session-cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosted-session-cli.d.ts","sourceRoot":"","sources":["../src/hosted-session-cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAIH,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACxB,MAAM,uBAAuB,CAAA;AAK9B,OAAO,EAAE,oBAAoB,EAAqB,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAMlG,OAAO,EAKL,KAAK,sBAAsB,EAC5B,MAAM,mBAAmB,CAAA;AAQ1B,OAAO,EAAE,oBAAoB,EAAE,CAAA;AAC/B,eAAO,MAAM,wBAAwB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ared orizu-cli skill staging (ALI-1044 / ALI-1059).
|
|
3
|
+
*
|
|
4
|
+
* BOTH hosted boot paths must stage the vendored `orizu-cli` skill into the
|
|
5
|
+
* cloned workspace so the agent discovers the Orizu workflows: the OPERATOR path
|
|
6
|
+
* (hosted-bootstrap.ts) and the DO path (hosted-boot.ts). Before ALI-1059 only the
|
|
7
|
+
* operator path did — the DO path (the default; `--operator` is deprecated) booted
|
|
8
|
+
* an authenticated CLI that never found the skill. This module is the ONE
|
|
9
|
+
* implementation of the resolution chain and the `.git/info/exclude` append; each
|
|
10
|
+
* path adapts its own exec seam and records the outcome its own way (a run-event
|
|
11
|
+
* sink vs. a boot log).
|
|
12
|
+
*
|
|
13
|
+
* Resolution chain (unchanged from the original operator-path block), preferring:
|
|
14
|
+
* (1) $ORIZU_SKILL_SOURCE_DIR — explicit override (also honored by the CLI's
|
|
15
|
+
* skill-installer; the local-sim rehearsal sets it),
|
|
16
|
+
* (2) `orizu skills path` — the packaged vendor/skills/orizu-cli of the
|
|
17
|
+
* globally-installed CLI (the production path),
|
|
18
|
+
* (3) `$(npm root -g)/orizu/vendor/skills/orizu-cli` — belt fallback.
|
|
19
|
+
* Then SYMLINK it under `<workspaceDir>/.claude/skills/orizu-cli`, falling back to
|
|
20
|
+
* a copy if the symlink cannot be created. Resolved paths stay in shell vars
|
|
21
|
+
* (never interpolated), so they cannot inject into the command.
|
|
22
|
+
*
|
|
23
|
+
* HARVEST-SAFE (ALI-1051): the script appends `/.claude/skills/` to the repo-LOCAL
|
|
24
|
+
* `.git/info/exclude` so auto-harvest's `git add -A` cannot sweep the staged
|
|
25
|
+
* symlink into the session branch (hosted-harvest.ts also excludes it by pathspec,
|
|
26
|
+
* belt-and-braces).
|
|
27
|
+
*/
|
|
28
|
+
export interface SkillStageExecResult {
|
|
29
|
+
exitCode: number;
|
|
30
|
+
stdout: string;
|
|
31
|
+
stderr: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Runs a POSIX shell command string, returning its exit code + captured output.
|
|
35
|
+
* The operator path adapts `SandboxSession.exec`; the DO path adapts its
|
|
36
|
+
* `BootExec` via `sh -c`. Kept as an injected seam so both callers — and tests —
|
|
37
|
+
* share one script and one output parser.
|
|
38
|
+
*/
|
|
39
|
+
export type SkillStageExec = (command: string) => Promise<SkillStageExecResult>;
|
|
40
|
+
export interface StageOrizuSkillOptions {
|
|
41
|
+
/**
|
|
42
|
+
* Directory the session branch is cloned into (ABSOLUTE on the DO path,
|
|
43
|
+
* sandbox-root RELATIVE on the operator path). The skill is staged under
|
|
44
|
+
* `<workspaceDir>/.claude/skills/orizu-cli`.
|
|
45
|
+
*/
|
|
46
|
+
workspaceDir: string;
|
|
47
|
+
exec: SkillStageExec;
|
|
48
|
+
}
|
|
49
|
+
export interface StageOrizuSkillResult {
|
|
50
|
+
ok: boolean;
|
|
51
|
+
method: 'symlink' | 'copy' | null;
|
|
52
|
+
/** `<workspaceDir>/.claude/skills/orizu-cli`. */
|
|
53
|
+
dest: string;
|
|
54
|
+
exitCode: number;
|
|
55
|
+
stdout: string;
|
|
56
|
+
stderr: string;
|
|
57
|
+
}
|
|
58
|
+
/** The exact staging script — exported for tests that assert its shape. */
|
|
59
|
+
export declare function renderStageOrizuSkillScript(workspaceDir: string): string;
|
|
60
|
+
/**
|
|
61
|
+
* Stage the orizu-cli skill into `<workspaceDir>/.claude/skills/orizu-cli`.
|
|
62
|
+
* Non-throwing (except via the injected exec): resolves to a structured result
|
|
63
|
+
* both callers record their own way. A malformed `workspaceDir` returns a non-ok
|
|
64
|
+
* result rather than throwing, so staging stays non-fatal to the boot.
|
|
65
|
+
*
|
|
66
|
+
* TRUSTED-DIR CONTRACT: `workspaceDir` must be a trusted, internally-constructed
|
|
67
|
+
* non-traversal directory. The shell-safety guard blocks injection metacharacters
|
|
68
|
+
* but deliberately does not reject `..` or a leading `-` — do not pass untrusted
|
|
69
|
+
* input here. Idempotent: safe to re-invoke (e.g. ALI-1060 resume/retry) — the
|
|
70
|
+
* `.git/info/exclude` line is appended only when absent.
|
|
71
|
+
*/
|
|
72
|
+
export declare function stageOrizuSkill(opts: StageOrizuSkillOptions): Promise<StageOrizuSkillResult>;
|
|
73
|
+
//# sourceMappingURL=hosted-skill-staging.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosted-skill-staging.d.ts","sourceRoot":"","sources":["../src/hosted-skill-staging.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAA;AAE/E,MAAM,WAAW,sBAAsB;IACrC;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAA;IACpB,IAAI,EAAE,cAAc,CAAA;CACrB;AAED,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,OAAO,CAAA;IACX,MAAM,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAAA;IACjC,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACf;AAUD,2EAA2E;AAC3E,wBAAgB,2BAA2B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAmBxE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAqBlG"}
|
package/dist/http.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GlobalFlags } from './global-flags.js';
|
|
2
|
+
export declare function setGlobalFlags(flags: GlobalFlags): void;
|
|
3
|
+
export declare function resolveBaseUrl(flags?: GlobalFlags): string;
|
|
4
|
+
export declare function resolveLoginBaseUrl(flags?: GlobalFlags): string;
|
|
5
|
+
export declare function getBaseUrl(): string;
|
|
6
|
+
export declare function assertSecureTokenTransport(baseUrl: string): void;
|
|
7
|
+
export declare function authedFetch(path: string, init?: RequestInit): Promise<Response>;
|
|
8
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAMA,OAAO,EAAkB,WAAW,EAAoB,MAAM,mBAAmB,CAAA;AAKjF,wBAAgB,cAAc,CAAC,KAAK,EAAE,WAAW,QAEhD;AAED,wBAAgB,cAAc,CAAC,KAAK,GAAE,WAA0B,GAAG,MAAM,CAiBxE;AAED,wBAAgB,mBAAmB,CAAC,KAAK,GAAE,WAA0B,GAAG,MAAM,CAY7E;AAED,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAWD,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,MAAM,QAmBzD;AA8CD,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,WAAgB,qBAkDrE"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export { loadInstructionSet } from './instruction-set-loader.js';
|
|
3
|
+
export { parseJsonResponse, sanitizeTerminalText } from './json-response.js';
|
|
4
|
+
export declare function normalizeSlugInput(slug: string): string;
|
|
5
|
+
export declare function expandHomePath(path: string): string;
|
|
6
|
+
export declare function createCodeChallenge(verifier: string): string;
|
|
7
|
+
export declare function validateBrowserUrl(url: string, expectedOrigin?: string): URL;
|
|
8
|
+
export declare function formatTerminalLink(url: string): string;
|
|
9
|
+
export declare function readRunnerManifest(runnerDir: string): {
|
|
10
|
+
command: string[];
|
|
11
|
+
supports_body_kind?: string[];
|
|
12
|
+
};
|
|
13
|
+
export declare const RUNNER_TIMEOUT_MS = 120000;
|
|
14
|
+
export declare const RUNNER_OUTPUT_MAX_BYTES: number;
|
|
15
|
+
export declare const RUNNER_ENV_ALLOWLIST: Set<string>;
|
|
16
|
+
export declare function runnerSubprocessEnv(inputPath: string, outputPath: string, instructionSetDir?: string): NodeJS.ProcessEnv;
|
|
17
|
+
export declare function materializeRunnerVersion(runnerVersionId: string): Promise<{
|
|
18
|
+
runnerDir: string;
|
|
19
|
+
cleanup: () => void;
|
|
20
|
+
}>;
|
|
21
|
+
export declare function main(rawArgs?: string[]): Promise<void>;
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AA2FgF,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AA8BhJ,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAgU5E,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvD;AAUD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOnD;AAyBD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE5D;AAcD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,GAAG,CAqB5E;AA6BD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAgBtD;AA+jKD,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CA0B1G;AAED,eAAO,MAAM,iBAAiB,SAAU,CAAA;AACxC,eAAO,MAAM,uBAAuB,QAAkB,CAAA;AACtD,eAAO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