@skrr-ai/cli 0.1.101 → 0.1.102

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 (52) hide show
  1. package/dist/commands/commitments/control/apply.d.ts +15 -0
  2. package/dist/commands/commitments/control/apply.js +36 -0
  3. package/dist/commands/commitments/control/preview.d.ts +17 -0
  4. package/dist/commands/commitments/control/preview.js +43 -0
  5. package/dist/commands/commitments/control/show.d.ts +12 -0
  6. package/dist/commands/commitments/control/show.js +29 -0
  7. package/dist/commands/commitments/create.js +5 -2
  8. package/dist/commands/commitments/observation/probe.d.ts +15 -0
  9. package/dist/commands/commitments/observation/probe.js +46 -0
  10. package/dist/commands/commitments/observation/summary.d.ts +9 -0
  11. package/dist/commands/commitments/observation/summary.js +31 -0
  12. package/dist/commands/commitments/readiness/show.d.ts +12 -0
  13. package/dist/commands/commitments/readiness/show.js +29 -0
  14. package/dist/commands/commitments/readiness/verify.d.ts +13 -0
  15. package/dist/commands/commitments/readiness/verify.js +33 -0
  16. package/dist/commands/commitments/update.js +11 -9
  17. package/dist/commands/commitments/work-plan.d.ts +11 -0
  18. package/dist/commands/commitments/work-plan.js +36 -0
  19. package/dist/commands/compass/effective-policy.d.ts +12 -0
  20. package/dist/commands/compass/effective-policy.js +34 -0
  21. package/dist/commands/compass/update.d.ts +12 -0
  22. package/dist/commands/compass/update.js +27 -0
  23. package/dist/commands/machines/dedicated/exec.js +3 -1
  24. package/dist/commands/proposals/discard.d.ts +4 -0
  25. package/dist/commands/proposals/discard.js +3 -0
  26. package/dist/commands/proposals/keep.d.ts +4 -0
  27. package/dist/commands/proposals/keep.js +3 -0
  28. package/dist/commands/proposals/snooze.d.ts +4 -0
  29. package/dist/commands/proposals/snooze.js +3 -0
  30. package/dist/commands/spaces/workflows/cancel-node.d.ts +16 -0
  31. package/dist/commands/spaces/workflows/cancel-node.js +44 -0
  32. package/dist/commands/spaces/workflows/cancel.d.ts +40 -0
  33. package/dist/commands/spaces/workflows/cancel.js +109 -3
  34. package/dist/commands/spaces/workflows/run.d.ts +9 -0
  35. package/dist/commands/spaces/workflows/run.js +38 -0
  36. package/dist/commands/tasks/schedule.js +1 -1
  37. package/dist/commands/triggers/capabilities.js +7 -0
  38. package/dist/commands/triggers/create.js +4 -1
  39. package/dist/lib/commitments.d.ts +19 -0
  40. package/dist/lib/commitments.js +36 -3
  41. package/dist/lib/compasses.d.ts +3 -0
  42. package/dist/lib/compasses.js +1 -0
  43. package/dist/lib/responsibility-controls.d.ts +11 -0
  44. package/dist/lib/responsibility-controls.js +119 -0
  45. package/dist/lib/stewardship-output.js +13 -2
  46. package/dist/lib/workflow-node-control.d.ts +10 -0
  47. package/dist/lib/workflow-node-control.js +76 -0
  48. package/dist/lib/workspaces.d.ts +2 -0
  49. package/dist/node_modules/@skrr-ai/auth-core/package.json +1 -1
  50. package/dist/node_modules/@skrr-ai/data-provider/index.js +6369 -6355
  51. package/oclif.manifest.json +1033 -155
  52. package/package.json +11 -2
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RESPONSIBILITY_CONTROL_SCOPES = void 0;
4
+ exports.controlFromPreview = controlFromPreview;
5
+ exports.renderControl = renderControl;
6
+ exports.renderReadiness = renderReadiness;
7
+ exports.renderProbe = renderProbe;
8
+ /** Scope/version coordinates are intent. The server re-authorizes every read and write. */
9
+ exports.RESPONSIBILITY_CONTROL_SCOPES = [
10
+ 'mute_updates', 'pause_observation', 'cancel_worker', 'cancel_episode', 'cancel_subtree', 'retire',
11
+ ];
12
+ function record(value) {
13
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
14
+ }
15
+ /**
16
+ * Apply only the saved preview, never a newly fetched version or live target set.
17
+ * Presentation and authority fields cannot become request fields. The canonical
18
+ * service validates every attempt pin and rejects stale or enlarged selections.
19
+ */
20
+ function controlFromPreview(commitmentId, preview, idempotencyKey, reason) {
21
+ if (preview.schemaVersion !== 1 || preview.commitmentId !== commitmentId) {
22
+ throw new Error('Use a control preview for this exact Commitment.');
23
+ }
24
+ if (preview.available !== true)
25
+ throw new Error('The reviewed control is unavailable; refresh its preview.');
26
+ if (!exports.RESPONSIBILITY_CONTROL_SCOPES.some((scope) => scope === preview.scope)) {
27
+ throw new Error('The preview has an unsupported control scope.');
28
+ }
29
+ if (typeof preview.expectedVersion !== 'number' || !Number.isSafeInteger(preview.expectedVersion)
30
+ || preview.expectedVersion < 1)
31
+ throw new Error('The preview must pin its Commitment version.');
32
+ if (!idempotencyKey.trim() || idempotencyKey.length > 200)
33
+ throw new Error('Use an idempotency key of 1..200 characters.');
34
+ if (reason !== undefined && reason.length > 1000)
35
+ throw new Error('The control reason must be at most 1000 characters.');
36
+ if (!Array.isArray(preview.targetIds) || !Array.isArray(preview.expectedTargets)
37
+ || preview.targetIds.length > 500 || preview.expectedTargets.length > 500) {
38
+ throw new Error('The preview must contain a bounded, frozen target set.');
39
+ }
40
+ const pinKeys = new Set(['id', 'type', 'generation', 'attempt', 'taskWorkflowGeneration',
41
+ 'workflowPlanGeneration', 'workflowNodeAttempt', 'workflowTaskRunId', 'bindingDigest',
42
+ 'executorAttemptRef', 'taskRunId']);
43
+ const executorKeys = new Set(['kind', 'runId', 'generation', 'attempt']);
44
+ const targetIds = preview.targetIds;
45
+ const pins = preview.expectedTargets;
46
+ if (targetIds.some((id) => typeof id !== 'string' || !id || id.length > 200)
47
+ || new Set(targetIds).size !== targetIds.length
48
+ || pins.some((pin) => !record(pin) || typeof pin.id !== 'string'
49
+ || typeof pin.generation !== 'number' || !Number.isSafeInteger(pin.generation) || pin.generation < 0
50
+ || Object.keys(pin).some((key) => !pinKeys.has(key))
51
+ || (pin.executorAttemptRef != null && (!record(pin.executorAttemptRef)
52
+ || Object.keys(pin.executorAttemptRef).some((key) => !executorKeys.has(key)))))
53
+ || pins.length !== targetIds.length
54
+ || new Set(pins.map((pin) => record(pin) ? pin.id : null)).size !== pins.length
55
+ || pins.some((pin) => !record(pin) || !targetIds.includes(pin.id))) {
56
+ throw new Error('Use the exact target identities and generation pins returned by control preview.');
57
+ }
58
+ if (String(preview.scope).startsWith('cancel_') && pins.length === 0) {
59
+ throw new Error('A cancellation preview must identify the exact worker or episode attempts.');
60
+ }
61
+ return {
62
+ scope: preview.scope, expectedVersion: preview.expectedVersion,
63
+ targetIds, expectedTargets: pins, idempotencyKey,
64
+ ...(reason !== undefined ? { reason } : {}),
65
+ };
66
+ }
67
+ function renderControl(value, log) {
68
+ log(`${value.scope}: ${value.state ?? (value.available === true ? 'available' : 'unavailable')}`);
69
+ if (value.controlId)
70
+ log(`Control receipt: ${value.controlId}`);
71
+ if (value.expectedVersion !== undefined)
72
+ log(`Commitment version: ${value.expectedVersion}`);
73
+ if (value.unavailableReason)
74
+ log(`Reason: ${value.unavailableReason}`);
75
+ for (const key of ['affected', 'remaining']) {
76
+ const rows = value[key];
77
+ if (!Array.isArray(rows))
78
+ continue;
79
+ log(`${key === 'affected' ? 'Affected' : 'Remaining'} work: ${rows.length}`);
80
+ for (const row of rows)
81
+ if (record(row))
82
+ log(` ${row.id}: ${row.status ?? 'unknown'}${row.acknowledgement ? ` (${row.acknowledgement})` : ''}`);
83
+ }
84
+ if (Array.isArray(value.warnings))
85
+ for (const warning of value.warnings)
86
+ log(String(warning));
87
+ }
88
+ function renderReadiness(value, log) {
89
+ const activation = value.object === 'commitment_readiness_activation_receipt';
90
+ log(`${activation ? 'Activation' : 'Readiness'} receipt: ${value.id ?? 'not recorded'}`);
91
+ if (activation) {
92
+ log(`Validated version: ${value.validatedVersion ?? 'unknown'}`);
93
+ log(`Activated version: ${value.activatedVersion ?? 'unknown'}`);
94
+ if (record(value.materialization))
95
+ log(`Trigger materialization: ${value.materialization.status ?? 'unknown'}`);
96
+ log(`Worker observation: ${value.workerObservationConfirmed === true ? 'confirmed' : 'unconfirmed'}`);
97
+ }
98
+ if (record(value.preflight))
99
+ log(`Preflight: ${value.preflight.verdict ?? 'unknown'}`);
100
+ if (record(value.observation)) {
101
+ log(`Observation: ${value.observation.status ?? 'unknown'}`);
102
+ log(`Required source coverage: ${value.observation.requiredCoverageComplete === true ? 'complete' : 'incomplete'}`);
103
+ log(`Worker observation: ${value.observation.workerObservationConfirmed === true ? 'confirmed' : 'unconfirmed'}`);
104
+ }
105
+ if (value.isCurrent !== undefined)
106
+ log(`Current evidence: ${value.isCurrent === true ? 'yes' : 'no'}`);
107
+ if (value.validUntil)
108
+ log(`Evidence valid until: ${value.validUntil}`);
109
+ }
110
+ function renderProbe(value, log) {
111
+ log(`Source observation: ${value.status ?? 'unknown'}`);
112
+ log(`Coverage: ${value.coverageComplete === true ? 'complete' : 'incomplete'}`);
113
+ if (Array.isArray(value.rows))
114
+ for (const row of value.rows) {
115
+ if (record(row))
116
+ log(` ${row.source ?? row.key ?? 'source'}: ${row.status ?? 'unknown'}${row.reason ? ` (${row.reason})` : ''}`);
117
+ }
118
+ log(`Worker observation: ${value.workerObservationConfirmed === true ? 'confirmed' : 'unconfirmed'}`);
119
+ }
@@ -9,12 +9,20 @@ function printStewardshipCoverage(report, log) {
9
9
  log('Coverage: complete within the bounded sources.');
10
10
  return;
11
11
  }
