@harness-gw/sdk 0.16.1 → 0.17.0

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/README.md CHANGED
@@ -63,7 +63,7 @@ You need a running harness. Hermes is the primary one; see
63
63
  docker run --rm \
64
64
  -v "$PWD/config.yaml:/run/harness-gw/config.yaml:ro" \
65
65
  -v "$PWD/hermes-token:/run/secrets/hermes-token:ro" \
66
- ghcr.io/almogbaku/harness-gw:0.16.1 \
66
+ ghcr.io/almogbaku/harness-gw:0.17.0 \
67
67
  config check --config /run/harness-gw/config.yaml
68
68
  ```
69
69
 
@@ -73,7 +73,7 @@ You need a running harness. Hermes is the primary one; see
73
73
  docker run --rm -p 127.0.0.1:4100:4100 \
74
74
  -v "$PWD/config.yaml:/run/harness-gw/config.yaml:ro" \
75
75
  -v "$PWD/hermes-token:/run/secrets/hermes-token:ro" \
76
- ghcr.io/almogbaku/harness-gw:0.16.1 \
76
+ ghcr.io/almogbaku/harness-gw:0.17.0 \
77
77
  serve --config /run/harness-gw/config.yaml
78
78
  ```
79
79
 
@@ -97,7 +97,7 @@ Without Docker, run the same CLI from a checkout with `bun run serve --config
97
97
  ## Use the SDK
98
98
 
99
99
  ```bash
100
- npm install @harness-gw/sdk @agentclientprotocol/sdk @modelcontextprotocol/core zod
100
+ npm install @harness-gw/sdk @agentclientprotocol/sdk@2.7.0 @modelcontextprotocol/core zod
101
101
  ```
102
102
 
103
103
  ```ts
