@skrr-ai/cli 0.1.207 → 0.1.209

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 (168) hide show
  1. package/dist/commands/agent/message/no-reply.js +1 -1
  2. package/dist/commands/agent/message/react.d.ts +23 -0
  3. package/dist/commands/agent/message/react.js +125 -0
  4. package/dist/commands/agent/message/resolve.d.ts +31 -0
  5. package/dist/commands/agent/message/resolve.js +111 -0
  6. package/dist/commands/agent/message/retract.js +1 -1
  7. package/dist/commands/agent/message/send.d.ts +25 -6
  8. package/dist/commands/agent/message/send.js +135 -30
  9. package/dist/commands/agent/request/list.d.ts +15 -0
  10. package/dist/commands/agent/request/list.js +82 -0
  11. package/dist/commands/agent/request/send.d.ts +18 -0
  12. package/dist/commands/agent/request/send.js +56 -0
  13. package/dist/commands/agents/access/approve.d.ts +17 -0
  14. package/dist/commands/agents/access/approve.js +94 -0
  15. package/dist/commands/agents/access/deny.d.ts +10 -0
  16. package/dist/commands/agents/access/deny.js +36 -0
  17. package/dist/commands/agents/access/list.d.ts +10 -0
  18. package/dist/commands/agents/access/list.js +55 -0
  19. package/dist/commands/agents/access/reach.d.ts +13 -0
  20. package/dist/commands/agents/access/reach.js +53 -0
  21. package/dist/commands/agents/access/revoke.d.ts +13 -0
  22. package/dist/commands/agents/access/revoke.js +50 -0
  23. package/dist/commands/agents/always-on/recovery-review.d.ts +5 -0
  24. package/dist/commands/agents/always-on/recovery-review.js +16 -0
  25. package/dist/commands/agents/chat.d.ts +8 -0
  26. package/dist/commands/agents/chat.js +369 -90
  27. package/dist/commands/agents/import.d.ts +15 -1
  28. package/dist/commands/agents/import.js +212 -24
  29. package/dist/commands/agents/intuitions/accept.d.ts +0 -1
  30. package/dist/commands/agents/intuitions/accept.js +22 -7
  31. package/dist/commands/agents/intuitions/generate.d.ts +0 -1
  32. package/dist/commands/agents/intuitions/generate.js +4 -16
  33. package/dist/commands/agents/intuitions/list.js +9 -3
  34. package/dist/commands/agents/intuitions/resume.d.ts +11 -0
  35. package/dist/commands/agents/intuitions/resume.js +37 -0
  36. package/dist/commands/agents/manager/status.js +7 -6
  37. package/dist/commands/agents/not-for-task.d.ts +24 -0
  38. package/dist/commands/agents/not-for-task.js +60 -0
  39. package/dist/commands/agents/schedule-overview.d.ts +20 -0
  40. package/dist/commands/agents/schedule-overview.js +35 -2
  41. package/dist/commands/agents/shared-memory.d.ts +24 -0
  42. package/dist/commands/agents/shared-memory.js +67 -0
  43. package/dist/commands/agents/stop.d.ts +23 -0
  44. package/dist/commands/agents/stop.js +61 -0
  45. package/dist/commands/agents/update.d.ts +7 -0
  46. package/dist/commands/agents/update.js +45 -2
  47. package/dist/commands/agents/visibility.d.ts +1 -0
  48. package/dist/commands/agents/visibility.js +14 -0
  49. package/dist/commands/code/migrate.js +3 -1
  50. package/dist/commands/convos/messages.js +5 -0
  51. package/dist/commands/convos/transcript.js +2 -2
  52. package/dist/commands/daemon/logs.d.ts +3 -1
  53. package/dist/commands/daemon/logs.js +6 -2
  54. package/dist/commands/duties/advance-next.js +16 -7
  55. package/dist/commands/duties/preflight.js +17 -13
  56. package/dist/commands/followups/show.js +9 -0
  57. package/dist/commands/followups/watch-pr.d.ts +27 -0
  58. package/dist/commands/followups/watch-pr.js +124 -0
  59. package/dist/commands/harnesses/evaluations/evidence.js +2 -2
  60. package/dist/commands/harnesses/evaluations/grant.js +1 -1
  61. package/dist/commands/harnesses/evaluations/revoke.js +1 -1
  62. package/dist/commands/harnesses/evaluations/show.js +1 -1
  63. package/dist/commands/harnesses/rollouts/grant.js +1 -1
  64. package/dist/commands/harnesses/rollouts/revoke.js +1 -1
  65. package/dist/commands/machines/hosted/identity-evaluations/revoke.js +1 -1
  66. package/dist/commands/machines/hosted/identity-evaluations/show.js +1 -1
  67. package/dist/commands/memory/consolidation/index.d.ts +20 -0
  68. package/dist/commands/memory/consolidation/index.js +78 -0
  69. package/dist/commands/memory/consolidation/resume.d.ts +14 -0
  70. package/dist/commands/memory/consolidation/resume.js +46 -0
  71. package/dist/commands/memory/consolidation/undo.d.ts +18 -0
  72. package/dist/commands/memory/consolidation/undo.js +61 -0
  73. package/dist/commands/messages/list.js +9 -1
  74. package/dist/commands/slack/mutes.d.ts +10 -0
  75. package/dist/commands/slack/mutes.js +62 -0
  76. package/dist/commands/slack/unmute.d.ts +12 -0
  77. package/dist/commands/slack/unmute.js +44 -0
  78. package/dist/commands/tasks/actionability.js +10 -0
  79. package/dist/commands/tasks/ask.d.ts +50 -0
  80. package/dist/commands/tasks/ask.js +190 -0
  81. package/dist/commands/tasks/bulk-update.js +12 -0
  82. package/dist/commands/tasks/handover.js +14 -0
  83. package/dist/commands/tasks/input/answer.js +8 -2
  84. package/dist/commands/tasks/input/show.d.ts +26 -0
  85. package/dist/commands/tasks/input/show.js +185 -17
  86. package/dist/commands/tasks/list.d.ts +8 -0
  87. package/dist/commands/tasks/list.js +50 -9
  88. package/dist/commands/tasks/move.d.ts +3 -0
  89. package/dist/commands/tasks/move.js +71 -1
  90. package/dist/commands/tasks/result/show.js +19 -7
  91. package/dist/commands/tasks/result/submit.js +3 -0
  92. package/dist/commands/tasks/runs.d.ts +4 -1
  93. package/dist/commands/tasks/runs.js +22 -3
  94. package/dist/commands/tasks/show.d.ts +4 -3
  95. package/dist/commands/tasks/show.js +40 -7
  96. package/dist/commands/tasks/start.js +35 -16
  97. package/dist/commands/tasks/update.d.ts +1 -0
  98. package/dist/commands/tasks/update.js +55 -1
  99. package/dist/commands/tasks/updates/add.js +3 -0
  100. package/dist/commands/tasks/wait.d.ts +20 -0
  101. package/dist/commands/tasks/wait.js +103 -2
  102. package/dist/generated/agent-guides.json +892 -183
  103. package/dist/generated/managed-instruction-guides.json +1 -1
  104. package/dist/lib/agent-access-command.d.ts +19 -0
  105. package/dist/lib/agent-access-command.js +44 -0
  106. package/dist/lib/agent-access.d.ts +18 -0
  107. package/dist/lib/agent-access.js +48 -0
  108. package/dist/lib/agent-import/apply.d.ts +50 -0
  109. package/dist/lib/agent-import/apply.js +85 -0
  110. package/dist/lib/agent-import/plan.d.ts +132 -0
  111. package/dist/lib/agent-import/plan.js +504 -0
  112. package/dist/lib/agent-import/reader.d.ts +94 -0
  113. package/dist/lib/agent-import/reader.js +326 -0
  114. package/dist/lib/agent-import/schedule.d.ts +46 -0
  115. package/dist/lib/agent-import/schedule.js +220 -0
  116. package/dist/lib/agent-import/sources.d.ts +124 -0
  117. package/dist/lib/agent-import/sources.js +797 -0
  118. package/dist/lib/chat-stop.d.ts +17 -0
  119. package/dist/lib/chat-stop.js +70 -0
  120. package/dist/lib/cloud-reply.d.ts +21 -0
  121. package/dist/lib/cloud-reply.js +52 -0
  122. package/dist/lib/duties.js +24 -4
  123. package/dist/lib/duty-ledgers.js +19 -2
  124. package/dist/lib/file-mime.js +8 -0
  125. package/dist/lib/followups.d.ts +61 -0
  126. package/dist/lib/followups.js +39 -0
  127. package/dist/lib/handover-interview.d.ts +18 -0
  128. package/dist/lib/handover-interview.js +53 -0
  129. package/dist/lib/inbound-messages.d.ts +156 -0
  130. package/dist/lib/inbound-messages.js +375 -0
  131. package/dist/lib/input-queue.js +2 -1
  132. package/dist/lib/intuition-look.d.ts +10 -0
  133. package/dist/lib/intuition-look.js +64 -0
  134. package/dist/lib/message-intent.d.ts +18 -2
  135. package/dist/lib/message-intent.js +23 -1
  136. package/dist/lib/preflight-copy.d.ts +16 -1
  137. package/dist/lib/preflight-copy.js +33 -1
  138. package/dist/lib/record-output.d.ts +1 -1
  139. package/dist/lib/record-output.js +2 -0
  140. package/dist/lib/skill-import.d.ts +19 -0
  141. package/dist/lib/skill-import.js +34 -0
  142. package/dist/lib/slack-thread-mutes.d.ts +25 -0
  143. package/dist/lib/slack-thread-mutes.js +12 -0
  144. package/dist/lib/task-carriers.d.ts +18 -0
  145. package/dist/lib/task-carriers.js +43 -0
  146. package/dist/lib/task-extras.d.ts +5 -0
  147. package/dist/lib/task-extras.js +5 -0
  148. package/dist/lib/task-operations.d.ts +2 -0
  149. package/dist/lib/task-operations.js +28 -4
  150. package/dist/lib/task-preflight.js +1 -0
  151. package/dist/lib/task-recurrence-summary.d.ts +15 -0
  152. package/dist/lib/task-recurrence-summary.js +22 -0
  153. package/dist/lib/task-review-notice.d.ts +21 -0
  154. package/dist/lib/task-review-notice.js +46 -0
  155. package/dist/lib/task-version.d.ts +53 -0
  156. package/dist/lib/task-version.js +89 -0
  157. package/dist/lib/task-write-attribution.d.ts +7 -0
  158. package/dist/lib/task-write-attribution.js +14 -0
  159. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelopeBridge.js +6 -1
  160. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/turnPacing.d.ts +75 -0
  161. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/turnPacing.js +124 -0
  162. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelopeBridge.js +45 -15
  163. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/turnPacing.d.ts +75 -0
  164. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/turnPacing.js +141 -0
  165. package/dist/node_modules/@skrr-ai/auth-core/package.json +11 -1
  166. package/dist/node_modules/@skrr-ai/data-provider/index.js +13492 -12505
  167. package/oclif.manifest.json +2090 -132
  168. package/package.json +9 -2
