@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
@@ -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,5 +1,10 @@
1
1
  export declare const SPACE_REVIEW_WORK_RUNTIME_PROOF_VERSION = 1;
2
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;
3
8
  /**
4
9
  * Account Authorization decides access; a separate server-issued session
5
10
  * credential proves Agent authorship. Environment ids are selectors only.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SPACE_REVIEW_RESULT_RUNTIME_PROOF_VERSION = exports.SPACE_REVIEW_WORK_RUNTIME_PROOF_VERSION = void 0;
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;
4
4
  exports.withTaskRuntimeHeaders = withTaskRuntimeHeaders;
5
5
  exports.taskRuntimeRedirectOptions = taskRuntimeRedirectOptions;
6
6
  const WITH_TASK_RUNTIME_HEADERS_RE = /^\/api\/tasks(?:\/|$)/;
@@ -10,9 +10,15 @@ const WITH_TASK_RUNTIME_HEADERS_RE_4 = /^\/api\/templates\/[^/]+\/(?:instantiate
10
10
  const WITH_TASK_RUNTIME_HEADERS_RE_5 = /^\/api\/store\/services\/[^/]+\/install\/?$/;
11
11
  const KEY_RESULT_LIST = /^\/api\/goals\/[^/]+\/key-results\/?$/;
12
12
  const KEY_RESULT_ASSESS = /^\/api\/goals\/[^/]+\/key-results\/[^/]+\/assessments\/?$/;
13
+ const GOAL_DETAIL = /^\/api\/goals\/[^/]+\/?$/;
13
14
  const EXACT_TASK_RESULT = /^\/api\/tasks\/[^/]+\/results\/[^/]+\/?$/;
14
15
  exports.SPACE_REVIEW_WORK_RUNTIME_PROOF_VERSION = 1;
15
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;
16
22
  /**
17
23
  * Account Authorization decides access; a separate server-issued session
18
24
  * credential proves Agent authorship. Environment ids are selectors only.
@@ -29,8 +35,11 @@ function withTaskRuntimeHeaders(headers, requestUrl, method, env = process.env)
29
35
  }
30
36
  const verb = method.toUpperCase();
31
37
  const mutation = ['POST', 'PUT', 'PATCH', 'DELETE'].includes(verb);
32
- const reviewSpace = env.OVERSKY_SPACE_REVIEW_WORK === '1' ? env.OVERSKY_SESSION_SPACE_ID : undefined;
33
- if (!mutation && !(reviewSpace && verb === 'GET'))
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'))
34
43
  return sent;
35
44
  const refuseOrigin = () => Object.assign(new Error('Managed Task requests require their bound server origin; refusing account-attributed fallback.'), {
36
45
  code: 'SESSION_TASK_ORIGIN_MISMATCH',
@@ -56,14 +65,25 @@ function withTaskRuntimeHeaders(headers, requestUrl, method, env = process.env)
56
65
  WITH_TASK_RUNTIME_HEADERS_RE_5,
57
66
  KEY_RESULT_ASSESS,
58
67
  ].some((route) => route.test(pathname));
59
- const spacePath = reviewSpace ? `/api/spaces/${encodeURIComponent(reviewSpace)}` : undefined;
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`;
60
72
  const reviewProof = spacePath && ((verb === 'GET' && (KEY_RESULT_LIST.test(pathname) || pathname === `${spacePath}/goals` ||
73
+ (goalWork && GOAL_DETAIL.test(pathname)) ||
61
74
  (EXACT_TASK_RESULT.test(pathname) && target.searchParams.getAll('reviewSpaceId').length === 1 &&
62
- target.searchParams.get('reviewSpaceId') === reviewSpace) ||
75
+ target.searchParams.get('reviewSpaceId') === workSpace) ||
63
76
  (pathname === '/api/tasks' && target.searchParams.getAll('spaceId').length === 1 &&
64
- target.searchParams.get('spaceId') === reviewSpace))) ||
65
- (verb === 'POST' && pathname === `${spacePath}/wiki/pages`));
66
- if (!taskMutation && !attributedWrite && !reviewProof)
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)
67
87
  return sent;
68
88
  const names = new Set(['x-oversky-agent-id', 'x-oversky-session-id', 'x-oversky-autonomous-run-id']);
69
89
  for (const key of Object.keys(sent))
@@ -329,43 +329,44 @@ declare const ENGINE_ENV_SUFFIXES: Readonly<{
329
329
  sessionId: "SESSION_ID";
330
330
  }>;
331
331
  export type FirstPartyHarnessEngineEnvKey = keyof typeof ENGINE_ENV_SUFFIXES;
332
- /**
333
- * Names the ENGINE itself defines and reads. The platform sets or reads them
334
- * across the daemon↔engine boundary, so they are recorded here as values rather
335
- * than scattered as literals. They are the fork's names, and moving one is a
336
- * two-sided change: the engine reads the new name first and every legacy name
337
- * second, and while engine and platform releases can arrive in either order the
338
- * platform SETS every name and READS new-then-legacy (contract §6, OSK-8674).
339
- */
340
- export declare const FIRST_PARTY_HARNESS_ENGINE: Readonly<{
332
+ interface FirstPartyHarnessEngineNamespace {
341
333
  /**
342
334
  * The engine's state namespace: XDG dirs, project marker, config basename, and
343
335
  * the engine home under the skrr root (`firstPartyHarnessHomeDirname`).
344
336
  */
345
- appName: string;
337
+ readonly appName: string;
346
338
  /**
347
339
  * Earlier `appName`s, newest first. `migrateFirstPartyHarnessHome` moves a home
348
340
  * under one of them onto the current name and leaves a symlink; readers of
349
341
  * engine state look under them after the current name.
350
342
  */
351
- legacyAppNames: readonly string[];
343
+ readonly legacyAppNames: readonly string[];
352
344
  /** Project-local configuration directory inside a user's repository. */
353
- projectDirectory: `.${string}`;
345
+ readonly projectDirectory: `.${string}`;
354
346
  /**
355
347
  * Earlier project directories, newest first. The engine still reads them and
356
348
  * the platform never rewrites a user's repository to move one, so a reader
357
349
  * looks here after `projectDirectory`, and a writer adopts an existing file
358
350
  * here rather than creating a second one beside it.
359
351
  */
360
- legacyProjectDirectories: readonly string[];
352
+ readonly legacyProjectDirectories: readonly string[];
361
353
  /**
362
354
  * Environment variables the engine reads, under the CURRENT namespace. The
363
355
  * engine also reads each one under every legacy namespace, second — use
364
356
  * `readFirstPartyHarnessEngineEnv` to read one the way the engine does and
365
357
  * `firstPartyHarnessEngineEnvEntries` to set one every engine build honours.
366
358
  */
367
- env: Readonly<Record<"sessionId" | "appName" | "serverPassword" | "serverUsername" | "home" | "config" | "scriptName" | "allowUpstreamEgress" | "compatOpencode" | "noCompatPrompts", string>>;
368
- }>;
359
+ readonly env: Readonly<Record<FirstPartyHarnessEngineEnvKey, string>>;
360
+ }
361
+ /**
362
+ * Names the ENGINE itself defines and reads. The platform sets or reads them
363
+ * across the daemon↔engine boundary, so they are recorded here as values rather
364
+ * than scattered as literals. They are the fork's names, and moving one is a
365
+ * two-sided change: the engine reads the new name first and every legacy name
366
+ * second, and while engine and platform releases can arrive in either order the
367
+ * platform SETS every name and READS new-then-legacy (contract §6, OSK-8674).
368
+ */
369
+ export declare const FIRST_PARTY_HARNESS_ENGINE: FirstPartyHarnessEngineNamespace;
369
370
  /**
370
371
  * Every name the engine reads for one purpose, current namespace first — the
371
372
  * engine's own lookup order.
@@ -297,32 +297,10 @@ function defineEngineNamespace(appName, legacyAppNames) {
297
297
  throw new Error("first-party harness engine appName and legacyAppNames must be distinct");
298
298
  }
299
299
  return Object.freeze({
300
- /**
301
- * The engine's state namespace: XDG dirs, project marker, config basename, and
302
- * the engine home under the skrr root (`firstPartyHarnessHomeDirname`).
303
- */
304
300
  appName,
