@skrr-ai/cli 0.1.232 → 0.1.233

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 (118) hide show
  1. package/README.md +29 -13
  2. package/bin/dev.cjs +0 -1
  3. package/bin/run.js +0 -15
  4. package/dist/base-command.d.ts +6 -1
  5. package/dist/base-command.js +24 -4
  6. package/dist/commands/agenda/plan.d.ts +2 -1
  7. package/dist/commands/agenda/plan.js +18 -4
  8. package/dist/commands/agents/chat.d.ts +2 -0
  9. package/dist/commands/agents/chat.js +59 -13
  10. package/dist/commands/agents/eval/list.d.ts +4 -0
  11. package/dist/commands/agents/eval/list.js +33 -0
  12. package/dist/commands/agents/permissions/policy.js +25 -2
  13. package/dist/commands/agents/spawn.js +61 -24
  14. package/dist/commands/agents/triggers/fire.js +1 -1
  15. package/dist/commands/agents/triggers/runs.js +3 -0
  16. package/dist/commands/code/jobs/approve.d.ts +1 -11
  17. package/dist/commands/code/jobs/approve.js +3 -15
  18. package/dist/commands/code/jobs/cancel.js +3 -2
  19. package/dist/commands/code/jobs/index.js +1 -1
  20. package/dist/commands/code/jobs/list.js +4 -11
  21. package/dist/commands/code/jobs/run.js +13 -7
  22. package/dist/commands/code/jobs/show.js +51 -6
  23. package/dist/commands/commands.d.ts +1 -0
  24. package/dist/commands/commands.js +5 -1
  25. package/dist/commands/context.d.ts +1 -0
  26. package/dist/commands/context.js +1 -0
  27. package/dist/commands/duties/catalog/add.d.ts +18 -0
  28. package/dist/commands/duties/catalog/add.js +52 -0
  29. package/dist/commands/duties/catalog/index.d.ts +18 -0
  30. package/dist/commands/duties/catalog/index.js +88 -0
  31. package/dist/commands/duties/receipt.js +56 -1
  32. package/dist/commands/goals/planner-compare.js +5 -3
  33. package/dist/commands/instructions/discovery.d.ts +10 -0
  34. package/dist/commands/instructions/discovery.js +74 -0
  35. package/dist/commands/runs/admission.d.ts +12 -0
  36. package/dist/commands/runs/admission.js +66 -0
  37. package/dist/commands/runs/events.d.ts +2 -0
  38. package/dist/commands/runs/events.js +40 -10
  39. package/dist/commands/runs/list.d.ts +7 -1
  40. package/dist/commands/runs/list.js +81 -17
  41. package/dist/commands/runs/show.d.ts +1 -0
  42. package/dist/commands/runs/show.js +225 -15
  43. package/dist/commands/runs/stop.d.ts +1 -0
  44. package/dist/commands/runs/stop.js +34 -7
  45. package/dist/commands/runs/transcript.d.ts +2 -0
  46. package/dist/commands/runs/transcript.js +102 -17
  47. package/dist/commands/tasks/attachments/download.d.ts +1 -0
  48. package/dist/commands/tasks/attachments/download.js +6 -4
  49. package/dist/commands/tasks/attachments/source.d.ts +6 -0
  50. package/dist/commands/tasks/attachments/source.js +18 -0
  51. package/dist/commands/tasks/chat/exchange.d.ts +0 -14
  52. package/dist/commands/tasks/chat/exchange.js +8 -39
  53. package/dist/commands/tasks/chat/reply-run.d.ts +15 -0
  54. package/dist/commands/tasks/chat/reply-run.js +69 -0
  55. package/dist/commands/tasks/complete.js +1 -1
  56. package/dist/commands/tasks/lifecycle/transition.d.ts +1 -0
  57. package/dist/commands/tasks/lifecycle/transition.js +51 -13
  58. package/dist/commands/tasks/operations/show.js +5 -0
  59. package/dist/commands/tasks/result/submit.js +4 -2
  60. package/dist/commands/tasks/retry.js +25 -16
  61. package/dist/commands/triggers/audit.js +3 -1
  62. package/dist/commands/triggers/fire-detail.js +4 -1
  63. package/dist/commands/triggers/fire.js +1 -1
  64. package/dist/commands/usage.d.ts +1 -0
  65. package/dist/commands/usage.js +1 -0
  66. package/dist/generated/agent-guides.json +64 -712
  67. package/dist/help.d.ts +2 -7
  68. package/dist/help.js +13 -7
  69. package/dist/hooks/init.js +10 -0
  70. package/dist/lib/agent-evals.d.ts +1 -1
  71. package/dist/lib/agent-evals.js +13 -3
  72. package/dist/lib/agent-guides.d.ts +3 -5
  73. package/dist/lib/agent-guides.js +12 -13
  74. package/dist/lib/agent-runs.d.ts +69 -9
  75. package/dist/lib/agent-runs.js +208 -35
  76. package/dist/lib/agentic-stream.d.ts +12 -0
  77. package/dist/lib/agentic-stream.js +163 -79
  78. package/dist/lib/api-fetch.d.ts +2 -0
  79. package/dist/lib/api-fetch.js +6 -1
  80. package/dist/lib/command-manifest.d.ts +1 -6
  81. package/dist/lib/command-manifest.js +86 -13
  82. package/dist/lib/config.d.ts +2 -3
  83. package/dist/lib/config.js +2 -3
  84. package/dist/lib/duties.d.ts +5 -1
  85. package/dist/lib/duties.js +4 -0
  86. package/dist/lib/execution-history.d.ts +3 -0
  87. package/dist/lib/format.d.ts +1 -0
  88. package/dist/lib/format.js +18 -0
  89. package/dist/lib/guide-pointer.d.ts +5 -1
  90. package/dist/lib/guide-pointer.js +21 -2
  91. package/dist/lib/hosted-job-status.d.ts +4 -0
  92. package/dist/lib/hosted-job-status.js +19 -0
  93. package/dist/lib/inbound-messages.d.ts +1 -0
  94. package/dist/lib/inbound-messages.js +2 -0
  95. package/dist/lib/roles.d.ts +2 -2
  96. package/dist/lib/schedule.d.ts +4 -0
  97. package/dist/lib/schedule.js +4 -3
  98. package/dist/lib/task-execution.d.ts +1 -1
  99. package/dist/lib/task-execution.js +3 -19
  100. package/dist/lib/task-extras.d.ts +11 -1
  101. package/dist/lib/task-extras.js +15 -1
  102. package/dist/lib/task-transcript.js +3 -8
  103. package/dist/lib/triggers.d.ts +5 -36
  104. package/dist/lib/triggers.js +48 -33
  105. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.js +5 -1
  106. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessCommand.d.ts +37 -0
  107. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessCommand.js +59 -0
  108. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.js +5 -1
  109. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessCommand.d.ts +37 -0
  110. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessCommand.js +57 -0
  111. package/dist/node_modules/@skrr-ai/auth-core/package.json +10 -0
  112. package/dist/node_modules/@skrr-ai/data-provider/index.js +12261 -12172
  113. package/docs/v1/quickstart.md +18 -0
  114. package/oclif.manifest.json +2505 -629
  115. package/package.json +3 -2
  116. package/skills/skrr/SKILL.md +14 -0
  117. package/dist/commands/triggers/runs.d.ts +0 -22
  118. package/dist/commands/triggers/runs.js +0 -58
