@skrr-ai/cli 0.1.162 → 0.1.164
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.d.ts +5 -2
- package/dist/base-command.js +108 -39
- package/dist/commands/activity/list.d.ts +7 -0
- package/dist/commands/activity/list.js +17 -0
- package/dist/commands/activity/scan-older.d.ts +2 -2
- package/dist/commands/activity/scan-older.js +6 -5
- package/dist/commands/activity/show.d.ts +0 -2
- package/dist/commands/activity/show.js +21 -42
- package/dist/commands/agents/always-on/release-run.d.ts +3 -3
- package/dist/commands/agents/always-on/release-run.js +5 -6
- package/dist/commands/agents/mini-computer/app/reset.d.ts +1 -0
- package/dist/commands/agents/mini-computer/app/reset.js +5 -2
- package/dist/commands/agents/mini-computer/app/set.js +1 -1
- package/dist/commands/agents/mini-computer/show.js +10 -2
- package/dist/commands/agents/mini-computer/tasks-view.js +2 -2
- package/dist/commands/agents/supervision.d.ts +25 -0
- package/dist/commands/agents/supervision.js +129 -0
- package/dist/commands/agents/triggers/replay.js +1 -1
- package/dist/commands/agents/triggers/runs.d.ts +2 -3
- package/dist/commands/agents/triggers/runs.js +4 -5
- package/dist/commands/apps/auto-apply.js +31 -10
- package/dist/commands/apps/check.js +8 -0
- package/dist/commands/apps/data/batch.js +16 -5
- package/dist/commands/apps/data/collections.js +1 -1
- package/dist/commands/apps/data/delete.js +12 -4
- package/dist/commands/apps/data/patch.js +11 -4
- package/dist/commands/apps/data/put.js +13 -6
- package/dist/commands/apps/data/query.js +3 -3
- package/dist/commands/apps/install.js +24 -7
- package/dist/commands/apps/installations/events.d.ts +1 -0
- package/dist/commands/apps/installations/events.js +63 -10
- package/dist/commands/apps/installations/show.js +26 -5
- package/dist/commands/apps/installations/snapshot.js +1 -1
- package/dist/commands/apps/installations/versions.js +25 -9
- package/dist/commands/apps/logs.js +4 -1
- package/dist/commands/apps/push.js +10 -2
- package/dist/commands/apps/reconsent.js +7 -1
- package/dist/commands/apps/rollback.js +2 -2
- package/dist/commands/apps/settings/set.js +81 -4
- package/dist/commands/apps/settings/show.js +38 -7
- package/dist/commands/duties/action-proposal.js +19 -11
- package/dist/commands/duties/cadence-decisions.js +7 -0
- package/dist/commands/duties/status.js +20 -15
- package/dist/commands/duties/trigger-status.js +2 -2
- package/dist/commands/duties/wake-capabilities.js +12 -6
- package/dist/commands/outbox/drop.js +21 -15
- package/dist/commands/outbox/list.d.ts +2 -1
- package/dist/commands/outbox/list.js +20 -11
- package/dist/commands/outbox/retry.d.ts +8 -11
- package/dist/commands/outbox/retry.js +135 -92
- package/dist/commands/spaces/create.js +1 -1
- package/dist/commands/tasks/comments/add.js +1 -1
- package/dist/commands/triggers/audit.js +3 -5
- package/dist/commands/triggers/fire-detail.js +7 -1
- package/dist/commands/triggers/replay.js +1 -1
- package/dist/commands/triggers/runs.d.ts +2 -4
- package/dist/commands/triggers/runs.js +3 -5
- package/dist/generated/agent-guides.json +19 -19
- package/dist/lib/agent-activity.d.ts +21 -1
- package/dist/lib/agent-activity.js +98 -29
- package/dist/lib/api-fetch.d.ts +2 -0
- package/dist/lib/api-fetch.js +5 -5
- package/dist/lib/appData.d.ts +43 -5
- package/dist/lib/appData.js +117 -25
- package/dist/lib/appInstallations.d.ts +5 -5
- package/dist/lib/appInstallations.js +232 -74
- package/dist/lib/appSettings.d.ts +2 -0
- package/dist/lib/appSettings.js +36 -3
- package/dist/lib/apps-command.d.ts +9 -0
- package/dist/lib/apps-command.js +191 -7
- package/dist/lib/appsCheck.js +40 -3
- package/dist/lib/appsFs.d.ts +1 -1
- package/dist/lib/chat-supervision.d.ts +21 -0
- package/dist/lib/chat-supervision.js +37 -0
- package/dist/lib/duties.d.ts +4 -0
- package/dist/lib/json-output.d.ts +4 -0
- package/dist/lib/json-output.js +38 -0
- package/dist/lib/miniComputer.d.ts +1 -0
- package/dist/lib/miniComputer.js +16 -4
- package/dist/lib/miniComputerCommand.js +4 -1
- package/dist/lib/node-adapter.js +35 -2
- package/dist/lib/outbox.d.ts +20 -5
- package/dist/lib/outbox.js +233 -76
- package/dist/lib/rate-limit-retry.d.ts +3 -2
- package/dist/lib/rate-limit-retry.js +3 -2
- package/dist/lib/roles.d.ts +1 -1
- package/dist/lib/triggers.d.ts +3 -0
- package/dist/lib/triggers.js +10 -0
- package/dist/lib/widgetCheck.js +30 -4
- package/dist/lib/widgetStaticScan.d.ts +17 -6
- package/dist/lib/widgetStaticScan.js +336 -94
- package/dist/node_modules/@skrr-ai/data-provider/APP_HTML_PARSER_LICENSES.txt +36 -0
- package/dist/node_modules/@skrr-ai/data-provider/index.js +15543 -10133
- package/oclif.manifest.json +334 -47
- package/package.json +5 -3
package/dist/base-command.d.ts
CHANGED
|
@@ -84,6 +84,7 @@ export declare abstract class BaseCommand extends Command {
|
|
|
84
84
|
*/
|
|
85
85
|
protected printJsonResult(value: unknown, options?: {
|
|
86
86
|
ok?: boolean;
|
|
87
|
+
preserveAppData?: boolean;
|
|
87
88
|
}): void;
|
|
88
89
|
/**
|
|
89
90
|
* A task write the Space write policy HELD for approval (OSK-17988): the
|
|
@@ -436,7 +437,8 @@ export declare abstract class BaseCommand extends Command {
|
|
|
436
437
|
* For commands where the USER AUTHORED THE CONTENT — a completion summary, a
|
|
437
438
|
* comment body, a new Space — losing it to a 503 costs the thinking, not just
|
|
438
439
|
* a retry. Those commands call this instead of `handleApiError`, and the
|
|
439
|
-
* content lands in the outbox
|
|
440
|
+
* content lands in the outbox for reconciliation. Automatic replay is
|
|
441
|
+
* paused while the original request context cannot be verified.
|
|
440
442
|
*
|
|
441
443
|
* Two invariants the caller must honour, both load-bearing:
|
|
442
444
|
*
|
|
@@ -458,7 +460,7 @@ export declare abstract class BaseCommand extends Command {
|
|
|
458
460
|
url: string;
|
|
459
461
|
body: unknown;
|
|
460
462
|
idempotencyKey: string;
|
|
461
|
-
}): never
|
|
463
|
+
}): Promise<never>;
|
|
462
464
|
protected failWithCliError({ message, code, status, exit, retryable, details, requestId, }: {
|
|
463
465
|
message: string;
|
|
464
466
|
code: string;
|
|
@@ -732,4 +734,5 @@ export declare function parseErrorRemedy(err: Error & {
|
|
|
732
734
|
fix?: string;
|
|
733
735
|
flag?: string;
|
|
734
736
|
};
|
|
737
|
+
export declare function isOclifExitError(err: Error): boolean;
|
|
735
738
|
export { Flags };
|
package/dist/base-command.js
CHANGED
|
@@ -24,6 +24,7 @@ exports.errorBodyMessage = errorBodyMessage;
|
|
|
24
24
|
exports.envelopeDetails = envelopeDetails;
|
|
25
25
|
exports.retiredFlagHint = retiredFlagHint;
|
|
26
26
|
exports.parseErrorRemedy = parseErrorRemedy;
|
|
27
|
+
exports.isOclifExitError = isOclifExitError;
|
|
27
28
|
const space_write_policy_1 = require("./lib/space-write-policy");
|
|
28
29
|
const node_fs_1 = require("node:fs");
|
|
29
30
|
const core_1 = require("@oclif/core");
|
|
@@ -81,6 +82,10 @@ const task_resource_references_1 = require("./lib/task-resource-references");
|
|
|
81
82
|
const tasks_1 = require("./lib/tasks");
|
|
82
83
|
const RESOLVE_TASK_RESOURCE_REFERENCES_RE = /^[\da-f-]{36}$/i;
|
|
83
84
|
const RESOLVE_TASK_RESOURCE_REFERENCES_RE_2 = /^[\da-f]{24}$/i;
|
|
85
|
+
/** Control, combining and invisible characters, escaped in the unsaved-recovery text so it prints inertly. */
|
|
86
|
+
/* eslint-disable no-misleading-character-class -- the point of the pattern is to match combining and invisible characters */
|
|
87
|
+
const RECOVERY_INVISIBLE_CHARS = /[\u007f-\u009f\u00ad\u034f\u061c\u115f\u1160\u17b4\u17b5\u180b-\u180e\u200b-\u200f\u2028-\u202e\u2060-\u206f\u2800\u3164\ufe00-\ufe0f\ufeff\uffa0\ufff9-\ufffb\u{1d173}-\u{1d17a}\u{e0000}-\u{e03ff}]/gu;
|
|
88
|
+
/* eslint-enable no-misleading-character-class */
|
|
84
89
|
const HANDLE_API_ERROR_RE = /\s*Run `[^`]+` to sign in again\.$/;
|
|
85
90
|
const HAS_REMEDY_LINE_RE = /^\s*→/m;
|
|
86
91
|
const UNSUPPORTED_FLAG_REMEDY_FOR_MESSAGE_RE = /Nonexistent flag[s]?:?\s*(-{1,2}[\w-]+)/i;
|
|
@@ -204,8 +209,8 @@ class BaseCommand extends core_1.Command {
|
|
|
204
209
|
* `--raw` / `OVERSKY_CLI_RAW=1` opts out.
|
|
205
210
|
*/
|
|
206
211
|
log(message, ...args) {
|
|
207
|
-
const text = typeof message === 'string' && this.wantsJsonOutput()
|
|
208
|
-
? (0, json_output_1.stripStorageFieldsFromText)(message)
|
|
212
|
+
const text = typeof message === 'string' && this.wantsJsonOutput()
|
|
213
|
+
? (0, json_output_1.escapeJsonForTerminal)(this.wantsRawJson() ? message : (0, json_output_1.stripStorageFieldsFromText)(message))
|
|
209
214
|
: message;
|
|
210
215
|
super.log(text, ...args);
|
|
211
216
|
}
|
|
@@ -228,7 +233,14 @@ class BaseCommand extends core_1.Command {
|
|
|
228
233
|
* that has not been moved here yet.
|
|
229
234
|
*/
|
|
230
235
|
printJsonResult(value, options = {}) {
|
|
231
|
-
|
|
236
|
+
const result = (0, json_output_1.withOk)(value, options.ok ?? true);
|
|
237
|
+
if (options.preserveAppData) {
|
|
238
|
+
// The app owns docs[].data: its `_id` and `__v` keys are data, not Mongo envelope metadata.
|
|
239
|
+
const output = this.wantsRawJson() ? result : (0, json_output_1.stripAppDataQueryMetadata)(result);
|
|
240
|
+
super.log((0, json_output_1.escapeJsonForTerminal)(JSON.stringify(output, null, 2)));
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
this.log(JSON.stringify(result, null, 2));
|
|
232
244
|
}
|
|
233
245
|
/**
|
|
234
246
|
* A task write the Space write policy HELD for approval (OSK-17988): the
|
|
@@ -1587,6 +1599,16 @@ class BaseCommand extends core_1.Command {
|
|
|
1587
1599
|
details: envelopeDetails(body),
|
|
1588
1600
|
});
|
|
1589
1601
|
}
|
|
1602
|
+
else if (bodyCode === 'DUTY_REMEDIATION_SOURCE_UNVERIFIED') {
|
|
1603
|
+
this.failWithCliError({
|
|
1604
|
+
message: say('Remediation proposals and decisions are unavailable because their original Duty and Case sources cannot be verified.'),
|
|
1605
|
+
code: bodyCode,
|
|
1606
|
+
status: e.status,
|
|
1607
|
+
exit: 1,
|
|
1608
|
+
retryable: false,
|
|
1609
|
+
details: envelopeDetails(body),
|
|
1610
|
+
});
|
|
1611
|
+
}
|
|
1590
1612
|
else if (bodyCode === 'AGENT_RUNTIME_UNAVAILABLE') {
|
|
1591
1613
|
// A specific agent's runtime is offline — not a platform outage, even
|
|
1592
1614
|
// though the server returns 503. Intercept before the 503→outage
|
|
@@ -1622,6 +1644,16 @@ class BaseCommand extends core_1.Command {
|
|
|
1622
1644
|
details: envelopeDetails(body),
|
|
1623
1645
|
});
|
|
1624
1646
|
}
|
|
1647
|
+
else if (bodyCode === 'DUTY_REFLECTION_SOURCE_UNVERIFIED') {
|
|
1648
|
+
this.failWithCliError({
|
|
1649
|
+
message: say('Reflection history and decisions are unavailable because the original Duty source cannot be verified.'),
|
|
1650
|
+
code: bodyCode,
|
|
1651
|
+
status: e.status,
|
|
1652
|
+
exit: 1,
|
|
1653
|
+
retryable: false,
|
|
1654
|
+
details: envelopeDetails(body),
|
|
1655
|
+
});
|
|
1656
|
+
}
|
|
1625
1657
|
else if (bodyCode === 'DUTY_HISTORY_UNAVAILABLE' ||
|
|
1626
1658
|
bodyCode === 'DUTY_HISTORY_SOURCE_UNVERIFIED' ||
|
|
1627
1659
|
stringProp(body, 'error') === 'DUTY_HISTORY_UNAVAILABLE') {
|
|
@@ -2087,7 +2119,8 @@ class BaseCommand extends core_1.Command {
|
|
|
2087
2119
|
* For commands where the USER AUTHORED THE CONTENT — a completion summary, a
|
|
2088
2120
|
* comment body, a new Space — losing it to a 503 costs the thinking, not just
|
|
2089
2121
|
* a retry. Those commands call this instead of `handleApiError`, and the
|
|
2090
|
-
* content lands in the outbox
|
|
2122
|
+
* content lands in the outbox for reconciliation. Automatic replay is
|
|
2123
|
+
* paused while the original request context cannot be verified.
|
|
2091
2124
|
*
|
|
2092
2125
|
* Two invariants the caller must honour, both load-bearing:
|
|
2093
2126
|
*
|
|
@@ -2102,7 +2135,7 @@ class BaseCommand extends core_1.Command {
|
|
|
2102
2135
|
* Anything that is not an outage — every 4xx — falls through to the normal
|
|
2103
2136
|
* error path untouched, because replaying a refusal is just a slower refusal.
|
|
2104
2137
|
*/
|
|
2105
|
-
queueWriteOrFail(err, write) {
|
|
2138
|
+
async queueWriteOrFail(err, write) {
|
|
2106
2139
|
// The durable-write path, and the one this whole step is about. It must
|
|
2107
2140
|
// read the WIDE predicate: a 401 here is precisely the case where an
|
|
2108
2141
|
// authored payload was being dropped, because `outbox` only ever queued on
|
|
@@ -2134,24 +2167,67 @@ class BaseCommand extends core_1.Command {
|
|
|
2134
2167
|
}, (0, keychain_2.getActiveProfile)());
|
|
2135
2168
|
queuedId = entry.id;
|
|
2136
2169
|
}
|
|
2137
|
-
catch {
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2170
|
+
catch (queueError) {
|
|
2171
|
+
{
|
|
2172
|
+
const full = queueError instanceof outbox_1.OutboxFullError;
|
|
2173
|
+
// The request may already have committed. Preserve the original key
|
|
2174
|
+
// and context with the payload so it can be reconciled, not blindly
|
|
2175
|
+
// re-issued as a fresh operation.
|
|
2176
|
+
let server = null;
|
|
2177
|
+
try {
|
|
2178
|
+
const url = new URL(this.cliConfig.baseURL);
|
|
2179
|
+
if (!url.username && !url.password && !url.search && !url.hash)
|
|
2180
|
+
server = url.toString();
|
|
2181
|
+
}
|
|
2182
|
+
catch {
|
|
2183
|
+
/* A malformed server is not a reliable recovery target. */
|
|
2184
|
+
}
|
|
2185
|
+
const recovery = {
|
|
2186
|
+
configuredServer: server,
|
|
2187
|
+
currentWorkspaceId: (0, workspace_header_1.withWorkspaceHeader)({})['X-Workspace-Id'] ?? null,
|
|
2188
|
+
actualTarget: 'unknown',
|
|
2189
|
+
actor: 'unverified',
|
|
2190
|
+
command: write.command,
|
|
2191
|
+
method: write.method,
|
|
2192
|
+
path: write.url.startsWith('/') && !write.url.startsWith('//') && !/[?#]/.test(write.url)
|
|
2193
|
+
? write.url
|
|
2194
|
+
: null,
|
|
2195
|
+
idempotencyKey: write.idempotencyKey,
|
|
2196
|
+
body: write.body,
|
|
2197
|
+
};
|
|
2198
|
+
const recoveryText = (JSON.stringify(recovery, null, 2) ?? 'null').replace(RECOVERY_INVISIBLE_CHARS, (char) => {
|
|
2199
|
+
const code = char.codePointAt(0) ?? 0;
|
|
2200
|
+
if (code <= 0xffff)
|
|
2201
|
+
return `\\u${code.toString(16).padStart(4, '0')}`;
|
|
2202
|
+
const offset = code - 0x10000;
|
|
2203
|
+
const high = 0xd800 + (offset >> 10);
|
|
2204
|
+
const low = 0xdc00 + (offset & 0x3ff);
|
|
2205
|
+
return `\\u${high.toString(16)}\\u${low.toString(16)}`;
|
|
2206
|
+
});
|
|
2207
|
+
if (!this.wantsJsonOutput()) {
|
|
2208
|
+
process.stderr.write(`Unsaved recovery details (may contain private data):\n${recoveryText}\n`);
|
|
2209
|
+
await (0, drain_stdio_1.drainStdio)();
|
|
2210
|
+
}
|
|
2211
|
+
this.failWithCliError({
|
|
2212
|
+
message: (full
|
|
2213
|
+
? `The local outbox is full; this write was not saved in the queue. `
|
|
2214
|
+
: `The local outbox could not confirm that this write was saved. `) +
|
|
2215
|
+
`The server may already have applied it. Reconcile the original request before trying again. ` +
|
|
2216
|
+
`The actual target and actor are not verified. ` +
|
|
2217
|
+
`Inspect existing entries with \`${this.config.bin} outbox list\`. ` +
|
|
2218
|
+
(this.wantsJsonOutput()
|
|
2219
|
+
? 'Keep the unsaved recovery details in this response; they may contain private data.'
|
|
2220
|
+
: 'Keep the unsaved recovery details printed above.'),
|
|
2221
|
+
code: full ? 'OUTBOX_FULL' : 'OUTBOX_UNAVAILABLE',
|
|
2222
|
+
status: e.status,
|
|
2223
|
+
exit: 5,
|
|
2224
|
+
retryable: false,
|
|
2225
|
+
details: { outcome: 'unknown', recovery },
|
|
2226
|
+
});
|
|
2227
|
+
}
|
|
2148
2228
|
}
|
|
2149
|
-
//
|
|
2150
|
-
//
|
|
2151
|
-
// write, so neither branch claims nothing landed. A replay is safe because
|
|
2152
|
-
// the queued record carries an idempotency key, not because the first
|
|
2153
|
-
// attempt is assumed absent.
|
|
2154
|
-
const outage = (0, outbox_1.isOutageFailure)(err);
|
|
2229
|
+
// An intermediary can answer after the application committed a write;
|
|
2230
|
+
// neither the outcome nor the original context is proven here.
|
|
2155
2231
|
const statusSuffix = e.status ? ` (HTTP ${e.status})` : '';
|
|
2156
2232
|
// OSK-12121 — a 401 is queued (the payload is authored, and it is worth
|
|
2157
2233
|
// keeping until someone signs in again), but it is an AUTHENTICATION
|
|
@@ -2172,14 +2248,13 @@ class BaseCommand extends core_1.Command {
|
|
|
2172
2248
|
// OSK-12474 — the daemon was asked for a hand-off and refused; say why.
|
|
2173
2249
|
(brokerRefusal ? ` ${brokerRefusal.headline}` : '');
|
|
2174
2250
|
this.failWithCliError({
|
|
2175
|
-
message: `Authentication failed${statusSuffix}. ${why}
|
|
2176
|
-
`was saved locally as ${queuedId}
|
|
2177
|
-
|
|
2178
|
-
`(or discard it with \`${this.config.bin} outbox drop ${queuedId}\`).`,
|
|
2251
|
+
message: `Authentication failed${statusSuffix}. ${why} Sign in again with \`${this.config.bin} login\`. ` +
|
|
2252
|
+
`Your ${write.summary} was saved locally as ${queuedId}; ` +
|
|
2253
|
+
`the original outcome and context need reconciliation. Automatic replay is paused. Inspect \`${this.config.bin} outbox list --json\` before taking further action.`,
|
|
2179
2254
|
code: refusal?.code || 'AUTHENTICATION_FAILED',
|
|
2180
2255
|
status: e.status,
|
|
2181
2256
|
exit: this.bareMode ? 75 : 2,
|
|
2182
|
-
retryable:
|
|
2257
|
+
retryable: false,
|
|
2183
2258
|
details: {
|
|
2184
2259
|
queued: true,
|
|
2185
2260
|
outboxId: queuedId,
|
|
@@ -2188,21 +2263,15 @@ class BaseCommand extends core_1.Command {
|
|
|
2188
2263
|
},
|
|
2189
2264
|
});
|
|
2190
2265
|
}
|
|
2191
|
-
const lead =
|
|
2192
|
-
|
|
2193
|
-
`Your ${write.summary} was queued locally as ${queuedId}; whether the server already ` +
|
|
2194
|
-
'applied the timed-out attempt is unknown, so verify before replaying.'
|
|
2195
|
-
: `${this.cliConfig.baseURL} did not accept this write${statusSuffix}. ` +
|
|
2196
|
-
`Your ${write.summary} was queued locally as ${queuedId}; whether the server applied ` +
|
|
2197
|
-
'any of it is not reported, so verify before replaying.';
|
|
2266
|
+
const lead = `The request did not return a confirmed result${statusSuffix}. ` +
|
|
2267
|
+
`Your ${write.summary} was queued locally as ${queuedId}; whether it was applied is unknown.`;
|
|
2198
2268
|
this.failWithCliError({
|
|
2199
2269
|
message: `${lead} ` +
|
|
2200
|
-
`
|
|
2201
|
-
`replay will not double-apply), or discard it with \`${this.config.bin} outbox drop ${queuedId}\`.`,
|
|
2270
|
+
`Automatic replay is paused. Inspect \`${this.config.bin} outbox list --json\` and reconcile the original target and result before taking further action.`,
|
|
2202
2271
|
code: 'QUEUED_FOR_RETRY',
|
|
2203
2272
|
status: e.status,
|
|
2204
2273
|
exit: 5,
|
|
2205
|
-
retryable:
|
|
2274
|
+
retryable: false,
|
|
2206
2275
|
details: { outboxId: queuedId, idempotencyKey: write.idempotencyKey },
|
|
2207
2276
|
});
|
|
2208
2277
|
}
|
|
@@ -2289,9 +2358,9 @@ class BaseCommand extends core_1.Command {
|
|
|
2289
2358
|
printList(shaped, ndjson) {
|
|
2290
2359
|
const out = (0, list_output_1.renderListOutput)(shaped, ndjson);
|
|
2291
2360
|
for (const line of out.stdout)
|
|
2292
|
-
this.log(line);
|
|
2361
|
+
this.log(typeof line === 'string' ? (0, json_output_1.escapeJsonForTerminal)(line) : line);
|
|
2293
2362
|
for (const line of out.stderr)
|
|
2294
|
-
process.stderr.write(`${line}\n`);
|
|
2363
|
+
process.stderr.write(`${typeof line === 'string' ? (0, json_output_1.escapeJsonForTerminal)(line) : line}\n`);
|
|
2295
2364
|
}
|
|
2296
2365
|
wantsJsonOutput() {
|
|
2297
2366
|
// `this.argv` is only populated by oclif's parse path; a command run
|
|
@@ -6,6 +6,13 @@ export default class ActivityList extends BaseCommand {
|
|
|
6
6
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
7
|
agent: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
8
|
duty: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
source: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
status: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
runtime: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
initiator: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
content: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
from: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
before: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
16
|
limit: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
17
|
cursor: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
18
|
};
|
|
@@ -11,11 +11,21 @@ class ActivityList extends base_command_1.BaseCommand {
|
|
|
11
11
|
'<%= config.bin %> activity list --agent agent_123',
|
|
12
12
|
'<%= config.bin %> activity list --duty duty_123 --json',
|
|
13
13
|
'<%= config.bin %> activity list --agent agent_123 --cursor <cursor>',
|
|
14
|
+
'<%= config.bin %> activity list --source task_execution',
|
|
15
|
+
'<%= config.bin %> activity list --status failed --runtime bound',
|
|
16
|
+
'<%= config.bin %> activity list --initiator automation --from 2026-11-01T00:00:00Z',
|
|
14
17
|
];
|
|
15
18
|
static flags = {
|
|
16
19
|
json: core_1.Flags.boolean({ description: 'Output the server response as JSON' }),
|
|
17
20
|
agent: core_1.Flags.string({ description: 'Show activity for this Agent ID', exclusive: ['duty'] }),
|
|
18
21
|
duty: core_1.Flags.string({ description: 'Show activity for this Duty ID', exclusive: ['agent'] }),
|
|
22
|
+
source: core_1.Flags.string({ description: 'Limit the feed to one source kind', options: [...agent_activity_1.ACTIVITY_SOURCES] }),
|
|
23
|
+
status: core_1.Flags.string({ description: 'Match a public activity status, for example failed or succeeded' }),
|
|
24
|
+
runtime: core_1.Flags.string({ description: 'Match a public runtime state or selected machine product', options: [...agent_activity_1.ACTIVITY_RUNTIMES] }),
|
|
25
|
+
initiator: core_1.Flags.string({ description: 'Match a public initiator; unknown includes missing evidence', options: [...agent_activity_1.ACTIVITY_INITIATORS] }),
|
|
26
|
+
content: core_1.Flags.string({ description: 'Match public content availability, such as partial or unsupported' }),
|
|
27
|
+
from: core_1.Flags.string({ description: 'Include activity from this ISO timestamp, with timezone' }),
|
|
28
|
+
before: core_1.Flags.string({ description: 'Exclude activity at or after this ISO timestamp, with timezone' }),
|
|
19
29
|
limit: core_1.Flags.integer({
|
|
20
30
|
description: 'Maximum records per page (1–100)',
|
|
21
31
|
min: 1,
|
|
@@ -33,6 +43,13 @@ class ActivityList extends base_command_1.BaseCommand {
|
|
|
33
43
|
scope,
|
|
34
44
|
...(flags.agent ? { agentId: flags.agent } : {}),
|
|
35
45
|
...(flags.duty ? { dutyId: flags.duty } : {}),
|
|
46
|
+
...(flags.source ? { source: flags.source } : {}),
|
|
47
|
+
...(flags.status ? { status: flags.status } : {}),
|
|
48
|
+
...(flags.runtime ? { runtime: flags.runtime } : {}),
|
|
49
|
+
...(flags.initiator ? { initiator: flags.initiator } : {}),
|
|
50
|
+
...(flags.content ? { content: flags.content } : {}),
|
|
51
|
+
...(flags.from ? { from: flags.from } : {}),
|
|
52
|
+
...(flags.before ? { before: flags.before } : {}),
|
|
36
53
|
limit: flags.limit,
|
|
37
54
|
...(flags.cursor ? { cursor: flags.cursor } : {}),
|
|
38
55
|
}, this.resolvedCredential);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseCommand } from '../../base-command';
|
|
2
2
|
/**
|
|
3
|
-
* `skrr activity scan-older <chat|group-chat>` — a separate, bounded read of older chat or
|
|
4
|
-
*
|
|
3
|
+
* `skrr activity scan-older <chat|group-chat|task>` — a separate, bounded read of older chat, group or personal Task
|
|
4
|
+
* activity (`GET /api/agent-activity/chat/scan-older`, `.../group-chat/scan-older`).
|
|
5
5
|
*
|
|
6
6
|
* This is not the feed with another cursor. A scan does not depend on what the feed filtered out,
|
|
7
7
|
* its cursor is not a global time order or a has-more signal, and some history may be unavailable,
|
|
@@ -4,8 +4,8 @@ const core_1 = require("@oclif/core");
|
|
|
4
4
|
const base_command_1 = require("../../base-command");
|
|
5
5
|
const agent_activity_1 = require("../../lib/agent-activity");
|
|
6
6
|
/**
|
|
7
|
-
* `skrr activity scan-older <chat|group-chat>` — a separate, bounded read of older chat or
|
|
8
|
-
*
|
|
7
|
+
* `skrr activity scan-older <chat|group-chat|task>` — a separate, bounded read of older chat, group or personal Task
|
|
8
|
+
* activity (`GET /api/agent-activity/chat/scan-older`, `.../group-chat/scan-older`).
|
|
9
9
|
*
|
|
10
10
|
* This is not the feed with another cursor. A scan does not depend on what the feed filtered out,
|
|
11
11
|
* its cursor is not a global time order or a has-more signal, and some history may be unavailable,
|
|
@@ -13,19 +13,20 @@ const agent_activity_1 = require("../../lib/agent-activity");
|
|
|
13
13
|
* the list envelope, whose `has_more` would claim what the cursor does not.
|
|
14
14
|
*/
|
|
15
15
|
class ActivityScanOlder extends base_command_1.BaseCommand {
|
|
16
|
-
static description = 'Scan for older chat or
|
|
16
|
+
static description = 'Scan for older chat, group or personal Task activity the feed does not page to';
|
|
17
17
|
static examples = [
|
|
18
18
|
'<%= config.bin %> activity scan-older chat',
|
|
19
19
|
'<%= config.bin %> activity scan-older group-chat',
|
|
20
|
+
'<%= config.bin %> activity scan-older task',
|
|
20
21
|
'<%= config.bin %> activity scan-older group-chat --cursor <scanOlderCursor>',
|
|
21
22
|
'<%= config.bin %> activity scan-older chat --limit 10 --json',
|
|
22
23
|
];
|
|
23
24
|
static args = {
|
|
24
25
|
source: core_1.Args.string({
|
|
25
|
-
description: 'Which scan: chat
|
|
26
|
+
description: 'Which scan: chat, group-chat, or task (owned personal Tasks; clear the workspace selection first)',
|
|
26
27
|
required: true,
|
|
27
28
|
ignoreStdin: true,
|
|
28
|
-
options: ['chat', 'group-chat'],
|
|
29
|
+
options: ['chat', 'group-chat', 'task'],
|
|
29
30
|
}),
|
|
30
31
|
};
|
|
31
32
|
static flags = {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { BaseCommand } from '../../base-command';
|
|
2
2
|
import { type GroupChatActivityDetail } from '../../lib/agent-activity';
|
|
3
|
-
/** Render only content returned by the owner-authorized trigger detail API. */
|
|
4
|
-
export declare function renderFireContent(detail: Record<string, unknown>, log: (line: string) => void): void;
|
|
5
3
|
/**
|
|
6
4
|
* Render one Group reply: the saved reply text and what the server says it does NOT have. Every
|
|
7
5
|
* string is the response's, so it goes through `terminalText`, and a state the server did not
|
|
@@ -1,43 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.renderFireContent = renderFireContent;
|
|
4
3
|
exports.renderGroupChatContent = renderGroupChatContent;
|
|
4
|
+
const node_util_1 = require("node:util");
|
|
5
5
|
const core_1 = require("@oclif/core");
|
|
6
6
|
const base_command_1 = require("../../base-command");
|
|
7
7
|
const agent_activity_1 = require("../../lib/agent-activity");
|
|
8
8
|
const duties_1 = require("../../lib/duties");
|
|
9
9
|
const http_error_1 = require("../../lib/http-error");
|
|
10
|
-
const triggers_1 = require("../../lib/triggers");
|
|
11
10
|
const workspace_header_1 = require("../../lib/workspace-header");
|
|
12
|
-
const fire_detail_1 = require("../triggers/fire-detail");
|
|
13
11
|
// Source text is untrusted. Preserve useful whitespace, but never send terminal
|
|
14
12
|
// control sequences from a stored prompt or response to the caller's terminal.
|
|
15
13
|
function terminalText(value) {
|
|
16
|
-
//
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
function renderFireContent(detail, log) {
|
|
21
|
-
const input = detail.input;
|
|
22
|
-
const output = detail.output;
|
|
23
|
-
if (typeof input?.promptText === 'string') {
|
|
24
|
-
log('');
|
|
25
|
-
log(`Trigger input${input.truncated === true ? ' (excerpt; truncated)' : ''}:`);
|
|
26
|
-
log(terminalText(input.promptText));
|
|
27
|
-
log('This is the recorded trigger input; the runtime may add or change context.');
|
|
28
|
-
}
|
|
29
|
-
else
|
|
30
|
-
log('Trigger input: unavailable');
|
|
31
|
-
const fullText = typeof output?.fullText === 'string' ? output.fullText : undefined;
|
|
32
|
-
const excerpt = typeof output?.excerpt === 'string' ? output.excerpt : undefined;
|
|
33
|
-
const response = fullText ?? excerpt;
|
|
34
|
-
if (response !== undefined) {
|
|
35
|
-
log('');
|
|
36
|
-
log(`Response${!fullText && output?.truncated === true ? ' (excerpt; truncated)' : ''}:`);
|
|
37
|
-
log(terminalText(response));
|
|
38
|
-
}
|
|
39
|
-
else
|
|
40
|
-
log('Response: unavailable');
|
|
14
|
+
// Preserve line breaks, but prevent carriage returns and bidi controls from
|
|
15
|
+
// rewriting or visually reordering previously printed terminal output.
|
|
16
|
+
return (0, node_util_1.stripVTControlCharacters)(value.replace(/\r\n?/g, '\n'))
|
|
17
|
+
.replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\x9f\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/g, '');
|
|
41
18
|
}
|
|
42
19
|
/**
|
|
43
20
|
* Render one Group reply: the saved reply text and what the server says it does NOT have. Every
|
|
@@ -45,15 +22,17 @@ function renderFireContent(detail, log) {
|
|
|
45
22
|
* report is never filled in (an unrecognised availability is printed as itself, not as "empty").
|
|
46
23
|
*/
|
|
47
24
|
function renderGroupChatContent(detail, log) {
|
|
25
|
+
log('This is the currently authorized group reply; its connection to the earlier Activity record is unverified.');
|
|
48
26
|
const { output } = detail;
|
|
49
27
|
const state = (entry) => entry?.availability
|
|
50
28
|
? `${terminalText(entry.availability)}${entry.reason ? ` (${terminalText(entry.reason)})` : ''}`
|
|
51
29
|
: 'not reported';
|
|
52
30
|
log('Group chat reply');
|
|
31
|
+
const reference = (value) => (0, agent_activity_1.isPrintableActivityToken)(value) ? value : '[unprintable]';
|
|
53
32
|
if (detail.source?.groupChatId)
|
|
54
|
-
log(` Group chat: ${
|
|
33
|
+
log(` Group chat: ${reference(detail.source.groupChatId)}`);
|
|
55
34
|
if (detail.source?.responseMessageId)
|
|
56
|
-
log(` Message: ${
|
|
35
|
+
log(` Message: ${reference(detail.source.responseMessageId)}`);
|
|
57
36
|
log('');
|
|
58
37
|
const partial = output.availability === 'partial'
|
|
59
38
|
? typeof output.originalLength === 'number' && typeof output.text === 'string'
|
|
@@ -80,16 +59,15 @@ function renderGroupChatContent(detail, log) {
|
|
|
80
59
|
log('Output coverage: partial. Attachments and other output may be missing.');
|
|
81
60
|
}
|
|
82
61
|
class ActivityShow extends base_command_1.BaseCommand {
|
|
83
|
-
static description = 'Inspect
|
|
62
|
+
static description = 'Inspect an independently authorized Duty trace or Group reply';
|
|
84
63
|
static examples = [
|
|
85
|
-
'<%= config.bin %> activity show --trigger <trigger-id> --fire <occurrence-id>',
|
|
86
64
|
'<%= config.bin %> activity show --duty <duty-id> --json',
|
|
87
65
|
'<%= config.bin %> activity show --group-chat <group-chat-id> --message <message-id>',
|
|
88
66
|
];
|
|
89
67
|
static flags = {
|
|
90
68
|
json: core_1.Flags.boolean({ description: 'Output the authorized source response as JSON' }),
|
|
91
69
|
trigger: core_1.Flags.string({
|
|
92
|
-
description: 'Trigger ID from source
|
|
70
|
+
description: 'Trigger ID from a legacy Activity reference (source detail unavailable)',
|
|
93
71
|
exclusive: ['duty', 'task', 'group-chat'],
|
|
94
72
|
}),
|
|
95
73
|
fire: core_1.Flags.string({
|
|
@@ -210,15 +188,16 @@ class ActivityShow extends base_command_1.BaseCommand {
|
|
|
210
188
|
(0, duties_1.renderDutyTrace)(trace, (line) => this.log(terminalText(line)));
|
|
211
189
|
return;
|
|
212
190
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}
|
|
191
|
+
// A logical Trigger and Fire id do not identify the physical Trigger at
|
|
192
|
+
// occurrence time. The separate Trigger audit API authorizes its current
|
|
193
|
+
// source, but cannot establish this Activity row's historical lineage.
|
|
194
|
+
const unavailable = {
|
|
195
|
+
source: 'trigger_fire',
|
|
196
|
+
state: 'unsupported',
|
|
197
|
+
reason: 'Trigger Activity detail is unavailable because the original Trigger identity was not recorded. ' +
|
|
198
|
+
'The separate triggers fire-detail command is an independently authorized audit, not proof of this Activity source.',
|
|
199
|
+
};
|
|
200
|
+
this.log(flags.json ? JSON.stringify(unavailable, null, 2) : unavailable.reason);
|
|
222
201
|
}
|
|
223
202
|
catch (err) {
|
|
224
203
|
this.handleApiError(err);
|
|
@@ -4,8 +4,8 @@ import { BaseCommand } from '../../../base-command';
|
|
|
4
4
|
* ran it never confirmed it stopped, via `POST /api/agents/:id/always-on/runs/:runId/stop-release` (OSK-22700).
|
|
5
5
|
*
|
|
6
6
|
* A Run whose daemon was killed mid-turn is queued again and refused as `previous_execution_stopping`: the platform will
|
|
7
|
-
* not start a second provider request while the first may still run.
|
|
8
|
-
* generation
|
|
7
|
+
* not start a second provider request while the first may still run. Trigger fire detail currently withholds the Run and
|
|
8
|
+
* generation because the historical source identity is unverified. Releasing does not wait for the machine, so it costs something the
|
|
9
9
|
* platform cannot take back: the provider may receive a SECOND request for the same turn.
|
|
10
10
|
*
|
|
11
11
|
* So the command refuses to go anywhere without `--accept-duplicate-risk`: with the flag missing it prints the risk and
|
|
@@ -17,7 +17,7 @@ import { BaseCommand } from '../../../base-command';
|
|
|
17
17
|
* What this does NOT guarantee, and the help says so: your own `skrr login` IS you to the server, so a program running on your
|
|
18
18
|
* machine with your login (a coding agent, a script) passes every check above. `--accept-duplicate-risk` is the flag a person
|
|
19
19
|
* adds after reading the risk; it is friction, not a barrier, and nothing on the server can tell a person typing it from a
|
|
20
|
-
* script.
|
|
20
|
+
* script. Do not hand your login to a program
|
|
21
21
|
* you would not trust to make this decision; give it its own delegated session, which the server refuses.
|
|
22
22
|
*/
|
|
23
23
|
export default class AgentsAlwaysOnReleaseRun extends BaseCommand {
|
|
@@ -8,8 +8,8 @@ const base_command_1 = require("../../../base-command");
|
|
|
8
8
|
* ran it never confirmed it stopped, via `POST /api/agents/:id/always-on/runs/:runId/stop-release` (OSK-22700).
|
|
9
9
|
*
|
|
10
10
|
* A Run whose daemon was killed mid-turn is queued again and refused as `previous_execution_stopping`: the platform will
|
|
11
|
-
* not start a second provider request while the first may still run.
|
|
12
|
-
* generation
|
|
11
|
+
* not start a second provider request while the first may still run. Trigger fire detail currently withholds the Run and
|
|
12
|
+
* generation because the historical source identity is unverified. Releasing does not wait for the machine, so it costs something the
|
|
13
13
|
* platform cannot take back: the provider may receive a SECOND request for the same turn.
|
|
14
14
|
*
|
|
15
15
|
* So the command refuses to go anywhere without `--accept-duplicate-risk`: with the flag missing it prints the risk and
|
|
@@ -21,20 +21,19 @@ const base_command_1 = require("../../../base-command");
|
|
|
21
21
|
* What this does NOT guarantee, and the help says so: your own `skrr login` IS you to the server, so a program running on your
|
|
22
22
|
* machine with your login (a coding agent, a script) passes every check above. `--accept-duplicate-risk` is the flag a person
|
|
23
23
|
* adds after reading the risk; it is friction, not a barrier, and nothing on the server can tell a person typing it from a
|
|
24
|
-
* script.
|
|
24
|
+
* script. Do not hand your login to a program
|
|
25
25
|
* you would not trust to make this decision; give it its own delegated session, which the server refuses.
|
|
26
26
|
*/
|
|
27
27
|
class AgentsAlwaysOnReleaseRun extends base_command_1.BaseCommand {
|
|
28
28
|
static description = 'Let one queued Run start although the machine that ran it never confirmed it stopped (Agent owner only; the provider may receive a second request for the same turn). Release it only when its machine is online and ready: the claim spends the release even if the new attempt then parks before it reaches a machine, and the Run then needs another. It runs as you, so a program using your login can do this too: --accept-duplicate-risk is a deliberate step, not a barrier';
|
|
29
29
|
static examples = [
|
|
30
|
-
'<%= config.bin %> triggers fire-detail <trigger-id> <fire-id> # shows the Run, the wait and the generation',
|
|
31
30
|
'<%= config.bin %> agents always-on release-run <agent-id> <run-id> --expected-generation 3 --accept-duplicate-risk',
|
|
32
31
|
'<%= config.bin %> agents always-on release-run <agent-id> <run-id> --expected-generation 3 --accept-duplicate-risk --reason "Laptop was destroyed" --json',
|
|
33
32
|
];
|
|
34
33
|
static args = {
|
|
35
34
|
id: core_1.Args.string({ description: 'Agent ID', required: true, ignoreStdin: true }),
|
|
36
35
|
runId: core_1.Args.string({
|
|
37
|
-
description: 'Run ID
|
|
36
|
+
description: 'Run ID; historical Trigger fire detail does not currently expose it',
|
|
38
37
|
required: true,
|
|
39
38
|
ignoreStdin: true,
|
|
40
39
|
}),
|
|
@@ -43,7 +42,7 @@ class AgentsAlwaysOnReleaseRun extends base_command_1.BaseCommand {
|
|
|
43
42
|
'expected-generation': core_1.Flags.integer({
|
|
44
43
|
min: 0,
|
|
45
44
|
required: true,
|
|
46
|
-
description: 'The generation
|
|
45
|
+
description: 'The Run generation for the wait. Historical Trigger fire detail does not currently expose it; a stale generation is refused.',
|
|
47
46
|
}),
|
|
48
47
|
'accept-duplicate-risk': core_1.Flags.boolean({
|
|
49
48
|
description: 'I understand the provider may receive a second request for the same turn. Required: without it nothing is sent.',
|
|
@@ -8,6 +8,7 @@ export default class AgentsMiniComputerAppReset extends MiniComputerCommand {
|
|
|
8
8
|
};
|
|
9
9
|
static flags: {
|
|
10
10
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
'expected-rev': import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
12
|
};
|
|
12
13
|
run(): Promise<void>;
|
|
13
14
|
}
|
|
@@ -14,12 +14,15 @@ class AgentsMiniComputerAppReset extends miniComputerCommand_1.MiniComputerComma
|
|
|
14
14
|
ignoreStdin: true,
|
|
15
15
|
}),
|
|
16
16
|
};
|
|
17
|
-
static flags = {
|
|
17
|
+
static flags = {
|
|
18
|
+
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
19
|
+
'expected-rev': core_1.Flags.integer({ description: 'Only reset if the app is at this revision', min: 0 }),
|
|
20
|
+
};
|
|
18
21
|
async run() {
|
|
19
22
|
this.requireAuth();
|
|
20
23
|
const { args, flags } = await this.parse(AgentsMiniComputerAppReset);
|
|
21
24
|
try {
|
|
22
|
-
const entry = await data_provider_1.dataService.resetMiniComputerAppConfig(args.agentId, args.app);
|
|
25
|
+
const entry = await data_provider_1.dataService.resetMiniComputerAppConfig(args.agentId, args.app, flags['expected-rev']);
|
|
23
26
|
if (flags.json) {
|
|
24
27
|
this.log(this.agentJson(args.agentId, entry));
|
|
25
28
|
return;
|
|
@@ -30,7 +30,7 @@ class AgentsMiniComputerAppSet extends miniComputerCommand_1.MiniComputerCommand
|
|
|
30
30
|
exactlyOne: ['config', 'file'],
|
|
31
31
|
}),
|
|
32
32
|
'expected-rev': core_1.Flags.integer({
|
|
33
|
-
description: 'Only write if the app is at this revision (0:
|
|
33
|
+
description: 'Only write if the app is at this revision (0: never configured)',
|
|
34
34
|
min: 0,
|
|
35
35
|
}),
|
|
36
36
|
};
|