@skrr-ai/cli 0.1.202 → 0.1.206

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 (71) hide show
  1. package/bin/dev-fallback.js +47 -29
  2. package/bin/dev.cjs +6 -0
  3. package/dist/base-command.js +1 -1
  4. package/dist/commands/agent/message/context.d.ts +3 -0
  5. package/dist/commands/agent/message/context.js +33 -1
  6. package/dist/commands/agent/message/no-reply.d.ts +17 -0
  7. package/dist/commands/agent/message/no-reply.js +54 -0
  8. package/dist/commands/agent/message/retract.d.ts +24 -0
  9. package/dist/commands/agent/message/retract.js +167 -0
  10. package/dist/commands/agent/message/send.d.ts +53 -3
  11. package/dist/commands/agent/message/send.js +148 -4
  12. package/dist/commands/agents/chat.d.ts +12 -0
  13. package/dist/commands/agents/chat.js +258 -25
  14. package/dist/commands/agents/manager/status.d.ts +9 -0
  15. package/dist/commands/agents/manager/status.js +84 -0
  16. package/dist/commands/agents/queue/clear.d.ts +13 -0
  17. package/dist/commands/agents/queue/clear.js +31 -0
  18. package/dist/commands/agents/queue/list.d.ts +10 -0
  19. package/dist/commands/agents/queue/list.js +34 -0
  20. package/dist/commands/agents/queue/move.d.ts +16 -0
  21. package/dist/commands/agents/queue/move.js +33 -0
  22. package/dist/commands/agents/queue/pause.d.ts +7 -0
  23. package/dist/commands/agents/queue/pause.js +24 -0
  24. package/dist/commands/agents/queue/resume.d.ts +7 -0
  25. package/dist/commands/agents/queue/resume.js +24 -0
  26. package/dist/commands/agents/queue/steer.d.ts +14 -0
  27. package/dist/commands/agents/queue/steer.js +38 -0
  28. package/dist/commands/agents/queue/withdraw.d.ts +10 -0
  29. package/dist/commands/agents/queue/withdraw.js +27 -0
  30. package/dist/commands/agents/supervision.d.ts +1 -0
  31. package/dist/commands/agents/supervision.js +28 -9
  32. package/dist/commands/convos/transcript.d.ts +48 -0
  33. package/dist/commands/convos/transcript.js +461 -0
  34. package/dist/commands/duties/advance-next.d.ts +17 -0
  35. package/dist/commands/duties/advance-next.js +122 -0
  36. package/dist/commands/duties/pack/plan.js +45 -0
  37. package/dist/commands/duties/preflight.d.ts +1 -0
  38. package/dist/commands/duties/preflight.js +18 -2
  39. package/dist/commands/spaces/auto-executor/preview.js +6 -2
  40. package/dist/commands/spaces/charter/revise.d.ts +16 -0
  41. package/dist/commands/spaces/charter/revise.js +84 -0
  42. package/dist/commands/spaces/skills/propose.d.ts +1 -0
  43. package/dist/commands/spaces/skills/propose.js +5 -0
  44. package/dist/commands/tasks/create.js +16 -1
  45. package/dist/commands/tasks/result/show.js +6 -3
  46. package/dist/commands/tasks/start.d.ts +3 -0
  47. package/dist/commands/tasks/start.js +12 -1
  48. package/dist/commands/triggers/capabilities.js +14 -4
  49. package/dist/generated/agent-guides.json +258 -24
  50. package/dist/lib/agent-chat-queue-command.d.ts +29 -0
  51. package/dist/lib/agent-chat-queue-command.js +75 -0
  52. package/dist/lib/agent-chat-queue.d.ts +77 -0
  53. package/dist/lib/agent-chat-queue.js +245 -0
  54. package/dist/lib/agent-chat-start.d.ts +101 -0
  55. package/dist/lib/agent-chat-start.js +151 -6
  56. package/dist/lib/duties.d.ts +5 -1
  57. package/dist/lib/duties.js +16 -5
  58. package/dist/lib/duty-product.js +6 -0
  59. package/dist/lib/input-queue.d.ts +18 -0
  60. package/dist/lib/input-queue.js +59 -0
  61. package/dist/lib/message-intent.d.ts +26 -3
  62. package/dist/lib/message-intent.js +7 -1
  63. package/dist/lib/task-runtime-headers.d.ts +5 -0
  64. package/dist/lib/task-runtime-headers.js +28 -8
  65. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarness.d.ts +16 -15
  66. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarness.js +0 -22
  67. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarness.d.ts +16 -15
  68. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarness.js +0 -22
  69. package/dist/node_modules/@skrr-ai/data-provider/index.js +11690 -11370
  70. package/oclif.manifest.json +1635 -332
  71. package/package.json +10 -4
@@ -43,9 +43,13 @@ exports.sequenceHalt = sequenceHalt;
43
43
  exports.rejectPrincipalOverrides = rejectPrincipalOverrides;
44
44
  exports.normalizeIntentPayload = normalizeIntentPayload;
45
45
  exports.generateIdempotencyKey = generateIdempotencyKey;
46
+ exports.legacyDmMessageId = legacyDmMessageId;
46
47
  exports.buildEnvelope = buildEnvelope;
47
48
  exports.withAppliedAttention = withAppliedAttention;
48
49
  exports.formatEnvelope = formatEnvelope;
50
+ exports.describeMessageOperation = describeMessageOperation;
51
+ exports.resolveSendOperation = resolveSendOperation;
52
+ exports.sendOperationUnsupported = sendOperationUnsupported;
49
53
  const crypto = __importStar(require("node:crypto"));
50
54
  const core_1 = require("@oclif/core");
51
55
  const data_provider_1 = require("@skrr-ai/data-provider");
@@ -137,6 +141,8 @@ class AgentMessageSend extends base_command_1.BaseCommand {
137
141
  // for all time — a bare `checkpoint:verify` collides on the next run.
138
142
  '<%= config.bin %> agent message send --agent <agent-id> --kind milestone --idempotency-key <task-id>:verify --text "Implementation is complete." --part "Verification is in progress." --json',
139
143
  '<%= config.bin %> agent message send --agent <agent-id> --destination slack_channel --channel C123 --text "Update" --json',
144
+ '<%= config.bin %> agent message send --supersedes <message-id> --text "Correction: the deploy is at 15:00, not 14:00." --json',
145
+ '<%= config.bin %> agent message send --status-key build --text "Build 2 of 3 passed." --json',
140
146
  ];
