@skrr-ai/cli 0.1.201 → 0.1.204

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 (67) hide show
  1. package/dist/base-command.js +1 -1
  2. package/dist/commands/agent/message/context.d.ts +3 -0
  3. package/dist/commands/agent/message/context.js +33 -1
  4. package/dist/commands/agent/message/no-reply.d.ts +17 -0
  5. package/dist/commands/agent/message/no-reply.js +54 -0
  6. package/dist/commands/agent/message/retract.d.ts +24 -0
  7. package/dist/commands/agent/message/retract.js +167 -0
  8. package/dist/commands/agent/message/send.d.ts +47 -3
  9. package/dist/commands/agent/message/send.js +135 -4
  10. package/dist/commands/agents/chat.d.ts +12 -0
  11. package/dist/commands/agents/chat.js +258 -25
  12. package/dist/commands/agents/manager/status.d.ts +9 -0
  13. package/dist/commands/agents/manager/status.js +84 -0
  14. package/dist/commands/agents/queue/clear.d.ts +13 -0
  15. package/dist/commands/agents/queue/clear.js +31 -0
  16. package/dist/commands/agents/queue/list.d.ts +10 -0
  17. package/dist/commands/agents/queue/list.js +34 -0
  18. package/dist/commands/agents/queue/move.d.ts +16 -0
  19. package/dist/commands/agents/queue/move.js +33 -0
  20. package/dist/commands/agents/queue/pause.d.ts +7 -0
  21. package/dist/commands/agents/queue/pause.js +24 -0
  22. package/dist/commands/agents/queue/resume.d.ts +7 -0
  23. package/dist/commands/agents/queue/resume.js +24 -0
  24. package/dist/commands/agents/queue/steer.d.ts +14 -0
  25. package/dist/commands/agents/queue/steer.js +38 -0
  26. package/dist/commands/agents/queue/withdraw.d.ts +10 -0
  27. package/dist/commands/agents/queue/withdraw.js +27 -0
  28. package/dist/commands/agents/supervision.d.ts +1 -0
  29. package/dist/commands/agents/supervision.js +28 -9
  30. package/dist/commands/duties/advance-next.d.ts +17 -0
  31. package/dist/commands/duties/advance-next.js +122 -0
  32. package/dist/commands/duties/create.js +22 -3
  33. package/dist/commands/duties/pack/plan.js +45 -0
  34. package/dist/commands/duties/preflight.d.ts +1 -0
  35. package/dist/commands/duties/preflight.js +18 -2
  36. package/dist/commands/spaces/auto-executor/preview.js +6 -2
  37. package/dist/commands/spaces/charter/revise.d.ts +16 -0
  38. package/dist/commands/spaces/charter/revise.js +84 -0
  39. package/dist/commands/spaces/skills/propose.d.ts +1 -0
  40. package/dist/commands/spaces/skills/propose.js +5 -0
  41. package/dist/commands/tasks/create.js +16 -1
  42. package/dist/commands/tasks/result/show.d.ts +1 -0
  43. package/dist/commands/tasks/result/show.js +22 -1
  44. package/dist/commands/tasks/start.d.ts +3 -0
  45. package/dist/commands/tasks/start.js +12 -1
  46. package/dist/commands/triggers/capabilities.js +24 -5
  47. package/dist/commands/triggers/create.d.ts +1 -1
  48. package/dist/commands/triggers/create.js +15 -6
  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 +7 -0
  64. package/dist/lib/task-runtime-headers.js +46 -9
  65. package/dist/node_modules/@skrr-ai/data-provider/index.js +10464 -10221
  66. package/oclif.manifest.json +1288 -87
  67. package/package.json +6 -3
@@ -18,7 +18,7 @@ import { type DutyAuthoringSnapshot, type DutyAuthoringWarning, type DutyObserva
18
18
  * "hold this state", derived from a Compass invariant — not authored here).
19
19
  */
20
20
  import { DUTY_WATCHED_SOURCES, DUTY_TEMPLATE_IDS, DUTY_CADENCE_MODES, DUTY_CADENCE_TIME_PATTERN, DUTY_CADENCE_MAX_TIMES, DUTY_EXECUTION_ISOLATION_MODES, DUTY_STATUSES, DUTY_KIND_VALUES } from '@skrr-ai/data-provider';
