@skrr-ai/cli 0.1.154 → 0.1.157

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 (153) hide show
  1. package/dist/base-command.js +64 -16
  2. package/dist/commands/activity/list.d.ts +13 -0
  3. package/dist/commands/activity/list.js +50 -0
  4. package/dist/commands/activity/show.d.ts +18 -0
  5. package/dist/commands/activity/show.js +125 -0
  6. package/dist/commands/agent/message/send.js +64 -19
  7. package/dist/commands/agents/always-on/held-messages.js +24 -1
  8. package/dist/commands/agents/always-on/status.js +6 -1
  9. package/dist/commands/agents/mini-computer/app/reset.d.ts +13 -0
  10. package/dist/commands/agents/mini-computer/app/reset.js +35 -0
  11. package/dist/commands/agents/mini-computer/app/set.d.ts +16 -0
  12. package/dist/commands/agents/mini-computer/app/set.js +70 -0
  13. package/dist/commands/agents/mini-computer/layout/change.d.ts +14 -0
  14. package/dist/commands/agents/mini-computer/layout/change.js +44 -0
  15. package/dist/commands/agents/mini-computer/layout/folder.d.ts +14 -0
  16. package/dist/commands/agents/mini-computer/layout/folder.js +35 -0
  17. package/dist/commands/agents/mini-computer/layout/move.d.ts +14 -0
  18. package/dist/commands/agents/mini-computer/layout/move.js +32 -0
  19. package/dist/commands/agents/mini-computer/layout/pin.d.ts +14 -0
  20. package/dist/commands/agents/mini-computer/layout/pin.js +35 -0
  21. package/dist/commands/agents/mini-computer/layout/remove.d.ts +13 -0
  22. package/dist/commands/agents/mini-computer/layout/remove.js +27 -0
  23. package/dist/commands/agents/mini-computer/layout/restore.d.ts +13 -0
  24. package/dist/commands/agents/mini-computer/layout/restore.js +27 -0
  25. package/dist/commands/agents/mini-computer/layout/unfolder.d.ts +13 -0
  26. package/dist/commands/agents/mini-computer/layout/unfolder.js +27 -0
  27. package/dist/commands/agents/mini-computer/layout/unpin.d.ts +14 -0
  28. package/dist/commands/agents/mini-computer/layout/unpin.js +34 -0
  29. package/dist/commands/agents/mini-computer/show.d.ts +13 -0
  30. package/dist/commands/agents/mini-computer/show.js +60 -0
  31. package/dist/commands/agents/mini-computer/tasks-view.d.ts +29 -0
  32. package/dist/commands/agents/mini-computer/tasks-view.js +100 -0
  33. package/dist/commands/apps/auto-apply.d.ts +14 -0
  34. package/dist/commands/apps/auto-apply.js +53 -0
  35. package/dist/commands/apps/check.js +4 -1
  36. package/dist/commands/apps/create.js +11 -6
  37. package/dist/commands/apps/data/batch.d.ts +15 -0
  38. package/dist/commands/apps/data/batch.js +59 -0
  39. package/dist/commands/apps/data/collections.d.ts +12 -0
  40. package/dist/commands/apps/data/collections.js +44 -0
  41. package/dist/commands/apps/data/delete.d.ts +15 -0
  42. package/dist/commands/apps/data/delete.js +57 -0
  43. package/dist/commands/apps/data/patch.d.ts +17 -0
  44. package/dist/commands/apps/data/patch.js +70 -0
  45. package/dist/commands/apps/data/put.js +1 -1
  46. package/dist/commands/apps/data/query.js +1 -1
  47. package/dist/commands/apps/installations/diff.d.ts +14 -0
  48. package/dist/commands/apps/installations/diff.js +45 -0
  49. package/dist/commands/apps/installations/events.d.ts +23 -0
  50. package/dist/commands/apps/installations/events.js +104 -0
  51. package/dist/commands/apps/installations/snapshot.d.ts +18 -0
  52. package/dist/commands/apps/installations/snapshot.js +60 -0
  53. package/dist/commands/apps/installations/versions.d.ts +12 -0
  54. package/dist/commands/apps/installations/versions.js +38 -0
  55. package/dist/commands/apps/logs.js +3 -0
  56. package/dist/commands/apps/preview.js +4 -2
  57. package/dist/commands/apps/pull.js +10 -1
  58. package/dist/commands/apps/push.js +36 -12
  59. package/dist/commands/apps/reference.d.ts +26 -0
  60. package/dist/commands/apps/reference.js +56 -0
  61. package/dist/commands/apps/rollback.d.ts +13 -0
  62. package/dist/commands/apps/rollback.js +47 -0
  63. package/dist/commands/apps/version/create.js +5 -0
  64. package/dist/commands/daemon/index.js +2 -0
  65. package/dist/commands/daemon/workspace-locks.d.ts +9 -0
  66. package/dist/commands/daemon/workspace-locks.js +59 -0
  67. package/dist/commands/duties/accounting.js +6 -0
  68. package/dist/commands/duties/analytics/detail.js +6 -0
  69. package/dist/commands/duties/analytics/index.js +14 -0
  70. package/dist/commands/duties/analytics/replay.js +6 -0
  71. package/dist/commands/duties/cost.js +6 -0
  72. package/dist/commands/duties/delete.js +22 -19
  73. package/dist/commands/duties/doctor.d.ts +2 -1
  74. package/dist/commands/duties/doctor.js +17 -3
  75. package/dist/commands/duties/goals/link.js +4 -0
  76. package/dist/commands/duties/goals/unlink.js +4 -0
  77. package/dist/commands/duties/lineage.js +6 -1
  78. package/dist/commands/duties/links/list.js +6 -0
  79. package/dist/commands/duties/metrics.js +10 -0
  80. package/dist/commands/duties/observations.js +12 -0
  81. package/dist/commands/duties/operating-review.d.ts +4 -30
  82. package/dist/commands/duties/operating-review.js +28 -141
  83. package/dist/commands/duties/receipt-metrics.js +7 -0
  84. package/dist/commands/duties/receipt.js +7 -0
  85. package/dist/commands/duties/roster.js +14 -8
  86. package/dist/commands/duties/show.js +27 -9
  87. package/dist/commands/duties/status.js +18 -9
  88. package/dist/commands/duties/trigger-status.d.ts +2 -0
  89. package/dist/commands/duties/trigger-status.js +19 -1
  90. package/dist/commands/duties/wake-capabilities.d.ts +2 -0
  91. package/dist/commands/duties/wake-capabilities.js +32 -2
  92. package/dist/commands/followups/act.js +3 -0
  93. package/dist/commands/followups/remind.js +12 -3
  94. package/dist/commands/followups/show.js +6 -0
  95. package/dist/commands/harnesses/quota.js +1 -1
  96. package/dist/commands/spaces/members/add.js +6 -6
  97. package/dist/commands/spaces/members/remove.js +6 -6
  98. package/dist/commands/spaces/notebook.d.ts +3 -7
  99. package/dist/commands/spaces/notebook.js +32 -8
  100. package/dist/commands/tasks/create.d.ts +2 -2
  101. package/dist/commands/tasks/create.js +3 -3
  102. package/dist/commands/tasks/list.d.ts +3 -41
  103. package/dist/commands/tasks/list.js +5 -53
  104. package/dist/generated/agent-guides.json +424 -101
  105. package/dist/generated/managed-instruction-guides.json +1 -1
  106. package/dist/lib/agent-activity.d.ts +68 -0
  107. package/dist/lib/agent-activity.js +106 -0
  108. package/dist/lib/always-on-runtime.d.ts +9 -0
  109. package/dist/lib/always-on-runtime.js +20 -0
  110. package/dist/lib/api-fetch.d.ts +10 -0
  111. package/dist/lib/api-fetch.js +12 -2
  112. package/dist/lib/appData.d.ts +28 -1
  113. package/dist/lib/appData.js +111 -9
  114. package/dist/lib/appInstallations.d.ts +9 -1
  115. package/dist/lib/appInstallations.js +100 -0
  116. package/dist/lib/apps-command.d.ts +1 -0
  117. package/dist/lib/apps-command.js +11 -0
  118. package/dist/lib/apps.d.ts +12 -0
  119. package/dist/lib/apps.js +28 -1
  120. package/dist/lib/appsAssets.d.ts +17 -0
  121. package/dist/lib/appsAssets.js +15 -0
  122. package/dist/lib/appsCheck.d.ts +1 -0
  123. package/dist/lib/appsCheck.js +1 -0
  124. package/dist/lib/appsFs.d.ts +18 -1
  125. package/dist/lib/appsFs.js +76 -19
  126. package/dist/lib/compasses.js +6 -0
  127. package/dist/lib/duties.d.ts +25 -2
  128. package/dist/lib/duties.js +58 -3
  129. package/dist/lib/duty-analytics.d.ts +2 -0
  130. package/dist/lib/duty-analytics.js +26 -0
  131. package/dist/lib/duty-goal-propagation.d.ts +2 -0
  132. package/dist/lib/duty-goal-propagation.js +18 -0
  133. package/dist/lib/duty-history-source.d.ts +4 -0
  134. package/dist/lib/duty-history-source.js +12 -0
  135. package/dist/lib/duty-ledgers.d.ts +4 -0
  136. package/dist/lib/duty-ledgers.js +4 -0
  137. package/dist/lib/duty-receipt-source.d.ts +4 -0
  138. package/dist/lib/duty-receipt-source.js +19 -0
  139. package/dist/lib/followups.d.ts +20 -0
  140. package/dist/lib/followups.js +10 -0
  141. package/dist/lib/held-messages.d.ts +22 -0
  142. package/dist/lib/held-messages.js +55 -0
  143. package/dist/lib/list-workspace.d.ts +40 -0
  144. package/dist/lib/list-workspace.js +58 -0
  145. package/dist/lib/miniComputer.d.ts +59 -0
  146. package/dist/lib/miniComputer.js +224 -0
  147. package/dist/lib/miniComputerCommand.d.ts +13 -0
  148. package/dist/lib/miniComputerCommand.js +48 -0
  149. package/dist/lib/roles.d.ts +3 -3
  150. package/dist/lib/space-notebook.js +15 -4
  151. package/dist/node_modules/@skrr-ai/data-provider/index.js +10806 -8686
  152. package/oclif.manifest.json +2604 -316
  153. package/package.json +14 -2
