@granular-software/sdk 0.4.50 → 0.4.52

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
@@ -193,6 +193,36 @@ const result = await job.result;
193
193
 
194
194
  Effects must be declared ahead of time in the ontology version manifest with `withEffect`. Live registration only makes already-declared effects available at runtime.
195
195
 
196
+ ### Agent-selected result columns
197
+
198
+ When an agent needs to show records with fields or calculations chosen for the
199
+ current question, it can project a result table in the job runtime:
200
+
201
+ ```typescript
202
+ import { relativeTime, showAgentResponse, table } from "@granular/agent";
203
+
204
+ showAgentResponse({
205
+ reply: "Two recent orders need attention.",
206
+ show: table(
207
+ recentOrders,
208
+ [
209
+ { label: "Order", value: (record) => record.label },
210
+ {
211
+ label: "Status change",
212
+ value: (record) => `${record.before_status} → ${record.after_status}`,
213
+ },
214
+ { label: "Updated", value: (record) => relativeTime(record.timestamp) },
215
+ ],
216
+ { label: "Latest order changes" },
217
+ ),
218
+ });
219
+ ```
220
+
221
+ The callbacks run only inside the sandbox job. Granular persists the resolved
222
+ column labels, primitive cells, typed dates, relative times, and grounded row
223
+ references—not executable functions—so the conversation remains durable and
224
+ safe to reopen in another browser.
225
+
196
226
  ## Core Flow
197
227
 
198
228
  ```
@@ -698,6 +728,29 @@ Registers ontology-scoped live handlers for effects declared in the ontology man
698
728
 
699
729
  Open a live runtime session for the environment, then submit code to the sandbox. The code imports typed classes from Harness v3 modules such as `@granular/domain/<Class>`.
700
730
 
731
+ Pass `sessionScope` when one product has more than one independent conversation
732
+ surface. The scope is persisted with the session and can be reused as a hard
733
+ history filter:
734
+
735
+ ```ts
736
+ const session = await env.sessions.create({
737
+ clientId: crypto.randomUUID(),
738
+ sessionScope: "spendish-order-ops",
739
+ });
740
+
741
+ const firstPage = await env.sessions.list({
742
+ status: "all",
743
+ sessionScope: "spendish-order-ops",
744
+ limit: 25,
745
+ offset: 0,
746
+ });
747
+ ```
748
+
749
+ Session history is always bounded (100 rows by default, 500 maximum). Increment
750
+ `offset` to fetch another page. For tenant-level tooling,
751
+ `granular.listSessions()` also accepts `environmentId`, `sandboxId`, and
752
+ `subjectId`; at least one ownership filter is required.
753
+
701
754
  ### Live Session State And Durable Collections
702
755
 
703
756
  `session.document` and `session.getHeap()` are local, fast views of the live runtime state synced over the WebSocket.
@@ -1,5 +1,5 @@
1
- import { a as EnvironmentSession, G as Granular } from './client-DaYFTHG8.mjs';
2
- import { G as GranularSpendContext, h as OpenAITokenSpend, P as Prompt, bL as RecordObjectOptions, cz as ManifestContent, c as SessionHeapSnapshot, T as ToolWithHandler, J as ConnectOptions, ad as CreateEnvironmentData, y as GranularOptions } from './spend-RpJikX9w.mjs';
1
+ import { a as EnvironmentSession, G as Granular } from './client-B2OyGOHE.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-DpRRCrAr.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';
@@ -1,5 +1,5 @@
1
- import { a as EnvironmentSession, G as Granular } from './client-BbI7ThzU.js';
2
- import { G as GranularSpendContext, h as OpenAITokenSpend, P as Prompt, bL as RecordObjectOptions, cz as ManifestContent, c as SessionHeapSnapshot, T as ToolWithHandler, J as ConnectOptions, ad as CreateEnvironmentData, y as GranularOptions } from './spend-RpJikX9w.js';
1
+ import { a as EnvironmentSession, G as Granular } from './client-BMfjRJTs.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-DpRRCrAr.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';