@0gfoundation/0g-agentdna 0.2.3 → 0.5.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 (255) hide show
  1. package/GUIDE.md +190 -40
  2. package/OPERATORS.md +164 -0
  3. package/OPERATORS.zh.md +141 -0
  4. package/PROVIDERS.md +6 -0
  5. package/PROVIDERS.zh.md +3 -1
  6. package/README.md +84 -11
  7. package/dist/AgentClient.d.ts +374 -26
  8. package/dist/AgentClient.d.ts.map +1 -1
  9. package/dist/AgentClient.js +323 -40
  10. package/dist/AgentClient.js.map +1 -1
  11. package/dist/AgenticID.d.ts +170 -80
  12. package/dist/AgenticID.d.ts.map +1 -1
  13. package/dist/AgenticID.js +300 -42
  14. package/dist/AgenticID.js.map +1 -1
  15. package/dist/AttestorClient.d.ts +115 -31
  16. package/dist/AttestorClient.d.ts.map +1 -1
  17. package/dist/AttestorClient.js +276 -56
  18. package/dist/AttestorClient.js.map +1 -1
  19. package/dist/Credentials.d.ts +574 -0
  20. package/dist/Credentials.d.ts.map +1 -0
  21. package/dist/Credentials.js +838 -0
  22. package/dist/Credentials.js.map +1 -0
  23. package/dist/Operators.d.ts +60 -0
  24. package/dist/Operators.d.ts.map +1 -0
  25. package/dist/Operators.js +38 -0
  26. package/dist/Operators.js.map +1 -0
  27. package/dist/Providers.d.ts +13 -0
  28. package/dist/Providers.d.ts.map +1 -1
  29. package/dist/Providers.js +20 -1
  30. package/dist/Providers.js.map +1 -1
  31. package/dist/Releases.d.ts +51 -0
  32. package/dist/Releases.d.ts.map +1 -0
  33. package/dist/Releases.js +72 -0
  34. package/dist/Releases.js.map +1 -0
  35. package/dist/ReputationClient.d.ts +47 -3
  36. package/dist/ReputationClient.d.ts.map +1 -1
  37. package/dist/ReputationClient.js +204 -78
  38. package/dist/ReputationClient.js.map +1 -1
  39. package/dist/ServeProof.d.ts +70 -23
  40. package/dist/ServeProof.d.ts.map +1 -1
  41. package/dist/ServeProof.js +94 -35
  42. package/dist/ServeProof.js.map +1 -1
  43. package/dist/ServeSession.d.ts +17 -2
  44. package/dist/ServeSession.d.ts.map +1 -1
  45. package/dist/ServeSession.js +77 -9
  46. package/dist/ServeSession.js.map +1 -1
  47. package/dist/Settings.d.ts +25 -1
  48. package/dist/Settings.d.ts.map +1 -1
  49. package/dist/Settings.js +53 -1
  50. package/dist/Settings.js.map +1 -1
  51. package/dist/TrustRegistry.d.ts +28 -0
  52. package/dist/TrustRegistry.d.ts.map +1 -0
  53. package/dist/TrustRegistry.js +67 -0
  54. package/dist/TrustRegistry.js.map +1 -0
  55. package/dist/abi.d.ts +346 -34
  56. package/dist/abi.d.ts.map +1 -1
  57. package/dist/abi.js +150 -30
  58. package/dist/abi.js.map +1 -1
  59. package/dist/cli/attach.d.ts +79 -0
  60. package/dist/cli/attach.d.ts.map +1 -0
  61. package/dist/cli/attach.js +253 -0
  62. package/dist/cli/attach.js.map +1 -0
  63. package/dist/cli/commands/cells.d.ts +45 -0
  64. package/dist/cli/commands/cells.d.ts.map +1 -1
  65. package/dist/cli/commands/cells.js +77 -0
  66. package/dist/cli/commands/cells.js.map +1 -1
  67. package/dist/cli/commands/cred.d.ts +12 -0
  68. package/dist/cli/commands/cred.d.ts.map +1 -0
  69. package/dist/cli/commands/cred.js +43 -0
  70. package/dist/cli/commands/cred.js.map +1 -0
  71. package/dist/cli/commands/doctor.d.ts.map +1 -1
  72. package/dist/cli/commands/doctor.js +44 -35
  73. package/dist/cli/commands/doctor.js.map +1 -1
  74. package/dist/cli/commands/interactive.d.ts +597 -21
  75. package/dist/cli/commands/interactive.d.ts.map +1 -1
  76. package/dist/cli/commands/interactive.js +5082 -1323
  77. package/dist/cli/commands/interactive.js.map +1 -1
  78. package/dist/cli/commands/list.d.ts +5 -5
  79. package/dist/cli/commands/list.d.ts.map +1 -1
  80. package/dist/cli/commands/list.js +21 -26
  81. package/dist/cli/commands/list.js.map +1 -1
  82. package/dist/cli/commands/providers.d.ts +4 -0
  83. package/dist/cli/commands/providers.d.ts.map +1 -1
  84. package/dist/cli/commands/providers.js +19 -5
  85. package/dist/cli/commands/providers.js.map +1 -1
  86. package/dist/cli/commands/releases.d.ts +13 -0
  87. package/dist/cli/commands/releases.d.ts.map +1 -0
  88. package/dist/cli/commands/releases.js +65 -0
  89. package/dist/cli/commands/releases.js.map +1 -0
  90. package/dist/cli/commands/settings.d.ts +5 -0
  91. package/dist/cli/commands/settings.d.ts.map +1 -1
  92. package/dist/cli/commands/settings.js +70 -24
  93. package/dist/cli/commands/settings.js.map +1 -1
  94. package/dist/cli/commands/status.d.ts +2 -1
  95. package/dist/cli/commands/status.d.ts.map +1 -1
  96. package/dist/cli/commands/status.js +22 -19
  97. package/dist/cli/commands/status.js.map +1 -1
  98. package/dist/cli/config.d.ts +48 -1
  99. package/dist/cli/config.d.ts.map +1 -1
  100. package/dist/cli/config.js +114 -5
  101. package/dist/cli/config.js.map +1 -1
  102. package/dist/cli/credentials.d.ts +179 -0
  103. package/dist/cli/credentials.d.ts.map +1 -0
  104. package/dist/cli/credentials.js +1443 -0
  105. package/dist/cli/credentials.js.map +1 -0
  106. package/dist/cli/download.d.ts +21 -0
  107. package/dist/cli/download.d.ts.map +1 -0
  108. package/dist/cli/download.js +89 -0
  109. package/dist/cli/download.js.map +1 -0
  110. package/dist/cli/env.d.ts +6 -0
  111. package/dist/cli/env.d.ts.map +1 -1
  112. package/dist/cli/env.js +18 -6
  113. package/dist/cli/env.js.map +1 -1
  114. package/dist/cli/envelope.d.ts +4 -2
  115. package/dist/cli/envelope.d.ts.map +1 -1
  116. package/dist/cli/envelope.js +10 -6
  117. package/dist/cli/envelope.js.map +1 -1
  118. package/dist/cli/errors.d.ts +45 -1
  119. package/dist/cli/errors.d.ts.map +1 -1
  120. package/dist/cli/errors.js +77 -0
  121. package/dist/cli/errors.js.map +1 -1
  122. package/dist/cli/inference.d.ts.map +1 -1
  123. package/dist/cli/inference.js +7 -0
  124. package/dist/cli/inference.js.map +1 -1
  125. package/dist/cli/inkView.d.ts +341 -0
  126. package/dist/cli/inkView.d.ts.map +1 -0
  127. package/dist/cli/inkView.js +1019 -0
  128. package/dist/cli/inkView.js.map +1 -0
  129. package/dist/cli/legacy/modelKey.d.ts +24 -0
  130. package/dist/cli/legacy/modelKey.d.ts.map +1 -0
  131. package/dist/cli/legacy/modelKey.js +32 -0
  132. package/dist/cli/legacy/modelKey.js.map +1 -0
  133. package/dist/cli/livePrompt.d.ts +212 -0
  134. package/dist/cli/livePrompt.d.ts.map +1 -0
  135. package/dist/cli/livePrompt.js +576 -0
  136. package/dist/cli/livePrompt.js.map +1 -0
  137. package/dist/cli/main.js +206 -72
  138. package/dist/cli/main.js.map +1 -1
  139. package/dist/cli/modelkey.d.ts +64 -0
  140. package/dist/cli/modelkey.d.ts.map +1 -0
  141. package/dist/cli/modelkey.js +113 -0
  142. package/dist/cli/modelkey.js.map +1 -0
  143. package/dist/cli/outboxSync.d.ts +51 -0
  144. package/dist/cli/outboxSync.d.ts.map +1 -0
  145. package/dist/cli/outboxSync.js +210 -0
  146. package/dist/cli/outboxSync.js.map +1 -0
  147. package/dist/cli/plain.d.ts +46 -0
  148. package/dist/cli/plain.d.ts.map +1 -0
  149. package/dist/cli/plain.js +260 -0
  150. package/dist/cli/plain.js.map +1 -0
  151. package/dist/cli/proofs.d.ts +5 -0
  152. package/dist/cli/proofs.d.ts.map +1 -1
  153. package/dist/cli/proofs.js +20 -0
  154. package/dist/cli/proofs.js.map +1 -1
  155. package/dist/cli/ref.d.ts.map +1 -1
  156. package/dist/cli/ref.js +3 -2
  157. package/dist/cli/ref.js.map +1 -1
  158. package/dist/cli/releaseNotice.d.ts +64 -0
  159. package/dist/cli/releaseNotice.d.ts.map +1 -0
  160. package/dist/cli/releaseNotice.js +194 -0
  161. package/dist/cli/releaseNotice.js.map +1 -0
  162. package/dist/cli/sdk.d.ts +18 -0
  163. package/dist/cli/sdk.d.ts.map +1 -1
  164. package/dist/cli/sdk.js +99 -1
  165. package/dist/cli/sdk.js.map +1 -1
  166. package/dist/cli/settings.d.ts +90 -9
  167. package/dist/cli/settings.d.ts.map +1 -1
  168. package/dist/cli/settings.js +273 -21
  169. package/dist/cli/settings.js.map +1 -1
  170. package/dist/cli/textfit.d.ts +28 -0
  171. package/dist/cli/textfit.d.ts.map +1 -0
  172. package/dist/cli/textfit.js +111 -0
  173. package/dist/cli/textfit.js.map +1 -0
  174. package/dist/constants.d.ts +1 -1
  175. package/dist/constants.js +1 -1
  176. package/dist/context.d.ts +26 -0
  177. package/dist/context.d.ts.map +1 -1
  178. package/dist/context.js +1 -0
  179. package/dist/context.js.map +1 -1
  180. package/dist/index.d.ts +19 -11
  181. package/dist/index.d.ts.map +1 -1
  182. package/dist/index.js +35 -2
  183. package/dist/index.js.map +1 -1
  184. package/dist/legacy/modelKey.d.ts +67 -0
  185. package/dist/legacy/modelKey.d.ts.map +1 -0
  186. package/dist/legacy/modelKey.js +80 -0
  187. package/dist/legacy/modelKey.js.map +1 -0
  188. package/dist/legacy/serveProofV1.d.ts +56 -0
  189. package/dist/legacy/serveProofV1.d.ts.map +1 -0
  190. package/dist/legacy/serveProofV1.js +91 -0
  191. package/dist/legacy/serveProofV1.js.map +1 -0
  192. package/dist/provider-catalog.json +3 -2
  193. package/dist/secretEnv.d.ts +18 -3
  194. package/dist/secretEnv.d.ts.map +1 -1
  195. package/dist/secretEnv.js +16 -2
  196. package/dist/secretEnv.js.map +1 -1
  197. package/dist/types.d.ts +63 -1
  198. package/dist/types.d.ts.map +1 -1
  199. package/dist/viemErrors.d.ts +30 -0
  200. package/dist/viemErrors.d.ts.map +1 -0
  201. package/dist/viemErrors.js +36 -0
  202. package/dist/viemErrors.js.map +1 -0
  203. package/package.json +5 -1
  204. package/src/AgentClient.ts +622 -68
  205. package/src/AgenticID.ts +345 -56
  206. package/src/AttestorClient.ts +330 -83
  207. package/src/Credentials.ts +1027 -0
  208. package/src/Operators.ts +71 -0
  209. package/src/Providers.ts +20 -0
  210. package/src/Releases.ts +95 -0
  211. package/src/ReputationClient.ts +231 -79
  212. package/src/ServeProof.ts +123 -39
  213. package/src/ServeSession.ts +91 -9
  214. package/src/Settings.ts +61 -1
  215. package/src/TrustRegistry.ts +75 -0
  216. package/src/abi.ts +153 -30
  217. package/src/cli/attach.ts +257 -0
  218. package/src/cli/commands/cells.ts +104 -0
  219. package/src/cli/commands/cred.ts +44 -0
  220. package/src/cli/commands/doctor.ts +45 -37
  221. package/src/cli/commands/interactive.ts +4120 -664
  222. package/src/cli/commands/list.ts +21 -30
  223. package/src/cli/commands/providers.ts +17 -4
  224. package/src/cli/commands/releases.ts +60 -0
  225. package/src/cli/commands/settings.ts +75 -28
  226. package/src/cli/commands/status.ts +24 -21
  227. package/src/cli/config.ts +119 -4
  228. package/src/cli/credentials.ts +1379 -0
  229. package/src/cli/download.ts +80 -0
  230. package/src/cli/env.ts +22 -7
  231. package/src/cli/envelope.ts +10 -6
  232. package/src/cli/errors.ts +92 -0
  233. package/src/cli/inference.ts +8 -1
  234. package/src/cli/inkView.ts +969 -0
  235. package/src/cli/legacy/modelKey.ts +35 -0
  236. package/src/cli/livePrompt.ts +615 -0
  237. package/src/cli/main.ts +206 -76
  238. package/src/cli/modelkey.ts +124 -0
  239. package/src/cli/outboxSync.ts +231 -0
  240. package/src/cli/plain.ts +260 -0
  241. package/src/cli/proofs.ts +27 -0
  242. package/src/cli/ref.ts +5 -4
  243. package/src/cli/releaseNotice.ts +200 -0
  244. package/src/cli/sdk.ts +87 -7
  245. package/src/cli/settings.ts +275 -25
  246. package/src/cli/textfit.ts +95 -0
  247. package/src/constants.ts +1 -1
  248. package/src/context.ts +28 -0
  249. package/src/index.ts +50 -7
  250. package/src/legacy/modelKey.ts +80 -0
  251. package/src/legacy/serveProofV1.ts +124 -0
  252. package/src/provider-catalog.json +3 -2
  253. package/src/secretEnv.ts +18 -3
  254. package/src/types.ts +60 -1
  255. package/src/viemErrors.ts +39 -0
