@openacp/cli 2026.410.2 → 2026.410.3

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/cli.js CHANGED
@@ -8561,32 +8561,48 @@ async function sessionRoutes(app, deps) {
8561
8561
  { preHandler: requireScopes("sessions:read") },
8562
8562
  async (request) => {
8563
8563
  const { sessionId } = SessionIdParamSchema.parse(request.params);
8564
- const session = deps.core.sessionManager.getSession(
8565
- decodeURIComponent(sessionId)
8566
- );
8567
- if (!session) {
8568
- throw new NotFoundError(
8569
- "SESSION_NOT_FOUND",
8570
- `Session "${sessionId}" not found`
8571
- );
8564
+ const id = decodeURIComponent(sessionId);
8565
+ const session = deps.core.sessionManager.getSession(id);
8566
+ if (session) {
8567
+ return {
8568
+ session: {
8569
+ id: session.id,
8570
+ agent: session.agentName,
8571
+ status: session.status,
8572
+ name: session.name ?? null,
8573
+ workspace: session.workingDirectory,
8574
+ createdAt: session.createdAt.toISOString(),
8575
+ dangerousMode: session.clientOverrides.bypassPermissions ?? false,
8576
+ queueDepth: session.queueDepth,
8577
+ promptRunning: session.promptRunning,
8578
+ threadId: session.threadId,
8579
+ channelId: session.channelId,
8580
+ agentSessionId: session.agentSessionId,
8581
+ configOptions: session.configOptions?.length ? session.configOptions : void 0,
8582
+ capabilities: session.agentCapabilities ?? null
8583
+ }
8584
+ };
8585
+ }
8586
+ const record = deps.core.sessionManager.getSessionRecord(id);
8587
+ if (!record) {
8588
+ throw new NotFoundError("SESSION_NOT_FOUND", `Session "${id}" not found`);
8572
8589
  }
8573
8590
  return {
8574
8591
  session: {
8575
- id: session.id,
8576
- agent: session.agentName,
8577
- status: session.status,
8578
- name: session.name ?? null,
8579
- workspace: session.workingDirectory,
8580
- createdAt: session.createdAt.toISOString(),
8581
- dangerousMode: session.clientOverrides.bypassPermissions ?? false,
8582
- queueDepth: session.queueDepth,
8583
- promptRunning: session.promptRunning,
8584
- threadId: session.threadId,
8585
- channelId: session.channelId,
8586
- agentSessionId: session.agentSessionId,
8587
- // ACP state
8588
- configOptions: session.configOptions?.length ? session.configOptions : void 0,
8589
- capabilities: session.agentCapabilities ?? null
8592
+ id: record.sessionId,
8593
+ agent: record.agentName,
8594
+ status: record.status,
8595
+ name: record.name ?? null,
8596
+ workspace: record.workingDir,
8597
+ createdAt: record.createdAt,
8598
+ dangerousMode: record.clientOverrides?.bypassPermissions ?? false,
8599
+ queueDepth: 0,
8600
+ promptRunning: false,
8601
+ threadId: null,
8602
+ channelId: record.channelId,
8603
+ agentSessionId: record.agentSessionId,
8604
+ configOptions: record.acpState?.configOptions?.length ? record.acpState.configOptions : void 0,
8605
+ capabilities: record.acpState?.agentCapabilities ?? null
8590
8606
  }
8591
8607
  };
8592
8608
  }
@@ -8721,7 +8737,7 @@ async function sessionRoutes(app, deps) {
8721
8737
  async (request, reply) => {
8722
8738
  const { sessionId: rawId } = SessionIdParamSchema.parse(request.params);
8723
8739
  const sessionId = decodeURIComponent(rawId);
8724
- const session = deps.core.sessionManager.getSession(sessionId);
8740
+ const session = await deps.core.getOrResumeSessionById(sessionId);
8725
8741
  if (!session) {
8726
8742
  throw new NotFoundError(
8727
8743
  "SESSION_NOT_FOUND",
@@ -8750,7 +8766,7 @@ async function sessionRoutes(app, deps) {
8750
8766
  async (request) => {
8751
8767
  const { sessionId: rawId } = SessionIdParamSchema.parse(request.params);
8752
8768
  const sessionId = decodeURIComponent(rawId);
8753
- const session = deps.core.sessionManager.getSession(sessionId);
8769
+ const session = await deps.core.getOrResumeSessionById(sessionId);
8754
8770
  if (!session) {
8755
8771
  throw new NotFoundError(
8756
8772
  "SESSION_NOT_FOUND",
@@ -8787,7 +8803,7 @@ async function sessionRoutes(app, deps) {
8787
8803
  async (request) => {
8788
8804
  const { sessionId: rawId } = SessionIdParamSchema.parse(request.params);
8789
8805
  const sessionId = decodeURIComponent(rawId);
8790
- const session = deps.core.sessionManager.getSession(sessionId);
8806
+ const session = await deps.core.getOrResumeSessionById(sessionId);
8791
8807
  if (!session) {
8792
8808
  throw new NotFoundError(
8793
8809
  "SESSION_NOT_FOUND",
@@ -8809,15 +8825,19 @@ async function sessionRoutes(app, deps) {
8809
8825
  const { sessionId: rawId } = SessionIdParamSchema.parse(request.params);
8810
8826
  const sessionId = decodeURIComponent(rawId);
8811
8827
  const session = deps.core.sessionManager.getSession(sessionId);
8812
- if (!session) {
8813
- throw new NotFoundError(
8814
- "SESSION_NOT_FOUND",
8815
- `Session "${sessionId}" not found`
8816
- );
8828
+ if (session) {
8829
+ return {
8830
+ configOptions: session.configOptions,
8831
+ clientOverrides: session.clientOverrides
8832
+ };
8833
+ }
8834
+ const record = deps.core.sessionManager.getSessionRecord(sessionId);
8835
+ if (!record) {
8836
+ throw new NotFoundError("SESSION_NOT_FOUND", `Session "${sessionId}" not found`);
8817
8837
  }
8818
8838
  return {
8819
- configOptions: session.configOptions,
8820
- clientOverrides: session.clientOverrides
8839
+ configOptions: record.acpState?.configOptions,
8840
+ clientOverrides: record.clientOverrides ?? {}
8821
8841
  };
8822
8842
  }
8823
8843
  );
@@ -8827,7 +8847,7 @@ async function sessionRoutes(app, deps) {
8827
8847
  async (request) => {
8828
8848
  const { sessionId: rawId, configId } = ConfigIdParamSchema.parse(request.params);
8829
8849
  const sessionId = decodeURIComponent(rawId);
8830
- const session = deps.core.sessionManager.getSession(sessionId);
8850
+ const session = await deps.core.getOrResumeSessionById(sessionId);
8831
8851
  if (!session) {
8832
8852
  throw new NotFoundError(
8833
8853
  "SESSION_NOT_FOUND",
@@ -8852,13 +8872,14 @@ async function sessionRoutes(app, deps) {
8852
8872
  const { sessionId: rawId } = SessionIdParamSchema.parse(request.params);
8853
8873
  const sessionId = decodeURIComponent(rawId);
8854
8874
  const session = deps.core.sessionManager.getSession(sessionId);
8855
- if (!session) {
8856
- throw new NotFoundError(
8857
- "SESSION_NOT_FOUND",
8858
- `Session "${sessionId}" not found`
8859
- );
8875
+ if (session) {
8876
+ return { clientOverrides: session.clientOverrides };
8860
8877
  }
8861
- return { clientOverrides: session.clientOverrides };
8878
+ const record = deps.core.sessionManager.getSessionRecord(sessionId);
8879
+ if (!record) {
8880
+ throw new NotFoundError("SESSION_NOT_FOUND", `Session "${sessionId}" not found`);
8881
+ }
8882
+ return { clientOverrides: record.clientOverrides ?? {} };
8862
8883
  }
8863
8884
  );
8864
8885
  app.put(
@@ -8867,7 +8888,7 @@ async function sessionRoutes(app, deps) {
8867
8888
  async (request) => {
8868
8889
  const { sessionId: rawId } = SessionIdParamSchema.parse(request.params);
8869
8890
  const sessionId = decodeURIComponent(rawId);
8870
- const session = deps.core.sessionManager.getSession(sessionId);
8891
+ const session = await deps.core.getOrResumeSessionById(sessionId);
8871
8892
  if (!session) {
8872
8893
  throw new NotFoundError(
8873
8894
  "SESSION_NOT_FOUND",
@@ -8933,8 +8954,8 @@ async function sessionRoutes(app, deps) {
8933
8954
  { preHandler: requireScopes("sessions:read") },
8934
8955
  async (request, reply) => {
8935
8956
  const { sessionId } = SessionIdParamSchema.parse(request.params);
8936
- const session = deps.core.sessionManager.getSession(sessionId);
8937
- if (!session) {
8957
+ const isKnown = deps.core.sessionManager.getSession(sessionId) ?? deps.core.sessionManager.getSessionRecord(sessionId);
8958
+ if (!isKnown) {
8938
8959
  throw new NotFoundError(
8939
8960
  "SESSION_NOT_FOUND",
8940
8961
  `Session "${sessionId}" not found`
@@ -8956,8 +8977,8 @@ async function sessionRoutes(app, deps) {
8956
8977
  async (request) => {
8957
8978
  const { sessionId: rawId } = SessionIdParamSchema.parse(request.params);
8958
8979
  const sessionId = decodeURIComponent(rawId);
8959
- const session = deps.core.sessionManager.getSession(sessionId);
8960
- if (!session) {
8980
+ const isKnown = deps.core.sessionManager.getSession(sessionId) ?? deps.core.sessionManager.getSessionRecord(sessionId);
8981
+ if (!isKnown) {
8961
8982
  throw new NotFoundError(
8962
8983
  "SESSION_NOT_FOUND",
8963
8984
  `Session "${sessionId}" not found`