141
147
  static args = {
142
148
  agent: core_1.Args.string({
@@ -186,6 +192,12 @@ class AgentMessageSend extends base_command_1.BaseCommand {
186
192
  'from-json': core_1.Flags.string({
187
193
  description: 'Path to a canonical intent JSON payload, or "-" for stdin',
188
194
  }),
195
+ supersedes: core_1.Flags.string({
196
+ description: 'The messageId of a message this Agent sent earlier that this one corrects (app_owner_dm, inside an Agent session). The earlier message is shown as replaced.',
197
+ }),
198
+ 'status-key': core_1.Flags.string({
199
+ description: 'A key for a status this Agent keeps current, such as build (app_owner_dm, inside an Agent session). Each send with the same key replaces the previous one.',
200
+ }),
189
201
  'idempotency-key': core_1.Flags.string({
190
202
  description: 'Stable retry key; overrides the key in --from-json, or is auto-derived when neither is supplied',
191
203
  }),
@@ -289,6 +301,29 @@ class AgentMessageSend extends base_command_1.BaseCommand {
289
301
  retryable: false,
290
302
  });
291
303
  }
304
+ const operationChoice = resolveSendOperation({
305
+ supersedes: flags.supersedes,
306
+ statusKey: flags['status-key'],
307
+ jsonOperation: jsonBody.operation,
308
+ });
309
+ if ('error' in operationChoice) {
310
+ this.failWithCliError({
311
+ message: operationChoice.error,
312
+ code: 'INVALID_MESSAGE_OPERATION',
313
+ exit: 1,
314
+ retryable: false,
315
+ });
316
+ }
317
+ const operation = operationChoice.operation;
318
+ if (operation) {
319
+ const unsupported = sendOperationUnsupported({
320
+ destinationKind: payload.destination.kind,
321
+ inSession: Boolean(sessionContext),
322
+ partCount: (flags.part || []).length,
323
+ });
324
+ if (unsupported)
325
+ this.failWithCliError({ ...unsupported, retryable: false });
326
+ }
292
327
  // Manual task context accepts the same titles and references as task
293
328
  // commands. Managed sessions must leave the claim-derived context alone.
294
329
  if (!sessionContext &&
@@ -328,7 +363,7 @@ class AgentMessageSend extends base_command_1.BaseCommand {
328
363
  }
329
364
  throw error;
330
365
  }
331
- const idempotencyKey = payload.idempotencyKey || generateIdempotencyKey(agentId, payload);
366
+ const idempotencyKey = payload.idempotencyKey || generateIdempotencyKey(agentId, payload, operation);
332
367
  const request_ = canonicalIntentFromDestination({
333
368
  agentId,
334
369
  idempotencyKey,
@@ -339,6 +374,7 @@ class AgentMessageSend extends base_command_1.BaseCommand {
339
374
  context: payload.context,
340
375
  threadRootMessageId: payload.threadRootMessageId,
341
376
  embeds,
377
+ operation,
342
378
  });
343
379
  let requests;
344
380
  try {
@@ -490,6 +526,10 @@ class AgentMessageSend extends base_command_1.BaseCommand {
490
526
  notificationPolicy: request.notificationPolicy,
491
527
  embeds: request.embeds,
492
528
  embedRejections: result.embedRejections,
529
+ messageId: typeof result.messageId === 'string' ? result.messageId : undefined,
530
+ operation: request.operation
531
+ ? { ...request.operation, ...(result.operation ? { outcome: result.operation } : {}) }
532
+ : undefined,
493
533
  intent: {
494
534
  id: result.intentId ?? null,
495
535
  status: result.status || 'submitted',
@@ -543,6 +583,7 @@ class AgentMessageSend extends base_command_1.BaseCommand {
543
583
  notificationPolicy: request.notificationPolicy,
544
584
  embeds: request.embeds,
545
585
  embedRejections: result.embedRejections,
586
+ messageId: legacyDmMessageId(result),
546
587
  intent: {
547
588
  id: result.messageId ?? null,
548
589
  status: statusFromLegacyDm(result),
@@ -1080,7 +1121,7 @@ function booleanFlagInput(argv, name, parsedValue) {
1080
1121
  void parsedValue;
1081
1122
  return undefined;
1082
1123
  }
1083
- function canonicalIntentFromDestination({ agentId, idempotencyKey, destination, text, presentation, notificationPolicy, context, threadRootMessageId, embeds, }) {
1124
+ function canonicalIntentFromDestination({ agentId, idempotencyKey, destination, text, presentation, notificationPolicy, context, threadRootMessageId, embeds, operation, }) {
1084
1125
  switch (destination.kind) {
1085
1126
  case 'agent_email':
1086
1127
  return {
@@ -1101,6 +1142,7 @@ function canonicalIntentFromDestination({ agentId, idempotencyKey, destination,
1101
1142
  notificationPolicy,
1102
1143
  threadRootMessageId,
1103
1144
  embeds,
1145
+ operation,
1104
1146
  ...context,
1105
1147
  });
1106
1148
  case 'slack_owner_dm':
@@ -1159,7 +1201,7 @@ function optionalIdempotencyKey(value) {
1159
1201
  }
1160
1202
  return normalized;
1161
1203
  }
1162
- function generateIdempotencyKey(agentId, payload) {
1204
+ function generateIdempotencyKey(agentId, payload, operation) {
1163
1205
  const requestId = optionalString(process.env.OVERSKY_SESSION_REQUEST_ID) ||
1164
1206
  optionalString(process.env.OVERSKY_REQUEST_ID);
1165
1207
  const digest = crypto
@@ -1171,6 +1213,9 @@ function generateIdempotencyKey(agentId, payload) {
1171
1213
  presentation: payload.presentation,
1172
1214
  context: payload.context,
1173
1215
  threadRootMessageId: payload.threadRootMessageId,
1216
+ // The same words correcting another message are another send. Absent for an ordinary
1217
+ // send, so its key is the one it had before C10.
1218
+ ...(operation ? { operation } : {}),
1174
1219
  }))
1175
1220
  .digest('hex')
1176
1221
  .slice(0, 32);
@@ -1195,6 +1240,17 @@ function statusFromLegacyDm(result) {
1195
1240
  return 'failed';
1196
1241
  return 'delivered';
1197
1242
  }
1243
+ /**
1244
+ * The app message a person's owner-DM send became, as the session path names it (`messageId`),
1245
+ * so the text output says `Message id: …` on this path too. Only a send that reached the chat
1246
+ * names one.
1247
+ */
1248
+ function legacyDmMessageId(result) {
1249
+ const status = statusFromLegacyDm(result);
1250
+ if (status !== 'delivered' && status !== 'duplicate')
1251
+ return undefined;
1252
+ return typeof result.messageId === 'string' && result.messageId ? result.messageId : undefined;
1253
+ }
1198
1254
  function buildEnvelope(input) {
1199
1255
  const presentation = input.presentation
1200
1256
  ? withAppliedAttention(input.presentation, input.appliedPresentation)
@@ -1218,6 +1274,8 @@ function buildEnvelope(input) {
1218
1274
  ...(input.embedRejections && input.embedRejections.length > 0
1219
1275
  ? { embedRejections: input.embedRejections }
1220
1276
  : {}),
1277
+ ...(input.messageId ? { messageId: input.messageId } : {}),
1278
+ ...(input.operation ? { operation: input.operation } : {}),
1221
1279
  intent: input.intent,
1222
1280
  };
1223
1281
  }
@@ -1252,7 +1310,93 @@ function formatEnvelope(envelope) {
1252
1310
  : '';
1253
1311
  const consequence = (envelope.intent.reason && REASON_CONSEQUENCE[envelope.intent.reason]) ||
1254
1312
  STATUS_CONSEQUENCE[status];
1255
- return `Agent message intent for ${envelope.agent.id} → ${destination}: ${status}${suffix}.${presentation}${describeOneVoice(envelope.intent.oneVoice)}${consequence ? ` ${consequence}` : ''}${describePersonSender(envelope)}`;
1313
+ return `Agent message intent for ${envelope.agent.id} → ${destination}: ${status}${suffix}.${presentation}${describeOneVoice(envelope.intent.oneVoice)}${consequence ? ` ${consequence}` : ''}${describePersonSender(envelope)}${describeMessageOperation(envelope)}`;
1314
+ }
1315
+ /**
1316
+ * The message id a later correction names, and what this send did to an earlier message (C10).
1317
+ * A send whose mark did not land is said to have gone out WITHOUT replacing anything: the exit
1318
+ * code cannot say it, because the message itself was delivered.
1319
+ */
1320
+ function describeMessageOperation(envelope) {
1321
+ const id = envelope.messageId ? ` Message id: ${envelope.messageId}.` : '';
1322
+ const operation = envelope.operation;
1323
+ const outcome = operation?.outcome;
1324
+ if (!operation || !outcome)
1325
+ return id;
1326
+ if (operation.kind === 'supersede') {
1327
+ return outcome.applied
1328
+ ? `${id} It replaces ${outcome.targetMessageId || operation.targetMessageId}.`
1329
+ : `${id} It was sent, but ${operation.targetMessageId} was not marked as replaced (${outcome.reason || 'unknown'}).`;
1330
+ }
1331
+ if (operation.kind === 'status') {
1332
+ if (outcome.applied && outcome.targetMessageId) {
1333
+ return `${id} It replaces the earlier "${operation.key}" status ${outcome.targetMessageId}.`;
1334
+ }
1335
+ if (outcome.reason === 'first_status')
1336
+ return `${id} It is the first "${operation.key}" status.`;
1337
+ return `${id} It was sent, but the earlier "${operation.key}" status was not replaced (${outcome.reason || 'unknown'}).`;
1338
+ }
1339
+ return id;
1340
+ }
1341
+ /**
1342
+ * The operation a send asks for, from `--supersedes`, `--status-key` or a JSON body's
1343
+ * `operation`. One source only: two that disagree are refused rather than one silently winning.
1344
+ * A retraction is not a send (`agent message retract`).
1345
+ */
1346
+ function resolveSendOperation({ supersedes, statusKey, jsonOperation, }) {
1347
+ const sources = [supersedes !== undefined, statusKey !== undefined, jsonOperation !== undefined];
1348
+ if (sources.filter(Boolean).length > 1) {
1349
+ return {
1350
+ error: 'Give one of --supersedes, --status-key or a JSON operation: a message either corrects another or keeps a status.',
1351
+ };
1352
+ }
1353
+ let raw;
1354
+ if (supersedes !== undefined)
1355
+ raw = { kind: 'supersede', targetMessageId: supersedes };
1356
+ else if (statusKey !== undefined)
1357
+ raw = { kind: 'status', key: statusKey };
1358
+ else if (jsonOperation !== undefined)
1359
+ raw = jsonOperation;
1360
+ else
1361
+ return {};
1362
+ const parsed = (0, data_provider_1.parseMessageOperation)(raw);
1363
+ if (!parsed.ok)
1364
+ return { error: parsed.reason };
1365
+ if (parsed.value.kind === 'retract') {
1366
+ return {
1367
+ error: 'A retraction sends no message. Use `agent message retract <message-id>` to withdraw one.',
1368
+ };
1369
+ }
1370
+ return { operation: parsed.value };
1371
+ }
1372
+ /**
1373
+ * Why a send cannot carry an operation here, or null. Only an Agent's own session can name its
1374
+ * own message (the server proves it through the session), only an owner DM can be named, and a
1375
+ * sequence would leave unclear which part replaces the earlier message.
1376
+ */
1377
+ function sendOperationUnsupported({ destinationKind, inSession, partCount, }) {
1378
+ if (destinationKind !== 'app_owner_dm') {
1379
+ return {
1380
+ message: 'Only a message in the owner’s chat (app_owner_dm) can be corrected or kept as a status.',
1381
+ code: 'MESSAGE_OPERATION_DESTINATION_UNSUPPORTED',
1382
+ exit: 1,
1383
+ };
1384
+ }
1385
+ if (!inSession) {
1386
+ return {
1387
+ message: 'Correcting or keeping a status of an Agent’s message works only inside that Agent’s session: a message you send from your own terminal goes out as you.',
1388
+ code: 'MESSAGE_OPERATION_REQUIRES_SESSION',
1389
+ exit: 2,
1390
+ };
1391
+ }
1392
+ if (partCount > 0) {
1393
+ return {
1394
+ message: '--supersedes and --status-key send one message. Drop --part, or send the correction on its own.',
1395
+ code: 'MESSAGE_OPERATION_SEQUENCE_UNSUPPORTED',
1396
+ exit: 1,
1397
+ };
1398
+ }
1399
+ return null;
1256
1400
  }
1257
1401
  /**
1258
1402
  * A message a PERSON sends at a terminal goes out as that person, not through the agent's session, so the agent's
@@ -283,6 +283,11 @@ export default class AgentsChat extends BaseCommand {
283
283
  jsonl: import("@oclif/core/interfaces").BooleanFlag<boolean>;
284
284
  json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
285
285
  'idempotency-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
286
+ 'wait-for-idle': import("@oclif/core/interfaces").BooleanFlag<boolean>;
287
+ 'wait-timeout': import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
288
+ 'when-busy': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
289
+ detach: import("@oclif/core/interfaces").BooleanFlag<boolean>;
290
+ 'queue-timeout': import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
286
291
  'repair-wait': import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
287
292
  'approve-tools': import("@oclif/core/interfaces").BooleanFlag<boolean>;
288
293
  'permission-mode': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
@@ -309,6 +314,13 @@ export default class AgentsChat extends BaseCommand {
309
314
  * would only move the same error later (OSK-9478).
310
315
  */
311
316
  private resolveLocalSkills;
317
+ /**
318
+ * G7 — the conversation is busy and the caller asked for the turn to be queued (or steered)
319
+ * instead of refused. Returns the coordinates of the turn once it is started, so the caller
320
+ * attaches to it exactly as after a direct start, or `null` when there is nothing to stream (the
321
+ * message joined the running turn, or `--detach`).
322
+ */
323
+ private startThroughQueue;
312
324
  run(): Promise<void>;
313
325
  }
314
326
  export {};