305
- /**
306
- * Earlier `appName`s, newest first. `migrateFirstPartyHarnessHome` moves a home
307
- * under one of them onto the current name and leaves a symlink; readers of
308
- * engine state look under them after the current name.
309
- */
310
301
  legacyAppNames: Object.freeze([...legacyAppNames]),
311
- /** Project-local configuration directory inside a user's repository. */
312
302
  projectDirectory: `.${appName}`,
313
- /**
314
- * Earlier project directories, newest first. The engine still reads them and
315
- * the platform never rewrites a user's repository to move one, so a reader
316
- * looks here after `projectDirectory`, and a writer adopts an existing file
317
- * here rather than creating a second one beside it.
318
- */
319
303
  legacyProjectDirectories: Object.freeze(legacyAppNames.map((name) => `.${name}`)),
320
- /**
321
- * Environment variables the engine reads, under the CURRENT namespace. The
322
- * engine also reads each one under every legacy namespace, second — use
323
- * `readFirstPartyHarnessEngineEnv` to read one the way the engine does and
324
- * `firstPartyHarnessEngineEnvEntries` to set one every engine build honours.
325
- */
326
304
  env: engineEnvTable(appName)
327
305
  });
328
306
  }
@@ -329,43 +329,44 @@ declare const ENGINE_ENV_SUFFIXES: Readonly<{
329
329
  sessionId: "SESSION_ID";
330
330
  }>;
331
331
  export type FirstPartyHarnessEngineEnvKey = keyof typeof ENGINE_ENV_SUFFIXES;
