@skrr-ai/cli 0.1.216 → 0.1.217
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/commands/duties/check-now.d.ts +7 -0
- package/dist/commands/duties/check-now.js +36 -1
- package/dist/commands/duties/create.d.ts +15 -0
- package/dist/commands/duties/create.js +93 -5
- package/dist/commands/spaces/auto-executor/preview.d.ts +7 -0
- package/dist/commands/spaces/auto-executor/preview.js +21 -2
- package/dist/commands/wiki/write.js +7 -2
- package/dist/lib/duties.d.ts +2 -0
- package/dist/lib/duties.js +41 -2
- package/dist/lib/permission-rules.d.ts +4 -1
- package/dist/lib/permission-rules.js +16 -3
- package/dist/lib/space-proposals.js +8 -1
- package/dist/lib/space-write-policy.js +18 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/ownerChatDutyHarnesses.d.ts +43 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/ownerChatDutyHarnesses.js +36 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/ownerChatDutyHarnesses.d.ts +43 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/ownerChatDutyHarnesses.js +48 -0
- package/dist/node_modules/@skrr-ai/auth-core/package.json +10 -0
- package/dist/node_modules/@skrr-ai/data-provider/index.js +10285 -10283
- package/oclif.manifest.json +2 -2
- package/package.json +2 -2
|
@@ -9,6 +9,13 @@ export declare function manualCheckBlockerLines(result: Record<string, unknown>,
|
|
|
9
9
|
* searched for and quoted. `null` for a reason this does not know: the caller prints it as it came.
|
|
10
10
|
*/
|
|
11
11
|
export declare function describeNotQueuedReason(reason: unknown, id: string, bin?: string): string | null;
|
|
12
|
+
/**
|
|
13
|
+
* The lines for a Check now the server answered without queueing because the unreadable-observation
|
|
14
|
+
* backoff would hold it (OSK-33271): its Agent would not start, so nothing was queued. The sentence
|
|
15
|
+
* and the fix are the server's (the stop the Check would have recorded); the CLI adds the time and
|
|
16
|
+
* where to look. Empty for any other answer.
|
|
17
|
+
*/
|
|
18
|
+
export declare function backoffHoldLines(result: Record<string, unknown>, id: string, bin?: string): string[];
|
|
12
19
|
/**
|
|
13
20
|
* `skrr duties check-now <id>` — run one control-loop iteration immediately.
|
|
14
21
|
*
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.manualCheckBlockerLines = manualCheckBlockerLines;
|
|
4
4
|
exports.describeNotQueuedReason = describeNotQueuedReason;
|
|
5
|
+
exports.backoffHoldLines = backoffHoldLines;
|
|
5
6
|
const core_1 = require("@oclif/core");
|
|
7
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
6
8
|
const base_command_1 = require("../../base-command");
|
|
7
9
|
const web_url_1 = require("../../lib/web-url");
|
|
8
10
|
const duties_1 = require("../../lib/duties");
|
|
@@ -64,6 +66,35 @@ function describeNotQueuedReason(reason, id, bin = 'skrr') {
|
|
|
64
66
|
return null;
|
|
65
67
|
}
|
|
66
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* The lines for a Check now the server answered without queueing because the unreadable-observation
|
|
71
|
+
* backoff would hold it (OSK-33271): its Agent would not start, so nothing was queued. The sentence
|
|
72
|
+
* and the fix are the server's (the stop the Check would have recorded); the CLI adds the time and
|
|
73
|
+
* where to look. Empty for any other answer.
|
|
74
|
+
*/
|
|
75
|
+
function backoffHoldLines(result, id, bin = 'skrr') {
|
|
76
|
+
const reason = result.reason;
|
|
77
|
+
if (result.status !== 'skipped' ||
|
|
78
|
+
typeof reason !== 'string' ||
|
|
79
|
+
!data_provider_1.DUTY_CHECK_NOW_BACKOFF_REASONS.includes(reason)) {
|
|
80
|
+
return [];
|
|
81
|
+
}
|
|
82
|
+
const at = typeof result.nextAttemptAt === 'string' && result.nextAttemptAt ? result.nextAttemptAt : null;
|
|
83
|
+
const lines = [
|
|
84
|
+
reason === 'held_report_backoff'
|
|
85
|
+
? `Nothing was queued: the agent would not start, because its last report is held for approval (${reason}).`
|
|
86
|
+
: `Nothing was queued: the agent would not start, because the declared observations it reads came back unreadable and are on backoff (${reason}).`,
|
|
87
|
+
at
|
|
88
|
+
? `Next attempt allowed: the first check after ${at} (UTC).`
|
|
89
|
+
: 'Next attempt allowed: at a later check.',
|
|
90
|
+
];
|
|
91
|
+
if (typeof result.detail === 'string' && result.detail.trim())
|
|
92
|
+
lines.push(result.detail.trim());
|
|
93
|
+
if (typeof result.fix === 'string' && result.fix.trim())
|
|
94
|
+
lines.push(`Fix: ${result.fix.trim()}`);
|
|
95
|
+
lines.push(`See the last run's readings with \`${bin} duties observations ${id} --latest\`.`);
|
|
96
|
+
return lines;
|
|
97
|
+
}
|
|
67
98
|
/**
|
|
68
99
|
* `skrr duties check-now <id>` — run one control-loop iteration immediately.
|
|
69
100
|
*
|
|
@@ -113,8 +144,12 @@ class DutiesCheckNow extends base_command_1.BaseCommand {
|
|
|
113
144
|
: 'The server queued a regular Check. Version verification was not confirmed.');
|
|
114
145
|
}
|
|
115
146
|
if (status !== 'queued') {
|
|
147
|
+
const holdLines = backoffHoldLines(result, args.id, this.config.bin);
|
|
116
148
|
const sentence = describeNotQueuedReason(result.reason, args.id, this.config.bin);
|
|
117
|
-
if (
|
|
149
|
+
if (holdLines.length)
|
|
150
|
+
for (const line of holdLines)
|
|
151
|
+
this.log(line);
|
|
152
|
+
else if (sentence)
|
|
118
153
|
this.log(sentence);
|
|
119
154
|
else if (result.reason)
|
|
120
155
|
this.log(`Reason: ${String(result.reason)}`);
|
|
@@ -1,5 +1,18 @@
|
|
|
1
|
+
import { type DutyContractDifference } from '@skrr-ai/data-provider';
|
|
1
2
|
import { BaseCommand } from '../../base-command';
|
|
2
3
|
import { type AgentGuidePointer } from '../../lib/guide-pointer';
|
|
4
|
+
/**
|
|
5
|
+
* The `duties update` that applies what `create --activate` supplied and the existing Duty did
|
|
6
|
+
* not take (OSK-33270). Fields with a flag of their own get that flag, with the value from this
|
|
7
|
+
* request (never the server's bounded preview); everything else is a `--from-json` patch.
|
|
8
|
+
*/
|
|
9
|
+
export declare function existingDutyEditCommand({ dutyId, differences, payload, directiveFile, bin, }: {
|
|
10
|
+
dutyId: string;
|
|
11
|
+
differences: DutyContractDifference[];
|
|
12
|
+
payload: Record<string, unknown>;
|
|
13
|
+
directiveFile?: string;
|
|
14
|
+
bin?: string;
|
|
15
|
+
}): string;
|
|
3
16
|
/** Do not silently discard a JSON source's scope or event filters. */
|
|
4
17
|
export declare function applyWatchedSourceFlags(payload: Record<string, unknown>, built: Array<Record<string, unknown>> | undefined): void;
|
|
5
18
|
/**
|
|
@@ -88,4 +101,6 @@ export default class DutiesCreate extends BaseCommand {
|
|
|
88
101
|
'concurrency-reason': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
89
102
|
};
|
|
90
103
|
run(): Promise<void>;
|
|
104
|
+
/** The server's refusal of a start that landed on a Duty holding a different contract. */
|
|
105
|
+
private reportExistingContractDiffers;
|
|
91
106
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.existingDutyEditCommand = existingDutyEditCommand;
|
|
3
4
|
exports.applyWatchedSourceFlags = applyWatchedSourceFlags;
|
|
4
5
|
exports.hasEventCapableWatchedSource = hasEventCapableWatchedSource;
|
|
5
6
|
exports.assertEventDrivenWatchedSource = assertEventDrivenWatchedSource;
|
|
@@ -16,6 +17,40 @@ const triggers_1 = require("../../lib/triggers");
|
|
|
16
17
|
const duty_product_1 = require("../../lib/duty-product");
|
|
17
18
|
const duties_1 = require("../../lib/duties");
|
|
18
19
|
const DUTY_ACTIVATION_REFUSAL_RE = /^[A-Za-z][A-Za-z0-9_]*$/;
|
|
20
|
+
function shellWord(value) {
|
|
21
|
+
return /^[A-Za-z0-9_./:@-]+$/.test(value) ? value : JSON.stringify(value);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The `duties update` that applies what `create --activate` supplied and the existing Duty did
|
|
25
|
+
* not take (OSK-33270). Fields with a flag of their own get that flag, with the value from this
|
|
26
|
+
* request (never the server's bounded preview); everything else is a `--from-json` patch.
|
|
27
|
+
*/
|
|
28
|
+
function existingDutyEditCommand({ dutyId, differences, payload, directiveFile, bin = 'skrr', }) {
|
|
29
|
+
const remaining = new Set(differences.map((item) => item.field));
|
|
30
|
+
const parts = [`${bin} duties update ${dutyId}`];
|
|
31
|
+
if (remaining.has('title') && typeof payload.title === 'string') {
|
|
32
|
+
parts.push(`--title ${shellWord(payload.title)}`);
|
|
33
|
+
remaining.delete('title');
|
|
34
|
+
}
|
|
35
|
+
if (remaining.has('description') && typeof payload.description === 'string') {
|
|
36
|
+
parts.push(`--description ${shellWord(payload.description)}`);
|
|
37
|
+
remaining.delete('description');
|
|
38
|
+
}
|
|
39
|
+
if (remaining.has('agentDirective')) {
|
|
40
|
+
parts.push(`--agent-directive-file ${directiveFile ? shellWord(directiveFile) : '<file>'}`);
|
|
41
|
+
remaining.delete('agentDirective');
|
|
42
|
+
}
|
|
43
|
+
const outcome = record(payload.target)?.outcome;
|
|
44
|
+
if (remaining.has('target') &&
|
|
45
|
+
typeof outcome === 'string' &&
|
|
46
|
+
differences.every((item) => item.field !== 'target' || item.path === 'target.outcome')) {
|
|
47
|
+
parts.push(`--outcome ${shellWord(outcome)}`);
|
|
48
|
+
remaining.delete('target');
|
|
49
|
+
}
|
|
50
|
+
if (remaining.size)
|
|
51
|
+
parts.push(`--from-json <patch.json with ${[...remaining].join(', ')}>`);
|
|
52
|
+
return parts.join(' ');
|
|
53
|
+
}
|
|
19
54
|
const DEFAULT_EVENT_DRIVEN_BACKSTOP_MS = 24 * 60 * 60 * 1000;
|
|
20
55
|
const DEFAULT_EVENT_SOURCES = new Set(['github', 'slack', 'email', 'calendar']);
|
|
21
56
|
/**
|
|
@@ -141,8 +176,11 @@ function assertEventDrivenWatchedSource(payload) {
|
|
|
141
176
|
const hasInvalidEvents = sources.some((value) => {
|
|
142
177
|
const source = record(value);
|
|
143
178
|
const config = record(source?.config);
|
|
144
|
-
return source?.enabled !== false &&
|
|
145
|
-
|
|
179
|
+
return (source?.enabled !== false &&
|
|
180
|
+
source?.source !== 'tasks' &&
|
|
181
|
+
source?.source !== 'goal' &&
|
|
182
|
+
Array.isArray(config?.events) &&
|
|
183
|
+
!hasStructurallyValidExplicitEvent(config));
|
|
146
184
|
});
|
|
147
185
|
if (hasInvalidEvents) {
|
|
148
186
|
throw new Error('Event-driven cadence requires at least one event-capable watched source. ' +
|
|
@@ -269,7 +307,9 @@ function dutyActivationRefusal(err, { id, bin }) {
|
|
|
269
307
|
reason: refusal.message || (err instanceof Error ? err.message : 'Activation was refused.'),
|
|
270
308
|
fix: hint
|
|
271
309
|
? `${hint} Then run \`${bin} duties resume ${id}\`.`
|
|
272
|
-
: (0, data_provider_1.describeDutyActivationFix)(code === 'DUTY_ACTIVATION_REFUSED' ? undefined : code, {
|
|
310
|
+
: (0, data_provider_1.describeDutyActivationFix)(code === 'DUTY_ACTIVATION_REFUSED' ? undefined : code, {
|
|
311
|
+
turnOn: `run \`${bin} duties resume ${id}\``,
|
|
312
|
+
}),
|
|
273
313
|
...(guide ? { guide } : {}),
|
|
274
314
|
...(blockers.length > 1 ? { blockers } : {}),
|
|
275
315
|
};
|
|
@@ -368,7 +408,7 @@ JSON
|
|
|
368
408
|
}),
|
|
369
409
|
activate: core_1.Flags.boolean({
|
|
370
410
|
description: 'Turn the duty on right after creating it — the same resume + Preflight boundary ' +
|
|
371
|
-
|
|
411
|
+
'as `duties resume`. A refusal reports its code, reason and fix, and exits nonzero. ' +
|
|
372
412
|
'If a new draft was saved, use its returned ID to resume it.',
|
|
373
413
|
}),
|
|
374
414
|
deadline: core_1.Flags.string({ description: 'ISO-8601 deadline for an `achieve` duty' }),
|
|
@@ -614,7 +654,21 @@ JSON
|
|
|
614
654
|
duty = await duties_1.dutyApi.create(flags.activate ? { ...payload, activate: true } : payload);
|
|
615
655
|
}
|
|
616
656
|
catch (err) {
|
|
617
|
-
const { body } = (0, base_command_1.apiRefusal)(err);
|
|
657
|
+
const { body, code } = (0, base_command_1.apiRefusal)(err);
|
|
658
|
+
// The start landed on an existing Duty that holds a different contract, and the server
|
|
659
|
+
// refused it (OSK-33270). Report it the way OSK-32836 reported a different cadence mode:
|
|
660
|
+
// the existing Duty, `activated: false`, the refusal and its fix, and a nonzero exit.
|
|
661
|
+
if (flags.activate &&
|
|
662
|
+
code === data_provider_1.DUTY_EXISTING_CONTRACT_DIFFERS &&
|
|
663
|
+
record(body?.duty) &&
|
|
664
|
+
Array.isArray(body?.differences)) {
|
|
665
|
+
this.reportExistingContractDiffers(body, {
|
|
666
|
+
payload,
|
|
667
|
+
directiveFile: flags['agent-directive-file'],
|
|
668
|
+
json: flags.json === true,
|
|
669
|
+
});
|
|
670
|
+
return;
|
|
671
|
+
}
|
|
618
672
|
const details = body?.details;
|
|
619
673
|
const olderServer = flags.activate &&
|
|
620
674
|
Array.isArray(details) &&
|
|
@@ -635,6 +689,8 @@ JSON
|
|
|
635
689
|
// A refusal is reported on the result — never thrown over the draft's id.
|
|
636
690
|
let activation = null;
|
|
637
691
|
const start = duty?.directStart;
|
|
692
|
+
// The server refuses this itself now, with every differing field (OSK-33270, above). This
|
|
693
|
+
// stays for a server older than that, which still answers `existing` with the stored Duty.
|
|
638
694
|
const requestedController = record(record(payload.policy)?.cadenceController);
|
|
639
695
|
const existingController = duty?.policy?.cadenceController;
|
|
640
696
|
const mismatchedSetting = start?.state === 'existing' && duty?.status === 'active'
|
|
@@ -736,5 +792,37 @@ JSON
|
|
|
736
792
|
this.warn(`Guide: ${refusal.guide.command}`);
|
|
737
793
|
}
|
|
738
794
|
}
|
|
795
|
+
/** The server's refusal of a start that landed on a Duty holding a different contract. */
|
|
796
|
+
reportExistingContractDiffers(body, { payload, directiveFile, json, }) {
|
|
797
|
+
const { duty, differences } = body;
|
|
798
|
+
const bin = this.config.bin;
|
|
799
|
+
const fix = `Edit the existing Duty instead: \`${existingDutyEditCommand({ dutyId: duty.id, differences, payload, directiveFile, bin })}\`. ` +
|
|
800
|
+
`To keep it and add a second Duty, create the new one without --activate, then run \`${bin} duties resume <new-duty-id>\`.`;
|
|
801
|
+
process.exitCode = 1;
|
|
802
|
+
if (json) {
|
|
803
|
+
this.log(JSON.stringify((0, web_url_1.withDutyUrl)(this.cliConfig.baseURL, {
|
|
804
|
+
...duty,
|
|
805
|
+
activated: false,
|
|
806
|
+
refusal: {
|
|
807
|
+
code: body.code,
|
|
808
|
+
reason: body.message,
|
|
809
|
+
differences,
|
|
810
|
+
...(body.differencesTruncated ? { differencesTruncated: true } : {}),
|
|
811
|
+
fix,
|
|
812
|
+
},
|
|
813
|
+
}), null, 2));
|
|
814
|
+
return;
|
|
815
|
+
}
|
|
816
|
+
this.log('Existing duty:');
|
|
817
|
+
(0, duties_1.renderDutySummary)(duty, (line) => this.log(line));
|
|
818
|
+
this.warn(`Not created or started (${body.code}): ${body.message}`);
|
|
819
|
+
this.warn('Supplied here, held differently by that Duty, and not applied:');
|
|
820
|
+
for (const item of differences) {
|
|
821
|
+
this.warn(` - ${item.path}: it has ${item.stored ?? '(nothing)'}; this request had ${item.requested ?? '(nothing)'}`);
|
|
822
|
+
}
|
|
823
|
+
if (body.differencesTruncated)
|
|
824
|
+
this.warn(' - …and more.');
|
|
825
|
+
this.warn(`Fix: ${fix}`);
|
|
826
|
+
}
|
|
739
827
|
}
|
|
740
828
|
exports.default = DutiesCreate;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { type SpaceAutoExecutorPreviewResponse, type SpaceAutoExecutorRefillState } from '@skrr-ai/data-provider';
|
|
2
2
|
import { BaseCommand } from '../../../base-command';
|
|
3
3
|
type PreviewSpace = SpaceAutoExecutorPreviewResponse['space'];
|
|
4
|
+
type PlanSummary = SpaceAutoExecutorPreviewResponse['plan']['summary'];
|
|
5
|
+
/**
|
|
6
|
+
* The board in one line. "Running" counts the started Tasks something executes (OSK-33478); a
|
|
7
|
+
* started Task that only waits on something else, or that nothing carries, is said as what it is,
|
|
8
|
+
* and an older server that reports no split prints the line it always did.
|
|
9
|
+
*/
|
|
10
|
+
export declare function boardLine(summary: Pick<PlanSummary, 'readyCount' | 'unassignedCount' | 'runningCount' | 'startedWaitingCount' | 'startedUncarriedCount' | 'failedCount' | 'scheduledCount'>): string;
|
|
4
11
|
/**
|
|
5
12
|
* "Can start" is a capacity figure, not a forecast. Printed bare next to a disabled autopilot
|
|
6
13
|
* it read as "one task will start now" (dogfooded: `Autopilot: disabled` / `Can start: 1 now`).
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.boardLine = boardLine;
|
|
3
4
|
exports.canStartLine = canStartLine;
|
|
4
5
|
exports.principalLine = principalLine;
|
|
5
6
|
exports.refillLines = refillLines;
|
|
@@ -9,6 +10,22 @@ const base_command_1 = require("../../../base-command");
|
|
|
9
10
|
const api_fetch_1 = require("../../../lib/api-fetch");
|
|
10
11
|
const space_output_1 = require("../../../lib/space-output");
|
|
11
12
|
const PRINCIPAL_LINE_RE = /_/g;
|
|
13
|
+
/**
|
|
14
|
+
* The board in one line. "Running" counts the started Tasks something executes (OSK-33478); a
|
|
15
|
+
* started Task that only waits on something else, or that nothing carries, is said as what it is,
|
|
16
|
+
* and an older server that reports no split prints the line it always did.
|
|
17
|
+
*/
|
|
18
|
+
function boardLine(summary) {
|
|
19
|
+
const started = [
|
|
20
|
+
summary.startedWaitingCount ? `${summary.startedWaitingCount} started and waiting` : null,
|
|
21
|
+
summary.startedUncarriedCount
|
|
22
|
+
? `${summary.startedUncarriedCount} started with nothing carrying ${summary.startedUncarriedCount === 1 ? 'it' : 'them'}`
|
|
23
|
+
: null,
|
|
24
|
+
].filter(Boolean);
|
|
25
|
+
return (`Board: ${summary.readyCount} ready · ${summary.unassignedCount} unassigned · ` +
|
|
26
|
+
`${summary.runningCount} running · ${started.map((part) => `${part} · `).join('')}` +
|
|
27
|
+
`${summary.failedCount} failed · ${summary.scheduledCount} scheduled`);
|
|
28
|
+
}
|
|
12
29
|
/**
|
|
13
30
|
* "Can start" is a capacity figure, not a forecast. Printed bare next to a disabled autopilot
|
|
14
31
|
* it read as "one task will start now" (dogfooded: `Autopilot: disabled` / `Can start: 1 now`).
|
|
@@ -94,12 +111,14 @@ class SpacesAutoExecutorPreview extends base_command_1.BaseCommand {
|
|
|
94
111
|
this.log(line);
|
|
95
112
|
const { actions, summary } = plan;
|
|
96
113
|
this.log('');
|
|
97
|
-
this.log(
|
|
98
|
-
`${summary.runningCount} running · ${summary.failedCount} failed · ${summary.scheduledCount} scheduled`);
|
|
114
|
+
this.log(boardLine(summary));
|
|
99
115
|
section(this.log.bind(this), 'Would start now', actions.startNow, (a) => taskLine(a.task));
|
|
100
116
|
section(this.log.bind(this), 'Would assign', actions.assignments, (a) => `${taskLine(a.task)} → ${a.suggestedAgentName ?? a.suggestedAgentId ?? 'no eligible agent'}`);
|
|
101
117
|
section(this.log.bind(this), 'Would schedule later', actions.scheduleLater, (a) => `${taskLine(a.task)} @ ${a.scheduledFor}`);
|
|
102
118
|
section(this.log.bind(this), 'Failures to review', actions.failureReviews, (a) => taskLine(a.task));
|
|
119
|
+
// In Progress on the board, and nothing will move them: not running, and not this Space's to
|
|
120
|
+
// start. Listed so the person reading this can decide what moves each one.
|
|
121
|
+
section(this.log.bind(this), 'Started, nothing carrying it', result.context.buckets.startedUncarried, (task) => taskLine(task));
|
|
103
122
|
// The single most useful diagnostic in the payload: a ready task that is
|
|
104
123
|
// not starting because ITS agent is saturated elsewhere, not because this
|
|
105
124
|
// space is full. Without it the board just looks stuck.
|
|
@@ -190,7 +190,8 @@ class WikiWrite extends base_command_1.BaseCommand {
|
|
|
190
190
|
}),
|
|
191
191
|
note: core_1.Flags.string({
|
|
192
192
|
description: 'Why you are making the change. When the Space holds the write for approval it becomes a ' +
|
|
193
|
-
'suggestion on the page, and this is its first comment;
|
|
193
|
+
'suggestion (on the page, or a proposal to create it), and this is its first comment; ' +
|
|
194
|
+
'otherwise it is not stored',
|
|
194
195
|
}),
|
|
195
196
|
};
|
|
196
197
|
async run() {
|
|
@@ -284,6 +285,9 @@ class WikiWrite extends base_command_1.BaseCommand {
|
|
|
284
285
|
content,
|
|
285
286
|
format,
|
|
286
287
|
...(flags.kind ? { kind: flags.kind } : {}),
|
|
288
|
+
// The first comment of the proposal when the Space holds the
|
|
289
|
+
// create for approval (OSK-33418); never stored on the page.
|
|
290
|
+
...(flags.note ? { note: flags.note } : {}),
|
|
287
291
|
// Never let the server rename an EXACTLY addressed path. Without
|
|
288
292
|
// this it answers 201 having created `x-2` beside `x`, and the
|
|
289
293
|
// write the user asked for silently did not happen.
|
|
@@ -324,7 +328,8 @@ class WikiWrite extends base_command_1.BaseCommand {
|
|
|
324
328
|
// write policy (`202 pending_approval`): a journal entry or report create,
|
|
325
329
|
// or an append to the one it created (`--append`, OSK-17995), in its Run's
|
|
326
330
|
// approval bundle (OSK-17994); an edit of any other page's body as a
|
|
327
|
-
// suggestion on the page (OSK-17997)
|
|
331
|
+
// suggestion on the page (OSK-17997); a new page of any other kind as a
|
|
332
|
+
// proposal to create it (OSK-33418). Nothing was written yet.
|
|
328
333
|
if (this.reportHeldSpaceWrite(page, { json: flags.json }))
|
|
329
334
|
return;
|
|
330
335
|
// Fallback for a server predating `conflict: 'fail'`, which answers 201
|
package/dist/lib/duties.d.ts
CHANGED
|
@@ -1263,6 +1263,8 @@ export declare function renderDutyObservations(response: ReadModelRecord, log: (
|
|
|
1263
1263
|
export declare function renderDutyHypotheses(response: ReadModelRecord, log: (line: string) => void, options?: {
|
|
1264
1264
|
emptyMessage?: string;
|
|
1265
1265
|
}): void;
|
|
1266
|
+
/** Notes under the hypothesis table: each claim whose falsifier can never fire, and what that means. */
|
|
1267
|
+
export declare function hypothesisLegend(data: ReadModelRecord[]): string[];
|
|
1266
1268
|
/** Old servers could associate work by logical ID without proving its source.
|
|
1267
1269
|
* Never render or print those rows unless the server explicitly declares that
|
|
1268
1270
|
* the source is supported. This also protects JSON output during mixed rollout.
|
package/dist/lib/duties.js
CHANGED
|
@@ -62,6 +62,7 @@ exports.describeObservationArtifacts = describeObservationArtifacts;
|
|
|
62
62
|
exports.observationLegend = observationLegend;
|
|
63
63
|
exports.renderDutyObservations = renderDutyObservations;
|
|
64
64
|
exports.renderDutyHypotheses = renderDutyHypotheses;
|
|
65
|
+
exports.hypothesisLegend = hypothesisLegend;
|
|
65
66
|
exports.safeDutyLineage = safeDutyLineage;
|
|
66
67
|
exports.isDutyLineageUnavailable = isDutyLineageUnavailable;
|
|
67
68
|
exports.renderDutyLineage = renderDutyLineage;
|
|
@@ -2668,7 +2669,7 @@ function renderDutyHypotheses(response, log, options = {}) {
|
|
|
2668
2669
|
// difference between a real check and a degraded self-certification
|
|
2669
2670
|
// (OSK-10954). (A hypothesis carries no `confidence` — that is an
|
|
2670
2671
|
// observation concept — so the column that read it was always empty.)
|
|
2671
|
-
falsifier: describeFalsifier(item.falsifier),
|
|
2672
|
+
falsifier: describeFalsifier(item.falsifier, item.falsifierCannotFire),
|
|
2672
2673
|
authority: text(item.authority),
|
|
2673
2674
|
episode: (0, format_1.formatCell)(item.episode),
|
|
2674
2675
|
})), [
|
|
@@ -2679,6 +2680,40 @@ function renderDutyHypotheses(response, log, options = {}) {
|
|
|
2679
2680
|
{ key: 'authority', header: 'AUTHORITY', maxWidth: 18 },
|
|
2680
2681
|
{ key: 'episode', header: 'EP', maxWidth: 4 },
|
|
2681
2682
|
], options.emptyMessage || 'No hypotheses recorded.', log);
|
|
2683
|
+
for (const line of hypothesisLegend(data))
|
|
2684
|
+
log(line);
|
|
2685
|
+
}
|
|
2686
|
+
/**
|
|
2687
|
+
* Why a falsifier bound to a declared key can never fire, as the server derives it (OSK-33475). The column shows
|
|
2688
|
+
* the short form; the legend names the claim and the key, which the 26-character column cannot.
|
|
2689
|
+
*/
|
|
2690
|
+
const FALSIFIER_CANNOT_FIRE_CELL = {
|
|
2691
|
+
no_comparator: 'cannot fire: no comparator',
|
|
2692
|
+
no_threshold: 'cannot fire: no threshold',
|
|
2693
|
+
};
|
|
2694
|
+
const FALSIFIER_CANNOT_FIRE_WORDS = {
|
|
2695
|
+
no_comparator: () => 'it names no comparator the platform evaluates',
|
|
2696
|
+
no_threshold: (comparator) => `comparator "${comparator}" has no numeric threshold to compare against`,
|
|
2697
|
+
};
|
|
2698
|
+
function cannotFireReason(value) {
|
|
2699
|
+
return typeof value === 'string' &&
|
|
2700
|
+
Object.prototype.hasOwnProperty.call(FALSIFIER_CANNOT_FIRE_CELL, value)
|
|
2701
|
+
? value
|
|
2702
|
+
: undefined;
|
|
2703
|
+
}
|
|
2704
|
+
/** Notes under the hypothesis table: each claim whose falsifier can never fire, and what that means. */
|
|
2705
|
+
function hypothesisLegend(data) {
|
|
2706
|
+
const lines = [];
|
|
2707
|
+
for (const item of data) {
|
|
2708
|
+
const why = cannotFireReason(item.falsifierCannotFire);
|
|
2709
|
+
if (!why)
|
|
2710
|
+
continue;
|
|
2711
|
+
const falsifier = record(item.falsifier) || {};
|
|
2712
|
+
lines.push(`CANNOT FIRE ${text(item.id)}: the falsifier on key ${text(falsifier.observationKey)} can never fire, because ` +
|
|
2713
|
+
`${FALSIFIER_CANNOT_FIRE_WORDS[why](text(falsifier.comparator))}. The platform will not settle this claim; ` +
|
|
2714
|
+
'only a run can.');
|
|
2715
|
+
}
|
|
2716
|
+
return lines;
|
|
2682
2717
|
}
|
|
2683
2718
|
/**
|
|
2684
2719
|
* One falsifier rendered as what settles the claim, not just its kind.
|
|
@@ -2687,10 +2722,14 @@ function renderDutyHypotheses(response, log, options = {}) {
|
|
|
2687
2722
|
* `agent_check` stays the literal kind — the claim can only be settled by the
|
|
2688
2723
|
* same agent that proposed it, and the column should keep saying so.
|
|
2689
2724
|
*/
|
|
2690
|
-
function describeFalsifier(falsifier) {
|
|
2725
|
+
function describeFalsifier(falsifier, cannotFire) {
|
|
2691
2726
|
const f = record(falsifier);
|
|
2692
2727
|
if (!f)
|
|
2693
2728
|
return '-';
|
|
2729
|
+
const why = cannotFireReason(cannotFire);
|
|
2730
|
+
// A key that can never settle the claim is not "a real check", so the column must not name it as one.
|
|
2731
|
+
if (why)
|
|
2732
|
+
return FALSIFIER_CANNOT_FIRE_CELL[why];
|
|
2694
2733
|
if (f.kind === 'observation_key' && typeof f.observationKey === 'string') {
|
|
2695
2734
|
return `key:${f.observationKey}`;
|
|
2696
2735
|
}
|
|
@@ -4,7 +4,10 @@
|
|
|
4
4
|
* from, and how often it has run.
|
|
5
5
|
*/
|
|
6
6
|
import type { AgentPermissionRuleView, PermissionRuleGrantOutcome } from '@skrr-ai/data-provider';
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* What a rule covers. "any command", and the Task Runs preset (OSK-33426), are worded here, never
|
|
9
|
+
* read from a stored label.
|
|
10
|
+
*/
|
|
8
11
|
export declare function ruleCovers(rule: AgentPermissionRuleView): string;
|
|
9
12
|
export declare function ruleWhere(rule: AgentPermissionRuleView): string;
|
|
10
13
|
export declare function ruleGranted(rule: AgentPermissionRuleView): string;
|
|
@@ -6,17 +6,29 @@ exports.ruleGranted = ruleGranted;
|
|
|
6
6
|
exports.ruleUse = ruleUse;
|
|
7
7
|
exports.ruleLines = ruleLines;
|
|
8
8
|
exports.ruleOutcomeLine = ruleOutcomeLine;
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* What a rule covers. "any command", and the Task Runs preset (OSK-33426), are worded here, never
|
|
11
|
+
* read from a stored label.
|
|
12
|
+
*/
|
|
10
13
|
function ruleCovers(rule) {
|
|
14
|
+
if (rule.runs === 'task')
|
|
15
|
+
return 'any tool or command in Task Runs';
|
|
11
16
|
return rule.match?.kind === 'any' ? 'any command' : rule.label;
|
|
12
17
|
}
|
|
13
18
|
function ruleWhere(rule) {
|
|
14
19
|
if (rule.where?.kind === 'machine') {
|
|
15
|
-
|
|
20
|
+
const id = rule.where.harnessId;
|
|
21
|
+
if (rule.where.name)
|
|
22
|
+
return id ? `on ${rule.where.name} (${id})` : `on ${rule.where.name}`;
|
|
23
|
+
return id ? `on machine ${id}` : 'on a machine';
|
|
16
24
|
}
|
|
17
25
|
return 'in the cloud';
|
|
18
26
|
}
|
|
19
27
|
function ruleGranted(rule) {
|
|
28
|
+
if (rule.source?.from === 'preset') {
|
|
29
|
+
const at = rule.createdAt ? `added ${rule.createdAt}` : 'added';
|
|
30
|
+
return `${at} automatically: Task Runs on your own machine don't ask. Remove it and they ask you again`;
|
|
31
|
+
}
|
|
20
32
|
const at = rule.createdAt ? `granted ${rule.createdAt}` : 'granted';
|
|
21
33
|
if (rule.source?.taskId)
|
|
22
34
|
return `${at} from Task ${rule.source.taskId}`;
|
|
@@ -34,7 +46,8 @@ function ruleUse(rule) {
|
|
|
34
46
|
/** One rule as a short block: what it covers, then its id and details. */
|
|
35
47
|
function ruleLines(rule) {
|
|
36
48
|
return [
|
|
37
|
-
|
|
49
|
+
// The Task Runs preset covers every tool, so naming one (`*`) would say nothing.
|
|
50
|
+
rule.runs === 'task' ? ruleCovers(rule) : `${ruleCovers(rule)} (${rule.tool})`,
|
|
38
51
|
` id: ${rule.id}`,
|
|
39
52
|
` ${ruleWhere(rule)}; ${ruleGranted(rule)}`,
|
|
40
53
|
` ${ruleUse(rule)}`,
|
|
@@ -161,7 +161,14 @@ function spaceProposalDetailLines(item, binName) {
|
|
|
161
161
|
const produced = spaceMemoryProducerLine(item);
|
|
162
162
|
if (produced)
|
|
163
163
|
lines.push(` ${item.id} ${produced}`);
|
|
164
|
-
if (item.kind === 'page_suggestion' && item.page) {
|
|
164
|
+
if (item.kind === 'page_suggestion' && item.page?.create) {
|
|
165
|
+
// A proposal to create a page (OSK-33418): there is no page to open yet.
|
|
166
|
+
const create = item.page.create;
|
|
167
|
+
lines.push(` ${item.id} create page "${create.title}" at ${create.path} (${create.kind})`);
|
|
168
|
+
if (item.page.truncated)
|
|
169
|
+
lines.push(` ${item.id} (draft shortened here; the proposal's details on the web show all of it)`);
|
|
170
|
+
}
|
|
171
|
+
else if (item.kind === 'page_suggestion' && item.page) {
|
|
165
172
|
const where = item.page.anchor
|
|
166
173
|
? (0, data_provider_1.describePageSectionAnchor)(item.page.anchor)
|
|
167
174
|
: 'the marked text';
|
|
@@ -44,12 +44,13 @@ function writePolicyLines(view) {
|
|
|
44
44
|
if (row.capped)
|
|
45
45
|
notes.push(`the Workspace requires approval for ${row.writeClass}, so stored "auto" reads as propose`);
|
|
46
46
|
// A class with no proposal path yet refuses what it would hold (OSK-17994);
|
|
47
|
-
// a page class holds
|
|
47
|
+
// a page class holds a body write as a suggestion on the page (OSK-17997)
|
|
48
|
+
// and a new page as a proposal to create it (OSK-33418).
|
|
48
49
|
// `proposalPath` is absent from a server older than the field.
|
|
49
50
|
if (row.mode === 'propose' && row.proposalPath === null)
|
|
50
51
|
notes.push('cannot be proposed yet, so an unattended write is refused');
|
|
51
52
|
if (row.mode === 'propose' && row.proposalPath === 'page_suggestion')
|
|
52
|
-
notes.push('a body edit becomes a suggestion
|
|
53
|
+
notes.push('a body edit or a new page becomes a suggestion a person accepts; other page changes are refused');
|
|
53
54
|
// OSK-17998: a new skill is proposed as a lesson; nothing else about skills can be.
|
|
54
55
|
if (row.mode === 'propose' && row.proposalPath === 'space_lesson')
|
|
55
56
|
notes.push('a new skill is proposed as a lesson a person promotes; a removal or pin is refused');
|
|
@@ -68,6 +69,21 @@ function writePolicyLines(view) {
|
|
|
68
69
|
*/
|
|
69
70
|
function spaceWritePendingLines(body, { binName }) {
|
|
70
71
|
const proposal = body.proposal;
|
|
72
|
+
if (proposal.kind === 'page_suggestion' && proposal.create) {
|
|
73
|
+
// A proposal to create a page (OSK-33418): no page exists and nothing
|
|
74
|
+
// holds the path until a person accepts it.
|
|
75
|
+
const lines = [
|
|
76
|
+
'Held for approval: no page was created yet.',
|
|
77
|
+
body.message,
|
|
78
|
+
`Proposed page: "${proposal.create.title}" at ${proposal.create.path} (suggestion ${proposal.id})`,
|
|
79
|
+
];
|
|
80
|
+
if (proposal.duplicate)
|
|
81
|
+
lines.push('The same proposal was already pending; it was not made twice.');
|
|
82
|
+
if (proposal.spaceId) {
|
|
83
|
+
lines.push(`Review it: ${binName} spaces proposals list ${proposal.spaceId} --kind page_suggestion`);
|
|
84
|
+
}
|
|
85
|
+
return lines;
|
|
86
|
+
}
|
|
71
87
|
if (proposal.kind === 'page_suggestion') {
|
|
72
88
|
// A page revision proposal (OSK-17997): a suggestion thread on the page,
|
|
73
89
|
// decided from the Space inbox or on the page itself.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which daemon harnesses a Main Chat turn may carry the owner-chat Duty tools on
|
|
3
|
+
* (`duty_list`, `duty_start`, `duty_update_reporting`, `duty_pause`): the tools
|
|
4
|
+
* that let an Agent's owner start, pause or change a Duty in their own words
|
|
5
|
+
* (OSK-33476). One list, here, because both ends of the wire act on it and the
|
|
6
|
+
* daemon cannot import the API (`@skrr-ai/auth-core/owner-chat-duty-harnesses`):
|
|
7
|
+
*
|
|
8
|
+
* - the server (`api/server/services/AgentWorker/bridge.js`) offers the tools to
|
|
9
|
+
* a listed harness's dispatch, and seals the owner's message on the dispatch
|
|
10
|
+
* receipt the tools are checked against when one is called;
|
|
11
|
+
* - the server's intent check (`api/server/services/Duties/OwnerChatDutyIntent.js`)
|
|
12
|
+
* has a bounded, tool-less inference on the chat's own daemon for every listed
|
|
13
|
+
* harness, and refuses any other;
|
|
14
|
+
* - the daemon mints the session credential the tools need
|
|
15
|
+
* (`daemon/src/connection-helpers/session-credential.ts`) and admits the turn
|
|
16
|
+
* (`daemon/src/delegation-mcp/owner-chat-duty-gate.ts`) only for a listed
|
|
17
|
+
* harness, whose backend mounts the tools.
|
|
18
|
+
*
|
|
19
|
+
* A harness is listed only when ALL THREE hold: its daemon backend can mount an
|
|
20
|
+
* extra stdio MCP server for the turn, the server can run the intent check for
|
|
21
|
+
* it, and the daemon mints its credential. Listing one that lacks the second
|
|
22
|
+
* would offer tools whose every change is refused.
|
|
23
|
+
*
|
|
24
|
+
* The first-party harness is deliberately NOT listed yet. Its ACP backend could
|
|
25
|
+
* mount the server as it mounts `delegation` (`daemon/src/backends/acp.ts`; not wired,
|
|
26
|
+
* and a resident engine reads MCP bindings from its turn channel, not a file), but
|
|
27
|
+
* the intent check has no qualified local inference for it:
|
|
28
|
+
* the daemon's private inference answers only `claude` and the native Codex draft
|
|
29
|
+
* (`daemon/src/continuity/inference.ts`, `PROVIDERS`), and a hosted check would
|
|
30
|
+
* move a local chat's judgment and its cost onto the platform, which is a product
|
|
31
|
+
* decision, not this list's.
|
|
32
|
+
*
|
|
33
|
+
* The server stays the authority whatever this list says: the tools act only after
|
|
34
|
+
* `OwnerChatDuty.run` re-checks the stored owner stamp, the quoted request and the
|
|
35
|
+
* intent. An older peer that does not know a provider is listed only ever withholds
|
|
36
|
+
* the tools.
|
|
37
|
+
*
|
|
38
|
+
* Pure: no `node:` imports and nothing read at module load.
|
|
39
|
+
*/
|
|
40
|
+
/** Canonical provider spellings, in the order they were admitted. */
|
|
41
|
+
export declare const OWNER_CHAT_DUTY_TOOL_HARNESSES: readonly string[];
|
|
42
|
+
/** Whether a Main Chat turn on this harness may carry the owner-chat Duty tools. */
|
|
43
|
+
export declare function supportsOwnerChatDutyTools(provider: unknown): boolean;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var ownerChatDutyHarnesses_exports = {};
|
|
20
|
+
__export(ownerChatDutyHarnesses_exports, {
|
|
21
|
+
OWNER_CHAT_DUTY_TOOL_HARNESSES: () => OWNER_CHAT_DUTY_TOOL_HARNESSES,
|
|
22
|
+
supportsOwnerChatDutyTools: () => supportsOwnerChatDutyTools
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(ownerChatDutyHarnesses_exports);
|
|
25
|
+
var import_firstPartyHarness = require("./firstPartyHarness.js");
|
|
26
|
+
const OWNER_CHAT_DUTY_TOOL_HARNESSES = Object.freeze(["codex", "claude"]);
|
|
27
|
+
function supportsOwnerChatDutyTools(provider) {
|
|
28
|
+
if (typeof provider !== "string" || !provider)
|
|
29
|
+
return false;
|
|
30
|
+
return OWNER_CHAT_DUTY_TOOL_HARNESSES.includes(String((0, import_firstPartyHarness.canonicalHarnessProvider)(provider)));
|
|
31
|
+
}
|
|
32
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
+
0 && (module.exports = {
|
|
34
|
+
OWNER_CHAT_DUTY_TOOL_HARNESSES,
|
|
35
|
+
supportsOwnerChatDutyTools
|
|
36
|
+
});
|