@skrr-ai/cli 0.1.197 → 0.1.199
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/tasks/result/submit.d.ts +1 -0
- package/dist/commands/tasks/result/submit.js +2 -0
- package/dist/commands/tasks/start-receipt.js +5 -0
- package/dist/commands/tasks/start.js +40 -1
- package/dist/lib/task-work.js +5 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/dutyExecutionContract.d.ts +8 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/dutyExecutionContract.js +11 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/dutyExecutionContract.d.ts +8 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/dutyExecutionContract.js +16 -0
- package/dist/node_modules/@skrr-ai/data-provider/index.js +10171 -10164
- package/oclif.manifest.json +8 -2
- package/package.json +3 -3
|
@@ -9,6 +9,7 @@ export default class TasksResultSubmit extends BaseCommand {
|
|
|
9
9
|
static flags: {
|
|
10
10
|
task: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
11
|
summary: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
'request-completion': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
13
|
body: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
14
|
'conclusion-type': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
15
|
'conclusion-json': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -33,6 +33,7 @@ class TasksResultSubmit extends base_command_1.BaseCommand {
|
|
|
33
33
|
static flags = {
|
|
34
34
|
task: core_1.Flags.string({ description: 'Task id; overrides runtime context' }),
|
|
35
35
|
summary: core_1.Flags.string({ required: true, description: 'The answer in one readable paragraph' }),
|
|
36
|
+
'request-completion': core_1.Flags.boolean({ description: 'Request workflow completion after the active Task Run ends' }),
|
|
36
37
|
body: core_1.Flags.string({ description: 'Long-form Result body' }),
|
|
37
38
|
'conclusion-type': core_1.Flags.string({ description: 'Domain conclusion type' }),
|
|
38
39
|
'conclusion-json': core_1.Flags.string({ description: 'JSON value for the domain conclusion' }),
|
|
@@ -129,6 +130,7 @@ class TasksResultSubmit extends base_command_1.BaseCommand {
|
|
|
129
130
|
}
|
|
130
131
|
const payload = {
|
|
131
132
|
summary: flags.summary,
|
|
133
|
+
...(flags['request-completion'] ? { completionIntent: 'request_completion' } : {}),
|
|
132
134
|
body: flags.body,
|
|
133
135
|
expectedSpecVersion: flags['spec-version'],
|
|
134
136
|
runId: flags['run-id'],
|
|
@@ -67,6 +67,11 @@ class TasksStartReceipt extends base_command_1.BaseCommand {
|
|
|
67
67
|
this.log(`Start request ${receipt.requestId} has an accepted server response.`);
|
|
68
68
|
if (receipt.responseStatus !== undefined)
|
|
69
69
|
this.log(`Response status: ${receipt.responseStatus}`);
|
|
70
|
+
if (receipt.input) {
|
|
71
|
+
this.log(`Task input: ${receipt.input.commandId} (${receipt.input.phase})`);
|
|
72
|
+
if (receipt.input.exchangeId)
|
|
73
|
+
this.log(`Exchange: ${receipt.input.exchangeId}`);
|
|
74
|
+
}
|
|
70
75
|
if (receipt.run?.runId)
|
|
71
76
|
this.log(`Run: ${receipt.run.runId}`);
|
|
72
77
|
if (receipt.run?.autonomousRunId)
|
|
@@ -10,9 +10,10 @@ const base_command_1 = require("../../base-command");
|
|
|
10
10
|
const task_resolver_1 = require("../../lib/task-resolver");
|
|
11
11
|
const git_task_1 = require("../../lib/git-task");
|
|
12
12
|
const task_admission_1 = require("../../lib/task-admission");
|
|
13
|
+
const http_error_1 = require("../../lib/http-error");
|
|
13
14
|
const TASK_START_REQUEST_ID_PATTERN = /^[A-Za-z0-9._:/-]{1,200}$/;
|
|
14
15
|
class TasksStart extends base_command_1.BaseCommand {
|
|
15
|
-
static description = '
|
|
16
|
+
static description = 'Request execution of a Task by its assigned Agent. ' +
|
|
16
17
|
'Alias: tasks execute';
|
|
17
18
|
// `tasks execute` is the verb a first-time user reaches for, and it was
|
|
18
19
|
// "not a command" (OSK-12128). One command, two names.
|
|
@@ -150,6 +151,44 @@ class TasksStart extends base_command_1.BaseCommand {
|
|
|
150
151
|
}
|
|
151
152
|
let result;
|
|
152
153
|
try {
|
|
154
|
+
// Check capability before any mutation. Skill and capability overrides
|
|
155
|
+
// still use the existing endpoint that can honor them.
|
|
156
|
+
if (!flags.skill && !flags.capability?.length) {
|
|
157
|
+
const chat = await data_provider_1.dataService.getTaskChat(taskId).catch((error) => {
|
|
158
|
+
if ([404, 405].includes((0, http_error_1.httpStatusOf)(error) ?? 0))
|
|
159
|
+
return null;
|
|
160
|
+
throw error;
|
|
161
|
+
});
|
|
162
|
+
if (chat?.startInput && chat.authorizationGeneration != null) {
|
|
163
|
+
const prior = flags['request-id']
|
|
164
|
+
? await data_provider_1.dataService.getTaskStartReceipt(taskId, requestId)
|
|
165
|
+
: null;
|
|
166
|
+
if (prior && prior.state !== 'unknown') {
|
|
167
|
+
if (flags.json)
|
|
168
|
+
this.log(JSON.stringify(prior, null, 2));
|
|
169
|
+
else
|
|
170
|
+
this.log(`Start request ${requestId} is ${prior.state}. Inspect it with ${this.config.bin} tasks start-receipt ${taskId} --request-id ${requestId}.`);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
const input = await data_provider_1.dataService.submitTaskConversationInput(taskId, {
|
|
174
|
+
action: 'start', commandKey: requestId,
|
|
175
|
+
expectedWorkflowGeneration: chat.workflowGeneration,
|
|
176
|
+
expectedAuthorizationGeneration: chat.authorizationGeneration,
|
|
177
|
+
expectedSpecVersion: chat.startInput.specVersion,
|
|
178
|
+
});
|
|
179
|
+
if (flags.json) {
|
|
180
|
+
this.log(JSON.stringify({ taskId, requestId, input, ...(branch ? { branch } : {}) }, null, 2));
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
if (branch)
|
|
184
|
+
this.log(`${branch.created ? 'Created' : 'Checked out'} branch: ${branch.branch}`);
|
|
185
|
+
this.log(`Task ${taskId} start input: ${input.phase}.`);
|
|
186
|
+
this.log(`Start request: ${requestId}`);
|
|
187
|
+
this.log(`Inspect execution: ${this.config.bin} tasks execution-state ${taskId}`);
|
|
188
|
+
}
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
153
192
|
result = await data_provider_1.dataService.startTask(taskId, {
|
|
154
193
|
...(flags.skill ? { skillId: flags.skill } : {}),
|
|
155
194
|
...(flags.capability?.length ? { requestedCapabilities: flags.capability } : {}),
|
package/dist/lib/task-work.js
CHANGED
|
@@ -29,9 +29,11 @@ function describeExecutionState(state) {
|
|
|
29
29
|
const resources = state.resources
|
|
30
30
|
? [
|
|
31
31
|
`Execution resources: ${state.resources.state}; ${state.resources.reason}`,
|
|
32
|
-
...state.resources.items.map((resource) =>
|
|
33
|
-
?
|
|
34
|
-
:
|
|
32
|
+
...state.resources.items.map((resource) => resource.kind === 'task_checkout' && resource.reason === 'native_stop_receipt'
|
|
33
|
+
? 'Checkout locked: waiting for the daemon to confirm the previous execution stopped.'
|
|
34
|
+
: `Resource: ${resource.kind} ${resource.state}; ${resource.reason}${resource.attempt
|
|
35
|
+
? `; attempt ${resource.attempt.kind}:${resource.attempt.runId}:${resource.attempt.attempt}:${resource.attempt.generation}`
|
|
36
|
+
: ''}; evidence ${resource.evidence?.source ?? 'unavailable'}${resource.evidence?.observedAt ? ` ${resource.evidence.observedAt}` : ''}${resource.requestedAt ? `; requested ${resource.requestedAt}` : ''}${resource.transportRequestedAt ? `; transport requested ${resource.transportRequestedAt}` : ''}${resource.acknowledgedAt ? `; acknowledged ${resource.acknowledgedAt}` : ''}${resource.releasedAt ? `; released ${resource.releasedAt}` : ''}${resource.unknownAt ? `; release unverifiable ${resource.unknownAt}` : ''}${resource.recoveryAttempts !== undefined ? `; recovery attempts ${resource.recoveryAttempts}` : ''}`),
|
|
35
37
|
]
|
|
36
38
|
: ['Execution resources: unavailable; this server did not return a resource projection'];
|
|
37
39
|
return [
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** Mode-free responsibility context. Tool permissions belong to the Agent runtime. */
|
|
2
2
|
export declare const DUTY_EXECUTION_CONTRACT_VERSION: 3;
|
|
3
3
|
export declare const DUTY_EXECUTION_CONTRACT_CAPABILITY = "duty_execution_contract_v3";
|
|
4
|
+
export declare const PLATFORM_DUTY_SCRATCH_CAPABILITY = "platform_duty_scratch_v1";
|
|
4
5
|
export interface DutyExecutionContract {
|
|
5
6
|
version: 3;
|
|
6
7
|
kind: 'duty' | 'task_delivery';
|
|
@@ -41,5 +42,12 @@ export interface DutyExecutionContract {
|
|
|
41
42
|
return: 'duty_result_v1' | 'task_output';
|
|
42
43
|
}
|
|
43
44
|
export declare function eventRepository(event: Record<string, unknown> | null | undefined): string;
|
|
45
|
+
/** The platform's relationship Duties use server evidence and need no checkout. */
|
|
46
|
+
export declare function usesPlatformDutyScratch(input: {
|
|
47
|
+
dutyId?: string;
|
|
48
|
+
delivery?: DutyExecutionContract['delivery'];
|
|
49
|
+
workspace?: DutyExecutionContract['workspace'];
|
|
50
|
+
event?: DutyExecutionContract['event'];
|
|
51
|
+
}): boolean;
|
|
44
52
|
/** One strict parser used at storage admission and at runtime admission. */
|
|
45
53
|
export declare function normalizeDutyExecutionContract(value: unknown): DutyExecutionContract | null;
|
|
@@ -20,8 +20,10 @@ var dutyExecutionContract_exports = {};
|
|
|
20
20
|
__export(dutyExecutionContract_exports, {
|
|
21
21
|
DUTY_EXECUTION_CONTRACT_CAPABILITY: () => DUTY_EXECUTION_CONTRACT_CAPABILITY,
|
|
22
22
|
DUTY_EXECUTION_CONTRACT_VERSION: () => DUTY_EXECUTION_CONTRACT_VERSION,
|
|
23
|
+
PLATFORM_DUTY_SCRATCH_CAPABILITY: () => PLATFORM_DUTY_SCRATCH_CAPABILITY,
|
|
23
24
|
eventRepository: () => eventRepository,
|
|
24
|
-
normalizeDutyExecutionContract: () => normalizeDutyExecutionContract
|
|
25
|
+
normalizeDutyExecutionContract: () => normalizeDutyExecutionContract,
|
|
26
|
+
usesPlatformDutyScratch: () => usesPlatformDutyScratch
|
|
25
27
|
});
|
|
26
28
|
module.exports = __toCommonJS(dutyExecutionContract_exports);
|
|
27
29
|
var import_node_util = require("node:util");
|
|
@@ -38,6 +40,7 @@ const VALID_DELIVERY_SOURCE_RE = /^[A-Za-z0-9][A-Za-z0-9_./-]{0,239}$/;
|
|
|
38
40
|
const VALID_DELIVERY_SOURCE_RE_2 = /^[a-f0-9]{40,64}$/i;
|
|
39
41
|
const DUTY_EXECUTION_CONTRACT_VERSION = 3;
|
|
40
42
|
const DUTY_EXECUTION_CONTRACT_CAPABILITY = "duty_execution_contract_v3";
|
|
43
|
+
const PLATFORM_DUTY_SCRATCH_CAPABILITY = "platform_duty_scratch_v1";
|
|
41
44
|
const DELIVERY_MODES = /* @__PURE__ */ new Set([
|
|
42
45
|
"report_only",
|
|
43
46
|
"local_patch",
|
|
@@ -401,6 +404,10 @@ function eventRepository(event) {
|
|
|
401
404
|
const value = event.repoFullName || repository?.full_name || repository?.fullName;
|
|
402
405
|
return VALID_DELIVERY_RE.test(String(value || "")) ? String(value).toLowerCase() : "";
|
|
403
406
|
}
|
|
407
|
+
function usesPlatformDutyScratch(input) {
|
|
408
|
+
const { dutyId, delivery, workspace, event } = input;
|
|
409
|
+
return typeof dutyId === "string" && /^obj_system_(conversation_continuity|relationship_pulse|duty_incubator|open_loop_closer)_[a-f0-9]{24}$/.test(dutyId) && delivery?.mode === "report_only" && !delivery.repo && !delivery.baseBranch && workspace?.kind === "ephemeral" && workspace.base === "agent_working_directory" && !workspace.fetchBase && !event?.repo && !event?.repository && !eventRepository(event);
|
|
410
|
+
}
|
|
404
411
|
function failedGitHubCheck(event) {
|
|
405
412
|
const eventType = String(event?.eventType || event?.type || "").toLowerCase();
|
|
406
413
|
return eventType === "github.check_run_failed" || eventType === "check_run_failed";
|
|
@@ -439,6 +446,8 @@ function normalizeDutyExecutionContract(value) {
|
|
|
439
446
|
0 && (module.exports = {
|
|
440
447
|
DUTY_EXECUTION_CONTRACT_CAPABILITY,
|
|
441
448
|
DUTY_EXECUTION_CONTRACT_VERSION,
|
|
449
|
+
PLATFORM_DUTY_SCRATCH_CAPABILITY,
|
|
442
450
|
eventRepository,
|
|
443
|
-
normalizeDutyExecutionContract
|
|
451
|
+
normalizeDutyExecutionContract,
|
|
452
|
+
usesPlatformDutyScratch
|
|
444
453
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** Mode-free responsibility context. Tool permissions belong to the Agent runtime. */
|
|
2
2
|
export declare const DUTY_EXECUTION_CONTRACT_VERSION: 3;
|
|
3
3
|
export declare const DUTY_EXECUTION_CONTRACT_CAPABILITY = "duty_execution_contract_v3";
|
|
4
|
+
export declare const PLATFORM_DUTY_SCRATCH_CAPABILITY = "platform_duty_scratch_v1";
|
|
4
5
|
export interface DutyExecutionContract {
|
|
5
6
|
version: 3;
|
|
6
7
|
kind: 'duty' | 'task_delivery';
|
|
@@ -41,5 +42,12 @@ export interface DutyExecutionContract {
|
|
|
41
42
|
return: 'duty_result_v1' | 'task_output';
|
|
42
43
|
}
|
|
43
44
|
export declare function eventRepository(event: Record<string, unknown> | null | undefined): string;
|
|
45
|
+
/** The platform's relationship Duties use server evidence and need no checkout. */
|
|
46
|
+
export declare function usesPlatformDutyScratch(input: {
|
|
47
|
+
dutyId?: string;
|
|
48
|
+
delivery?: DutyExecutionContract['delivery'];
|
|
49
|
+
workspace?: DutyExecutionContract['workspace'];
|
|
50
|
+
event?: DutyExecutionContract['event'];
|
|
51
|
+
}): boolean;
|
|
44
52
|
/** One strict parser used at storage admission and at runtime admission. */
|
|
45
53
|
export declare function normalizeDutyExecutionContract(value: unknown): DutyExecutionContract | null;
|
|
@@ -14,6 +14,7 @@ const VALID_DELIVERY_SOURCE_RE_2 = /^[a-f0-9]{40,64}$/i;
|
|
|
14
14
|
/** Mode-free responsibility context. Tool permissions belong to the Agent runtime. */
|
|
15
15
|
export const DUTY_EXECUTION_CONTRACT_VERSION = 3;
|
|
16
16
|
export const DUTY_EXECUTION_CONTRACT_CAPABILITY = 'duty_execution_contract_v3';
|
|
17
|
+
export const PLATFORM_DUTY_SCRATCH_CAPABILITY = 'platform_duty_scratch_v1';
|
|
17
18
|
const DELIVERY_MODES = new Set([
|
|
18
19
|
'report_only',
|
|
19
20
|
'local_patch',
|
|
@@ -476,6 +477,21 @@ export function eventRepository(event) {
|
|
|
476
477
|
const value = event.repoFullName || repository?.full_name || repository?.fullName;
|
|
477
478
|
return VALID_DELIVERY_RE.test(String(value || '')) ? String(value).toLowerCase() : '';
|
|
478
479
|
}
|
|
480
|
+
/** The platform's relationship Duties use server evidence and need no checkout. */
|
|
481
|
+
export function usesPlatformDutyScratch(input) {
|
|
482
|
+
const { dutyId, delivery, workspace, event } = input;
|
|
483
|
+
return (typeof dutyId === 'string' &&
|
|
484
|
+
/^obj_system_(conversation_continuity|relationship_pulse|duty_incubator|open_loop_closer)_[a-f0-9]{24}$/.test(dutyId) &&
|
|
485
|
+
delivery?.mode === 'report_only' &&
|
|
486
|
+
!delivery.repo &&
|
|
487
|
+
!delivery.baseBranch &&
|
|
488
|
+
workspace?.kind === 'ephemeral' &&
|
|
489
|
+
workspace.base === 'agent_working_directory' &&
|
|
490
|
+
!workspace.fetchBase &&
|
|
491
|
+
!event?.repo &&
|
|
492
|
+
!event?.repository &&
|
|
493
|
+
!eventRepository(event));
|
|
494
|
+
}
|
|
479
495
|
function failedGitHubCheck(event) {
|
|
480
496
|
const eventType = String(event?.eventType || event?.type || '').toLowerCase();
|
|
481
497
|
return eventType === 'github.check_run_failed' || eventType === 'check_run_failed';
|