@@ -5,11 +5,15 @@ export interface AgentGuidePointer {
5
5
  /** `skrr guide <id> <section>` — what the `Guide:` line and `error.guide.command` carry. */
6
6
  command: string;
7
7
  }
8
+ /** Published in command help and JSON schema so agents can read before writing. */
9
+ export declare function agentGuidePointerForCommand(commandId: string): (AgentGuidePointer & {
10
+ readWhen: string;
11
+ }) | null;
8
12
  /**
9
13
  * The pointer for a refusal code: `{id, section, command}`, or `null` when no
10
14
  * section explains it, the error carries no code, or the bundled vocabulary is
11
15
  * unavailable. Never throws.
12
16
  */
13
17
  export declare function agentGuidePointerFor(code: string | null | undefined): AgentGuidePointer | null;
14
- /** The `Guide:` line a refusal's human text ends with. */
18
+ /** The `Guide:` line used by help and refusals. */
15
19
  export declare function agentGuidePointerLine(pointer: AgentGuidePointer): string;
@@ -3,10 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.agentGuidePointerForCommand = agentGuidePointerForCommand;
6
7
  exports.agentGuidePointerFor = agentGuidePointerFor;
7
8
  exports.agentGuidePointerLine = agentGuidePointerLine;
8
9
  /**
9
- * Agent guides — the pointer a refusal carries (OSK-17977).
10
+ * Agent guide pointers for command discovery and refusals.
10
11
  *
11
12
  * The cheapest moment to teach is the moment something goes wrong. A section's
12
13
  * manifest entry declares the refusal codes it `explains`; the server registry
@@ -23,6 +24,24 @@ exports.agentGuidePointerLine = agentGuidePointerLine;
23
24
  const data_provider_1 = require("@skrr-ai/data-provider");
24
25
  const agent_guides_json_1 = __importDefault(require("../generated/agent-guides.json"));
25
26
  const catalog = agent_guides_json_1.default.index?.guides ?? [];
27
+ const commandGuideSections = new Map([
28
+ ['tasks:complete', 'closure'],
29
+ ['tasks:result:submit', 'result-review'],
30
+ ['tasks:review', 'result-review'],
31
+ ['tasks:updates:add', 'updates'],
32
+ ]);
33
+ /** Published in command help and JSON schema so agents can read before writing. */
34
+ function agentGuidePointerForCommand(commandId) {
35
+ const sectionId = commandGuideSections.get(commandId);
36
+ if (!sectionId)
37
+ return null;
38
+ const guide = catalog.find(({ id }) => id === 'tasks');
39
+ const section = guide?.sections.find(({ id }) => id === sectionId);
40
+ if (!guide || !section)
41
+ return null;
42
+ const address = { id: guide.id, section: section.id };
43
+ return { ...address, command: (0, data_provider_1.agentGuideReadCommand)(address, 'cli'), readWhen: section.readWhen };
44
+ }
26
45
  /**
27
46
  * The pointer for a refusal code: `{id, section, command}`, or `null` when no
28
47
  * section explains it, the error carries no code, or the bundled vocabulary is
@@ -45,7 +64,7 @@ function agentGuidePointerFor(code) {
45
64
  return null;
46
65
  }
47
66
  }
48
- /** The `Guide:` line a refusal's human text ends with. */
67
+ /** The `Guide:` line used by help and refusals. */
49
68
  function agentGuidePointerLine(pointer) {
50
69
  return `Guide: ${pointer.command}`;
51
70
  }