@@ -9,9 +9,32 @@ const core_1 = require("@oclif/core");
9
9
  const data_provider_1 = require("@skrr-ai/data-provider");
10
10
  const base_command_1 = require("../../base-command");
11
11
  const agent_spec_1 = require("../../lib/agent-spec");
12
+ const apply_1 = require("../../lib/agent-import/apply");
13
+ const plan_1 = require("../../lib/agent-import/plan");
14
+ const sources_1 = require("../../lib/agent-import/sources");
15
+ const duties_1 = require("../../lib/duties");
16
+ const prompt_1 = require("../../lib/prompt");
17
+ const skill_import_1 = require("../../lib/skill-import");
18
+ /** What an import reads of the target agent. Closures, so the services are looked up per call. */
19
+ const TARGET_READERS = {
20
+ getBootstrap: (agentId) => data_provider_1.dataService.getBootstrap(agentId),
21
+ getBootstrapHistory: (agentId, options) => data_provider_1.dataService.getBootstrapHistory(agentId, options),
22
+ getSkillsByAgent: (agentId) => data_provider_1.dataService.getSkillsByAgent(agentId),
23
+ listProposals: (agentId, status) => data_provider_1.dataService.getAgentMemoryWorkspaceProposals(agentId, status),
24
+ listDuties: (query) => duties_1.dutyApi.list(query),
25
+ };
26
+ /** How an import writes to the target agent: each kind through the surface that owns it. */
27
+ const WRITERS = {
28
+ updatePersonaFile: ({ agentId, fileType, content, reason }) => data_provider_1.dataService.updateBootstrapFile({ agentId, fileType, content, reason }),
29
+ observeMemory: (agentId, input) => data_provider_1.dataService.observeAgentMemory(agentId, input),
30
+ createSkill: (skill, agentId) => (0, skill_import_1.createImportedSkill)(skill, agentId),
31
+ importDuty: (body) => duties_1.dutyApi.import(body),
32
+ };
12
33
  /**
13
34
  * Bring a Claude Code asset in: a subagent (`.claude/agents/<name>.md`) or a
14
- * skill (`SKILL.md`, or the directory holding one).
35
+ * skill (`SKILL.md`, or the directory holding one). Or bring a whole bot over
36
+ * from OpenClaw, Hermes or Orca: point it at the bot's folder (see
37
+ * `lib/agent-import/`), read the plan, and say yes.
15
38
  *
16
39
  * A subagent becomes an agent spec document — printed or written with
17
40
  * `--output`, or pushed onto an existing agent with `--agent` (the same push
@@ -24,42 +47,75 @@ const agent_spec_1 = require("../../lib/agent-spec");
24
47
  * import says what it did not do.
25
48
  */
