@oxy.so/contracts 5.8.0 → 6.1.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/cjs/accountAccess.js +6 -5
- package/dist/cjs/accountEmail.js +13 -5
- package/dist/cjs/accountGraph.js +10 -9
- package/dist/cjs/accountName.js +3 -2
- package/dist/cjs/agency.js +91 -34
- package/dist/cjs/agentKeys.js +21 -17
- package/dist/cjs/appAssertions.js +14 -13
- package/dist/cjs/applicationRoles.js +19 -12
- package/dist/cjs/campaignAttribution.js +28 -0
- package/dist/cjs/civic.js +10 -9
- package/dist/cjs/client/campaignAttribution.js +14 -0
- package/dist/cjs/client/check.js +61 -53
- package/dist/cjs/client/index.js +7 -1
- package/dist/cjs/client/language.js +7 -0
- package/dist/cjs/consoleOnboarding.js +9 -4
- package/dist/cjs/contentClaims.js +23 -14
- package/dist/cjs/deviceDirectory.js +11 -9
- package/dist/cjs/deviceSession.js +27 -25
- package/dist/cjs/email/messages.js +20 -18
- package/dist/cjs/emailAgentContext.js +11 -9
- package/dist/cjs/externalIdentity.js +15 -11
- package/dist/cjs/federationInstanceFetch.js +12 -7
- package/dist/cjs/identity.js +19 -17
- package/dist/cjs/identityLink.js +6 -4
- package/dist/cjs/identityProof.js +6 -4
- package/dist/cjs/inboxPush.js +5 -4
- package/dist/cjs/index.js +17 -6
- package/dist/cjs/inference/accountBilling.js +35 -33
- package/dist/cjs/inference/aliaModelRelease.js +9 -7
- package/dist/cjs/inference/attribution.js +14 -12
- package/dist/cjs/inference/catalogue.js +35 -29
- package/dist/cjs/inference/economics.js +24 -19
- package/dist/cjs/inference/embeddings.js +9 -7
- package/dist/cjs/inference/entitlement.js +17 -15
- package/dist/cjs/inference/errors.js +15 -8
- package/dist/cjs/inference/identifiers.js +33 -21
- package/dist/cjs/inference/inbox.js +37 -35
- package/dist/cjs/inference/modelDocumentation.js +16 -14
- package/dist/cjs/inference/money.js +5 -4
- package/dist/cjs/inference/priceVersion.js +10 -5
- package/dist/cjs/inference/providerConnection.js +21 -14
- package/dist/cjs/inference/realtime.js +88 -47
- package/dist/cjs/inference/request.js +27 -25
- package/dist/cjs/inference/routingPolicy.js +12 -10
- package/dist/cjs/inference/streamEvents.js +22 -16
- package/dist/cjs/inference/usage.js +32 -15
- package/dist/cjs/keyRecovery.js +8 -6
- package/dist/cjs/keyRotation.js +5 -4
- package/dist/cjs/linkedAccounts.js +22 -18
- package/dist/cjs/moderationReputation.js +29 -27
- package/dist/cjs/notifications.js +25 -9
- package/dist/cjs/numberChecks.js +45 -0
- package/dist/cjs/oauth.js +14 -12
- package/dist/cjs/organizations.js +23 -21
- package/dist/cjs/products/access.js +10 -8
- package/dist/cjs/products/billing.js +10 -8
- package/dist/cjs/products/checkout.js +22 -10
- package/dist/cjs/products/plans.js +15 -10
- package/dist/cjs/protocol.js +6 -5
- package/dist/cjs/recommendations.js +27 -19
- package/dist/cjs/reputation.js +15 -13
- package/dist/cjs/safety.js +43 -27
- package/dist/cjs/serviceToken.js +81 -2
- package/dist/cjs/sessionRevocation.js +8 -6
- package/dist/cjs/signIn.js +50 -24
- package/dist/cjs/stickers.js +19 -15
- package/dist/cjs/stringChecks.js +70 -0
- package/dist/cjs/transparency.js +14 -12
- package/dist/cjs/updates.js +24 -22
- package/dist/cjs/userInvalidation.js +7 -5
- package/dist/cjs/userResponse.js +8 -7
- package/dist/cjs/username.js +7 -6
- package/dist/esm/accountAccess.js +4 -3
- package/dist/esm/accountEmail.js +13 -5
- package/dist/esm/accountGraph.js +8 -7
- package/dist/esm/accountName.js +3 -2
- package/dist/esm/agency.js +90 -33
- package/dist/esm/agentKeys.js +21 -17
- package/dist/esm/appAssertions.js +11 -10
- package/dist/esm/applicationRoles.js +16 -9
- package/dist/esm/campaignAttribution.js +25 -0
- package/dist/esm/civic.js +8 -7
- package/dist/esm/client/campaignAttribution.js +10 -0
- package/dist/esm/client/check.js +61 -53
- package/dist/esm/client/index.js +2 -0
- package/dist/esm/client/language.js +4 -0
- package/dist/esm/consoleOnboarding.js +7 -2
- package/dist/esm/contentClaims.js +23 -14
- package/dist/esm/deviceDirectory.js +11 -9
- package/dist/esm/deviceSession.js +27 -25
- package/dist/esm/email/messages.js +18 -16
- package/dist/esm/emailAgentContext.js +11 -9
- package/dist/esm/externalIdentity.js +15 -11
- package/dist/esm/federationInstanceFetch.js +10 -5
- package/dist/esm/identity.js +17 -15
- package/dist/esm/identityLink.js +6 -4
- package/dist/esm/identityProof.js +6 -4
- package/dist/esm/inboxPush.js +3 -2
- package/dist/esm/index.js +5 -2
- package/dist/esm/inference/accountBilling.js +33 -31
- package/dist/esm/inference/aliaModelRelease.js +7 -5
- package/dist/esm/inference/attribution.js +14 -12
- package/dist/esm/inference/catalogue.js +33 -27
- package/dist/esm/inference/economics.js +22 -17
- package/dist/esm/inference/embeddings.js +9 -7
- package/dist/esm/inference/entitlement.js +15 -13
- package/dist/esm/inference/errors.js +13 -6
- package/dist/esm/inference/identifiers.js +31 -19
- package/dist/esm/inference/inbox.js +37 -35
- package/dist/esm/inference/modelDocumentation.js +14 -12
- package/dist/esm/inference/money.js +3 -2
- package/dist/esm/inference/priceVersion.js +8 -3
- package/dist/esm/inference/providerConnection.js +19 -12
- package/dist/esm/inference/realtime.js +85 -44
- package/dist/esm/inference/request.js +25 -23
- package/dist/esm/inference/routingPolicy.js +9 -7
- package/dist/esm/inference/streamEvents.js +20 -14
- package/dist/esm/inference/usage.js +30 -13
- package/dist/esm/keyRecovery.js +8 -6
- package/dist/esm/keyRotation.js +5 -4
- package/dist/esm/linkedAccounts.js +20 -16
- package/dist/esm/moderationReputation.js +27 -25
- package/dist/esm/notifications.js +23 -7
- package/dist/esm/numberChecks.js +41 -0
- package/dist/esm/oauth.js +14 -12
- package/dist/esm/organizations.js +23 -21
- package/dist/esm/products/access.js +10 -8
- package/dist/esm/products/billing.js +10 -8
- package/dist/esm/products/checkout.js +22 -10
- package/dist/esm/products/plans.js +15 -10
- package/dist/esm/protocol.js +4 -3
- package/dist/esm/recommendations.js +25 -17
- package/dist/esm/reputation.js +13 -11
- package/dist/esm/safety.js +43 -27
- package/dist/esm/serviceToken.js +80 -1
- package/dist/esm/sessionRevocation.js +6 -4
- package/dist/esm/signIn.js +50 -24
- package/dist/esm/stickers.js +17 -13
- package/dist/esm/stringChecks.js +63 -0
- package/dist/esm/transparency.js +14 -12
- package/dist/esm/updates.js +22 -20
- package/dist/esm/userInvalidation.js +4 -2
- package/dist/esm/userResponse.js +4 -3
- package/dist/esm/username.js +3 -2
- package/dist/types/accountAccess.d.ts +29 -70
- package/dist/types/accountEmail.d.ts +2 -14
- package/dist/types/accountGraph.d.ts +179 -171
- package/dist/types/accountName.d.ts +1 -1
- package/dist/types/accountSubject.d.ts +20 -93
- package/dist/types/agency.d.ts +528 -2924
- package/dist/types/agentKeys.d.ts +48 -421
- package/dist/types/appAssertions.d.ts +56 -210
- package/dist/types/applicationRoles.d.ts +30 -276
- package/dist/types/avatarCharacter.d.ts +1 -1
- package/dist/types/campaignAttribution.d.ts +10 -0
- package/dist/types/civic.d.ts +1 -13
- package/dist/types/client/agentKeys.d.ts +18 -18
- package/dist/types/client/appAssertions.d.ts +3 -3
- package/dist/types/client/campaignAttribution.d.ts +12 -0
- package/dist/types/client/check.d.ts +13 -13
- package/dist/types/client/deviceDirectory.d.ts +51 -51
- package/dist/types/client/deviceSession.d.ts +14 -14
- package/dist/types/client/index.d.ts +3 -0
- package/dist/types/client/language.d.ts +2 -0
- package/dist/types/client/organizations.d.ts +25 -25
- package/dist/types/client/products.d.ts +33 -33
- package/dist/types/client/recommendations.d.ts +2 -2
- package/dist/types/client/safety.d.ts +45 -45
- package/dist/types/client/sessionStatus.d.ts +4 -4
- package/dist/types/client/signIn.d.ts +1 -1
- package/dist/types/commonsSignIn.d.ts +4 -1
- package/dist/types/consoleOnboarding.d.ts +24 -44
- package/dist/types/contentClaims.d.ts +24 -180
- package/dist/types/deviceDirectory.d.ts +109 -1040
- package/dist/types/deviceSession.d.ts +36 -298
- package/dist/types/email/messages.d.ts +212 -1793
- package/dist/types/emailAgentContext.d.ts +10 -194
- package/dist/types/externalIdentity.d.ts +121 -615
- package/dist/types/federationInstanceFetch.d.ts +3 -32
- package/dist/types/identity.d.ts +15 -92
- package/dist/types/identityLink.d.ts +6 -84
- package/dist/types/identityProof.d.ts +5 -17
- package/dist/types/inboxPush.d.ts +1 -9
- package/dist/types/index.d.ts +7 -3
- package/dist/types/inference/accountBilling.d.ts +151 -488
- package/dist/types/inference/aliaModelRelease.d.ts +42 -439
- package/dist/types/inference/attribution.d.ts +75 -104
- package/dist/types/inference/catalogue.d.ts +417 -1599
- package/dist/types/inference/economics.d.ts +69 -276
- package/dist/types/inference/embeddings.d.ts +110 -406
- package/dist/types/inference/entitlement.d.ts +80 -335
- package/dist/types/inference/errors.d.ts +90 -102
- package/dist/types/inference/identifiers.d.ts +12 -4
- package/dist/types/inference/inbox.d.ts +105 -420
- package/dist/types/inference/modelDocumentation.d.ts +201 -1390
- package/dist/types/inference/money.d.ts +65 -32
- package/dist/types/inference/priceVersion.d.ts +53 -120
- package/dist/types/inference/providerConnection.d.ts +253 -710
- package/dist/types/inference/realtime.d.ts +954 -6825
- package/dist/types/inference/request.d.ts +300 -2572
- package/dist/types/inference/routingPolicy.d.ts +95 -503
- package/dist/types/inference/streamEvents.d.ts +253 -721
- package/dist/types/inference/usage.d.ts +317 -950
- package/dist/types/keyRecovery.d.ts +3 -51
- package/dist/types/keyRotation.d.ts +3 -38
- package/dist/types/linkedAccounts.d.ts +50 -236
- package/dist/types/moderationReputation.d.ts +81 -14
- package/dist/types/notifications.d.ts +19 -51
- package/dist/types/numberChecks.d.ts +9 -0
- package/dist/types/oauth.d.ts +101 -809
- package/dist/types/organizations.d.ts +268 -921
- package/dist/types/oxyRecordTypes.d.ts +11 -1
- package/dist/types/products/access.d.ts +125 -775
- package/dist/types/products/billing.d.ts +67 -503
- package/dist/types/products/checkout.d.ts +16 -69
- package/dist/types/products/plans.d.ts +33 -366
- package/dist/types/recommendations.d.ts +76 -389
- package/dist/types/reputation.d.ts +37 -5
- package/dist/types/safety.d.ts +408 -2048
- package/dist/types/serviceToken.d.ts +247 -7
- package/dist/types/sessionRevocation.d.ts +2 -17
- package/dist/types/sessionStatus.d.ts +27 -115
- package/dist/types/signIn.d.ts +62 -553
- package/dist/types/stickers.d.ts +67 -819
- package/dist/types/stringChecks.d.ts +16 -0
- package/dist/types/transparency.d.ts +14 -302
- package/dist/types/updates.d.ts +60 -316
- package/dist/types/userInvalidation.d.ts +4 -13
- package/dist/types/userResponse.d.ts +302 -2400
- package/dist/types/username.d.ts +3 -3
- package/package.json +6 -4
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.accountAccessVerdictSchema = exports.accountAccessGrantSchema = exports.accountAccessSourceSchema = exports.ACCOUNT_ACCESS_SOURCES = exports.ACCOUNTS_MEMBERSHIP_READ_SCOPE = void 0;
|
|
4
|
+
const stringChecks_1 = require("./stringChecks");
|
|
2
5
|
/**
|
|
3
6
|
* Wire contract for `GET /internal/accounts/:accountId/access/:userId`: Oxy
|
|
4
7
|
* answers a trusted first-party service's question "may this person act FOR
|
|
@@ -20,8 +23,6 @@
|
|
|
20
23
|
*
|
|
21
24
|
* Platform-agnostic — zod only.
|
|
22
25
|
*/
|
|
23
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.accountAccessVerdictSchema = exports.accountAccessGrantSchema = exports.accountAccessSourceSchema = exports.ACCOUNT_ACCESS_SOURCES = exports.ACCOUNTS_MEMBERSHIP_READ_SCOPE = void 0;
|
|
25
26
|
const zod_1 = require("zod");
|
|
26
27
|
const accountGraph_1 = require("./accountGraph");
|
|
27
28
|
/**
|
|
@@ -52,15 +53,15 @@ exports.accountAccessSourceSchema = zod_1.z.enum(exports.ACCOUNT_ACCESS_SOURCES)
|
|
|
52
53
|
* revokes), never on `role`.
|
|
53
54
|
*/
|
|
54
55
|
exports.accountAccessGrantSchema = zod_1.z.object({
|
|
55
|
-
role: zod_1.z.string().
|
|
56
|
-
permissions: zod_1.z.array(zod_1.z.string().
|
|
56
|
+
role: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
57
|
+
permissions: zod_1.z.array(zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1))),
|
|
57
58
|
/** Only an active membership grants access, so this is the one value. */
|
|
58
59
|
status: zod_1.z.literal('active'),
|
|
59
60
|
source: exports.accountAccessSourceSchema,
|
|
60
61
|
});
|
|
61
62
|
exports.accountAccessVerdictSchema = zod_1.z
|
|
62
63
|
.object({
|
|
63
|
-
accountId: zod_1.z.string().
|
|
64
|
+
accountId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
64
65
|
/** `null` when no such account exists. */
|
|
65
66
|
kind: accountGraph_1.accountKindSchema.nullable(),
|
|
66
67
|
/** `null` means: this person may not act for this account. */
|
package/dist/cjs/accountEmail.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.emailVerificationConfirmResponseSchema = exports.emailVerificationConfirmRequestSchema = exports.emailVerificationStartResponseSchema = exports.emailVerificationStartRequestSchema = exports.emailTicketSchema = exports.emailAddressSchema = exports.EMAIL_VERIFICATION_ERROR_CODES = exports.EMAIL_TICKET_TTL_MS = exports.EMAIL_CODE_MAX_ATTEMPTS = exports.EMAIL_CODE_TTL_MS = exports.EMAIL_CODE_LENGTH = exports.EMAIL_VERIFICATION_PURPOSES = void 0;
|
|
4
|
+
const numberChecks_1 = require("./numberChecks");
|
|
5
|
+
const stringChecks_1 = require("./stringChecks");
|
|
4
6
|
/**
|
|
5
7
|
* Email codes and tickets (ADR 0030).
|
|
6
8
|
*
|
|
@@ -27,7 +29,13 @@ Object.defineProperty(exports, "EMAIL_CODE_MAX_ATTEMPTS", { enumerable: true, ge
|
|
|
27
29
|
Object.defineProperty(exports, "EMAIL_TICKET_TTL_MS", { enumerable: true, get: function () { return accountEmail_2.EMAIL_TICKET_TTL_MS; } });
|
|
28
30
|
Object.defineProperty(exports, "EMAIL_VERIFICATION_ERROR_CODES", { enumerable: true, get: function () { return accountEmail_2.EMAIL_VERIFICATION_ERROR_CODES; } });
|
|
29
31
|
/** An email address as the API stores it: trimmed and lowercase. */
|
|
30
|
-
exports.emailAddressSchema = zod_1.z
|
|
32
|
+
exports.emailAddressSchema = zod_1.z
|
|
33
|
+
.string()
|
|
34
|
+
.trim()
|
|
35
|
+
.toLowerCase()
|
|
36
|
+
.check((0, stringChecks_1.utf16MinLength)(3))
|
|
37
|
+
.check((0, stringChecks_1.utf16MaxLength)(254))
|
|
38
|
+
.email();
|
|
31
39
|
/** An opaque one-use ticket (32 random bytes, base64url). */
|
|
32
40
|
exports.emailTicketSchema = zod_1.z
|
|
33
41
|
.string()
|
|
@@ -38,13 +46,13 @@ exports.emailVerificationStartRequestSchema = zod_1.z
|
|
|
38
46
|
.object({ purpose: zod_1.z.literal('signup'), email: exports.emailAddressSchema })
|
|
39
47
|
.strict();
|
|
40
48
|
exports.emailVerificationStartResponseSchema = zod_1.z.object({
|
|
41
|
-
verificationId: zod_1.z.string().
|
|
42
|
-
expiresAt: zod_1.z.number().
|
|
49
|
+
verificationId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(64)),
|
|
50
|
+
expiresAt: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).positive(),
|
|
43
51
|
});
|
|
44
52
|
/** `POST /auth/email/verify/confirm` */
|
|
45
53
|
exports.emailVerificationConfirmRequestSchema = zod_1.z
|
|
46
54
|
.object({
|
|
47
|
-
verificationId: zod_1.z.string().trim().
|
|
55
|
+
verificationId: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(64)),
|
|
48
56
|
code: zod_1.z
|
|
49
57
|
.string()
|
|
50
58
|
.trim()
|
|
@@ -53,5 +61,5 @@ exports.emailVerificationConfirmRequestSchema = zod_1.z
|
|
|
53
61
|
.strict();
|
|
54
62
|
exports.emailVerificationConfirmResponseSchema = zod_1.z.object({
|
|
55
63
|
ticket: exports.emailTicketSchema,
|
|
56
|
-
expiresAt: zod_1.z.number().
|
|
64
|
+
expiresAt: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).positive(),
|
|
57
65
|
});
|
package/dist/cjs/accountGraph.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createAccountRequestSchema = exports.accountNameSchema = exports.accountCategoriesSchema = exports.accountCategoryIdSchema = exports.childAccountKindSchema = exports.accountKindSchema = exports.kindAcceptsAccountCategories = exports.ACCOUNT_CATEGORY_KINDS = exports.MAX_ACCOUNT_CATEGORIES = exports.newlyAddedRetiredCategories = exports.SELECTABLE_ACCOUNT_CATEGORY_IDS = exports.isSelectableAccountCategoryId = exports.RETIRED_ACCOUNT_CATEGORY_IDS = exports.ACCOUNT_CATEGORY_IDS = exports.isAccountKind = exports.isMemberOperatedKind = exports.isOperatorSwitchTargetKind = exports.isDelegatedActAsEligibleKind = exports.CHILD_ACCOUNT_KINDS = exports.ACCOUNT_KINDS = void 0;
|
|
4
|
+
const stringChecks_1 = require("./stringChecks");
|
|
2
5
|
/**
|
|
3
6
|
* Account graph wire contracts — the account-kind vocabulary, the account
|
|
4
7
|
* category taxonomy, and the create-account input.
|
|
@@ -7,8 +10,6 @@
|
|
|
7
10
|
* it does — without polluting `User.kind`. See the block above
|
|
8
11
|
* {@link ACCOUNT_CATEGORY_IDS} for the four rules that govern it.
|
|
9
12
|
*/
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.createAccountRequestSchema = exports.accountNameSchema = exports.accountCategoriesSchema = exports.accountCategoryIdSchema = exports.childAccountKindSchema = exports.accountKindSchema = exports.kindAcceptsAccountCategories = exports.ACCOUNT_CATEGORY_KINDS = exports.MAX_ACCOUNT_CATEGORIES = exports.newlyAddedRetiredCategories = exports.SELECTABLE_ACCOUNT_CATEGORY_IDS = exports.isSelectableAccountCategoryId = exports.RETIRED_ACCOUNT_CATEGORY_IDS = exports.ACCOUNT_CATEGORY_IDS = exports.isAccountKind = exports.isMemberOperatedKind = exports.isOperatorSwitchTargetKind = exports.isDelegatedActAsEligibleKind = exports.CHILD_ACCOUNT_KINDS = exports.ACCOUNT_KINDS = void 0;
|
|
12
13
|
const zod_1 = require("zod");
|
|
13
14
|
const avatarCharacter_1 = require("./avatarCharacter");
|
|
14
15
|
const accountName_1 = require("./accountName");
|
|
@@ -86,9 +87,9 @@ exports.accountCategoriesSchema = zod_1.z
|
|
|
86
87
|
*/
|
|
87
88
|
exports.accountNameSchema = zod_1.z
|
|
88
89
|
.object({
|
|
89
|
-
first: zod_1.z.string().trim().
|
|
90
|
-
last: zod_1.z.string().trim().
|
|
91
|
-
displayName: zod_1.z.string().trim().
|
|
90
|
+
first: zod_1.z.string().trim().check((0, stringChecks_1.utf16MaxLength)(100)).optional(),
|
|
91
|
+
last: zod_1.z.string().trim().check((0, stringChecks_1.utf16MaxLength)(100)).optional(),
|
|
92
|
+
displayName: zod_1.z.string().trim().check((0, stringChecks_1.utf16MaxLength)(accountName_2.ACCOUNT_TITLE_MAX_LENGTH)).optional(),
|
|
92
93
|
})
|
|
93
94
|
.optional();
|
|
94
95
|
/**
|
|
@@ -104,7 +105,7 @@ exports.accountNameSchema = zod_1.z
|
|
|
104
105
|
*/
|
|
105
106
|
exports.createAccountRequestSchema = zod_1.z
|
|
106
107
|
.object({
|
|
107
|
-
parentAccountId: zod_1.z.string().trim().
|
|
108
|
+
parentAccountId: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).optional(),
|
|
108
109
|
kind: exports.childAccountKindSchema,
|
|
109
110
|
/**
|
|
110
111
|
* The SAME policy a person's handle is held to. `users.username` is one unique
|
|
@@ -119,9 +120,9 @@ exports.createAccountRequestSchema = zod_1.z
|
|
|
119
120
|
*/
|
|
120
121
|
username: username_1.usernameSchema,
|
|
121
122
|
name: exports.accountNameSchema,
|
|
122
|
-
bio: zod_1.z.string().trim().
|
|
123
|
+
bio: zod_1.z.string().trim().check((0, stringChecks_1.utf16MaxLength)(500)).optional(),
|
|
123
124
|
avatar: zod_1.z.string().optional(),
|
|
124
|
-
description: zod_1.z.string().trim().
|
|
125
|
+
description: zod_1.z.string().trim().check((0, stringChecks_1.utf16MaxLength)(1000)).optional(),
|
|
125
126
|
/**
|
|
126
127
|
* A named color preset KEY (`"blue"`, `"mint"`, …), never a hex value.
|
|
127
128
|
*
|
|
@@ -138,7 +139,7 @@ exports.createAccountRequestSchema = zod_1.z
|
|
|
138
139
|
* would drift apart silently. What this shape does is keep an over-long or
|
|
139
140
|
* non-string value from reaching the service at all.
|
|
140
141
|
*/
|
|
141
|
-
color: zod_1.z.string().trim().
|
|
142
|
+
color: zod_1.z.string().trim().check((0, stringChecks_1.utf16MaxLength)(32)).optional(),
|
|
142
143
|
/** Ordered, PRIMARY FIRST — see rule 2 above {@link ACCOUNT_CATEGORY_IDS}. */
|
|
143
144
|
accountCategories: exports.accountCategoriesSchema.optional(),
|
|
144
145
|
organizationType: zod_1.z.enum(organizations_1.ORGANIZATION_TYPES).optional(),
|
package/dist/cjs/accountName.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.accountTitleSchema = exports.isPlainTextTitle = exports.accountNamePolicyForKind = exports.ACCOUNT_TITLE_MAX_LENGTH = exports.ACCOUNT_TITLE_DISALLOWED_SOURCE = exports.ACCOUNT_NAME_POLICY_BY_KIND = void 0;
|
|
4
|
+
const stringChecks_1 = require("./stringChecks");
|
|
4
5
|
const zod_1 = require("zod");
|
|
5
6
|
// The Zod-free half of this contract lives in `./client/` (`@oxy.so/contracts/client`);
|
|
6
7
|
// it is re-exported here so the root entry carries the whole policy.
|
|
@@ -15,6 +16,6 @@ Object.defineProperty(exports, "isPlainTextTitle", { enumerable: true, get: func
|
|
|
15
16
|
exports.accountTitleSchema = zod_1.z
|
|
16
17
|
.string()
|
|
17
18
|
.trim()
|
|
18
|
-
.
|
|
19
|
-
.
|
|
19
|
+
.check((0, stringChecks_1.utf16MinLength)(1))
|
|
20
|
+
.check((0, stringChecks_1.utf16MaxLength)(accountName_1.ACCOUNT_TITLE_MAX_LENGTH))
|
|
20
21
|
.refine(accountName_1.isPlainTextTitle, 'Name must be plain text');
|
package/dist/cjs/agency.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalizedAppEventSchema = exports.catalogRegistrationSchema = exports.appCapabilityCatalogSchema = exports.CATALOG_INTERNAL_TRANSPORTS = exports.catalogFeatureSchema = exports.catalogEventSchema = exports.catalogToolSchema = exports.CATALOG_TOOL_DEFAULT_ACTORS = exports.catalogToolActorTypeSchema = exports.CATALOG_TOOL_ACTOR_TYPES = exports.auditEventSchema = exports.auditResultSchema = exports.policyDecisionSchema = exports.invocationPrincipalSchema = exports.capabilityTicketClaimsSchema = exports.automationDefinitionSchema = exports.automationDataFlowSchema = exports.automationActorSelectionSchema = exports.automationTriggerSchema = exports.agentAvailabilitySchema = exports.applicationAgentSchema = exports.applicationAgentWriteSchema = exports.applicationAgentAvailabilitySchema = exports.APPLICATION_AGENT_AVAILABILITIES = exports.agentRequesterCeilingSchema = exports.agentRequesterCeilingWriteSchema = exports.AGENT_REQUESTER_CEILING_AUTONOMY = exports.delegationGrantSchema = exports.capabilityTicketRequestSchema = exports.capabilityCoordinatorSchema = exports.executionAuthorizationRefSchema = exports.capabilityCatalogBindingSchema = exports.grantLimitSchema = exports.toolGrantOverrideSchema = exports.resourceRefSchema = exports.foregroundExecutionAuthorizationInputSchema = exports.executionActorRefSchema = exports.actorRefSchema = exports.capabilityPackageSchema = exports.CAPABILITY_PACKAGES = exports.autonomyLevelSchema = exports.AUTONOMY_LEVELS = void 0;
|
|
3
|
+
exports.normalizedAppEventSchema = exports.catalogRegistrationSchema = exports.appCapabilityCatalogSchema = exports.CATALOG_INTERNAL_TRANSPORTS = exports.catalogFeatureSchema = exports.catalogEventSchema = exports.catalogToolSchema = exports.CATALOG_TOOL_DEFAULT_ACTORS = exports.catalogToolActorTypeSchema = exports.CATALOG_TOOL_ACTOR_TYPES = exports.auditEventSchema = exports.auditResultSchema = exports.policyDecisionSchema = exports.invocationPrincipalSchema = exports.capabilityTicketClaimsSchema = exports.automationDefinitionSchema = exports.automationDataFlowSchema = exports.automationActorSelectionSchema = exports.automationTriggerSchema = exports.agentAvailabilitySchema = exports.applicationAgentSchema = exports.applicationAgentWriteSchema = exports.applicationAgentAvailabilitySchema = exports.APPLICATION_AGENT_AVAILABILITIES = exports.agentRequesterCeilingSchema = exports.agentRequesterCeilingWriteSchema = exports.AGENT_REQUESTER_CEILING_AUTONOMY = exports.delegationGrantSchema = exports.capabilityTicketRequestSchema = exports.capabilityCoordinatorSchema = exports.executionAuthorizationRefSchema = exports.capabilityCatalogBindingSchema = exports.grantLimitSchema = exports.toolGrantOverrideSchema = exports.firstPartyExecutionAuthorizationInputSchema = exports.firstPartyTaskInputSchema = exports.resourceRefSchema = exports.foregroundExecutionAuthorizationInputSchema = exports.executionActorRefSchema = exports.actorRefSchema = exports.capabilityPackageSchema = exports.CAPABILITY_PACKAGES = exports.autonomyLevelSchema = exports.AUTONOMY_LEVELS = void 0;
|
|
4
4
|
exports.catalogToolActors = catalogToolActors;
|
|
5
5
|
exports.catalogToolAllowsActor = catalogToolAllowsActor;
|
|
6
|
+
const numberChecks_1 = require("./numberChecks");
|
|
7
|
+
const stringChecks_1 = require("./stringChecks");
|
|
6
8
|
const zod_1 = require("zod");
|
|
7
9
|
const capabilityInvocation_1 = require("./capabilityInvocation");
|
|
8
|
-
const nonEmptyStringSchema = zod_1.z.string().trim().
|
|
9
|
-
const identifierSchema = zod_1.z.string().trim().
|
|
10
|
+
const nonEmptyStringSchema = zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1));
|
|
11
|
+
const identifierSchema = zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(255));
|
|
10
12
|
const limitKeySchema = zod_1.z
|
|
11
13
|
.string()
|
|
12
14
|
.regex(/^[A-Za-z][A-Za-z0-9_]*(?:\.[A-Za-z][A-Za-z0-9_]*)*$/, 'limit keys must be dot-separated input property names')
|
|
13
|
-
.
|
|
15
|
+
.check((0, stringChecks_1.utf16MaxLength)(255));
|
|
14
16
|
const auditCodeSchema = zod_1.z.string().regex(/^[A-Za-z0-9_.:-]{1,128}$/);
|
|
15
17
|
const sha256HexSchema = zod_1.z.string().regex(/^[a-f0-9]{64}$/);
|
|
16
18
|
const invocationPathSchema = zod_1.z
|
|
@@ -62,7 +64,7 @@ exports.foregroundExecutionAuthorizationInputSchema = zod_1.z
|
|
|
62
64
|
.strict(),
|
|
63
65
|
runId: identifierSchema,
|
|
64
66
|
stepId: identifierSchema.optional(),
|
|
65
|
-
expiresAt: zod_1.z.string().
|
|
67
|
+
expiresAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
|
|
66
68
|
})
|
|
67
69
|
.strict();
|
|
68
70
|
exports.resourceRefSchema = zod_1.z
|
|
@@ -73,6 +75,50 @@ exports.resourceRefSchema = zod_1.z
|
|
|
73
75
|
resourceId: identifierSchema,
|
|
74
76
|
})
|
|
75
77
|
.strict();
|
|
78
|
+
exports.firstPartyTaskInputSchema = zod_1.z
|
|
79
|
+
.object({
|
|
80
|
+
origin: zod_1.z
|
|
81
|
+
.object({ kind: zod_1.z.enum(['request', 'goal', 'automation']), id: identifierSchema })
|
|
82
|
+
.strict(),
|
|
83
|
+
actor: exports.executionActorRefSchema,
|
|
84
|
+
effectiveAccountId: identifierSchema,
|
|
85
|
+
expiresAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
|
|
86
|
+
})
|
|
87
|
+
.strict();
|
|
88
|
+
/** Oxy-owned tools use the authenticated requester's task, never per-app grants. */
|
|
89
|
+
exports.firstPartyExecutionAuthorizationInputSchema = zod_1.z
|
|
90
|
+
.object({
|
|
91
|
+
authority: zod_1.z.literal('first_party'),
|
|
92
|
+
kind: zod_1.z.enum(['direct_request', 'automation']).default('direct_request'),
|
|
93
|
+
actor: exports.executionActorRefSchema,
|
|
94
|
+
resource: exports.resourceRefSchema,
|
|
95
|
+
tool: identifierSchema,
|
|
96
|
+
expectedCatalog: exports.foregroundExecutionAuthorizationInputSchema.shape.expectedCatalog,
|
|
97
|
+
runId: identifierSchema.optional(),
|
|
98
|
+
stepId: identifierSchema.optional(),
|
|
99
|
+
automationId: identifierSchema.optional(),
|
|
100
|
+
limits: zod_1.z
|
|
101
|
+
.array(zod_1.z
|
|
102
|
+
.object({
|
|
103
|
+
tool: identifierSchema,
|
|
104
|
+
key: limitKeySchema,
|
|
105
|
+
value: zod_1.z.union([zod_1.z.number().finite(), zod_1.z.boolean()]),
|
|
106
|
+
})
|
|
107
|
+
.strict())
|
|
108
|
+
.default([]),
|
|
109
|
+
expiresAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
|
|
110
|
+
})
|
|
111
|
+
.strict()
|
|
112
|
+
.superRefine((input, context) => {
|
|
113
|
+
if (input.kind === 'direct_request'
|
|
114
|
+
? !input.runId || input.automationId !== undefined
|
|
115
|
+
: !input.automationId || input.runId !== undefined || input.stepId !== undefined) {
|
|
116
|
+
context.addIssue({
|
|
117
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
118
|
+
message: 'Bind either a direct run or an automation identity.',
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
});
|
|
76
122
|
exports.toolGrantOverrideSchema = zod_1.z
|
|
77
123
|
.object({
|
|
78
124
|
tool: identifierSchema,
|
|
@@ -120,9 +166,9 @@ exports.capabilityCoordinatorSchema = zod_1.z
|
|
|
120
166
|
/** Opt-in catalogue pin; legacy issuance omits expectedCatalog and its claim. */
|
|
121
167
|
exports.capabilityTicketRequestSchema = zod_1.z
|
|
122
168
|
.object({
|
|
123
|
-
executionAuthorizationId: zod_1.z.string().
|
|
124
|
-
runId: zod_1.z.string().
|
|
125
|
-
stepId: zod_1.z.string().
|
|
169
|
+
executionAuthorizationId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
170
|
+
runId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).optional(),
|
|
171
|
+
stepId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).optional(),
|
|
126
172
|
expectedCatalog: exports.capabilityCatalogBindingSchema.optional(),
|
|
127
173
|
})
|
|
128
174
|
.strict();
|
|
@@ -139,10 +185,10 @@ exports.delegationGrantSchema = zod_1.z
|
|
|
139
185
|
limits: zod_1.z.array(exports.grantLimitSchema).default([]),
|
|
140
186
|
maximumAutonomy: exports.autonomyLevelSchema,
|
|
141
187
|
canRedelegate: zod_1.z.boolean().default(false),
|
|
142
|
-
expiresAt: zod_1.z.string().
|
|
143
|
-
revokedAt: zod_1.z.string().
|
|
144
|
-
createdAt: zod_1.z.string().
|
|
145
|
-
updatedAt: zod_1.z.string().
|
|
188
|
+
expiresAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()).nullable(),
|
|
189
|
+
revokedAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()).nullable().default(null),
|
|
190
|
+
createdAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
|
|
191
|
+
updatedAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
|
|
146
192
|
})
|
|
147
193
|
.strict();
|
|
148
194
|
/**
|
|
@@ -168,10 +214,10 @@ exports.agentRequesterCeilingSchema = exports.agentRequesterCeilingWriteSchema
|
|
|
168
214
|
agentAccountId: identifierSchema,
|
|
169
215
|
appId: identifierSchema,
|
|
170
216
|
catalog: exports.capabilityCatalogBindingSchema,
|
|
171
|
-
version: zod_1.z.number().
|
|
172
|
-
revokedAt: zod_1.z.string().
|
|
173
|
-
createdAt: zod_1.z.string().
|
|
174
|
-
updatedAt: zod_1.z.string().
|
|
217
|
+
version: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).positive(),
|
|
218
|
+
revokedAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()).nullable(),
|
|
219
|
+
createdAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
|
|
220
|
+
updatedAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
|
|
175
221
|
})
|
|
176
222
|
.strict();
|
|
177
223
|
/**
|
|
@@ -191,8 +237,8 @@ exports.applicationAgentSchema = exports.applicationAgentWriteSchema
|
|
|
191
237
|
applicationId: identifierSchema,
|
|
192
238
|
agentAccountId: identifierSchema,
|
|
193
239
|
createdByUserId: identifierSchema.nullable(),
|
|
194
|
-
createdAt: zod_1.z.string().
|
|
195
|
-
updatedAt: zod_1.z.string().
|
|
240
|
+
createdAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
|
|
241
|
+
updatedAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
|
|
196
242
|
})
|
|
197
243
|
.strict();
|
|
198
244
|
/**
|
|
@@ -241,14 +287,14 @@ exports.automationDefinitionSchema = zod_1.z
|
|
|
241
287
|
objective: nonEmptyStringSchema,
|
|
242
288
|
trigger: exports.automationTriggerSchema,
|
|
243
289
|
actorSelection: exports.automationActorSelectionSchema,
|
|
244
|
-
inputs: zod_1.z.record(zod_1.z.unknown()),
|
|
290
|
+
inputs: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
|
|
245
291
|
resources: zod_1.z.array(exports.resourceRefSchema),
|
|
246
292
|
dataFlow: exports.automationDataFlowSchema,
|
|
247
293
|
maximumAutonomy: exports.autonomyLevelSchema,
|
|
248
294
|
limits: zod_1.z.array(exports.grantLimitSchema).default([]),
|
|
249
295
|
enabled: zod_1.z.boolean(),
|
|
250
|
-
createdAt: zod_1.z.string().
|
|
251
|
-
updatedAt: zod_1.z.string().
|
|
296
|
+
createdAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
|
|
297
|
+
updatedAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
|
|
252
298
|
})
|
|
253
299
|
.strict();
|
|
254
300
|
exports.capabilityTicketClaimsSchema = zod_1.z
|
|
@@ -257,12 +303,14 @@ exports.capabilityTicketClaimsSchema = zod_1.z
|
|
|
257
303
|
aud: identifierSchema,
|
|
258
304
|
sub: identifierSchema,
|
|
259
305
|
jti: identifierSchema,
|
|
260
|
-
iat: zod_1.z.number().
|
|
261
|
-
exp: zod_1.z.number().
|
|
306
|
+
iat: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative(),
|
|
307
|
+
exp: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).positive(),
|
|
262
308
|
runId: identifierSchema,
|
|
263
309
|
stepId: identifierSchema.optional(),
|
|
264
310
|
automationId: identifierSchema.optional(),
|
|
265
311
|
executionAuthorization: exports.executionAuthorizationRefSchema,
|
|
312
|
+
authority: zod_1.z.enum(['first_party', 'external']).optional(),
|
|
313
|
+
taskId: identifierSchema.optional(),
|
|
266
314
|
coordinator: exports.capabilityCoordinatorSchema,
|
|
267
315
|
/** Signed only for callers that explicitly requested a pinned catalogue. */
|
|
268
316
|
catalog: exports.capabilityCatalogBindingSchema.optional(),
|
|
@@ -296,6 +344,7 @@ exports.capabilityTicketClaimsSchema = zod_1.z
|
|
|
296
344
|
});
|
|
297
345
|
}
|
|
298
346
|
if (claims.actor.type === 'requester' &&
|
|
347
|
+
claims.authority !== 'first_party' &&
|
|
299
348
|
(claims.actor.accountId !== claims.requesterAccountId ||
|
|
300
349
|
claims.executionAuthorization.kind !== 'direct_request' ||
|
|
301
350
|
claims.autonomy !== 'read_only' ||
|
|
@@ -307,6 +356,14 @@ exports.capabilityTicketClaimsSchema = zod_1.z
|
|
|
307
356
|
message: 'requester actors require their exact principal and direct read-only authority without standing grants',
|
|
308
357
|
});
|
|
309
358
|
}
|
|
359
|
+
if (claims.authority === 'first_party' &&
|
|
360
|
+
(claims.grantId !== undefined || claims.ceilingId !== undefined)) {
|
|
361
|
+
context.addIssue({
|
|
362
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
363
|
+
message: 'Own tool tasks cannot carry external grants or ceilings',
|
|
364
|
+
path: ['authority'],
|
|
365
|
+
});
|
|
366
|
+
}
|
|
310
367
|
if (claims.ceilingId !== undefined) {
|
|
311
368
|
if (claims.grantId !== undefined) {
|
|
312
369
|
context.addIssue({
|
|
@@ -368,7 +425,7 @@ exports.invocationPrincipalSchema = zod_1.z.discriminatedUnion('kind', [
|
|
|
368
425
|
originAccountId: identifierSchema,
|
|
369
426
|
activeAccountId: identifierSchema,
|
|
370
427
|
scopes: zod_1.z.array(identifierSchema),
|
|
371
|
-
resource: zod_1.z.string().
|
|
428
|
+
resource: zod_1.z.string().check((0, stringChecks_1.urlCheck)()),
|
|
372
429
|
})
|
|
373
430
|
.strict(),
|
|
374
431
|
zod_1.z
|
|
@@ -398,7 +455,7 @@ exports.auditResultSchema = zod_1.z
|
|
|
398
455
|
exports.auditEventSchema = zod_1.z
|
|
399
456
|
.object({
|
|
400
457
|
eventId: identifierSchema,
|
|
401
|
-
occurredAt: zod_1.z.string().
|
|
458
|
+
occurredAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
|
|
402
459
|
requesterAccountId: identifierSchema,
|
|
403
460
|
coordinator: exports.capabilityCoordinatorSchema,
|
|
404
461
|
executor: exports.executionActorRefSchema,
|
|
@@ -445,8 +502,8 @@ exports.catalogToolSchema = zod_1.z
|
|
|
445
502
|
name: identifierSchema,
|
|
446
503
|
version: identifierSchema,
|
|
447
504
|
description: nonEmptyStringSchema,
|
|
448
|
-
inputSchema: zod_1.z.record(zod_1.z.unknown()),
|
|
449
|
-
outputSchema: zod_1.z.record(zod_1.z.unknown()).optional(),
|
|
505
|
+
inputSchema: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
|
|
506
|
+
outputSchema: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
|
|
450
507
|
capabilityPackage: exports.capabilityPackageSchema,
|
|
451
508
|
requiredCapabilities: zod_1.z.array(identifierSchema).min(1),
|
|
452
509
|
resourceTypes: zod_1.z.array(identifierSchema).min(1),
|
|
@@ -623,7 +680,7 @@ exports.catalogEventSchema = zod_1.z
|
|
|
623
680
|
type: identifierSchema,
|
|
624
681
|
version: identifierSchema,
|
|
625
682
|
description: nonEmptyStringSchema,
|
|
626
|
-
dataSchema: zod_1.z.record(zod_1.z.unknown()),
|
|
683
|
+
dataSchema: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
|
|
627
684
|
resourceTypes: zod_1.z.array(identifierSchema).min(1),
|
|
628
685
|
})
|
|
629
686
|
.strict();
|
|
@@ -637,7 +694,7 @@ exports.catalogFeatureSchema = zod_1.z
|
|
|
637
694
|
key: zod_1.z
|
|
638
695
|
.string()
|
|
639
696
|
.regex(/^[a-z][a-z0-9_-]*(?:\.[a-z][a-z0-9_-]*)*$/, 'feature keys are dot-separated slugs')
|
|
640
|
-
.
|
|
697
|
+
.check((0, stringChecks_1.utf16MaxLength)(128)),
|
|
641
698
|
description: nonEmptyStringSchema,
|
|
642
699
|
checkTool: identifierSchema,
|
|
643
700
|
consumeTool: identifierSchema.optional(),
|
|
@@ -654,7 +711,7 @@ exports.appCapabilityCatalogSchema = zod_1.z
|
|
|
654
711
|
/** HTTPS origin that serves the catalog's internal invocation paths. */
|
|
655
712
|
internalBaseUrl: zod_1.z
|
|
656
713
|
.string()
|
|
657
|
-
.
|
|
714
|
+
.check((0, stringChecks_1.urlCheck)())
|
|
658
715
|
.superRefine((value, context) => {
|
|
659
716
|
const url = new URL(value);
|
|
660
717
|
const localDevelopment = url.hostname === 'localhost' || url.hostname === '127.0.0.1';
|
|
@@ -678,7 +735,7 @@ exports.appCapabilityCatalogSchema = zod_1.z
|
|
|
678
735
|
.object({
|
|
679
736
|
resource: zod_1.z
|
|
680
737
|
.string()
|
|
681
|
-
.
|
|
738
|
+
.check((0, stringChecks_1.urlCheck)())
|
|
682
739
|
.superRefine((value, context) => {
|
|
683
740
|
const url = new URL(value);
|
|
684
741
|
const localDevelopment = url.hostname === 'localhost' ||
|
|
@@ -788,7 +845,7 @@ exports.catalogRegistrationSchema = zod_1.z
|
|
|
788
845
|
catalog: exports.appCapabilityCatalogSchema,
|
|
789
846
|
digest: zod_1.z.string().regex(/^[a-f0-9]{64}$/),
|
|
790
847
|
signature: nonEmptyStringSchema,
|
|
791
|
-
deployedAt: zod_1.z.string().
|
|
848
|
+
deployedAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
|
|
792
849
|
})
|
|
793
850
|
.strict();
|
|
794
851
|
exports.normalizedAppEventSchema = zod_1.z
|
|
@@ -798,8 +855,8 @@ exports.normalizedAppEventSchema = zod_1.z
|
|
|
798
855
|
accountId: identifierSchema,
|
|
799
856
|
resource: exports.resourceRefSchema,
|
|
800
857
|
type: identifierSchema,
|
|
801
|
-
occurredAt: zod_1.z.string().
|
|
802
|
-
data: zod_1.z.record(zod_1.z.unknown()),
|
|
858
|
+
occurredAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
|
|
859
|
+
data: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
|
|
803
860
|
})
|
|
804
861
|
.strict();
|
|
805
862
|
/** The actor types that may execute `tool`: the one reading of an absent `actors`. */
|
package/dist/cjs/agentKeys.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.agentKeyListResponseSchema = exports.agentKeyOperationResultSchema = exports.agentKeyOperationChallengeSchema = exports.executeAgentKeyOperationSchema = exports.agentKeyOperationProofSchema = exports.agentKeyOperationSchema = exports.agentVerifyRequestSchema = exports.agentChallengeRequestSchema = exports.agentSignatureSchema = exports.agentProofClaimsSchema = exports.ACCOUNT_AUTH_METHODS = exports.AGENT_PROOF_ACTIONS = exports.AGENT_PROOF_TTL_MS = exports.AGENT_PROOF_AUDIENCE = void 0;
|
|
4
4
|
exports.buildAgentProofMessage = buildAgentProofMessage;
|
|
5
|
+
const numberChecks_1 = require("./numberChecks");
|
|
6
|
+
const stringChecks_1 = require("./stringChecks");
|
|
5
7
|
/** Autonomous runtime proof. No private key crosses this contract. */
|
|
6
8
|
const zod_1 = require("zod");
|
|
7
9
|
const signIn_1 = require("./signIn");
|
|
@@ -19,13 +21,13 @@ exports.agentProofClaimsSchema = zod_1.z
|
|
|
19
21
|
version: zod_1.z.literal(1),
|
|
20
22
|
audience: zod_1.z.literal(agentKeys_1.AGENT_PROOF_AUDIENCE),
|
|
21
23
|
action: zod_1.z.enum(agentKeys_1.AGENT_PROOF_ACTIONS),
|
|
22
|
-
accountId: zod_1.z.string().
|
|
23
|
-
actorId: zod_1.z.string().
|
|
24
|
+
accountId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
25
|
+
actorId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
24
26
|
authMethodId: zod_1.z.string().nullable(),
|
|
25
|
-
publicKey: zod_1.z.string().
|
|
27
|
+
publicKey: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
26
28
|
payloadDigest: zod_1.z.string().regex(/^[0-9a-f]{64}$/),
|
|
27
29
|
challenge: zod_1.z.string().regex(/^[0-9a-f]{64}$/),
|
|
28
|
-
expiresAt: zod_1.z.number().
|
|
30
|
+
expiresAt: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).positive(),
|
|
29
31
|
})
|
|
30
32
|
.strict();
|
|
31
33
|
/** Different proof roles cannot substitute for one another on the same operation. */
|
|
@@ -43,19 +45,19 @@ exports.agentSignatureSchema = zod_1.z
|
|
|
43
45
|
signature: zod_1.z
|
|
44
46
|
.string()
|
|
45
47
|
.regex(/^[0-9a-f]+$/i)
|
|
46
|
-
.
|
|
47
|
-
timestamp: zod_1.z.number().
|
|
48
|
+
.check((0, stringChecks_1.utf16MaxLength)(160)),
|
|
49
|
+
timestamp: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).positive(),
|
|
48
50
|
})
|
|
49
51
|
.strict();
|
|
50
52
|
exports.agentChallengeRequestSchema = zod_1.z
|
|
51
|
-
.object({ publicKey: zod_1.z.string().trim().
|
|
53
|
+
.object({ publicKey: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(130)) })
|
|
52
54
|
.strict();
|
|
53
55
|
exports.agentVerifyRequestSchema = exports.agentSignatureSchema
|
|
54
|
-
.extend({ publicKey: zod_1.z.string().trim().
|
|
56
|
+
.extend({ publicKey: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(130)) })
|
|
55
57
|
.strict();
|
|
56
58
|
const newKey = {
|
|
57
|
-
publicKey: zod_1.z.string().trim().
|
|
58
|
-
label: zod_1.z.string().trim().
|
|
59
|
+
publicKey: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(130)),
|
|
60
|
+
label: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(120)),
|
|
59
61
|
};
|
|
60
62
|
exports.agentKeyOperationSchema = zod_1.z.discriminatedUnion('operation', [
|
|
61
63
|
zod_1.z.object({ operation: zod_1.z.literal('enroll'), ...newKey }).strict(),
|
|
@@ -63,21 +65,23 @@ exports.agentKeyOperationSchema = zod_1.z.discriminatedUnion('operation', [
|
|
|
63
65
|
zod_1.z
|
|
64
66
|
.object({ operation: zod_1.z.literal('rotate'), ...newKey, retireCurrent: zod_1.z.boolean().optional() })
|
|
65
67
|
.strict(),
|
|
66
|
-
zod_1.z
|
|
68
|
+
zod_1.z
|
|
69
|
+
.object({ operation: zod_1.z.literal('revoke'), methodId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)) })
|
|
70
|
+
.strict(),
|
|
67
71
|
]);
|
|
68
72
|
exports.agentKeyOperationProofSchema = zod_1.z
|
|
69
73
|
.object({
|
|
70
74
|
challenge: zod_1.z.string().regex(/^[0-9a-f]{64}$/),
|
|
71
|
-
timestamp: zod_1.z.number().
|
|
75
|
+
timestamp: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).positive(),
|
|
72
76
|
keySignature: zod_1.z
|
|
73
77
|
.string()
|
|
74
78
|
.regex(/^[0-9a-f]+$/i)
|
|
75
|
-
.
|
|
79
|
+
.check((0, stringChecks_1.utf16MaxLength)(160))
|
|
76
80
|
.optional(),
|
|
77
81
|
governorSignature: zod_1.z
|
|
78
82
|
.string()
|
|
79
83
|
.regex(/^[0-9a-f]+$/i)
|
|
80
|
-
.
|
|
84
|
+
.check((0, stringChecks_1.utf16MaxLength)(160))
|
|
81
85
|
.optional(),
|
|
82
86
|
reauth: signIn_1.reauthProofSchema.optional(),
|
|
83
87
|
})
|
|
@@ -110,9 +114,9 @@ exports.agentKeyListResponseSchema = zod_1.z
|
|
|
110
114
|
label: zod_1.z.string(),
|
|
111
115
|
enrolledByUserId: zod_1.z.string().nullable(),
|
|
112
116
|
enrollmentMethod: zod_1.z.enum(['governor', 'rotation', 'recovery']),
|
|
113
|
-
linkedAt: zod_1.z.string().
|
|
114
|
-
lastUsedAt: zod_1.z.string().
|
|
115
|
-
revokedAt: zod_1.z.string().
|
|
117
|
+
linkedAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
|
|
118
|
+
lastUsedAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()).nullable(),
|
|
119
|
+
revokedAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()).nullable(),
|
|
116
120
|
})
|
|
117
121
|
.strict()),
|
|
118
122
|
})
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.appAssertionResponseSchema = exports.appAssertionRequestSchema = exports.appAttestKeyResponseSchema = exports.appAttestKeyRequestSchema = exports.appAttestKeyIdSchema = exports.appAssertionChallengeResponseSchema = exports.appAssertionChallengeRequestSchema = exports.applicationRecognitionSchema = exports.applicationRecognitionWriteSchema = exports.applicationIosRecognitionSchema = exports.applicationAndroidRecognitionSchema = exports.appleBundleIdSchema = exports.appleTeamIdSchema = exports.signingCertSha256Schema = exports.androidPackageNameSchema = exports.applicationWebOriginSchema = exports.appAssertionErrorCodeSchema = exports.appAssertionPlatformSchema = exports.OXY_APP_ASSERTION_TYPE = exports.OXY_APP_ASSERTION_TTL_SECONDS = exports.OXY_APP_ASSERTION_HEADER = exports.OXY_APP_ASSERTION_AUDIENCE = exports.APP_ASSERTION_PLATFORMS = exports.APP_ASSERTION_ERROR_CODES = exports.APP_ASSERTION_CHALLENGE_PURPOSES = void 0;
|
|
4
|
+
exports.isExactHttpsOrigin = isExactHttpsOrigin;
|
|
5
|
+
const stringChecks_1 = require("./stringChecks");
|
|
2
6
|
/**
|
|
3
7
|
* App assertions (ADR 0045): how an Oxy app proves which app it is.
|
|
4
8
|
*
|
|
@@ -23,9 +27,6 @@
|
|
|
23
27
|
* The Zod-free half (vocabularies, header name, response checks) is
|
|
24
28
|
* `./client/appAssertions.ts`.
|
|
25
29
|
*/
|
|
26
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.appAssertionResponseSchema = exports.appAssertionRequestSchema = exports.appAttestKeyResponseSchema = exports.appAttestKeyRequestSchema = exports.appAttestKeyIdSchema = exports.appAssertionChallengeResponseSchema = exports.appAssertionChallengeRequestSchema = exports.applicationRecognitionSchema = exports.applicationRecognitionWriteSchema = exports.applicationIosRecognitionSchema = exports.applicationAndroidRecognitionSchema = exports.appleBundleIdSchema = exports.appleTeamIdSchema = exports.signingCertSha256Schema = exports.androidPackageNameSchema = exports.applicationWebOriginSchema = exports.appAssertionErrorCodeSchema = exports.appAssertionPlatformSchema = exports.OXY_APP_ASSERTION_TYPE = exports.OXY_APP_ASSERTION_TTL_SECONDS = exports.OXY_APP_ASSERTION_HEADER = exports.OXY_APP_ASSERTION_AUDIENCE = exports.APP_ASSERTION_PLATFORMS = exports.APP_ASSERTION_ERROR_CODES = exports.APP_ASSERTION_CHALLENGE_PURPOSES = void 0;
|
|
28
|
-
exports.isExactHttpsOrigin = isExactHttpsOrigin;
|
|
29
30
|
const zod_1 = require("zod");
|
|
30
31
|
const appAssertions_1 = require("./client/appAssertions");
|
|
31
32
|
Object.defineProperty(exports, "APP_ASSERTION_CHALLENGE_PURPOSES", { enumerable: true, get: function () { return appAssertions_1.APP_ASSERTION_CHALLENGE_PURPOSES; } });
|
|
@@ -35,12 +36,12 @@ Object.defineProperty(exports, "OXY_APP_ASSERTION_AUDIENCE", { enumerable: true,
|
|
|
35
36
|
Object.defineProperty(exports, "OXY_APP_ASSERTION_HEADER", { enumerable: true, get: function () { return appAssertions_1.OXY_APP_ASSERTION_HEADER; } });
|
|
36
37
|
Object.defineProperty(exports, "OXY_APP_ASSERTION_TTL_SECONDS", { enumerable: true, get: function () { return appAssertions_1.OXY_APP_ASSERTION_TTL_SECONDS; } });
|
|
37
38
|
Object.defineProperty(exports, "OXY_APP_ASSERTION_TYPE", { enumerable: true, get: function () { return appAssertions_1.OXY_APP_ASSERTION_TYPE; } });
|
|
38
|
-
const applicationIdSchema = zod_1.z.string().trim().
|
|
39
|
+
const applicationIdSchema = zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(255));
|
|
39
40
|
const base64Url32Schema = zod_1.z.string().regex(/^[A-Za-z0-9_-]{43}$/);
|
|
40
41
|
const base64Schema = (max) => zod_1.z
|
|
41
42
|
.string()
|
|
42
|
-
.
|
|
43
|
-
.
|
|
43
|
+
.check((0, stringChecks_1.utf16MinLength)(4))
|
|
44
|
+
.check((0, stringChecks_1.utf16MaxLength)(max))
|
|
44
45
|
.regex(/^[A-Za-z0-9+/]+={0,2}$/);
|
|
45
46
|
exports.appAssertionPlatformSchema = zod_1.z.enum(appAssertions_1.APP_ASSERTION_PLATFORMS);
|
|
46
47
|
exports.appAssertionErrorCodeSchema = zod_1.z.enum(appAssertions_1.APP_ASSERTION_ERROR_CODES);
|
|
@@ -60,12 +61,12 @@ function isExactHttpsOrigin(value) {
|
|
|
60
61
|
/** An exact `https://` origin, in the form a browser sends in `Origin` (`https://mention.earth`). */
|
|
61
62
|
exports.applicationWebOriginSchema = zod_1.z
|
|
62
63
|
.string()
|
|
63
|
-
.
|
|
64
|
+
.check((0, stringChecks_1.utf16MaxLength)(255))
|
|
64
65
|
.refine(isExactHttpsOrigin, 'Must be an exact https origin, as a browser sends it');
|
|
65
66
|
/** A Java-style Android application id, at least two segments. */
|
|
66
67
|
exports.androidPackageNameSchema = zod_1.z
|
|
67
68
|
.string()
|
|
68
|
-
.
|
|
69
|
+
.check((0, stringChecks_1.utf16MaxLength)(255))
|
|
69
70
|
.regex(/^[A-Za-z][A-Za-z0-9_]*(?:\.[A-Za-z][A-Za-z0-9_]*)+$/, 'Must be an Android package name');
|
|
70
71
|
/** A signing certificate's SHA-256, 64 lowercase hex characters (keytool's digest without colons). */
|
|
71
72
|
exports.signingCertSha256Schema = zod_1.z
|
|
@@ -76,7 +77,7 @@ exports.appleTeamIdSchema = zod_1.z.string().regex(/^[A-Z0-9]{10}$/, 'Must be an
|
|
|
76
77
|
/** An Apple bundle id. */
|
|
77
78
|
exports.appleBundleIdSchema = zod_1.z
|
|
78
79
|
.string()
|
|
79
|
-
.
|
|
80
|
+
.check((0, stringChecks_1.utf16MaxLength)(255))
|
|
80
81
|
.regex(/^[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)+$/, 'Must be an Apple bundle id');
|
|
81
82
|
const unique = (values) => new Set(values).size === values.length;
|
|
82
83
|
exports.applicationAndroidRecognitionSchema = zod_1.z
|
|
@@ -110,7 +111,7 @@ exports.applicationRecognitionWriteSchema = zod_1.z
|
|
|
110
111
|
exports.applicationRecognitionSchema = exports.applicationRecognitionWriteSchema
|
|
111
112
|
.extend({
|
|
112
113
|
applicationId: applicationIdSchema,
|
|
113
|
-
updatedAt: zod_1.z.string().
|
|
114
|
+
updatedAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()).nullable(),
|
|
114
115
|
})
|
|
115
116
|
.strict();
|
|
116
117
|
// ---------------------------------------------------------------------------
|
|
@@ -137,7 +138,7 @@ exports.appAssertionChallengeResponseSchema = zod_1.z
|
|
|
137
138
|
.object({
|
|
138
139
|
challenge: base64Url32Schema,
|
|
139
140
|
requestHash: base64Url32Schema,
|
|
140
|
-
expiresAt: zod_1.z.string().
|
|
141
|
+
expiresAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
|
|
141
142
|
cloudProjectNumber: zod_1.z
|
|
142
143
|
.string()
|
|
143
144
|
.regex(/^[0-9]{1,20}$/)
|
|
@@ -171,7 +172,7 @@ exports.appAssertionRequestSchema = zod_1.z.discriminatedUnion('platform', [
|
|
|
171
172
|
proof: zod_1.z
|
|
172
173
|
.object({
|
|
173
174
|
challenge: base64Url32Schema,
|
|
174
|
-
integrityToken: zod_1.z.string().
|
|
175
|
+
integrityToken: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(16384)),
|
|
175
176
|
})
|
|
176
177
|
.strict(),
|
|
177
178
|
})
|
|
@@ -196,6 +197,6 @@ exports.appAssertionResponseSchema = zod_1.z
|
|
|
196
197
|
assertion: zod_1.z.string().regex(/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/),
|
|
197
198
|
applicationId: zod_1.z.string().regex(/^\S{1,255}$/),
|
|
198
199
|
platform: exports.appAssertionPlatformSchema,
|
|
199
|
-
expiresAt: zod_1.z.string().
|
|
200
|
+
expiresAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
|
|
200
201
|
})
|
|
201
202
|
.strict();
|