@skrr-ai/cli 0.1.213 → 0.1.215
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/agents/relationship/clear.d.ts +12 -0
- package/dist/commands/agents/relationship/clear.js +26 -0
- package/dist/commands/agents/relationship/edit.d.ts +15 -0
- package/dist/commands/agents/relationship/edit.js +40 -0
- package/dist/commands/agents/relationship/show.d.ts +12 -0
- package/dist/commands/agents/relationship/show.js +35 -0
- package/dist/commands/tasks/ask.d.ts +3 -2
- package/dist/commands/tasks/ask.js +4 -3
- package/dist/commands/tasks/chat/exchange.d.ts +3 -2
- package/dist/commands/tasks/chat/exchange.js +18 -6
- package/dist/commands/tasks/chat/rotate.js +5 -2
- package/dist/commands/tasks/show.d.ts +6 -1
- package/dist/commands/tasks/show.js +19 -5
- package/dist/generated/agent-guides.json +20 -20
- package/dist/lib/inbound-messages.js +7 -0
- package/dist/lib/task-asset-upload.d.ts +7 -0
- package/dist/lib/task-asset-upload.js +114 -44
- package/dist/lib/task-operations.d.ts +16 -0
- package/dist/lib/task-operations.js +39 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/personAskWindow.d.ts +23 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/personAskWindow.js +28 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refresh.d.ts +16 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refresh.js +110 -15
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/runtime.d.ts +7 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/personAskWindow.d.ts +23 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/personAskWindow.js +23 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refresh.d.ts +16 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refresh.js +179 -17
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/runtime.d.ts +7 -2
- package/dist/node_modules/@skrr-ai/auth-core/package.json +10 -0
- package/dist/node_modules/@skrr-ai/data-provider/index.js +10767 -10760
- package/oclif.manifest.json +265 -7
- package/package.json +2 -2
|
@@ -62,7 +62,9 @@ exports.postFileToStorage = postFileToStorage;
|
|
|
62
62
|
* evidence reference that named the local hash would pin a version of the
|
|
63
63
|
* file that was never stored (OSK-10120). The local hash is computed only
|
|
64
64
|
* where the protocol needs it — declaring a direct upload, which storage then
|
|
65
|
-
* enforces — and never leaves this module as a claim about the asset.
|
|
65
|
+
* enforces — and never leaves this module as a claim about the asset. The
|
|
66
|
+
* name and MIME type it reports are the server's for the same reason: the
|
|
67
|
+
* server decides them from the bytes, not from the extension (OSK-33381).
|
|
66
68
|
*/
|
|
67
69
|
const fs = __importStar(require("node:fs"));
|
|
68
70
|
const http = __importStar(require("node:http"));
|
|
@@ -86,6 +88,9 @@ function storedDigest(asset) {
|
|
|
86
88
|
const value = asset.contentSha256;
|
|
87
89
|
return typeof value === 'string' && SHA256_HEX.test(value) ? value.toLowerCase() : undefined;
|
|
88
90
|
}
|
|
91
|
+
function storedText(value) {
|
|
92
|
+
return typeof value === 'string' && value.trim() ? value : undefined;
|
|
93
|
+
}
|
|
89
94
|
/**
|
|
90
95
|
* Read the Task an upload targets, through the same credential the upload
|
|
91
96
|
* will use. In a session the task comes from the claim, so the read is the
|
|
@@ -106,8 +111,10 @@ async function readTaskForUpload(taskId) {
|
|
|
106
111
|
async function uploadTaskAssetFile(opts) {
|
|
107
112
|
const { taskId, filePath, role, ledger } = opts;
|
|
108
113
|
if (opts.resumeAttachmentId !== undefined &&
|
|
109
|
-
(!opts.resumeAttachmentId ||
|
|
110
|
-
opts.resumeAttachmentId.
|
|
114
|
+
(!opts.resumeAttachmentId ||
|
|
115
|
+
opts.resumeAttachmentId.trim() !== opts.resumeAttachmentId ||
|
|
116
|
+
opts.resumeAttachmentId.length > 200 ||
|
|
117
|
+
ledger !== undefined)) {
|
|
111
118
|
throw new Error('Resume requires one exact attachment id and retains its original ledger declaration.');
|
|
112
119
|
}
|
|
113
120
|
if (!fs.existsSync(filePath)) {
|
|
@@ -132,8 +139,7 @@ async function uploadTaskAssetFile(opts) {
|
|
|
132
139
|
let result;
|
|
133
140
|
try {
|
|
134
141
|
if (opts.resumeAttachmentId !== undefined) {
|
|
135
|
-
result = await resumeDirectUpload({ taskId, filePath, size, filename, mimeType, role,
|
|
136
|
-
attachmentId: opts.resumeAttachmentId }, sessionTarget);
|
|
142
|
+
result = await resumeDirectUpload({ taskId, filePath, size, filename, mimeType, role, attachmentId: opts.resumeAttachmentId }, sessionTarget);
|
|
137
143
|
}
|
|
138
144
|
else if (sessionTarget) {
|
|
139
145
|
result = direct
|
|
@@ -154,8 +160,8 @@ async function uploadTaskAssetFile(opts) {
|
|
|
154
160
|
status: 'ready',
|
|
155
161
|
id: String(result.id ?? result._id),
|
|
156
162
|
digest: storedDigest(result),
|
|
157
|
-
filename,
|
|
158
|
-
mimeType,
|
|
163
|
+
filename: storedText(result.originalName) ?? filename,
|
|
164
|
+
mimeType: storedText(result.mimeType) ?? mimeType,
|
|
159
165
|
deduplicated: result.deduplicated === true,
|
|
160
166
|
...(result.resourceReceipt ? { resourceReceipt: result.resourceReceipt } : {}),
|
|
161
167
|
};
|
|
@@ -315,13 +321,19 @@ function directUploadProtocol(taskId, attachmentId, target) {
|
|
|
315
321
|
credential: target.credential,
|
|
316
322
|
}),
|
|
317
323
|
sign: (partNumbers) => (0, api_fetch_1.apiFetch)(`${uploadPath}/upload-parts/sign`, {
|
|
318
|
-
method: 'POST',
|
|
324
|
+
method: 'POST',
|
|
325
|
+
credential: target.credential,
|
|
326
|
+
body: { partNumbers },
|
|
319
327
|
}),
|
|
320
328
|
record: (part) => (0, api_fetch_1.apiFetch)(`${uploadPath}/upload-parts/complete`, {
|
|
321
|
-
method: 'POST',
|
|
329
|
+
method: 'POST',
|
|
330
|
+
credential: target.credential,
|
|
331
|
+
body: part,
|
|
322
332
|
}),
|
|
323
333
|
complete: () => (0, api_fetch_1.apiFetch)(`${target.path}/complete`, {
|
|
324
|
-
method: 'POST',
|
|
334
|
+
method: 'POST',
|
|
335
|
+
credential: target.credential,
|
|
336
|
+
body: { attachmentId },
|
|
325
337
|
}),
|
|
326
338
|
};
|
|
327
339
|
}
|
|
@@ -330,40 +342,59 @@ function taskAssetUploadRecovery(error) {
|
|
|
330
342
|
if (!error || typeof error !== 'object')
|
|
331
343
|
return undefined;
|
|
332
344
|
const value = error.uploadRecovery;
|
|
333
|
-
if (!value ||
|
|
345
|
+
if (!value ||
|
|
346
|
+
typeof value.taskId !== 'string' ||
|
|
347
|
+
typeof value.attachmentId !== 'string' ||
|
|
334
348
|
value.transport !== 'multipart')
|
|
335
349
|
return undefined;
|
|
336
|
-
return {
|
|
337
|
-
|
|
350
|
+
return {
|
|
351
|
+
taskId: value.taskId,
|
|
352
|
+
attachmentId: value.attachmentId,
|
|
353
|
+
transport: 'multipart',
|
|
354
|
+
...(typeof value.sessionId === 'string' ? { sessionId: value.sessionId } : {}),
|
|
355
|
+
};
|
|
338
356
|
}
|
|
339
357
|
function resumeHint(attachmentId) {
|
|
340
|
-
return `Upload attachment ${attachmentId} is not confirmed complete. ` +
|
|
341
|
-
`Use --resume-attachment ${attachmentId} with tasks attachments upload and the same file to recover this exact upload
|
|
358
|
+
return (`Upload attachment ${attachmentId} is not confirmed complete. ` +
|
|
359
|
+
`Use --resume-attachment ${attachmentId} with tasks attachments upload and the same file to recover this exact upload.`);
|
|
342
360
|
}
|
|
343
361
|
async function resumeDirectUpload(file, target) {
|
|
344
362
|
const taskId = target?.taskId ?? file.taskId;
|
|
345
363
|
const protocol = directUploadProtocol(taskId, file.attachmentId, target);
|
|
346
364
|
const progress = await protocol.status();
|
|
347
|
-
const rawDeclaration = progress
|
|
365
|
+
const rawDeclaration = progress
|
|
366
|
+
?.declaredAttachment;
|
|
348
367
|
const declaration = rawDeclaration && typeof rawDeclaration === 'object' && !Array.isArray(rawDeclaration)
|
|
349
|
-
? rawDeclaration
|
|
368
|
+
? rawDeclaration
|
|
369
|
+
: undefined;
|
|
350
370
|
const sha256 = await sha256OfFile(file.filePath);
|
|
351
|
-
if (!declaration ||
|
|
352
|
-
|
|
353
|
-
declaration.
|
|
354
|
-
declaration.
|
|
355
|
-
|
|
371
|
+
if (!declaration ||
|
|
372
|
+
file.size < 1 ||
|
|
373
|
+
declaration.basis !== 'declared_upload_intent' ||
|
|
374
|
+
declaration.attachmentId !== file.attachmentId ||
|
|
375
|
+
declaration.taskId !== taskId ||
|
|
376
|
+
declaration.filename !== file.filename ||
|
|
377
|
+
declaration.mimeType !== file.mimeType ||
|
|
378
|
+
declaration.sizeBytes !== file.size ||
|
|
379
|
+
declaration.sha256 !== sha256 ||
|
|
380
|
+
typeof declaration.role !== 'string' ||
|
|
381
|
+
!['input', 'evidence', 'deliverable'].includes(declaration.role) ||
|
|
356
382
|
(file.role !== undefined && declaration.role !== file.role)) {
|
|
357
383
|
throw new Error('This file does not match the existing upload declaration, or the server cannot verify it. No replacement upload was created.');
|
|
358
384
|
}
|
|
359
|
-
if (progress.transport !== 'multipart' ||
|
|
385
|
+
if (progress.transport !== 'multipart' ||
|
|
386
|
+
typeof progress.expiresAt !== 'string' ||
|
|
360
387
|
!Number.isFinite(Date.parse(progress.expiresAt)) ||
|
|
361
388
|
Date.parse(progress.expiresAt) <= Date.now()) {
|
|
362
389
|
throw new Error('Only an unexpired multipart upload can be resumed. No replacement upload was created.');
|
|
363
390
|
}
|
|
364
391
|
const intent = {
|
|
365
|
-
attachment: { id: file.attachmentId, status: 'pending' },
|
|
366
|
-
|
|
392
|
+
attachment: { id: file.attachmentId, status: 'pending' },
|
|
393
|
+
uploadUrl: null,
|
|
394
|
+
uploadFields: null,
|
|
395
|
+
uploadTransport: 'multipart',
|
|
396
|
+
partSize: progress.partSize,
|
|
397
|
+
partCount: progress.expectedParts,
|
|
367
398
|
};
|
|
368
399
|
// Even a ready session goes through canonical completion to recover its
|
|
369
400
|
// verified attachment and original ledger receipt, never its declaration.
|
|
@@ -382,7 +413,8 @@ async function uploadDirectIntent(file, intent, protocol) {
|
|
|
382
413
|
if (intent.attachment.status === 'ready')
|
|
383
414
|
return intent.attachment;
|
|
384
415
|
if ((intent.attachment.status !== undefined && intent.attachment.status !== 'pending') ||
|
|
385
|
-
(intent.uploadTransport !== undefined &&
|
|
416
|
+
(intent.uploadTransport !== undefined &&
|
|
417
|
+
!['single', 'multipart'].includes(intent.uploadTransport))) {
|
|
386
418
|
throw new Error('The server returned an unusable Task attachment upload intent.');
|
|
387
419
|
}
|
|
388
420
|
try {
|
|
@@ -393,7 +425,11 @@ async function uploadDirectIntent(file, intent, protocol) {
|
|
|
393
425
|
if (!intent.uploadUrl || !intent.uploadFields) {
|
|
394
426
|
throw new Error('The pending Task attachment has no usable storage grant; it was not uploaded.');
|
|
395
427
|
}
|
|
396
|
-
await postFileToStorage({
|
|
428
|
+
await postFileToStorage({
|
|
429
|
+
...file,
|
|
430
|
+
uploadUrl: intent.uploadUrl,
|
|
431
|
+
uploadFields: intent.uploadFields,
|
|
432
|
+
});
|
|
397
433
|
}
|
|
398
434
|
const completed = await protocol.complete();
|
|
399
435
|
requireReadyAsset(completed);
|
|
@@ -423,19 +459,35 @@ async function uploadMultipartFile(file, intent, protocol) {
|
|
|
423
459
|
const lengthOf = (partNumber) => Math.min(partSize, file.size - (partNumber - 1) * partSize);
|
|
424
460
|
let sessionId;
|
|
425
461
|
const inspect = (progress) => {
|
|
426
|
-
if (!progress ||
|
|
427
|
-
|
|
428
|
-
progress.
|
|
429
|
-
progress.
|
|
430
|
-
|
|
462
|
+
if (!progress ||
|
|
463
|
+
typeof progress.sessionId !== 'string' ||
|
|
464
|
+
!progress.sessionId ||
|
|
465
|
+
(sessionId && progress.sessionId !== sessionId) ||
|
|
466
|
+
progress.transport !== 'multipart' ||
|
|
467
|
+
progress.partSize !== partSize ||
|
|
468
|
+
progress.expectedSize !== file.size ||
|
|
469
|
+
progress.expectedParts !== partCount ||
|
|
470
|
+
!Array.isArray(progress.receivedParts) ||
|
|
471
|
+
![
|
|
472
|
+
'created',
|
|
473
|
+
'receiving',
|
|
474
|
+
'landed',
|
|
475
|
+
'verified',
|
|
476
|
+
'scanning',
|
|
477
|
+
'canonicalizing',
|
|
478
|
+
'ready',
|
|
479
|
+
].includes(progress.state)) {
|
|
431
480
|
throw new Error('The server returned inconsistent multipart upload progress.');
|
|
432
481
|
}
|
|
433
482
|
sessionId = progress.sessionId;
|
|
434
483
|
const received = new Set();
|
|
435
484
|
let bytes = 0;
|
|
436
485
|
for (const part of progress.receivedParts) {
|
|
437
|
-
if (!Number.isInteger(part.partNumber) ||
|
|
438
|
-
|
|
486
|
+
if (!Number.isInteger(part.partNumber) ||
|
|
487
|
+
part.partNumber < 1 ||
|
|
488
|
+
part.partNumber > partCount ||
|
|
489
|
+
received.has(part.partNumber) ||
|
|
490
|
+
part.byteLength !== lengthOf(part.partNumber)) {
|
|
439
491
|
throw new Error('The server returned an invalid multipart part receipt.');
|
|
440
492
|
}
|
|
441
493
|
received.add(part.partNumber);
|
|
@@ -457,13 +509,18 @@ async function uploadMultipartFile(file, intent, protocol) {
|
|
|
457
509
|
}
|
|
458
510
|
const signed = await protocol.sign([partNumber]);
|
|
459
511
|
inspect(signed?.progress);
|
|
460
|
-
if (signed.sessionId !== sessionId ||
|
|
461
|
-
|
|
512
|
+
if (signed.sessionId !== sessionId ||
|
|
513
|
+
!Array.isArray(signed.parts) ||
|
|
514
|
+
signed.parts.length !== 1 ||
|
|
515
|
+
signed.parts[0].partNumber !== partNumber ||
|
|
516
|
+
typeof signed.parts[0].url !== 'string') {
|
|
462
517
|
throw new Error('The server did not grant the requested multipart part.');
|
|
463
518
|
}
|
|
464
519
|
const receipt = await putFilePartToStorage({
|
|
465
|
-
uploadUrl: signed.parts[0].url,
|
|
466
|
-
|
|
520
|
+
uploadUrl: signed.parts[0].url,
|
|
521
|
+
filePath: file.filePath,
|
|
522
|
+
offset: (partNumber - 1) * partSize,
|
|
523
|
+
byteLength: lengthOf(partNumber),
|
|
467
524
|
});
|
|
468
525
|
const recorded = await protocol.record({ partNumber, ...receipt });
|
|
469
526
|
const landed = inspect(recorded?.progress);
|
|
@@ -473,7 +530,8 @@ async function uploadMultipartFile(file, intent, protocol) {
|
|
|
473
530
|
progress = recorded.progress;
|
|
474
531
|
}
|
|
475
532
|
const final = await protocol.status();
|
|
476
|
-
if (inspect(final).size !== partCount ||
|
|
533
|
+
if (inspect(final).size !== partCount ||
|
|
534
|
+
final.uploadedBytes !== file.size ||
|
|
477
535
|
fs.statSync(file.filePath).size !== file.size) {
|
|
478
536
|
throw new Error('The multipart upload is incomplete or the file changed during upload.');
|
|
479
537
|
}
|
|
@@ -488,7 +546,10 @@ async function putFilePartToStorage(p) {
|
|
|
488
546
|
let sent = 0;
|
|
489
547
|
let ended = false;
|
|
490
548
|
let etag;
|
|
491
|
-
const stream = fs.createReadStream(p.filePath, {
|
|
549
|
+
const stream = fs.createReadStream(p.filePath, {
|
|
550
|
+
start: p.offset,
|
|
551
|
+
end: p.offset + p.byteLength - 1,
|
|
552
|
+
});
|
|
492
553
|
const fail = (message) => {
|
|
493
554
|
if (settled)
|
|
494
555
|
return;
|
|
@@ -506,7 +567,8 @@ async function putFilePartToStorage(p) {
|
|
|
506
567
|
resolve({ etag, byteLength: sent });
|
|
507
568
|
};
|
|
508
569
|
const req = (url.protocol === 'http:' ? http : https).request(url, {
|
|
509
|
-
method: 'PUT',
|
|
570
|
+
method: 'PUT',
|
|
571
|
+
headers: { 'Content-Length': String(p.byteLength) },
|
|
510
572
|
}, (res) => {
|
|
511
573
|
const status = res.statusCode ?? 0;
|
|
512
574
|
const actualEtag = res.headers.etag;
|
|
@@ -517,14 +579,22 @@ async function putFilePartToStorage(p) {
|
|
|
517
579
|
}
|
|
518
580
|
res.on('error', () => fail('Storage multipart response failed.'));
|
|
519
581
|
res.on('aborted', () => fail('Storage multipart response was interrupted.'));
|
|
520
|
-
res.on('end', () => {
|
|
582
|
+
res.on('end', () => {
|
|
583
|
+
etag = actualEtag;
|
|
584
|
+
done();
|
|
585
|
+
});
|
|
521
586
|
res.resume();
|
|
522
587
|
});
|
|
523
588
|
req.on('error', () => fail('Storage multipart upload failed.'));
|
|
524
589
|
req.setTimeout(60000, () => fail('Storage multipart upload timed out.'));
|
|
525
|
-
stream.on('data', (chunk) => {
|
|
590
|
+
stream.on('data', (chunk) => {
|
|
591
|
+
sent += chunk.length;
|
|
592
|
+
});
|
|
526
593
|
stream.on('error', () => fail('The multipart file could not be read.'));
|
|
527
|
-
stream.on('end', () => {
|
|
594
|
+
stream.on('end', () => {
|
|
595
|
+
ended = true;
|
|
596
|
+
done();
|
|
597
|
+
});
|
|
528
598
|
stream.pipe(req);
|
|
529
599
|
});
|
|
530
600
|
}
|
|
@@ -30,6 +30,22 @@ type TaskActionContext = {
|
|
|
30
30
|
* `assignTaskRemedies`), so a renderer lists every entry, not only the first.
|
|
31
31
|
*/
|
|
32
32
|
export declare function taskActionRemedies(action: string, taskId: string, targetId: string | undefined, bin?: string, context?: TaskActionContext): TaskActionRemedy[];
|
|
33
|
+
/**
|
|
34
|
+
* The commands that settle a submitted Result waiting on a Review (`review_required`).
|
|
35
|
+
*
|
|
36
|
+
* The server offers `complete_task` and `request_changes` there, and neither maps through the
|
|
37
|
+
* table above. `request_changes` targets the Task, while `tasks review` needs the exact Result
|
|
38
|
+
* (`--result-id`), so the table leaves it unmapped; and `tasks complete` submits a NEW Result,
|
|
39
|
+
* where this one only needs closing. A caller that holds the Task passes its `currentResultId`,
|
|
40
|
+
* and gets the Review itself plus, when the server offers closing, the owner's close past it
|
|
41
|
+
* (OSK-33352).
|
|
42
|
+
*
|
|
43
|
+
* Accepting closes the Task. Its submitter cannot accept it (`TASK_REVIEW_SELF_ACCEPTANCE`), and a
|
|
44
|
+
* Task that requires the Review closes without one only for its owner, so each says who it is for.
|
|
45
|
+
*/
|
|
46
|
+
export declare function reviewDecisionRemedies(taskId: string, resultId: string | undefined, bin?: string, options?: {
|
|
47
|
+
closable?: boolean;
|
|
48
|
+
}): TaskActionRemedy[];
|
|
33
49
|
/** One row per remedy: the command, then what it does, with the notes lined up. */
|
|
34
50
|
export declare function taskActionRemedyRows(remedies: readonly TaskActionRemedy[]): string[];
|
|
35
51
|
/** The first command for an action. A renderer should list `taskActionRemedies` instead. */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.taskActionRemedies = taskActionRemedies;
|
|
4
|
+
exports.reviewDecisionRemedies = reviewDecisionRemedies;
|
|
4
5
|
exports.taskActionRemedyRows = taskActionRemedyRows;
|
|
5
6
|
exports.taskActionCommand = taskActionCommand;
|
|
6
7
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
@@ -52,6 +53,44 @@ function taskActionRemedies(action, taskId, targetId, bin = 'skrr', context = {}
|
|
|
52
53
|
};
|
|
53
54
|
return commands[action] ? [{ command: `${bin} ${commands[action]}` }] : [];
|
|
54
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* The commands that settle a submitted Result waiting on a Review (`review_required`).
|
|
58
|
+
*
|
|
59
|
+
* The server offers `complete_task` and `request_changes` there, and neither maps through the
|
|
60
|
+
* table above. `request_changes` targets the Task, while `tasks review` needs the exact Result
|
|
61
|
+
* (`--result-id`), so the table leaves it unmapped; and `tasks complete` submits a NEW Result,
|
|
62
|
+
* where this one only needs closing. A caller that holds the Task passes its `currentResultId`,
|
|
63
|
+
* and gets the Review itself plus, when the server offers closing, the owner's close past it
|
|
64
|
+
* (OSK-33352).
|
|
65
|
+
*
|
|
66
|
+
* Accepting closes the Task. Its submitter cannot accept it (`TASK_REVIEW_SELF_ACCEPTANCE`), and a
|
|
67
|
+
* Task that requires the Review closes without one only for its owner, so each says who it is for.
|
|
68
|
+
*/
|
|
69
|
+
function reviewDecisionRemedies(taskId, resultId, bin = 'skrr', options = {}) {
|
|
70
|
+
const task = (0, shell_quote_1.shellQuoteArg)(taskId);
|
|
71
|
+
const result = resultId ? (0, shell_quote_1.shellQuoteArg)(resultId) : '<result-id>';
|
|
72
|
+
const review = `${bin} tasks review ${task} --result-id ${result}`;
|
|
73
|
+
// `--rationale` is named in the note rather than the command: a quoted placeholder would make that
|
|
74
|
+
// command the widest by far, and the aligned notes would pad every other row out to it.
|
|
75
|
+
return [
|
|
76
|
+
{
|
|
77
|
+
command: `${review} --decision accepted`,
|
|
78
|
+
what: 'accept it and close the Task (not its submitter)',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
command: `${review} --decision changes_requested`,
|
|
82
|
+
what: 'request changes (say what with --rationale)',
|
|
83
|
+
},
|
|
84
|
+
...(options.closable
|
|
85
|
+
? [
|
|
86
|
+
{
|
|
87
|
+
command: `${bin} tasks move ${task} --status done`,
|
|
88
|
+
what: 'its owner closes it without a Review',
|
|
89
|
+
},
|
|
90
|
+
]
|
|
91
|
+
: []),
|
|
92
|
+
];
|
|
93
|
+
}
|
|
55
94
|
/** One row per remedy: the command, then what it does, with the notes lined up. */
|
|
56
95
|
function taskActionRemedyRows(remedies) {
|
|
57
96
|
const width = Math.max(0, ...remedies.filter((r) => r.what).map((r) => r.command.length));
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How long an agent's question or approval waits for its person (OSK-33439).
|
|
3
|
+
*
|
|
4
|
+
* ONE number for every place an agent asks a person and waits: a cloud turn's
|
|
5
|
+
* approval and question (the API's `AgentWorker/permissionWindow.js`) and a
|
|
6
|
+
* session that runs natively on the person's machine (the daemon's permissions
|
|
7
|
+
* bridge, `DEFAULT_PERMISSION_TIMEOUT_MS`). Before this the daemon kept its own
|
|
8
|
+
* copy, five minutes, under a comment saying it matched the server. The server
|
|
9
|
+
* had moved to ten minutes on 2026-10-22, so the same person got ten minutes when
|
|
10
|
+
* the agent ran in the cloud and five when it ran on their machine, and nothing
|
|
11
|
+
* on screen said why.
|
|
12
|
+
*
|
|
13
|
+
* Why ten minutes (owner decision 2026-10-22): answers arrive in under a second
|
|
14
|
+
* when someone is there, so the window is for a person who stepped away, and an
|
|
15
|
+
* open ask keeps its turn's spend reserved for as long as it waits. A 72-hour
|
|
16
|
+
* window once left three abandoned cards holding $9.9 of a $10 balance
|
|
17
|
+
* (OSK-17926). Expiry is an answer the run finishes with, not an error.
|
|
18
|
+
*
|
|
19
|
+
* A harness whose own runtime gives up on an ask sooner keeps that shorter bound,
|
|
20
|
+
* because a card that outlives the wait behind it would take an answer nothing
|
|
21
|
+
* reads (the daemon's ACP permission authority, `acp-permission/authority.ts`).
|
|
22
|
+
*/
|
|
23
|
+
export declare const PERSON_ASK_WINDOW_MS: number;
|
|
@@ -0,0 +1,28 @@
|
|
|
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 personAskWindow_exports = {};
|
|
20
|
+
__export(personAskWindow_exports, {
|
|
21
|
+
PERSON_ASK_WINDOW_MS: () => PERSON_ASK_WINDOW_MS
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(personAskWindow_exports);
|
|
24
|
+
const PERSON_ASK_WINDOW_MS = 10 * 60 * 1e3;
|
|
25
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
26
|
+
0 && (module.exports = {
|
|
27
|
+
PERSON_ASK_WINDOW_MS
|
|
28
|
+
});
|
|
@@ -17,10 +17,21 @@ interface LockAcquireState {
|
|
|
17
17
|
mkdirCalls: number;
|
|
18
18
|
/** When it started, which is when its deadline started. */
|
|
19
19
|
startedAt: number;
|
|
20
|
+
/** Set once it took the lock and its holder began releasing it (OSK-33430). */
|
|
21
|
+
releasing: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Set when that release passed its bound with an `rmdir` or `utimes` still
|
|
24
|
+
* pending. Unlike `abandoned`, it refuses no call and replaces no answer
|
|
25
|
+
* (EABANDONED delivered to proper-lockfile's mtime-refresh `stat` callback
|
|
26
|
+
* throws in a timer; see `trackedLockFs`). It only keeps this release a
|
|
27
|
+
* blocker.
|
|
28
|
+
*/
|
|
29
|
+
releaseTimedOut: boolean;
|
|
20
30
|
}
|
|
21
31
|
export declare const __authLockTesting: {
|
|
22
32
|
acquireDeadlineMs: number;
|
|
23
33
|
asyncFsProbeMs: number;
|
|
34
|
+
releaseDeadlineMs: number;
|
|
24
35
|
/**
|
|
25
36
|
* The `fs` proper-lockfile uses: Node's own. Its default, graceful-fs 4.2,
|
|
26
37
|
* retries EMFILE only for open, readFile, writeFile, appendFile, copyFile and
|
|
@@ -129,13 +140,16 @@ export declare function installLockExitHandlers(options?: LockExitHandlerOptions
|
|
|
129
140
|
* Acquire the cross-process auth lock, run the body, release on `finally`.
|
|
130
141
|
* Throws ELOCKED once proper-lockfile's retries are spent (about 19 s), and a
|
|
131
142
|
* `TransientAuthFailure` if the acquire is still pending at
|
|
132
|
-
* `LOCK_ACQUIRE_DEADLINE_MS` (OSK-33422).
|
|
143
|
+
* `LOCK_ACQUIRE_DEADLINE_MS` (OSK-33422). Returns the body's result once the
|
|
144
|
+
* release has answered or waited `LOCK_RELEASE_DEADLINE_MS` (OSK-33430).
|
|
133
145
|
*
|
|
134
146
|
* We lock a sentinel file (auth.lock) that we create/touch if missing —
|
|
135
147
|
* locking the real auth.json would race with atomic-rename writes.
|
|
136
148
|
*
|
|
137
149
|
* @param daemonId When supplied, lock-lifecycle telemetry events are emitted:
|
|
138
|
-
* refresh_lock_acquiring, refresh_lock_acquired, refresh_lock_released
|
|
150
|
+
* refresh_lock_acquiring, refresh_lock_acquired, then refresh_lock_released
|
|
151
|
+
* once the release answers, or refresh_lock_release_timeout when it does not
|
|
152
|
+
* answer in time.
|
|
139
153
|
*/
|
|
140
154
|
export declare function withAuthLock<T>(body: () => Promise<T>, daemonId?: string): Promise<T>;
|
|
141
155
|
/**
|