@ouispec/agent-core 0.0.0-stage → 0.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.
Files changed (112) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +13 -2
  3. package/dist/approval-vectors.json +88 -0
  4. package/dist/approvals/args-hash.d.ts +11 -0
  5. package/dist/approvals/args-hash.d.ts.map +1 -0
  6. package/dist/approvals/args-hash.js +11 -0
  7. package/dist/approvals/args-hash.js.map +1 -0
  8. package/dist/approvals/index.d.ts +3 -0
  9. package/dist/approvals/index.d.ts.map +1 -0
  10. package/dist/approvals/index.js +3 -0
  11. package/dist/approvals/index.js.map +1 -0
  12. package/dist/approvals/types.d.ts +16 -0
  13. package/dist/approvals/types.d.ts.map +1 -0
  14. package/dist/approvals/types.js +18 -0
  15. package/dist/approvals/types.js.map +1 -0
  16. package/dist/browser.d.ts +8 -0
  17. package/dist/browser.d.ts.map +1 -0
  18. package/dist/browser.js +8 -0
  19. package/dist/browser.js.map +1 -0
  20. package/dist/entities/index.d.ts +2 -0
  21. package/dist/entities/index.d.ts.map +1 -0
  22. package/dist/entities/index.js +2 -0
  23. package/dist/entities/index.js.map +1 -0
  24. package/dist/entity/base.d.ts +81 -0
  25. package/dist/entity/base.d.ts.map +1 -0
  26. package/dist/entity/base.js +147 -0
  27. package/dist/entity/base.js.map +1 -0
  28. package/dist/entity/index.d.ts +6 -0
  29. package/dist/entity/index.d.ts.map +1 -0
  30. package/dist/entity/index.js +3 -0
  31. package/dist/entity/index.js.map +1 -0
  32. package/dist/entity/protocol.d.ts +45 -0
  33. package/dist/entity/protocol.d.ts.map +1 -0
  34. package/dist/entity/protocol.js +2 -0
  35. package/dist/entity/protocol.js.map +1 -0
  36. package/dist/entity/registry.d.ts +90 -0
  37. package/dist/entity/registry.d.ts.map +1 -0
  38. package/dist/entity/registry.js +274 -0
  39. package/dist/entity/registry.js.map +1 -0
  40. package/dist/entity/types.d.ts +102 -0
  41. package/dist/entity/types.d.ts.map +1 -0
  42. package/dist/entity/types.js +2 -0
  43. package/dist/entity/types.js.map +1 -0
  44. package/dist/index.d.ts +9 -0
  45. package/dist/index.d.ts.map +1 -0
  46. package/dist/index.js +9 -0
  47. package/dist/index.js.map +1 -0
  48. package/dist/intents/index.d.ts +2 -0
  49. package/dist/intents/index.d.ts.map +1 -0
  50. package/dist/intents/index.js +2 -0
  51. package/dist/intents/index.js.map +1 -0
  52. package/dist/protocol/index.d.ts +163 -0
  53. package/dist/protocol/index.d.ts.map +1 -0
  54. package/dist/protocol/index.js +106 -0
  55. package/dist/protocol/index.js.map +1 -0
  56. package/dist/schema/compiler.d.ts +9 -0
  57. package/dist/schema/compiler.d.ts.map +1 -0
  58. package/dist/schema/compiler.js +234 -0
  59. package/dist/schema/compiler.js.map +1 -0
  60. package/dist/schema/index.d.ts +5 -0
  61. package/dist/schema/index.d.ts.map +1 -0
  62. package/dist/schema/index.js +4 -0
  63. package/dist/schema/index.js.map +1 -0
  64. package/dist/schema/loader.d.ts +7 -0
  65. package/dist/schema/loader.d.ts.map +1 -0
  66. package/dist/schema/loader.js +117 -0
  67. package/dist/schema/loader.js.map +1 -0
  68. package/dist/schema/types.d.ts +187 -0
  69. package/dist/schema/types.d.ts.map +1 -0
  70. package/dist/schema/types.js +2 -0
  71. package/dist/schema/types.js.map +1 -0
  72. package/dist/schema/validator.d.ts +7 -0
  73. package/dist/schema/validator.d.ts.map +1 -0
  74. package/dist/schema/validator.js +142 -0
  75. package/dist/schema/validator.js.map +1 -0
  76. package/dist/types/api-surface.d.ts +169 -0
  77. package/dist/types/api-surface.d.ts.map +1 -0
  78. package/dist/types/api-surface.js +6 -0
  79. package/dist/types/api-surface.js.map +1 -0
  80. package/dist/types/client-config.d.ts +244 -0
  81. package/dist/types/client-config.d.ts.map +1 -0
  82. package/dist/types/client-config.js +14 -0
  83. package/dist/types/client-config.js.map +1 -0
  84. package/dist/types/index.d.ts +7 -0
  85. package/dist/types/index.d.ts.map +1 -0
  86. package/dist/types/index.js +2 -0
  87. package/dist/types/index.js.map +1 -0
  88. package/dist/types/llm-types.d.ts +76 -0
  89. package/dist/types/llm-types.d.ts.map +1 -0
  90. package/dist/types/llm-types.js +5 -0
  91. package/dist/types/llm-types.js.map +1 -0
  92. package/dist/types/registry-types.d.ts +58 -0
  93. package/dist/types/registry-types.d.ts.map +1 -0
  94. package/dist/types/registry-types.js +5 -0
  95. package/dist/types/registry-types.js.map +1 -0
  96. package/dist/types/schema-types.d.ts +142 -0
  97. package/dist/types/schema-types.d.ts.map +1 -0
  98. package/dist/types/schema-types.js +6 -0
  99. package/dist/types/schema-types.js.map +1 -0
  100. package/dist/types/service-types.d.ts +165 -0
  101. package/dist/types/service-types.d.ts.map +1 -0
  102. package/dist/types/service-types.js +6 -0
  103. package/dist/types/service-types.js.map +1 -0
  104. package/dist/ui-surface/index.d.ts +12 -0
  105. package/dist/ui-surface/index.d.ts.map +1 -0
  106. package/dist/ui-surface/index.js +2 -0
  107. package/dist/ui-surface/index.js.map +1 -0
  108. package/dist/ui-surface/schema.d.ts +144 -0
  109. package/dist/ui-surface/schema.d.ts.map +1 -0
  110. package/dist/ui-surface/schema.js +10 -0
  111. package/dist/ui-surface/schema.js.map +1 -0
  112. package/package.json +50 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Closure Studio
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,14 @@
1
- # Temporary Holding Version
1
+ # @ouispec/agent-core
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ What the rest of the agent SDK shares: the turn protocol's event names and payload types, the schema and entity types a product's tools are declared with, intent resolution, the UI-surface types a tab sends with a turn, and the approval types and `argsHash` an irreversible call is bound by.
4
+
5
+ ```sh
6
+ npm install @ouispec/agent-core
7
+ ```
8
+
9
+ It has no runtime of its own. `@ouispec/agent-worker` (the agent), `@ouispec/agent-realtime` (the server between the agent and the browser) and `@ouispec/agent-react` (the browser) build on it, and all four release together under one version.
10
+
11
+ - The turn events come from `@ouispec/agent-events`, and the approval messages from `@ouispec/contract`'s `approvals.json`.
12
+ - `argsHash` and the approval rules are `oui-spec`'s. `@ouispec/agent-core/approval-vectors.json` re-exports its test vectors, so an engine in another language can hold its own hash to them.
13
+
14
+ See [the integrator guide](https://github.com/wesreid/oui/blob/main/packages/contract/INTEGRATOR-GUIDE.md) for how the pieces fit, and [VERSIONING.md](https://github.com/wesreid/oui/blob/main/VERSIONING.md) for what a release may change.
@@ -0,0 +1,88 @@
1
+ {
2
+ "version": 1,
3
+ "algorithm": "SHA-256 over the RFC 8785 (JCS) canonical JSON of the value, UTF-8 encoded; lowercase hex",
4
+ "use": "The approval args hash. Every implementation (an agent runtime, an approval store, the browser runtime, a gateway in another language) parses each `json`, canonicalizes it to exactly `canonical`, and hashes it to exactly `sha256`; it refuses every `invalid` input.",
5
+ "provenance": "Canonical forms derived by hand from RFC 8785 §3.2 and Appendix B; hashes computed with Python hashlib over those forms, independently of any implementation under test.",
6
+ "vectors": [
7
+ {
8
+ "name": "key order",
9
+ "json": "{\"b\":2,\"a\":1,\"c\":{\"z\":true,\"y\":null,\"x\":[3,2,1]}}",
10
+ "canonical": "{\"a\":1,\"b\":2,\"c\":{\"x\":[3,2,1],\"y\":null,\"z\":true}}",
11
+ "sha256": "a3e834099e840d9028fa0c005d117ffd5ae99f8275223ae3b64121241290958d"
12
+ },
13
+ {
14
+ "name": "key order by UTF-16 code units, not code points (RFC 8785 §3.2.3)",
15
+ "json": "{\"\\u20ac\":\"Euro Sign\",\"\\r\":\"Carriage Return\",\"\\ufb33\":\"Hebrew Letter Dalet With Dagesh\",\"1\":\"One\",\"\\ud83d\\ude00\":\"Emoji: Grinning Face\",\"\\u0080\":\"Control\",\"\\u00f6\":\"Latin Small Letter O With Diaeresis\"}",
16
+ "canonical": "{\"\\r\":\"Carriage Return\",\"1\":\"One\",\"€\":\"Control\",\"ö\":\"Latin Small Letter O With Diaeresis\",\"€\":\"Euro Sign\",\"😀\":\"Emoji: Grinning Face\",\"דּ\":\"Hebrew Letter Dalet With Dagesh\"}",
17
+ "sha256": "5e321556d22018a9656991a9e94f77ec175fa193e52a2429d312f8419ec8b08c"
18
+ },
19
+ {
20
+ "name": "key order with digits, capitals and underscore",
21
+ "json": "{\"aa\":1,\"a\":2,\"b\":3,\"A\":4,\"_\":5,\"10\":6,\"9\":7}",
22
+ "canonical": "{\"10\":6,\"9\":7,\"A\":4,\"_\":5,\"a\":2,\"aa\":1,\"b\":3}",
23
+ "sha256": "e395d6cbc8557fd7b4e4dd42af7c48c30fb4d5ec7da43567ccf39bc322ff9804"
24
+ },
25
+ {
26
+ "name": "RFC 8785 §3.2.2 example: numbers, string escapes, literals",
27
+ "json": "{\"numbers\":[333333333.33333329,1E30,4.50,2e-3,0.000000000000000000000000001],\"string\":\"\\u20ac$\\u000F\\u000aA'\\u0042\\u0022\\u005c\\\\\\\"\\/\",\"literals\":[null,true,false]}",
28
+ "canonical": "{\"literals\":[null,true,false],\"numbers\":[333333333.3333333,1e+30,4.5,0.002,1e-27],\"string\":\"€$\\u000f\\nA'B\\\"\\\\\\\\\\\"/\"}",
29
+ "sha256": "2d5e01a318d0f0879ab568c4be289c8b1f64ef8921a53c6277d5e069978baacb"
30
+ },
31
+ {
32
+ "name": "numbers: RFC 8785 Appendix B and ECMAScript formatting",
33
+ "json": "[0,-0,5e-324,-5e-324,1.7976931348623157e308,9007199254740992,1e21,999999999999999900000,0.000001,9.999999999999997e-7,1e-7,100,1.5,-1.5,123456789012345680000,1E2,0.1,-0.0000123]",
34
+ "canonical": "[0,0,5e-324,-5e-324,1.7976931348623157e+308,9007199254740992,1e+21,999999999999999900000,0.000001,9.999999999999997e-7,1e-7,100,1.5,-1.5,123456789012345680000,100,0.1,-0.0000123]",
35
+ "sha256": "6f4a14dff8d80f1da955de6c0dc2099dd8a65c8538b4cbcabf4dbf92323832d6"
36
+ },
37
+ {
38
+ "name": "nested arrays",
39
+ "json": "{\"a\":[[],[[]],[1,[2,[3,{}]]],[{\"b\":[],\"a\":{}}]]}",
40
+ "canonical": "{\"a\":[[],[[]],[1,[2,[3,{}]]],[{\"a\":{},\"b\":[]}]]}",
41
+ "sha256": "f5cb025d9d4301d5b460a2919d5d5c21856faef0fba5a987555d8be6e36cfc1a"
42
+ },
43
+ {
44
+ "name": "empty object",
45
+ "json": "{}",
46
+ "canonical": "{}",
47
+ "sha256": "44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a"
48
+ },
49
+ {
50
+ "name": "empty members",
51
+ "json": "{ \"c\" : \"\", \"b\" : [ ], \"a\" : { } }",
52
+ "canonical": "{\"a\":{},\"b\":[],\"c\":\"\"}",
53
+ "sha256": "e052004170cc85d084722ffe760c499548014bfdbdf5275548b688255770dfc2"
54
+ },
55
+ {
56
+ "name": "Unicode and control characters in strings",
57
+ "json": "{\"s\":\"line1\\nline2\\ttab \\u0000 \\u001f \\u007f \\u2028 \\b\\f\\r é 中文 \\ud83d\\ude00 \\\"q\\\" \\\\ \\/\"}",
58
+ "canonical": "{\"s\":\"line1\\nline2\\ttab \\u0000 \\u001f  
 \\b\\f\\r é 中文 😀 \\\"q\\\" \\\\ /\"}",
59
+ "sha256": "0704f4e91b2358f88126313e3d01b58887d0222527f54a365f7c47284701f77b"
60
+ },
61
+ {
62
+ "name": "a tool call's arguments",
63
+ "json": "{\"to\":\"cfo@desk.example\",\"reportId\":\"q3-2026\",\"amount\":1250.5,\"lines\":[{\"sku\":\"A-1\",\"qty\":2},{\"qty\":1,\"sku\":\"B-7\"}],\"note\":null,\"urgent\":false}",
64
+ "canonical": "{\"amount\":1250.5,\"lines\":[{\"qty\":2,\"sku\":\"A-1\"},{\"qty\":1,\"sku\":\"B-7\"}],\"note\":null,\"reportId\":\"q3-2026\",\"to\":\"cfo@desk.example\",\"urgent\":false}",
65
+ "sha256": "9fca331ee3441ff41fb72daf559bb93cb062624683e896fad0ba11f1ebfa39b3"
66
+ },
67
+ {
68
+ "name": "an order",
69
+ "json": "{\"side\":\"buy\",\"symbol\":\"ACME\",\"quantity\":100,\"limitPrice\":12.34,\"timeInForce\":\"day\"}",
70
+ "canonical": "{\"limitPrice\":12.34,\"quantity\":100,\"side\":\"buy\",\"symbol\":\"ACME\",\"timeInForce\":\"day\"}",
71
+ "sha256": "95d63838fb17517676ce7070891709fc5fdb1bc21bd378f44f20aa1e463d7024"
72
+ }
73
+ ],
74
+ "invalid": [
75
+ {
76
+ "name": "a lone high surrogate",
77
+ "json": "{\"s\":\"\\ud800\"}"
78
+ },
79
+ {
80
+ "name": "a lone low surrogate",
81
+ "json": "{\"s\":\"a\\udc00b\"}"
82
+ },
83
+ {
84
+ "name": "a lone surrogate in a key",
85
+ "json": "{\"\\udbff\":1}"
86
+ }
87
+ ]
88
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The args hash (ADR-0228 §2.3): SHA-256 over the RFC 8785 (JCS) canonical
3
+ * JSON of a call's arguments, lowercase hex.
4
+ *
5
+ * Defined once, in `oui-spec`, where the browser's runtime checks a request
6
+ * against the user's grant, and re-exported here for the worker and the
7
+ * approval store. Every other implementation (the Rust gateway, an engine in
8
+ * another language) is held to `oui-spec/approval-vectors.json`.
9
+ */
10
+ export { argsHash, canonicalJson, ARGS_HASH_PATTERN } from 'oui-spec/spec';
11
+ //# sourceMappingURL=args-hash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"args-hash.d.ts","sourceRoot":"","sources":["../../src/approvals/args-hash.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The args hash (ADR-0228 §2.3): SHA-256 over the RFC 8785 (JCS) canonical
3
+ * JSON of a call's arguments, lowercase hex.
4
+ *
5
+ * Defined once, in `oui-spec`, where the browser's runtime checks a request
6
+ * against the user's grant, and re-exported here for the worker and the
7
+ * approval store. Every other implementation (the Rust gateway, an engine in
8
+ * another language) is held to `oui-spec/approval-vectors.json`.
9
+ */
10
+ export { argsHash, canonicalJson, ARGS_HASH_PATTERN } from 'oui-spec/spec';
11
+ //# sourceMappingURL=args-hash.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"args-hash.js","sourceRoot":"","sources":["../../src/approvals/args-hash.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './args-hash.js';
2
+ export * from './types.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/approvals/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './args-hash.js';
2
+ export * from './types.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/approvals/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { ApprovalChannel } from '@ouispec/contract';
2
+ /**
3
+ * Approvals (ADR-0228): the shapes the worker, the approval store in the
4
+ * realtime server, the browser's approval card and a conversation engine
5
+ * exchange. An irreversible action runs only on an approval the user gave,
6
+ * bound to the exact call by a single-use token.
7
+ */
8
+ /** The client event a user's socket sends when they click the approval card. */
9
+ export declare const APPROVAL_DECIDE_EVENT = "approval:decide";
10
+ /** How long an approval lasts unless its action declares otherwise (ADR-0228 §2.3). */
11
+ export declare const DEFAULT_APPROVAL_TTL_MS: number;
12
+ /** The longest an action may declare an approval lasts. */
13
+ export declare const MAX_APPROVAL_TTL_MS: number;
14
+ export declare const APPROVAL_CHANNELS: readonly ApprovalChannel[];
15
+ export type { ActionRequestApproval, ApprovalChannel, ApprovalContinuation, ApprovalDecidePayload, ApprovalDecideResult, ApprovalDecision, ApprovalEffect, ApprovalGrant, ApprovalPreview, ApprovalPreviewArgument, ApprovalRedeemResult, ApprovalRefusal, ApprovalRefusalReason, ApprovalRequiredEvent, ApprovalStatus, ApprovalTokenClaims, ApprovedCall, PendingApprovalInput, } from '@ouispec/contract';
16
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/approvals/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAyB,eAAe,EAAiB,MAAM,mBAAmB,CAAC;AAE/F;;;;;GAKG;AAEH,gFAAgF;AAChF,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AAEvD,uFAAuF;AACvF,eAAO,MAAM,uBAAuB,QAAa,CAAC;AAClD,2DAA2D;AAC3D,eAAO,MAAM,mBAAmB,QAAc,CAAC;AAE/C,eAAO,MAAM,iBAAiB,EAAE,SAAS,eAAe,EAA4C,CAAC;AAKrG,YAAY,EACV,qBAAqB,EACrB,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,eAAe,EACf,uBAAuB,EACvB,oBAAoB,EACpB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,oBAAoB,GACrB,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Approvals (ADR-0228): the shapes the worker, the approval store in the
3
+ * realtime server, the browser's approval card and a conversation engine
4
+ * exchange. An irreversible action runs only on an approval the user gave,
5
+ * bound to the exact call by a single-use token.
6
+ */
7
+ /** The client event a user's socket sends when they click the approval card. */
8
+ export const APPROVAL_DECIDE_EVENT = 'approval:decide';
9
+ /** How long an approval lasts unless its action declares otherwise (ADR-0228 §2.3). */
10
+ export const DEFAULT_APPROVAL_TTL_MS = 5 * 60_000;
11
+ /** The longest an action may declare an approval lasts. */
12
+ export const MAX_APPROVAL_TTL_MS = 30 * 60_000;
13
+ export const APPROVAL_CHANNELS = ['ui', 'voice', 'phone', 'sms', 'chat'];
14
+ const requestIsOUIs = true;
15
+ const grantIsOUIs = true;
16
+ void requestIsOUIs;
17
+ void grantIsOUIs;
18
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/approvals/types.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AAEH,gFAAgF;AAChF,MAAM,CAAC,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAEvD,uFAAuF;AACvF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,GAAG,MAAM,CAAC;AAClD,2DAA2D;AAC3D,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,GAAG,MAAM,CAAC;AAE/C,MAAM,CAAC,MAAM,iBAAiB,GAA+B,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AA6BrG,MAAM,aAAa,GAAmD,IAAI,CAAC;AAC3E,MAAM,WAAW,GAA0C,IAAI,CAAC;AAChE,KAAK,aAAa,CAAC;AACnB,KAAK,WAAW,CAAC"}
@@ -0,0 +1,8 @@
1
+ export * from './types/index.js';
2
+ export * from './entities/index.js';
3
+ export * from './intents/index.js';
4
+ export * from './protocol/index.js';
5
+ export * from './entity/index.js';
6
+ export * from './ui-surface/index.js';
7
+ export * from './approvals/index.js';
8
+ //# sourceMappingURL=browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,8 @@
1
+ export * from './types/index.js';
2
+ export * from './entities/index.js';
3
+ export * from './intents/index.js';
4
+ export * from './protocol/index.js';
5
+ export * from './entity/index.js';
6
+ export * from './ui-surface/index.js';
7
+ export * from './approvals/index.js';
8
+ //# sourceMappingURL=browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export type { EntityGraph, EntityNode, EntityEdge } from '../types/registry-types.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/entities/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/entities/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,81 @@
1
+ import type { EntityCapabilities, EntityDisplayContext, AgentAction, AgentCommand, AgentCommandResponse, UserObservation, EntityExecuteOptions, Unsubscribe } from './types.js';
2
+ import type { IntentResult } from '../types/api-surface.js';
3
+ import type { AgentEntityProtocol } from './protocol.js';
4
+ import { EntityRegistry } from './registry.js';
5
+ /**
6
+ * AgentEntityBase — the universal base class for entities in the agent SDK.
7
+ *
8
+ * This class is framework-agnostic. React, Vue, Svelte, and vanilla JS integrations
9
+ * all delegate to this base. It provides:
10
+ *
11
+ * HYBRID (default):
12
+ * - execute() — trigger intents through the SDK orchestrator
13
+ * - onTargeted() / onReleased() — receive targeting from agent
14
+ * - onCommandReceived() — receive direct commands from agent
15
+ * - onExecutionComplete() — callback after intent execution
16
+ *
17
+ * FULL BIDIRECTIONAL (opt-in via capabilities.observe = true):
18
+ * - emit() — proactively signal the agent
19
+ * - subscribe() — listen to other entities or agent events
20
+ * - onObserve() — receive ambient user interaction observations
21
+ */
22
+ export declare abstract class AgentEntityBase implements AgentEntityProtocol {
23
+ abstract readonly entityType: string;
24
+ abstract readonly entityId: string;
25
+ abstract readonly intents: string[];
26
+ abstract readonly displayContext: EntityDisplayContext;
27
+ get capabilities(): EntityCapabilities;
28
+ private _isTargeted;
29
+ private _isExecuting;
30
+ private _currentAction;
31
+ private _subscriptions;
32
+ private _registry;
33
+ get isTargeted(): boolean;
34
+ get isExecuting(): boolean;
35
+ get currentAction(): AgentAction | null;
36
+ /**
37
+ * Register this entity with the given registry.
38
+ * Called automatically by framework bindings (React hooks, etc.).
39
+ */
40
+ register(registry?: EntityRegistry): void;
41
+ /**
42
+ * Unregister this entity from its registry.
43
+ * Called automatically on unmount/destroy by framework bindings.
44
+ */
45
+ unregister(): void;
46
+ /**
47
+ * Execute an intent through the SDK. This goes through the orchestrator/service registry,
48
+ * ensuring trajectory capture, precondition checks, and learning signals.
49
+ */
50
+ execute(intentId: string, params?: Record<string, unknown>, options?: EntityExecuteOptions): Promise<IntentResult>;
51
+ /** @internal Called by the registry/orchestrator when this entity is targeted */
52
+ _handleTargeted(action: AgentAction): void;
53
+ /** @internal Called by the registry/orchestrator when targeting is released */
54
+ _handleReleased(): void;
55
+ /** @internal Called by the registry/orchestrator when an intent starts executing */
56
+ _handleExecuting(intentId: string, params: Record<string, unknown>): void;
57
+ /** @internal Called by the registry/orchestrator when execution completes */
58
+ _handleExecutionComplete(intentId: string, result: IntentResult): void;
59
+ /** @internal Called by the registry/orchestrator with a direct command */
60
+ _handleCommand(command: AgentCommand): AgentCommandResponse | Promise<AgentCommandResponse> | void;
61
+ onTargeted?(action: AgentAction): void;
62
+ onReleased?(): void;
63
+ onExecuting?(intentId: string, params: Record<string, unknown>): void;
64
+ onExecutionComplete?(intentId: string, result: IntentResult): void;
65
+ onCommandReceived?(command: AgentCommand): AgentCommandResponse | Promise<AgentCommandResponse> | void;
66
+ /**
67
+ * Emit a signal to the agent. Only available when capabilities.observe is true.
68
+ * Signals are batched and debounced by the registry before reaching the orchestrator.
69
+ */
70
+ emit(signal: string, data?: unknown): void;
71
+ /**
72
+ * Subscribe to events from the registry/agent. Only available when capabilities.observe is true.
73
+ * Returns an unsubscribe function.
74
+ */
75
+ subscribe(event: string, handler: (data: unknown) => void): Unsubscribe;
76
+ /** @internal Called by the registry when a user observation is detected */
77
+ _handleObservation(observation: UserObservation): void;
78
+ onObserve?(observation: UserObservation): void;
79
+ private _cleanupSubscriptions;
80
+ }
81
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/entity/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,oBAAoB,EACpB,WAAW,EACX,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EAEpB,WAAW,EACZ,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C;;;;;;;;;;;;;;;;GAgBG;AACH,8BAAsB,eAAgB,YAAW,mBAAmB;IAClE,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,QAAQ,CAAC,cAAc,EAAE,oBAAoB,CAAC;IAEvD,IAAI,YAAY,IAAI,kBAAkB,CAAe;IAGrD,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,cAAc,CAA4B;IAClD,OAAO,CAAC,cAAc,CAA0B;IAChD,OAAO,CAAC,SAAS,CAA+B;IAEhD,IAAI,UAAU,IAAI,OAAO,CAExB;IAED,IAAI,WAAW,IAAI,OAAO,CAEzB;IAED,IAAI,aAAa,IAAI,WAAW,GAAG,IAAI,CAEtC;IAID;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,GAAG,IAAI;IAKzC;;;OAGG;IACH,UAAU,IAAI,IAAI;IAUlB;;;OAGG;IACG,OAAO,CACX,QA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tD,SAAS,CAAC,CAAC,WAAW,EAAE,eAAe,GAAG,IAAI;IAI9C,OAAO,CAAC,qBAAqB;CAM9B"}
@@ -0,0 +1,147 @@
1
+ import { EntityRegistry } from './registry.js';
2
+ /**
3
+ * AgentEntityBase — the universal base class for entities in the agent SDK.
4
+ *
5
+ * This class is framework-agnostic. React, Vue, Svelte, and vanilla JS integrations
6
+ * all delegate to this base. It provides:
7
+ *
8
+ * HYBRID (default):
9
+ * - execute() — trigger intents through the SDK orchestrator
10
+ * - onTargeted() / onReleased() — receive targeting from agent
11
+ * - onCommandReceived() — receive direct commands from agent
12
+ * - onExecutionComplete() — callback after intent execution
13
+ *
14
+ * FULL BIDIRECTIONAL (opt-in via capabilities.observe = true):
15
+ * - emit() — proactively signal the agent
16
+ * - subscribe() — listen to other entities or agent events
17
+ * - onObserve() — receive ambient user interaction observations
18
+ */
19
+ export class AgentEntityBase {
20
+ get capabilities() { return {}; }
21
+ // --- Internal state ---
22
+ _isTargeted = false;
23
+ _isExecuting = false;
24
+ _currentAction = null;
25
+ _subscriptions = [];
26
+ _registry = null;
27
+ get isTargeted() {
28
+ return this._isTargeted;
29
+ }
30
+ get isExecuting() {
31
+ return this._isExecuting;
32
+ }
33
+ get currentAction() {
34
+ return this._currentAction;
35
+ }
36
+ // --- Registration lifecycle ---
37
+ /**
38
+ * Register this entity with the given registry.
39
+ * Called automatically by framework bindings (React hooks, etc.).
40
+ */
41
+ register(registry) {
42
+ this._registry = registry ?? EntityRegistry.instance;
43
+ this._registry.registerEntity(this);
44
+ }
45
+ /**
46
+ * Unregister this entity from its registry.
47
+ * Called automatically on unmount/destroy by framework bindings.
48
+ */
49
+ unregister() {
50
+ this._cleanupSubscriptions();
51
+ if (this._registry) {
52
+ this._registry.unregisterEntity(this.entityType, this.entityId);
53
+ this._registry = null;
54
+ }
55
+ }
56
+ // --- HYBRID: Always available ---
57
+ /**
58
+ * Execute an intent through the SDK. This goes through the orchestrator/service registry,
59
+ * ensuring trajectory capture, precondition checks, and learning signals.
60
+ */
61
+ async execute(intentId, params, options) {
62
+ if (!this._registry) {
63
+ return { success: false, error: { code: 'NOT_REGISTERED', message: 'Entity is not registered with a registry' } };
64
+ }
65
+ return this._registry.executeFromEntity(this, intentId, params ?? {}, options);
66
+ }
67
+ /** @internal Called by the registry/orchestrator when this entity is targeted */
68
+ _handleTargeted(action) {
69
+ this._isTargeted = true;
70
+ this._currentAction = action;
71
+ this.onTargeted?.(action);
72
+ }
73
+ /** @internal Called by the registry/orchestrator when targeting is released */
74
+ _handleReleased() {
75
+ this._isTargeted = false;
76
+ this._currentAction = null;
77
+ this.onReleased?.();
78
+ }
79
+ /** @internal Called by the registry/orchestrator when an intent starts executing */
80
+ _handleExecuting(intentId, params) {
81
+ this._isExecuting = true;
82
+ this.onExecuting?.(intentId, params);
83
+ }
84
+ /** @internal Called by the registry/orchestrator when execution completes */
85
+ _handleExecutionComplete(intentId, result) {
86
+ this._isExecuting = false;
87
+ this.onExecutionComplete?.(intentId, result);
88
+ }
89
+ /** @internal Called by the registry/orchestrator with a direct command */
90
+ _handleCommand(command) {
91
+ return this.onCommandReceived?.(command);
92
+ }
93
+ // --- FULL BIDIRECTIONAL: Only when capabilities.observe === true ---
94
+ /**
95
+ * Emit a signal to the agent. Only available when capabilities.observe is true.
96
+ * Signals are batched and debounced by the registry before reaching the orchestrator.
97
+ */
98
+ emit(signal, data) {
99
+ if (!this.capabilities.observe) {
100
+ if (typeof console !== 'undefined') {
101
+ console.warn(`[AgentEntity] emit() called on ${this.entityType}:${this.entityId} but observe capability is not enabled`);
102
+ }
103
+ return;
104
+ }
105
+ if (!this._registry)
106
+ return;
107
+ const entitySignal = {
108
+ entityType: this.entityType,
109
+ entityId: this.entityId,
110
+ signal,
111
+ data,
112
+ timestamp: Date.now(),
113
+ };
114
+ this._registry.emitSignal(entitySignal);
115
+ }
116
+ /**
117
+ * Subscribe to events from the registry/agent. Only available when capabilities.observe is true.
118
+ * Returns an unsubscribe function.
119
+ */
120
+ subscribe(event, handler) {
121
+ if (!this.capabilities.observe) {
122
+ if (typeof console !== 'undefined') {
123
+ console.warn(`[AgentEntity] subscribe() called on ${this.entityType}:${this.entityId} but observe capability is not enabled`);
124
+ }
125
+ return () => { };
126
+ }
127
+ if (!this._registry)
128
+ return () => { };
129
+ const unsub = this._registry.subscribeEntityEvent(this.entityType, this.entityId, event, handler);
130
+ this._subscriptions.push(unsub);
131
+ return unsub;
132
+ }
133
+ /** @internal Called by the registry when a user observation is detected */
134
+ _handleObservation(observation) {
135
+ if (!this.capabilities.observe)
136
+ return;
137
+ this.onObserve?.(observation);
138
+ }
139
+ // --- Cleanup ---
140
+ _cleanupSubscriptions() {
141
+ for (const unsub of this._subscriptions) {
142
+ unsub();
143
+ }
144
+ this._subscriptions = [];
145
+ }
146
+ }
147
+ //# sourceMappingURL=base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/entity/base.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAgB,eAAe;IAMnC,IAAI,YAAY,KAAyB,OAAO,EAAE,CAAC,CAAC,CAAC;IAErD,yBAAyB;IACjB,WAAW,GAAG,KAAK,CAAC;IACpB,YAAY,GAAG,KAAK,CAAC;IACrB,cAAc,GAAuB,IAAI,CAAC;IAC1C,cAAc,GAAuB,EAAE,CAAC;IACxC,SAAS,GAA0B,IAAI,CAAC;IAEhD,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED,iCAAiC;IAEjC;;;OAGG;IACH,QAAQ,CAAC,QAAyB;QAChC,IAAI,CAAC,SAAS,GAAG,QAAQ,IAAI,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CAAC,CAAC;YAChI,CAAC;YACD,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;QAClB,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,SAAS;YAAE,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;QAErC,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAClG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAChC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,2EAA2E;IAC3E,kBAAkB,CAAC,WAA4B;QAC7C,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO;YAAE,OAAO;QACvC,IAAI,CAAC,SAAS,EAAE,CAAC,WAAW,CAAC,CAAC;IAChC,CAAC;IAID,kBAAkB;IAEV,qBAAqB;QAC3B,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACxC,KAAK,EAAE,CAAC;QACV,CAAC;QACD,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;IAC3B,CAAC;CACF"}
@@ -0,0 +1,6 @@
1
+ export { AgentEntityBase } from './base.js';
2
+ export { EntityRegistry } from './registry.js';
3
+ export type { AgentEntityProtocol, AgentEntityCapable } from './protocol.js';
4
+ export type { EntityCapabilities, EntityDisplayContext, EntityIdentity, AgentAction, AgentCommand, AgentCommandResponse, UserObservation, EntitySignal, EntityLifecycleState, EntityRegistration, EntityExecuteOptions, Unsubscribe, } from './types.js';
5
+ export type { RegistryEvent } from './registry.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/entity/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAE7E,YAAY,EACV,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,WAAW,GACZ,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { AgentEntityBase } from './base.js';
2
+ export { EntityRegistry } from './registry.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/entity/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,45 @@
1
+ import type { EntityCapabilities, EntityDisplayContext, AgentAction, AgentCommand, AgentCommandResponse, UserObservation, EntityExecuteOptions, Unsubscribe } from './types.js';
2
+ import type { IntentResult } from '../types/api-surface.js';
3
+ /**
4
+ * AgentEntityProtocol — the interface contract for entities that participate
5
+ * in the agent SDK. Use this when class inheritance isn't desired.
6
+ *
7
+ * Any object conforming to this protocol can be registered with the EntityRegistry.
8
+ */
9
+ export interface AgentEntityProtocol {
10
+ /** The schema entity type (e.g., 'Character', 'Voice', 'Clip') */
11
+ readonly entityType: string;
12
+ /** The unique identifier for this specific entity instance */
13
+ readonly entityId: string;
14
+ /** Intent IDs this entity supports — determines what the agent can do with it */
15
+ readonly intents: string[];
16
+ /** Human-readable display information for the agent's context window */
17
+ readonly displayContext: EntityDisplayContext;
18
+ /** Capability flags — defaults to hybrid mode */
19
+ readonly capabilities?: EntityCapabilities;
20
+ /** Called when the agent targets this entity */
21
+ onTargeted?(action: AgentAction): void;
22
+ /** Called when the agent releases targeting of this entity */
23
+ onReleased?(): void;
24
+ /** Called when an intent begins executing on this entity */
25
+ onExecuting?(intentId: string, params: Record<string, unknown>): void;
26
+ /** Called when an intent execution completes on this entity */
27
+ onExecutionComplete?(intentId: string, result: IntentResult): void;
28
+ /** Called when the agent sends a direct command to this entity */
29
+ onCommandReceived?(command: AgentCommand): AgentCommandResponse | Promise<AgentCommandResponse> | void;
30
+ /** Called with user interaction observations (observe mode) */
31
+ onObserve?(observation: UserObservation): void;
32
+ }
33
+ /**
34
+ * Extended protocol with SDK-provided capabilities.
35
+ * This is what entities get when registered — the SDK injects these methods.
36
+ */
37
+ export interface AgentEntityCapable extends AgentEntityProtocol {
38
+ /** Execute an intent through the SDK orchestrator */
39
+ execute(intentId: string, params?: Record<string, unknown>, options?: EntityExecuteOptions): Promise<IntentResult>;
40
+ /** Emit a signal to the agent (only available when observe: true) */
41
+ emit?(signal: string, data?: unknown): void;
42
+ /** Subscribe to events from other entities or the agent */
43
+ subscribe?(event: string, handler: (data: unknown) => void): Unsubscribe;
44
+ }
45
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/entity/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,oBAAoB,EACpB,WAAW,EACX,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,WAAW,EACZ,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,kEAAkE;IAClE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAE5B,8DAA8D;IAC9D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B,iFAAiF;IACjF,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAE3B,wEAAwE;IACxE,QAAQ,CAA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