@kindgi/cli 0.1.4 → 0.1.5

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 (325) hide show
  1. package/README.md +13 -7
  2. package/dist/build/bundle.d.ts +11 -3
  3. package/dist/build/bundle.d.ts.map +1 -1
  4. package/dist/build/bundle.js +17 -3
  5. package/dist/build/bundle.js.map +1 -1
  6. package/dist/build/defaults.d.ts +3 -1
  7. package/dist/build/defaults.d.ts.map +1 -1
  8. package/dist/build/defaults.js +44 -1
  9. package/dist/build/defaults.js.map +1 -1
  10. package/dist/build/java-image.d.ts +31 -0
  11. package/dist/build/java-image.d.ts.map +1 -0
  12. package/dist/build/java-image.js +146 -0
  13. package/dist/build/java-image.js.map +1 -0
  14. package/dist/build/pack-root.d.ts +1 -31
  15. package/dist/build/pack-root.d.ts.map +1 -1
  16. package/dist/build/pack-root.js +22 -2
  17. package/dist/build/pack-root.js.map +1 -1
  18. package/dist/build/runners.d.ts +44 -0
  19. package/dist/build/runners.d.ts.map +1 -1
  20. package/dist/build/scala-image.d.ts +21 -0
  21. package/dist/build/scala-image.d.ts.map +1 -0
  22. package/dist/build/scala-image.js +150 -0
  23. package/dist/build/scala-image.js.map +1 -0
  24. package/dist/cli-pin.d.ts +16 -0
  25. package/dist/cli-pin.d.ts.map +1 -0
  26. package/dist/cli-pin.js +66 -0
  27. package/dist/cli-pin.js.map +1 -0
  28. package/dist/commands/agents.d.ts.map +1 -1
  29. package/dist/commands/agents.js +9 -8
  30. package/dist/commands/agents.js.map +1 -1
  31. package/dist/commands/approvals.d.ts.map +1 -1
  32. package/dist/commands/approvals.js +30 -4
  33. package/dist/commands/approvals.js.map +1 -1
  34. package/dist/commands/artifacts.d.ts.map +1 -1
  35. package/dist/commands/artifacts.js +100 -37
  36. package/dist/commands/artifacts.js.map +1 -1
  37. package/dist/commands/auth.js +2 -2
  38. package/dist/commands/blocks.d.ts.map +1 -1
  39. package/dist/commands/blocks.js +5 -4
  40. package/dist/commands/blocks.js.map +1 -1
  41. package/dist/commands/build.d.ts +10 -2
  42. package/dist/commands/build.d.ts.map +1 -1
  43. package/dist/commands/build.js +109 -16
  44. package/dist/commands/build.js.map +1 -1
  45. package/dist/commands/capabilities.d.ts.map +1 -1
  46. package/dist/commands/capabilities.js +37 -10
  47. package/dist/commands/capabilities.js.map +1 -1
  48. package/dist/commands/console.d.ts +21 -0
  49. package/dist/commands/console.d.ts.map +1 -0
  50. package/dist/commands/console.js +87 -0
  51. package/dist/commands/console.js.map +1 -0
  52. package/dist/commands/conversations.d.ts.map +1 -1
  53. package/dist/commands/conversations.js +13 -2
  54. package/dist/commands/conversations.js.map +1 -1
  55. package/dist/commands/deploy.d.ts.map +1 -1
  56. package/dist/commands/deploy.js +2 -2
  57. package/dist/commands/deploy.js.map +1 -1
  58. package/dist/commands/dev.d.ts +11 -0
  59. package/dist/commands/dev.d.ts.map +1 -1
  60. package/dist/commands/dev.js +212 -40
  61. package/dist/commands/dev.js.map +1 -1
  62. package/dist/commands/doctor.d.ts +14 -2
  63. package/dist/commands/doctor.d.ts.map +1 -1
  64. package/dist/commands/doctor.js +356 -20
  65. package/dist/commands/doctor.js.map +1 -1
  66. package/dist/commands/env-scoped.d.ts +44 -0
  67. package/dist/commands/env-scoped.d.ts.map +1 -0
  68. package/dist/commands/env-scoped.js +222 -0
  69. package/dist/commands/env-scoped.js.map +1 -0
  70. package/dist/commands/env.d.ts.map +1 -1
  71. package/dist/commands/env.js +85 -123
  72. package/dist/commands/env.js.map +1 -1
  73. package/dist/commands/eval-runs.d.ts +9 -0
  74. package/dist/commands/eval-runs.d.ts.map +1 -1
  75. package/dist/commands/eval-runs.js +20 -19
  76. package/dist/commands/eval-runs.js.map +1 -1
  77. package/dist/commands/eval-suites.d.ts.map +1 -1
  78. package/dist/commands/eval-suites.js +16 -8
  79. package/dist/commands/eval-suites.js.map +1 -1
  80. package/dist/commands/exports.d.ts +3 -0
  81. package/dist/commands/exports.d.ts.map +1 -0
  82. package/dist/commands/exports.js +82 -0
  83. package/dist/commands/exports.js.map +1 -0
  84. package/dist/commands/feedback.d.ts.map +1 -1
  85. package/dist/commands/feedback.js +6 -5
  86. package/dist/commands/feedback.js.map +1 -1
  87. package/dist/commands/flows.d.ts.map +1 -1
  88. package/dist/commands/flows.js +2 -1
  89. package/dist/commands/flows.js.map +1 -1
  90. package/dist/commands/gate-policies.d.ts.map +1 -1
  91. package/dist/commands/gate-policies.js +2 -1
  92. package/dist/commands/gate-policies.js.map +1 -1
  93. package/dist/commands/guardrails.d.ts.map +1 -1
  94. package/dist/commands/guardrails.js +3 -2
  95. package/dist/commands/guardrails.js.map +1 -1
  96. package/dist/commands/helpers.js +5 -5
  97. package/dist/commands/helpers.js.map +1 -1
  98. package/dist/commands/index.d.ts.map +1 -1
  99. package/dist/commands/index.js +14 -0
  100. package/dist/commands/index.js.map +1 -1
  101. package/dist/commands/init.d.ts +1 -1
  102. package/dist/commands/init.d.ts.map +1 -1
  103. package/dist/commands/init.js +254 -18
  104. package/dist/commands/init.js.map +1 -1
  105. package/dist/commands/judge-classes.d.ts.map +1 -1
  106. package/dist/commands/judge-classes.js +11 -10
  107. package/dist/commands/judge-classes.js.map +1 -1
  108. package/dist/commands/judgments.d.ts.map +1 -1
  109. package/dist/commands/judgments.js +7 -6
  110. package/dist/commands/judgments.js.map +1 -1
  111. package/dist/commands/key.js +4 -4
  112. package/dist/commands/memory.d.ts.map +1 -1
  113. package/dist/commands/memory.js +277 -25
  114. package/dist/commands/memory.js.map +1 -1
  115. package/dist/commands/people.d.ts +3 -0
  116. package/dist/commands/people.d.ts.map +1 -0
  117. package/dist/commands/people.js +166 -0
  118. package/dist/commands/people.js.map +1 -0
  119. package/dist/commands/proposals.d.ts.map +1 -1
  120. package/dist/commands/proposals.js +390 -69
  121. package/dist/commands/proposals.js.map +1 -1
  122. package/dist/commands/provenance.d.ts.map +1 -1
  123. package/dist/commands/provenance.js +6 -7
  124. package/dist/commands/provenance.js.map +1 -1
  125. package/dist/commands/providers.d.ts.map +1 -1
  126. package/dist/commands/providers.js +7 -5
  127. package/dist/commands/providers.js.map +1 -1
  128. package/dist/commands/reviewers.d.ts.map +1 -1
  129. package/dist/commands/reviewers.js +3 -2
  130. package/dist/commands/reviewers.js.map +1 -1
  131. package/dist/commands/runs.d.ts.map +1 -1
  132. package/dist/commands/runs.js +35 -15
  133. package/dist/commands/runs.js.map +1 -1
  134. package/dist/commands/schedules.d.ts +3 -0
  135. package/dist/commands/schedules.d.ts.map +1 -0
  136. package/dist/commands/schedules.js +275 -0
  137. package/dist/commands/schedules.js.map +1 -0
  138. package/dist/commands/secrets.d.ts.map +1 -1
  139. package/dist/commands/secrets.js +10 -11
  140. package/dist/commands/secrets.js.map +1 -1
  141. package/dist/commands/service-accounts.d.ts +3 -0
  142. package/dist/commands/service-accounts.d.ts.map +1 -0
  143. package/dist/commands/service-accounts.js +175 -0
  144. package/dist/commands/service-accounts.js.map +1 -0
  145. package/dist/commands/skills.d.ts +1 -1
  146. package/dist/commands/skills.d.ts.map +1 -1
  147. package/dist/commands/skills.js +11 -4
  148. package/dist/commands/skills.js.map +1 -1
  149. package/dist/commands/sso.d.ts +6 -0
  150. package/dist/commands/sso.d.ts.map +1 -0
  151. package/dist/commands/sso.js +318 -0
  152. package/dist/commands/sso.js.map +1 -0
  153. package/dist/commands/tokens.d.ts +11 -0
  154. package/dist/commands/tokens.d.ts.map +1 -1
  155. package/dist/commands/tokens.js +144 -11
  156. package/dist/commands/tokens.js.map +1 -1
  157. package/dist/commands/tools.d.ts.map +1 -1
  158. package/dist/commands/tools.js +4 -3
  159. package/dist/commands/tools.js.map +1 -1
  160. package/dist/commands/unwired.d.ts.map +1 -1
  161. package/dist/commands/unwired.js +1 -30
  162. package/dist/commands/unwired.js.map +1 -1
  163. package/dist/commands/upgrade.d.ts +11 -0
  164. package/dist/commands/upgrade.d.ts.map +1 -0
  165. package/dist/commands/upgrade.js +160 -0
  166. package/dist/commands/upgrade.js.map +1 -0
  167. package/dist/context.d.ts +7 -0
  168. package/dist/context.d.ts.map +1 -1
  169. package/dist/context.js +1 -0
  170. package/dist/context.js.map +1 -1
  171. package/dist/dev/defaults.d.ts +28 -11
  172. package/dist/dev/defaults.d.ts.map +1 -1
  173. package/dist/dev/defaults.js +114 -35
  174. package/dist/dev/defaults.js.map +1 -1
  175. package/dist/dev/google-credentials.d.ts +50 -0
  176. package/dist/dev/google-credentials.d.ts.map +1 -0
  177. package/dist/dev/google-credentials.js +157 -0
  178. package/dist/dev/google-credentials.js.map +1 -0
  179. package/dist/dev/java-builder.d.ts +56 -0
  180. package/dist/dev/java-builder.d.ts.map +1 -0
  181. package/dist/dev/java-builder.js +204 -0
  182. package/dist/dev/java-builder.js.map +1 -0
  183. package/dist/dev/jvm-run-files.d.ts +29 -0
  184. package/dist/dev/jvm-run-files.d.ts.map +1 -0
  185. package/dist/dev/jvm-run-files.js +94 -0
  186. package/dist/dev/jvm-run-files.js.map +1 -0
  187. package/dist/dev/lines.d.ts +13 -0
  188. package/dist/dev/lines.d.ts.map +1 -0
  189. package/dist/dev/lines.js +24 -0
  190. package/dist/dev/lines.js.map +1 -0
  191. package/dist/dev/log-view.d.ts +116 -0
  192. package/dist/dev/log-view.d.ts.map +1 -0
  193. package/dist/dev/log-view.js +233 -0
  194. package/dist/dev/log-view.js.map +1 -0
  195. package/dist/dev/pack-code.d.ts +79 -4
  196. package/dist/dev/pack-code.d.ts.map +1 -1
  197. package/dist/dev/pack-code.js +262 -3
  198. package/dist/dev/pack-code.js.map +1 -1
  199. package/dist/dev/pack-env.d.ts.map +1 -1
  200. package/dist/dev/pack-env.js +4 -0
  201. package/dist/dev/pack-env.js.map +1 -1
  202. package/dist/dev/pack-service.d.ts +11 -1
  203. package/dist/dev/pack-service.d.ts.map +1 -1
  204. package/dist/dev/pack-service.js +56 -20
  205. package/dist/dev/pack-service.js.map +1 -1
  206. package/dist/dev/paths.d.ts +6 -0
  207. package/dist/dev/paths.d.ts.map +1 -1
  208. package/dist/dev/paths.js +8 -0
  209. package/dist/dev/paths.js.map +1 -1
  210. package/dist/dev/project-database.js +1 -1
  211. package/dist/dev/project-database.js.map +1 -1
  212. package/dist/dev/runners.d.ts +35 -9
  213. package/dist/dev/runners.d.ts.map +1 -1
  214. package/dist/dev/runtime-container.d.ts +10 -2
  215. package/dist/dev/runtime-container.d.ts.map +1 -1
  216. package/dist/dev/runtime-container.js +48 -20
  217. package/dist/dev/runtime-container.js.map +1 -1
  218. package/dist/dev/runtime-env.d.ts +10 -0
  219. package/dist/dev/runtime-env.d.ts.map +1 -1
  220. package/dist/dev/runtime-env.js +8 -4
  221. package/dist/dev/runtime-env.js.map +1 -1
  222. package/dist/dev/runtime-image.d.ts +1 -1
  223. package/dist/dev/runtime-image.js +1 -1
  224. package/dist/dev/scala-builder.d.ts +72 -0
  225. package/dist/dev/scala-builder.d.ts.map +1 -0
  226. package/dist/dev/scala-builder.js +347 -0
  227. package/dist/dev/scala-builder.js.map +1 -0
  228. package/dist/env/project-env.d.ts.map +1 -1
  229. package/dist/env/project-env.js +3 -1
  230. package/dist/env/project-env.js.map +1 -1
  231. package/dist/errors.d.ts +9 -0
  232. package/dist/errors.d.ts.map +1 -1
  233. package/dist/errors.js +15 -0
  234. package/dist/errors.js.map +1 -1
  235. package/dist/init/augment-scaffolder.js +1 -1
  236. package/dist/init/augment-scaffolder.js.map +1 -1
  237. package/dist/init/dependency-specs.d.ts +26 -0
  238. package/dist/init/dependency-specs.d.ts.map +1 -1
  239. package/dist/init/dependency-specs.js +38 -0
  240. package/dist/init/dependency-specs.js.map +1 -1
  241. package/dist/init/java-augment.d.ts +24 -0
  242. package/dist/init/java-augment.d.ts.map +1 -0
  243. package/dist/init/java-augment.js +198 -0
  244. package/dist/init/java-augment.js.map +1 -0
  245. package/dist/init/mode-detect.d.ts +2 -2
  246. package/dist/init/mode-detect.d.ts.map +1 -1
  247. package/dist/init/mode-detect.js +12 -1
  248. package/dist/init/mode-detect.js.map +1 -1
  249. package/dist/init/python-augment.js +1 -1
  250. package/dist/init/python-augment.js.map +1 -1
  251. package/dist/init/scala-augment.d.ts +23 -0
  252. package/dist/init/scala-augment.d.ts.map +1 -0
  253. package/dist/init/scala-augment.js +213 -0
  254. package/dist/init/scala-augment.js.map +1 -0
  255. package/dist/init/template-files.d.ts +40 -2
  256. package/dist/init/template-files.d.ts.map +1 -1
  257. package/dist/init/template-files.js +56 -5
  258. package/dist/init/template-files.js.map +1 -1
  259. package/dist/main.d.ts +3 -0
  260. package/dist/main.d.ts.map +1 -1
  261. package/dist/main.js +20 -2
  262. package/dist/main.js.map +1 -1
  263. package/dist/open-url.d.ts +15 -0
  264. package/dist/open-url.d.ts.map +1 -0
  265. package/dist/open-url.js +41 -0
  266. package/dist/open-url.js.map +1 -0
  267. package/dist/package-manager.d.ts +10 -3
  268. package/dist/package-manager.d.ts.map +1 -1
  269. package/dist/package-manager.js +19 -1
  270. package/dist/package-manager.js.map +1 -1
  271. package/dist/providers/presets/anthropic.json +11 -3
  272. package/dist/sdk-skills/kindgi-authoring-agents/SKILL.md +30 -2
  273. package/dist/sdk-skills/kindgi-authoring-flows/SKILL.md +1 -1
  274. package/dist/sdk-skills/kindgi-authoring-guardrails/SKILL.md +47 -3
  275. package/dist/sdk-skills/kindgi-authoring-mcp-servers/SKILL.md +7 -5
  276. package/dist/sdk-skills/kindgi-authoring-providers/SKILL.md +40 -15
  277. package/dist/sdk-skills/kindgi-authoring-tools/SKILL.md +66 -2
  278. package/dist/sdk-skills/kindgi-framework-feedback/SKILL.md +5 -4
  279. package/dist/sdk-skills/kindgi-getting-started/SKILL.md +1 -1
  280. package/dist/sdk-skills/kindgi-java-authoring-agents/SKILL.md +220 -0
  281. package/dist/sdk-skills/kindgi-java-authoring-flows/SKILL.md +390 -0
  282. package/dist/sdk-skills/kindgi-java-authoring-guardrails/SKILL.md +209 -0
  283. package/dist/sdk-skills/kindgi-java-authoring-tools/SKILL.md +334 -0
  284. package/dist/sdk-skills/kindgi-java-getting-started/SKILL.md +270 -0
  285. package/dist/sdk-skills/kindgi-python-authoring-agents/SKILL.md +25 -3
  286. package/dist/sdk-skills/kindgi-python-authoring-flows/SKILL.md +1 -1
  287. package/dist/sdk-skills/kindgi-python-authoring-guardrails/SKILL.md +10 -3
  288. package/dist/sdk-skills/kindgi-python-authoring-tools/SKILL.md +45 -6
  289. package/dist/sdk-skills/kindgi-python-getting-started/SKILL.md +2 -2
  290. package/dist/sdk-skills/kindgi-scala-authoring-agents/SKILL.md +217 -0
  291. package/dist/sdk-skills/kindgi-scala-authoring-flows/SKILL.md +357 -0
  292. package/dist/sdk-skills/kindgi-scala-authoring-guardrails/SKILL.md +199 -0
  293. package/dist/sdk-skills/kindgi-scala-authoring-tools/SKILL.md +302 -0
  294. package/dist/sdk-skills/kindgi-scala-getting-started/SKILL.md +302 -0
  295. package/dist/templates/java/.mvn/wrapper/maven-wrapper.properties +3 -0
  296. package/dist/templates/java/AGENTS.md +31 -0
  297. package/dist/templates/java/README.md.tmpl +69 -0
  298. package/dist/templates/java/gitignore +9 -0
  299. package/dist/templates/java/kindgi.config.json.tmpl +8 -0
  300. package/dist/templates/java/kindgiw +33 -0
  301. package/dist/templates/java/kindgiw.cmd +28 -0
  302. package/dist/templates/java/mvnw +295 -0
  303. package/dist/templates/java/pom.xml.tmpl +65 -0
  304. package/dist/templates/java/src/main/java/__PACKAGE__/agents/EchoAgent.java.tmpl +27 -0
  305. package/dist/templates/java/src/main/java/__PACKAGE__/flows/EchoFlow.java.tmpl +18 -0
  306. package/dist/templates/java/src/main/java/__PACKAGE__/guardrails/ResponseNotEmpty.java.tmpl +28 -0
  307. package/dist/templates/java/src/main/java/__PACKAGE__/tools/Echo.java.tmpl +22 -0
  308. package/dist/templates/java/src/main/java/__PACKAGE__/tools/Greet.java.tmpl +23 -0
  309. package/dist/templates/java/src/test/java/__PACKAGE__/ToolsTest.java.tmpl +30 -0
  310. package/dist/templates/minimal/README.md.tmpl +6 -12
  311. package/dist/templates/python/README.md.tmpl +4 -4
  312. package/dist/templates/sample/README.md.tmpl +5 -11
  313. package/dist/templates/scala/AGENTS.md +32 -0
  314. package/dist/templates/scala/README.md.tmpl +75 -0
  315. package/dist/templates/scala/build.sbt.tmpl +16 -0
  316. package/dist/templates/scala/gitignore +13 -0
  317. package/dist/templates/scala/kindgi.config.json.tmpl +8 -0
  318. package/dist/templates/scala/project/build.properties +1 -0
  319. package/dist/templates/scala/src/main/scala/__PACKAGE__/agents/EchoAgent.scala.tmpl +23 -0
  320. package/dist/templates/scala/src/main/scala/__PACKAGE__/flows/EchoFlow.scala.tmpl +16 -0
  321. package/dist/templates/scala/src/main/scala/__PACKAGE__/guardrails/ResponseNotEmpty.scala.tmpl +21 -0
  322. package/dist/templates/scala/src/main/scala/__PACKAGE__/tools/Echo.scala.tmpl +16 -0
  323. package/dist/templates/scala/src/main/scala/__PACKAGE__/tools/Greet.scala.tmpl +17 -0
  324. package/dist/templates/scala/src/test/scala/__PACKAGE__/ToolsSuite.scala.tmpl +23 -0
  325. package/package.json +13 -12