package/dist/cli/main.js CHANGED
@@ -16,6 +16,10 @@ const node_util_1 = require("node:util");
16
16
  const node_fs_1 = require("node:fs");
17
17
  const node_path_1 = require("node:path");
18
18
  const errors_1 = require("./errors");
19
+ const plain_1 = require("./plain");
20
+ const ref_1 = require("./ref");
21
+ const textfit_1 = require("./textfit");
22
+ const cells_1 = require("./commands/cells");
19
23
  const envelope_1 = require("./envelope");
20
24
  const env_1 = require("./env");
21
25
  const config_1 = require("./config");
@@ -25,10 +29,13 @@ const list_1 = require("./commands/list");
25
29
  const update_1 = require("./commands/update");
26
30
  const settings_1 = require("./commands/settings");
27
31
  const providers_1 = require("./commands/providers");
32
+ const releases_1 = require("./commands/releases");
33
+ const releaseNotice_1 = require("./releaseNotice");
34
+ const cred_1 = require("./commands/cred");
28
35
  const interactive_1 = require("./commands/interactive");
29
- /** Diagnostics subcommands. Anything else (bare, or a leading agent ref)
30
- * routes to the default interactive shell. */
31
- const COMMANDS = { doctor: doctor_1.run, status: status_1.run, list: list_1.run, update: update_1.run, settings: settings_1.run, providers: providers_1.run };
36
+ /** One-shot commands. Bare, an agent ref or `use <agent>` opens the
37
+ * interactive shell instead (see route). */
38
+ const COMMANDS = { doctor: doctor_1.run, status: status_1.run, list: list_1.run, update: update_1.run, settings: settings_1.run, cred: cred_1.run, providers: providers_1.run, releases: releases_1.run };
32
39
  // Help is written for LLM consumption as much as for humans: exact syntax,
