@granular-software/sdk 0.4.58 → 0.4.60

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
@@ -751,26 +751,60 @@ Session history is always bounded (100 rows by default, 500 maximum). Increment
751
751
  `granular.listSessions()` also accepts `environmentId`, `sandboxId`, and
752
752
  `subjectId`; at least one ownership filter is required.
753
753
 
754
+ ### Canonical User And Assistant Ingress
755
+
756
+ The live session API has no mixed-role message append. Browser and server
757
+ callers append user input with an implicit user role:
758
+
759
+ ```ts
760
+ await session.appendUserMessage({
761
+ id: "user_turn_42",
762
+ operationId: "send:user_turn_42",
763
+ content: "Compare the open requests.",
764
+ show: { fileIds: ["file_123"] },
765
+ });
766
+ ```
767
+
768
+ Only trusted API-key `EnvironmentSession` handles can publish a terminal
769
+ assistant text occurrence:
770
+
771
+ ```ts
772
+ await session.publishAssistantReply({
773
+ id: "assistant_turn_42",
774
+ operationId: "reply:assistant_turn_42",
775
+ text: "The comparison is ready.",
776
+ });
777
+ ```
778
+
779
+ Delegated browsers cannot call `publishAssistantReply()`. Generated jobs should
780
+ author messages and components with the trusted Harness feed helpers.
781
+
754
782
  ### Live Session State And Durable Collections
755
783
 
756
784
  `session.document` and `session.getHeap()` are local, fast views of the live runtime state synced over the WebSocket.
757
785
 
758
- Older conversation history, timeline events, completed jobs, and saved heap artifacts are exposed through named durable collections:
786
+ The canonical customer-visible history is the server-sequenced feed. The
787
+ transcript is a message-oriented projection of that same feed. Timeline events
788
+ and jobs are diagnostic collections; they are not presentation chronology.
789
+ Saved heap artifacts remain available through their named collections:
759
790
 
760
791
  ```ts
761
792
  const session = await env.sessions.create();
762
793
 
763
794
  const liveHeap = session.getHeap();
764
- const messages = await session.messages.list({ limit: 100 });
795
+ const feed = await session.feed.list({ afterSequence: 0, limit: 100 });
796
+ const transcript = await session.transcript.list({ limit: 100 });
765
797
  const timeline = await session.timeline.list({ limit: 100 });
766
798
  const jobs = await session.jobs.list({ status: "all", limit: 100 });
767
799
  const job = await session.jobs.get("job_123");
768
800
  const entry = await session.heap.entries.get("customer_123");
769
801
  const savedList = await session.heap.lists.get("recent_customers");
770
- const transcript = await session.transcript.list({ limit: 100 });
771
802
  ```
772
803
 
773
- Use the live state for current working context, and the collection APIs when you need durable history or artifacts that may have been moved out of the live document.
804
+ Use the live state for current resource lifecycle data, `feed.list()` for exact
805
+ durable presentation order, and `transcript.list()` when only message-like
806
+ history is needed. Page the feed by server sequence; never reconstruct display
807
+ order from timeline events, jobs, or timestamps.
774
808
 
775
809
  ### `session.getDomainDocumentation()`
776
810
 
@@ -1,5 +1,5 @@
1
- import { a as EnvironmentSession, G as Granular } from './client-DFaCRSto.mjs';
2
- import { G as GranularSpendContext, h as OpenAITokenSpend, P as Prompt, bW as RecordObjectOptions, cL as ManifestContent, c as SessionHeapSnapshot, T as ToolWithHandler, K as ConnectOptions, ag as CreateEnvironmentData, y as GranularOptions } from './spend-czRX7l0X.mjs';
1
+ import { a as EnvironmentSession, G as Granular } from './client-DSkGcmmX.mjs';
2
+ import { at as GranularSpendContext, ao as OpenAITokenSpend, P as Prompt, cX as RecordObjectOptions, dN as ManifestContent, d as SessionHeapSnapshot, T as ToolWithHandler, aP as ConnectOptions, bd as CreateEnvironmentData, aI as GranularOptions } from './spend-CNe-Ff6U.mjs';
3
3
  import { GranularAgentToolInfo, GeneratedJobCodeIssue, BuildGranularAgentSystemPromptInput, HarnessRenderedPrompt, HarnessRenderedContinuation, HarnessControllerBudgets } from './agent-harness.mjs';
4
4
  import '@automerge/automerge';
5
5
  import '@automerge/automerge/slim';
@@ -369,7 +369,6 @@ interface AgentEvalPendingTurn {
369
369
  turnDir: string;
370
370
  boundaryTimestamp: number;
371
371
  finalCode: string;
372
- finalReply: string;
373
372
  stdout: string[];
374
373
  stderr: string[];
375
374
  prompts: Prompt[];
@@ -1,5 +1,5 @@
1
- import { a as EnvironmentSession, G as Granular } from './client-UdGt44dF.js';
2
- import { G as GranularSpendContext, h as OpenAITokenSpend, P as Prompt, bW as RecordObjectOptions, cL as ManifestContent, c as SessionHeapSnapshot, T as ToolWithHandler, K as ConnectOptions, ag as CreateEnvironmentData, y as GranularOptions } from './spend-czRX7l0X.js';
1
+ import { a as EnvironmentSession, G as Granular } from './client-BzgQvNyG.js';
2
+ import { at as GranularSpendContext, ao as OpenAITokenSpend, P as Prompt, cX as RecordObjectOptions, dN as ManifestContent, d as SessionHeapSnapshot, T as ToolWithHandler, aP as ConnectOptions, bd as CreateEnvironmentData, aI as GranularOptions } from './spend-CNe-Ff6U.js';
3
3
  import { GranularAgentToolInfo, GeneratedJobCodeIssue, BuildGranularAgentSystemPromptInput, HarnessRenderedPrompt, HarnessRenderedContinuation, HarnessControllerBudgets } from './agent-harness.js';
4
4
  import '@automerge/automerge';
5
5
  import '@automerge/automerge/slim';
@@ -369,7 +369,6 @@ interface AgentEvalPendingTurn {
369
369
  turnDir: string;
370
370
  boundaryTimestamp: number;
371
371
  finalCode: string;
372
- finalReply: string;
373
372
  stdout: string[];
374
373
  stderr: string[];
375
374
  prompts: Prompt[];