@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
@@ -4,6 +4,7 @@ const core_1 = require("@oclif/core");
4
4
  const base_command_1 = require("../../base-command");
5
5
  const duties_1 = require("../../lib/duties");
6
6
  const duty_product_1 = require("../../lib/duty-product");
7
+ const duty_receipt_source_1 = require("../../lib/duty-receipt-source");
7
8
  class DutiesReceipt extends base_command_1.BaseCommand {
8
9
  static description = 'Explain what happened from the event through work, delivery, and verification';
9
10
  static examples = [
@@ -33,6 +34,9 @@ class DutiesReceipt extends base_command_1.BaseCommand {
33
34
  checkId: flags.check,
34
35
  runId: flags.run,
35
36
  });
37
+ if (!(0, duty_receipt_source_1.hasVerifiedReceiptSource)(result)) {
38
+ this.error(duty_receipt_source_1.RECEIPT_UNAVAILABLE_MESSAGE, { code: duty_receipt_source_1.RECEIPT_SOURCE_UNVERIFIED });
39
+ }
36
40
  if (flags.json)
37
41
  return this.log(JSON.stringify(result, null, 2));
38
42
  if (!result.receipts.length)
@@ -41,6 +45,9 @@ class DutiesReceipt extends base_command_1.BaseCommand {
41
45
  (0, duty_product_1.renderExecutionReceipt)(receipt, (line) => this.log(line), flags.verbose);
42
46
  }
43
47
  catch (error) {
48
+ if ((0, duty_receipt_source_1.isReceiptSourceUnverified)(error)) {
49
+ this.error(duty_receipt_source_1.RECEIPT_UNAVAILABLE_MESSAGE, { code: duty_receipt_source_1.RECEIPT_SOURCE_UNVERIFIED });
50
+ }
44
51
  this.handleApiError(error);
45
52
  }
46
53
  }
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
4
  const base_command_1 = require("../../base-command");
5
5
  const duties_1 = require("../../lib/duties");
