@yitom/agy-acp-map 0.1.6 → 0.1.7

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.
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/dist/agy-acp-win-x64.exe
3
- size: 86637568 bytes
4
- sha256: a382550f80df362aea3dc5491aeeb3c12cc3a23dbd2ec4e24e3e93740d7b2352
3
+ size: 86638080 bytes
4
+ sha256: 4b22437f28bb0b65797110f6b47623dfaf8c98dea06593cb1cc4a0769c2c9d80
Binary file
package/dist/bin.js CHANGED
@@ -12488,7 +12488,7 @@ class SessionHistoryStore {
12488
12488
  var AGENT_INFO = {
12489
12489
  name: "agy-acp",
12490
12490
  title: "agy ACP (stream-json)",
12491
- version: "0.1.6"
12491
+ version: "0.1.7"
12492
12492
  };
12493
12493
  var BRIDGE_CAPABILITIES = {
12494
12494
  prompt: true,
@@ -12595,6 +12595,13 @@ function debugLog(msg) {
12595
12595
  }
12596
12596
 
12597
12597
  // src/core/session-core.ts
12598
+ var EMPTY_SESSION_MAX_AGE_MS = 60 * 60 * 1000;
12599
+ function deriveTitle(text, maxLen = 60) {
12600
+ const line = String(text || "").split(/\r?\n/).map((s) => s.trim()).find(Boolean) || "";
12601
+ const flat = line.replace(/\s+/g, " ");
12602
+ return flat.length > maxLen ? flat.slice(0, maxLen) + "…" : flat;
12603
+ }
12604
+
12598
12605
  class AgySessionCore {
12599
12606
  sessions = new Map;
12600
12607
  sessionStore;
@@ -13017,7 +13024,7 @@ class AgySessionCore {
13017
13024
  meta: this.sessionMeta(session)
13018
13025
  };
13019
13026
  }
13020
- async listSessions(params) {
13027
+ async listSessions(params, opts) {
13021
13028
  const filterCwd = params?.cwd;
13022
13029
  if (filterCwd !== undefined && filterCwd !== null) {
13023
13030
  if (typeof filterCwd !== "string" || !path10.isAbsolute(filterCwd)) {
@@ -13042,6 +13049,13 @@ class AgySessionCore {
13042
13049
  diskById.delete(id);
13043
13050
  }
13044
13051
  for (const r of diskById.values()) {
13052
+ if (!r.conversationId) {
13053
+ const updated = r.updatedAt ? new Date(r.updatedAt).getTime() : NaN;
13054
+ const now = opts?.now ?? Date.now();
13055
+ if (Number.isFinite(updated) && now - updated > EMPTY_SESSION_MAX_AGE_MS) {
13056
+ continue;
13057
+ }
13058
+ }
13045
13059
  allSessions.push({
13046
13060
  sessionId: r.sessionId,
13047
13061
  cwd: r.cwd,
@@ -13243,6 +13257,9 @@ class AgySessionCore {
13243
13257
  }
13244
13258
  }
13245
13259
  this.persistTurnHistory(sessionId, text, visibleAssistantText, stopReason, historyTurnEligible);
13260
+ if (!session.title && text.trim()) {
13261
+ session.title = deriveTitle(text);
13262
+ }
13246
13263
  this.persistSession(session);
13247
13264
  if (process.env.AGY_ACP_KEEP_STAGING !== "1" && session.stagedFiles.length) {
13248
13265
  for (const f of session.stagedFiles) {
@@ -13452,8 +13469,8 @@ class AgyAcpV1Service {
13452
13469
  ...meta ? { _meta: meta } : {}
13453
13470
  };
13454
13471
  }
13455
- async listSessions(params) {
13456
- return this.core.listSessions(params);
13472
+ async listSessions(params, opts) {
13473
+ return this.core.listSessions(params, opts);
13457
13474
  }
13458
13475
  async closeSession(params) {
13459
13476
  return this.core.closeSession(params);
@@ -13565,8 +13582,8 @@ class AgyAcpV2Service {
13565
13582
  ...meta ? { _meta: meta } : {}
13566
13583
  };
13567
13584
  }
13568
- async listSessions(params) {
13569
- return this.core.listSessions(params);
13585
+ async listSessions(params, opts) {
13586
+ return this.core.listSessions(params, opts);
13570
13587
  }
13571
13588
  async closeSession(params) {
13572
13589
  return this.core.closeSession(params);
@@ -6,6 +6,11 @@ export interface SessionCoreOptions {
6
6
  sessionStore?: SessionStore | string;
7
7
  historyStore?: SessionHistoryStore | string;
8
8
  }
9
+ /** Rows without any completed turn older than this are hidden from
10
+ * session/list (still resumable/deletable by id — the store keeps them). */
11
+ export declare const EMPTY_SESSION_MAX_AGE_MS: number;
12
+ /** First user prompt collapsed to one line, capped for list display. */
13
+ export declare function deriveTitle(text: string, maxLen?: number): string;
9
14
  export declare class AgySessionCore {
10
15
  readonly sessions: Map<string, SdkSession>;
11
16
  readonly sessionStore: SessionStore;
@@ -54,7 +59,9 @@ export declare class AgySessionCore {
54
59
  configOptions: any[];
55
60
  meta?: Record<string, unknown>;
56
61
  }>;
57
- listSessions(params?: any): Promise<{
62
+ listSessions(params?: any, opts?: {
63
+ now?: number;
64
+ }): Promise<{
58
65
  sessions: any[];
59
66
  nextCursor?: string | null;
60
67
  }>;
package/dist/index.js CHANGED
@@ -12275,7 +12275,7 @@ class SessionHistoryStore {
12275
12275
  var AGENT_INFO = {
12276
12276
  name: "agy-acp",
12277
12277
  title: "agy ACP (stream-json)",
12278
- version: "0.1.6"
12278
+ version: "0.1.7"
12279
12279
  };
12280
12280
  var BRIDGE_CAPABILITIES = {
12281
12281
  prompt: true,
@@ -12395,6 +12395,13 @@ function installFileLogging() {
12395
12395
  }
12396
12396
 
12397
12397
  // src/core/session-core.ts
12398
+ var EMPTY_SESSION_MAX_AGE_MS = 60 * 60 * 1000;
12399
+ function deriveTitle(text, maxLen = 60) {
12400
+ const line = String(text || "").split(/\r?\n/).map((s) => s.trim()).find(Boolean) || "";
12401
+ const flat = line.replace(/\s+/g, " ");
12402
+ return flat.length > maxLen ? flat.slice(0, maxLen) + "…" : flat;
12403
+ }
12404
+
12398
12405
  class AgySessionCore {
12399
12406
  sessions = new Map;
12400
12407
  sessionStore;
@@ -12817,7 +12824,7 @@ class AgySessionCore {
12817
12824
  meta: this.sessionMeta(session)
12818
12825
  };
12819
12826
  }
12820
- async listSessions(params) {
12827
+ async listSessions(params, opts) {
12821
12828
  const filterCwd = params?.cwd;
12822
12829
  if (filterCwd !== undefined && filterCwd !== null) {
12823
12830
  if (typeof filterCwd !== "string" || !path10.isAbsolute(filterCwd)) {
@@ -12842,6 +12849,13 @@ class AgySessionCore {
12842
12849
  diskById.delete(id);
12843
12850
  }
12844
12851
  for (const r of diskById.values()) {
12852
+ if (!r.conversationId) {
12853
+ const updated = r.updatedAt ? new Date(r.updatedAt).getTime() : NaN;
12854
+ const now = opts?.now ?? Date.now();
12855
+ if (Number.isFinite(updated) && now - updated > EMPTY_SESSION_MAX_AGE_MS) {
12856
+ continue;
12857
+ }
12858
+ }
12845
12859
  allSessions.push({
12846
12860
  sessionId: r.sessionId,
12847
12861
  cwd: r.cwd,
@@ -13043,6 +13057,9 @@ class AgySessionCore {
13043
13057
  }
13044
13058
  }
13045
13059
  this.persistTurnHistory(sessionId, text, visibleAssistantText, stopReason, historyTurnEligible);
13060
+ if (!session.title && text.trim()) {
13061
+ session.title = deriveTitle(text);
13062
+ }
13046
13063
  this.persistSession(session);
13047
13064
  if (process.env.AGY_ACP_KEEP_STAGING !== "1" && session.stagedFiles.length) {
13048
13065
  for (const f of session.stagedFiles) {
@@ -13252,8 +13269,8 @@ class AgyAcpV1Service {
13252
13269
  ...meta ? { _meta: meta } : {}
13253
13270
  };
13254
13271
  }
13255
- async listSessions(params) {
13256
- return this.core.listSessions(params);
13272
+ async listSessions(params, opts) {
13273
+ return this.core.listSessions(params, opts);
13257
13274
  }
13258
13275
  async closeSession(params) {
13259
13276
  return this.core.closeSession(params);
@@ -13365,8 +13382,8 @@ class AgyAcpV2Service {
13365
13382
  ...meta ? { _meta: meta } : {}
13366
13383
  };
13367
13384
  }
13368
- async listSessions(params) {
13369
- return this.core.listSessions(params);
13385
+ async listSessions(params, opts) {
13386
+ return this.core.listSessions(params, opts);
13370
13387
  }
13371
13388
  async closeSession(params) {
13372
13389
  return this.core.closeSession(params);
@@ -17583,7 +17600,9 @@ __export(exports_core3, {
17583
17600
  AgySessionCore: () => AgySessionCore,
17584
17601
  AsyncSerialQueue: () => AsyncSerialQueue,
17585
17602
  BRIDGE_CAPABILITIES: () => BRIDGE_CAPABILITIES,
17586
- catalogChoices: () => catalogChoices
17603
+ EMPTY_SESSION_MAX_AGE_MS: () => EMPTY_SESSION_MAX_AGE_MS,
17604
+ catalogChoices: () => catalogChoices,
17605
+ deriveTitle: () => deriveTitle
17587
17606
  });
17588
17607
  // src/v1/index.ts
17589
17608
  var exports_v1 = {};
@@ -7,7 +7,9 @@ export declare class AgyAcpV1Service {
7
7
  resumeSession(params: any): Promise<any>;
8
8
  loadSession(params: any, notifyClient: (update: any) => Promise<void> | void): Promise<any>;
9
9
  setConfigOption(params: any): Promise<any>;
10
- listSessions(params?: any): Promise<any>;
10
+ listSessions(params?: any, opts?: {
11
+ now?: number;
12
+ }): Promise<any>;
11
13
  closeSession(params: any): Promise<any>;
12
14
  deleteSession(params: any): Promise<any>;
13
15
  cancelSession(params: any): void;
@@ -6,7 +6,9 @@ export declare class AgyAcpV2Service {
6
6
  newSession(params: any): Promise<any>;
7
7
  resumeSession(params: any, notifyClient?: (update: any) => Promise<void> | void): Promise<any>;
8
8
  setConfigOption(params: any): Promise<any>;
9
- listSessions(params?: any): Promise<any>;
9
+ listSessions(params?: any, opts?: {
10
+ now?: number;
11
+ }): Promise<any>;
10
12
  closeSession(params: any): Promise<any>;
11
13
  deleteSession(params: any): Promise<any>;
12
14
  cancelSession(params: any): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yitom/agy-acp-map",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },