@skrr-ai/cli 0.1.142 → 0.1.144
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/README.md +8 -0
- package/dist/base-command.d.ts +4 -2
- package/dist/base-command.js +46 -13
- package/dist/commands/agenda/trigger/create.js +4 -2
- package/dist/commands/agenda/trigger/list.js +7 -7
- package/dist/commands/agent/message/approve.d.ts +17 -0
- package/dist/commands/agent/message/approve.js +72 -0
- package/dist/commands/agent/message/decline.d.ts +17 -0
- package/dist/commands/agent/message/decline.js +72 -0
- package/dist/commands/agent/message/pending.d.ts +18 -0
- package/dist/commands/agent/message/pending.js +79 -0
- package/dist/commands/agents/always-on/disable.js +9 -1
- package/dist/commands/agents/always-on/enable.js +9 -1
- package/dist/commands/agents/always-on/status.js +14 -1
- package/dist/commands/agents/create.js +10 -1
- package/dist/commands/agents/delete.d.ts +51 -0
- package/dist/commands/agents/delete.js +163 -2
- package/dist/commands/agents/intuitions/list.js +1 -1
- package/dist/commands/agents/plan-day.d.ts +39 -7
- package/dist/commands/agents/plan-day.js +254 -65
- package/dist/commands/agents/proactive-audit.d.ts +22 -0
- package/dist/commands/agents/proactive-audit.js +86 -0
- package/dist/commands/agents/schedule-overview.d.ts +7 -0
- package/dist/commands/agents/schedule-overview.js +43 -5
- package/dist/commands/agents/schedule-trace.js +30 -19
- package/dist/commands/agents/spawn.d.ts +51 -0
- package/dist/commands/agents/spawn.js +212 -9
- package/dist/commands/agents/todos/cancel.js +3 -0
- package/dist/commands/agents/todos/edit.js +1 -1
- package/dist/commands/agents/todos/list.d.ts +5 -0
- package/dist/commands/agents/todos/list.js +19 -5
- package/dist/commands/agents/triggers/create.js +1 -1
- package/dist/commands/agents/triggers/policy.js +7 -0
- package/dist/commands/agents/triggers/update.js +1 -1
- package/dist/commands/commitments/create.js +13 -3
- package/dist/commands/commitments/preflight.js +31 -5
- package/dist/commands/daemon/index.js +1 -0
- package/dist/commands/daemon/logs.d.ts +8 -1
- package/dist/commands/daemon/logs.js +32 -22
- package/dist/commands/daemon/profile.d.ts +15 -0
- package/dist/commands/daemon/profile.js +51 -0
- package/dist/commands/goals/briefing/status.js +1 -1
- package/dist/commands/initiatives/worker/deactivate.d.ts +23 -0
- package/dist/commands/initiatives/worker/deactivate.js +78 -0
- package/dist/commands/login.js +8 -2
- package/dist/commands/logout.d.ts +20 -0
- package/dist/commands/logout.js +110 -5
- package/dist/commands/machines/profiles/disconnect.d.ts +23 -0
- package/dist/commands/machines/profiles/disconnect.js +102 -0
- package/dist/commands/machines/profiles/index.d.ts +15 -0
- package/dist/commands/machines/profiles/index.js +33 -0
- package/dist/commands/machines/profiles/label.d.ts +24 -0
- package/dist/commands/machines/profiles/label.js +85 -0
- package/dist/commands/machines/profiles/list.d.ts +16 -0
- package/dist/commands/machines/profiles/list.js +87 -0
- package/dist/commands/memory/maintain.js +16 -2
- package/dist/commands/profiles/list.js +17 -2
- package/dist/commands/spaces/delete.js +6 -1
- package/dist/commands/spaces/workflows/archive.js +6 -1
- package/dist/commands/spaces/workflows/publish.js +3 -1
- package/dist/commands/spaces/workflows/run.d.ts +1 -0
- package/dist/commands/spaces/workflows/run.js +17 -1
- package/dist/commands/spaces/workflows/triggers/create.js +3 -1
- package/dist/commands/tasks/workflow-context.js +3 -1
- package/dist/commands/triggers/authorization.js +1 -1
- package/dist/commands/triggers/capabilities.js +17 -1
- package/dist/commands/triggers/create.d.ts +2 -0
- package/dist/commands/triggers/create.js +23 -7
- package/dist/commands/triggers/fire-detail.js +12 -3
- package/dist/commands/triggers/list.d.ts +1 -0
- package/dist/commands/triggers/list.js +13 -1
- package/dist/commands/triggers/preflight.js +18 -0
- package/dist/commands/triggers/prune.js +9 -5
- package/dist/commands/triggers/update.js +13 -4
- package/dist/generated/agent-guides.json +35 -35
- package/dist/lib/agent-guides.js +1 -1
- package/dist/lib/agent-proactive-baseline.d.ts +6 -0
- package/dist/lib/agent-proactive-baseline.js +32 -3
- package/dist/lib/always-on-command-result.d.ts +18 -0
- package/dist/lib/always-on-command-result.js +52 -0
- package/dist/lib/always-on-runtime.d.ts +31 -0
- package/dist/lib/always-on-runtime.js +39 -0
- package/dist/lib/auth-diagnostics.d.ts +10 -1
- package/dist/lib/auth-diagnostics.js +16 -8
- package/dist/lib/commitments.d.ts +16 -9
- package/dist/lib/commitments.js +65 -4
- package/dist/lib/compasses.js +5 -0
- package/dist/lib/daemon-binding.js +6 -3
- package/dist/lib/daemon-command-hint.d.ts +10 -5
- package/dist/lib/daemon-command-hint.js +11 -6
- package/dist/lib/daemon-setup.js +9 -3
- package/dist/lib/daemonBroker.d.ts +7 -0
- package/dist/lib/daemonBroker.js +5 -0
- package/dist/lib/daemonHandoff.d.ts +2 -0
- package/dist/lib/daemonHandoff.js +16 -3
- package/dist/lib/daemonIslandProfile.d.ts +19 -0
- package/dist/lib/daemonIslandProfile.js +41 -0
- package/dist/lib/drain-stdio.d.ts +22 -0
- package/dist/lib/drain-stdio.js +46 -0
- package/dist/lib/format.d.ts +32 -0
- package/dist/lib/format.js +105 -1
- package/dist/lib/initiatives-worker.d.ts +25 -0
- package/dist/lib/initiatives-worker.js +13 -0
- package/dist/lib/keychain.d.ts +22 -1
- package/dist/lib/keychain.js +40 -1
- package/dist/lib/local-daemon-readiness.js +4 -6
- package/dist/lib/local-skills.js +4 -1
- package/dist/lib/login.d.ts +7 -0
- package/dist/lib/login.js +5 -0
- package/dist/lib/machines.d.ts +68 -0
- package/dist/lib/machines.js +67 -0
- package/dist/lib/proactive-audit.d.ts +52 -0
- package/dist/lib/proactive-audit.js +67 -0
- package/dist/lib/proactiveApi.d.ts +23 -0
- package/dist/lib/refresh.d.ts +20 -6
- package/dist/lib/refresh.js +27 -9
- package/dist/lib/roles.d.ts +1 -1
- package/dist/lib/runtime-start-verification.js +3 -6
- package/dist/lib/schedule.d.ts +189 -9
- package/dist/lib/schedule.js +283 -22
- package/dist/lib/triggers.d.ts +134 -3
- package/dist/lib/triggers.js +370 -17
- package/dist/lib/workflow-node-control.js +8 -0
- package/dist/lib/workflow-run-view.js +9 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/configRoot.d.ts +12 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/configRoot.js +10 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceIdentityBridge.d.ts +8 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceIdentityBridge.js +22 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/executorStopReceiptV2.d.ts +133 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/executorStopReceiptV2.js +180 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.d.ts +5 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.js +50 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profilePorts.d.ts +137 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profilePorts.js +328 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profileSelection.d.ts +63 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profileSelection.js +174 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refresh.d.ts +22 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refresh.js +15 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/configRoot.d.ts +12 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/configRoot.js +14 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceIdentityBridge.d.ts +8 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceIdentityBridge.js +27 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/executorStopReceiptV2.d.ts +133 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/executorStopReceiptV2.js +183 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.d.ts +5 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.js +11 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profilePorts.d.ts +137 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profilePorts.js +333 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profileSelection.d.ts +63 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profileSelection.js +212 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refresh.d.ts +22 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refresh.js +22 -4
- package/dist/node_modules/@skrr-ai/auth-core/package.json +11 -1
- package/dist/node_modules/@skrr-ai/data-provider/index.js +7446 -7378
- package/oclif.manifest.json +844 -47
- package/package.json +1 -1
package/dist/lib/format.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.displayWidth = displayWidth;
|
|
4
4
|
exports.pad = pad;
|
|
5
5
|
exports.truncate = truncate;
|
|
6
|
+
exports.truncateMiddle = truncateMiddle;
|
|
6
7
|
exports.truncateAtWord = truncateAtWord;
|
|
7
8
|
exports.formatCell = formatCell;
|
|
8
9
|
exports.collapseWhitespace = collapseWhitespace;
|
|
@@ -10,6 +11,8 @@ exports.renderTable = renderTable;
|
|
|
10
11
|
exports.localStamp = localStamp;
|
|
11
12
|
exports.localTime = localTime;
|
|
12
13
|
exports.localZone = localZone;
|
|
14
|
+
exports.zoneAbbreviation = zoneAbbreviation;
|
|
15
|
+
exports.zonedTime = zonedTime;
|
|
13
16
|
exports.formatWhen = formatWhen;
|
|
14
17
|
/**
|
|
15
18
|
* Code points that occupy TWO terminal columns (Unicode East Asian Wide and
|
|
@@ -106,6 +109,46 @@ function truncate(s, max) {
|
|
|
106
109
|
}
|
|
107
110
|
return `${out}…`;
|
|
108
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Truncate in the MIDDLE, keeping both ends: `[df-261102-trig…tion-tc01] text-out`.
|
|
114
|
+
*
|
|
115
|
+
* For a cell whose two ends both carry meaning. A trigger label starts with a run tag and the tag's
|
|
116
|
+
* last characters are what tell two runs apart, so cutting the tail (`truncate`) kept the part they
|
|
117
|
+
* share and dropped the part that differs (OSK-22493).
|
|
118
|
+
*/
|
|
119
|
+
function truncateMiddle(s, max) {
|
|
120
|
+
if (displayWidth(s) <= max)
|
|
121
|
+
return s;
|
|
122
|
+
if (max <= 3)
|
|
123
|
+
return truncate(s, max);
|
|
124
|
+
const budget = max - 1; // room for the ellipsis
|
|
125
|
+
const tailBudget = Math.floor(budget / 2);
|
|
126
|
+
const headBudget = budget - tailBudget;
|
|
127
|
+
const widthOf = (ch) => {
|
|
128
|
+
const cp = ch.codePointAt(0) ?? 0;
|
|
129
|
+
return inRanges(cp, ZERO_RANGES) ? 0 : inRanges(cp, WIDE_RANGES) ? 2 : 1;
|
|
130
|
+
};
|
|
131
|
+
let head = '';
|
|
132
|
+
let used = 0;
|
|
133
|
+
for (const ch of s) {
|
|
134
|
+
const w = widthOf(ch);
|
|
135
|
+
if (used + w > headBudget)
|
|
136
|
+
break;
|
|
137
|
+
head += ch;
|
|
138
|
+
used += w;
|
|
139
|
+
}
|
|
140
|
+
const chars = Array.from(s);
|
|
141
|
+
let tail = '';
|
|
142
|
+
used = 0;
|
|
143
|
+
for (let i = chars.length - 1; i >= 0; i -= 1) {
|
|
144
|
+
const w = widthOf(chars[i]);
|
|
145
|
+
if (used + w > tailBudget)
|
|
146
|
+
break;
|
|
147
|
+
tail = chars[i] + tail;
|
|
148
|
+
used += w;
|
|
149
|
+
}
|
|
150
|
+
return `${head}…${tail}`;
|
|
151
|
+
}
|
|
109
152
|
/**
|
|
110
153
|
* `truncate`, but never in the middle of a word.
|
|
111
154
|
*
|
|
@@ -216,7 +259,8 @@ function renderTable(rows, columns, log) {
|
|
|
216
259
|
const key = String(col.key);
|
|
217
260
|
const raw = row[key];
|
|
218
261
|
const width = widths[key];
|
|
219
|
-
|
|
262
|
+
const clip = col.truncate === 'middle' ? truncateMiddle : truncate;
|
|
263
|
+
return pad(col.verbatim ? raw : clip(raw, width), width);
|
|
220
264
|
})
|
|
221
265
|
.join(' ');
|
|
222
266
|
log(line);
|
|
@@ -289,6 +333,66 @@ function localZone(at = new Date()) {
|
|
|
289
333
|
const abs = Math.abs(offset);
|
|
290
334
|
return `UTC${sign}${`${Math.floor(abs / 60)}`.padStart(2, '0')}:${`${abs % 60}`.padStart(2, '0')}`;
|
|
291
335
|
}
|
|
336
|
+
/**
|
|
337
|
+
* `PST` / `PDT` / `GMT+8` — the short name of `timeZone` at `at`, or an empty
|
|
338
|
+
* string when the runtime cannot name it. Used to label a time that is shown in
|
|
339
|
+
* a zone the reader did not necessarily choose (a plan's own zone).
|
|
340
|
+
*/
|
|
341
|
+
function zoneAbbreviation(timeZone, at = new Date()) {
|
|
342
|
+
try {
|
|
343
|
+
const parts = new Intl.DateTimeFormat('en-US', {
|
|
344
|
+
timeZone,
|
|
345
|
+
timeZoneName: 'short',
|
|
346
|
+
}).formatToParts(at);
|
|
347
|
+
return parts.find((part) => part.type === 'timeZoneName')?.value ?? '';
|
|
348
|
+
}
|
|
349
|
+
catch {
|
|
350
|
+
return '';
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* One instant rendered in an EXPLICIT IANA zone, with the zone named:
|
|
355
|
+
* `2026-11-02 17:13:40 PST`.
|
|
356
|
+
*
|
|
357
|
+
* `localTime` renders in the machine's zone. A Smart Schedule plan has its own
|
|
358
|
+
* zone, and the instants a plan prints (expiry at the plan day's local midnight,
|
|
359
|
+
* the suggested next run, a trace row) are only readable in THAT zone: printed as
|
|
360
|
+
* raw UTC, `Expires: 2026-11-03T08:00:00.000Z` makes the reader work out that
|
|
361
|
+
* 08:00Z is local midnight, and a trace row at 01:13 UTC reads as an event from
|
|
362
|
+
* tomorrow under a header naming today (OSK-22397). `--json` keeps the raw UTC
|
|
363
|
+
* instant; this is for text only. Never throws: an unparseable value comes back
|
|
364
|
+
* as given, and an unknown zone falls back to UTC, labelled.
|
|
365
|
+
*/
|
|
366
|
+
function zonedTime(value, timeZone, options = {}) {
|
|
367
|
+
if (value === null || value === undefined || value === '')
|
|
368
|
+
return '-';
|
|
369
|
+
const date = value instanceof Date ? value : new Date(typeof value === 'number' ? value : String(value));
|
|
370
|
+
if (Number.isNaN(date.getTime()))
|
|
371
|
+
return String(value);
|
|
372
|
+
const seconds = options.seconds !== false;
|
|
373
|
+
const render = (zone) => {
|
|
374
|
+
const parts = new Intl.DateTimeFormat('en-CA', {
|
|
375
|
+
timeZone: zone,
|
|
376
|
+
year: 'numeric',
|
|
377
|
+
month: '2-digit',
|
|
378
|
+
day: '2-digit',
|
|
379
|
+
hour: '2-digit',
|
|
380
|
+
minute: '2-digit',
|
|
381
|
+
second: '2-digit',
|
|
382
|
+
hourCycle: 'h23',
|
|
383
|
+
}).formatToParts(date);
|
|
384
|
+
const get = (type) => parts.find((part) => part.type === type)?.value ?? '00';
|
|
385
|
+
const label = zoneAbbreviation(zone, date) || zone;
|
|
386
|
+
return (`${get('year')}-${get('month')}-${get('day')} ${get('hour')}:${get('minute')}` +
|
|
387
|
+
`${seconds ? `:${get('second')}` : ''} ${label}`);
|
|
388
|
+
};
|
|
389
|
+
try {
|
|
390
|
+
return render(timeZone);
|
|
391
|
+
}
|
|
392
|
+
catch {
|
|
393
|
+
return render('UTC');
|
|
394
|
+
}
|
|
395
|
+
}
|
|
292
396
|
function zonedParts(date, timeZone) {
|
|
293
397
|
const parts = new Intl.DateTimeFormat('en-CA', {
|
|
294
398
|
timeZone,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface WorkerDeactivateResult {
|
|
2
|
+
agentId: string;
|
|
3
|
+
enabled: false;
|
|
4
|
+
/** One entry per worker watcher kind; `skipped` when the agent has none of that kind. */
|
|
5
|
+
schedules: Array<{
|
|
6
|
+
kind: string;
|
|
7
|
+
skipped?: boolean;
|
|
8
|
+
schedule?: {
|
|
9
|
+
triggerId?: string;
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
} | null;
|
|
12
|
+
}>;
|
|
13
|
+
initiativeClosure?: {
|
|
14
|
+
skipped?: boolean;
|
|
15
|
+
matched?: number;
|
|
16
|
+
modified?: number;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export declare const initiativesWorkerApi: {
|
|
20
|
+
deactivate: (input: {
|
|
21
|
+
agentId: string;
|
|
22
|
+
reason?: string;
|
|
23
|
+
closeOpenInitiatives?: boolean;
|
|
24
|
+
}) => Promise<WorkerDeactivateResult>;
|
|
25
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initiativesWorkerApi = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* initiatives-worker.ts — client for the worker-wide controls under `/api/initiatives/workers`.
|
|
6
|
+
*
|
|
7
|
+
* The web Control Center had a way to pause an agent's worker; the CLI had none, so a refusal that
|
|
8
|
+
* told a person "change the object that owns it" had no command to point at (OSK-22423).
|
|
9
|
+
*/
|
|
10
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
11
|
+
exports.initiativesWorkerApi = {
|
|
12
|
+
deactivate: (input) => data_provider_1.request.post('/api/initiatives/workers/deactivate', input),
|
|
13
|
+
};
|
package/dist/lib/keychain.d.ts
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
|
+
import { type ProfileSelection, type ProfileSelectionSource } from '@skrr-ai/auth-core';
|
|
1
2
|
/** Default profile when no profile flag or environment override is present. */
|
|
2
3
|
export declare const DEFAULT_PROFILE = "default";
|
|
3
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Wire the profile from the ONE selection rule both binaries share
|
|
6
|
+
* (`resolveProfileSelection` in auth-core: `--profile` > `OVERSKY_PROFILE` >
|
|
7
|
+
* `<root>/profile.lock` > `default`, OSK-22299). Throws the grammar's message
|
|
8
|
+
* for an invalid flag or environment value.
|
|
9
|
+
*/
|
|
10
|
+
export declare function selectActiveProfile(flag: string | null | undefined): ProfileSelection;
|
|
11
|
+
/** How the active profile was chosen, for diagnostics that name it. */
|
|
12
|
+
export declare function getActiveProfileSelection(): ProfileSelection;
|
|
13
|
+
/**
|
|
14
|
+
* The profile a `skrrd` child must be told to act on, always passed explicitly
|
|
15
|
+
* (`explicitProfileArgs`, `default` included).
|
|
16
|
+
*
|
|
17
|
+
* A `--profile` in the forwarded argv wins. Otherwise a process that already
|
|
18
|
+
* chose (every `BaseCommand`) passes what it chose, and a thin wrapper that
|
|
19
|
+
* extends oclif's `Command` and never ran `init()` resolves by the shared rule
|
|
20
|
+
* now, so it lands where `skrrd` would have — but says so instead of leaving
|
|
21
|
+
* the child to re-derive it (OSK-22298).
|
|
22
|
+
*/
|
|
23
|
+
export declare function profileForChildProcess(argv?: readonly string[]): string;
|
|
24
|
+
export declare function setActiveProfile(profile: string, source?: ProfileSelectionSource): void;
|
|
4
25
|
/**
|
|
5
26
|
* Whether the profile has been chosen for this process.
|
|
6
27
|
*
|
package/dist/lib/keychain.js
CHANGED
|
@@ -34,6 +34,9 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.DEFAULT_PROFILE = void 0;
|
|
37
|
+
exports.selectActiveProfile = selectActiveProfile;
|
|
38
|
+
exports.getActiveProfileSelection = getActiveProfileSelection;
|
|
39
|
+
exports.profileForChildProcess = profileForChildProcess;
|
|
37
40
|
exports.setActiveProfile = setActiveProfile;
|
|
38
41
|
exports.isProfileResolved = isProfileResolved;
|
|
39
42
|
exports.getActiveProfile = getActiveProfile;
|
|
@@ -146,8 +149,44 @@ let _availability = null;
|
|
|
146
149
|
let _activeProfile = exports.DEFAULT_PROFILE;
|
|
147
150
|
/** True once a caller has chosen, so a writer can tell "default" from "unset". */
|
|
148
151
|
let _profileResolved = false;
|
|
149
|
-
|
|
152
|
+
/** How `_activeProfile` was chosen; `default` until a caller says otherwise. */
|
|
153
|
+
let _activeProfileSource = 'default';
|
|
154
|
+
/**
|
|
155
|
+
* Wire the profile from the ONE selection rule both binaries share
|
|
156
|
+
* (`resolveProfileSelection` in auth-core: `--profile` > `OVERSKY_PROFILE` >
|
|
157
|
+
* `<root>/profile.lock` > `default`, OSK-22299). Throws the grammar's message
|
|
158
|
+
* for an invalid flag or environment value.
|
|
159
|
+
*/
|
|
160
|
+
function selectActiveProfile(flag) {
|
|
161
|
+
const selection = (0, auth_core_1.resolveProfileSelection)({ flag });
|
|
162
|
+
setActiveProfile(selection.profile, selection.source);
|
|
163
|
+
return selection;
|
|
164
|
+
}
|
|
165
|
+
/** How the active profile was chosen, for diagnostics that name it. */
|
|
166
|
+
function getActiveProfileSelection() {
|
|
167
|
+
return { profile: _activeProfile, source: _activeProfileSource };
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* The profile a `skrrd` child must be told to act on, always passed explicitly
|
|
171
|
+
* (`explicitProfileArgs`, `default` included).
|
|
172
|
+
*
|
|
173
|
+
* A `--profile` in the forwarded argv wins. Otherwise a process that already
|
|
174
|
+
* chose (every `BaseCommand`) passes what it chose, and a thin wrapper that
|
|
175
|
+
* extends oclif's `Command` and never ran `init()` resolves by the shared rule
|
|
176
|
+
* now, so it lands where `skrrd` would have — but says so instead of leaving
|
|
177
|
+
* the child to re-derive it (OSK-22298).
|
|
178
|
+
*/
|
|
179
|
+
function profileForChildProcess(argv) {
|
|
180
|
+
const fromArgv = argv ? resolveProfileFromArgv(argv) : null;
|
|
181
|
+
if (fromArgv)
|
|
182
|
+
return (0, auth_core_1.resolveProfileSelection)({ flag: fromArgv }).profile;
|
|
183
|
+
if (_profileResolved)
|
|
184
|
+
return _activeProfile;
|
|
185
|
+
return (0, auth_core_1.resolveProfileSelection)().profile;
|
|
186
|
+
}
|
|
187
|
+
function setActiveProfile(profile, source = profile && profile !== exports.DEFAULT_PROFILE ? 'flag' : 'default') {
|
|
150
188
|
_profileResolved = true;
|
|
189
|
+
_activeProfileSource = source;
|
|
151
190
|
if (profile && profile.length > 0)
|
|
152
191
|
_activeProfile = profile;
|
|
153
192
|
// The machineUuid the CLI sends (first-party harness broker) is per profile,
|
|
@@ -5,6 +5,7 @@ exports.describeUnreadyLocalDaemon = describeUnreadyLocalDaemon;
|
|
|
5
5
|
exports.reportLocalDaemonAfterHandoff = reportLocalDaemonAfterHandoff;
|
|
6
6
|
const exec_runtime_binary_1 = require("./exec-runtime-binary");
|
|
7
7
|
const managed_instruction_local_1 = require("./managed-instruction-local");
|
|
8
|
+
const auth_core_1 = require("@skrr-ai/auth-core");
|
|
8
9
|
const keychain_1 = require("./keychain");
|
|
9
10
|
const config_1 = require("./config");
|
|
10
11
|
const runtime_start_verification_1 = require("./runtime-start-verification");
|
|
@@ -14,12 +15,9 @@ function defaultDeps() {
|
|
|
14
15
|
return {
|
|
15
16
|
inspect: () => (0, managed_instruction_local_1.inspectLocalInstructionDaemon)((0, keychain_1.getActiveProfile)(), (0, config_1.loadConfig)().baseURL),
|
|
16
17
|
status: async () => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
'--json',
|
|
21
|
-
...(profile !== keychain_1.DEFAULT_PROFILE ? ['--profile', profile] : []),
|
|
22
|
-
];
|
|
18
|
+
// Explicit for `default` too, so the probe reads the profile this
|
|
19
|
+
// process signed in to rather than whichever one a lock names (OSK-22298).
|
|
20
|
+
const args = ['status', '--json', ...(0, auth_core_1.explicitProfileArgs)((0, keychain_1.profileForChildProcess)())];
|
|
23
21
|
try {
|
|
24
22
|
const out = await (0, exec_runtime_binary_1.execRuntimeBinaryCapture)(args, { timeoutMs: 15_000 });
|
|
25
23
|
return { stdout: out.stdout, code: out.code };
|
package/dist/lib/local-skills.js
CHANGED
|
@@ -12,6 +12,7 @@ exports.describeStoreSkillMiss = describeStoreSkillMiss;
|
|
|
12
12
|
exports.daemonPredates = daemonPredates;
|
|
13
13
|
exports.summarizeSkillActionImport = summarizeSkillActionImport;
|
|
14
14
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
15
|
+
const auth_core_1 = require("@skrr-ai/auth-core");
|
|
15
16
|
const instruction_input_1 = require("./instruction-input");
|
|
16
17
|
/**
|
|
17
18
|
* Which machine to ask, or why there is no single answer.
|
|
@@ -55,7 +56,9 @@ function isUserInvocable(skill) {
|
|
|
55
56
|
*/
|
|
56
57
|
function daemonRestartCommand(daemonId) {
|
|
57
58
|
const profile = daemonId ? (0, instruction_input_1.parseDaemonId)(daemonId)?.profile : undefined;
|
|
58
|
-
|
|
59
|
+
// Named whenever a bare command would resolve elsewhere, which includes a
|
|
60
|
+
// `profile.lock` naming another profile (OSK-22299), not only non-default.
|
|
61
|
+
return profile && !(0, auth_core_1.profileIsImplicit)(profile)
|
|
59
62
|
? `skrr daemon restart --profile ${profile}`
|
|
60
63
|
: 'skrr daemon restart';
|
|
61
64
|
}
|
package/dist/lib/login.d.ts
CHANGED
|
@@ -18,6 +18,13 @@ export interface CliLoginResult {
|
|
|
18
18
|
refreshExpiresAt?: number;
|
|
19
19
|
/** The flow that produced the token; for diagnostics / telemetry. */
|
|
20
20
|
flow: 'localhost' | 'device-code' | 'refresh-token' | 'daemon-broker';
|
|
21
|
+
/**
|
|
22
|
+
* With `flow: 'daemon-broker'`: the profile of the daemon that brokered it,
|
|
23
|
+
* when its descriptor names one. The broker borrows whichever daemon is
|
|
24
|
+
* running, so after `skrr login --profile work` this is usually `default`, and
|
|
25
|
+
* `work`'s own daemon still needs a credential (OSK-22309).
|
|
26
|
+
*/
|
|
27
|
+
brokerProfile?: string;
|
|
21
28
|
}
|
|
22
29
|
export interface CliLoginWithRefreshTokenOptions {
|
|
23
30
|
/** Server base URL. Defaults to config. */
|
package/dist/lib/login.js
CHANGED
|
@@ -37,6 +37,7 @@ const device_code_1 = require("./device-code");
|
|
|
37
37
|
const device_identity_1 = require("./device-identity");
|
|
38
38
|
const oauthLogin_1 = require("./oauthLogin");
|
|
39
39
|
const daemonBroker_1 = require("./daemonBroker");
|
|
40
|
+
const daemonIslandProfile_1 = require("./daemonIslandProfile");
|
|
40
41
|
const dedicated_guest_1 = require("./dedicated-guest");
|
|
41
42
|
const daemonBrokerRefusal_1 = require("./daemonBrokerRefusal");
|
|
42
43
|
/**
|
|
@@ -122,6 +123,8 @@ async function cliLogin(opts = {}) {
|
|
|
122
123
|
baseURL: serverUrl,
|
|
123
124
|
});
|
|
124
125
|
if (brokerResult.ok) {
|
|
126
|
+
const brokerProfile = (0, daemonIslandProfile_1.bootstrapDescriptorProfile)(brokerResult.descriptorPath);
|
|
127
|
+
const brokeredBy = brokerProfile ? { brokerProfile } : {};
|
|
125
128
|
if (brokerResult.brokered) {
|
|
126
129
|
// Broker-mode hand-off: the daemon served a short-lived access token
|
|
127
130
|
// from a family IT owns. Nothing credential-shaped is persisted here
|
|
@@ -144,6 +147,7 @@ async function cliLogin(opts = {}) {
|
|
|
144
147
|
? { expiresAt: brokerResult.accessExpiresAt }
|
|
145
148
|
: {}),
|
|
146
149
|
flow: 'daemon-broker',
|
|
150
|
+
...brokeredBy,
|
|
147
151
|
};
|
|
148
152
|
}
|
|
149
153
|
console.log('');
|
|
@@ -163,6 +167,7 @@ async function cliLogin(opts = {}) {
|
|
|
163
167
|
? { refreshExpiresAt: Date.parse(brokerResult.refreshExpiresAt) }
|
|
164
168
|
: {}),
|
|
165
169
|
flow: 'daemon-broker',
|
|
170
|
+
...brokeredBy,
|
|
166
171
|
};
|
|
167
172
|
}
|
|
168
173
|
// `ci_token_refused` is the one broker failure we surface rather
|
package/dist/lib/machines.d.ts
CHANGED
|
@@ -46,6 +46,10 @@ export interface MachineHarnessRow {
|
|
|
46
46
|
authStatus?: string;
|
|
47
47
|
lastSeenAt: string | null;
|
|
48
48
|
daemonId: string | null;
|
|
49
|
+
/** The daemon profile this registration belongs to, when the server knows it. */
|
|
50
|
+
profile?: string;
|
|
51
|
+
/** A person's display label for that profile (OSK-22308); present only when one is set. */
|
|
52
|
+
profileLabel?: MachineProfileLabel;
|
|
49
53
|
/**
|
|
50
54
|
* A newer registration of the same provider on this machine replaced this
|
|
51
55
|
* row. Rows are keyed per daemonId, and daemonId changes when the same daemon
|
|
@@ -234,6 +238,33 @@ export declare function parseDaemonId(daemonId: string): {
|
|
|
234
238
|
source: string;
|
|
235
239
|
profile: string;
|
|
236
240
|
} | null;
|
|
241
|
+
/** A person's display name and note for one daemon profile (OSK-22308). Display only. */
|
|
242
|
+
export interface MachineProfileLabel {
|
|
243
|
+
label?: string;
|
|
244
|
+
description?: string;
|
|
245
|
+
}
|
|
246
|
+
/** One daemon profile on a machine, gathered from its harness rows. */
|
|
247
|
+
export interface MachineProfileSummary {
|
|
248
|
+
/** The profile's name: a directory, a Keychain suffix and a service label, so it cannot change. */
|
|
249
|
+
name: string;
|
|
250
|
+
label: MachineProfileLabel | null;
|
|
251
|
+
/** The same contact words as `summarizeDaemons`. */
|
|
252
|
+
status: MachineDaemonSummary['status'];
|
|
253
|
+
lastSeenAt: string | null;
|
|
254
|
+
/** Current (not superseded) registrations, and the providers they run. */
|
|
255
|
+
harnessCount: number;
|
|
256
|
+
providers: string[];
|
|
257
|
+
/** The daemon ids its registrations used. Several when it was started different ways. */
|
|
258
|
+
daemonIds: string[];
|
|
259
|
+
}
|
|
260
|
+
/** The profile a harness row belongs to: the server's field, else the one its legacy daemon id names. */
|
|
261
|
+
export declare function harnessProfileOf(row: Pick<MachineHarnessRow, 'profile' | 'daemonId'>): string | null;
|
|
262
|
+
/**
|
|
263
|
+
* The daemon profiles one machine's harness rows belong to, live first. A row whose
|
|
264
|
+
* profile cannot be told (a hosted box, an id with no profile in it) is left out: it
|
|
265
|
+
* belongs to no profile a person could disconnect or label.
|
|
266
|
+
*/
|
|
267
|
+
export declare function summarizeMachineProfiles(harnesses: readonly MachineHarnessRow[]): MachineProfileSummary[];
|
|
237
268
|
/** The word the tables print for one harness row: the server's statement, not the bare status. */
|
|
238
269
|
export declare function harnessStateLabel(row: MachineHarnessRow): string;
|
|
239
270
|
export declare function summarizeDaemons(harnesses: readonly MachineHarnessRow[], activeProfile: string): MachineDaemonSummary[];
|
|
@@ -310,4 +341,41 @@ export declare function listMachines(): Promise<Machine[]>;
|
|
|
310
341
|
export declare function getMachine(machineId: string): Promise<Machine | null>;
|
|
311
342
|
export declare function updateMachine(machineId: string, patch: MachinePreferencesPatch): Promise<Machine | null>;
|
|
312
343
|
export declare function disconnectMachine(machineId: string): Promise<Record<string, unknown> | null>;
|
|
344
|
+
/** What disconnecting one daemon profile did (`POST .../profiles/:profile/actions/disconnect`). */
|
|
345
|
+
export interface MachineProfileDisconnectResult {
|
|
346
|
+
ok: true;
|
|
347
|
+
profile: string;
|
|
348
|
+
/**
|
|
349
|
+
* The profile shares this computer's server identity with other profiles (a
|
|
350
|
+
* profile created before OSK-13845), so only its own sessions were revoked and
|
|
351
|
+
* the machine stays connected for the others.
|
|
352
|
+
*/
|
|
353
|
+
sharedIdentity: boolean;
|
|
354
|
+
otherProfiles: string[];
|
|
355
|
+
revokedDaemon: boolean;
|
|
356
|
+
revokedSessions: number;
|
|
357
|
+
retiredHarnesses: number;
|
|
358
|
+
releasedHolds: number;
|
|
359
|
+
labelCleared: number | boolean;
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Disconnect ONE daemon profile of a machine (OSK-22306): revoke that profile's
|
|
363
|
+
* daemon credential and nothing another profile holds, and retire its harness rows.
|
|
364
|
+
* The server refuses while agents are pinned to it (`PROFILE_ASSIGNED_AGENTS`).
|
|
365
|
+
*/
|
|
366
|
+
export declare function disconnectMachineProfile(machineId: string, profile: string, options?: {
|
|
367
|
+
clearLabel?: boolean;
|
|
368
|
+
}): Promise<MachineProfileDisconnectResult | null>;
|
|
369
|
+
/**
|
|
370
|
+
* Set or clear one daemon profile's display label and description (OSK-22308).
|
|
371
|
+
* An empty string clears a field; a field left out is unchanged.
|
|
372
|
+
*/
|
|
373
|
+
export declare function setMachineProfileLabel(machineId: string, profile: string, patch: {
|
|
374
|
+
label?: string;
|
|
375
|
+
description?: string;
|
|
376
|
+
}): Promise<{
|
|
377
|
+
profile: string;
|
|
378
|
+
runtimeKeys: number;
|
|
379
|
+
label: MachineProfileLabel | null;
|
|
380
|
+
} | null>;
|
|
313
381
|
export declare function resolveMachineRef(machines: Machine[], ref: string): Machine;
|
package/dist/lib/machines.js
CHANGED
|
@@ -6,6 +6,8 @@ exports.isReachableMachine = isReachableMachine;
|
|
|
6
6
|
exports.isOwnComputer = isOwnComputer;
|
|
7
7
|
exports.isListedByDefault = isListedByDefault;
|
|
8
8
|
exports.parseDaemonId = parseDaemonId;
|
|
9
|
+
exports.harnessProfileOf = harnessProfileOf;
|
|
10
|
+
exports.summarizeMachineProfiles = summarizeMachineProfiles;
|
|
9
11
|
exports.harnessStateLabel = harnessStateLabel;
|
|
10
12
|
exports.summarizeDaemons = summarizeDaemons;
|
|
11
13
|
exports.isThisComputer = isThisComputer;
|
|
@@ -17,6 +19,8 @@ exports.listMachines = listMachines;
|
|
|
17
19
|
exports.getMachine = getMachine;
|
|
18
20
|
exports.updateMachine = updateMachine;
|
|
19
21
|
exports.disconnectMachine = disconnectMachine;
|
|
22
|
+
exports.disconnectMachineProfile = disconnectMachineProfile;
|
|
23
|
+
exports.setMachineProfileLabel = setMachineProfileLabel;
|
|
20
24
|
exports.resolveMachineRef = resolveMachineRef;
|
|
21
25
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
22
26
|
const api_fetch_1 = require("./api-fetch");
|
|
@@ -141,6 +145,54 @@ function newerStamp(a, b) {
|
|
|
141
145
|
return new Date(b).getTime() > new Date(a).getTime() ? b : a;
|
|
142
146
|
}
|
|
143
147
|
const RANK = { online: 0, reconnecting: 1, stale: 2, offline: 3 };
|
|
148
|
+
/** The profile a harness row belongs to: the server's field, else the one its legacy daemon id names. */
|
|
149
|
+
function harnessProfileOf(row) {
|
|
150
|
+
if (row.profile)
|
|
151
|
+
return row.profile;
|
|
152
|
+
return row.daemonId ? (parseDaemonId(row.daemonId)?.profile ?? null) : null;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* The daemon profiles one machine's harness rows belong to, live first. A row whose
|
|
156
|
+
* profile cannot be told (a hosted box, an id with no profile in it) is left out: it
|
|
157
|
+
* belongs to no profile a person could disconnect or label.
|
|
158
|
+
*/
|
|
159
|
+
function summarizeMachineProfiles(harnesses) {
|
|
160
|
+
const byName = new Map();
|
|
161
|
+
for (const row of harnesses) {
|
|
162
|
+
const name = harnessProfileOf(row);
|
|
163
|
+
if (!name)
|
|
164
|
+
continue;
|
|
165
|
+
const entry = byName.get(name) ?? {
|
|
166
|
+
name,
|
|
167
|
+
label: null,
|
|
168
|
+
status: 'offline',
|
|
169
|
+
lastSeenAt: null,
|
|
170
|
+
harnessCount: 0,
|
|
171
|
+
providers: [],
|
|
172
|
+
daemonIds: [],
|
|
173
|
+
};
|
|
174
|
+
if (row.profileLabel && !entry.label)
|
|
175
|
+
entry.label = row.profileLabel;
|
|
176
|
+
if (row.daemonId && !entry.daemonIds.includes(row.daemonId))
|
|
177
|
+
entry.daemonIds.push(row.daemonId);
|
|
178
|
+
if (row.superseded !== true) {
|
|
179
|
+
entry.harnessCount += 1;
|
|
180
|
+
if (!entry.providers.includes(row.provider))
|
|
181
|
+
entry.providers.push(row.provider);
|
|
182
|
+
const state = (0, data_provider_1.daemonContactOfRow)(row);
|
|
183
|
+
const rowStatus = state === 'live' ? 'online' : state;
|
|
184
|
+
if (RANK[rowStatus] < RANK[entry.status])
|
|
185
|
+
entry.status = rowStatus;
|
|
186
|
+
}
|
|
187
|
+
entry.lastSeenAt = newerStamp(entry.lastSeenAt, row.lastSeenAt);
|
|
188
|
+
byName.set(name, entry);
|
|
189
|
+
}
|
|
190
|
+
return [...byName.values()].sort((a, b) => {
|
|
191
|
+
if (a.status !== b.status)
|
|
192
|
+
return RANK[a.status] - RANK[b.status];
|
|
193
|
+
return a.name.localeCompare(b.name);
|
|
194
|
+
});
|
|
195
|
+
}
|
|
144
196
|
/** The word the tables print for one harness row: the server's statement, not the bare status. */
|
|
145
197
|
function harnessStateLabel(row) {
|
|
146
198
|
return data_provider_1.DAEMON_CONTACT_WORDS[(0, data_provider_1.daemonContactOfRow)(row)];
|
|
@@ -300,6 +352,21 @@ async function updateMachine(machineId, patch) {
|
|
|
300
352
|
async function disconnectMachine(machineId) {
|
|
301
353
|
return (0, api_fetch_1.apiFetch)(`/api/machines/${encodeURIComponent(machineId)}/actions/disconnect`, { method: 'POST', body: {} });
|
|
302
354
|
}
|
|
355
|
+
/**
|
|
356
|
+
* Disconnect ONE daemon profile of a machine (OSK-22306): revoke that profile's
|
|
357
|
+
* daemon credential and nothing another profile holds, and retire its harness rows.
|
|
358
|
+
* The server refuses while agents are pinned to it (`PROFILE_ASSIGNED_AGENTS`).
|
|
359
|
+
*/
|
|
360
|
+
async function disconnectMachineProfile(machineId, profile, options = {}) {
|
|
361
|
+
return (0, api_fetch_1.apiFetch)(`/api/machines/${encodeURIComponent(machineId)}/profiles/${encodeURIComponent(profile)}/actions/disconnect`, { method: 'POST', body: options.clearLabel ? { clearLabel: true } : {} });
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Set or clear one daemon profile's display label and description (OSK-22308).
|
|
365
|
+
* An empty string clears a field; a field left out is unchanged.
|
|
366
|
+
*/
|
|
367
|
+
async function setMachineProfileLabel(machineId, profile, patch) {
|
|
368
|
+
return (0, api_fetch_1.apiFetch)(`/api/machines/${encodeURIComponent(machineId)}/profiles/${encodeURIComponent(profile)}/label`, { method: 'PUT', body: patch });
|
|
369
|
+
}
|
|
303
370
|
/**
|
|
304
371
|
* Resolve a user-supplied reference to exactly one machine.
|
|
305
372
|
*
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export type ProactiveAuditDomain = 'agent_compass' | 'agent_initiatives' | 'smart_schedule' | 'goal_planner';
|
|
2
|
+
export interface ProactiveAuditEvent {
|
|
3
|
+
id: string;
|
|
4
|
+
domain: string;
|
|
5
|
+
changeType?: string | null;
|
|
6
|
+
actorType?: string | null;
|
|
7
|
+
actorUserId?: string | null;
|
|
8
|
+
actorAgentId?: string | null;
|
|
9
|
+
reason?: string | null;
|
|
10
|
+
summary?: string | null;
|
|
11
|
+
occurredAt?: string | null;
|
|
12
|
+
}
|
|
13
|
+
/** One watcher switch as the run reads it. `default` = the trigger names no value. */
|
|
14
|
+
export interface WatcherSettingValue {
|
|
15
|
+
value: boolean;
|
|
16
|
+
source: 'trigger' | 'default';
|
|
17
|
+
}
|
|
18
|
+
export interface TaskGoalWatcherTrigger {
|
|
19
|
+
triggerId: string;
|
|
20
|
+
label: string | null;
|
|
21
|
+
enabled: boolean;
|
|
22
|
+
taskGoalDeltaMode: WatcherSettingValue;
|
|
23
|
+
crossDomainDedupe: WatcherSettingValue;
|
|
24
|
+
}
|
|
25
|
+
export interface TaskGoalWatcherSettings {
|
|
26
|
+
settings: Record<string, {
|
|
27
|
+
default: boolean;
|
|
28
|
+
meaning: string;
|
|
29
|
+
}>;
|
|
30
|
+
triggers: TaskGoalWatcherTrigger[];
|
|
31
|
+
}
|
|
32
|
+
export interface ProactiveAuditResponse {
|
|
33
|
+
events: ProactiveAuditEvent[];
|
|
34
|
+
taskGoalWatcher?: TaskGoalWatcherSettings;
|
|
35
|
+
}
|
|
36
|
+
export declare function proactiveAuditPath(params: {
|
|
37
|
+
agentId: string;
|
|
38
|
+
domain?: ProactiveAuditDomain;
|
|
39
|
+
limit?: number;
|
|
40
|
+
}): string;
|
|
41
|
+
export declare const proactiveAuditApi: {
|
|
42
|
+
read: (params: {
|
|
43
|
+
agentId: string;
|
|
44
|
+
domain?: ProactiveAuditDomain;
|
|
45
|
+
limit?: number;
|
|
46
|
+
}) => Promise<ProactiveAuditResponse>;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* The text form of the watcher block: for each switch, its effective value, where it comes from, and
|
|
50
|
+
* what it does. Pure, so what a reader is told is pinned by a spec rather than by a run.
|
|
51
|
+
*/
|
|
52
|
+
export declare function renderTaskGoalWatcherSettings(watcher: TaskGoalWatcherSettings | undefined, log: (line: string) => void): void;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.proactiveAuditApi = void 0;
|
|
4
|
+
exports.proactiveAuditPath = proactiveAuditPath;
|
|
5
|
+
exports.renderTaskGoalWatcherSettings = renderTaskGoalWatcherSettings;
|
|
6
|
+
/**
|
|
7
|
+
* proactive-audit.ts — client for `GET /api/todos/proactive-audit`: the cross-domain
|
|
8
|
+
* "who changed this agent's proactivity boundary, when, why" ledger, plus the two switches the
|
|
9
|
+
* agent's task/goal watcher runs with.
|
|
10
|
+
*
|
|
11
|
+
* The route shipped with the web client's types only, so a headless owner could read neither the
|
|
12
|
+
* ledger nor `crossDomainDedupe`, and a watcher run printing `"crossDomainDedupe": true` could not
|
|
13
|
+
* be told apart from a setting someone chose (OSK-22418).
|
|
14
|
+
*/
|
|
15
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
16
|
+
const triggers_1 = require("./triggers");
|
|
17
|
+
function proactiveAuditPath(params) {
|
|
18
|
+
return (0, triggers_1.withQuery)('/api/todos/proactive-audit', {
|
|
19
|
+
agentId: params.agentId,
|
|
20
|
+
domain: params.domain,
|
|
21
|
+
limit: params.limit,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
exports.proactiveAuditApi = {
|
|
25
|
+
read: (params) => data_provider_1.request.get(proactiveAuditPath(params)),
|
|
26
|
+
};
|
|
27
|
+
const SETTING_LABELS = [
|
|
28
|
+
['taskGoalDeltaMode', 'Only new pressure (delta mode)'],
|
|
29
|
+
['crossDomainDedupe', 'One voice (cross-domain dedupe)'],
|
|
30
|
+
];
|
|
31
|
+
function describeSetting(setting) {
|
|
32
|
+
const state = setting.value ? 'on' : 'off';
|
|
33
|
+
return setting.source === 'trigger'
|
|
34
|
+
? `${state} (set on the watcher trigger)`
|
|
35
|
+
: `${state} (platform default; the watcher trigger sets no value)`;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The text form of the watcher block: for each switch, its effective value, where it comes from, and
|
|
39
|
+
* what it does. Pure, so what a reader is told is pinned by a spec rather than by a run.
|
|
40
|
+
*/
|
|
41
|
+
function renderTaskGoalWatcherSettings(watcher, log) {
|
|
42
|
+
if (!watcher) {
|
|
43
|
+
log('Task/goal watcher settings were not returned (a read failure, or a server older than this field); the ledger above is unaffected.');
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (watcher.triggers.length === 0) {
|
|
47
|
+
log('Task/goal watcher: none installed on this agent, so no run reads these switches.');
|
|
48
|
+
for (const [key, label] of SETTING_LABELS) {
|
|
49
|
+
const info = watcher.settings[key];
|
|
50
|
+
if (info)
|
|
51
|
+
log(` ${label}: ${info.default ? 'on' : 'off'} by default - ${info.meaning}`);
|
|
52
|
+
}
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
for (const trigger of watcher.triggers) {
|
|
56
|
+
log(`Task/goal watcher ${trigger.triggerId}${trigger.label ? ` (${trigger.label})` : ''}` +
|
|
57
|
+
` - ${trigger.enabled ? 'enabled' : 'disabled'}`);
|
|
58
|
+
for (const [key, label] of SETTING_LABELS) {
|
|
59
|
+
log(` ${label}: ${describeSetting(trigger[key])}`);
|
|
60
|
+
const meaning = watcher.settings[key]?.meaning;
|
|
61
|
+
if (meaning)
|
|
62
|
+
log(` ${meaning}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
log('These are not settable from the CLI: a worker watcher belongs to the platform, and a run');
|
|
66
|
+
log('echoes the effective values in its counts (`skrr agents triggers runs <agent> <trigger>`).');
|
|
67
|
+
}
|