@skrr-ai/cli 0.1.13 → 0.1.15
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 +12 -36
- package/dist/base-command.js +96 -11
- package/dist/commands/agents/create.d.ts +1 -0
- package/dist/commands/agents/create.js +6 -1
- package/dist/commands/agents/instructions/add.d.ts +21 -0
- package/dist/commands/agents/instructions/add.js +115 -0
- package/dist/commands/agents/instructions/disable.d.ts +13 -0
- package/dist/commands/agents/instructions/disable.js +50 -0
- package/dist/commands/agents/instructions/edit.d.ts +16 -0
- package/dist/commands/agents/instructions/edit.js +79 -0
- package/dist/commands/agents/instructions/enable.d.ts +13 -0
- package/dist/commands/agents/instructions/enable.js +50 -0
- package/dist/commands/agents/instructions/move.d.ts +15 -0
- package/dist/commands/agents/instructions/move.js +61 -0
- package/dist/commands/agents/instructions/preview.d.ts +13 -0
- package/dist/commands/agents/instructions/preview.js +59 -0
- package/dist/commands/agents/instructions/remove.d.ts +13 -0
- package/dist/commands/agents/instructions/remove.js +49 -0
- package/dist/commands/agents/instructions/set.d.ts +17 -0
- package/dist/commands/agents/instructions/set.js +79 -0
- package/dist/commands/agents/instructions/show.d.ts +15 -0
- package/dist/commands/agents/instructions/show.js +76 -0
- package/dist/commands/agents/instructions/upgrade.d.ts +16 -0
- package/dist/commands/agents/instructions/upgrade.js +77 -0
- package/dist/commands/agents/list.d.ts +10 -0
- package/dist/commands/agents/list.js +16 -1
- package/dist/commands/agents/show.js +5 -0
- package/dist/commands/agents/triggers/policy.js +8 -2
- package/dist/commands/agents/update.d.ts +1 -0
- package/dist/commands/agents/update.js +8 -2
- package/dist/commands/browser.js +5 -5
- package/dist/commands/commitments/create.d.ts +2 -0
- package/dist/commands/commitments/create.js +30 -13
- package/dist/commands/commitments/update.d.ts +2 -0
- package/dist/commands/commitments/update.js +24 -4
- package/dist/commands/daemon/byok.js +5 -5
- package/dist/commands/daemon/index.js +5 -3
- package/dist/commands/daemon/install.js +8 -5
- package/dist/commands/daemon/login.js +5 -5
- package/dist/commands/daemon/logs.js +5 -5
- package/dist/commands/daemon/recover-offline-queue.d.ts +9 -0
- package/dist/commands/daemon/recover-offline-queue.js +24 -0
- package/dist/commands/daemon/restart.js +5 -5
- package/dist/commands/daemon/start.js +34 -6
- package/dist/commands/daemon/status.js +5 -5
- package/dist/commands/daemon/stop.js +5 -5
- package/dist/commands/daemon/uninstall.js +5 -5
- package/dist/commands/daemon/unlock.js +5 -5
- package/dist/commands/daemon/usage.js +6 -6
- package/dist/commands/instruction-blocks/create.d.ts +19 -0
- package/dist/commands/instruction-blocks/create.js +94 -0
- package/dist/commands/instruction-blocks/delete.d.ts +13 -0
- package/dist/commands/instruction-blocks/delete.js +35 -0
- package/dist/commands/instruction-blocks/list.d.ts +13 -0
- package/dist/commands/instruction-blocks/list.js +71 -0
- package/dist/commands/instruction-blocks/show.d.ts +12 -0
- package/dist/commands/instruction-blocks/show.js +35 -0
- package/dist/commands/instruction-blocks/update.d.ts +23 -0
- package/dist/commands/instruction-blocks/update.js +94 -0
- package/dist/commands/login.js +7 -2
- package/dist/commands/spaces/auto-executor/preview.d.ts +1 -0
- package/dist/commands/spaces/auto-executor/preview.js +62 -3
- package/dist/commands/spaces/auto-executor/update.d.ts +4 -0
- package/dist/commands/spaces/auto-executor/update.js +78 -7
- package/dist/commands/spaces/capacity.js +14 -2
- package/dist/commands/spaces/list.d.ts +13 -0
- package/dist/commands/spaces/list.js +20 -1
- package/dist/commands/spaces/update.d.ts +4 -0
- package/dist/commands/spaces/update.js +49 -2
- package/dist/commands/tasks/complete.d.ts +12 -5
- package/dist/commands/tasks/complete.js +50 -28
- package/dist/commands/tasks/continue-ready.js +9 -1
- package/dist/commands/tasks/create.d.ts +1 -0
- package/dist/commands/tasks/create.js +25 -1
- package/dist/commands/tasks/deliverable/add.d.ts +23 -0
- package/dist/commands/tasks/deliverable/add.js +70 -0
- package/dist/commands/tasks/events/append.d.ts +1 -1
- package/dist/commands/tasks/events/append.js +4 -4
- package/dist/commands/tasks/expectations.d.ts +12 -0
- package/dist/commands/tasks/expectations.js +92 -0
- package/dist/commands/tasks/judge.d.ts +29 -0
- package/dist/commands/tasks/judge.js +68 -0
- package/dist/commands/tasks/list.d.ts +11 -0
- package/dist/commands/tasks/list.js +82 -11
- package/dist/commands/tasks/report.d.ts +1 -1
- package/dist/commands/tasks/report.js +3 -3
- package/dist/commands/tasks/update.d.ts +1 -0
- package/dist/commands/tasks/update.js +34 -4
- package/dist/commands/tasks/waive.d.ts +25 -0
- package/dist/commands/tasks/waive.js +58 -0
- package/dist/commands/wiki/cat.js +2 -1
- package/dist/commands/wiki/mv.js +5 -1
- package/dist/commands/wiki/write.js +5 -1
- package/dist/lib/agent-config.js +5 -0
- package/dist/lib/agent-instructions.d.ts +15 -0
- package/dist/lib/agent-instructions.js +55 -0
- package/dist/lib/api-fetch.d.ts +2 -1
- package/dist/lib/api-fetch.js +9 -2
- package/dist/lib/command-hygiene.d.ts +6 -1
- package/dist/lib/command-hygiene.js +49 -29
- package/dist/lib/commitments.d.ts +44 -0
- package/dist/lib/commitments.js +123 -0
- package/dist/lib/daemon-binding.d.ts +3 -4
- package/dist/lib/daemon-binding.js +11 -10
- package/dist/lib/daemon-handoff-opt-out.d.ts +8 -0
- package/dist/lib/daemon-handoff-opt-out.js +17 -0
- package/dist/lib/daemon-installer.d.ts +1 -1
- package/dist/lib/daemon-installer.js +2 -2
- package/dist/lib/daemon-setup.js +13 -7
- package/dist/lib/daemonHandoff.d.ts +1 -1
- package/dist/lib/daemonHandoff.js +20 -7
- package/dist/lib/delegated-cli.d.ts +0 -9
- package/dist/lib/delegated-cli.js +149 -6
- package/dist/lib/{exec-oversky.d.ts → exec-runtime-binary.d.ts} +28 -4
- package/dist/lib/{exec-oversky.js → exec-runtime-binary.js} +138 -37
- package/dist/lib/git-task.d.ts +37 -0
- package/dist/lib/git-task.js +151 -0
- package/dist/lib/instruction-blocks.d.ts +29 -0
- package/dist/lib/instruction-blocks.js +159 -0
- package/dist/lib/node-adapter.js +6 -0
- package/dist/lib/runtime-start-verification.d.ts +49 -0
- package/dist/lib/runtime-start-verification.js +108 -0
- package/dist/lib/sky-code.d.ts +1 -1
- package/dist/lib/sky-code.js +1 -1
- package/dist/lib/task-execution.d.ts +18 -2
- package/dist/lib/task-execution.js +19 -14
- package/dist/lib/task-transcript.js +1 -1
- package/dist/lib/tasks.d.ts +50 -0
- package/dist/lib/tasks.js +66 -1
- package/dist/lib/usage-discovery.js +1 -1
- package/dist/lib/web-url.d.ts +16 -0
- package/dist/lib/web-url.js +25 -0
- package/dist/node_modules/@skrr-ai/data-provider/index.js +4075 -3905
- package/dist/node_modules/@skrr-ai/inference-broker/package.json +1 -1
- package/oclif.manifest.json +12364 -10488
- package/package.json +4 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** Matches the runtime's EX_CONFIG result for a permanent local configuration failure. */
|
|
2
|
+
export declare const DAEMON_START_REAUTH_EXIT = 78;
|
|
3
|
+
/** Matches the runtime's EX_TEMPFAIL result when a service cannot remain running. */
|
|
4
|
+
export declare const DAEMON_START_UNVERIFIED_EXIT = 75;
|
|
5
|
+
export type RuntimeStartStatus = {
|
|
6
|
+
profile: string;
|
|
7
|
+
serverUrl: string | null;
|
|
8
|
+
cwd: string | null;
|
|
9
|
+
reauth: {
|
|
10
|
+
needed: boolean;
|
|
11
|
+
reason: string | null;
|
|
12
|
+
};
|
|
13
|
+
running: boolean;
|
|
14
|
+
runtimeStatus: string | null;
|
|
15
|
+
};
|
|
16
|
+
export type RuntimeStartVerification = {
|
|
17
|
+
status: 'running';
|
|
18
|
+
} | {
|
|
19
|
+
status: 'reauth_required';
|
|
20
|
+
profile: string;
|
|
21
|
+
reason: string | null;
|
|
22
|
+
recoveryCommand: string;
|
|
23
|
+
} | {
|
|
24
|
+
status: 'not_running';
|
|
25
|
+
profile: string;
|
|
26
|
+
runtimeStatus: string | null;
|
|
27
|
+
} | {
|
|
28
|
+
status: 'unreadable_status';
|
|
29
|
+
profile: string;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* The status probe must observe the same profile as the start request. A
|
|
33
|
+
* runtime's `--profile` flag is global, so it is deliberately returned after
|
|
34
|
+
* `status` here and normalized by execRuntimeBinary before spawning.
|
|
35
|
+
*/
|
|
36
|
+
export declare function statusArgsForStart(argv: readonly string[]): string[];
|
|
37
|
+
export declare function parseRuntimeStartStatus(value: unknown, fallbackProfile: string): RuntimeStartStatus | null;
|
|
38
|
+
/**
|
|
39
|
+
* `skrr daemon login` is the public wrapper for daemon-scope login. Explicit
|
|
40
|
+
* server, profile, and cwd make this remedy target the stopped daemon rather
|
|
41
|
+
* than whichever CLI profile or working directory happens to be current.
|
|
42
|
+
*/
|
|
43
|
+
export declare function daemonLoginRecoveryCommand(status: RuntimeStartStatus): string;
|
|
44
|
+
/**
|
|
45
|
+
* A runtime binary may predate a CLI update. Treat its successful process exit
|
|
46
|
+
* as an unverified supervisor request until `status --json` proves it either
|
|
47
|
+
* stayed alive or named the permanent re-auth latch it wrote.
|
|
48
|
+
*/
|
|
49
|
+
export declare function verifyRuntimeStart(statusOutput: string, statusExitCode: number, argv: readonly string[]): RuntimeStartVerification;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DAEMON_START_UNVERIFIED_EXIT = exports.DAEMON_START_REAUTH_EXIT = void 0;
|
|
4
|
+
exports.statusArgsForStart = statusArgsForStart;
|
|
5
|
+
exports.parseRuntimeStartStatus = parseRuntimeStartStatus;
|
|
6
|
+
exports.daemonLoginRecoveryCommand = daemonLoginRecoveryCommand;
|
|
7
|
+
exports.verifyRuntimeStart = verifyRuntimeStart;
|
|
8
|
+
const keychain_1 = require("./keychain");
|
|
9
|
+
/** Matches the runtime's EX_CONFIG result for a permanent local configuration failure. */
|
|
10
|
+
exports.DAEMON_START_REAUTH_EXIT = 78;
|
|
11
|
+
/** Matches the runtime's EX_TEMPFAIL result when a service cannot remain running. */
|
|
12
|
+
exports.DAEMON_START_UNVERIFIED_EXIT = 75;
|
|
13
|
+
function asRecord(value) {
|
|
14
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value)
|
|
15
|
+
? value
|
|
16
|
+
: null;
|
|
17
|
+
}
|
|
18
|
+
function asString(value) {
|
|
19
|
+
return typeof value === 'string' && value.length > 0 ? value : null;
|
|
20
|
+
}
|
|
21
|
+
function profileFromArgv(argv) {
|
|
22
|
+
return ((0, keychain_1.resolveProfileFromArgv)(argv) ??
|
|
23
|
+
process.env.OVERSKY_PROFILE ??
|
|
24
|
+
(0, keychain_1.getActiveProfile)() ??
|
|
25
|
+
keychain_1.DEFAULT_PROFILE);
|
|
26
|
+
}
|
|
27
|
+
function quoteShellArg(value) {
|
|
28
|
+
return /^[A-Za-z0-9_./:@+=-]+$/.test(value) ? value : `'${value.replaceAll("'", "'\\''")}'`;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The status probe must observe the same profile as the start request. A
|
|
32
|
+
* runtime's `--profile` flag is global, so it is deliberately returned after
|
|
33
|
+
* `status` here and normalized by execRuntimeBinary before spawning.
|
|
34
|
+
*/
|
|
35
|
+
function statusArgsForStart(argv) {
|
|
36
|
+
const requested = (0, keychain_1.resolveProfileFromArgv)(argv);
|
|
37
|
+
return requested ? ['status', '--json', '--profile', requested] : ['status', '--json'];
|
|
38
|
+
}
|
|
39
|
+
function parseRuntimeStartStatus(value, fallbackProfile) {
|
|
40
|
+
const root = asRecord(value);
|
|
41
|
+
if (!root)
|
|
42
|
+
return null;
|
|
43
|
+
const auth = asRecord(root.auth);
|
|
44
|
+
const reauth = asRecord(auth?.reauth);
|
|
45
|
+
const profile = asRecord(root.profile);
|
|
46
|
+
const liveDaemon = asRecord(root.liveDaemon);
|
|
47
|
+
const service = asRecord(root.service);
|
|
48
|
+
const runtime = asRecord(service?.runtime);
|
|
49
|
+
return {
|
|
50
|
+
profile: asString(profile?.name) ?? fallbackProfile,
|
|
51
|
+
serverUrl: asString(root.serverUrl),
|
|
52
|
+
cwd: asString(root.cwd),
|
|
53
|
+
reauth: {
|
|
54
|
+
needed: reauth?.needed === true,
|
|
55
|
+
reason: asString(reauth?.reason),
|
|
56
|
+
},
|
|
57
|
+
running: liveDaemon?.detected === true || runtime?.status === 'running',
|
|
58
|
+
runtimeStatus: asString(runtime?.status),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* `skrr daemon login` is the public wrapper for daemon-scope login. Explicit
|
|
63
|
+
* server, profile, and cwd make this remedy target the stopped daemon rather
|
|
64
|
+
* than whichever CLI profile or working directory happens to be current.
|
|
65
|
+
*/
|
|
66
|
+
function daemonLoginRecoveryCommand(status) {
|
|
67
|
+
const args = ['skrr', 'daemon', 'login', '--profile', quoteShellArg(status.profile)];
|
|
68
|
+
if (status.serverUrl)
|
|
69
|
+
args.push('--server', quoteShellArg(status.serverUrl));
|
|
70
|
+
if (status.cwd)
|
|
71
|
+
args.push('--cwd', quoteShellArg(status.cwd));
|
|
72
|
+
return args.join(' ');
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* A runtime binary may predate a CLI update. Treat its successful process exit
|
|
76
|
+
* as an unverified supervisor request until `status --json` proves it either
|
|
77
|
+
* stayed alive or named the permanent re-auth latch it wrote.
|
|
78
|
+
*/
|
|
79
|
+
function verifyRuntimeStart(statusOutput, statusExitCode, argv) {
|
|
80
|
+
const fallbackProfile = profileFromArgv(argv);
|
|
81
|
+
if (statusExitCode !== 0)
|
|
82
|
+
return { status: 'unreadable_status', profile: fallbackProfile };
|
|
83
|
+
let parsed;
|
|
84
|
+
try {
|
|
85
|
+
parsed = JSON.parse(statusOutput);
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return { status: 'unreadable_status', profile: fallbackProfile };
|
|
89
|
+
}
|
|
90
|
+
const status = parseRuntimeStartStatus(parsed, fallbackProfile);
|
|
91
|
+
if (!status)
|
|
92
|
+
return { status: 'unreadable_status', profile: fallbackProfile };
|
|
93
|
+
if (status.reauth.needed) {
|
|
94
|
+
return {
|
|
95
|
+
status: 'reauth_required',
|
|
96
|
+
profile: status.profile,
|
|
97
|
+
reason: status.reauth.reason,
|
|
98
|
+
recoveryCommand: daemonLoginRecoveryCommand(status),
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
if (status.running)
|
|
102
|
+
return { status: 'running' };
|
|
103
|
+
return {
|
|
104
|
+
status: 'not_running',
|
|
105
|
+
profile: status.profile,
|
|
106
|
+
runtimeStatus: status.runtimeStatus,
|
|
107
|
+
};
|
|
108
|
+
}
|
package/dist/lib/sky-code.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WL-2.2 — locate and forward to the local `sky-code` engine.
|
|
3
3
|
*
|
|
4
|
-
* The same `gh → git` shape `exec-
|
|
4
|
+
* The same `gh → git` shape `exec-runtime-binary.ts` uses, for the same reason: the
|
|
5
5
|
* Sky CLI is a REST client, the engine is a separately-built, separately-
|
|
6
6
|
* released binary with its own lifetime and failure model. Unifying them at
|
|
7
7
|
* the command surface (`skrr code`) gives users one thing to type without
|
package/dist/lib/sky-code.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* WL-2.2 — locate and forward to the local `sky-code` engine.
|
|
4
4
|
*
|
|
5
|
-
* The same `gh → git` shape `exec-
|
|
5
|
+
* The same `gh → git` shape `exec-runtime-binary.ts` uses, for the same reason: the
|
|
6
6
|
* Sky CLI is a REST client, the engine is a separately-built, separately-
|
|
7
7
|
* released binary with its own lifetime and failure model. Unifying them at
|
|
8
8
|
* the command surface (`skrr code`) gives users one thing to type without
|
|
@@ -46,12 +46,28 @@ export type TaskSnapshot = {
|
|
|
46
46
|
export type SpaceCapacity = {
|
|
47
47
|
object: 'space_task_capacity';
|
|
48
48
|
space: TaskRecord;
|
|
49
|
-
|
|
49
|
+
/**
|
|
50
|
+
* `null` means UNLIMITED, matching the orchestration payload. Declaring
|
|
51
|
+
* these `number` was not merely a type lie — it broke the CLI build, and
|
|
52
|
+
* before that it reached users as `Capacity: 0/null active`, because
|
|
53
|
+
* `autoExecuteMaxActiveTasks` defaults to `0` (= unlimited) and so the
|
|
54
|
+
* unlimited case is the COMMON path, not an edge case (OSK-7087).
|
|
55
|
+
*/
|
|
56
|
+
maxActiveTasks: number | null;
|
|
50
57
|
activeCount: number;
|
|
51
|
-
availableSlots: number;
|
|
58
|
+
availableSlots: number | null;
|
|
59
|
+
/** Live start-budget consumption, or `null` when no round is open. */
|
|
60
|
+
budget: SpaceCapacityBudget | null;
|
|
52
61
|
activeTasks: TaskRecord[];
|
|
53
62
|
sampledTaskCount: number;
|
|
54
63
|
};
|
|
64
|
+
export type SpaceCapacityBudget = {
|
|
65
|
+
generation: number;
|
|
66
|
+
maxStarts: number;
|
|
67
|
+
consumedStarts: number;
|
|
68
|
+
remaining: number | null;
|
|
69
|
+
unlimited: boolean;
|
|
70
|
+
};
|
|
55
71
|
export declare function statusOf(task: TaskRecord | null | undefined): string;
|
|
56
72
|
export declare function isTerminalTask(task: TaskRecord): boolean;
|
|
57
73
|
/**
|
|
@@ -79,10 +79,15 @@ function satisfiesWaitTarget(task, until) {
|
|
|
79
79
|
return until === 'terminal' ? exports.TERMINAL_STATUSES.has(status) : status === until;
|
|
80
80
|
}
|
|
81
81
|
function isActiveTask(task) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
if (isTerminalTask(task))
|
|
83
|
+
return false;
|
|
84
|
+
const reasonCode = task.actionability?.reasonCode;
|
|
85
|
+
if (typeof reasonCode === 'string')
|
|
86
|
+
return reasonCode === 'execution_running';
|
|
87
|
+
// Compatibility for older servers that do not attach actionability. A
|
|
88
|
+
// workflow status or leftover session is not compute ownership; only the
|
|
89
|
+
// checkout is a conservative fallback.
|
|
90
|
+
return isNonEmptyString(task.checkoutRunId);
|
|
86
91
|
}
|
|
87
92
|
function isRecoveredExecutionTask(task) {
|
|
88
93
|
if (!isStartableTask(task))
|
|
@@ -178,19 +183,25 @@ async function fetchSpaceTasks(spaceId, limit = 500) {
|
|
|
178
183
|
return items;
|
|
179
184
|
}
|
|
180
185
|
async function getSpaceCapacity(spaceId, limit = 1000) {
|
|
181
|
-
const [space, tasks] = await Promise.all([
|
|
186
|
+
const [space, tasks, preview] = await Promise.all([
|
|
182
187
|
data_provider_1.dataService.getSpace(spaceId),
|
|
183
188
|
fetchSpaceTasks(spaceId, limit),
|
|
189
|
+
data_provider_1.dataService.previewSpaceAutoExecutor(spaceId),
|
|
184
190
|
]);
|
|
185
191
|
const activeTasks = tasks.filter(isActiveTask);
|
|
186
|
-
const
|
|
187
|
-
|
|
192
|
+
const canonicalCapacity = preview?.plan?.capacity;
|
|
193
|
+
if (!canonicalCapacity) {
|
|
194
|
+
throw new Error('Space auto-executor preview did not return canonical capacity');
|
|
195
|
+
}
|
|
196
|
+
const maxActiveTasks = canonicalCapacity.maxActiveTasks;
|
|
197
|
+
const activeCount = canonicalCapacity.activeCount;
|
|
188
198
|
return {
|
|
189
199
|
object: 'space_task_capacity',
|
|
190
200
|
space,
|
|
191
201
|
maxActiveTasks,
|
|
192
202
|
activeCount,
|
|
193
|
-
availableSlots:
|
|
203
|
+
availableSlots: canonicalCapacity.availableSlots,
|
|
204
|
+
budget: canonicalCapacity.budget ?? null,
|
|
194
205
|
activeTasks,
|
|
195
206
|
sampledTaskCount: tasks.length,
|
|
196
207
|
};
|
|
@@ -314,9 +325,3 @@ function stringValue(value) {
|
|
|
314
325
|
function isNonEmptyString(value) {
|
|
315
326
|
return typeof value === 'string' && value.trim().length > 0;
|
|
316
327
|
}
|
|
317
|
-
function normalizePositiveInt(value, fallback) {
|
|
318
|
-
const n = Number(value);
|
|
319
|
-
if (!Number.isFinite(n) || n <= 0)
|
|
320
|
-
return fallback;
|
|
321
|
-
return Math.floor(n);
|
|
322
|
-
}
|
package/dist/lib/tasks.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ParsedDeliverableCoordinate, ParsedExpectationSpec } from '@skrr-ai/data-provider';
|
|
1
2
|
export declare const TASK_PRIORITIES: readonly ["low", "medium", "high", "critical"];
|
|
2
3
|
/**
|
|
3
4
|
* The kinds `tasks events append --kind` will accept.
|
|
@@ -50,6 +51,14 @@ export type TaskCreateFlagValues = {
|
|
|
50
51
|
'assignee-agent'?: string[];
|
|
51
52
|
'assignee-user'?: string[];
|
|
52
53
|
'execution-mode'?: string;
|
|
54
|
+
expectations?: Array<{
|
|
55
|
+
shape?: string;
|
|
56
|
+
kind?: string;
|
|
57
|
+
format?: string;
|
|
58
|
+
target?: string;
|
|
59
|
+
description?: string;
|
|
60
|
+
presetKey?: string;
|
|
61
|
+
}>;
|
|
53
62
|
'start-date'?: string;
|
|
54
63
|
'due-date'?: string;
|
|
55
64
|
estimate?: number;
|
|
@@ -62,6 +71,47 @@ export type TaskCreateFlagValues = {
|
|
|
62
71
|
* true ⇒ 'ephemeral', false ⇒ 'shared', undefined ⇒ undefined (inherit/leave).
|
|
63
72
|
*/
|
|
64
73
|
export declare function executionIsolationFromWorktreeFlag(worktree: boolean | undefined): 'shared' | 'ephemeral' | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* Parse an expectation spec.
|
|
76
|
+
*
|
|
77
|
+
* DELEGATES to `@skrr-ai/data-provider`, which owns the grammar and is read by
|
|
78
|
+
* the API and the web client too. The copy this replaces validated correctly
|
|
79
|
+
* and then described a syntax it refused — its messages named three different
|
|
80
|
+
* flags (`--requires`, `--output`, `--accept`) and used `git_ref:origin/main`
|
|
81
|
+
* as the example, a value the same function rejects. For an agent the refusal
|
|
82
|
+
* IS the documentation: it hits the error and corrects, so an error naming a
|
|
83
|
+
* rejected example costs a whole turn and can loop.
|
|
84
|
+
*/
|
|
85
|
+
export declare function parseExpectation(spec: string): {
|
|
86
|
+
ok: true;
|
|
87
|
+
value: ParsedExpectationSpec;
|
|
88
|
+
} | {
|
|
89
|
+
ok: false;
|
|
90
|
+
error: string;
|
|
91
|
+
};
|
|
92
|
+
/** Parse several, failing on the first that cannot be read. */
|
|
93
|
+
export declare function parseExpectations(specs: string[] | undefined): {
|
|
94
|
+
ok: true;
|
|
95
|
+
value: ParsedExpectationSpec[];
|
|
96
|
+
} | {
|
|
97
|
+
ok: false;
|
|
98
|
+
error: string;
|
|
99
|
+
};
|
|
100
|
+
export declare const EXPECT_FLAG_HELP: string;
|
|
101
|
+
/**
|
|
102
|
+
* Parse a deliverable coordinate. Also delegated — `:` and `@` and now `/` all
|
|
103
|
+
* mean different things, and a second implementation of that grammar is how the
|
|
104
|
+
* declaring side and the recording side stop agreeing.
|
|
105
|
+
*/
|
|
106
|
+
export declare function parseDeliverableCoordinate(spec: string): {
|
|
107
|
+
ok: true;
|
|
108
|
+
value: ParsedDeliverableCoordinate;
|
|
109
|
+
} | {
|
|
110
|
+
ok: false;
|
|
111
|
+
error: string;
|
|
112
|
+
};
|
|
113
|
+
/** Lifecycle values a caller may assert, for flag validation. */
|
|
114
|
+
export declare const DELIVERABLE_LIFECYCLE_VALUES: readonly ["local", "in_review", "durable", "blocked", "superseded"];
|
|
65
115
|
export declare function buildTaskCreatePayload(body: TaskRecord, flags?: TaskCreateFlagValues): TaskRecord;
|
|
66
116
|
/**
|
|
67
117
|
* The Agent this CLI process is running AS, if any.
|
package/dist/lib/tasks.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RECOGNIZED_TASK_VERDICTS = exports.TASK_WORK_EVENT_KINDS = exports.TASK_PRIORITIES = void 0;
|
|
3
|
+
exports.RECOGNIZED_TASK_VERDICTS = exports.DELIVERABLE_LIFECYCLE_VALUES = exports.EXPECT_FLAG_HELP = exports.TASK_WORK_EVENT_KINDS = exports.TASK_PRIORITIES = void 0;
|
|
4
4
|
exports.releasePinRepairGuard = releasePinRepairGuard;
|
|
5
5
|
exports.taskUpdateMutationGuard = taskUpdateMutationGuard;
|
|
6
6
|
exports.executionIsolationFromWorktreeFlag = executionIsolationFromWorktreeFlag;
|
|
7
|
+
exports.parseExpectation = parseExpectation;
|
|
8
|
+
exports.parseExpectations = parseExpectations;
|
|
9
|
+
exports.parseDeliverableCoordinate = parseDeliverableCoordinate;
|
|
7
10
|
exports.buildTaskCreatePayload = buildTaskCreatePayload;
|
|
8
11
|
exports.boundSessionAgentId = boundSessionAgentId;
|
|
9
12
|
exports.applyDaemonSessionDefaults = applyDaemonSessionDefaults;
|
|
@@ -106,6 +109,67 @@ function executionIsolationFromWorktreeFlag(worktree) {
|
|
|
106
109
|
return undefined;
|
|
107
110
|
return worktree ? 'ephemeral' : 'shared';
|
|
108
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Parse an expectation spec.
|
|
114
|
+
*
|
|
115
|
+
* DELEGATES to `@skrr-ai/data-provider`, which owns the grammar and is read by
|
|
116
|
+
* the API and the web client too. The copy this replaces validated correctly
|
|
117
|
+
* and then described a syntax it refused — its messages named three different
|
|
118
|
+
* flags (`--requires`, `--output`, `--accept`) and used `git_ref:origin/main`
|
|
119
|
+
* as the example, a value the same function rejects. For an agent the refusal
|
|
120
|
+
* IS the documentation: it hits the error and corrects, so an error naming a
|
|
121
|
+
* rejected example costs a whole turn and can loop.
|
|
122
|
+
*/
|
|
123
|
+
function parseExpectation(spec) {
|
|
124
|
+
return (0, data_provider_1.parseExpectationSpec)(spec);
|
|
125
|
+
}
|
|
126
|
+
/** Parse several, failing on the first that cannot be read. */
|
|
127
|
+
function parseExpectations(specs) {
|
|
128
|
+
if (!specs || specs.length === 0) {
|
|
129
|
+
return { ok: true, value: [] };
|
|
130
|
+
}
|
|
131
|
+
const out = [];
|
|
132
|
+
for (const spec of specs) {
|
|
133
|
+
const parsed = (0, data_provider_1.parseExpectationSpec)(spec);
|
|
134
|
+
if (!parsed.ok) {
|
|
135
|
+
return parsed;
|
|
136
|
+
}
|
|
137
|
+
out.push(parsed.value);
|
|
138
|
+
}
|
|
139
|
+
return { ok: true, value: out };
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* The one-line help every expectation flag shares, so they cannot disagree.
|
|
143
|
+
*
|
|
144
|
+
* The vocabulary is read from the owning package, but DEFENSIVELY: oclif
|
|
145
|
+
* evaluates a flag `description` when the command class body runs, i.e. at
|
|
146
|
+
* module load, and several suites mock `@skrr-ai/data-provider` with an
|
|
147
|
+
* explicit allow-list that predates these exports. Under such a mock the arrays
|
|
148
|
+
* are `undefined`, and a HELP STRING is never worth failing a module load for —
|
|
149
|
+
* the fallbacks below are a test-environment courtesy, never the vocabulary
|
|
150
|
+
* anything is validated against. `parseExpectationSpec` runs at call time
|
|
151
|
+
* against the real module and remains the only authority.
|
|
152
|
+
*/
|
|
153
|
+
const kindsForHelp = Array.isArray(data_provider_1.TASK_OUTCOME_KINDS)
|
|
154
|
+
? data_provider_1.TASK_OUTCOME_KINDS.join(', ')
|
|
155
|
+
: 'code, page, url, file, message, dataset';
|
|
156
|
+
const presetsForHelp = Array.isArray(data_provider_1.EXPECTATION_PRESETS)
|
|
157
|
+
? data_provider_1.EXPECTATION_PRESETS.map((preset) => `@${preset.key}`).join(', ')
|
|
158
|
+
: '@merged-to-main, @pdf-delivered';
|
|
159
|
+
exports.EXPECT_FLAG_HELP = 'What this task must produce, as <kind>[/<format>][:<target>] or @<preset> — ' +
|
|
160
|
+
`e.g. 'code:origin/main', 'file/pdf:Drive/Reports', '@merged-to-main'. ` +
|
|
161
|
+
`Kinds: ${kindsForHelp}. Presets: ${presetsForHelp}. ` +
|
|
162
|
+
'Anything else is stored as a plain-language expectation a person settles. Repeatable.';
|
|
163
|
+
/**
|
|
164
|
+
* Parse a deliverable coordinate. Also delegated — `:` and `@` and now `/` all
|
|
165
|
+
* mean different things, and a second implementation of that grammar is how the
|
|
166
|
+
* declaring side and the recording side stop agreeing.
|
|
167
|
+
*/
|
|
168
|
+
function parseDeliverableCoordinate(spec) {
|
|
169
|
+
return (0, data_provider_1.parseDeliverableCoordinate)(spec);
|
|
170
|
+
}
|
|
171
|
+
/** Lifecycle values a caller may assert, for flag validation. */
|
|
172
|
+
exports.DELIVERABLE_LIFECYCLE_VALUES = data_provider_1.DELIVERABLE_LIFECYCLES;
|
|
109
173
|
function buildTaskCreatePayload(body, flags = {}) {
|
|
110
174
|
const payload = (0, prompt_1.mergeDefined)(body, {
|
|
111
175
|
templateId: flags.template,
|
|
@@ -123,6 +187,7 @@ function buildTaskCreatePayload(body, flags = {}) {
|
|
|
123
187
|
assigneeAgentIds: flags['assignee-agent'],
|
|
124
188
|
assigneeUserIds: flags['assignee-user'],
|
|
125
189
|
executionMode: flags['execution-mode'],
|
|
190
|
+
expectations: flags.expectations,
|
|
126
191
|
startDate: flags['start-date'],
|
|
127
192
|
dueDate: flags['due-date'],
|
|
128
193
|
estimate: flags.estimate,
|
|
@@ -108,7 +108,7 @@ function renderUsageReference(reference, bin = 'skrr') {
|
|
|
108
108
|
];
|
|
109
109
|
for (const command of reference.data) {
|
|
110
110
|
const flags = command.keyFlags.length > 0 ? ` Flags: ${command.keyFlags.join(', ')}.` : '';
|
|
111
|
-
lines.push(
|
|
111
|
+
lines.push(`${bin} ${command.command} — ${command.description}.${flags} Example: ${command.example}`);
|
|
112
112
|
}
|
|
113
113
|
if (reference.nextPage)
|
|
114
114
|
lines.push(`Next: ${bin} usage ${reference.domain} --page ${reference.nextPage}`);
|
package/dist/lib/web-url.d.ts
CHANGED
|
@@ -69,6 +69,10 @@ export type WebUrlRef = {
|
|
|
69
69
|
} | {
|
|
70
70
|
kind: 'groupChat';
|
|
71
71
|
groupChatId: string;
|
|
72
|
+
} | {
|
|
73
|
+
kind: 'wikiPage';
|
|
74
|
+
spaceId: string;
|
|
75
|
+
pageId: string;
|
|
72
76
|
};
|
|
73
77
|
/**
|
|
74
78
|
* Site-relative canonical path for an entity, or `null` when the required id is
|
|
@@ -146,6 +150,18 @@ export declare function projectUrlFrom(baseURL: string, project: EntityRecord):
|
|
|
146
150
|
export declare function withProjectUrl<T extends EntityRecord>(baseURL: string, project: T): T & {
|
|
147
151
|
url: string | null;
|
|
148
152
|
};
|
|
153
|
+
/**
|
|
154
|
+
* Build a wiki-page URL from a raw server page record.
|
|
155
|
+
*
|
|
156
|
+
* The server returns `pageId`, never `id`; the fallback reads exist so a
|
|
157
|
+
* caller that has already normalized the record still gets a link back
|
|
158
|
+
* instead of null.
|
|
159
|
+
*/
|
|
160
|
+
export declare function wikiPageUrlFrom(baseURL: string, page: EntityRecord): string | null;
|
|
161
|
+
/** Return a shallow copy of a wiki-page record with a `url` field attached. */
|
|
162
|
+
export declare function withWikiPageUrl<T extends EntityRecord>(baseURL: string, page: T): T & {
|
|
163
|
+
url: string | null;
|
|
164
|
+
};
|
|
149
165
|
/** Return a shallow copy of a commitment record with a `url` field attached. */
|
|
150
166
|
export declare function withCommitmentUrl<T extends EntityRecord>(baseURL: string, commitment: T): T & {
|
|
151
167
|
url: string | null;
|
package/dist/lib/web-url.js
CHANGED
|
@@ -35,6 +35,8 @@ exports.withSpaceUrl = withSpaceUrl;
|
|
|
35
35
|
exports.withGoalUrl = withGoalUrl;
|
|
36
36
|
exports.projectUrlFrom = projectUrlFrom;
|
|
37
37
|
exports.withProjectUrl = withProjectUrl;
|
|
38
|
+
exports.wikiPageUrlFrom = wikiPageUrlFrom;
|
|
39
|
+
exports.withWikiPageUrl = withWikiPageUrl;
|
|
38
40
|
exports.withCommitmentUrl = withCommitmentUrl;
|
|
39
41
|
exports.withNorthstarUrl = withNorthstarUrl;
|
|
40
42
|
exports.withAgentUrl = withAgentUrl;
|
|
@@ -103,6 +105,11 @@ function webPath(ref) {
|
|
|
103
105
|
const projectId = encodeId(ref.projectId);
|
|
104
106
|
return projectId ? `/spaces/${spaceId}/projects/${projectId}` : `/spaces/${spaceId}/projects`;
|
|
105
107
|
}
|
|
108
|
+
case 'wikiPage': {
|
|
109
|
+
const spaceId = encodeId(ref.spaceId);
|
|
110
|
+
const pageId = encodeId(ref.pageId);
|
|
111
|
+
return spaceId && pageId ? `/spaces/${spaceId}/wiki?page=${pageId}` : null;
|
|
112
|
+
}
|
|
106
113
|
case 'workflow': {
|
|
107
114
|
const spaceId = encodeId(ref.spaceId);
|
|
108
115
|
if (!spaceId)
|
|
@@ -282,6 +289,24 @@ function projectUrlFrom(baseURL, project) {
|
|
|
282
289
|
function withProjectUrl(baseURL, project) {
|
|
283
290
|
return { ...project, url: projectUrlFrom(baseURL, project) };
|
|
284
291
|
}
|
|
292
|
+
/**
|
|
293
|
+
* Build a wiki-page URL from a raw server page record.
|
|
294
|
+
*
|
|
295
|
+
* The server returns `pageId`, never `id`; the fallback reads exist so a
|
|
296
|
+
* caller that has already normalized the record still gets a link back
|
|
297
|
+
* instead of null.
|
|
298
|
+
*/
|
|
299
|
+
function wikiPageUrlFrom(baseURL, page) {
|
|
300
|
+
const pageId = idOf(page, 'pageId', 'id', '_id');
|
|
301
|
+
const spaceId = idOf(page, 'spaceId');
|
|
302
|
+
if (!pageId || !spaceId)
|
|
303
|
+
return null;
|
|
304
|
+
return webUrl(baseURL, { kind: 'wikiPage', spaceId, pageId });
|
|
305
|
+
}
|
|
306
|
+
/** Return a shallow copy of a wiki-page record with a `url` field attached. */
|
|
307
|
+
function withWikiPageUrl(baseURL, page) {
|
|
308
|
+
return { ...page, url: wikiPageUrlFrom(baseURL, page) };
|
|
309
|
+
}
|
|
285
310
|
/** Return a shallow copy of a commitment record with a `url` field attached. */
|
|
286
311
|
function withCommitmentUrl(baseURL, commitment) {
|
|
287
312
|
return { ...commitment, url: commitmentUrlFrom(baseURL, commitment) };
|