@absolutejs/agent 0.4.0 → 0.4.2

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 CHANGED
@@ -45,3 +45,12 @@ AuthZEN surfaces while Absolute supplies provider-neutral implementation seams.
45
45
  route. Absolute Auth generates it from the application's authoritative OAuth
46
46
  metadata and implements the flow natively; it is not a WorkOS adapter and does
47
47
  not require a WorkOS service.
48
+
49
+ ## One authenticated delegation
50
+
51
+ `createAuthAgencyDelegationAuthority()` bridges the delegation already verified
52
+ by Absolute Auth directly into Agency. Put an
53
+ `authAgencyAuthorizationDetail()` in the Auth grant to bind its audience,
54
+ canonical actions, effects, resource types, and optional resource IDs. Agency
55
+ then re-reads that same grant before an action request, lease, and execution;
56
+ there is no second grant ID or shadow state to synchronize.
package/dist/actions.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export * from "@absolutejs/agency";
2
+ export * from "./authAgency";
package/dist/actions.js CHANGED
@@ -1,6 +1,66 @@
1
1
  // @bun
2
+ // src/authAgency.ts
3
+ import { Type } from "@sinclair/typebox";
4
+ import { Value } from "@sinclair/typebox/value";
5
+ var AUTH_AGENCY_AUTHORIZATION_DETAIL_TYPE = "urn:absolutejs:authorization-detail:agency-delegation";
6
+ var AuthAgencyAuthorizationDetailSchema = Type.Object({
7
+ actions: Type.Array(Type.String({ minLength: 1 }), { minItems: 1 }),
8
+ audience: Type.String({ minLength: 1 }),
9
+ effects: Type.Array(Type.String({ minLength: 1 }), { minItems: 1 }),
10
+ resourceIds: Type.Optional(Type.Array(Type.String({ minLength: 1 }), { minItems: 1 })),
11
+ resourceTypes: Type.Array(Type.String({ minLength: 1 }), { minItems: 1 }),
12
+ type: Type.Literal(AUTH_AGENCY_AUTHORIZATION_DETAIL_TYPE)
13
+ }, { additionalProperties: false });
14
+ var authAgencyAuthorizationDetail = (detail) => ({
15
+ ...detail,
16
+ type: AUTH_AGENCY_AUTHORIZATION_DETAIL_TYPE
17
+ });
18
+ var subset = (required, available) => required.every((value) => available.includes(value));
19
+ var audienceOf = (action) => {
20
+ const audience = action.context?.audience;
21
+ return typeof audience === "string" ? audience : undefined;
22
+ };
23
+ var activeDelegation = async (store, action, now) => {
24
+ const { delegationId } = action.actor;
25
+ if (!delegationId)
26
+ throw new Error("Agency action requires a delegation");
27
+ const delegation = await store.findByDelegationId(delegationId);
28
+ if (!delegation)
29
+ throw new Error("Unknown authenticated delegation");
30
+ if (delegation.status !== "active")
31
+ throw new Error("Authenticated delegation is revoked");
32
+ if (delegation.expiresAt !== undefined && delegation.expiresAt <= now)
33
+ throw new Error("Authenticated delegation is expired");
34
+ return delegation;
35
+ };
36
+ var assertActor = (action, delegation) => {
37
+ if (action.actor.agentId !== delegation.agentId || action.actor.userId !== delegation.userId || action.actor.organizationId !== delegation.organizationId)
38
+ throw new Error("Agency actor does not match authenticated delegation");
39
+ if (!subset(action.actor.scopes, delegation.scopes))
40
+ throw new Error("Agency actor scopes exceed authenticated delegation");
41
+ };
42
+ var authorizationDetails = (delegation) => (delegation.authorizationDetails ?? []).filter((detail) => Value.Check(AuthAgencyAuthorizationDetailSchema, detail));
43
+ var detailAllows = (detail, action) => detail.audience === audienceOf(action) && detail.actions.includes(action.action) && subset(action.effects, detail.effects) && detail.resourceTypes.includes(action.resource.type) && (!detail.resourceIds || detail.resourceIds.includes(action.resource.id));
44
+ var createAuthAgencyDelegationAuthority = (options) => ({
45
+ assertAllows: async (action) => {
46
+ const delegation = await activeDelegation(options.store, action, (options.now ?? Date.now)());
47
+ assertActor(action, delegation);
48
+ if (!authorizationDetails(delegation).some((detail) => detailAllows(detail, action)))
49
+ throw new Error("Agency action is outside authenticated delegation");
50
+ return {
51
+ ...delegation.expiresAt === undefined ? {} : { expiresAt: delegation.expiresAt }
52
+ };
53
+ }
54
+ });
55
+
2
56
  // src/actions.ts
