@rkat/sdk 0.5.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  TypeScript client for the [Meerkat](https://github.com/lukacf/meerkat) runtime. The SDK is a thin session-first wrapper over the same runtime-backed contracts used by the CLI, REST, JSON-RPC, and MCP surfaces. It communicates with a local `rkat-rpc` subprocess over JSON-RPC 2.0 (newline-delimited JSON on stdin/stdout).
4
4
 
5
- Current contract version: `0.5.0`.
5
+ Current contract version: `0.6.0`.
6
6
 
7
7
  ## Installation
8
8
 
@@ -107,7 +107,7 @@ Creates a new session and immediately runs the first turn with the given prompt.
107
107
  |-----------|------|---------|-------------|
108
108
  | `prompt` | `string \| ContentBlock[]` | **(required)** | The user prompt for the first turn. |
109
109
  | `options.model` | `string` | Server default (typically `claude-sonnet-4-5`) | LLM model name (e.g. `"gpt-5.2"`, `"gemini-3-flash-preview"`, `"claude-opus-4-6"`). |
110
- | `options.provider` | `string` | Auto-detected from model | Force a specific provider (`"anthropic"`, `"openai"`, `"gemini"`). |
110
+ | `options.provider` | `string` | Resolved from the model registry | Force a specific provider (`"anthropic"`, `"openai"`, `"gemini"`). |
111
111
  | `options.systemPrompt` | `string` | `undefined` | Override the default system prompt. |
112
112
  | `options.maxTokens` | `number` | `undefined` | Maximum output tokens for the LLM response. |
113
113
  | `options.outputSchema` | `Record<string, unknown>` | `undefined` | JSON Schema for structured output extraction. |
@@ -125,6 +125,11 @@ Creates a new session and immediately runs the first turn with the given prompt.
125
125
  | `options.preloadSkills` | `string[]` | `undefined` | Skill source UUIDs to load before the run. |
126
126
  | `options.skillRefs` | `SkillRef[]` | `undefined` | Canonical structured skill references. |
127
127
  | `options.skillReferences` | `string[]` | `undefined` | Legacy string skill references; prefer `skillRefs`. |
128
+ | `options.labels` | `Record<string, string>` | `undefined` | Session labels used for filtering and metadata. |
129
+ | `options.additionalInstructions` | `string[]` | `undefined` | Extra instruction blocks appended to the system prompt. |
130
+ | `options.appContext` | `unknown` | `undefined` | Opaque app context passed to custom builders. |
131
+ | `options.shellEnv` | `Record<string, string>` | `undefined` | Per-session shell environment variables. |
132
+ | `options.externalTools` | `Record<string, unknown>[]` | `undefined` | Inline callback tool definitions for this session. |
128
133
 
129
134
  ### createDeferredSession(prompt, options?)
130
135
 
@@ -140,18 +145,57 @@ Creates a session identity without running the first turn yet. Use `await deferr
140
145
  ### listSessions()
141
146
 
142
147
  ```ts
143
- async listSessions(): Promise<SessionInfo[]>
148
+ async listSessions(options?: {
149
+ labels?: Record<string, string>;
150
+ limit?: number;
151
+ offset?: number;
152
+ }): Promise<SessionInfo[]>
144
153
  ```
145
154
 
146
- Returns an array of `SessionInfo` objects with camelCase fields such as `sessionId`, `sessionRef`, `messageCount`, and `isActive`.
155
+ Returns an array of typed `SessionInfo` objects with camelCase fields such as `sessionId`, `sessionRef`, `messageCount`, `isActive`, and `labels`.
147
156
 
148
157
  ### readSession(sessionId)
149
158
 
150
159
  ```ts
151
- async readSession(sessionId: string): Promise<Record<string, unknown>>
160
+ async readSession(sessionId: string): Promise<SessionInfo>
152
161
  ```
153
162
 
154
- Returns the current state payload for a session.
163
+ Returns typed session details including `model`, `provider`, `lastAssistantText`, and `labels`.
164
+
165
+ ### Session ingress helpers
166
+
167
+ ```ts
168
+ async sendExternalEvent(sessionId: string, payload: unknown, options?: { source?: string }): Promise<Record<string, unknown>>
169
+ async injectContext(sessionId: string, text: string, options?: { source?: string; idempotencyKey?: string }): Promise<{ status: string }>
170
+ ```
171
+
172
+ These expose `session/external_event` and `session/inject_context` as first-class public APIs.
173
+
174
+ ### Schedules, Models, and Mob profile APIs
175
+
176
+ ```ts
177
+ async getModelsCatalog(): Promise<ModelsCatalog>
178
+
179
+ async createSchedule(request: CreateScheduleRequest): Promise<Schedule>
180
+ async getSchedule(scheduleId: string): Promise<Schedule>
181
+ async listSchedules(options?: ScheduleListOptions): Promise<Schedule[]>
182
+ async updateSchedule(request: UpdateScheduleRequest): Promise<Schedule>
183
+ async pauseSchedule(scheduleId: string): Promise<Schedule>
184
+ async resumeSchedule(scheduleId: string): Promise<Schedule>
185
+ async deleteSchedule(scheduleId: string): Promise<Schedule>
186
+ async listScheduleOccurrences(scheduleId: string, options?: ScheduleOccurrencesOptions): Promise<ScheduleOccurrencesResult>
187
+ async listScheduleTools(): Promise<ScheduleToolsResult>
188
+ async callScheduleTool(request: ScheduleToolCallRequest): Promise<Record<string, unknown>>
189
+
190
+ async readMobEvents(mobId: string, options?: MobEventsOptions): Promise<MobEventsResult>
191
+ async spawnMobMembers(mobId: string, specs: SpawnSpec[]): Promise<MobSpawnManyResultEntry[]>
192
+
193
+ async createMobProfile(name: string, profile: MobProfile): Promise<MobProfileLookupResult>
194
+ async getMobProfile(name: string): Promise<MobProfileLookupResult>
195
+ async listMobProfiles(): Promise<MobProfileLookupResult[]>
196
+ async updateMobProfile(name: string, profile: MobProfile, expectedRevision: number): Promise<MobProfileLookupResult>
197
+ async deleteMobProfile(name: string, expectedRevision: number): Promise<MobProfileDeleteResult>
198
+ ```
155
199
 
156
200
  ### Session lifecycle on wrappers
157
201
 
@@ -204,26 +248,26 @@ Throws `MeerkatError` with code `"CAPABILITY_UNAVAILABLE"` if the capability is
204
248
  ### getConfig()
205
249
 
206
250
  ```ts
207
- async getConfig(): Promise<Record<string, unknown>>
251
+ async getConfig(): Promise<ConfigEnvelope>
208
252
  ```
209
253
 
210
- Returns the current Meerkat configuration as a JSON object.
254
+ Returns a config envelope: `{ config, generation, realmId?, instanceId?, backend?, resolvedPaths? }`.
211
255
 
212
256
  ### setConfig(config)
213
257
 
214
258
  ```ts
215
- async setConfig(config: Record<string, unknown>): Promise<void>
259
+ async setConfig(config: Record<string, unknown>): Promise<ConfigEnvelope>
216
260
  ```
217
261
 
218
- Replaces the entire runtime configuration.
262
+ Replaces the entire runtime configuration and returns the updated envelope.
219
263
 
220
264
  ### patchConfig(patch)
221
265
 
222
266
  ```ts
223
- async patchConfig(patch: Record<string, unknown>): Promise<Record<string, unknown>>
267
+ async patchConfig(patch: Record<string, unknown>): Promise<ConfigEnvelope>
224
268
  ```
225
269
 
226
- Merge-patches the runtime configuration and returns the resulting config.
270
+ Merge-patches the runtime configuration and returns the updated envelope.
227
271
 
228
272
  ## Public Types
229
273
 
@@ -333,14 +377,14 @@ try {
333
377
 
334
378
  ## Version Compatibility
335
379
 
336
- The SDK exports `CONTRACT_VERSION` (currently `"0.4.11"`). During `connect()`, the SDK checks that the server's contract version is compatible:
380
+ The SDK exports `CONTRACT_VERSION` (currently `"0.6.0"`). During `connect()`, the SDK checks that the server's contract version is compatible:
337
381
 
338
382
  - While the major version is `0`, minor versions must match exactly (e.g. SDK `0.1.x` requires server `0.1.x`).
339
383
  - Once `1.0.0` is reached, major versions must match (standard semver).
340
384
 
341
385
  ```ts
342
386
  import { CONTRACT_VERSION } from "@rkat/sdk";
343
- console.log(CONTRACT_VERSION); // "0.4.11"
387
+ console.log(CONTRACT_VERSION); // "0.6.0"
344
388
  ```
345
389
 
346
390
  If the versions are incompatible, `connect()` throws a `MeerkatError` with code `"VERSION_MISMATCH"`.
@@ -353,14 +397,14 @@ await client.connect();
353
397
 
354
398
  // Read the current config.
355
399
  const config = await client.getConfig();
356
- console.log(config);
400
+ console.log(config.generation, config.config);
357
401
 
358
402
  // Replace the entire config.
359
- await client.setConfig({ ...config, max_tokens: 4096 });
403
+ await client.setConfig({ ...config.config, max_tokens: 4096 });
360
404
 
361
405
  // Or merge-patch specific fields.
362
406
  const updated = await client.patchConfig({ max_tokens: 8192 });
363
- console.log(updated.max_tokens); // 8192
407
+ console.log(updated.config.max_tokens); // 8192
364
408
 
365
409
  await client.close();
366
410
  ```
@@ -382,16 +426,16 @@ const session = await client.createSession("List three European capitals", {
382
426
  },
383
427
  required: ["capitals"],
384
428
  },
385
- structured_output_retries: 3,
429
+ structuredOutputRetries: 3,
386
430
  });
