@yitom/agy-acp-map 0.1.7 → 0.1.11
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/agent-sdk.d.ts +2 -0
- package/dist/agy-acp-win-x64.exe +2 -2
- package/dist/agy-headless.exe +0 -0
- package/dist/bin.js +41 -2
- package/dist/index.js +22 -1
- package/dist/lib/session-history.d.ts +6 -0
- package/package.json +1 -1
package/dist/agent-sdk.d.ts
CHANGED
|
@@ -41,6 +41,8 @@ export declare class AgyAcpService {
|
|
|
41
41
|
closeSession(params: any): Promise<any>;
|
|
42
42
|
deleteSession(params: any): Promise<any>;
|
|
43
43
|
cancelSession(params: any): void;
|
|
44
|
+
/** Kill every live agy child (bridge shutdown path; see sdk-server.ts). */
|
|
45
|
+
shutdown(): Promise<void>;
|
|
44
46
|
promptSession(params: any, notifyClient: (update: any) => Promise<void> | void, opts?: {
|
|
45
47
|
isPreLocked?: boolean;
|
|
46
48
|
}): Promise<{
|
package/dist/agy-acp-win-x64.exe
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: package/dist/agy-acp-win-x64.exe
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 86639616 bytes
|
|
4
|
+
sha256: 9907e60cb909d51bedd9d2632b7c0fc00f05d9a5ec040098c09941c75960b737
|
package/dist/agy-headless.exe
CHANGED
|
Binary file
|
package/dist/bin.js
CHANGED
|
@@ -12451,6 +12451,14 @@ class SessionHistoryStore {
|
|
|
12451
12451
|
fs7.appendFileSync(this.filePath(sessionId), payload, "utf8");
|
|
12452
12452
|
}
|
|
12453
12453
|
read(sessionId) {
|
|
12454
|
+
return this.readUpTo(sessionId, Infinity);
|
|
12455
|
+
}
|
|
12456
|
+
firstUserText(sessionId) {
|
|
12457
|
+
const records = this.readUpTo(sessionId, 50);
|
|
12458
|
+
const first = records.find((r) => r.role === "user" && r.text.trim());
|
|
12459
|
+
return first ? first.text : null;
|
|
12460
|
+
}
|
|
12461
|
+
readUpTo(sessionId, maxLines) {
|
|
12454
12462
|
const file = this.filePath(sessionId);
|
|
12455
12463
|
if (!fs7.existsSync(file))
|
|
12456
12464
|
return [];
|
|
@@ -12461,9 +12469,12 @@ class SessionHistoryStore {
|
|
|
12461
12469
|
return [];
|
|
12462
12470
|
}
|
|
12463
12471
|
const records = [];
|
|
12472
|
+
let lines = 0;
|
|
12464
12473
|
for (const line of raw.split(/\r?\n/)) {
|
|
12465
12474
|
if (!line.trim())
|
|
12466
12475
|
continue;
|
|
12476
|
+
if (++lines > maxLines)
|
|
12477
|
+
break;
|
|
12467
12478
|
try {
|
|
12468
12479
|
const parsed = JSON.parse(line);
|
|
12469
12480
|
if (isRecord2(parsed) && parsed.sessionId === sessionId) {
|
|
@@ -12488,7 +12499,7 @@ class SessionHistoryStore {
|
|
|
12488
12499
|
var AGENT_INFO = {
|
|
12489
12500
|
name: "agy-acp",
|
|
12490
12501
|
title: "agy ACP (stream-json)",
|
|
12491
|
-
version: "0.1.
|
|
12502
|
+
version: "0.1.11"
|
|
12492
12503
|
};
|
|
12493
12504
|
var BRIDGE_CAPABILITIES = {
|
|
12494
12505
|
prompt: true,
|
|
@@ -12967,6 +12978,13 @@ class AgySessionCore {
|
|
|
12967
12978
|
}
|
|
12968
12979
|
const discovery = await this.getDiscovery();
|
|
12969
12980
|
this.applyCatalogDefaults(session, discovery);
|
|
12981
|
+
if (!session.title) {
|
|
12982
|
+
try {
|
|
12983
|
+
const first = this.historyStore.firstUserText(sessionId);
|
|
12984
|
+
if (first && first.trim())
|
|
12985
|
+
session.title = deriveTitle(first);
|
|
12986
|
+
} catch {}
|
|
12987
|
+
}
|
|
12970
12988
|
this.persistSession(session);
|
|
12971
12989
|
if (opts?.warmup !== false) {
|
|
12972
12990
|
this.warmupSession(sessionId);
|
|
@@ -17787,6 +17805,9 @@ class AgyAcpService {
|
|
|
17787
17805
|
cancelSession(params) {
|
|
17788
17806
|
this.core.cancelSession(params);
|
|
17789
17807
|
}
|
|
17808
|
+
async shutdown() {
|
|
17809
|
+
await this.core.shutdown();
|
|
17810
|
+
}
|
|
17790
17811
|
promptSession(params, notifyClient, opts) {
|
|
17791
17812
|
const targetSession = this.core.sessions.get(params?.sessionId);
|
|
17792
17813
|
const version = params?.protocolVersion === 2 || params?.protocolVersion !== 1 && targetSession?.protocolVersion === 2 ? 2 : 1;
|
|
@@ -17856,5 +17877,23 @@ var app = createDualAcpApp(service);
|
|
|
17856
17877
|
var stream = ndJsonStream2(Writable.toWeb(process.stdout), Readable.toWeb(process.stdin));
|
|
17857
17878
|
process.stderr.write(`[agy-acp-sdk] Starting official @agentclientprotocol/sdk stdio server...
|
|
17858
17879
|
`);
|
|
17880
|
+
var shuttingDown = false;
|
|
17881
|
+
async function shutdown(code) {
|
|
17882
|
+
if (shuttingDown)
|
|
17883
|
+
process.exit(code);
|
|
17884
|
+
shuttingDown = true;
|
|
17885
|
+
debugLog2(`shutdown code=${code}: killing supervised agy children`);
|
|
17886
|
+
try {
|
|
17887
|
+
await service.shutdown();
|
|
17888
|
+
} catch (err) {
|
|
17889
|
+
debugLog2(`shutdown kill error: ${err?.message}`);
|
|
17890
|
+
}
|
|
17891
|
+
debugLog2("shutdown complete");
|
|
17892
|
+
process.exit(code);
|
|
17893
|
+
}
|
|
17894
|
+
process.on("SIGINT", () => void shutdown(0));
|
|
17895
|
+
process.on("SIGTERM", () => void shutdown(0));
|
|
17896
|
+
process.stdin.on("end", () => void shutdown(0));
|
|
17897
|
+
process.stdin.on("close", () => void shutdown(0));
|
|
17859
17898
|
await app.connect(stream);
|
|
17860
|
-
debugLog2("CONNECT-SETUP-DONE (
|
|
17899
|
+
debugLog2("CONNECT-SETUP-DONE (serving; exit only via stdin close or signal)");
|
package/dist/index.js
CHANGED
|
@@ -12238,6 +12238,14 @@ class SessionHistoryStore {
|
|
|
12238
12238
|
fs7.appendFileSync(this.filePath(sessionId), payload, "utf8");
|
|
12239
12239
|
}
|
|
12240
12240
|
read(sessionId) {
|
|
12241
|
+
return this.readUpTo(sessionId, Infinity);
|
|
12242
|
+
}
|
|
12243
|
+
firstUserText(sessionId) {
|
|
12244
|
+
const records = this.readUpTo(sessionId, 50);
|
|
12245
|
+
const first = records.find((r) => r.role === "user" && r.text.trim());
|
|
12246
|
+
return first ? first.text : null;
|
|
12247
|
+
}
|
|
12248
|
+
readUpTo(sessionId, maxLines) {
|
|
12241
12249
|
const file = this.filePath(sessionId);
|
|
12242
12250
|
if (!fs7.existsSync(file))
|
|
12243
12251
|
return [];
|
|
@@ -12248,9 +12256,12 @@ class SessionHistoryStore {
|
|
|
12248
12256
|
return [];
|
|
12249
12257
|
}
|
|
12250
12258
|
const records = [];
|
|
12259
|
+
let lines = 0;
|
|
12251
12260
|
for (const line of raw.split(/\r?\n/)) {
|
|
12252
12261
|
if (!line.trim())
|
|
12253
12262
|
continue;
|
|
12263
|
+
if (++lines > maxLines)
|
|
12264
|
+
break;
|
|
12254
12265
|
try {
|
|
12255
12266
|
const parsed = JSON.parse(line);
|
|
12256
12267
|
if (isRecord2(parsed) && parsed.sessionId === sessionId) {
|
|
@@ -12275,7 +12286,7 @@ class SessionHistoryStore {
|
|
|
12275
12286
|
var AGENT_INFO = {
|
|
12276
12287
|
name: "agy-acp",
|
|
12277
12288
|
title: "agy ACP (stream-json)",
|
|
12278
|
-
version: "0.1.
|
|
12289
|
+
version: "0.1.11"
|
|
12279
12290
|
};
|
|
12280
12291
|
var BRIDGE_CAPABILITIES = {
|
|
12281
12292
|
prompt: true,
|
|
@@ -12767,6 +12778,13 @@ class AgySessionCore {
|
|
|
12767
12778
|
}
|
|
12768
12779
|
const discovery = await this.getDiscovery();
|
|
12769
12780
|
this.applyCatalogDefaults(session, discovery);
|
|
12781
|
+
if (!session.title) {
|
|
12782
|
+
try {
|
|
12783
|
+
const first = this.historyStore.firstUserText(sessionId);
|
|
12784
|
+
if (first && first.trim())
|
|
12785
|
+
session.title = deriveTitle(first);
|
|
12786
|
+
} catch {}
|
|
12787
|
+
}
|
|
12770
12788
|
this.persistSession(session);
|
|
12771
12789
|
if (opts?.warmup !== false) {
|
|
12772
12790
|
this.warmupSession(sessionId);
|
|
@@ -17587,6 +17605,9 @@ class AgyAcpService {
|
|
|
17587
17605
|
cancelSession(params) {
|
|
17588
17606
|
this.core.cancelSession(params);
|
|
17589
17607
|
}
|
|
17608
|
+
async shutdown() {
|
|
17609
|
+
await this.core.shutdown();
|
|
17610
|
+
}
|
|
17590
17611
|
promptSession(params, notifyClient, opts) {
|
|
17591
17612
|
const targetSession = this.core.sessions.get(params?.sessionId);
|
|
17592
17613
|
const version = params?.protocolVersion === 2 || params?.protocolVersion !== 1 && targetSession?.protocolVersion === 2 ? 2 : 1;
|
|
@@ -29,5 +29,11 @@ export declare class SessionHistoryStore {
|
|
|
29
29
|
appendTurn(sessionId: string, userText: string, assistantText?: string): void;
|
|
30
30
|
/** Read valid records and ignore incomplete/corrupt trailing lines. */
|
|
31
31
|
read(sessionId: string): SessionHistoryRecord[];
|
|
32
|
+
/**
|
|
33
|
+
* First user prompt text for backfilling list titles. Stops at the first
|
|
34
|
+
* valid user record instead of parsing the whole journal.
|
|
35
|
+
*/
|
|
36
|
+
firstUserText(sessionId: string): string | null;
|
|
37
|
+
private readUpTo;
|
|
32
38
|
delete(sessionId: string): void;
|
|
33
39
|
}
|