@cortexkit/opencode-openai-auth 1.12.0 → 1.14.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/bin.js +9 -9
- package/dist/{codex-request-DFeGDzpN.d.ts → codex-request-Cl6zEfsR.d.ts} +21 -3
- package/dist/{index-5p6vw484.js → index-1abcvt9p.js} +1 -1
- package/dist/{index-2xsz3z63.js → index-3c9pk6zn.js} +2 -2
- package/dist/{index-dcvxs9xj.js → index-4tpttpjw.js} +1 -1
- package/dist/index-4zpxwh8y.js +91 -0
- package/dist/{index-7p1s64b4.js → index-a9tzfpxy.js} +1 -1
- package/dist/index-bc2d4vma.js +64 -0
- package/dist/{index-wtmxk263.js → index-f7t7cc9b.js} +2 -2
- package/dist/{index-7qztyb1b.js → index-nfbmjq6g.js} +2 -2
- package/dist/{index-3pm1cvhy.js → index-q111b2h5.js} +1 -1
- package/dist/{index-3nwj0h10.js → index-wap9mf5f.js} +2 -2
- package/dist/{index-p4qaa85r.js → index-xxmaf5ks.js} +2 -2
- package/dist/index-yew3mp47.js +76 -0
- package/dist/index-zcpher1w.js +8 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/rpc/port-file.js +1 -1
- package/dist/rpc/protocol.js +1 -1
- package/dist/rpc/rpc-client.js +1 -1
- package/dist/rpc/rpc-dir.js +1 -1
- package/dist/sidebar-state.js +1 -1
- package/dist/{token-dr80qm6g.js → token-6x4q5r2r.js} +1 -1
- package/dist/token-util-54mhq85x.js +1 -0
- package/dist/tui-preferences.js +1 -1
- package/dist/v2/server.d.ts +1 -1
- package/dist/v2/server.js +3 -3
- package/package.json +8 -7
- package/src/tui-compiled/raw/shared/0f77ebc3c914c9c6-custody.js +89 -31
- package/src/tui-compiled/raw/shared/4825e03209d6ae3e-with-lock.js +19 -13
- package/src/tui-compiled/raw/shared/549daf371622c304-index.tsx +49 -607
- package/src/tui-compiled/raw/shared/723b00f96290a097-lock-record.js +55 -0
- package/src/tui-compiled/raw/shared/94f53cfd572ba4bb-availability.js +9 -1
- package/src/tui-compiled/raw/shared/a75d0d866c227b3f-index.tsx +681 -0
- package/src/tui-compiled/raw/shared/abd062d633e29fd2-pool-routing.js +21 -15
- package/src/tui-compiled/raw/shared/b9588ad4725c1d10-enrollment.js +110 -2
- package/src/tui-compiled/raw/shared/c97089ed4243981c-host.js +11 -7
- package/src/tui-compiled/raw/shared/e8cd4929507508d8-refresh-file-lock.js +148 -92
- package/src/tui-compiled/raw/shared/e8d3c8da776ef9cd-index.js +1 -1
- package/src/tui-compiled/runtime/shared/0f77ebc3c914c9c6-custody.js +89 -31
- package/src/tui-compiled/runtime/shared/4825e03209d6ae3e-with-lock.js +19 -13
- package/src/tui-compiled/runtime/shared/549daf371622c304-index.js +36 -674
- package/src/tui-compiled/runtime/shared/723b00f96290a097-lock-record.js +55 -0
- package/src/tui-compiled/runtime/shared/94f53cfd572ba4bb-availability.js +9 -1
- package/src/tui-compiled/runtime/shared/a75d0d866c227b3f-index.js +678 -0
- package/src/tui-compiled/runtime/shared/abd062d633e29fd2-pool-routing.js +21 -15
- package/src/tui-compiled/runtime/shared/b9588ad4725c1d10-enrollment.js +110 -2
- package/src/tui-compiled/runtime/shared/c97089ed4243981c-host.js +11 -7
- package/src/tui-compiled/runtime/shared/e8cd4929507508d8-refresh-file-lock.js +148 -92
- package/src/tui-compiled/runtime/shared/e8d3c8da776ef9cd-index.js +1 -1
- package/dist/index-2egbrywb.js +0 -8
- package/dist/index-dqk0c7wr.js +0 -64
- package/dist/index-n5jtwtrs.js +0 -76
- package/dist/index-phgm1zwn.js +0 -91
- package/dist/token-util-97td5ex3.js +0 -1
|
@@ -166,34 +166,38 @@ export function planOrdered(input) {
|
|
|
166
166
|
refreshBackoff: input.refreshBackoff,
|
|
167
167
|
now: input.now,
|
|
168
168
|
requestPull: input.requestPull
|
|
169
|
-
}), ids = orderForPlacement(input.rows.map((row) => row.id), placement, mainId), confirmed = new Set(route.admission.refused.filter((refusal) => isConfirmedExhaustion(refusal) && input.killswitch.get(refusal.id) !== !1).map((refusal) => refusal.id)), lastPath = ids.filter((id) => confirmed.has(id)), tiers = creditsTiers(input.rows, input, route.admission), free = route.order.filter((id) => tiers.free.has(id)), credits = ids.filter((id) => tiers.credits.includes(id))
|
|
169
|
+
}), ids = orderForPlacement(input.rows.map((row) => row.id), placement, mainId), confirmed = new Set(route.admission.refused.filter((refusal) => isConfirmedExhaustion(refusal) && input.killswitch.get(refusal.id) !== !1).map((refusal) => refusal.id)), lastPath = ids.filter((id) => confirmed.has(id)), tiers = creditsTiers(input.rows, input, route.admission), free = route.order.filter((id) => tiers.free.has(id)), credits = ids.filter((id) => tiers.credits.includes(id)), send = (order, lastPath) => ({
|
|
170
|
+
kind: "send",
|
|
171
|
+
order,
|
|
172
|
+
lastPath,
|
|
173
|
+
tiers: Object.fromEntries(order.map((id) => [
|
|
174
|
+
id,
|
|
175
|
+
tiers.free.has(id) ? "free" : tiers.credits.includes(id) ? "credits" : "last-path"
|
|
176
|
+
]))
|
|
177
|
+
});
|
|
170
178
|
if (!replayable) {
|
|
171
179
|
const hasMain = ids.includes(mainId), target = hasMain ? mainId : free[0] ?? credits[0] ?? route.order[0] ?? lastPath[0];
|
|
172
180
|
if (target !== void 0 && route.order.includes(target))
|
|
173
|
-
return
|
|
181
|
+
return send([target], !1);
|
|
174
182
|
if (target !== void 0 && credits.includes(target))
|
|
175
|
-
return
|
|
183
|
+
return send([target], !1);
|
|
176
184
|
if (target !== void 0 && confirmed.has(target))
|
|
177
|
-
return
|
|
185
|
+
return send([target], !0);
|
|
178
186
|
return {
|
|
179
187
|
kind: "block",
|
|
180
188
|
block: hasMain ? blockFor(mainId, route.admission, input.killswitch) : routeBlock(ids, route.admission, input.killswitch)
|
|
181
189
|
};
|
|
182
190
|
}
|
|
183
191
|
if (free.length > 0)
|
|
184
|
-
return
|
|
192
|
+
return send(free, !1);
|
|
185
193
|
if (credits.length > 0) {
|
|
186
194
|
const rest = route.order.length > 0 ? route.order : lastPath;
|
|
187
|
-
return
|
|
188
|
-
kind: "send",
|
|
189
|
-
order: [...credits, ...rest.filter((id) => !credits.includes(id))],
|
|
190
|
-
lastPath: !1
|
|
191
|
-
};
|
|
195
|
+
return send([...credits, ...rest.filter((id) => !credits.includes(id))], !1);
|
|
192
196
|
}
|
|
193
197
|
if (route.order.length > 0)
|
|
194
|
-
return
|
|
198
|
+
return send(route.order, !1);
|
|
195
199
|
if (lastPath.length > 0)
|
|
196
|
-
return
|
|
200
|
+
return send(lastPath, !0);
|
|
197
201
|
return {
|
|
198
202
|
kind: "block",
|
|
199
203
|
block: routeBlock(ids, route.admission, input.killswitch)
|
|
@@ -244,6 +248,7 @@ export function selectStickyRow(input, options, exclude, pendingBytes) {
|
|
|
244
248
|
const route = routePoolSticky(input, options, { exclude, pendingBytes }), rows = input.rows.filter((row) => !exclude.has(row.id)), tiers = creditsTiers(rows, input, route.admission), selected = route.outcome === "dispatch" && route.source !== "pin" ? {
|
|
245
249
|
accountId: route.accountId,
|
|
246
250
|
source: route.source,
|
|
251
|
+
tier: tiers.free.has(route.accountId) ? "free" : "last-path",
|
|
247
252
|
...route.quotaCheckedAt === void 0 ? {} : { quotaCheckedAt: route.quotaCheckedAt }
|
|
248
253
|
} : void 0;
|
|
249
254
|
if (selected && tiers.free.has(selected.accountId))
|
|
@@ -255,6 +260,7 @@ export function selectStickyRow(input, options, exclude, pendingBytes) {
|
|
|
255
260
|
return {
|
|
256
261
|
accountId: credits,
|
|
257
262
|
source: "mode-fallback",
|
|
263
|
+
tier: "credits",
|
|
258
264
|
...checkedAt === void 0 ? {} : { quotaCheckedAt: checkedAt }
|
|
259
265
|
};
|
|
260
266
|
}
|
|
@@ -267,18 +273,18 @@ export function routePinnedRow(input, options, id) {
|
|
|
267
273
|
const toLastPath = !tiers.free.has(route.accountId);
|
|
268
274
|
if (route.pin.action === "assign") {
|
|
269
275
|
if (toLastPath && onCredits)
|
|
270
|
-
return { kind: "serve" };
|
|
276
|
+
return { kind: "serve", tier: "credits" };
|
|
271
277
|
return move;
|
|
272
278
|
}
|
|
273
279
|
if (route.accountId !== id)
|
|
274
280
|
return { kind: "detour" };
|
|
275
281
|
if (toLastPath && othersOnCredits)
|
|
276
282
|
return move;
|
|
277
|
-
return { kind: "serve" };
|
|
283
|
+
return { kind: "serve", tier: toLastPath ? "last-path" : "free" };
|
|
278
284
|
}
|
|
279
285
|
const refusal = route.admission.refused.find((entry) => entry.id === id), confirmed = killed || refusal !== void 0 && isConfirmedExhaustion(refusal);
|
|
280
286
|
if (onCredits)
|
|
281
|
-
return { kind: "serve" };
|
|
287
|
+
return { kind: "serve", tier: "credits" };
|
|
282
288
|
if (othersOnCredits)
|
|
283
289
|
return confirmed ? move : { kind: "detour" };
|
|
284
290
|
if (!killed && refusal && isConfirmedExhaustion(refusal))
|
|
@@ -68,6 +68,42 @@ export function enrollmentName(plugin, host) {
|
|
|
68
68
|
throw new ClaustrumConsumerError('invalid-state', 'Claustrum enrollment names use lowercase letters, digits and dashes');
|
|
69
69
|
return `${plugin}-${host}`;
|
|
70
70
|
}
|
|
71
|
+
/** Match the vault's plain-text, code-point limit before proposing a display name. */
|
|
72
|
+
export function validEnrollmentDisplayName(displayName) {
|
|
73
|
+
const length = Array.from(displayName).length;
|
|
74
|
+
return (length >= 1 &&
|
|
75
|
+
length <= 40 &&
|
|
76
|
+
!/[\p{Cc}\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069\u200b-\u200d\u2060\ufeff]/u.test(displayName));
|
|
77
|
+
}
|
|
78
|
+
/** Reject malformed permissions before a compatibility retry can omit them. */
|
|
79
|
+
export function validEnrollmentRequestedGrants(grants) {
|
|
80
|
+
return (Array.isArray(grants) &&
|
|
81
|
+
grants.length >= 1 &&
|
|
82
|
+
grants.length <= 4 &&
|
|
83
|
+
Array.from(grants).every((grant) => {
|
|
84
|
+
if (!isRecord(grant) ||
|
|
85
|
+
Object.keys(grant).length !== 2 ||
|
|
86
|
+
(grant.operation !== 'read' && grant.operation !== 'list') ||
|
|
87
|
+
!isRecord(grant.selector))
|
|
88
|
+
return false;
|
|
89
|
+
const keys = Object.keys(grant.selector);
|
|
90
|
+
const key = keys[0];
|
|
91
|
+
return (keys.length === 1 &&
|
|
92
|
+
(key === 'category' || key === 'exact') &&
|
|
93
|
+
typeof grant.selector[key] === 'string' &&
|
|
94
|
+
grant.selector[key].trim().length > 0);
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
97
|
+
function grantProposal(state) {
|
|
98
|
+
return {
|
|
99
|
+
...(state.requestedGrants !== undefined && {
|
|
100
|
+
requestedGrants: state.requestedGrants,
|
|
101
|
+
}),
|
|
102
|
+
...(state.requestedGrantsStatus !== undefined && {
|
|
103
|
+
requestedGrantsStatus: state.requestedGrantsStatus,
|
|
104
|
+
}),
|
|
105
|
+
};
|
|
106
|
+
}
|
|
71
107
|
/**
|
|
72
108
|
* Connect the enrollment ceremony. Setup calls this; the request path never
|
|
73
109
|
* does. `connectionFile` is required because this library reads no
|
|
@@ -122,6 +158,7 @@ function decodeEnrollmentState(value) {
|
|
|
122
158
|
throw invalidState();
|
|
123
159
|
}
|
|
124
160
|
if (value.phase === 'pending') {
|
|
161
|
+
const grants = decodeGrantProposal(value);
|
|
125
162
|
if (!TOKEN_RE.test(String(value.requestSecret ?? '')) ||
|
|
126
163
|
(value.requestId !== undefined &&
|
|
127
164
|
(typeof value.requestId !== 'string' ||
|
|
@@ -140,9 +177,11 @@ function decodeEnrollmentState(value) {
|
|
|
140
177
|
}),
|
|
141
178
|
createdAt: value.createdAt,
|
|
142
179
|
updatedAt: value.updatedAt,
|
|
180
|
+
...grants,
|
|
143
181
|
};
|
|
144
182
|
}
|
|
145
183
|
if (value.phase === 'approved') {
|
|
184
|
+
const grants = decodeGrantProposal(value);
|
|
146
185
|
if ((value.approvedName !== undefined &&
|
|
147
186
|
(typeof value.approvedName !== 'string' ||
|
|
148
187
|
value.approvedName.length === 0)) ||
|
|
@@ -159,6 +198,7 @@ function decodeEnrollmentState(value) {
|
|
|
159
198
|
}),
|
|
160
199
|
tokenGeneration: value.tokenGeneration,
|
|
161
200
|
updatedAt: value.updatedAt,
|
|
201
|
+
...grants,
|
|
162
202
|
};
|
|
163
203
|
}
|
|
164
204
|
if (value.phase === 'denied' || value.phase === 'blocked') {
|
|
@@ -178,6 +218,18 @@ function decodeEnrollmentState(value) {
|
|
|
178
218
|
}
|
|
179
219
|
throw invalidState();
|
|
180
220
|
}
|
|
221
|
+
function decodeGrantProposal(value) {
|
|
222
|
+
// Optional proposal metadata from a newer version must not invalidate an
|
|
223
|
+
// existing enrollment when a plugin is downgraded. Never infer access from it.
|
|
224
|
+
if ((value.requestedGrants !== undefined &&
|
|
225
|
+
!validEnrollmentRequestedGrants(value.requestedGrants)) ||
|
|
226
|
+
(value.requestedGrantsStatus !== undefined &&
|
|
227
|
+
(value.requestedGrants === undefined ||
|
|
228
|
+
(value.requestedGrantsStatus !== 'sent' &&
|
|
229
|
+
value.requestedGrantsStatus !== 'dropped'))))
|
|
230
|
+
return {};
|
|
231
|
+
return grantProposal(value);
|
|
232
|
+
}
|
|
181
233
|
function decodeTokenFile(value) {
|
|
182
234
|
if (!isRecord(value) ||
|
|
183
235
|
!TOKEN_RE.test(String(value.token ?? '')) ||
|
|
@@ -445,6 +497,9 @@ async function readEnrollmentStatus(paths, proposedName) {
|
|
|
445
497
|
approvedName: state.approvedName,
|
|
446
498
|
}),
|
|
447
499
|
tokenGeneration: token.token_generation,
|
|
500
|
+
...(state &&
|
|
501
|
+
(state.phase === 'approved' || state.phase === 'pending') &&
|
|
502
|
+
grantProposal(state)),
|
|
448
503
|
},
|
|
449
504
|
};
|
|
450
505
|
}
|
|
@@ -527,6 +582,7 @@ function statusFromState(state) {
|
|
|
527
582
|
state: 'pending',
|
|
528
583
|
proposedName: state.proposedName,
|
|
529
584
|
...(state.requestId !== undefined && { requestId: state.requestId }),
|
|
585
|
+
...grantProposal(state),
|
|
530
586
|
};
|
|
531
587
|
}
|
|
532
588
|
if (state.phase === 'approved') {
|
|
@@ -537,6 +593,7 @@ function statusFromState(state) {
|
|
|
537
593
|
approvedName: state.approvedName,
|
|
538
594
|
}),
|
|
539
595
|
tokenGeneration: state.tokenGeneration,
|
|
596
|
+
...grantProposal(state),
|
|
540
597
|
};
|
|
541
598
|
}
|
|
542
599
|
if (state.phase === 'denied')
|
|
@@ -559,15 +616,28 @@ export class ClaustrumEnrollmentManager {
|
|
|
559
616
|
#client;
|
|
560
617
|
#paths;
|
|
561
618
|
#proposedName;
|
|
619
|
+
#displayName;
|
|
620
|
+
#requestedGrants;
|
|
562
621
|
#now;
|
|
563
622
|
#mintSecret;
|
|
564
623
|
#writeTokenFile;
|
|
565
624
|
#ancestorOptions;
|
|
566
625
|
constructor(options) {
|
|
626
|
+
if (options.displayName !== undefined &&
|
|
627
|
+
!validEnrollmentDisplayName(options.displayName))
|
|
628
|
+
throw new ClaustrumConsumerError('invalid-state', 'invalid Claustrum enrollment display name');
|
|
629
|
+
if (options.requestedGrants !== undefined &&
|
|
630
|
+
!validEnrollmentRequestedGrants(options.requestedGrants))
|
|
631
|
+
throw new ClaustrumConsumerError('invalid-state', 'invalid Claustrum enrollment requested grants');
|
|
632
|
+
this.#requestedGrants = options.requestedGrants?.map((grant) => ({
|
|
633
|
+
selector: { ...grant.selector },
|
|
634
|
+
operation: grant.operation,
|
|
635
|
+
}));
|
|
567
636
|
this.#ancestorOptions = options.ancestorOptions ?? {};
|
|
568
637
|
this.#client = options.client;
|
|
569
638
|
this.#paths = options.paths;
|
|
570
639
|
this.#proposedName = options.proposedName;
|
|
640
|
+
this.#displayName = options.displayName;
|
|
571
641
|
this.#now = options.now ?? Date.now;
|
|
572
642
|
this.#mintSecret =
|
|
573
643
|
options.mintSecret ?? (() => randomBytes(32).toString('hex'));
|
|
@@ -615,6 +685,7 @@ export class ClaustrumEnrollmentManager {
|
|
|
615
685
|
phase: 'approved',
|
|
616
686
|
proposedName: state?.proposedName ?? this.#proposedName,
|
|
617
687
|
tokenGeneration: token.token_generation,
|
|
688
|
+
...(state && grantProposal(state)),
|
|
618
689
|
updatedAt: this.#now(),
|
|
619
690
|
};
|
|
620
691
|
await writeStateAtomic(this.#paths.statePath, approved, this.#ancestorOptions);
|
|
@@ -628,6 +699,7 @@ export class ClaustrumEnrollmentManager {
|
|
|
628
699
|
approvedName: state.approvedName,
|
|
629
700
|
}),
|
|
630
701
|
tokenGeneration: token.token_generation,
|
|
702
|
+
...(state.phase === 'approved' && grantProposal(state)),
|
|
631
703
|
};
|
|
632
704
|
}
|
|
633
705
|
if (state?.phase === 'approved') {
|
|
@@ -652,6 +724,9 @@ export class ClaustrumEnrollmentManager {
|
|
|
652
724
|
requestSecret: this.#mintSecret(),
|
|
653
725
|
createdAt: now,
|
|
654
726
|
updatedAt: now,
|
|
727
|
+
...(this.#requestedGrants !== undefined && {
|
|
728
|
+
requestedGrants: this.#requestedGrants,
|
|
729
|
+
}),
|
|
655
730
|
};
|
|
656
731
|
if (!TOKEN_RE.test(state.requestSecret))
|
|
657
732
|
throw new ClaustrumConsumerError('invalid-state', 'invalid minted Claustrum enrollment secret');
|
|
@@ -665,14 +740,44 @@ export class ClaustrumEnrollmentManager {
|
|
|
665
740
|
const requestSecretHash = createHash('sha256')
|
|
666
741
|
.update(Buffer.from(state.requestSecret, 'hex'))
|
|
667
742
|
.digest('hex');
|
|
668
|
-
const
|
|
743
|
+
const proposal = {
|
|
669
744
|
name: state.proposedName,
|
|
670
745
|
requestSecretHash,
|
|
671
|
-
}
|
|
746
|
+
};
|
|
747
|
+
let proposed;
|
|
748
|
+
let requestedGrantsStatus = state.requestedGrantsStatus;
|
|
749
|
+
try {
|
|
750
|
+
proposed = await this.#client.enrollPropose({
|
|
751
|
+
...proposal,
|
|
752
|
+
...(this.#displayName !== undefined && {
|
|
753
|
+
displayName: this.#displayName,
|
|
754
|
+
}),
|
|
755
|
+
...(state.requestedGrants !== undefined && {
|
|
756
|
+
requestedGrants: state.requestedGrants,
|
|
757
|
+
}),
|
|
758
|
+
});
|
|
759
|
+
if (state.requestedGrants !== undefined)
|
|
760
|
+
requestedGrantsStatus = 'sent';
|
|
761
|
+
}
|
|
762
|
+
catch (error) {
|
|
763
|
+
if ((this.#displayName === undefined &&
|
|
764
|
+
state.requestedGrants === undefined) ||
|
|
765
|
+
!(error instanceof ClaustrumCredentialError) ||
|
|
766
|
+
error.code !== 'invalid_params')
|
|
767
|
+
throw error;
|
|
768
|
+
// Both optional fields were validated locally. Older vaults reject
|
|
769
|
+
// either field without storing a proposal, so retry the plain shape once.
|
|
770
|
+
proposed = await this.#client.enrollPropose(proposal);
|
|
771
|
+
if (state.requestedGrants !== undefined)
|
|
772
|
+
requestedGrantsStatus = 'dropped';
|
|
773
|
+
}
|
|
672
774
|
state = {
|
|
673
775
|
...state,
|
|
674
776
|
requestId: proposed.requestId,
|
|
675
777
|
updatedAt: this.#now(),
|
|
778
|
+
...(requestedGrantsStatus !== undefined && {
|
|
779
|
+
requestedGrantsStatus,
|
|
780
|
+
}),
|
|
676
781
|
};
|
|
677
782
|
await writeStateAtomic(this.#paths.statePath, state, this.#ancestorOptions);
|
|
678
783
|
}
|
|
@@ -685,6 +790,7 @@ export class ClaustrumEnrollmentManager {
|
|
|
685
790
|
state: 'pending',
|
|
686
791
|
proposedName: state.proposedName,
|
|
687
792
|
retryCode: refusal.code,
|
|
793
|
+
...grantProposal(state),
|
|
688
794
|
};
|
|
689
795
|
}
|
|
690
796
|
// A vault without the ceremony cannot hold a request for this
|
|
@@ -741,6 +847,7 @@ export class ClaustrumEnrollmentManager {
|
|
|
741
847
|
proposedName: state.proposedName,
|
|
742
848
|
approvedName: outcome.name,
|
|
743
849
|
tokenGeneration: outcome.tokenGeneration,
|
|
850
|
+
...grantProposal(state),
|
|
744
851
|
updatedAt: this.#now(),
|
|
745
852
|
};
|
|
746
853
|
await writeStateAtomic(this.#paths.statePath, approved, this.#ancestorOptions);
|
|
@@ -756,6 +863,7 @@ export class ClaustrumEnrollmentManager {
|
|
|
756
863
|
proposedName: state.proposedName,
|
|
757
864
|
requestId,
|
|
758
865
|
retryCode: refusal.code,
|
|
866
|
+
...grantProposal(state),
|
|
759
867
|
};
|
|
760
868
|
}
|
|
761
869
|
return this.#block(state, refusal.code);
|
|
@@ -29,7 +29,10 @@ function hostError(error) {
|
|
|
29
29
|
(typeof value.code === 'string' &&
|
|
30
30
|
classifyVaultFailure(Object.assign(new Error(), { code: value.code })) ===
|
|
31
31
|
'unreachable'))
|
|
32
|
-
return new ClaustrumUnreachableError(
|
|
32
|
+
return new ClaustrumUnreachableError(value.reason === 'host-accessor-missing' ||
|
|
33
|
+
value.reason === 'host-accessor-failed'
|
|
34
|
+
? value.reason
|
|
35
|
+
: undefined);
|
|
33
36
|
return error;
|
|
34
37
|
}
|
|
35
38
|
function call(operation) {
|
|
@@ -101,13 +104,14 @@ export function connectVaultHost(pluginId) {
|
|
|
101
104
|
throw new ClaustrumUnreachableError();
|
|
102
105
|
try {
|
|
103
106
|
const accessor = globalThis[Symbol.for('cortexkit.vault')];
|
|
104
|
-
if (typeof accessor
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
if (typeof accessor === 'function') {
|
|
108
|
+
const client = wrapHostClient(accessor(pluginId));
|
|
109
|
+
hostClients.add(client);
|
|
110
|
+
return client;
|
|
111
|
+
}
|
|
109
112
|
}
|
|
110
113
|
catch {
|
|
111
|
-
throw new ClaustrumUnreachableError();
|
|
114
|
+
throw new ClaustrumUnreachableError('host-accessor-failed');
|
|
112
115
|
}
|
|
116
|
+
throw new ClaustrumUnreachableError('host-accessor-missing');
|
|
113
117
|
}
|