12
- log('Coverage: incomplete. Unreadable sources do not confirm absence.');
12
+ const unreadable = report.coverage.sources.some((source) => source.status === 'unavailable' || source.truncated);
13
+ log(unreadable
14
+ ? 'Coverage: incomplete. Unreadable sources do not confirm absence.'
15
+ : 'Coverage: incomplete. Some Grants are not attributed to this workspace and are not listed.');
13
16
  for (const source of report.coverage.sources) {
14
17
  if (source.status === 'unavailable')
15
18
  log(`${source.name}: unavailable`);
16
19
  else if (source.truncated)
17
20
  log(`${source.name}: truncated at 200 rows`);
21
+ if (source.unlisted) {
22
+ // A capped count is a lower bound; say so rather than print 200 as exact.
23
+ const count = `${source.truncated ? 'at least ' : ''}${source.unlisted}`;
24
+ log(`${source.name}: ${count} Grant${source.unlisted === 1 && !source.truncated ? '' : 's'} on an Agent or Commitment in this workspace carry no workspace stamp, so they are not listed here. Their owners can see them with \`skrr grants list\`.`);
25
+ }
18
26
  }
19
27
  }
20
28
  function printWorkspaceGrants(report, log) {
@@ -27,7 +35,10 @@ function printGrantRows(report, log) {
27
35
  return;
28
36
  }
29
37
  if (!report.grants.length) {
30
- log('No workspace Grants observed.');
38
+ const unlisted = report.coverage.sources.some((source) => source.unlisted);
39
+ log(unlisted
40
+ ? 'No Grant carries this workspace stamp (see the coverage note above).'
41
+ : 'No workspace Grants observed.');
31
42
  return;
32
43
  }
33
44
  (0, format_1.renderTable)(report.grants.map((row) => ({
@@ -0,0 +1,10 @@
1
+ import type { WorkflowReviewedCancellationScope } from '@skrr-ai/data-provider';
2
+ /** Freeze the saved canonical selection. This command performs no live reads. */
3
+ export declare function nodeCancellationFromSnapshot(spaceId: string, runId: string, nodeKey: string, snapshot: Record<string, unknown>, reason?: string): {
4
+ expectedRunGeneration: number;
5
+ expectedGeneration: number;
6
+ expectedAttempt: string;
7
+ expectedTaskRunId: string | null;
8
+ expectedScopeNode: WorkflowReviewedCancellationScope['nodes'][number];
9
+ reason?: string;
10
+ };
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.nodeCancellationFromSnapshot = nodeCancellationFromSnapshot;
4
+ function record(value) {
5
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
6
+ }
7
+ function integer(value) {
8
+ return typeof value === 'number' && Number.isSafeInteger(value) && value >= 0;
9
+ }
10
+ function id(value) {
11
+ return typeof value === 'string' && value.length > 0 && value.length <= 160;
12
+ }
13
+ /** Freeze the saved canonical selection. This command performs no live reads. */
14
+ function nodeCancellationFromSnapshot(spaceId, runId, nodeKey, snapshot, reason) {
15
+ if (snapshot.id !== runId || snapshot.spaceId !== spaceId || !integer(snapshot.generation) || !Array.isArray(snapshot.nodes)) {
16
+ throw new Error('Use a saved canonical run snapshot for this exact Space and workflow run.');
17
+ }
18
+ const selected = snapshot.nodes.filter((node) => record(node) && node.nodeKey === nodeKey);
19
+ const node = selected[0];
20
+ if (selected.length !== 1 || !record(node) || !id(node.id) || node.workflowRunId !== runId
21
+ || !integer(node.iteration) || !integer(node.planGeneration) || !id(node.nodeType)) {
22
+ throw new Error('The saved snapshot must contain one exact node attempt and its generation.');
23
+ }
24
+ if (node.taskRunId != null && !id(node.taskRunId))
25
+ throw new Error('The saved TaskRun pin is invalid.');
26
+ if (reason !== undefined && reason.length > 500)
27
+ throw new Error('The cancellation reason must be at most 500 characters.');
28
+ const expectedScopeNode = {
29
+ id: node.id, workflowRunId: runId, iteration: node.iteration,
30
+ planGeneration: node.planGeneration, nodeType: node.nodeType,
31
+ };
32
+ for (const key of ['taskId', 'taskRunId', 'autonomousRunId']) {
33
+ const value = node[key];
34
+ if (value == null)
35
+ continue;
36
+ if (!id(value))
37
+ throw new Error(`The saved ${key} pin is invalid.`);
38
+ Object.assign(expectedScopeNode, { [key]: value });
39
+ }
40
+ // Explicit physical absence is a boundary. The canonical service refuses
41
+ // an executor that appears later rather than discovering it during a stop.
42
+ if (node.sessionId != null && !id(node.sessionId))
43
+ throw new Error('The saved session pin is invalid.');
44
+ expectedScopeNode.sessionId = node.sessionId == null ? null : node.sessionId;
45
+ const executor = (value) => {
46
+ if (value == null)
47
+ return null;
48
+ if (!record(value) || !id(value.kind) || !id(value.runId) || !integer(value.generation) || !integer(value.attempt)) {
49
+ throw new Error('The saved physical executor attempt is invalid.');
50
+ }
51
+ return { kind: value.kind, runId: value.runId, generation: value.generation, attempt: value.attempt };
52
+ };
53
+ expectedScopeNode.executorAttemptRef = executor(node.executorAttemptRef);
54
+ if (node.waitingFor !== undefined) {
55
+ const waitingFor = node.waitingFor;
56
+ if (!record(waitingFor))
57
+ throw new Error('The saved child execution scope is invalid.');
58
+ const keys = ['kind', 'eventKey', 'workflowRunId', 'index', 'phase', 'round', 'reviewTaskIds', 'reviseTaskId', 'executions'];
59
+ expectedScopeNode.waitingFor = Object.fromEntries(keys.filter((key) => waitingFor[key] !== undefined)
60
+ .map((key) => [key, waitingFor[key]]));
61
+ }
62
+ if (node.executorPins !== undefined) {
63
+ if (!Array.isArray(node.executorPins))
64
+ throw new Error('The saved executor set is invalid.');
65
+ expectedScopeNode.executorPins = node.executorPins.map((pin) => {
66
+ if (!record(pin) || !id(pin.taskId) || (pin.runId !== null && !id(pin.runId))
67
+ || (pin.sessionId != null && !id(pin.sessionId)))
68
+ throw new Error('The saved executor set is invalid.');
69
+ return { taskId: pin.taskId, runId: pin.runId, sessionId: pin.sessionId == null ? null : pin.sessionId,
70
+ executorAttemptRef: executor(pin.executorAttemptRef) };
71
+ });
72
+ }
73
+ return { expectedRunGeneration: snapshot.generation, expectedGeneration: node.planGeneration, expectedAttempt: node.id,
74
+ expectedTaskRunId: node.taskRunId == null ? null : node.taskRunId, expectedScopeNode,
75
+ ...(reason !== undefined ? { reason } : {}) };
76
+ }
@@ -4,6 +4,8 @@ export interface StewardshipSource {
4
4
  status: 'available' | 'unavailable';
5
5
  truncated: boolean;
6
6
  code?: string;
7
+ /** `unattributedGrants` only: Grants in this workspace by Agent or Commitment that carry no workspace stamp and so are not listed. */
8
+ unlisted?: number;
7
9
  }
8
10
  export interface StewardshipCoverage {
9
11
  complete: boolean;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skrr-ai/auth-core",
3
- "version": "0.4.20",
3
+ "version": "0.4.21",
4
4
  "main": "dist/cjs/index.js",
5
5
  "types": "dist/esm/index.d.ts",
6
6
  "exports": {