33
40
  // env contract, exit-code semantics, runnable examples — it is the ground
34
41
  // truth an agent plans against (spec v0.03 §2.4).
@@ -36,62 +43,68 @@ const HELP = `0g-agentdna — 0G AgentDNA CLI for the AgenticID protocol
36
43
  (ships with @0gfoundation/0g-agentdna; no separate install)
37
44
 
38
45
  USAGE
39
- 0g-agentdna [agent] [options] interactive chat (default)
40
- 0g-agentdna <command> [options] diagnostics
46
+ 0g-agentdna [agent] [options] the interactive shell (default)
47
+ 0g-agentdna <command> [options] one-shot commands (below)
41
48
 
42
- INTERACTIVE (default — no command)
43
- 0g-agentdna Open the manager REPL. Its commands:
44
- list agents on this attestor (* = yours)
45
- use <agentId|seal> enter YOUR agent's session, in
46
- ANY phase (lifecycle is inside)
47
- hello <agentId|seal> any agent's public /hello
48
- (identity + services + proof;
49
- banks a rating ticket if a
50
- wallet is configured)
51
- call <id> [path] use an agent's service (banks
52
- a rating ticket)
53
- rate <id> [score] rate an agent on-chain, spending
54
- a ticket from call/hello (<1h)
55
- deploy new-agent wizard, then chat
56
- start/stop/reset <id> lifecycle without entering
57
- the session (reset asks the
58
- framework + key)
59
- settings <id> [k=v] show/change the agent's
60
- configuration document
61
- balance prepaid balance + burn rate
62
- deposit [og] fund the prepaid balance
63
- withdraw [og] refund prepaid funds (time-
64
- locked; bare claims)
65
- ack acknowledge the TEE trust
66
- root (implicit in deploy/
67
- start/reset)
68
- login guided setup: attestor URL,
69
- owner key, provider, inference key (Enter
70
- keeps current; keys echo *)
71
- whoami · help · quit
72
- 0g-agentdna <agent> Shortcut: use that agent directly, then drop to
73
- the manager REPL on /back.
49
+ INTERACTIVE SHELL (default — no command)
50
+ 0g-agentdna Open the shell at its manager prompt (0g-agentdna>).
51
+ Its commands (\`help\` there lists them all):
52
+ list agents on this attestor (* = yours)
53
+ use <agentId|seal> enter YOUR agent's session, in ANY phase
54
+ (lifecycle is inside)
55
+ hello <agentId|seal> [full]
56
+ any agent's public /hello (identity + proof,
57
+ services one per line, owner routes on one line;
58
+ full: every field; banks a rating ticket if a
59
+ wallet is set)
60
+ call <id> [path] use an agent's service (banks a rating ticket)
61
+ rate <id> [score] rate an agent on-chain, spending a ticket from
62
+ call/hello (<1h)
63
+ deploy new-agent wizard, then chat
64
+ start/stop/reset <id>
65
+ lifecycle without entering the session (reset
66
+ asks the framework + key)
67
+ settings <id> [k=v] show/change the agent's configuration document
68
+ balance prepaid balance + burn rate
69
+ deposit [og] fund the prepaid balance
70
+ withdraw [og] refund prepaid funds (time-locked; bare claims)
71
+ ack acknowledge the TEE trust root (implicit in
72
+ deploy/start/reset)
73
+ login [provider] guided setup: attestor URL, owner key, each
74
+ provider's model key (Enter keeps the current
75
+ value; keys echo *)
76
+ doctor · status <id> · providers · releases
77
+ as the one-shot commands below
78
+ whoami · help · quit
79
+ 0g-agentdna <agent> Shortcut (also \`0g-agentdna use <agent>\`): enter
80
+ that agent's session; /back drops to the manager.
74
81
 
75
- In a session: type to talk; Esc / Ctrl-C interrupts
76
- the turn in flight (and cancels a /start or /reset
77
- wait). Slash: /hello /balance /topup [og] /stop
78
- /start /reset /settings [k=v] /agentlog [n]
79
- /startuplog [n] /back (or /unuse) /quit. The framework (for /reset
80
- and the chat model selector) is picked by you, never
81
- guessed. Config persists to ~/.config/0g-agentdna
82
- (config.json + credentials at 0600); AGENTIC_* env
83
- vars always override the files.
82
+ In a session: type to talk; Esc / Ctrl-C
83
+ interrupts the turn in flight (and cancels a
84
+ /start or /reset wait). Slash: /hello [full]
85
+ /balance /topup [og] /stop /start /reset
86
+ /settings [k=v] /agentlog [n] /startuplog [n]
87
+ /back (or /unuse) /quit. The framework (for
88
+ /reset and the chat model selector) is picked by
89
+ you, never guessed.
90
+ Config persists to ~/.config/0g-agentdna
91
+ (config.json + credentials at 0600); AGENTIC_*
92
+ env vars always override the files.
93
+ The shell's other words (login, deploy, balance, …) are not one-shot
94
+ commands: \`0g-agentdna login\` says to run \`0g-agentdna\` and type it
95
+ there. \`0g-agentdna help\` prints this text.
84
96
 
85
97
  COMMANDS
86
98
  doctor Check every deploy prerequisite (attestor reachable, RPC,
87
99
  wallet, gas, trust-root ack, sandbox balance). Each failing
88
100
  item prints a remedy. Exit 0 all green; exit 3 otherwise,
89
101
  carrying the FIRST failing check's code. Diagnostics only:
90
- the ack/deposit remedies are transactions (they need gas)
91
- executed via the deploy console or the SDK, not this CLI.
102
+ its ack and deposit remedies are transactions you run in
103
+ the shell (\`ack\`, \`deposit\`).
92
104
  status <agent> One agent's full picture: phase, agentId/sealId/agentSeal,
93
- url, failure reason. <agent> is a decimal agentId (33) or a
94
- 0x… sealId — the CLI converts between them for you.
105
+ failure reason (--json also carries the container url).
106
+ <agent> is a decimal agentId (33) or a 0x… sealId — the
107
+ CLI converts between them for you.
95
108
  list List deployments. --mine (owner-signed, needs
96
109
  AGENTIC_PRIVATE_KEY) adds owner-only fields such as the
97
110
  failure reason and sandboxId.
@@ -100,8 +113,12 @@ COMMANDS
100
113
  thinks with, and how hard); with key=value assignments,
101
114
  change it. Keys: provider, model, thinking (low|high|max),
102
115
  others (opaque JSON for that framework's own knobs —
103
- quote it: others='{"a": 1}'). Assignments merge into the
104
- stored document; an empty value (thinking=) clears a field.
116
+ quote it: others='{"a": 1}'), and on 0g-harness sealed and
117
+ harness (a version's sha256 from the trust registry's
118
+ lists, which settings <agent> versions prints; the agent
119
+ runs a pick while it stays listed). Assignments merge into
120
+ the stored document; an empty value (thinking=) clears a
121
+ field.
105
122
  The document is the owner's, so BOTH reading and writing
106
123
  are owner-signed and need AGENTIC_PRIVATE_KEY. A write is a
107
124
  compare-and-swap against the version just read: if another
@@ -109,7 +126,54 @@ COMMANDS
109
126
  3, SETTINGS_CONFLICT) rather than overwriting them. The
110
127
  model advisory uses its provider catalog. Provider changes
111
128
  need a matching key and image support, then require reset.
129
+ cred <agent> [ls|set|rm|connect|disconnect|reveal|pending|approve|deny|log]
130
+ The owner's credentials for the agent (API keys, tokens).
131
+ The agent writes [[credential:<name>]] where a key goes;
132
+ sealed fills it in on the way out, only for the hosts and
133
+ positions you allowed, and hides it in responses. The
134
+ value is read from stdin or a prompt that does not echo,
135
+ never from an argument, and is sealed to the agent before
136
+ it leaves this machine.
137
+ cred <agent> list (never values)
138
+ cred <agent> set <name> [k=v …] add or change one.
139
+ Keys: preset=<name> (see cred presets), host=a,b,
140
+ header='Name: … {v} …', basic=<user>, query=<param>,
141
+ body=<field>, path=yes, use=inject|token_only|sign,
142
+ signer=<json> (with use=sign: sigv4, hmac, jwt or
143
+ wallet; the key is never sent, sealed signs with it),
144
+ token=<json>, writeback=yes|no, reveal=yes|no,
145
+ expires=<YYYY-MM-DD|unix>, desc=…
146
+ preset=oauth2-refresh|oauth2-client token_url=…
147
+ client_id=… api_host=… [client_secret=<entry>]
148
+ [scope=…]: sealed trades the value for access tokens
149
+ cred <agent> rm <name> remove one
150
+ cred <agent> connect <name> <mcp-url>
151
+ connect an MCP server:
152
+ log in through the link
153
+ it prints; sealed keeps
154
+ the tokens, refreshes
155
+ them
156
+ cred <agent> disconnect <name> revoke it at the server
157
+ (when it offers that)
158
+ and remove it
159
+ cred <agent> reveal <name> on|off the agent may read it
160
+ cred <agent> pending requests waiting
161
+ cred <agent> approve|deny <id> decide one (id prefix)
162
+ cred <agent> log [n] what the agent did
163
+ cred pending counts, all your agents
164
+ cred notify [<email>|off] email when one waits
165
+ cred presets presets, where to
166
+ create each key
167
+ Owner-signed (all but cred presets); needs
168
+ AGENTIC_PRIVATE_KEY. A write is a compare-and-swap like
169
+ settings (CREDENTIALS_CONFLICT, exit 3).
112
170
  providers Read the platform provider registry (--json for export).
171
+ releases The attestor's release notices: what each release
172
+ changed, the images it replaces and when their
173
+ transition period ends; with AGENTIC_PRIVATE_KEY, which
174
+ of your agents still run one (reset them before then).
175
+ Other commands print a short notice when one is due:
176
+ weekly, daily in the last 7 days (stderr, terminals only).
113
177
  update Self-update: compare against the npm registry and
114
178
  npm install -g the latest (a git-checkout/npm-link copy
115
179
  is reported, not overwritten). --json only reports.
@@ -126,11 +190,12 @@ OPTIONS
126
190
  --help Show this help.
127
191
  --version Print the package version (identical to the SDK's).
128
192
 
129
- ENVIRONMENT
130
- AGENTIC_ATTESTOR_URL required. Attestor base URL — one URL selects the
131
- whole environment (contracts, RPC, appIds).
132
- AGENTIC_PRIVATE_KEY optional. Owner key (0x… hex). Env only — there is
133
- deliberately no flag for it.
193
+ ENVIRONMENT (each overrides what \`login\` saved)
194
+ AGENTIC_ATTESTOR_URL required unless saved by login. Attestor base URL —
195
+ one URL selects the whole environment (contracts,
196
+ RPC, appIds).
197
+ AGENTIC_PRIVATE_KEY optional. Owner key (0x… hex). Env or login only —
198
+ there is deliberately no flag for it.
134
199
  AGENTIC_RPC_URL optional. Overrides the RPC the attestor advertises.
135
200
  AGENTDNA_API_KEY_PROVIDER / AGENTDNA_API_KEY
136
201
  optional, set together. Inference key for deploy/
@@ -148,15 +213,17 @@ ENVIRONMENT
148
213
  EXIT CODES
149
214
  0 success · 1 unknown · 2 usage error (incl. unknown command/agent — branch
150
215
  on error.code to tell them apart) · 3 fixable precondition (run the error's
151
- remedy, then retry) · 4 timeout (check again later) · 5 auth (stop)
216
+ remedy, then retry) · 4 timeout (check again later) · 5 auth (stop) ·
217
+ 130 cancelled at a prompt (Ctrl-C)
152
218
 
153
219
  EXAMPLES
154
- 0g-agentdna # deploy a new agent and chat
155
- 0g-agentdna 286 # attach to agent 286 and chat
220
+ 0g-agentdna # the shell: list, deploy, chat, …
221
+ 0g-agentdna 286 # straight into agent 286's session
156
222
  0g-agentdna doctor
157
223
  0g-agentdna status 33
158
224
  0g-agentdna settings 286
159
225
  0g-agentdna settings 286 model=0gm-1.0-35b-a3b thinking=high
226
+ echo "$GITHUB_TOKEN" | 0g-agentdna cred 286 set github preset=github
160
227
  0g-agentdna list --mine --phase failed --json | jq -r '.data[].sealId'`;