3
57
  export * from "@absolutejs/agency";
58
+ export {
59
+ createAuthAgencyDelegationAuthority,
60
+ authAgencyAuthorizationDetail,
61
+ AuthAgencyAuthorizationDetailSchema,
62
+ AUTH_AGENCY_AUTHORIZATION_DETAIL_TYPE
63
+ };
4
64
 
5
- //# debugId=A280C5CD9E78AED364756E2164756E21
65
+ //# debugId=C399317D4FE0652364756E2164756E21
6
66
  //# sourceMappingURL=actions.js.map
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/actions.ts"],
3
+ "sources": ["../src/authAgency.ts", "../src/actions.ts"],
4
4
  "sourcesContent": [
5
- "export * from \"@absolutejs/agency\";\n"
5
+ "import type { ActionRequestInput } from \"@absolutejs/agency\";\nimport type {\n AgentDelegation,\n AgentDelegationStore,\n} from \"@absolutejs/auth/agents\";\nimport { Type, type Static } from \"@sinclair/typebox\";\nimport { Value } from \"@sinclair/typebox/value\";\n\nexport const AUTH_AGENCY_AUTHORIZATION_DETAIL_TYPE =\n \"urn:absolutejs:authorization-detail:agency-delegation\";\n\nexport const AuthAgencyAuthorizationDetailSchema = Type.Object(\n {\n actions: Type.Array(Type.String({ minLength: 1 }), { minItems: 1 }),\n audience: Type.String({ minLength: 1 }),\n effects: Type.Array(Type.String({ minLength: 1 }), { minItems: 1 }),\n resourceIds: Type.Optional(\n Type.Array(Type.String({ minLength: 1 }), { minItems: 1 }),\n ),\n resourceTypes: Type.Array(Type.String({ minLength: 1 }), { minItems: 1 }),\n type: Type.Literal(AUTH_AGENCY_AUTHORIZATION_DETAIL_TYPE),\n },\n { additionalProperties: false },\n);\n\nexport type AuthAgencyAuthorizationDetail = Static<\n typeof AuthAgencyAuthorizationDetailSchema\n>;\n\nexport const authAgencyAuthorizationDetail = (\n detail: Omit<AuthAgencyAuthorizationDetail, \"type\">,\n): AuthAgencyAuthorizationDetail => ({\n ...detail,\n type: AUTH_AGENCY_AUTHORIZATION_DETAIL_TYPE,\n});\n\nconst subset = (required: readonly string[], available: readonly string[]) =>\n required.every((value) => available.includes(value));\n\nconst audienceOf = (action: ActionRequestInput) => {\n const audience = action.context?.audience;\n\n return typeof audience === \"string\" ? audience : undefined;\n};\n\nconst activeDelegation = async (\n store: AgentDelegationStore,\n action: ActionRequestInput,\n now: number,\n) => {\n const { delegationId } = action.actor;\n\n if (!delegationId) throw new Error(\"Agency action requires a delegation\");\n const delegation = await store.findByDelegationId(delegationId);\n\n if (!delegation) throw new Error(\"Unknown authenticated delegation\");\n if (delegation.status !== \"active\")\n throw new Error(\"Authenticated delegation is revoked\");\n if (delegation.expiresAt !== undefined && delegation.expiresAt <= now)\n throw new Error(\"Authenticated delegation is expired\");\n\n return delegation;\n};\n\nconst assertActor = (\n action: ActionRequestInput,\n delegation: AgentDelegation,\n) => {\n if (\n action.actor.agentId !== delegation.agentId ||\n action.actor.userId !== delegation.userId ||\n action.actor.organizationId !== delegation.organizationId\n )\n throw new Error(\"Agency actor does not match authenticated delegation\");\n if (!subset(action.actor.scopes, delegation.scopes))\n throw new Error(\"Agency actor scopes exceed authenticated delegation\");\n};\n\nconst authorizationDetails = (delegation: AgentDelegation) =>\n (delegation.authorizationDetails ?? []).filter(\n (detail): detail is AuthAgencyAuthorizationDetail =>\n Value.Check(AuthAgencyAuthorizationDetailSchema, detail),\n );\n\nconst detailAllows = (\n detail: AuthAgencyAuthorizationDetail,\n action: ActionRequestInput,\n) =>\n detail.audience === audienceOf(action) &&\n detail.actions.includes(action.action) &&\n subset(action.effects, detail.effects) &&\n detail.resourceTypes.includes(action.resource.type) &&\n (!detail.resourceIds || detail.resourceIds.includes(action.resource.id));\n\n/** Bridges Absolute Auth's verified principal grant directly into Agency.\n * The same delegation ID is re-read at request, lease, and execution time; no\n * shadow grant or manual synchronization is required. */\nexport const createAuthAgencyDelegationAuthority = (options: {\n now?: () => number;\n store: AgentDelegationStore;\n}) => ({\n assertAllows: async (action: ActionRequestInput) => {\n const delegation = await activeDelegation(\n options.store,\n action,\n (options.now ?? Date.now)(),\n );\n assertActor(action, delegation);\n if (!authorizationDetails(delegation).some((detail) => detailAllows(detail, action)))\n throw new Error(\"Agency action is outside authenticated delegation\");\n\n return {\n ...(delegation.expiresAt === undefined\n ? {}\n : { expiresAt: delegation.expiresAt }),\n };\n },\n});\n",
6
+ "export * from \"@absolutejs/agency\";\nexport * from \"./authAgency\";\n"
6
7
  ],