387
431
 
388
432
  // Parsed structured output (matches the schema).
389
- console.log(result.structured_output);
433
+ console.log(session.structuredOutput);
390
434
  // { capitals: ["Paris", "Berlin", "Madrid"] }
391
435
 
392
436
  // Schema warnings from provider-specific validation issues.
393
- if (result.schema_warnings) {
394
- for (const w of result.schema_warnings) {
437
+ if (session.lastResult.schemaWarnings) {
438
+ for (const w of session.lastResult.schemaWarnings) {
395
439
  console.warn(`[${w.provider}] ${w.path}: ${w.message}`);
396
440
  }
397
441
  }
package/dist/client.d.ts CHANGED
@@ -24,17 +24,17 @@
24
24
  * await client.close();
25
25
  * ```
26
26
  */
27
- import { type RuntimeAcceptResult, type RuntimeResetResult, type RuntimeRetireResult, type RuntimeStateResult, type WireInputState, type McpAddParams, type McpLiveOpResponse, type McpReloadParams, type McpRemoveParams } from "./generated/types.js";
27
+ import { type RealtimeCapabilitiesResult, type RealtimeOpenInfo, type RealtimeOpenRequest, type RealtimeStatusResult, type MobRotateSupervisorResult, type RuntimeRealtimeAttachmentStatusResult, type McpAddParams, type McpLiveOpResponse, type McpReloadParams, type McpRemoveParams, type MobSpawnManyResultEntry } from "./generated/types.js";
28
28
  import { DeferredSession, Session } from "./session.js";
29
- import { Mob, type MemberDeliveryReceipt, type MemberSendOptions, type MobKickoffMemberSnapshot, type MobKickoffWaitOptions, type MobPeerTarget } from "./mob.js";
29
+ import { Mob, type MemberDeliveryReceipt, type MemberSendOptions, type MobKickoffMemberSnapshot, type MobKickoffWaitOptions, type MobReadyMemberSnapshot, type MobReadyWaitOptions, type MobPeerTarget } from "./mob.js";
30
30
  import { EventStream } from "./streaming.js";
31
31
  import { EventSubscription } from "./subscription.js";
32
- import type { AgentEventEnvelope, AttributedMobEvent, BlobPayload, Capability, ContentInput, ContentBlock, MobCreateOptions, MobFlowStatus, MobMember, MobSummary, RunResult, SessionAssistantBlock, SessionHistory, SessionInfo, SessionMessage, SessionOptions, SkillRef, TurnToolOverlay } from "./types.js";
32
+ import type { AgentEventEnvelope, AttributedMobEvent, BlobPayload, Capability, CommsCommand, CommsSendReceipt, ConfigEnvelope, ContentInput, ContentBlock, CreateScheduleRequest, HelpOptions, ModelsCatalog, MobEventsOptions, MobEventsResult, MobCreateOptions, MobFlowStatus, MobLifecycleAction, MobMember, MobMemberRef, MobProfile, MobProfileDeleteResult, MobProfileLookupResult, MobSpawnResult, MobSummary, MobTurnStartOptions, PeerCorrelationId, PeerId, PeerResponseTerminalOptions, RunResult, Schedule, ScheduleListOptions, ScheduleOccurrencesOptions, ScheduleOccurrencesResult, ScheduleToolCallRequest, ScheduleToolsResult, SessionAssistantBlock, SessionHistory, SessionIngressOptions, SessionInfo, SessionListOptions, SessionMessage, SessionOptions, SpawnManySpec, SpawnSpec, UpdateScheduleRequest, TurnOptions } from "./types.js";
33
33
  /** Options for connecting to the rkat-rpc runtime. */
34
34
  export interface ConnectOptions {
35
35
  realmId?: string;
36
36
  instanceId?: string;
37
- realmBackend?: "jsonl" | "redb";
37
+ realmBackend?: "jsonl" | "sqlite";
38
38
  isolated?: boolean;
39
39
  stateRoot?: string;
40
40
  contextRoot?: string;
@@ -42,6 +42,7 @@ export interface ConnectOptions {
42
42
  }
43
43
  export declare class MeerkatClient {
44
44
  private process;
45
+ private processStderr;
45
46
  private requestId;
46
47
  private _capabilities;
47
48
  private _methods;
@@ -71,6 +72,8 @@ export declare class MeerkatClient {
71
72
  registerTool(name: string, description: string, inputSchema: Record<string, unknown>, handler: (args: Record<string, unknown>) => Promise<string>): void;
72
73
  connect(options?: ConnectOptions): Promise<this>;
73
74
  close(): Promise<void>;
75
+ private rejectPendingRequests;
76
+ private closeQueues;
74
77
  /**
75
78
  * Create a new session, run the first turn, and return a {@link Session}.
76
79
  *
@@ -96,8 +99,16 @@ export declare class MeerkatClient {
96
99
  * turn with optional per-turn overrides.
97
100
  */
98
101
  createDeferredSession(prompt: string | ContentBlock[], options?: SessionOptions): Promise<DeferredSession>;
99
- listSessions(): Promise<SessionInfo[]>;
100
- readSession(sessionId: string): Promise<Record<string, unknown>>;
102
+ askHelp(question: string, options?: HelpOptions): Promise<RunResult>;
103
+ listSessions(options?: SessionListOptions): Promise<SessionInfo[]>;
104
+ readSession(sessionId: string): Promise<SessionInfo>;
105
+ sendExternalEvent(sessionId: string, eventType: string, payload: unknown, options?: {
106
+ blocks?: ContentBlock[];
107
+ }): Promise<Record<string, unknown>>;
108
+ sendPeerResponseTerminal(sessionId: string, peerId: PeerId, requestId: PeerCorrelationId, status: "completed" | "failed" | "cancelled", result: unknown, options?: PeerResponseTerminalOptions): Promise<Record<string, unknown>>;
109
+ injectContext(sessionId: string, text: string, options?: SessionIngressOptions): Promise<{
110
+ status: string;
111
+ }>;
101
112
  readSessionHistory(sessionId: string, options?: {
102
113
  offset?: number;
103
114
  limit?: number;
@@ -105,13 +116,13 @@ export declare class MeerkatClient {
105
116
  get capabilities(): readonly Capability[];
106
117
  hasCapability(capabilityId: string): boolean;
107
118
  requireCapability(capabilityId: string): void;
108
- getConfig(): Promise<Record<string, unknown>>;
119
+ getConfig(): Promise<ConfigEnvelope>;
109
120
  setConfig(config: Record<string, unknown>, options?: {
110
121
  expectedGeneration?: number;
111
- }): Promise<Record<string, unknown>>;
122
+ }): Promise<ConfigEnvelope>;
112
123
  patchConfig(patch: Record<string, unknown>, options?: {
113
124
  expectedGeneration?: number;
114
- }): Promise<Record<string, unknown>>;
125
+ }): Promise<ConfigEnvelope>;
115
126
  mcpAdd(params: McpAddParams): Promise<McpLiveOpResponse>;
116
127
  mcpRemove(params: McpRemoveParams): Promise<McpLiveOpResponse>;
117
128
  mcpReload(params: McpReloadParams): Promise<McpLiveOpResponse>;
@@ -119,10 +130,31 @@ export declare class MeerkatClient {
119
130
  mcp_remove(params: McpRemoveParams): Promise<McpLiveOpResponse>;
120
131
  mcp_reload(params: McpReloadParams): Promise<McpLiveOpResponse>;
121
132
  listSkills(): Promise<Array<Record<string, unknown>>>;
122
- inspectSkill(id: string, options?: {
123
- source?: string;
124
- }): Promise<Record<string, unknown>>;
125
133
  getBlob(blobId: string): Promise<BlobPayload>;
134
+ getRuntimeHostInfo(): Promise<Record<string, unknown>>;
135
+ getRuntimeHostCapabilities(): Promise<Record<string, unknown>>;
136
+ getRuntimeHostHealth(): Promise<Record<string, unknown>>;
137
+ requestApproval(params: Record<string, unknown>): Promise<Record<string, unknown>>;
138
+ listApprovals(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
139
+ getApproval(params: Record<string, unknown>): Promise<Record<string, unknown>>;
140
+ decideApproval(params: Record<string, unknown>): Promise<Record<string, unknown>>;
141
+ listArtifacts(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
142
+ getArtifact(params: Record<string, unknown>): Promise<Record<string, unknown>>;
143
+ downloadArtifact(params: Record<string, unknown>): Promise<Record<string, unknown>>;
144
+ latestEventCursor(params: Record<string, unknown>): Promise<Record<string, unknown>>;
145
+ listEventsSince(params: Record<string, unknown>): Promise<Record<string, unknown>>;
146
+ eventSnapshot(params: Record<string, unknown>): Promise<Record<string, unknown>>;
147
+ getModelsCatalog(): Promise<ModelsCatalog>;
148
+ createSchedule(request: CreateScheduleRequest): Promise<Schedule>;
149
+ getSchedule(scheduleId: string): Promise<Schedule>;
150
+ listSchedules(_options?: ScheduleListOptions): Promise<Schedule[]>;
151
+ updateSchedule(request: UpdateScheduleRequest): Promise<Schedule>;
152
+ pauseSchedule(scheduleId: string): Promise<Schedule>;
153
+ resumeSchedule(scheduleId: string): Promise<Schedule>;
154
+ deleteSchedule(scheduleId: string): Promise<Schedule>;
155
+ listScheduleOccurrences(scheduleId: string, options?: ScheduleOccurrencesOptions): Promise<ScheduleOccurrencesResult>;
156
+ listScheduleTools(): Promise<ScheduleToolsResult>;
157
+ callScheduleTool(request: ScheduleToolCallRequest): Promise<Record<string, unknown>>;
126
158
  subscribeSessionEvents(sessionId: string): Promise<EventSubscription<AgentEventEnvelope>>;
127
159
  createMob(options: MobCreateOptions): Promise<Mob>;
128
160
  mob(mobId: string): Mob;
@@ -132,36 +164,27 @@ export declare class MeerkatClient {
132
164
  status: string;
133
165
  }>;
134
166
  listMobMembers(mobId: string): Promise<MobMember[]>;
135
- sendMobMemberContent(mobId: string, meerkatId: string, content: string | ContentBlock[], options?: MemberSendOptions): Promise<MemberDeliveryReceipt>;
136
- spawnMobMember(mobId: string, options: {
137
- profile: string;
138
- meerkatId: string;
139
- initialMessage?: string | ContentBlock[];
140
- runtimeMode?: string;
141
- backend?: string;
142
- resumeSessionId?: string;
143
- labels?: Record<string, string>;
144
- context?: Record<string, unknown>;
145
- additionalInstructions?: string[];
146
- }): Promise<Record<string, unknown>>;
147
- retireMobMember(mobId: string, meerkatId: string): Promise<void>;
148
- respawnMobMember(mobId: string, meerkatId: string, initialMessage?: string | ContentBlock[]): Promise<{
167
+ sendMobMemberContent(mobId: string, agentIdentity: string, content: string | ContentBlock[], options?: MemberSendOptions): Promise<MemberDeliveryReceipt>;
168
+ spawnMobMember(mobId: string, options: SpawnSpec): Promise<MobSpawnResult>;
169
+ spawnMobMembers(mobId: string, specs: SpawnManySpec[]): Promise<MobSpawnManyResultEntry[]>;
170
+ retireMobMember(mobId: string, agentIdentity: string): Promise<void>;
171
+ respawnMobMember(mobId: string, agentIdentity: string, initialMessage?: string | ContentBlock[]): Promise<{
149
172
  status: "completed" | "topology_restore_failed";
150
173
  receipt: {
151
- memberId: string;
152
- oldSessionId?: string;
153
- newSessionId?: string;
174
+ agentIdentity: string;
175
+ memberRef: MobMemberRef;
154
176
  };
155
177
  failedPeerIds?: string[];
156
178
  }>;
157
- forceCancelMobMember(mobId: string, meerkatId: string): Promise<void>;
158
- mobMemberStatus(mobId: string, meerkatId: string): Promise<{
179
+ forceCancelMobMember(mobId: string, agentIdentity: string): Promise<void>;
180
+ mobTurnStart(mobId: string, agentIdentity: string, prompt: ContentInput, options?: MobTurnStartOptions): Promise<Record<string, unknown>>;
181
+ mobMemberStatus(mobId: string, agentIdentity: string): Promise<{
159
182
  status: string;
160
183
  outputPreview?: string;
161
184
  error?: string;
162
185
  tokensUsed: number;
163
186
  isFinal: boolean;
164
- currentSessionId?: string;
187
+ liveAttachmentStatus?: "unattached" | "intent_present_unbound" | "binding_not_ready" | "binding_ready" | "replacement_pending" | "reattach_required";
165
188
  peerConnectivity?: {
166
189
  reachablePeerCount: number;
167
190
  unknownPeerCount: number;
@@ -170,21 +193,94 @@ export declare class MeerkatClient {
170
193
  reason?: string;
171
194
  }>;
172
195
  };
196
+ /**
197
+ * Phase 5G/T5i identity-first realtime routing: session id of the
198
+ * member's current bridge session. Consumers navigate
199
+ * `mob/member_status.currentSessionId → realtime/open_info
200
+ * (session_target)`. Absent when the member is not yet bound to a
201
+ * session.
202
+ */
203
+ currentSessionId?: string;
204
+ }>;
205
+ /**
206
+ * Point-in-time aggregate of a mob's status plus its member list.
207
+ * Wraps the `mob/snapshot` RPC (DELETE_ME C2).
208
+ */
209
+ mobSnapshot(mobId: string): Promise<{
210
+ mobId: string;
211
+ status: string;
212
+ members: unknown[];
213
+ }>;
214
+ /**
215
+ * Destroy a mob and surface the structured `MobDestroyReport`.
216
+ * Wraps the `mob/destroy` RPC (DELETE_ME C3). Unlike `mob/lifecycle`
217
+ * with `action: "destroy"`, this dedicated endpoint has a predictable
218
+ * response shape that does not require branching on an action string.
219
+ */
220
+ mobDestroy(mobId: string): Promise<{
221
+ mobId: string;
222
+ ok: boolean;
223
+ destroyReport: Record<string, unknown>;
224
+ }>;
225
+ /**
226
+ * Rotate the supervisor bridge for all members of a mob.
227
+ * Wraps the `mob/rotate_supervisor` RPC (DELETE_ME C10). Returns the
228
+ * full `SupervisorRotationReport` so operators can inspect per-member
229
+ * rotation outcomes instead of getting a bare `ok: true`.
230
+ */
231
+ mobRotateSupervisor(mobId: string): Promise<MobRotateSupervisorResult>;
232
+ /**
233
+ * Submit a unit of work to a mob member through the work lane.
234
+ * Wraps the `mob/submit_work` RPC (DELETE_ME C4). Work lane was
235
+ * Rust-only prior to this; `origin` is `"external"` for
236
+ * user-originated turns and `"internal"` for mob-orchestration work.
237
+ * When `workRef` is omitted the server generates a fresh UUID.
238
+ */
239
+ mobSubmitWork(args: {
240
+ memberRef: string;
241
+ content: unknown;
242
+ workRef?: string;
243
+ origin?: "external" | "internal";
244
+ }): Promise<{
245
+ mobId: string;
246
+ workRef: string;
247
+ memberRef: string;
248
+ }>;
249
+ /**
250
+ * Cancel a previously submitted unit of work.
251
+ * Wraps the `mob/cancel_work` RPC (DELETE_ME C4).
252
+ */
253
+ mobCancelWork(mobId: string, workRef: string): Promise<{
254
+ ok: boolean;
255
+ }>;
256
+ /**
257
+ * Cancel all in-flight work for a specific mob member.
258
+ * Wraps the `mob/cancel_all_work` RPC (DELETE_ME C4).
259
+ */
260
+ mobCancelAllWork(args: {
261
+ memberRef: string;
262
+ }): Promise<{
263
+ ok: boolean;
173
264
  }>;
174
265
  waitMobKickoff(mobId: string, options?: MobKickoffWaitOptions): Promise<MobKickoffMemberSnapshot[]>;
266
+ waitMobReady(mobId: string, options?: MobReadyWaitOptions): Promise<MobReadyMemberSnapshot[]>;
175
267
  wait_mob_kickoff(mobId: string, options?: MobKickoffWaitOptions): Promise<MobKickoffMemberSnapshot[]>;
268
+ wait_mob_ready(mobId: string, options?: MobReadyWaitOptions): Promise<MobReadyMemberSnapshot[]>;
176
269
  spawnMobHelper(mobId: string, prompt: string, options?: {
177
- meerkatId?: string;
270
+ agentIdentity?: string;
271
+ roleName?: string;
178
272
  profileName?: string;
179
273
  runtimeMode?: string;
180
274
  backend?: string;
181
275
  }): Promise<{
182
276
  output?: string;
183
277
  tokensUsed: number;
184
- sessionId?: string;
278
+ agentIdentity: string;
279
+ memberRef: MobMemberRef;
185
280
  }>;
186
281
  forkMobHelper(mobId: string, sourceMemberId: string, prompt: string, options?: {
187
- meerkatId?: string;
282
+ agentIdentity?: string;
283
+ roleName?: string;
188
284
  profileName?: string;
189
285
  forkContext?: Record<string, unknown>;
190
286
  runtimeMode?: string;
@@ -192,68 +288,133 @@ export declare class MeerkatClient {
192
288
  }): Promise<{
193
289
  output?: string;
194
290
  tokensUsed: number;
195
- sessionId?: string;
291
+ agentIdentity: string;
292
+ memberRef: MobMemberRef;
196
293
  }>;
197
294
  wireMobMembers(mobId: string, member: string, peer: MobPeerTarget): Promise<void>;
198
295
  unwireMobMembers(mobId: string, member: string, peer: MobPeerTarget): Promise<void>;
199
- mobLifecycle(mobId: string, action: 'stop' | 'resume' | 'complete' | 'reset' | 'destroy'): Promise<void>;
200
- appendMobSystemContext(mobId: string, meerkatId: string, text: string, options?: {
296
+ mobLifecycle(mobId: string, action: MobLifecycleAction): Promise<void>;
297
+ appendMobSystemContext(mobId: string, agentIdentity: string, text: string, options?: {
201
298
  source?: string;
202
299
  idempotencyKey?: string;
203
300
  }): Promise<Record<string, unknown>>;
301
+ readMobEvents(mobId: string, options?: MobEventsOptions): Promise<MobEventsResult>;
302
+ mobIngressInteraction(params: Record<string, unknown>): Promise<Record<string, unknown>>;
303
+ createMobProfile(name: string, profile: MobProfile): Promise<MobProfileLookupResult>;
304
+ getMobProfile(name: string): Promise<MobProfileLookupResult>;
305
+ listMobProfiles(): Promise<MobProfileLookupResult[]>;
306
+ updateMobProfile(name: string, profile: MobProfile, expectedRevision: number): Promise<MobProfileLookupResult>;
307
+ deleteMobProfile(name: string, expectedRevision: number): Promise<MobProfileDeleteResult>;
204
308
  listMobFlows(mobId: string): Promise<string[]>;
205
309
  runMobFlow(mobId: string, flowId: string, params?: Record<string, unknown>): Promise<string>;
206
310
  getMobFlowStatus(mobId: string, runId: string): Promise<MobFlowStatus | null>;
207
311
  cancelMobFlow(mobId: string, runId: string): Promise<void>;
208
312
  subscribeMobEvents(mobId: string): Promise<EventSubscription<AttributedMobEvent>>;
209
- subscribeMobMemberEvents(mobId: string, meerkatId: string): Promise<EventSubscription<AgentEventEnvelope>>;
313
+ subscribeMobMemberEvents(mobId: string, agentIdentity: string): Promise<EventSubscription<AgentEventEnvelope>>;
210
314
  private openEventSubscription;
211
315
  private static parseAgentEventEnvelope;
316
+ private static parseEventSourceIdentity;
317
+ private static parseOptionalString;
318
+ private static parseOptionalNumber;
212
319
  private static parseAttributedMobEvent;
213
320
  /** @internal */
214
- _startTurn(sessionId: string, prompt: string | ContentBlock[], options?: {
215
- skillRefs?: SkillRef[];
216
- skillReferences?: string[];
217
- flowToolOverlay?: TurnToolOverlay;
218
- keepAlive?: boolean;
219
- model?: string;
220
- provider?: string;
221
- maxTokens?: number;
222
- systemPrompt?: string;
223
- outputSchema?: Record<string, unknown>;
224
- structuredOutputRetries?: number;
225
- providerParams?: Record<string, unknown>;
226
- }): Promise<RunResult>;
321
+ _startTurn(sessionId: string, prompt: string | ContentBlock[], options?: TurnOptions): Promise<RunResult>;
227
322
  /** @internal */
228
- _startTurnStreaming(sessionId: string, prompt: string | ContentBlock[], options?: {
229
- skillRefs?: SkillRef[];
230
- skillReferences?: string[];
231
- flowToolOverlay?: TurnToolOverlay;
232
- }, session?: Session): EventStream;
323
+ _startTurnStreaming(sessionId: string, prompt: string | ContentBlock[], options?: TurnOptions, session?: Session): EventStream;
233
324
  /** @internal */
234
325
  _interrupt(sessionId: string): Promise<void>;
235
326
  /** @internal */
236
327
  _archive(sessionId: string): Promise<void>;
328
+ private static retiredRuntimeSessionControlError;
329
+ /**
330
+ * @internal
331
+ * @deprecated Retired runtime/session control RPC method; always fails before transport.
332
+ */
333
+ _runtimeStatus(_params: Record<string, unknown>): Promise<never>;
334
+ /**
335
+ * @internal
336
+ * @deprecated Retired runtime/session control RPC method; always fails before transport.
337
+ */
338
+ _runtimeSubmit(_params: Record<string, unknown>): Promise<never>;
339
+ /**
340
+ * @internal
341
+ * @deprecated Retired runtime/session control RPC method; always fails before transport.
342
+ */
343
+ _runtimeSubmission(_params: Record<string, unknown>): Promise<never>;
344
+ /**
345
+ * @internal
346
+ * @deprecated Retired runtime/session control RPC method; always fails before transport.
347
+ */
348
+ _runtimeSubmissions(_params: Record<string, unknown>): Promise<never>;
349
+ /**
350
+ * @internal
351
+ * @deprecated Retired runtime/session control RPC method; always fails before transport.
352
+ */
353
+ _runtimeRetire(_params: Record<string, unknown>): Promise<never>;
354
+ /**
355
+ * @internal
356
+ * @deprecated Retired runtime/session control RPC method; always fails before transport.
357
+ */
358
+ _runtimeReset(_params: Record<string, unknown>): Promise<never>;
237
359
  /** @internal */
238
- _send(sessionId: string, command: Record<string, unknown>): Promise<Record<string, unknown>>;
360
+ _send(sessionId: string, command: CommsCommand): Promise<CommsSendReceipt>;
239
361
  /** @internal */
240
362
  _peers(sessionId: string): Promise<Record<string, unknown>>;
241
- send(sessionId: string, command: Record<string, unknown>): Promise<Record<string, unknown>>;
363
+ /**
364
+ * Send a typed comms command. Invalid discriminators (`source`, `stream`,
365
+ * `handling_mode`, `status`) are rejected at the server's typed-serde
366
+ * boundary.
367
+ */
368
+ send(sessionId: string, command: CommsCommand): Promise<CommsSendReceipt>;
242
369
  peers(sessionId: string): Promise<Record<string, unknown>>;
243
- runtimeState(sessionId: string): Promise<RuntimeStateResult>;
244
- runtimeAccept(sessionId: string, input: Record<string, unknown>): Promise<RuntimeAcceptResult>;
245
- runtimeRetire(sessionId: string): Promise<RuntimeRetireResult>;
246
- runtimeReset(sessionId: string): Promise<RuntimeResetResult>;
247
- inputState(sessionId: string, inputId: string): Promise<WireInputState | null>;
248
- inputList(sessionId: string): Promise<string[]>;
370
+ runtimeRealtimeAttachmentStatus(sessionId: string): Promise<RuntimeRealtimeAttachmentStatusResult>;
371
+ /** Idempotent spawn: spawns or returns the existing member entry. */
372
+ mobEnsureMember(mobId: string, spec: Record<string, unknown>): Promise<Record<string, unknown>>;
373
+ /** Declarative reconcile: converge roster to the desired spec list. */
374
+ mobReconcile(mobId: string, desired: Record<string, unknown>[], options?: Record<string, unknown>): Promise<Record<string, unknown>>;
375
+ /** Label-filtered member listing. */
376
+ mobListMembersMatching(mobId: string, filter: Record<string, unknown>): Promise<Record<string, unknown>>;
377
+ realtimeOpenInfo(request: RealtimeOpenRequest): Promise<RealtimeOpenInfo>;
378
+ realtimeStatus(params: {
379
+ target: Record<string, unknown>;
380
+ }): Promise<RealtimeStatusResult>;
381
+ realtimeCapabilities(params: {
382
+ target: Record<string, unknown>;
383
+ }): Promise<RealtimeCapabilitiesResult>;
384
+ realmList(): Promise<unknown>;
385
+ realmGet(realmId: string): Promise<unknown>;
386
+ authProfileList(realmId: string): Promise<unknown>;
387
+ authProfileGet(realmId: string, bindingId: string, profileId?: string): Promise<unknown>;
388
+ authProfileCreate(params: Record<string, unknown>): Promise<unknown>;
389
+ authProfileDelete(realmId: string, bindingId: string, profileId?: string): Promise<unknown>;
390
+ authLoginStart(params: Record<string, unknown>): Promise<unknown>;
391
+ authLoginComplete(params: Record<string, unknown>): Promise<unknown>;
392
+ authLoginDeviceStart(params: Record<string, unknown>): Promise<unknown>;
393
+ authLoginDeviceComplete(params: Record<string, unknown>): Promise<unknown>;
394
+ authLoginProvisionApiKey(params: Record<string, unknown>): Promise<unknown>;
395
+ authStatusGet(realmId: string, bindingId: string, profileId?: string): Promise<unknown>;
396
+ authLogout(realmId: string, bindingId: string, profileId?: string): Promise<unknown>;
249
397
  private handleLine;
250
398
  private static parseRpcErrorPayload;
251
399
  private request;
252
400
  private registerRequest;
253
401
  private static normalizeStatus;
402
+ private static requireRecord;
403
+ private static requireStringField;
404
+ private static requireNumberField;
405
+ private static requireBooleanField;
254
406
  private static parseSkillDiagnostics;
255
407
  private static checkVersionCompatible;
256
408
  static parseRunResult(data: Record<string, unknown>): RunResult;
409
+ static parseSessionInfo(data: Record<string, unknown>): SessionInfo;
410
+ static parseConfigEnvelope(data: Record<string, unknown>): ConfigEnvelope;
411
+ static parseCommsSendReceipt(data: Record<string, unknown>): CommsSendReceipt;
412
+ static parseModelsCatalog(data: Record<string, unknown>): ModelsCatalog;
413
+ static parseSchedule(data: Record<string, unknown>): Schedule;
414
+ static parseScheduleOccurrence(data: Record<string, unknown>): ScheduleOccurrencesResult["occurrences"][number];
415
+ static parseMobProfileLookup(data: Record<string, unknown>): MobProfileLookupResult;
416
+ private static toWireCreateScheduleRequest;
417
+ private static toWireUpdateSchedulePatch;
257
418
  static parseSessionHistory(data: Record<string, unknown>): SessionHistory;
258
419
  static parseSessionMessage(data: Record<string, unknown>): SessionMessage;
259
420
  static parseContentInput(value: unknown): ContentInput;