6
- const duty_loop_status_1 = require("../../lib/duty-loop-status");
7
6
  /**
8
7
  * Every Duty one agent holds — system roles included — with whether its
9
8
  * loop is actually installed and working: what it watches, when it next wakes,
@@ -23,17 +22,24 @@ class DutiesRoster extends base_command_1.BaseCommand {
23
22
  this.requireAuth();
24
23
  const { flags } = await this.parse(DutiesRoster);
25
24
  try {
26
- const roster = await duties_1.dutyApi.roster(flags.agent);
27
- if (flags.json) {
28
- this.log(JSON.stringify(roster, null, 2));
29
- return;
30
- }
31
- for (const line of (0, duty_loop_status_1.formatDutyRoster)(roster))
32
- this.log(line);
25
+ // A successful old-server response can include history joined by
26
+ // logical ID. Do not expose those rows, including in --json.
27
+ await duties_1.dutyApi.roster(flags.agent);
33
28
  }
34
29
  catch (err) {
30
+ const code = err
31
+ ?.response?.data;
32
+ if (code?.error === 'DUTY_ROSTER_SOURCE_UNVERIFIED' ||
33
+ code?.code === 'DUTY_ROSTER_SOURCE_UNVERIFIED') {
34
+ this.error('Duty roster is unavailable because its historical source identity cannot be verified.', {
35
+ code: 'DUTY_ROSTER_SOURCE_UNVERIFIED',
36
+ });
37
+ }
35
38
  this.handleApiError(err);
36
39
  }
40
+ this.error('Duty roster is unavailable because its historical source identity cannot be verified.', {
41
+ code: 'DUTY_ROSTER_SOURCE_UNVERIFIED',
42
+ });
37
43
  }
38
44
  }
39
45
  exports.default = DutiesRoster;
@@ -6,6 +6,7 @@ const base_command_1 = require("../../base-command");
6
6
  const duties_1 = require("../../lib/duties");
7
7
  const web_url_1 = require("../../lib/web-url");
8
8
  const duty_product_1 = require("../../lib/duty-product");
9
+ const duty_receipt_source_1 = require("../../lib/duty-receipt-source");
9
10
  /**
10
11
  * What `show --json` prints, said where the flag is read (OSK-21334, from OSK-21205): the server's
11
12
  * read envelope, with the duty UNDER `.duty`. `create --json` and `update --json` print
@@ -62,7 +63,10 @@ class DutiesShow extends base_command_1.BaseCommand {
62
63
  this.log(`Duty ${args.id} not found.`);
63
64
  return;
64
65
  }
65
- (0, duties_1.renderDutySummary)((0, duties_1.withLiveAssessment)(response.duty, response.operatingState), (line) => this.log(line), response.latestCheck, response.scheduleIssues);
66
+ (0, duties_1.renderDutySummary)((0, duties_1.withLiveAssessment)(response.duty, response.operatingState, response.historyUnavailable), (line) => this.log(line), response.latestCheck, response.scheduleIssues);
67
+ if (response.historyUnavailable || response.operatingState === null) {
68
+ this.log('Duty history is unavailable because its source identity cannot be verified.');
69
+ }
66
70
  for (const line of (0, duties_1.pendingCadenceRequestLines)(response.duty))
67
71
  this.log(line);
68
72
  // Whose permissions a run uses (OSK-11975) — read from the operating state,
@@ -75,6 +79,11 @@ class DutiesShow extends base_command_1.BaseCommand {
75
79
  // invisible until you knew to run `links list` (OSK-10963).
76
80
  try {
77
81
  const links = await duties_1.dutyApi.workLinks(args.id);
82
+ const sourcePolicy = links
83
+ .sourcePolicy;
84
+ if (sourcePolicy?.status !== 'supported') {
85
+ throw new Error('Duty work link source access cannot be verified');
86
+ }
78
87
  const active = (links.data || []).filter((link) => link.status === 'active');
79
88
  if (active.length) {
80
89
  this.log('Links:');
@@ -85,34 +94,43 @@ class DutiesShow extends base_command_1.BaseCommand {
85
94
  }
86
95
  }
87
96
  catch {
88
- // The header still stands on its own when the links read is unavailable.
97
+ this.log('Linked work is unavailable while source access cannot be verified.');
89
98
  }
90
99
  // `goals link` writes goal.dutyId — an edge that lives on the GOAL,
91
100
  // so `links list` can never see it. The lineage projection aggregates both
92
101
  // link models; without it, a goal the duty visibly advances is
93
102
  // unrenderable from its own headline view (OSK-10963).
94
103
  try {
95
- const lineage = await duties_1.dutyApi.workLineage(args.id, 50);
104
+ const lineage = (0, duties_1.safeDutyLineage)(await duties_1.dutyApi.workLineage(args.id, 50), args.id);
105
+ const sourcePolicy = lineage.sourcePolicy;
96
106
  const hasAny = ['goals', 'tasks', 'runs'].some((key) => Array.isArray(lineage?.[key]) && lineage[key].length > 0);
97
- if (hasAny) {
107
+ if (hasAny || sourcePolicy?.status === 'unsupported') {
98
108
  this.log('');
99
109
  (0, duties_1.renderDutyLineage)(lineage, (line) => this.log(line));
100
110
  }
101
111
  }
102
- catch {
103
- // Lineage is a hint on the headline view, not load-bearing.
112
+ catch (err) {
113
+ if ((0, duties_1.isDutyLineageUnavailable)(err)) {
114
+ this.log('Work lineage is unavailable because historical source identity cannot be verified.');
115
+ }
116
+ // Other lineage read failures remain a non-load-bearing hint.
104
117
  }
105
118
  try {
106
119
  const receipts = await duties_1.dutyApi.receipts(args.id, 1);
107
- if (receipts.receipts[0]) {
120
+ if (!(0, duty_receipt_source_1.hasVerifiedReceiptSource)(receipts)) {
121
+ this.log(duty_receipt_source_1.RECEIPT_UNAVAILABLE_MESSAGE);
122
+ }
123
+ else if (receipts.receipts[0]) {
108
124
  this.log('');
109
125
  (0, duty_product_1.renderExecutionReceipt)(receipts.receipts[0], (line) => this.log(line), flags.verbose);
110
126
  }
111
127
  else
112
128
  this.log('No wake has been observed yet.');
113
129
  }
114
- catch {
115
- this.log('Execution receipt is unavailable. Retry with duties receipt <id> --latest.');
130
+ catch (error) {
131
+ this.log((0, duty_receipt_source_1.isReceiptSourceUnverified)(error)
132
+ ? duty_receipt_source_1.RECEIPT_UNAVAILABLE_MESSAGE
133
+ : 'Execution receipt is unavailable. Retry with duties receipt <id> --latest.');
116
134
  }
117
135
  if (flags.verbose && response.latestCheck) {
118
136
  this.log('');
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
4
  const base_command_1 = require("../../base-command");
5
5
  const duties_1 = require("../../lib/duties");
6
- const duty_loop_status_1 = require("../../lib/duty-loop-status");
7
6
  /**
8
7
  * Is this duty's loop installed and working? Names the loop state and
9
8
  * why, the next wakes, each watched source's access, the last stop and its
@@ -23,19 +22,29 @@ class DutiesStatus extends base_command_1.BaseCommand {
23
22
  };
24
23
  async run() {
25
24
  this.requireAuth();
26
- const { args, flags } = await this.parse(DutiesStatus);
25
+ const { args } = await this.parse(DutiesStatus);
27
26
  try {
28
- const status = await duties_1.dutyApi.loopStatus(args.dutyId);
29
- if (flags.json) {
30
- this.log(JSON.stringify(status, null, 2));
31
- return;
32
- }
33
- for (const line of (0, duty_loop_status_1.formatDutyLoopStatus)(status))
34
- this.log(line);
27
+ // Older servers can return a successful response that associates Check
28
+ // and Run history by logical Duty ID alone. Its provenance is not
29
+ // verifiable, including in machine-readable output.
30
+ await duties_1.dutyApi.loopStatus(args.dutyId);
35
31
  }
36
32
  catch (err) {
33
+ const code = err
34
+ ?.response?.data;
35
+ if (code?.error === 'DUTY_LOOP_STATUS_SOURCE_UNVERIFIED' ||
36
+ code?.code === 'DUTY_LOOP_STATUS_SOURCE_UNVERIFIED') {
37
+ this.error('Loop status is unavailable because its historical source identity cannot be verified.', {
38
+ code: 'DUTY_LOOP_STATUS_SOURCE_UNVERIFIED',
39
+ });
40
+ }
37
41
  this.handleApiError(err);
38
42
  }
43
+ // Until a verified provenance contract is available, do not display an
44
+ // old server's successful response. Preserve the same error for --json.
45
+ this.error('Loop status is unavailable because its historical source identity cannot be verified.', {
46
+ code: 'DUTY_LOOP_STATUS_SOURCE_UNVERIFIED',
47
+ });
39
48
  }
40
49
  }
41
50
  exports.default = DutiesStatus;
@@ -19,6 +19,8 @@ export default class DutiesTriggerStatus extends BaseCommand {
19
19
  };
20
20
  run(): Promise<void>;
21
21
  }
22
+ /** Hide unverified legacy fields in JSON as well as human output. */
23
+ export declare function safeTriggerStatus(status: Record<string, unknown>): Record<string, unknown>;
22
24
  /**
23
25
  * Pure formatter for the duty trigger-status read-model. Kept separate so
24
26
  * it can be unit-tested without a live API, and so the command body stays a thin
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.safeTriggerStatus = safeTriggerStatus;
3
4
  exports.formatTriggerStatus = formatTriggerStatus;
4
5
  const core_1 = require("@oclif/core");
5
6
  const base_command_1 = require("../../base-command");
@@ -32,7 +33,7 @@ class DutiesTriggerStatus extends base_command_1.BaseCommand {
32
33
  const { args, flags } = await this.parse(DutiesTriggerStatus);
33
34
  let status;
34
35
  try {
35
- status = await duties_1.dutyApi.triggerStatus(args.dutyId, flags.limit);
36
+ status = safeTriggerStatus(await duties_1.dutyApi.triggerStatus(args.dutyId, flags.limit));
36
37
  }
37
38
  catch (err) {
38
39
  this.handleApiError(err);
@@ -49,6 +50,16 @@ class DutiesTriggerStatus extends base_command_1.BaseCommand {
49
50
  }
50
51
  }
51
52
  exports.default = DutiesTriggerStatus;
53
+ /** Hide unverified legacy fields in JSON as well as human output. */
54
+ function safeTriggerStatus(status) {
55
+ const policy = status.sourcePolicy;
56
+ if (['complete', 'partial'].includes(String(policy?.status)))
57
+ return status;
58
+ return {
59
+ dutyId: status.dutyId,
60
+ sourcePolicy: { status: 'unsupported', reason: 'unverified_duty_lineage' },
61
+ };
62
+ }
52
63
  function fmtTime(value) {
53
64
  if (!value)
54
65
  return '-';
@@ -63,6 +74,13 @@ function fmtTime(value) {
63
74
  function formatTriggerStatus(status) {
64
75
  const lines = [];
65
76
  const dutyId = String(status.dutyId ?? '-');
77
+ const sourcePolicy = status.sourcePolicy;
78
+ if (!['complete', 'partial'].includes(String(sourcePolicy?.status))) {
79
+ return [
80
+ `Trigger status for ${dutyId}: unavailable.`,
81
+ 'The historical sources cannot be verified for this Duty. This does not mean no triggers or fires exist.',
82
+ ];
83
+ }
66
84
  lines.push(`Trigger status for ${dutyId} (plan generation ${String(status.planGeneration ?? '-')})`);
67
85
  // OSK-10961: the one-word answer an operator came for — did the plan
68
86
  // materialize. Absent on older servers; only rendered when present.
@@ -6,6 +6,8 @@ import { type DutyWakeCapabilities } from '../../lib/duties';
6
6
  * wake would fire (OSK-15428, OSK-15419). It still says what a source does, conditionally.
7
7
  */
8
8
  export declare function wakePolicyHeadline(_result?: unknown): string;
9
+ /** Do not pass legacy standing rows through --json without source proof. */
10
+ export declare function safeWakeCapabilities(result: DutyWakeCapabilities): DutyWakeCapabilities;
9
11
  /**
10
12
  * The lines above the table. The table is what the Agent may PICK; what is bound is the server's
11
13
  * `trigger-status` event-wake block, printed by the same function in the same words, so the two
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.wakePolicyHeadline = wakePolicyHeadline;
4
+ exports.safeWakeCapabilities = safeWakeCapabilities;
4
5
  exports.wakePolicyLines = wakePolicyLines;
5
6
  exports.describeUnavailable = describeUnavailable;
6
7
  const core_1 = require("@oclif/core");
@@ -17,6 +18,18 @@ const duty_attention_copy_1 = require("../../lib/duty-attention-copy");
17
18
  function wakePolicyHeadline(_result) {
18
19
  return 'Wake behavior: configured sources may wake the Agent within lifecycle and execution budgets, once an event wake is bound to them.';
19
20
  }
21
+ /** Do not pass legacy standing rows through --json without source proof. */
22
+ function safeWakeCapabilities(result) {
23
+ if (result.sourcePolicy?.status === 'unsupported') {
24
+ return { eligibleCapabilities: [], visibleCapabilities: [],
25
+ sourcePolicy: { status: 'unsupported', reason: 'unverified_duty_lineage' } };
26
+ }
27
+ if (['complete', 'partial'].includes(String(result.standingEventWakesSourcePolicy?.status)) &&
28
+ result.standingEventWakes?.sourcePolicy?.status !== 'unsupported')
29
+ return result;
30
+ return { ...result, standingEventWakes: null,
31
+ standingEventWakesSourcePolicy: { status: 'unsupported', reason: 'unverified_duty_lineage' } };
32
+ }
20
33
  /**
21
34
  * The lines above the table. The table is what the Agent may PICK; what is bound is the server's
22
35
  * `trigger-status` event-wake block, printed by the same function in the same words, so the two
@@ -26,10 +39,25 @@ function wakePolicyHeadline(_result) {
26
39
  function wakePolicyLines(result) {
27
40
  const wakes = result?.standingEventWakes;
28
41
  const pickable = 'The table lists wakes the Agent may pick, not what is bound.';
42
+ if (result?.sourcePolicy?.status === 'unsupported') {
43
+ return [
44
+ 'Wake capabilities are unavailable because their sources cannot be verified for this Duty.',
45
+ 'This does not mean no wake capabilities or triggers exist.',
46
+ ];
47
+ }
48
+ if (!['complete', 'partial'].includes(String(result?.standingEventWakesSourcePolicy?.status)) ||
49
+ wakes?.sourcePolicy?.status === 'unsupported') {
50
+ return [
51
+ wakePolicyHeadline(),
52
+ pickable,
53
+ 'Current trigger bindings are unavailable because their sources cannot be verified for this Duty.',
54
+ 'This does not mean no triggers exist.',
55
+ ];
56
+ }
29
57
  if (!wakes) {
30
58
  return [
31
59
  wakePolicyHeadline(),
32
- `${pickable} \`skrr duties trigger-status <id>\` shows what is bound.`,
60
+ `${pickable} \`skrr duties trigger-status <id>\` may show what is bound when the sources are available.`,
33
61
  ];
34
62
  }
35
63
  const lines = [wakePolicyHeadline(), pickable];
@@ -86,7 +114,7 @@ class DutiesWakeCapabilities extends base_command_1.BaseCommand {
86
114
  const { args, flags } = await this.parse(DutiesWakeCapabilities);
87
115
  let result;
88
116
  try {
89
- result = await duties_1.dutyApi.wakeCapabilities(args.dutyId);
117
+ result = safeWakeCapabilities(await duties_1.dutyApi.wakeCapabilities(args.dutyId));
90
118
  }
91
119
  catch (err) {
92
120
  this.handleApiError(err);
@@ -97,6 +125,8 @@ class DutiesWakeCapabilities extends base_command_1.BaseCommand {
97
125
  }
98
126
  for (const line of wakePolicyLines(result))
99
127
  this.log(line);
128
+ if (result.sourcePolicy?.status === 'unsupported')
129
+ return;
100
130
  // The owner's allowlist of event sources (OSK-21113): the response does not carry it, and for
101
131
  // unset, [], a bogus name and a real source this output was byte-identical. Read from the
102
132
  // Duty's own policy; unread, the line is left out rather than claim "all allowed".
@@ -103,6 +103,9 @@ class FollowupsAct extends base_command_1.BaseCommand {
103
103
  const producerNotice = (0, followups_1.producerDowngradeNotice)(response);
104
104
  if (producerNotice)
105
105
  this.log(producerNotice);
106
+ const advisory = (0, followups_1.gateAdvisoryNotice)(response);
107
+ if (advisory)
108
+ this.log(advisory);
106
109
  const row = response.followup;
107
110
  if (response.reused) {
108
111
  this.log((0, followups_1.reusedWithoutChangeMessage)(row, 'the same act on this subject'));
@@ -34,10 +34,16 @@ class FollowupsRemind extends base_command_1.BaseCommand {
34
34
  description: 'Wake the agent to word the reminder (needs an agent context)',
35
35
  default: false,
36
36
  }),
37
- agent: core_1.Flags.string({ description: 'Agent ID (default: bound session agent). Attribution only unless --active is set' }),
37
+ agent: core_1.Flags.string({
38
+ description: 'Agent ID (default: bound session agent). Attribution only unless --active is set',
39
+ }),
38
40
  endpoint: core_1.Flags.string({ description: 'Active only: delivery endpoint id; requires --active' }),
39
- 'endpoint-target': core_1.Flags.string({ description: 'Active only: channel target for a channel endpoint; requires --active' }),
40
- pin: core_1.Flags.string({ description: 'Active only: deliver into this conversation; requires --active. Do not combine with --endpoint other than pinned' }),
41
+ 'endpoint-target': core_1.Flags.string({
42
+ description: 'Active only: channel target for a channel endpoint; requires --active',
43
+ }),
44
+ pin: core_1.Flags.string({
45
+ description: 'Active only: deliver into this conversation; requires --active. Do not combine with --endpoint other than pinned',
46
+ }),
41
47
  json: core_1.Flags.boolean({ description: 'Output as JSON' }),
42
48
  };
43
49
  async run() {
@@ -105,6 +111,9 @@ class FollowupsRemind extends base_command_1.BaseCommand {
105
111
  const producerNotice = (0, followups_1.producerDowngradeNotice)(response);
106
112
  if (producerNotice)
107
113
  this.log(producerNotice);
114
+ const advisory = (0, followups_1.gateAdvisoryNotice)(response);
115
+ if (advisory)
116
+ this.log(advisory);
108
117
  const row = response.followup;
109
118
  if (response.reused && response.rescheduled) {
110
119
  this.log(`Moved: ${row?.id} now fires at ${row?.nextRunAt ?? at} — the same reminder already existed, so it was rescheduled rather than duplicated.`);
@@ -69,6 +69,12 @@ class FollowupsShow extends base_command_1.BaseCommand {
69
69
  ? `moved to ${row.held.until} — ${row.held.note ?? row.held.reason ?? 'it could not run when it came due'}`
70
70
  : undefined,
71
71
  ],
72
+ [
73
+ 'skipped',
74
+ row.skipped && !row.terminal
75
+ ? `${row.skipped.at ? `${row.skipped.at} — ` : ''}${row.skipped.note ?? row.skipped.reason}`
76
+ : undefined,
77
+ ],
72
78
  ['escalated to', row.escalatedInitiativeId],
73
79
  ]) {
74
80
  if (value)
@@ -99,7 +99,7 @@ class HarnessesQuota extends base_command_1.BaseCommand {
99
99
  this.failWithCliError({ message: 'This server returned an unsupported current quota response. Use --since-days 1 for history.', code: 'QUOTA_CURRENT_UNSUPPORTED', exit: 1, retryable: false });
100
100
  }
101
101
  if (flags.json)
102
- this.log(JSON.stringify(report, null, 2));
102
+ this.printJsonResult(report);
103
103
  else
104
104
  for (const line of currentQuotaLines(report))
105
105
  this.log(line);
@@ -104,16 +104,16 @@ class SpacesMembersAdd extends base_command_1.BaseCommand {
104
104
  accessRoleId,
105
105
  })),
106
106
  ];
107
- let current;
108
107
  let result;
109
108
  try {
110
- current = await data_provider_1.dataService.getResourcePermissions(data_provider_1.ResourceType.SPACE, spaceRef);
111
- result = await data_provider_1.dataService.updateResourcePermissions(data_provider_1.ResourceType.SPACE, spaceRef, {
109
+ // `public` is left out on purpose: the server reads a missing or false one as
110
+ // "revoke the PUBLIC grant", so it is read from the space right before the
111
+ // write and carried through. If it cannot be read, nothing is written.
112
+ const request = await (0, data_provider_1.resolvePermissionsUpdate)({
112
113
  updated: updated,
113
114
  removed: [],
114
- public: Boolean(current.public),
115
- publicAccessRoleId: current.publicAccessRoleId,
116
- });
115
+ }, () => data_provider_1.dataService.getResourcePermissions(data_provider_1.ResourceType.SPACE, spaceRef));
116
+ result = await data_provider_1.dataService.updateResourcePermissions(data_provider_1.ResourceType.SPACE, spaceRef, request);
117
117
  const expertise = flags.expertise;
118
118
  if ((brief && brief.trim().length > 0) || (expertise && expertise.length > 0)) {
119
119
  const saves = [
@@ -42,16 +42,16 @@ class SpacesMembersRemove extends base_command_1.BaseCommand {
42
42
  ...userIds.map((id) => ({ type: (0, space_members_1.principalType)('user'), id })),
43
43
  ...agentIds.map((id) => ({ type: (0, space_members_1.principalType)('agent'), id })),
44
44
  ];
45
- let current;
46
45
  let result;
47
46
  try {
48
- current = await data_provider_1.dataService.getResourcePermissions(data_provider_1.ResourceType.SPACE, spaceRef);
49
- result = await data_provider_1.dataService.updateResourcePermissions(data_provider_1.ResourceType.SPACE, spaceRef, {
47
+ // `public` is left out on purpose: the server reads a missing or false one as
48
+ // "revoke the PUBLIC grant", so it is read from the space right before the
49
+ // write and carried through. If it cannot be read, nothing is written.
50
+ const request = await (0, data_provider_1.resolvePermissionsUpdate)({
50
51
  updated: [],
51
52
  removed: removed,
52
- public: Boolean(current.public),
53
- publicAccessRoleId: current.publicAccessRoleId,
54
- });
53
+ }, () => data_provider_1.dataService.getResourcePermissions(data_provider_1.ResourceType.SPACE, spaceRef));
54
+ result = await data_provider_1.dataService.updateResourcePermissions(data_provider_1.ResourceType.SPACE, spaceRef, request);
55
55
  if (!flags['keep-brief']) {
56
56
  const deletes = [
57
57
  ...userIds.map((principalId) => data_provider_1.dataService.deleteSpaceBrief(spaceRef, 'user', principalId).catch(() => undefined)),
@@ -1,13 +1,9 @@
1
1
  import { BaseCommand } from '../../base-command';
2
2
  /**
3
3
  * `skrr spaces notebook <space>` — the Space's notebook (OSK-17996): one page
4
- * of its Task Results, loop Cycles, hypothesis verdicts and journal / report
5
- * pages, newest first. A view over records that already exist: each row is a
6
- * summary and a link, and the body is read from the record itself. VIEW on
7
- * the Space. A loop's Cycles are shared with the Space's members while its
8
- * rules hold; a Duty that only watches the Space, and every hypothesis
9
- * verdict, show only to people who can open the Duty. Each loop row says
10
- * which.
4
+ * of its Task Results and journal / report pages, newest first. Loop Cycles
5
+ * and hypothesis verdicts are unavailable until their historical physical
6
+ * sources can be verified. Each available row links to its source record.
11
7
  */
12
8
  export default class SpacesNotebook extends BaseCommand {
13
9
  static description: string;
@@ -5,18 +5,37 @@ const data_provider_1 = require("@skrr-ai/data-provider");
5
5
  const base_command_1 = require("../../base-command");
6
6
  const space_notebook_1 = require("../../lib/space-notebook");
7
7
  const web_url_1 = require("../../lib/web-url");
8
+ /** An older server can ignore the capability header and return unverified
9
+ * Duty history. Never render or emit it as JSON, regardless of server version.
10
+ */
11
+ function withholdUnverifiedDutyHistory(page) {
12
+ const withheld = new Set(['loop_cycle', 'hypothesis']);
13
+ // A legacy cursor may encode the position of a withheld row. It cannot be
14
+ // safely forwarded as if it were issued by an upgraded server.
15
+ const legacyCoverage = page.kinds.some((kind) => withheld.has(kind) &&
16
+ page.sources.find((source) => source.kind === kind)?.state !== 'unsupported');
17
+ const sources = page.sources
18
+ .filter((source) => !withheld.has(source.kind));
19
+ for (const kind of page.kinds) {
20
+ if (kind === 'loop_cycle' || kind === 'hypothesis') {
21
+ sources.push({ kind, state: 'unsupported' });
22
+ }
23
+ }
24
+ return {
25
+ ...page,
26
+ rows: page.rows.filter((row) => !withheld.has(row.kind)),
27
+ sources,
28
+ ...(legacyCoverage ? { nextCursor: null } : {}),
29
+ };
30
+ }
8
31
  /**
9
32
  * `skrr spaces notebook <space>` — the Space's notebook (OSK-17996): one page
10
- * of its Task Results, loop Cycles, hypothesis verdicts and journal / report
11
- * pages, newest first. A view over records that already exist: each row is a
12
- * summary and a link, and the body is read from the record itself. VIEW on
13
- * the Space. A loop's Cycles are shared with the Space's members while its
14
- * rules hold; a Duty that only watches the Space, and every hypothesis
15
- * verdict, show only to people who can open the Duty. Each loop row says
16
- * which.
33
+ * of its Task Results and journal / report pages, newest first. Loop Cycles
34
+ * and hypothesis verdicts are unavailable until their historical physical
35
+ * sources can be verified. Each available row links to its source record.
17
36
  */
18
37
  class SpacesNotebook extends base_command_1.BaseCommand {
19
- static description = "Show a space's notebook: its task results, loop cycles, hypothesis verdicts and journal and report pages, newest first";
38
+ static description = "Show a space's notebook, including task results and journal and report pages; unverified Duty history is marked unavailable";
20
39
  static examples = [
21
40
  '<%= config.bin %> spaces notebook <space-id>',
22
41
  '<%= config.bin %> spaces notebook "Growth lab" --kinds task_result,hypothesis',
@@ -55,11 +74,16 @@ class SpacesNotebook extends base_command_1.BaseCommand {
55
74
  ...(kinds.kinds.length < data_provider_1.SPACE_NOTEBOOK_KINDS.length ? { kinds: kinds.kinds } : {}),
56
75
  ...(typeof flags.limit === 'number' ? { limit: flags.limit } : {}),
57
76
  ...(flags.cursor ? { cursor: flags.cursor } : {}),
77
+ }, {
78
+ // This CLI understands unsupported sources and will not describe them
79
+ // as an empty or complete history. Legacy clients do not send this.
80
+ headers: { 'X-Skrr-Notebook-Capabilities': 'unsupported-sources-v1' },
58
81
  });
59
82
  }
60
83
  catch (err) {
61
84
  this.handleApiError(err, { subject: `space ${args.id}` });
62
85
  }
86
+ page = withholdUnverifiedDutyHistory(page);
63
87
  if (flags.json) {
64
88
  this.printJsonResult(page);
65
89
  return;
@@ -1,7 +1,7 @@
1
1
  import { BaseCommand } from '../../base-command';
2
2
  import { type TaskRecord } from '../../lib/tasks';
3
- import { resolveListWorkspace } from './list';
4
- import type { ListWorkspaceScope } from './list';
3
+ import { resolveListWorkspace } from '../../lib/list-workspace';
4
+ import type { ListWorkspaceScope } from '../../lib/list-workspace';
5
5
  /**
6
6
  * Whether the estimate we asked for survived the write. (S3 dogfood finding)
7
7
  *
@@ -13,7 +13,7 @@ const label_ref_1 = require("../../lib/label-ref");
13
13
  const prompt_1 = require("../../lib/prompt");
14
14
  const tasks_1 = require("../../lib/tasks");
15
15
  const task_instruction_offer_1 = require("../../lib/task-instruction-offer");
16
- const list_1 = require("./list");
16
+ const list_workspace_1 = require("../../lib/list-workspace");
17
17
  const web_url_1 = require("../../lib/web-url");
18
18
  const TASK_CREATE_MAY_HAVE_COMMITTED_RE = /fetch failed|socket hang up|timed? ?out/i;
19
19
  /**
@@ -144,7 +144,7 @@ function taskMatchesCreateIdentity(task, payload) {
144
144
  async function resolveCreateWorkspace(scoped, env, lookupDefault) {
145
145
  if (scoped)
146
146
  return undefined;
147
- const scope = await (0, list_1.resolveListWorkspace)({}, env, lookupDefault);
147
+ const scope = await (0, list_workspace_1.resolveListWorkspace)({}, env, lookupDefault);
148
148
  return scope?.source === 'default' ? scope : undefined;
149
149
  }
150
150
  class TasksCreate extends base_command_1.BaseCommand {
@@ -366,7 +366,7 @@ class TasksCreate extends base_command_1.BaseCommand {
366
366
  body.projectId ||
367
367
  body.parentId ||
368
368
  body.goalId);
369
- const defaultWorkspace = await resolveCreateWorkspace(namesAScope, process.env, list_1.lookupDefaultWorkspace);
369
+ const defaultWorkspace = await resolveCreateWorkspace(namesAScope, process.env, list_workspace_1.lookupDefaultWorkspace);
370
370
  if (defaultWorkspace) {
371
371
  process.env.OVERSKY_WORKSPACE_ID = defaultWorkspace.workspaceId;
372
372
  if (!flags.json && defaultWorkspace.workspaceCount > 1) {
@@ -1,47 +1,10 @@
1
1
  import type { TaskListParams } from '@skrr-ai/data-provider';
2
2
  import { BaseCommand } from '../../base-command';
3
3
  import { type ListWarning } from '../../lib/list-output';
4
+ import { lookupDefaultWorkspace, resolveListWorkspace } from '../../lib/list-workspace';
5
+ export { lookupDefaultWorkspace, resolveListWorkspace };
6
+ export type { ListWorkspaceScope } from '../../lib/list-workspace';
4
7
  type ListFlags = Record<string, unknown>;
5
- /** Which workspace a list reads, and why (OSK-21284). */
6
- export type ListWorkspaceScope = {
7
- source: 'all';
8
- } | {
9
- source: 'default';
10
- workspaceId: string;
11
- workspaceName?: string;
12
- workspaceCount: number;
13
- };
14
- /**
15
- * A plain `tasks list` named no workspace, and the server answers that with a list across EVERY
16
- * workspace the person belongs to. Its access filter has branches that belong to no single
17
- * workspace, so no index can serve it in order: on production it timed out after about 6 s while
18
- * the same list naming a workspace answered in about a second. `skrr workspaces list` already says
19
- * an unselected session "resolves to your default workspace"; a list now reads it too.
20
- *
21
- * --all-workspaces the old, wider list, asked for by name (`workspaceScope=all`)
22
- * a selected workspace, `--workspace`, or `skrr workspaces use` untouched: the choice stands
23
- * an autonomous Agent session untouched: a workspace-less Agent session stays personal
24
- * `--space`, `--calendar` untouched: a Space names its own scope
25
- *
26
- * Returns nothing when there is nothing to apply, and `source: 'default'` when the caller's
27
- * default workspace should be used. `lookupDefault` is injected so the rule is tested without the
28
- * network; a lookup that fails or finds no default changes nothing.
29
- */
30
- export declare function resolveListWorkspace(flags: {
31
- 'all-workspaces'?: boolean;
32
- space?: string;
33
- calendar?: string;
34
- }, env: NodeJS.ProcessEnv, lookupDefault: () => Promise<{
35
- id: string;
36
- name?: string;
37
- count: number;
38
- } | null>): Promise<ListWorkspaceScope | undefined>;
39
- /** The default workspace the signed-in person's `skrr workspaces list` reports. */
40
- export declare function lookupDefaultWorkspace(): Promise<{
41
- id: string;
42
- name?: string;
43
- count: number;
44
- } | null>;
45
8
  /**
46
9
  * E12: inside an agent session an unfiltered `tasks list --json` returned the
47
10
  * first page of EVERYTHING, which in practice was cancelled test tasks. When the
@@ -190,4 +153,3 @@ export default class TasksList extends BaseCommand {
190
153
  };
191
154
  run(): Promise<void>;
192
155
  }
193
- export {};