161
228
  /** Package version, read at runtime from the SDK's own package.json
162
229
  * (dist/cli/main.js → ../../package.json). */
@@ -164,6 +231,45 @@ function packageVersion() {
164
231
  const raw = (0, node_fs_1.readFileSync)((0, node_path_1.join)(__dirname, '..', '..', 'package.json'), 'utf8');
165
232
  return JSON.parse(raw).version;
166
233
  }
234
+ /** The interactive shell's words that are not one-shot commands. */
235
+ const SHELL_WORDS = [
236
+ 'login', 'whoami', 'deploy', 'balance', 'deposit', 'withdraw', 'ack', 'hello', 'call', 'rate',
237
+ 'start', 'stop', 'reset', 'retry', 'clone', 'transfer', 'authorizer', 'grant', 'revoke', 'quit',
238
+ ];
239
+ /**
240
+ * Which command runs: a one-shot command by name; the interactive shell for
241
+ * nothing, an agent reference (an agentId is decimal and a sealId 0x…, so
242
+ * neither collides with a command name) or `use <agent>`. A word of the
243
+ * shell's is refused with where to type it; any other word is an unknown
244
+ * command, with the nearest known one when it looks like a typo.
245
+ */
246
+ function route(positionals) {
247
+ const [first, ...rest] = positionals;
248
+ if (!first)
249
+ return { run: interactive_1.run, rest: [] };
250
+ if (Object.prototype.hasOwnProperty.call(COMMANDS, first))
251
+ return { run: COMMANDS[first], rest, command: first };
252
+ if (first === 'use') {
253
+ (0, ref_1.parseAgentRef)(rest[0]);
254
+ return { run: interactive_1.run, rest };
255
+ }
256
+ if (/^(?:\d+|0x[0-9a-fA-F]*)$/.test(first))
257
+ return { run: interactive_1.run, rest: positionals };
258
+ const typed = (0, cells_1.cleanCell)(first);
259
+ if (SHELL_WORDS.includes(first)) {
260
+ throw new errors_1.CliError('UNKNOWN_COMMAND', `\`${typed}\` is a command of the interactive shell, not a one-shot one`, {
261
+ remedy: `run \`0g-agentdna\` and type \`${(0, cells_1.cleanCell)(positionals.join(' '))}\` there`,
262
+ });
263
+ }
264
+ const near = (0, textfit_1.didYouMean)(first, ['help', ...Object.keys(COMMANDS), ...SHELL_WORDS]);
265
+ throw new errors_1.CliError('UNKNOWN_COMMAND', `unknown command: ${typed}`, {
266
+ remedy: near === undefined
267
+ ? '0g-agentdna --help lists the commands'
268
+ : SHELL_WORDS.includes(near)
269
+ ? `did you mean \`${near}\`? It is a shell command: run \`0g-agentdna\` and type it there`
270
+ : `did you mean \`0g-agentdna ${near}\`?`,
271
+ });
272
+ }
167
273
  async function main() {
168
274
  // parseArgs throws on unknown/malformed flags — surfaced as exit 2 below.
169
275
  const { values, positionals } = (0, node_util_1.parseArgs)({
@@ -179,21 +285,22 @@ async function main() {
179
285
  },
180
286
  });
181
287
  if (values.version) {
182
- (0, envelope_1.print)(packageVersion());
288
+ if (values.json)
289
+ (0, envelope_1.emitOk)({ version: packageVersion() });
290
+ else
291
+ (0, envelope_1.print)(packageVersion());
183
292
  return errors_1.EXIT.OK;
184
293
  }
185
294
  if (values.help) {
186
295
  (0, envelope_1.print)(HELP);
187
296
  return errors_1.EXIT.OK;
188
297
  }
189
- // Claude-Code-style default: bare `0g-agentdna` (or with just an agent
190
- // ref, e.g. `0g-agentdna 286`) enters the interactive chat. The
191
- // diagnostics commands (doctor/status/list) are the only reserved words;
192
- // an agentId is decimal and a sealId is 0x…, so neither collides with a
193
- // command name — anything that isn't a known command routes to chat.
194
- const [first, ...rest] = positionals;
195
- const isCommand = !!first && first in COMMANDS;
196
- const run = isCommand ? COMMANDS[first] : interactive_1.run;
298
+ if (positionals[0] === 'help') {
299
+ (0, envelope_1.print)(HELP);
300
+ return errors_1.EXIT.OK;
301
+ }
302
+ const { run, rest, command } = route(positionals);
303
+ const isCommand = command !== undefined;
197
304
  // The public attestors were renamed: a saved earlier address moves to the
198
305
  // current one before the environment is read.
199
306
  const moved = (0, config_1.moveRenamedAttestor)();
@@ -202,10 +309,30 @@ async function main() {
202
309
  const ctx = {
203
310
  env: (0, env_1.readEnv)(),
204
311
  json: values.json,
205
- positionals: isCommand ? rest : positionals,
312
+ positionals: rest,
206
313
  flags: { mine: values.mine, phase: values.phase },
207
314
  };
208
- await run(ctx);
315
+ // The release notice runs alongside a one-shot command and prints after it,
316
+ // on stderr, in a terminal only; it waits at most 1.5 s past the command.
317
+ const noticeAbort = new AbortController();
318
+ const notice = isCommand && command !== 'releases' && command !== 'update' && !ctx.json && process.stderr.isTTY
319
+ ? (0, releaseNotice_1.dueReleaseNotice)(ctx.env, noticeAbort.signal)
320
+ : null;
321
+ try {
322
+ await run(ctx);
323
+ }
324
+ catch (e) {
325
+ noticeAbort.abort();
326
+ throw e;
327
+ }
328
+ if (notice) {
329
+ const due = await Promise.race([notice, new Promise((r) => setTimeout(() => r(null), 1500).unref())]);
330
+ noticeAbort.abort();
331
+ if (due) {
332
+ process.stderr.write(`\n${(0, textfit_1.fitLines)(due.lines.map((l) => ` ${l}`).join('\n'), (0, textfit_1.termWidth)(process.stderr))}\n`);
333
+ due.shown();
334
+ }
335
+ }
209
336
  return errors_1.EXIT.OK;
210
337
  }
211
338
  // Single error boundary. `--json` is detected from raw argv so the envelope
@@ -219,6 +346,13 @@ main()
219
346
  process.exitCode = code;
220
347
  })