@@ -0,0 +1,4 @@
1
+ import type { TCloudCodingTask } from '@skrr-ai/data-provider';
2
+ /** Whether the job is progressing without a new human approval. */
3
+ export declare function isHostedJobInProgress(status: string): boolean;
4
+ export declare function hostedJobDisplayStatus(task?: TCloudCodingTask): string | undefined;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isHostedJobInProgress = isHostedJobInProgress;
4
+ exports.hostedJobDisplayStatus = hostedJobDisplayStatus;
5
+ const IN_PROGRESS = new Set([
6
+ 'queued', 'provisioning', 'cloning', 'running', 'checkpointing', 'pushing', 'pr_opening', 'pr_open',
7
+ ]);
8
+ /** Whether the job is progressing without a new human approval. */
9
+ function isHostedJobInProgress(status) {
10
+ return IN_PROGRESS.has(status);
11
+ }
12
+ function hostedJobDisplayStatus(task) {
13
+ if (task?.status !== 'cancelled' || !task.runId)
14
+ return task?.status;
15
+ const receipt = task.stopReceipt;
16
+ if (receipt?.runId === task.runId)
17
+ return receipt.status;
18
+ return task.cancelRequestedAt && task.jobOnlyCancellation !== true ? 'stop_requested' : task.status;
19
+ }
@@ -98,6 +98,7 @@ export type InboundNext = {
98
98
  sessionId: string;
99
99
  responseMessageId: string;
100
100
  runId?: string;
101
+ runHistoryWorkspaceId?: string | null;
101
102
  } | {
102
103
  kind: 'wait';
103
104
  } | {
@@ -322,6 +322,8 @@ function nextAfterSend(answer) {
322
322
  sessionId: turn.sessionId,
323
323
  responseMessageId: turn.responseMessageId,
324
324
  ...(runId ? { runId } : {}),
325
+ ...(runId && turn.runHistoryWorkspaceId !== undefined
326
+ ? { runHistoryWorkspaceId: turn.runHistoryWorkspaceId } : {}),
325
327
  };
326
328
  }
327
329
  // A merge whose reply row is not known yet is answered by that turn; a new turn that did
@@ -53,7 +53,7 @@ export declare const roleApi: {
53
53
  config?: Record<string, unknown> | undefined;
54
54
  }[];
55
55
  sources: {
56
- source: "space" | "docs" | "tasks" | "memory" | "daemon" | "email" | "goal" | "files" | "local" | "browser" | "metrics" | "monitor" | "github" | "conversations" | "agent_initiatives" | "messages" | "documents" | "slack" | "calendar" | "product_metrics" | "business_metrics" | "state_monitor" | "agent_run" | "chat_execution";
56
+ source: "space" | "docs" | "tasks" | "memory" | "daemon" | "email" | "local" | "goal" | "files" | "browser" | "metrics" | "monitor" | "github" | "conversations" | "agent_initiatives" | "messages" | "documents" | "slack" | "calendar" | "product_metrics" | "business_metrics" | "state_monitor" | "agent_run" | "chat_execution";
57
57
  enabled: boolean;
58
58
  config?: Record<string, unknown> | undefined;
59
59
  }[];
@@ -78,7 +78,7 @@ export declare const roleApi: {
78
78
  }[];
79
79
  contexts: {
80
80
  key: string;
81
- roles: ("home" | "delivery" | "watch" | "advance")[];
81
+ roles: ("delivery" | "home" | "watch" | "advance")[];
82
82
  }[];
83
83
  directive?: string | undefined;
84
84
  subject?: {
@@ -161,6 +161,10 @@ export interface SmartSchedulePlanRequest {
161
161
  code: string;
162
162
  message: string;
163
163
  };
164
+ runReference?: {
165
+ runId: string;
166
+ workspaceId?: string;
167
+ };
164
168
  }
