@cortexkit/opencode-antigravity-auth 3.0.34 → 3.0.36
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/cli.js +413 -182
- package/dist/cli.js.map +4 -4
- package/dist/cli.meta.json +196 -69
- package/dist/index.js +506 -245
- package/dist/index.js.map +4 -4
- package/dist/index.meta.json +217 -90
- package/dist/server.js +1185 -860
- package/dist/server.js.map +4 -4
- package/dist/server.meta.json +1 -1
- package/dist/src/common-auth-embedded/auth-menu/accounts.js +9 -3
- package/dist/src/common-auth-embedded/claustrum/consumer.d.ts +5 -1
- package/dist/src/common-auth-embedded/claustrum/consumer.js +14 -5
- package/dist/src/common-auth-embedded/claustrum/custody.d.ts +11 -8
- package/dist/src/common-auth-embedded/claustrum/custody.js +26 -15
- package/dist/src/common-auth-embedded/claustrum/enrollment.d.ts +2 -0
- package/dist/src/common-auth-embedded/claustrum/enrollment.js +7 -0
- package/dist/src/common-auth-embedded/claustrum/host.d.ts +8 -0
- package/dist/src/common-auth-embedded/claustrum/host.js +113 -0
- package/dist/src/common-auth-embedded/claustrum/hub.d.ts +5 -1
- package/dist/src/common-auth-embedded/claustrum/hub.js +5 -2
- package/dist/src/common-auth-embedded/claustrum/index.d.ts +2 -1
- package/dist/src/common-auth-embedded/claustrum/index.js +2 -1
- package/dist/src/common-auth-embedded/opencode2/install.js +42 -9
- package/dist/src/common-auth-embedded/opencode2/types.d.ts +3 -1
- package/dist/src/common-auth-embedded/setup/command.js +8 -4
- package/dist/src/common-auth-embedded/setup/enroll.js +3 -0
- package/dist/src/common-auth-embedded/source-output.json +68 -52
- package/dist/src/ga/rpc/protocol.d.ts +1 -0
- package/dist/src/ga/rpc/protocol.d.ts.map +1 -1
- package/dist/src/ga/rpc/protocol.js +4 -1
- package/dist/src/ga/rpc/protocol.js.map +1 -1
- package/dist/src/ga/server/auth.d.ts.map +1 -1
- package/dist/src/ga/server/auth.js +27 -4
- package/dist/src/ga/server/auth.js.map +1 -1
- package/dist/src/ga/server/index.d.ts.map +1 -1
- package/dist/src/ga/server/index.js +5 -1
- package/dist/src/ga/server/index.js.map +1 -1
- package/dist/src/ga/tui/host-ga.d.ts +22 -58
- package/dist/src/ga/tui/host-ga.d.ts.map +1 -1
- package/dist/src/ga/tui/host-ga.js +161 -248
- package/dist/src/ga/tui/host-ga.js.map +1 -1
- package/dist/src/plugin/__fixtures__/verified-store.d.ts +1 -1
- package/dist/src/plugin/__fixtures__/verified-store.js +4 -4
- package/dist/src/plugin/auth-loader.js +1 -1
- package/dist/src/plugin/auth-loader.js.map +1 -1
- package/dist/src/plugin/background-vault-quota-refresh.js +1 -1
- package/dist/src/plugin/background-vault-quota-refresh.js.map +1 -1
- package/dist/src/plugin/ga-location-services.d.ts +1 -0
- package/dist/src/plugin/ga-location-services.d.ts.map +1 -1
- package/dist/src/plugin/ga-location-services.js +87 -51
- package/dist/src/plugin/ga-location-services.js.map +1 -1
- package/dist/src/plugin/index.d.ts.map +1 -1
- package/dist/src/plugin/index.js +2 -2
- package/dist/src/plugin/index.js.map +1 -1
- package/dist/src/plugin/shared/source-sidebar.js +1 -1
- package/dist/src/plugin/shared/source-sidebar.js.map +1 -1
- package/dist/src/plugin/vault-activation.d.ts.map +1 -1
- package/dist/src/plugin/vault-activation.js +10 -2
- package/dist/src/plugin/vault-activation.js.map +1 -1
- package/dist/src/plugin/vault-custody.d.ts.map +1 -1
- package/dist/src/plugin/vault-custody.js +25 -3
- package/dist/src/plugin/vault-custody.js.map +1 -1
- package/dist/src/runtime-layout.js +3 -3
- package/dist/src/runtime-layout.js.map +1 -1
- package/dist/src/setup.d.ts.map +1 -1
- package/dist/src/setup.js +8 -5
- package/dist/src/setup.js.map +1 -1
- package/dist/tui-build-map.json +1 -1
- package/dist/tui-ga-build-map.json +5 -5
- package/dist/types/src/common-auth-embedded/claustrum/consumer.d.ts +5 -1
- package/dist/types/src/common-auth-embedded/claustrum/custody.d.ts +11 -8
- package/dist/types/src/common-auth-embedded/claustrum/enrollment.d.ts +2 -0
- package/dist/types/src/common-auth-embedded/claustrum/host.d.ts +8 -0
- package/dist/types/src/common-auth-embedded/claustrum/hub.d.ts +5 -1
- package/dist/types/src/common-auth-embedded/claustrum/index.d.ts +2 -1
- package/dist/types/src/common-auth-embedded/opencode2/types.d.ts +3 -1
- package/dist/types/src/ga/rpc/protocol.d.ts +1 -0
- package/dist/types/src/ga/rpc/protocol.d.ts.map +1 -1
- package/dist/types/src/ga/server/auth.d.ts.map +1 -1
- package/dist/types/src/ga/server/index.d.ts.map +1 -1
- package/dist/types/src/plugin/ga-location-services.d.ts +1 -0
- package/dist/types/src/plugin/ga-location-services.d.ts.map +1 -1
- package/dist/types/src/plugin/index.d.ts.map +1 -1
- package/dist/types/src/plugin/vault-activation.d.ts.map +1 -1
- package/dist/types/src/plugin/vault-custody.d.ts.map +1 -1
- package/dist/types/src/setup.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/common-auth-embedded/auth-menu/accounts.js +9 -3
- package/src/common-auth-embedded/claustrum/consumer.d.ts +5 -1
- package/src/common-auth-embedded/claustrum/consumer.js +14 -5
- package/src/common-auth-embedded/claustrum/custody.d.ts +11 -8
- package/src/common-auth-embedded/claustrum/custody.js +26 -15
- package/src/common-auth-embedded/claustrum/enrollment.d.ts +2 -0
- package/src/common-auth-embedded/claustrum/enrollment.js +7 -0
- package/src/common-auth-embedded/claustrum/host.d.ts +8 -0
- package/src/common-auth-embedded/claustrum/host.js +113 -0
- package/src/common-auth-embedded/claustrum/hub.d.ts +5 -1
- package/src/common-auth-embedded/claustrum/hub.js +5 -2
- package/src/common-auth-embedded/claustrum/index.d.ts +2 -1
- package/src/common-auth-embedded/claustrum/index.js +2 -1
- package/src/common-auth-embedded/opencode2/install.js +42 -9
- package/src/common-auth-embedded/opencode2/types.d.ts +3 -1
- package/src/common-auth-embedded/setup/command.js +8 -4
- package/src/common-auth-embedded/setup/enroll.js +3 -0
- package/src/common-auth-embedded/source-output.json +68 -52
- package/src/tui-ga-compiled/host-ga.js +133 -241
- package/src/tui-ga-raw/host-ga.tsx +222 -315
|
@@ -46,7 +46,10 @@ export interface ClaustrumDiscoveryHubOptions {
|
|
|
46
46
|
* member for any row and is refused.
|
|
47
47
|
*/
|
|
48
48
|
family: ClassifyingClaustrumFamily<string>;
|
|
49
|
-
|
|
49
|
+
/** Enrollment-name prefix, required by the default host connection. */
|
|
50
|
+
pluginId?: string;
|
|
51
|
+
/** Used outside host authority; hosted connections always use the relay. */
|
|
52
|
+
connect?: () => Promise<ClaustrumScopedClient>;
|
|
50
53
|
/**
|
|
51
54
|
* How long one `connect()` attempt may take before the hub treats the vault
|
|
52
55
|
* as unreachable (default 10 s, as `ClaustrumConsumerOptions`). The hub's
|
|
@@ -60,6 +63,7 @@ export interface ClaustrumDiscoveryHubOptions {
|
|
|
60
63
|
* state only, never from the vault: on every hub tick, and when a member
|
|
61
64
|
* refreshes or authorizes. The first false read revokes every lease,
|
|
62
65
|
* closes the connection and clears every member.
|
|
66
|
+
* Host authority always selects custody and does not call this callback.
|
|
63
67
|
*/
|
|
64
68
|
isCustodyActive?: () => boolean | Promise<boolean>;
|
|
65
69
|
parseIdentity?: IdentityParser;
|
|
@@ -21,6 +21,7 @@ import { createHubMember, DEFAULT_CONNECT_TIMEOUT_MS, } from './consumer.js';
|
|
|
21
21
|
import { ClaustrumScopedCustody, } from './custody.js';
|
|
22
22
|
import { ensureClaustrumPrivateDirectory } from './enrollment.js';
|
|
23
23
|
import { ClaustrumConsumerError } from './errors.js';
|
|
24
|
+
import { connectVaultHost, hasVaultHost } from './host.js';
|
|
24
25
|
import { DEFAULT_ROUTE_PREFIX, decodedVaultRoster, forgetPendingVaultDiscovery, isVaultRosterLockRefusal, readVaultRoster, refreshVaultRoster, vaultRosterSeed, } from './roster.js';
|
|
25
26
|
import { drainShutdown, shutdownWarning } from './shutdown.js';
|
|
26
27
|
import { SAFETY_POLL_MS } from './watch.js';
|
|
@@ -383,7 +384,9 @@ export class ClaustrumDiscoveryHub {
|
|
|
383
384
|
// that never settles would otherwise hold them all for the hub's life.
|
|
384
385
|
const connectTimeoutMs = this.#options.connectTimeoutMs ?? DEFAULT_CONNECT_TIMEOUT_MS;
|
|
385
386
|
let timer;
|
|
386
|
-
const connect = this.#options.connect
|
|
387
|
+
const connect = (!hasVaultHost() && this.#options.connect
|
|
388
|
+
? this.#options.connect()
|
|
389
|
+
: Promise.resolve().then(() => connectVaultHost(this.#options.pluginId))).then((client) => {
|
|
387
390
|
// A connect resolves into its generation only while that generation
|
|
388
391
|
// is current and still wanted; otherwise its client never serves.
|
|
389
392
|
if (entry.timedOut) {
|
|
@@ -567,7 +570,7 @@ export class ClaustrumDiscoveryHub {
|
|
|
567
570
|
* runs the inactive transition; nothing else does.
|
|
568
571
|
*/
|
|
569
572
|
async #readAuthority() {
|
|
570
|
-
const active = (await this.#options.isCustodyActive?.()) ?? true;
|
|
573
|
+
const active = hasVaultHost() || ((await this.#options.isCustodyActive?.()) ?? true);
|
|
571
574
|
if (this.#shutdown.signal.aborted)
|
|
572
575
|
return false;
|
|
573
576
|
const was = this.#active;
|
|
@@ -4,8 +4,9 @@ export { ClaustrumCredentialError, type ClaustrumReporterSource, type Enrollment
|
|
|
4
4
|
export { ClaustrumUnreachableError, classifyVaultFailure, VAULT_FAILURE_CLASSES, type VaultFailureClass, } from './availability.js';
|
|
5
5
|
export { ClaustrumConsumer, type ClaustrumConsumerOptions, type ClaustrumWatchState, DEFAULT_CONNECT_TIMEOUT_MS, type SendOptions, } from './consumer.js';
|
|
6
6
|
export { type AccountIdentitySource, type ClassifyingClaustrumFamily, type ClaustrumFamily, type ClaustrumFamilyInput, type ClaustrumRosterWatch, type ClaustrumRosterWatchOptions, type ClaustrumScopedAttempt, type ClaustrumScopedClient, ClaustrumScopedCustody, type ClaustrumScopedIdentity, decideScopedRetryAfter401, type IdentityParser, isScopedCredentialRotation, KEPT_RECEIPT_MARGIN_MS, type KeptReceiptState, type ScopedRetryReason, SERVING_MARGIN_MS, type SkippedVaultReason, type SkippedVaultRecord, type VaultCredential, type VaultCredentialType, type VaultGrantReach, type VaultGrantTuple, type VaultInventory, type VaultRowFacts, } from './custody.js';
|
|
7
|
-
export { type ClaustrumEnrollmentClient, type ClaustrumEnrollmentConnection, type ClaustrumEnrollmentDisconnectResult, ClaustrumEnrollmentManager, type ClaustrumEnrollmentPaths, type ClaustrumEnrollmentResetResult, type ClaustrumEnrollmentStatus, classifyEnrollmentError, connectClaustrumEnrollmentClient, disconnectClaustrumEnrollment, type EnrollmentDisposition, enrollmentAuthority, enrollmentName, getClaustrumEnrollmentPaths, hostEnrollmentPaths, RETRYABLE_ENROLLMENT_CODES, readClaustrumEnrollmentStatus, readClaustrumEnrollmentToken, resetClaustrumEnrollmentState, TERMINAL_ENROLLMENT_CODES, } from './enrollment.js';
|
|
7
|
+
export { type ClaustrumEnrollmentClient, type ClaustrumEnrollmentConnection, type ClaustrumEnrollmentDisconnectResult, ClaustrumEnrollmentManager, type ClaustrumEnrollmentPaths, type ClaustrumEnrollmentResetResult, type ClaustrumEnrollmentStatus, classifyEnrollmentError, connectClaustrumEnrollmentClient, disconnectClaustrumEnrollment, type EnrollmentDisposition, enrollmentAuthority, enrollmentName, getClaustrumEnrollmentPaths, hostEnrollmentPaths, RETRYABLE_ENROLLMENT_CODES, readClaustrumEnrollmentStatus, readClaustrumEnrollmentToken, resetClaustrumEnrollmentState, TERMINAL_ENROLLMENT_CODES, vaultAuthority, } from './enrollment.js';
|
|
8
8
|
export { ClaustrumConsumerError, type ClaustrumConsumerFailureKind, type ClaustrumLogger, } from './errors.js';
|
|
9
|
+
export { connectVaultHost, VAULT_HOST_CONNECT_REFUSAL, VAULT_HOST_STATUS, } from './host.js';
|
|
9
10
|
export { assertHostSlotMatchesMode, assertNotCustodyPlaceholder, CUSTODY_PLACEHOLDER_PREFIX, classifyHostSlot, custodyPlaceholder, custodyPlaceholderKey, type HostSlotContent, isCustodyPlaceholder, isCustodyPlaceholderValue, } from './host-slot.js';
|
|
10
11
|
export { ClaustrumDiscoveryHub, type ClaustrumDiscoveryHubOptions, type ClaustrumHubMemberOptions, type ClaustrumHubRefusals, type ClaustrumLeasedCustody, type CustodyLease, } from './hub.js';
|
|
11
12
|
export { acquireInsulaQuotaSource, type InsulaQuotaContext, type InsulaQuotaLookup, type InsulaQuotaMiss, type InsulaQuotaOptions, type InsulaQuotaReading, type InsulaQuotaResult, type InsulaQuotaSource, type InsulaUsageEntry, type InsulaUsageTransport, type InsulaUsageWatch, type InsulaUsageWindow, type InsulaWatchOptions, } from './insula.js';
|
|
@@ -10,8 +10,9 @@ export { ClaustrumCredentialError, } from '@cortexkit/claustrum-client';
|
|
|
10
10
|
export { ClaustrumUnreachableError, classifyVaultFailure, VAULT_FAILURE_CLASSES, } from './availability.js';
|
|
11
11
|
export { ClaustrumConsumer, DEFAULT_CONNECT_TIMEOUT_MS, } from './consumer.js';
|
|
12
12
|
export { ClaustrumScopedCustody, decideScopedRetryAfter401, isScopedCredentialRotation, KEPT_RECEIPT_MARGIN_MS, SERVING_MARGIN_MS, } from './custody.js';
|
|
13
|
-
export { ClaustrumEnrollmentManager, classifyEnrollmentError, connectClaustrumEnrollmentClient, disconnectClaustrumEnrollment, enrollmentAuthority, enrollmentName, getClaustrumEnrollmentPaths, hostEnrollmentPaths, RETRYABLE_ENROLLMENT_CODES, readClaustrumEnrollmentStatus, readClaustrumEnrollmentToken, resetClaustrumEnrollmentState, TERMINAL_ENROLLMENT_CODES, } from './enrollment.js';
|
|
13
|
+
export { ClaustrumEnrollmentManager, classifyEnrollmentError, connectClaustrumEnrollmentClient, disconnectClaustrumEnrollment, enrollmentAuthority, enrollmentName, getClaustrumEnrollmentPaths, hostEnrollmentPaths, RETRYABLE_ENROLLMENT_CODES, readClaustrumEnrollmentStatus, readClaustrumEnrollmentToken, resetClaustrumEnrollmentState, TERMINAL_ENROLLMENT_CODES, vaultAuthority, } from './enrollment.js';
|
|
14
14
|
export { ClaustrumConsumerError, } from './errors.js';
|
|
15
|
+
export { connectVaultHost, VAULT_HOST_CONNECT_REFUSAL, VAULT_HOST_STATUS, } from './host.js';
|
|
15
16
|
export { assertHostSlotMatchesMode, assertNotCustodyPlaceholder, CUSTODY_PLACEHOLDER_PREFIX, classifyHostSlot, custodyPlaceholder, custodyPlaceholderKey, isCustodyPlaceholder, isCustodyPlaceholderValue, } from './host-slot.js';
|
|
16
17
|
export { ClaustrumDiscoveryHub, } from './hub.js';
|
|
17
18
|
export { acquireInsulaQuotaSource, } from './insula.js';
|
|
@@ -290,6 +290,27 @@ export async function installOpenCode2Auth(ctx, adapter, options = {}) {
|
|
|
290
290
|
}
|
|
291
291
|
}));
|
|
292
292
|
};
|
|
293
|
+
const emitRetry = async (payload) => {
|
|
294
|
+
const transports = new Set([...attempts.values()]
|
|
295
|
+
.filter((rec) => rec.scope.sessionID === payload.sessionID)
|
|
296
|
+
.map((rec) => rec.transport)
|
|
297
|
+
.filter((transport) => transport !== undefined));
|
|
298
|
+
const transport = payload.handle?.transport ??
|
|
299
|
+
(transports.size === 1 ? [...transports][0] : 'unknown');
|
|
300
|
+
try {
|
|
301
|
+
logger?.info?.('opencode2 auth retry decision', {
|
|
302
|
+
sessionID: payload.sessionID,
|
|
303
|
+
transport,
|
|
304
|
+
attempt: payload.attempt,
|
|
305
|
+
reason: payload.reason === 'host-decides' && mixed(payload.sessionID)
|
|
306
|
+
? 'mixed-session'
|
|
307
|
+
: payload.reason,
|
|
308
|
+
retry: payload.decision.retry,
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
catch { }
|
|
312
|
+
await emit('retry', payload);
|
|
313
|
+
};
|
|
293
314
|
const deliverEnd = async (attempt, outcome) => {
|
|
294
315
|
try {
|
|
295
316
|
await adapter.onAttemptEnd?.(attempt, outcome);
|
|
@@ -805,7 +826,7 @@ export async function installOpenCode2Auth(ctx, adapter, options = {}) {
|
|
|
805
826
|
}
|
|
806
827
|
response = new Response(trackBody(body, (error) => {
|
|
807
828
|
if (error?.reason === 'failed')
|
|
808
|
-
rec.
|
|
829
|
+
rec.readFailed = true;
|
|
809
830
|
finish(rec, error);
|
|
810
831
|
}), {
|
|
811
832
|
status: original.status,
|
|
@@ -915,7 +936,7 @@ export async function installOpenCode2Auth(ctx, adapter, options = {}) {
|
|
|
915
936
|
if (ownership && latestTransportOwned.get(draft.sessionID) !== true)
|
|
916
937
|
return;
|
|
917
938
|
const hostDecision = draft.decision;
|
|
918
|
-
const hostDecides = () =>
|
|
939
|
+
const hostDecides = () => emitRetry({
|
|
919
940
|
sessionID: draft.sessionID,
|
|
920
941
|
attempt: draft.attempt,
|
|
921
942
|
reason: 'host-decides',
|
|
@@ -932,7 +953,7 @@ export async function installOpenCode2Auth(ctx, adapter, options = {}) {
|
|
|
932
953
|
if (picked === 'ambiguous') {
|
|
933
954
|
// Nothing tells which open attempt failed: keep the host's
|
|
934
955
|
// decision and leave every attempt as it is.
|
|
935
|
-
await
|
|
956
|
+
await emitRetry({
|
|
936
957
|
sessionID: draft.sessionID,
|
|
937
958
|
attempt: draft.attempt,
|
|
938
959
|
reason: 'host-decides',
|
|
@@ -948,8 +969,18 @@ export async function installOpenCode2Auth(ctx, adapter, options = {}) {
|
|
|
948
969
|
const retrySameAccount = adapter.retrySameAccount?.bind(adapter);
|
|
949
970
|
const handle = rec.attempt;
|
|
950
971
|
const afterOutput = rec.outputStarted;
|
|
972
|
+
if (rec.transport === 'ws' &&
|
|
973
|
+
afterOutput &&
|
|
974
|
+
!rec.ended &&
|
|
975
|
+
!rec.limit &&
|
|
976
|
+
!(rec.status !== undefined && rec.status >= 400) &&
|
|
977
|
+
!(draft.error.status !== undefined && draft.error.status >= 400) &&
|
|
978
|
+
draft.error.type === 'provider.transport') {
|
|
979
|
+
rec.readFailed = true;
|
|
980
|
+
finish(rec, { reason: 'failed', message: draft.error.message });
|
|
981
|
+
}
|
|
951
982
|
if (afterOutput &&
|
|
952
|
-
rec.
|
|
983
|
+
rec.readFailed &&
|
|
953
984
|
retrySameAccount &&
|
|
954
985
|
handle &&
|
|
955
986
|
!mixed(draft.sessionID)) {
|
|
@@ -964,9 +995,11 @@ export async function installOpenCode2Auth(ctx, adapter, options = {}) {
|
|
|
964
995
|
await rec.limit.delivered;
|
|
965
996
|
checkRetryActive();
|
|
966
997
|
}
|
|
967
|
-
// The host drops read-operation metadata from its retry error.
|
|
968
|
-
// our
|
|
969
|
-
|
|
998
|
+
// The host drops read-operation metadata from its retry error. HTTP
|
|
999
|
+
// needs our body reader's failure; WebSocket needs inspected output
|
|
1000
|
+
// without a terminal frame, since the host only sends before reading.
|
|
1001
|
+
// Ending the socket attempt above also excludes any late frames.
|
|
1002
|
+
const canContinue = () => rec.readFailed === true &&
|
|
970
1003
|
draft.error.type === 'provider.transport' &&
|
|
971
1004
|
hostDecision.retry &&
|
|
972
1005
|
hostRetryLimit - draft.attempt >= 1 &&
|
|
@@ -1072,7 +1105,7 @@ export async function installOpenCode2Auth(ctx, adapter, options = {}) {
|
|
|
1072
1105
|
});
|
|
1073
1106
|
checkRetryActive();
|
|
1074
1107
|
if (retried) {
|
|
1075
|
-
await
|
|
1108
|
+
await emitRetry({
|
|
1076
1109
|
sessionID: draft.sessionID,
|
|
1077
1110
|
accountId: rec.accountId,
|
|
1078
1111
|
kind: rec.scope.kind,
|
|
@@ -1327,7 +1360,7 @@ export async function installOpenCode2Auth(ctx, adapter, options = {}) {
|
|
|
1327
1360
|
return { decision, reason };
|
|
1328
1361
|
});
|
|
1329
1362
|
checkRetryActive();
|
|
1330
|
-
await
|
|
1363
|
+
await emitRetry({
|
|
1331
1364
|
sessionID: draft.sessionID,
|
|
1332
1365
|
...(rec.accountId === undefined
|
|
1333
1366
|
? {}
|
|
@@ -487,6 +487,8 @@ export interface OpenCode2AuthAdapter<Q = unknown, A = unknown, Choice extends C
|
|
|
487
487
|
}
|
|
488
488
|
export interface OpenCode2AuthLogger {
|
|
489
489
|
warn(message: string, data?: unknown): void;
|
|
490
|
+
/** Retry decisions, without account details or provider error contents. */
|
|
491
|
+
info?(message: string, data?: unknown): void;
|
|
490
492
|
}
|
|
491
493
|
export interface InstallOpenCode2AuthOptions {
|
|
492
494
|
/**
|
|
@@ -541,7 +543,7 @@ export interface InstallOpenCode2AuthOptions {
|
|
|
541
543
|
* - `reroute`: refused for a limit before any output, and `chooseAccount`
|
|
542
544
|
* named another account for the next attempt, so the host retries at once;
|
|
543
545
|
* - `output-started`: output reached the user without a safe continuation, so no retry;
|
|
544
|
-
* - `continue-same-account`: a witnessed
|
|
546
|
+
* - `continue-same-account`: a witnessed transport read failure after output, with
|
|
545
547
|
* adapter-approved identity preservation; keeps the host's continuation and delay;
|
|
546
548
|
* - `no-account`: the attempt had no account, so no retry;
|
|
547
549
|
* - `host-decides-last-account`: refused for a limit before any output, but
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { select } from '../auth-menu/select.js';
|
|
2
2
|
import { isInteractive, printLine, processTerminal, } from '../auth-menu/terminal.js';
|
|
3
|
-
import {
|
|
3
|
+
import { hostEnrollmentPaths, vaultAuthority } from '../claustrum/enrollment.js';
|
|
4
|
+
import { hasVaultHost, VAULT_HOST_CONNECT_REFUSAL } from '../claustrum/host.js';
|
|
4
5
|
import { recordSetupEnrollment, setupEnrollmentLine } from './command-error.js';
|
|
5
6
|
import { defaultCommandRunner } from './command-runner.js';
|
|
6
7
|
import { detectHosts } from './detect.js';
|
|
@@ -27,7 +28,7 @@ function validatePlugin(plugin) {
|
|
|
27
28
|
* Turn what setup recorded into one outcome per selected host, in setup order.
|
|
28
29
|
* A host setup never reached was never asked to enroll. Only a host whose
|
|
29
30
|
* enrollment was in flight when setup failed is checked on disk, by reading its
|
|
30
|
-
*
|
|
31
|
+
* authority once with `vaultAuthority`; if that read fails it stays
|
|
31
32
|
* `unknown`.
|
|
32
33
|
*/
|
|
33
34
|
async function enrollmentReport(plugin, hosts, recorded) {
|
|
@@ -36,8 +37,8 @@ async function enrollmentReport(plugin, hosts, recorded) {
|
|
|
36
37
|
let outcome = recorded.get(host) ?? 'not-enrolled';
|
|
37
38
|
if (outcome === 'unknown') {
|
|
38
39
|
const { name, paths } = plugin.vault.hosts[host];
|
|
39
|
-
const authority = await
|
|
40
|
-
if (authority === 'vault')
|
|
40
|
+
const authority = await vaultAuthority(hostEnrollmentPaths(paths), name).catch(() => 'unreadable');
|
|
41
|
+
if (authority === 'vault' || authority === 'host')
|
|
41
42
|
outcome = 'enrolled';
|
|
42
43
|
else if (authority === 'local')
|
|
43
44
|
outcome = 'not-enrolled';
|
|
@@ -48,6 +49,9 @@ async function enrollmentReport(plugin, hosts, recorded) {
|
|
|
48
49
|
}
|
|
49
50
|
export async function runSetup(plugin, argv = [], io = {}) {
|
|
50
51
|
const options = parseSetupFlags(argv);
|
|
52
|
+
// Hosted sign-in belongs to Thalamus, never to a plugin's local setup.
|
|
53
|
+
if (hasVaultHost())
|
|
54
|
+
throw new Error(VAULT_HOST_CONNECT_REFUSAL);
|
|
51
55
|
validatePlugin(plugin);
|
|
52
56
|
const terminal = io.terminal ?? processTerminal();
|
|
53
57
|
const detection = await detectHosts(plugin, io);
|
|
@@ -2,6 +2,7 @@ import { setTimeout as delay } from 'node:timers/promises';
|
|
|
2
2
|
import { writeEnrollmentTokenFile } from '@cortexkit/claustrum-client';
|
|
3
3
|
import { printLine } from '../auth-menu/terminal.js';
|
|
4
4
|
import { ClaustrumEnrollmentManager, connectClaustrumEnrollmentClient, hostEnrollmentPaths, UNSUPPORTED_ENROLLMENT_CODE, } from '../claustrum/enrollment.js';
|
|
5
|
+
import { hasVaultHost, VAULT_HOST_CONNECT_REFUSAL } from '../claustrum/host.js';
|
|
5
6
|
import { ProcessFenceViolationError, ProcessInspectionError, } from './process-fence.js';
|
|
6
7
|
const ENROLLMENT_INCOMPLETE_MESSAGE = 'Claustrum enrollment did not complete. Inspect and approve with ck, then rerun setup.';
|
|
7
8
|
/** Fixed text: no version, host or account detail, so it is safe to print anywhere. */
|
|
@@ -51,6 +52,8 @@ function approveCommand(requestId, name) {
|
|
|
51
52
|
}
|
|
52
53
|
/** Enroll an independently revocable host; plugin callbacks choose its credential store and account permissions. */
|
|
53
54
|
export async function connectSetupHost(plugin, host, io, terminal, fence) {
|
|
55
|
+
if (hasVaultHost())
|
|
56
|
+
throw new Error(VAULT_HOST_CONNECT_REFUSAL);
|
|
54
57
|
const { name, paths: input } = plugin.vault.hosts[host];
|
|
55
58
|
const paths = hostEnrollmentPaths(input);
|
|
56
59
|
await fence();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": 1,
|
|
3
3
|
"package": "@cortexkit/common-auth",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.40.0",
|
|
5
5
|
"artifactStatus": "published",
|
|
6
6
|
"publicRoots": {
|
|
7
7
|
"./rpc": {
|
|
@@ -69,15 +69,15 @@
|
|
|
69
69
|
"import": "./src/quota-sidebar/index.tsx"
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
|
-
"input": "tools/common-auth-build/inputs/cortexkit-common-auth-0.
|
|
73
|
-
"tarballSha256": "
|
|
74
|
-
"sri": "sha512-
|
|
75
|
-
"canonicalFiles":
|
|
76
|
-
"canonicalBytes":
|
|
72
|
+
"input": "tools/common-auth-build/inputs/cortexkit-common-auth-0.40.0.tgz",
|
|
73
|
+
"tarballSha256": "c1346992a2f15355b9304e729ff2ff47de9bf07d578563b9f0c6f83b969253b4",
|
|
74
|
+
"sri": "sha512-P0rfQ+fRXTBhAAG0rWkcP2CXkDb32Zplo37qpQx6TINHi78yzp8kNEnHSSwSeEReH5imh7hptg9L69AYCg4Jdw==",
|
|
75
|
+
"canonicalFiles": 218,
|
|
76
|
+
"canonicalBytes": 1365319,
|
|
77
77
|
"generator": {
|
|
78
78
|
"path": "packages/opencode/scripts/embed-common-auth.ts",
|
|
79
79
|
"version": 4,
|
|
80
|
-
"sha256": "
|
|
80
|
+
"sha256": "3d9e00d8b43c67a911c6b14648432aad4d43c85d210c9dc5a3e9524cf67aff3c"
|
|
81
81
|
},
|
|
82
82
|
"files": [
|
|
83
83
|
{
|
|
@@ -91,9 +91,9 @@
|
|
|
91
91
|
{
|
|
92
92
|
"source": "package/dist/auth-menu/accounts.js",
|
|
93
93
|
"output": "auth-menu/accounts.js",
|
|
94
|
-
"bytes":
|
|
95
|
-
"sourceSha256": "
|
|
96
|
-
"outputSha256": "
|
|
94
|
+
"bytes": 15426,
|
|
95
|
+
"sourceSha256": "a3101cdc5c971119c382fb74ce563bb24e1a996ebe3d6b06037440b55d2fd6ed",
|
|
96
|
+
"outputSha256": "a3101cdc5c971119c382fb74ce563bb24e1a996ebe3d6b06037440b55d2fd6ed",
|
|
97
97
|
"transform": "verbatim"
|
|
98
98
|
},
|
|
99
99
|
{
|
|
@@ -259,49 +259,49 @@
|
|
|
259
259
|
{
|
|
260
260
|
"source": "package/dist/claustrum/consumer.d.ts",
|
|
261
261
|
"output": "claustrum/consumer.d.ts",
|
|
262
|
-
"bytes":
|
|
263
|
-
"sourceSha256": "
|
|
264
|
-
"outputSha256": "
|
|
262
|
+
"bytes": 14722,
|
|
263
|
+
"sourceSha256": "b4c4a006089b95a5b553fcc03b598851535ba8e5d184c277b7b2fa5ce172f7d9",
|
|
264
|
+
"outputSha256": "b4c4a006089b95a5b553fcc03b598851535ba8e5d184c277b7b2fa5ce172f7d9",
|
|
265
265
|
"transform": "verbatim"
|
|
266
266
|
},
|
|
267
267
|
{
|
|
268
268
|
"source": "package/dist/claustrum/consumer.js",
|
|
269
269
|
"output": "claustrum/consumer.js",
|
|
270
|
-
"bytes":
|
|
271
|
-
"sourceSha256": "
|
|
272
|
-
"outputSha256": "
|
|
270
|
+
"bytes": 41187,
|
|
271
|
+
"sourceSha256": "c566f9a86fcd7cacb64901f68d4d0399424e2f27135bbdc1855f5c8262be9604",
|
|
272
|
+
"outputSha256": "c566f9a86fcd7cacb64901f68d4d0399424e2f27135bbdc1855f5c8262be9604",
|
|
273
273
|
"transform": "verbatim"
|
|
274
274
|
},
|
|
275
275
|
{
|
|
276
276
|
"source": "package/dist/claustrum/custody.d.ts",
|
|
277
277
|
"output": "claustrum/custody.d.ts",
|
|
278
|
-
"bytes":
|
|
279
|
-
"sourceSha256": "
|
|
280
|
-
"outputSha256": "
|
|
278
|
+
"bytes": 17299,
|
|
279
|
+
"sourceSha256": "70c5f7f40cde58a614c79b280c2129f9a228238342f69eac42237b8621ecfa59",
|
|
280
|
+
"outputSha256": "70c5f7f40cde58a614c79b280c2129f9a228238342f69eac42237b8621ecfa59",
|
|
281
281
|
"transform": "verbatim"
|
|
282
282
|
},
|
|
283
283
|
{
|
|
284
284
|
"source": "package/dist/claustrum/custody.js",
|
|
285
285
|
"output": "claustrum/custody.js",
|
|
286
|
-
"bytes":
|
|
287
|
-
"sourceSha256": "
|
|
288
|
-
"outputSha256": "
|
|
286
|
+
"bytes": 34857,
|
|
287
|
+
"sourceSha256": "cadbce8e39cb51c9c6756c01d0d8ebe9a328cf4f3bb70e081ffe26c4773bc5f1",
|
|
288
|
+
"outputSha256": "cadbce8e39cb51c9c6756c01d0d8ebe9a328cf4f3bb70e081ffe26c4773bc5f1",
|
|
289
289
|
"transform": "verbatim"
|
|
290
290
|
},
|
|
291
291
|
{
|
|
292
292
|
"source": "package/dist/claustrum/enrollment.d.ts",
|
|
293
293
|
"output": "claustrum/enrollment.d.ts",
|
|
294
|
-
"bytes":
|
|
295
|
-
"sourceSha256": "
|
|
296
|
-
"outputSha256": "
|
|
294
|
+
"bytes": 8761,
|
|
295
|
+
"sourceSha256": "4ebace01478b70ccabca0964128a47ea93c553d4ad1c307c29946a6952023dbe",
|
|
296
|
+
"outputSha256": "4ebace01478b70ccabca0964128a47ea93c553d4ad1c307c29946a6952023dbe",
|
|
297
297
|
"transform": "verbatim"
|
|
298
298
|
},
|
|
299
299
|
{
|
|
300
300
|
"source": "package/dist/claustrum/enrollment.js",
|
|
301
301
|
"output": "claustrum/enrollment.js",
|
|
302
|
-
"bytes":
|
|
303
|
-
"sourceSha256": "
|
|
304
|
-
"outputSha256": "
|
|
302
|
+
"bytes": 37156,
|
|
303
|
+
"sourceSha256": "b5bd0f39bc78277cc36a15dd30bad763f114d7ed099466671752dbeecd1cd873",
|
|
304
|
+
"outputSha256": "b5bd0f39bc78277cc36a15dd30bad763f114d7ed099466671752dbeecd1cd873",
|
|
305
305
|
"transform": "verbatim"
|
|
306
306
|
},
|
|
307
307
|
{
|
|
@@ -336,36 +336,52 @@
|
|
|
336
336
|
"outputSha256": "59bd24af8dbf5d923750b6e2fb15de2ce8a59aa59e11a6740527e50d5f7f93d6",
|
|
337
337
|
"transform": "verbatim"
|
|
338
338
|
},
|
|
339
|
+
{
|
|
340
|
+
"source": "package/dist/claustrum/host.d.ts",
|
|
341
|
+
"output": "claustrum/host.d.ts",
|
|
342
|
+
"bytes": 652,
|
|
343
|
+
"sourceSha256": "a15498005feb59a231b9419736a10dd764ec3bcc67d7f427197845aa91105b8e",
|
|
344
|
+
"outputSha256": "a15498005feb59a231b9419736a10dd764ec3bcc67d7f427197845aa91105b8e",
|
|
345
|
+
"transform": "verbatim"
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
"source": "package/dist/claustrum/host.js",
|
|
349
|
+
"output": "claustrum/host.js",
|
|
350
|
+
"bytes": 4403,
|
|
351
|
+
"sourceSha256": "7baae6af599ee02066c6ff3c238bcade9f701846505ec4d497e78e429bb7eea2",
|
|
352
|
+
"outputSha256": "7baae6af599ee02066c6ff3c238bcade9f701846505ec4d497e78e429bb7eea2",
|
|
353
|
+
"transform": "verbatim"
|
|
354
|
+
},
|
|
339
355
|
{
|
|
340
356
|
"source": "package/dist/claustrum/hub.d.ts",
|
|
341
357
|
"output": "claustrum/hub.d.ts",
|
|
342
|
-
"bytes":
|
|
343
|
-
"sourceSha256": "
|
|
344
|
-
"outputSha256": "
|
|
358
|
+
"bytes": 9719,
|
|
359
|
+
"sourceSha256": "489a3214a386ad2329d7348288c371d41e79427bfc2daa91e2743cd4ddeccec9",
|
|
360
|
+
"outputSha256": "489a3214a386ad2329d7348288c371d41e79427bfc2daa91e2743cd4ddeccec9",
|
|
345
361
|
"transform": "verbatim"
|
|
346
362
|
},
|
|
347
363
|
{
|
|
348
364
|
"source": "package/dist/claustrum/hub.js",
|
|
349
365
|
"output": "claustrum/hub.js",
|
|
350
|
-
"bytes":
|
|
351
|
-
"sourceSha256": "
|
|
352
|
-
"outputSha256": "
|
|
366
|
+
"bytes": 46503,
|
|
367
|
+
"sourceSha256": "2b9aea632e082662a9b4e5341e926bd468467851cfb0fb2d4fabb9bed44a5544",
|
|
368
|
+
"outputSha256": "2b9aea632e082662a9b4e5341e926bd468467851cfb0fb2d4fabb9bed44a5544",
|
|
353
369
|
"transform": "verbatim"
|
|
354
370
|
},
|
|
355
371
|
{
|
|
356
372
|
"source": "package/dist/claustrum/index.d.ts",
|
|
357
373
|
"output": "claustrum/index.d.ts",
|
|
358
|
-
"bytes":
|
|
359
|
-
"sourceSha256": "
|
|
360
|
-
"outputSha256": "
|
|
374
|
+
"bytes": 4923,
|
|
375
|
+
"sourceSha256": "17fe239561e9a3c8769cef79b08ca279b6d359ab9946fe03e40f1f285edadf03",
|
|
376
|
+
"outputSha256": "17fe239561e9a3c8769cef79b08ca279b6d359ab9946fe03e40f1f285edadf03",
|
|
361
377
|
"transform": "verbatim"
|
|
362
378
|
},
|
|
363
379
|
{
|
|
364
380
|
"source": "package/dist/claustrum/index.js",
|
|
365
381
|
"output": "claustrum/index.js",
|
|
366
|
-
"bytes":
|
|
367
|
-
"sourceSha256": "
|
|
368
|
-
"outputSha256": "
|
|
382
|
+
"bytes": 4048,
|
|
383
|
+
"sourceSha256": "9f50749354dbcf643a3cddc9ff994824c603fac288f50015703ca6e1f730ca08",
|
|
384
|
+
"outputSha256": "9f50749354dbcf643a3cddc9ff994824c603fac288f50015703ca6e1f730ca08",
|
|
369
385
|
"transform": "verbatim"
|
|
370
386
|
},
|
|
371
387
|
{
|
|
@@ -875,9 +891,9 @@
|
|
|
875
891
|
{
|
|
876
892
|
"source": "package/dist/opencode2/install.js",
|
|
877
893
|
"output": "opencode2/install.js",
|
|
878
|
-
"bytes":
|
|
879
|
-
"sourceSha256": "
|
|
880
|
-
"outputSha256": "
|
|
894
|
+
"bytes": 65057,
|
|
895
|
+
"sourceSha256": "823040b7d0fc4b0199fdbaa68583180338b040ea1200d611c645ba9a3b22538d",
|
|
896
|
+
"outputSha256": "823040b7d0fc4b0199fdbaa68583180338b040ea1200d611c645ba9a3b22538d",
|
|
881
897
|
"transform": "verbatim"
|
|
882
898
|
},
|
|
883
899
|
{
|
|
@@ -915,9 +931,9 @@
|
|
|
915
931
|
{
|
|
916
932
|
"source": "package/dist/opencode2/types.d.ts",
|
|
917
933
|
"output": "opencode2/types.d.ts",
|
|
918
|
-
"bytes":
|
|
919
|
-
"sourceSha256": "
|
|
920
|
-
"outputSha256": "
|
|
934
|
+
"bytes": 32757,
|
|
935
|
+
"sourceSha256": "d9e94ff62857ad062770ad64e30456c39fafbea57c488099cf06dade301120e1",
|
|
936
|
+
"outputSha256": "d9e94ff62857ad062770ad64e30456c39fafbea57c488099cf06dade301120e1",
|
|
921
937
|
"transform": "verbatim"
|
|
922
938
|
},
|
|
923
939
|
{
|
|
@@ -1307,9 +1323,9 @@
|
|
|
1307
1323
|
{
|
|
1308
1324
|
"source": "package/dist/setup/command.js",
|
|
1309
1325
|
"output": "setup/command.js",
|
|
1310
|
-
"bytes":
|
|
1311
|
-
"sourceSha256": "
|
|
1312
|
-
"outputSha256": "
|
|
1326
|
+
"bytes": 13808,
|
|
1327
|
+
"sourceSha256": "e4c04aa49c650583e2768089ebcd6a41f90f00589f8cd8ca8ac73027a3867678",
|
|
1328
|
+
"outputSha256": "e4c04aa49c650583e2768089ebcd6a41f90f00589f8cd8ca8ac73027a3867678",
|
|
1313
1329
|
"transform": "verbatim"
|
|
1314
1330
|
},
|
|
1315
1331
|
{
|
|
@@ -1347,9 +1363,9 @@
|
|
|
1347
1363
|
{
|
|
1348
1364
|
"source": "package/dist/setup/enroll.js",
|
|
1349
1365
|
"output": "setup/enroll.js",
|
|
1350
|
-
"bytes":
|
|
1351
|
-
"sourceSha256": "
|
|
1352
|
-
"outputSha256": "
|
|
1366
|
+
"bytes": 8966,
|
|
1367
|
+
"sourceSha256": "e05ca19de7459da5a3c90c06dfec95d65ae4f8101f8fab3fc5d77d4e02728940",
|
|
1368
|
+
"outputSha256": "e05ca19de7459da5a3c90c06dfec95d65ae4f8101f8fab3fc5d77d4e02728940",
|
|
1353
1369
|
"transform": "verbatim"
|
|
1354
1370
|
},
|
|
1355
1371
|
{
|