221
348
  .catch((e) => {
349
+ // Ctrl-C at a one-shot command's prompt: the owner stopped it, nothing
350
+ // failed. 130 is the shell's code for an interrupted command.
351
+ if ((0, errors_1.isCancelled)(e) && !wantJson) {
352
+ process.stderr.write('cancelled\n');
353
+ process.exitCode = 130;
354
+ return;
355
+ }
222
356
  // node:util's parseArgs errors carry ERR_PARSE_ARGS_* codes — usage, exit 2.
223
357
  const nodeCode = e.code ?? '';
224
358
  // Own wording, not node:util's raw parseArgs prose (its "place it at the
@@ -227,7 +361,7 @@ main()
227
361
  ? new errors_1.CliError('BAD_FLAG', nodeCode === 'ERR_PARSE_ARGS_UNKNOWN_OPTION'
228
362
  ? `unknown flag: ${(e.message.match(/'(--?[^']+)'/) ?? [])[1] ?? '(see --help)'}`
229
363
  : 'malformed command-line arguments', { remedy: '0g-agentdna --help' })
230
- : (0, errors_1.toCliError)(e);
364
+ : (0, plain_1.plainCliError)(e);
231
365
  process.exitCode = (0, envelope_1.emitError)(err, wantJson);
232
366
  });
