@mirasoth/soothe-client 0.5.7 → 0.5.9

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/dist/index.cjs CHANGED
@@ -321,8 +321,7 @@ function newRequestID() {
321
321
  function newLoopInputMessage(loopID, content) {
322
322
  return notificationEnvelope("loop_input", {
323
323
  loop_id: loopID,
324
- content,
325
- autonomous: false
324
+ content
326
325
  });
327
326
  }
328
327
  function newLoopNewMessage(opts) {
@@ -361,51 +360,6 @@ var init_protocol = __esm({
361
360
  }
362
361
  });
363
362
 
364
- // src/intent_hints.ts
365
- function validateLoopInputIntentHint(hint) {
366
- const key = hint.trim().toLowerCase();
367
- if (key in REMOVED_INTENT_HINT_MESSAGES) {
368
- return REMOVED_INTENT_HINT_MESSAGES[key];
369
- }
370
- return null;
371
- }
372
- var INTENT_HINT_TEXT_COMPLETION, INTENT_HINT_IMAGE_TO_TEXT, INTENT_HINT_OCR, INTENT_HINT_EMBED, REMOVED_INTENT_HINTS, REMOVED_INTENT_HINT_MESSAGES, LOOP_ASSISTANT_OUTPUT_PHASES, DEFAULT_DELIVERABLE_PHASES;
373
- var init_intent_hints = __esm({
374
- "src/intent_hints.ts"() {
375
- "use strict";
376
- INTENT_HINT_TEXT_COMPLETION = "text_completion";
377
- INTENT_HINT_IMAGE_TO_TEXT = "image_to_text";
378
- INTENT_HINT_OCR = "ocr";
379
- INTENT_HINT_EMBED = "embed";
380
- REMOVED_INTENT_HINTS = ["direct_llm", "quiz", "direct_model"];
381
- REMOVED_INTENT_HINT_MESSAGES = {
382
- direct_llm: "intent_hint direct_llm is removed; use text_completion (text-only) or image_to_text (with attachments)",
383
- quiz: "intent_hint quiz is removed; omit intent_hint and let intake classify the turn",
384
- direct_model: "intent_hint direct_model is removed; use text_completion, image_to_text, ocr, or embed"
385
- };
386
- LOOP_ASSISTANT_OUTPUT_PHASES = [
387
- "goal_completion",
388
- "quiz",
389
- "autonomous_goal",
390
- "chitchat",
391
- "text_completion",
392
- "image_to_text",
393
- "ocr",
394
- "embed",
395
- "plan_direct"
396
- ];
397
- DEFAULT_DELIVERABLE_PHASES = /* @__PURE__ */ new Set([
398
- "quiz",
399
- "goal_completion",
400
- "chitchat",
401
- "text_completion",
402
- "image_to_text",
403
- "ocr",
404
- "embed"
405
- ]);
406
- }
407
- });
408
-
409
363
  // src/events.ts
410
364
  function parseNamespace(ns) {
411
365
  const parts = splitNamespace(ns);
@@ -887,7 +841,6 @@ var init_client = __esm({
887
841
  init_config();
888
842
  init_errors();
889
843
  init_multiplexer();
890
- init_intent_hints();
891
844
  init_stream_terminal();
892
845
  init_inbound_priority();
893
846
  init_protocol();
@@ -1411,16 +1364,16 @@ var init_client = __esm({
1411
1364
  });
1412
1365
  }
1413
1366
  /**
1414
- * Sends a `request` envelope and waits for the matching `response` (or
1415
- * `error`) correlated by `id`. Returns the `result` object.
1416
- *
1417
- * Multiplexer-aware: registers a pending RPC wait
1418
- * keyed by the request id so that, even when a `receiveMessages()` reader
1419
- * is concurrently active, the matching `response`/`error` is routed to
1420
- * this caller instead of being discarded or buffered behind a stream.
1421
- * Non-matching frames are routed to their own waiters by the multiplexer
1422
- * or flow on to the resolver queue for stream readers.
1423
- */
1367
+ * Sends a `request` envelope and waits for the matching `response` (or
1368
+ * `error`) correlated by `id`. Returns the `result` object.
1369
+ *
1370
+ * Multiplexer-aware: registers a pending RPC wait
1371
+ * keyed by the request id so that, even when a `receiveMessages()` reader
1372
+ * is concurrently active, the matching `response`/`error` is routed to
1373
+ * this caller instead of being discarded or buffered behind a stream.
1374
+ * Non-matching frames are routed to their own waiters by the multiplexer
1375
+ * or flow on to the resolver queue for stream readers.
1376
+ */
1424
1377
  async requestResponse(method, params, responseType, timeout = 15e3) {
1425
1378
  const req = requestEnvelope(method, params);
1426
1379
  const rid = req.id;
@@ -1581,19 +1534,14 @@ var init_client = __esm({
1581
1534
  }
1582
1535
  const params = {
1583
1536
  loop_id: loopId,
1584
- content: text,
1585
- autonomous: options?.autonomous ?? false
1537
+ content: text
1586
1538
  };
1587
- if (options?.maxIterations !== void 0) params.max_iterations = options.maxIterations;
1588
1539
  if (options?.subagent) params.preferred_subagent = options.subagent;
1540
+ if (options?.intakeScope) params.intake_scope = options.intakeScope;
1589
1541
  if (options?.model) params.model = options.model;
1590
1542
  if (options?.modelParams) params.model_params = options.modelParams;
1591
1543
  if (options?.attachments) params.attachments = options.attachments;
1592
1544
  if (options?.intentHint) {
1593
- const hintError = validateLoopInputIntentHint(options.intentHint);
1594
- if (hintError) {
1595
- return Promise.reject(new Error(hintError));
1596
- }
1597
1545
  params.intent_hint = options.intentHint;
1598
1546
  }
1599
1547
  if (options?.responseSchema) params.response_schema = options.responseSchema;
@@ -1674,6 +1622,15 @@ var init_client = __esm({
1674
1622
  getLoopTree(loopID, timeout) {
1675
1623
  return this.requestResponse("loop_tree", { loop_id: loopID }, "loop_tree", timeout ?? 15e3);
1676
1624
  }
1625
+ /** Prunes old checkpoint branches for a loop and waits for response. */
1626
+ pruneLoop(loopID, keepLatest = 1, timeout) {
1627
+ return this.requestResponse(
1628
+ "loop_prune",
1629
+ { loop_id: loopID, keep_latest: keepLatest },
1630
+ "loop_prune",
1631
+ timeout ?? 15e3
1632
+ );
1633
+ }
1677
1634
  /** Requests loop deletion and waits for response. */
1678
1635
  deleteLoop(loopID, timeout) {
1679
1636
  return this.requestResponse(
@@ -1683,6 +1640,33 @@ var init_client = __esm({
1683
1640
  timeout ?? 15e3
1684
1641
  );
1685
1642
  }
1643
+ /** Reattaches to an existing loop and waits for response. */
1644
+ reattachLoop(loopID, timeout) {
1645
+ return this.requestResponse(
1646
+ "loop_reattach",
1647
+ { loop_id: loopID },
1648
+ "loop_reattach",
1649
+ timeout ?? 15e3
1650
+ );
1651
+ }
1652
+ /** Detaches from a loop (unsubscribe) and waits for response. */
1653
+ detachLoop(loopID, timeout) {
1654
+ return this.requestResponse(
1655
+ "loop_detach",
1656
+ { loop_id: loopID },
1657
+ "loop_detach",
1658
+ timeout ?? 15e3
1659
+ );
1660
+ }
1661
+ /** Fetches the execution state snapshot (plan, step_index, iteration, status). */
1662
+ getLoopExecutionState(loopID, timeout) {
1663
+ return this.requestResponse(
1664
+ "loop_execution_state_fetch",
1665
+ { loop_id: loopID },
1666
+ "loop_execution_state_fetch",
1667
+ timeout ?? 15e3
1668
+ );
1669
+ }
1686
1670
  /** Requests persisted conversation/activity rows. */
1687
1671
  sendLoopMessages(loopID, limit, offset, includeEvents) {
1688
1672
  const params = { loop_id: loopID };
@@ -2059,7 +2043,6 @@ __export(index_exports, {
2059
2043
  PROTO_VERSION: () => PROTO_VERSION,
2060
2044
  PooledConn: () => PooledConn,
2061
2045
  QueryGate: () => QueryGate,
2062
- REMOVED_INTENT_HINTS: () => REMOVED_INTENT_HINTS,
2063
2046
  ReconnectError: () => ReconnectError,
2064
2047
  SSEBroadcaster: () => SSEBroadcaster,
2065
2048
  STREAM_END: () => STREAM_END,
@@ -2133,7 +2116,6 @@ __export(index_exports, {
2133
2116
  subscribeEnvelope: () => subscribeEnvelope,
2134
2117
  turnIdsMatch: () => turnIdsMatch,
2135
2118
  unsubscribeEnvelope: () => unsubscribeEnvelope,
2136
- validateLoopInputIntentHint: () => validateLoopInputIntentHint,
2137
2119
  waitDaemonReady: () => waitDaemonReady,
2138
2120
  waitLoopStatusWithID: () => waitLoopStatusWithID,
2139
2121
  waitSubscriptionConfirmed: () => waitSubscriptionConfirmed
@@ -2143,7 +2125,34 @@ init_errors();
2143
2125
  init_verbosity();
2144
2126
  init_config();
2145
2127
  init_protocol();
2146
- init_intent_hints();
2128
+
2129
+ // src/intent_hints.ts
2130
+ var INTENT_HINT_TEXT_COMPLETION = "text_completion";
2131
+ var INTENT_HINT_IMAGE_TO_TEXT = "image_to_text";
2132
+ var INTENT_HINT_OCR = "ocr";
2133
+ var INTENT_HINT_EMBED = "embed";
2134
+ var LOOP_ASSISTANT_OUTPUT_PHASES = [
2135
+ "goal_completion",
2136
+ "quiz",
2137
+ "autonomous_goal",
2138
+ "chitchat",
2139
+ "text_completion",
2140
+ "image_to_text",
2141
+ "ocr",
2142
+ "embed",
2143
+ "plan_direct"
2144
+ ];
2145
+ var DEFAULT_DELIVERABLE_PHASES = /* @__PURE__ */ new Set([
2146
+ "quiz",
2147
+ "goal_completion",
2148
+ "chitchat",
2149
+ "text_completion",
2150
+ "image_to_text",
2151
+ "ocr",
2152
+ "embed"
2153
+ ]);
2154
+
2155
+ // src/index.ts
2147
2156
  init_events();
2148
2157
  init_client();
2149
2158
 
@@ -2286,9 +2295,23 @@ var CommandClient = class {
2286
2295
  async jobStatus(jobId) {
2287
2296
  return this.request("job_status", { job_id: jobId });
2288
2297
  }
2298
+ async jobPause(jobId) {
2299
+ return this.request("job_pause", { job_id: jobId });
2300
+ }
2301
+ async jobResume(jobId) {
2302
+ return this.request("job_resume", { job_id: jobId });
2303
+ }
2289
2304
  async jobCancel(jobId) {
2290
2305
  return this.request("job_cancel", { job_id: jobId });
2291
2306
  }
2307
+ async jobDag(jobId) {
2308
+ return this.request("job_dag", { job_id: jobId });
2309
+ }
2310
+ async jobGuidance(jobId, content, goalId) {
2311
+ const params = { job_id: jobId, content };
2312
+ if (goalId) params.goal_id = goalId;
2313
+ return this.request("job_guidance", params);
2314
+ }
2292
2315
  /** Return autopilot scheduler status (running / dreaming / pool). */
2293
2316
  async autopilotStatus() {
2294
2317
  return this.request("autopilot_status");
@@ -2352,6 +2375,12 @@ var CommandClient = class {
2352
2375
  if (status) params.status = status;
2353
2376
  return this.request("cron_list", params);
2354
2377
  }
2378
+ async cronShow(jobId) {
2379
+ return this.request("cron_show", { job_id: jobId });
2380
+ }
2381
+ async cronCancel(jobId) {
2382
+ return this.request("cron_cancel", { job_id: jobId });
2383
+ }
2355
2384
  };
2356
2385
 
2357
2386
  // src/helpers.ts
@@ -3517,9 +3546,6 @@ async function compactAttachments(atts, opts) {
3517
3546
  return out;
3518
3547
  }
3519
3548
 
3520
- // src/appkit/turn_runner.ts
3521
- init_intent_hints();
3522
-
3523
3549
  // src/appkit/turn_boundary.ts
3524
3550
  init_stream_terminal();
3525
3551
  var TURN_END_STREAM_END = STREAM_END;
@@ -3682,13 +3708,10 @@ function inputMessageForLoop(text, loopID, attachments, opts) {
3682
3708
  if (attachments && attachments.length > 0) msg.attachments = attachments;
3683
3709
  if (opts) {
3684
3710
  if (opts.intentHint?.trim()) {
3685
- const hintError = validateLoopInputIntentHint(opts.intentHint);
3686
- if (hintError) {
3687
- throw new Error(hintError);
3688
- }
3689
3711
  msg.intent_hint = opts.intentHint.trim();
3690
3712
  }
3691
3713
  if (opts.preferredSubagent?.trim()) msg.preferred_subagent = opts.preferredSubagent.trim();
3714
+ if (opts.intakeScope?.trim()) msg.intake_scope = opts.intakeScope.trim();
3692
3715
  if (opts.responseSchema && Object.keys(opts.responseSchema).length > 0) {
3693
3716
  msg.response_schema = opts.responseSchema;
3694
3717
  }
@@ -4217,8 +4240,6 @@ var DaemonSession = class {
4217
4240
  if (!this.loopId) throw new Error("No active loop session");
4218
4241
  await this.client.sendInput(text, {
4219
4242
  loopID: this.loopId,
4220
- autonomous: options?.autonomous,
4221
- maxIterations: options?.maxIterations,
4222
4243
  subagent: options?.preferredSubagent,
4223
4244
  model: options?.model,
4224
4245
  modelParams: options?.modelParams,
@@ -4623,7 +4644,6 @@ var CardProjection = class {
4623
4644
  PROTO_VERSION,
4624
4645
  PooledConn,
4625
4646
  QueryGate,
4626
- REMOVED_INTENT_HINTS,
4627
4647
  ReconnectError,
4628
4648
  SSEBroadcaster,
4629
4649
  STREAM_END,
@@ -4697,7 +4717,6 @@ var CardProjection = class {
4697
4717
  subscribeEnvelope,
4698
4718
  turnIdsMatch,
4699
4719
  unsubscribeEnvelope,
4700
- validateLoopInputIntentHint,
4701
4720
  waitDaemonReady,
4702
4721
  waitLoopStatusWithID,
4703
4722
  waitSubscriptionConfirmed