7
- "mappings": ";;AAAA;",
8
- "debugId": "A280C5CD9E78AED364756E2164756E21",
8
+ "mappings": ";;AAKA;AACA;AAEO,IAAM,wCACX;AAEK,IAAM,sCAAsC,KAAK,OACtD;AAAA,EACE,SAAS,KAAK,MAAM,KAAK,OAAO,EAAE,WAAW,EAAE,CAAC,GAAG,EAAE,UAAU,EAAE,CAAC;AAAA,EAClE,UAAU,KAAK,OAAO,EAAE,WAAW,EAAE,CAAC;AAAA,EACtC,SAAS,KAAK,MAAM,KAAK,OAAO,EAAE,WAAW,EAAE,CAAC,GAAG,EAAE,UAAU,EAAE,CAAC;AAAA,EAClE,aAAa,KAAK,SAChB,KAAK,MAAM,KAAK,OAAO,EAAE,WAAW,EAAE,CAAC,GAAG,EAAE,UAAU,EAAE,CAAC,CAC3D;AAAA,EACA,eAAe,KAAK,MAAM,KAAK,OAAO,EAAE,WAAW,EAAE,CAAC,GAAG,EAAE,UAAU,EAAE,CAAC;AAAA,EACxE,MAAM,KAAK,QAAQ,qCAAqC;AAC1D,GACA,EAAE,sBAAsB,MAAM,CAChC;AAMO,IAAM,gCAAgC,CAC3C,YACmC;AAAA,KAChC;AAAA,EACH,MAAM;AACR;AAEA,IAAM,SAAS,CAAC,UAA6B,cAC3C,SAAS,MAAM,CAAC,UAAU,UAAU,SAAS,KAAK,CAAC;AAErD,IAAM,aAAa,CAAC,WAA+B;AAAA,EACjD,MAAM,WAAW,OAAO,SAAS;AAAA,EAEjC,OAAO,OAAO,aAAa,WAAW,WAAW;AAAA;AAGnD,IAAM,mBAAmB,OACvB,OACA,QACA,QACG;AAAA,EACH,QAAQ,iBAAiB,OAAO;AAAA,EAEhC,IAAI,CAAC;AAAA,IAAc,MAAM,IAAI,MAAM,qCAAqC;AAAA,EACxE,MA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AAO;AAAA,SACD,WAAW,cAAc,YACzB,CAAC,IACD,EAAE,WAAW,WAAW,UAAU;AAAA,IACxC;AAAA;AAEJ;;;ACrHA;",
9
+ "debugId": "C399317D4FE0652364756E2164756E21",
9
10
  "names": []