332
- /**
333
- * Names the ENGINE itself defines and reads. The platform sets or reads them
334
- * across the daemon↔engine boundary, so they are recorded here as values rather
335
- * than scattered as literals. They are the fork's names, and moving one is a
336
- * two-sided change: the engine reads the new name first and every legacy name
337
- * second, and while engine and platform releases can arrive in either order the
338
- * platform SETS every name and READS new-then-legacy (contract §6, OSK-8674).
339
- */
340
- export declare const FIRST_PARTY_HARNESS_ENGINE: Readonly<{
332
+ interface FirstPartyHarnessEngineNamespace {
341
333
  /**
342
334
  * The engine's state namespace: XDG dirs, project marker, config basename, and
343
335
  * the engine home under the skrr root (`firstPartyHarnessHomeDirname`).
344
336
  */
345
- appName: string;
337
+ readonly appName: string;
346
338
  /**
347
339
  * Earlier `appName`s, newest first. `migrateFirstPartyHarnessHome` moves a home
348
340
  * under one of them onto the current name and leaves a symlink; readers of
349
341
  * engine state look under them after the current name.
350
342
  */
351
- legacyAppNames: readonly string[];
343
+ readonly legacyAppNames: readonly string[];
352
344
  /** Project-local configuration directory inside a user's repository. */
353
- projectDirectory: `.${string}`;
345
+ readonly projectDirectory: `.${string}`;
354
346
  /**
355
347
  * Earlier project directories, newest first. The engine still reads them and
356
348
  * the platform never rewrites a user's repository to move one, so a reader
357
349
  * looks here after `projectDirectory`, and a writer adopts an existing file
358
350
  * here rather than creating a second one beside it.
359
351
  */
360
- legacyProjectDirectories: readonly string[];
352
+ readonly legacyProjectDirectories: readonly string[];
361
353
  /**
362
354
  * Environment variables the engine reads, under the CURRENT namespace. The
363
355
  * engine also reads each one under every legacy namespace, second — use
364
356
  * `readFirstPartyHarnessEngineEnv` to read one the way the engine does and
365
357
  * `firstPartyHarnessEngineEnvEntries` to set one every engine build honours.
366
358
  */
367
- env: Readonly<Record<"sessionId" | "appName" | "serverPassword" | "serverUsername" | "home" | "config" | "scriptName" | "allowUpstreamEgress" | "compatOpencode" | "noCompatPrompts", string>>;
368
- }>;
359
+ readonly env: Readonly<Record<FirstPartyHarnessEngineEnvKey, string>>;
360
+ }
361
+ /**
362
+ * Names the ENGINE itself defines and reads. The platform sets or reads them
363
+ * across the daemon↔engine boundary, so they are recorded here as values rather
364
+ * than scattered as literals. They are the fork's names, and moving one is a
365
+ * two-sided change: the engine reads the new name first and every legacy name
366
+ * second, and while engine and platform releases can arrive in either order the
367
+ * platform SETS every name and READS new-then-legacy (contract §6, OSK-8674).
368
+ */
369
+ export declare const FIRST_PARTY_HARNESS_ENGINE: FirstPartyHarnessEngineNamespace;
369
370
  /**
370
371
  * Every name the engine reads for one purpose, current namespace first — the
371
372
  * engine's own lookup order.
@@ -457,32 +457,10 @@ function defineEngineNamespace(appName, legacyAppNames) {
457
457
  throw new Error('first-party harness engine appName and legacyAppNames must be distinct');
458
458
  }
459
459
  return Object.freeze({
460
- /**
461
- * The engine's state namespace: XDG dirs, project marker, config basename, and
462
- * the engine home under the skrr root (`firstPartyHarnessHomeDirname`).
463
- */
464
460
  appName,
465
- /**
466
- * Earlier `appName`s, newest first. `migrateFirstPartyHarnessHome` moves a home
467
- * under one of them onto the current name and leaves a symlink; readers of
468
- * engine state look under them after the current name.
469
- */
470
461
  legacyAppNames: Object.freeze([...legacyAppNames]),
471
- /** Project-local configuration directory inside a user's repository. */
472
462
  projectDirectory: `.${appName}`,
473
- /**
474
- * Earlier project directories, newest first. The engine still reads them and
475
- * the platform never rewrites a user's repository to move one, so a reader
476
- * looks here after `projectDirectory`, and a writer adopts an existing file
477
- * here rather than creating a second one beside it.
478
- */
479
463
  legacyProjectDirectories: Object.freeze(legacyAppNames.map((name) => `.${name}`)),
480
- /**
481
- * Environment variables the engine reads, under the CURRENT namespace. The
482
- * engine also reads each one under every legacy namespace, second — use
483
- * `readFirstPartyHarnessEngineEnv` to read one the way the engine does and
484
- * `firstPartyHarnessEngineEnvEntries` to set one every engine build honours.
485
- */
486
464
  env: engineEnvTable(appName),
487
465
  });
488
466
  }