233
367
  //# sourceMappingURL=main.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";;AACA;;;;;;;;;;GAUG;;AAEH,yCAAsC;AACtC,qCAAuC;AACvC,yCAAiC;AACjC,qCAAsD;AACtD,yCAAoD;AACpD,+BAAgC;AAChC,qCAA+C;AAE/C,8CAAkD;AAClD,8CAAkD;AAClD,0CAA8C;AAC9C,8CAAkD;AAClD,kDAAsD;AACtD,oDAAwD;AACxD,wDAA4D;AAE5D;+CAC+C;AAC/C,MAAM,QAAQ,GAA+B,EAAE,MAAM,EAAN,YAAM,EAAE,MAAM,EAAN,YAAM,EAAE,IAAI,EAAJ,UAAI,EAAE,MAAM,EAAN,YAAM,EAAE,QAAQ,EAAR,cAAQ,EAAE,SAAS,EAAT,e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AQ,KAAK,+BAA+B;YAC1C,CAAC,CAAC,iBAAiB,CAAE,CAAW,CAAC,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,cAAc,EAAE;YAC5F,CAAC,CAAC,kCAAkC,EACtC,EAAE,MAAM,EAAE,oBAAoB,EAAE,CACjC;QACH,CAAC,CAAC,IAAA,qBAAa,EAAC,CAAC,CAAC,CAAC;IACvB,OAAO,CAAC,QAAQ,GAAG,IAAA,oBAAS,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;AAC9C,CAAC,CAAC,CAAC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * @file modelkey.ts
