@skrr-ai/cli 0.1.155 → 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.
- package/dist/base-command.js +64 -16
- package/dist/commands/activity/list.d.ts +13 -0
- package/dist/commands/activity/list.js +50 -0
- package/dist/commands/activity/show.d.ts +18 -0
- package/dist/commands/activity/show.js +125 -0
- package/dist/commands/agent/message/send.js +64 -19
- package/dist/commands/agents/always-on/held-messages.js +24 -1
- package/dist/commands/agents/always-on/status.js +6 -1
- package/dist/commands/agents/mini-computer/app/reset.d.ts +13 -0
- package/dist/commands/agents/mini-computer/app/reset.js +35 -0
- package/dist/commands/agents/mini-computer/app/set.d.ts +16 -0
- package/dist/commands/agents/mini-computer/app/set.js +70 -0
- package/dist/commands/agents/mini-computer/layout/change.d.ts +14 -0
- package/dist/commands/agents/mini-computer/layout/change.js +44 -0
- package/dist/commands/agents/mini-computer/layout/folder.d.ts +14 -0
- package/dist/commands/agents/mini-computer/layout/folder.js +35 -0
- package/dist/commands/agents/mini-computer/layout/move.d.ts +14 -0
- package/dist/commands/agents/mini-computer/layout/move.js +32 -0
- package/dist/commands/agents/mini-computer/layout/pin.d.ts +14 -0
- package/dist/commands/agents/mini-computer/layout/pin.js +35 -0
- package/dist/commands/agents/mini-computer/layout/remove.d.ts +13 -0
- package/dist/commands/agents/mini-computer/layout/remove.js +27 -0
- package/dist/commands/agents/mini-computer/layout/restore.d.ts +13 -0
- package/dist/commands/agents/mini-computer/layout/restore.js +27 -0
- package/dist/commands/agents/mini-computer/layout/unfolder.d.ts +13 -0
- package/dist/commands/agents/mini-computer/layout/unfolder.js +27 -0
- package/dist/commands/agents/mini-computer/layout/unpin.d.ts +14 -0
- package/dist/commands/agents/mini-computer/layout/unpin.js +34 -0
- package/dist/commands/agents/mini-computer/show.d.ts +13 -0
- package/dist/commands/agents/mini-computer/show.js +60 -0
- package/dist/commands/agents/mini-computer/tasks-view.d.ts +29 -0
- package/dist/commands/agents/mini-computer/tasks-view.js +100 -0
- package/dist/commands/apps/auto-apply.d.ts +14 -0
- package/dist/commands/apps/auto-apply.js +53 -0
- package/dist/commands/apps/check.js +4 -1
- package/dist/commands/apps/create.js +11 -6
- package/dist/commands/apps/data/batch.d.ts +15 -0
- package/dist/commands/apps/data/batch.js +59 -0
- package/dist/commands/apps/data/collections.d.ts +12 -0
- package/dist/commands/apps/data/collections.js +44 -0
- package/dist/commands/apps/data/delete.d.ts +15 -0
- package/dist/commands/apps/data/delete.js +57 -0
- package/dist/commands/apps/data/patch.d.ts +17 -0
- package/dist/commands/apps/data/patch.js +70 -0
- package/dist/commands/apps/data/put.js +1 -1
- package/dist/commands/apps/data/query.js +1 -1
- package/dist/commands/apps/installations/diff.d.ts +14 -0
- package/dist/commands/apps/installations/diff.js +45 -0
- package/dist/commands/apps/installations/events.d.ts +23 -0
- package/dist/commands/apps/installations/events.js +104 -0
- package/dist/commands/apps/installations/snapshot.d.ts +18 -0
- package/dist/commands/apps/installations/snapshot.js +60 -0
- package/dist/commands/apps/installations/versions.d.ts +12 -0
- package/dist/commands/apps/installations/versions.js +38 -0
- package/dist/commands/apps/logs.js +3 -0
- package/dist/commands/apps/preview.js +4 -2
- package/dist/commands/apps/pull.js +10 -1
- package/dist/commands/apps/push.js +36 -12
- package/dist/commands/apps/reference.d.ts +26 -0
- package/dist/commands/apps/reference.js +56 -0
- package/dist/commands/apps/rollback.d.ts +13 -0
- package/dist/commands/apps/rollback.js +47 -0
- package/dist/commands/apps/version/create.js +5 -0
- package/dist/commands/duties/accounting.js +6 -0
- package/dist/commands/duties/analytics/detail.js +6 -0
- package/dist/commands/duties/analytics/index.js +14 -0
- package/dist/commands/duties/analytics/replay.js +6 -0
- package/dist/commands/duties/cost.js +6 -0
- package/dist/commands/duties/delete.js +22 -19
- package/dist/commands/duties/doctor.d.ts +2 -1
- package/dist/commands/duties/doctor.js +17 -3
- package/dist/commands/duties/goals/link.js +4 -0
- package/dist/commands/duties/goals/unlink.js +4 -0
- package/dist/commands/duties/lineage.js +6 -1
- package/dist/commands/duties/links/list.js +6 -0
- package/dist/commands/duties/metrics.js +10 -0
- package/dist/commands/duties/observations.js +12 -0
- package/dist/commands/duties/operating-review.d.ts +4 -30
- package/dist/commands/duties/operating-review.js +28 -141
- package/dist/commands/duties/receipt-metrics.js +7 -0
- package/dist/commands/duties/receipt.js +7 -0
- package/dist/commands/duties/roster.js +14 -8
- package/dist/commands/duties/show.js +27 -9
- package/dist/commands/duties/status.js +18 -9
- package/dist/commands/duties/trigger-status.d.ts +2 -0
- package/dist/commands/duties/trigger-status.js +19 -1
- package/dist/commands/duties/wake-capabilities.d.ts +2 -0
- package/dist/commands/duties/wake-capabilities.js +32 -2
- package/dist/commands/followups/act.js +3 -0
- package/dist/commands/followups/remind.js +12 -3
- package/dist/commands/followups/show.js +6 -0
- package/dist/commands/harnesses/quota.js +1 -1
- package/dist/commands/spaces/notebook.d.ts +3 -7
- package/dist/commands/spaces/notebook.js +32 -8
- package/dist/commands/tasks/create.d.ts +2 -2
- package/dist/commands/tasks/create.js +3 -3
- package/dist/commands/tasks/list.d.ts +3 -41
- package/dist/commands/tasks/list.js +5 -53
- package/dist/generated/agent-guides.json +424 -101
- package/dist/generated/managed-instruction-guides.json +1 -1
- package/dist/lib/agent-activity.d.ts +68 -0
- package/dist/lib/agent-activity.js +106 -0
- package/dist/lib/always-on-runtime.d.ts +9 -0
- package/dist/lib/always-on-runtime.js +20 -0
- package/dist/lib/api-fetch.d.ts +10 -0
- package/dist/lib/api-fetch.js +12 -2
- package/dist/lib/appData.d.ts +28 -1
- package/dist/lib/appData.js +111 -9
- package/dist/lib/appInstallations.d.ts +9 -1
- package/dist/lib/appInstallations.js +100 -0
- package/dist/lib/apps-command.d.ts +1 -0
- package/dist/lib/apps-command.js +11 -0
- package/dist/lib/apps.d.ts +12 -0
- package/dist/lib/apps.js +28 -1
- package/dist/lib/appsAssets.d.ts +17 -0
- package/dist/lib/appsAssets.js +15 -0
- package/dist/lib/appsCheck.d.ts +1 -0
- package/dist/lib/appsCheck.js +1 -0
- package/dist/lib/appsFs.d.ts +18 -1
- package/dist/lib/appsFs.js +76 -19
- package/dist/lib/compasses.js +6 -0
- package/dist/lib/duties.d.ts +25 -2
- package/dist/lib/duties.js +58 -3
- package/dist/lib/duty-analytics.d.ts +2 -0
- package/dist/lib/duty-analytics.js +26 -0
- package/dist/lib/duty-goal-propagation.d.ts +2 -0
- package/dist/lib/duty-goal-propagation.js +18 -0
- package/dist/lib/duty-history-source.d.ts +4 -0
- package/dist/lib/duty-history-source.js +12 -0
- package/dist/lib/duty-ledgers.d.ts +4 -0
- package/dist/lib/duty-ledgers.js +4 -0
- package/dist/lib/duty-receipt-source.d.ts +4 -0
- package/dist/lib/duty-receipt-source.js +19 -0
- package/dist/lib/followups.d.ts +20 -0
- package/dist/lib/followups.js +10 -0
- package/dist/lib/held-messages.d.ts +22 -0
- package/dist/lib/held-messages.js +55 -0
- package/dist/lib/list-workspace.d.ts +40 -0
- package/dist/lib/list-workspace.js +58 -0
- package/dist/lib/miniComputer.d.ts +59 -0
- package/dist/lib/miniComputer.js +224 -0
- package/dist/lib/miniComputerCommand.d.ts +13 -0
- package/dist/lib/miniComputerCommand.js +48 -0
- package/dist/lib/roles.d.ts +3 -3
- package/dist/lib/space-notebook.js +15 -4
- package/dist/node_modules/@skrr-ai/data-provider/index.js +10465 -8383
- package/oclif.manifest.json +2789 -533
- package/package.json +14 -2
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TASKS_VIEW_DATE_PRESETS = exports.TASKS_VIEW_DATE_FIELDS = exports.MINI_COMPUTER_REFUSAL_CODES = void 0;
|
|
4
|
+
exports.readMiniComputerRefusal = readMiniComputerRefusal;
|
|
5
|
+
exports.describeMiniComputerRefusal = describeMiniComputerRefusal;
|
|
6
|
+
exports.tasksConfigFromFlags = tasksConfigFromFlags;
|
|
7
|
+
exports.formatMiniAppConfig = formatMiniAppConfig;
|
|
8
|
+
exports.formatMiniComputerLayout = formatMiniComputerLayout;
|
|
9
|
+
exports.formatLayoutChangeResult = formatLayoutChangeResult;
|
|
10
|
+
exports.parseOpsText = parseOpsText;
|
|
11
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
12
|
+
/** Read a refusal out of an API error, or null when the error is not one the Mini Computer routes made. */
|
|
13
|
+
function readMiniComputerRefusal(error) {
|
|
14
|
+
const e = error;
|
|
15
|
+
if (!e || typeof e.body !== 'string')
|
|
16
|
+
return null;
|
|
17
|
+
try {
|
|
18
|
+
const body = JSON.parse(e.body);
|
|
19
|
+
if (!body || typeof body !== 'object' || typeof body.code !== 'string')
|
|
20
|
+
return null;
|
|
21
|
+
return {
|
|
22
|
+
...(typeof e.status === 'number' ? { status: e.status } : {}),
|
|
23
|
+
code: body.code,
|
|
24
|
+
...(typeof body.issue === 'string' ? { issue: body.issue } : {}),
|
|
25
|
+
...(typeof body.message === 'string' ? { message: body.message } : {}),
|
|
26
|
+
...(typeof body.currentRev === 'number' ? { currentRev: body.currentRev } : {}),
|
|
27
|
+
...(typeof body.opCode === 'string' ? { opCode: body.opCode } : {}),
|
|
28
|
+
...(typeof body.opIndex === 'number' ? { opIndex: body.opIndex } : {}),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/** Every refusal the routes make, in words with the next step. A Record, so a new one has to be given words. */
|
|
36
|
+
const REFUSAL_WORDS = {
|
|
37
|
+
not_found: () => ({
|
|
38
|
+
message: 'There is no such Agent that you can see. Nothing was changed.',
|
|
39
|
+
code: 'MINI_COMPUTER_NOT_FOUND',
|
|
40
|
+
exit: 4,
|
|
41
|
+
retryable: false,
|
|
42
|
+
}),
|
|
43
|
+
forbidden: () => ({
|
|
44
|
+
message: 'You can see this Agent but may not edit it, so its app configuration cannot be changed.',
|
|
45
|
+
code: 'MINI_COMPUTER_FORBIDDEN',
|
|
46
|
+
exit: 3,
|
|
47
|
+
retryable: false,
|
|
48
|
+
}),
|
|
49
|
+
invalid_input: (r) => ({
|
|
50
|
+
message: `The server did not accept that${r.issue ? ` (${r.issue})` : ''}. Nothing was changed.`,
|
|
51
|
+
code: 'MINI_COMPUTER_INVALID',
|
|
52
|
+
exit: 2,
|
|
53
|
+
retryable: false,
|
|
54
|
+
}),
|
|
55
|
+
unknown_app: () => ({
|
|
56
|
+
message: 'That is not an app with a configuration slot. Run `skrr agents mini-computer show <agent-id>` for the apps, or use one of the built-in app ids (for example tasks).',
|
|
57
|
+
code: 'MINI_COMPUTER_UNKNOWN_APP',
|
|
58
|
+
exit: 2,
|
|
59
|
+
retryable: false,
|
|
60
|
+
}),
|
|
61
|
+
too_large: (r) => ({
|
|
62
|
+
message: `That configuration is too large${r.issue ? ` (${r.issue})` : ''}. Nothing was changed.`,
|
|
63
|
+
code: 'MINI_COMPUTER_TOO_LARGE',
|
|
64
|
+
exit: 2,
|
|
65
|
+
retryable: false,
|
|
66
|
+
}),
|
|
67
|
+
rev_mismatch: (r) => ({
|
|
68
|
+
message: `It is now at revision ${r.currentRev ?? '?'}: it changed since you read it. Nothing was written. Read it again and retry.`,
|
|
69
|
+
code: 'MINI_COMPUTER_REV_MISMATCH',
|
|
70
|
+
exit: 1,
|
|
71
|
+
retryable: false,
|
|
72
|
+
}),
|
|
73
|
+
busy: () => ({
|
|
74
|
+
message: 'Other changes kept landing at the same moment. Nothing was lost; run the command again.',
|
|
75
|
+
code: 'MINI_COMPUTER_BUSY',
|
|
76
|
+
exit: 1,
|
|
77
|
+
retryable: true,
|
|
78
|
+
}),
|
|
79
|
+
layout_unreadable: () => ({
|
|
80
|
+
message: 'The stored layout is not in a form this version understands. Nothing was changed.',
|
|
81
|
+
code: 'MINI_COMPUTER_LAYOUT_UNREADABLE',
|
|
82
|
+
exit: 1,
|
|
83
|
+
retryable: false,
|
|
84
|
+
}),
|
|
85
|
+
op_refused: (r) => ({
|
|
86
|
+
message: `${r.message ?? 'The change cannot be made.'}${r.opIndex !== undefined ? ` (operation ${r.opIndex + 1})` : ''} Nothing was changed.`,
|
|
87
|
+
code: `MINI_COMPUTER_${(r.opCode ?? 'OP_REFUSED').toUpperCase()}`,
|
|
88
|
+
exit: 1,
|
|
89
|
+
retryable: false,
|
|
90
|
+
}),
|
|
91
|
+
proposal_not_found: () => ({
|
|
92
|
+
message: 'That suggestion is no longer there.',
|
|
93
|
+
code: 'MINI_COMPUTER_PROPOSAL_NOT_FOUND',
|
|
94
|
+
exit: 4,
|
|
95
|
+
retryable: false,
|
|
96
|
+
}),
|
|
97
|
+
proposal_stale: (r) => ({
|
|
98
|
+
message: r.message ?? 'That suggestion no longer fits the layout.',
|
|
99
|
+
code: 'MINI_COMPUTER_PROPOSAL_STALE',
|
|
100
|
+
exit: 1,
|
|
101
|
+
retryable: false,
|
|
102
|
+
}),
|
|
103
|
+
change_not_found: () => ({
|
|
104
|
+
message: 'That change is not recorded.',
|
|
105
|
+
code: 'MINI_COMPUTER_CHANGE_NOT_FOUND',
|
|
106
|
+
exit: 4,
|
|
107
|
+
retryable: false,
|
|
108
|
+
}),
|
|
109
|
+
change_not_undoable: () => ({
|
|
110
|
+
message: 'That change can no longer be undone: the layout moved on after it.',
|
|
111
|
+
code: 'MINI_COMPUTER_CHANGE_NOT_UNDOABLE',
|
|
112
|
+
exit: 1,
|
|
113
|
+
retryable: false,
|
|
114
|
+
}),
|
|
115
|
+
};
|
|
116
|
+
exports.MINI_COMPUTER_REFUSAL_CODES = Object.keys(REFUSAL_WORDS);
|
|
117
|
+
function describeMiniComputerRefusal(refusal, bin = 'skrr') {
|
|
118
|
+
const words = REFUSAL_WORDS[refusal.code];
|
|
119
|
+
return words ? words(refusal, bin) : null;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* The Tasks mini app configuration a set of flags describes (the server validates it again; this only shapes it).
|
|
123
|
+
* `type` is required: a view with no layout is not a view.
|
|
124
|
+
*/
|
|
125
|
+
function tasksConfigFromFlags(flags) {
|
|
126
|
+
const filters = {};
|
|
127
|
+
if (flags['quick-filter'])
|
|
128
|
+
filters.quickFilter = flags['quick-filter'];
|
|
129
|
+
if (flags.status?.length)
|
|
130
|
+
filters.statuses = flags.status;
|
|
131
|
+
if (flags.priority?.length)
|
|
132
|
+
filters.priorities = flags.priority;
|
|
133
|
+
if (flags.label?.length)
|
|
134
|
+
filters.labels = flags.label;
|
|
135
|
+
if (flags.assignee?.length)
|
|
136
|
+
filters.assignees = flags.assignee;
|
|
137
|
+
if (flags.search)
|
|
138
|
+
filters.search = flags.search;
|
|
139
|
+
const view = { viewType: flags.type };
|
|
140
|
+
if (flags.name)
|
|
141
|
+
view.name = flags.name;
|
|
142
|
+
if (flags['group-by'])
|
|
143
|
+
view.groupBy = flags['group-by'];
|
|
144
|
+
if (flags.sort || flags['sort-dir']) {
|
|
145
|
+
view.sort = { key: flags.sort ?? 'manual', dir: flags['sort-dir'] ?? 'asc' };
|
|
146
|
+
}
|
|
147
|
+
if (Object.keys(filters).length > 0)
|
|
148
|
+
view.filters = filters;
|
|
149
|
+
if (flags['date-preset'] || flags.after || flags.before) {
|
|
150
|
+
view.dateFilter = {
|
|
151
|
+
field: flags['date-field'] ?? 'dueOrScheduled',
|
|
152
|
+
...(flags['date-preset'] ? { preset: flags['date-preset'] } : {}),
|
|
153
|
+
...(flags.after ? { after: flags.after } : {}),
|
|
154
|
+
...(flags.before ? { before: flags.before } : {}),
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
return { view };
|
|
158
|
+
}
|
|
159
|
+
exports.TASKS_VIEW_DATE_FIELDS = data_provider_1.DATE_FILTER_FIELDS;
|
|
160
|
+
exports.TASKS_VIEW_DATE_PRESETS = data_provider_1.DATE_FILTER_PRESETS;
|
|
161
|
+
// ── reading it back ─────────────────────────────────────────────────────────
|
|
162
|
+
const labelOf = (id) => data_provider_1.MINI_COMPUTER_BUILTIN_APPS.find((app) => app.id === id)?.label ?? id;
|
|
163
|
+
/** One app's slot, in lines. */
|
|
164
|
+
function formatMiniAppConfig(raw) {
|
|
165
|
+
const entry = (0, data_provider_1.parseMiniAppConfigEntry)(raw);
|
|
166
|
+
if (entry === null)
|
|
167
|
+
return ['This configuration is not in a form this version of the CLI understands.'];
|
|
168
|
+
if (entry.config === null)
|
|
169
|
+
return [`${entry.appId}: default (nothing set)`];
|
|
170
|
+
const view = entry.config.view;
|
|
171
|
+
const lines = [
|
|
172
|
+
`${entry.appId}: revision ${entry.rev}${entry.via ? `, set by ${entry.via}` : ''}`,
|
|
173
|
+
];
|
|
174
|
+
if (view) {
|
|
175
|
+
lines.push(` view${view.name ? ` "${view.name}"` : ''}: ${view.viewType}${view.groupBy ? `, grouped by ${view.groupBy}` : ''}`);
|
|
176
|
+
}
|
|
177
|
+
lines.push(` ${JSON.stringify(entry.config)}`);
|
|
178
|
+
return lines;
|
|
179
|
+
}
|
|
180
|
+
/** The layout a person sees, in lines: the dock, the home grid, the folders, what is hidden, and what waits. */
|
|
181
|
+
function formatMiniComputerLayout(raw) {
|
|
182
|
+
const read = (0, data_provider_1.parseMiniComputerLayoutRead)(raw);
|
|
183
|
+
if (read === null) {
|
|
184
|
+
return [
|
|
185
|
+
'This layout is not in a form this version of the CLI understands, so it is not shown.',
|
|
186
|
+
];
|
|
187
|
+
}
|
|
188
|
+
const seen = (0, data_provider_1.describeMiniComputerLayout)(read.layout);
|
|
189
|
+
const names = (ids) => ids.map((id) => (id.startsWith('app:') ? id : labelOf(id)));
|
|
190
|
+
const lines = [
|
|
191
|
+
read.stored ? `Layout revision ${read.rev}.` : 'Layout: nothing arranged yet (the defaults).',
|
|
192
|
+
`Agent changes: ${read.agentChanges === 'apply' ? 'applied at once (undoable)' : 'proposed for the person to apply'} (the person chooses this).`,
|
|
193
|
+
`Dock (${seen.dock.length}/${data_provider_1.MINI_COMPUTER_MAX_DOCK_APPS}): ${names(seen.dock).join(', ') || '(empty)'}`,
|
|
194
|
+
`Home: ${names(seen.home.filter((id) => !id.startsWith('folder:'))).join(', ') || '(empty)'}`,
|
|
195
|
+
];
|
|
196
|
+
for (const folder of seen.folders) {
|
|
197
|
+
lines.push(`Folder "${folder.name}": ${names(folder.apps).join(', ') || '(empty)'}`);
|
|
198
|
+
}
|
|
199
|
+
if (seen.removed.length > 0)
|
|
200
|
+
lines.push(`Removed: ${names(seen.removed).join(', ')}`);
|
|
201
|
+
for (const proposal of read.proposals) {
|
|
202
|
+
lines.push(`Waiting for the person: ${proposal.summary.join('; ')}`);
|
|
203
|
+
}
|
|
204
|
+
const latest = read.changes[0];
|
|
205
|
+
if (latest)
|
|
206
|
+
lines.push(`Latest change: ${latest.summary.join('; ')}${latest.undoable ? ' (can be undone)' : ''}`);
|
|
207
|
+
return lines;
|
|
208
|
+
}
|
|
209
|
+
/** What a change answered, in lines for the Agent that asked. */
|
|
210
|
+
function formatLayoutChangeResult(result) {
|
|
211
|
+
const lines = result.summary.length > 0
|
|
212
|
+
? result.summary.map((line) => ` ${line}`)
|
|
213
|
+
: [' (no change: it already looks like that)'];
|
|
214
|
+
const heading = { applied: 'Applied', proposed: 'Proposed', noop: 'Unchanged' }[result.outcome];
|
|
215
|
+
return [`${heading}:`, ...lines, result.note];
|
|
216
|
+
}
|
|
217
|
+
/** Operations from `--ops` or `--file` JSON text. Returns the raw array for the server to validate. */
|
|
218
|
+
function parseOpsText(text) {
|
|
219
|
+
const parsed = JSON.parse(text);
|
|
220
|
+
const ops = Array.isArray(parsed) ? parsed : parsed?.ops;
|
|
221
|
+
if (!Array.isArray(ops))
|
|
222
|
+
throw new Error('expected a JSON array of operations, or { "ops": [...] }');
|
|
223
|
+
return ops;
|
|
224
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { MiniComputerLayoutOp } from '@skrr-ai/data-provider';
|
|
2
|
+
import { BaseCommand } from '../base-command';
|
|
3
|
+
/**
|
|
4
|
+
* The base of every `skrr agents mini-computer` command. A refusal of the Mini Computer routes is an ANSWER with a
|
|
5
|
+
* next step (a stale revision, a dock that is full), so it comes under its own machine code and exit; one this does
|
|
6
|
+
* not know (not signed in, the server being down) is the base command's.
|
|
7
|
+
*/
|
|
8
|
+
export declare abstract class MiniComputerCommand extends BaseCommand {
|
|
9
|
+
/** Say what went wrong. Never returns. */
|
|
10
|
+
protected failMiniComputer(error: unknown): never;
|
|
11
|
+
/** Send operations to the person's Mini Computer (their policy decides whether they apply) and print the answer. */
|
|
12
|
+
protected sendLayoutOps(agentId: string, ops: MiniComputerLayoutOp[], json: boolean): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MiniComputerCommand = void 0;
|
|
4
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
5
|
+
const base_command_1 = require("../base-command");
|
|
6
|
+
const miniComputer_1 = require("./miniComputer");
|
|
7
|
+
/**
|
|
8
|
+
* The base of every `skrr agents mini-computer` command. A refusal of the Mini Computer routes is an ANSWER with a
|
|
9
|
+
* next step (a stale revision, a dock that is full), so it comes under its own machine code and exit; one this does
|
|
10
|
+
* not know (not signed in, the server being down) is the base command's.
|
|
11
|
+
*/
|
|
12
|
+
class MiniComputerCommand extends base_command_1.BaseCommand {
|
|
13
|
+
/** Say what went wrong. Never returns. */
|
|
14
|
+
failMiniComputer(error) {
|
|
15
|
+
const refusal = (0, miniComputer_1.readMiniComputerRefusal)(error);
|
|
16
|
+
const failure = refusal ? (0, miniComputer_1.describeMiniComputerRefusal)(refusal, this.config.bin) : null;
|
|
17
|
+
if (refusal && failure) {
|
|
18
|
+
return this.failWithCliError({
|
|
19
|
+
message: failure.message,
|
|
20
|
+
code: failure.code,
|
|
21
|
+
...(refusal.status === undefined ? {} : { status: refusal.status }),
|
|
22
|
+
exit: failure.exit,
|
|
23
|
+
retryable: failure.retryable,
|
|
24
|
+
...(refusal.currentRev === undefined
|
|
25
|
+
? {}
|
|
26
|
+
: { details: { currentRev: refusal.currentRev } }),
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return this.handleApiError(error);
|
|
30
|
+
}
|
|
31
|
+
/** Send operations to the person's Mini Computer (their policy decides whether they apply) and print the answer. */
|
|
32
|
+
async sendLayoutOps(agentId, ops, json) {
|
|
33
|
+
try {
|
|
34
|
+
const result = await data_provider_1.dataService.changeMiniComputerLayout(agentId, { ops });
|
|
35
|
+
if (json) {
|
|
36
|
+
this.log(this.agentJson(agentId, result));
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
for (const line of (0, miniComputer_1.formatLayoutChangeResult)(result))
|
|
40
|
+
this.log(line);
|
|
41
|
+
this.printAgentUrl(agentId);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
this.failMiniComputer(error);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.MiniComputerCommand = MiniComputerCommand;
|
package/dist/lib/roles.d.ts
CHANGED
|
@@ -49,17 +49,17 @@ export declare const roleApi: {
|
|
|
49
49
|
successCriteria: {
|
|
50
50
|
id: string;
|
|
51
51
|
label: string;
|
|
52
|
-
evaluator?: "manual" | "
|
|
52
|
+
evaluator?: "manual" | "metric" | "source_state" | "task_state" | "goal_state" | "llm_review" | undefined;
|
|
53
53
|
config?: Record<string, unknown> | undefined;
|
|
54
54
|
}[];
|
|
55
55
|
sources: {
|
|
56
|
-
source: "space" | "tasks" | "memory" | "daemon" | "email" | "goal" | "files" | "local" | "browser" | "
|
|
56
|
+
source: "space" | "tasks" | "memory" | "daemon" | "email" | "goal" | "files" | "local" | "browser" | "metrics" | "monitor" | "github" | "conversations" | "agent_initiatives" | "messages" | "docs" | "documents" | "slack" | "calendar" | "product_metrics" | "business_metrics" | "state_monitor" | "agent_run";
|
|
57
57
|
enabled: boolean;
|
|
58
58
|
config?: Record<string, unknown> | undefined;
|
|
59
59
|
}[];
|
|
60
60
|
evidenceKeys: string[];
|
|
61
61
|
wake: {
|
|
62
|
-
mode: "manual" | "
|
|
62
|
+
mode: "manual" | "interval" | "daily" | "event_plus_interval";
|
|
63
63
|
timezone: string;
|
|
64
64
|
intervalMs?: number | undefined;
|
|
65
65
|
times?: string[] | undefined;
|
|
@@ -100,12 +100,19 @@ function detailLines(row) {
|
|
|
100
100
|
/** The lines `spaces notebook` prints for one page. */
|
|
101
101
|
function notebookLines(page, { webOrigin, binName }) {
|
|
102
102
|
const lines = [];
|
|
103
|
-
|
|
103
|
+
const unsupported = new Set(page.sources.filter((source) => source.state === 'unsupported').map((source) => source.kind));
|
|
104
|
+
// A server may include an older cached row for a now unsupported source.
|
|
105
|
+
// Do not display it as an authorized historical record.
|
|
106
|
+
const rows = page.rows.filter((row) => !unsupported.has(row.kind));
|
|
107
|
+
const allSourcesEnded = page.kinds.every((kind) => page.sources.find((source) => source.kind === kind)?.state === 'ended');
|
|
108
|
+
if (!rows.length) {
|
|
104
109
|
lines.push(page.nextCursor
|
|
105
110
|
? 'Nothing on this page.'
|
|
106
|
-
:
|
|
111
|
+
: allSourcesEnded
|
|
112
|
+
? `No available records in this listing (${page.kinds.map(data_provider_1.spaceNotebookKindLabel).join(', ')}).`
|
|
113
|
+
: 'No records from the available sources on this page; some sources were not read to their end.');
|
|
107
114
|
}
|
|
108
|
-
for (const row of
|
|
115
|
+
for (const row of rows) {
|
|
109
116
|
const tag = (KIND_TAG[row.kind] || row.kind).padEnd(10);
|
|
110
117
|
lines.push(`${row.at} ${tag} ${oneLine(row.title, 80)} · ${notebookAuthorLabel(row.author)}`);
|
|
111
118
|
if (row.summary) {
|
|
@@ -117,6 +124,10 @@ function notebookLines(page, { webOrigin, binName }) {
|
|
|
117
124
|
}
|
|
118
125
|
const notes = [];
|
|
119
126
|
for (const source of page.sources) {
|
|
127
|
+
if (source.state === 'unsupported') {
|
|
128
|
+
notes.push(`${(0, data_provider_1.spaceNotebookKindLabel)(source.kind)} are unavailable because their historical source cannot be verified.`);
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
120
131
|
if (source.state !== 'ended')
|
|
121
132
|
continue;
|
|
122
133
|
for (const window of source.windows || []) {
|
|
@@ -124,7 +135,7 @@ function notebookLines(page, { webOrigin, binName }) {
|
|
|
124
135
|
}
|
|
125
136
|
}
|
|
126
137
|
// Who may see a loop row, once per rule the page shows.
|
|
127
|
-
for (const row of
|
|
138
|
+
for (const row of rows) {
|
|
128
139
|
if ('visibility' in row && row.visibility) {
|
|
129
140
|
notes.push((0, data_provider_1.describeSpaceNotebookVisibility)(row.visibility));
|
|
130
141
|
}
|