@cotal-ai/auth 0.59.0 → 0.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/derive.d.ts +5 -0
- package/dist/derive.d.ts.map +1 -1
- package/dist/derive.js +15 -1
- package/dist/derive.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/manager-admin-authorization.d.ts +13 -4
- package/dist/manager-admin-authorization.d.ts.map +1 -1
- package/dist/manager-admin-authorization.js +15 -7
- package/dist/manager-admin-authorization.js.map +1 -1
- package/dist/manager-authority.d.ts +11 -7
- package/dist/manager-authority.d.ts.map +1 -1
- package/dist/manager-authority.js +9 -7
- package/dist/manager-authority.js.map +1 -1
- package/dist/manager-goal-index.d.ts +2 -3
- package/dist/manager-goal-index.d.ts.map +1 -1
- package/dist/manager-goal-index.js +2 -2
- package/dist/manager-goal-index.js.map +1 -1
- package/dist/manager-maintenance.d.ts +2 -3
- package/dist/manager-maintenance.d.ts.map +1 -1
- package/dist/manager-maintenance.js +8 -2
- package/dist/manager-maintenance.js.map +1 -1
- package/dist/platform-control.d.ts +47 -0
- package/dist/platform-control.d.ts.map +1 -0
- package/dist/platform-control.js +117 -0
- package/dist/platform-control.js.map +1 -0
- package/dist/records-scanner.d.ts.map +1 -1
- package/dist/records-scanner.js +3 -2
- package/dist/records-scanner.js.map +1 -1
- package/dist/retained-manager-validation.d.ts +9 -6
- package/dist/retained-manager-validation.d.ts.map +1 -1
- package/dist/retained-manager-validation.js +9 -7
- package/dist/retained-manager-validation.js.map +1 -1
- package/dist/service.d.ts +54 -29
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +70 -24
- package/dist/service.js.map +1 -1
- package/package.json +3 -3
package/dist/service.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type IncomingMessage, type ServerResponse } from "node:http";
|
|
2
|
-
import { type ParsedArgs, type RemoteManagerAdminAuthorizationRequest, type RemoteManagerAuthorityRequest, type RemoteManagerMaintenanceRequest, type RemoteRetainedAgentValidationRequest, type SecretStore } from "@cotal-ai/core";
|
|
2
|
+
import { type EpGateState, type ParsedArgs, type PlatformControlAssignment, type PlatformControlAuthorityRequest, type PlatformControlAuthorityResult, type PlatformControlInnerRequest, type RemoteManagerAdminAuthorizationRequest, type RemoteManagerAuthorityRequest, type RemoteManagerMaintenanceRequest, type RemoteRetainedAgentValidationRequest, type SecretStore } from "@cotal-ai/core";
|
|
3
3
|
import { type HostedContextInputs, type HostedServiceHandle, type ManagerInstanceIdentity } from "@cotal-ai/workspace";
|
|
4
|
+
import { type ManagerAuthorityHolder } from "./platform-control.js";
|
|
4
5
|
import { type IdpBridge } from "./idp.js";
|
|
5
6
|
import { type UserTokenSession, type ValidatedUserToken } from "./token.js";
|
|
6
7
|
import { pinnedJwksResolver, type UserTokenIssuer } from "./issuer.js";
|
|
@@ -55,19 +56,13 @@ export interface AuthAuthorityPlane {
|
|
|
55
56
|
alreadyRetired?: boolean;
|
|
56
57
|
}>;
|
|
57
58
|
retireManagedLifecycle: AuthAuthorityPlane["retireInteractiveLifecycle"];
|
|
58
|
-
issueManagerServiceAuthority: (args: {
|
|
59
|
-
owner: string;
|
|
60
|
-
scope: string[];
|
|
59
|
+
issueManagerServiceAuthority: (args: ManagerAuthorityHolder & {
|
|
61
60
|
request: RemoteManagerAuthorityRequest;
|
|
62
61
|
}) => Promise<import("@cotal-ai/core").RemoteManagerAuthorityMaterial>;
|
|
63
|
-
maintainRemoteManager: (args: {
|
|
64
|
-
owner: string;
|
|
65
|
-
scope: string[];
|
|
62
|
+
maintainRemoteManager: (args: ManagerAuthorityHolder & {
|
|
66
63
|
request: RemoteManagerMaintenanceRequest;
|
|
67
64
|
}) => Promise<import("@cotal-ai/core").RemoteManagerMaintenanceResult>;
|
|
68
|
-
validateRetainedAgent: (args: {
|
|
69
|
-
owner: string;
|
|
70
|
-
scope: string[];
|
|
65
|
+
validateRetainedAgent: (args: ManagerAuthorityHolder & {
|
|
71
66
|
request: RemoteRetainedAgentValidationRequest;
|
|
72
67
|
}) => Promise<RemoteRetainedAgentValidationRequest>;
|
|
73
68
|
/** Authorize one host-owned managed-agent enrollment (#1972). The plane reads the manager gate on
|
|
@@ -90,33 +85,31 @@ export interface AuthAuthorityPlane {
|
|
|
90
85
|
owner: string;
|
|
91
86
|
request: import("@cotal-ai/core").RemoteManagedAgentRuntimeRequest;
|
|
92
87
|
}) => Promise<RemoteManagedAgentRuntimeDecision>;
|
|
93
|
-
scanManagerGoalIndex: (args: {
|
|
94
|
-
owner: string;
|
|
95
|
-
scope: string[];
|
|
88
|
+
scanManagerGoalIndex: (args: ManagerAuthorityHolder & {
|
|
96
89
|
request: import("@cotal-ai/core").RemoteManagerGoalIndexScanRequest;
|
|
97
90
|
}) => Promise<import("@cotal-ai/core").RemoteManagerGoalIndexScanResult>;
|
|
98
|
-
authorizeManagerAdmin: (args: {
|
|
99
|
-
owner: string;
|
|
100
|
-
scope: string[];
|
|
91
|
+
authorizeManagerAdmin: (args: ManagerAuthorityHolder & {
|
|
101
92
|
request: RemoteManagerAdminAuthorizationRequest;
|
|
102
93
|
}) => Promise<import("@cotal-ai/core").RemoteManagerAdminAuthorizationResult>;
|
|
103
94
|
/** First-run admission for one hosted run-start, asked by a registered signerless manager. The
|
|
104
95
|
* plane authenticates the registration, resolves the caller's issued generation on its own issuer
|
|
105
96
|
* connection with live sources, and creates the admission through a run-admitter credential
|
|
106
97
|
* pinned to that one run. No ceiling, caller or profile is taken from the request. */
|
|
107
|
-
admitManagerRun: (args: {
|
|
108
|
-
owner: string;
|
|
109
|
-
scope: string[];
|
|
98
|
+
admitManagerRun: (args: ManagerAuthorityHolder & {
|
|
110
99
|
request: unknown;
|
|
111
100
|
}) => Promise<import("@cotal-ai/core").RemoteRunAdmissionResult>;
|
|
112
101
|
/** First-attempt/resume or operator issuance for one hosted run, asked by a registered signerless manager.
|
|
113
102
|
* The plane authenticates the registration, derives coordinates from native admission/records/checkpoints,
|
|
114
103
|
* and signs ONLY the returned fixed grant args. JWT responses contain no seeds. */
|
|
115
|
-
issueManagerRunAttempt: (args: {
|
|
116
|
-
owner: string;
|
|
117
|
-
scope: string[];
|
|
104
|
+
issueManagerRunAttempt: (args: ManagerAuthorityHolder & {
|
|
118
105
|
request: unknown;
|
|
119
106
|
}) => Promise<import("@cotal-ai/core").RemoteRunAttemptResult>;
|
|
107
|
+
/** Read-only view of one manager instance for the platform control door: whether its
|
|
108
|
+
* `svc.manager` record is current, and its gate. It probes, freezes and writes nothing. */
|
|
109
|
+
observeManagerInstance: (instanceId: string) => Promise<{
|
|
110
|
+
registered: boolean;
|
|
111
|
+
gate: EpGateState | null;
|
|
112
|
+
}>;
|
|
120
113
|
/** Resolves with the state-3 copy when a mid-life scanner death FENCES the plane (SPEC 13.13):
|
|
121
114
|
* the plane is no longer whole, `authorizeConnect`/`mintConnectCredential` refuse from that
|
|
122
115
|
* moment, and the composition root must take the whole service DOWN loud (a fenced plane that
|
|
@@ -201,6 +194,15 @@ export declare function runAuthService(args: ParsedArgs, store?: SecretStore): P
|
|
|
201
194
|
export interface AuthServiceHandle extends HostedServiceHandle {
|
|
202
195
|
readonly url: string;
|
|
203
196
|
readonly publicUrl?: string;
|
|
197
|
+
/** The platform control door (SPEC 13.1). Present only when `platformControl` was supplied to
|
|
198
|
+
* {@link startAuthService}. In-process and typed: no route, no capability, and no signer or
|
|
199
|
+
* capability in the result. */
|
|
200
|
+
platformControlAuthority?<R extends PlatformControlInnerRequest>(request: PlatformControlAuthorityRequest<R>): Promise<PlatformControlAuthorityResult<R>>;
|
|
201
|
+
}
|
|
202
|
+
/** The platform composition's input for the platform control door. */
|
|
203
|
+
export interface PlatformControlInput {
|
|
204
|
+
/** The one current assignment for this account, or null. Read fresh on every door call. */
|
|
205
|
+
observeAssignment(space: string, accountPublicKey: string): Promise<PlatformControlAssignment | null>;
|
|
204
206
|
}
|
|
205
207
|
/** Start one account-scoped auth-service context. Every input is explicit: the state dir, the
|
|
206
208
|
* injected store with its proved identity, the assigned data account and the broker. The context
|
|
@@ -210,7 +212,16 @@ export interface AuthServiceHandle extends HostedServiceHandle {
|
|
|
210
212
|
* mid-life fence or broker loss makes only this context `unavailable` and closes its resources. */
|
|
211
213
|
export declare function startAuthService(inputs: HostedContextInputs & {
|
|
212
214
|
port?: number;
|
|
215
|
+
/** Present only in a platform composition. Absent: the handle has no platform control door. */
|
|
216
|
+
platformControl?: PlatformControlInput;
|
|
217
|
+
/** Trusted-host only. Forwarded unchanged to {@link openAuthAuthorityPlane}, which bounds it to
|
|
218
|
+
* 5..86400 seconds. Absent: the 24h default. No CLI flag and no request field sets it. */
|
|
219
|
+
standingRenewableTtlSeconds?: number;
|
|
213
220
|
}): Promise<AuthServiceHandle>;
|
|
221
|
+
/** The HTTP routes authenticate a human, so they only ever supply the human arm. */
|
|
222
|
+
type HumanHolder = Extract<ManagerAuthorityHolder, {
|
|
223
|
+
scope: string[];
|
|
224
|
+
}>;
|
|
214
225
|
interface HandlerCtx {
|
|
215
226
|
issuer: UserTokenIssuer;
|
|
216
227
|
bridge: IdpBridge;
|
|
@@ -220,16 +231,30 @@ interface HandlerCtx {
|
|
|
220
231
|
key: ReturnType<typeof pinnedJwksResolver>;
|
|
221
232
|
};
|
|
222
233
|
ownerSecret: string | Uint8Array;
|
|
223
|
-
managerServiceAuthority:
|
|
224
|
-
|
|
225
|
-
|
|
234
|
+
managerServiceAuthority: (args: HumanHolder & {
|
|
235
|
+
request: RemoteManagerAuthorityRequest;
|
|
236
|
+
}) => ReturnType<AuthAuthorityPlane["issueManagerServiceAuthority"]>;
|
|
237
|
+
maintainRemoteManager: (args: HumanHolder & {
|
|
238
|
+
request: RemoteManagerMaintenanceRequest;
|
|
239
|
+
}) => ReturnType<AuthAuthorityPlane["maintainRemoteManager"]>;
|
|
240
|
+
validateRetainedAgent: (args: HumanHolder & {
|
|
241
|
+
request: RemoteRetainedAgentValidationRequest;
|
|
242
|
+
}) => ReturnType<AuthAuthorityPlane["validateRetainedAgent"]>;
|
|
226
243
|
verifyManagedAgentEnrollment: AuthAuthorityPlane["verifyManagedAgentEnrollment"];
|
|
227
244
|
verifyManagedAgentPrepareRetirement: AuthAuthorityPlane["verifyManagedAgentPrepareRetirement"];
|
|
228
245
|
verifyManagedAgentRuntime: AuthAuthorityPlane["verifyManagedAgentRuntime"];
|
|
229
|
-
scanManagerGoalIndex:
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
246
|
+
scanManagerGoalIndex: (args: HumanHolder & {
|
|
247
|
+
request: import("@cotal-ai/core").RemoteManagerGoalIndexScanRequest;
|
|
248
|
+
}) => ReturnType<AuthAuthorityPlane["scanManagerGoalIndex"]>;
|
|
249
|
+
authorizeManagerAdmin: (args: HumanHolder & {
|
|
250
|
+
request: RemoteManagerAdminAuthorizationRequest;
|
|
251
|
+
}) => ReturnType<AuthAuthorityPlane["authorizeManagerAdmin"]>;
|
|
252
|
+
admitManagerRun: (args: HumanHolder & {
|
|
253
|
+
request: unknown;
|
|
254
|
+
}) => ReturnType<AuthAuthorityPlane["admitManagerRun"]>;
|
|
255
|
+
issueManagerRunAttempt: (args: HumanHolder & {
|
|
256
|
+
request: unknown;
|
|
257
|
+
}) => ReturnType<AuthAuthorityPlane["issueManagerRunAttempt"]>;
|
|
233
258
|
secrets: SecretStore;
|
|
234
259
|
retireInteractiveLifecycle: AuthAuthorityPlane["retireInteractiveLifecycle"];
|
|
235
260
|
retireManagedLifecycle: AuthAuthorityPlane["retireManagedLifecycle"];
|
package/dist/service.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAuDA,OAAO,EAAgB,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAKpF,OAAO,
|
|
1
|
+
{"version":3,"file":"service.d.ts","sour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AE;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IACvD,aAAa,EAAE,MAAM,CAAC;IACtB;;gGAE4F;IAC5F,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAmB1B;AAED;;;mDAGmD;AACnD,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAInG;AAED;;;cAGc;AACd,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAUzE"}
|
package/dist/service.js
CHANGED
|
@@ -61,7 +61,8 @@ import { Kvm } from "@nats-io/kv";
|
|
|
61
61
|
import { contractRefToHex, contractStoreContext, fetchContractArtifact, verifyClusterManifest, verifyClusterRoot, admissionBucket, admissionMediatorGrants, assertDerivedOwnerToken, assertLifecycleToken, assertValidOwnerToken, authorizeTrustedServeSnapshot, commitSiblingIssuance, credsClaims, EpEnvelopeError, ensureAuthorityStores, epAuthBucket, isReachable, jwtFromCreds, managedRetirementOpId, mintCreds, mintPublicUserJwt, newIdentity, observeHostedRunAttempt, openRecordsBucket, parseEndpointGate, parseServiceSpec, parseServiceStatus, rawDigest, parseSecretStoreIdentity, readCheckpointStatus, readRunAdmission, readRunRecord, readSvcRecordLeader, reconcileEndpointGate, sameSecretStoreIdentity, recordSpecKey, recordStatusKey, RECORD_KINDS, recordsBucket, remoteManagerActors, retirementFrontierStreams, runDriverCaller, serveIssuanceGateKv, standaloneConnectOpts, STANDING_RENEWABLE_TTL_SEC, withIssuerSession, authorizeServeGrant, contractArtifactCanonicalBytes, DEV_OWNER, endpointRegistrationBarrier, mintLifecycleUid, principalKey, provisionEndpointGateOpen, publishContractArtifact, registerServiceInstance, SERVICE_READY, writeServiceStatus } from "@cotal-ai/core";
|
|
62
62
|
import { findCotalRoot, loadManagerInstanceIdentity, userAuthStateDir, workspaceSecretStore, createAuthInstanceIdentity, loadAuthInstanceIdentity } from "@cotal-ai/workspace";
|
|
63
63
|
import { decodeJwt } from "jose";
|
|
64
|
-
import { deriveOwnerForIdpSubject } from "./derive.js";
|
|
64
|
+
import { deriveOwnerForIdpSubject, platformControlOwner } from "./derive.js";
|
|
65
|
+
import { makePlatformControlAuthority, requireManagerAuthorityHolder } from "./platform-control.js";
|
|
65
66
|
import { startAuthCallout } from "./callout.js";
|
|
66
67
|
import { createIdpBridge, verifyIdpToken } from "./idp.js";
|
|
67
68
|
import { PUBLIC_EXCHANGE_VIEWS } from "./token.js";
|
|
@@ -617,13 +618,12 @@ export async function openAuthAuthorityPlane(opts) {
|
|
|
617
618
|
await flight;
|
|
618
619
|
return { retired: true, lifecycleUid };
|
|
619
620
|
},
|
|
620
|
-
issueManagerServiceAuthority: async (
|
|
621
|
+
issueManagerServiceAuthority: async (holder) => {
|
|
621
622
|
refuseIfFenced();
|
|
623
|
+
const { owner } = holder;
|
|
622
624
|
const observeManagerGate = async (instanceId) => (await serveIssuanceGateKv(await new Kvm(remoteIssuer.nc).open(epAuthBucket(space)), space, { endpoint: "manager", instanceId }).observe()) ?? null;
|
|
623
625
|
return issueRemoteManagerAuthority({
|
|
624
|
-
|
|
625
|
-
scope,
|
|
626
|
-
request,
|
|
626
|
+
...holder,
|
|
627
627
|
authorizeRenewal: ({ owner: o, request: r }) => authorizeRemoteManagerRenewal({
|
|
628
628
|
request: r, owner: o, space, accountPublicKey: dataAccount.pub, proofSecret: dataAccount.signingSeed,
|
|
629
629
|
observeManagerGate,
|
|
@@ -821,14 +821,13 @@ export async function openAuthAuthorityPlane(opts) {
|
|
|
821
821
|
},
|
|
822
822
|
});
|
|
823
823
|
},
|
|
824
|
-
maintainRemoteManager: async (
|
|
824
|
+
maintainRemoteManager: async (holder) => {
|
|
825
825
|
refuseIfFenced();
|
|
826
|
+
const { owner } = holder;
|
|
826
827
|
const gateKv = await new Kvm(remoteIssuer.nc).open(epAuthBucket(space));
|
|
827
828
|
const authorized = await authorizeRemoteManagerMaintenance({
|
|
828
|
-
|
|
829
|
-
scope,
|
|
829
|
+
...holder,
|
|
830
830
|
space,
|
|
831
|
-
request,
|
|
832
831
|
scanner,
|
|
833
832
|
observeManagerGate: async (instanceId) => serveIssuanceGateKv(gateKv, space, { endpoint: "manager", instanceId }).observe(),
|
|
834
833
|
});
|
|
@@ -876,14 +875,12 @@ export async function openAuthAuthorityPlane(opts) {
|
|
|
876
875
|
}
|
|
877
876
|
return completeRemoteManagerMaintenance(authorized, owner, { reconciliation: report });
|
|
878
877
|
},
|
|
879
|
-
validateRetainedAgent: async (
|
|
878
|
+
validateRetainedAgent: async (holder) => {
|
|
880
879
|
refuseIfFenced();
|
|
881
880
|
return authorizeRemoteRetainedAgentValidation({
|
|
882
|
-
|
|
883
|
-
scope,
|
|
881
|
+
...holder,
|
|
884
882
|
proofSecret: dataAccount.signingSeed,
|
|
885
883
|
space,
|
|
886
|
-
request,
|
|
887
884
|
observeManagerGate: async (instanceId) => {
|
|
888
885
|
const gate = serveIssuanceGateKv(await new Kvm(remoteIssuer.nc).open(epAuthBucket(space)), space, { endpoint: "manager", instanceId });
|
|
889
886
|
return gate.observe();
|
|
@@ -934,10 +931,11 @@ export async function openAuthAuthorityPlane(opts) {
|
|
|
934
931
|
? authorizeRemoteManagedAgentRuntimeStatus({ ...args, request })
|
|
935
932
|
: authorizeRemoteManagedAgentRuntimeCreate({ ...args, request });
|
|
936
933
|
},
|
|
937
|
-
scanManagerGoalIndex: async (
|
|
934
|
+
scanManagerGoalIndex: async (holder) => {
|
|
938
935
|
refuseIfFenced();
|
|
936
|
+
const { owner } = holder;
|
|
939
937
|
const authorized = await authorizeRemoteManagerGoalIndexScan({
|
|
940
|
-
|
|
938
|
+
...holder, proofSecret: dataAccount.signingSeed, space,
|
|
941
939
|
observeManagerGate: async (instanceId) => {
|
|
942
940
|
const gate = serveIssuanceGateKv(await new Kvm(remoteIssuer.nc).open(epAuthBucket(space)), space, { endpoint: "manager", instanceId });
|
|
943
941
|
return gate.observe();
|
|
@@ -945,11 +943,11 @@ export async function openAuthAuthorityPlane(opts) {
|
|
|
945
943
|
});
|
|
946
944
|
return completeRemoteManagerGoalIndexScan(authorized, owner, await recordsScanner.scanManagerGoalIndex(owner));
|
|
947
945
|
},
|
|
948
|
-
authorizeManagerAdmin: async ({
|
|
946
|
+
authorizeManagerAdmin: async ({ request, ...holder }) => {
|
|
949
947
|
refuseIfFenced();
|
|
950
948
|
return authorizeRemoteManagerAdmin({
|
|
951
|
-
managerOwner: owner,
|
|
952
|
-
managerScope: scope,
|
|
949
|
+
managerOwner: holder.owner,
|
|
950
|
+
...(holder.holder === "platform" ? { managerAssignment: holder.assignment } : { managerScope: holder.scope }),
|
|
953
951
|
proofSecret: dataAccount.signingSeed,
|
|
954
952
|
space,
|
|
955
953
|
dir: opts.dir,
|
|
@@ -960,10 +958,10 @@ export async function openAuthAuthorityPlane(opts) {
|
|
|
960
958
|
},
|
|
961
959
|
});
|
|
962
960
|
},
|
|
963
|
-
admitManagerRun: async ({
|
|
961
|
+
admitManagerRun: async ({ request, ...holder }) => {
|
|
964
962
|
refuseIfFenced();
|
|
965
|
-
|
|
966
|
-
|
|
963
|
+
const { owner } = holder;
|
|
964
|
+
requireManagerAuthorityHolder(holder, String(request?.instanceId), 'manager run admission needs scope "supervise"; spawn/admin do not imply it');
|
|
967
965
|
const runId = parseRemoteRunAdmissionRequest(request).run.runId;
|
|
968
966
|
const hostAuth = {
|
|
969
967
|
space,
|
|
@@ -997,10 +995,10 @@ export async function openAuthAuthorityPlane(opts) {
|
|
|
997
995
|
}
|
|
998
996
|
});
|
|
999
997
|
},
|
|
1000
|
-
issueManagerRunAttempt: async ({
|
|
998
|
+
issueManagerRunAttempt: async ({ request, ...holder }) => {
|
|
1001
999
|
refuseIfFenced();
|
|
1002
|
-
|
|
1003
|
-
|
|
1000
|
+
const { owner } = holder;
|
|
1001
|
+
requireManagerAuthorityHolder(holder, String(request?.instanceId), 'manager run attempt needs scope "supervise"; spawn/admin do not imply it');
|
|
1004
1002
|
const req = parseRemoteRunAttemptRequest(request);
|
|
1005
1003
|
const recordsKv = await openRecordsBucket(remoteIssuer.nc, space);
|
|
1006
1004
|
const grant = await authorizeRemoteRunAttempt({
|
|
@@ -1078,6 +1076,12 @@ export async function openAuthAuthorityPlane(opts) {
|
|
|
1078
1076
|
credentials: { operator },
|
|
1079
1077
|
};
|
|
1080
1078
|
},
|
|
1079
|
+
observeManagerInstance: async (instanceId) => {
|
|
1080
|
+
refuseIfFenced();
|
|
1081
|
+
const gate = await serveIssuanceGateKv(await new Kvm(remoteIssuer.nc).open(epAuthBucket(space)), space, { endpoint: "manager", instanceId }).observe();
|
|
1082
|
+
const rec = await readSvcRecordLeader(recordsJsm, space, recordSpecKey(RECORD_KINDS.svc, ["manager", instanceId]));
|
|
1083
|
+
return { registered: rec !== undefined && !("deleted" in rec), gate: gate ?? null };
|
|
1084
|
+
},
|
|
1081
1085
|
fenced,
|
|
1082
1086
|
close: async () => {
|
|
1083
1087
|
// Clean-close order (SPEC 13.13): the rail stops answering first, then scan-capable
|
|
@@ -1288,6 +1292,8 @@ export async function startAuthService(inputs) {
|
|
|
1288
1292
|
const port = inputs.port ?? 0;
|
|
1289
1293
|
if (!Number.isInteger(port) || port < 0 || port > 65535)
|
|
1290
1294
|
throw new Error(`auth-service: port must be a port number, got ${port}`);
|
|
1295
|
+
if (inputs.platformControl !== undefined && typeof inputs.platformControl?.observeAssignment !== "function")
|
|
1296
|
+
throw new Error("auth-service: platformControl requires an observeAssignment function");
|
|
1291
1297
|
const started = await startAuthContext({
|
|
1292
1298
|
space: inputs.space,
|
|
1293
1299
|
server: inputs.servers,
|
|
@@ -1297,6 +1303,8 @@ export async function startAuthService(inputs) {
|
|
|
1297
1303
|
hostedStore: true,
|
|
1298
1304
|
localManager: () => undefined,
|
|
1299
1305
|
context: inputs.context,
|
|
1306
|
+
...(inputs.platformControl !== undefined ? { platformControl: inputs.platformControl } : {}),
|
|
1307
|
+
...(inputs.standingRenewableTtlSeconds !== undefined ? { standingRenewableTtlSeconds: inputs.standingRenewableTtlSeconds } : {}),
|
|
1300
1308
|
});
|
|
1301
1309
|
return started.handle;
|
|
1302
1310
|
}
|
|
@@ -1332,6 +1340,7 @@ async function startAuthContext(o) {
|
|
|
1332
1340
|
dataAccount: { pub: keys.dataAccount.pub, signingSeed: keys.dataAccount.signingSeed },
|
|
1333
1341
|
log: (l) => console.error(l),
|
|
1334
1342
|
localManager: o.localManager,
|
|
1343
|
+
...(o.standingRenewableTtlSeconds !== undefined ? { standingRenewableTtlSeconds: o.standingRenewableTtlSeconds } : {}),
|
|
1335
1344
|
});
|
|
1336
1345
|
let nc;
|
|
1337
1346
|
let http;
|
|
@@ -1476,9 +1485,46 @@ async function startAuthContext(o) {
|
|
|
1476
1485
|
return end;
|
|
1477
1486
|
});
|
|
1478
1487
|
const context = o.context ?? { accountPublicKey: keys.dataAccount.pub, lifecycleUid: "" };
|
|
1488
|
+
const platformControl = o.platformControl;
|
|
1489
|
+
// The human route's retained-validation composition, for the platform holder.
|
|
1490
|
+
const validateRetainedForHolder = async (holder, request) => {
|
|
1491
|
+
const retained = await plane.validateRetainedAgent({ ...holder, request });
|
|
1492
|
+
const authority = await validateRetainedManagedAgent({
|
|
1493
|
+
store: secrets,
|
|
1494
|
+
dir,
|
|
1495
|
+
space,
|
|
1496
|
+
owner: retained.target.owner,
|
|
1497
|
+
actor: retained.target.actor,
|
|
1498
|
+
actorToken: retained.actorToken,
|
|
1499
|
+
sentinelCreds: retained.sentinelCreds,
|
|
1500
|
+
});
|
|
1501
|
+
return completeRemoteRetainedAgentValidation(retained, holder.owner, authority);
|
|
1502
|
+
};
|
|
1479
1503
|
const service = {
|
|
1480
1504
|
url,
|
|
1481
1505
|
...(publicUrl !== undefined ? { publicUrl } : {}),
|
|
1506
|
+
...(platformControl !== undefined ? {
|
|
1507
|
+
platformControlAuthority: makePlatformControlAuthority({
|
|
1508
|
+
space,
|
|
1509
|
+
accountPublicKey: keys.dataAccount.pub,
|
|
1510
|
+
owner: platformControlOwner(ownerSecret, space, keys.dataAccount.pub),
|
|
1511
|
+
observeAssignment: (s, a) => platformControl.observeAssignment(s, a),
|
|
1512
|
+
observeManagerInstance: plane.observeManagerInstance,
|
|
1513
|
+
dispatch: (holder, request) => {
|
|
1514
|
+
if (state !== "ready" || closePromise !== undefined)
|
|
1515
|
+
throw new EpEnvelopeError("unavailable", "auth-service context is not ready");
|
|
1516
|
+
switch (request.kind) {
|
|
1517
|
+
case "manager-service-authority": return plane.issueManagerServiceAuthority({ ...holder, request });
|
|
1518
|
+
case "manager-service-maintenance": return plane.maintainRemoteManager({ ...holder, request });
|
|
1519
|
+
case "manager-goal-index-scan": return plane.scanManagerGoalIndex({ ...holder, request });
|
|
1520
|
+
case "manager-admin-authorization": return plane.authorizeManagerAdmin({ ...holder, request });
|
|
1521
|
+
case "manager-run-admission": return plane.admitManagerRun({ ...holder, request });
|
|
1522
|
+
case "manager-run-attempt": return plane.issueManagerRunAttempt({ ...holder, request });
|
|
1523
|
+
case "manager-retained-agent-validation": return validateRetainedForHolder(holder, request);
|
|
1524
|
+
}
|
|
1525
|
+
},
|
|
1526
|
+
}),
|
|
1527
|
+
} : {}),
|
|
1482
1528
|
readiness() {
|
|
1483
1529
|
if (state === "unavailable")
|
|
1484
1530
|
return { state, context, cause: cause ?? "auth-service context is unavailable" };
|