3
+ * @description One model key per provider, wherever the owner first gives it.
4
+ *
5
+ * The key `login` keeps on this machine (the draft) is what every other entry
6
+ * point offers first; a key given anywhere replaces it. Deploy, reset,
7
+ * `cred <agent> set model` and a settings switch all ask through
8
+ * {@link pickModelKey}, so the owner meets the same question everywhere.
9
+ *
10
+ * A script (stdin piped, `--json`) is asked nothing: a key it pipes in is the
11
+ * new key, otherwise the draft is used.
12
+ */
13
+ /** How {@link pickModelKey} talks to whoever runs the CLI. */
14
+ export interface KeyPrompt {
15
+ /** A person answers at a terminal. False for a script: nothing is asked. */
16
+ interactive: boolean;
17
+ out(line: string): void;
18
+ /** Read a value without echoing it; for a script, what it piped in ('' for nothing). */
19
+ secret(prompt: string): Promise<string>;
20
+ /** A yes/no question; Enter answers `def`. Asked only when interactive. */
21
+ confirm(question: string, def: boolean): Promise<boolean>;
22
+ /** The draft store; defaults to the CLI's (`login`'s) on this machine. */
23
+ draft?: {
24
+ get(provider: string): string | null;
25
+ save(provider: string, key: string): void;
26
+ };
27
+ }
28
+ /**
29
+ * The model key for `provider`: the draft when the owner takes it, or a new
30
+ * key, which then replaces the draft. Null only when `optional` and the owner
31
+ * gives none (an agent that starts without a model key); otherwise a missing
32
+ * key is an error.
33
+ */
34
+ export declare function pickModelKey(provider: string, io: KeyPrompt, opts?: {
35
+ optional?: boolean;
36
+ }): Promise<string | null>;
37
+ /**
38
+ * Whether an agent may be created or reset with no model key: 0g-harness on
39
+ * 0g-compute starts without one (its model calls fail until one is set). On
40
+ * another provider sealed refuses a key it lacks, and the other frameworks
41
+ * need one.
42
+ */
43
+ export declare function mayGoKeyless(framework: string, provider: string): boolean;
44
+ /**
45
+ * The model key a reset takes.
46
+ *
47
+ * The credential set holding the provider's key: the new container gets it
48
+ * from the set (older images: cli/legacy/modelKey.ts). Otherwise the owner is
49
+ * asked as everywhere (see mayGoKeyless for skipping). LEGACY(model-key):
50
+ * `keepStoredModelKey` in the result goes with the older images.
51
+ */
52
+ export declare function resetModelKey(cred: {
53
+ get(sealId: `0x${string}`): Promise<{
54
+ definitions: Array<{
55
+ name: string;
56
+ }>;
57
+ }>;
58
+ }, sealId: `0x${string}`, provider: string, framework: string, io: KeyPrompt): Promise<{
59
+ apiKey?: string;
60
+ keepStoredModelKey: boolean;
61
+ }>;
62
+ /** The prompt of a REPL: questions through `ask`, secrets through `secret`. */
63
+ export declare function replKeyPrompt(ask: (q: string) => Promise<string>, secret: (p: string) => Promise<string>, out: (line: string) => void): KeyPrompt;
64
+ //# sourceMappingURL=modelkey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modelkey.d.ts","sourceRoot":"","sources":["../../src/cli/modelkey.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAQH,8DAA8D;AAC9D,MAAM,WAAW,SAAS;IACxB,4EAA4E;IAC5E,WAAW,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,wFAAwF;IACxF,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACxC,2EAA2E;IAC3E,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1D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
+ /**
3
+ * @file modelkey.ts
4
+ * @description One model key per provider, wherever the owner first gives it.
5
+ *
6
+ * The key `login` keeps on this machine (the draft) is what every other entry
7
+ * point offers first; a key given anywhere replaces it. Deploy, reset,
8
+ * `cred <agent> set model` and a settings switch all ask through
9
+ * {@link pickModelKey}, so the owner meets the same question everywhere.
10
+ *
11
+ * A script (stdin piped, `--json`) is asked nothing: a key it pipes in is the
12
+ * new key, otherwise the draft is used.
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.pickModelKey = pickModelKey;
16
+ exports.mayGoKeyless = mayGoKeyless;
17
+ exports.resetModelKey = resetModelKey;
18
+ exports.replKeyPrompt = replKeyPrompt;
19
+ const Credentials_1 = require("../Credentials");
20
+ const config_1 = require("./config");
21
+ const errors_1 = require("./errors");
22
+ const inference_1 = require("./inference");
23
+ const modelKey_1 = require("./legacy/modelKey");
24
+ const machineDraft = {
25
+ get: (provider) => (0, inference_1.configuredInferenceKey)(provider),
26
+ save: (provider, key) => (0, config_1.saveApiKey)(provider, key),
27
+ };
28
+ /**
29
+ * The model key for `provider`: the draft when the owner takes it, or a new
30
+ * key, which then replaces the draft. Null only when `optional` and the owner
31
+ * gives none (an agent that starts without a model key); otherwise a missing
32
+ * key is an error.
33
+ */
34
+ async function pickModelKey(provider, io, opts = {}) {
35
+ const draft = io.draft ?? machineDraft;
36
+ const saved = draft.get(provider);
37
+ const keep = (key) => {
38
+ // Checked before it replaces the key on this machine: a script's stray
39
+ // input must not.
40
+ if (/[\u0000-\u001f\u007f]/.test(key)) {
41
+ throw new errors_1.CliError('BAD_FLAG', 'a model key is one line of printable characters', { remedy: `give the ${provider} key alone` });
42
+ }
43
+ draft.save(provider, key);
44
+ if (io.interactive)
45
+ io.out(`saved as your ${provider} key on this machine`);
46
+ // An environment variable (API_KEY, AGENTDNA_API_KEY…) still wins over it.
47
+ if (draft.get(provider) !== key)
48
+ io.out(`note: an environment variable sets the ${provider} key and takes precedence over the saved one`);
49
+ return key;
50
+ };
51
+ if (!io.interactive) {
52
+ const piped = (await io.secret('')).trim();
53
+ if (piped)
54
+ return keep(piped);
55
+ if (saved)
56
+ return saved;
57
+ if (opts.optional)
58
+ return null;
59
+ throw missing(provider);
60
+ }
61
+ if (saved && await io.confirm(`use the ${provider} key saved on this machine?`, true))
62
+ return saved;
63
+ const typed = (await io.secret(`${provider} model key (${opts.optional ? 'Enter: none for now, ' : ''}Ctrl-C cancels): `)).trim();
64
+ if (typed)
65
+ return keep(typed);
66
+ if (opts.optional)
67
+ return null;
68
+ throw missing(provider);
69
+ }
70
+ /**
71
+ * Whether an agent may be created or reset with no model key: 0g-harness on
72
+ * 0g-compute starts without one (its model calls fail until one is set). On
73
+ * another provider sealed refuses a key it lacks, and the other frameworks
74
+ * need one.
75
+ */
76
+ function mayGoKeyless(framework, provider) {
77
+ return framework === '0g-harness' && provider === '0g-compute';
78
+ }
79
+ /**
80
+ * The model key a reset takes.
81
+ *
82
+ * The credential set holding the provider's key: the new container gets it
83
+ * from the set (older images: cli/legacy/modelKey.ts). Otherwise the owner is
84
+ * asked as everywhere (see mayGoKeyless for skipping). LEGACY(model-key):
85
+ * `keepStoredModelKey` in the result goes with the older images.
86
+ */
87
+ async function resetModelKey(cred, sealId, provider, framework, io) {
88
+ const name = (0, Credentials_1.modelKeyName)(provider);
89
+ const cur = await cred.get(sealId).catch(() => undefined);
90
+ if (cur?.definitions.some((d) => d.name === name)) {
91
+ return (0, modelKey_1.resetKeyForOlderImages)(provider, name, (io.draft ?? machineDraft).get(provider), io.out, () => pickModelKey(provider, io, { optional: true }));
92
+ }
93
+ const key = await pickModelKey(provider, io, { optional: mayGoKeyless(framework, provider) });
94
+ return { apiKey: key ?? undefined, keepStoredModelKey: false };
95
+ }
96
+ function missing(provider) {
97
+ return new errors_1.CliError('INFERENCE_KEY_REQUIRED', `no ${provider} model key`, {
98
+ remedy: `give one at the prompt, pipe it in, or save it with login ${provider}`,
99
+ });
100
+ }
101
+ /** The prompt of a REPL: questions through `ask`, secrets through `secret`. */
102
+ function replKeyPrompt(ask, secret, out) {
103
+ return {
104
+ interactive: true,
105
+ out,
106
+ secret,
107
+ confirm: async (question, def) => {
108
+ const a = (await ask(`${question} [${def ? 'Y/n' : 'y/N'}] `)).trim().toLowerCase();
109
+ return a ? a.startsWith('y') : def;
110
+ },
111
+ };
112
+ }
113
+ //# sourceMappingURL=modelkey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modelkey.js","sourceRoot":"","sources":["../../src/cli/modelkey.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;AAgCH,oCA2BC;AAQD,oCAEC;AAUD,sCAcC;AASD,sCAUC;AA9GD,gDAA8C;AAC9C,qCAAsC;AACtC,qCAAoC;AACpC,2CAAqD;AACrD,gDAA2D;AAe3D,MAAM,YAAY,GAAG;IACnB,GAAG,EAAE,CAAC,QAAgB,EAAE,EAAE,CAAC,IAAA,kCAAsB,EAAC,QAAQ,CAAC;IAC3D,IAAI,EAAE,CAAC,QAAgB,EAAE,GAAW,EAAE,EAAE,CAAC,IAAA,mBAAU,EAAC,QAAQ,EAAE,GAAG,CAAC;CACnE,CAAC;AAEF;;;;;GAKG;AACI,KAAK,UAAU,YAAY,CAAC,QAAgB,EAAE,EAAa,EAAE,OAA+B,EAAE;IACnG,MAAM,KAAK,GAAG,EAAE,CAAC,KAAK,IAAI,YAAY,CAAC;IACvC,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAClC,MAAM,IAAI,GAAG,CAAC,GAAW,EAAU,EAAE;QACnC,uEAAuE;QACvE,kBAAkB;QAClB,IAAI,uBAAuB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACtC,MAAM,IAAI,iBAAQ,CAAC,UAAU,EAAE,iDAAiD,EAAE,EAAE,MAAM,EAAE,YAAY,QAAQ,YAAY,EAAE,CAAC,CAAC;QAClI,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,QAA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