21
- import type { DutyCheck, DutyChecksResponse, Duty, DutyRevisionReceipt, DutyUpdateResponse, DutyActionProposal, DutyListResponse, DutyPlanResponse, DutyScheduleIssue, DutyStatusResponse, DutyWorkLink, DutyExecutionReceiptListResponse, DutyExecutionReceiptQuarterlyMetricsResponse, DutyCapabilitySource, DutyDeliveryPatchResponse, DutyDeliveryBundleResponse, DutyCycle, DutyCyclesResponse, DutyExplanationResponse, DutyRunPermissions, DutyLoopStatus, DutyRoster } from '@skrr-ai/data-provider';
21
+ import type { DutyCheck, DutyCheckAdvance, DutyCheckAdvanceRequest, DutyChecksResponse, Duty, DutyRevisionReceipt, DutyUpdateResponse, DutyActionProposal, DutyListResponse, DutyPlanResponse, DutyScheduleIssue, DutyStatusResponse, DutyWorkLink, DutyExecutionReceiptListResponse, DutyExecutionReceiptQuarterlyMetricsResponse, DutyCapabilitySource, DutyDeliveryPatchResponse, DutyDeliveryBundleResponse, DutyCycle, DutyCyclesResponse, DutyExplanationResponse, DutyRunPermissions, DutyLoopStatus, DutyRoster } from '@skrr-ai/data-provider';
22
22
  import { withQuery } from './triggers';
23
23
  export { DUTY_WATCHED_SOURCES, DUTY_TEMPLATE_IDS, DUTY_CADENCE_MODES, DUTY_CADENCE_TIME_PATTERN, DUTY_CADENCE_MAX_TIMES, DUTY_STATUSES, DUTY_KIND_VALUES, };
24
24
  export type { DutyCheck, DutyChecksResponse, Duty, DutyActionProposal, DutyListResponse, DutyPlanResponse, DutyStatusResponse, DutyWorkLink, };
@@ -89,6 +89,7 @@ export type DutyPreflightReport = {
89
89
  } & Record<string, unknown>;
90
90
  }>;
91
91
  nextRuns: string[];