10
11
  }
@@ -0,0 +1,25 @@
1
+ import type { ActionRequestInput } from "@absolutejs/agency";
2
+ import type { AgentDelegationStore } from "@absolutejs/auth/agents";
3
+ import { type Static } from "@sinclair/typebox";
4
+ export declare const AUTH_AGENCY_AUTHORIZATION_DETAIL_TYPE = "urn:absolutejs:authorization-detail:agency-delegation";
5
+ export declare const AuthAgencyAuthorizationDetailSchema: import("@sinclair/typebox").TObject<{
6
+ actions: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
7
+ audience: import("@sinclair/typebox").TString;
8
+ effects: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
9
+ resourceIds: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
10
+ resourceTypes: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
11
+ type: import("@sinclair/typebox").TLiteral<"urn:absolutejs:authorization-detail:agency-delegation">;
12
+ }>;
13
+ export type AuthAgencyAuthorizationDetail = Static<typeof AuthAgencyAuthorizationDetailSchema>;
14
+ export declare const authAgencyAuthorizationDetail: (detail: Omit<AuthAgencyAuthorizationDetail, "type">) => AuthAgencyAuthorizationDetail;
15
+ /** Bridges Absolute Auth's verified principal grant directly into Agency.
16
+ * The same delegation ID is re-read at request, lease, and execution time; no
17
+ * shadow grant or manual synchronization is required. */
18
+ export declare const createAuthAgencyDelegationAuthority: (options: {
19
+ now?: () => number;
20
+ store: AgentDelegationStore;
21
+ }) => {
22
+ assertAllows: (action: ActionRequestInput) => Promise<{
23
+ expiresAt?: number | undefined;
24
+ }>;
25
+ };
@@ -0,0 +1,63 @@
1
+ // @bun
2
+ // src/authAgency.ts
3
+ import { Type } from "@sinclair/typebox";
4
+ import { Value } from "@sinclair/typebox/value";
5
+ var AUTH_AGENCY_AUTHORIZATION_DETAIL_TYPE = "urn:absolutejs:authorization-detail:agency-delegation";
6
+ var AuthAgencyAuthorizationDetailSchema = Type.Object({
7
+ actions: Type.Array(Type.String({ minLength: 1 }), { minItems: 1 }),
8
+ audience: Type.String({ minLength: 1 }),
9
+ effects: Type.Array(Type.String({ minLength: 1 }), { minItems: 1 }),
10
+ resourceIds: Type.Optional(Type.Array(Type.String({ minLength: 1 }), { minItems: 1 })),
11
+ resourceTypes: Type.Array(Type.String({ minLength: 1 }), { minItems: 1 }),
12
+ type: Type.Literal(AUTH_AGENCY_AUTHORIZATION_DETAIL_TYPE)
13
+ }, { additionalProperties: false });
14
+ var authAgencyAuthorizationDetail = (detail) => ({
15
+ ...detail,
16
+ type: AUTH_AGENCY_AUTHORIZATION_DETAIL_TYPE
17
+ });
18
+ var subset = (required, available) => required.every((value) => available.includes(value));
19
+ var audienceOf = (action) => {
20
+ const audience = action.context?.audience;
21
+ return typeof audience === "string" ? audience : undefined;
22
+ };
23
+ var activeDelegation = async (store, action, now) => {
24
+ const { delegationId } = action.actor;
25
+ if (!delegationId)
26
+ throw new Error("Agency action requires a delegation");
27
+ const delegation = await store.findByDelegationId(delegationId);
28
+ if (!delegation)
29
+ throw new Error("Unknown authenticated delegation");
30
+ if (delegation.status !== "active")
31
+ throw new Error("Authenticated delegation is revoked");
32
+ if (delegation.expiresAt !== undefined && delegation.expiresAt <= now)
33
+ throw new Error("Authenticated delegation is expired");
34
+ return delegation;
35
+ };
36
+ var assertActor = (action, delegation) => {
37
+ if (action.actor.agentId !== delegation.agentId || action.actor.userId !== delegation.userId || action.actor.organizationId !== delegation.organizationId)
38
+ throw new Error("Agency actor does not match authenticated delegation");
39
+ if (!subset(action.actor.scopes, delegation.scopes))
40
+ throw new Error("Agency actor scopes exceed authenticated delegation");
41
+ };
42
+ var authorizationDetails = (delegation) => (delegation.authorizationDetails ?? []).filter((detail) => Value.Check(AuthAgencyAuthorizationDetailSchema, detail));
43
+ var detailAllows = (detail, action) => detail.audience === audienceOf(action) && detail.actions.includes(action.action) && subset(action.effects, detail.effects) && detail.resourceTypes.includes(action.resource.type) && (!detail.resourceIds || detail.resourceIds.includes(action.resource.id));
44
+ var createAuthAgencyDelegationAuthority = (options) => ({
45
+ assertAllows: async (action) => {
46
+ const delegation = await activeDelegation(options.store, action, (options.now ?? Date.now)());
47
+ assertActor(action, delegation);
48
+ if (!authorizationDetails(delegation).some((detail) => detailAllows(detail, action)))
49
+ throw new Error("Agency action is outside authenticated delegation");
50
+ return {
51
+ ...delegation.expiresAt === undefined ? {} : { expiresAt: delegation.expiresAt }
52
+ };
53
+ }
54
+ });
55
+ export {
56
+ createAuthAgencyDelegationAuthority,
57
+ authAgencyAuthorizationDetail,
58
+ AuthAgencyAuthorizationDetailSchema,
59
+ AUTH_AGENCY_AUTHORIZATION_DETAIL_TYPE
60
+ };
61
+
62
+ //# debugId=E0B3B1639AE88DFF64756E2164756E21
63
+ //# sourceMappingURL=authAgency.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/authAgency.ts"],
4
+ "sourcesContent": [
5
+ "import type { ActionRequestInput } from \"@absolutejs/agency\";\nimport type {\n AgentDelegation,\n AgentDelegationStore,\n} from \"@absolutejs/auth/agents\";\nimport { Type, type Static } from \"@sinclair/typebox\";\nimport { Value } from \"@sinclair/typebox/value\";\n\nexport const AUTH_AGENCY_AUTHORIZATION_DETAIL_TYPE =\n \"urn:absolutejs:authorization-detail:agency-delegation\";\n\nexport const AuthAgencyAuthorizationDetailSchema = Type.Object(\n {\n actions: Type.Array(Type.String({ minLength: 1 }), { minItems: 1 }),\n audience: Type.String({ minLength: 1 }),\n effects: Type.Array(Type.String({ minLength: 1 }), { minItems: 1 }),\n resourceIds: Type.Optional(\n Type.Array(Type.String({ minLength: 1 }), { minItems: 1 }),\n ),\n resourceTypes: Type.Array(Type.String({ minLength: 1 }), { minItems: 1 }),\n type: Type.Literal(AUTH_AGENCY_AUTHORIZATION_DETAIL_TYPE),\n },\n { additionalProperties: false },\n);\n\nexport type AuthAgencyAuthorizationDetail = Static<\n typeof AuthAgencyAuthorizationDetailSchema\n>;\n\nexport const authAgencyAuthorizationDetail = (\n detail: Omit<AuthAgencyAuthorizationDetail, \"type\">,\n): AuthAgencyAuthorizationDetail => ({\n ...detail,\n type: AUTH_AGENCY_AUTHORIZATION_DETAIL_TYPE,\n});\n\nconst subset = (required: readonly string[], available: readonly string[]) =>\n required.every((value) => available.includes(value));\n\nconst audienceOf = (action: ActionRequestInput) => {\n const audience = action.context?.audience;\n\n return typeof audience === \"string\" ? audience : undefined;\n};\n\nconst activeDelegation = async (\n store: AgentDelegationStore,\n action: ActionRequestInput,\n now: number,\n) => {\n const { delegationId } = action.actor;\n\n if (!delegationId) throw new Error(\"Agency action requires a delegation\");\n const delegation = await store.findByDelegationId(delegationId);\n\n if (!delegation) throw new Error(\"Unknown authenticated delegation\");\n if (delegation.status !== \"active\")\n throw new Error(\"Authenticated delegation is revoked\");\n if (delegation.expiresAt !== undefined && delegation.expiresAt <= now)\n throw new Error(\"Authenticated delegation is expired\");\n\n return delegation;\n};\n\nconst assertActor = (\n action: ActionRequestInput,\n delegation: AgentDelegation,\n) => {\n if (\n action.actor.agentId !== delegation.agentId ||\n action.actor.userId !== delegation.userId ||\n action.actor.organizationId !== delegation.organizationId\n )\n throw new Error(\"Agency actor does not match authenticated delegation\");\n if (!subset(action.actor.scopes, delegation.scopes))\n throw new Error(\"Agency actor scopes exceed authenticated delegation\");\n};\n\nconst authorizationDetails = (delegation: AgentDelegation) =>\n (delegation.authorizationDetails ?? []).filter(\n (detail): detail is AuthAgencyAuthorizationDetail =>\n Value.Check(AuthAgencyAuthorizationDetailSchema, detail),\n );\n\nconst detailAllows = (\n detail: AuthAgencyAuthorizationDetail,\n action: ActionRequestInput,\n) =>\n detail.audience === audienceOf(action) &&\n detail.actions.includes(action.action) &&\n subset(action.effects, detail.effects) &&\n detail.resourceTypes.includes(action.resource.type) &&\n (!detail.resourceIds || detail.resourceIds.includes(action.resource.id));\n\n/** Bridges Absolute Auth's verified principal grant directly into Agency.\n * The same delegation ID is re-read at request, lease, and execution time; no\n * shadow grant or manual synchronization is required. */\nexport const createAuthAgencyDelegationAuthority = (options: {\n now?: () => number;\n store: AgentDelegationStore;\n}) => ({\n assertAllows: async (action: ActionRequestInput) => {\n const delegation = await activeDelegation(\n options.store,\n action,\n (options.now ?? Date.now)(),\n );\n assertActor(action, delegation);\n if (!authorizationDetails(delegation).some((detail) => detailAllows(detail, action)))\n throw new Error(\"Agency action is outside authenticated delegation\");\n\n return {\n ...(delegation.expiresAt === undefined\n ? {}\n : { expiresAt: delegation.expiresAt }),\n };\n },\n});\n"
6
+ ],
7
+ "mappings": ";;AAKA;AACA;AAEO,IAAM,wCACX;AAEK,IAAM,sCAAsC,KAAK,OACtD;AAAA,EACE,SAAS,KAAK,MAAM,KAAK,OAAO,EAAE,WAAW,EAAE,CAAC,GAAG,EAAE,UAAU,EAAE,CAAC;AAAA,EAClE,UAAU,KAAK,OAAO,EAAE,WAAW,EAAE,CAAC;AAAA,EACtC,SAAS,KAAK,MAAM,KAAK,OAAO,EAAE,WAAW,EAAE,CAAC,GAAG,EAAE,UAAU,EAAE,CAAC;AAAA,EAClE,aAAa,KAAK,SAChB,KAAK,MAAM,KAAK,OAAO,EAAE,WAAW,EAAE,CAAC,GAAG,EAAE,UAAU,EAAE,CAAC,CAC3D;AAAA,EACA,eAAe,KAAK,MAAM,KAAK,OAAO,EAAE,WAAW,EAAE,CAAC,GAAG,EAAE,UAAU,EAAE,CAAC;AAAA,EACxE,MAAM,KAAK,QAAQ,qCAAqC;AAC1D,GACA,EAAE,sBAAsB,MAAM,CAChC;AAMO,IAAM,gCAAgC,CAC3C,YACmC;AAAA,KAChC;AAAA,EACH,MAAM;AACR;AAEA,IAAM,SAAS,CAAC,UAA6B,cAC3C,SAAS,MAAM,CAAC,UAAU,UAAU,SAAS,KAAK,C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Ac,OAAO,WAA+B;AAAA,IAClD,MAAM,aAAa,MAAM,iBACvB,QAAQ,OACR,SACC,QAAQ,OAAO,KAAK,KAAK,CAC5B;AAAA,IACA,YAAY,QAAQ,UAAU;AAAA,IAC9B,IAAI,CAAC,qBAAqB,UAAU,EAAE,KAAK,CAAC,WAAW,aAAa,QAAQ,MAAM,CAAC;AAAA,MACjF,MAAM,IAAI,MAAM,mDAAmD;AAAA,IAErE,OAAO;AAAA,SACD,WAAW,cAAc,YACzB,CAAC,IACD,EAAE,WAAW,WAAW,UAAU;AAAA,IACxC;AAAA;AAEJ;",
8
+ "debugId": "E0B3B1639AE88DFF64756E2164756E21",
9
+ "names": []
10
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/agent",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "The production-grade, provider-neutral agent stack for AbsoluteJS: auth, actions, runtime, sandboxing, trust, memory, inbox, discovery, MCP, A2A, policy, wallet limits, controls, and conformance.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -121,7 +121,7 @@
121
121
  "release": "bun run format && bun run check:package && npm publish --access public"
122
122
  },
123
123
  "dependencies": {
124
- "@absolutejs/a2a": "^0.2.0",
124
+ "@absolutejs/a2a": "^0.2.1",
125
125
  "@absolutejs/agency": "^0.5.0",
126
126
  "@absolutejs/agent-conformance": "^0.4.0",
127
127
  "@absolutejs/agent-control": "^0.4.0",
@@ -134,9 +134,9 @@
134
134
  "@absolutejs/auth": "^0.56.0",
135
135
  "@absolutejs/execution": "^0.2.0",
136
136
  "@absolutejs/manifest": "^0.3.0",
137
- "@absolutejs/mcp": "^0.10.1",
137
+ "@absolutejs/mcp": "^0.10.2",
138
138
  "@absolutejs/policy": "^0.2.0",
139
- "@absolutejs/wallet": "^0.3.0",
139
+ "@absolutejs/wallet": "^0.3.2",
140
140
  "@sinclair/typebox": "^0.34.0"
141
141
  },
142
142
  "devDependencies": {