@ziggy-ai/client-sdk 1.2.6 → 1.3.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/CHANGELOG.md +18 -0
- package/README.md +21 -6
- package/dist/agents.d.ts +0 -1
- package/dist/analytics.d.ts +0 -1
- package/dist/app-intel.d.ts +0 -1
- package/dist/app.d.ts +35 -2
- package/dist/auth.d.ts +0 -1
- package/dist/callback-handler.d.ts +48 -6
- package/dist/chat.d.ts +8 -9
- package/dist/connection.d.ts +0 -1
- package/dist/context.d.ts +0 -1
- package/dist/conversations.d.ts +9 -1
- package/dist/element-registry.d.ts +0 -1
- package/dist/errors.d.ts +0 -1
- package/dist/feedback.d.ts +0 -1
- package/dist/hooks.d.ts +0 -1
- package/dist/index.d.ts +3 -4
- package/dist/index.js +126 -3
- package/dist/notifications.d.ts +0 -1
- package/dist/observer.d.ts +0 -1
- package/dist/persistence.d.ts +0 -1
- package/dist/product-memory.d.ts +0 -1
- package/dist/quests.d.ts +0 -1
- package/dist/screenshot-uploader.d.ts +0 -1
- package/dist/screenshot.d.ts +0 -1
- package/dist/session.d.ts +0 -1
- package/dist/signals.d.ts +0 -1
- package/dist/storage.d.ts +0 -1
- package/dist/stream-parser.d.ts +0 -1
- package/dist/testing.d.ts +0 -1
- package/dist/tickets.d.ts +0 -1
- package/dist/tools.d.ts +0 -1
- package/dist/triggers.d.ts +0 -1
- package/dist/types.d.ts +168 -2
- package/dist/ui-actions.d.ts +0 -1
- package/dist/voice.d.ts +0 -1
- package/package.json +49 -48
- package/dist/agents.d.ts.map +0 -1
- package/dist/analytics.d.ts.map +0 -1
- package/dist/app-intel.d.ts.map +0 -1
- package/dist/app.d.ts.map +0 -1
- package/dist/auth.d.ts.map +0 -1
- package/dist/callback-handler.d.ts.map +0 -1
- package/dist/chat.d.ts.map +0 -1
- package/dist/connection.d.ts.map +0 -1
- package/dist/context.d.ts.map +0 -1
- package/dist/conversations.d.ts.map +0 -1
- package/dist/element-registry.d.ts.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/feedback.d.ts.map +0 -1
- package/dist/hooks.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/notifications.d.ts.map +0 -1
- package/dist/observer.d.ts.map +0 -1
- package/dist/persistence.d.ts.map +0 -1
- package/dist/product-memory.d.ts.map +0 -1
- package/dist/quests.d.ts.map +0 -1
- package/dist/screenshot-uploader.d.ts.map +0 -1
- package/dist/screenshot.d.ts.map +0 -1
- package/dist/session.d.ts.map +0 -1
- package/dist/signals.d.ts.map +0 -1
- package/dist/storage.d.ts.map +0 -1
- package/dist/stream-parser.d.ts.map +0 -1
- package/dist/testing.d.ts.map +0 -1
- package/dist/tickets.d.ts.map +0 -1
- package/dist/tools.d.ts.map +0 -1
- package/dist/triggers.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/ui-actions.d.ts.map +0 -1
- package/dist/voice.d.ts.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# @ziggy-ai/client-sdk changelog
|
|
2
|
+
|
|
3
|
+
## 1.3.0
|
|
4
|
+
|
|
5
|
+
Includes the unpublished 1.2.7 changes.
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- `client.app.getCallback()` / `setCallbackUrl(url | null)`: read and set the app's callback URL (HTTPS, public destinations only).
|
|
9
|
+
- `verifyCallbackSignature(headers, rawBody, { secret, toleranceMs? })`: checks `X-Ziggy-Timestamp` / `X-Ziggy-Signature` (HMAC-SHA256 over `timestamp.rawBody`, 5-minute window, constant-time compare) with Web Crypto.
|
|
10
|
+
- `CallbackHandler.handleRequest(request, { secret, allowUnsigned? })`: verify and dispatch a fetch-style `Request`; 401 before any handler runs. Fails closed (500) when `secret` is empty unless `allowUnsigned: true`.
|
|
11
|
+
- `client.app.setProfile()`, `approveProfile()`, `addDomainConcept()`: owner-written App Profile and product terms.
|
|
12
|
+
- Types: `AppCallbackResponse` (with `signing`), `OwnerProfileFields`, `SetProfileResponse`, `AddDomainConceptRequest`, `AddDomainConceptResponse`, `VerifyCallbackOptions`, `CallbackVerification`.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
- README callback example now verifies signatures (`handleRequest`); `handle(body)` alone does not.
|
|
16
|
+
|
|
17
|
+
### Not yet in the SDK
|
|
18
|
+
- Editing an owner-written term (`PATCH /v1/apps/domain-research/concepts/:id`); planned for 1.3.1.
|
package/README.md
CHANGED
|
@@ -176,7 +176,9 @@ await ziggy.app.deleteCredentials();
|
|
|
176
176
|
|
|
177
177
|
### Callback Handler
|
|
178
178
|
|
|
179
|
-
Handle tool execution requests from Ziggy. When Ziggy needs your app to do something (navigate, retry a process,
|
|
179
|
+
Handle tool execution requests from Ziggy. When Ziggy needs your app to do something (navigate, retry a process, run an `executor: 'http'` host action), it POSTs to your registered callback URL (`client.app.setCallbackUrl()`, HTTPS only).
|
|
180
|
+
|
|
181
|
+
Every request is signed once your app has a callback secret (`POST /v1/apps/callback/secret`, or Console → Settings → Callback URL → Create signing secret). Verify it before you run anything: `handleRequest` answers `401` to a missing, wrong or stale (over 5 minutes) signature without calling any handler. It fails closed: if `secret` is empty or missing (say an unset Worker binding) it answers `500` and runs nothing. Pass `{ allowUnsigned: true }` only before your app has a secret.
|
|
180
182
|
|
|
181
183
|
```typescript
|
|
182
184
|
import { CallbackHandler } from '@ziggy-ai/client-sdk';
|
|
@@ -193,13 +195,26 @@ handler
|
|
|
193
195
|
return { retried: true };
|
|
194
196
|
});
|
|
195
197
|
|
|
196
|
-
//
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}
|
|
198
|
+
// Fetch-style servers (Cloudflare Workers, Hono, Next.js route handlers, Deno, Bun):
|
|
199
|
+
export default {
|
|
200
|
+
fetch: (request: Request, env: { ZIGGY_CALLBACK_SECRET: string }) =>
|
|
201
|
+
handler.handleRequest(request, { secret: env.ZIGGY_CALLBACK_SECRET }),
|
|
202
|
+
};
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
For other frameworks, verify with the raw body before parsing it:
|
|
206
|
+
|
|
207
|
+
```typescript
|
|
208
|
+
import { verifyCallbackSignature } from '@ziggy-ai/client-sdk';
|
|
209
|
+
|
|
210
|
+
const rawBody = await readRawBody(req); // exact bytes, not re-serialised JSON
|
|
211
|
+
const check = await verifyCallbackSignature(req.headers, rawBody, { secret: process.env.ZIGGY_CALLBACK_SECRET! });
|
|
212
|
+
if (!check.valid) return res.status(401).json({ error: check.reason });
|
|
213
|
+
res.json(await handler.handle(JSON.parse(rawBody)));
|
|
201
214
|
```
|
|
202
215
|
|
|
216
|
+
Headers: `X-Ziggy-Timestamp` (ISO 8601 UTC) and `X-Ziggy-Signature` = `v1=` + hex HMAC-SHA256 of `${timestamp}.${rawBody}` with your callback secret. `handler.handle(body)` on its own does not verify anything; only use it behind your own check.
|
|
217
|
+
|
|
203
218
|
---
|
|
204
219
|
|
|
205
220
|
### Tools
|
package/dist/agents.d.ts
CHANGED
package/dist/analytics.d.ts
CHANGED
package/dist/app-intel.d.ts
CHANGED
package/dist/app.d.ts
CHANGED
|
@@ -5,8 +5,17 @@
|
|
|
5
5
|
* (resolved server-side by auth middleware), so no appId is needed here.
|
|
6
6
|
*/
|
|
7
7
|
import type { Connection } from './connection.js';
|
|
8
|
-
import type { RegisterTriggersRequest, RegisterTriggersResponse, ListTriggersResponse, DeleteResponse, RegisterQuickActionsRequest, RegisterQuickActionsResponse, ListQuickActionsResponse, RegisterHostActionsRequest, RegisterHostActionsResponse, ListHostActionsResponse, RegisterBrandRequest, GetBrandResponse, SpokenVoiceRecommendationsResponse, SpokenVoiceConfig, SetCredentialsRequest, SetCredentialsResponse, GetCredentialsResponse, AppStatus, VerifyResponse, YoloConfig, SetYoloConfigRequest, DeploymentSettings, UpdateDeploymentSettingsRequest, TriageConfig, SetTriageConfigRequest, ToolConfig, SetToolConfigRequest, AuditTriggerResponse, ObserverConfigResponse, DesignSystemResponse, DesignTokensResponse, ComponentSpecResponse } from './types.js';
|
|
8
|
+
import type { RegisterTriggersRequest, RegisterTriggersResponse, ListTriggersResponse, DeleteResponse, RegisterQuickActionsRequest, RegisterQuickActionsResponse, ListQuickActionsResponse, RegisterHostActionsRequest, RegisterHostActionsResponse, ListHostActionsResponse, RegisterBrandRequest, OwnerProfileFields, SetProfileResponse, AddDomainConceptRequest, AddDomainConceptResponse, GetBrandResponse, SpokenVoiceRecommendationsResponse, SpokenVoiceConfig, SetCredentialsRequest, SetCredentialsResponse, GetCredentialsResponse, AppCallbackResponse, AppStatus, VerifyResponse, YoloConfig, SetYoloConfigRequest, DeploymentSettings, UpdateDeploymentSettingsRequest, TriageConfig, SetTriageConfigRequest, ToolConfig, SetToolConfigRequest, AuditTriggerResponse, ObserverConfigResponse, DesignSystemResponse, DesignTokensResponse, ComponentSpecResponse } from './types.js';
|
|
9
9
|
export declare class AppClient {
|
|
10
|
+
getConversationPolicy(): Promise<{
|
|
11
|
+
mode: 'support_led' | 'visible_team';
|
|
12
|
+
appliesTo: 'new_conversations';
|
|
13
|
+
}>;
|
|
14
|
+
/** Server-side app setup. Applies to new conversations; existing threads keep their policy. */
|
|
15
|
+
setConversationPolicy(mode: 'support_led' | 'visible_team'): Promise<{
|
|
16
|
+
mode: 'support_led' | 'visible_team';
|
|
17
|
+
appliesTo: 'new_conversations';
|
|
18
|
+
}>;
|
|
10
19
|
private connection;
|
|
11
20
|
constructor(connection: Connection);
|
|
12
21
|
/**
|
|
@@ -90,6 +99,22 @@ export declare class AppClient {
|
|
|
90
99
|
* Returns 404 with list of available component names if not found.
|
|
91
100
|
*/
|
|
92
101
|
getComponentSpec(name: string): Promise<ComponentSpecResponse>;
|
|
102
|
+
/**
|
|
103
|
+
* Write the App Profile. Creates a draft when the app has none, otherwise
|
|
104
|
+
* updates it. Agents use it only after approveProfile().
|
|
105
|
+
*/
|
|
106
|
+
setProfile(profile: OwnerProfileFields): Promise<SetProfileResponse>;
|
|
107
|
+
/** Approve the draft profile so agents treat it as the app's ground truth. */
|
|
108
|
+
approveProfile(): Promise<{
|
|
109
|
+
approved: boolean;
|
|
110
|
+
applied: boolean;
|
|
111
|
+
effect: string;
|
|
112
|
+
}>;
|
|
113
|
+
/**
|
|
114
|
+
* Add a product term (plan, package, policy). With approve: true Support may
|
|
115
|
+
* use it at once; otherwise it waits for approval in the Console.
|
|
116
|
+
*/
|
|
117
|
+
addDomainConcept(concept: AddDomainConceptRequest): Promise<AddDomainConceptResponse>;
|
|
93
118
|
/**
|
|
94
119
|
* Set or update tool credentials (encrypted at rest).
|
|
95
120
|
* Merges with existing credentials — pass only the ones to update.
|
|
@@ -103,6 +128,15 @@ export declare class AppClient {
|
|
|
103
128
|
* Delete all stored credentials.
|
|
104
129
|
*/
|
|
105
130
|
deleteCredentials(): Promise<DeleteResponse>;
|
|
131
|
+
/**
|
|
132
|
+
* Get the URL Ziggy POSTs host tool calls and http-executor actions to.
|
|
133
|
+
*/
|
|
134
|
+
getCallback(): Promise<AppCallbackResponse>;
|
|
135
|
+
/**
|
|
136
|
+
* Set (or clear with null) the callback URL. HTTPS only; the server refuses
|
|
137
|
+
* private, loopback, link-local and metadata destinations after DNS resolution.
|
|
138
|
+
*/
|
|
139
|
+
setCallbackUrl(callbackUrl: string | null): Promise<AppCallbackResponse>;
|
|
106
140
|
/**
|
|
107
141
|
* Get app setup status (brand, triggers, actions, agents, readiness).
|
|
108
142
|
*/
|
|
@@ -173,4 +207,3 @@ export declare class AppClient {
|
|
|
173
207
|
*/
|
|
174
208
|
triggerAudit(): Promise<AuditTriggerResponse>;
|
|
175
209
|
}
|
|
176
|
-
//# sourceMappingURL=app.d.ts.map
|
package/dist/auth.d.ts
CHANGED
|
@@ -6,4 +6,3 @@ import type { ZiggyClientConfig } from './types.js';
|
|
|
6
6
|
* Build default headers with API key and optional auth token.
|
|
7
7
|
*/
|
|
8
8
|
export declare function buildHeaders(config: ZiggyClientConfig, extra?: Record<string, string>): Promise<Record<string, string>>;
|
|
9
|
-
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -21,13 +21,41 @@
|
|
|
21
21
|
* return { retried: true, newProcessId: transforms.latestId };
|
|
22
22
|
* });
|
|
23
23
|
*
|
|
24
|
-
* // In
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* })
|
|
24
|
+
* // In a fetch-style server (Cloudflare Worker, Hono, Next route handler):
|
|
25
|
+
* // verifies X-Ziggy-Signature with your callback secret, then dispatches.
|
|
26
|
+
* export default {
|
|
27
|
+
* fetch: (request: Request, env: { ZIGGY_CALLBACK_SECRET: string }) =>
|
|
28
|
+
* handler.handleRequest(request, { secret: env.ZIGGY_CALLBACK_SECRET }),
|
|
29
|
+
* };
|
|
29
30
|
* ```
|
|
31
|
+
*
|
|
32
|
+
* Signing scheme (same as Ziggy signal webhooks): X-Ziggy-Timestamp is an
|
|
33
|
+
* ISO 8601 UTC time; X-Ziggy-Signature is `v1=` + hex HMAC-SHA256 of
|
|
34
|
+
* `${timestamp}.${rawBody}` keyed with the app's callback secret
|
|
35
|
+
* (POST /v1/apps/callback/secret). See docs/architecture/02-api-reference.md.
|
|
30
36
|
*/
|
|
37
|
+
export declare const DEFAULT_CALLBACK_TOLERANCE_MS: number;
|
|
38
|
+
export interface VerifyCallbackOptions {
|
|
39
|
+
/** The app's callback secret (hex string from POST /v1/apps/callback/secret). */
|
|
40
|
+
secret: string;
|
|
41
|
+
/** Max allowed clock difference between the timestamp and now. Default 5 minutes. */
|
|
42
|
+
toleranceMs?: number;
|
|
43
|
+
/** Override "now" (ms since epoch), for tests. */
|
|
44
|
+
now?: number;
|
|
45
|
+
}
|
|
46
|
+
export type CallbackVerification = {
|
|
47
|
+
valid: true;
|
|
48
|
+
} | {
|
|
49
|
+
valid: false;
|
|
50
|
+
reason: 'missing_signature' | 'bad_timestamp' | 'stale_timestamp' | 'bad_signature';
|
|
51
|
+
};
|
|
52
|
+
type HeaderSource = Headers | Record<string, string | string[] | undefined>;
|
|
53
|
+
/**
|
|
54
|
+
* Verify that a callback request came from Ziggy. Pass the raw body text,
|
|
55
|
+
* exactly as received, before any JSON parsing. Uses Web Crypto, so it runs in
|
|
56
|
+
* Cloudflare Workers, Deno, browsers and Node 18+.
|
|
57
|
+
*/
|
|
58
|
+
export declare function verifyCallbackSignature(headers: HeaderSource, rawBody: string, options: VerifyCallbackOptions): Promise<CallbackVerification>;
|
|
31
59
|
export interface CallbackRequest {
|
|
32
60
|
toolId: string;
|
|
33
61
|
params: Record<string, unknown>;
|
|
@@ -56,9 +84,23 @@ export declare class CallbackHandler {
|
|
|
56
84
|
* Returns a response object suitable for sending back as JSON.
|
|
57
85
|
*/
|
|
58
86
|
handle(request: CallbackRequest): Promise<CallbackResponse>;
|
|
87
|
+
/**
|
|
88
|
+
* Verify and handle a fetch-style Request in one call. Requests without a
|
|
89
|
+
* valid X-Ziggy-Signature, or with a timestamp outside the tolerance window,
|
|
90
|
+
* get 401 and no handler runs.
|
|
91
|
+
*
|
|
92
|
+
* Fails closed: an empty or missing `secret` (for example an unset Worker
|
|
93
|
+
* binding) answers 500 and runs nothing. Pass `allowUnsigned: true` only
|
|
94
|
+
* while your app has no callback secret yet.
|
|
95
|
+
*/
|
|
96
|
+
handleRequest(request: Request, options?: {
|
|
97
|
+
secret?: string;
|
|
98
|
+
toleranceMs?: number;
|
|
99
|
+
allowUnsigned?: boolean;
|
|
100
|
+
}): Promise<Response>;
|
|
59
101
|
/**
|
|
60
102
|
* List all registered tool IDs.
|
|
61
103
|
*/
|
|
62
104
|
get registeredTools(): string[];
|
|
63
105
|
}
|
|
64
|
-
|
|
106
|
+
export {};
|
package/dist/chat.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { Connection } from './connection.js';
|
|
8
8
|
import type { SessionManager } from './session.js';
|
|
9
|
-
import type { ChatRequest, ActionRequest, ActionResponse, StreamEvent, ConversationSummary, ConversationDetail,
|
|
9
|
+
import type { ChatRequest, ActionRequest, ActionResponse, StreamEvent, ConversationSummary, ConversationDetail, ConversationMessagesPage } from './types.js';
|
|
10
10
|
export declare class ChatClient {
|
|
11
11
|
private connection;
|
|
12
12
|
private sessionManager;
|
|
@@ -74,17 +74,17 @@ export declare class ChatClient {
|
|
|
74
74
|
*/
|
|
75
75
|
getConversation(conversationId: string, limit?: number): Promise<ConversationDetail>;
|
|
76
76
|
/**
|
|
77
|
-
* Get
|
|
78
|
-
*
|
|
77
|
+
* Get one page of a conversation's messages, oldest first.
|
|
78
|
+
* No cursor: the newest page. `beforeSeq`: the page before it (load older;
|
|
79
|
+
* continue with `olderBeforeSeq`). `afterSeq`: the page after it, to poll
|
|
80
|
+
* for newer messages (ZIG-125 live operator join; continue with `nextAfterSeq`
|
|
81
|
+
* while `hasMore`). Pass one cursor, not both.
|
|
79
82
|
*/
|
|
80
83
|
getMessages(conversationId: string, options?: number | {
|
|
81
84
|
limit?: number;
|
|
82
85
|
afterSeq?: number;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
handoffStatus?: string;
|
|
86
|
-
lastSeq?: number;
|
|
87
|
-
}>;
|
|
86
|
+
beforeSeq?: number;
|
|
87
|
+
}): Promise<ConversationMessagesPage>;
|
|
88
88
|
/**
|
|
89
89
|
* List conversations for a user (scoped to current app).
|
|
90
90
|
*/
|
|
@@ -100,4 +100,3 @@ export declare class ChatClient {
|
|
|
100
100
|
};
|
|
101
101
|
}>;
|
|
102
102
|
}
|
|
103
|
-
//# sourceMappingURL=chat.d.ts.map
|
package/dist/connection.d.ts
CHANGED
package/dist/context.d.ts
CHANGED
package/dist/conversations.d.ts
CHANGED
|
@@ -8,9 +8,18 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import type { Connection } from './connection.js';
|
|
10
10
|
import type { RoomEvent, RoomParticipantsResponse, InviteHumanRequest, InviteHumanResponse } from './types.js';
|
|
11
|
+
import type { ConversationPartnerState, ConversationPartnerCommand } from './types.js';
|
|
11
12
|
export declare class ConversationsClient {
|
|
12
13
|
private connection;
|
|
13
14
|
constructor(connection: Connection);
|
|
15
|
+
partner(conversationId: string): Promise<ConversationPartnerState>;
|
|
16
|
+
changePartner(conversationId: string, command: ConversationPartnerCommand): Promise<{
|
|
17
|
+
receipt: {
|
|
18
|
+
revision: number;
|
|
19
|
+
replayed: boolean;
|
|
20
|
+
};
|
|
21
|
+
state: ConversationPartnerState;
|
|
22
|
+
}>;
|
|
14
23
|
/**
|
|
15
24
|
* Subscribe to the room feed. Replays events after `afterSeq`, then stays
|
|
16
25
|
* open; heartbeats arrive as `{ type: 'heartbeat', seq: -1 }`. Abort the
|
|
@@ -25,4 +34,3 @@ export declare class ConversationsClient {
|
|
|
25
34
|
/** The end user asks for a person. Idempotent while one is already requested or present. */
|
|
26
35
|
invite(conversationId: string, request?: InviteHumanRequest): Promise<InviteHumanResponse>;
|
|
27
36
|
}
|
|
28
|
-
//# sourceMappingURL=conversations.d.ts.map
|
package/dist/errors.d.ts
CHANGED
package/dist/feedback.d.ts
CHANGED
package/dist/hooks.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -134,12 +134,12 @@ export declare class ZiggyClient {
|
|
|
134
134
|
*/
|
|
135
135
|
disconnect(): Promise<void>;
|
|
136
136
|
}
|
|
137
|
-
export type { ZiggyClientConfig, CreateSessionRequest, SessionResponse, SessionExperiences, ExperienceKey, ExperienceWalkthroughStep, SessionConfig, AgentSummary, CatalogAgent, AgentListResponse, CatalogTool, AgentDetailResponse, PageContext, ProcessContext, ContentContext, UserContext, ErrorEntry, SupportContext, ContextPushRequest, ContextPushResponse, ContextEvent, ChatRequest, ChatResponse, ChatAttachment, ActionRequest, ActionResponse, Confidence, Source, ToolUsage, StreamEvent, StreamStartEvent, AgentStartEvent, AgentSwitchEvent, ToolStartEvent, ToolProgressEvent, ToolResultEvent, ContentDeltaEvent, ContentDoneEvent, MetadataEvent, StreamEndEvent, StreamErrorEvent, ToolErrorEvent, ReturnHandoffEvent, ActivityEvent, QuestStatusEvent, QuestStepUpdateEvent, QuestCompleteEvent, WalkthroughStep, UIHighlightEvent, UIScrollEvent, UIClickEvent, UITypeEvent, UIWalkthroughEvent, UINavigateEvent, UIScreenshotAnalysisEvent, UISurfaceEvent, HostActionEvent, ChatSurfaceMode, HostActionDefinition, RegisterHostActionsRequest, RegisterHostActionsResponse, ListHostActionsResponse, ScreenshotAnnotation, WalkthroughResult, BrandConfig, SpokenVoiceConfig, SpokenVoiceRecommendation, SpokenVoiceRecommendationsResponse, ProactiveTrigger, QuickAction, ToolInvokeRequest, ToolInvokeResponse, ReactionRequest, FeedbackRequest, Quest, QuestStep, TriggerCondition, TriggerRegistration, RegisterTriggersRequest, RegisterTriggersResponse, ListTriggersResponse, DeleteResponse, QuickActionSetConditions, QuickActionSet, RegisterQuickActionsRequest, RegisterQuickActionsResponse, ListQuickActionsResponse, RegisterBrandRequest, GetBrandResponse, SetCredentialsRequest, SetCredentialsResponse, GetCredentialsResponse, Ticket, CreateTicketRequest, CreateTicketResponse, UpdateTicketRequest, TicketFilters, TicketResponse, CreateTicketResponseRequest, TicketAnalysis, TimelineEvent, TicketTimeline, TicketConversation, TriageTicket, TicketPattern, MediaAttachment, RequestUploadRequest, RequestUploadResponse, ConfirmUploadResponse, UploadMediaRequest, UploadMediaResponse, VoiceTokenResponse, VoiceTtsResult, VoiceTtsAudio, VoiceTtsFallback, LiveConversationState, LiveSessionCreateRequest, LiveSessionCreateResponse, LiveSessionCloseResponse, LiveInterruptResponse, LiveSessionStatus, LiveStateEvent, LiveTranscriptEvent, LiveTurnEvent, LiveCommentaryEvent, LiveUsageEvent, LiveClosedEvent, DiscoveryJobStatus, PageType, DiscoveryJob, DiscoveredPage, AnalysisType, AnalysisIssue, AnalysisResult, SpecialistAnalysis, AppPersona, TestScenario, TestStrategy, ChangeEvent, ScreenshotConfig, ScreencastConfig, ScreencastFrame, TestRunStatus, TestResultStatus, TestRun, TestResult, StepResult, TestInsight, TriggerDiscoveryRequest, TriggerAnalysisRequest, GeneratePersonasRequest, GenerateTestScenariosRequest, GenerateTestStrategyRequest, DetectChangesRequest, CaptureScreenshotsRequest, StartTestRunRequest, AnalyzeTestRunRequest, ConversationMessage, ConversationSummary, ConversationDetail, AppStatus, VerifyResponse, YoloConfig, SetYoloConfigRequest, DeploymentSettings, UpdateDeploymentSettingsRequest, TriageConfig, SetTriageConfigRequest, ToolConfig, SetToolConfigRequest, ObservationCycle, ObservationCycleDetail, Observation, HealthScore, HealthScoreResponse, SignalsResponse, SelfTestCycle, SelfTestCycleDetail, SuiteResult, SelfTestResult, TestingBrainReport, SelfTestTrend, TriggerResponse, EngineeringJob, EngineeringProposal, ProposalDeployment, TriggerEngineeringRequest, UpdateProposalRequest, TriggerDeploymentRequest, UpdateDeploymentRequest, AuditTriggerResponse, ObserverConfigResponse, DesignTokens, ComponentSpec, DesignSystemResponse, DesignTokensResponse, ComponentSpecResponse, Notification, NotificationType, NotificationSeverity, NotificationStatus, NotificationsResponse, NotificationCountResponse, CodeChangeEvent, SignificanceLevel, StreamCollectingEvent, StreamQueuedEvent, StreamSteeringEvent, StreamInterruptedEvent, CoalesceResponse, TurnMetrics, TurnStartedEvent, TurnMetricsEvent, TurnCompletedEvent, SpanStartedEvent, SpanCompletedEvent, SpanErrorEvent, UICaptureScreenshotEvent, CrewPlanEvent, AgentDispatchedEvent, AgentProgressEvent, AgentFindingEvent, AgentCompleteEvent, CrewSynthesisEvent, CrewCompleteEvent, CrewAwaitingApprovalEvent, CrewApprovedEvent, CrewCancelledEvent, CrewStoppedEvent, AgentHandoffEvent, HookName, HookStyle, WebhookHook, CreateHookRequest, UpdateHookRequest, ListHooksResponse, InboundSignalStatus, InboundSignalOutcome, InboundSignalEnvironment, InboundSignalPriority, InboundSignalRelease, InboundSignal, CreateInboundSignalRequest, CreateInboundSignalResponse, InboundSignalFilters, InboundSignalDetailResponse, SignalAutomationMode, AutomationPolicy, SetAutomationPolicyRequest, SignalWebhookEventType, SignalWebhookSubscription, CreateSignalWebhookSubscriptionRequest, UpdateSignalWebhookSubscriptionRequest, CreateSignalWebhookSubscriptionResponse, SignalWebhookDeliveryStatus, SignalWebhookDelivery, RoomParticipantKind, RoomParticipantRole, RoomParticipantMode, RoomPresenceState, Participant, RoomEventType, RoomEvent, RoutingSignal, RoutingEvent, RoomParticipantsResponse, InviteHumanRequest, InviteHumanResponse, } from './types.js';
|
|
137
|
+
export type { RecommendationDiscussionReference, BrowserReviewDiscussionReference, ZiggyClientConfig, CreateSessionRequest, SessionResponse, SessionExperiences, ExperienceKey, ExperienceWalkthroughStep, SessionConfig, AgentSummary, CatalogAgent, AgentListResponse, CatalogTool, AgentDetailResponse, PageContext, ProcessContext, ContentContext, UserContext, ErrorEntry, SupportContext, ContextPushRequest, ContextPushResponse, ContextEvent, ChatRequest, ChatResponse, ChatAttachment, ActionRequest, ActionResponse, Confidence, Source, ToolUsage, StreamEvent, StreamStartEvent, AgentStartEvent, AgentSwitchEvent, ToolStartEvent, ToolProgressEvent, ToolResultEvent, ContentDeltaEvent, ContentDoneEvent, MetadataEvent, StreamEndEvent, StreamErrorEvent, ToolErrorEvent, ReturnHandoffEvent, ActivityEvent, QuestStatusEvent, QuestStepUpdateEvent, QuestCompleteEvent, WalkthroughStep, UIHighlightEvent, UIScrollEvent, UIClickEvent, UITypeEvent, UIWalkthroughEvent, UINavigateEvent, UIScreenshotAnalysisEvent, UISurfaceEvent, HostActionEvent, ChatSurfaceMode, HostActionDefinition, RegisterHostActionsRequest, RegisterHostActionsResponse, ListHostActionsResponse, ScreenshotAnnotation, WalkthroughResult, BrandConfig, SpokenVoiceConfig, SpokenVoiceRecommendation, SpokenVoiceRecommendationsResponse, ProactiveTrigger, QuickAction, ToolInvokeRequest, ToolInvokeResponse, ReactionRequest, FeedbackRequest, Quest, QuestStep, TriggerCondition, TriggerRegistration, RegisterTriggersRequest, RegisterTriggersResponse, ListTriggersResponse, DeleteResponse, QuickActionSetConditions, QuickActionSet, RegisterQuickActionsRequest, RegisterQuickActionsResponse, ListQuickActionsResponse, RegisterBrandRequest, OwnerProfileFields, SetProfileResponse, AddDomainConceptRequest, AddDomainConceptResponse, GetBrandResponse, SetCredentialsRequest, SetCredentialsResponse, GetCredentialsResponse, AppCallbackResponse, Ticket, CreateTicketRequest, CreateTicketResponse, UpdateTicketRequest, TicketFilters, TicketResponse, CreateTicketResponseRequest, TicketAnalysis, TimelineEvent, TicketTimeline, TicketConversation, TriageTicket, TicketPattern, MediaAttachment, RequestUploadRequest, RequestUploadResponse, ConfirmUploadResponse, UploadMediaRequest, UploadMediaResponse, VoiceTokenResponse, VoiceTtsResult, VoiceTtsAudio, VoiceTtsFallback, LiveConversationState, LiveSessionCreateRequest, LiveSessionCreateResponse, LiveSessionCloseResponse, LiveInterruptResponse, LiveSessionStatus, LiveStateEvent, LiveTranscriptEvent, LiveTurnEvent, LiveCommentaryEvent, LiveUsageEvent, LiveClosedEvent, DiscoveryJobStatus, PageType, DiscoveryJob, DiscoveredPage, AnalysisType, AnalysisIssue, AnalysisResult, SpecialistAnalysis, AppPersona, TestScenario, TestStrategy, ChangeEvent, ScreenshotConfig, ScreencastConfig, ScreencastFrame, TestRunStatus, TestResultStatus, TestRun, TestResult, StepResult, TestInsight, TriggerDiscoveryRequest, TriggerAnalysisRequest, GeneratePersonasRequest, GenerateTestScenariosRequest, GenerateTestStrategyRequest, DetectChangesRequest, CaptureScreenshotsRequest, StartTestRunRequest, AnalyzeTestRunRequest, ConversationPartnerState, ConversationPartnerCommand, ConversationMessage, ConversationSummary, ConversationDetail, ConversationMessagesPage, AppStatus, VerifyResponse, YoloConfig, SetYoloConfigRequest, DeploymentSettings, UpdateDeploymentSettingsRequest, TriageConfig, SetTriageConfigRequest, ToolConfig, SetToolConfigRequest, ObservationCycle, ObservationCycleDetail, Observation, HealthScore, HealthScoreResponse, SignalsResponse, SelfTestCycle, SelfTestCycleDetail, SuiteResult, SelfTestResult, TestingBrainReport, SelfTestTrend, TriggerResponse, EngineeringJob, EngineeringProposal, ProposalDeployment, TriggerEngineeringRequest, UpdateProposalRequest, TriggerDeploymentRequest, UpdateDeploymentRequest, AuditTriggerResponse, ObserverConfigResponse, DesignTokens, ComponentSpec, DesignSystemResponse, DesignTokensResponse, ComponentSpecResponse, Notification, NotificationType, NotificationSeverity, NotificationStatus, NotificationsResponse, NotificationCountResponse, CodeChangeEvent, SignificanceLevel, StreamCollectingEvent, StreamQueuedEvent, StreamSteeringEvent, StreamInterruptedEvent, CoalesceResponse, TurnMetrics, TurnStartedEvent, TurnMetricsEvent, TurnCompletedEvent, SpanStartedEvent, SpanCompletedEvent, SpanErrorEvent, UICaptureScreenshotEvent, CrewPlanEvent, AgentDispatchedEvent, AgentProgressEvent, AgentFindingEvent, AgentCompleteEvent, CrewSynthesisEvent, CrewCompleteEvent, CrewAwaitingApprovalEvent, CrewApprovedEvent, CrewCancelledEvent, CrewStoppedEvent, AgentHandoffEvent, HookName, HookStyle, WebhookHook, CreateHookRequest, UpdateHookRequest, ListHooksResponse, InboundSignalStatus, InboundSignalOutcome, InboundSignalEnvironment, InboundSignalPriority, InboundSignalRelease, InboundSignal, CreateInboundSignalRequest, CreateInboundSignalResponse, InboundSignalFilters, InboundSignalDetailResponse, SignalAutomationMode, AutomationPolicy, SetAutomationPolicyRequest, SignalWebhookEventType, SignalWebhookSubscription, CreateSignalWebhookSubscriptionRequest, UpdateSignalWebhookSubscriptionRequest, CreateSignalWebhookSubscriptionResponse, SignalWebhookDeliveryStatus, SignalWebhookDelivery, RoomParticipantKind, RoomParticipantRole, RoomParticipantMode, RoomPresenceState, Participant, RoomEventType, RoomEvent, RoutingSignal, ReclaimSignal, RoutingEvent, RoomParticipantsResponse, InviteHumanRequest, InviteHumanResponse, } from './types.js';
|
|
138
138
|
export { ZiggyError, ZiggyConnectionError } from './errors.js';
|
|
139
139
|
export { LocalStoragePersistence } from './persistence.js';
|
|
140
140
|
export type { PersistenceAdapter } from './persistence.js';
|
|
141
141
|
export { parseNdjsonStream, SequenceTracker } from './stream-parser.js';
|
|
142
|
-
export { CallbackHandler } from './callback-handler.js';
|
|
142
|
+
export { CallbackHandler, verifyCallbackSignature, DEFAULT_CALLBACK_TOLERANCE_MS } from './callback-handler.js';
|
|
143
143
|
export { ObserverClient } from './observer.js';
|
|
144
144
|
export { NotificationClient } from './notifications.js';
|
|
145
145
|
export { TestingClient } from './testing.js';
|
|
@@ -148,7 +148,7 @@ export { TriggerClient } from './triggers.js';
|
|
|
148
148
|
export { SignalClient } from './signals.js';
|
|
149
149
|
export { ConversationsClient } from './conversations.js';
|
|
150
150
|
export type { TriggerInteraction } from './triggers.js';
|
|
151
|
-
export type { CallbackRequest, CallbackResponse, ToolHandler } from './callback-handler.js';
|
|
151
|
+
export type { CallbackRequest, CallbackResponse, ToolHandler, VerifyCallbackOptions, CallbackVerification } from './callback-handler.js';
|
|
152
152
|
export { UIActionExecutor } from './ui-actions.js';
|
|
153
153
|
export type { UIActionExecutorConfig } from './ui-actions.js';
|
|
154
154
|
export { ElementRegistry } from './element-registry.js';
|
|
@@ -159,4 +159,3 @@ export { captureAndUpload } from './screenshot-uploader.js';
|
|
|
159
159
|
export type { ScreenshotUploadResult } from './screenshot-uploader.js';
|
|
160
160
|
export { PRODUCT_MEMORY_EVENT_TYPES, PRODUCT_FRICTION_KINDS, PRODUCT_SIGNAL_PREF_KEYS, isProductMemoryEventType, } from './product-memory.js';
|
|
161
161
|
export type { ProductMemoryEventType, ProductFrictionKind, ProductOutcomePayload, ProductSignalPrefKey, ProductMemoryPreferences, } from './product-memory.js';
|
|
162
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -464,14 +464,18 @@ var ChatClient = class {
|
|
|
464
464
|
return this.connection.request("GET", `/conversations/${conversationId}${params}`);
|
|
465
465
|
}
|
|
466
466
|
/**
|
|
467
|
-
* Get
|
|
468
|
-
*
|
|
467
|
+
* Get one page of a conversation's messages, oldest first.
|
|
468
|
+
* No cursor: the newest page. `beforeSeq`: the page before it (load older;
|
|
469
|
+
* continue with `olderBeforeSeq`). `afterSeq`: the page after it, to poll
|
|
470
|
+
* for newer messages (ZIG-125 live operator join; continue with `nextAfterSeq`
|
|
471
|
+
* while `hasMore`). Pass one cursor, not both.
|
|
469
472
|
*/
|
|
470
473
|
async getMessages(conversationId, options) {
|
|
471
474
|
const opts = typeof options === "number" ? { limit: options } : options || {};
|
|
472
475
|
const params = new URLSearchParams();
|
|
473
476
|
if (opts.limit !== void 0) params.set("limit", String(opts.limit));
|
|
474
477
|
if (opts.afterSeq !== void 0) params.set("afterSeq", String(opts.afterSeq));
|
|
478
|
+
if (opts.beforeSeq !== void 0) params.set("beforeSeq", String(opts.beforeSeq));
|
|
475
479
|
const qs = params.toString() ? `?${params.toString()}` : "";
|
|
476
480
|
return this.connection.request("GET", `/conversations/${conversationId}/messages${qs}`);
|
|
477
481
|
}
|
|
@@ -987,6 +991,13 @@ var AnalyticsClient = class {
|
|
|
987
991
|
|
|
988
992
|
// src/app.ts
|
|
989
993
|
var AppClient = class {
|
|
994
|
+
async getConversationPolicy() {
|
|
995
|
+
return this.connection.request("GET", "/apps/conversation-policy");
|
|
996
|
+
}
|
|
997
|
+
/** Server-side app setup. Applies to new conversations; existing threads keep their policy. */
|
|
998
|
+
async setConversationPolicy(mode) {
|
|
999
|
+
return this.connection.request("PUT", "/apps/conversation-policy", { mode });
|
|
1000
|
+
}
|
|
990
1001
|
connection;
|
|
991
1002
|
constructor(connection) {
|
|
992
1003
|
this.connection = connection;
|
|
@@ -1111,6 +1122,25 @@ var AppClient = class {
|
|
|
1111
1122
|
async getComponentSpec(name) {
|
|
1112
1123
|
return this.connection.request("GET", `/branding/design-system/component/${encodeURIComponent(name)}`);
|
|
1113
1124
|
}
|
|
1125
|
+
// ─── Product knowledge (App Profile + domain terms) ────────────────────────
|
|
1126
|
+
/**
|
|
1127
|
+
* Write the App Profile. Creates a draft when the app has none, otherwise
|
|
1128
|
+
* updates it. Agents use it only after approveProfile().
|
|
1129
|
+
*/
|
|
1130
|
+
async setProfile(profile) {
|
|
1131
|
+
return this.connection.request("PUT", "/app-profile", profile);
|
|
1132
|
+
}
|
|
1133
|
+
/** Approve the draft profile so agents treat it as the app's ground truth. */
|
|
1134
|
+
async approveProfile() {
|
|
1135
|
+
return this.connection.request("POST", "/app-profile/approve");
|
|
1136
|
+
}
|
|
1137
|
+
/**
|
|
1138
|
+
* Add a product term (plan, package, policy). With approve: true Support may
|
|
1139
|
+
* use it at once; otherwise it waits for approval in the Console.
|
|
1140
|
+
*/
|
|
1141
|
+
async addDomainConcept(concept) {
|
|
1142
|
+
return this.connection.request("POST", "/apps/domain-research/concepts", concept);
|
|
1143
|
+
}
|
|
1114
1144
|
// ─── Credentials ────────────────────────────────────────────────────────────
|
|
1115
1145
|
/**
|
|
1116
1146
|
* Set or update tool credentials (encrypted at rest).
|
|
@@ -1131,6 +1161,20 @@ var AppClient = class {
|
|
|
1131
1161
|
async deleteCredentials() {
|
|
1132
1162
|
return this.connection.request("DELETE", "/apps/credentials");
|
|
1133
1163
|
}
|
|
1164
|
+
// ─── Callback URL ───────────────────────────────────────────────────────────
|
|
1165
|
+
/**
|
|
1166
|
+
* Get the URL Ziggy POSTs host tool calls and http-executor actions to.
|
|
1167
|
+
*/
|
|
1168
|
+
async getCallback() {
|
|
1169
|
+
return this.connection.request("GET", "/apps/callback");
|
|
1170
|
+
}
|
|
1171
|
+
/**
|
|
1172
|
+
* Set (or clear with null) the callback URL. HTTPS only; the server refuses
|
|
1173
|
+
* private, loopback, link-local and metadata destinations after DNS resolution.
|
|
1174
|
+
*/
|
|
1175
|
+
async setCallbackUrl(callbackUrl) {
|
|
1176
|
+
return this.connection.request("PUT", "/apps/callback", { callbackUrl });
|
|
1177
|
+
}
|
|
1134
1178
|
// ─── Status ─────────────────────────────────────────────────────────────────
|
|
1135
1179
|
/**
|
|
1136
1180
|
* Get app setup status (brand, triggers, actions, agents, readiness).
|
|
@@ -1557,6 +1601,46 @@ var VoiceClient = class {
|
|
|
1557
1601
|
};
|
|
1558
1602
|
|
|
1559
1603
|
// src/callback-handler.ts
|
|
1604
|
+
var DEFAULT_CALLBACK_TOLERANCE_MS = 5 * 60 * 1e3;
|
|
1605
|
+
function headerValue(headers, name) {
|
|
1606
|
+
if (typeof headers.get === "function") return headers.get(name) ?? void 0;
|
|
1607
|
+
const record = headers;
|
|
1608
|
+
const key = Object.keys(record).find((k) => k.toLowerCase() === name.toLowerCase());
|
|
1609
|
+
const value = key ? record[key] : void 0;
|
|
1610
|
+
return Array.isArray(value) ? value[0] : value;
|
|
1611
|
+
}
|
|
1612
|
+
function jsonResponse(body, init = {}) {
|
|
1613
|
+
return new Response(JSON.stringify(body), { status: init.status ?? 200, headers: { "Content-Type": "application/json" } });
|
|
1614
|
+
}
|
|
1615
|
+
function toHex(bytes) {
|
|
1616
|
+
return Array.from(new Uint8Array(bytes), (b) => b.toString(16).padStart(2, "0")).join("");
|
|
1617
|
+
}
|
|
1618
|
+
function constantTimeEqual(a, b) {
|
|
1619
|
+
let diff = a.length ^ b.length;
|
|
1620
|
+
for (let i = 0; i < Math.max(a.length, b.length); i++) {
|
|
1621
|
+
diff |= (a.charCodeAt(i) || 0) ^ (b.charCodeAt(i) || 0);
|
|
1622
|
+
}
|
|
1623
|
+
return diff === 0;
|
|
1624
|
+
}
|
|
1625
|
+
async function verifyCallbackSignature(headers, rawBody, options) {
|
|
1626
|
+
const timestamp = headerValue(headers, "x-ziggy-timestamp");
|
|
1627
|
+
const signature = headerValue(headers, "x-ziggy-signature");
|
|
1628
|
+
if (!timestamp || !signature) return { valid: false, reason: "missing_signature" };
|
|
1629
|
+
const sentAt = Date.parse(timestamp);
|
|
1630
|
+
if (Number.isNaN(sentAt)) return { valid: false, reason: "bad_timestamp" };
|
|
1631
|
+
const tolerance = options.toleranceMs ?? DEFAULT_CALLBACK_TOLERANCE_MS;
|
|
1632
|
+
if (Math.abs((options.now ?? Date.now()) - sentAt) > tolerance) return { valid: false, reason: "stale_timestamp" };
|
|
1633
|
+
const encoder = new TextEncoder();
|
|
1634
|
+
const key = await crypto.subtle.importKey(
|
|
1635
|
+
"raw",
|
|
1636
|
+
encoder.encode(options.secret),
|
|
1637
|
+
{ name: "HMAC", hash: "SHA-256" },
|
|
1638
|
+
false,
|
|
1639
|
+
["sign"]
|
|
1640
|
+
);
|
|
1641
|
+
const expected = `v1=${toHex(await crypto.subtle.sign("HMAC", key, encoder.encode(`${timestamp}.${rawBody}`)))}`;
|
|
1642
|
+
return constantTimeEqual(expected, signature.trim()) ? { valid: true } : { valid: false, reason: "bad_signature" };
|
|
1643
|
+
}
|
|
1560
1644
|
var CallbackHandler = class {
|
|
1561
1645
|
handlers = /* @__PURE__ */ new Map();
|
|
1562
1646
|
/**
|
|
@@ -1598,6 +1682,37 @@ var CallbackHandler = class {
|
|
|
1598
1682
|
};
|
|
1599
1683
|
}
|
|
1600
1684
|
}
|
|
1685
|
+
/**
|
|
1686
|
+
* Verify and handle a fetch-style Request in one call. Requests without a
|
|
1687
|
+
* valid X-Ziggy-Signature, or with a timestamp outside the tolerance window,
|
|
1688
|
+
* get 401 and no handler runs.
|
|
1689
|
+
*
|
|
1690
|
+
* Fails closed: an empty or missing `secret` (for example an unset Worker
|
|
1691
|
+
* binding) answers 500 and runs nothing. Pass `allowUnsigned: true` only
|
|
1692
|
+
* while your app has no callback secret yet.
|
|
1693
|
+
*/
|
|
1694
|
+
async handleRequest(request, options = {}) {
|
|
1695
|
+
if (request.method !== "POST") return jsonResponse({ error: "Method not allowed" }, { status: 405 });
|
|
1696
|
+
const secret = options.secret?.trim() || "";
|
|
1697
|
+
if (!secret && options.allowUnsigned !== true) {
|
|
1698
|
+
return jsonResponse({ error: "Callback secret is not configured" }, { status: 500 });
|
|
1699
|
+
}
|
|
1700
|
+
const rawBody = await request.text();
|
|
1701
|
+
if (secret) {
|
|
1702
|
+
const verification = await verifyCallbackSignature(request.headers, rawBody, {
|
|
1703
|
+
secret,
|
|
1704
|
+
toleranceMs: options.toleranceMs
|
|
1705
|
+
});
|
|
1706
|
+
if (!verification.valid) return jsonResponse({ error: "Invalid signature", reason: verification.reason }, { status: 401 });
|
|
1707
|
+
}
|
|
1708
|
+
let parsed;
|
|
1709
|
+
try {
|
|
1710
|
+
parsed = JSON.parse(rawBody);
|
|
1711
|
+
} catch {
|
|
1712
|
+
return jsonResponse({ error: "Invalid JSON" }, { status: 400 });
|
|
1713
|
+
}
|
|
1714
|
+
return jsonResponse(await this.handle(parsed));
|
|
1715
|
+
}
|
|
1601
1716
|
/**
|
|
1602
1717
|
* List all registered tool IDs.
|
|
1603
1718
|
*/
|
|
@@ -1983,6 +2098,12 @@ var ConversationsClient = class {
|
|
|
1983
2098
|
constructor(connection) {
|
|
1984
2099
|
this.connection = connection;
|
|
1985
2100
|
}
|
|
2101
|
+
async partner(conversationId) {
|
|
2102
|
+
return this.connection.request("GET", `/conversations/${encodeURIComponent(conversationId)}/partner`);
|
|
2103
|
+
}
|
|
2104
|
+
async changePartner(conversationId, command) {
|
|
2105
|
+
return this.connection.request("POST", `/conversations/${encodeURIComponent(conversationId)}/partner`, command);
|
|
2106
|
+
}
|
|
1986
2107
|
/**
|
|
1987
2108
|
* Subscribe to the room feed. Replays events after `afterSeq`, then stays
|
|
1988
2109
|
* open; heartbeats arrive as `{ type: 'heartbeat', seq: -1 }`. Abort the
|
|
@@ -2465,6 +2586,7 @@ var ZiggyClient = class {
|
|
|
2465
2586
|
export {
|
|
2466
2587
|
CallbackHandler,
|
|
2467
2588
|
ConversationsClient,
|
|
2589
|
+
DEFAULT_CALLBACK_TOLERANCE_MS,
|
|
2468
2590
|
ElementRegistry,
|
|
2469
2591
|
HookClient,
|
|
2470
2592
|
LocalStoragePersistence,
|
|
@@ -2484,5 +2606,6 @@ export {
|
|
|
2484
2606
|
ZiggyError,
|
|
2485
2607
|
captureAndUpload,
|
|
2486
2608
|
isProductMemoryEventType,
|
|
2487
|
-
parseNdjsonStream
|
|
2609
|
+
parseNdjsonStream,
|
|
2610
|
+
verifyCallbackSignature
|
|
2488
2611
|
};
|
package/dist/notifications.d.ts
CHANGED
package/dist/observer.d.ts
CHANGED
package/dist/persistence.d.ts
CHANGED
|
@@ -21,4 +21,3 @@ export declare class LocalStoragePersistence implements PersistenceAdapter {
|
|
|
21
21
|
}
|
|
22
22
|
/** Build a namespaced storage key for a given app + user. */
|
|
23
23
|
export declare function persistenceKey(appId: string, userId: string, field: string): string;
|
|
24
|
-
//# sourceMappingURL=persistence.d.ts.map
|
package/dist/product-memory.d.ts
CHANGED
package/dist/quests.d.ts
CHANGED
|
@@ -24,4 +24,3 @@ export interface ScreenshotUploadResult {
|
|
|
24
24
|
* Returns an attachment ID ready to include in a chat message.
|
|
25
25
|
*/
|
|
26
26
|
export declare function captureAndUpload(storage: StorageClient, capture: ScreenshotCapture, userId: string, options?: ScreenshotOptions): Promise<ScreenshotUploadResult>;
|
|
27
|
-
//# sourceMappingURL=screenshot-uploader.d.ts.map
|
package/dist/screenshot.d.ts
CHANGED
package/dist/session.d.ts
CHANGED
package/dist/signals.d.ts
CHANGED
package/dist/storage.d.ts
CHANGED
package/dist/stream-parser.d.ts
CHANGED
package/dist/testing.d.ts
CHANGED