@@ -1029,6 +1029,9 @@ var HgwHistoryPageResponseMetaSchema2 = readObject({
1029
1029
  var HgwHistoryPageTagSchema2 = readObject({
1030
1030
  historyPage: readObject({ cursor: z3.string().min(1).max(256) }).optional()
1031
1031
  });
1032
+ var HgwSessionSetupResponseMetaSchema2 = readObject({
1033
+ capabilities: SessionWorkspaceCapabilitiesResponseSchema2
1034
+ });
1032
1035
  var HgwSessionResumeResponseMetaSchema2 = readObject({
1033
1036
  position: readObject({
1034
1037
  turnId: IdentifierSchema2,
@@ -1289,4 +1292,4 @@ var PushUnregistrationSchema2 = z4.strictObject({
1289
1292
  endpoint: z4.string().max(2048)
1290
1293
  });
1291
1294
 
1292
- export { CallToolResultSchema2, EmptyResultSchema2, ReadResourceResultSchema2, McpUiCspSchema2, isMcpAppCspDomain2, McpUiPermissionsSchema2, McpAppFilesSchema2, McpUiDomainSchema2, McpAppViewSchema2, viewerFileResult2, McpAppToolCallRequestSchema2, McpAppResourceReadRequestSchema2, McpAppModelContextRequestSchema2, MAX_MCP_APP_FILE_BYTES2, McpAppFileReadFailureSchema2, McpAppFileReadErrorDataSchema2, MCP_APP_SANDBOX_PATH2, isMcpAppPolicyOrigin2, appliedMcpAppCsp2, mcpAppSandboxPolicy2, SESSION_CATALOG_MAX_WINDOW2, RuntimeAuthStateSchema2, OperationCapabilitySchema2, RuntimeInfoSchema2, AgentAvatarSchema2, AgentCatalogEntrySchema2, AgentCatalogResponseSchema2, AgentUpdateFields2, writesAgentField2, AgentUpdateRequestSchema2, AgentUpdateResponseSchema2, SessionStatusSchema2, SessionPlatformSchema2, SessionSchema2, newestSessionFirst2, SessionCatalogResponseSchema2, StopReason2, ToolKind2, ToolLocationSchema2, DiffOperation2, DiffChangeSchema2, ToolDiffSchema2, SessionMessageErrorStatusSchema2, SessionMessageSchema2, SessionPlanActivityMessageSchema2, SessionCompactionActivityMessageSchema2, SessionChildActivityMessageSchema2, SessionActivityMessageSchema2, SessionHistoryResponseSchema2, SessionCreateRequestSchema2, SessionCreateResponseSchema2, SessionPatchRequestSchema2, TurnStopResponseSchema2, TurnSteerRequestSchema2, TurnSteerResponseSchema2, SlashCommandSchema2, MAX_SLASH_COMMANDS2, INTERACTION_PROTOCOL2, SessionWorkspaceCapabilitiesResponseSchema2, GuestRuntimeCapabilitiesResponseSchema2, SessionModelsResponseSchema2, SessionModelUpdateRequestSchema2, SessionModelUpdateResponseSchema2, SessionContextResponseSchema2, ArtifactDescriptorSchema2, SessionTodosResponseSchema2, SessionActivityResponseSchema2, SessionAttachmentStageRequestSchema2, SessionAttachmentStageResponseSchema2, SessionAudioResponseSchema2, SessionTranscriptionRequestSchema2, SessionTranscriptionResponseSchema2, SessionSpeechRequestSchema2, ErrorResponseSchema2, ACP_PROTOCOL_VERSION2, HGW_API_PREFIX2, HGW_ACP_PATH2, HGW_ACP_AGENTS_PATH2, hgwAcpAgentPath2, HGW_META_KEY2, HGW_EXTENSION_VERSION2, HGW_AUTH_METHOD_INVITE2, HGW_ATTACHMENT_URI_SCHEME2, HGW_ARTIFACT_URI_SCHEME2, HGW_METHODS2, HGW_PERMISSION_KIND_SESSION2, HGW_PLAN_ID2, HGW_JSONRPC_ERRORS2, HGW_MAX_FRAME_BYTES2, IdentifierSchema2, HgwExtensionsSchema2, HgwClientCapabilitiesMetaSchema2, HgwInitializeMetaSchema2, HgwLoginMetaSchema2, HgwSessionNewMetaSchema2, HgwSessionListMetaSchema2, HgwSessionSearchMetaSchema2, HgwSessionSearchResponseSchema2, HgwSessionInfoMetaSchema2, HgwSessionResumeMetaSchema2, HGW_REPLAY_POSITION2, HgwReplayPositionSchema2, HGW_REPLAY_BEFORE2, HgwReplayBeforeSchema2, HgwHistoryCursorSchema2, HgwHistoryPageResponseMetaSchema2, HgwHistoryPageTagSchema2, HgwSessionResumeResponseMetaSchema2, HgwPromptMetaSchema2, HgwSessionUpdateRequestSchema2, HgwSessionPartRequestSchema2, HgwSteerRequestSchema2, HgwSteerResponseSchema2, HgwFocusRequestSchema2, HgwAgentsListResponseSchema2, HgwAgentUpdateRequestSchema2, HgwAgentUpdateResponseSchema2, HgwTurnMetaSchema2, HgwNoticeMetaSchema2, HgwMessageMetaSchema2, HgwCostSchema2, HgwChildSessionMetaSchema2, HgwStateMetaSchema2, HgwChunkMetaSchema2, HgwToolCallMetaSchema2, HgwPlanMetaSchema2, HgwUsageMetaSchema2, HgwAvailableCommandsMetaSchema2, HgwPermissionMetaSchema2, HgwQuestionOptionSchema2, HgwQuestionSchema2, HgwElicitationMetaSchema2, HgwArtifactDescriptorSchema2, formatArtifactUri2, parseArtifactUri2, HgwComposerPrefillNotificationSchema2, HgwErrorNotificationSchema2, HGW_REQUEST_TEXT_MAX2, HgwActivityNotificationSchema2, PushCategorySchema2, categoryOf2, PushLocaleSchema2, PRESENCE_IDLE_MS2, PRESENCE_HEARTBEAT_MS2, PRESENCE_GRACE_MS2, PRESENCE_CLOSED_GRACE_MS2, COALESCE_WINDOW_MS2, PUSH_TEXT_LIMITS2, PushMessageSchema2, PushCategoriesSchema2, PushSubscriptionJsonSchema2, PushInfoSchema2, PushRegistrationSchema2, PushUnregistrationSchema2 };
1295
+ export { CallToolResultSchema2, EmptyResultSchema2, ReadResourceResultSchema2, McpUiCspSchema2, isMcpAppCspDomain2, McpUiPermissionsSchema2, McpAppFilesSchema2, McpUiDomainSchema2, McpAppViewSchema2, viewerFileResult2, McpAppToolCallRequestSchema2, McpAppResourceReadRequestSchema2, McpAppModelContextRequestSchema2, MAX_MCP_APP_FILE_BYTES2, McpAppFileReadFailureSchema2, McpAppFileReadErrorDataSchema2, MCP_APP_SANDBOX_PATH2, isMcpAppPolicyOrigin2, appliedMcpAppCsp2, mcpAppSandboxPolicy2, SESSION_CATALOG_MAX_WINDOW2, RuntimeAuthStateSchema2, OperationCapabilitySchema2, RuntimeInfoSchema2, AgentAvatarSchema2, AgentCatalogEntrySchema2, AgentCatalogResponseSchema2, AgentUpdateFields2, writesAgentField2, AgentUpdateRequestSchema2, AgentUpdateResponseSchema2, SessionStatusSchema2, SessionPlatformSchema2, SessionSchema2, newestSessionFirst2, SessionCatalogResponseSchema2, StopReason2, ToolKind2, ToolLocationSchema2, DiffOperation2, DiffChangeSchema2, ToolDiffSchema2, SessionMessageErrorStatusSchema2, SessionMessageSchema2, SessionPlanActivityMessageSchema2, SessionCompactionActivityMessageSchema2, SessionChildActivityMessageSchema2, SessionActivityMessageSchema2, SessionHistoryResponseSchema2, SessionCreateRequestSchema2, SessionCreateResponseSchema2, SessionPatchRequestSchema2, TurnStopResponseSchema2, TurnSteerRequestSchema2, TurnSteerResponseSchema2, SlashCommandSchema2, MAX_SLASH_COMMANDS2, INTERACTION_PROTOCOL2, SessionWorkspaceCapabilitiesResponseSchema2, GuestRuntimeCapabilitiesResponseSchema2, SessionModelsResponseSchema2, SessionModelUpdateRequestSchema2, SessionModelUpdateResponseSchema2, SessionContextResponseSchema2, ArtifactDescriptorSchema2, SessionTodosResponseSchema2, SessionActivityResponseSchema2, SessionAttachmentStageRequestSchema2, SessionAttachmentStageResponseSchema2, SessionAudioResponseSchema2, SessionTranscriptionRequestSchema2, SessionTranscriptionResponseSchema2, SessionSpeechRequestSchema2, ErrorResponseSchema2, ACP_PROTOCOL_VERSION2, HGW_API_PREFIX2, HGW_ACP_PATH2, HGW_ACP_AGENTS_PATH2, hgwAcpAgentPath2, HGW_META_KEY2, HGW_EXTENSION_VERSION2, HGW_AUTH_METHOD_INVITE2, HGW_ATTACHMENT_URI_SCHEME2, HGW_ARTIFACT_URI_SCHEME2, HGW_METHODS2, HGW_PERMISSION_KIND_SESSION2, HGW_PLAN_ID2, HGW_JSONRPC_ERRORS2, HGW_MAX_FRAME_BYTES2, IdentifierSchema2, HgwExtensionsSchema2, HgwClientCapabilitiesMetaSchema2, HgwInitializeMetaSchema2, HgwLoginMetaSchema2, HgwSessionNewMetaSchema2, HgwSessionListMetaSchema2, HgwSessionSearchMetaSchema2, HgwSessionSearchResponseSchema2, HgwSessionInfoMetaSchema2, HgwSessionResumeMetaSchema2, HGW_REPLAY_POSITION2, HgwReplayPositionSchema2, HGW_REPLAY_BEFORE2, HgwReplayBeforeSchema2, HgwHistoryCursorSchema2, HgwHistoryPageResponseMetaSchema2, HgwHistoryPageTagSchema2, HgwSessionSetupResponseMetaSchema2, HgwSessionResumeResponseMetaSchema2, HgwPromptMetaSchema2, HgwSessionUpdateRequestSchema2, HgwSessionPartRequestSchema2, HgwSteerRequestSchema2, HgwSteerResponseSchema2, HgwFocusRequestSchema2, HgwAgentsListResponseSchema2, HgwAgentUpdateRequestSchema2, HgwAgentUpdateResponseSchema2, HgwTurnMetaSchema2, HgwNoticeMetaSchema2, HgwMessageMetaSchema2, HgwCostSchema2, HgwChildSessionMetaSchema2, HgwStateMetaSchema2, HgwChunkMetaSchema2, HgwToolCallMetaSchema2, HgwPlanMetaSchema2, HgwUsageMetaSchema2, HgwAvailableCommandsMetaSchema2, HgwPermissionMetaSchema2, HgwQuestionOptionSchema2, HgwQuestionSchema2, HgwElicitationMetaSchema2, HgwArtifactDescriptorSchema2, formatArtifactUri2, parseArtifactUri2, HgwComposerPrefillNotificationSchema2, HgwErrorNotificationSchema2, HGW_REQUEST_TEXT_MAX2, HgwActivityNotificationSchema2, PushCategorySchema2, categoryOf2, PushLocaleSchema2, PRESENCE_IDLE_MS2, PRESENCE_HEARTBEAT_MS2, PRESENCE_GRACE_MS2, PRESENCE_CLOSED_GRACE_MS2, COALESCE_WINDOW_MS2, PUSH_TEXT_LIMITS2, PushMessageSchema2, PushCategoriesSchema2, PushSubscriptionJsonSchema2, PushInfoSchema2, PushRegistrationSchema2, PushUnregistrationSchema2 };
@@ -1,4 +1,4 @@
1
- import { SessionConfigOption, type Usage } from "@agentclientprotocol/sdk/experimental/v2";
1
+ import { SessionConfigOption, type Usage } from "@agentclientprotocol/sdk/experimental/v2/unstable";
2
2
  import { type HgwCost } from "../protocol/acp.js";
3
3
  import type { ComposerModelFeed, ComposerTurnUsage } from "./workspace.js";
4
4
  import type { HgwModelChoices } from "./hgw-client.js";
@@ -1,4 +1,4 @@
1
- import { type SessionInfo } from "@agentclientprotocol/sdk/experimental/v2";
1
+ import { type SessionInfo } from "@agentclientprotocol/sdk/experimental/v2/unstable";
2
2
  import { type HgwSessionInfoMeta } from "../protocol/acp.js";
3
3
  import type { SessionMetadata, SessionStatus, TodoItem, WorkspaceActivityEvent } from "./workspace.js";
4
4
  import type { Logger } from "../lifecycle/index.js";
@@ -1,4 +1,4 @@
1
- import type { SessionInfo } from "@agentclientprotocol/sdk/experimental/v2";
1
+ import type { SessionInfo } from "@agentclientprotocol/sdk/experimental/v2/unstable";
2
2
  import { type Clock, type Logger } from "../lifecycle/index.js";
3
3
  import type { SessionModelUpdateRequest, SessionModelUpdateResponse } from "../protocol/index.js";
4
4
  import type { AgentUpdate, SessionActionCapabilities, SessionCreationOptions, SessionSearchResult } from "./workspace.js";
@@ -105,6 +105,12 @@ export declare function createAcpWorkspaceClient({ connection, rest, agentIdFor,
105
105
  createSession(agentId: string, options?: SessionCreationOptions): Promise<{
106
106
  sessionId: string;
107
107
  }>;
108
+ /**
109
+ * Ends a Session nothing will use, as an abandoned draft's, stopping its
110
+ * work; one the gateway no longer has resolves as closed. A hold on it
111
+ * stays the holder's to release.
112
+ */
113
+ closeSession: (sessionId: string) => Promise<void>;
108
114
  subscribeSession: (sessionId: string) => () => void;
109
115
  markSessionRead(sessionId: string): Promise<void>;
110
116
  /** The row leads the write, so a refused pin has to be taken back. */
@@ -1,7 +1,7 @@
1
- import { type AgentApp } from "@agentclientprotocol/sdk/experimental/v2";
1
+ import { SessionUpdate, type AgentApp } from "@agentclientprotocol/sdk/experimental/v2/unstable";
2
2
  import { type WebSocketConstructor } from "@agentclientprotocol/sdk/experimental/ws-client";
3
3
  import { createOwner, type Clock, type Logger } from "../lifecycle/index.js";
4
- import type { AcpConnection } from "./types.js";
4
+ import type { AcpConnection, AcpSessionSetup } from "./types.js";
5
5
  /** Where the client logs when its caller passes no logger. */
6
6
  export declare const SILENT_LOGGER: Logger;
7
7
  /**
@@ -50,6 +50,13 @@ export type AcpConnectionOptions = {
50
50
  });
51
51
  /** Whether the gateway refused an invitation it cannot redeem. */
52
52
  export declare function isAuthenticationRequired(error: unknown): boolean;
53
+ /**
54
+ * What a `config_option_update` or `available_commands_update` reports of its
55
+ * Session's setup, from the update and its `_meta.hgw`; undefined for any
56
+ * other update. Capabilities this client cannot read are left out, never the
57
+ * commands they travel with.
58
+ */
59
+ export declare function setupOfUpdate(update: SessionUpdate, meta: unknown): AcpSessionSetup | undefined;
53
60
  /** One of the gateway's ACP listener paths as a WebSocket URL from `base`. */
54
61
  export declare function acpSocketUrl(path: string, base: string): string;
55
62
  type ConnectionEvent = {
@@ -1,6 +1,6 @@
1
1
  /** `@harness-gw/sdk`: the browser client for the gateway's ACP and HTTP APIs. */
2
2
  export { acpSocketUrl, createAcpConnection, isAuthenticationRequired, SILENT_LOGGER, type AcpConnectionOptions, type OwnerInspector, type PageSignals, } from "./connection.js";
3
- export type { AcpConnection, AcpConnectionOutage, AcpConnectionStatus, AcpHistoryPage, AcpPendingRequest, AcpSessionListener, AcpSessionReplayListener, AcpSessionState, AcpSessionUpdateListener, } from "./types.js";
3
+ export type { AcpConnection, AcpConnectionOutage, AcpConnectionStatus, AcpHistoryPage, AcpPendingRequest, AcpSessionListener, AcpSessionReplayListener, AcpSessionSetup, AcpSessionState, AcpSessionUpdateListener, } from "./types.js";
4
4
  export { createAcpWorkspaceClient, type AcpWorkspaceClient, type AcpWorkspaceClientOptions, } from "./acp-workspace-client.js";
5
5
  export { createAcpComposerStore, foldTurnUsage, projectModels, type AcpModelProjection, type AcpTurnUsage, } from "./acp-workspace-client-composer.js";
6
6
  export { createAcpApprovals, isSettledApproval, type AcpApproval, type AcpApprovalOption, type AcpApprovals, } from "./acp-approvals.js";
@@ -30,6 +30,7 @@ import {
30
30
  HGW_REPLAY_BEFORE2,
31
31
  HgwHistoryPageResponseMetaSchema2,
32
32
  HgwHistoryPageTagSchema2,
33
+ HgwSessionSetupResponseMetaSchema2,
33
34
  HgwSessionResumeResponseMetaSchema2,
34
35
  HgwSteerResponseSchema2,
35
36
  HgwAgentsListResponseSchema2,
@@ -54,7 +55,7 @@ import {
54
55
  methods as methods2,
55
56
  RequestError,
56
57
  SessionUpdate
57
- } from "@agentclientprotocol/sdk/experimental/v2";
58
+ } from "@agentclientprotocol/sdk/experimental/v2/unstable";
58
59
  import {
59
60
  createWebSocketStream
60
61
  } from "@agentclientprotocol/sdk/experimental/ws-client";
@@ -305,7 +306,7 @@ var CAPACITY_BACKOFF = { minMs: 30000, maxMs: 60000 };
305
306
  // client/log.ts
306
307
  import {
307
308
  methods
308
- } from "@agentclientprotocol/sdk/experimental/v2";
309
+ } from "@agentclientprotocol/sdk/experimental/v2/unstable";
309
310
  import pino from "pino/browser.js";
310
311
  var DEBUG_PARAM = "debug";
311
312
  var DEBUG_VALUE = "acp";
@@ -359,10 +360,7 @@ function frameFields(direction, message) {
359
360
  };
360
361
  }
361
362
  function loggedStream(stream, logger) {
362
- const log = (direction, frame) => {
363
- for (const message of [frame].flat())
364
- logger.debug(frameFields(direction, message), "acp.frame");
365
- };
363
+ const log = (direction, frame) => logger.debug(frameFields(direction, frame), "acp.frame");
366
364
  const writer = stream.writable.getWriter();
367
365
  return {
368
366
  readable: stream.readable.pipeThrough(new TransformStream({
@@ -457,6 +455,25 @@ function hgwMetaOf(meta) {
457
455
  const parsed = HgwEnvelopeSchema.safeParse(meta);
458
456
  return parsed.success ? parsed.data[HGW_META_KEY2] : undefined;
459
457
  }
458
+ function setupOfUpdate(update, meta) {
459
+ if (SessionUpdate.isConfigOptionUpdate(update))
460
+ return { configOptions: update.configOptions };
461
+ if (!SessionUpdate.isAvailableCommandsUpdate(update))
462
+ return;
463
+ const capabilities = HgwAvailableCommandsMetaSchema2.safeParse(meta).data?.capabilities;
464
+ return {
465
+ availableCommands: update.availableCommands,
466
+ ...capabilities ? { capabilities } : {}
467
+ };
468
+ }
469
+ function setupOfAnswer(answer) {
470
+ const capabilities = HgwSessionSetupResponseMetaSchema2.safeParse(hgwMetaOf(answer._meta)).data?.capabilities;
471
+ return {
472
+ configOptions: answer.configOptions ?? [],
473
+ availableCommands: answer.availableCommands ?? [],
474
+ ...capabilities ? { capabilities } : {}
475
+ };
476
+ }
460
477
  function acpSocketUrl(path, base) {
461
478
  const url = new URL(path, base);
462
479
  url.protocol = url.protocol === "https:" ? "wss:" : "ws:";
@@ -847,6 +864,9 @@ function createAcpConnection(options) {
847
864
  deliverChild(open, params.sessionId, params.update, meta);
848
865
  return;
849
866
  }
867
+ const reported = setupOfUpdate(params.update, meta);
868
+ if (reported)
869
+ report(open, reported);
850
870
  for (const { listener } of open.listeners)
851
871
  callEach(listener.update ? [listener.update] : [], logger, "acp.listener.failed", params.update, meta);
852
872
  }).onRequest(methods2.client.session.requestPermission, ({ params, signal }) => permissionRequest(params, signal)).onRequest(methods2.client.elicitation.create, ({ params, signal }) => elicitationRequest(params, signal));
@@ -1002,6 +1022,7 @@ function createAcpConnection(options) {
1002
1022
  owners.set(sessionId, agentId);
1003
1023
  if (meta.history)
1004
1024
  open.history = meta.history;
1025
+ hand(open, report(open, setupOfAnswer(response)));
1005
1026
  if (fromStart) {
1006
1027
  open.replayed = true;
1007
1028
  replayed = true;
@@ -1026,6 +1047,16 @@ function createAcpConnection(options) {
1026
1047
  const settle = listener.replay?.();
1027
1048
  return settle ? [settle] : [];
1028
1049
  }
1050
+ function report(open, reported) {
1051
+ open.setup = { ...open.setup, ...reported };
1052
+ return reported;
1053
+ }
1054
+ function hand(open, setup, listeners = open.listeners) {
1055
+ if (Object.keys(setup).length === 0)
1056
+ return;
1057
+ for (const { listener } of listeners)
1058
+ callEach(listener.setup ? [listener.setup] : [], logger, "acp.listener.failed", setup);
1059
+ }
1029
1060
  function notOpen() {
1030
1061
  return new Error("The Session is not open on this ACP connection");
1031
1062
  }
@@ -1089,6 +1120,7 @@ function createAcpConnection(options) {
1089
1120
  known.listeners.add(subscription);
1090
1121
  if (known.replaying && !known.replaying.delivered)
1091
1122
  known.replaying.settles.push(...settleOf(subscription));
1123
+ hand(known, known.setup, [subscription]);
1092
1124
  return () => leave(sessionId, known, subscription);
1093
1125
  }
1094
1126
  const open = openSession(sessionId, [subscription], false);
@@ -1099,7 +1131,8 @@ function createAcpConnection(options) {
1099
1131
  listeners: new Set(listeners),
1100
1132
  state: "joining",
1101
1133
  replayed: created,
1102
- replayOwed: false
1134
+ replayOwed: false,
1135
+ setup: {}
1103
1136
  };
1104
1137
  sessions.set(sessionId, open);
1105
1138
  const initial = !joinable ? "detached" : created ? "joined" : "joining";
@@ -1120,7 +1153,18 @@ function createAcpConnection(options) {
1120
1153
  return;
1121
1154
  open.grace = clock.setTimeout(() => part(sessionId, open), PART_GRACE_MS);
1122
1155
  }
1123
- function part(sessionId, open) {
1156
+ function openCreated(sessionId, answer) {
1157
+ let open = sessions.get(sessionId);
1158
+ if (!open) {
1159
+ const created = openSession(sessionId, [], true);
1160
+ created.grace = clock.setTimeout(() => part(sessionId, created), PART_GRACE_MS);
1161
+ open = created;
1162
+ }
1163
+ hand(open, report(open, setupOfAnswer(answer)));
1164
+ }
1165
+ function forget(sessionId, open) {
1166
+ clock.clearTimeout(open.grace);
1167
+ open.grace = undefined;
1124
1168
  sessions.delete(sessionId);
1125
1169
  owners.delete(sessionId);
1126
1170
  for (const [child, parent] of children)
@@ -1129,6 +1173,9 @@ function createAcpConnection(options) {
1129
1173
  open.owner?.dispose();
1130
1174
  open.waiters?.reject(notOpen());
1131
1175
  open.waiters = undefined;
1176
+ }
1177
+ function part(sessionId, open) {
1178
+ forget(sessionId, open);
1132
1179
  if (open.state === "gone")
1133
1180
  return;
1134
1181
  request("short", (agent, options) => agent.request(HGW_METHODS2.session.part, { sessionId }, options)).catch((err) => {
@@ -1151,6 +1198,8 @@ function createAcpConnection(options) {
1151
1198
  }, options);
1152
1199
  }, { sessionId });
1153
1200
  const { history } = HgwHistoryPageResponseMetaSchema2.parse(hgwMetaOf(response._meta));
1201
+ if (sessions.get(sessionId) === open)
1202
+ hand(open, report(open, setupOfAnswer(response)));
1154
1203
  return { updates, history };
1155
1204
  } finally {
1156
1205
  if (open.page === updates)
@@ -1305,23 +1354,17 @@ function createAcpConnection(options) {
1305
1354
  subscribeOutage: (listener) => subscribeTo(outageListeners, listener),
1306
1355
  login,
1307
1356
  async newSession(meta) {
1308
- const { sessionId } = await request("short", (agent, options) => agent.request(methods2.agent.session.new, { cwd: AGENT_CWD, _meta: { [HGW_META_KEY2]: meta } }, options));
1309
- owners.set(sessionId, meta.agentId);
1310
- if (!sessions.has(sessionId)) {
1311
- const open = openSession(sessionId, [], true);
1312
- open.grace = clock.setTimeout(() => part(sessionId, open), PART_GRACE_MS);
1313
- }
1314
- return { sessionId };
1357
+ const created = await request("short", (agent, options) => agent.request(methods2.agent.session.new, { cwd: AGENT_CWD, _meta: { [HGW_META_KEY2]: meta } }, options));
1358
+ owners.set(created.sessionId, meta.agentId);
1359
+ openCreated(created.sessionId, created);
1360
+ return { sessionId: created.sessionId };
1315
1361
  },
1316
1362
  async forkSession(sessionId) {
1317
1363
  const forked = await request("short", (agent, options) => agent.request(methods2.agent.session.fork, { sessionId, cwd: AGENT_CWD }, options));
1318
1364
  const agentId = owners.get(sessionId);
1319
1365
  if (agentId !== undefined)
1320
1366
  owners.set(forked.sessionId, agentId);
1321
- if (!sessions.has(forked.sessionId)) {
1322
- const open = openSession(forked.sessionId, [], true);
1323
- open.grace = clock.setTimeout(() => part(forked.sessionId, open), PART_GRACE_MS);
1324
- }
1367
+ openCreated(forked.sessionId, forked);
1325
1368
  return { sessionId: forked.sessionId };
1326
1369
  },
1327
1370
  async listSessions(meta, cursor) {
@@ -1366,8 +1409,17 @@ function createAcpConnection(options) {
1366
1409
  },
1367
1410
  async setConfigOption(sessionId, configId, value) {
1368
1411
  const response = await request("medium", (agent, options) => agent.request(methods2.agent.session.setConfigOption, { sessionId, configId, type: "id", value }, options), { sessionId });
1412
+ const open = sessions.get(sessionId);
1413
+ if (open)
1414
+ report(open, { configOptions: response.configOptions });
1369
1415
  return response.configOptions;
1370
1416
  },
1417
+ async closeSession(sessionId) {
1418
+ const open = sessions.get(sessionId);
1419
+ if (open)
1420
+ forget(sessionId, open);
1421
+ await request("short", (agent, options) => agent.request(methods2.agent.session.close, { sessionId }, options));
1422
+ },
1371
1423
  async deleteSession(sessionId) {
1372
1424
  await request("short", (agent, options) => agent.request(methods2.agent.session.delete, { sessionId }, options));
1373
1425
  },
@@ -1405,7 +1457,7 @@ function createAcpConnection(options) {
1405
1457
  import {
1406
1458
  SessionConfigOption,
1407
1459
  SessionUpdate as SessionUpdate2
1408
- } from "@agentclientprotocol/sdk/experimental/v2";
1460
+ } from "@agentclientprotocol/sdk/experimental/v2/unstable";
1409
1461
  var MODEL_CATEGORY = "model";
1410
1462
  var EFFORT_CATEGORY = "thought_level";
1411
1463
  function selectOf(option, category) {
@@ -1533,28 +1585,38 @@ function createAcpComposerStore(connection) {
1533
1585
  for (const listener of registry.get(sessionId) ?? [])
1534
1586
  listener();
1535
1587
  }
1588
+ function entryOf(sessionId) {
1589
+ const known = sessions.get(sessionId) ?? { projection: {}, writes: 0 };
1590
+ sessions.set(sessionId, known);
1591
+ return known;
1592
+ }
1536
1593
  function project(known, sessionId, next) {
1537
1594
  known.projection = next;
1538
- notify(listeners, sessionId);
1539
1595
  const current = currentOf(next, known.current);
1540
1596
  if (current === known.current)
1541
1597
  return;
1542
1598
  known.current = current;
1543
1599
  notify(modelListeners, sessionId);
1544
1600
  }
1601
+ function settle(known, sessionId, { configOptions, availableCommands, capabilities }) {
1602
+ if (configOptions)
1603
+ project(known, sessionId, projectModels(configOptions));
1604
+ if (availableCommands)
1605
+ known.commands = availableCommands.map(({ name, description }) => ({
1606
+ name,
1607
+ description
1608
+ }));
1609
+ if (capabilities)
1610
+ known.reported = capabilities;
1611
+ if (known.reported)
1612
+ known.capabilities = capabilitiesOf(known.reported, known.commands);
1613
+ notify(listeners, sessionId);
1614
+ }
1545
1615
  function accept(sessionId, update, meta) {
1546
- const known = sessions.get(sessionId) ?? { projection: {}, writes: 0 };
1547
- sessions.set(sessionId, known);
1548
- if (SessionUpdate2.isConfigOptionUpdate(update)) {
1549
- project(known, sessionId, projectModels(update.configOptions));
1550
- } else if (SessionUpdate2.isAvailableCommandsUpdate(update)) {
1551
- known.commands = update.availableCommands.map(({ name, description }) => ({ name, description }));
1552
- const aos = HgwAvailableCommandsMetaSchema2.safeParse(meta);
1553
- if (aos.success)
1554
- known.reported = aos.data.capabilities;
1555
- if (known.reported)
1556
- known.capabilities = capabilitiesOf(known.reported, known.commands);
1557
- notify(listeners, sessionId);
1616
+ const known = entryOf(sessionId);
1617
+ const setup = setupOfUpdate(update, meta);
1618
+ if (setup) {
1619
+ settle(known, sessionId, setup);
1558
1620
  } else if (SessionUpdate2.isUsageUpdate(update)) {
1559
1621
  const context = projectContext(update, meta);
1560
1622
  if (!context)
@@ -1573,6 +1635,7 @@ function createAcpComposerStore(connection) {
1573
1635
  function subscribe(sessionId) {
1574
1636
  const leave = connection.subscribe(sessionId, {
1575
1637
  update: (update, meta) => accept(sessionId, update, meta),
1638
+ setup: (setup) => settle(entryOf(sessionId), sessionId, setup),
1576
1639
  replay: () => {
1577
1640
  const replayed = sessions.get(sessionId);
1578
1641
  if (replayed)
@@ -1606,8 +1669,10 @@ function createAcpComposerStore(connection) {
1606
1669
  const generation = ++known.writes;
1607
1670
  const configId = (category === MODEL_CATEGORY ? known.projection.modelConfigId : known.projection.effortConfigId) ?? category;
1608
1671
  const next = projectModels(await connection.setConfigOption(sessionId, configId, valueId));
1609
- if (!stale(sessionId, known, generation))
1672
+ if (!stale(sessionId, known, generation)) {
1610
1673
  project(known, sessionId, next);
1674
+ notify(listeners, sessionId);
1675
+ }
1611
1676
  if (!next.models)
1612
1677
  throw new Error("The Session reports no models");
1613
1678
  return next.models;
@@ -1629,7 +1694,7 @@ function createAcpComposerStore(connection) {
1629
1694
  import {
1630
1695
  SessionUpdate as SessionUpdate3,
1631
1696
  StateUpdate
1632
- } from "@agentclientprotocol/sdk/experimental/v2";
1697
+ } from "@agentclientprotocol/sdk/experimental/v2/unstable";
1633
1698
 
1634
1699
  // client/hgw-notification.ts
1635
1700
  function subscribeHgwNotification(connection, method, schema, handler) {
@@ -2186,6 +2251,7 @@ function createAcpWorkspaceClient({
2186
2251
  adopt(created.sessionId, agentId);
2187
2252
  return { sessionId: created.sessionId };
2188
2253
  },
2254
+ closeSession: (sessionId) => connection.closeSession(sessionId),
2189
2255
  subscribeSession,
2190
2256
  async markSessionRead(sessionId) {
2191
2257
  store.setUnread(sessionId, false);
@@ -1,4 +1,4 @@
1
- import { type WireStream } from "@agentclientprotocol/sdk/experimental/v2";
1
+ import { type Stream } from "@agentclientprotocol/sdk/experimental/v2/unstable";
2
2
  import type { LogFields, Logger } from "../lifecycle/index.js";
3
3
  type FlagStorage = {
4
4
  getItem(key: string): string | null;
@@ -27,7 +27,7 @@ export declare function frameFields(direction: "in" | "out", message: unknown):
27
27
  frame: Json;
28
28
  };
29
29
  /** `stream` with one `acp.frame` debug line per message, each way. */
30
- export declare function loggedStream(stream: WireStream, logger: Logger): WireStream;
30
+ export declare function loggedStream(stream: Stream, logger: Logger): Stream;
31
31
  /**
32
32
  * The id at `path` in a row not yet checked, bounded for a warning. A warning
33
33
  * about a rejected row names it by this alone, never by its content.
@@ -1,7 +1,8 @@
1
- import type { AgentCapabilities, ContentBlock, CreateElicitationRequest, CreateElicitationResponse, RequestPermissionRequest, RequestPermissionResponse, SessionConfigOption, SessionInfo, SessionUpdate } from "@agentclientprotocol/sdk/experimental/v2";
1
+ import type { AgentCapabilities, AvailableCommand, ContentBlock, CreateElicitationRequest, CreateElicitationResponse, RequestPermissionRequest, RequestPermissionResponse, SessionConfigOption, SessionInfo, SessionUpdate } from "@agentclientprotocol/sdk/experimental/v2/unstable";
2
2
  import type { z } from "zod";
3
3
  import type { AgentCatalogResponseSchema } from "../protocol/index.js";
4
4
  import type { HgwAgentUpdateRequest, HgwAgentUpdateResponseSchema, HgwHistoryCursor, HgwInitializeMetaSchema, HgwPromptMetaSchema, HgwSessionListMetaSchema, HgwSessionNewMetaSchema, HgwSessionSearchMeta, HgwSessionUpdateRequestSchema, HgwSteerRequestSchema, HgwSteerResponseSchema } from "../protocol/acp.js";
5
+ import type { HgwWorkspaceCapabilities } from "./hgw-client.js";
5
6
  /**
6
7
  * The browser-side seam over one ACP v2 WebSocket connection to the gateway.
7
8
  * `connection.ts` implements it; the runtime, thread list, interactions, and
@@ -46,6 +47,19 @@ export type AcpHistoryPage = {
46
47
  * whether the replay completed.
47
48
  */
48
49
  export type AcpSessionReplayListener = () => ((replayed: boolean) => void) | void;
50
+ /**
51
+ * What a Session reports of its setup: its config options, its slash commands,
52
+ * and the capabilities that travel with the commands. A `session/new`,
53
+ * `session/resume`, or `session/fork` answer carries both lists, one it omits
54
+ * read as none, and the capabilities when it names them; a
55
+ * `config_option_update` or `available_commands_update` carries one list. Each
56
+ * list is the Session's whole list, and a field left out here is unchanged.
57
+ */
58
+ export type AcpSessionSetup = {
59
+ readonly configOptions?: readonly SessionConfigOption[];
60
+ readonly availableCommands?: readonly AvailableCommand[];
61
+ readonly capabilities?: HgwWorkspaceCapabilities;
62
+ };
49
63
  /**
50
64
  * Where one opened Session stands: `joining` until the gateway has joined it,
51
65
  * `joined` while it follows the Session, `unavailable` while a failed join
@@ -71,6 +85,14 @@ export type AcpSessionListener = {
71
85
  * may return a callback, called once that replay has settled either way.
72
86
  */
73
87
  replay?: AcpSessionReplayListener;
88
+ /**
89
+ * The Session's setup: on subscribe, what it has reported so far by answer
90
+ * or update, then what each later setup answer reports, such as a rejoin's
91
+ * `session/resume`. Live updates of those lists reach `update` alone. An
92
+ * answer and an update alike replace the lists they name, in the order they
93
+ * arrive, as ACP has a client apply them.
94
+ */
95
+ setup?: (setup: AcpSessionSetup) => void;
74
96
  state?: (state: AcpSessionState) => void;
75
97
  };
76
98
  /**
@@ -109,8 +131,10 @@ export interface AcpConnection {
109
131
  */
110
132
  login(token: string): Promise<void>;
111
133
  /**
112
- * The new Session's row, capabilities and config options follow as updates.
113
- * The browser holds the shared address, so it names the Agent.
134
+ * Creates a Session, opened in its grace: it parts unless a listener
135
+ * subscribes within it, and one that does is handed the setup the answer
136
+ * reported. Its row follows as an update. The browser holds the shared
137
+ * address, so it names the Agent.
114
138
  */
115
139
  newSession(meta: z.infer<typeof HgwSessionNewMetaSchema> & {
116
140
  agentId: string;
@@ -120,7 +144,7 @@ export interface AcpConnection {
120
144
  /**
121
145
  * Forks a Session into a new one holding its conversation so far, where
122
146
  * `capabilities.session.fork` says the gateway forks; the gateway joins
123
- * this connection to it, as `newSession` does.
147
+ * this connection to it, and it opens in its grace, as `newSession` does.
124
148
  */
125
149
  forkSession(sessionId: string): Promise<{
126
150
  sessionId: string;
@@ -173,6 +197,14 @@ export interface AcpConnection {
173
197
  }>;
174
198
  cancel(sessionId: string): void;
175
199
  setConfigOption(sessionId: string, configId: string, value: string): Promise<SessionConfigOption[]>;
200
+ /**
201
+ * Ends the Session with ACP's `session/close`, which stops its work, and
202
+ * forgets it here at once, with no `_hgw/session/part`: its listeners hear
203
+ * nothing more of it, and nothing rejoins it. A Session the gateway no
204
+ * longer has (`-32002`) is closed already, so that answer resolves too.
205
+ */
206
+ closeSession(sessionId: string): Promise<void>;
207
+ /** Resolves, as `closeSession` does, for a Session already gone (`-32002`). */
176
208
  deleteSession(sessionId: string): Promise<void>;
177
209
  updateSession(request: z.infer<typeof HgwSessionUpdateRequestSchema>): Promise<void>;
178
210
  steer(request: z.infer<typeof HgwSteerRequestSchema>): Promise<z.infer<typeof HgwSteerResponseSchema>>;
@@ -1,4 +1,4 @@
1
- import type { UnknownVariant } from "@agentclientprotocol/sdk/experimental/v2";
1
+ import type { UnknownVariant } from "@agentclientprotocol/sdk/experimental/v2/unstable";
2
2
  import { z } from "zod";
3
3
  import { type ArtifactDescriptor } from "./index.js";
4
4
  /**
@@ -263,10 +263,190 @@ export declare const HgwHistoryPageTagSchema: z.ZodObject<{
263
263
  cursor: z.ZodString;
264
264
  }, z.core.$strip>>;
265
265
  }, z.core.$strip>;
266
+ /**
267
+ * `_meta.hgw` of a `session/new`, `session/fork`, or `session/resume` answer:
268
+ * the Session's capabilities, beside the answer's own `availableCommands` as
269
+ * `available_commands_update._meta.hgw` carries them beside its commands
270
+ * (`HgwAvailableCommandsMetaSchema`), in the same shape. A client reads it
271
+ * apart from the rest of a resume's `_meta.hgw`, so a capability it cannot
272
+ * read costs only the capabilities, never the join.
273
+ */
274
+ export declare const HgwSessionSetupResponseMetaSchema: z.ZodObject<{
275
+ capabilities: z.ZodObject<{
276
+ workspace: z.ZodObject<{
277
+ slashCommands: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
278
+ status: z.ZodLiteral<"available">;
279
+ scope: z.ZodLiteral<"session">;
280
+ commands: z.ZodArray<z.ZodObject<{
281
+ name: z.ZodString;
282
+ description: z.ZodOptional<z.ZodString>;
283
+ }, z.core.$strict>>;
284
+ }, z.core.$strict>, z.ZodObject<{
285
+ status: z.ZodLiteral<"unavailable">;
286
+ reason: z.ZodString;
287
+ }, z.core.$strict>]>>>;
288
+ models: z.ZodUnion<readonly [z.ZodObject<{
289
+ status: z.ZodLiteral<"available">;
290
+ scope: z.ZodLiteral<"session">;
291
+ selection: z.ZodLiteral<"native-session">;
292
+ choices: z.ZodLiteral<"provider-reported">;
293
+ }, z.core.$strict>, z.ZodObject<{
294
+ status: z.ZodLiteral<"unavailable">;
295
+ reason: z.ZodString;
296
+ }, z.core.$strict>]>;
297
+ context: z.ZodUnion<readonly [z.ZodObject<{
298
+ status: z.ZodLiteral<"available">;
299
+ scope: z.ZodLiteral<"session">;
300
+ source: z.ZodLiteral<"provider-usage-or-estimate">;
301
+ breakdown: z.ZodLiteral<"provider-categories">;
302
+ }, z.core.$strict>, z.ZodObject<{
303
+ status: z.ZodLiteral<"unavailable">;
304
+ reason: z.ZodString;
305
+ }, z.core.$strict>]>;
306
+ todos: z.ZodUnion<readonly [z.ZodObject<{
307
+ status: z.ZodLiteral<"available">;
308
+ scope: z.ZodLiteral<"session">;
309
+ mode: z.ZodLiteral<"read-only-projection">;
310
+ source: z.ZodLiteral<"latest-completed-todo-tool-result">;
311
+ }, z.core.$strict>, z.ZodObject<{
312
+ status: z.ZodLiteral<"unavailable">;
313
+ reason: z.ZodString;
314
+ }, z.core.$strict>]>;
315
+ activity: z.ZodUnion<readonly [z.ZodObject<{
316
+ status: z.ZodLiteral<"available">;
317
+ scope: z.ZodLiteral<"active-session">;
318
+ coverage: z.ZodLiteral<"active-session-only">;
319
+ source: z.ZodLiteral<"provider-session-state">;
320
+ }, z.core.$strict>, z.ZodObject<{
321
+ status: z.ZodLiteral<"unavailable">;
322
+ reason: z.ZodString;
323
+ }, z.core.$strict>]>;
324
+ }, z.core.$strict>;
325
+ interactions: z.ZodObject<{
326
+ steering: z.ZodUnion<readonly [z.ZodObject<{
327
+ status: z.ZodLiteral<"available">;
328
+ scope: z.ZodLiteral<"active-turn">;
329
+ semantics: z.ZodLiteral<"visible-user-message">;
330
+ input: z.ZodLiteral<"text">;
331
+ fallback: z.ZodLiteral<"provider-queue">;
332
+ }, z.core.$strict>, z.ZodObject<{
333
+ status: z.ZodLiteral<"unavailable">;
334
+ reason: z.ZodString;
335
+ }, z.core.$strict>]>;
336
+ rewind: z.ZodUnion<readonly [z.ZodObject<{
337
+ status: z.ZodLiteral<"available">;
338
+ scope: z.ZodLiteral<"user-turn">;
339
+ }, z.core.$strict>, z.ZodObject<{
340
+ status: z.ZodLiteral<"unavailable">;
341
+ reason: z.ZodString;
342
+ }, z.core.$strict>]>;
343
+ approvals: z.ZodObject<{
344
+ status: z.ZodLiteral<"available">;
345
+ protocol: z.ZodLiteral<"acp-request">;
346
+ scope: z.ZodLiteral<"turn">;
347
+ choices: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
348
+ value: z.ZodLiteral<"once">;
349
+ scope: z.ZodLiteral<"request">;
350
+ }, z.core.$strict>, z.ZodObject<{
351
+ value: z.ZodLiteral<"session">;
352
+ scope: z.ZodLiteral<"session">;
353
+ }, z.core.$strict>, z.ZodObject<{
354
+ value: z.ZodLiteral<"always">;
355
+ scope: z.ZodLiteral<"agent">;
356
+ }, z.core.$strict>, z.ZodObject<{
357
+ value: z.ZodLiteral<"deny">;
358
+ scope: z.ZodLiteral<"request">;
359
+ }, z.core.$strict>], "value">>;
360
+ maxPending: z.ZodNumber;
361
+ }, z.core.$strict>;
362
+ questions: z.ZodObject<{
363
+ status: z.ZodLiteral<"available">;
364
+ protocol: z.ZodLiteral<"acp-request">;
365
+ scope: z.ZodLiteral<"turn">;
366
+ answerModes: z.ZodTuple<[z.ZodLiteral<"single">, z.ZodLiteral<"multiple">, z.ZodLiteral<"free-text">], null>;
367
+ cancellation: z.ZodEnum<{
368
+ "native-cancel": "native-cancel";
369
+ "native-empty-answer": "native-empty-answer";
370
+ "native-reject": "native-reject";
371
+ }>;
372
+ maxQuestions: z.ZodNumber;
373
+ maxChoicesPerQuestion: z.ZodNumber;
374
+ maxAnswerValuesPerQuestion: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"complete-request">]>;
375
+ maxStringBytes: z.ZodNumber;
376
+ }, z.core.$strict>;
377
+ reactions: z.ZodObject<{
378
+ status: z.ZodLiteral<"unavailable">;
379
+ reason: z.ZodString;
380
+ }, z.core.$strict>;
381
+ }, z.core.$strict>;
382
+ content: z.ZodObject<{
383
+ attachments: z.ZodUnion<readonly [z.ZodObject<{
384
+ status: z.ZodLiteral<"available">;
385
+ scope: z.ZodLiteral<"session">;
386
+ inputs: z.ZodTuple<[z.ZodLiteral<"image">, z.ZodLiteral<"file">], null>;
387
+ imageMimeTypes: z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodLiteral<"provider-dependent">]>;
388
+ fileMimeTypes: z.ZodEnum<{
389
+ "provider-dependent": "provider-dependent";
390
+ "valid-type/subtype": "valid-type/subtype";
391
+ }>;
392
+ maxMimeTypeBytes: z.ZodNumber;
393
+ maxFilenameBytes: z.ZodNumber;
394
+ maxCount: z.ZodNumber;
395
+ maxImageBytes: z.ZodNumber;
396
+ maxFileBytes: z.ZodNumber;
397
+ maxTotalBytes: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"complete-request">]>;
398
+ maxEncodedRequestBytes: z.ZodOptional<z.ZodNumber>;
399
+ completeRequestValidation: z.ZodOptional<z.ZodLiteral<"native-run-input">>;
400
+ }, z.core.$strict>, z.ZodObject<{
401
+ status: z.ZodLiteral<"unavailable">;
402
+ reason: z.ZodString;
403
+ }, z.core.$strict>]>;
404
+ artifacts: z.ZodUnion<readonly [z.ZodObject<{
405
+ status: z.ZodLiteral<"available">;
406
+ scope: z.ZodLiteral<"session">;
407
+ maxBytes: z.ZodNumber;
408
+ }, z.core.$strict>, z.ZodObject<{
409
+ status: z.ZodLiteral<"unavailable">;
410
+ reason: z.ZodString;
411
+ }, z.core.$strict>]>;
412
+ mcpApps: z.ZodUnion<readonly [z.ZodObject<{
413
+ status: z.ZodLiteral<"available">;
414
+ scope: z.ZodLiteral<"session">;
415
+ maxBytes: z.ZodNumber;
416
+ }, z.core.$strict>, z.ZodObject<{
417
+ status: z.ZodLiteral<"unavailable">;
418
+ reason: z.ZodString;
419
+ }, z.core.$strict>]>;
420
+ transcription: z.ZodUnion<readonly [z.ZodObject<{
421
+ status: z.ZodLiteral<"available">;
422
+ scope: z.ZodLiteral<"agent">;
423
+ acceptedMimeTypes: z.ZodArray<z.ZodString>;
424
+ mimeParameter: z.ZodLiteral<"codecs">;
425
+ codecValues: z.ZodArray<z.ZodString>;
426
+ maxRecordingBytes: z.ZodNumber;
427
+ maxTranscriptBytes: z.ZodNumber;
428
+ }, z.core.$strict>, z.ZodObject<{
429
+ status: z.ZodLiteral<"unavailable">;
430
+ reason: z.ZodString;
431
+ }, z.core.$strict>]>;
432
+ speech: z.ZodUnion<readonly [z.ZodObject<{
433
+ status: z.ZodLiteral<"available">;
434
+ scope: z.ZodLiteral<"agent">;
435
+ acceptedMimeTypes: z.ZodArray<z.ZodString>;
436
+ maxTextBytes: z.ZodNumber;
437
+ maxAudioBytes: z.ZodNumber;
438
+ }, z.core.$strict>, z.ZodObject<{
439
+ status: z.ZodLiteral<"unavailable">;
440
+ reason: z.ZodString;
441
+ }, z.core.$strict>]>;
442
+ }, z.core.$strict>;
443
+ }, z.core.$strict>;
444
+ }, z.core.$strip>;
266
445
  /**
267
446
  * `ResumeSessionResponse._meta.hgw`. `position` is the turn and sequence the
268
447
  * joined Session's stream stands at, which a later resume continues from.
269
- * The Session's row, execution, models and capabilities follow the answer as
448
+ * The capabilities `HgwSessionSetupResponseMetaSchema` reads ride in the same
449
+ * `_meta.hgw`; the Session's row, execution and usage follow the answer as
270
450
  * updates.
271
451
  */
272
452
  export declare const HgwSessionResumeResponseMetaSchema: z.ZodObject<{
@@ -106,6 +106,7 @@ import {
106
106
  HgwHistoryCursorSchema2,
107
107
  HgwHistoryPageResponseMetaSchema2,
108
108
  HgwHistoryPageTagSchema2,
109
+ HgwSessionSetupResponseMetaSchema2,
109
110
  HgwSessionResumeResponseMetaSchema2,
110
111
  HgwPromptMetaSchema2,
111
112
  HgwSessionUpdateRequestSchema2,
@@ -273,6 +274,7 @@ export {
273
274
  HgwSessionResumeResponseMetaSchema2 as HgwSessionResumeResponseMetaSchema,
274
275
  HgwSessionSearchMetaSchema2 as HgwSessionSearchMetaSchema,
275
276
  HgwSessionSearchResponseSchema2 as HgwSessionSearchResponseSchema,
277
+ HgwSessionSetupResponseMetaSchema2 as HgwSessionSetupResponseMetaSchema,
276
278
  HgwSessionUpdateRequestSchema2 as HgwSessionUpdateRequestSchema,
277
279
  HgwStateMetaSchema2 as HgwStateMetaSchema,
278
280
  HgwSteerRequestSchema2 as HgwSteerRequestSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harness-gw/sdk",
3
- "version": "0.16.1",
3
+ "version": "0.17.0",
4
4
  "description": "A gateway that puts Hermes, OpenClaw, and OpenCode behind one ACP WebSocket, and the browser client and protocol SDK for it.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -47,16 +47,16 @@
47
47
  "xstate": "5.33.2"
48
48
  },
49
49
  "peerDependencies": {
50
- "@agentclientprotocol/sdk": "^1.5.0",
50
+ "@agentclientprotocol/sdk": "2.7.0",
51
51
  "@modelcontextprotocol/core": "^2.3.1",
52
52
  "zod": "^4.5.4"
53
53
  },
54
54
  "devDependencies": {
55
- "@agentclientprotocol/sdk": "1.8.0",
55
+ "@agentclientprotocol/sdk": "2.7.0",
56
56
  "@block65/webcrypto-web-push": "^2.0.0",
57
- "@modelcontextprotocol/client": "2.3.1",
58
- "@modelcontextprotocol/core": "2.3.1",
59
- "@modelcontextprotocol/server": "2.3.1",
57
+ "@modelcontextprotocol/client": "2.4.0",
58
+ "@modelcontextprotocol/core": "2.4.0",
59
+ "@modelcontextprotocol/server": "2.4.0",
60
60
  "@openclaw/gateway-client": "2026.10.2",
61
61
  "@openclaw/gateway-protocol": "2026.10.2",
62
62
  "@opencode-ai/sdk": "1.19.0",