@oxy.so/contracts 1.0.1 → 1.1.1
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/.tsbuildinfo +1 -1
- package/dist/cjs/agency.js +7 -1
- package/dist/cjs/externalIdentity.js +52 -0
- package/dist/cjs/identity.js +20 -1
- package/dist/cjs/index.js +32 -15
- package/dist/cjs/oauth.js +50 -1
- package/dist/cjs/webauthn.js +1 -1
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/agency.js +6 -0
- package/dist/esm/externalIdentity.js +49 -0
- package/dist/esm/identity.js +19 -0
- package/dist/esm/index.js +4 -6
- package/dist/esm/oauth.js +49 -0
- package/dist/esm/webauthn.js +1 -1
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/agency.d.ts +61 -24
- package/dist/types/externalIdentity.d.ts +536 -0
- package/dist/types/identity.d.ts +38 -0
- package/dist/types/index.d.ts +7 -8
- package/dist/types/inference/request.d.ts +28 -28
- package/dist/types/keyRecovery.d.ts +4 -4
- package/dist/types/oauth.d.ts +891 -0
- package/dist/types/userResponse.d.ts +2 -2
- package/dist/types/webauthn.d.ts +1 -1
- package/package.json +1 -1
- package/dist/cjs/links.js +0 -68
- package/dist/esm/links.js +0 -65
- package/dist/types/links.d.ts +0 -96
package/dist/esm/agency.js
CHANGED
|
@@ -52,6 +52,11 @@ export const grantLimitSchema = z.object({
|
|
|
52
52
|
// queries) and ADR 0016 forbids persisting those in Oxy.
|
|
53
53
|
value: z.union([z.number().finite(), z.boolean()]),
|
|
54
54
|
}).strict();
|
|
55
|
+
export const capabilityCatalogBindingSchema = z.object({
|
|
56
|
+
registrationId: identifierSchema,
|
|
57
|
+
version: identifierSchema,
|
|
58
|
+
digest: sha256HexSchema,
|
|
59
|
+
}).strict();
|
|
55
60
|
export const executionAuthorizationRefSchema = z.discriminatedUnion('kind', [
|
|
56
61
|
z.object({
|
|
57
62
|
kind: z.literal('direct_request'),
|
|
@@ -72,6 +77,7 @@ export const delegationGrantSchema = z.object({
|
|
|
72
77
|
ownerAccountId: identifierSchema,
|
|
73
78
|
actor: actorRefSchema,
|
|
74
79
|
resource: resourceRefSchema,
|
|
80
|
+
catalog: capabilityCatalogBindingSchema.nullable(),
|
|
75
81
|
capabilityPackages: z.array(capabilityPackageSchema),
|
|
76
82
|
capabilities: z.array(identifierSchema),
|
|
77
83
|
toolOverrides: z.array(toolGrantOverrideSchema).default([]),
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { userResponseSchema } from './userResponse.js';
|
|
3
|
+
export const externalIdentityReferenceSchema = z.object({
|
|
4
|
+
canonicalAcct: z.string().min(1),
|
|
5
|
+
network: z.string().min(1),
|
|
6
|
+
protocol: z.enum(['activitypub', 'atproto']),
|
|
7
|
+
actorUri: z.string().min(1),
|
|
8
|
+
transportAcct: z.string().min(1),
|
|
9
|
+
sourceUserId: z.string().min(1),
|
|
10
|
+
});
|
|
11
|
+
export const resolveExternalIdentityRequestSchema = z.object({
|
|
12
|
+
actorUri: z.string().min(1).max(2048).optional(),
|
|
13
|
+
handle: z.string().min(1).max(2048).optional(),
|
|
14
|
+
transportAcct: z.string().max(320).optional(),
|
|
15
|
+
protocol: z.enum(['activitypub', 'atproto']).optional(),
|
|
16
|
+
}).refine(value => Boolean(value.actorUri) !== Boolean(value.handle), 'Exactly one actorUri or handle is required');
|
|
17
|
+
export const resolveExternalIdentityResponseSchema = z.object({
|
|
18
|
+
user: userResponseSchema.extend({
|
|
19
|
+
id: z.string().min(1),
|
|
20
|
+
username: z.string().min(1),
|
|
21
|
+
bio: z.string().optional(),
|
|
22
|
+
externalIdentities: z.array(externalIdentityReferenceSchema),
|
|
23
|
+
redirectedUserIds: z.array(z.string()),
|
|
24
|
+
}),
|
|
25
|
+
externalIdentity: externalIdentityReferenceSchema.extend({ userId: z.string() }),
|
|
26
|
+
externalIdentities: z.array(externalIdentityReferenceSchema),
|
|
27
|
+
redirectedUserIds: z.array(z.string()),
|
|
28
|
+
}).superRefine((value, context) => {
|
|
29
|
+
if (value.externalIdentity.userId !== value.user.id) {
|
|
30
|
+
context.addIssue({ code: z.ZodIssueCode.custom, path: ['externalIdentity', 'userId'], message: 'Canonical user id does not match profile' });
|
|
31
|
+
}
|
|
32
|
+
if (!value.externalIdentities.some(identity => identity.actorUri === value.externalIdentity.actorUri
|
|
33
|
+
&& identity.canonicalAcct === value.externalIdentity.canonicalAcct
|
|
34
|
+
&& identity.sourceUserId === value.externalIdentity.sourceUserId)) {
|
|
35
|
+
context.addIssue({ code: z.ZodIssueCode.custom, path: ['externalIdentity'], message: 'Resolved source is absent from authoritative identities' });
|
|
36
|
+
}
|
|
37
|
+
if (!value.externalIdentities.some(identity => identity.canonicalAcct === value.user.username)) {
|
|
38
|
+
context.addIssue({ code: z.ZodIssueCode.custom, path: ['user', 'username'], message: 'Profile handle is not an authoritative identity' });
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
export const lookupExternalIdentitiesRequestSchema = z.object({ identifiers: z.array(z.string().min(1).max(2048)).min(1).max(100) });
|
|
42
|
+
export const lookupExternalIdentitiesResponseSchema = z.object({
|
|
43
|
+
identities: z.array(z.object({
|
|
44
|
+
identifier: z.string(),
|
|
45
|
+
userId: z.string().nullable(),
|
|
46
|
+
externalIdentities: z.array(externalIdentityReferenceSchema),
|
|
47
|
+
redirectedUserIds: z.array(z.string()),
|
|
48
|
+
})),
|
|
49
|
+
});
|
package/dist/esm/identity.js
CHANGED
|
@@ -168,6 +168,25 @@ export const verifiedDomainSchema = z.object({
|
|
|
168
168
|
export const domainVerificationRequestSchema = z.object({
|
|
169
169
|
domain: z.string().trim().min(1),
|
|
170
170
|
});
|
|
171
|
+
const resourceOriginHostSchema = z
|
|
172
|
+
.string()
|
|
173
|
+
.trim()
|
|
174
|
+
.toLowerCase()
|
|
175
|
+
.pipe(z.string().min(1).max(253).regex(/^(?!-)[a-z0-9-]{1,63}(?<!-)(?:\.(?!-)[a-z0-9-]{1,63}(?<!-))+$/, 'originHost must be a public DNS hostname without scheme, port or path'));
|
|
176
|
+
/** Clarity resource-server request to bind a site to Oxy domain authority. */
|
|
177
|
+
export const resourceDomainOwnershipRequestSchema = z.object({
|
|
178
|
+
accountId: z.string().min(1).max(128),
|
|
179
|
+
verifiedDomainId: z.string().min(1).max(128),
|
|
180
|
+
originHost: resourceOriginHostSchema,
|
|
181
|
+
}).strict();
|
|
182
|
+
export const resourceDomainOwnershipResponseSchema = z.object({
|
|
183
|
+
verified: z.boolean(),
|
|
184
|
+
accountId: z.string().min(1).max(128),
|
|
185
|
+
verifiedDomainId: z.string().min(1).max(128),
|
|
186
|
+
originHost: resourceOriginHostSchema,
|
|
187
|
+
verifiedAt: z.string().datetime().optional(),
|
|
188
|
+
method: z.enum(['dns-txt', 'well-known']).optional(),
|
|
189
|
+
}).strict();
|
|
171
190
|
/**
|
|
172
191
|
* The instructions the API returns when a domain verification is requested. The
|
|
173
192
|
* caller may prove ownership EITHER by publishing the `dns` TXT record OR by
|
package/dist/esm/index.js
CHANGED
|
@@ -31,7 +31,7 @@ export {
|
|
|
31
31
|
recommendationExcludeTypeSchema, recommendationBoostSchema, recommendationSignalWeightsSchema, recommendationRequestSchema, recommendationCountSchema, recommendationItemSchema, recommendationResponseSchema, appEndorsementInputSchema, appInterestInputSchema, appUserSignalIngestSchema, appAffinityEventTypeSchema, appAffinityEventSchema, appAffinityEventsIngestSchema, } from './recommendations.js';
|
|
32
32
|
export {
|
|
33
33
|
// Schemas
|
|
34
|
-
verificationMethodSchema, didServiceSchema, didDocumentSchema, signedRecordEnvelopeSchema, verifiedDomainSchema, domainVerificationRequestSchema, domainVerificationInstructionsSchema, authMethodEntrySchema, authMethodsResponseSchema, exportAttestationSchema, exportUsageReceiptSchema, exportLedgerEntrySchema, exportUsageReservationSchema, exportFinancialSectionSchema, exportBundleSchema, } from './identity.js';
|
|
34
|
+
verificationMethodSchema, didServiceSchema, didDocumentSchema, signedRecordEnvelopeSchema, verifiedDomainSchema, domainVerificationRequestSchema, resourceDomainOwnershipRequestSchema, resourceDomainOwnershipResponseSchema, domainVerificationInstructionsSchema, authMethodEntrySchema, authMethodsResponseSchema, exportAttestationSchema, exportUsageReceiptSchema, exportLedgerEntrySchema, exportUsageReservationSchema, exportFinancialSectionSchema, exportBundleSchema, } from './identity.js';
|
|
35
35
|
export {
|
|
36
36
|
// Schemas
|
|
37
37
|
oxySignedRecordTypeSchema, } from './oxyRecordTypes.js';
|
|
@@ -67,12 +67,9 @@ moderationFindingSchema, moderationDecisionEventSubjectSchema, moderationPolicyV
|
|
|
67
67
|
registerIdentityBindingSchema, identityBindingSchema,
|
|
68
68
|
// Schemas — the derived V2 axes
|
|
69
69
|
reputationPersonhoodSchema, reputationContributionSchema, reputationConductSchema, reputationReportingSchema, reputationReviewingSchema, reputationContextualInfluenceSchema, applicationModerationTrustSchema, } from './moderationReputation.js';
|
|
70
|
-
export {
|
|
71
|
-
// Schemas
|
|
72
|
-
linkPreviewSchema, linkPreviewBatchRequestSchema, linkPreviewBatchResponseSchema, linkPreviewResponseSchema, } from './links.js';
|
|
73
70
|
export { sessionAccountSchema, deviceSessionStateSchema, activeTokenSchema, deviceSessionSyncSchema, deviceTokenMintRequestSchema, deviceTokenMintResponseSchema, deviceBackgroundCredentialResponseSchema, deviceBackgroundTokenRequestSchema, deviceBackgroundTokenResponseSchema, SESSION_ACCOUNTS_CHANGED_EVENT, sessionAccountsChangedReasonSchema, sessionAccountsChangedEventSchema, } from './deviceSession.js';
|
|
74
71
|
export { deviceContextRelationshipSchema, deviceDirectoryProfileSchema, deviceAccountContextSchema, devicePrincipalSchema, deviceDirectorySchema, deviceActivateRequestSchema, deviceActivateResponseSchema, deviceDirectorySyncSchema, } from './deviceDirectory.js';
|
|
75
|
-
export { oauthConsentDecisionSchema, oauthAuthorizeCodeResponseSchema } from './oauth.js';
|
|
72
|
+
export { oauthConsentDecisionSchema, oauthAuthorizeCodeResponseSchema, mcpOAuthClientApplicationSchema, mcpOAuthWriteActionSchema, mcpOAuthConsentContextSchema, mcpOAuthClientInfoResponseSchema, mcpOAuthConsentResponseSchema, } from './oauth.js';
|
|
76
73
|
export { BROWSER_HUB_COOKIE_NAME, BROWSER_HUB_COOKIE_ATTRIBUTES, BROWSER_HUB_HANDLE_TTL_MS, browserHubHandleSchema, browserHubHandleRequestSchema, browserHubHandleResponseSchema, browserHubResolveResponseSchema, browserHubErrorSchema, browserHubRevokeResponseSchema, hubSessionSchema, hubClaimRequestSchema, hubActivateRequestSchema, hubAuthorizeRequestSchema, hubAuthorizeResultSchema, } from './browserHub.js';
|
|
77
74
|
export {
|
|
78
75
|
// Schemas
|
|
@@ -168,6 +165,7 @@ export {
|
|
|
168
165
|
// Product entitlements. Allowances are integer counts and money is an exact
|
|
169
166
|
// decimal, so a plan allowance cannot be added to a balance.
|
|
170
167
|
PRODUCT_PLAN_STATUSES, productPlanStatusSchema, LIVE_PRODUCT_PLAN_STATUSES, planAllowanceSchema, productPlanSchema, payAsYouGoEntitlementSchema, COST_CENTER_STATUSES, costCenterStatusSchema, costCenterSchema, costCenterSpendSchema, productEntitlementSchema, } from './inference/entitlement.js';
|
|
171
|
-
export { AUTONOMY_LEVELS, CAPABILITY_PACKAGES, autonomyLevelSchema, capabilityPackageSchema, actorRefSchema, resourceRefSchema, toolGrantOverrideSchema, grantLimitSchema, executionAuthorizationRefSchema, capabilityCoordinatorSchema, delegationGrantSchema, automationTriggerSchema, automationActorSelectionSchema, automationDataFlowSchema, automationDefinitionSchema, capabilityTicketClaimsSchema, policyDecisionSchema, auditResultSchema, auditEventSchema, catalogToolSchema, catalogEventSchema, appCapabilityCatalogSchema, catalogRegistrationSchema, normalizedAppEventSchema, } from './agency.js';
|
|
168
|
+
export { AUTONOMY_LEVELS, CAPABILITY_PACKAGES, autonomyLevelSchema, capabilityPackageSchema, actorRefSchema, resourceRefSchema, toolGrantOverrideSchema, grantLimitSchema, capabilityCatalogBindingSchema, executionAuthorizationRefSchema, capabilityCoordinatorSchema, delegationGrantSchema, automationTriggerSchema, automationActorSelectionSchema, automationDataFlowSchema, automationDefinitionSchema, capabilityTicketClaimsSchema, policyDecisionSchema, auditResultSchema, auditEventSchema, catalogToolSchema, catalogEventSchema, appCapabilityCatalogSchema, catalogRegistrationSchema, normalizedAppEventSchema, } from './agency.js';
|
|
172
169
|
export { emailContextAddressSchema, emailContextMailboxSchema, emailContextMessageSchema, emailAgentContextSchema, } from './emailAgentContext.js';
|
|
173
170
|
export { inboxComposeRequestSchema, inboxDailyBriefRequestSchema, inboxNaturalSearchRequestSchema, inboxMessageInferenceParamsSchema, inboxInferenceTextResponseSchema, inboxNaturalSearchResponseSchema, inboxSmartRepliesResponseSchema, inboxThreadSummaryResponseSchema, inboxInferenceStreamEventSchema, } from './inference/inbox.js';
|
|
171
|
+
export * from './externalIdentity.js';
|
package/dist/esm/oauth.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { catalogToolSchema } from './agency.js';
|
|
3
|
+
import { publicApplicationSchema } from './sessionStatus.js';
|
|
2
4
|
/**
|
|
3
5
|
* The two `/auth/oauth/*` responses the browser hub's edge layer reads.
|
|
4
6
|
*
|
|
@@ -61,3 +63,50 @@ export const oauthAuthorizeCodeResponseSchema = z.object({
|
|
|
61
63
|
redirectUri: z.string(),
|
|
62
64
|
expiresIn: z.number().int().positive(),
|
|
63
65
|
});
|
|
66
|
+
/**
|
|
67
|
+
* Display-safe identity of a dynamically registered external MCP client.
|
|
68
|
+
* Reuses the ordinary public application projection and adds only the public
|
|
69
|
+
* DCR client id needed to bind the consent surface to the request.
|
|
70
|
+
*/
|
|
71
|
+
export const mcpOAuthClientApplicationSchema = publicApplicationSchema.extend({
|
|
72
|
+
clientId: z.string().min(1),
|
|
73
|
+
}).strict();
|
|
74
|
+
/**
|
|
75
|
+
* An effectful MCP action the requested capability set can actually invoke.
|
|
76
|
+
* Every field is picked from the canonical catalog tool schema so consent can
|
|
77
|
+
* never maintain a second tool description or effect classification.
|
|
78
|
+
*/
|
|
79
|
+
export const mcpOAuthWriteActionSchema = catalogToolSchema.innerType().pick({
|
|
80
|
+
name: true,
|
|
81
|
+
version: true,
|
|
82
|
+
description: true,
|
|
83
|
+
requiredCapabilities: true,
|
|
84
|
+
effect: true,
|
|
85
|
+
}).strict().refine((action) => action.effect !== 'read', {
|
|
86
|
+
message: 'MCP consent write actions must be effectful',
|
|
87
|
+
path: ['effect'],
|
|
88
|
+
});
|
|
89
|
+
/** Exact, server-resolved context rendered before an external MCP grant. */
|
|
90
|
+
export const mcpOAuthConsentContextSchema = z.object({
|
|
91
|
+
client: mcpOAuthClientApplicationSchema,
|
|
92
|
+
account: z.object({
|
|
93
|
+
id: z.string().min(1),
|
|
94
|
+
displayName: z.string().min(1).optional(),
|
|
95
|
+
handle: z.string().min(1).optional(),
|
|
96
|
+
avatar: z.string().min(1).optional(),
|
|
97
|
+
}).strict(),
|
|
98
|
+
resource: z.object({
|
|
99
|
+
appId: z.string().min(1),
|
|
100
|
+
uri: z.string().url(),
|
|
101
|
+
application: publicApplicationSchema,
|
|
102
|
+
}).strict(),
|
|
103
|
+
capabilities: z.array(z.string().min(1)).min(1),
|
|
104
|
+
writeActions: z.array(mcpOAuthWriteActionSchema),
|
|
105
|
+
}).strict();
|
|
106
|
+
export const mcpOAuthClientInfoResponseSchema = z.object({
|
|
107
|
+
application: mcpOAuthClientApplicationSchema,
|
|
108
|
+
}).strict();
|
|
109
|
+
export const mcpOAuthConsentResponseSchema = z.object({
|
|
110
|
+
consentRequired: z.boolean(),
|
|
111
|
+
context: mcpOAuthConsentContextSchema,
|
|
112
|
+
}).strict();
|
package/dist/esm/webauthn.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* These schemas describe ONLY the outer Oxy envelope that wraps a WebAuthn
|
|
5
5
|
* ceremony request — the username the client is registering/authenticating as,
|
|
6
|
-
* plus
|
|
6
|
+
* plus non-authoritative device metadata. The browser
|
|
7
7
|
* `RegistrationResponseJSON` / `AuthenticationResponseJSON` payloads are NOT
|
|
8
8
|
* mirrored here: they are validated by `@simplewebauthn/server` inside the route
|
|
9
9
|
* (`verifyRegistrationResponse` / `verifyAuthenticationResponse`), which is the
|