@skrr-ai/cli 0.1.36 → 0.1.38

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 (266) hide show
  1. package/README.md +17 -4
  2. package/bin/dev-fallback.js +167 -4
  3. package/dist/base-command.js +46 -2
  4. package/dist/commands/agents/actions/create.d.ts +5 -0
  5. package/dist/commands/agents/actions/create.js +42 -5
  6. package/dist/commands/agents/actions/delete.d.ts +1 -0
  7. package/dist/commands/agents/actions/delete.js +7 -0
  8. package/dist/commands/agents/actions/update.d.ts +5 -0
  9. package/dist/commands/agents/actions/update.js +27 -1
  10. package/dist/commands/agents/api-actions/add.d.ts +41 -0
  11. package/dist/commands/agents/api-actions/add.js +205 -0
  12. package/dist/commands/agents/api-actions/index.d.ts +39 -0
  13. package/dist/commands/agents/api-actions/index.js +103 -0
  14. package/dist/commands/agents/api-actions/remove.d.ts +14 -0
  15. package/dist/commands/agents/api-actions/remove.js +36 -0
  16. package/dist/commands/agents/avatar/default/apply.d.ts +25 -0
  17. package/dist/commands/agents/avatar/default/apply.js +56 -0
  18. package/dist/commands/agents/avatar/default/index.d.ts +29 -0
  19. package/dist/commands/agents/avatar/default/index.js +61 -0
  20. package/dist/commands/agents/avatar/default/set.d.ts +24 -0
  21. package/dist/commands/agents/avatar/default/set.js +120 -0
  22. package/dist/commands/agents/avatar/library/delete.d.ts +20 -0
  23. package/dist/commands/agents/avatar/library/delete.js +47 -0
  24. package/dist/commands/agents/avatar/library/index.d.ts +16 -0
  25. package/dist/commands/agents/avatar/library/index.js +56 -0
  26. package/dist/commands/agents/avatar/presets.d.ts +19 -0
  27. package/dist/commands/agents/avatar/presets.js +56 -0
  28. package/dist/commands/agents/avatar/upload.js +7 -1
  29. package/dist/commands/agents/categories/create.d.ts +14 -0
  30. package/dist/commands/agents/categories/create.js +46 -0
  31. package/dist/commands/agents/categories/delete.d.ts +13 -0
  32. package/dist/commands/agents/categories/delete.js +41 -0
  33. package/dist/commands/agents/categories/index.d.ts +36 -0
  34. package/dist/commands/agents/categories/index.js +135 -0
  35. package/dist/commands/agents/categories/update.d.ts +22 -0
  36. package/dist/commands/agents/categories/update.js +59 -0
  37. package/dist/commands/agents/chat.d.ts +21 -0
  38. package/dist/commands/agents/chat.js +94 -7
  39. package/dist/commands/agents/create.d.ts +10 -0
  40. package/dist/commands/agents/create.js +64 -3
  41. package/dist/commands/agents/ensure-default.d.ts +27 -0
  42. package/dist/commands/agents/ensure-default.js +65 -0
  43. package/dist/commands/agents/list.d.ts +15 -0
  44. package/dist/commands/agents/list.js +31 -1
  45. package/dist/commands/agents/mute.d.ts +16 -0
  46. package/dist/commands/agents/mute.js +38 -0
  47. package/dist/commands/agents/pin.d.ts +16 -0
  48. package/dist/commands/agents/pin.js +38 -0
  49. package/dist/commands/agents/scene-background/upload.d.ts +30 -0
  50. package/dist/commands/agents/scene-background/upload.js +97 -0
  51. package/dist/commands/agents/show.js +13 -0
  52. package/dist/commands/agents/tools/auth.d.ts +19 -0
  53. package/dist/commands/agents/tools/auth.js +41 -0
  54. package/dist/commands/agents/tools/calls.d.ts +36 -0
  55. package/dist/commands/agents/tools/calls.js +117 -0
  56. package/dist/commands/agents/tools/index.d.ts +20 -0
  57. package/dist/commands/agents/tools/index.js +77 -0
  58. package/dist/commands/agents/unmute.d.ts +16 -0
  59. package/dist/commands/agents/unmute.js +38 -0
  60. package/dist/commands/agents/unpin.d.ts +16 -0
  61. package/dist/commands/agents/unpin.js +38 -0
  62. package/dist/commands/agents/update.d.ts +12 -0
  63. package/dist/commands/agents/update.js +74 -3
  64. package/dist/commands/code/{oversky-agent.d.ts → skrr-agent.d.ts} +3 -3
  65. package/dist/commands/code/{oversky-agent.js → skrr-agent.js} +11 -8
  66. package/dist/commands/convos/messages.d.ts +13 -0
  67. package/dist/commands/convos/messages.js +40 -16
  68. package/dist/commands/daemon/index.js +8 -1
  69. package/dist/commands/daemon/logs.d.ts +26 -0
  70. package/dist/commands/daemon/logs.js +56 -0
  71. package/dist/commands/daemon/uninstall.js +1 -1
  72. package/dist/commands/followups/act.d.ts +22 -0
  73. package/dist/commands/followups/act.js +103 -0
  74. package/dist/commands/followups/cancel.d.ts +20 -0
  75. package/dist/commands/followups/cancel.js +50 -0
  76. package/dist/commands/followups/checkin.d.ts +27 -0
  77. package/dist/commands/followups/checkin.js +107 -0
  78. package/dist/commands/followups/list.d.ts +24 -0
  79. package/dist/commands/followups/list.js +90 -0
  80. package/dist/commands/followups/observability.d.ts +23 -0
  81. package/dist/commands/followups/observability.js +114 -0
  82. package/dist/commands/followups/remind.d.ts +26 -0
  83. package/dist/commands/followups/remind.js +106 -0
  84. package/dist/commands/followups/reschedule.d.ts +15 -0
  85. package/dist/commands/followups/reschedule.js +48 -0
  86. package/dist/commands/followups/resolve.d.ts +23 -0
  87. package/dist/commands/followups/resolve.js +54 -0
  88. package/dist/commands/followups/show.d.ts +12 -0
  89. package/dist/commands/followups/show.js +46 -0
  90. package/dist/commands/followups/watch.d.ts +51 -0
  91. package/dist/commands/followups/watch.js +211 -0
  92. package/dist/commands/goals/labels/add.js +19 -2
  93. package/dist/commands/goals/labels/remove.js +22 -2
  94. package/dist/commands/harnesses/forget.js +28 -0
  95. package/dist/commands/harnesses/install.d.ts +41 -0
  96. package/dist/commands/harnesses/install.js +165 -0
  97. package/dist/commands/harnesses/installers.d.ts +45 -0
  98. package/dist/commands/harnesses/installers.js +155 -0
  99. package/dist/commands/harnesses/list.d.ts +82 -1
  100. package/dist/commands/harnesses/list.js +104 -12
  101. package/dist/commands/harnesses/models.js +10 -1
  102. package/dist/commands/harnesses/show.d.ts +15 -0
  103. package/dist/commands/harnesses/show.js +44 -3
  104. package/dist/commands/harnesses/update.js +1 -1
  105. package/dist/commands/harnesses/usage.d.ts +25 -0
  106. package/dist/commands/harnesses/usage.js +24 -2
  107. package/dist/commands/instructions/status.js +13 -1
  108. package/dist/commands/labels/list.d.ts +24 -1
  109. package/dist/commands/labels/list.js +62 -19
  110. package/dist/commands/machines/dedicated/catalog.js +4 -15
  111. package/dist/commands/machines/dedicated/create.d.ts +8 -0
  112. package/dist/commands/machines/dedicated/create.js +58 -1
  113. package/dist/commands/machines/dedicated/destroy.js +18 -4
  114. package/dist/commands/machines/dedicated/list.js +9 -6
  115. package/dist/commands/machines/hosted/list.js +12 -0
  116. package/dist/commands/machines/list.js +11 -0
  117. package/dist/commands/machines/show.d.ts +1 -0
  118. package/dist/commands/machines/show.js +40 -11
  119. package/dist/commands/memory/governance/index.d.ts +21 -0
  120. package/dist/commands/memory/governance/index.js +64 -0
  121. package/dist/commands/memory/governance/set.d.ts +24 -0
  122. package/dist/commands/memory/governance/set.js +95 -0
  123. package/dist/commands/memory/provenance.d.ts +18 -0
  124. package/dist/commands/memory/provenance.js +66 -0
  125. package/dist/commands/profiles/list.d.ts +23 -0
  126. package/dist/commands/profiles/list.js +96 -0
  127. package/dist/commands/search/skills.d.ts +11 -1
  128. package/dist/commands/search/skills.js +26 -8
  129. package/dist/commands/skills/details.d.ts +2 -0
  130. package/dist/commands/skills/details.js +24 -1
  131. package/dist/commands/skills/import-as-actions.d.ts +32 -0
  132. package/dist/commands/skills/import-as-actions.js +175 -0
  133. package/dist/commands/skills/install.d.ts +2 -0
  134. package/dist/commands/skills/install.js +24 -1
  135. package/dist/commands/skills/invocable.js +6 -2
  136. package/dist/commands/skills/local.d.ts +40 -0
  137. package/dist/commands/skills/local.js +160 -0
  138. package/dist/commands/skills/search.d.ts +11 -1
  139. package/dist/commands/skills/search.js +29 -8
  140. package/dist/commands/spaces/actions/add.js +23 -5
  141. package/dist/commands/spaces/actions/available.js +3 -0
  142. package/dist/commands/spaces/actions/list.d.ts +5 -0
  143. package/dist/commands/spaces/actions/list.js +49 -3
  144. package/dist/commands/spaces/actions/run.d.ts +28 -0
  145. package/dist/commands/spaces/actions/run.js +146 -0
  146. package/dist/commands/spaces/actions/update.js +27 -5
  147. package/dist/commands/spaces/create.d.ts +3 -0
  148. package/dist/commands/spaces/create.js +32 -2
  149. package/dist/commands/spaces/label-summaries.d.ts +27 -0
  150. package/dist/commands/spaces/label-summaries.js +64 -0
  151. package/dist/commands/spaces/labels/add.js +19 -2
  152. package/dist/commands/spaces/labels/remove.js +22 -2
  153. package/dist/commands/spaces/show.js +2 -0
  154. package/dist/commands/spaces/task-rollups.d.ts +5 -0
  155. package/dist/commands/spaces/task-rollups.js +15 -4
  156. package/dist/commands/spaces/update.d.ts +5 -0
  157. package/dist/commands/spaces/update.js +41 -4
  158. package/dist/commands/spaces/workflows/lifecycle-diagnostics.d.ts +11 -0
  159. package/dist/commands/spaces/workflows/lifecycle-diagnostics.js +105 -0
  160. package/dist/commands/tasks/actions/attach.js +32 -7
  161. package/dist/commands/tasks/complete.d.ts +1 -0
  162. package/dist/commands/tasks/complete.js +21 -1
  163. package/dist/commands/tasks/create.d.ts +3 -0
  164. package/dist/commands/tasks/create.js +34 -2
  165. package/dist/commands/tasks/events/append.js +29 -6
  166. package/dist/commands/tasks/expectations/assess.d.ts +12 -0
  167. package/dist/commands/tasks/expectations/assess.js +123 -14
  168. package/dist/commands/tasks/expectations.js +95 -17
  169. package/dist/commands/tasks/follow-up.js +2 -2
  170. package/dist/commands/tasks/labels/attach.js +20 -3
  171. package/dist/commands/tasks/labels/detach.js +21 -3
  172. package/dist/commands/tasks/lifecycle/attach.d.ts +14 -0
  173. package/dist/commands/tasks/lifecycle/attach.js +47 -0
  174. package/dist/commands/tasks/lifecycle/definitions.d.ts +11 -0
  175. package/dist/commands/tasks/lifecycle/definitions.js +59 -0
  176. package/dist/commands/tasks/lifecycle/detach.d.ts +19 -0
  177. package/dist/commands/tasks/lifecycle/detach.js +72 -0
  178. package/dist/commands/tasks/lifecycle/history.d.ts +13 -0
  179. package/dist/commands/tasks/lifecycle/history.js +38 -0
  180. package/dist/commands/tasks/lifecycle/migrate.d.ts +14 -0
  181. package/dist/commands/tasks/lifecycle/migrate.js +68 -0
  182. package/dist/commands/tasks/lifecycle/reconcile.d.ts +11 -0
  183. package/dist/commands/tasks/lifecycle/reconcile.js +27 -0
  184. package/dist/commands/tasks/lifecycle/reopen.d.ts +15 -0
  185. package/dist/commands/tasks/lifecycle/reopen.js +71 -0
  186. package/dist/commands/tasks/lifecycle/show.d.ts +11 -0
  187. package/dist/commands/tasks/lifecycle/show.js +27 -0
  188. package/dist/commands/tasks/lifecycle/start.d.ts +12 -0
  189. package/dist/commands/tasks/lifecycle/start.js +30 -0
  190. package/dist/commands/tasks/lifecycle/transition.d.ts +15 -0
  191. package/dist/commands/tasks/lifecycle/transition.js +109 -0
  192. package/dist/commands/tasks/list.js +16 -9
  193. package/dist/commands/tasks/move.d.ts +1 -0
  194. package/dist/commands/tasks/move.js +29 -0
  195. package/dist/commands/tasks/result/submit.js +11 -1
  196. package/dist/commands/tasks/review-queue.d.ts +44 -0
  197. package/dist/commands/tasks/review-queue.js +314 -0
  198. package/dist/commands/tasks/show.d.ts +11 -0
  199. package/dist/commands/tasks/show.js +139 -4
  200. package/dist/commands/tasks/trust.js +7 -2
  201. package/dist/commands/tasks/update.d.ts +1 -0
  202. package/dist/commands/tasks/update.js +83 -0
  203. package/dist/commands/tasks/updates/add.js +1 -1
  204. package/dist/commands/token/list.d.ts +22 -0
  205. package/dist/commands/token/list.js +68 -0
  206. package/dist/commands/token/revoke.d.ts +23 -0
  207. package/dist/commands/token/revoke.js +53 -0
  208. package/dist/lib/agent-actions.d.ts +92 -11
  209. package/dist/lib/agent-actions.js +171 -25
  210. package/dist/lib/agent-config.d.ts +11 -0
  211. package/dist/lib/agent-config.js +85 -3
  212. package/dist/lib/agent-pin-mute.d.ts +29 -0
  213. package/dist/lib/agent-pin-mute.js +30 -0
  214. package/dist/lib/agent-visual-refs.d.ts +33 -0
  215. package/dist/lib/agent-visual-refs.js +267 -0
  216. package/dist/lib/agentic-stream.d.ts +6 -0
  217. package/dist/lib/agentic-stream.js +34 -3
  218. package/dist/lib/assignee-resolver.d.ts +1 -1
  219. package/dist/lib/assignee-resolver.js +8 -0
  220. package/dist/lib/bulk-task-targets.d.ts +12 -0
  221. package/dist/lib/bulk-task-targets.js +34 -1
  222. package/dist/lib/cli-installers.d.ts +130 -0
  223. package/dist/lib/cli-installers.js +145 -0
  224. package/dist/lib/command-miss.js +55 -7
  225. package/dist/lib/dedicated-lease-command.d.ts +13 -0
  226. package/dist/lib/dedicated-lease-command.js +22 -1
  227. package/dist/lib/dedicated-machines.d.ts +95 -1
  228. package/dist/lib/dedicated-machines.js +236 -2
  229. package/dist/lib/failed-lookup.d.ts +3 -0
  230. package/dist/lib/failed-lookup.js +40 -0
  231. package/dist/lib/first-party-harness-agent.js +16 -2
  232. package/dist/lib/first-party-harness-doctor.d.ts +15 -0
  233. package/dist/lib/first-party-harness-doctor.js +126 -27
  234. package/dist/lib/followups.d.ts +115 -0
  235. package/dist/lib/followups.js +127 -0
  236. package/dist/lib/harnesses.d.ts +8 -0
  237. package/dist/lib/instruction-input.d.ts +19 -1
  238. package/dist/lib/instruction-input.js +52 -1
  239. package/dist/lib/label-ref.d.ts +95 -0
  240. package/dist/lib/label-ref.js +163 -0
  241. package/dist/lib/label-scope.d.ts +17 -2
  242. package/dist/lib/label-scope.js +27 -7
  243. package/dist/lib/local-skills.d.ts +98 -0
  244. package/dist/lib/local-skills.js +195 -0
  245. package/dist/lib/machines.d.ts +10 -10
  246. package/dist/lib/machines.js +23 -1
  247. package/dist/lib/search-query.d.ts +19 -0
  248. package/dist/lib/search-query.js +35 -0
  249. package/dist/lib/space-custom-actions.d.ts +72 -0
  250. package/dist/lib/space-custom-actions.js +117 -0
  251. package/dist/lib/space-resolver.d.ts +1 -21
  252. package/dist/lib/space-resolver.js +19 -10
  253. package/dist/lib/task-closure.d.ts +33 -0
  254. package/dist/lib/task-closure.js +104 -0
  255. package/dist/lib/task-lifecycle-output.d.ts +14 -0
  256. package/dist/lib/task-lifecycle-output.js +209 -0
  257. package/dist/lib/task-ref-resolver.d.ts +1 -17
  258. package/dist/lib/task-ref-resolver.js +18 -8
  259. package/dist/lib/tasks.d.ts +3 -0
  260. package/dist/lib/tasks.js +40 -3
  261. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessTrust.js +4 -0
  262. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessTrust.js +4 -0
  263. package/dist/node_modules/@skrr-ai/auth-core/package.json +1 -1
  264. package/dist/node_modules/@skrr-ai/data-provider/index.js +5559 -4897
  265. package/oclif.manifest.json +33890 -28690
  266. package/package.json +24 -6
