@harness-gw/sdk 0.17.0 → 0.18.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 +4 -3
- package/dist/chunks/index.js +39 -12
- package/dist/client/acp-workspace-client.d.ts +3 -3
- package/dist/client/hgw-client.d.ts +9 -3
- package/dist/client/index.js +84 -15
- package/dist/client/tolerant.d.ts +15 -0
- package/dist/client/types.d.ts +8 -0
- package/dist/client/workspace.d.ts +13 -0
- package/dist/protocol/mcp-apps.d.ts +26 -10
- package/dist/protocol/push.d.ts +83 -9
- package/dist/protocol/sdk.js +10 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -35,7 +35,8 @@ guest ── invite link ──────► guest listener ─────
|
|
|
35
35
|
permission requests and elicitations, and answer back the same way.
|
|
36
36
|
- **MCP Apps.** Tool results that carry a `ui://` view are served to the client
|
|
37
37
|
through the gateway, scoped to the tool call's own Session.
|
|
38
|
-
- **Attachments, Artifacts, voice and Web Push
|
|
38
|
+
- **Attachments, Artifacts, voice and push** (Web Push and APNs) over plain
|
|
39
|
+
HTTP routes.
|
|
39
40
|
- **A framework-free browser SDK.** No React, no browser globals: location,
|
|
40
41
|
storage, page visibility and logging arrive as options.
|
|
41
42
|
- **Origin-checked by default.** Each listener admits only its listed browser
|
|
@@ -63,7 +64,7 @@ You need a running harness. Hermes is the primary one; see
|
|
|
63
64
|
docker run --rm \
|
|
64
65
|
-v "$PWD/config.yaml:/run/harness-gw/config.yaml:ro" \
|
|
65
66
|
-v "$PWD/hermes-token:/run/secrets/hermes-token:ro" \
|
|
66
|
-
ghcr.io/almogbaku/harness-gw:0.
|
|
67
|
+
ghcr.io/almogbaku/harness-gw:0.18.0 \
|
|
67
68
|
config check --config /run/harness-gw/config.yaml
|
|
68
69
|
```
|
|
69
70
|
|
|
@@ -73,7 +74,7 @@ You need a running harness. Hermes is the primary one; see
|
|
|
73
74
|
docker run --rm -p 127.0.0.1:4100:4100 \
|
|
74
75
|
-v "$PWD/config.yaml:/run/harness-gw/config.yaml:ro" \
|
|
75
76
|
-v "$PWD/hermes-token:/run/secrets/hermes-token:ro" \
|
|
76
|
-
ghcr.io/almogbaku/harness-gw:0.
|
|
77
|
+
ghcr.io/almogbaku/harness-gw:0.18.0 \
|
|
77
78
|
serve --config /run/harness-gw/config.yaml
|
|
78
79
|
```
|
|
79
80
|
|
package/dist/chunks/index.js
CHANGED
|
@@ -103,17 +103,20 @@ function isMcpAppPolicyOrigin2(value) {
|
|
|
103
103
|
return false;
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
+
var MCP_APP_BUNDLED_PAGE_ORIGIN2 = "tauri://localhost";
|
|
107
|
+
function isMcpAppFramingOrigin2(value) {
|
|
108
|
+
return value === MCP_APP_BUNDLED_PAGE_ORIGIN2 || isMcpAppPolicyOrigin2(value);
|
|
109
|
+
}
|
|
106
110
|
function ownHosts({
|
|
107
111
|
frameAncestors,
|
|
108
112
|
sandboxOrigin
|
|
109
113
|
}) {
|
|
110
|
-
const
|
|
111
|
-
const invalid = origins.find((origin) => !isMcpAppPolicyOrigin2(origin));
|
|
114
|
+
const invalid = frameAncestors.find((origin) => !isMcpAppFramingOrigin2(origin)) ?? (isMcpAppPolicyOrigin2(sandboxOrigin) ? undefined : sandboxOrigin);
|
|
112
115
|
if (invalid !== undefined)
|
|
113
116
|
throw new Error(`Not an exact origin a sandbox policy can name: ${invalid}`);
|
|
114
117
|
if (frameAncestors.includes(sandboxOrigin))
|
|
115
118
|
throw new Error(`The sandbox origin is one of the host's: ${sandboxOrigin}`);
|
|
116
|
-
return new Set(
|
|
119
|
+
return new Set([...frameAncestors, sandboxOrigin].filter((origin) => origin !== MCP_APP_BUNDLED_PAGE_ORIGIN2).map((origin) => new URL(origin).host));
|
|
117
120
|
}
|
|
118
121
|
function namesHost(domain, hosts) {
|
|
119
122
|
try {
|
|
@@ -1276,20 +1279,44 @@ var PushSubscriptionJsonSchema2 = z4.strictObject({
|
|
|
1276
1279
|
auth: Base64UrlSchema.length(22)
|
|
1277
1280
|
})
|
|
1278
1281
|
});
|
|
1282
|
+
var apnsAvailability = { apns: z4.literal(true).optional() };
|
|
1279
1283
|
var PushInfoSchema2 = z4.discriminatedUnion("status", [
|
|
1280
|
-
z4.strictObject({ status: z4.literal("not-configured") }),
|
|
1284
|
+
z4.strictObject({ status: z4.literal("not-configured"), ...apnsAvailability }),
|
|
1281
1285
|
z4.strictObject({
|
|
1282
1286
|
status: z4.literal("available"),
|
|
1283
|
-
publicKey: Base64UrlSchema.length(87)
|
|
1287
|
+
publicKey: Base64UrlSchema.length(87),
|
|
1288
|
+
...apnsAvailability
|
|
1284
1289
|
})
|
|
1285
1290
|
]);
|
|
1286
|
-
var
|
|
1287
|
-
subscription: PushSubscriptionJsonSchema2,
|
|
1291
|
+
var devicePreferences = {
|
|
1288
1292
|
locale: PushLocaleSchema2,
|
|
1289
1293
|
categories: PushCategoriesSchema2
|
|
1290
|
-
}
|
|
1291
|
-
var
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
+
};
|
|
1295
|
+
var WebPushRegistrationSchema2 = z4.strictObject({
|
|
1296
|
+
transport: z4.literal("web-push").optional(),
|
|
1297
|
+
subscription: PushSubscriptionJsonSchema2,
|
|
1298
|
+
...devicePreferences
|
|
1299
|
+
});
|
|
1300
|
+
var ApnsDeviceTokenSchema2 = z4.string().regex(/^(?:[0-9a-f]{2}){32,100}$/iu).toLowerCase();
|
|
1301
|
+
var ApnsRegistrationSchema2 = z4.strictObject({
|
|
1302
|
+
transport: z4.literal("apns"),
|
|
1303
|
+
token: ApnsDeviceTokenSchema2,
|
|
1304
|
+
environment: z4.enum(["sandbox", "production"]),
|
|
1305
|
+
...devicePreferences
|
|
1306
|
+
});
|
|
1307
|
+
var PushRegistrationSchema2 = z4.discriminatedUnion("transport", [
|
|
1308
|
+
WebPushRegistrationSchema2,
|
|
1309
|
+
ApnsRegistrationSchema2
|
|
1310
|
+
]);
|
|
1311
|
+
var PushUnregistrationSchema2 = z4.discriminatedUnion("transport", [
|
|
1312
|
+
z4.strictObject({
|
|
1313
|
+
transport: z4.literal("web-push").optional(),
|
|
1314
|
+
endpoint: z4.string().max(2048)
|
|
1315
|
+
}),
|
|
1316
|
+
z4.strictObject({
|
|
1317
|
+
transport: z4.literal("apns"),
|
|
1318
|
+
token: ApnsDeviceTokenSchema2
|
|
1319
|
+
})
|
|
1320
|
+
]);
|
|
1294
1321
|
|
|
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 };
|
|
1322
|
+
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, MCP_APP_BUNDLED_PAGE_ORIGIN2, isMcpAppFramingOrigin2, 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, WebPushRegistrationSchema2, ApnsDeviceTokenSchema2, ApnsRegistrationSchema2, PushRegistrationSchema2, PushUnregistrationSchema2 };
|
|
@@ -134,15 +134,15 @@ export declare function createAcpWorkspaceClient({ connection, rest, agentIdFor,
|
|
|
134
134
|
workspaceCapabilities: (sessionId: string) => {
|
|
135
135
|
workspace: {
|
|
136
136
|
slashCommands: {
|
|
137
|
-
status: "unavailable";
|
|
138
|
-
reason: string;
|
|
139
|
-
} | {
|
|
140
137
|
status: "available";
|
|
141
138
|
scope: "session";
|
|
142
139
|
commands: {
|
|
143
140
|
name: string;
|
|
144
141
|
description?: string | undefined;
|
|
145
142
|
}[];
|
|
143
|
+
} | {
|
|
144
|
+
status: "unavailable";
|
|
145
|
+
reason: string;
|
|
146
146
|
};
|
|
147
147
|
models: {
|
|
148
148
|
status: "unavailable";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { z } from "zod";
|
|
2
2
|
import { SessionContextResponseSchema, SessionModelsResponseSchema, SessionWorkspaceCapabilitiesResponseSchema } from "../protocol/index.js";
|
|
3
|
-
import { type PushRegistration } from "../protocol/push.js";
|
|
3
|
+
import { type PushRegistration, type PushUnregistration } from "../protocol/push.js";
|
|
4
4
|
import { type McpAppFileReadFailure, type McpAppModelContextRequest, type McpAppResourceReadRequest, type McpAppToolCallRequest } from "../protocol/mcp-apps.js";
|
|
5
5
|
import type { StagedAttachment } from "./workspace.js";
|
|
6
6
|
export type HgwWorkspaceCapabilities = z.infer<typeof SessionWorkspaceCapabilitiesResponseSchema>;
|
|
@@ -164,14 +164,20 @@ export declare class HgwRemoteClient {
|
|
|
164
164
|
}>;
|
|
165
165
|
/** What this deployment offers for alerts while no tab is open. */
|
|
166
166
|
pushInfo(signal?: AbortSignal): Promise<{
|
|
167
|
+
apns?: true | undefined;
|
|
167
168
|
status: "not-configured";
|
|
168
169
|
} | {
|
|
170
|
+
apns?: true | undefined;
|
|
169
171
|
status: "available";
|
|
170
172
|
publicKey: string;
|
|
171
173
|
}>;
|
|
172
|
-
/**
|
|
174
|
+
/**
|
|
175
|
+
* Registering the same device again is how a preference change travels. A
|
|
176
|
+
* registration naming no `transport` is a browser's, through Web Push.
|
|
177
|
+
*/
|
|
173
178
|
putPushSubscription(registration: PushRegistration): Promise<void>;
|
|
174
|
-
|
|
179
|
+
/** Names the device by its transport's own key: an endpoint, or a token. */
|
|
180
|
+
deletePushSubscription(device: PushUnregistration): Promise<void>;
|
|
175
181
|
/** REST authorizes byte routes per Agent, so every Session names its owner. */
|
|
176
182
|
adoptSessionOwnership(sessionId: string, agentId: string): void;
|
|
177
183
|
stageAttachments(sessionId: string, attachments: readonly StagedAttachment[]): Promise<{
|
package/dist/client/index.js
CHANGED
|
@@ -289,6 +289,17 @@ class AcpConnectionClosedError extends Error {
|
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
291
|
|
|
292
|
+
class HgwVersionMismatchError extends Error {
|
|
293
|
+
gatewayVersion;
|
|
294
|
+
clientVersion;
|
|
295
|
+
constructor(gatewayVersion, clientVersion) {
|
|
296
|
+
super(`The gateway speaks hgw extension version ${String(gatewayVersion)}; this client speaks version ${clientVersion}`);
|
|
297
|
+
this.gatewayVersion = gatewayVersion;
|
|
298
|
+
this.clientVersion = clientVersion;
|
|
299
|
+
this.name = "HgwVersionMismatchError";
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
292
303
|
// client/limits.ts
|
|
293
304
|
var HANDSHAKE_DEADLINE_MS = 1e4;
|
|
294
305
|
var REQUEST_DEADLINE_MS = {
|
|
@@ -395,6 +406,58 @@ function callEach(listeners, logger, event, ...args) {
|
|
|
395
406
|
}
|
|
396
407
|
}
|
|
397
408
|
|
|
409
|
+
// client/tolerant.ts
|
|
410
|
+
var MAX_PASSES = 8;
|
|
411
|
+
function unknownKeys(issues, prefix = []) {
|
|
412
|
+
const found = [];
|
|
413
|
+
for (const issue of issues) {
|
|
414
|
+
const path = [...prefix, ...issue.path];
|
|
415
|
+
if (issue.code === "unrecognized_keys")
|
|
416
|
+
found.push(...issue.keys.map((key) => [...path, key]));
|
|
417
|
+
else if (issue.code === "invalid_union") {
|
|
418
|
+
const branch = issue.errors.map((branchIssues) => unknownKeys(branchIssues, path)).find((keys) => keys !== undefined && keys.length > 0);
|
|
419
|
+
if (branch === undefined)
|
|
420
|
+
return;
|
|
421
|
+
found.push(...branch);
|
|
422
|
+
} else
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
return found;
|
|
426
|
+
}
|
|
427
|
+
function withoutKey(value, path) {
|
|
428
|
+
const [head, ...rest] = path;
|
|
429
|
+
if (head === undefined || typeof value !== "object" || value === null)
|
|
430
|
+
return value;
|
|
431
|
+
const copy = Array.isArray(value) ? [...value] : { ...value };
|
|
432
|
+
if (rest.length === 0)
|
|
433
|
+
delete copy[head];
|
|
434
|
+
else
|
|
435
|
+
copy[head] = withoutKey(copy[head], rest);
|
|
436
|
+
return copy;
|
|
437
|
+
}
|
|
438
|
+
function tolerant(schema) {
|
|
439
|
+
const safeParse = (value) => {
|
|
440
|
+
let result = schema.safeParse(value);
|
|
441
|
+
for (let pass = 0;!result.success && pass < MAX_PASSES; pass += 1) {
|
|
442
|
+
const unknown = unknownKeys(result.error.issues);
|
|
443
|
+
if (!unknown?.length)
|
|
444
|
+
break;
|
|
445
|
+
value = unknown.reduce(withoutKey, value);
|
|
446
|
+
result = schema.safeParse(value);
|
|
447
|
+
}
|
|
448
|
+
return result;
|
|
449
|
+
};
|
|
450
|
+
return {
|
|
451
|
+
safeParse,
|
|
452
|
+
parse(value) {
|
|
453
|
+
const result = safeParse(value);
|
|
454
|
+
if (result.success)
|
|
455
|
+
return result.data;
|
|
456
|
+
throw result.error;
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
|
|
398
461
|
// client/connection.ts
|
|
399
462
|
var TRY_AGAIN_LATER = 1013;
|
|
400
463
|
var POLICY_VIOLATION = 1008;
|
|
@@ -460,14 +523,14 @@ function setupOfUpdate(update, meta) {
|
|
|
460
523
|
return { configOptions: update.configOptions };
|
|
461
524
|
if (!SessionUpdate.isAvailableCommandsUpdate(update))
|
|
462
525
|
return;
|
|
463
|
-
const capabilities = HgwAvailableCommandsMetaSchema2.safeParse(meta).data?.capabilities;
|
|
526
|
+
const capabilities = tolerant(HgwAvailableCommandsMetaSchema2).safeParse(meta).data?.capabilities;
|
|
464
527
|
return {
|
|
465
528
|
availableCommands: update.availableCommands,
|
|
466
529
|
...capabilities ? { capabilities } : {}
|
|
467
530
|
};
|
|
468
531
|
}
|
|
469
532
|
function setupOfAnswer(answer) {
|
|
470
|
-
const capabilities = HgwSessionSetupResponseMetaSchema2.safeParse(hgwMetaOf(answer._meta)).data?.capabilities;
|
|
533
|
+
const capabilities = tolerant(HgwSessionSetupResponseMetaSchema2).safeParse(hgwMetaOf(answer._meta)).data?.capabilities;
|
|
471
534
|
return {
|
|
472
535
|
configOptions: answer.configOptions ?? [],
|
|
473
536
|
availableCommands: answer.availableCommands ?? [],
|
|
@@ -690,7 +753,7 @@ function readEach(entries, schema, skipped) {
|
|
|
690
753
|
const kept = [];
|
|
691
754
|
let unreadable;
|
|
692
755
|
for (const entry of entries) {
|
|
693
|
-
const read = schema.safeParse(entry);
|
|
756
|
+
const read = tolerant(schema).safeParse(entry);
|
|
694
757
|
if (read.success)
|
|
695
758
|
kept.push(read.data);
|
|
696
759
|
else {
|
|
@@ -733,6 +796,7 @@ function createAcpConnection(options) {
|
|
|
733
796
|
let agentCapabilities;
|
|
734
797
|
let status = "connecting";
|
|
735
798
|
let outage;
|
|
799
|
+
let versionMismatch;
|
|
736
800
|
let started = false;
|
|
737
801
|
let inspecting;
|
|
738
802
|
let ended = false;
|
|
@@ -962,7 +1026,8 @@ function createAcpConnection(options) {
|
|
|
962
1026
|
const announced = hgwMetaOf(response._meta);
|
|
963
1027
|
agentCapabilities = response.capabilities ?? undefined;
|
|
964
1028
|
if (announced?.version !== HGW_EXTENSION_VERSION2) {
|
|
965
|
-
const error = new
|
|
1029
|
+
const error = new HgwVersionMismatchError(typeof announced?.version === "number" ? announced.version : undefined, HGW_EXTENSION_VERSION2);
|
|
1030
|
+
versionMismatch = error;
|
|
966
1031
|
failInitialized?.(error);
|
|
967
1032
|
failInitialized = undefined;
|
|
968
1033
|
settleInitialized = undefined;
|
|
@@ -1037,7 +1102,7 @@ function createAcpConnection(options) {
|
|
|
1037
1102
|
}
|
|
1038
1103
|
}
|
|
1039
1104
|
async function listAgents() {
|
|
1040
|
-
const response = AgentsListEntriesSchema.parse(await request("short", (agent, options) => agent.request(HGW_METHODS2.agents.list, undefined, options), "read"));
|
|
1105
|
+
const response = tolerant(AgentsListEntriesSchema).parse(await request("short", (agent, options) => agent.request(HGW_METHODS2.agents.list, undefined, options), "read"));
|
|
1041
1106
|
return {
|
|
1042
1107
|
...response,
|
|
1043
1108
|
agents: readEach(response.agents, HgwAgentsListResponseSchema2.shape.agents.element, (entry) => logger.warn({ id: loggedId(entry, "summary", "id") }, "agents.entry_skipped"))
|
|
@@ -1352,6 +1417,9 @@ function createAcpConnection(options) {
|
|
|
1352
1417
|
return outage;
|
|
1353
1418
|
},
|
|
1354
1419
|
subscribeOutage: (listener) => subscribeTo(outageListeners, listener),
|
|
1420
|
+
get versionMismatch() {
|
|
1421
|
+
return versionMismatch;
|
|
1422
|
+
},
|
|
1355
1423
|
login,
|
|
1356
1424
|
async newSession(meta) {
|
|
1357
1425
|
const created = await request("short", (agent, options) => agent.request(methods2.agent.session.new, { cwd: AGENT_CWD, _meta: { [HGW_META_KEY2]: meta } }, options));
|
|
@@ -1428,7 +1496,7 @@ function createAcpConnection(options) {
|
|
|
1428
1496
|
},
|
|
1429
1497
|
async steer(steer) {
|
|
1430
1498
|
assertFrameFits(steer);
|
|
1431
|
-
return HgwSteerResponseSchema2.parse(await request("medium", (agent, options) => agent.request(HGW_METHODS2.session.steer, steer, options), { sessionId: steer.sessionId }));
|
|
1499
|
+
return tolerant(HgwSteerResponseSchema2).parse(await request("medium", (agent, options) => agent.request(HGW_METHODS2.session.steer, steer, options), { sessionId: steer.sessionId }));
|
|
1432
1500
|
},
|
|
1433
1501
|
focus(sessionId, presence) {
|
|
1434
1502
|
const report = {
|
|
@@ -1446,7 +1514,7 @@ function createAcpConnection(options) {
|
|
|
1446
1514
|
const response = await request("short", (agent, options) => agent.request(HGW_METHODS2.agents.update, update, options)).catch((error) => {
|
|
1447
1515
|
throw agentUpdateError(error);
|
|
1448
1516
|
});
|
|
1449
|
-
return HgwAgentUpdateResponseSchema2.parse(response);
|
|
1517
|
+
return tolerant(HgwAgentUpdateResponseSchema2).parse(response);
|
|
1450
1518
|
},
|
|
1451
1519
|
subscribeNotification: (method, listener) => subscribeKeyed(notificationListeners, method, listener),
|
|
1452
1520
|
subscribePendingRequests: (listener) => subscribeTo(pendingListeners, listener),
|
|
@@ -1506,7 +1574,7 @@ function projectModels(options) {
|
|
|
1506
1574
|
function projectContext(update, meta) {
|
|
1507
1575
|
if (update.size <= 0)
|
|
1508
1576
|
return;
|
|
1509
|
-
const aos = HgwUsageMetaSchema2.safeParse(meta);
|
|
1577
|
+
const aos = tolerant(HgwUsageMetaSchema2).safeParse(meta);
|
|
1510
1578
|
return {
|
|
1511
1579
|
usedTokens: update.used,
|
|
1512
1580
|
maxTokens: update.size,
|
|
@@ -1699,7 +1767,7 @@ import {
|
|
|
1699
1767
|
// client/hgw-notification.ts
|
|
1700
1768
|
function subscribeHgwNotification(connection, method, schema, handler) {
|
|
1701
1769
|
return connection.subscribeNotification(method, (params) => {
|
|
1702
|
-
const parsed = schema.safeParse(params);
|
|
1770
|
+
const parsed = tolerant(schema).safeParse(params);
|
|
1703
1771
|
if (parsed.success)
|
|
1704
1772
|
handler(parsed.data);
|
|
1705
1773
|
});
|
|
@@ -1851,7 +1919,7 @@ function createAcpSessionStore({
|
|
|
1851
1919
|
}
|
|
1852
1920
|
if (!SessionUpdate3.isPlanUpdate(update))
|
|
1853
1921
|
return;
|
|
1854
|
-
const plan = HgwPlanMetaSchema2.safeParse(meta);
|
|
1922
|
+
const plan = tolerant(HgwPlanMetaSchema2).safeParse(meta);
|
|
1855
1923
|
if (plan.success)
|
|
1856
1924
|
setTodos(sessionId, plan.data.todos);
|
|
1857
1925
|
}
|
|
@@ -2575,7 +2643,7 @@ class McpAppFileReadError extends HgwClientError {
|
|
|
2575
2643
|
}
|
|
2576
2644
|
}
|
|
2577
2645
|
async function normalizedError(response) {
|
|
2578
|
-
const parsed = ErrorResponseSchema2.safeParse(await response.json().catch(() => {
|
|
2646
|
+
const parsed = tolerant(ErrorResponseSchema2).safeParse(await response.json().catch(() => {
|
|
2579
2647
|
return;
|
|
2580
2648
|
}));
|
|
2581
2649
|
return parsed.success ? parsed.data.error : undefined;
|
|
@@ -2631,7 +2699,7 @@ class HgwRemoteClient {
|
|
|
2631
2699
|
} catch {
|
|
2632
2700
|
throw new HgwClientError("gateway-failure", "Invalid gateway response");
|
|
2633
2701
|
}
|
|
2634
|
-
const parsed = schema.safeParse(payload);
|
|
2702
|
+
const parsed = tolerant(schema).safeParse(payload);
|
|
2635
2703
|
if (!parsed.success)
|
|
2636
2704
|
throw new HgwClientError("gateway-failure", "Invalid gateway response");
|
|
2637
2705
|
return parsed.data;
|
|
@@ -2645,9 +2713,9 @@ class HgwRemoteClient {
|
|
|
2645
2713
|
async putPushSubscription(registration) {
|
|
2646
2714
|
await this.#write("/push/subscriptions", "PUT", registration);
|
|
2647
2715
|
}
|
|
2648
|
-
async deletePushSubscription(
|
|
2649
|
-
const request = PushUnregistrationSchema2.safeParse(
|
|
2650
|
-
if (!request.success || !endpoint.trim())
|
|
2716
|
+
async deletePushSubscription(device) {
|
|
2717
|
+
const request = PushUnregistrationSchema2.safeParse(device);
|
|
2718
|
+
if (!request.success || "endpoint" in request.data && !request.data.endpoint.trim())
|
|
2651
2719
|
throw new HgwClientError("gateway-failure", "Invalid push subscription");
|
|
2652
2720
|
await this.#write("/push/subscriptions", "DELETE", request.data);
|
|
2653
2721
|
}
|
|
@@ -2822,6 +2890,7 @@ export {
|
|
|
2822
2890
|
AgentUpdateError,
|
|
2823
2891
|
HgwClientError,
|
|
2824
2892
|
HgwRemoteClient,
|
|
2893
|
+
HgwVersionMismatchError,
|
|
2825
2894
|
McpAppFileReadError,
|
|
2826
2895
|
PART_GRACE_MS,
|
|
2827
2896
|
SILENT_LOGGER,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
/** What a parse boundary needs of a schema. */
|
|
3
|
+
type Schema<T> = Pick<z.ZodType<T>, "safeParse">;
|
|
4
|
+
/**
|
|
5
|
+
* `schema` as a client reads what the gateway sends: a key it does not know is
|
|
6
|
+
* dropped wherever a strict object sits, so a later gateway may add one, and
|
|
7
|
+
* every key it knows is still validated. A value that fails for any other
|
|
8
|
+
* reason, a known key of the wrong type, an unknown enum value or union
|
|
9
|
+
* variant, still fails. What a client sends stays strict.
|
|
10
|
+
*/
|
|
11
|
+
export declare function tolerant<T>(schema: Schema<T>): {
|
|
12
|
+
safeParse: (value: unknown) => z.ZodSafeParseResult<T>;
|
|
13
|
+
parse(value: unknown): T;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
package/dist/client/types.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ 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
5
|
import type { HgwWorkspaceCapabilities } from "./hgw-client.js";
|
|
6
|
+
import type { HgwVersionMismatchError } from "./workspace.js";
|
|
6
7
|
/**
|
|
7
8
|
* The browser-side seam over one ACP v2 WebSocket connection to the gateway.
|
|
8
9
|
* `connection.ts` implements it; the runtime, thread list, interactions, and
|
|
@@ -125,6 +126,13 @@ export interface AcpConnection {
|
|
|
125
126
|
*/
|
|
126
127
|
readonly outage: AcpConnectionOutage | undefined;
|
|
127
128
|
subscribeOutage(listener: (outage: AcpConnectionOutage | undefined) => void): () => void;
|
|
129
|
+
/**
|
|
130
|
+
* Set, before `status` turns `closed`, once a handshake finds the gateway
|
|
131
|
+
* speaking another hgw extension version: the first one, which fails
|
|
132
|
+
* `initialized` with the same error, or a reconnect's, after `initialized`
|
|
133
|
+
* has resolved. No other close sets it.
|
|
134
|
+
*/
|
|
135
|
+
readonly versionMismatch: HgwVersionMismatchError | undefined;
|
|
128
136
|
/**
|
|
129
137
|
* Redeems a guest invitation. The connection keeps the token and replays the
|
|
130
138
|
* login before it rejoins its Sessions on a recovered transport.
|
|
@@ -26,6 +26,19 @@ export declare class AgentUpdateError extends Error {
|
|
|
26
26
|
export declare class AcpConnectionClosedError extends Error {
|
|
27
27
|
constructor(message?: string, options?: ErrorOptions);
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* The gateway speaks another hgw extension version than this client, so the
|
|
31
|
+
* connection ended for good: no retry changes the gateway's version. Which
|
|
32
|
+
* side is older says which one to update.
|
|
33
|
+
*/
|
|
34
|
+
export declare class HgwVersionMismatchError extends Error {
|
|
35
|
+
/** What the gateway's `initialize` announced; undefined for no number. */
|
|
36
|
+
readonly gatewayVersion: number | undefined;
|
|
37
|
+
readonly clientVersion: number;
|
|
38
|
+
constructor(
|
|
39
|
+
/** What the gateway's `initialize` announced; undefined for no number. */
|
|
40
|
+
gatewayVersion: number | undefined, clientVersion: number);
|
|
41
|
+
}
|
|
29
42
|
export type SessionStatus = "idle" | "running" | "waiting-for-input" | "failed" | "unknown";
|
|
30
43
|
export type ActivityBase = {
|
|
31
44
|
id: string;
|
|
@@ -355,7 +355,7 @@ export declare const MCP_APP_SANDBOX_PATH = "/mcp-app-sandbox.html";
|
|
|
355
355
|
export type McpAppSandboxPolicyInput = {
|
|
356
356
|
/**
|
|
357
357
|
* The exact origins of the host's own pages, the only ones that may frame
|
|
358
|
-
* the sandbox page.
|
|
358
|
+
* the sandbox page (`isMcpAppFramingOrigin`).
|
|
359
359
|
*/
|
|
360
360
|
frameAncestors: readonly string[];
|
|
361
361
|
/** The exact origin the sandbox page is served from. */
|
|
@@ -366,18 +366,33 @@ export type McpAppSandboxPolicyInput = {
|
|
|
366
366
|
fileLocations?: readonly string[] | undefined;
|
|
367
367
|
};
|
|
368
368
|
/**
|
|
369
|
-
* Whether a sandbox policy can name `value` as
|
|
370
|
-
*
|
|
371
|
-
* or an IPv4 address. `mcpAppSandboxPolicy` throws for
|
|
372
|
-
* checks its settings with this once,
|
|
369
|
+
* Whether a sandbox policy can name `value` as the sandbox, or as a framing
|
|
370
|
+
* page served from the network: an `http(s)` origin exactly as `URL` writes
|
|
371
|
+
* it, whose host is a name or an IPv4 address. `mcpAppSandboxPolicy` throws for
|
|
372
|
+
* any other sandbox origin, so a host checks its settings with this once,
|
|
373
|
+
* before it serves a view.
|
|
373
374
|
*/
|
|
374
375
|
export declare function isMcpAppPolicyOrigin(value: string): boolean;
|
|
376
|
+
/**
|
|
377
|
+
* The origin of the pages an app bundles and serves itself, from no network
|
|
378
|
+
* origin: the one framing page a sandbox policy names that is no `http(s)`
|
|
379
|
+
* origin. `URL` reads it as the opaque origin `null`, so it is matched as this
|
|
380
|
+
* exact string. It is never the sandbox, never a file location, and names no
|
|
381
|
+
* host, so no declared domain is dropped for naming it.
|
|
382
|
+
*/
|
|
383
|
+
export declare const MCP_APP_BUNDLED_PAGE_ORIGIN = "tauri://localhost";
|
|
384
|
+
/**
|
|
385
|
+
* Whether a sandbox policy can name `value` as a framing page: an origin
|
|
386
|
+
* `isMcpAppPolicyOrigin` admits, or exactly `MCP_APP_BUNDLED_PAGE_ORIGIN`.
|
|
387
|
+
* `mcpAppSandboxPolicy` throws for any other.
|
|
388
|
+
*/
|
|
389
|
+
export declare function isMcpAppFramingOrigin(value: string): boolean;
|
|
375
390
|
/**
|
|
376
391
|
* The domains a view's sandbox policy applies, per `_meta.ui.csp` list, as a
|
|
377
392
|
* host reports them in `hostCapabilities.sandbox.csp`: those
|
|
378
393
|
* `isMcpAppCspDomain` admits, lowercased and once each, without any that names
|
|
379
|
-
* the host and port of
|
|
380
|
-
* scheme. `undefined` when it applies none. Throws as `mcpAppSandboxPolicy`
|
|
394
|
+
* the host and port of an `http(s)` framing page or of the sandbox itself,
|
|
395
|
+
* whatever its scheme. `undefined` when it applies none. Throws as `mcpAppSandboxPolicy`
|
|
381
396
|
* does for the origins.
|
|
382
397
|
*/
|
|
383
398
|
export declare function appliedMcpAppCsp({ csp, ...origins }: Omit<McpAppSandboxPolicyInput, "fileLocations">): McpUiCsp | undefined;
|
|
@@ -390,9 +405,10 @@ export declare function appliedMcpAppCsp({ csp, ...origins }: Omit<McpAppSandbox
|
|
|
390
405
|
* document renderer's decoders do.
|
|
391
406
|
*
|
|
392
407
|
* Anyone can ask for a sandbox page with any query, so every value is checked
|
|
393
|
-
* before it is written: an ancestor
|
|
394
|
-
*
|
|
408
|
+
* before it is written: an ancestor that is no framing origin
|
|
409
|
+
* (`isMcpAppFramingOrigin`) or a sandbox origin that is no exact origin
|
|
410
|
+
* (`isMcpAppPolicyOrigin`) throws, as does a sandbox origin among the
|
|
395
411
|
* ancestors, and a domain or a file location its rule refuses is dropped. A
|
|
396
|
-
* file location is kept only on
|
|
412
|
+
* file location is kept only on an `http(s)` framing page's origin.
|
|
397
413
|
*/
|
|
398
414
|
export declare function mcpAppSandboxPolicy({ fileLocations, ...view }: McpAppSandboxPolicyInput): string;
|
package/dist/protocol/push.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* Push contract shared by the browser, the service worker, and the gateway. A
|
|
4
|
+
* device registers through one transport, Web Push or APNs. One Web Push
|
|
5
|
+
* message is about one Session. It always carries the category, the Agent and
|
|
6
|
+
* Session ids, when the Session's newest event happened, and the device
|
|
6
7
|
* locale. A device whose registration is under 30 days old may also get the
|
|
7
8
|
* Agent's name, the Session's title, and a preview of what is asked: each one
|
|
8
9
|
* line, cut to its `PUSH_TEXT_LIMITS` entry, with credentials masked. Every
|
|
@@ -87,16 +88,31 @@ export declare const PushSubscriptionJsonSchema: z.ZodObject<{
|
|
|
87
88
|
}, z.core.$strict>;
|
|
88
89
|
}, z.core.$strict>;
|
|
89
90
|
export type PushSubscriptionJson = z.infer<typeof PushSubscriptionJsonSchema>;
|
|
90
|
-
/**
|
|
91
|
+
/**
|
|
92
|
+
* `GET /push`: `status` and `publicKey` are Web Push's, and `apns` says
|
|
93
|
+
* whether a device may register through APNs.
|
|
94
|
+
*/
|
|
91
95
|
export declare const PushInfoSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
96
|
+
apns: z.ZodOptional<z.ZodLiteral<true>>;
|
|
92
97
|
status: z.ZodLiteral<"not-configured">;
|
|
93
98
|
}, z.core.$strict>, z.ZodObject<{
|
|
99
|
+
apns: z.ZodOptional<z.ZodLiteral<true>>;
|
|
94
100
|
status: z.ZodLiteral<"available">;
|
|
95
101
|
publicKey: z.ZodString;
|
|
96
102
|
}, z.core.$strict>], "status">;
|
|
97
103
|
export type PushInfo = z.infer<typeof PushInfoSchema>;
|
|
98
|
-
/**
|
|
99
|
-
export declare const
|
|
104
|
+
/** A browser's registration; one that names no `transport` is this one. */
|
|
105
|
+
export declare const WebPushRegistrationSchema: z.ZodObject<{
|
|
106
|
+
locale: z.ZodEnum<{
|
|
107
|
+
en: "en";
|
|
108
|
+
he: "he";
|
|
109
|
+
}>;
|
|
110
|
+
categories: z.ZodObject<{
|
|
111
|
+
input: z.ZodBoolean;
|
|
112
|
+
failure: z.ZodBoolean;
|
|
113
|
+
completion: z.ZodBoolean;
|
|
114
|
+
}, z.core.$strict>;
|
|
115
|
+
transport: z.ZodOptional<z.ZodLiteral<"web-push">>;
|
|
100
116
|
subscription: z.ZodObject<{
|
|
101
117
|
endpoint: z.ZodString;
|
|
102
118
|
expirationTime: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
@@ -105,6 +121,16 @@ export declare const PushRegistrationSchema: z.ZodObject<{
|
|
|
105
121
|
auth: z.ZodString;
|
|
106
122
|
}, z.core.$strict>;
|
|
107
123
|
}, z.core.$strict>;
|
|
124
|
+
}, z.core.$strict>;
|
|
125
|
+
export type WebPushRegistration = z.infer<typeof WebPushRegistrationSchema>;
|
|
126
|
+
/** An APNs device token: 32 to 100 bytes as hex, in either case, kept lowercase. */
|
|
127
|
+
export declare const ApnsDeviceTokenSchema: z.ZodString;
|
|
128
|
+
/**
|
|
129
|
+
* A device's APNs registration: its token, and the APNs environment that
|
|
130
|
+
* issued it. The topic and the credentials the gateway sends with are its own
|
|
131
|
+
* configuration, never a device's.
|
|
132
|
+
*/
|
|
133
|
+
export declare const ApnsRegistrationSchema: z.ZodObject<{
|
|
108
134
|
locale: z.ZodEnum<{
|
|
109
135
|
en: "en";
|
|
110
136
|
he: "he";
|
|
@@ -114,10 +140,58 @@ export declare const PushRegistrationSchema: z.ZodObject<{
|
|
|
114
140
|
failure: z.ZodBoolean;
|
|
115
141
|
completion: z.ZodBoolean;
|
|
116
142
|
}, z.core.$strict>;
|
|
143
|
+
transport: z.ZodLiteral<"apns">;
|
|
144
|
+
token: z.ZodString;
|
|
145
|
+
environment: z.ZodEnum<{
|
|
146
|
+
production: "production";
|
|
147
|
+
sandbox: "sandbox";
|
|
148
|
+
}>;
|
|
117
149
|
}, z.core.$strict>;
|
|
150
|
+
export type ApnsRegistration = z.infer<typeof ApnsRegistrationSchema>;
|
|
151
|
+
/** `PUT /push/subscriptions`: one device, by its transport. */
|
|
152
|
+
export declare const PushRegistrationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
153
|
+
locale: z.ZodEnum<{
|
|
154
|
+
en: "en";
|
|
155
|
+
he: "he";
|
|
156
|
+
}>;
|
|
157
|
+
categories: z.ZodObject<{
|
|
158
|
+
input: z.ZodBoolean;
|
|
159
|
+
failure: z.ZodBoolean;
|
|
160
|
+
completion: z.ZodBoolean;
|
|
161
|
+
}, z.core.$strict>;
|
|
162
|
+
transport: z.ZodOptional<z.ZodLiteral<"web-push">>;
|
|
163
|
+
subscription: z.ZodObject<{
|
|
164
|
+
endpoint: z.ZodString;
|
|
165
|
+
expirationTime: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
166
|
+
keys: z.ZodObject<{
|
|
167
|
+
p256dh: z.ZodString;
|
|
168
|
+
auth: z.ZodString;
|
|
169
|
+
}, z.core.$strict>;
|
|
170
|
+
}, z.core.$strict>;
|
|
171
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
172
|
+
locale: z.ZodEnum<{
|
|
173
|
+
en: "en";
|
|
174
|
+
he: "he";
|
|
175
|
+
}>;
|
|
176
|
+
categories: z.ZodObject<{
|
|
177
|
+
input: z.ZodBoolean;
|
|
178
|
+
failure: z.ZodBoolean;
|
|
179
|
+
completion: z.ZodBoolean;
|
|
180
|
+
}, z.core.$strict>;
|
|
181
|
+
transport: z.ZodLiteral<"apns">;
|
|
182
|
+
token: z.ZodString;
|
|
183
|
+
environment: z.ZodEnum<{
|
|
184
|
+
production: "production";
|
|
185
|
+
sandbox: "sandbox";
|
|
186
|
+
}>;
|
|
187
|
+
}, z.core.$strict>], "transport">;
|
|
118
188
|
export type PushRegistration = z.infer<typeof PushRegistrationSchema>;
|
|
119
|
-
/** `DELETE /push/subscriptions
|
|
120
|
-
export declare const PushUnregistrationSchema: z.ZodObject<{
|
|
189
|
+
/** `DELETE /push/subscriptions`: one device, by its transport's own key. */
|
|
190
|
+
export declare const PushUnregistrationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
191
|
+
transport: z.ZodOptional<z.ZodLiteral<"web-push">>;
|
|
121
192
|
endpoint: z.ZodString;
|
|
122
|
-
}, z.core.$strict
|
|
193
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
194
|
+
transport: z.ZodLiteral<"apns">;
|
|
195
|
+
token: z.ZodString;
|
|
196
|
+
}, z.core.$strict>], "transport">;
|
|
123
197
|
export type PushUnregistration = z.infer<typeof PushUnregistrationSchema>;
|
package/dist/protocol/sdk.js
CHANGED
|
@@ -17,6 +17,8 @@ import {
|
|
|
17
17
|
McpAppFileReadErrorDataSchema2,
|
|
18
18
|
MCP_APP_SANDBOX_PATH2,
|
|
19
19
|
isMcpAppPolicyOrigin2,
|
|
20
|
+
MCP_APP_BUNDLED_PAGE_ORIGIN2,
|
|
21
|
+
isMcpAppFramingOrigin2,
|
|
20
22
|
appliedMcpAppCsp2,
|
|
21
23
|
mcpAppSandboxPolicy2,
|
|
22
24
|
SESSION_CATALOG_MAX_WINDOW2,
|
|
@@ -152,6 +154,9 @@ import {
|
|
|
152
154
|
PushCategoriesSchema2,
|
|
153
155
|
PushSubscriptionJsonSchema2,
|
|
154
156
|
PushInfoSchema2,
|
|
157
|
+
WebPushRegistrationSchema2,
|
|
158
|
+
ApnsDeviceTokenSchema2,
|
|
159
|
+
ApnsRegistrationSchema2,
|
|
155
160
|
PushRegistrationSchema2,
|
|
156
161
|
PushUnregistrationSchema2
|
|
157
162
|
} from "../chunks/index.js";
|
|
@@ -213,6 +218,8 @@ export {
|
|
|
213
218
|
AgentUpdateFields2 as AgentUpdateFields,
|
|
214
219
|
AgentUpdateRequestSchema2 as AgentUpdateRequestSchema,
|
|
215
220
|
AgentUpdateResponseSchema2 as AgentUpdateResponseSchema,
|
|
221
|
+
ApnsDeviceTokenSchema2 as ApnsDeviceTokenSchema,
|
|
222
|
+
ApnsRegistrationSchema2 as ApnsRegistrationSchema,
|
|
216
223
|
ArtifactDescriptorSchema2 as ArtifactDescriptorSchema,
|
|
217
224
|
COALESCE_WINDOW_MS2 as COALESCE_WINDOW_MS,
|
|
218
225
|
CallToolResultSchema2 as CallToolResultSchema,
|
|
@@ -290,6 +297,7 @@ export {
|
|
|
290
297
|
MAX_SPEECH_BYTES,
|
|
291
298
|
MAX_SPEECH_TEXT_BYTES,
|
|
292
299
|
MAX_TRANSCRIPT_BYTES,
|
|
300
|
+
MCP_APP_BUNDLED_PAGE_ORIGIN2 as MCP_APP_BUNDLED_PAGE_ORIGIN,
|
|
293
301
|
MCP_APP_SANDBOX_PATH2 as MCP_APP_SANDBOX_PATH,
|
|
294
302
|
McpAppFileReadErrorDataSchema2 as McpAppFileReadErrorDataSchema,
|
|
295
303
|
McpAppFileReadFailureSchema2 as McpAppFileReadFailureSchema,
|
|
@@ -357,11 +365,13 @@ export {
|
|
|
357
365
|
TurnSteerRequestSchema2 as TurnSteerRequestSchema,
|
|
358
366
|
TurnSteerResponseSchema2 as TurnSteerResponseSchema,
|
|
359
367
|
TurnStopResponseSchema2 as TurnStopResponseSchema,
|
|
368
|
+
WebPushRegistrationSchema2 as WebPushRegistrationSchema,
|
|
360
369
|
appliedMcpAppCsp2 as appliedMcpAppCsp,
|
|
361
370
|
categoryOf2 as categoryOf,
|
|
362
371
|
formatArtifactUri2 as formatArtifactUri,
|
|
363
372
|
hgwAcpAgentPath2 as hgwAcpAgentPath,
|
|
364
373
|
isMcpAppCspDomain2 as isMcpAppCspDomain,
|
|
374
|
+
isMcpAppFramingOrigin2 as isMcpAppFramingOrigin,
|
|
365
375
|
isMcpAppPolicyOrigin2 as isMcpAppPolicyOrigin,
|
|
366
376
|
mcpAppSandboxPolicy2 as mcpAppSandboxPolicy,
|
|
367
377
|
newestSessionFirst2 as newestSessionFirst,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@harness-gw/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.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",
|