@primitive.ai/prim 0.1.0-alpha.124 → 0.1.0-alpha.126
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/README.md +27 -0
- package/dist/{chunk-5KPDY5GF.js → chunk-5D2C6RCH.js} +4 -4
- package/dist/{chunk-3OKVMKK2.js → chunk-6KXQQ7CQ.js} +3 -3
- package/dist/{chunk-EER7VG3P.js → chunk-74DQDWLW.js} +2 -2
- package/dist/{chunk-KMWXI7KO.js → chunk-BFYJLI7V.js} +1 -1
- package/dist/{chunk-TS2NX6YT.js → chunk-C5VBPHOS.js} +9 -8
- package/dist/{chunk-ZMH6GJUG.js → chunk-DT7E3SD5.js} +4 -4
- package/dist/{chunk-6W72SEXC.js → chunk-EZXIKEMA.js} +3 -3
- package/dist/{chunk-6WKJWW6D.js → chunk-FYYHBOOM.js} +2 -2
- package/dist/{chunk-DGZX3MID.js → chunk-JFWJN2ME.js} +3 -3
- package/dist/{chunk-A6YTFBQ4.js → chunk-KKUDAQQZ.js} +7 -8
- package/dist/{chunk-WLVEXOHC.js → chunk-L32WYFJT.js} +1 -1
- package/dist/{chunk-6VJ7C2B5.js → chunk-NBNQI3YJ.js} +2 -2
- package/dist/{chunk-KTXJJE5K.js → chunk-ND6TYHNI.js} +2 -2
- package/dist/{chunk-Q2PVD5W2.js → chunk-NJBN3WXF.js} +37 -5
- package/dist/{chunk-5MH2C5QG.js → chunk-O73J3KQQ.js} +7121 -5513
- package/dist/{chunk-EWV7VIZ3.js → chunk-PPZ56EVJ.js} +1 -1
- package/dist/{chunk-WQFJ5TEG.js → chunk-R6NDP7OF.js} +2 -2
- package/dist/{chunk-5BZWFN62.js → chunk-TI37ME2D.js} +12 -8
- package/dist/{chunk-6PSCGY2A.js → chunk-YP4OXKNX.js} +4 -2
- package/dist/{chunk-QZWLZH6D.js → chunk-ZKXNJB6U.js} +3 -3
- package/dist/daemon/server.js +7128 -5507
- package/dist/hook-runtime/daemon/server.js +7128 -5507
- package/dist/hook-runtime/hooks/post-commit.js +7106 -5496
- package/dist/hook-runtime/hooks/post-rewrite.js +7106 -5496
- package/dist/hook-runtime/hooks/post-tool-use.js +3595 -1977
- package/dist/hook-runtime/hooks/pre-commit.js +17 -7
- package/dist/hook-runtime/hooks/pre-tool-use-worker.js +3796 -2184
- package/dist/hook-runtime/hooks/prim-hook.js +7117 -5502
- package/dist/hook-runtime/hooks/session-end.js +11 -4
- package/dist/hook-runtime/hooks/session-start.js +3584 -1970
- package/dist/hook-runtime/index.js +6376 -4464
- package/dist/hook-runtime/statusline-main.js +11 -4
- package/dist/hooks/post-commit.js +7 -7
- package/dist/hooks/post-rewrite.js +6 -6
- package/dist/hooks/post-tool-use.js +15 -15
- package/dist/hooks/pre-commit.js +4 -4
- package/dist/hooks/pre-tool-use-worker.js +9 -9
- package/dist/hooks/prim-hook.js +16 -16
- package/dist/hooks/session-end.js +4 -4
- package/dist/hooks/session-start.js +11 -11
- package/dist/index.js +9117 -8836
- package/dist/statusline-main.js +11 -4
- package/package.json +1 -1
|
@@ -202,12 +202,16 @@ function parseMachineConfiguration(value) {
|
|
|
202
202
|
"The WorkOS issuer must be an HTTPS origin."
|
|
203
203
|
);
|
|
204
204
|
}
|
|
205
|
-
return {
|
|
205
|
+
return {
|
|
206
|
+
issuer: record.issuer,
|
|
207
|
+
audience: record.audience,
|
|
208
|
+
...record.developer_enrollment === true ? { developerEnrollment: true } : {}
|
|
209
|
+
};
|
|
206
210
|
}
|
|
207
211
|
function parseMachineIdentity(value, clientId) {
|
|
208
212
|
const data = machineRecord(value);
|
|
209
213
|
const principal = machineRecord(data.principal);
|
|
210
|
-
if (data.authenticated !== true || data.captureAuthorityKind !== "workos_m2m" || data.organizationBindingVersion !==
|
|
214
|
+
if (data.authenticated !== true || data.captureAuthorityKind !== "workos_m2m" || ![2, 3].includes(data.organizationBindingVersion) || (data.organizationBindingVersion === 3 ? !machineString(principal.authorizedUserId, 256) : principal.authorizedUserId !== void 0) || principal.kind !== "machine" || principal.clientId !== clientId || !machineString(principal.machineId, 256) || !machineString(principal.displayName, 256) || !machineString(data.organizationId, 256) || !machineString(data.workosOrganizationId, 256) || !Array.isArray(principal.scopes) || !principal.scopes.every((scope) => machineString(scope, 128))) {
|
|
211
215
|
throw new MachineAuthError(
|
|
212
216
|
"machine_identity_rejected",
|
|
213
217
|
"The API did not verify a machine identity.",
|
|
@@ -216,6 +220,7 @@ function parseMachineIdentity(value, clientId) {
|
|
|
216
220
|
}
|
|
217
221
|
return {
|
|
218
222
|
machineId: principal.machineId,
|
|
223
|
+
...data.organizationBindingVersion === 3 ? { authorizedUserId: principal.authorizedUserId } : {},
|
|
219
224
|
clientId,
|
|
220
225
|
displayName: principal.displayName,
|
|
221
226
|
organizationId: data.organizationId,
|
|
@@ -327,7 +332,7 @@ function parseStoredIdentity(data) {
|
|
|
327
332
|
return parseMachineIdentity(
|
|
328
333
|
{
|
|
329
334
|
authenticated: true,
|
|
330
|
-
organizationBindingVersion: 2,
|
|
335
|
+
organizationBindingVersion: data.authorizedUserId ? 3 : 2,
|
|
331
336
|
captureAuthorityKind: "workos_m2m",
|
|
332
337
|
organizationId: data.organizationId,
|
|
333
338
|
workosOrganizationId: data.workosOrganizationId,
|
|
@@ -560,7 +565,9 @@ function resolveDaemonPrincipal(token = resolveAuthCredential()?.token) {
|
|
|
560
565
|
if (hasMachineConfiguration()) {
|
|
561
566
|
const machine = machineContext();
|
|
562
567
|
return machine ? {
|
|
563
|
-
principalId: sha256(
|
|
568
|
+
principalId: sha256(
|
|
569
|
+
`${machine.issuer}\0${machine.clientId}${machine.authorizedUserId ? `\0${machine.authorizedUserId}` : ""}`
|
|
570
|
+
),
|
|
564
571
|
organizationId: machine.workosOrganizationId,
|
|
565
572
|
credentialFingerprint: sha256(machine.generation)
|
|
566
573
|
} : void 0;
|