@raidiant/notifai 1.1.0 → 2.0.1
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/CHANGELOG.md +41 -0
- package/dist/client.d.ts +5 -1
- package/dist/client.js +2 -0
- package/dist/client.js.map +1 -1
- package/dist/commands.d.ts +8 -1
- package/dist/commands.js +120 -15
- package/dist/commands.js.map +1 -1
- package/dist/hooks.d.ts +15 -1
- package/dist/hooks.js +182 -12
- package/dist/hooks.js.map +1 -1
- package/dist/logging.d.ts +1 -1
- package/dist/logging.js +4 -0
- package/dist/logging.js.map +1 -1
- package/dist/main.js +14 -3
- package/dist/main.js.map +1 -1
- package/package.json +11 -10
- package/src/client.test.ts +53 -0
- package/src/client.ts +24 -0
- package/src/commands.test.ts +252 -5
- package/src/commands.ts +158 -13
- package/src/hooks.test.ts +150 -2
- package/src/hooks.ts +240 -12
- package/src/logging.ts +4 -0
- package/src/main.ts +17 -2
- package/src/skill.test.ts +32 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,47 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
8
8
|
This project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
|
|
9
9
|
and [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).
|
|
10
10
|
|
|
11
|
+
## [2.0.1](https://github.com/Raidiant-io/notifai/compare/v2.0.0...v2.0.1) (2026-08-14)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* **cli:** require acknowledgement protocol at runtime ([bbec8ca](https://github.com/Raidiant-io/notifai/commit/bbec8ca386cd2a86c58a579daf70905d667865d5))
|
|
17
|
+
* **cli:** require acknowledgement protocol at runtime ([43f94cd](https://github.com/Raidiant-io/notifai/commit/43f94cde1a90b4ca4f5f0fce8356d4832c618216))
|
|
18
|
+
|
|
19
|
+
## [2.0.0](https://github.com/Raidiant-io/notifai/compare/v1.1.0...v2.0.0) (2026-08-13)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### ⚠ BREAKING CHANGES
|
|
23
|
+
|
|
24
|
+
* **cli:** hide the service URL, move personal prefs, and shorten setup closes
|
|
25
|
+
|
|
26
|
+
### Features
|
|
27
|
+
|
|
28
|
+
* **cli:** pack a bounded consented slice of the local log ([6fb3d68](https://github.com/Raidiant-io/notifai/commit/6fb3d68cd0057ab901c031c6012318fe464949a9))
|
|
29
|
+
* **cli:** send a test notification by kind, not by inventing a sound ([b90c8ed](https://github.com/Raidiant-io/notifai/commit/b90c8edcbf2ba98db09414701a309cef88aa1cc4))
|
|
30
|
+
* **cli:** support Windows and Linux harness workflows ([779ab6b](https://github.com/Raidiant-io/notifai/commit/779ab6b075900a7a431b809ddcb715fd80836688))
|
|
31
|
+
* compose native skills setup into init ([de6318a](https://github.com/Raidiant-io/notifai/commit/de6318a71166ef75774a217176f1e020116e177b))
|
|
32
|
+
* **skill:** make agents set Notifai up and skip sound/level unless overriding ([9ffd87c](https://github.com/Raidiant-io/notifai/commit/9ffd87c0c79e539f8b92e94ac453407d58bca30f))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Bug Fixes
|
|
36
|
+
|
|
37
|
+
* **cli:** cover Windows terminal behavior ([cda7abd](https://github.com/Raidiant-io/notifai/commit/cda7abd134744b2cac44204dd3eb1b20b9038edc))
|
|
38
|
+
* **cli:** drop unfinished import changes from the skill rewrite ([2fd49b2](https://github.com/Raidiant-io/notifai/commit/2fd49b2ba4d4f218138da5dbc3455f1ac07adaf6))
|
|
39
|
+
* **cli:** hide the service URL, move personal prefs, and shorten setup closes ([5b9fe52](https://github.com/Raidiant-io/notifai/commit/5b9fe52d9dc5296e5c3b328a82682a36719d891b))
|
|
40
|
+
* **cli:** install hooks at one scope, not project and global ([f4cd237](https://github.com/Raidiant-io/notifai/commit/f4cd2376b57d9104fbcdcca83990ad9dfe09b296))
|
|
41
|
+
* **cli:** isolate Codex hooks and reply routing ([#1](https://github.com/Raidiant-io/notifai/issues/1)) ([d060b6a](https://github.com/Raidiant-io/notifai/commit/d060b6a18b5937d82f74619a6c1bc711243be26c))
|
|
42
|
+
* **cli:** keep Codex hook install on ~/.codex, ignore CODEX_HOME ([3f75f13](https://github.com/Raidiant-io/notifai/commit/3f75f131c24534d3813a336bb72422f78e24a972))
|
|
43
|
+
* **cli:** offer labeled hooks install and uninstall in the interactive app ([f93d0ae](https://github.com/Raidiant-io/notifai/commit/f93d0ae1c981694de6abb317f93f1647dd1d64fa))
|
|
44
|
+
* **cli:** preserve Codex hook trust on reinstall ([#3](https://github.com/Raidiant-io/notifai/issues/3)) ([5e2c2f4](https://github.com/Raidiant-io/notifai/commit/5e2c2f4d618276573f810a989f41a89ab1053564))
|
|
45
|
+
* **cli:** report observed setup receipts ([99d04bb](https://github.com/Raidiant-io/notifai/commit/99d04bbd487681db3023468fbd88b77a1ba13ceb))
|
|
46
|
+
* **cli:** skip readiness work that cannot change the next action ([7fc2295](https://github.com/Raidiant-io/notifai/commit/7fc2295e4a98b07f0116bad17ea93b8f98b265d1))
|
|
47
|
+
* **cli:** stabilize Linux portability checks ([1462693](https://github.com/Raidiant-io/notifai/commit/146269306ae3dfc91f3559cce802460d3e058925))
|
|
48
|
+
* **cli:** write Codex hooks in the layer's existing representation ([7589862](https://github.com/Raidiant-io/notifai/commit/758986296009c1d50bed66a79a5863ea977aa87e))
|
|
49
|
+
* **cli:** write Codex hooks to config.toml, not hooks.json ([3cc6bb8](https://github.com/Raidiant-io/notifai/commit/3cc6bb8bc9bb592ee4abce3f1421d7c0c6f56d32))
|
|
50
|
+
* make CLI package installable from npm ([67bd6be](https://github.com/Raidiant-io/notifai/commit/67bd6be77d648a12ff0d3036a5853b6a4391bebb))
|
|
51
|
+
|
|
11
52
|
## [1.1.0](https://github.com/Raidiant-io/notifai/compare/v1.0.1...v1.1.0) (2026-08-13)
|
|
12
53
|
|
|
13
54
|
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AccountAccessResponse, BeginPairingResponse, CapabilityDocument, CreateMediaUploadRequestT, CreateMediaUploadResponse, EvidenceSnapshot, ListDevicesResponse, ListRepliesResponse, Platform, PollPairingResponse, SubmissionReceipt, SubmitNotificationRequestT } from '@raidiant/notifai-protocol';
|
|
1
|
+
import type { AccountAccessResponse, BeginPairingResponse, CapabilityDocument, CreateMediaUploadRequestT, CreateMediaUploadResponse, EvidenceSnapshot, GetAgentAcknowledgementResponse, ListDevicesResponse, ListRepliesResponse, Platform, PollPairingResponse, PutAgentAcknowledgementRequestT, PutAgentAcknowledgementResponse, SubmissionReceipt, SubmitNotificationRequestT } from '@raidiant/notifai-protocol';
|
|
2
2
|
import type { Logger } from './logging.js';
|
|
3
3
|
export declare class ApiCallError extends Error {
|
|
4
4
|
status: number;
|
|
@@ -34,6 +34,10 @@ export interface ApiClient {
|
|
|
34
34
|
}): Promise<ListRepliesResponse>;
|
|
35
35
|
/** Retire a question and return the replies committed before the close fence. */
|
|
36
36
|
closeReplies(requestId: string): Promise<ListRepliesResponse>;
|
|
37
|
+
putAgentAcknowledgement(requestId: string, body: PutAgentAcknowledgementRequestT): Promise<PutAgentAcknowledgementResponse>;
|
|
38
|
+
agentAcknowledgement(requestId: string, options: {
|
|
39
|
+
waitSeconds: number;
|
|
40
|
+
}): Promise<GetAgentAcknowledgementResponse>;
|
|
37
41
|
createMediaUpload(body: CreateMediaUploadRequestT): Promise<CreateMediaUploadResponse>;
|
|
38
42
|
uploadMedia(grant: CreateMediaUploadResponse, bytes: Uint8Array): Promise<void>;
|
|
39
43
|
health(): Promise<boolean>;
|
package/dist/client.js
CHANGED
|
@@ -129,6 +129,8 @@ export function createClient(baseUrl, bearer, options = {}) {
|
|
|
129
129
|
evidence: (requestId) => call('GET', `/api/v1/notifications/${requestId}`),
|
|
130
130
|
replies: (requestId, { waitSeconds, afterSeq }) => call('GET', `/api/v1/notifications/${encodeURIComponent(requestId)}/replies?wait_seconds=${waitSeconds}&after_seq=${afterSeq}`, undefined, waitSeconds),
|
|
131
131
|
closeReplies: (requestId) => call('POST', `/api/v1/notifications/${encodeURIComponent(requestId)}/replies/close`),
|
|
132
|
+
putAgentAcknowledgement: (requestId, body) => call('PUT', `/api/v1/notifications/${encodeURIComponent(requestId)}/agent-acknowledgement`, body),
|
|
133
|
+
agentAcknowledgement: (requestId, { waitSeconds }) => call('GET', `/api/v1/notifications/${encodeURIComponent(requestId)}/agent-acknowledgement?wait_seconds=${waitSeconds}`, undefined, waitSeconds),
|
|
132
134
|
createMediaUpload: (body) => call('POST', '/api/v1/media', body),
|
|
133
135
|
uploadMedia: async (grant, bytes) => {
|
|
134
136
|
let response;
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAoBA,MAAM,OAAO,YAAa,SAAQ,KAAK;IAE5B;IACA;IAEA;IACA;IALT,YACS,MAAc,EACd,IAAY,EACnB,OAAe,EACR,aAA4B,IAAI,EAChC,UAAmB,IAAI;QAE9B,KAAK,CAAC,OAAO,CAAC,CAAA;QANP,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAQ;QAEZ,eAAU,GAAV,UAAU,CAAsB;QAChC,YAAO,GAAP,OAAO,CAAgB;IAGhC,CAAC;CACF;AAED,MAAM,OAAO,YAAa,SAAQ,KAAK;CAAG;AAE1C;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,GAAY;IACpD,IAAI,GAAG,YAAY,YAAY;QAAE,OAAO,IAAI,CAAA;IAC5C,IAAI,CAAC,CAAC,GAAG,YAAY,YAAY,CAAC;QAAE,OAAO,KAAK,CAAA;IAChD,OAAO,GAAG,CAAC,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,KAAK,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EAAE,CAAC,CAAA;YAC1E,CAAC;QACH,CAAC;QACD,MAAM,EAAE,KAAK,IAAI,EAAE;YACjB,IAAI,CAAC;gBACH,MAAM,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,CAAA;gBAC7B,OAAO,IAAI,CAAA;YACb,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,KAAK,CAAA;YACd,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/dist/commands.d.ts
CHANGED
|
@@ -230,8 +230,15 @@ export declare function buildQuestions(flags: AskFlags, question: string | undef
|
|
|
230
230
|
* for `ask_grace_seconds` before it reaches any device.
|
|
231
231
|
*/
|
|
232
232
|
export declare function askCommand(deps: CommandDeps, question: string | undefined, flags: AskFlags): number;
|
|
233
|
+
/** Record the one Agent Acknowledgement associated with a replied-to request. */
|
|
234
|
+
export declare function acknowledgeCommand(deps: CommandDeps, requestId: string, flags: {
|
|
235
|
+
text?: string;
|
|
236
|
+
json?: boolean;
|
|
237
|
+
}): Promise<number>;
|
|
233
238
|
/** Retire a question so a late answer is rejected rather than silently lost. */
|
|
234
|
-
export declare function closeCommand(deps: CommandDeps, requestId: string
|
|
239
|
+
export declare function closeCommand(deps: CommandDeps, requestId: string, flags?: {
|
|
240
|
+
json?: boolean;
|
|
241
|
+
}): Promise<number>;
|
|
235
242
|
export interface HooksInstallFlags {
|
|
236
243
|
harness?: string;
|
|
237
244
|
global?: boolean;
|
package/dist/commands.js
CHANGED
|
@@ -3,7 +3,7 @@ import { existsSync, lstatSync, mkdirSync, readFileSync, realpathSync, rmSync, u
|
|
|
3
3
|
import os from 'node:os';
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import { parse as parseToml, stringify as stringifyToml } from 'smol-toml';
|
|
6
|
-
import { CAPABILITIES_V1, QUESTION_TEXT_MAX_LENGTH, REPLY_MAX_QUESTIONS, REPLY_MAX_WINDOW_SECONDS, validateDraft, } from '@raidiant/notifai-protocol';
|
|
6
|
+
import { AGENT_ACKNOWLEDGEMENT_MAX_LENGTH, CAPABILITIES_V1, QUESTION_TEXT_MAX_LENGTH, REPLY_MAX_QUESTIONS, REPLY_MAX_WINDOW_SECONDS, validateDraft, } from '@raidiant/notifai-protocol';
|
|
7
7
|
import { sha256Hex } from '@raidiant/notifai-protocol/node';
|
|
8
8
|
import { ApiCallError, NetworkError, createClient, isRetryableReplyPollError, } from './client.js';
|
|
9
9
|
import { BOOLEAN_CONFIG_KEYS, CONFIG_KEYS, LOG_LEVELS, NUMERIC_CONFIG_KEYS, configBounds, configDefaultValue, findProjectConfigPath, personalProjectConfigPath, globalConfigPath, loadConfig, sessionConfigPath, stateDir, } from './config.js';
|
|
@@ -13,7 +13,7 @@ import { atomicWriteFileSync } from './atomic-file.js';
|
|
|
13
13
|
import { withTargetFileLock } from './file-lock.js';
|
|
14
14
|
import { renderConfigExplain, renderConfigList, renderConfigPlain, } from './ui/config-view.js';
|
|
15
15
|
import { firstBlocker, } from './readiness.js';
|
|
16
|
-
import { WAITER_CEILING_SECONDS, handleSessionEnd, handleStop, handleUserPromptSubmit, parseHookInput, pruneAbandonedSessions, readLiveProjectSessionPointers, readMatchingProjectSessionPointer, readProjectSession, readProjectSessionPointer, readSessionState, registerQuestion, } from './hooks.js';
|
|
16
|
+
import { WAITER_CEILING_SECONDS, clearAcknowledgementObligation, handleSessionEnd, handleStop, handleUserPromptSubmit, parseHookInput, pruneAbandonedSessions, readLiveProjectSessionPointers, readMatchingProjectSessionPointer, readProjectSession, readProjectSessionPointer, readSessionState, registerQuestion, } from './hooks.js';
|
|
17
17
|
import { LOG_EVENTS, activeLogPath, archiveLogPaths, logConfigResolved, logSettingsFrom, logsDiskUsage, nullLogger, readLogRecords, renderRecord, } from './logging.js';
|
|
18
18
|
import { BLOCKING_STOP_TIMEOUT_SECONDS, CLAUDE_ASYNC_STOP_TIMEOUT_SECONDS, HARNESSES, applyPlan, buildCursorHookConfig, buildHookConfig, collapseUnusedCodexRepresentation, codexLayerDir, codexLayerPaths, codexRepresentationProblems, codexTrustProblems, codexProjectRoot, detectHarness, detectedHarnesses, findInstallations, handlerEvent, hookDefinitionFiles, inspectCodexLayer, loadCursorSettings, loadSettings, mergeCursorHooks, mergeHooks, removeCursorHooks, removeHooks, settingsFile, } from './install-hooks.js';
|
|
19
19
|
import { HARNESS_CAPABILITIES, HARNESS_LABELS } from './harnesses.js';
|
|
@@ -422,6 +422,7 @@ export async function sendCommand(deps, flags) {
|
|
|
422
422
|
title: flags.title,
|
|
423
423
|
overall: receipt.overall,
|
|
424
424
|
replayed: receipt.replayed,
|
|
425
|
+
agent_acknowledgement_required: receipt.agent_acknowledgement_required,
|
|
425
426
|
deliveries: receipt.deliveries.length,
|
|
426
427
|
wait_seconds: waitSeconds,
|
|
427
428
|
exit: receiptExit,
|
|
@@ -452,6 +453,9 @@ export async function sendCommand(deps, flags) {
|
|
|
452
453
|
type: 'reply_result',
|
|
453
454
|
request_id: receipt.request_id,
|
|
454
455
|
replies: [],
|
|
456
|
+
agent_acknowledgement_required: receipt.agent_acknowledgement_required,
|
|
457
|
+
agent_acknowledgement: null,
|
|
458
|
+
acknowledgement_command: null,
|
|
455
459
|
degraded: false,
|
|
456
460
|
})
|
|
457
461
|
: JSON.stringify(receipt, null, 2));
|
|
@@ -467,17 +471,16 @@ export async function sendCommand(deps, flags) {
|
|
|
467
471
|
});
|
|
468
472
|
recordReplies(deps, receipt.request_id, result.response.replies);
|
|
469
473
|
if (flags.json) {
|
|
470
|
-
deps.io.out(JSON.stringify(
|
|
471
|
-
type: 'reply_result',
|
|
472
|
-
request_id: receipt.request_id,
|
|
473
|
-
replies: result.response.replies,
|
|
474
|
-
degraded: result.degraded,
|
|
475
|
-
}));
|
|
474
|
+
deps.io.out(JSON.stringify(replyResultJson(result.response, result.degraded)));
|
|
476
475
|
}
|
|
477
|
-
else if (result.response.replies.length > 0)
|
|
476
|
+
else if (result.response.replies.length > 0) {
|
|
478
477
|
printReplies(deps, result.response.replies);
|
|
479
|
-
|
|
478
|
+
printAcknowledgementStatus(deps, result.response);
|
|
479
|
+
}
|
|
480
|
+
else {
|
|
480
481
|
printNoReply(deps, receipt.request_id, result.response.reply_expires_at);
|
|
482
|
+
printAcknowledgementStatus(deps, result.response);
|
|
483
|
+
}
|
|
481
484
|
if (result.degraded) {
|
|
482
485
|
log(deps).error('cli.error', {
|
|
483
486
|
kind: 'network',
|
|
@@ -601,15 +604,17 @@ export async function repliesCommand(deps, requestedId, flags) {
|
|
|
601
604
|
});
|
|
602
605
|
recordReplies(deps, requestId, result.response.replies);
|
|
603
606
|
if (flags.json) {
|
|
604
|
-
jsonBodies.push(
|
|
607
|
+
jsonBodies.push(replyResultJson(result.response, result.degraded));
|
|
605
608
|
}
|
|
606
609
|
else if (result.response.replies.length > 0) {
|
|
607
610
|
if (flags.pending === true)
|
|
608
611
|
deps.io.out(`pending request ${requestId}`);
|
|
609
612
|
printReplies(deps, result.response.replies);
|
|
613
|
+
printAcknowledgementStatus(deps, result.response);
|
|
610
614
|
}
|
|
611
615
|
else {
|
|
612
616
|
printNoReply(deps, requestId, result.response.reply_expires_at);
|
|
617
|
+
printAcknowledgementStatus(deps, result.response);
|
|
613
618
|
}
|
|
614
619
|
anyReplies ||= result.response.replies.length > 0;
|
|
615
620
|
if (result.degraded)
|
|
@@ -687,7 +692,13 @@ export async function waitForReply(client, requestId, options) {
|
|
|
687
692
|
throw lastTransientError;
|
|
688
693
|
return {
|
|
689
694
|
response: lastResponse ??
|
|
690
|
-
{
|
|
695
|
+
{
|
|
696
|
+
request_id: requestId,
|
|
697
|
+
reply_expires_at: null,
|
|
698
|
+
agent_acknowledgement_required: false,
|
|
699
|
+
agent_acknowledgement: null,
|
|
700
|
+
replies: [],
|
|
701
|
+
},
|
|
691
702
|
timedOut: true,
|
|
692
703
|
// A poll succeeded at some point, so we do not throw — but the last thing
|
|
693
704
|
// we know is that we could not reach the server. Reporting that as a plain
|
|
@@ -723,6 +734,39 @@ function degradedWaitWarning(requestId) {
|
|
|
723
734
|
function isNonNegativeInteger(value) {
|
|
724
735
|
return Number.isInteger(value) && value >= 0;
|
|
725
736
|
}
|
|
737
|
+
function acknowledgementCommand(requestId, required, acknowledgement, hasReply = true) {
|
|
738
|
+
return required && acknowledgement === null && hasReply
|
|
739
|
+
? `notifai acknowledge ${requestId} --text <text>`
|
|
740
|
+
: null;
|
|
741
|
+
}
|
|
742
|
+
function replyResultJson(response, degraded) {
|
|
743
|
+
return {
|
|
744
|
+
type: 'reply_result',
|
|
745
|
+
request_id: response.request_id,
|
|
746
|
+
reply_expires_at: response.reply_expires_at,
|
|
747
|
+
replies: response.replies,
|
|
748
|
+
agent_acknowledgement_required: response.agent_acknowledgement_required,
|
|
749
|
+
agent_acknowledgement: response.agent_acknowledgement,
|
|
750
|
+
acknowledgement_command: acknowledgementCommand(response.request_id, response.agent_acknowledgement_required, response.agent_acknowledgement, response.replies.length > 0),
|
|
751
|
+
degraded,
|
|
752
|
+
};
|
|
753
|
+
}
|
|
754
|
+
function printAcknowledgementStatus(deps, response) {
|
|
755
|
+
if (!response.agent_acknowledgement_required) {
|
|
756
|
+
deps.io.out('Agent Acknowledgement: not required for this request.');
|
|
757
|
+
return;
|
|
758
|
+
}
|
|
759
|
+
if (response.agent_acknowledgement !== null) {
|
|
760
|
+
deps.io.out(`Agent Acknowledgement: recorded at ${response.agent_acknowledgement.created_at}: ${response.agent_acknowledgement.text}`);
|
|
761
|
+
return;
|
|
762
|
+
}
|
|
763
|
+
if (response.replies.length > 0) {
|
|
764
|
+
deps.io.out('Agent Acknowledgement required.');
|
|
765
|
+
deps.io.out(`next: Run \`${acknowledgementCommand(response.request_id, true, null)}\` with concrete text saying what you will do because of the reply.`);
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
768
|
+
deps.io.out('Agent Acknowledgement: required after a user reply; no reply is recorded yet.');
|
|
769
|
+
}
|
|
726
770
|
function recordReplies(deps, requestId, replies) {
|
|
727
771
|
const logger = log(deps);
|
|
728
772
|
for (const reply of replies) {
|
|
@@ -1615,15 +1659,76 @@ function hookActivationAdvice(installations) {
|
|
|
1615
1659
|
}
|
|
1616
1660
|
return `${advice.join('. ')}.`;
|
|
1617
1661
|
}
|
|
1662
|
+
/** Record the one Agent Acknowledgement associated with a replied-to request. */
|
|
1663
|
+
export async function acknowledgeCommand(deps, requestId, flags) {
|
|
1664
|
+
const text = flags.text?.trim() ?? '';
|
|
1665
|
+
if (text.length === 0) {
|
|
1666
|
+
deps.io.err('--text is required and must contain non-whitespace text.');
|
|
1667
|
+
return EXIT.usage;
|
|
1668
|
+
}
|
|
1669
|
+
if (text.length > AGENT_ACKNOWLEDGEMENT_MAX_LENGTH) {
|
|
1670
|
+
deps.io.err(`--text must be at most ${AGENT_ACKNOWLEDGEMENT_MAX_LENGTH} characters after trimming.`);
|
|
1671
|
+
return EXIT.usage;
|
|
1672
|
+
}
|
|
1673
|
+
const logger = log(deps);
|
|
1674
|
+
const config = loadLoggedConfig(deps, { cwd: deps.cwd, env: deps.env });
|
|
1675
|
+
logger.info('acknowledgement.attempted', {
|
|
1676
|
+
request_id: requestId,
|
|
1677
|
+
text,
|
|
1678
|
+
characters: text.length,
|
|
1679
|
+
});
|
|
1680
|
+
const authed = authedClient(deps, config);
|
|
1681
|
+
if (!authed)
|
|
1682
|
+
return EXIT.auth;
|
|
1683
|
+
try {
|
|
1684
|
+
const result = await authed.client.putAgentAcknowledgement(requestId, { text });
|
|
1685
|
+
const output = {
|
|
1686
|
+
request_id: requestId,
|
|
1687
|
+
outcome: result.status,
|
|
1688
|
+
acknowledgement: result.agent_acknowledgement,
|
|
1689
|
+
agent_acknowledgement_required: true,
|
|
1690
|
+
};
|
|
1691
|
+
logger.info('acknowledgement.outcome', {
|
|
1692
|
+
request_id: requestId,
|
|
1693
|
+
outcome: result.status,
|
|
1694
|
+
text: result.agent_acknowledgement.text,
|
|
1695
|
+
created_at: result.agent_acknowledgement.created_at,
|
|
1696
|
+
agent_acknowledgement_required: true,
|
|
1697
|
+
});
|
|
1698
|
+
const sessionId = readProjectSession(deps.cwd, deps.env, (deps.now ?? Date.now)());
|
|
1699
|
+
if (sessionId !== null) {
|
|
1700
|
+
clearAcknowledgementObligation(sessionId, deps.env, requestId);
|
|
1701
|
+
}
|
|
1702
|
+
if (flags.json)
|
|
1703
|
+
deps.io.out(JSON.stringify(output, null, 2));
|
|
1704
|
+
else {
|
|
1705
|
+
deps.io.out(`Agent Acknowledgement ${result.status} for ${requestId} at ${result.agent_acknowledgement.created_at}.`);
|
|
1706
|
+
}
|
|
1707
|
+
return EXIT.ok;
|
|
1708
|
+
}
|
|
1709
|
+
catch (err) {
|
|
1710
|
+
return reportError(deps, err, { operation: 'agent_acknowledgement', request_id: requestId });
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1618
1713
|
/** Retire a question so a late answer is rejected rather than silently lost. */
|
|
1619
|
-
export async function closeCommand(deps, requestId) {
|
|
1714
|
+
export async function closeCommand(deps, requestId, flags = {}) {
|
|
1620
1715
|
const config = loadLoggedConfig(deps, { cwd: deps.cwd, env: deps.env });
|
|
1621
1716
|
const authed = authedClient(deps, config);
|
|
1622
1717
|
if (!authed)
|
|
1623
1718
|
return EXIT.auth;
|
|
1624
1719
|
try {
|
|
1625
|
-
await authed.client.closeReplies(requestId);
|
|
1626
|
-
|
|
1720
|
+
const response = await authed.client.closeReplies(requestId);
|
|
1721
|
+
if (flags.json) {
|
|
1722
|
+
deps.io.out(JSON.stringify({
|
|
1723
|
+
...response,
|
|
1724
|
+
acknowledgement_command: acknowledgementCommand(response.request_id, response.agent_acknowledgement_required, response.agent_acknowledgement, response.replies.length > 0),
|
|
1725
|
+
}, null, 2));
|
|
1726
|
+
}
|
|
1727
|
+
else {
|
|
1728
|
+
deps.io.out(`Closed the reply window for ${requestId}.`);
|
|
1729
|
+
if (response.replies.length > 0)
|
|
1730
|
+
printAcknowledgementStatus(deps, response);
|
|
1731
|
+
}
|
|
1627
1732
|
return EXIT.ok;
|
|
1628
1733
|
}
|
|
1629
1734
|
catch (err) {
|