26
49
  class AgentsImport extends base_command_1.BaseCommand {
27
- static description = 'Import a Claude Code subagent (.claude/agents/*.md) or SKILL.md; hooks and MCP commands are never imported';
50
+ static description = 'Import a Claude Code subagent (.claude/agents/*.md) or SKILL.md, or an OpenClaw, Hermes or Orca bot folder; hooks, MCP commands, key files and secret-looking lines are never imported';
28
51
  static examples = [
29
52
  '<%= config.bin %> agents import .claude/agents/reviewer.md --output reviewer.agent.json',
30
53
  '<%= config.bin %> agents import .claude/agents/reviewer.md --agent <agent-id>',
31
54
  '<%= config.bin %> agents import .claude/skills/release-notes --agent <agent-id>',
32
55
  '<%= config.bin %> agents import .claude/skills/release-notes/SKILL.md',
33
56
  'cat reviewer.md | <%= config.bin %> agents import - --output reviewer.agent.json',
57
+ '<%= config.bin %> agents import ~/.openclaw',
58
+ '<%= config.bin %> agents import ~/.openclaw --source-agent research --agent <agent-id>',
59
+ '<%= config.bin %> agents import ~/.hermes --agent <agent-id> --yes',
60
+ '<%= config.bin %> agents import ~/.orca/bots/sage --from orca --agent <agent-id>',
34
61
  ];
35
62
  static args = {
36
63
  path: core_1.Args.string({
37
- description: 'A .claude/agents/*.md file, a SKILL.md, a directory containing SKILL.md, or "-" to read a subagent file from stdin',
64
+ description: 'A .claude/agents/*.md file, a SKILL.md, a directory containing SKILL.md, an OpenClaw, Hermes or Orca bot folder, or "-" to read a subagent file from stdin',
38
65
  required: true,
39
66
  ignoreStdin: true,
40
67
  }),
41
68
  };
42
69
  static flags = {
43
70
  agent: core_1.Flags.string({
44
- description: 'Subagent: push the converted spec onto this agent. Skill: attach the new skill to it.',
71
+ description: 'Subagent: push the converted spec onto this agent. Skill: attach the new skill to it. Bot folder: the agent to bring the bot into (without it, only the plan is shown).',
45
72
  }),
46
73
  output: core_1.Flags.string({
47
74
  char: 'o',
48
75
  description: 'Subagent only: write the converted spec document here (omit for stdout)',
49
76
  }),
50
77
  json: core_1.Flags.boolean({ description: 'Output the result as JSON' }),
78
+ from: core_1.Flags.string({
79
+ description: 'Bot folder: the app it comes from, when its layout does not say (openclaw, hermes, orca)',
80
+ options: [...sources_1.AGENT_IMPORT_APPS],
81
+ }),
82
+ 'source-agent': core_1.Flags.string({
83
+ description: 'Bot folder: which bot in it (an OpenClaw agent id, default main; a Hermes profile; an Orca bot folder)',
84
+ }),
85
+ yes: core_1.Flags.boolean({
86
+ char: 'y',
87
+ description: 'Bot folder: import without asking (the plan is still printed)',
88
+ default: false,
89
+ }),
90
+ 'replace-persona': core_1.Flags.boolean({
91
+ description: 'Bot folder: replace persona files written on this agent (the old ones stay in their history)',
92
+ default: false,
93
+ }),
51
94
  };
52
95
  async run() {
53
96
  const { args, flags } = await this.parse(AgentsImport);
54
97
  // stdin has no file name to route on, so it is read as a subagent file;
55
98
  // a SKILL.md is imported by path, where its directory names it.
56
99
  const fromStdin = args.path === '-';
100
+ if (flags.from || (!fromStdin && (await this.isBotFolder(args.path)))) {
101
+ await this.importBot(args.path, flags);
102
+ return;
103
+ }
104
+ for (const flag of ['source-agent', 'replace-persona']) {
105
+ if (flags[flag]) {
106
+ this.failWithCliError({
107
+ message: `--${flag} applies to a bot folder from OpenClaw, Hermes or Orca.`,
108
+ code: 'IMPORT_FLAG_NOT_APPLICABLE',
109
+ exit: 2,
110
+ retryable: false,
111
+ });
112
+ }
113
+ }
57
114
  let sourcePath = args.path;
58
115
  if (!fromStdin) {
116
+ let isDirectory = false;
59
117
  try {
60
- if ((await (0, promises_1.stat)(sourcePath)).isDirectory()) {
61
- sourcePath = node_path_1.default.join(sourcePath, 'SKILL.md');
62
- }
118
+ isDirectory = (await (0, promises_1.stat)(sourcePath)).isDirectory();
63
119
  }
64
120
  catch (err) {
65
121
  this.failWithCliError({
@@ -70,6 +126,18 @@ class AgentsImport extends base_command_1.BaseCommand {
70
126
  details: { path: args.path },
71
127
  });
72
128
  }
129
+ if (isDirectory) {
130
+ sourcePath = node_path_1.default.join(sourcePath, 'SKILL.md');
131
+ if (!(await (0, promises_1.stat)(sourcePath).catch(() => null))) {
132
+ this.failWithCliError({
133
+ message: `${args.path} holds no SKILL.md and does not look like an OpenClaw, Hermes or Orca bot folder. For a bot folder, name its app with --from openclaw|hermes|orca.`,
134
+ code: 'IMPORT_SOURCE_UNKNOWN',
135
+ exit: 1,
136
+ retryable: false,
137
+ details: { path: args.path },
138
+ });
139
+ }
140
+ }
73
141
  }
74
142
  let text;
75
143
  try {
@@ -148,7 +216,7 @@ class AgentsImport extends base_command_1.BaseCommand {
148
216
  });
149
217
  }
150
218
  if (flags.json) {
151
- this.log(JSON.stringify({ output: flags.output, document, dropped }, null, 2));
219
+ this.printJsonResult({ output: flags.output, document, dropped });
152
220
  return;
153
221
  }
154
222
  this.log(`Wrote ${Object.keys(document.spec).length} field(s) to ${flags.output}.`);
@@ -199,35 +267,155 @@ class AgentsImport extends base_command_1.BaseCommand {
199
267
  const { skill, dropped } = this.convert(() => (0, data_provider_1.skillFromSkillMarkdown)(text, { sourcePath }));
200
268
  this.requireAuth();
201
269
  let created;
270
+ let skillId;
202
271
  try {
203
- created = await data_provider_1.dataService.createSkill({
204
- agentId: flags.agent ?? null,
205
- name: skill.name,
206
- description: skill.description,
207
- content: skill.content,
208
- frontmatter: skill.frontmatter,
209
- });
272
+ ({ created, skillId } = await (0, skill_import_1.createImportedSkill)(skill, flags.agent ?? null));
210
273
  }
211
274
  catch (err) {
212
275
  this.handleApiError(err, { subject: `skill ${skill.name}` });
213
276
  }
214
- const skillId = created.id;
215
- if (flags.agent && skillId) {
277
+ if (flags.json) {
278
+ this.printJsonResult({ skill: created, attachedTo: flags.agent ?? null, dropped });
279
+ return;
280
+ }
281
+ this.log(flags.agent
282
+ ? `Imported skill ${skill.name} (${skillId ?? 'no id returned'}) and attached it to agent ${flags.agent}.`
283
+ : `Imported skill ${skill.name} (${skillId ?? 'no id returned'}) into your library.`);
284
+ this.printDropped(dropped);
285
+ }
286
+ /** A folder with no SKILL.md whose layout is an OpenClaw, Hermes or Orca bot's. */
287
+ async isBotFolder(folder) {
288
+ const info = await (0, promises_1.stat)(folder).catch(() => null);
289
+ if (!info?.isDirectory())
290
+ return false;
291
+ if (await (0, promises_1.stat)(node_path_1.default.join(folder, 'SKILL.md')).catch(() => null))
292
+ return false;
293
+ return (0, sources_1.looksLikeBotFolder)(folder);
294
+ }
295
+ /**
296
+ * Bring a bot over from another app. Reads the folder (never a key file, never a secret-looking
297
+ * line, never a link out of it), shows the plan, and writes only after a yes: the prompt on a
298
+ * terminal, `--yes` anywhere else. Without `--agent` it shows the plan and writes nothing.
299
+ */
300
+ async importBot(folder, flags) {
301
+ if (flags.output) {
302
+ this.failWithCliError({
303
+ message: '--output applies to a subagent file; a bot folder is imported into an agent with --agent.',
304
+ code: 'IMPORT_FLAG_NOT_APPLICABLE',
305
+ exit: 2,
306
+ retryable: false,
307
+ });
308
+ }
309
+ let source;
310
+ try {
311
+ source = await (0, sources_1.readImportSource)(folder, {
312
+ app: flags.from,
313
+ sourceAgent: flags['source-agent'],
314
+ });
315
+ }
316
+ catch (err) {
317
+ if (err instanceof sources_1.AgentImportSourceError) {
318
+ this.failWithCliError({
319
+ message: err.message,
320
+ code: err.code,
321
+ exit: 1,
322
+ retryable: false,
323
+ details: { path: folder },
324
+ });
325
+ }
326
+ this.failWithCliError({
327
+ message: `Could not read ${folder}: ${err.message}`,
328
+ code: 'IMPORT_SOURCE_UNREADABLE',
329
+ exit: 1,
330
+ retryable: false,
331
+ details: { path: folder },
332
+ });
333
+ }
334
+ let target = null;
335
+ if (flags.agent) {
336
+ this.requireAuth();
216
337
  try {
217
- await data_provider_1.dataService.addAgentSkill({ agentId: flags.agent, skillId });
338
+ target = await (0, plan_1.loadImportTarget)(flags.agent, TARGET_READERS, source.persona.map((file) => file.fileType));
218
339
  }
219
340
  catch (err) {
220
341
  this.handleApiError(err, { subject: `agent ${flags.agent}` });
221
342
  }
222
343
  }
223
- if (flags.json) {
224
- this.log(JSON.stringify({ skill: created, attachedTo: flags.agent ?? null, dropped }, null, 2));
344
+ const plan = (0, plan_1.buildImportPlan)(source, target, {
345
+ replacePersona: flags['replace-persona'] === true,
346
+ });
347
+ const writes = (0, plan_1.planWrites)(plan);
348
+ const showPlan = () => {
349
+ for (const line of (0, plan_1.renderImportPlan)(plan))
350
+ this.log(line);
351
+ this.log('');
352
+ };
353
+ if (!flags.agent) {
354
+ if (flags.json) {
355
+ this.printJsonResult({ applied: false, ...(0, plan_1.planForOutput)(plan) });
356
+ return;
357
+ }
358
+ showPlan();
359
+ this.log('Nothing was written.');
360
+ this.log(`To bring ${plan.name} over, create an agent for it (skrr agents create), then run this again with --agent <agent-id>.`);
225
361
  return;
226
362
  }
227
- this.log(flags.agent
228
- ? `Imported skill ${skill.name} (${skillId ?? 'no id returned'}) and attached it to agent ${flags.agent}.`
229
- : `Imported skill ${skill.name} (${skillId ?? 'no id returned'}) into your library.`);
230
- this.printDropped(dropped);
363
+ const agentId = flags.agent;
364
+ if (writes.length === 0) {
365
+ if (flags.json) {
366
+ this.log(this.agentJson(agentId, { applied: false, ...(0, plan_1.planForOutput)(plan), results: [] }));
367
+ return;
368
+ }
369
+ showPlan();
370
+ this.log('Nothing to import: everything that can come over is already here.');
371
+ return;
372
+ }
373
+ if (!flags.yes) {
374
+ const interactive = !flags.json && Boolean(process.stdin.isTTY) && Boolean(process.stdout.isTTY);
375
+ if (!interactive) {
376
+ if (flags.json) {
377
+ this.log(this.agentJson(agentId, { applied: false, ...(0, plan_1.planForOutput)(plan) }));
378
+ return;
379
+ }
380
+ showPlan();
381
+ this.log('Nothing was written. Re-run with --yes to import it.');
382
+ return;
383
+ }
384
+ showPlan();
385
+ const yes = await (0, prompt_1.confirm)(`Import ${writes.length} item${writes.length === 1 ? '' : 's'} into agent ${agentId}?`);
386
+ if (!yes) {
387
+ this.log('Nothing was written.');
388
+ return;
389
+ }
390
+ }
391
+ else if (!flags.json) {
392
+ showPlan();
393
+ }
394
+ const results = await (0, apply_1.applyImportPlan)(plan, agentId, WRITERS);
395
+ const failed = results.filter((result) => result.outcome === 'failed');
396
+ if (flags.json) {
397
+ this.log(this.agentJson(agentId, { applied: true, ...(0, plan_1.planForOutput)(plan), results }));
398
+ }
399
+ else {
400
+ for (const line of (0, apply_1.renderApplyResults)(results))
401
+ this.log(line);
402
+ if (results.some((result) => result.area === 'duty' && result.outcome === 'written')) {
403
+ this.log('Draft Duties never run on their own. When the old bot is off, restore each schedule (skrr duties update <id> --restore-saved-cadence) and turn it on (skrr duties resume <id>).');
404
+ }
405
+ if (results.some((result) => result.area === 'memory' && result.outcome === 'written')) {
406
+ this.log(`Review the Memory proposals: skrr memory proposals list --agent ${agentId} --scope agent:${agentId}`);
407
+ }
408
+ this.printAgentUrl(agentId);
409
+ }
410
+ if (failed.length) {
411
+ this.failWithCliError({
412
+ message: `${failed.length} of ${results.length} items were not written. Run the same command again to retry them; nothing already written is written twice.`,
413
+ code: 'IMPORT_INCOMPLETE',
414
+ exit: 1,
415
+ retryable: true,
416
+ details: { failed },
417
+ });
418
+ }
231
419
  }
232
420
  }
233
421
  exports.default = AgentsImport;
@@ -6,7 +6,6 @@ export default class AgentsIntuitionsAccept extends BaseCommand {
6
6
  intuitionId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
7
7
  };
8
8
  static flags: {
9
- 'from-json': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
9
  json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
10
  };
12
11
  run(): Promise<void>;
@@ -3,24 +3,39 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
4
  const data_provider_1 = require("@skrr-ai/data-provider");
5
5
  const base_command_1 = require("../../../base-command");
6
- const prompt_1 = require("../../../lib/prompt");
7
6
  class AgentsIntuitionsAccept extends base_command_1.BaseCommand {
8
- static description = 'Accept an intuition and create its automation';
7
+ static description = 'Take up a suggestion: prints its ask as a draft to send to the agent. Nothing is sent';
9
8
  static args = {
10
9
  agentId: core_1.Args.string({ required: true, ignoreStdin: true }),
11
10
  intuitionId: core_1.Args.string({ required: true, ignoreStdin: true }),
12
11
  };
13
12
  static flags = {
14
- 'from-json': core_1.Flags.string({ description: 'Customization JSON file or -' }),
15
13
  json: core_1.Flags.boolean({ description: 'Output JSON' }),
16
14
  };
17
15
  async run() {
18
16
  this.requireAuth();
19
17
  const { args, flags } = await this.parse(AgentsIntuitionsAccept);
20
- const result = await data_provider_1.dataService.acceptAgentIntuition(args.agentId, args.intuitionId, await (0, prompt_1.readJsonBody)(flags['from-json']));
21
- this.log(flags.json ? this.agentJson(args.agentId, result) : `Accepted intuition ${args.intuitionId}`);
22
- if (!flags.json)
23
- this.printAgentUrl(args.agentId);
18
+ let result;
19
+ try {
20
+ result = await data_provider_1.dataService.acceptAgentIntuition(args.agentId, args.intuitionId);
21
+ }
22
+ catch (err) {
23
+ this.handleApiError(err);
24
+ }
25
+ if (flags.json) {
26
+ this.log(this.agentJson(args.agentId, result));
27
+ return;
28
+ }
29
+ const draft = result?.draft;
30
+ this.log(`Accepted suggestion ${args.intuitionId}. Nothing was sent.`);
31
+ if (draft?.text) {
32
+ this.log('');
33
+ this.log('Draft:');
34
+ this.log(draft.text);
35
+ this.log('');
36
+ this.log(`Edit it and send it with: skrr agents chat ${args.agentId} --prompt "<message>"`);
37
+ }
38
+ this.printAgentUrl(args.agentId);
24
39
  }
25
40
  }
26
41
  exports.default = AgentsIntuitionsAccept;
@@ -5,7 +5,6 @@ export default class AgentsIntuitionsGenerate extends BaseCommand {
5
5
  agentId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
6
6
  };
7
7
  static flags: {
8
- force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
8
  json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
9
  };
11
10
  run(): Promise<void>;
@@ -4,10 +4,9 @@ const core_1 = require("@oclif/core");
4
4
  const data_provider_1 = require("@skrr-ai/data-provider");
5
5
  const base_command_1 = require("../../../base-command");
6
6
  class AgentsIntuitionsGenerate extends base_command_1.BaseCommand {
7
- static description = 'Generate fresh intuitions for an agent';
7
+ static description = 'Ask an agent to look around now (read-only) and suggest what it can point to. Owner only';
8
8
  static args = { agentId: core_1.Args.string({ required: true, ignoreStdin: true }) };
9
9
  static flags = {
10
- force: core_1.Flags.boolean({ description: 'Regenerate even when cached intuitions exist' }),
11
10
  json: core_1.Flags.boolean({ description: 'Output JSON' }),
12
11
  };
13
12
  async run() {
@@ -15,7 +14,7 @@ class AgentsIntuitionsGenerate extends base_command_1.BaseCommand {
15
14
  const { args, flags } = await this.parse(AgentsIntuitionsGenerate);
16
15
  let result;
17
16
  try {
18
- result = await data_provider_1.dataService.generateAgentIntuitions(args.agentId, flags.force);
17
+ result = await data_provider_1.dataService.lookAroundAgentIntuitions(args.agentId);
19
18
  }
20
19
  catch (err) {
21
20
  this.handleApiError(err);
@@ -24,19 +23,8 @@ class AgentsIntuitionsGenerate extends base_command_1.BaseCommand {
24
23
  this.log(this.agentJson(args.agentId, result));
25
24
  return;
26
25
  }
27
- const response = result;
28
- if (response.outcome === 'insufficient_context') {
29
- this.log('No intuitions yet: add relevant agent memories or activity, then try again.');
30
- }
31
- else if (response.outcome === 'no_suggestions') {
32
- this.log('No intuitions were suggested from the available context. Try again after more activity.');
33
- }
34
- else if (response.intuitions?.length === 0) {
35
- this.log('No intuitions were returned. Add relevant memories or activity, then try again.');
36
- }
37
- else {
38
- this.log(`Generated intuitions for agent ${args.agentId}`);
39
- }
26
+ // The look runs on an agent worker; the server only queued it.
27
+ this.log(`The agent is looking around. See what it found with: skrr agents intuitions list ${args.agentId}`);
40
28
  this.printAgentUrl(args.agentId);
41
29
  }
42
30
  }
@@ -4,8 +4,9 @@ const list_output_1 = require("../../../lib/list-output");
4
4
  const core_1 = require("@oclif/core");
5
5
  const data_provider_1 = require("@skrr-ai/data-provider");
6
6
  const base_command_1 = require("../../../base-command");
7
+ const intuition_look_1 = require("../../../lib/intuition-look");
7
8
  class AgentsIntuitionsList extends base_command_1.BaseCommand {
8
- static description = "List an agent's generated intuitions";
9
+ static description = "List an agent's open suggestions, each with the source it read";
9
10
  static args = { agentId: core_1.Args.string({ required: true, ignoreStdin: true }) };
10
11
  static flags = { json: core_1.Flags.boolean({ description: 'Output JSON' }) };
11
12
  async run() {
@@ -16,13 +17,18 @@ class AgentsIntuitionsList extends base_command_1.BaseCommand {
16
17
  this.printJsonResult((0, list_output_1.listResult)(this.withAgentContext(args.agentId, result), 'intuitions'));
17
18
  return;
18
19
  }
19
- const intuitions = result.intuitions ?? result;
20
+ const response = result;
21
+ const intuitions = response.intuitions ?? result;
20
22
  if (Array.isArray(intuitions) && intuitions.length === 0) {
21
- this.log(`No active intuitions. Run skrr agents intuitions generate ${args.agentId} to look for suggestions.`);
23
+ this.log(response.canLook
24
+ ? `No open suggestions. Ask it to look around now: skrr agents intuitions generate ${args.agentId}`
25
+ : 'No open suggestions.');
22
26
  }
23
27
  else {
24
28
  this.printJsonResult(intuitions);
25
29
  }
30
+ for (const line of (0, intuition_look_1.describeLookAround)(response.lookAround, args.agentId))
31
+ this.log(line);
26
32
  this.printAgentUrl(args.agentId);
27
33
  }
28
34
  }
@@ -0,0 +1,11 @@
1
+ import { BaseCommand } from '../../../base-command';
2
+ export default class AgentsIntuitionsResume extends BaseCommand {
3
+ static description: string;
4
+ static args: {
5
+ agentId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
6
+ };
7
+ static flags: {
8
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
+ };
10
+ run(): Promise<void>;
11
+ }
@@ -0,0 +1,37 @@
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
+ const intuition_look_1 = require("../../../lib/intuition-look");
7
+ class AgentsIntuitionsResume extends base_command_1.BaseCommand {
8
+ static description = "Resume an agent's look around after it paused itself on repeated failures. Owner only";
9
+ static args = { agentId: core_1.Args.string({ required: true, ignoreStdin: true }) };
10
+ static flags = {
11
+ json: core_1.Flags.boolean({ description: 'Output JSON' }),
12
+ };
13
+ async run() {
14
+ this.requireAuth();
15
+ const { args, flags } = await this.parse(AgentsIntuitionsResume);
16
+ let result;
17
+ try {
18
+ result = await data_provider_1.dataService.resumeAgentIntuitionLook(args.agentId);
19
+ }
20
+ catch (err) {
21
+ this.handleApiError(err);
22
+ }
23
+ if (flags.json) {
24
+ this.log(this.agentJson(args.agentId, result));
25
+ return;
26
+ }
27
+ const lookAround = result
28
+ ?.lookAround;
29
+ this.log(lookAround?.state === 'paused'
30
+ ? 'Looking around is still paused.'
31
+ : 'Looking around resumed.');
32
+ for (const line of (0, intuition_look_1.describeLookAround)(lookAround, args.agentId))
33
+ this.log(line);
34
+ this.printAgentUrl(args.agentId);
35
+ }
36
+ }
37
+ exports.default = AgentsIntuitionsResume;
@@ -19,13 +19,14 @@ class AgentsManagerStatus extends base_command_1.BaseCommand {
19
19
  this.requireAuth();
20
20
  const { flags } = await this.parse(AgentsManagerStatus);
21
21
  try {
22
- const { workspaceId, agent: manager, duty: staffingDuty } = await data_provider_1.dataService.getAgentManagerStatus();
22
+ const { workspaceId, agent: manager, duty: staffingDuty, } = await data_provider_1.dataService.getAgentManagerStatus();
23
23
  const agent = manager && (0, web_url_1.withAgentUrl)(this.cliConfig.baseURL, manager);
24
24
  const detail = staffingDuty ? await duties_1.dutyApi.get(staffingDuty.id) : null;
25
- const duty = staffingDuty && (0, web_url_1.withDutyUrl)(this.cliConfig.baseURL, {
26
- ...staffingDuty,
27
- status: detail?.duty?.status ?? staffingDuty.status,
28
- });
25
+ const duty = staffingDuty &&
26
+ (0, web_url_1.withDutyUrl)(this.cliConfig.baseURL, {
27
+ ...staffingDuty,
28
+ status: detail?.duty?.status ?? staffingDuty.status,
29
+ });
29
30
  const historyAvailable = detail ? (0, duty_history_source_1.hasVerifiedDutyHistorySource)(detail) : null;
30
31
  const operatingTrigger = historyAvailable ? detail?.operatingState?.trigger : null;
31
32
  const trigger = operatingTrigger
@@ -43,7 +44,7 @@ class AgentsManagerStatus extends base_command_1.BaseCommand {
43
44
  }
44
45
  : null;
45
46
  if (flags.json) {
46
- this.log(JSON.stringify({ workspaceId, agent, duty, trigger, historyAvailable, latestCheck }, null, 2));
47
+ this.printJsonResult({ workspaceId, agent, duty, trigger, historyAvailable, latestCheck });
47
48
  return;
48
49
  }
49
50
  if (!agent) {
@@ -0,0 +1,24 @@
1
+ import { BaseCommand } from '../../base-command';
2
+ /**
3
+ * `skrr agents not-for-task <message> --conversation <id>`: a message of yours that your agent
4
+ * passed to a Task was not for that Task. It comes back to the conversation and is delivered there
5
+ * again; the Task is told, and its response is stopped when it was for this message alone.
6
+ * Running it again answers with the message as it is and changes nothing.
7
+ */
8
+ export default class AgentsNotForTask extends BaseCommand {
9
+ static description: string;
10
+ static examples: string[];
11
+ static args: {
12
+ message: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
13
+ };
14
+ static flags: {
15
+ conversation: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
16
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
17
+ bare: import("@oclif/core/interfaces").BooleanFlag<boolean>;
18
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
+ workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
20
+ profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
21
+ raw: import("@oclif/core/interfaces").BooleanFlag<boolean>;
22
+ };
23
+ run(): Promise<void>;
24
+ }
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const base_command_1 = require("../../base-command");
5
+ const inbound_messages_1 = require("../../lib/inbound-messages");
6
+ /**
7
+ * `skrr agents not-for-task <message> --conversation <id>`: a message of yours that your agent
8
+ * passed to a Task was not for that Task. It comes back to the conversation and is delivered there
9
+ * again; the Task is told, and its response is stopped when it was for this message alone.
10
+ * Running it again answers with the message as it is and changes nothing.
11
+ */
12
+ class AgentsNotForTask extends base_command_1.BaseCommand {
13
+ static description = 'Bring back a message your agent passed to a Task, and have it answered in the conversation';
14
+ static examples = [
15
+ '<%= config.bin %> agents not-for-task msg_3f9a1c2b --conversation <conversation-id>',
16
+ '<%= config.bin %> agents not-for-task msg_3f9a1c2b --conversation <conversation-id> --json',
17
+ ];
18
+ static args = {
19
+ message: core_1.Args.string({ description: 'The id of your message', required: true }),
20
+ };
21
+ static flags = {
22
+ ...base_command_1.BaseCommand.baseFlags,
23
+ conversation: core_1.Flags.string({ description: 'Conversation the message is in', required: true }),
24
+ json: core_1.Flags.boolean({ description: 'Output as JSON' }),
25
+ };
26
+ async run() {
27
+ this.requireAuth();
28
+ const { args, flags } = await this.parse(AgentsNotForTask);
29
+ let answer;
30
+ try {
31
+ answer = await (0, inbound_messages_1.returnInboundMessage)(flags.conversation, args.message);
32
+ }
33
+ catch (err) {
34
+ const refusal = (0, inbound_messages_1.returnRefusalOf)(err);
35
+ if (refusal) {
36
+ this.failWithCliError({
37
+ message: refusal,
38
+ code: 'MESSAGE_NOT_RETURNED',
39
+ exit: 1,
40
+ retryable: false,
41
+ details: { messageId: args.message, conversationId: flags.conversation },
42
+ });
43
+ }
44
+ this.handleApiError(err);
45
+ }
46
+ if (flags.json)
47
+ return this.printJsonResult(answer);
48
+ this.log((0, inbound_messages_1.returnedSentence)(answer.returned ?? {}));
49
+ // How it is delivered here now: why it waits or failed, else what its route says.
50
+ const state = answer.delivery?.state;
51
+ const now = state === 'held' || state === 'failed'
52
+ ? (0, inbound_messages_1.deliverySentence)(answer.delivery)
53
+ : answer.route
54
+ ? inbound_messages_1.ROUTE_COPY[answer.route]
55
+ : null;
56
+ if (now)
57
+ this.log(now);
58
+ }
59
+ }
60
+ exports.default = AgentsNotForTask;
@@ -63,3 +63,23 @@ export interface WithheldTrigger {
63
63
  * agent's Always-On switch. A server that predates `reasonText` still prints the code.
64
64
  */
65
65
  export declare function withheldLine(trigger: WithheldTrigger): string;
66
+ /**
67
+ * Why the Recent fires section has no rows, when the read did not succeed. The states and reasons are
68
+ * the ones the agent's own overview tool answers with (`self_schedule_overview`'s `recentFiresCoverage`),
69
+ * so a person and an agent are told the same thing.
70
+ *
71
+ * The server refuses an Agent's fire history (409 `FIRE_SOURCE_UNVERIFIED`): a fire row records the
72
+ * Trigger's and the Agent's logical ids only, and an Agent recreated under the same id, or a Duty
73
+ * handed to another executor, shares them. That refusal is `unsupported`; any other failure is
74
+ * `unavailable`. Either way the section used to print "No fire audit records." under the error, which
75
+ * read as "nothing fired" (OSK-33261). Undefined for a read that succeeded, even with no rows.
76
+ */
77
+ export interface RecentFiresCoverage {
78
+ state: 'unsupported' | 'unavailable';
79
+ reason: string;
80
+ }
81
+ export declare const RECENT_FIRES_UNSUPPORTED_REASON = "Historical fires do not prove the physical Agent at occurrence time.";
82
+ export declare const RECENT_FIRES_UNAVAILABLE_REASON = "Recent fire history could not be read.";
83
+ export declare function recentFiresCoverage(result: PromiseSettledResult<unknown>): RecentFiresCoverage | undefined;
84
+ /** The one line the text view prints instead of the list. An unavailable read keeps its error. */
85
+ export declare function recentFiresCoverageLine(coverage: RecentFiresCoverage, result: PromiseSettledResult<unknown>): string;