@granular-software/sdk 0.4.30 → 0.4.31
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 +25 -20
- package/dist/agent-evals.d.mts +7 -6
- package/dist/agent-evals.d.ts +7 -6
- package/dist/agent-evals.js +681 -277
- package/dist/agent-evals.js.map +1 -1
- package/dist/agent-evals.mjs +681 -277
- package/dist/agent-evals.mjs.map +1 -1
- package/dist/cli/index.js +526 -271
- package/dist/{client-BVvOMfln.d.mts → client-CTH1hfwe.d.mts} +254 -123
- package/dist/{client-BVvOMfln.d.ts → client-CTH1hfwe.d.ts} +254 -123
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +439 -187
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +438 -188
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -86,35 +86,71 @@ interface Subject {
|
|
|
86
86
|
updatedAt: number;
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
|
-
* Options for
|
|
89
|
+
* Options for opening or resolving an ontology environment for one user.
|
|
90
|
+
*
|
|
91
|
+
* This does **not** open a session. Use `environment.sessions.create()` after
|
|
92
|
+
* opening the environment when you need a live runtime connection.
|
|
90
93
|
*/
|
|
91
|
-
interface
|
|
92
|
-
/** The ontology name or ID to
|
|
94
|
+
interface OpenEnvironmentOptions {
|
|
95
|
+
/** The ontology name or ID to open */
|
|
93
96
|
ontology: string;
|
|
94
|
-
/**
|
|
95
|
-
|
|
96
|
-
/** Advanced override for the version tag/channel to follow. In the common case, omit this. */
|
|
97
|
-
tagName?: string;
|
|
97
|
+
/** Version channel to follow, typically `dev` or `prod` */
|
|
98
|
+
tag?: string;
|
|
98
99
|
/**
|
|
99
|
-
* External user identifier from your app.
|
|
100
|
-
*
|
|
100
|
+
* External user identifier from your app.
|
|
101
|
+
*
|
|
102
|
+
* Exactly one of `userId`, `granularId`, or `user` should be provided.
|
|
101
103
|
*/
|
|
102
104
|
userId?: string;
|
|
103
105
|
/**
|
|
104
|
-
* Internal Granular user identifier.
|
|
105
|
-
*
|
|
106
|
+
* Internal Granular user identifier.
|
|
107
|
+
*
|
|
108
|
+
* Exactly one of `userId`, `granularId`, or `user` should be provided.
|
|
106
109
|
*/
|
|
107
110
|
granularId?: string;
|
|
108
111
|
/** Optional display name used when upserting the user */
|
|
109
112
|
name?: string;
|
|
110
113
|
/** Optional email used when upserting the user */
|
|
111
114
|
email?: string;
|
|
112
|
-
/**
|
|
113
|
-
|
|
115
|
+
/**
|
|
116
|
+
* Permission profile names or IDs to ensure before opening the environment.
|
|
117
|
+
* This should be provided even for existing users so the SDK can guarantee
|
|
118
|
+
* assignments for first-time environment creation.
|
|
119
|
+
*/
|
|
120
|
+
permissions: string[];
|
|
121
|
+
/**
|
|
122
|
+
* When true, if the latest environment for this ontology/user/tag is marked
|
|
123
|
+
* outdated relative to the current tag target, create a fresh environment on
|
|
124
|
+
* the newest tag target instead of reusing the outdated one.
|
|
125
|
+
*/
|
|
126
|
+
createFreshIfOutdated?: boolean;
|
|
114
127
|
/** Backwards-compatible user object returned from recordUser() */
|
|
115
128
|
user?: User;
|
|
116
|
-
|
|
117
|
-
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Deprecated compatibility alias for the legacy `connect()` entry point.
|
|
132
|
+
*
|
|
133
|
+
* `connect()` now resolves an environment handle and no longer opens a
|
|
134
|
+
* runtime session automatically. Prefer `openEnvironment()` for new code.
|
|
135
|
+
*/
|
|
136
|
+
interface ConnectOptions extends OpenEnvironmentOptions {
|
|
137
|
+
/** @deprecated Legacy explicit environment slot name. Prefer `tag`. */
|
|
138
|
+
environment?: string;
|
|
139
|
+
/** @deprecated Legacy tag field. Prefer `tag`. */
|
|
140
|
+
tagName?: string;
|
|
141
|
+
/** @deprecated Ignored by `connect()` now that it no longer opens sessions. */
|
|
142
|
+
clientId?: string;
|
|
143
|
+
/** @deprecated Ignored by `connect()` now that it no longer opens sessions. */
|
|
144
|
+
initialHeap?: Array<{
|
|
145
|
+
className: string;
|
|
146
|
+
id: string;
|
|
147
|
+
}>;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Options for creating a live runtime session from an opened environment.
|
|
151
|
+
*/
|
|
152
|
+
interface CreateSessionOptions {
|
|
153
|
+
/** Optional stable client ID. Defaults to `client_${Date.now()}`. */
|
|
118
154
|
clientId?: string;
|
|
119
155
|
/** Optional session heap seed. Each item is eagerly hydrated into the session heap on connect. */
|
|
120
156
|
initialHeap?: Array<{
|
|
@@ -634,6 +670,18 @@ interface JobFeedbackRecord {
|
|
|
634
670
|
createdAt: number;
|
|
635
671
|
updatedAt: number;
|
|
636
672
|
}
|
|
673
|
+
/**
|
|
674
|
+
* Persisted feedback rows listed at the environment level.
|
|
675
|
+
*/
|
|
676
|
+
interface EnvironmentFeedbackRecord {
|
|
677
|
+
feedbackId: string;
|
|
678
|
+
sessionId: string;
|
|
679
|
+
jobId: string;
|
|
680
|
+
sentiment: JobFeedbackSentiment;
|
|
681
|
+
comment?: string | null;
|
|
682
|
+
metadata?: Record<string, unknown> | null;
|
|
683
|
+
createdAt: string | null;
|
|
684
|
+
}
|
|
637
685
|
/**
|
|
638
686
|
* Result from submitting a job
|
|
639
687
|
*/
|
|
@@ -1447,27 +1495,18 @@ declare class Session {
|
|
|
1447
1495
|
}
|
|
1448
1496
|
|
|
1449
1497
|
/**
|
|
1450
|
-
* Environment
|
|
1451
|
-
*
|
|
1452
|
-
* After connecting, you can:
|
|
1453
|
-
* 1. Define your domain ontology via `applyManifest()` (classes, properties, relationships)
|
|
1454
|
-
* 2. Record object instances via `recordObject()` (with fields and relationship attachments)
|
|
1455
|
-
* 3. Register sandbox-scoped effects via `granular.registerEffect()` / `granular.registerEffects()`
|
|
1456
|
-
* 4. Submit jobs via `submitJob()` that import auto-generated typed classes from `./sandbox-tools`
|
|
1457
|
-
* 5. Execute GraphQL queries via `graphql()` (authenticated automatically)
|
|
1458
|
-
* 6. List available effects via `getEffects()` and listen for updates via `onEffectsChanged()`
|
|
1459
|
-
*
|
|
1460
|
-
* Tool calls from the sandbox automatically invoke your handlers via reverse-RPC.
|
|
1498
|
+
* Environment is the sessionless handle for one resolved ontology environment.
|
|
1461
1499
|
*
|
|
1462
|
-
*
|
|
1463
|
-
*
|
|
1464
|
-
*
|
|
1500
|
+
* Use it to query or mutate environment data directly, or to open live runtime
|
|
1501
|
+
* sessions through `environment.sessions.*` when you need jobs, prompts, or a
|
|
1502
|
+
* synced Automerge document.
|
|
1465
1503
|
*/
|
|
1466
|
-
declare class Environment
|
|
1504
|
+
declare class Environment {
|
|
1505
|
+
private granular;
|
|
1467
1506
|
private envData;
|
|
1468
1507
|
private _apiKey;
|
|
1469
1508
|
private _apiEndpoint;
|
|
1470
|
-
constructor(
|
|
1509
|
+
constructor(granular: Granular, envData: EnvironmentData, apiKey: string, apiEndpoint: string);
|
|
1471
1510
|
/** The environment ID */
|
|
1472
1511
|
get environmentId(): string;
|
|
1473
1512
|
/** The sandbox ID */
|
|
@@ -1486,65 +1525,68 @@ declare class Environment extends Session {
|
|
|
1486
1525
|
get granularId(): string;
|
|
1487
1526
|
/** The permission profile ID */
|
|
1488
1527
|
get permissionProfileId(): string;
|
|
1528
|
+
/** The current build policy backing this environment */
|
|
1529
|
+
get buildPolicy(): BuildPolicy;
|
|
1530
|
+
/** The current update state relative to the followed tag */
|
|
1531
|
+
get updateState(): EnvironmentData["updateState"];
|
|
1532
|
+
/** Convenience flag for whether this environment trails the current tag target */
|
|
1533
|
+
get isOutdated(): boolean;
|
|
1534
|
+
/** The followed tag name when this environment is tag-tracked */
|
|
1535
|
+
get tag(): string | null;
|
|
1489
1536
|
/** The GraphQL API endpoint URL */
|
|
1490
1537
|
get apiEndpoint(): string;
|
|
1538
|
+
/** Internal auth token used for control-plane and runtime fallback requests */
|
|
1539
|
+
get authToken(): string;
|
|
1540
|
+
/** Base runtime URL derived from the GraphQL endpoint */
|
|
1541
|
+
get runtimeBaseUrl(): string;
|
|
1542
|
+
get sessions(): {
|
|
1543
|
+
list: (options?: {
|
|
1544
|
+
status?: "active" | "closed" | "all";
|
|
1545
|
+
}) => Promise<ConversationSessionInfo[]>;
|
|
1546
|
+
create: (options?: CreateSessionOptions) => Promise<EnvironmentSession>;
|
|
1547
|
+
connect: (sessionId: string, options?: {
|
|
1548
|
+
clientId?: string;
|
|
1549
|
+
}) => Promise<EnvironmentSession>;
|
|
1550
|
+
reopen: (sessionId: string, options?: {
|
|
1551
|
+
clientId?: string;
|
|
1552
|
+
}) => Promise<EnvironmentSession>;
|
|
1553
|
+
close: (sessionId: string, session?: EnvironmentSession | null) => Promise<void>;
|
|
1554
|
+
};
|
|
1555
|
+
get data(): {
|
|
1556
|
+
record: (record: RecordObjectOptions) => Promise<RecordObjectResult>;
|
|
1557
|
+
recordMany: (records: RecordObjectOptions[], options?: RecordObjectsOptions) => Promise<RecordObjectResult[]>;
|
|
1558
|
+
import: (records: RecordObjectOptions[], options?: {
|
|
1559
|
+
batchSize?: number;
|
|
1560
|
+
}) => Promise<RecordImport>;
|
|
1561
|
+
listImports: (status?: RecordImportStatus) => Promise<RecordImport[]>;
|
|
1562
|
+
getImport: (importId: string) => Promise<RecordImport>;
|
|
1563
|
+
getImportSummary: () => Promise<EnvironmentRecordImportSummary>;
|
|
1564
|
+
cancelImport: (importId: string) => Promise<RecordImport>;
|
|
1565
|
+
getAwaitingCount: () => Promise<number>;
|
|
1566
|
+
};
|
|
1567
|
+
get feedback(): {
|
|
1568
|
+
list: () => Promise<EnvironmentFeedbackRecord[]>;
|
|
1569
|
+
};
|
|
1491
1570
|
/**
|
|
1492
|
-
*
|
|
1493
|
-
*
|
|
1494
|
-
*
|
|
1495
|
-
*
|
|
1571
|
+
* Sessionless environments do not own a live transport, so disconnecting the
|
|
1572
|
+
* environment handle itself is a no-op. This keeps the public surface
|
|
1573
|
+
* symmetric with `EnvironmentSession.disconnect()` and lets callers always
|
|
1574
|
+
* clean up safely without tracking whether they currently hold an environment
|
|
1575
|
+
* or a session.
|
|
1496
1576
|
*/
|
|
1497
|
-
|
|
1577
|
+
disconnect(): Promise<void>;
|
|
1578
|
+
listSessions(status?: "active" | "closed" | "all"): Promise<ConversationSessionInfo[]>;
|
|
1579
|
+
createSession(options?: CreateSessionOptions): Promise<EnvironmentSession>;
|
|
1580
|
+
connectSession(sessionId: string, options?: {
|
|
1581
|
+
clientId?: string;
|
|
1582
|
+
}): Promise<EnvironmentSession>;
|
|
1583
|
+
reopenSession(sessionId: string, options?: {
|
|
1584
|
+
clientId?: string;
|
|
1585
|
+
}): Promise<EnvironmentSession>;
|
|
1586
|
+
closeSession(sessionId: string, session?: EnvironmentSession | null): Promise<void>;
|
|
1587
|
+
listFeedback(): Promise<EnvironmentFeedbackRecord[]>;
|
|
1498
1588
|
private getRuntimeBaseUrl;
|
|
1499
1589
|
private controlPlaneRequest;
|
|
1500
|
-
/**
|
|
1501
|
-
* Close the session and disconnect from the sandbox.
|
|
1502
|
-
*
|
|
1503
|
-
* Sends `client.goodbye` over WebSocket first, then issues an HTTP fallback
|
|
1504
|
-
* to the runtime goodbye endpoint if no definitive WS-side runtime notify
|
|
1505
|
-
* acknowledgement was observed.
|
|
1506
|
-
*/
|
|
1507
|
-
disconnect(): Promise<void>;
|
|
1508
|
-
/**
|
|
1509
|
-
* Close only the socket transport without sending `client.goodbye`.
|
|
1510
|
-
*
|
|
1511
|
-
* Use this when the caller intends to immediately reattach to the same
|
|
1512
|
-
* session after an unexpected disconnect.
|
|
1513
|
-
*/
|
|
1514
|
-
disconnectTransport(): void;
|
|
1515
|
-
/** The last known graph container status, updated by checkReadiness() or on heartbeat */
|
|
1516
|
-
graphContainerStatus: {
|
|
1517
|
-
lastKeepAliveAt: number;
|
|
1518
|
-
status: "warming" | "hot" | "unknown";
|
|
1519
|
-
} | null;
|
|
1520
|
-
/**
|
|
1521
|
-
* Check if the graph container is ready and warm.
|
|
1522
|
-
*
|
|
1523
|
-
* Sends a lightweight heartbeat RPC to the Session DO which internally
|
|
1524
|
-
* pings the FalkorDB container. The response includes `graphContainerStatus`,
|
|
1525
|
-
* which is stored locally and emitted as a `readiness` event.
|
|
1526
|
-
*
|
|
1527
|
-
* Use this method to proactively warm the graph container before any
|
|
1528
|
-
* GraphQL query that requires it, or to poll the container's state in
|
|
1529
|
-
* the background.
|
|
1530
|
-
*
|
|
1531
|
-
* @returns The current graph container status object
|
|
1532
|
-
*
|
|
1533
|
-
* @example
|
|
1534
|
-
* ```typescript
|
|
1535
|
-
* const status = await env.checkReadiness();
|
|
1536
|
-
* console.log(status.status); // 'hot' | 'warming' | 'unknown'
|
|
1537
|
-
*
|
|
1538
|
-
* // Or listen for live updates
|
|
1539
|
-
* env.on('readiness', (status) => {
|
|
1540
|
-
* console.log('Graph is now:', status.status);
|
|
1541
|
-
* });
|
|
1542
|
-
* ```
|
|
1543
|
-
*/
|
|
1544
|
-
checkReadiness(): Promise<{
|
|
1545
|
-
lastKeepAliveAt: number;
|
|
1546
|
-
status: "warming" | "hot" | "unknown";
|
|
1547
|
-
}>;
|
|
1548
1590
|
/**
|
|
1549
1591
|
* Convert a class name + real-world ID into a unique graph path.
|
|
1550
1592
|
*
|
|
@@ -1822,26 +1864,107 @@ declare class Environment extends Session {
|
|
|
1822
1864
|
* Cancel a queued/background record import.
|
|
1823
1865
|
*/
|
|
1824
1866
|
cancelRecordImport(importId: string): Promise<RecordImport>;
|
|
1867
|
+
}
|
|
1868
|
+
/**
|
|
1869
|
+
* Live runtime session attached to one opened environment.
|
|
1870
|
+
*
|
|
1871
|
+
* This is the object returned by `environment.sessions.create()` and friends.
|
|
1872
|
+
* It owns websocket state, prompts, job execution, and the synced Automerge
|
|
1873
|
+
* document while delegating environment-level data APIs back to
|
|
1874
|
+
* `session.environment`.
|
|
1875
|
+
*/
|
|
1876
|
+
declare class EnvironmentSession extends Session {
|
|
1877
|
+
readonly environment: Environment;
|
|
1878
|
+
/** The last known graph container status, updated by checkReadiness() or on heartbeat */
|
|
1879
|
+
graphContainerStatus: {
|
|
1880
|
+
lastKeepAliveAt: number;
|
|
1881
|
+
status: "warming" | "hot" | "unknown";
|
|
1882
|
+
} | null;
|
|
1883
|
+
constructor(client: WSClient, environment: Environment, clientId: string);
|
|
1884
|
+
get environmentId(): string;
|
|
1885
|
+
get sandboxId(): string;
|
|
1886
|
+
get ontologyId(): string;
|
|
1887
|
+
get subjectId(): string;
|
|
1888
|
+
get envName(): string;
|
|
1889
|
+
get versionId(): string;
|
|
1890
|
+
get granularId(): string;
|
|
1891
|
+
get permissionProfileId(): string;
|
|
1892
|
+
get apiEndpoint(): string;
|
|
1893
|
+
get data(): {
|
|
1894
|
+
record: (record: RecordObjectOptions) => Promise<RecordObjectResult>;
|
|
1895
|
+
recordMany: (records: RecordObjectOptions[], options?: RecordObjectsOptions) => Promise<RecordObjectResult[]>;
|
|
1896
|
+
import: (records: RecordObjectOptions[], options?: {
|
|
1897
|
+
batchSize?: number;
|
|
1898
|
+
} | undefined) => Promise<RecordImport>;
|
|
1899
|
+
listImports: (status?: RecordImportStatus) => Promise<RecordImport[]>;
|
|
1900
|
+
getImport: (importId: string) => Promise<RecordImport>;
|
|
1901
|
+
getImportSummary: () => Promise<EnvironmentRecordImportSummary>;
|
|
1902
|
+
cancelImport: (importId: string) => Promise<RecordImport>;
|
|
1903
|
+
getAwaitingCount: () => Promise<number>;
|
|
1904
|
+
};
|
|
1905
|
+
get feedback(): {
|
|
1906
|
+
list: () => Promise<EnvironmentFeedbackRecord[]>;
|
|
1907
|
+
};
|
|
1825
1908
|
/**
|
|
1826
|
-
*
|
|
1909
|
+
* Return a plain JS snapshot of the synced session heap.
|
|
1827
1910
|
*/
|
|
1828
|
-
|
|
1911
|
+
getHeap(): SessionHeapSnapshot;
|
|
1912
|
+
graphql<T = any>(query: string, variables?: Record<string, any>): Promise<GraphQLResult<T>>;
|
|
1913
|
+
defineRelationship(options: DefineRelationshipOptions): Promise<RelationshipInfo>;
|
|
1914
|
+
getRelationships(modelPath: string): Promise<RelationshipInfo[]>;
|
|
1915
|
+
attach(modelPath: string, submodelPath: string, targetPath: string): Promise<void>;
|
|
1916
|
+
detach(modelPath: string, submodelPath: string, targetPath?: string): Promise<void>;
|
|
1917
|
+
listRelated(modelPath: string, submodelPath: string): Promise<ModelRef[]>;
|
|
1918
|
+
applyManifest(manifest: ManifestContent): Promise<{
|
|
1919
|
+
applied: number;
|
|
1920
|
+
errors: string[];
|
|
1921
|
+
}>;
|
|
1922
|
+
recordObject(options: RecordObjectOptions): Promise<RecordObjectResult>;
|
|
1923
|
+
recordObjects(records: RecordObjectOptions[], options?: RecordObjectsOptions): Promise<RecordObjectResult[]>;
|
|
1924
|
+
enqueueRecordImport(records: RecordObjectOptions[], options?: {
|
|
1925
|
+
batchSize?: number;
|
|
1926
|
+
}): Promise<RecordImport>;
|
|
1927
|
+
listRecordImports(status?: RecordImportStatus): Promise<RecordImport[]>;
|
|
1928
|
+
getRecordImportSummary(): Promise<EnvironmentRecordImportSummary>;
|
|
1929
|
+
getAwaitingRecordCount(): Promise<number>;
|
|
1930
|
+
getRecordImport(importId: string): Promise<RecordImport>;
|
|
1931
|
+
cancelRecordImport(importId: string): Promise<RecordImport>;
|
|
1932
|
+
listFeedback(): Promise<EnvironmentFeedbackRecord[]>;
|
|
1829
1933
|
/**
|
|
1830
|
-
*
|
|
1934
|
+
* Close the session and disconnect from the sandbox.
|
|
1935
|
+
*
|
|
1936
|
+
* Sends `client.goodbye` over WebSocket first, then issues an HTTP fallback
|
|
1937
|
+
* to the runtime goodbye endpoint if no definitive WS-side runtime notify
|
|
1938
|
+
* acknowledgement was observed.
|
|
1831
1939
|
*/
|
|
1832
|
-
|
|
1940
|
+
disconnect(): Promise<void>;
|
|
1833
1941
|
/**
|
|
1834
|
-
*
|
|
1942
|
+
* Close only the socket transport without sending `client.goodbye`.
|
|
1835
1943
|
*/
|
|
1836
|
-
|
|
1944
|
+
disconnectTransport(): void;
|
|
1837
1945
|
/**
|
|
1838
|
-
*
|
|
1946
|
+
* Backwards-compatible alias for `disconnect()`.
|
|
1839
1947
|
*/
|
|
1840
|
-
|
|
1948
|
+
close(): Promise<void>;
|
|
1841
1949
|
/**
|
|
1842
|
-
*
|
|
1950
|
+
* Check if the graph container is ready and warm.
|
|
1843
1951
|
*/
|
|
1844
|
-
|
|
1952
|
+
checkReadiness(): Promise<{
|
|
1953
|
+
lastKeepAliveAt: number;
|
|
1954
|
+
status: "warming" | "hot" | "unknown";
|
|
1955
|
+
}>;
|
|
1956
|
+
}
|
|
1957
|
+
declare class OntologyHandle {
|
|
1958
|
+
private granular;
|
|
1959
|
+
private ontologyNameOrId;
|
|
1960
|
+
constructor(granular: Granular, ontologyNameOrId: string);
|
|
1961
|
+
get effects(): {
|
|
1962
|
+
register: (effect: ToolWithHandler) => Promise<void>;
|
|
1963
|
+
registerMany: (effects: ToolWithHandler[]) => Promise<void>;
|
|
1964
|
+
unregister: (name: string) => Promise<void>;
|
|
1965
|
+
clear: () => Promise<void>;
|
|
1966
|
+
disconnect: () => Promise<void>;
|
|
1967
|
+
};
|
|
1845
1968
|
}
|
|
1846
1969
|
declare class Granular {
|
|
1847
1970
|
private apiKey;
|
|
@@ -1863,6 +1986,10 @@ declare class Granular {
|
|
|
1863
1986
|
* @param options - Client configuration
|
|
1864
1987
|
*/
|
|
1865
1988
|
constructor(options: GranularOptions);
|
|
1989
|
+
/**
|
|
1990
|
+
* Return an ontology-scoped handle for effects and other ontology-level APIs.
|
|
1991
|
+
*/
|
|
1992
|
+
ontology(ontologyNameOrId: string): OntologyHandle;
|
|
1866
1993
|
/**
|
|
1867
1994
|
* Records/upserts a user and prepares them for sandbox connections
|
|
1868
1995
|
*
|
|
@@ -1879,43 +2006,46 @@ declare class Granular {
|
|
|
1879
2006
|
* ```
|
|
1880
2007
|
*/
|
|
1881
2008
|
recordUser(options: RecordUserOptions): Promise<User>;
|
|
2009
|
+
/**
|
|
2010
|
+
* Alias for `recordUser()` with user-facing naming that matches upsert semantics.
|
|
2011
|
+
*/
|
|
2012
|
+
upsertUser(options: RecordUserOptions): Promise<User>;
|
|
1882
2013
|
private resolveConnectUser;
|
|
1883
2014
|
/**
|
|
1884
|
-
*
|
|
1885
|
-
*
|
|
1886
|
-
* Effects are registered at the sandbox level via `granular.registerEffect()`
|
|
1887
|
-
* or `granular.registerEffects()`. Sessions pick up live availability from
|
|
1888
|
-
* the sandbox registry automatically.
|
|
1889
|
-
*
|
|
1890
|
-
* @param options - Connection options
|
|
1891
|
-
* @returns An active environment session
|
|
2015
|
+
* Open or resolve an ontology environment for one user without opening a session.
|
|
1892
2016
|
*
|
|
1893
2017
|
* @example
|
|
1894
2018
|
* ```typescript
|
|
1895
|
-
* const environment = await granular.
|
|
2019
|
+
* const environment = await granular.openEnvironment({
|
|
1896
2020
|
* ontology: 'my-ontology',
|
|
1897
|
-
*
|
|
2021
|
+
* tag: 'dev',
|
|
1898
2022
|
* userId: 'user_123',
|
|
1899
2023
|
* permissions: ['agent'],
|
|
1900
2024
|
* });
|
|
1901
2025
|
*
|
|
1902
|
-
* await
|
|
1903
|
-
*
|
|
1904
|
-
*
|
|
1905
|
-
*
|
|
1906
|
-
* handler: async () => 'Hello!',
|
|
2026
|
+
* await environment.data.record({
|
|
2027
|
+
* className: 'customer',
|
|
2028
|
+
* id: 'acme',
|
|
2029
|
+
* fields: { name: 'Acme' },
|
|
1907
2030
|
* });
|
|
1908
2031
|
*
|
|
1909
|
-
*
|
|
1910
|
-
* const job = await
|
|
1911
|
-
*
|
|
1912
|
-
* return await tools.greet({});
|
|
1913
|
-
* `);
|
|
1914
|
-
*
|
|
1915
|
-
* console.log(await job.result); // 'Hello!'
|
|
2032
|
+
* const session = await environment.sessions.create();
|
|
2033
|
+
* const job = await session.submitJob(`return "hello";`);
|
|
2034
|
+
* console.log(await job.result);
|
|
1916
2035
|
* ```
|
|
1917
2036
|
*/
|
|
2037
|
+
openEnvironment(options: OpenEnvironmentOptions): Promise<Environment>;
|
|
2038
|
+
/**
|
|
2039
|
+
* Deprecated compatibility alias for `openEnvironment()`.
|
|
2040
|
+
*
|
|
2041
|
+
* `connect()` no longer opens a runtime session automatically.
|
|
2042
|
+
*/
|
|
1918
2043
|
connect(options: ConnectOptions): Promise<Environment>;
|
|
2044
|
+
private resolveRequestedTag;
|
|
2045
|
+
private buildManagedEnvironmentName;
|
|
2046
|
+
private matchesTagTrackedEnvironment;
|
|
2047
|
+
private sortEnvironmentsByRecency;
|
|
2048
|
+
private resolveOpenEnvironmentData;
|
|
1919
2049
|
/**
|
|
1920
2050
|
* List active (open) sessions for an environment — each session is one agent conversation thread.
|
|
1921
2051
|
*/
|
|
@@ -1938,27 +2068,28 @@ declare class Granular {
|
|
|
1938
2068
|
createSession(options: {
|
|
1939
2069
|
environmentId: string;
|
|
1940
2070
|
clientId?: string;
|
|
1941
|
-
initialHeap?:
|
|
1942
|
-
}): Promise<
|
|
2071
|
+
initialHeap?: CreateSessionOptions["initialHeap"];
|
|
2072
|
+
}): Promise<EnvironmentSession>;
|
|
1943
2073
|
/**
|
|
1944
2074
|
* Connect to an existing open session (same conversation thread) using a freshly minted WebSocket token.
|
|
1945
2075
|
*/
|
|
1946
2076
|
connectSession(options: {
|
|
1947
2077
|
sessionId: string;
|
|
1948
2078
|
clientId?: string;
|
|
1949
|
-
}): Promise<
|
|
2079
|
+
}): Promise<EnvironmentSession>;
|
|
1950
2080
|
/**
|
|
1951
2081
|
* Mark a session closed in the control plane. If `environment` is the connected handle for that
|
|
1952
2082
|
* `sessionId`, disconnects the WebSocket so the runtime tears down cleanly.
|
|
1953
2083
|
*/
|
|
1954
|
-
closeSession(sessionId: string, environment?:
|
|
2084
|
+
closeSession(sessionId: string, environment?: EnvironmentSession | null): Promise<void>;
|
|
1955
2085
|
/**
|
|
1956
2086
|
* Re-open a closed session in the index and connect to its existing runtime document.
|
|
1957
2087
|
*/
|
|
1958
2088
|
reopenSession(sessionId: string, options?: {
|
|
1959
2089
|
clientId?: string;
|
|
1960
|
-
}): Promise<
|
|
1961
|
-
private
|
|
2090
|
+
}): Promise<EnvironmentSession>;
|
|
2091
|
+
private bindEnvironmentHandle;
|
|
2092
|
+
private bindWebSocketEnvironmentSession;
|
|
1962
2093
|
private activateEnvironment;
|
|
1963
2094
|
private getSandboxEffectMap;
|
|
1964
2095
|
private serializeEffect;
|
|
@@ -2102,4 +2233,4 @@ declare class Granular {
|
|
|
2102
2233
|
private request;
|
|
2103
2234
|
}
|
|
2104
2235
|
|
|
2105
|
-
export { type
|
|
2236
|
+
export { type SemanticVersionDiff as $, type AccessTokenProvider as A, type BuildPolicy as B, type ConnectOptions as C, type DomainState as D, type EndpointMode as E, type VersionTag as F, Granular as G, type EnvironmentData as H, type InstanceToolHandler as I, type CreateEnvironmentData as J, type EnvironmentListResponse as K, type Manifest as L, type ManifestEffectMetamodelSpec as M, type ManifestListResponse as N, OntologyHandle as O, type Prompt as P, type BuildStatus as Q, type ResolvedEffectBehaviors as R, type SessionHeapEntry as S, type ToolWithHandler as T, type User as U, type VersionTracking as V, WSClient as W, type Build as X, type Version as Y, type BuildListResponse as Z, type SemanticVersionDiffEntry as _, type EffectHandlerContext as a, type ManifestApprovalRequiredSpec as a$, type ResolvedEffectPostCondition as a0, type ResolvedEffectDryRun as a1, type ResolvedEffectReverse as a2, type ResolvedEffectApprovalRequired as a3, type EffectInvocationMode as a4, type EffectInvocationMetadata as a5, type EffectSchema as a6, type EffectWithHandler as a7, type PublishEffectsResult as a8, type ToolInfo as a9, type RPCRequestFromServer as aA, type ToolInvokeParams as aB, type ToolResultParams as aC, type ModelRef as aD, type RelationshipInfo as aE, type DefineRelationshipOptions as aF, type RecordObjectOptions as aG, type RecordObjectResult as aH, type RecordObjectsChunkInfo as aI, type RecordObjectsOptions as aJ, type RecordImportStatus as aK, type RecordImportItemStatus as aL, type RecordImportStats as aM, type RecordImportItem as aN, type RecordImport as aO, type EnvironmentRecordImportSummary as aP, type ManifestPropertySpec as aQ, type ManifestValidationOperator as aR, type ManifestEnumRuleSpec as aS, type ManifestFilterBySpec as aT, type ManifestValidationRuleSpec as aU, type ManifestStateMachineStateSpec as aV, type ManifestStateMachineTransitionSpec as aW, type ManifestStateMachineSpec as aX, type ManifestPostConditionSpec as aY, type ManifestDryRunSpec as aZ, type ManifestReverseSpec as a_, type EffectInfo as aa, type ToolsChangedEvent as ab, type EffectsChangedEvent as ac, type EffectHandler as ad, type InstanceEffectHandler as ae, type JobStatus as af, type JobFeedbackSentiment as ag, type JobFeedbackToolCall as ah, type JobFeedbackMetadata as ai, type JobFeedbackInput as aj, type JobFeedbackRecord as ak, type EnvironmentFeedbackRecord as al, type JobSubmitResult as am, type Job as an, type ConversationMessageShowRefs as ao, type ConversationMessageInput as ap, type ConversationAppendResult as aq, type SessionHeapFieldType as ar, type SessionHeapFieldValue as as, type SessionHeapVariable as at, type WSDisconnectInfo as au, type WSReconnectErrorInfo as av, type WSClientOptions as aw, type RPCRequest as ax, type RPCResponse as ay, type SyncMessage as az, type SessionHeapList as b, type ManifestRelationshipDef as b0, type ManifestEffectSchema as b1, type ManifestEffectDeclaration as b2, type ManifestEventTypeDef as b3, type ManifestEventStreamDef as b4, type ManifestOperation as b5, type ManifestImport as b6, type ManifestVolume as b7, type ManifestContent as b8, type GraphQLResult as b9, type APIError as ba, type DeleteResponse as bb, type StreamEvent as bc, type StreamSubscription as bd, type StreamStats as be, type SessionHeapSnapshot as c, type SessionTranscriptEntry as d, Environment as e, EnvironmentSession as f, Session as g, type ToolSchema as h, type PublishToolsResult as i, type ToolHandler as j, type GranularOptions as k, type GranularAuth as l, type RecordUserOptions as m, type Subject as n, type OpenEnvironmentOptions as o, type CreateSessionOptions as p, type ConversationSessionInfo as q, type Sandbox as r, type CreateSandboxData as s, type SandboxListResponse as t, type PermissionRules as u, type PermissionProfile as v, type CreatePermissionProfileData as w, type PermissionProfileListResponse as x, type Assignment as y, type AssignmentListResponse as z };
|