165
169
  /**
166
170
  * The `202` answer to a propose that sent `Prefer: respond-async`: the plan day was
@@ -221,17 +221,18 @@ function describePlanRequest(request, now = new Date()) {
221
221
  if (!request)
222
222
  return null;
223
223
  const kind = request.origin === 'automatic' ? 'automatic planning run' : 'planning request';
224
+ const run = request.runReference ? `\nRun ${request.runReference.runId}` : '';
224
225
  switch (request.state) {
225
226
  case 'running':
226
227
  return (`A plan for ${request.planDate} is being generated (started ${clockTime(request.startedAt)}` +
227
- `${minutesSince(request.startedAt, now)}). Approve, dismiss and regenerate are paused until it finishes.`);
228
+ `${minutesSince(request.startedAt, now)}). Approve, dismiss and regenerate are paused until it finishes.${run}`);
228
229
  case 'unknown':
229
230
  return (`The last ${kind} for ${request.planDate} (started ${clockTime(request.startedAt)}) never reported a result ` +
230
- 'and may have been interrupted. You can plan again; if it was still running, a second draft may appear.');
231
+ `and may have been interrupted. You can plan again; if it was still running, a second draft may appear.${run}`);
231
232
  case 'failed':
232
233
  return (`The last ${kind} for ${request.planDate} failed` +
233
234
  `${request.finishedAt ? ` at ${clockTime(request.finishedAt)}` : ''}: ` +
234
- `${request.failure?.message ?? 'no reason was recorded'}`);
235
+ `${request.failure?.message ?? 'no reason was recorded'}${run}`);
235
236
  default:
236
237
  return null;
237
238
  }
@@ -1,4 +1,5 @@
1
1
  import { type TaskRecord } from './tasks';
2
+ export { formatDurationMs } from './format';
2
3
  /**
3
4
  * Statuses at which an execution is OVER — nothing further will move the task
4
5
  * without new input.
@@ -100,6 +101,5 @@ export declare function dependencyKeys(task: TaskRecord): string[];
100
101
  export declare function blockingDependencies(task: TaskRecord, candidates: TaskRecord[]): TaskRecord[];
101
102
  export declare function formatTaskLine(task: TaskRecord): string;
102
103
  export declare function formatAgeSince(value: string): string;
103
- export declare function formatDurationMs(value: unknown): string;
104
104
  export declare function sleep(ms: number): Promise<void>;
105
105
  export declare function compactSnapshotSignature(snapshot: TaskSnapshot): string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.STARTABLE_STATUSES = exports.DEFAULT_FAIL_STATUSES_FLAG = exports.DEFAULT_FAIL_STATUSES = exports.TERMINAL_STATUSES = void 0;
3
+ exports.STARTABLE_STATUSES = exports.DEFAULT_FAIL_STATUSES_FLAG = exports.DEFAULT_FAIL_STATUSES = exports.TERMINAL_STATUSES = exports.formatDurationMs = void 0;
4
4
  exports.statusOf = statusOf;
5
5
  exports.isTerminalTask = isTerminalTask;
6
6
  exports.satisfiesWaitTarget = satisfiesWaitTarget;
@@ -22,12 +22,13 @@ exports.dependencyKeys = dependencyKeys;
22
22
  exports.blockingDependencies = blockingDependencies;
23
23
  exports.formatTaskLine = formatTaskLine;
24
24
  exports.formatAgeSince = formatAgeSince;
25
- exports.formatDurationMs = formatDurationMs;
26
25
  exports.sleep = sleep;
27
26
  exports.compactSnapshotSignature = compactSnapshotSignature;
28
27
  const data_provider_1 = require("@skrr-ai/data-provider");
29
28
  const tasks_1 = require("./tasks");
30
29
  const html_text_1 = require("./html-text");
30
+ var format_1 = require("./format");
31
+ Object.defineProperty(exports, "formatDurationMs", { enumerable: true, get: function () { return format_1.formatDurationMs; } });
31
32
  const IS_RECOVERED_EXECUTION_TASK_RE = /\b(stuck|timeout|timed out|reaped|reset|lost|expired|usage|quota|rate limit|token)\b/i;
32
33
  const RECOVERY_REASON_RE = /stuck|reaped|reset/i;
33
34
  const RECOVERY_REASON_RE_2 = /usage|quota|rate limit|token/i;
@@ -297,23 +298,6 @@ function formatAgeSince(value) {
297
298
  return `${hours}h${minutes % 60 ? `${minutes % 60}m` : ''}`;
298
299
  return `${Math.floor(hours / 24)}d`;
299
300
  }
300
- function formatDurationMs(value) {
301
- const ms = Number(value);
302
- if (!Number.isFinite(ms) || ms < 0)
303
- return '-';
304
- if (ms < 1000)
305
- return `${Math.floor(ms)}ms`;
306
- const seconds = Math.floor(ms / 1000);
307
- if (seconds < 60)
308
- return `${seconds}s`;
309
- const minutes = Math.floor(seconds / 60);
310
- if (minutes < 60)
311
- return `${minutes}m${seconds % 60 ? `${seconds % 60}s` : ''}`;
312
- const hours = Math.floor(minutes / 60);
313
- if (hours < 48)
314
- return `${hours}h${minutes % 60 ? `${minutes % 60}m` : ''}`;
315
- return `${Math.floor(hours / 24)}d`;
316
- }
317
301
  function sleep(ms) {
318
302
  return new Promise((resolve) => setTimeout(resolve, ms));
319
303
  }
@@ -1,7 +1,17 @@
1
1
  import type { TaskResultRecord } from '@skrr-ai/data-provider';
2
2
  import { withQuery } from './triggers';
3
+ import { type ApiFetchOptions } from './api-fetch';
3
4
  type Query = Parameters<typeof withQuery>[1];
4
5
  type Json = Record<string, unknown>;
6
+ type TaskReadScope = Pick<ApiFetchOptions, 'workspaceScope'>;
7
+ export declare function readTaskAttachmentSource(taskId: string, attachmentId: string): Promise<Uint8Array>;
8
+ export declare function listPersonalTaskTitleCandidates(params: {
9
+ q: string;
10
+ limit: number;
11
+ }): Promise<{
12
+ data?: Json[];
13
+ has_more?: boolean;
14
+ }>;
5
15
  export declare const taskWorkflowApi: {
6
16
  get: (id: string) => Promise<Json>;
7
17
  start: (id: string) => Promise<Json>;
@@ -108,6 +118,7 @@ export interface ExecutionTargetRef {
108
118
  */
109
119
  export declare function parseExecutionTargetRef(value: string): ExecutionTargetRef;
