gh-inari 0.16.0 → 0.17.1
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/.codex-plugin/plugin.json +1 -1
- package/README.md +8 -0
- package/dist/admission/authorization.d.ts +68 -0
- package/dist/admission/authorization.js +419 -0
- package/dist/admission/authorization.js.map +1 -0
- package/dist/admission/server.d.ts +50 -0
- package/dist/admission/server.js +529 -0
- package/dist/admission/server.js.map +1 -0
- package/dist/admission/setup.d.ts +27 -0
- package/dist/admission/setup.js +84 -0
- package/dist/admission/setup.js.map +1 -0
- package/dist/agent-authority/branch-advance.js +12 -4
- package/dist/agent-authority/branch-advance.js.map +1 -1
- package/dist/agent-authority/capability-admission.js +3 -2
- package/dist/agent-authority/capability-admission.js.map +1 -1
- package/dist/agent-authority/capability-provenance.js +12 -6
- package/dist/agent-authority/capability-provenance.js.map +1 -1
- package/dist/agent-authority/capability.d.ts +5 -3
- package/dist/agent-authority/capability.js +18 -15
- package/dist/agent-authority/capability.js.map +1 -1
- package/dist/application/setup/actions.d.ts +38 -0
- package/dist/application/setup/actions.js +283 -0
- package/dist/application/setup/actions.js.map +1 -0
- package/dist/application/setup/index.d.ts +7 -0
- package/dist/application/setup/index.js +8 -0
- package/dist/application/setup/index.js.map +1 -0
- package/dist/application/setup/state.d.ts +139 -0
- package/dist/application/setup/state.js +451 -0
- package/dist/application/setup/state.js.map +1 -0
- package/dist/authority/index.d.ts +2 -0
- package/dist/authority/index.js +3 -0
- package/dist/authority/index.js.map +1 -0
- package/dist/authority/local-migration.d.ts +134 -0
- package/dist/authority/local-migration.js +599 -0
- package/dist/authority/local-migration.js.map +1 -0
- package/dist/authority/local-runtime-authority.d.ts +28 -0
- package/dist/authority/local-runtime-authority.js +64 -0
- package/dist/authority/local-runtime-authority.js.map +1 -0
- package/dist/authority/setup-trust.d.ts +22 -0
- package/dist/authority/setup-trust.js +51 -0
- package/dist/authority/setup-trust.js.map +1 -0
- package/dist/authorized-execution.js +15 -4
- package/dist/authorized-execution.js.map +1 -1
- package/dist/branch-naming.d.ts +85 -4
- package/dist/branch-naming.js +231 -10
- package/dist/branch-naming.js.map +1 -1
- package/dist/change.d.ts +8 -0
- package/dist/change.js +106 -4
- package/dist/change.js.map +1 -1
- package/dist/cli/runtime/admission-client.d.ts +49 -0
- package/dist/cli/runtime/admission-client.js +315 -0
- package/dist/cli/runtime/admission-client.js.map +1 -0
- package/dist/cli/runtime/branch-observation.d.ts +34 -0
- package/dist/cli/runtime/branch-observation.js +185 -0
- package/dist/cli/runtime/branch-observation.js.map +1 -0
- package/dist/cli/runtime/role-status.d.ts +11 -0
- package/dist/cli/runtime/role-status.js +59 -0
- package/dist/cli/runtime/role-status.js.map +1 -0
- package/dist/cli/runtime/session-launcher.d.ts +40 -0
- package/dist/cli/runtime/session-launcher.js +352 -0
- package/dist/cli/runtime/session-launcher.js.map +1 -0
- package/dist/cli/setup/index.d.ts +47 -0
- package/dist/cli/setup/index.js +156 -0
- package/dist/cli/setup/index.js.map +1 -0
- package/dist/cli-core.d.ts +9 -0
- package/dist/cli-core.js +502 -87
- package/dist/cli-core.js.map +1 -1
- package/dist/command-contract.d.ts +9 -4
- package/dist/command-contract.js +21 -3
- package/dist/command-contract.js.map +1 -1
- package/dist/composition/local-runtime-roles.d.ts +13 -0
- package/dist/composition/local-runtime-roles.js +18 -0
- package/dist/composition/local-runtime-roles.js.map +1 -0
- package/dist/composition/setup-adapters.d.ts +39 -0
- package/dist/composition/setup-adapters.js +567 -0
- package/dist/composition/setup-adapters.js.map +1 -0
- package/dist/composition/setup-config-store.d.ts +67 -0
- package/dist/composition/setup-config-store.js +251 -0
- package/dist/composition/setup-config-store.js.map +1 -0
- package/dist/composition/setup-host.d.ts +107 -0
- package/dist/composition/setup-host.js +581 -0
- package/dist/composition/setup-host.js.map +1 -0
- package/dist/composition/setup-journal-store.d.ts +19 -0
- package/dist/composition/setup-journal-store.js +161 -0
- package/dist/composition/setup-journal-store.js.map +1 -0
- package/dist/composition/setup-observation.d.ts +146 -0
- package/dist/composition/setup-observation.js +617 -0
- package/dist/composition/setup-observation.js.map +1 -0
- package/dist/console/api.d.ts +16 -0
- package/dist/console/api.js +134 -0
- package/dist/console/api.js.map +1 -0
- package/dist/console/enrollment-forwarder.d.ts +4 -0
- package/dist/console/enrollment-forwarder.js +26 -0
- package/dist/console/enrollment-forwarder.js.map +1 -0
- package/dist/console/operator-session.d.ts +26 -0
- package/dist/console/operator-session.js +64 -0
- package/dist/console/operator-session.js.map +1 -0
- package/dist/console/public-assets.d.ts +19 -0
- package/dist/console/public-assets.js +72 -0
- package/dist/console/public-assets.js.map +1 -0
- package/dist/contract/ir.d.ts +4 -0
- package/dist/contract/ir.js +5 -1
- package/dist/contract/ir.js.map +1 -1
- package/dist/executor/credential-store.d.ts +45 -0
- package/dist/executor/credential-store.js +289 -0
- package/dist/executor/credential-store.js.map +1 -0
- package/dist/executor/enrollment/issuer-reference.d.ts +9 -0
- package/dist/executor/enrollment/issuer-reference.js +50 -0
- package/dist/executor/enrollment/issuer-reference.js.map +1 -0
- package/dist/executor/enrollment/owner.d.ts +46 -0
- package/dist/executor/enrollment/owner.js +270 -0
- package/dist/executor/enrollment/owner.js.map +1 -0
- package/dist/executor/enrollment/server.d.ts +11 -0
- package/dist/executor/enrollment/server.js +46 -0
- package/dist/executor/enrollment/server.js.map +1 -0
- package/dist/executor/errors.d.ts +5 -0
- package/dist/executor/errors.js +10 -0
- package/dist/executor/errors.js.map +1 -0
- package/dist/executor/execution.d.ts +48 -0
- package/dist/executor/execution.js +477 -0
- package/dist/executor/execution.js.map +1 -0
- package/dist/executor/issuer-input.d.ts +33 -0
- package/dist/executor/issuer-input.js +82 -0
- package/dist/executor/issuer-input.js.map +1 -0
- package/dist/executor/server.d.ts +17 -0
- package/dist/executor/server.js +196 -0
- package/dist/executor/server.js.map +1 -0
- package/dist/executor/setup.d.ts +25 -0
- package/dist/executor/setup.js +79 -0
- package/dist/executor/setup.js.map +1 -0
- package/dist/github/adapter-core.d.ts +219 -0
- package/dist/github/adapter-core.js +2180 -0
- package/dist/github/adapter-core.js.map +1 -0
- package/dist/github/adapter.d.ts +4 -200
- package/dist/github/adapter.js +33 -2139
- package/dist/github/adapter.js.map +1 -1
- package/dist/github/change-state-projector.d.ts +9 -0
- package/dist/github/change-state-projector.js +77 -20
- package/dist/github/change-state-projector.js.map +1 -1
- package/dist/github/direct-app-execution.d.ts +1 -12
- package/dist/github/direct-app-execution.js +4 -119
- package/dist/github/direct-app-execution.js.map +1 -1
- package/dist/github/git-data-capability.js +11 -12
- package/dist/github/git-data-capability.js.map +1 -1
- package/dist/github/index.d.ts +1 -0
- package/dist/github/index.js +1 -0
- package/dist/github/index.js.map +1 -1
- package/dist/github/pr-publication-provider.d.ts +13 -0
- package/dist/github/pr-publication-provider.js +131 -0
- package/dist/github/pr-publication-provider.js.map +1 -0
- package/dist/github/repository-evidence-reader.js +2 -2
- package/dist/github/repository-evidence-reader.js.map +1 -1
- package/dist/github/standalone-adapter.d.ts +2 -0
- package/dist/github/standalone-adapter.js +3 -0
- package/dist/github/standalone-adapter.js.map +1 -0
- package/dist/governance.d.ts +15 -1
- package/dist/governance.js +59 -0
- package/dist/governance.js.map +1 -1
- package/dist/hosted-worker.js +3 -48
- package/dist/hosted-worker.js.map +1 -1
- package/dist/implementation-change-identity.js +16 -6
- package/dist/implementation-change-identity.js.map +1 -1
- package/dist/implementation-frontier-composition.d.ts +2 -1
- package/dist/implementation-frontier-composition.js +2 -1
- package/dist/implementation-frontier-composition.js.map +1 -1
- package/dist/integration-routing.js +44 -6
- package/dist/integration-routing.js.map +1 -1
- package/dist/local-application-state.d.ts +2 -0
- package/dist/local-application-state.js +28 -33
- package/dist/local-application-state.js.map +1 -1
- package/dist/local-control/admission-client.d.ts +2 -40
- package/dist/local-control/admission-client.js +2 -239
- package/dist/local-control/admission-client.js.map +1 -1
- package/dist/local-control/admission-server.d.ts +8 -45
- package/dist/local-control/admission-server.js +8 -738
- package/dist/local-control/admission-server.js.map +1 -1
- package/dist/local-control/config.d.ts +20 -0
- package/dist/local-control/config.js +84 -10
- package/dist/local-control/config.js.map +1 -1
- package/dist/local-control/executor-client.d.ts +13 -3
- package/dist/local-control/executor-client.js +45 -2
- package/dist/local-control/executor-client.js.map +1 -1
- package/dist/local-control/executor-http.d.ts +20 -0
- package/dist/local-control/executor-http.js +158 -8
- package/dist/local-control/executor-http.js.map +1 -1
- package/dist/local-control/executor-server.d.ts +3 -39
- package/dist/local-control/executor-server.js +8 -580
- package/dist/local-control/executor-server.js.map +1 -1
- package/dist/local-control/identity.d.ts +14 -0
- package/dist/local-control/identity.js +53 -1
- package/dist/local-control/identity.js.map +1 -1
- package/dist/local-control/runtime-discovery.d.ts +2 -1
- package/dist/local-control/runtime-discovery.js +8 -3
- package/dist/local-control/runtime-discovery.js.map +1 -1
- package/dist/local-control/session-binding.d.ts +4 -0
- package/dist/local-control/session-binding.js +22 -0
- package/dist/local-control/session-binding.js.map +1 -1
- package/dist/local-control/session-launcher.d.ts +2 -38
- package/dist/local-control/session-launcher.js +2 -309
- package/dist/local-control/session-launcher.js.map +1 -1
- package/dist/local-control/supervisor.d.ts +44 -0
- package/dist/local-control/supervisor.js +155 -53
- package/dist/local-control/supervisor.js.map +1 -1
- package/dist/local-runtime-profile.d.ts +8 -0
- package/dist/local-runtime-profile.js +23 -0
- package/dist/local-runtime-profile.js.map +1 -1
- package/dist/mcp/tools.d.ts +3 -3
- package/dist/pr-policy.d.ts +8 -0
- package/dist/pr-policy.js +13 -2
- package/dist/pr-policy.js.map +1 -1
- package/dist/relay/local-runtime-config-credentials.d.ts +13 -0
- package/dist/relay/local-runtime-config-credentials.js +52 -0
- package/dist/relay/local-runtime-config-credentials.js.map +1 -0
- package/dist/relay/local-runtime-config.d.ts +3 -11
- package/dist/relay/local-runtime-config.js +2 -44
- package/dist/relay/local-runtime-config.js.map +1 -1
- package/dist/repository-branch-policy.d.ts +156 -0
- package/dist/repository-branch-policy.js +277 -0
- package/dist/repository-branch-policy.js.map +1 -0
- package/dist/repository-setup.d.ts +28 -1
- package/dist/repository-setup.js +91 -11
- package/dist/repository-setup.js.map +1 -1
- package/dist/runtime-contracts/command.d.ts +9 -0
- package/dist/runtime-contracts/command.js +37 -0
- package/dist/runtime-contracts/command.js.map +1 -0
- package/dist/runtime-contracts/components.d.ts +26 -0
- package/dist/runtime-contracts/components.js +112 -0
- package/dist/runtime-contracts/components.js.map +1 -0
- package/dist/runtime-contracts/enrollment.d.ts +62 -0
- package/dist/runtime-contracts/enrollment.js +95 -0
- package/dist/runtime-contracts/enrollment.js.map +1 -0
- package/dist/runtime-contracts/errors.d.ts +13 -0
- package/dist/runtime-contracts/errors.js +14 -0
- package/dist/runtime-contracts/errors.js.map +1 -0
- package/dist/runtime-contracts/index.d.ts +13 -0
- package/dist/runtime-contracts/index.js +14 -0
- package/dist/runtime-contracts/index.js.map +1 -0
- package/dist/runtime-contracts/ports.d.ts +107 -0
- package/dist/runtime-contracts/ports.js +2 -0
- package/dist/runtime-contracts/ports.js.map +1 -0
- package/dist/runtime-contracts/runtime-failure.d.ts +95 -0
- package/dist/runtime-contracts/runtime-failure.js +167 -0
- package/dist/runtime-contracts/runtime-failure.js.map +1 -0
- package/dist/runtime-contracts/secret-material.d.ts +19 -0
- package/dist/runtime-contracts/secret-material.js +133 -0
- package/dist/runtime-contracts/secret-material.js.map +1 -0
- package/dist/runtime-contracts/setup-primitives.d.ts +34 -0
- package/dist/runtime-contracts/setup-primitives.js +80 -0
- package/dist/runtime-contracts/setup-primitives.js.map +1 -0
- package/dist/runtime-contracts/setup.d.ts +128 -0
- package/dist/runtime-contracts/setup.js +263 -0
- package/dist/runtime-contracts/setup.js.map +1 -0
- package/dist/setup-console/index.html +23 -0
- package/dist/setup-console/setup-console.js +1640 -0
- package/dist/setup-console/styles.css +218 -0
- package/package.json +20 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "inari",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.1",
|
|
4
4
|
"description": "Governed GitHub Issue/PR/template workflows via the inari CLI. Prefer inari over raw gh for operations it owns; use inari skill for operational playbooks.",
|
|
5
5
|
"skills": "skills/inari"
|
|
6
6
|
}
|
package/README.md
CHANGED
|
@@ -52,6 +52,14 @@ Setup stores only a repository-scoped, secret-free Runtime profile. It never
|
|
|
52
52
|
commits, pushes, approves, or merges Runtime Authority trust; `ready` is
|
|
53
53
|
reported only after canonical protected-ref readiness succeeds.
|
|
54
54
|
|
|
55
|
+
The local setup state is shared by the CLI and a loopback browser console:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
inari setup status # canonical state and the one next action
|
|
59
|
+
inari setup next # perform exactly that action through its owner
|
|
60
|
+
inari setup console # owned loopback setup host; works before any key or trust
|
|
61
|
+
```
|
|
62
|
+
|
|
55
63
|
## The governed path
|
|
56
64
|
|
|
57
65
|
```text
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { LocalSessionBinding } from "../local-control/session-binding.js";
|
|
2
|
+
import type { LocalExecutorEvidenceRequest } from "../local-control/executor-http.js";
|
|
3
|
+
import { type ExecutionIntent } from "../local-control/execution-intent.js";
|
|
4
|
+
import { type Delegator } from "../agent-authority/delegator.js";
|
|
5
|
+
import type { SessionCertificateRepository } from "../agent-authority/session-certificate.js";
|
|
6
|
+
import { type AuthorizedExecution } from "../authorized-execution.js";
|
|
7
|
+
import { type ChangeProjectionResult } from "../change.js";
|
|
8
|
+
import { type LocalBranchPolicyInput } from "../cli/runtime/branch-observation.js";
|
|
9
|
+
import type { LocalExecutorBranchPolicyRequest } from "../local-control/executor-http.js";
|
|
10
|
+
import { type RuntimeFailure, type RuntimeFailureReason, type RuntimeFailureStage } from "../runtime-contracts/runtime-failure.js";
|
|
11
|
+
/** Bounded Admission denial carrying the owner stage and catalog reason (#1180). */
|
|
12
|
+
export declare class AdmissionAuthorizationError extends Error {
|
|
13
|
+
readonly code: RuntimeFailureReason;
|
|
14
|
+
readonly runtimeFailure: RuntimeFailure;
|
|
15
|
+
constructor(stage: RuntimeFailureStage, code: RuntimeFailureReason, message: string);
|
|
16
|
+
}
|
|
17
|
+
/** Reads current Executor evidence through the neutral Executor client protocol. */
|
|
18
|
+
export type AdmissionEvidenceReader = (request: LocalExecutorEvidenceRequest) => Promise<unknown>;
|
|
19
|
+
export interface AdmissionAuthorizationOptions {
|
|
20
|
+
readonly runtimeAuthority: Delegator;
|
|
21
|
+
readonly readEvidence: AdmissionEvidenceReader;
|
|
22
|
+
readonly environment?: NodeJS.ProcessEnv;
|
|
23
|
+
readonly now?: () => Date;
|
|
24
|
+
/**
|
|
25
|
+
* Reads the current repository branch-policy input from the Executor owner
|
|
26
|
+
* (#1179). Admission verifies every observed Session binding against this
|
|
27
|
+
* current evidence; it never accepts a caller-supplied observation.
|
|
28
|
+
*/
|
|
29
|
+
readonly readBranchPolicy?: (request: LocalExecutorBranchPolicyRequest) => Promise<unknown>;
|
|
30
|
+
}
|
|
31
|
+
/** Current, owner-acquired branch-policy input for one governed Implementation. */
|
|
32
|
+
export declare function currentBranchPolicyInput(repository: SessionCertificateRepository, implementation: number, options: AdmissionAuthorizationOptions, stage: RuntimeFailureStage): Promise<LocalBranchPolicyInput>;
|
|
33
|
+
export interface AdmittedSession {
|
|
34
|
+
readonly id: string;
|
|
35
|
+
readonly status: string;
|
|
36
|
+
readonly exp: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Repository-bound Session readiness (#1182): the same current Executor
|
|
40
|
+
* repository binding and protected-ref trust evidence Session registration
|
|
41
|
+
* requires, for the Authority the caller expects Admission to have pinned. It
|
|
42
|
+
* admits nothing and stores nothing; every failure throws a bounded denial.
|
|
43
|
+
*/
|
|
44
|
+
export declare function observeRepositoryReadiness(repository: SessionCertificateRepository, expectedAuthority: {
|
|
45
|
+
readonly id: string;
|
|
46
|
+
readonly publicKeyFingerprint: string;
|
|
47
|
+
}, options: AdmissionAuthorizationOptions): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* A read on behalf of an active Session (#1181): the Session exists, is active
|
|
50
|
+
* and is bound to exactly the requested repository. It authorizes no effect.
|
|
51
|
+
*/
|
|
52
|
+
export declare function requireActiveSessionRepository(sessionId: string, repository: SessionCertificateRepository, options: AdmissionAuthorizationOptions): LocalSessionBinding;
|
|
53
|
+
/**
|
|
54
|
+
* The current Change projection of the Session's Implementation (#1181), from
|
|
55
|
+
* the same Executor evidence and Authority/repository checks every execution
|
|
56
|
+
* uses. Read-only; it authorizes nothing.
|
|
57
|
+
*/
|
|
58
|
+
export declare function currentSessionChange(binding: LocalSessionBinding, options: AdmissionAuthorizationOptions): Promise<ChangeProjectionResult>;
|
|
59
|
+
/** Admits a validated Session binding against current Executor trust evidence. */
|
|
60
|
+
export declare function admitSession(binding: LocalSessionBinding, options: AdmissionAuthorizationOptions): Promise<AdmittedSession>;
|
|
61
|
+
/** Closes a validated Session binding against current Executor trust evidence. */
|
|
62
|
+
export declare function closeSession(binding: LocalSessionBinding, options: AdmissionAuthorizationOptions): Promise<Omit<AdmittedSession, "exp">>;
|
|
63
|
+
/**
|
|
64
|
+
* Produces an `AuthorizedExecution` for a validated ExecutionIntent on an
|
|
65
|
+
* active Session, after every current-evidence, Implementation and capability
|
|
66
|
+
* check. It never dispatches the execution.
|
|
67
|
+
*/
|
|
68
|
+
export declare function authorizeExecutionIntent(intent: ExecutionIntent, sessionId: string, options: AdmissionAuthorizationOptions): Promise<AuthorizedExecution>;
|
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admission authorization (#1107). Private Admission module: it admits and
|
|
3
|
+
* closes Sessions against current Executor trust evidence and produces an
|
|
4
|
+
* `AuthorizedExecution` only after the existing Session, repository, task,
|
|
5
|
+
* Implementation, capability, expiry and replay checks. It reuses the pure
|
|
6
|
+
* Session, Delegator and capability validators, reaches the Executor only
|
|
7
|
+
* through the evidence reader it is given, and holds no provider credential or
|
|
8
|
+
* private signing key. Every failure throws; the server maps it to a bounded
|
|
9
|
+
* denial.
|
|
10
|
+
*/
|
|
11
|
+
import { closeAdmissionSession, createAdmissionSession, readAdmissionSession } from "../local-control/session-store.js";
|
|
12
|
+
import { executionIntentIssue } from "../local-control/execution-intent.js";
|
|
13
|
+
import { validateDelegator } from "../agent-authority/delegator.js";
|
|
14
|
+
import { delegatorPublicKeyFingerprint } from "../agent-authority/delegator-key.js";
|
|
15
|
+
import { admitAuthenticatedSessionCapability, } from "../agent-authority/capability-admission.js";
|
|
16
|
+
import { authorizeBranchAdvance } from "../agent-authority/branch-advance.js";
|
|
17
|
+
import { createCapabilityExecutionProvenance, } from "../agent-authority/capability-provenance.js";
|
|
18
|
+
import { canonicalJsonString } from "../agent-authority/codec.js";
|
|
19
|
+
import { createAuthorizedExecution } from "../authorized-execution.js";
|
|
20
|
+
import { changeReadRequest } from "../change-execution-port.js";
|
|
21
|
+
import { validateChangeProjectionResult } from "../change.js";
|
|
22
|
+
import { tryAuthorizeImplementation } from "../implementation-authorization.js";
|
|
23
|
+
import { projectImplementationSessionAuthorizationBinding } from "../implementation-session-binding.js";
|
|
24
|
+
import { tryProjectImplementationScope } from "../implementation-scope-projection.js";
|
|
25
|
+
import { assertTrustedExecution, validateIssuerRepositoryIdentity, } from "../github/effect-authorizer.js";
|
|
26
|
+
import { observeLocalBranch, validateLocalBranchPolicyInput, } from "../cli/runtime/branch-observation.js";
|
|
27
|
+
import { runtimeFailure, } from "../runtime-contracts/runtime-failure.js";
|
|
28
|
+
/** Bounded Admission denial carrying the owner stage and catalog reason (#1180). */
|
|
29
|
+
export class AdmissionAuthorizationError extends Error {
|
|
30
|
+
code;
|
|
31
|
+
runtimeFailure;
|
|
32
|
+
constructor(stage, code, message) {
|
|
33
|
+
super(message);
|
|
34
|
+
this.name = "AdmissionAuthorizationError";
|
|
35
|
+
this.code = code;
|
|
36
|
+
this.runtimeFailure = runtimeFailure(stage, code);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function deny(stage, code, message) {
|
|
40
|
+
throw new AdmissionAuthorizationError(stage, code, message);
|
|
41
|
+
}
|
|
42
|
+
/** Current, owner-acquired branch-policy input for one governed Implementation. */
|
|
43
|
+
export async function currentBranchPolicyInput(repository, implementation, options, stage) {
|
|
44
|
+
if (options.readBranchPolicy === undefined)
|
|
45
|
+
deny(stage, "ADMISSION_BRANCH_OBSERVATION_MISSING", "Current repository branch observation is missing.");
|
|
46
|
+
const input = validateLocalBranchPolicyInput(await options.readBranchPolicy({ version: 1, repository: evidenceRepository(repository), implementation }));
|
|
47
|
+
if (input === undefined)
|
|
48
|
+
deny(stage, "ADMISSION_BRANCH_OBSERVATION_STALE", "Current repository branch observation is invalid or stale.");
|
|
49
|
+
return input;
|
|
50
|
+
}
|
|
51
|
+
async function requireCurrentBranchObservation(binding, options, stage) {
|
|
52
|
+
if (binding.branchObservation === undefined)
|
|
53
|
+
return;
|
|
54
|
+
const input = await currentBranchPolicyInput(binding.repository, binding.task.number, options, stage);
|
|
55
|
+
let current;
|
|
56
|
+
try {
|
|
57
|
+
current = observeLocalBranch({ ...input, observedBranch: binding.branchObservation.observedBranch });
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
deny(stage, "ADMISSION_BRANCH_OBSERVATION_STALE", "Current repository branch observation is invalid or stale.");
|
|
61
|
+
}
|
|
62
|
+
if (canonicalJsonString(current) !==
|
|
63
|
+
canonicalJsonString(binding.branchObservation))
|
|
64
|
+
deny(stage, "ADMISSION_BRANCH_OBSERVATION_CONTRADICTED", "Current repository branch observation contradicts Session binding.");
|
|
65
|
+
}
|
|
66
|
+
function isRecord(value) {
|
|
67
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
68
|
+
}
|
|
69
|
+
function exactKeys(value, allowed) {
|
|
70
|
+
return Object.keys(value).every((key) => allowed.includes(key));
|
|
71
|
+
}
|
|
72
|
+
function pinnedRuntimeAuthority(value, stage) {
|
|
73
|
+
const result = validateDelegator(value);
|
|
74
|
+
if (!result.valid || result.value === undefined)
|
|
75
|
+
deny(stage, "ADMISSION_EVIDENCE_MALFORMED", "Public Runtime Authority trust is invalid.");
|
|
76
|
+
return result.value;
|
|
77
|
+
}
|
|
78
|
+
function requirePinnedAuthorityMatch(current, binding, pinnedAuthority, stage) {
|
|
79
|
+
if (current.id !== binding.authority.id ||
|
|
80
|
+
delegatorPublicKeyFingerprint(current.key) !== binding.authority.publicKeyFingerprint ||
|
|
81
|
+
canonicalJsonString(current) !==
|
|
82
|
+
canonicalJsonString(pinnedAuthority))
|
|
83
|
+
deny(stage, "ADMISSION_RUNTIME_AUTHORITY_MISMATCH", "Current Runtime Authority trust does not match Admission configuration.");
|
|
84
|
+
}
|
|
85
|
+
function requireAuthorityRef(authority, stage) {
|
|
86
|
+
if (!isRecord(authority) ||
|
|
87
|
+
!exactKeys(authority, ["ref", "sha"]) ||
|
|
88
|
+
typeof authority.ref !== "string" ||
|
|
89
|
+
!/^refs\/heads\/[A-Za-z0-9._/-]+$/u.test(authority.ref) ||
|
|
90
|
+
typeof authority.sha !== "string" ||
|
|
91
|
+
!/^[a-f0-9]{40}$/u.test(authority.sha))
|
|
92
|
+
deny(stage, "ADMISSION_EVIDENCE_MALFORMED", "Executor Authority evidence is malformed.");
|
|
93
|
+
return { ref: authority.ref, sha: authority.sha };
|
|
94
|
+
}
|
|
95
|
+
function sameRepository(left, right) {
|
|
96
|
+
if (!isRecord(left))
|
|
97
|
+
return false;
|
|
98
|
+
return (left.repositoryHost === "github.com" &&
|
|
99
|
+
left.repositoryId === right.id &&
|
|
100
|
+
(left.nameWithOwner === undefined ||
|
|
101
|
+
(typeof left.nameWithOwner === "string" && left.nameWithOwner.toLowerCase() === right.name.toLowerCase())));
|
|
102
|
+
}
|
|
103
|
+
function evidenceRepository(repository) {
|
|
104
|
+
return { id: repository.id, name: repository.name };
|
|
105
|
+
}
|
|
106
|
+
function intentRepositoryMatchesBinding(intent, binding) {
|
|
107
|
+
return (intent.repositoryHost === "github.com" &&
|
|
108
|
+
intent.repositoryId === binding.id &&
|
|
109
|
+
(intent.repositoryNameWithOwner === undefined ||
|
|
110
|
+
intent.repositoryNameWithOwner.toLocaleLowerCase("en-US") === binding.name.toLocaleLowerCase("en-US")));
|
|
111
|
+
}
|
|
112
|
+
function makeContext(binding, repository, authority, intent, operation, nowSeconds) {
|
|
113
|
+
const request = Object.freeze({
|
|
114
|
+
requestId: intent.requestId,
|
|
115
|
+
operation,
|
|
116
|
+
issuedAt: nowSeconds,
|
|
117
|
+
expiresAt: nowSeconds + 60,
|
|
118
|
+
});
|
|
119
|
+
return Object.freeze({
|
|
120
|
+
repository,
|
|
121
|
+
runtimeAuthority: Object.freeze({ id: binding.authority.id, kid: binding.authority.id }),
|
|
122
|
+
session: Object.freeze({ id: binding.sessionId, certificateJti: binding.signature }),
|
|
123
|
+
task: binding.task,
|
|
124
|
+
capabilities: binding.capabilities,
|
|
125
|
+
authority,
|
|
126
|
+
request,
|
|
127
|
+
semanticRequest: intent.request,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
function capabilityOperation(intent) {
|
|
131
|
+
return intent.operation === "pullRequest.publish" ? "pullRequest.create" : intent.operation;
|
|
132
|
+
}
|
|
133
|
+
function intentSubject(intent) {
|
|
134
|
+
const issue = executionIntentIssue(intent);
|
|
135
|
+
if (issue === undefined)
|
|
136
|
+
throw new Error("ExecutionIntent has no task Issue.");
|
|
137
|
+
if (intent.operation === "branch.advance") {
|
|
138
|
+
const request = intent.request;
|
|
139
|
+
return { kind: "branch", issue, branch: request.branch };
|
|
140
|
+
}
|
|
141
|
+
if (intent.operation === "pullRequest.publish") {
|
|
142
|
+
const request = intent.request;
|
|
143
|
+
if (typeof request.expectedHead !== "string" || typeof request.expectedBase !== "string")
|
|
144
|
+
throw new Error("Pull request publication route is unavailable.");
|
|
145
|
+
return { kind: "pullRequest", issue, head: request.expectedHead, base: request.expectedBase };
|
|
146
|
+
}
|
|
147
|
+
return { kind: "change", issue };
|
|
148
|
+
}
|
|
149
|
+
function readTreeDelta(intent) {
|
|
150
|
+
if (intent.operation !== "branch.advance")
|
|
151
|
+
return undefined;
|
|
152
|
+
const request = intent.request;
|
|
153
|
+
return {
|
|
154
|
+
changes: request.changes.map((change) => ({ operation: "modify", path: change.path })),
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
function validateEvidence(value, binding, pinnedAuthority) {
|
|
158
|
+
const stage = "implementation-admission";
|
|
159
|
+
if (!isRecord(value) ||
|
|
160
|
+
!exactKeys(value, ["repository", "authority", "runtimeAuthority", "change", "implementation", "reviewEvidence"]))
|
|
161
|
+
deny(stage, "ADMISSION_EVIDENCE_MALFORMED", "Executor evidence response is malformed.");
|
|
162
|
+
const repositoryResult = validateIssuerRepositoryIdentity(value.repository);
|
|
163
|
+
if (!repositoryResult.valid ||
|
|
164
|
+
repositoryResult.value === undefined ||
|
|
165
|
+
!sameRepository(repositoryResult.value, binding.repository))
|
|
166
|
+
deny(stage, "ADMISSION_REPOSITORY_MISMATCH", "Executor repository evidence does not match Session.");
|
|
167
|
+
const authority = requireAuthorityRef(value.authority, stage);
|
|
168
|
+
const runtime = pinnedRuntimeAuthority(value.runtimeAuthority, stage);
|
|
169
|
+
requirePinnedAuthorityMatch(runtime, binding, pinnedAuthority, stage);
|
|
170
|
+
const projection = validateChangeProjectionResult(value.change);
|
|
171
|
+
if (!projection.valid || projection.projection === undefined)
|
|
172
|
+
deny(stage, "ADMISSION_EVIDENCE_MALFORMED", "Current Change evidence is malformed.");
|
|
173
|
+
if (!isRecord(value.implementation) ||
|
|
174
|
+
!exactKeys(value.implementation, [
|
|
175
|
+
"implementation",
|
|
176
|
+
"issue",
|
|
177
|
+
"repository",
|
|
178
|
+
"base",
|
|
179
|
+
"readiness",
|
|
180
|
+
"change",
|
|
181
|
+
"pullRequest",
|
|
182
|
+
]))
|
|
183
|
+
deny(stage, "ADMISSION_EVIDENCE_MALFORMED", "Current Implementation evidence is malformed.");
|
|
184
|
+
return {
|
|
185
|
+
repository: repositoryResult.value,
|
|
186
|
+
authority,
|
|
187
|
+
change: projection.projection,
|
|
188
|
+
implementation: value.implementation,
|
|
189
|
+
...(value.reviewEvidence === undefined ? {} : { reviewEvidence: value.reviewEvidence }),
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
function validateTrustEvidence(value, subject, pinnedAuthority) {
|
|
193
|
+
const stage = "trust-evidence";
|
|
194
|
+
if (!isRecord(value) || !exactKeys(value, ["repository", "authority", "runtimeAuthority"]))
|
|
195
|
+
deny(stage, "ADMISSION_EVIDENCE_MALFORMED", "Executor Runtime Authority evidence is malformed.");
|
|
196
|
+
if (!sameRepository(value.repository, subject.repository))
|
|
197
|
+
deny(stage, "ADMISSION_REPOSITORY_MISMATCH", "Executor repository evidence does not match Session.");
|
|
198
|
+
requireAuthorityRef(value.authority, stage);
|
|
199
|
+
const current = pinnedRuntimeAuthority(value.runtimeAuthority, stage);
|
|
200
|
+
requirePinnedAuthorityMatch(current, subject, pinnedAuthority, stage);
|
|
201
|
+
return current;
|
|
202
|
+
}
|
|
203
|
+
function currentImplementationAuthorization(evidence, binding) {
|
|
204
|
+
const implementationEvidence = evidence.implementation;
|
|
205
|
+
const authorizationInput = {
|
|
206
|
+
implementation: implementationEvidence.implementation,
|
|
207
|
+
issue: implementationEvidence.issue,
|
|
208
|
+
repository: implementationEvidence.repository,
|
|
209
|
+
base: implementationEvidence.base,
|
|
210
|
+
readiness: implementationEvidence.readiness,
|
|
211
|
+
};
|
|
212
|
+
const authorization = tryAuthorizeImplementation(authorizationInput);
|
|
213
|
+
if (!authorization.valid || authorization.status !== "authorized" || authorization.authorization === undefined)
|
|
214
|
+
deny("implementation-admission", "ADMISSION_IMPLEMENTATION_UNAUTHORIZED", "Current Implementation is not authorized.");
|
|
215
|
+
const currentInput = { ...authorizationInput, authorization: authorization.authorization };
|
|
216
|
+
const bindingProjection = projectImplementationSessionAuthorizationBinding({
|
|
217
|
+
...currentInput,
|
|
218
|
+
task: binding.task,
|
|
219
|
+
});
|
|
220
|
+
const scope = tryProjectImplementationScope(currentInput);
|
|
221
|
+
if (!scope.valid || scope.projection === undefined)
|
|
222
|
+
deny("implementation-admission", "ADMISSION_IMPLEMENTATION_SCOPE_UNAVAILABLE", "Current Implementation scope is unavailable.");
|
|
223
|
+
return { binding: bindingProjection, scope: scope.projection };
|
|
224
|
+
}
|
|
225
|
+
async function currentTrust(binding, options) {
|
|
226
|
+
const evidence = await options.readEvidence({
|
|
227
|
+
version: 1,
|
|
228
|
+
repository: evidenceRepository(binding.repository),
|
|
229
|
+
authorityId: binding.authority.id,
|
|
230
|
+
});
|
|
231
|
+
return validateTrustEvidence(evidence, binding, options.runtimeAuthority);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Repository-bound Session readiness (#1182): the same current Executor
|
|
235
|
+
* repository binding and protected-ref trust evidence Session registration
|
|
236
|
+
* requires, for the Authority the caller expects Admission to have pinned. It
|
|
237
|
+
* admits nothing and stores nothing; every failure throws a bounded denial.
|
|
238
|
+
*/
|
|
239
|
+
export async function observeRepositoryReadiness(repository, expectedAuthority, options) {
|
|
240
|
+
const pinned = options.runtimeAuthority;
|
|
241
|
+
if (pinned.id !== expectedAuthority.id ||
|
|
242
|
+
delegatorPublicKeyFingerprint(pinned.key) !== expectedAuthority.publicKeyFingerprint)
|
|
243
|
+
deny("trust-evidence", "ADMISSION_RUNTIME_AUTHORITY_MISMATCH", "The Authority Admission pins differs from the configured setup Authority.");
|
|
244
|
+
const subject = {
|
|
245
|
+
repository,
|
|
246
|
+
authority: { id: pinned.id, publicKeyFingerprint: expectedAuthority.publicKeyFingerprint },
|
|
247
|
+
};
|
|
248
|
+
const evidence = await options.readEvidence({
|
|
249
|
+
version: 1,
|
|
250
|
+
repository: evidenceRepository(repository),
|
|
251
|
+
authorityId: pinned.id,
|
|
252
|
+
});
|
|
253
|
+
validateTrustEvidence(evidence, subject, pinned);
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* A read on behalf of an active Session (#1181): the Session exists, is active
|
|
257
|
+
* and is bound to exactly the requested repository. It authorizes no effect.
|
|
258
|
+
*/
|
|
259
|
+
export function requireActiveSessionRepository(sessionId, repository, options) {
|
|
260
|
+
const stored = readAdmissionSession(sessionId, options.runtimeAuthority, {
|
|
261
|
+
environment: options.environment,
|
|
262
|
+
now: options.now?.(),
|
|
263
|
+
});
|
|
264
|
+
if (stored === undefined || stored.status !== "active")
|
|
265
|
+
deny("implementation-admission", "ADMISSION_SESSION_UNAVAILABLE", "Session is unavailable.");
|
|
266
|
+
const binding = stored.record.binding;
|
|
267
|
+
if (binding.repository.id !== repository.id ||
|
|
268
|
+
binding.repository.name.toLocaleLowerCase("en-US") !== repository.name.toLocaleLowerCase("en-US"))
|
|
269
|
+
deny("implementation-admission", "ADMISSION_TASK_MISMATCH", "The read repository does not match the Session.");
|
|
270
|
+
return binding;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* The current Change projection of the Session's Implementation (#1181), from
|
|
274
|
+
* the same Executor evidence and Authority/repository checks every execution
|
|
275
|
+
* uses. Read-only; it authorizes nothing.
|
|
276
|
+
*/
|
|
277
|
+
export async function currentSessionChange(binding, options) {
|
|
278
|
+
if (binding.task.kind !== "issue")
|
|
279
|
+
deny("implementation-admission", "ADMISSION_TASK_MISMATCH", "The Session has no Implementation task.");
|
|
280
|
+
const evidence = validateEvidence(await options.readEvidence({
|
|
281
|
+
version: 1,
|
|
282
|
+
repository: evidenceRepository(binding.repository),
|
|
283
|
+
authorityId: binding.authority.id,
|
|
284
|
+
issue: binding.task.number,
|
|
285
|
+
implementationIssue: binding.task.number,
|
|
286
|
+
}), binding, options.runtimeAuthority);
|
|
287
|
+
return evidence.change;
|
|
288
|
+
}
|
|
289
|
+
/** Admits a validated Session binding against current Executor trust evidence. */
|
|
290
|
+
export async function admitSession(binding, options) {
|
|
291
|
+
await requireCurrentBranchObservation(binding, options, "session-registration");
|
|
292
|
+
const current = await currentTrust(binding, options);
|
|
293
|
+
const snapshot = createAdmissionSession(binding, current, {
|
|
294
|
+
environment: options.environment,
|
|
295
|
+
now: options.now?.(),
|
|
296
|
+
});
|
|
297
|
+
return { id: snapshot.record.binding.sessionId, status: snapshot.status, exp: snapshot.record.binding.exp };
|
|
298
|
+
}
|
|
299
|
+
/** Closes a validated Session binding against current Executor trust evidence. */
|
|
300
|
+
export async function closeSession(binding, options) {
|
|
301
|
+
const current = await currentTrust(binding, options);
|
|
302
|
+
const snapshot = closeAdmissionSession(binding, current, {
|
|
303
|
+
environment: options.environment,
|
|
304
|
+
now: options.now?.(),
|
|
305
|
+
});
|
|
306
|
+
return { id: snapshot.record.binding.sessionId, status: snapshot.status };
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Produces an `AuthorizedExecution` for a validated ExecutionIntent on an
|
|
310
|
+
* active Session, after every current-evidence, Implementation and capability
|
|
311
|
+
* check. It never dispatches the execution.
|
|
312
|
+
*/
|
|
313
|
+
export async function authorizeExecutionIntent(intent, sessionId, options) {
|
|
314
|
+
const stored = readAdmissionSession(sessionId, options.runtimeAuthority, {
|
|
315
|
+
environment: options.environment,
|
|
316
|
+
now: options.now?.(),
|
|
317
|
+
});
|
|
318
|
+
if (stored === undefined || stored.status !== "active")
|
|
319
|
+
deny("implementation-admission", "ADMISSION_SESSION_UNAVAILABLE", "Session is unavailable.");
|
|
320
|
+
const binding = stored.record.binding;
|
|
321
|
+
await requireCurrentBranchObservation(binding, options, "implementation-admission");
|
|
322
|
+
if (binding.branchObservation !== undefined &&
|
|
323
|
+
intent.operation === "branch.advance" &&
|
|
324
|
+
intent.request.branch !== binding.branchObservation.expectedBranch)
|
|
325
|
+
deny("implementation-admission", "ADMISSION_BRANCH_SCOPE_DENIED", "Branch advance does not match the Session policy branch.");
|
|
326
|
+
if (!intentRepositoryMatchesBinding(intent.repository, binding.repository))
|
|
327
|
+
deny("implementation-admission", "ADMISSION_TASK_MISMATCH", "Execution repository does not match Session.");
|
|
328
|
+
const issue = executionIntentIssue(intent);
|
|
329
|
+
if (issue === undefined || binding.task.kind !== "issue" || binding.task.number !== issue)
|
|
330
|
+
deny("implementation-admission", "ADMISSION_TASK_MISMATCH", "Execution task does not match Session.");
|
|
331
|
+
const evidenceValue = await options.readEvidence({
|
|
332
|
+
version: 1,
|
|
333
|
+
repository: evidenceRepository(binding.repository),
|
|
334
|
+
authorityId: binding.authority.id,
|
|
335
|
+
issue,
|
|
336
|
+
implementationIssue: binding.task.number,
|
|
337
|
+
});
|
|
338
|
+
const evidence = validateEvidence(evidenceValue, binding, options.runtimeAuthority);
|
|
339
|
+
const current = currentImplementationAuthorization(evidence, binding);
|
|
340
|
+
const operation = capabilityOperation(intent);
|
|
341
|
+
const nowSeconds = Math.floor((options.now?.() ?? new Date()).getTime() / 1000);
|
|
342
|
+
const context = {
|
|
343
|
+
...makeContext(binding, evidence.repository, evidence.authority, intent, operation, nowSeconds),
|
|
344
|
+
implementationBinding: current.binding,
|
|
345
|
+
implementationScope: current.scope,
|
|
346
|
+
};
|
|
347
|
+
let admission;
|
|
348
|
+
try {
|
|
349
|
+
admission = admitAuthenticatedSessionCapability({
|
|
350
|
+
context,
|
|
351
|
+
operation,
|
|
352
|
+
subject: intentSubject(intent),
|
|
353
|
+
projection: evidence.change,
|
|
354
|
+
...(readTreeDelta(intent) === undefined ? {} : { treeDelta: readTreeDelta(intent) }),
|
|
355
|
+
...(evidence.reviewEvidence === undefined ? {} : { reviewEvidence: evidence.reviewEvidence }),
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
catch (error) {
|
|
359
|
+
// Keep the capability owner's own denial (name/reason) and attach the bounded wire diagnostic.
|
|
360
|
+
if (error instanceof Error) {
|
|
361
|
+
Object.defineProperty(error, "runtimeFailure", {
|
|
362
|
+
value: runtimeFailure("implementation-admission", "ADMISSION_CAPABILITY_DENIED"),
|
|
363
|
+
enumerable: false,
|
|
364
|
+
});
|
|
365
|
+
throw error;
|
|
366
|
+
}
|
|
367
|
+
deny("implementation-admission", "ADMISSION_CAPABILITY_DENIED", "The Session capability does not authorize this operation.");
|
|
368
|
+
}
|
|
369
|
+
let branchAuthorization;
|
|
370
|
+
if (intent.operation === "branch.advance") {
|
|
371
|
+
const authorized = authorizeBranchAdvance({ context, admission, request: intent.request });
|
|
372
|
+
if (!authorized.valid)
|
|
373
|
+
deny("implementation-admission", "ADMISSION_BRANCH_SCOPE_DENIED", "Branch advance is outside the current authorized scope.");
|
|
374
|
+
branchAuthorization = authorized.authorization;
|
|
375
|
+
}
|
|
376
|
+
const provenanceRequest = {
|
|
377
|
+
...context.request,
|
|
378
|
+
operation: intent.operation,
|
|
379
|
+
};
|
|
380
|
+
const provenance = createCapabilityExecutionProvenance({
|
|
381
|
+
version: 1,
|
|
382
|
+
stage: "authorized",
|
|
383
|
+
repository: evidence.repository,
|
|
384
|
+
runtimeAuthority: context.runtimeAuthority,
|
|
385
|
+
session: context.session,
|
|
386
|
+
authority: context.authority,
|
|
387
|
+
request: provenanceRequest,
|
|
388
|
+
subject: admission.subject,
|
|
389
|
+
capability: admission.capability,
|
|
390
|
+
});
|
|
391
|
+
const localAdmissionExecution = assertTrustedExecution({
|
|
392
|
+
version: 1,
|
|
393
|
+
runtime: "inari-local-admission",
|
|
394
|
+
event: "authorized-session-execution",
|
|
395
|
+
repository: evidence.repository,
|
|
396
|
+
requestId: intent.requestId,
|
|
397
|
+
sessionId: binding.sessionId,
|
|
398
|
+
sessionBindingSignature: binding.signature,
|
|
399
|
+
requester: `session:${binding.sessionId}`,
|
|
400
|
+
});
|
|
401
|
+
const executionInput = {
|
|
402
|
+
version: 1,
|
|
403
|
+
operation: intent.operation,
|
|
404
|
+
repository: evidence.repository,
|
|
405
|
+
task: binding.task,
|
|
406
|
+
subject: admission.subject,
|
|
407
|
+
capability: admission.capability,
|
|
408
|
+
provenance,
|
|
409
|
+
request: intent.operation === "change.show" ? changeReadRequest(issue) : intent.request,
|
|
410
|
+
};
|
|
411
|
+
if (intent.operation === "change.show")
|
|
412
|
+
executionInput.initialProjection = evidence.change;
|
|
413
|
+
else if (intent.operation === "branch.advance")
|
|
414
|
+
executionInput.branchAuthorization = branchAuthorization;
|
|
415
|
+
else
|
|
416
|
+
executionInput.execution = localAdmissionExecution;
|
|
417
|
+
return createAuthorizedExecution(executionInput);
|
|
418
|
+
}
|
|
419
|
+
//# sourceMappingURL=authorization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorization.js","sourceRoot":"","sources":["../../src/admission/authorization.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAGxH,OAAO,EAAE,oBAAoB,EAAwB,MAAM,sCAAsC,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAkB,MAAM,iCAAiC,CAAC;AACpF,OAAO,EAAE,6BAA6B,EAAE,MAAM,qCAAqC,CAAC;AACpF,OAAO,EACL,mCAAmC,GAGpC,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAqC,MAAM,sCAAsC,CAAC;AACjH,OAAO,EACL,mCAAmC,GAEpC,MAAM,6CAA6C,CAAC;AAGrD,OAAO,EAAE,mBAAmB,EAA2B,MAAM,6BAA6B,CAAC;AAC3F,OAAO,EAAE,yBAAyB,EAA4B,MAAM,4BAA4B,CAAC;AACjG,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,8BAA8B,EAA+B,MAAM,cAAc,CAAC;AAC3F,OAAO,EAAE,0BAA0B,EAAyC,MAAM,oCAAoC,CAAC;AACvH,OAAO,EAAE,gDAAgD,EAAE,MAAM,sCAAsC,CAAC;AACxG,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AACtF,OAAO,EACL,sBAAsB,EACtB,gCAAgC,GAEjC,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,kBAAkB,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,CAAC,SAAS;QAC5B,uBAAuB,EAAE,OAAO,CAAC,SAAS;QAC1C,SAAS,EAAE,WAAW,OAAO,CAAC,SAAS,EAAE;KAC1C,CAAC,CAAC;IACH,MAAM,cAAc,GAA4B;QAC9C,OAAO,EAAE,CAAC;QACV,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,OAAO,EAAE,SAAS,CAAC,OAAO;QAC1B,UAAU,EAAE,SAAS,CAAC,UAAU;QAChC,UAAU;QACV,OAAO,EAAE,MAAM,CAAC,SAAS,KAAK,aAAa,CAAC,CAAC,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO;KACxF,CAAC;IACF,IAAI,MAAM,CAAC,SAAS,KAAK,aAAa;QAAE,cAAc,CAAC,iBAAiB,GAAG,QAAQ,CAAC,MAAM,CAAC;SACtF,IAAI,MAAM,CAAC,SAAS,KAAK,gBAAgB;QAAE,cAAc,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;;QACpG,cAAc,CAAC,SAAS,GAAG,uBAAuB,CAAC;IACxD,OAAO,yBAAyB,CAAC,cAAc,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admission server (#1107). Public Admission role entry for serving: the
|
|
3
|
+
* bounded local Admission HTTP wire, mTLS enforcement and process startup.
|
|
4
|
+
* Session admission and execution authorization are delegated to the private
|
|
5
|
+
* authorization module; the Executor is reached only through the neutral
|
|
6
|
+
* `LocalExecutorClient` protocol client. The server holds no provider
|
|
7
|
+
* credential and no private signing key.
|
|
8
|
+
*/
|
|
9
|
+
import { type Server } from "node:http";
|
|
10
|
+
import type { Delegator } from "../agent-authority/delegator.js";
|
|
11
|
+
import type { AuthorizedExecution } from "../authorized-execution.js";
|
|
12
|
+
import { type RepositoryIdentity } from "../github/effect-authorizer.js";
|
|
13
|
+
import type { LocalAdmissionConfig } from "../local-control/config.js";
|
|
14
|
+
import { type LocalExecutorBranchPolicyRequest, type LocalExecutorEvidenceRequest, type LocalExecutorGovernedContractRequest } from "../local-control/executor-http.js";
|
|
15
|
+
import { type LocalRuntimeEndpoint } from "../local-control/runtime-discovery.js";
|
|
16
|
+
import { type LocalMtlsIdentity } from "../local-control/transport-security.js";
|
|
17
|
+
export declare const LOCAL_ADMISSION_STATUS_PATH: "/status";
|
|
18
|
+
export declare const LOCAL_ADMISSION_PROTOCOL_VERSION: 1;
|
|
19
|
+
export declare const LOCAL_ADMISSION_HEALTH_PATH: "/health";
|
|
20
|
+
export declare const LOCAL_ADMISSION_SESSIONS_PATH: "/v1/sessions";
|
|
21
|
+
export declare const LOCAL_ADMISSION_REPOSITORY_PATH: "/v1/repository";
|
|
22
|
+
export declare const LOCAL_ADMISSION_EXECUTIONS_PATH: "/v1/executions";
|
|
23
|
+
export declare const LOCAL_ADMISSION_READINESS_PATH: "/v1/readiness";
|
|
24
|
+
export declare const LOCAL_ADMISSION_BRANCH_POLICY_PATH: "/v1/branch-policy";
|
|
25
|
+
export declare const LOCAL_ADMISSION_PULL_REQUEST_CONTEXT_PATH: "/v1/pull-request-context";
|
|
26
|
+
export declare const LOCAL_ADMISSION_SESSION_ID_HEADER: "x-inari-session-id";
|
|
27
|
+
export declare const MAX_LOCAL_ADMISSION_BODY_BYTES = 1048576;
|
|
28
|
+
/**
|
|
29
|
+
* Executor surface Admission consumes. `LocalExecutorClient` (the neutral
|
|
30
|
+
* client of the Executor wire protocol) implements it; Admission never loads
|
|
31
|
+
* Executor internals.
|
|
32
|
+
*/
|
|
33
|
+
export interface AdmissionExecutorClient {
|
|
34
|
+
verifyReady(): Promise<unknown>;
|
|
35
|
+
resolveRepository?(repositoryNameWithOwner: string): Promise<RepositoryIdentity>;
|
|
36
|
+
readEvidence(request: LocalExecutorEvidenceRequest): Promise<unknown>;
|
|
37
|
+
readBranchPolicy?(request: LocalExecutorBranchPolicyRequest): Promise<unknown>;
|
|
38
|
+
readGovernedContract?(request: LocalExecutorGovernedContractRequest): Promise<unknown>;
|
|
39
|
+
execute(execution: AuthorizedExecution): Promise<unknown>;
|
|
40
|
+
}
|
|
41
|
+
export declare function createLocalAdmissionHttpServer(config: LocalAdmissionConfig, version: string, runtimeAuthority: Delegator, executor: AdmissionExecutorClient, options?: {
|
|
42
|
+
readonly environment?: NodeJS.ProcessEnv;
|
|
43
|
+
readonly now?: () => Date;
|
|
44
|
+
readonly transport?: LocalMtlsIdentity;
|
|
45
|
+
}): Server;
|
|
46
|
+
export declare function startConfiguredLocalAdmission(version: string, environment?: NodeJS.ProcessEnv): Promise<{
|
|
47
|
+
readonly server: Server;
|
|
48
|
+
readonly config: LocalAdmissionConfig;
|
|
49
|
+
readonly announcement: LocalRuntimeEndpoint;
|
|
50
|
+
}>;
|