@@ -1,5 +1,6 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  // Copyright (C) 2026 Kindgi Inc.
3
+ import { UsageError } from '../errors.js';
3
4
  import { integerFlag, listFlag, requiredPositional, runSdk, stringFlag } from './helpers.js';
4
5
  const SCOPE_FLAGS = {
5
6
  tenant: { type: 'boolean', description: 'The whole tenant.' },
@@ -15,19 +16,19 @@ function scopeFromFlags(ctx, required) {
15
16
  const projectId = stringFlag(ctx, 'project');
16
17
  const agentId = stringFlag(ctx, 'agent');
17
18
  if (tenant && (projectId !== undefined || agentId !== undefined)) {
18
- throw new Error('--tenant cannot be combined with --project or --agent');
19
+ throw new UsageError('--tenant cannot be combined with --project or --agent');
19
20
  }
20
21
  if (tenant)
21
22
  return { kind: 'tenant' };
22
23
  if (agentId !== undefined) {
23
24
  if (projectId === undefined)
24
- throw new Error('--agent needs --project');
25
+ throw new UsageError('--agent needs --project');
25
26
  return { kind: 'agent', projectId, agentId };
26
27
  }
27
28
  if (projectId !== undefined)
28
29
  return { kind: 'project', projectId };
29
30
  if (required)
30
- throw new Error('Give a scope: --tenant, --project=<id>, or --agent=<id> --project=<id>');
31
+ throw new UsageError('Give a scope: --tenant, --project=<id>, or --agent=<id> --project=<id>');
31
32
  return undefined;
32
33
  }
33
34
  const REVIEWER_ROLES = ['standard', 'senior', 'admin'];
@@ -53,12 +54,12 @@ const ASSERTABLE_USAGE = '[--min-reviewer-role=standard|senior|admin] [--princip
53
54
  function assertableByFromFlags(ctx) {
54
55
  const role = stringFlag(ctx, 'min-reviewer-role');
55
56
  if (role !== undefined && !REVIEWER_ROLES.includes(role)) {
56
- throw new Error(`--min-reviewer-role must be one of ${REVIEWER_ROLES.join(', ')}, got "${role}"`);
57
+ throw new UsageError(`--min-reviewer-role must be one of ${REVIEWER_ROLES.join(', ')}, got "${role}"`);
57
58
  }
58
59
  const kinds = listFlag(ctx, 'principal-kind');
59
60
  for (const kind of kinds) {
60
61
  if (!PRINCIPAL_KINDS.includes(kind)) {
61
- throw new Error(`--principal-kind must be user or service, got "${kind}"`);
62
+ throw new UsageError(`--principal-kind must be user or service, got "${kind}"`);
62
63
  }
63
64
  }
64
65
  const ids = listFlag(ctx, 'principal-id');
@@ -78,7 +79,7 @@ function weightFlag(ctx) {
78
79
  return undefined;
79
80
  const n = Number(raw);
80
81
  if (!Number.isFinite(n) || n < 0)
81
- throw new Error(`--weight must be a number of 0 or more, got '${raw}'`);
82
+ throw new UsageError(`--weight must be a number of 0 or more, got '${raw}'`);
82
83
  return n;
83
84
  }
84
85
  const list = {
@@ -123,10 +124,10 @@ const add = {
123
124
  run: (ctx) => runSdk(ctx, 'judge-classes add', async () => {
124
125
  const name = stringFlag(ctx, 'name');
125
126
  if (name === undefined)
126
- throw new Error('--name=<name> is required');
127
+ throw new UsageError('--name=<name> is required');
127
128
  const weight = weightFlag(ctx);
128
129
  if (weight === undefined)
129
- throw new Error('--weight=<w> is required');
130
+ throw new UsageError('--weight=<w> is required');
130
131
  const scope = scopeFromFlags(ctx, true);
131
132
  const description = stringFlag(ctx, 'description');
132
133
  const assertableBy = assertableByFromFlags(ctx);
@@ -160,11 +161,11 @@ const set = {
160
161
  const restricted = assertableByFromFlags(ctx);
161
162
  const unrestricted = ctx.options.unrestricted === true;
162
163
  if (restricted !== undefined && unrestricted) {
163
- throw new Error('--unrestricted cannot be combined with the restriction flags');
164
+ throw new UsageError('--unrestricted cannot be combined with the restriction flags');
164
165
  }
165
166
  const assertableBy = unrestricted ? null : restricted;
166
167
  if (weight === undefined && description === undefined && assertableBy === undefined) {
167
- throw new Error('Give --weight, --description, a restriction flag, or --unrestricted');
168
+ throw new UsageError('Give --weight, --description, a restriction flag, or --unrestricted');
168
169
  }
169
170
  return await ctx.client().judgeClasses.update(id, {
170
171
  ...(weight !== undefined && { weight }),
@@ -1 +1 @@
1
- {"version":3,"file":"judge-classes.js","sourceRoot":"","sources":["../../src/commands/judge-classes.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,iCAAiC;AAKjC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG7F,MAAM,WAAW,GAAG;IAClB,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,mBAAmB,EAAE;IAC7D,OAAO,EAAE;QACP,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,gEAAgE;KAC9E;IACD,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,sCAAsC,EAAE;CACtE,CAAC;AAEX,wFAAwF;AACxF,SAAS,cAAc,CAAC,GAAmB,EAAE,QAAiB;IAC5D,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,IAAI,CAAC;IAC3C,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IAC7C,MAAM,OAAO,GAA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;IAC7C,CAAC,CAAC;CACL,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAY;IAC1C,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,gFAAgF;IAC7F,WAAW,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC;CACtC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"judgments.d.ts","sourceRoot":"","sources":["../../src/commands/judgments.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAe,MAAM,YAAY,CAAC;AAuKvD,eAAO,MAAM,gBAAgB,EAAE,OAK9B,CAAC"}
1
+ {"version":3,"file":"judgments.d.ts","sourceRoot":"","sources":["../../src/commands/judgments.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAe,MAAM,YAAY,CAAC;AAuKvD,eAAO,MAAM,gBAAgB,EAAE,OAK9B,CAAC"}
@@ -1,5 +1,6 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  // Copyright (C) 2026 Kindgi Inc.
3
+ import { UsageError } from '../errors.js';
3
4
  import { integerFlag, requiredPositional, runSdk, stringFlag } from './helpers.js';
4
5
  const VERDICTS = ['yes', 'no'];
5
6
  /** The string flags given, under their request field names (`{ class: 'judgeClassId' }`). */
@@ -43,17 +44,17 @@ const add = {
43
44
  run: (ctx) => runSdk(ctx, 'judgments add', async () => {
44
45
  const runId = stringFlag(ctx, 'run');
45
46
  if (runId === undefined)
46
- throw new Error('--run=<run-id> is required');
47
+ throw new UsageError('--run=<run-id> is required');
47
48
  const key = stringFlag(ctx, 'item');
48
49
  if (key === undefined)
49
- throw new Error('--item=<key> is required');
50
+ throw new UsageError('--item=<key> is required');
50
51
  const yes = ctx.options.yes === true;
51
52
  const no = ctx.options.no === true;
52
53
  if (yes === no)
53
- throw new Error('Give exactly one of --yes or --no');
54
+ throw new UsageError('Give exactly one of --yes or --no');
54
55
  const rank = integerFlag(ctx, 'rank');
55
56
  if (rank !== undefined && rank < 0)
56
- throw new Error('--rank must be 0 or more');
57
+ throw new UsageError('--rank must be 0 or more');
57
58
  const pointer = ctx.options.pointer;
58
59
  return await ctx.client().judgments.create({
59
60
  runId,
@@ -104,11 +105,11 @@ const list = {
104
105
  run: (ctx) => runSdk(ctx, 'judgments list', async () => {
105
106
  if (stringFlag(ctx, 'agent-version') !== undefined &&
106
107
  stringFlag(ctx, 'agent') === undefined) {
107
- throw new Error('--agent-version needs --agent');
108
+ throw new UsageError('--agent-version needs --agent');
108
109
  }
109
110
  const verdict = stringFlag(ctx, 'verdict');
110
111
  if (verdict !== undefined && !VERDICTS.includes(verdict)) {
111
- throw new Error(`--verdict must be one of ${VERDICTS.join(', ')}, got "${verdict}"`);
112
+ throw new UsageError(`--verdict must be one of ${VERDICTS.join(', ')}, got "${verdict}"`);
112
113
  }
113
114
  const projectId = stringFlag(ctx, 'project');
114
115
  const limit = integerFlag(ctx, 'limit');
@@ -1 +1 @@
1
- {"version":3,"file":"judgments.js","sourceRoot":"","sources":["../../src/commands/judgments.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,iCAAiC;AAGjC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAGnF,MAAM,QAAQ,GAAG,CAAC,KAAK,EAAE,IAAI,CAAU,CAAC;AAExC,6FAA6F;AAC7F,SAAS,UAAU,CACjB,GAAmB,EACnB,MAAmC;IAEnC,MAAM,GAAG,GAA+B,EAAE,CAAC;IAC3C,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACnD,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACpC,IAAI,KAAK,KAAK,SAAS;YAAE,GAAG,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;IAC9C,CA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EAAE,KAAK,IAAI,EAAE;QACvC,MAAM,EAAE,GAAG,kBAAkB,CAAC,GAAG,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC;QACrD,OAAO,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC9C,CAAC,CAAC;CACL,CAAC;AAEF,MAAM,MAAM,GAAgB;IAC1B,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,oBAAoB;IACjC,KAAK,EAAE,uCAAuC;IAC9C,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE,CACX,MAAM,CAAC,GAAG,EAAE,kBAAkB,EAAE,KAAK,IAAI,EAAE;QACzC,MAAM,EAAE,GAAG,kBAAkB,CAAC,GAAG,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC;QACrD,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QAC5C,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3C,CAAC,CAAC;CACL,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAY;IACvC,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,wEAAwE;IACrF,WAAW,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC;CACvC,CAAC"}
@@ -78,7 +78,7 @@ const createCmd = {
78
78
  run: async (ctx) => {
79
79
  const idCheck = validateKeyId(ctx.positionals[0]);
80
80
  if (!idCheck.ok) {
81
- return { kind: 'error', stderr: `${idCheck.error}\n`, exitCode: 1 };
81
+ return { kind: 'error', stderr: `${idCheck.error}\n`, exitCode: 2 };
82
82
  }
83
83
  const keyId = idCheck.id;
84
84
  const runnersOutcome = pickRunners(ctx);
@@ -168,7 +168,7 @@ const exportCmd = {
168
168
  run: async (ctx) => {
169
169
  const idCheck = validateKeyId(ctx.positionals[0]);
170
170
  if (!idCheck.ok) {
171
- return { kind: 'error', stderr: `${idCheck.error}\n`, exitCode: 1 };
171
+ return { kind: 'error', stderr: `${idCheck.error}\n`, exitCode: 2 };
172
172
  }
173
173
  const keyId = idCheck.id;
174
174
  const formatFlag = ctx.options.format;
@@ -177,7 +177,7 @@ const exportCmd = {
177
177
  return {
178
178
  kind: 'error',
179
179
  stderr: `Unknown --format: ${formatInput}. Available: ${AVAILABLE_FORMATS.join(', ')}.\n`,
180
- exitCode: 1,
180
+ exitCode: 2,
181
181
  };
182
182
  }
183
183
  const format = formatInput;
@@ -332,7 +332,7 @@ const trustCmd = {
332
332
  run: async (ctx) => {
333
333
  const idCheck = validateKeyId(ctx.positionals[0]);
334
334
  if (!idCheck.ok) {
335
- return { kind: 'error', stderr: `${idCheck.error}\n`, exitCode: 1 };
335
+ return { kind: 'error', stderr: `${idCheck.error}\n`, exitCode: 2 };
336
336
  }
337
337
  const keyId = idCheck.id;
338
338
  const runnersOutcome = pickRunners(ctx);
@@ -1 +1 @@
1
- {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/commands/memory.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,OAAO,EAAe,MAAM,YAAY,CAAC;AAqKvD,eAAO,MAAM,aAAa,EAAE,OAK3B,CAAC"}
1
+ {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/commands/memory.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,OAAO,EAAe,MAAM,YAAY,CAAC;AAmevD,eAAO,MAAM,aAAa,EAAE,OAM3B,CAAC"}
@@ -1,6 +1,9 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  // Copyright (C) 2026 Kindgi Inc.
3
- import { integerFlag, readJsonInput, requiredPositional, runSdk, stringFlag, throwUnwired, truncateCell, } from './helpers.js';
3
+ import { writeFile } from 'node:fs/promises';
4
+ import { UsageError } from '../errors.js';
5
+ import { integerFlag, readJsonInput, requiredPositional, runSdk, stringFlag, truncateCell, } from './helpers.js';
6
+ const contentCell = (f) => f.content !== undefined ? truncateCell(JSON.stringify(f.content), 60) : '';
4
7
  /** `memory facts list --table`. */
5
8
  const FACTS_TABLE = {
6
9
  rows: (page) => page.data,
@@ -8,32 +11,55 @@ const FACTS_TABLE = {
8
11
  { header: 'ID', get: (f) => String(f.id) },
9
12
  { header: 'TYPE', get: (f) => f.type },
10
13
  { header: 'VERSION', get: (f) => String(f.version) },
14
+ { header: 'TRUST', get: (f) => f.trust ?? 'asserted' },
15
+ { header: 'CREATED', get: (f) => String(f.createdAt) },
16
+ { header: 'CONTENT', get: contentCell },
17
+ ],
18
+ };
19
+ /** `memory facts revisions --table`: newest first, with why each one stopped being current. */
20
+ const REVISIONS_TABLE = {
21
+ rows: (revisions) => revisions,
22
+ columns: [
23
+ { header: 'VERSION', get: (f) => String(f.version) },
24
+ { header: 'TRUST', get: (f) => f.trust ?? 'asserted' },
11
25
  { header: 'CREATED', get: (f) => String(f.createdAt) },
12
26
  {
13
- header: 'CONTENT',
14
- get: (f) => (f.content !== undefined ? truncateCell(JSON.stringify(f.content), 60) : ''),
27
+ header: 'ENDED',
28
+ get: (f) => f.invalidatedAt === undefined
29
+ ? 'current'
30
+ : `${f.invalidationReason ?? 'ended'} ${String(f.invalidatedAt)} by ${f.invalidatedBy ?? '?'}`,
15
31
  },
32
+ { header: 'CONTENT', get: contentCell },
16
33
  ],
17
34
  };
35
+ const AS_OF_OPTION = {
36
+ type: 'string',
37
+ description: 'Memory as it stood at this time (ISO 8601), deleted and superseded facts included.',
38
+ };
39
+ const EXPECT_VERSION_OPTION = {
40
+ type: 'string',
41
+ description: 'Only if the fact is still at this revision (its `version`); if someone changed it first, nothing changes and the command fails with `fact-changed`.',
42
+ };
18
43
  /** A JSON object from inline JSON or `@<file>`, or an error naming the flag. */
19
44
  async function jsonObjectFlag(text, flag) {
20
45
  const value = await readJsonInput(text);
21
46
  if (value === null || typeof value !== 'object' || Array.isArray(value)) {
22
- throw new Error(`--${flag} must be a JSON object`);
47
+ throw new UsageError(`--${flag} must be a JSON object`);
23
48
  }
24
49
  return value;
25
50
  }
26
51
  const factsList = {
27
52
  kind: 'leaf',
28
53
  name: 'list',
29
- description: 'List memory facts, the latest version of each.',
30
- usage: 'kindgi memory facts list [--type=<type>] [--scope=<json-or-@file>] [--limit=<n>] [--cursor=<c>]',
54
+ description: 'List the memory facts you may see, the current revision of each.',
55
+ usage: 'kindgi memory facts list [--type=<type>] [--scope=<json-or-@file>] [--as-of=<time>] [--limit=<n>] [--cursor=<c>]',
31
56
  optionSpec: {
32
57
  type: { type: 'string', description: 'Only the facts of this type.' },
33
58
  scope: {
34
59
  type: 'string',
35
- description: 'Only the facts in this scope, as inline JSON or `@<file>`: any of `userId`, `orgId`, `projectId`, `threadId`, `sessionId`; every key given must match.',
60
+ description: 'Only the facts in this scope, as inline JSON or `@<file>`: any of `userId`, `orgId`, `projectId`, `threadId`, `sessionId`, `participantId`; every key given must match.',
36
61
  },
62
+ 'as-of': AS_OF_OPTION,
37
63
  limit: { type: 'string', description: 'The most facts to return (default 25, at most 100).' },
38
64
  cursor: {
39
65
  type: 'string',
@@ -46,9 +72,11 @@ const factsList = {
46
72
  const scope = scopeText === undefined ? undefined : await jsonObjectFlag(scopeText, 'scope');
47
73
  const limit = integerFlag(ctx, 'limit');
48
74
  const cursor = stringFlag(ctx, 'cursor');
75
+ const asOf = stringFlag(ctx, 'as-of');
49
76
  return await ctx.client().memory.facts.list({
50
77
  ...(type !== undefined && { type }),
51
78
  ...(scope !== undefined && { scope }),
79
+ ...(asOf !== undefined && { asOf }),
52
80
  ...(limit !== undefined && { limit }),
53
81
  ...(cursor !== undefined && { cursor: cursor }),
54
82
  });
@@ -57,13 +85,35 @@ const factsList = {
57
85
  const factsGet = {
58
86
  kind: 'leaf',
59
87
  name: 'get',
60
- description: 'A memory fact by id, its latest version.',
61
- usage: 'kindgi memory facts get <fact-id>',
88
+ description: 'A memory fact by id: its current revision, one revision, or as it stood then.',
89
+ usage: 'kindgi memory facts get <fact-id> [--revision=<n>] [--as-of=<time>]',
90
+ optionSpec: {
91
+ revision: { type: 'string', description: 'This revision (its `version`), current or not.' },
92
+ 'as-of': AS_OF_OPTION,
93
+ },
62
94
  run: (ctx) => runSdk(ctx, 'memory facts get', async () => {
63
95
  const id = requiredPositional(ctx, 0, 'fact-id');
64
- return await ctx.client().memory.facts.read(id);
96
+ const version = integerFlag(ctx, 'revision');
97
+ const asOf = stringFlag(ctx, 'as-of');
98
+ const options = {
99
+ ...(version !== undefined && { version }),
100
+ ...(asOf !== undefined && { asOf }),
101
+ };
102
+ return Object.keys(options).length === 0
103
+ ? await ctx.client().memory.facts.read(id)
104
+ : await ctx.client().memory.facts.read(id, options);
65
105
  }),
66
106
  };
107
+ const factsRevisions = {
108
+ kind: 'leaf',
109
+ name: 'revisions',
110
+ description: "A memory fact's revisions, newest first: who changed or deleted it, when and why.",
111
+ usage: 'kindgi memory facts revisions <fact-id>',
112
+ run: (ctx) => runSdk(ctx, 'memory facts revisions', async () => {
113
+ const id = requiredPositional(ctx, 0, 'fact-id');
114
+ return await ctx.client().memory.facts.revisions(id);
115
+ }, REVISIONS_TABLE),
116
+ };
67
117
  const factsWrite = {
68
118
  kind: 'leaf',
69
119
  name: 'write',
@@ -72,17 +122,17 @@ const factsWrite = {
72
122
  optionSpec: {
73
123
  input: {
74
124
  type: 'string',
75
- description: 'The fact as inline JSON or `@<file>`: its `type` and `content`, and optionally `scope` (default: your tenant; narrow it with `userId`, `orgId`, `projectId`, `threadId`, `sessionId`) and `retention` (`keepDays`, `keepUntil`, `legalHold`). Required.',
125
+ description: 'The fact as inline JSON or `@<file>`: its `type` and `content`, and optionally `scope` (default: your tenant; narrow it with `userId`, `orgId`, `projectId`, `threadId`, `sessionId`, or an app\'s end user with `projectId` and `participantId`), `retention` (`keepDays`, `keepUntil`, `legalHold`), `subjects` (whom it is about: `[{"kind":"participant","id":"…"}]`) and `validFrom`/`validUntil`/`observedAt`. Required.',
76
126
  },
77
127
  },
78
128
  run: (ctx) => runSdk(ctx, 'memory facts write', async () => {
79
129
  const inputText = stringFlag(ctx, 'input');
80
130
  if (inputText === undefined)
81
- throw new Error('--input=<json-or-@file> is required');
131
+ throw new UsageError('--input=<json-or-@file> is required');
82
132
  const input = (await jsonObjectFlag(inputText, 'input'));
83
133
  const scope = input.scope ?? {};
84
134
  if (scope === null || typeof scope !== 'object' || Array.isArray(scope)) {
85
- throw new Error('--input `scope` must be a JSON object');
135
+ throw new UsageError('--input `scope` must be a JSON object');
86
136
  }
87
137
  const client = ctx.client();
88
138
  // The API asks for the scope's tenant, which can only be the caller's.
@@ -99,42 +149,244 @@ const factsWrite = {
99
149
  const factsSupersede = {
100
150
  kind: 'leaf',
101
151
  name: 'supersede',
102
- description: 'Supersede an existing memory fact.',
103
- usage: 'kindgi memory facts supersede <fact-id> --input=<json-or-@file>',
152
+ description: "Change a memory fact's content: writes its next revision (same id). Prints the new revision.",
153
+ usage: 'kindgi memory facts supersede <fact-id> --input=<json-or-@file> [--expect-version=<n>]',
104
154
  optionSpec: {
105
155
  input: {
106
156
  type: 'string',
107
- description: 'Inline JSON or `@<file>`. Currently unused: superseding a fact takes only its id.',
157
+ description: 'The next revision as inline JSON or `@<file>`: its `content`, and optionally `retention`, `subjects` and `validFrom`/`validUntil`/`observedAt` (absent ones keep their current values). Its type and scope stay. Required.',
108
158
  },
159
+ 'expect-version': EXPECT_VERSION_OPTION,
109
160
  },
110
161
  run: (ctx) => runSdk(ctx, 'memory facts supersede', async () => {
111
- requiredPositional(ctx, 0, 'fact-id');
112
- throwUnwired('memory.facts.supersede');
162
+ const id = requiredPositional(ctx, 0, 'fact-id');
163
+ const inputText = stringFlag(ctx, 'input');
164
+ if (inputText === undefined)
165
+ throw new UsageError('--input=<json-or-@file> is required');
166
+ const input = (await jsonObjectFlag(inputText, 'input'));
167
+ if (!('content' in input))
168
+ throw new UsageError('--input needs `content`: the next revision');
169
+ const expectVersion = integerFlag(ctx, 'expect-version');
170
+ // The rest is the server's to check.
171
+ return await ctx.client().memory.facts.supersede(id, {
172
+ ...input,
173
+ content: input.content,
174
+ ...(expectVersion !== undefined && { expectVersion }),
175
+ });
113
176
  }),
114
177
  };
178
+ const factsDelete = {
179
+ kind: 'leaf',
180
+ name: 'delete',
181
+ description: 'Delete a memory fact: agents and reads no longer see it; its history stays until retention removes it. Prints the closed revision.',
182
+ usage: 'kindgi memory facts delete <fact-id> [--expect-version=<n>]',
183
+ optionSpec: { 'expect-version': EXPECT_VERSION_OPTION },
184
+ run: (ctx) => runSdk(ctx, 'memory facts delete', async () => {
185
+ const id = requiredPositional(ctx, 0, 'fact-id');
186
+ const expectVersion = integerFlag(ctx, 'expect-version');
187
+ return expectVersion === undefined
188
+ ? await ctx.client().memory.facts.delete(id)
189
+ : await ctx.client().memory.facts.delete(id, { expectVersion });
190
+ }),
191
+ };
192
+ const factsVerify = {
193
+ kind: 'leaf',
194
+ name: 'verify',
195
+ description: 'Mark a memory fact verified: you checked it. Prints the new revision (`trust: verified`).',
196
+ usage: 'kindgi memory facts verify <fact-id> [--expect-version=<n>]',
197
+ optionSpec: { 'expect-version': EXPECT_VERSION_OPTION },
198
+ run: (ctx) => runSdk(ctx, 'memory facts verify', async () => {
199
+ const id = requiredPositional(ctx, 0, 'fact-id');
200
+ const expectVersion = integerFlag(ctx, 'expect-version');
201
+ return expectVersion === undefined
202
+ ? await ctx.client().memory.facts.verify(id)
203
+ : await ctx.client().memory.facts.verify(id, { expectVersion });
204
+ }),
205
+ };
206
+ /** `memory facts retrieve --table`: best first. */
207
+ const HITS_TABLE = {
208
+ rows: (hits) => hits,
209
+ columns: [
210
+ { header: 'ID', get: (h) => String(h.fact.id) },
211
+ { header: 'TYPE', get: (h) => h.fact.type },
212
+ { header: 'TRUST', get: (h) => h.fact.trust ?? 'asserted' },
213
+ { header: 'SCORE', get: (h) => (h.score === undefined ? '' : h.score.toFixed(4)) },
214
+ { header: 'CONTENT', get: (h) => contentCell(h.fact) },
215
+ ],
216
+ };
115
217
  const factsRetrieve = {
116
218
  kind: 'leaf',
117
219
  name: 'retrieve',
118
- description: 'Retrieve memory facts by query.',
220
+ description: 'Search the memory facts you may see: newest first, by keyword, by meaning, or both fused by rank.',
119
221
  usage: 'kindgi memory facts retrieve --query=<json-or-@file>',
120
222
  optionSpec: {
121
223
  query: {
122
224
  type: 'string',
123
- description: 'The retrieval as inline JSON or `@<file>`: a `mode` (`list`, `keyword`, `semantic` or `both`), and optionally `query`, `type`, `scope` and `limit`.',
225
+ description: 'The retrieval as inline JSON or `@<file>`: a `mode` (`list`, `keyword`, `semantic` or `both`), and optionally `query` (required for a search), `type`, `scope` and `limit`. `semantic` and `both` need embeddings on the runtime (`KINDGI_MEMORY_EMBEDDINGS`). Required.',
124
226
  },
125
227
  },
126
- run: (ctx) => runSdk(ctx, 'memory facts retrieve', async () => throwUnwired('memory.retrieve')),
228
+ run: (ctx) => runSdk(ctx, 'memory facts retrieve', async () => {
229
+ const text = stringFlag(ctx, 'query');
230
+ if (text === undefined)
231
+ throw new UsageError('--query=<json-or-@file> is required');
232
+ const input = (await jsonObjectFlag(text, 'query'));
233
+ // The mode and the rest are the server's to check.
234
+ return await ctx
235
+ .client()
236
+ .memory.search({ ...input, mode: input.mode });
237
+ }, HITS_TABLE),
127
238
  };
128
239
  const factsGroup = {
129
240
  kind: 'group',
130
241
  name: 'facts',
131
- description: 'Memory facts: list, get, write.',
132
- subcommands: [factsList, factsGet, factsWrite, factsSupersede, factsRetrieve],
242
+ description: 'Memory facts: list, get, write, supersede, delete, verify, revisions.',
243
+ subcommands: [
244
+ factsList,
245
+ factsGet,
246
+ factsRevisions,
247
+ factsWrite,
248
+ factsSupersede,
249
+ factsDelete,
250
+ factsVerify,
251
+ factsRetrieve,
252
+ ],
253
+ };
254
+ /** `memory erasures list --table`. */
255
+ const ERASURES_TABLE = {
256
+ rows: (page) => page.data,
257
+ columns: [
258
+ { header: 'ID', get: (e) => e.id },
259
+ { header: 'KIND', get: (e) => e.selectorKind },
260
+ { header: 'STATUS', get: (e) => (e.status === 'running' ? `running (${e.phase})` : e.status) },
261
+ { header: 'CREATED', get: (e) => e.createdAt },
262
+ { header: 'COMPLETED', get: (e) => e.completedAt ?? '' },
263
+ { header: 'REPLAYABLE', get: (e) => (e.matchable ? 'yes' : 'no') },
264
+ { header: 'BY', get: (e) => e.requestedBy },
265
+ ],
266
+ };
267
+ const SELECTOR_FLAGS = ['participant', 'external', 'fact', 'conversation'];
268
+ const erasuresCreate = {
269
+ kind: 'leaf',
270
+ name: 'create',
271
+ description: "Erase a person's words: their facts, conversations, the runs that served them, and what those left in provenance. Runs in the background; a tenant admin only.",
272
+ usage: 'kindgi memory erasures create (--participant=<id> | --external=<id> | --fact=<fact-id> | --conversation=<conversation-id>)',
273
+ optionSpec: {
274
+ participant: {
275
+ type: 'string',
276
+ description: "An app's end user (the `participantId` it gave).",
277
+ },
278
+ external: { type: 'string', description: 'A person facts name as an `external` subject.' },
279
+ fact: { type: 'string', description: 'One fact, every revision.' },
280
+ conversation: { type: 'string', description: 'One conversation.' },
281
+ },
282
+ run: (ctx) => runSdk(ctx, 'memory erasures create', async () => {
283
+ const given = SELECTOR_FLAGS.filter((f) => stringFlag(ctx, f) !== undefined);
284
+ if (given.length !== 1) {
285
+ throw new Error('Name exactly one of --participant, --external, --fact or --conversation');
286
+ }
287
+ const flag = given[0];
288
+ const id = stringFlag(ctx, flag);
289
+ return await ctx
290
+ .client()
291
+ .memory.erasures.create(flag === 'fact'
292
+ ? { factId: id }
293
+ : flag === 'conversation'
294
+ ? { conversationId: id }
295
+ : { subject: { kind: flag, id } });
296
+ }),
297
+ };
298
+ const erasuresGet = {
299
+ kind: 'leaf',
300
+ name: 'get',
301
+ description: 'An erasure: its status, phase, and what each store cleared.',
302
+ usage: 'kindgi memory erasures get <erasure-id>',
303
+ run: (ctx) => runSdk(ctx, 'memory erasures get', async () => ctx.client().memory.erasures.get(requiredPositional(ctx, 0, '<erasure-id>'))),
304
+ };
305
+ const erasuresList = {
306
+ kind: 'leaf',
307
+ name: 'list',
308
+ description: 'Erasures, newest first.',
309
+ usage: 'kindgi memory erasures list [--limit=<n>] [--cursor=<c>]',
310
+ optionSpec: {
311
+ limit: { type: 'string', description: 'The most to return (default 25, at most 100).' },
312
+ cursor: {
313
+ type: 'string',
314
+ description: "Resume after this cursor (the previous page's `nextCursor`).",
315
+ },
316
+ },
317
+ run: (ctx) => runSdk(ctx, 'memory erasures list', async () => {
318
+ const limit = integerFlag(ctx, 'limit');
319
+ const cursor = stringFlag(ctx, 'cursor');
320
+ return await ctx.client().memory.erasures.list({
321
+ ...(limit !== undefined && { limit }),
322
+ ...(cursor !== undefined && { cursor }),
323
+ });
324
+ }, ERASURES_TABLE),
325
+ };
326
+ const erasuresExport = {
327
+ kind: 'leaf',
328
+ name: 'export',
329
+ description: 'The erasure ledger, content-free, to keep off-box: restoring a backup rolls it back too, and `replay` takes it.',
330
+ usage: 'kindgi memory erasures export [--out=<file>]',
331
+ optionSpec: {
332
+ out: { type: 'string', description: 'Write it to this file (else, to stdout).' },
333
+ },
334
+ run: (ctx) => runSdk(ctx, 'memory erasures export', async () => {
335
+ const erasures = await ctx.client().memory.erasures.export();
336
+ const out = stringFlag(ctx, 'out');
337
+ if (out === undefined)
338
+ return { erasures };
339
+ await writeFile(out, `${JSON.stringify({ erasures }, null, 2)}\n`, 'utf8');
340
+ return { wrote: out, erasures: erasures.length };
341
+ }),
342
+ };
343
+ const erasuresReplay = {
344
+ kind: 'leaf',
345
+ name: 'replay',
346
+ description: 'After restoring a backup: put the exported ledger back, and erase again whoever the tenant holds again.',
347
+ usage: 'kindgi memory erasures replay <export-file>',
348
+ run: (ctx) => runSdk(ctx, 'memory erasures replay', async () => {
349
+ const file = requiredPositional(ctx, 0, '<export-file>');
350
+ const read = (await readJsonInput(`@${file}`));
351
+ const erasures = Array.isArray(read) ? read : (read.erasures ?? read.data);
352
+ if (!Array.isArray(erasures)) {
353
+ throw new Error(`${file} isn't an export: expected {"erasures": [...]}`);
354
+ }
355
+ return await ctx.client().memory.erasures.replay(erasures);
356
+ }),
357
+ };
358
+ const erasuresResume = {
359
+ kind: 'leaf',
360
+ name: 'resume',
361
+ description: 'Try an erasure again now; --force stops one waiting on a run in a flow that serves other people (that run is cancelled).',
362
+ usage: 'kindgi memory erasures resume <erasure-id> [--force]',
363
+ optionSpec: {
364
+ force: {
365
+ type: 'boolean',
366
+ description: "Don't wait for the shared flow's run: cancel it and go on (it would otherwise wait until its deadline).",
367
+ },
368
+ },
369
+ run: (ctx) => runSdk(ctx, 'memory erasures resume', async () => ctx.client().memory.erasures.resume(requiredPositional(ctx, 0, '<erasure-id>'), {
370
+ ...(ctx.options.force === true && { force: true }),
371
+ })),
372
+ };
373
+ const erasuresGroup = {
374
+ kind: 'group',
375
+ name: 'erasures',
376
+ description: "Erasing a person's words: create, get, list, resume, export, replay (a tenant admin only).",
377
+ subcommands: [
378
+ erasuresCreate,
379
+ erasuresGet,
380
+ erasuresList,
381
+ erasuresResume,
382
+ erasuresExport,
383
+ erasuresReplay,
384
+ ],
133
385
  };
134
386
  export const memoryCommand = {
135
387
  kind: 'group',
136
388
  name: 'memory',
137
- description: 'Memory: the facts agents remember, by type and scope.',
138
- subcommands: [factsGroup],
389
+ description: "Memory: the facts agents remember, by type and scope, and erasing a person's words.",
390
+ subcommands: [factsGroup, erasuresGroup],
139
391
  };
140
392
  //# sourceMappingURL=memory.js.map