@@ -54,6 +54,8 @@ exports.describeObservationArtifacts = describeObservationArtifacts;
54
54
  exports.observationLegend = observationLegend;
55
55
  exports.renderDutyObservations = renderDutyObservations;
56
56
  exports.renderDutyHypotheses = renderDutyHypotheses;
57
+ exports.safeDutyLineage = safeDutyLineage;
58
+ exports.isDutyLineageUnavailable = isDutyLineageUnavailable;
57
59
  exports.renderDutyLineage = renderDutyLineage;
58
60
  exports.renderDutyMetrics = renderDutyMetrics;
59
61
  exports.costRuleCell = costRuleCell;
@@ -225,7 +227,12 @@ exports.dutyApi = {
225
227
  fork: (id, body) => data_provider_2.request.post(`${base(id)}/fork`, body),
226
228
  // GET /:id returns `{ duty, latestCheck }` — NOT a bare contract.
227
229
  // Unwrap before rendering, or every field reads as undefined.
228
- get: (id) => data_provider_2.request.get(base(id)),
230
+ // The CLI understands that a null latestCheck can mean history is
231
+ // unavailable, rather than that the Duty has never run. Older clients do
232
+ // not declare this capability and receive a non-success response instead.
233
+ get: (id) => data_provider_2.request.get(base(id), {
234
+ headers: { 'X-Duty-Source-Policy': 'unsupported-v1' },
235
+ }),
229
236
  controlPreview: (id, query) => data_provider_2.request.get((0, triggers_1.withQuery)(`${base(id)}/control-preview`, query)),
230
237
  applyControl: (id, body) => data_provider_2.request.post(`${base(id)}/control`, body),
231
238
  controlReceipt: (id, controlId) => data_provider_2.request.get(`${base(id)}/control/${encodeURIComponent(controlId)}`),
@@ -289,7 +296,9 @@ exports.dutyApi = {
289
296
  receiptQuarterlyMetrics: (id, year, quarter) => data_provider_2.request.get((0, triggers_1.withQuery)(`${base(id)}/receipt-metrics/quarterly`, { year, quarter })),
290
297
  deliveryPatch: (id, taskId) => data_provider_2.request.get(`${base(id)}/delivery/${encodeURIComponent(taskId)}/patch`),
291
298
  deliveryBundle: (id, taskId) => data_provider_2.request.get(`${base(id)}/delivery/${encodeURIComponent(taskId)}/bundle`),
292
- operatingReview: (agentId) => data_provider_2.request.get(`/api/duties/agents/${encodeURIComponent(agentId)}/operating-review`),
299
+ operatingReview: (agentId) => data_provider_2.request.get(`/api/duties/agents/${encodeURIComponent(agentId)}/operating-review`, {
300
+ headers: { 'X-Operating-Review-Capabilities': 'nullable-system-duties-v1' },
301
+ }),
293
302
  reflection: (id) => data_provider_2.request.get(`${base(id)}/reflection`),
294
303
  decideReflectionProposal: (id, proposalKey, decision) => data_provider_2.request.post(`${base(id)}/reflection/proposals/${encodeURIComponent(proposalKey)}/decision`, {
295
304
  decision,
@@ -1292,7 +1301,14 @@ function describeStoppedBy(duty) {
1292
1301
  * `blocked`, and printing it above "Agent is working" made the header
1293
1302
  * contradict the rest of the page. `doctor` already reads the live one first.
1294
1303
  */
1295
- function withLiveAssessment(duty, operatingState) {
1304
+ function withLiveAssessment(duty, operatingState, historyUnavailable = false) {
1305
+ if (historyUnavailable || operatingState === null) {
1306
+ // These fields depend on history which the read could not attribute to the
1307
+ // current physical Duty. Keep the contract fields, but do not render old
1308
+ // assessment, check summary or executor evidence as the current state.
1309
+ const { assessment: _assessment, state: _state, executorBlocked: _executorBlocked, firstActionableBlocker: _firstActionableBlocker, ...contract } = duty;
1310
+ return contract;
1311
+ }
1296
1312
  const live = operatingState?.assessment;
1297
1313
  // The remediation for a blocked operation lives on the operating state's
1298
1314
  // first actionable blocker; the header printed only the code (OSK-16212).
@@ -2459,8 +2475,47 @@ function renderLineageRows(label, value, log) {
2459
2475
  { key: 'summary', header: 'SUMMARY', maxWidth: 72 },
2460
2476
  ], `No ${label.toLowerCase()} recorded.`, log);
2461
2477
  }
2478
+ /** Old servers could associate work by logical ID without proving its source.
2479
+ * Never render or print those rows unless the server explicitly declares that
2480
+ * the source is supported. This also protects JSON output during mixed rollout.
2481
+ */
2482
+ function safeDutyLineage(lineage, dutyId) {
2483
+ const policy = record(lineage.sourcePolicy);
2484
+ if (policy?.status === 'supported' || policy?.status === 'partial')
2485
+ return lineage;
2486
+ return {
2487
+ object: 'duty_work_lineage',
2488
+ ...(dutyId ? { dutyId } : {}),
2489
+ sourcePolicy: { status: 'unsupported', reason: 'unverified_duty_lineage' },
2490
+ };
2491
+ }
2492
+ /** Recognize the explicit server refusal across both CLI HTTP transports. */
2493
+ function isDutyLineageUnavailable(error) {
2494
+ const e = record(error);
2495
+ if (!e)
2496
+ return false;
2497
+ const expected = 'DUTY_WORK_LINEAGE_SOURCE_UNVERIFIED';
2498
+ const response = record(e.response);
2499
+ const data = record(response?.data);
2500
+ if (e.code === expected || data?.code === expected || data?.error === expected)
2501
+ return true;
2502
+ if (typeof e.body !== 'string')
2503
+ return false;
2504
+ try {
2505
+ const body = record(JSON.parse(e.body));
2506
+ return body?.code === expected || body?.error === expected;
2507
+ }
2508
+ catch {
2509
+ return false;
2510
+ }
2511
+ }
2462
2512
  /** Human view for the duty → work lineage projection. */
2463
2513
  function renderDutyLineage(lineage, log) {
2514
+ lineage = safeDutyLineage(lineage);
2515
+ if (record(lineage.sourcePolicy)?.status === 'unsupported') {
2516
+ log('Work lineage is unavailable because historical source identity cannot be verified.');
2517
+ return;
2518
+ }
2464
2519
  const duty = record(lineage.duty);
2465
2520
  if (duty) {
2466
2521
  log(`Duty: ${text(duty.title, text(duty.id))} (${text(duty.status)})`);
@@ -57,6 +57,8 @@ export declare const ANALYTICS_REPORTS: {
57
57
  };
58
58
  export type AnalyticsReport = keyof typeof ANALYTICS_REPORTS;
59
59
  export declare const ANALYTICS_REPORT_NAMES: AnalyticsReport[];
60
+ export declare function reportRequiresVerifiedHistory(report: AnalyticsReport): boolean;
61
+ export declare function hasVerifiedDutyHistory(value: unknown): boolean;
60
62
  export declare const dutyAnalyticsApi: {
61
63
  prdReadout: (query?: Query) => Promise<Record<string, unknown>>;
62
64
  operationsQueue: (query?: Query) => Promise<Record<string, unknown>>;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.dutyAnalyticsApi = exports.ANALYTICS_REPORT_NAMES = exports.ANALYTICS_REPORTS = void 0;
4
+ exports.reportRequiresVerifiedHistory = reportRequiresVerifiedHistory;
5
+ exports.hasVerifiedDutyHistory = hasVerifiedDutyHistory;
4
6
  exports.renderReportCatalogue = renderReportCatalogue;
5
7
  /**
6
8
  * duty-analytics.ts — client for `/api/duty-analytics`.
@@ -75,6 +77,30 @@ exports.ANALYTICS_REPORTS = {
75
77
  },
76
78
  };
77
79
  exports.ANALYTICS_REPORT_NAMES = Object.keys(exports.ANALYTICS_REPORTS);
80
+ // Legacy analytics responses can join retained records to a recreated Duty by
81
+ // logical ID alone. Do not print those responses without an explicit, current
82
+ // server assertion that the historical source was verified.
83
+ const VERIFIED_HISTORY_REPORTS = new Set([
84
+ 'prd-readout',
85
+ 'operations-queue',
86
+ 'governance-exceptions',
87
+ 'attention-budget',
88
+ 'decision-inbox',
89
+ 'recovery-metrics',
90
+ 'recovery',
91
+ 'dormant-records',
92
+ 'held-surfaces',
93
+ ]);
94
+ function reportRequiresVerifiedHistory(report) {
95
+ return VERIFIED_HISTORY_REPORTS.has(report);
96
+ }
97
+ function hasVerifiedDutyHistory(value) {
98
+ if (!value || typeof value !== 'object' || Array.isArray(value))
99
+ return false;
100
+ const policy = value.sourcePolicy;
101
+ return Boolean(policy && typeof policy === 'object' && !Array.isArray(policy) &&
102
+ policy.status === 'supported');
103
+ }
78
104
  exports.dutyAnalyticsApi = {
79
105
  prdReadout: (query = {}) => data_provider_1.request.get((0, triggers_1.withQuery)(`${MOUNT}/prd-readout`, query)),
80
106
  operationsQueue: (query = {}) => data_provider_1.request.get((0, triggers_1.withQuery)(`${MOUNT}/operations/queue`, query)),
@@ -0,0 +1,2 @@
1
+ /** Describe what the server could prove about existing Task updates. */
2
+ export declare function dutyGoalPropagationNotice(result: Record<string, unknown>, operation: 'link' | 'unlink'): string | null;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dutyGoalPropagationNotice = dutyGoalPropagationNotice;
4
+ /** Describe what the server could prove about existing Task updates. */
5
+ function dutyGoalPropagationNotice(result, operation) {
6
+ const propagation = result.taskPropagation;
7
+ const status = propagation && typeof propagation === 'object' && 'status' in propagation
8
+ ? propagation.status
9
+ : undefined;
10
+ if (status === 'complete' || status === 'supported')
11
+ return null;
12
+ if (status === 'unsupported') {
13
+ return operation === 'unlink'
14
+ ? 'Existing Tasks were not updated and may still refer to this Duty.'
15
+ : 'Existing Tasks were not updated and may not refer to this Duty.';
16
+ }
17
+ return 'Task synchronization could not be verified. Existing Tasks may not reflect this change.';
18
+ }
@@ -0,0 +1,4 @@
1
+ /** Old history endpoints selected rows by logical Duty ID and could return
2
+ * another physical Duty's data after deletion and recreation. Never print an
3
+ * old 200 response unless the server explicitly describes source coverage. */
4
+ export declare function hasVerifiedDutyHistorySource(value: unknown): boolean;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hasVerifiedDutyHistorySource = hasVerifiedDutyHistorySource;
4
+ /** Old history endpoints selected rows by logical Duty ID and could return
5
+ * another physical Duty's data after deletion and recreation. Never print an
6
+ * old 200 response unless the server explicitly describes source coverage. */
7
+ function hasVerifiedDutyHistorySource(value) {
8
+ if (!value || typeof value !== 'object')
9
+ return false;
10
+ const policy = value.sourcePolicy;
11
+ return policy?.status === 'supported' || policy?.status === 'partial';
12
+ }
@@ -2,6 +2,10 @@ export declare function renderActionHistory(page: {
2
2
  data?: unknown[];
3
3
  has_more?: boolean;
4
4
  next_cursor?: string | null;
5
+ coverage?: {
6
+ status?: string;
7
+ reason?: string;
8
+ };
5
9
  } | undefined, log: (line: string) => void): void;
6
10
  export declare function renderReflection(review: Record<string, unknown> | undefined, log: (line: string) => void): void;
7
11
  export declare function renderCadenceDecisions(list: {
@@ -34,6 +34,10 @@ function minutes(ms) {
34
34
  return `${m}m`;
35
35
  }
36
36
  function renderActionHistory(page, log) {
37
+ if (page?.coverage?.status === 'unsupported') {
38
+ log('Action history is unavailable until its historical sources can be verified.');
39
+ return;
40
+ }
37
41
  const rows = (Array.isArray(page?.data) ? page.data : []);
38
42
  if (rows.length === 0) {
39
43
  log('No actions recorded.');
@@ -0,0 +1,4 @@
1
+ export declare const RECEIPT_SOURCE_UNVERIFIED = "DUTY_RECEIPT_SOURCE_UNVERIFIED";
2
+ export declare const RECEIPT_UNAVAILABLE_MESSAGE = "Execution receipt history is unavailable because its source identity cannot be verified.";
3
+ export declare function hasVerifiedReceiptSource(value: unknown): boolean;
4
+ export declare function isReceiptSourceUnverified(error: unknown): boolean;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RECEIPT_UNAVAILABLE_MESSAGE = exports.RECEIPT_SOURCE_UNVERIFIED = void 0;
4
+ exports.hasVerifiedReceiptSource = hasVerifiedReceiptSource;
5
+ exports.isReceiptSourceUnverified = isReceiptSourceUnverified;
6
+ const duty_history_source_1 = require("./duty-history-source");
7
+ exports.RECEIPT_SOURCE_UNVERIFIED = 'DUTY_RECEIPT_SOURCE_UNVERIFIED';
8
+ exports.RECEIPT_UNAVAILABLE_MESSAGE = 'Execution receipt history is unavailable because its source identity cannot be verified.';
9
+ function hasVerifiedReceiptSource(value) {
10
+ return (0, duty_history_source_1.hasVerifiedDutyHistorySource)(value);
11
+ }
12
+ function isReceiptSourceUnverified(error) {
13
+ if (!error || typeof error !== 'object')
14
+ return false;
15
+ const candidate = error;
16
+ return (candidate.code === exports.RECEIPT_SOURCE_UNVERIFIED ||
17
+ candidate.response?.data?.code === exports.RECEIPT_SOURCE_UNVERIFIED ||
18
+ candidate.response?.data?.error === exports.RECEIPT_SOURCE_UNVERIFIED);
19
+ }
@@ -81,6 +81,12 @@ export interface FollowUpRow {
81
81
  reason?: string | null;
82
82
  note?: string | null;
83
83
  } | null;
84
+ /** Set when the last fire was skipped by a gate (the agent's initiative mode, say) rather than moved or run. `note` is the owner's-words reason when the server knows the gate. */
85
+ skipped?: {
86
+ reason: string;
87
+ at?: string | null;
88
+ note?: string | null;
89
+ } | null;
84
90
  capsule?: unknown;
85
91
  nextRunAt?: string | null;
86
92
  deadlineAt?: string | null;
@@ -105,7 +111,21 @@ export interface FollowUpCreateResponse {
105
111
  recorded: string;
106
112
  note: string;
107
113
  };
114
+ /**
115
+ * Set when the agent's initiative mode will refuse this follow-up when it comes due (OSK-23479):
116
+ * what the mode does to it, how to change the mode, and for an agent-worded reminder the way to
117
+ * get the literal text delivered regardless.
118
+ */
119
+ gateAdvisory?: {
120
+ reason: string;
121
+ headline: string;
122
+ text: string;
123
+ remedy: string;
124
+ alternative?: string;
125
+ };
108
126
  }
127
+ /** A heads-up that the follow-up just made will be refused at its due time, with the way out. */
128
+ export declare function gateAdvisoryNotice(response: FollowUpCreateResponse): string | undefined;
109
129
  /** One line telling a person the follow-up was recorded with weaker provenance than claimed. */
110
130
  export declare function producerDowngradeNotice(response: FollowUpCreateResponse): string | undefined;
111
131
  /**
@@ -4,6 +4,7 @@ exports.followupsApi = exports.FOLLOWUP_SUBJECT_FLAG_HELP = exports.FOLLOWUP_SUB
4
4
  exports.whenFlagProblem = whenFlagProblem;
5
5
  exports.settledLine = settledLine;
6
6
  exports.recipeWatchBoundsRefusal = recipeWatchBoundsRefusal;
7
+ exports.gateAdvisoryNotice = gateAdvisoryNotice;
7
8
  exports.producerDowngradeNotice = producerDowngradeNotice;
8
9
  exports.reusedWithoutChangeMessage = reusedWithoutChangeMessage;
9
10
  exports.resolveFollowUpAgent = resolveFollowUpAgent;
@@ -129,6 +130,15 @@ function recipeWatchBoundsRefusal(waitKind, passed) {
129
130
  : 'A recipe watch ends through its --wait.',
130
131
  ].join(' ');
131
132
  }
133
+ /** A heads-up that the follow-up just made will be refused at its due time, with the way out. */
134
+ function gateAdvisoryNotice(response) {
135
+ const advisory = response.gateAdvisory;
136
+ if (!advisory)
137
+ return undefined;
138
+ return ['Heads up:', advisory.text, advisory.alternative, advisory.remedy]
139
+ .filter(Boolean)
140
+ .join(' ');
141
+ }
132
142
  /** One line telling a person the follow-up was recorded with weaker provenance than claimed. */
133
143
  function producerDowngradeNotice(response) {
134
144
  const downgraded = response.producerDowngraded;
@@ -1,4 +1,26 @@
1
1
  import type { HeldOwnerMessages } from '@skrr-ai/data-provider';
2
+ /**
3
+ * Whether a thrown error is that refusal. The status alone is not enough: the same route also
4
+ * answers 400 `Invalid cursor`, which is a different problem with a different remedy.
5
+ */
6
+ export declare function isWorkspaceContextRequired(err: unknown): boolean;
7
+ /**
8
+ * What to tell the caller when the server answered "Workspace context required". It depends on
9
+ * what the request actually carried, because the same refusal has two causes with different fixes:
10
+ *
11
+ * - NO workspace was sent (none selected, and the agent's own could not be read): pass one.
12
+ * - A workspace WAS sent, whether the caller's or the agent's own that the CLI defaulted to. The
13
+ * server sets `req.workspace` only for a workspace the caller belongs to and passes anything
14
+ * else through as null, so this means the caller is not a member of it (or it does not exist).
15
+ * Saying "none was selected" here would be false, and found live: an agent whose workspace the
16
+ * caller can see through a direct grant but does not belong to.
17
+ *
18
+ * `sentWorkspaceId` is the workspace the request carried (`withWorkspaceHeader`).
19
+ */
20
+ export declare function heldMessagesWorkspaceRefusal(sentWorkspaceId: string | null | undefined): {
21
+ message: string;
22
+ suggestion: string;
23
+ };
2
24
  /** The sentence for a reason code, or an explicit "unrecognised" line carrying the code. */
3
25
  export declare function heldReasonLabel(reason: string): string;
4
26
  /**
@@ -1,8 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isWorkspaceContextRequired = isWorkspaceContextRequired;
4
+ exports.heldMessagesWorkspaceRefusal = heldMessagesWorkspaceRefusal;
3
5
  exports.heldReasonLabel = heldReasonLabel;
4
6
  exports.parseHeldOwnerMessages = parseHeldOwnerMessages;
5
7
  exports.heldMessageLines = heldMessageLines;
8
+ const http_error_1 = require("./http-error");
6
9
  /**
7
10
  * Presentation of `GET /api/agents/:id/always-on/held-messages` for `skrr agents always-on
8
11
  * held-messages`.
@@ -35,6 +38,58 @@ const HELD_REASON_LABELS = {
35
38
  rate_limit: 'Held by an attention rate limit',
36
39
  check_unavailable: 'A delivery check was unavailable',
37
40
  };
41
+ /**
42
+ * What the server's `heldMessages` controller answers (HTTP 400) to a request that names no
43
+ * workspace. That route scopes the read to one workspace and, unlike `always-on status`, does not
44
+ * fall back to the agent's own, so a CLI session that never selected one gets this and nothing else.
45
+ * `skrr workspaces list` says an unselected session "resolves to your default workspace"; that holds
46
+ * for other routes, not this one.
47
+ */
48
+ const WORKSPACE_REQUIRED_TEXT = 'Workspace context required';
49
+ /**
50
+ * Whether a thrown error is that refusal. The status alone is not enough: the same route also
51
+ * answers 400 `Invalid cursor`, which is a different problem with a different remedy.
52
+ */
53
+ function isWorkspaceContextRequired(err) {
54
+ if ((0, http_error_1.httpStatusOf)(err) !== 400)
55
+ return false;
56
+ const record = typeof err === 'object' && err !== null ? err : {};
57
+ const body = record.body;
58
+ const bodyRecord = typeof body === 'object' && body !== null ? body : {};
59
+ return [record.message, bodyRecord.message, bodyRecord.error, body].some((text) => typeof text === 'string' && text.includes(WORKSPACE_REQUIRED_TEXT));
60
+ }
61
+ /**
62
+ * What to tell the caller when the server answered "Workspace context required". It depends on
63
+ * what the request actually carried, because the same refusal has two causes with different fixes:
64
+ *
65
+ * - NO workspace was sent (none selected, and the agent's own could not be read): pass one.
66
+ * - A workspace WAS sent, whether the caller's or the agent's own that the CLI defaulted to. The
67
+ * server sets `req.workspace` only for a workspace the caller belongs to and passes anything
68
+ * else through as null, so this means the caller is not a member of it (or it does not exist).
69
+ * Saying "none was selected" here would be false, and found live: an agent whose workspace the
70
+ * caller can see through a direct grant but does not belong to.
71
+ *
72
+ * `sentWorkspaceId` is the workspace the request carried (`withWorkspaceHeader`).
73
+ */
74
+ function heldMessagesWorkspaceRefusal(sentWorkspaceId) {
75
+ const sent = sentWorkspaceId?.trim();
76
+ if (sent) {
77
+ return {
78
+ message: `The server did not accept workspace ${sent} for this read. Held messages are listed per ` +
79
+ 'workspace you belong to, and this usually means you are not a member of it (or it does ' +
80
+ 'not exist).',
81
+ suggestion: 'Pass --workspace <workspace-id> for a workspace of yours, or run `skrr workspaces use ' +
82
+ '<workspace-id>`. `skrr workspaces list` shows the ones you belong to.',
83
+ };
84
+ }
85
+ return {
86
+ message: 'The server scopes held messages to a workspace, and none was selected for this request. ' +
87
+ "The agent's own workspace could not be determined either.",
88
+ suggestion: 'Pass --workspace <workspace-id>, or run `skrr workspaces use <workspace-id>`. ' +
89
+ '`skrr workspaces list` shows yours, and `skrr agents always-on status <agent-id>` prints ' +
90
+ "the agent's workspace on its 'Agent workspace' line.",
91
+ };
92
+ }
38
93
  /** The sentence for a reason code, or an explicit "unrecognised" line carrying the code. */
39
94
  function heldReasonLabel(reason) {
40
95
  return HELD_REASON_LABELS[reason] ?? `Unrecognised reason: ${reason}`;
@@ -0,0 +1,40 @@
1
+ /** Which workspace a list reads, and why (OSK-21284). */
2
+ export type ListWorkspaceScope = {
3
+ source: 'all';
4
+ } | {
5
+ source: 'default';
6
+ workspaceId: string;
7
+ workspaceName?: string;
8
+ workspaceCount: number;
9
+ };
10
+ /**
11
+ * A plain `tasks list` named no workspace, and the server answers that with a list across EVERY
12
+ * workspace the person belongs to. Its access filter has branches that belong to no single
13
+ * workspace, so no index can serve it in order: on production it timed out after about 6 s while
14
+ * the same list naming a workspace answered in about a second. `skrr workspaces list` already says
15
+ * an unselected session "resolves to your default workspace"; a list now reads it too.
16
+ *
17
+ * --all-workspaces the old, wider list, asked for by name (`workspaceScope=all`)
18
+ * a selected workspace, `--workspace`, or `skrr workspaces use` untouched: the choice stands
19
+ * an autonomous Agent session untouched: a workspace-less Agent session stays personal
20
+ * `--space`, `--calendar` untouched: a Space names its own scope
21
+ *
22
+ * Returns nothing when there is nothing to apply, and `source: 'default'` when the caller's
23
+ * default workspace should be used. `lookupDefault` is injected so the rule is tested without the
24
+ * network; a lookup that fails or finds no default changes nothing.
25
+ */
26
+ export declare function resolveListWorkspace(flags: {
27
+ 'all-workspaces'?: boolean;
28
+ space?: string;
29
+ calendar?: string;
30
+ }, env: NodeJS.ProcessEnv, lookupDefault: () => Promise<{
31
+ id: string;
32
+ name?: string;
33
+ count: number;
34
+ } | null>): Promise<ListWorkspaceScope | undefined>;
35
+ /** The default workspace the signed-in person's `skrr workspaces list` reports. */
36
+ export declare function lookupDefaultWorkspace(): Promise<{
37
+ id: string;
38
+ name?: string;
39
+ count: number;
40
+ } | null>;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveListWorkspace = resolveListWorkspace;
4
+ exports.lookupDefaultWorkspace = lookupDefaultWorkspace;
5
+ const workspaces_1 = require("./workspaces");
6
+ /**
7
+ * A plain `tasks list` named no workspace, and the server answers that with a list across EVERY
8
+ * workspace the person belongs to. Its access filter has branches that belong to no single
9
+ * workspace, so no index can serve it in order: on production it timed out after about 6 s while
10
+ * the same list naming a workspace answered in about a second. `skrr workspaces list` already says
11
+ * an unselected session "resolves to your default workspace"; a list now reads it too.
12
+ *
13
+ * --all-workspaces the old, wider list, asked for by name (`workspaceScope=all`)
14
+ * a selected workspace, `--workspace`, or `skrr workspaces use` untouched: the choice stands
15
+ * an autonomous Agent session untouched: a workspace-less Agent session stays personal
16
+ * `--space`, `--calendar` untouched: a Space names its own scope
17
+ *
18
+ * Returns nothing when there is nothing to apply, and `source: 'default'` when the caller's
19
+ * default workspace should be used. `lookupDefault` is injected so the rule is tested without the
20
+ * network; a lookup that fails or finds no default changes nothing.
21
+ */
22
+ async function resolveListWorkspace(flags, env, lookupDefault) {
23
+ if (flags['all-workspaces'])
24
+ return { source: 'all' };
25
+ if (env.OVERSKY_WORKSPACE_ID?.trim())
26
+ return undefined;
27
+ if (env.OVERSKY_AUTONOMOUS_SESSION === '1')
28
+ return undefined;
29
+ if (flags.space || flags.calendar)
30
+ return undefined;
31
+ let found = null;
32
+ try {
33
+ found = await lookupDefault();
34
+ }
35
+ catch {
36
+ return undefined;
37
+ }
38
+ if (!found?.id)
39
+ return undefined;
40
+ return {
41
+ source: 'default',
42
+ workspaceId: found.id,
43
+ ...(found.name ? { workspaceName: found.name } : {}),
44
+ workspaceCount: found.count,
45
+ };
46
+ }
47
+ /** The default workspace the signed-in person's `skrr workspaces list` reports. */
48
+ async function lookupDefaultWorkspace() {
49
+ const listing = await (0, workspaces_1.listWorkspaceListing)();
50
+ if (!listing.defaultWorkspaceId)
51
+ return null;
52
+ const row = listing.rows.find((entry) => entry.id === listing.defaultWorkspaceId);
53
+ return {
54
+ id: listing.defaultWorkspaceId,
55
+ ...(row?.name ? { name: row.name } : {}),
56
+ count: listing.rows.length,
57
+ };
58
+ }
@@ -0,0 +1,59 @@
1
+ import { type MiniComputerLayoutChangeResult, type MiniComputerLayoutOp } from '@skrr-ai/data-provider';
2
+ /**
3
+ * The CLI half of the Mini Computer records (Dynamic Agent Apps D3, D5): the words for what the server refused,
4
+ * the Tasks view a set of flags describes, and the lines a read prints. The records, their limits and their
5
+ * vocabularies are `@skrr-ai/data-provider` `miniComputer/`; nothing is declared again here.
6
+ */
7
+ export interface MiniComputerRefusal {
8
+ status?: number;
9
+ code: string;
10
+ issue?: string;
11
+ message?: string;
12
+ currentRev?: number;
13
+ opCode?: string;
14
+ opIndex?: number;
15
+ }
16
+ /** Read a refusal out of an API error, or null when the error is not one the Mini Computer routes made. */
17
+ export declare function readMiniComputerRefusal(error: unknown): MiniComputerRefusal | null;
18
+ export interface MiniComputerFailure {
19
+ message: string;
20
+ code: string;
21
+ exit: number;
22
+ retryable: boolean;
23
+ }
24
+ export declare const MINI_COMPUTER_REFUSAL_CODES: string[];
25
+ export declare function describeMiniComputerRefusal(refusal: MiniComputerRefusal, bin?: string): MiniComputerFailure | null;
26
+ export interface TasksViewFlags {
27
+ name?: string;
28
+ type?: string;
29
+ 'group-by'?: string;
30
+ sort?: string;
31
+ 'sort-dir'?: string;
32
+ 'quick-filter'?: string;
33
+ status?: string[];
34
+ priority?: string[];
35
+ label?: string[];
36
+ assignee?: string[];
37
+ search?: string;
38
+ 'date-field'?: string;
39
+ 'date-preset'?: string;
40
+ after?: string;
41
+ before?: string;
42
+ }
43
+ /**
44
+ * The Tasks mini app configuration a set of flags describes (the server validates it again; this only shapes it).
45
+ * `type` is required: a view with no layout is not a view.
46
+ */
47
+ export declare function tasksConfigFromFlags(flags: TasksViewFlags): {
48
+ view: Record<string, unknown>;
49
+ };
50
+ export declare const TASKS_VIEW_DATE_FIELDS: readonly import("@skrr-ai/data-provider").DateFilterField[];
51
+ export declare const TASKS_VIEW_DATE_PRESETS: readonly import("@skrr-ai/data-provider").DateFilterPreset[];
52
+ /** One app's slot, in lines. */
53
+ export declare function formatMiniAppConfig(raw: unknown): string[];
54
+ /** The layout a person sees, in lines: the dock, the home grid, the folders, what is hidden, and what waits. */
55
+ export declare function formatMiniComputerLayout(raw: unknown): string[];
56
+ /** What a change answered, in lines for the Agent that asked. */
57
+ export declare function formatLayoutChangeResult(result: MiniComputerLayoutChangeResult): string[];
58
+ /** Operations from `--ops` or `--file` JSON text. Returns the raw array for the server to validate. */
59
+ export declare function parseOpsText(text: string): MiniComputerLayoutOp[];