@av-pi-studio/client 0.0.108 → 0.0.110

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.
@@ -16,6 +16,12 @@ import type { DaemonClient } from "./daemon-client.js";
16
16
  *
17
17
  * Out of scope: app runtime controller (sprint-012), terminal router (task-003).
18
18
  */
19
+ /**
20
+ * RPC timeout for `agent_compact_request`. Summarising a large context routinely outlasts the 30 s
21
+ * default, and the daemon holds the request open for the whole compaction. A timeout fails only
22
+ * this call (`rpcTimeoutMs ≠ socket death`); compaction progress keeps following the stream.
23
+ */
24
+ export declare const COMPACT_TIMEOUT_MS: number;
19
25
  export type PiStudioAgentUpdateHandler = (update: AgentUpdateMessage) => void;
20
26
  export type PiStudioWorkspaceUpdateHandler = (update: WorkspaceUpdateMessage) => void;
21
27
  /** Metadata carried alongside a live `agent_stream` event (daemon-owned, not provider-replayed). */
@@ -176,8 +182,11 @@ export interface ResolveDefaultModelResponse {
176
182
  export interface PiStudioProviderActions {
177
183
  /** List available providers. */
178
184
  listProviders(): Promise<unknown>;
179
- /** List models for a provider. */
180
- listModels(provider: string): Promise<ListProviderModelsResponse>;
185
+ /** List models for a provider. `agentId`: answer from that agent's live process when it has
186
+ * one — the list its `setModel` accepts (Pi reads `models.json` once per process). */
187
+ listModels(provider: string, opts?: {
188
+ agentId?: string;
189
+ }): Promise<ListProviderModelsResponse>;
181
190
  /** List modes for a provider. */
182
191
  listModes(provider: string): Promise<unknown>;
183
192
  /** Resolve the model a brand-new session would run on with no override — backs the
@@ -1,3 +1,25 @@
1
+ /**
2
+ * High-level `PiStudioClient` SDK facade over the low-level `DaemonClient` driver.
3
+ *
4
+ * Exposes workspace/agent/provider handles plus update handler registration, mirroring the
5
+ * scope's `Pi-StudioClient` surface (architecture/client-app-runtime.md § Layered client library /
6
+ * Facade and features/agent-sessions.md § Public Contract). Method names follow the server RPC
7
+ * type names (`create_agent_request`, `send_agent_prompt`, `interrupt_agent`, `update_agent`,
8
+ * `resume_agent`, `import_agent_session`, `fetch_agent_timeline_request`, and the sprint-037
9
+ * slash-command RPCs: `agent_session_stats_request`, `agent_compact_request`,
10
+ * `agent_new_session_request`, `agent_switch_session_request`, `agent_fork_request`,
11
+ * `agent_fork_messages_request`, `agent_clone_request`, `agent_set_session_name_request`,
12
+ * `agent_export_html_request`, `agent_set_model_request`, `agent_cycle_model_request`,
13
+ * `agent_last_assistant_text_request`), plus command discovery `agent_list_commands_request`.
14
+ *
15
+ * Out of scope: app runtime controller (sprint-012), terminal router (task-003).
16
+ */
17
+ /**
18
+ * RPC timeout for `agent_compact_request`. Summarising a large context routinely outlasts the 30 s
19
+ * default, and the daemon holds the request open for the whole compaction. A timeout fails only
20
+ * this call (`rpcTimeoutMs ≠ socket death`); compaction progress keeps following the stream.
21
+ */
22
+ export const COMPACT_TIMEOUT_MS = 10 * 60_000;
1
23
  /** Narrows an inbound session message to the `provider_auth_flow_event` push. */
2
24
  export function isProviderAuthFlowEvent(message) {
3
25
  const m = message;
@@ -536,10 +558,7 @@ class AgentHandle {
536
558
  return this.daemon.request("agent_session_stats_request", { agentId: this.agentId });
537
559
  }
538
560
  compact(customInstructions) {
539
- return this.daemon.request("agent_compact_request", {
540
- agentId: this.agentId,
541
- customInstructions,
542
- });
561
+ return this.daemon.request("agent_compact_request", { agentId: this.agentId, customInstructions }, COMPACT_TIMEOUT_MS);
543
562
  }
544
563
  newSession() {
545
564
  return this.daemon.request("agent_new_session_request", { agentId: this.agentId });
@@ -621,8 +640,11 @@ class ProviderHandle {
621
640
  listProviders() {
622
641
  return this.daemon.request("list_providers", {});
623
642
  }
624
- listModels(provider) {
625
- return this.daemon.request("list_provider_models", { provider });
643
+ listModels(provider, opts) {
644
+ return this.daemon.request("list_provider_models", {
645
+ provider,
646
+ ...(opts?.agentId ? { agentId: opts.agentId } : {}),
647
+ });
626
648
  }
627
649
  listModes(provider) {
628
650
  return this.daemon.request("list_provider_modes", { provider });
@@ -110,7 +110,7 @@ export function makeScriptedDaemon(opts) {
110
110
  reply({
111
111
  type: "agent_compact_response",
112
112
  requestId,
113
- payload: { summary: "compacted", tokensBefore: 1000 },
113
+ payload: { summary: "compacted", tokensBefore: 1000, estimatedTokensAfter: 100 },
114
114
  });
115
115
  return;
116
116
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@av-pi-studio/client",
3
- "version": "0.0.108",
3
+ "version": "0.0.110",
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.108",
24
- "@av-pi-studio/relay": "^0.0.108"
23
+ "@av-pi-studio/protocol": "^0.0.110",
24
+ "@av-pi-studio/relay": "^0.0.110"
25
25
  }
26
26
  }