@av-pi-studio/client 0.0.105 → 0.0.107
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentCloneResponse, AgentCompactResponse, AgentCycleModelResponse, AgentExportHtmlResponse, AgentForkMessagesResponse, AgentForkResponse, AgentLastAssistantTextResponse, AgentListCommandsResponse, AgentNewSessionResponse, AgentSessionStatsResponse, AgentSetModelResponse, AgentSetSessionNameResponse, AgentSetThinkingResponse, AgentStreamEvent, AgentSwitchSessionResponse, AgentThinkingLevelsResponse, AgentUiPendingRequest, AgentUiRequest, AgentUiResolved, AgentUiResponse, AgentUiSurface, CreateAgentRequest, ExtensionPacksListResponse, ExtensionPacksSetResponse, FetchAgentTimelineResponse, ProviderAuthInfo, ProviderAuthType, SessionMessage, TimelineDirection } from "@av-pi-studio/protocol";
|
|
1
|
+
import type { AgentCloneResponse, AgentCompactResponse, AgentCycleModelResponse, AgentExportHtmlResponse, AgentForkMessagesResponse, AgentForkResponse, AgentLastAssistantTextResponse, AgentListCommandsResponse, AgentNewSessionResponse, AgentSessionStatsResponse, AgentSetModelResponse, AgentSetSessionNameResponse, AgentSetThinkingResponse, AgentStreamEvent, AgentSwitchSessionResponse, AgentThinkingLevelsResponse, AgentUiPendingRequest, AgentUiRequest, AgentUiResolved, AgentUiResponse, AgentUiSurface, CreateAgentRequest, ExtensionPacksListResponse, ExtensionPacksSetResponse, FetchAgentTimelineResponse, ProviderAuthInfo, ProviderAuthType, SessionMessage, TimelineDirection, ViewerSettings, ViewerSettingsPatchEntry } from "@av-pi-studio/protocol";
|
|
2
2
|
import type { DaemonClient } from "./daemon-client.js";
|
|
3
3
|
/**
|
|
4
4
|
* High-level `PiStudioClient` SDK facade over the low-level `DaemonClient` driver.
|
|
@@ -352,6 +352,8 @@ export interface AgentDeletedMessage {
|
|
|
352
352
|
export declare function isAgentArchived(message: unknown): message is AgentArchivedMessage;
|
|
353
353
|
/** Narrows an inbound session message to `agent_deleted`. See `isAgentArchived`. */
|
|
354
354
|
export declare function isAgentDeleted(message: unknown): message is AgentDeletedMessage;
|
|
355
|
+
/** A `viewer_settings_set_request`'s patch body — per-viewer, both fields optional. */
|
|
356
|
+
export type ViewerSettingsPatch = Record<string, ViewerSettingsPatchEntry>;
|
|
355
357
|
export declare class PiStudioClient {
|
|
356
358
|
private readonly daemon;
|
|
357
359
|
/** Exactly one login flow per client instance, per `swe/features/provider-auth-rpc.md`. */
|
|
@@ -427,6 +429,18 @@ export declare class PiStudioClient {
|
|
|
427
429
|
/** The single place a flow ends. Idempotent — whichever path (a `done` event, a lost connection,
|
|
428
430
|
* an immediate login rejection) settles it first wins; releases every subscription exactly once. */
|
|
429
431
|
private settleProviderAuthFlow;
|
|
432
|
+
/** True iff the daemon advertised the `viewerSettings` capability in `server_info.features`.
|
|
433
|
+
* A `false` result means "treat every viewer as enabled", never "no viewers available" — the
|
|
434
|
+
* degrade direction always offers a viewer, never hides one behind a daemon version. */
|
|
435
|
+
hasViewerSettingsCapability(): boolean;
|
|
436
|
+
/** The current per-viewer enable/disable document. */
|
|
437
|
+
getViewerSettings(): Promise<ViewerSettings>;
|
|
438
|
+
/** Patches one or more viewer rows; resolves to the EFFECTIVE document after the daemon's
|
|
439
|
+
* merge, never an echo of `patch`. */
|
|
440
|
+
setViewerSettings(patch: ViewerSettingsPatch): Promise<ViewerSettings>;
|
|
441
|
+
/** Subscribe to the daemon's `viewer_settings_update` broadcast — every viewer-settings change
|
|
442
|
+
* on this daemon, from any session, including this client's own. */
|
|
443
|
+
onViewerSettingsUpdate(handler: (settings: ViewerSettings) => void): () => void;
|
|
430
444
|
/**
|
|
431
445
|
* Subscribe to every `agent_ui_request` broadcast (any agent) — a new dialog, a fire-and-forget
|
|
432
446
|
* UI event, or a surface upsert/clear. `meta.receivedAt` is stamped here, not forwarded from the
|
package/dist/pistudio-client.js
CHANGED
|
@@ -365,6 +365,33 @@ export class PiStudioClient {
|
|
|
365
365
|
this.activeProviderAuthFlow = null;
|
|
366
366
|
flow.settle(result);
|
|
367
367
|
}
|
|
368
|
+
// ─── Viewer settings (viewer_settings_*, sprint-073) ───────────────────────
|
|
369
|
+
/** True iff the daemon advertised the `viewerSettings` capability in `server_info.features`.
|
|
370
|
+
* A `false` result means "treat every viewer as enabled", never "no viewers available" — the
|
|
371
|
+
* degrade direction always offers a viewer, never hides one behind a daemon version. */
|
|
372
|
+
hasViewerSettingsCapability() {
|
|
373
|
+
return this.daemon.hasFeature("viewerSettings");
|
|
374
|
+
}
|
|
375
|
+
/** The current per-viewer enable/disable document. */
|
|
376
|
+
async getViewerSettings() {
|
|
377
|
+
const payload = await this.daemon.request("viewer_settings_get_request", {});
|
|
378
|
+
return payload.settings;
|
|
379
|
+
}
|
|
380
|
+
/** Patches one or more viewer rows; resolves to the EFFECTIVE document after the daemon's
|
|
381
|
+
* merge, never an echo of `patch`. */
|
|
382
|
+
async setViewerSettings(patch) {
|
|
383
|
+
const payload = await this.daemon.request("viewer_settings_set_request", { patch });
|
|
384
|
+
return payload.settings;
|
|
385
|
+
}
|
|
386
|
+
/** Subscribe to the daemon's `viewer_settings_update` broadcast — every viewer-settings change
|
|
387
|
+
* on this daemon, from any session, including this client's own. */
|
|
388
|
+
onViewerSettingsUpdate(handler) {
|
|
389
|
+
return this.daemon.onSessionMessage((msg) => {
|
|
390
|
+
if (msg.type === "viewer_settings_update") {
|
|
391
|
+
handler(msg.settings);
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
}
|
|
368
395
|
// ─── Extension UI (agent_ui_*, sprint-066) ─────────────────────────────────
|
|
369
396
|
/**
|
|
370
397
|
* Subscribe to every `agent_ui_request` broadcast (any agent) — a new dialog, a fire-and-forget
|
|
@@ -226,6 +226,25 @@ export function makeScriptedDaemon(opts) {
|
|
|
226
226
|
});
|
|
227
227
|
return;
|
|
228
228
|
}
|
|
229
|
+
case "viewer_settings_get_request": {
|
|
230
|
+
reply({
|
|
231
|
+
type: "viewer_settings_get_response",
|
|
232
|
+
requestId,
|
|
233
|
+
payload: { settings: { version: 1, viewers: {} } },
|
|
234
|
+
});
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
case "viewer_settings_set_request": {
|
|
238
|
+
// Echoes the patch verbatim as the "effective document" — sufficient for the facade's
|
|
239
|
+
// pass-through tests; the real merge semantics are tested against the daemon
|
|
240
|
+
// (viewer-settings-rpc.test.ts), not re-tested here.
|
|
241
|
+
reply({
|
|
242
|
+
type: "viewer_settings_set_response",
|
|
243
|
+
requestId,
|
|
244
|
+
payload: { settings: { version: 1, viewers: msg.patch } },
|
|
245
|
+
});
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
229
248
|
default:
|
|
230
249
|
reply({ type: `${String(msg.type)}_response`, requestId, payload: { ok: true } });
|
|
231
250
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@av-pi-studio/client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.107",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist",
|
|
6
6
|
"!dist/**/*.map",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"clean": "rm -rf dist *.tsbuildinfo"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@av-pi-studio/protocol": "^0.0.
|
|
24
|
-
"@av-pi-studio/relay": "^0.0.
|
|
23
|
+
"@av-pi-studio/protocol": "^0.0.107",
|
|
24
|
+
"@av-pi-studio/relay": "^0.0.107"
|
|
25
25
|
}
|
|
26
26
|
}
|