@camox/api-contract 0.80.0 → 0.81.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.
Files changed (2) hide show
  1. package/dist/router.d.ts +15 -11
  2. package/package.json +1 -1
package/dist/router.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { z } from "zod";
2
2
  import { DurableObject, WorkerEntrypoint, WorkflowEntrypoint, WorkflowEvent, WorkflowStep } from "cloudflare:workers";
3
- import { AgentActivity, ConnectedAgentClient, ThreadSender, ThreadView } from "@camox/api-contract/threads";
3
+ import { AgentActivity, ConnectedAgentClient, EditorWhere, ThreadSender, ThreadView } from "@camox/api-contract/threads";
4
4
  import { PiHarness, PiHarnessOptions } from "agents/harness/pi";
5
- import { CapabilityStartContext, Lifecycle } from "agents/lifecycle";
5
+ import { CapabilityStartContext, Lifecycle, LifecycleJobContext } from "agents/lifecycle";
6
6
  import { WebSockets } from "agents/websockets";
7
7
  import "@earendil-works/pi-ai";
8
8
  import "@earendil-works/pi-ai/models";
@@ -9753,6 +9753,8 @@ type OpeningMessage = {
9753
9753
  from: OpeningSender;
9754
9754
  answer?: boolean;
9755
9755
  attachments?: MessageAttachment[];
9756
+ /** Where the editor was in the studio as they sent it, for a message sent from there. */
9757
+ where?: EditorWhere;
9756
9758
  };
9757
9759
  /**
9758
9760
  * How the API opens a draft's thread with no studio connected (`Thread.open`): what it belongs
@@ -9768,12 +9770,17 @@ type ThreadOpening = {
9768
9770
  };
9769
9771
  /**
9770
9772
  * Cloudflare's `PiHarness`, leaving Pi closed when the object starts until `started` holds: Pi
9771
- * creates its tables as it opens, and a thread nobody messaged has no run to resume.
9773
+ * creates its tables as it opens, and a thread nobody messaged has no run to resume. `settled`
9774
+ * hears each time a session of the thread has no task left: Pi has no hook for a run that fails,
9775
+ * but the harness's job waking a session completes once its tasks are all over, failed or not.
9772
9776
  */
9773
9777
  declare class UntilStartedPiHarness extends PiHarness {
9774
9778
  #private;
9775
- constructor(started: () => Promise<boolean>, options: PiHarnessOptions);
9779
+ constructor(started: () => Promise<boolean>, { settled, ...options }: PiHarnessOptions & {
9780
+ settled: () => Promise<void>;
9781
+ });
9776
9782
  onStart(context: CapabilityStartContext): Promise<void>;
9783
+ onJob(context: LifecycleJobContext): Promise<void | import("agents/lifecycle").LifecycleJobOutcome>;
9777
9784
  }
9778
9785
  /**
9779
9786
  * One thread with Camox's agent, addressed by the thread's own id. Pi Durable runs the agent
@@ -9822,14 +9829,11 @@ declare class Thread extends DurableObject<Bindings> {
9822
9829
  */
9823
9830
  showDrafts(): Promise<void>;
9824
9831
  /**
9825
- * Opens the thread from the API, with no studio connected: records what it belongs to and the
9826
- * API's origin, adds the Brief if any, which the model reads and studios show as from Camox
9827
- * (ADR 0025), then the opening messages, each recorded as its sender's kind has it, and starts
9828
- * the agent's run, which acts as the last message's sender. Every message but the last goes in
9829
- * before the run, the last starting it, so the model reads them all on its first call.
9830
- * Repeating it changes nothing.
9832
+ * Opens the thread from the API, with no studio connected: its Brief, if any, then its opening
9833
+ * messages, each recorded as its sender's kind has it, the last starting the agent's run, which
9834
+ * acts as its sender (`Turns.take`). Repeating it changes nothing.
9831
9835
  */
9832
- open({ identity, apiOrigin, brief, messages }: ThreadOpening): Promise<void>;
9836
+ open(opening: ThreadOpening): Promise<void>;
9833
9837
  /**
9834
9838
  * Sends a message into the thread from the API, with no studio connected, as an editor's
9835
9839
  * message from the studio is sent: it starts the agent's run, or steers the one going, and the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camox/api-contract",
3
- "version": "0.80.0",
3
+ "version": "0.81.0",
4
4
  "license": "UNLICENSED",
5
5
  "files": [
6
6
  "src",