@nemphi/sdk 0.4.5386 → 0.5.5400

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.d.ts CHANGED
@@ -579,10 +579,11 @@ export interface Notification {
579
579
  /**
580
580
  * One realtime event of the workspace (`openRealtimeSocket` and
581
581
  * `streamEvents`, the frames of `GET /v1/events/stream` and
582
- * `GET /v1/events/socket`), or of one chat thread (`streamThread`).
583
- * `action` and `notification` are wakeups — re-read the surface, the row
584
- * itself comes by cursor; the rest is state that only matters while
585
- * someone is watching.
582
+ * `GET /v1/events/socket`), which every member hears. `action` and
583
+ * `notification` are wakeups — re-read the surface, the row itself comes by
584
+ * cursor; the rest is state that only matters while someone is watching. A
585
+ * chat thread's answers are not among them: they are only its members' to
586
+ * read, on the thread's own stream (`streamThread`, `ThreadStreamEvent`).
586
587
  */
587
588
  export type RealtimeEvent = {
588
589
  type: "action";
@@ -603,25 +604,6 @@ export type RealtimeEvent = {
603
604
  channel_id: string;
604
605
  /** A message landed, a delivery status changed, or the thread was read. */
605
606
  change: "message" | "status" | "read";
606
- } | {
607
- type: "run";
608
- /** The chat thread this run works in; only thread work is published. */
609
- thread_id: string;
610
- run_id: string;
611
- agent_definition: string;
612
- /** What the step returned: continue (still working), parked (waiting), idle (a resting session), done. */
613
- outcome: "continue" | "parked" | "idle" | "done";
614
- } | {
615
- type: "run_delta";
616
- /** The chat thread the run answers in. */
617
- thread_id: string;
618
- run_id: string;
619
- /** The step the model turn will be stored as; a higher one is a new turn. */
620
- seq: number;
621
- /** The frame's place within the turn, from 0. */
622
- n: number;
623
- /** Prose the model generated since the previous frame. */
624
- text: string;
625
607
  } | {
626
608
  type: "typing";
627
609
  /** A workspace chat thread or a marketing inbox conversation. */
@@ -654,12 +636,30 @@ export type RealtimeEvent = {
654
636
  until: string;
655
637
  };
656
638
  /**
657
- * One frame of a chat thread's own stream (`streamThread`): a piece of the
658
- * answer a run is writing (`run_delta`), or a run step's end (`run`).
639
+ * One frame of a chat thread's own stream (`streamThread`), which only a
640
+ * member who sits in the thread may read: a piece of the answer a run is
641
+ * writing (`run_delta`), or a run step's end (`run`).
659
642
  */
660
- export type ThreadStreamEvent = Extract<RealtimeEvent, {
661
- type: "run" | "run_delta";
662
- }>;
643
+ export type ThreadStreamEvent = {
644
+ type: "run";
645
+ /** The chat thread this run works in; only thread work is published. */
646
+ thread_id: string;
647
+ run_id: string;
648
+ agent_definition: string;
649
+ /** What the step returned: continue (still working), parked (waiting), idle (a resting session), done. */
650
+ outcome: "continue" | "parked" | "idle" | "done";
651
+ } | {
652
+ type: "run_delta";
653
+ /** The chat thread the run answers in. */
654
+ thread_id: string;
655
+ run_id: string;
656
+ /** The step the model turn will be stored as; a higher one is a new turn. */
657
+ seq: number;
658
+ /** The frame's place within the turn, from 0. */
659
+ n: number;
660
+ /** Prose the model generated since the previous frame. */
661
+ text: string;
662
+ };
663
663
  /** Where a person is typing: a chat thread or a marketing inbox conversation. */
664
664
  export type TypingScope = Extract<RealtimeEvent, {
665
665
  type: "typing";
@@ -6631,12 +6631,6 @@ export interface ChatAttachment {
6631
6631
  document_id: string;
6632
6632
  filename: string;
6633
6633
  }
6634
- export interface ChatMessage {
6635
- role: "user" | "assistant";
6636
- content: string;
6637
- /** Uploaded documents attached to a user message. */
6638
- attachments?: ChatAttachment[];
6639
- }
6640
6634
  /**
6641
6635
  * An action parked for in-chat authorization: the exact tool call the model
6642
6636
  * attempted, held server-side until the user approves or denies it.
@@ -6646,17 +6640,6 @@ export interface ChatApproval {
6646
6640
  tool: string;
6647
6641
  input: unknown;
6648
6642
  }
6649
- /** The outcome of deciding an in-chat authorization request. */
6650
- export interface ChatApprovalDecision {
6651
- decided: "approved" | "denied";
6652
- tool: string;
6653
- /** Tool output when approved and the call succeeded. */
6654
- output?: unknown;
6655
- /** Present when approved but the call failed. */
6656
- error?: string;
6657
- /** True when the approved call changed a dashboard. */
6658
- dashboard_changed?: boolean;
6659
- }
6660
6643
  /**
6661
6644
  * How a member answered an in-chat authorization, kept on the user turn
6662
6645
  * that carried the answer back to the model so the transcript can draw
@@ -6673,38 +6656,6 @@ export interface ChatApprovalOutcome {
6673
6656
  /** Present when approved but the call failed. */
6674
6657
  error?: string;
6675
6658
  }
6676
- export interface OverviewChatResponse {
6677
- reply: string;
6678
- /**
6679
- * The answer's json-render spec (ui-spec.ts), when the model drew one:
6680
- * rendered under the reply in place of `message`, which then leads with
6681
- * its Block Kit reading for a client that does not draw specs.
6682
- */
6683
- ui?: UISpec;
6684
- /**
6685
- * The answer as Block Kit blocks, when the model laid one out (a table,
6686
- * a plan, buttons to click): rendered under the reply. See block-kit.ts.
6687
- */
6688
- message?: MessageBlock[];
6689
- blocks: CanvasBlock[];
6690
- /**
6691
- * Questions the model posed via user.ask. Render them as a questionnaire
6692
- * and send the answers back as the next user message.
6693
- */
6694
- questions?: RunQuestion[];
6695
- /**
6696
- * An action awaiting the user's in-chat authorization. Render Approve/Deny;
6697
- * decide via decideChatApproval and report the outcome back as the next
6698
- * user message.
6699
- */
6700
- approval?: ChatApproval;
6701
- usage: {
6702
- tokens_in: number;
6703
- tokens_out: number;
6704
- };
6705
- /** True when this turn created, appended, edited, or deleted a dashboard. */
6706
- dashboard_changed: boolean;
6707
- }
6708
6659
  /** How a `askSession` stood when its wait ended. */
6709
6660
  export type SessionAskState = "answered" | "awaiting_approval" | "awaiting_input" | "working" | "failed";
6710
6661
  /**
@@ -6747,39 +6698,6 @@ export interface SessionAsk {
6747
6698
  message: string;
6748
6699
  };
6749
6700
  }
6750
- /** How far a tool call got during a streaming chat turn. */
6751
- export type OverviewChatToolPhase = "start" | "ok" | "error" | "approval" | "questions";
6752
- /**
6753
- * One event of a streaming overview chat (`overviewChatStream`).
6754
- *
6755
- * - `turn` — a model turn began. Text streamed before it was a preamble to
6756
- * a tool call, so the accumulated answer starts over.
6757
- * - `delta` — more of the answer's prose, already decoded out of the
6758
- * model's JSON envelope.
6759
- * - `tool` — a tool call started or finished; useful as a progress line.
6760
- * - `done` — the authoritative payload, identical to what `overviewChat`
6761
- * returns. Blocks, questions and approvals only exist once the turn is
6762
- * complete, so replace the streamed text with `response.reply`.
6763
- * - `error` — the round-trip failed; nothing further arrives.
6764
- */
6765
- export type OverviewChatStreamEvent = {
6766
- type: "turn";
6767
- n: number;
6768
- } | {
6769
- type: "delta";
6770
- text: string;
6771
- } | {
6772
- type: "tool";
6773
- name: string;
6774
- phase: OverviewChatToolPhase;
6775
- } | {
6776
- type: "done";
6777
- response: OverviewChatResponse;
6778
- } | {
6779
- type: "error";
6780
- error: string;
6781
- code: string;
6782
- };
6783
6701
  /** One turn of a saved overview conversation (a historical record: blocks keep the data they were hydrated with). */
6784
6702
  export interface ConversationTurn {
6785
6703
  role: "user" | "assistant";
@@ -9553,27 +9471,6 @@ export interface NemphiClient {
9553
9471
  document_ids?: string[];
9554
9472
  wait_ms?: number;
9555
9473
  }): Promise<SessionAsk>;
9556
- /**
9557
- * @deprecated Use `askSession`: the overview chat now asks the member's
9558
- * DM with the orchestrator through the same session path, and the route
9559
- * goes once installed app builds age out.
9560
- */
9561
- overviewChat(input: {
9562
- messages: ChatMessage[];
9563
- }): Promise<OverviewChatResponse>;
9564
- /**
9565
- * The same round-trip as `overviewChat`, reported as it happens. Render
9566
- * the deltas for immediate feedback and take the final answer from the
9567
- * `done` event — it is what `overviewChat` would have returned.
9568
- *
9569
- * @deprecated Use `askSession`, and `streamThread` to follow the answer
9570
- * as it forms.
9571
- */
9572
- overviewChatStream(input: {
9573
- messages: ChatMessage[];
9574
- }, opts?: {
9575
- signal?: AbortSignal;
9576
- }): AsyncGenerator<OverviewChatStreamEvent, void, void>;
9577
9474
  /** Suggested prompts ranked from the tenant's live data. */
9578
9475
  overviewSuggestions(): Promise<OverviewSuggestionsResponse>;
9579
9476
  /**
@@ -9597,13 +9494,6 @@ export interface NemphiClient {
9597
9494
  mirrorOverviewThread(turns: ConversationTurn[]): Promise<{
9598
9495
  thread_id: string;
9599
9496
  }>;
9600
- /**
9601
- * Decides an in-chat authorization request; approving executes the parked call.
9602
- *
9603
- * @deprecated Approvals are the run's now: decide `SessionAsk.approval`
9604
- * with `approveRun` / `denyRun` on its `run_id`.
9605
- */
9606
- decideChatApproval(id: string, approve: boolean): Promise<ChatApprovalDecision>;
9607
9497
  listDashboards(): Promise<DashboardSummary[]>;
9608
9498
  /**
9609
9499
  * Fetches one dashboard with every block's metric query re-run (live data).