@primitive.ai/prim 0.1.0-alpha.124 → 0.1.0-alpha.125
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-WQFJ5TEG.js → chunk-2BEUR3DU.js} +2 -2
- package/dist/{chunk-3OKVMKK2.js → chunk-6KXQQ7CQ.js} +3 -3
- package/dist/{chunk-TS2NX6YT.js → chunk-6OPSSJHO.js} +5 -5
- package/dist/{chunk-EER7VG3P.js → chunk-74DQDWLW.js} +2 -2
- package/dist/{chunk-KMWXI7KO.js → chunk-BFYJLI7V.js} +1 -1
- 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-A6YTFBQ4.js → chunk-HPA7RGSZ.js} +3 -3
- package/dist/{chunk-DGZX3MID.js → chunk-JFWJN2ME.js} +3 -3
- 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-5KPDY5GF.js → chunk-R35M4RCY.js} +4 -4
- 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 +7112 -5500
- 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
package/dist/statusline-main.js
CHANGED
|
@@ -214,12 +214,16 @@ function parseMachineConfiguration(value) {
|
|
|
214
214
|
"The WorkOS issuer must be an HTTPS origin."
|
|
215
215
|
);
|
|
216
216
|
}
|
|
217
|
-
return {
|
|
217
|
+
return {
|
|
218
|
+
issuer: record.issuer,
|
|
219
|
+
audience: record.audience,
|
|
220
|
+
...record.developer_enrollment === true ? { developerEnrollment: true } : {}
|
|
221
|
+
};
|
|
218
222
|
}
|
|
219
223
|
function parseMachineIdentity(value, clientId) {
|
|
220
224
|
const data = machineRecord(value);
|
|
221
225
|
const principal = machineRecord(data.principal);
|
|
222
|
-
if (data.authenticated !== true || data.captureAuthorityKind !== "workos_m2m" || data.organizationBindingVersion !==
|
|
226
|
+
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))) {
|
|
223
227
|
throw new MachineAuthError(
|
|
224
228
|
"machine_identity_rejected",
|
|
225
229
|
"The API did not verify a machine identity.",
|
|
@@ -228,6 +232,7 @@ function parseMachineIdentity(value, clientId) {
|
|
|
228
232
|
}
|
|
229
233
|
return {
|
|
230
234
|
machineId: principal.machineId,
|
|
235
|
+
...data.organizationBindingVersion === 3 ? { authorizedUserId: principal.authorizedUserId } : {},
|
|
231
236
|
clientId,
|
|
232
237
|
displayName: principal.displayName,
|
|
233
238
|
organizationId: data.organizationId,
|
|
@@ -339,7 +344,7 @@ function parseStoredIdentity(data) {
|
|
|
339
344
|
return parseMachineIdentity(
|
|
340
345
|
{
|
|
341
346
|
authenticated: true,
|
|
342
|
-
organizationBindingVersion: 2,
|
|
347
|
+
organizationBindingVersion: data.authorizedUserId ? 3 : 2,
|
|
343
348
|
captureAuthorityKind: "workos_m2m",
|
|
344
349
|
organizationId: data.organizationId,
|
|
345
350
|
workosOrganizationId: data.workosOrganizationId,
|
|
@@ -633,7 +638,9 @@ function resolveDaemonPrincipal(token = resolveAuthCredential()?.token) {
|
|
|
633
638
|
if (hasMachineConfiguration()) {
|
|
634
639
|
const machine = machineContext();
|
|
635
640
|
return machine ? {
|
|
636
|
-
principalId: sha256(
|
|
641
|
+
principalId: sha256(
|
|
642
|
+
`${machine.issuer}\0${machine.clientId}${machine.authorizedUserId ? `\0${machine.authorizedUserId}` : ""}`
|
|
643
|
+
),
|
|
637
644
|
organizationId: machine.workosOrganizationId,
|
|
638
645
|
credentialFingerprint: sha256(machine.generation)
|
|
639
646
|
} : void 0;
|
package/package.json
CHANGED