@alwith-ai/dsh-agent 0.2.1 → 0.2.2

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/bridge.ts +24 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alwith-ai/dsh-agent",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "ACP v2 agent built on DeepSeek Harness: fixed plugin compositions (standard / minimal / anchored / code / cordis), streaming turns with direct state reporting, permissions, resume with replay, multi-provider credentials and subscription login",
5
5
  "license": "MIT",
6
6
  "repository": {
package/src/bridge.ts CHANGED
@@ -22,6 +22,7 @@
22
22
  */
23
23
 
24
24
  import type { Context } from "@deepseek-ai/cordis"
25
+ import packageJson from "../package.json" with { type: "json" }
25
26
  import { randomUUID } from "node:crypto"
26
27
  import { isAbsolute } from "node:path"
27
28
  import { Readable, Writable } from "node:stream"
@@ -36,6 +37,8 @@ import {
36
37
  type CancelSessionNotification,
37
38
  type CloseSessionRequest,
38
39
  type CloseSessionResponse,
40
+ type ListSessionsRequest,
41
+ type ListSessionsResponse,
39
42
  type CompactionId,
40
43
  type InitializeResponse,
41
44
  type NewSessionRequest,
@@ -612,7 +615,7 @@ export function apply(ctx: Context, config: AcpConfig): void {
612
615
  .onRequest("initialize", (): InitializeResponse => {
613
616
  return {
614
617
  protocolVersion: ACP_PROTOCOL_VERSION,
615
- info: { name: "dsh-agent", title: "ALwith dsh bridge", version: "0.1.0" },
618
+ info: { name: "dsh-agent", title: "ALwith dsh bridge", version: packageJson.version },
616
619
  authMethods: [],
617
620
  capabilities: { session: { prompt: {} } },
618
621
  }
@@ -645,6 +648,26 @@ export function apply(ctx: Context, config: AcpConfig): void {
645
648
  if (record === undefined) throw internalError("session record vanished during session/new")
646
649
  return { sessionId, configOptions: await modelConfigOptions(record) }
647
650
  })
651
+ // v2 baseline: session/list is part of the `session: {}` surface, no capability key.
652
+ // Headers come from dsh's own persistence (the on-disk format stays private to it);
653
+ // `cwd` narrows to sessions started in that workspace, like the cli.
654
+ .onRequest("session/list", async (context): Promise<ListSessionsResponse> => {
655
+ assertOpen()
656
+ const params: ListSessionsRequest = context.params
657
+ const persistence = ctx.get("sessionPersistence")
658
+ if (persistence === undefined) throw internalError("session persistence is not mounted")
659
+ const headers = await persistence.list()
660
+ const sessions = headers
661
+ .filter(header => params.cwd === undefined || params.cwd === null || header.cwd === params.cwd)
662
+ .sort((a, b) => b.createdAt - a.createdAt)
663
+ .map(header => {
664
+ // Every bridge session is created with meta.cwd; a header without one is a
665
+ // persistence anomaly, not a session the host could resume.
666
+ if (header.cwd === undefined) throw internalError(`persisted session ${header.id} has no cwd`)
667
+ return { sessionId: header.id, cwd: header.cwd, updatedAt: new Date(header.createdAt).toISOString() }
668
+ })
669
+ return { sessions, nextCursor: null }
670
+ })
648
671
  .onRequest("session/resume", async (context): Promise<ResumeSessionResponse> => {
649
672
  assertOpen()
650
673
  const params: ResumeSessionRequest = context.params