@skrr-ai/cli 0.1.116 → 0.1.117

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 (63) hide show
  1. package/dist/base-command.d.ts +21 -0
  2. package/dist/base-command.js +95 -8
  3. package/dist/commands/actions/install.d.ts +1 -0
  4. package/dist/commands/actions/install.js +46 -1
  5. package/dist/commands/commitments/create.d.ts +21 -2
  6. package/dist/commands/commitments/create.js +74 -4
  7. package/dist/commands/convos/recovery.js +12 -4
  8. package/dist/commands/followups/plans/list.js +1 -1
  9. package/dist/commands/guide.d.ts +21 -0
  10. package/dist/commands/guide.js +46 -0
  11. package/dist/commands/instructions/guide.js +34 -52
  12. package/dist/commands/memory/maintain.js +1 -1
  13. package/dist/commands/skills/install.d.ts +1 -0
  14. package/dist/commands/skills/install.js +41 -2
  15. package/dist/commands/slack/send-as-agent.js +3 -3
  16. package/dist/commands/spaces/create.js +8 -2
  17. package/dist/commands/spaces/guide.d.ts +21 -0
  18. package/dist/commands/spaces/guide.js +40 -0
  19. package/dist/commands/spaces/index.d.ts +0 -1
  20. package/dist/commands/spaces/index.js +1 -6
  21. package/dist/commands/tasks/checkout.js +2 -3
  22. package/dist/commands/tasks/comments/add.js +3 -5
  23. package/dist/commands/tasks/complete.js +2 -3
  24. package/dist/commands/tasks/deliverable/add.d.ts +1 -1
  25. package/dist/commands/tasks/deliverable/add.js +4 -7
  26. package/dist/commands/tasks/expectations/assess.js +2 -2
  27. package/dist/commands/tasks/guide.d.ts +8 -0
  28. package/dist/commands/tasks/guide.js +23 -10
  29. package/dist/commands/tasks/report.js +9 -5
  30. package/dist/commands/tasks/resource/add.js +2 -3
  31. package/dist/commands/tasks/result/submit.js +2 -3
  32. package/dist/commands/tasks/resume/save.js +2 -3
  33. package/dist/commands/tasks/review.js +2 -3
  34. package/dist/commands/tasks/triage.js +2 -1
  35. package/dist/commands/tasks/updates/add.js +2 -3
  36. package/dist/generated/agent-guides.json +8290 -0
  37. package/dist/generated/managed-instruction-guides.json +1 -1
  38. package/dist/help.js +4 -3
  39. package/dist/hooks/command-not-found.js +1 -1
  40. package/dist/lib/agent-guide-reference-gate.d.ts +28 -0
  41. package/dist/lib/agent-guide-reference-gate.js +186 -0
  42. package/dist/lib/agent-guides.d.ts +51 -0
  43. package/dist/lib/agent-guides.js +170 -0
  44. package/dist/lib/command-miss.d.ts +13 -2
  45. package/dist/lib/command-miss.js +134 -8
  46. package/dist/lib/guide-pointer.d.ts +15 -0
  47. package/dist/lib/guide-pointer.js +51 -0
  48. package/dist/lib/lookbackPlans.d.ts +3 -1
  49. package/dist/lib/lookbackPlans.js +9 -0
  50. package/dist/lib/outbox.d.ts +0 -14
  51. package/dist/lib/outbox.js +0 -21
  52. package/dist/lib/roles.d.ts +1 -1
  53. package/dist/lib/task-batch.d.ts +10 -7
  54. package/dist/lib/task-batch.js +5 -20
  55. package/dist/lib/task-operations.d.ts +8 -20
  56. package/dist/lib/task-operations.js +9 -94
  57. package/dist/lib/task-preflight.js +70 -33
  58. package/dist/lib/usage-discovery.d.ts +4 -0
  59. package/dist/lib/usage-discovery.js +5 -0
  60. package/dist/lib/voice-call-intent.js +3 -1
  61. package/dist/node_modules/@skrr-ai/data-provider/index.js +6593 -6383
  62. package/oclif.manifest.json +228 -13
  63. package/package.json +4 -2
@@ -22,7 +22,9 @@ function unavailable(error, label) {
22
22
  if (typeof body?.code === 'string' && /^[A-Z][A-Z0-9_]{0,100}$/.test(body.code))
23
23
  code = body.code;
24
24
  }
25
- catch { /* non-JSON server refusal */ }
25
+ catch {
26
+ /* non-JSON server refusal */
27
+ }
26
28
  }
27
29
  const remedy = status === 401
28
30
  ? 'Restore the current CLI sign-in or delegated runtime credential, then repeat this read-only check.'
@@ -32,9 +34,12 @@ function unavailable(error, label) {
32
34
  ? 'Check the Task reference and server support for this diagnostic. No start fallback was attempted.'
33
35
  : 'Read tasks actionability and tasks start --dry-run separately for the native refusal, then repeat preflight after resolving it.';
34
36
  return {
35
- status: 'unavailable', certainty: 'unknown', code: code || 'TASK_PREFLIGHT_UNAVAILABLE',
37
+ status: 'unavailable',
38
+ certainty: 'unknown',
39
+ code: code || 'TASK_PREFLIGHT_UNAVAILABLE',
36
40
  ...(status ? { httpStatus: status } : {}),
37
- message: `${label} could not be confirmed${status ? ` (HTTP ${status})` : ''}.`, remedy,
41
+ message: `${label} could not be confirmed${status ? ` (HTTP ${status})` : ''}.`,
42
+ remedy,
38
43
  };
39
44
  }
40
45
  function isWorkflow(value, taskId) {
@@ -42,60 +47,92 @@ function isWorkflow(value, taskId) {
42
47
  return false;
43
48
  const row = value;
44
49
  const a = row.actionability;
45
- return row.taskId === taskId && Boolean(a &&
46
- ['ready', 'running', 'waiting', 'terminal'].includes(a.state) &&
47
- ['agent', 'human', 'system', 'external', 'none'].includes(a.nextActor) &&
48
- typeof a.reasonCode === 'string' && typeof a.reason === 'string' &&
49
- (a.actorRefs === undefined || Array.isArray(a.actorRefs) && a.actorRefs.every(ref => ref && ['user', 'agent'].includes(ref.kind) && typeof ref.id === 'string')) &&
50
- Array.isArray(a.allowedActions) && a.allowedActions.every(action => action &&
51
- typeof action.action === 'string' && (action.targetId === undefined || typeof action.targetId === 'string')));
50
+ return (row.taskId === taskId &&
51
+ Boolean(a &&
52
+ ['ready', 'running', 'waiting', 'terminal'].includes(a.state) &&
53
+ ['agent', 'human', 'system', 'external', 'none'].includes(a.nextActor) &&
54
+ typeof a.reasonCode === 'string' &&
55
+ typeof a.reason === 'string' &&
56
+ (a.actorRefs === undefined ||
57
+ (Array.isArray(a.actorRefs) &&
58
+ a.actorRefs.every((ref) => ref && ['user', 'agent'].includes(ref.kind) && typeof ref.id === 'string'))) &&
59
+ Array.isArray(a.allowedActions) &&
60
+ a.allowedActions.every((action) => action &&
61
+ typeof action.action === 'string' &&
62
+ (action.targetId === undefined || typeof action.targetId === 'string'))));
52
63
  }
53
64
  function isPreview(value, taskId) {
54
65
  if (!(0, task_admission_1.isAdmissionPreview)(value) || value.taskId !== taskId)
55
66
  return false;
56
67
  const a = value.executionAdmission;
57
- return Boolean(typeof a.unattended === 'boolean' && typeof a.approverAvailable === 'boolean' &&
58
- (a.constraints === undefined || Array.isArray(a.constraints) && a.constraints.every(c => c &&
59
- (c.message === undefined || typeof c.message === 'string') &&
60
- (c.requiredAction === undefined || typeof c.requiredAction === 'string'))) &&
61
- (a.permission === undefined || a.permission && typeof a.permission === 'object' &&
62
- (a.permission.mode == null || typeof a.permission.mode === 'string') &&
63
- (a.permission.source === undefined || typeof a.permission.source === 'string')) &&
64
- (a.shell === undefined || a.shell && typeof a.shell === 'object' &&
65
- (a.shell.state === undefined || typeof a.shell.state === 'string')) &&
66
- (a.workingDirectory === undefined || a.workingDirectory &&
67
- (a.workingDirectory.path === null || typeof a.workingDirectory.path === 'string') &&
68
- typeof a.workingDirectory.source === 'string'));
68
+ return Boolean(typeof a.unattended === 'boolean' &&
69
+ typeof a.approverAvailable === 'boolean' &&
70
+ (a.constraints === undefined ||
71
+ (Array.isArray(a.constraints) &&
72
+ a.constraints.every((c) => c &&
73
+ (c.message === undefined || typeof c.message === 'string') &&
74
+ (c.requiredAction === undefined || typeof c.requiredAction === 'string')))) &&
75
+ (a.permission === undefined ||
76
+ (a.permission &&
77
+ typeof a.permission === 'object' &&
78
+ (a.permission.mode == null || typeof a.permission.mode === 'string') &&
79
+ (a.permission.source === undefined || typeof a.permission.source === 'string'))) &&
80
+ (a.shell === undefined ||
81
+ (a.shell &&
82
+ typeof a.shell === 'object' &&
83
+ (a.shell.state === undefined || typeof a.shell.state === 'string'))) &&
84
+ (a.workingDirectory === undefined ||
85
+ (a.workingDirectory &&
86
+ (a.workingDirectory.path === null || typeof a.workingDirectory.path === 'string') &&
87
+ typeof a.workingDirectory.source === 'string')));
69
88
  }
70
89
  /** Compose native reads. This module cannot dispatch execution or infer grants. */
71
90
  async function readTaskPreflight(taskId, reads) {
72
91
  const [workflowResult, executionResult] = await Promise.allSettled([
73
- Promise.resolve().then(reads.workflow), Promise.resolve().then(reads.execution),
92
+ Promise.resolve().then(reads.workflow),
93
+ Promise.resolve().then(reads.execution),
74
94
  ]);
75
95
  const workflow = workflowResult.status === 'fulfilled' && isWorkflow(workflowResult.value, taskId)
76
96
  ? { status: 'observed', certainty: 'server_projection', value: workflowResult.value }
77
- : unavailable(workflowResult.status === 'rejected' ? workflowResult.reason : { code: 'TASK_ACTIONABILITY_UNSUPPORTED' }, 'Workflow actionability');
97
+ : unavailable(workflowResult.status === 'rejected'
98
+ ? workflowResult.reason
99
+ : { code: 'TASK_ACTIONABILITY_UNSUPPORTED' }, 'Workflow actionability');
78
100
  const execution = executionResult.status === 'fulfilled' && isPreview(executionResult.value, taskId)
79
101
  ? { status: 'observed', certainty: 'server_projection', value: executionResult.value }
80
- : unavailable(executionResult.status === 'rejected' ? executionResult.reason : { code: 'TASK_START_PREVIEW_UNSUPPORTED' }, 'Execution preview');
102
+ : unavailable(executionResult.status === 'rejected'
103
+ ? executionResult.reason
104
+ : { code: 'TASK_START_PREVIEW_UNSUPPORTED' }, 'Execution preview');
81
105
  // actionability.revision is the attention revision, not Task.version from
82
106
  // start-preview. Equal numbers would not prove the reads shared a snapshot.
83
107
  const workflowBlocked = workflow.status === 'observed' &&
84
- !workflow.value.actionability.allowedActions.some(action => action.action === 'start_task');
108
+ !workflow.value.actionability.allowedActions.some((action) => action.action === 'start_task');
85
109
  const executionBlocked = execution.status === 'observed' && execution.value.executionAdmission.state === 'blocked';
86
- const summary = workflowBlocked || executionBlocked ? 'blocked'
87
- : workflow.status === 'unavailable' || execution.status === 'unavailable' ||
88
- execution.value.executionAdmission.state !== 'ready' ? 'unknown'
110
+ const summary = workflowBlocked || executionBlocked
111
+ ? 'blocked'
112
+ : workflow.status === 'unavailable' ||
113
+ execution.status === 'unavailable' ||
114
+ execution.value.executionAdmission.state !== 'ready'
115
+ ? 'unknown'
89
116
  : 'eligible_to_attempt';
90
- return { taskId, summary, workflow, execution, consistency: 'independent_observations', limits: [...LIMITS] };
117
+ return {
118
+ taskId,
119
+ summary,
120
+ workflow,
121
+ execution,
122
+ consistency: 'independent_observations',
123
+ limits: [...LIMITS],
124
+ };
91
125
  }
92
126
  function taskPreflightLines(report, bin = 'skrr') {
93
- const lines = [`Task preflight: ${report.taskId}`, `Start eligibility: ${report.summary.replaceAll('_', ' ')} (current server projections)`];
127
+ const lines = [
128
+ `Task preflight: ${report.taskId}`,
129
+ `Start eligibility: ${report.summary.replaceAll('_', ' ')} (current server projections)`,
130
+ ];
94
131
  if (report.workflow.status === 'observed') {
95
132
  const a = report.workflow.value.actionability;
96
133
  lines.push('', `Workflow: ${a.state} (server projection)`, `Next actor: ${a.nextActor}`, `Why: ${a.reason} [${a.reasonCode}]`);
97
134
  if (a.actorRefs?.length)
98
- lines.push(`Eligible actors: ${a.actorRefs.map(ref => `${ref.kind}:${ref.id}`).join(', ')}`);
135
+ lines.push(`Eligible actors: ${a.actorRefs.map((ref) => `${ref.kind}:${ref.id}`).join(', ')}`);
99
136
  for (const action of a.allowedActions) {
100
137
  const command = (0, task_operations_1.taskActionCommand)(action.action, report.taskId, action.targetId, bin, {
101
138
  allowedActions: a.allowedActions,
@@ -116,6 +153,6 @@ function taskPreflightLines(report, bin = 'skrr') {
116
153
  }
117
154
  else
118
155
  lines.push('', `Execution: unknown. ${report.execution.message} [${report.execution.code}]`, `Next step: ${report.execution.remedy}`);
119
- lines.push('', ...report.limits, `More operations: ${bin} tasks guide`);
156
+ lines.push('', ...report.limits, `More operations: ${bin} guide tasks commands`);
120
157
  return lines;
121
158
  }
@@ -33,6 +33,10 @@ export declare const USAGE_OVERVIEW_TOKEN_BUDGET = 240;
33
33
  * `skrr widgets check`, and the app runs in the same frame. Its own overview line took the first read from 240 to 241
34
34
  * tokens, and this file's rule for that is to fold into a domain that already has the concept, not to raise the bound.
35
35
  * `skrr usage apps` still resolves, to the `widgets` pages, which name it in `Includes:`.
36
+ * `instruction-blocks` (version-pinned instruction blocks for cloud Agents) is the same concept as
37
+ * `instructions` (version-pinned blocks for local CLAUDE.md / AGENTS.md), aimed at another target. The overview
38
+ * read 245 once `skrr guide` joined it, and `guide` stays a line of its own because it is where every operation
39
+ * guide is read.
36
40
  */
37
41
  export declare const USAGE_DOMAIN_FOLDS: Readonly<Record<string, string>>;
38
42
  export declare const USAGE_DOMAIN_TOKEN_BUDGET = 500;
@@ -44,10 +44,15 @@ exports.USAGE_OVERVIEW_TOKEN_BUDGET = 240;
44
44
  * `skrr widgets check`, and the app runs in the same frame. Its own overview line took the first read from 240 to 241
45
45
  * tokens, and this file's rule for that is to fold into a domain that already has the concept, not to raise the bound.
46
46
  * `skrr usage apps` still resolves, to the `widgets` pages, which name it in `Includes:`.
47
+ * `instruction-blocks` (version-pinned instruction blocks for cloud Agents) is the same concept as
48
+ * `instructions` (version-pinned blocks for local CLAUDE.md / AGENTS.md), aimed at another target. The overview
49
+ * read 245 once `skrr guide` joined it, and `guide` stays a line of its own because it is where every operation
50
+ * guide is read.
47
51
  */
48
52
  exports.USAGE_DOMAIN_FOLDS = {
49
53
  proposals: 'inbox',
50
54
  apps: 'widgets',
55
+ 'instruction-blocks': 'instructions',
51
56
  };
52
57
  exports.USAGE_DOMAIN_TOKEN_BUDGET = 500;
53
58
  const GENERIC_FLAGS = new Set(['bare', 'help', 'json', 'token', 'workspace']);
@@ -74,9 +74,11 @@ function readVoiceCallSessionContext(env = process.env) {
74
74
  };
75
75
  }
76
76
  function generatedVoiceCallIdempotencyKey({ context, reason, conversationId, expiresInSeconds, }) {
77
+ if (!context.requestId)
78
+ return `voice-call:${crypto.randomUUID()}`;
77
79
  const input = [
78
80
  context.sessionId,
79
- context.requestId || 'no-request-id',
81
+ context.requestId,
80
82
  context.agentId,
81
83
  reason,
82
84
  conversationId || '',