@@ -0,0 +1,205 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const promises_1 = require("node:fs/promises");
5
+ const data_provider_1 = require("@skrr-ai/data-provider");
6
+ const base_command_1 = require("../../../base-command");
7
+ /**
8
+ * Attach (or re-attach) an OpenAPI document to an agent as a tool surface.
9
+ *
10
+ * The derivation is the SAME code the web builder runs —
11
+ * `validateAndParseOpenAPISpec` then `openapiToFunction`, both from
12
+ * `@skrr-ai/data-provider`. That matters more than it looks: the server stores
13
+ * `functions` verbatim and never re-reads the spec, so a CLI that derived them
14
+ * its own way would produce actions subtly unlike the ones the web produces from
15
+ * the same document, and the difference would only show up at call time.
16
+ *
17
+ * The spec is validated LOCALLY before anything is sent, because the endpoint's
18
+ * failure for a malformed document is `400 No functions provided` — true, and
19
+ * useless for finding the line that is wrong.
20
+ */
21
+ class AgentsApiActionsAdd extends base_command_1.BaseCommand {
22
+ static description = 'Attach an OpenAPI spec to an agent as a callable Action';
23
+ static examples = [
24
+ '<%= config.bin %> agents api-actions add <agent-id> --spec ./weather.yaml',
25
+ 'cat weather.json | <%= config.bin %> agents api-actions add <agent-id> --spec -',
26
+ '<%= config.bin %> agents api-actions add <agent-id> --spec ./api.yaml --auth service_http --api-key $KEY',
27
+ '<%= config.bin %> agents api-actions add <agent-id> --spec ./api.yaml --action-id <existing> # replace in place',
28
+ ];
29
+ static args = {
30
+ agentId: core_1.Args.string({ description: 'Agent ID', required: true, ignoreStdin: true }),
31
+ };
32
+ static flags = {
33
+ spec: core_1.Flags.string({
34
+ description: 'OpenAPI document — path to a JSON/YAML file, or "-" for stdin',
35
+ required: true,
36
+ }),
37
+ 'action-id': core_1.Flags.string({
38
+ description: 'Replace this existing action instead of creating a new one',
39
+ }),
40
+ auth: core_1.Flags.string({
41
+ description: 'How the API authenticates',
42
+ options: [data_provider_1.AuthTypeEnum.None, data_provider_1.AuthTypeEnum.ServiceHttp, data_provider_1.AuthTypeEnum.OAuth],
43
+ default: data_provider_1.AuthTypeEnum.None,
44
+ }),
45
+ 'api-key': core_1.Flags.string({ description: '--auth service_http: the key or token' }),
46
+ 'authorization-type': core_1.Flags.string({
47
+ description: '--auth service_http: how the key is presented',
48
+ options: [
49
+ data_provider_1.AuthorizationTypeEnum.Bearer,
50
+ data_provider_1.AuthorizationTypeEnum.Basic,
51
+ data_provider_1.AuthorizationTypeEnum.Custom,
52
+ ],
53
+ }),
54
+ 'custom-auth-header': core_1.Flags.string({
55
+ description: '--authorization-type custom: the header name',
56
+ }),
57
+ 'oauth-client-id': core_1.Flags.string({ description: '--auth oauth: client id' }),
58
+ 'oauth-client-secret': core_1.Flags.string({ description: '--auth oauth: client secret' }),
59
+ 'oauth-authorization-url': core_1.Flags.string({ description: '--auth oauth: authorization URL' }),
60
+ 'oauth-client-url': core_1.Flags.string({ description: '--auth oauth: token URL' }),
61
+ 'oauth-scope': core_1.Flags.string({ description: '--auth oauth: space-separated scopes' }),
62
+ 'oauth-token-exchange-method': core_1.Flags.string({
63
+ description: '--auth oauth: how the token is exchanged',
64
+ options: [data_provider_1.TokenExchangeMethodEnum.DefaultPost, data_provider_1.TokenExchangeMethodEnum.BasicAuthHeader],
65
+ }),
66
+ 'dry-run': core_1.Flags.boolean({
67
+ description: 'Parse the spec and report the functions it yields, send nothing',
68
+ }),
69
+ json: core_1.Flags.boolean({ description: 'Output as JSON' }),
70
+ };
71
+ async readSpec(source) {
72
+ if (source === '-') {
73
+ const chunks = [];
74
+ for await (const chunk of process.stdin)
75
+ chunks.push(Buffer.from(chunk));
76
+ return Buffer.concat(chunks).toString('utf8');
77
+ }
78
+ return (0, promises_1.readFile)(source, 'utf8');
79
+ }
80
+ buildAuth(flags) {
81
+ const type = flags.auth;
82
+ if (type === data_provider_1.AuthTypeEnum.ServiceHttp) {
83
+ if (!flags['api-key']) {
84
+ this.error('--auth service_http needs --api-key.', { exit: 1 });
85
+ }
86
+ if (flags['authorization-type'] === data_provider_1.AuthorizationTypeEnum.Custom &&
87
+ !flags['custom-auth-header']) {
88
+ this.error('--authorization-type custom needs --custom-auth-header.', { exit: 1 });
89
+ }
90
+ return {
91
+ api_key: String(flags['api-key']),
92
+ auth: {
93
+ type,
94
+ authorization_type: flags['authorization-type'] ?? data_provider_1.AuthorizationTypeEnum.Bearer,
95
+ ...(flags['custom-auth-header'] === undefined
96
+ ? {}
97
+ : { custom_auth_header: String(flags['custom-auth-header']) }),
98
+ },
99
+ };
100
+ }
101
+ if (type === data_provider_1.AuthTypeEnum.OAuth) {
102
+ const missing = [
103
+ ['--oauth-client-id', flags['oauth-client-id']],
104
+ ['--oauth-client-secret', flags['oauth-client-secret']],
105
+ ['--oauth-authorization-url', flags['oauth-authorization-url']],
106
+ ['--oauth-client-url', flags['oauth-client-url']],
107
+ ]
108
+ .filter(([, value]) => !value)
109
+ .map(([name]) => name);
110
+ if (missing.length > 0) {
111
+ this.error(`--auth oauth needs ${missing.join(', ')}.`, { exit: 1 });
112
+ }
113
+ return {
114
+ oauth_client_id: String(flags['oauth-client-id']),
115
+ oauth_client_secret: String(flags['oauth-client-secret']),
116
+ auth: {
117
+ type,
118
+ authorization_url: String(flags['oauth-authorization-url']),
119
+ client_url: String(flags['oauth-client-url']),
120
+ ...(flags['oauth-scope'] === undefined ? {} : { scope: String(flags['oauth-scope']) }),
121
+ token_exchange_method: flags['oauth-token-exchange-method'] ??
122
+ data_provider_1.TokenExchangeMethodEnum.DefaultPost,
123
+ },
124
+ };
125
+ }
126
+ return { auth: { type: data_provider_1.AuthTypeEnum.None } };
127
+ }
128
+ async run() {
129
+ this.requireAuth();
130
+ const { args, flags } = await this.parse(AgentsApiActionsAdd);
131
+ let rawSpec;
132
+ try {
133
+ rawSpec = await this.readSpec(flags.spec);
134
+ }
135
+ catch (err) {
136
+ this.error(`Could not read --spec ${flags.spec}: ${err.message}`, { exit: 1 });
137
+ }
138
+ const validation = (0, data_provider_1.validateAndParseOpenAPISpec)(rawSpec);
139
+ if (!validation.status || !validation.spec) {
140
+ this.error(`The OpenAPI document is not usable: ${validation.message}`, { exit: 1 });
141
+ }
142
+ const { functionSignatures, requestBuilders } = (0, data_provider_1.openapiToFunction)(validation.spec);
143
+ const functions = functionSignatures.map((signature) => signature.toObjectTool());
144
+ if (functions.length === 0) {
145
+ this.error('The spec parsed but yielded no callable operations. Every path needs an ' +
146
+ 'operationId and a method the parser understands.', { exit: 1 });
147
+ }
148
+ const first = Object.values(requestBuilders)[0];
149
+ if (!first?.domain) {
150
+ this.error('The spec has no server URL to call — `servers[0].url` is required.', { exit: 1 });
151
+ }
152
+ let domain;
153
+ try {
154
+ domain = new URL(first.domain).hostname;
155
+ }
156
+ catch {
157
+ this.error(`The spec's server URL is not a URL: ${first.domain}`, { exit: 1 });
158
+ }
159
+ if (flags['dry-run']) {
160
+ const preview = {
161
+ domain: domain,
162
+ functions: Object.entries(requestBuilders).map(([name, props]) => ({
163
+ name,
164
+ method: props.method,
165
+ path: props.path,
166
+ })),
167
+ };
168
+ // Say it was a dry run: the output used to be indistinguishable from what
169
+ // a real add would have printed, so a reader could not tell whether
170
+ // anything had been written.
171
+ this.log(flags.json
172
+ ? JSON.stringify({ dryRun: true, written: false, ...preview }, null, 2)
173
+ : `Dry run — nothing was written. ${preview.functions.length} operation(s) on ${domain}:\n` +
174
+ preview.functions
175
+ .map((f) => ` ${f.name} ${f.method.toUpperCase()} ${f.path}`)
176
+ .join('\n'));
177
+ return;
178
+ }
179
+ const metadata = {
180
+ raw_spec: rawSpec,
181
+ domain: domain,
182
+ ...this.buildAuth(flags),
183
+ };
184
+ let result;
185
+ try {
186
+ result = await data_provider_1.dataService.updateAgentAction({
187
+ agent_id: args.agentId,
188
+ ...(flags['action-id'] === undefined ? {} : { action_id: flags['action-id'] }),
189
+ metadata,
190
+ functions,
191
+ });
192
+ }
193
+ catch (err) {
194
+ this.handleApiError(err);
195
+ }
196
+ if (flags.json) {
197
+ this.log(this.agentJson(args.agentId, result));
198
+ return;
199
+ }
200
+ this.log(`${flags['action-id'] ? 'Updated' : 'Added'} an OpenAPI action on agent ${args.agentId} — ` +
201
+ `${functions.length} operation(s) on ${domain}`);
202
+ this.printAgentUrl(args.agentId);
203
+ }
204
+ }
205
+ exports.default = AgentsApiActionsAdd;
@@ -0,0 +1,39 @@
1
+ import { BaseCommand } from '../../../base-command';
2
+ /**
3
+ * OpenAPI-spec-backed Actions — an agent calling a third-party HTTP API.
4
+ *
5
+ * WHY THE COMMAND IS NOT CALLED `actions`
6
+ * ───────────────────────────────────────
7
+ * Three different things in this product are called an "action", and two of
8
+ * them already own that word in the CLI:
9
+ *
10
+ * skrr agents actions — embedded `agentActions`: prompt/builtin buttons
11
+ * that live ON the agent document
12
+ * skrr actions — marketplace LISTINGS of those embedded actions
13
+ * skrr agents api-actions (this) — `/api/agents/actions`: a tool surface
14
+ * generated from an OpenAPI document
15
+ *
16
+ * The third had no CLI at all, which the naming collision helped hide. Renaming
17
+ * the other two would break muscle memory for a surface that works, so this one
18
+ * takes an unambiguous name and all three now say which concept they are.
19
+ */
20
+ /**
21
+ * The operation names an action exposes, parsed from its stored spec by the same
22
+ * parser `add` and the web builder use. The listing used to show id, agent,
23
+ * domain and auth — never what the action can DO — so answering "which tools does
24
+ * this give the agent" meant reading the raw spec.
25
+ */
26
+ export declare function operationNames(action: {
27
+ metadata?: {
28
+ raw_spec?: string;
29
+ };
30
+ }): string[];
31
+ export default class AgentsApiActionsList extends BaseCommand {
32
+ static description: string;
33
+ static examples: string[];
34
+ static flags: {
35
+ agent: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
36
+ json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
37
+ };
38
+ run(): Promise<void>;
39
+ }
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.operationNames = operationNames;
4
+ const core_1 = require("@oclif/core");
5
+ const data_provider_1 = require("@skrr-ai/data-provider");
6
+ const base_command_1 = require("../../../base-command");
7
+ const format_1 = require("../../../lib/format");
8
+ /**
9
+ * OpenAPI-spec-backed Actions — an agent calling a third-party HTTP API.
10
+ *
11
+ * WHY THE COMMAND IS NOT CALLED `actions`
12
+ * ───────────────────────────────────────
13
+ * Three different things in this product are called an "action", and two of
14
+ * them already own that word in the CLI:
15
+ *
16
+ * skrr agents actions — embedded `agentActions`: prompt/builtin buttons
17
+ * that live ON the agent document
18
+ * skrr actions — marketplace LISTINGS of those embedded actions
19
+ * skrr agents api-actions (this) — `/api/agents/actions`: a tool surface
20
+ * generated from an OpenAPI document
21
+ *
22
+ * The third had no CLI at all, which the naming collision helped hide. Renaming
23
+ * the other two would break muscle memory for a surface that works, so this one
24
+ * takes an unambiguous name and all three now say which concept they are.
25
+ */
26
+ /**
27
+ * The operation names an action exposes, parsed from its stored spec by the same
28
+ * parser `add` and the web builder use. The listing used to show id, agent,
29
+ * domain and auth — never what the action can DO — so answering "which tools does
30
+ * this give the agent" meant reading the raw spec.
31
+ */
32
+ function operationNames(action) {
33
+ const raw = action.metadata?.raw_spec;
34
+ if (!raw)
35
+ return [];
36
+ const parsed = (0, data_provider_1.validateAndParseOpenAPISpec)(raw);
37
+ if (!parsed.status || !parsed.spec)
38
+ return [];
39
+ return Object.keys((0, data_provider_1.openapiToFunction)(parsed.spec).requestBuilders);
40
+ }
41
+ class AgentsApiActionsList extends base_command_1.BaseCommand {
42
+ static description = 'List OpenAPI-backed Actions on agents you can edit (NOT `agents actions`, which is embedded buttons)';
43
+ static examples = [
44
+ '<%= config.bin %> agents api-actions',
45
+ '<%= config.bin %> agents api-actions --agent <agent-id>',
46
+ '<%= config.bin %> agents api-actions --json',
47
+ ];
48
+ static flags = {
49
+ agent: core_1.Flags.string({ description: 'Only actions on this agent' }),
50
+ json: core_1.Flags.boolean({ description: 'Output as JSON' }),
51
+ };
52
+ async run() {
53
+ this.requireAuth();
54
+ const { flags } = await this.parse(AgentsApiActionsList);
55
+ let actions;
56
+ try {
57
+ actions = await data_provider_1.dataService.getActions();
58
+ }
59
+ catch (err) {
60
+ this.handleApiError(err);
61
+ }
62
+ // Filtered here rather than server-side: the endpoint returns every action
63
+ // on every agent the caller may EDIT, and has no agent filter. Doing it in
64
+ // the CLI keeps the flag honest instead of inventing a query the API does
65
+ // not answer.
66
+ const rows = flags.agent
67
+ ? actions.filter((action) => action.agent_id === flags.agent)
68
+ : actions;
69
+ if (flags.json) {
70
+ // Database internals (`_id`, `__v`) are not part of an action; a script
71
+ // reading this should not learn to depend on them.
72
+ const clean = rows.map((action) => {
73
+ const { _id, __v, ...rest } = action;
74
+ void _id;
75
+ void __v;
76
+ return { ...rest, operations: operationNames(action) };
77
+ });
78
+ this.log(JSON.stringify(clean, null, 2));
79
+ return;
80
+ }
81
+ if (rows.length === 0) {
82
+ this.log(flags.agent
83
+ ? `No OpenAPI actions on agent ${flags.agent}.`
84
+ : 'No OpenAPI actions on any agent you can edit.');
85
+ this.log('Add one with: skrr agents api-actions add <agent-id> --spec <openapi.yaml>');
86
+ return;
87
+ }
88
+ (0, format_1.renderTable)(rows.map((action) => ({
89
+ actionId: action.action_id,
90
+ agentId: action.agent_id ?? '-',
91
+ domain: action.metadata?.domain ?? '-',
92
+ auth: action.metadata?.auth?.type ?? 'none',
93
+ operations: operationNames(action).join(', ') || '-',
94
+ })), [
95
+ { key: 'actionId', header: 'ACTION ID', verbatim: true },
96
+ { key: 'agentId', header: 'AGENT ID', verbatim: true },
97
+ { key: 'domain', header: 'DOMAIN', maxWidth: 40 },
98
+ { key: 'auth', header: 'AUTH' },
99
+ { key: 'operations', header: 'OPERATIONS', maxWidth: 48 },
100
+ ], (line) => this.log(line));
101
+ }
102
+ }
103
+ exports.default = AgentsApiActionsList;
@@ -0,0 +1,14 @@
1
+ import { BaseCommand } from '../../../base-command';
2
+ /** Detach an OpenAPI Action from an agent. Wraps `DELETE /api/agents/actions/:agent_id/:action_id`. */
3
+ export default class AgentsApiActionsRemove extends BaseCommand {
4
+ static description: string;
5
+ static examples: string[];
6
+ static args: {
7
+ agentId: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
8
+ actionId: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
9
+ };
10
+ static flags: {
11
+ json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
12
+ };
13
+ run(): Promise<void>;
14
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const data_provider_1 = require("@skrr-ai/data-provider");
5
+ const base_command_1 = require("../../../base-command");
6
+ /** Detach an OpenAPI Action from an agent. Wraps `DELETE /api/agents/actions/:agent_id/:action_id`. */
7
+ class AgentsApiActionsRemove extends base_command_1.BaseCommand {
8
+ static description = 'Remove an OpenAPI-backed Action from an agent';
9
+ static examples = ['<%= config.bin %> agents api-actions remove <agent-id> <action-id>'];
10
+ static args = {
11
+ agentId: core_1.Args.string({ description: 'Agent ID', required: true, ignoreStdin: true }),
12
+ actionId: core_1.Args.string({ description: 'Action ID', required: true, ignoreStdin: true }),
13
+ };
14
+ static flags = {
15
+ json: core_1.Flags.boolean({ description: 'Output as JSON' }),
16
+ };
17
+ async run() {
18
+ this.requireAuth();
19
+ const { args, flags } = await this.parse(AgentsApiActionsRemove);
20
+ try {
21
+ await data_provider_1.dataService.deleteAgentAction({
22
+ agent_id: args.agentId,
23
+ action_id: args.actionId,
24
+ });
25
+ }
26
+ catch (err) {
27
+ this.handleApiError(err);
28
+ }
29
+ if (flags.json) {
30
+ this.log(JSON.stringify({ removed: args.actionId, agentId: args.agentId }, null, 2));
31
+ return;
32
+ }
33
+ this.log(`Removed action ${args.actionId} from agent ${args.agentId}`);
34
+ }
35
+ }
36
+ exports.default = AgentsApiActionsRemove;
@@ -0,0 +1,25 @@
1
+ import { BaseCommand } from '../../../../base-command';
2
+ /**
3
+ * Apply the policy to agents that ALREADY EXIST — the one retroactive path in
4
+ * the avatar system, and deliberately user-initiated.
5
+ *
6
+ * It is not a sweep over everything: an agent whose owner explicitly chose the
7
+ * platform logo stores `{type:'default'}` and is NOT eligible, while an agent
8
+ * that never had a face stores nothing and is. "Never chose" and "chose the
9
+ * logo" are different facts and the server keeps them apart.
10
+ *
11
+ * The count is shown BEFORE anything is written. `--dry-run` asks the server how
12
+ * many are eligible without touching them; without `--yes` that is what this
13
+ * command does first, then asks. A command that silently re-skinned an unknown
14
+ * number of agents would be the wrong shape for an irreversible bulk write.
15
+ */
16
+ export default class AgentsAvatarDefaultApply extends BaseCommand {
17
+ static description: string;
18
+ static examples: string[];
19
+ static flags: {
20
+ 'dry-run': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
21
+ yes: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
22
+ json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
23
+ };
24
+ run(): Promise<void>;
25
+ }
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const data_provider_1 = require("@skrr-ai/data-provider");
5
+ const base_command_1 = require("../../../../base-command");
6
+ /**
7
+ * Apply the policy to agents that ALREADY EXIST — the one retroactive path in
8
+ * the avatar system, and deliberately user-initiated.
9
+ *
10
+ * It is not a sweep over everything: an agent whose owner explicitly chose the
11
+ * platform logo stores `{type:'default'}` and is NOT eligible, while an agent
12
+ * that never had a face stores nothing and is. "Never chose" and "chose the
13
+ * logo" are different facts and the server keeps them apart.
14
+ *
15
+ * The count is shown BEFORE anything is written. `--dry-run` asks the server how
16
+ * many are eligible without touching them; without `--yes` that is what this
17
+ * command does first, then asks. A command that silently re-skinned an unknown
18
+ * number of agents would be the wrong shape for an irreversible bulk write.
19
+ */
20
+ class AgentsAvatarDefaultApply extends base_command_1.BaseCommand {
21
+ static description = 'Apply your default-avatar policy to existing agents that never had a face chosen';
22
+ static examples = [
23
+ '<%= config.bin %> agents avatar default apply --dry-run',
24
+ '<%= config.bin %> agents avatar default apply --yes',
25
+ ];
26
+ static flags = {
27
+ 'dry-run': core_1.Flags.boolean({ description: 'Report how many agents are eligible, write nothing' }),
28
+ yes: core_1.Flags.boolean({ description: 'Skip the eligible-count preview and write' }),
29
+ json: core_1.Flags.boolean({ description: 'Output as JSON' }),
30
+ };
31
+ async run() {
32
+ this.requireAuth();
33
+ const { flags } = await this.parse(AgentsAvatarDefaultApply);
34
+ const dryRun = flags['dry-run'] === true || flags.yes !== true;
35
+ let result;
36
+ try {
37
+ result = await data_provider_1.dataService.applyAgentAvatarDefault(dryRun);
38
+ }
39
+ catch (err) {
40
+ this.handleApiError(err);
41
+ }
42
+ if (flags.json) {
43
+ this.log(JSON.stringify(result, null, 2));
44
+ return;
45
+ }
46
+ if (!dryRun) {
47
+ this.log(`Applied the default-avatar policy to ${result.updated} agent(s).`);
48
+ return;
49
+ }
50
+ this.log(`${result.eligible} agent(s) would get a new avatar. Nothing was written.`);
51
+ if (!flags['dry-run']) {
52
+ this.log('Re-run with --yes to apply.');
53
+ }
54
+ }
55
+ }
56
+ exports.default = AgentsAvatarDefaultApply;
@@ -0,0 +1,29 @@
1
+ import { BaseCommand } from '../../../../base-command';
2
+ /**
3
+ * Which of the two states produced the policy line above it.
4
+ *
5
+ * The route sends `explicit` precisely because the policy alone cannot carry
6
+ * it: `resolveAgentAvatarDefaultPolicy` maps an absent field and a deliberate
7
+ * choice of the same shape onto one value. So "I picked random-from-all" and "I
8
+ * have never picked anything" printed identically, and they are not the same
9
+ * fact — only the second follows the shipped default if it ever changes, which
10
+ * is the whole reason clearing exists as a separate operation from choosing.
11
+ */
12
+ export declare function describePolicyProvenance(explicit: boolean): string;
13
+ /**
14
+ * What face a NEW agent gets when its creator does not pick one.
15
+ *
16
+ * Wraps `GET /api/agents/avatar-default`. The policy is read exactly ONCE, at
17
+ * creation, and the drawn reference is written onto the agent — so changing it
18
+ * is structurally incapable of re-skinning an agent that already exists. That
19
+ * property is worth stating here, because "default" in most products means a
20
+ * live fallback and this one does not.
21
+ */
22
+ export default class AgentsAvatarDefaultShow extends BaseCommand {
23
+ static description: string;
24
+ static examples: string[];
25
+ static flags: {
26
+ json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
27
+ };
28
+ run(): Promise<void>;
29
+ }
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.describePolicyProvenance = describePolicyProvenance;
4
+ const core_1 = require("@oclif/core");
5
+ const data_provider_1 = require("@skrr-ai/data-provider");
6
+ const base_command_1 = require("../../../../base-command");
7
+ /**
8
+ * Which of the two states produced the policy line above it.
9
+ *
10
+ * The route sends `explicit` precisely because the policy alone cannot carry
11
+ * it: `resolveAgentAvatarDefaultPolicy` maps an absent field and a deliberate
12
+ * choice of the same shape onto one value. So "I picked random-from-all" and "I
13
+ * have never picked anything" printed identically, and they are not the same
14
+ * fact — only the second follows the shipped default if it ever changes, which
15
+ * is the whole reason clearing exists as a separate operation from choosing.
16
+ */
17
+ function describePolicyProvenance(explicit) {
18
+ return explicit
19
+ ? ' You chose this. It stays until you change or clear it.'
20
+ : ' You have not chosen one, so this follows the shipped default — including if it changes.';
21
+ }
22
+ /**
23
+ * What face a NEW agent gets when its creator does not pick one.
24
+ *
25
+ * Wraps `GET /api/agents/avatar-default`. The policy is read exactly ONCE, at
26
+ * creation, and the drawn reference is written onto the agent — so changing it
27
+ * is structurally incapable of re-skinning an agent that already exists. That
28
+ * property is worth stating here, because "default" in most products means a
29
+ * live fallback and this one does not.
30
+ */
31
+ class AgentsAvatarDefaultShow extends base_command_1.BaseCommand {
32
+ static description = 'Show the default-avatar policy new agents are drawn from';
33
+ static examples = [
34
+ '<%= config.bin %> agents avatar default',
35
+ '<%= config.bin %> agents avatar default --json',
36
+ ];
37
+ static flags = {
38
+ json: core_1.Flags.boolean({ description: 'Output as JSON' }),
39
+ };
40
+ async run() {
41
+ this.requireAuth();
42
+ const { flags } = await this.parse(AgentsAvatarDefaultShow);
43
+ let response;
44
+ try {
45
+ response = await data_provider_1.dataService.getAgentAvatarDefault();
46
+ }
47
+ catch (err) {
48
+ this.handleApiError(err);
49
+ }
50
+ if (flags.json) {
51
+ this.log(JSON.stringify(response, null, 2));
52
+ return;
53
+ }
54
+ this.log((0, data_provider_1.describeAgentAvatarPolicy)(response.policy));
55
+ this.log(describePolicyProvenance(Boolean(response.explicit)));
56
+ this.log('');
57
+ this.log('Applies to agents created from now on. Existing agents keep the face they have —');
58
+ this.log('`skrr agents avatar default apply` is the one path that changes them.');
59
+ }
60
+ }
61
+ exports.default = AgentsAvatarDefaultShow;
@@ -0,0 +1,24 @@
1
+ import { BaseCommand } from '../../../../base-command';
2
+ /**
3
+ * Choose the policy. Wraps `PUT /api/agents/avatar-default`.
4
+ *
5
+ * ONE value, not three switches: `--mode` selects which of the shapes in
6
+ * `AgentAvatarDefaultPolicy` is being written, and the other flags supply that
7
+ * shape's payload. The union is the server's contract, so the command refuses a
8
+ * combination that cannot be one of its members rather than sending a
9
+ * half-formed object and letting zod name the problem.
10
+ */
11
+ export default class AgentsAvatarDefaultSet extends BaseCommand {
12
+ static description: string;
13
+ static examples: string[];
14
+ static flags: {
15
+ mode: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
16
+ clear: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
17
+ ref: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
18
+ scope: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
19
+ category: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
20
+ json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
21
+ };
22
+ private buildPolicy;
23
+ run(): Promise<void>;
24
+ }