92
+ nextRunsSource?: 'scheduler' | 'cadence_projection' | 'unconfirmed' | 'not_scheduled';
92
93
  endpoints: Array<{
93
94
  destination: string;
94
95
  label?: string;
@@ -406,6 +407,9 @@ export declare const dutyApi: {
406
407
  link: DutyWorkLink;
407
408
  }>;
408
409
  plan: (body: Record<string, unknown>) => Promise<DutyPlanResponse>;
410
+ nextCheckAdvance: (id: string, at?: string) => Promise<DutyCheckAdvance>;
411
+ advanceNextCheck: (id: string, input: DutyCheckAdvanceRequest) => Promise<DutyCheckAdvance>;
412
+ cancelNextCheckAdvance: (id: string, advanceId: string) => Promise<DutyCheckAdvance>;
409
413
  checkNow: (id: string, verifyVersion?: number) => Promise<Record<string, unknown>>;
410
414
  checks: (id: string, query?: {
411
415
  limit?: number;
@@ -259,6 +259,9 @@ exports.dutyApi = {
259
259
  updateWorkLink: (id, linkId, body) => data_provider_2.request.patch(`${base(id)}/links/${encodeURIComponent(linkId)}`, body),
260
260
  detachWorkLink: (id, linkId) => data_provider_2.request.delete(`${base(id)}/links/${encodeURIComponent(linkId)}`),
261
261
  plan: (body) => data_provider_2.request.post('/api/duties/plan', body),
262
+ nextCheckAdvance: (id, at) => data_provider_2.request.get((0, triggers_1.withQuery)(`${base(id)}/next-check-advance`, { at })),
263
+ advanceNextCheck: (id, input) => data_provider_2.request.post(`${base(id)}/next-check-advance`, input),
264
+ cancelNextCheckAdvance: (id, advanceId) => data_provider_2.request.delete(`${base(id)}/next-check-advance/${encodeURIComponent(advanceId)}`),
262
265
  checkNow: (id, verifyVersion) => data_provider_2.request.post(`${base(id)}/check-now`, verifyVersion === undefined ? {} : { verifyVersion }),
263
266
  checks: (id, query = {}) => data_provider_2.request.get((0, triggers_1.withQuery)(`${base(id)}/checks`, query)),
264
267
  actionHistory: (id, query = {}) => data_provider_2.request.get((0, triggers_1.withQuery)(`${base(id)}/action-history`, query)),
@@ -2060,6 +2063,9 @@ function cycleWake(cycle) {
2060
2063
  return `${wake.source || 'trigger'} wake`;
2061
2064
  return wake.source ? `${wake.kind} (${wake.source})` : String(wake.kind || '-');
2062
2065
  }
2066
+ function isRecordedDutyWake(cycle) {
2067
+ return cycle?.wake?.kind === 'fire' && cycle.wake.fireReason === 'wake_recorded_for_check';
2068
+ }
2063
2069
  /** What one Cycle came to, in a single line. */
2064
2070
  function cycleSummary(cycle) {
2065
2071
  if (cycle.confirmedDelivery)
@@ -2176,8 +2182,9 @@ function formatDutyCycles(page) {
2176
2182
  : owed
2177
2183
  ? CYCLE_GLYPH.owed
2178
2184
  : CYCLE_GLYPH[cycle.outcome] || '?';
2185
+ const wakeSaved = isRecordedDutyWake(cycle);
2179
2186
  const outcomeWord = cycle.confirmedDelivery ? 'delivered' : String(cycle.outcome);
2180
- const word = echo ? 'recorded' : owed ? 'owed' : outcomeWord;
2187
+ const word = echo || wakeSaved ? 'recorded' : owed ? 'owed' : outcomeWord;
2181
2188
  lines.push(`${cycleTime(cycle.startedAt)} ${glyph} ${word.padEnd(9)} ${cycleWake(cycle).padEnd(18)} ${echo ? recordOnlyEchoSummary(cycle) : cycleSummary(cycle)}`);
2182
2189
  if (cycle.confirmedDelivery?.verification) {
2183
2190
  lines.push(` ${cycle.confirmedDelivery.verification}`);
@@ -2286,9 +2293,11 @@ function wakeOutcomeLines(run) {
2286
2293
  }
2287
2294
  function formatDutyExplanation(explanation) {
2288
2295
  const cycle = explanation.cycle;
2296
+ const wakeSaved = isRecordedDutyWake(cycle);
2297
+ const outcomeWord = wakeSaved ? 'wake saved' : cycle?.confirmedDelivery ? 'delivered' : cycle?.outcome;
2289
2298
  const lines = [
2290
2299
  cycle
2291
- ? `Latest cycle: ${cycleTime(cycle.startedAt)} ${cycle.confirmedDelivery ? 'delivered' : cycle.outcome} (${cycle.id})`
2300
+ ? `Latest cycle: ${cycleTime(cycle.startedAt)} ${outcomeWord} (${cycle.id})`
2292
2301
  : `No cycle yet (status: ${explanation.status || '-'})`,
2293
2302
  ];
2294
2303
  if (cycle)
@@ -2307,9 +2316,11 @@ function formatDutyExplanation(explanation) {
2307
2316
  }
2308
2317
  lines.push(!explanation.stoppedAt
2309
2318
  ? 'Nothing stopped this cycle.'
2310
- : explanation.verdict === 'quiet'
2311
- ? `Chose to stay quiet at: ${explanation.stoppedAt}`
2312
- : `Stopped at: ${explanation.stoppedAt}`);
2319
+ : wakeSaved
2320
+ ? 'Check execution appears in a separate cycle.'
2321
+ : explanation.verdict === 'quiet'
2322
+ ? `Chose to stay quiet at: ${explanation.stoppedAt}`
2323
+ : `Stopped at: ${explanation.stoppedAt}`);
2313
2324
  // What the next Run may do without asking — an Ask-mode Agent can ask
2314
2325
  // nobody on an unattended Run (OSK-12201). Same lines as show/preflight.
2315
2326
  if (cycle) {
@@ -95,6 +95,12 @@ function renderExecutionReceipt(receipt, log, verbose = false) {
95
95
  log(` Observation: ${verification.observationId}`);
96
96
  }
97
97
  }
98
+ for (const wake of receipt.followUps || []) {
99
+ const state = wake.currentState === 'scheduled' && wake.currentRunAt
100
+ ? `Currently scheduled for ${wake.currentRunAt}`
101
+ : wake.currentState;
102
+ log(`Follow-up trigger: ${state} · ${wake.path || wake.triggerId}`);
103
+ }
98
104
  if (receipt.runtime) {
99
105
  const identity = receipt.runtime.name || receipt.runtime.id || 'the selected runtime';
100
106
  log(`Runtime: ${identity}${receipt.runtime.kind ? ` · ${receipt.runtime.kind}` : ''}${receipt.runtime.provider ? ` · ${receipt.runtime.provider}` : ''}`);
@@ -0,0 +1,18 @@
1
+ /**
2
+ * What the CLI says about the conversation input queue (G1, G3, G7 in
3
+ * docs/architecture/agent-chat-queue-and-steer-gaps-2026-11-25.zh-CN.md).
4
+ *
5
+ * Every vocabulary member the server can answer has a sentence here, as a `Record` over the
6
+ * vocabulary `@skrr-ai/data-provider` owns, so a new member fails the build until it is given one.
7
+ * The web copy is `client/src/components/Chat/Input/inputQueueCopy.ts`.
8
+ */
9
+ import type { TConversationInputQueueHoldReason, TConversationInputQueuePauseReason, TConversationInputQueueSteerOutcome, TSessionInputNoSteerReason } from '@skrr-ai/data-provider';
10
+ export declare const HOLD_REASON_COPY: Record<TConversationInputQueueHoldReason, string>;
11
+ /** Holds the queue clears by itself, so following a card waits through them (decision 6.10). */
12
+ export declare const SELF_CLEARING_HOLD_REASONS: ReadonlySet<TConversationInputQueueHoldReason>;
13
+ export declare const PAUSE_REASON_COPY: Record<TConversationInputQueuePauseReason, string>;
14
+ export declare const STEER_OUTCOME_COPY: Record<TConversationInputQueueSteerOutcome, string>;
15
+ export declare const NO_STEER_REASON_COPY: Record<TSessionInputNoSteerReason, string>;
16
+ /** Server refusal codes the queue answers with, and what the CLI says about each. */
17
+ export declare const INPUT_QUEUE_ERROR_COPY: Record<string, string>;
18
+ export declare function describeInputQueueError(code: string | undefined | null): string | null;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.INPUT_QUEUE_ERROR_COPY = exports.NO_STEER_REASON_COPY = exports.STEER_OUTCOME_COPY = exports.PAUSE_REASON_COPY = exports.SELF_CLEARING_HOLD_REASONS = exports.HOLD_REASON_COPY = void 0;
4
+ exports.describeInputQueueError = describeInputQueueError;
5
+ exports.HOLD_REASON_COPY = {
6
+ conversation_outcome_unconfirmed: 'Waiting for the previous reply to be confirmed. It sends by itself once that clears; nothing to do.',
7
+ agent_unavailable: 'The agent was deleted or suspended after this message was queued.',
8
+ permission_denied: 'You no longer have access to this agent or conversation.',
9
+ usage_limit: 'A balance, plan or usage limit refused this turn.',
10
+ moderation_refused: 'Moderation refused this message.',
11
+ machine_unavailable: 'The machine this turn runs on is offline or paused for maintenance.',
12
+ conversation_unavailable: 'The conversation is no longer available.',
13
+ start_refused: 'The turn could not be started.',
14
+ };
15
+ /** Holds the queue clears by itself, so following a card waits through them (decision 6.10). */
16
+ exports.SELF_CLEARING_HOLD_REASONS = new Set([
17
+ 'conversation_outcome_unconfirmed',
18
+ ]);
19
+ exports.PAUSE_REASON_COPY = {
20
+ user_paused: 'Paused. Nothing more is sent until you resume.',
21
+ turn_stopped: 'Paused because the running turn was stopped. Resume to send what is queued.',
22
+ turn_failed: 'Paused because the previous turn failed. Resume to send what is queued.',
23
+ card_held: 'Paused behind a message that could not be sent.',
24
+ };
25
+ exports.STEER_OUTCOME_COPY = {
26
+ sent: 'Sent into the running turn. If the turn does not take it, it waits at the head of the queue.',
27
+ next_turn: 'No turn was running, so it goes next, as its own turn.',
28
+ turn_takes_no_input: 'The running turn does not take messages until it finishes. It stays in the queue, asking to steer.',
29
+ };
30
+ exports.NO_STEER_REASON_COPY = {
31
+ manager_single_input: 'The main chat runs each message as its own turn.',
32
+ task_history_answer: 'This turn answers one question about the Task and takes no other input.',
33
+ daemon_turn_no_input: 'The agent on this machine reads no input until its turn ends.',
34
+ harness_turn_no_input: 'This agent reads no input until its turn ends.',
35
+ };
36
+ /** Server refusal codes the queue answers with, and what the CLI says about each. */
37
+ exports.INPUT_QUEUE_ERROR_COPY = {
38
+ INPUT_QUEUE_FULL: 'The queue is full. Wait for a message to be sent, or withdraw one.',
39
+ INPUT_QUEUE_TEXT_TOO_LONG: 'This message is too long to queue.',
40
+ INPUT_QUEUE_SUBMISSION_TOO_LARGE: 'The message settings are too large to queue.',
41
+ INPUT_QUEUE_EDIT_LEASE_LOST: 'Someone else is editing this message, or the edit expired.',
42
+ INPUT_QUEUE_VERSION_CONFLICT: 'The queue changed since you read it. List it again and retry.',
43
+ INPUT_QUEUE_CARD_NOT_FOUND: 'No such message in this queue; it may already have been sent.',
44
+ INPUT_QUEUE_CARD_BUSY: 'This message is being sent or edited.',
45
+ INPUT_QUEUE_COMMAND_RUNS_BETWEEN_TURNS: 'A command runs after the current turn finishes, as its own turn.',
46
+ INPUT_QUEUE_STEER_FILES: 'Attachments are sent with the next turn; they cannot join the running one.',
47
+ INPUT_QUEUE_STEER_UNAVAILABLE: 'The message could not be handed to the running turn. It is still in the queue.',
48
+ INPUT_QUEUE_SCOPED_CONVERSATION: 'Task chats and scoped conversations have no input queue.',
49
+ INPUT_QUEUE_CARD_DISPATCHING: 'This message is being sent right now.',
50
+ INPUT_QUEUE_CONVERSATION_NOT_FOUND: 'No such conversation.',
51
+ INPUT_QUEUE_CONVERSATION_REQUIRED: 'Queue a message on an existing conversation (--conversation).',
52
+ INPUT_QUEUE_AGENTS_USE_REQUIRED: 'Your role does not allow using agents.',
53
+ INPUT_QUEUE_CONTENDED: 'The queue is busy; try again in a moment.',
54
+ INPUT_QUEUE_UNAVAILABLE: 'The input queue is unavailable right now.',
55
+ INPUT_QUEUE_REFUSED: 'The server refused to queue this message.',
56
+ };
57
+ function describeInputQueueError(code) {
58
+ return code ? (exports.INPUT_QUEUE_ERROR_COPY[code] ?? null) : null;
59
+ }
@@ -1,5 +1,5 @@
1
1
  import { type ResolvedCredential } from '@skrr-ai/auth-core';
2
- import type { AgentMessageSequence, EntityEmbed } from '@skrr-ai/data-provider';
2
+ import type { AgentMessageSequence, EntityEmbed, MessageOperation } from '@skrr-ai/data-provider';
3
3
  export declare const CANONICAL_DESTINATION_KINDS: readonly ["app_owner_dm", "slack_owner_dm", "slack_channel", "agent_email"];
4
4
  export type CanonicalDestinationKind = (typeof CANONICAL_DESTINATION_KINDS)[number];
5
5
  export type CanonicalMessageDestination = {
@@ -83,11 +83,30 @@ export type CanonicalMessageIntentRequest = {
83
83
  * not a run of, and a run may deliberately show no card at all.
84
84
  */
85
85
  embeds?: EntityEmbed[];
86
+ /**
87
+ * C10: what this request does to a message the Agent already sent (app_owner_dm only). A
88
+ * supersede or a status is a send; a retraction sends nothing and carries no text. The server
89
+ * proves the Agent sent the message it names.
90
+ */
91
+ operation?: MessageOperation;
92
+ };
93
+ /**
94
+ * What the server did with a request's operation. `applied: false` on a delivered send means the
95
+ * message went out and the earlier one was NOT marked (`reason` says why).
96
+ */
97
+ export type MessageOperationOutcome = {
98
+ kind: MessageOperation['kind'];
99
+ /** The message replaced or withdrawn; for a status, the earlier status (absent for the first). */
100
+ targetMessageId?: string;
101
+ applied: boolean;
102
+ reason?: string;
86
103
  };
87
104
  export type CanonicalMessageIntentResponse = {
88
105
  ok: boolean;
89
106
  intentId?: string;
90
- status?: 'submitted' | 'held' | 'approval_required' | 'authorized' | 'dispatching' | 'delivered' | 'accepted' | 'unknown' | 'refused' | 'failed' | 'dropped' | 'expired' | 'cancelled' | 'duplicate' | 'queued_offline';
107
+ status?: 'submitted' | 'held' | 'approval_required' | 'authorized' | 'dispatching' | 'delivered' | 'accepted' | 'unknown' | 'refused' | 'failed' | 'dropped' | 'expired' | 'cancelled' | 'duplicate' | 'queued_offline'
108
+ /** C10: a message this Agent sent is now marked withdrawn. */
109
+ | 'retracted';
91
110
  reason?: string;
92
111
  retryAfter?: string;
93
112
  retryable?: boolean;
@@ -109,6 +128,9 @@ export type CanonicalMessageIntentResponse = {
109
128
  * absent from an older server.
110
129
  */
111
130
  oneVoice?: OneVoiceOutcome;
131
+ /** The app message this send became (app_owner_dm): what a later supersede or retract names. */
132
+ messageId?: string;
133
+ operation?: MessageOperationOutcome;
112
134
  [key: string]: unknown;
113
135
  };
114
136
  /**
@@ -162,7 +184,7 @@ export declare function submitSessionMessageIntent({ context, request, env, boot
162
184
  timeoutMs?: number;
163
185
  fetchImpl?: typeof fetch;
164
186
  }): Promise<CanonicalMessageIntentResponse>;
165
- export declare function canonicalAppOwnerDmRequest({ agentId, embeds, text, idempotencyKey, taskId, spaceId, goalId, presentation, notificationPolicy, threadRootMessageId, }: {
187
+ export declare function canonicalAppOwnerDmRequest({ agentId, embeds, text, idempotencyKey, taskId, spaceId, goalId, presentation, notificationPolicy, threadRootMessageId, operation, }: {
166
188
  agentId: string;
167
189
  text: string;
168
190
  idempotencyKey: string;
@@ -173,6 +195,7 @@ export declare function canonicalAppOwnerDmRequest({ agentId, embeds, text, idem
173
195
  notificationPolicy?: 'normal' | 'silent';
174
196
  threadRootMessageId?: string;
175
197
  embeds?: EntityEmbed[];
198
+ operation?: MessageOperation;
176
199
  }): CanonicalMessageIntentRequest;
177
200
  export declare function canonicalSlackChannelRequest({ agentId, embeds, channelId, text, threadTs, idempotencyKey, presentation, notificationPolicy, }: {
178
201
  agentId: string;
@@ -214,6 +214,11 @@ async function submitSessionMessageIntent({ context, request, env = process.env,
214
214
  // loopback broker. Falling back to the cloud here would bypass the
215
215
  // server-issued offline grant and make network failure skip the durable WAL.
216
216
  if (daemonMessageIntentRequired(env)) {
217
+ // The broker's WAL carries a send and nothing about another message, so an operation would
218
+ // be dropped there and a correction delivered as an ordinary message. Refuse it instead.
219
+ if (request.operation) {
220
+ throw new MessageIntentCliError('MESSAGE_OPERATION_UNAVAILABLE', 'This session sends through the daemon’s offline queue, which cannot correct, keep a status of, or withdraw an earlier message. Send a new message that says what changed.');
221
+ }
217
222
  return submitDaemonLoopbackMessageIntent({
218
223
  context,
219
224
  request,
@@ -231,7 +236,7 @@ async function submitSessionMessageIntent({ context, request, env = process.env,
231
236
  credential: sessionCredential(context.token),
232
237
  });
233
238
  }
234
- function canonicalAppOwnerDmRequest({ agentId, embeds, text, idempotencyKey, taskId, spaceId, goalId, presentation, notificationPolicy, threadRootMessageId, }) {
239
+ function canonicalAppOwnerDmRequest({ agentId, embeds, text, idempotencyKey, taskId, spaceId, goalId, presentation, notificationPolicy, threadRootMessageId, operation, }) {
235
240
  return {
236
241
  protocolVersion: 1,
237
242
  agentId,
@@ -239,6 +244,7 @@ function canonicalAppOwnerDmRequest({ agentId, embeds, text, idempotencyKey, tas
239
244
  destination: { kind: 'app_owner_dm' },
240
245
  content: { text },
241
246
  idempotencyKey,
247
+ ...(operation ? { operation } : {}),
242
248
  ...(presentation ? { presentation } : {}),
243
249
  ...(notificationPolicy ? { notificationPolicy } : {}),
244
250
  ...(threadRootMessageId ? { threadRootMessageId } : {}),
@@ -1,3 +1,10 @@
1
+ export declare const SPACE_REVIEW_WORK_RUNTIME_PROOF_VERSION = 1;
2
+ export declare const SPACE_REVIEW_RESULT_RUNTIME_PROOF_VERSION = 1;
3
+ export declare const SPACE_NOTEBOOK_RESULT_RUNTIME_PROOF_VERSION = 1;
4
+ export declare const SPACE_GOAL_WORK_RUNTIME_PROOF_VERSION = 1;
5
+ export declare const SPACE_GOAL_EDIT_RUNTIME_PROOF_VERSION = 1;
6
+ export declare const SPACE_ORCHESTRATION_WORK_RUNTIME_PROOF_VERSION = 1;
7
+ export declare const SPACE_ORCHESTRATION_RETRY_RUNTIME_PROOF_VERSION = 1;
1
8
  /**
2
9
  * Account Authorization decides access; a separate server-issued session
3
10
  * credential proves Agent authorship. Environment ids are selectors only.
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SPACE_ORCHESTRATION_RETRY_RUNTIME_PROOF_VERSION = exports.SPACE_ORCHESTRATION_WORK_RUNTIME_PROOF_VERSION = exports.SPACE_GOAL_EDIT_RUNTIME_PROOF_VERSION = exports.SPACE_GOAL_WORK_RUNTIME_PROOF_VERSION = exports.SPACE_NOTEBOOK_RESULT_RUNTIME_PROOF_VERSION = exports.SPACE_REVIEW_RESULT_RUNTIME_PROOF_VERSION = exports.SPACE_REVIEW_WORK_RUNTIME_PROOF_VERSION = void 0;
3
4
  exports.withTaskRuntimeHeaders = withTaskRuntimeHeaders;
4
5
  exports.taskRuntimeRedirectOptions = taskRuntimeRedirectOptions;
5
6
  const WITH_TASK_RUNTIME_HEADERS_RE = /^\/api\/tasks(?:\/|$)/;
@@ -7,6 +8,17 @@ const WITH_TASK_RUNTIME_HEADERS_RE_2 = /^\/api\/agents\/[^/]+\/agent-actions\/[^
7
8
  const WITH_TASK_RUNTIME_HEADERS_RE_3 = /^\/api\/(?:shortcuts|task-templates)\/[^/]+\/(?:instantiate|trigger)\/?$/;
8
9
  const WITH_TASK_RUNTIME_HEADERS_RE_4 = /^\/api\/templates\/[^/]+\/(?:instantiate|fork)\/?$/;
9
10
  const WITH_TASK_RUNTIME_HEADERS_RE_5 = /^\/api\/store\/services\/[^/]+\/install\/?$/;
11
+ const KEY_RESULT_LIST = /^\/api\/goals\/[^/]+\/key-results\/?$/;
12
+ const KEY_RESULT_ASSESS = /^\/api\/goals\/[^/]+\/key-results\/[^/]+\/assessments\/?$/;
13
+ const GOAL_DETAIL = /^\/api\/goals\/[^/]+\/?$/;
14
+ const EXACT_TASK_RESULT = /^\/api\/tasks\/[^/]+\/results\/[^/]+\/?$/;
15
+ exports.SPACE_REVIEW_WORK_RUNTIME_PROOF_VERSION = 1;
16
+ exports.SPACE_REVIEW_RESULT_RUNTIME_PROOF_VERSION = 1;
17
+ exports.SPACE_NOTEBOOK_RESULT_RUNTIME_PROOF_VERSION = 1;
18
+ exports.SPACE_GOAL_WORK_RUNTIME_PROOF_VERSION = 1;
19
+ exports.SPACE_GOAL_EDIT_RUNTIME_PROOF_VERSION = 1;
20
+ exports.SPACE_ORCHESTRATION_WORK_RUNTIME_PROOF_VERSION = 1;
21
+ exports.SPACE_ORCHESTRATION_RETRY_RUNTIME_PROOF_VERSION = 1;
10
22
  /**
11
23
  * Account Authorization decides access; a separate server-issued session
12
24
  * credential proves Agent authorship. Environment ids are selectors only.
@@ -15,14 +27,19 @@ const WITH_TASK_RUNTIME_HEADERS_RE_5 = /^\/api\/store\/services\/[^/]+\/install\
15
27
  */
16
28
  function withTaskRuntimeHeaders(headers, requestUrl, method, env = process.env) {
17
29
  const sent = { ...headers };
18
- // A companion credential never travels on a read, another API surface,
19
- // or a caller-selected header. Preserve existing nonsecret correlation
20
- // hints outside Task authorship mutations for other APIs' provenance checks.
30
+ // A companion credential travels only on the exact managed operations below.
31
+ // Preserve nonsecret correlation hints for other APIs' provenance checks.
21
32
  for (const key of Object.keys(sent)) {
22
33
  if (key.toLowerCase() === 'x-oversky-session-authorization')
23
34
  delete sent[key];
24
35
  }
25
- if (!['POST', 'PUT', 'PATCH', 'DELETE'].includes(method.toUpperCase()))
36
+ const verb = method.toUpperCase();
37
+ const mutation = ['POST', 'PUT', 'PATCH', 'DELETE'].includes(verb);
38
+ const goalWork = env.OVERSKY_SPACE_GOAL_WORK === '1';
39
+ const workSpace = (goalWork || env.OVERSKY_SPACE_REVIEW_WORK === '1') ? env.OVERSKY_SESSION_SPACE_ID : undefined;
40
+ const notebookSpace = env.OVERSKY_SPACE_NOTEBOOK_RESULT === '1' ? env.OVERSKY_SESSION_SPACE_ID : undefined;
41
+ const orchestrationSpace = env.OVERSKY_SPACE_ORCHESTRATION_WORK === '1' ? env.OVERSKY_SESSION_SPACE_ID : undefined;
42
+ if (!mutation && !((workSpace || notebookSpace || orchestrationSpace) && verb === 'GET'))
26
43
  return sent;
27
44
  const refuseOrigin = () => Object.assign(new Error('Managed Task requests require their bound server origin; refusing account-attributed fallback.'), {
28
45
  code: 'SESSION_TASK_ORIGIN_MISMATCH',
@@ -39,14 +56,34 @@ function withTaskRuntimeHeaders(headers, requestUrl, method, env = process.env)
39
56
  // Some platform operations materialize Tasks outside the Task router. Keep
40
57
  // their exact POST routes here; action/library edits, picker reads and other
41
58
  // integration routes must never receive the companion credential.
42
- const taskMutation = WITH_TASK_RUNTIME_HEADERS_RE.test(target.pathname);
43
- const taskCreation = method.toUpperCase() === 'POST' && [
59
+ const { pathname } = target;
60
+ const taskMutation = mutation && WITH_TASK_RUNTIME_HEADERS_RE.test(pathname);
61
+ const attributedWrite = verb === 'POST' && [
44
62
  WITH_TASK_RUNTIME_HEADERS_RE_2,
45
63
  WITH_TASK_RUNTIME_HEADERS_RE_3,
46
64
  WITH_TASK_RUNTIME_HEADERS_RE_4,
47
65
  WITH_TASK_RUNTIME_HEADERS_RE_5,
48
- ].some((route) => route.test(target.pathname));
49
- if (!taskMutation && !taskCreation)
66
+ KEY_RESULT_ASSESS,
67
+ ].some((route) => route.test(pathname));
68
+ const spacePath = workSpace ? `/api/spaces/${encodeURIComponent(workSpace)}` : undefined;
69
+ const boundSpace = env.OVERSKY_SESSION_SPACE_ID;
70
+ const skillProposal = verb === 'POST' && boundSpace &&
71
+ pathname === `/api/spaces/${encodeURIComponent(boundSpace)}/learning/skill-proposals`;
72
+ const reviewProof = spacePath && ((verb === 'GET' && (KEY_RESULT_LIST.test(pathname) || pathname === `${spacePath}/goals` ||
73
+ (goalWork && GOAL_DETAIL.test(pathname)) ||
74
+ (EXACT_TASK_RESULT.test(pathname) && target.searchParams.getAll('reviewSpaceId').length === 1 &&
75
+ target.searchParams.get('reviewSpaceId') === workSpace) ||
76
+ (pathname === '/api/tasks' && target.searchParams.getAll('spaceId').length === 1 &&
77
+ target.searchParams.get('spaceId') === workSpace))) ||
78
+ (!goalWork && verb === 'POST' && pathname === `${spacePath}/wiki/pages`));
79
+ const notebookProof = verb === 'GET' && notebookSpace && EXACT_TASK_RESULT.test(pathname) &&
80
+ target.searchParams.getAll('notebookSpaceId').length === 1 &&
81
+ target.searchParams.get('notebookSpaceId') === notebookSpace &&
82
+ !target.searchParams.has('reviewSpaceId');
83
+ const orchestrationProof = verb === 'GET' && orchestrationSpace &&
84
+ pathname === `/api/spaces/${encodeURIComponent(orchestrationSpace)}/auto-executor/preview` &&
85
+ target.searchParams.getAll('runtime').length === 1 && target.searchParams.get('runtime') === 'space-orchestration';
86
+ if (!taskMutation && !attributedWrite && !reviewProof && !notebookProof && !skillProposal && !orchestrationProof)
50
87
  return sent;
51
88
  const names = new Set(['x-oversky-agent-id', 'x-oversky-session-id', 'x-oversky-autonomous-run-id']);
52
89
  for (const key of Object.keys(sent))
@@ -65,7 +102,7 @@ function withTaskRuntimeHeaders(headers, requestUrl, method, env = process.env)
65
102
  throw refuseOrigin();
66
103
  }
67
104
  // The companion credential only travels to the managed runtime's server
68
- // and only to Task mutations/materialization. Bound routes use it as Authorization.
105
+ // and only to the attributed operations and scoped Review receipts above.
69
106
  if (target.origin !== trusted.origin)
70
107
  throw refuseOrigin();
71
108
  if (!sessionId || !token) {