@agentchatme/agent-core 0.0.1313111111111 → 0.0.1313111111112
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/{adapter-types-CV0DSi4F.d.ts → adapter-types-C_kf-KtV.d.ts} +25 -1
- package/dist/{chunk-D62LD5UE.js → chunk-KIP2JKPQ.js} +131 -9
- package/dist/chunk-KIP2JKPQ.js.map +1 -0
- package/dist/daemon-entry.d.ts +6 -2
- package/dist/daemon-entry.js +52 -37
- package/dist/daemon-entry.js.map +1 -1
- package/dist/index.d.ts +29 -7
- package/dist/index.js +81 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-D62LD5UE.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -31,11 +31,13 @@ import {
|
|
|
31
31
|
external_exports,
|
|
32
32
|
formatDaemonActivities,
|
|
33
33
|
formatPendingRequestsNotice,
|
|
34
|
+
formatPendingRequestsSystemMessage,
|
|
34
35
|
formatWhen,
|
|
35
36
|
fullAutonomyAllows,
|
|
36
37
|
getMeLite,
|
|
37
38
|
getPendingRequest,
|
|
38
39
|
idle,
|
|
40
|
+
installationId,
|
|
39
41
|
lastDeliveryId,
|
|
40
42
|
listPendingRequests,
|
|
41
43
|
log,
|
|
@@ -45,7 +47,9 @@ import {
|
|
|
45
47
|
markForegroundTurn,
|
|
46
48
|
markSessionActive,
|
|
47
49
|
normalizeAgentHandle,
|
|
50
|
+
notifyPendingRequest,
|
|
48
51
|
peekDaemonActivities,
|
|
52
|
+
pendingNotificationPlan,
|
|
49
53
|
pendingPath,
|
|
50
54
|
pendingRequestId,
|
|
51
55
|
pendingRequestsFingerprint,
|
|
@@ -56,19 +60,23 @@ import {
|
|
|
56
60
|
readPending,
|
|
57
61
|
recordDaemonActivity,
|
|
58
62
|
recordPendingRequest,
|
|
63
|
+
recordPendingRequestWithStatus,
|
|
59
64
|
relativeAge,
|
|
60
65
|
relativeWhen,
|
|
61
66
|
removeFullAutonomyAgent,
|
|
62
67
|
resolveIdentity,
|
|
63
68
|
resolvePendingRequest,
|
|
64
69
|
setFullAutonomyMode,
|
|
70
|
+
spawnCommand,
|
|
71
|
+
spawnCommandSync,
|
|
65
72
|
statePath,
|
|
66
73
|
syncAck,
|
|
67
74
|
syncPeek,
|
|
75
|
+
syncPendingReviewMirror,
|
|
68
76
|
writeCredentials,
|
|
69
77
|
writeFullAutonomyPolicy,
|
|
70
78
|
writePending
|
|
71
|
-
} from "./chunk-
|
|
79
|
+
} from "./chunk-KIP2JKPQ.js";
|
|
72
80
|
|
|
73
81
|
// src/identity/state.ts
|
|
74
82
|
var SESSION_TTL_MS = 48 * 60 * 60 * 1e3;
|
|
@@ -584,7 +592,12 @@ async function claimContiguousPrefix(cfg, rows, holder) {
|
|
|
584
592
|
return prefix;
|
|
585
593
|
}
|
|
586
594
|
async function sessionStart(ctx, input) {
|
|
587
|
-
const none = {
|
|
595
|
+
const none = {
|
|
596
|
+
context: null,
|
|
597
|
+
notification: null,
|
|
598
|
+
stage: () => {
|
|
599
|
+
}
|
|
600
|
+
};
|
|
588
601
|
try {
|
|
589
602
|
if (hooksDisabled()) return none;
|
|
590
603
|
if (input.source === "compact") return none;
|
|
@@ -593,7 +606,12 @@ async function sessionStart(ctx, input) {
|
|
|
593
606
|
if (identity === null) {
|
|
594
607
|
if (shouldOfferRegistration(ctx.home)) {
|
|
595
608
|
recordRegistrationOffer(ctx.home);
|
|
596
|
-
return {
|
|
609
|
+
return {
|
|
610
|
+
context: formatRegistrationOffer(ctx.copy, alwaysOnState(ctx.home)),
|
|
611
|
+
notification: null,
|
|
612
|
+
stage: () => {
|
|
613
|
+
}
|
|
614
|
+
};
|
|
597
615
|
}
|
|
598
616
|
return none;
|
|
599
617
|
}
|
|
@@ -614,19 +632,28 @@ async function sessionStart(ctx, input) {
|
|
|
614
632
|
input.sessionId,
|
|
615
633
|
fingerprint
|
|
616
634
|
) ? formatPendingRequestsNotice(requests, ctx.copy) : null;
|
|
617
|
-
if (pendingNotice !== null) {
|
|
618
|
-
recordPendingNotice(ctx.home, input.sessionId, fingerprint);
|
|
619
|
-
}
|
|
620
635
|
const context = [alert, pendingNotice].filter((value) => value !== null).join("\n\n");
|
|
621
|
-
return {
|
|
636
|
+
return {
|
|
637
|
+
context: context || null,
|
|
638
|
+
notification: pendingNotice === null ? null : formatPendingRequestsSystemMessage(requests),
|
|
639
|
+
stage: () => {
|
|
640
|
+
if (pendingNotice !== null) {
|
|
641
|
+
recordPendingNotice(ctx.home, input.sessionId, fingerprint);
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
};
|
|
622
645
|
} catch (err) {
|
|
623
646
|
log.warn(`session-start hook degraded to no-op: ${String(err)}`);
|
|
624
647
|
return none;
|
|
625
648
|
}
|
|
626
649
|
}
|
|
627
650
|
async function userPrompt(ctx, input) {
|
|
628
|
-
const none = {
|
|
629
|
-
|
|
651
|
+
const none = {
|
|
652
|
+
context: null,
|
|
653
|
+
notification: null,
|
|
654
|
+
stage: () => {
|
|
655
|
+
}
|
|
656
|
+
};
|
|
630
657
|
try {
|
|
631
658
|
if (hooksDisabled()) return none;
|
|
632
659
|
const identity = resolveIdentity(ctx.home);
|
|
@@ -666,6 +693,7 @@ async function userPrompt(ctx, input) {
|
|
|
666
693
|
if (!localContext) return none;
|
|
667
694
|
return {
|
|
668
695
|
context: localContext,
|
|
696
|
+
notification: pendingContext === null ? null : formatPendingRequestsSystemMessage(pendingRequests),
|
|
669
697
|
stage: stageLocalContext
|
|
670
698
|
};
|
|
671
699
|
}
|
|
@@ -678,15 +706,21 @@ async function userPrompt(ctx, input) {
|
|
|
678
706
|
if (!localContext) return none;
|
|
679
707
|
return {
|
|
680
708
|
context: localContext,
|
|
709
|
+
notification: pendingContext === null ? null : formatPendingRequestsSystemMessage(pendingRequests),
|
|
681
710
|
stage: stageLocalContext
|
|
682
711
|
};
|
|
683
712
|
}
|
|
684
713
|
const cursor = lastDeliveryId(rows);
|
|
685
714
|
if (cursor === null) {
|
|
686
|
-
return localContext ? {
|
|
715
|
+
return localContext ? {
|
|
716
|
+
context: localContext,
|
|
717
|
+
notification: pendingContext === null ? null : formatPendingRequestsSystemMessage(pendingRequests),
|
|
718
|
+
stage: stageLocalContext
|
|
719
|
+
} : none;
|
|
687
720
|
}
|
|
688
721
|
return {
|
|
689
722
|
context: [pendingContext, activityContext, formatSessionStart(handle, rows)].filter((value) => value !== null).join("\n\n"),
|
|
723
|
+
notification: pendingContext === null ? null : formatPendingRequestsSystemMessage(pendingRequests),
|
|
690
724
|
stage: () => {
|
|
691
725
|
stageLocalContext();
|
|
692
726
|
setPendingAck(ctx.home, input.sessionId, cursor);
|
|
@@ -840,8 +874,13 @@ function createHookRunners(context, dialect) {
|
|
|
840
874
|
async runSessionStart() {
|
|
841
875
|
try {
|
|
842
876
|
const input = await readHookInput();
|
|
843
|
-
const
|
|
844
|
-
if (
|
|
877
|
+
const result = await sessionStart(context(), input);
|
|
878
|
+
if (result.context !== null) {
|
|
879
|
+
dialect.printJson(
|
|
880
|
+
dialect.sessionStartOutput(result.context, result.notification)
|
|
881
|
+
);
|
|
882
|
+
result.stage();
|
|
883
|
+
}
|
|
845
884
|
} catch (err) {
|
|
846
885
|
log.warn(`session-start hook degraded to no-op: ${String(err)}`);
|
|
847
886
|
}
|
|
@@ -849,9 +888,9 @@ function createHookRunners(context, dialect) {
|
|
|
849
888
|
async runUserPrompt() {
|
|
850
889
|
try {
|
|
851
890
|
const input = await readHookInput();
|
|
852
|
-
const { context: text, stage } = await userPrompt(context(), input);
|
|
891
|
+
const { context: text, notification, stage } = await userPrompt(context(), input);
|
|
853
892
|
if (text === null) return;
|
|
854
|
-
dialect.printJson(dialect.userPromptOutput(text));
|
|
893
|
+
dialect.printJson(dialect.userPromptOutput(text, notification));
|
|
855
894
|
stage();
|
|
856
895
|
} catch (err) {
|
|
857
896
|
log.warn(`user-prompt hook degraded to no-op: ${String(err)}`);
|
|
@@ -951,11 +990,23 @@ function createIdentityCommands(profile) {
|
|
|
951
990
|
clientIdentity: CODING_AGENTS_CLIENT_IDENTITY
|
|
952
991
|
});
|
|
953
992
|
if (identity.source === "file" && identity.handle) {
|
|
954
|
-
return {
|
|
993
|
+
return {
|
|
994
|
+
home,
|
|
995
|
+
handle: identity.handle,
|
|
996
|
+
client,
|
|
997
|
+
apiKey: identity.apiKey,
|
|
998
|
+
apiBase: identity.apiBase
|
|
999
|
+
};
|
|
955
1000
|
}
|
|
956
1001
|
try {
|
|
957
1002
|
const me = await client.getMe();
|
|
958
|
-
return {
|
|
1003
|
+
return {
|
|
1004
|
+
home,
|
|
1005
|
+
handle: me.handle,
|
|
1006
|
+
client,
|
|
1007
|
+
apiKey: identity.apiKey,
|
|
1008
|
+
apiBase: identity.apiBase
|
|
1009
|
+
};
|
|
959
1010
|
} catch (err) {
|
|
960
1011
|
console.error(`Could not identify this AgentChat account: ${apiErr(err)}`);
|
|
961
1012
|
return null;
|
|
@@ -1452,6 +1503,14 @@ function createIdentityCommands(profile) {
|
|
|
1452
1503
|
console.error("That pending request was not found for this AgentChat account.");
|
|
1453
1504
|
return 1;
|
|
1454
1505
|
}
|
|
1506
|
+
try {
|
|
1507
|
+
await syncPendingReviewMirror(
|
|
1508
|
+
{ apiKey: current.apiKey, apiBase: current.apiBase },
|
|
1509
|
+
installationId(current.home),
|
|
1510
|
+
listPendingRequests(current.home, current.handle)
|
|
1511
|
+
);
|
|
1512
|
+
} catch {
|
|
1513
|
+
}
|
|
1455
1514
|
console.log(`Resolved local pending request ${id}. Its AgentChat conversation remains stored on the server.`);
|
|
1456
1515
|
return 0;
|
|
1457
1516
|
}
|
|
@@ -1767,13 +1826,6 @@ function renderManual(copy, opts = {}) {
|
|
|
1767
1826
|
import * as fs2 from "fs";
|
|
1768
1827
|
import * as os from "os";
|
|
1769
1828
|
import * as path2 from "path";
|
|
1770
|
-
|
|
1771
|
-
// src/util/spawn.ts
|
|
1772
|
-
import crossSpawn from "cross-spawn";
|
|
1773
|
-
var spawnCommand = crossSpawn;
|
|
1774
|
-
var spawnCommandSync = crossSpawn.sync;
|
|
1775
|
-
|
|
1776
|
-
// src/daemon/service.ts
|
|
1777
1829
|
function planForTest(opts) {
|
|
1778
1830
|
return plan(opts);
|
|
1779
1831
|
}
|
|
@@ -2216,6 +2268,7 @@ export {
|
|
|
2216
2268
|
formatAlwaysOnDown,
|
|
2217
2269
|
formatDaemonActivities,
|
|
2218
2270
|
formatPendingRequestsNotice,
|
|
2271
|
+
formatPendingRequestsSystemMessage,
|
|
2219
2272
|
formatRegistrationOffer,
|
|
2220
2273
|
formatSessionStart,
|
|
2221
2274
|
formatStopPickup,
|
|
@@ -2228,6 +2281,7 @@ export {
|
|
|
2228
2281
|
hooksDisabled,
|
|
2229
2282
|
idle,
|
|
2230
2283
|
installService,
|
|
2284
|
+
installationId,
|
|
2231
2285
|
lastDeliveryId,
|
|
2232
2286
|
launchdPlist,
|
|
2233
2287
|
listPendingRequests,
|
|
@@ -2238,9 +2292,11 @@ export {
|
|
|
2238
2292
|
markForegroundTurn,
|
|
2239
2293
|
markSessionActive,
|
|
2240
2294
|
normalizeAgentHandle,
|
|
2295
|
+
notifyPendingRequest,
|
|
2241
2296
|
offerDeclined,
|
|
2242
2297
|
peekDaemonActivities,
|
|
2243
2298
|
pendingNoticeNeeded,
|
|
2299
|
+
pendingNotificationPlan,
|
|
2244
2300
|
pendingPath,
|
|
2245
2301
|
pendingRequestId,
|
|
2246
2302
|
pendingRequestsFingerprint,
|
|
@@ -2259,6 +2315,7 @@ export {
|
|
|
2259
2315
|
recordOfferDeclined,
|
|
2260
2316
|
recordPendingNotice,
|
|
2261
2317
|
recordPendingRequest,
|
|
2318
|
+
recordPendingRequestWithStatus,
|
|
2262
2319
|
recordRegistrationOffer,
|
|
2263
2320
|
relativeAge,
|
|
2264
2321
|
relativeWhen,
|
|
@@ -2286,6 +2343,7 @@ export {
|
|
|
2286
2343
|
stripAnchorBlock,
|
|
2287
2344
|
syncAck,
|
|
2288
2345
|
syncPeek,
|
|
2346
|
+
syncPendingReviewMirror,
|
|
2289
2347
|
systemdQuote,
|
|
2290
2348
|
systemdUnit,
|
|
2291
2349
|
takePendingAck,
|