110
120
  export declare const taskChatApi: {
121
+ replyRun: (id: string, conversationId: string, messageId: string, scope?: TaskReadScope) => Promise<Json>;
111
122
  transcriptSources: (id: string, query?: Query) => Promise<Json>;
112
123
  reindexTranscript: (id: string) => Promise<Json>;
113
124
  chat: (id: string, query?: Query) => Promise<Json>;
@@ -122,7 +133,6 @@ export declare const taskChatApi: {
122
133
  sendExchangeMessage: (id: string, body: Json) => Promise<Json>;
123
134
  closeInput: (id: string, exchangeId: string, body?: Json) => Promise<Json>;
124
135
  cancelExchange: (id: string, exchangeId: string, body?: Json) => Promise<Json>;
125
- interruptExchange: (id: string, exchangeId: string, body?: Json) => Promise<Json>;
126
136
  reopen: (id: string, body?: Json) => Promise<Json>;
127
137
  /**
128
138
  * Re-derive the task's attention projection. A repair verb, not a routine one:
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.taskChatApi = exports.taskSelfScheduleApi = exports.taskLookupApi = exports.taskWorkflowApi = void 0;
4
+ exports.readTaskAttachmentSource = readTaskAttachmentSource;
5
+ exports.listPersonalTaskTitleCandidates = listPersonalTaskTitleCandidates;
4
6
  exports.taskCompletePath = taskCompletePath;
5
7
  exports.taskRunHandover = taskRunHandover;
6
8
  exports.taskRunFork = taskRunFork;
@@ -30,6 +32,18 @@ const PARSE_EXECUTION_TARGET_REF_RE = /^hosted-machine:(.+)$/;
30
32
  const PARSE_EXECUTION_TARGET_REF_RE_2 = /^harness:(.+)$/;
31
33
  const MOUNT = '/api/tasks';
32
34
  const base = (id) => `${MOUNT}/${encodeURIComponent(id)}`;
35
+ function readTaskAttachmentSource(taskId, attachmentId) {
36
+ return (0, api_fetch_1.apiFetch)(`${base(taskId)}/attachments/${encodeURIComponent(attachmentId)}/source`, {
37
+ responseAs: 'bytes',
38
+ singleAttempt: true,
39
+ });
40
+ }
41
+ async function listPersonalTaskTitleCandidates(params) {
42
+ const page = await (0, api_fetch_1.apiFetch)((0, triggers_1.withQuery)(MOUNT, params), { workspaceScope: 'personal' });
43
+ if (!Array.isArray(page?.data))
44
+ return page;
45
+ return { ...page, data: page.data.filter((task) => task && task.workspaceId == null) };
46
+ }
33
47
  exports.taskWorkflowApi = {
34
48
  get: (id) => data_provider_1.request.get(`${base(id)}/workflow`),
35
49
  start: (id) => data_provider_1.request.post(`${base(id)}/workflow/start`, {}),
@@ -162,6 +176,7 @@ function parseExecutionTargetRef(value) {
162
176
  return { kind: 'harness', ref: harness ? harness[1] : trimmed };
163
177
  }
164
178
  exports.taskChatApi = {
179
+ replyRun: (id, conversationId, messageId, scope) => (0, api_fetch_1.apiFetch)((0, triggers_1.withQuery)(`${base(id)}/response-run-reference`, { conversationId, messageId }), scope),
165
180
  transcriptSources: (id, query = {}) => data_provider_1.request.get((0, triggers_1.withQuery)(`${base(id)}/transcript/sources`, query)),
166
181
  reindexTranscript: (id) => data_provider_1.request.post(`${base(id)}/transcript/reindex`, {}),
167
182
  chat: (id, query = {}) => data_provider_1.request.get((0, triggers_1.withQuery)(`${base(id)}/chat`, query)),
@@ -176,7 +191,6 @@ exports.taskChatApi = {
176
191
  sendExchangeMessage: (id, body) => data_provider_1.request.post(`${base(id)}/exchanges/messages`, body),
177
192
  closeInput: (id, exchangeId, body = {}) => data_provider_1.request.post(`${base(id)}/exchanges/${encodeURIComponent(exchangeId)}/close-input`, body),
178
193
  cancelExchange: (id, exchangeId, body = {}) => data_provider_1.request.post(`${base(id)}/exchanges/${encodeURIComponent(exchangeId)}/cancel`, body),
179
- interruptExchange: (id, exchangeId, body = {}) => data_provider_1.request.post(`${base(id)}/exchanges/${encodeURIComponent(exchangeId)}/interrupt`, body),
180
194
  // human-input lives in `skrr tasks input show|answer|dismiss`, which reaches it
181
195
  // through dataService. Deliberately not duplicated here.
182
196
  reopen: (id, body = {}) => data_provider_1.request.post(`${base(id)}/reopen`, body),
@@ -162,15 +162,10 @@ function lastAssistantMessage(messages) {
162
162
  /** Most recent run row, or null when the task never executed. */
163
163
  async function fetchLatestRun(taskId) {
164
164
  const response = (await data_provider_1.dataService.getTaskRuns(taskId));
165
- const runs = response?.data ?? [];
166
- if (runs.length === 0)
165
+ // The API orders the list by admission even when some Runs have no Start.
166
+ const newest = response?.data?.[0];
167
+ if (!newest)
167
168
  return null;
168
- // getTaskRuns is newest-first; fall back to a startedAt scan if that changes.
169
- const newest = runs.reduce((best, run) => {
170
- const a = Date.parse(String(run.startedAt ?? '')) || 0;
171
- const b = Date.parse(String(best.startedAt ?? '')) || 0;
172
- return a > b ? run : best;
173
- }, runs[0]);
174
169
  return {
175
170
  runId: String(newest.runId ?? newest.id ?? newest._id ?? '-'),
176
171
  status: String(newest.status ?? newest.outcome ?? '-'),
@@ -1,4 +1,4 @@
1
- import { type EmbeddedActionRef, type FireRunClaimRefusal, type TriggerIntentUnsupportedItem, type TriggerPreflightReport, type TriggerSensorConfig } from '@skrr-ai/data-provider';
1
+ import { type EmbeddedActionRef, type FireRunClaimRefusal, type TriggerFireDetailResponse, type TriggerIntentUnsupportedItem, type TriggerPreflightReport, type TriggerSensorConfig } from '@skrr-ai/data-provider';
2
2
  export declare const TRIGGER_KINDS: readonly ["schedule", "once", "event", "stochastic", "self_scheduled", "on_demand", "form", "chat_message"];
3
3
  /**
4
4
  * The scope kinds the trigger endpoints accept. NOT a list of its own: `@skrr-ai/data-provider` owns it
@@ -318,32 +318,6 @@ export interface TriggerEventCatalogResponse {
318
318
  }
319
319
  /** Whether the live server declares this exact event reference. */
320
320
  export declare function serverEventCatalogIncludes(catalog: TriggerEventCatalogResponse | undefined, entityType: string | undefined, eventType: string | undefined): boolean;
321
- /**
322
- * Legacy per-agent run record — backed by the `AgentTriggerRun` collection,
323
- * which pre-dates the universal `TriggerFireRecord` audit table. Surfaced
324
- * by the `triggers runs` command for back-compat debugging of rows that
325
- * existed before the universal engine cutover.
326
- */
327
- export interface LegacyTriggerRun {
328
- id?: string;
329
- triggerId?: string;
330
- agentId?: string;
331
- source?: string;
332
- status?: string;
333
- triggeredAt?: string;
334
- completedAt?: string;
335
- durationMs?: number;
336
- failureReason?: string;
337
- skipReason?: string;
338
- conversationId?: string;
339
- messageId?: string;
340
- }
341
- export interface LegacyRunsPage {
342
- data: LegacyTriggerRun[];
343
- has_more?: boolean;
344
- next_cursor?: string | null;
345
- object?: string;
346
- }
347
321
  export interface GcsPresetResponse {
348
322
  triggers: TriggerDefinition[];
349
323
  preset: {
@@ -545,13 +519,15 @@ export declare function fireWasAccepted(result: Record<string, unknown>): boolea
545
519
  * accepts.
546
520
  */
547
521
  export declare function describeStrictFireRefusal(result: Record<string, unknown>): string;
522
+ type FireAgentRun = NonNullable<TriggerFireDetailResponse['agentRun']>;
523
+ export declare function fireRunHistoryCommand(value: unknown, bin: string): string | undefined;
548
524
  /**
549
525
  * The lines a fire or replay owes beyond `outcome=… reason=…` (OSK-15494): the sentence the
550
526
  * server wrote ("Replayed fire … resolved a step that was not waiting when that fire ran:
551
527
  * run …, step …"), or, for a debounced fire, when a retry will be accepted. Empty when the server
552
528
  * reported nothing more.
553
529
  */
554
- export declare function describeFireDetail(result: Record<string, unknown>): string[];
530
+ export declare function describeFireDetail(result: Record<string, unknown>, bin?: string): string[];
555
531
  /**
556
532
  * A projected fire as the trigger's own clock reads it. The header said `America/New_York` over
557
533
  * values that were UTC instants, so nothing on the line was in the zone it named (OSK-15407). The
@@ -806,7 +782,6 @@ export declare function builtinActionLine(trigger: TriggerDefinition): string |
806
782
  export declare function renderTriggerSummary(trigger: TriggerDefinition, log: (line: string) => void, options?: {
807
783
  baseURL?: string;
808
784
  }): void;
809
- export declare function renderLegacyRuns(runs: LegacyTriggerRun[], log: (line: string) => void): void;
810
785
  /**
811
786
  * The window lines `triggers show` prints (OSK-22529): each enabled window with its zone, then what it does
812
787
  * to the next occurrences, in the server's reading. Empty for a trigger with no window, or when the server
@@ -957,15 +932,9 @@ export declare const triggerApi: {
957
932
  */
958
933
  fireDetail: (triggerId: string, fireId: string) => Promise<TriggerFireRecord & {
959
934
  conversation?: unknown;
935
+ agentRun?: FireAgentRun;
960
936
  }>;
961
937
  replayFire: (triggerId: string, fireId: string, body: Record<string, unknown>) => Promise<Record<string, unknown>>;
962
- /**
963
- * Legacy per-agent runs feed. Reads from the legacy `/api/agents/:agentId/
964
- * triggers/:triggerId/runs` route, which queries the `AgentTriggerRun`
965
- * collection. Surfaced for back-compat debugging only; the universal audit
966
- * (`/api/triggers/:id/audit`) is the source of truth going forward.
967
- */
968
- legacyRuns: (agentId: string, triggerId: string, params: Record<string, unknown>) => Promise<LegacyRunsPage>;
969
938
  /**
970
939
  * Remaining trigger budget for a scope, without attempting a write. The
971
940
  * companion to `prune` — see `TriggerQuotaStatus`.
@@ -34,6 +34,7 @@ exports.settleFireAnswer = settleFireAnswer;
34
34
  exports.fireFollowCommand = fireFollowCommand;
35
35
  exports.fireWasAccepted = fireWasAccepted;
36
36
  exports.describeStrictFireRefusal = describeStrictFireRefusal;
37
+ exports.fireRunHistoryCommand = fireRunHistoryCommand;
37
38
  exports.describeFireDetail = describeFireDetail;
38
39
  exports.formatFireInZone = formatFireInZone;
39
40
  exports.nextFireLines = nextFireLines;
@@ -65,7 +66,6 @@ exports.debounceSummaryLine = debounceSummaryLine;
65
66
  exports.scheduleSummaryLine = scheduleSummaryLine;
66
67
  exports.builtinActionLine = builtinActionLine;
67
68
  exports.renderTriggerSummary = renderTriggerSummary;
68
- exports.renderLegacyRuns = renderLegacyRuns;
69
69
  exports.windowVerdictLines = windowVerdictLines;
70
70
  exports.lastResultLabel = lastResultLabel;
71
71
  exports.clockSkipAuditExplanation = clockSkipAuditExplanation;
@@ -77,12 +77,17 @@ exports.fireReasonText = fireReasonText;
77
77
  exports.unverifiedReplayExplanation = unverifiedReplayExplanation;
78
78
  exports.renderFireAudit = renderFireAudit;
79
79
  exports.describeTriggerBudget = describeTriggerBudget;
80
+ const auth_core_1 = require("@skrr-ai/auth-core");
80
81
  const data_provider_1 = require("@skrr-ai/data-provider");
81
82
  const node_fs_1 = require("node:fs");
83
+ const agent_runs_1 = require("./agent-runs");
82
84
  const http_error_1 = require("./http-error");
85
+ const keychain_1 = require("./keychain");
83
86
  const format_1 = require("./format");
84
87
  const planOutcome_1 = require("./planOutcome");
85
88
  const failedRunCause_1 = require("./failedRunCause");
89
+ const shell_quote_1 = require("./shell-quote");
90
+ const workspace_header_1 = require("./workspace-header");
86
91
  const LAST_RESULT_LABEL_RE = /^(outside_working_hours|inside_quiet_hours)(?::\1)?$/;
87
92
  const PARSE_JSON_ARRAY_RE = /^[[{]/;
88
93
  const ARMED_STATE_LABEL_RE = /^skipped:(.+)$/;
@@ -997,8 +1002,17 @@ async function settleFireAnswer(options) {
997
1002
  }
998
1003
  /** The command that reads a fire later, for a fire still running when the CLI stopped waiting. */
999
1004
  function fireFollowCommand(bin, agentId, triggerId, occurrenceId) {
1000
- const target = agentId ? `agents triggers runs ${agentId} ${triggerId}` : `triggers runs ${triggerId}`;
1001
- return `${bin} ${target}${occurrenceId ? ` --fire ${occurrenceId}` : ''}`;
1005
+ const workspaceId = (0, workspace_header_1.withWorkspaceHeader)({})['X-Workspace-Id'];
1006
+ const scope = [
1007
+ ...(workspaceId ? ['--workspace', workspaceId] : []),
1008
+ ...(0, auth_core_1.explicitProfileArgs)((0, keychain_1.profileForChildProcess)()),
1009
+ ];
1010
+ if (agentId) {
1011
+ const fire = occurrenceId ? ['--fire', occurrenceId] : [];
1012
+ return (0, shell_quote_1.shellQuoteArgv)([bin, 'agents', 'triggers', 'runs', agentId, triggerId, ...fire, ...scope]);
1013
+ }
1014
+ const target = occurrenceId ? ['fire-detail', triggerId, occurrenceId] : ['audit', triggerId];
1015
+ return (0, shell_quote_1.shellQuoteArgv)([bin, 'triggers', ...target, ...scope]);
1002
1016
  }
1003
1017
  /**
1004
1018
  * Was the fire admitted? `in_progress` and `awaiting_runtime` are admissions whose terminal arrives
@@ -1031,14 +1045,39 @@ function describeStrictFireRefusal(result) {
1031
1045
  `${sentence ? `: ${sentence}` : '.'} ` +
1032
1046
  `--strict accepts only ${data_provider_1.ACCEPTED_AGENT_TRIGGER_FIRE_OUTCOMES.join(', ')}, or a repeat of one.`);
1033
1047
  }
1048
+ function readFireAgentRun(value) {
1049
+ if (!value || typeof value !== 'object')
1050
+ return undefined;
1051
+ const candidate = value;
1052
+ const id = (0, agent_runs_1.canonicalRunId)(candidate.id);
1053
+ if (!id || typeof candidate.agentId !== 'string' || !candidate.agentId.trim())
1054
+ return undefined;
1055
+ const { agentId, workspaceId } = candidate;
1056
+ if (workspaceId !== undefined &&
1057
+ (typeof workspaceId !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(workspaceId)))
1058
+ return undefined;
1059
+ return { id, agentId, ...(workspaceId !== undefined ? { workspaceId } : {}) };
1060
+ }
1061
+ function fireRunHistoryCommand(value, bin) {
1062
+ const run = readFireAgentRun(value);
1063
+ if (!run)
1064
+ return undefined;
1065
+ const scope = run.workspaceId ? ['--workspace', run.workspaceId] : [];
1066
+ return (0, shell_quote_1.shellQuoteArgv)([
1067
+ bin, 'runs', 'show', run.id, ...scope, ...(0, auth_core_1.explicitProfileArgs)((0, keychain_1.profileForChildProcess)()),
1068
+ ]);
1069
+ }
1034
1070
  /**
1035
1071
  * The lines a fire or replay owes beyond `outcome=… reason=…` (OSK-15494): the sentence the
1036
1072
  * server wrote ("Replayed fire … resolved a step that was not waiting when that fire ran:
1037
1073
  * run …, step …"), or, for a debounced fire, when a retry will be accepted. Empty when the server
1038
1074
  * reported nothing more.
1039
1075
  */
1040
- function describeFireDetail(result) {
1076
+ function describeFireDetail(result, bin) {
1041
1077
  const lines = [];
1078
+ const runCommand = bin && fireRunHistoryCommand(result.agentRun, bin);
1079
+ if (runCommand)
1080
+ lines.push(`Run History: ${runCommand}`);
1042
1081
  if (typeof result.detail === 'string' && result.detail.trim())
1043
1082
  lines.push(result.detail.trim());
1044
1083
  else if (typeof result.retryAt === 'string' && result.retryAt) {
@@ -1933,27 +1972,6 @@ function renderTriggerSummary(trigger, log, options = {}) {
1933
1972
  log(`Webhook URL: POST ${webhookIngestUrl(options.baseURL, trigger.id)}`);
1934
1973
  }
1935
1974
  }
1936
- function renderLegacyRuns(runs, log) {
1937
- if (runs.length === 0) {
1938
- log('No legacy runs.');
1939
- return;
1940
- }
1941
- (0, format_1.renderTable)(runs.map((run) => ({
1942
- triggered: run.triggeredAt ?? '-',
1943
- status: run.status ?? '-',
1944
- source: run.source ?? '-',
1945
- duration: run.durationMs === undefined ? '-' : `${run.durationMs}ms`,
1946
- reason: run.failureReason ?? run.skipReason ?? '',
1947
- conversation: run.conversationId ?? '',
1948
- })), [
1949
- { key: 'triggered', header: 'TRIGGERED AT', maxWidth: 24 },
1950
- { key: 'status', header: 'STATUS', maxWidth: 12 },
1951
- { key: 'source', header: 'SOURCE', maxWidth: 14 },
1952
- { key: 'duration', header: 'DURATION', maxWidth: 10 },
1953
- { key: 'reason', header: 'REASON', maxWidth: 32 },
1954
- { key: 'conversation', header: 'CONVO', maxWidth: 24 },
1955
- ], log);
1956
- }
1957
1975
  /**
1958
1976
  * What a window-skipped fire's record says about the window, as one clause, or null when the record
1959
1977
  * kept none (it predates the field, or the platform scheduler recorded the skip).
@@ -2309,16 +2327,13 @@ exports.triggerApi = {
2309
2327
  */
2310
2328
  fireDetail: async (triggerId, fireId) => {
2311
2329
  const response = (await data_provider_1.request.get(`/api/triggers/${encodeURIComponent(triggerId)}/fires/${encodeURIComponent(fireId)}`));
2312
- return response.fire ?? response;
2330
+ const record = { ...(response.fire ?? response) };
2331
+ // Evidence from the verified API envelope. The Fire record can carry unrelated product IDs.
2332
+ delete record.agentRun;
2333
+ const agentRun = response.fire && readFireAgentRun(response.agentRun);
2334
+ return agentRun ? { ...record, agentRun } : record;
2313
2335
  },
2314
2336
  replayFire: (triggerId, fireId, body) => data_provider_1.request.post(`/api/triggers/${encodeURIComponent(triggerId)}/fires/${encodeURIComponent(fireId)}/replay`, body),
2315
- /**
2316
- * Legacy per-agent runs feed. Reads from the legacy `/api/agents/:agentId/
2317
- * triggers/:triggerId/runs` route, which queries the `AgentTriggerRun`
2318
- * collection. Surfaced for back-compat debugging only; the universal audit
2319
- * (`/api/triggers/:id/audit`) is the source of truth going forward.
2320
- */
2321
- legacyRuns: (agentId, triggerId, params) => data_provider_1.request.get(withQuery(`/api/agents/${encodeURIComponent(agentId)}/triggers/${encodeURIComponent(triggerId)}/runs`, params)),
2322
2337
  /**
2323
2338
  * Remaining trigger budget for a scope, without attempting a write. The
2324
2339
  * companion to `prune` — see `TriggerQuotaStatus`.
@@ -126,7 +126,7 @@ const RPC_ENVELOPE = [
126
126
  delivery: "acked",
127
127
  answeredBy: "rpc:response"
128
128
  }),
129
- entry("rpc:response", "bidirectional", "The answer to `rpc:request`, `{id, ok, result | error}`."),
129
+ entry("rpc:response", "bidirectional", "The answer to `rpc:request`, `{id, ok, result | error}`. A bound local proposal may send progress with `progress: true` before its final answer."),
130
130
  toServer("rpc:cancel", "Abandon an in-flight `rpc:request` by id.", {
131
131
  dormant: "The API handles it (`websocket/rpc.js`); no daemon sends it, and a daemon-side call is bounded by its own timeout instead."
132
132
  })
@@ -200,6 +200,10 @@ const RPC_METHODS = [
200
200
  capability: CANONICAL_DAEMON_ATTEMPT_CAPABILITY
201
201
  }),
202
202
  toDaemon("daemon.session.stop", "Stop one daemon session.", { delivery: "acked", carriers: RPC }),
203
+ toDaemon("daemon.inference.stopProposal", "Stop the exact bounded, no-tool proposal Attempt; acknowledgement is separate from its native terminal evidence.", {
204
+ delivery: "acked",
205
+ carriers: RPC
206
+ }),
203
207
  toDaemon("daemon.session.spawn", "Start a daemon session under the daemon-session registry.", {
204
208
  delivery: "acked",
205
209
  carriers: RPC
@@ -0,0 +1,37 @@
1
+ /**
2
+ * A slash command the person typed, carried to the harness as itself (OSK-33999).
3
+ *
4
+ * A daemon turn's prompt is never the person's words alone. The server puts its lookback facts
5
+ * and the owner communication block in front of them, and the daemon puts the turn's `## This
6
+ * Turn` context in front of that. Codex reads a command only from a message that starts with `/`
7
+ * and has no line break, and Claude Code only from a message that is the command, so no command a
8
+ * person typed in the app (`/compact`, `/review`, `/goal …`) ever ran as one: each reached the
9
+ * model as text.
10
+ *
11
+ * So the server sends the command beside the prompt, as `harnessCommand`, read from the person's
12
+ * own words before any context was added, and only to a daemon announcing
13
+ * `HARNESS_COMMAND_CAPABILITY`. That daemon hands the harness the command text alone, with no
14
+ * context in front of it, so the harness's own command parser sees exactly what was typed. Which
15
+ * commands exist is the harness's business; this module only carries one.
16
+ *
17
+ * Shared by the API (which writes the field and re-reads it at dispatch) and the daemon (which
18
+ * reads it), so both read the same shape.
19
+ */
20
+ /** A daemon that announces this reads `harnessCommand` on a session request and runs it. */
21
+ export declare const HARNESS_COMMAND_CAPABILITY = "session_harness_command_v1";
22
+ /** The longest command text carried: a `/goal` objective is the long one (4,000 characters). */
23
+ export declare const HARNESS_COMMAND_MAX_CHARS = 4200;
24
+ export interface HarnessCommandV1 {
25
+ version: 1;
26
+ /** The command's name, without the `/`. */
27
+ name: string;
28
+ /** What the person typed, trimmed: `/` + name, then any arguments. */
29
+ text: string;
30
+ }
31
+ /**
32
+ * A strict read of the wire field. Anything it does not understand is no command at all, and the
33
+ * turn then runs as an ordinary message: that is what it did before this field existed.
34
+ */
35
+ export declare function readHarnessCommand(value: unknown): HarnessCommandV1 | null;
36
+ /** The command's arguments: what follows the name, trimmed. Empty when there are none. */
37
+ export declare function harnessCommandArgs(command: Pick<HarnessCommandV1, 'name' | 'text'>): string;