@granular-software/sdk 0.4.49 → 0.4.51
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 +53 -0
- package/dist/agent-evals.d.mts +2 -2
- package/dist/agent-evals.d.ts +2 -2
- package/dist/agent-evals.js +1551 -277
- package/dist/agent-evals.js.map +1 -1
- package/dist/agent-evals.mjs +1551 -277
- package/dist/agent-evals.mjs.map +1 -1
- package/dist/agent-harness.d.mts +19 -2
- package/dist/agent-harness.d.ts +19 -2
- package/dist/agent-harness.js +81 -26
- package/dist/agent-harness.js.map +1 -1
- package/dist/agent-harness.mjs +80 -27
- package/dist/agent-harness.mjs.map +1 -1
- package/dist/cli/index.js +1492 -266
- package/dist/{client-B-MPVvDr.d.mts → client-NSH-tpNU.d.ts} +88 -11
- package/dist/{client-zihxkDDs.d.ts → client-djorlOpn.d.mts} +88 -11
- package/dist/index.d.mts +104 -5
- package/dist/index.d.ts +104 -5
- package/dist/index.js +1633 -268
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1630 -269
- package/dist/index.mjs.map +1 -1
- package/dist/{spend-CStuOBXb.d.mts → spend-BA-jZwZ0.d.mts} +505 -12
- package/dist/{spend-CStuOBXb.d.ts → spend-BA-jZwZ0.d.ts} +505 -12
- package/dist/spend.d.mts +1 -1
- package/dist/spend.d.ts +1 -1
- package/dist/spend.js +6 -1
- package/dist/spend.js.map +1 -1
- package/dist/spend.mjs +6 -1
- package/dist/spend.mjs.map +1 -1
- package/package.json +2 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { bL as WSClientOptions, a1 as GranularQuotaProgress, T as ToolWithHandler, f as PublishToolsResult, aN as Job, g as ToolHandler, I as InstanceToolHandler, aX as ConversationMessageInput, aY as ConversationAppendResult, aA as EffectInfo, P as Prompt, az as ToolInfo, aC as EffectsChangedEvent, aB as ToolsChangedEvent, D as DomainState, y as GranularOptions, cg as EnvironmentImporter, B as RecordUserOptions, U as User, H as OpenEnvironmentOptions, ae as EnvironmentData, ab as BuildPolicy, ce as EnvironmentSetupSummary, V as ConversationSessionListOptions, L as ConversationSessionInfo, K as CreateSessionOptions, bV as RecordObjectOptions, c0 as RecordObjectResult, c2 as RecordObjectsOptions, c9 as RecordImport, c5 as RecordImportStatus, ca as EnvironmentRecordImportSummary, aL as EnvironmentFeedbackRecord, c as SessionHeapSnapshot, bz as SessionDocumentResult, bA as SessionCollectionListOptions, bC as SessionCollectionListResult, aZ as SessionConversationMessage, a_ as SessionTimelineEvent, bB as SessionJobListOptions, bs as SessionJobRecord, b7 as SessionArtifactListOptions, b6 as SessionArtifactRecord, b8 as SessionArtifactValidationResult, ba as SessionArtifactExecutionOptions, b9 as SessionArtifactExecutionResult, bb as SessionArtifactApprovalOptions, bl as RecordManualActionInput, bn as ManualActionRecordResult, bo as ManualActionListOptions, bm as ManualActionOccurrence, bq as ManualActionSuggestionOptions, bp as ManualActionSuggestion, be as ArtifactApprovalTaskListOptions, bd as ArtifactApprovalTask, bf as ArtifactApprovalDecisionInput, bg as ArtifactApprovalDecisionResult, b2 as SessionFileRecord, br as SessionFileUploadOptions, S as SessionHeapEntry, b as SessionHeapList, bv as SessionHeapVariable, d as SessionTranscriptEntry, cK as GraphQLResult, bx as RecordSearchOptions, bw as RecordSearchResult, by as RecordMentionInput, bU as DefineRelationshipOptions, bT as RelationshipInfo, bS as ModelRef, cJ as ManifestContent, bZ as EnvironmentStateUpdateInput, bX as EnvironmentStateTarget, b$ as EnvironmentStateProxy, c4 as RecordImportOptions, bH as UserEnvironmentStateOptions, bG as UserEnvironmentState, bI as MarkUserEnvironmentReadOptions, J as ConnectOptions, cc as RunEnvironmentImporterOptions, l as OpenAIUsageSpendEvent, G as GranularSpendContext, o as RecordOpenAIUsageSpendResult, a4 as SandboxListResponse, a2 as Sandbox, a3 as CreateSandboxData, cM as DeleteResponse, a6 as PermissionProfile, a7 as CreatePermissionProfileData, af as CreateEnvironmentData, cN as StreamEvent, cO as StreamSubscription, cP as StreamStats, F as Subject, aa as AssignmentListResponse } from './spend-BA-jZwZ0.js';
|
|
2
2
|
import * as Automerge from '@automerge/automerge';
|
|
3
3
|
import { Doc } from '@automerge/automerge/slim';
|
|
4
4
|
|
|
@@ -18,9 +18,14 @@ declare class WSClient {
|
|
|
18
18
|
private tokenRefreshTimer;
|
|
19
19
|
private isExplicitlyDisconnected;
|
|
20
20
|
private reconnectAttempts;
|
|
21
|
+
private connectPromise;
|
|
22
|
+
private connectionEpoch;
|
|
23
|
+
private cancelConnectAttempt;
|
|
21
24
|
private options;
|
|
22
25
|
constructor(options: WSClientOptions);
|
|
23
26
|
get currentSessionId(): string;
|
|
27
|
+
seedDocumentSnapshot(document: Record<string, unknown> | Uint8Array | null | undefined): void;
|
|
28
|
+
saveDocumentSnapshot(): Uint8Array;
|
|
24
29
|
private clearTokenRefreshTimer;
|
|
25
30
|
private decodeBase64Url;
|
|
26
31
|
private getTokenExpiryMs;
|
|
@@ -31,9 +36,14 @@ declare class WSClient {
|
|
|
31
36
|
* Connect to the WebSocket server
|
|
32
37
|
* @returns {Promise<void>} Resolves when connection is open
|
|
33
38
|
*/
|
|
34
|
-
connect(
|
|
39
|
+
connect(options?: {
|
|
40
|
+
signal?: AbortSignal;
|
|
41
|
+
}): Promise<void>;
|
|
42
|
+
private connectAttempt;
|
|
35
43
|
private normalizeReason;
|
|
36
44
|
private rejectPending;
|
|
45
|
+
private emitReconnectErrorMessage;
|
|
46
|
+
private scheduleReconnectAttempt;
|
|
37
47
|
private buildDisconnectError;
|
|
38
48
|
private handleDisconnect;
|
|
39
49
|
private handleMessage;
|
|
@@ -73,7 +83,9 @@ declare class WSClient {
|
|
|
73
83
|
/**
|
|
74
84
|
* Disconnect the WebSocket and clear state
|
|
75
85
|
*/
|
|
76
|
-
disconnect(
|
|
86
|
+
disconnect(options?: {
|
|
87
|
+
reason?: string;
|
|
88
|
+
}): void;
|
|
77
89
|
}
|
|
78
90
|
|
|
79
91
|
declare class Session {
|
|
@@ -308,9 +320,7 @@ declare class Environment {
|
|
|
308
320
|
get runtimeBaseUrl(): string;
|
|
309
321
|
syncEnvironmentData(envData: EnvironmentData): void;
|
|
310
322
|
get sessions(): {
|
|
311
|
-
list: (options?:
|
|
312
|
-
status?: "active" | "closed" | "all";
|
|
313
|
-
}) => Promise<ConversationSessionInfo[]>;
|
|
323
|
+
list: (options?: Omit<ConversationSessionListOptions, "environmentId" | "sandboxId" | "subjectId">) => Promise<ConversationSessionInfo[]>;
|
|
314
324
|
create: (options?: CreateSessionOptions) => Promise<EnvironmentSession>;
|
|
315
325
|
connect: (sessionId: string, options?: {
|
|
316
326
|
clientId?: string;
|
|
@@ -338,9 +348,33 @@ declare class Environment {
|
|
|
338
348
|
cancelImport: (importId: string) => Promise<RecordImport>;
|
|
339
349
|
getAwaitingCount: () => Promise<number>;
|
|
340
350
|
};
|
|
351
|
+
/**
|
|
352
|
+
* Mirror product-owned workflow state into Granular without making Granular
|
|
353
|
+
* own the customer application's state machine.
|
|
354
|
+
*/
|
|
355
|
+
recordState(input: EnvironmentStateUpdateInput): Promise<RecordObjectResult>;
|
|
356
|
+
/**
|
|
357
|
+
* Mirror product-owned workflow state into Granular without making Granular
|
|
358
|
+
* own the customer application's state machine.
|
|
359
|
+
*
|
|
360
|
+
* Example:
|
|
361
|
+
* `await env.recordState({ className: "spend_request", id, machine: "lifecycle", state: "policy_review", source: "customer_backend" })`
|
|
362
|
+
*/
|
|
363
|
+
state(target: EnvironmentStateTarget): EnvironmentStateProxy;
|
|
341
364
|
get feedback(): {
|
|
342
365
|
list: () => Promise<EnvironmentFeedbackRecord[]>;
|
|
343
366
|
};
|
|
367
|
+
get manualActions(): {
|
|
368
|
+
record: (input: RecordManualActionInput) => Promise<ManualActionRecordResult>;
|
|
369
|
+
list: (options?: ManualActionListOptions) => Promise<SessionCollectionListResult<ManualActionOccurrence>>;
|
|
370
|
+
suggest: (options?: ManualActionSuggestionOptions) => Promise<{
|
|
371
|
+
items: ManualActionSuggestion[];
|
|
372
|
+
}>;
|
|
373
|
+
};
|
|
374
|
+
get artifactApprovals(): {
|
|
375
|
+
list: (options?: ArtifactApprovalTaskListOptions) => Promise<SessionCollectionListResult<ArtifactApprovalTask>>;
|
|
376
|
+
decide: (approvalTaskId: string, input: ArtifactApprovalDecisionInput) => Promise<ArtifactApprovalDecisionResult>;
|
|
377
|
+
};
|
|
344
378
|
/**
|
|
345
379
|
* Sessionless environments do not own a live transport, so disconnecting the
|
|
346
380
|
* environment handle itself is a no-op. This keeps the public surface
|
|
@@ -349,7 +383,8 @@ declare class Environment {
|
|
|
349
383
|
* or a session.
|
|
350
384
|
*/
|
|
351
385
|
disconnect(): Promise<void>;
|
|
352
|
-
listSessions(status?: "
|
|
386
|
+
listSessions(status?: ConversationSessionListOptions["status"]): Promise<ConversationSessionInfo[]>;
|
|
387
|
+
listSessions(options?: Omit<ConversationSessionListOptions, "environmentId" | "sandboxId" | "subjectId">): Promise<ConversationSessionInfo[]>;
|
|
353
388
|
getUserEnvironmentState(options?: UserEnvironmentStateOptions): Promise<UserEnvironmentState>;
|
|
354
389
|
markUserEnvironmentSessionsRead(options: MarkUserEnvironmentReadOptions): Promise<UserEnvironmentState["readAtBySessionId"]>;
|
|
355
390
|
createSession(options?: CreateSessionOptions): Promise<EnvironmentSession>;
|
|
@@ -363,6 +398,13 @@ declare class Environment {
|
|
|
363
398
|
}): Promise<EnvironmentSession>;
|
|
364
399
|
closeSession(sessionId: string, session?: EnvironmentSession | null): Promise<void>;
|
|
365
400
|
listFeedback(): Promise<EnvironmentFeedbackRecord[]>;
|
|
401
|
+
recordManualAction(input: RecordManualActionInput): Promise<ManualActionRecordResult>;
|
|
402
|
+
listManualActions(options?: ManualActionListOptions): Promise<SessionCollectionListResult<ManualActionOccurrence>>;
|
|
403
|
+
suggestManualActions(options?: ManualActionSuggestionOptions): Promise<{
|
|
404
|
+
items: ManualActionSuggestion[];
|
|
405
|
+
}>;
|
|
406
|
+
listArtifactApprovals(options?: ArtifactApprovalTaskListOptions): Promise<SessionCollectionListResult<ArtifactApprovalTask>>;
|
|
407
|
+
decideArtifactApproval(approvalTaskId: string, input: ArtifactApprovalDecisionInput): Promise<ArtifactApprovalDecisionResult>;
|
|
366
408
|
private getRuntimeBaseUrl;
|
|
367
409
|
private controlPlaneRequest;
|
|
368
410
|
private static normalizeGraphPathSegment;
|
|
@@ -707,6 +749,35 @@ declare class EnvironmentSession extends Session {
|
|
|
707
749
|
get jobs(): {
|
|
708
750
|
list: (options?: SessionJobListOptions) => Promise<SessionCollectionListResult<SessionJobRecord>>;
|
|
709
751
|
get: (jobId: string) => Promise<SessionJobRecord>;
|
|
752
|
+
latest: (options?: Pick<SessionJobListOptions, "status">) => Promise<SessionJobRecord | null>;
|
|
753
|
+
};
|
|
754
|
+
get artifacts(): {
|
|
755
|
+
list: (options?: SessionArtifactListOptions) => Promise<SessionCollectionListResult<SessionArtifactRecord>>;
|
|
756
|
+
listForLatestJob: (options?: Omit<SessionArtifactListOptions, "jobId" | "latestJob">) => Promise<SessionCollectionListResult<SessionArtifactRecord>>;
|
|
757
|
+
get: (artifactId: string) => Promise<SessionArtifactRecord>;
|
|
758
|
+
create: (artifact: Partial<SessionArtifactRecord> & {
|
|
759
|
+
label: string;
|
|
760
|
+
}) => Promise<SessionArtifactRecord>;
|
|
761
|
+
updateInputs: (artifactId: string, patch: {
|
|
762
|
+
inputValues?: Record<string, unknown>;
|
|
763
|
+
relationships?: Record<string, string | string[] | null>;
|
|
764
|
+
expectedUpdatedAt?: number;
|
|
765
|
+
}) => Promise<SessionArtifactRecord>;
|
|
766
|
+
validate: (artifactId: string) => Promise<SessionArtifactValidationResult>;
|
|
767
|
+
execute: (artifactId: string, options: SessionArtifactExecutionOptions) => Promise<SessionArtifactExecutionResult>;
|
|
768
|
+
approve: (artifactId: string, options: SessionArtifactApprovalOptions) => Promise<SessionArtifactExecutionResult>;
|
|
769
|
+
cancel: (artifactId: string) => Promise<SessionArtifactRecord>;
|
|
770
|
+
};
|
|
771
|
+
get manualActions(): {
|
|
772
|
+
record: (input: RecordManualActionInput) => Promise<ManualActionRecordResult>;
|
|
773
|
+
list: (options?: ManualActionListOptions) => Promise<SessionCollectionListResult<ManualActionOccurrence>>;
|
|
774
|
+
suggest: (options?: ManualActionSuggestionOptions) => Promise<{
|
|
775
|
+
items: ManualActionSuggestion[];
|
|
776
|
+
}>;
|
|
777
|
+
};
|
|
778
|
+
get artifactApprovals(): {
|
|
779
|
+
list: (options?: ArtifactApprovalTaskListOptions) => Promise<SessionCollectionListResult<ArtifactApprovalTask>>;
|
|
780
|
+
decide: (approvalTaskId: string, input: ArtifactApprovalDecisionInput) => Promise<ArtifactApprovalDecisionResult>;
|
|
710
781
|
};
|
|
711
782
|
get files(): {
|
|
712
783
|
list: (options?: SessionCollectionListOptions & {
|
|
@@ -755,6 +826,8 @@ declare class EnvironmentSession extends Session {
|
|
|
755
826
|
errors: string[];
|
|
756
827
|
}>;
|
|
757
828
|
recordObject(options: RecordObjectOptions): Promise<RecordObjectResult>;
|
|
829
|
+
recordState(input: EnvironmentStateUpdateInput): Promise<RecordObjectResult>;
|
|
830
|
+
state(target: EnvironmentStateTarget): EnvironmentStateProxy;
|
|
758
831
|
recordObjects(records: RecordObjectOptions[], options?: RecordObjectsOptions): Promise<RecordObjectResult[]>;
|
|
759
832
|
enqueueRecordImport(records: RecordObjectOptions[], options?: RecordImportOptions): Promise<RecordImport>;
|
|
760
833
|
listRecordImports(status?: RecordImportStatus): Promise<RecordImport[]>;
|
|
@@ -903,15 +976,19 @@ declare class Granular {
|
|
|
903
976
|
private sortEnvironmentsByRecency;
|
|
904
977
|
private resolveOpenEnvironmentData;
|
|
905
978
|
/**
|
|
906
|
-
* List
|
|
979
|
+
* List indexed sessions using ownership filters and bounded pagination.
|
|
980
|
+
*/
|
|
981
|
+
listSessions(options: ConversationSessionListOptions): Promise<ConversationSessionInfo[]>;
|
|
982
|
+
/**
|
|
983
|
+
* List active (open) sessions for an environment.
|
|
907
984
|
*/
|
|
908
|
-
listOpenSessions(filters: {
|
|
985
|
+
listOpenSessions(filters: Omit<ConversationSessionListOptions, "status"> & {
|
|
909
986
|
environmentId: string;
|
|
910
987
|
}): Promise<ConversationSessionInfo[]>;
|
|
911
988
|
/**
|
|
912
989
|
* List closed sessions for an environment (conversations that have disconnected).
|
|
913
990
|
*/
|
|
914
|
-
listClosedSessions(filters: {
|
|
991
|
+
listClosedSessions(filters: Omit<ConversationSessionListOptions, "status"> & {
|
|
915
992
|
environmentId: string;
|
|
916
993
|
}): Promise<ConversationSessionInfo[]>;
|
|
917
994
|
getUserEnvironmentState(options: UserEnvironmentStateOptions & {
|
|
@@ -920,7 +997,6 @@ declare class Granular {
|
|
|
920
997
|
markUserEnvironmentSessionsRead(options: MarkUserEnvironmentReadOptions & {
|
|
921
998
|
environmentId: string;
|
|
922
999
|
}): Promise<UserEnvironmentState["readAtBySessionId"]>;
|
|
923
|
-
private listSessionsForEnvironment;
|
|
924
1000
|
private normalizeConversationSession;
|
|
925
1001
|
private normalizeUserEnvironmentState;
|
|
926
1002
|
private static coerceIsoDate;
|
|
@@ -931,6 +1007,7 @@ declare class Granular {
|
|
|
931
1007
|
createSession(options: {
|
|
932
1008
|
environmentId: string;
|
|
933
1009
|
clientId?: string;
|
|
1010
|
+
sessionScope?: CreateSessionOptions["sessionScope"];
|
|
934
1011
|
initialHeap?: CreateSessionOptions["initialHeap"];
|
|
935
1012
|
}): Promise<EnvironmentSession>;
|
|
936
1013
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { bL as WSClientOptions, a1 as GranularQuotaProgress, T as ToolWithHandler, f as PublishToolsResult, aN as Job, g as ToolHandler, I as InstanceToolHandler, aX as ConversationMessageInput, aY as ConversationAppendResult, aA as EffectInfo, P as Prompt, az as ToolInfo, aC as EffectsChangedEvent, aB as ToolsChangedEvent, D as DomainState, y as GranularOptions, cg as EnvironmentImporter, B as RecordUserOptions, U as User, H as OpenEnvironmentOptions, ae as EnvironmentData, ab as BuildPolicy, ce as EnvironmentSetupSummary, V as ConversationSessionListOptions, L as ConversationSessionInfo, K as CreateSessionOptions, bV as RecordObjectOptions, c0 as RecordObjectResult, c2 as RecordObjectsOptions, c9 as RecordImport, c5 as RecordImportStatus, ca as EnvironmentRecordImportSummary, aL as EnvironmentFeedbackRecord, c as SessionHeapSnapshot, bz as SessionDocumentResult, bA as SessionCollectionListOptions, bC as SessionCollectionListResult, aZ as SessionConversationMessage, a_ as SessionTimelineEvent, bB as SessionJobListOptions, bs as SessionJobRecord, b7 as SessionArtifactListOptions, b6 as SessionArtifactRecord, b8 as SessionArtifactValidationResult, ba as SessionArtifactExecutionOptions, b9 as SessionArtifactExecutionResult, bb as SessionArtifactApprovalOptions, bl as RecordManualActionInput, bn as ManualActionRecordResult, bo as ManualActionListOptions, bm as ManualActionOccurrence, bq as ManualActionSuggestionOptions, bp as ManualActionSuggestion, be as ArtifactApprovalTaskListOptions, bd as ArtifactApprovalTask, bf as ArtifactApprovalDecisionInput, bg as ArtifactApprovalDecisionResult, b2 as SessionFileRecord, br as SessionFileUploadOptions, S as SessionHeapEntry, b as SessionHeapList, bv as SessionHeapVariable, d as SessionTranscriptEntry, cK as GraphQLResult, bx as RecordSearchOptions, bw as RecordSearchResult, by as RecordMentionInput, bU as DefineRelationshipOptions, bT as RelationshipInfo, bS as ModelRef, cJ as ManifestContent, bZ as EnvironmentStateUpdateInput, bX as EnvironmentStateTarget, b$ as EnvironmentStateProxy, c4 as RecordImportOptions, bH as UserEnvironmentStateOptions, bG as UserEnvironmentState, bI as MarkUserEnvironmentReadOptions, J as ConnectOptions, cc as RunEnvironmentImporterOptions, l as OpenAIUsageSpendEvent, G as GranularSpendContext, o as RecordOpenAIUsageSpendResult, a4 as SandboxListResponse, a2 as Sandbox, a3 as CreateSandboxData, cM as DeleteResponse, a6 as PermissionProfile, a7 as CreatePermissionProfileData, af as CreateEnvironmentData, cN as StreamEvent, cO as StreamSubscription, cP as StreamStats, F as Subject, aa as AssignmentListResponse } from './spend-BA-jZwZ0.mjs';
|
|
2
2
|
import * as Automerge from '@automerge/automerge';
|
|
3
3
|
import { Doc } from '@automerge/automerge/slim';
|
|
4
4
|
|
|
@@ -18,9 +18,14 @@ declare class WSClient {
|
|
|
18
18
|
private tokenRefreshTimer;
|
|
19
19
|
private isExplicitlyDisconnected;
|
|
20
20
|
private reconnectAttempts;
|
|
21
|
+
private connectPromise;
|
|
22
|
+
private connectionEpoch;
|
|
23
|
+
private cancelConnectAttempt;
|
|
21
24
|
private options;
|
|
22
25
|
constructor(options: WSClientOptions);
|
|
23
26
|
get currentSessionId(): string;
|
|
27
|
+
seedDocumentSnapshot(document: Record<string, unknown> | Uint8Array | null | undefined): void;
|
|
28
|
+
saveDocumentSnapshot(): Uint8Array;
|
|
24
29
|
private clearTokenRefreshTimer;
|
|
25
30
|
private decodeBase64Url;
|
|
26
31
|
private getTokenExpiryMs;
|
|
@@ -31,9 +36,14 @@ declare class WSClient {
|
|
|
31
36
|
* Connect to the WebSocket server
|
|
32
37
|
* @returns {Promise<void>} Resolves when connection is open
|
|
33
38
|
*/
|
|
34
|
-
connect(
|
|
39
|
+
connect(options?: {
|
|
40
|
+
signal?: AbortSignal;
|
|
41
|
+
}): Promise<void>;
|
|
42
|
+
private connectAttempt;
|
|
35
43
|
private normalizeReason;
|
|
36
44
|
private rejectPending;
|
|
45
|
+
private emitReconnectErrorMessage;
|
|
46
|
+
private scheduleReconnectAttempt;
|
|
37
47
|
private buildDisconnectError;
|
|
38
48
|
private handleDisconnect;
|
|
39
49
|
private handleMessage;
|
|
@@ -73,7 +83,9 @@ declare class WSClient {
|
|
|
73
83
|
/**
|
|
74
84
|
* Disconnect the WebSocket and clear state
|
|
75
85
|
*/
|
|
76
|
-
disconnect(
|
|
86
|
+
disconnect(options?: {
|
|
87
|
+
reason?: string;
|
|
88
|
+
}): void;
|
|
77
89
|
}
|
|
78
90
|
|
|
79
91
|
declare class Session {
|
|
@@ -308,9 +320,7 @@ declare class Environment {
|
|
|
308
320
|
get runtimeBaseUrl(): string;
|
|
309
321
|
syncEnvironmentData(envData: EnvironmentData): void;
|
|
310
322
|
get sessions(): {
|
|
311
|
-
list: (options?:
|
|
312
|
-
status?: "active" | "closed" | "all";
|
|
313
|
-
}) => Promise<ConversationSessionInfo[]>;
|
|
323
|
+
list: (options?: Omit<ConversationSessionListOptions, "environmentId" | "sandboxId" | "subjectId">) => Promise<ConversationSessionInfo[]>;
|
|
314
324
|
create: (options?: CreateSessionOptions) => Promise<EnvironmentSession>;
|
|
315
325
|
connect: (sessionId: string, options?: {
|
|
316
326
|
clientId?: string;
|
|
@@ -338,9 +348,33 @@ declare class Environment {
|
|
|
338
348
|
cancelImport: (importId: string) => Promise<RecordImport>;
|
|
339
349
|
getAwaitingCount: () => Promise<number>;
|
|
340
350
|
};
|
|
351
|
+
/**
|
|
352
|
+
* Mirror product-owned workflow state into Granular without making Granular
|
|
353
|
+
* own the customer application's state machine.
|
|
354
|
+
*/
|
|
355
|
+
recordState(input: EnvironmentStateUpdateInput): Promise<RecordObjectResult>;
|
|
356
|
+
/**
|
|
357
|
+
* Mirror product-owned workflow state into Granular without making Granular
|
|
358
|
+
* own the customer application's state machine.
|
|
359
|
+
*
|
|
360
|
+
* Example:
|
|
361
|
+
* `await env.recordState({ className: "spend_request", id, machine: "lifecycle", state: "policy_review", source: "customer_backend" })`
|
|
362
|
+
*/
|
|
363
|
+
state(target: EnvironmentStateTarget): EnvironmentStateProxy;
|
|
341
364
|
get feedback(): {
|
|
342
365
|
list: () => Promise<EnvironmentFeedbackRecord[]>;
|
|
343
366
|
};
|
|
367
|
+
get manualActions(): {
|
|
368
|
+
record: (input: RecordManualActionInput) => Promise<ManualActionRecordResult>;
|
|
369
|
+
list: (options?: ManualActionListOptions) => Promise<SessionCollectionListResult<ManualActionOccurrence>>;
|
|
370
|
+
suggest: (options?: ManualActionSuggestionOptions) => Promise<{
|
|
371
|
+
items: ManualActionSuggestion[];
|
|
372
|
+
}>;
|
|
373
|
+
};
|
|
374
|
+
get artifactApprovals(): {
|
|
375
|
+
list: (options?: ArtifactApprovalTaskListOptions) => Promise<SessionCollectionListResult<ArtifactApprovalTask>>;
|
|
376
|
+
decide: (approvalTaskId: string, input: ArtifactApprovalDecisionInput) => Promise<ArtifactApprovalDecisionResult>;
|
|
377
|
+
};
|
|
344
378
|
/**
|
|
345
379
|
* Sessionless environments do not own a live transport, so disconnecting the
|
|
346
380
|
* environment handle itself is a no-op. This keeps the public surface
|
|
@@ -349,7 +383,8 @@ declare class Environment {
|
|
|
349
383
|
* or a session.
|
|
350
384
|
*/
|
|
351
385
|
disconnect(): Promise<void>;
|
|
352
|
-
listSessions(status?: "
|
|
386
|
+
listSessions(status?: ConversationSessionListOptions["status"]): Promise<ConversationSessionInfo[]>;
|
|
387
|
+
listSessions(options?: Omit<ConversationSessionListOptions, "environmentId" | "sandboxId" | "subjectId">): Promise<ConversationSessionInfo[]>;
|
|
353
388
|
getUserEnvironmentState(options?: UserEnvironmentStateOptions): Promise<UserEnvironmentState>;
|
|
354
389
|
markUserEnvironmentSessionsRead(options: MarkUserEnvironmentReadOptions): Promise<UserEnvironmentState["readAtBySessionId"]>;
|
|
355
390
|
createSession(options?: CreateSessionOptions): Promise<EnvironmentSession>;
|
|
@@ -363,6 +398,13 @@ declare class Environment {
|
|
|
363
398
|
}): Promise<EnvironmentSession>;
|
|
364
399
|
closeSession(sessionId: string, session?: EnvironmentSession | null): Promise<void>;
|
|
365
400
|
listFeedback(): Promise<EnvironmentFeedbackRecord[]>;
|
|
401
|
+
recordManualAction(input: RecordManualActionInput): Promise<ManualActionRecordResult>;
|
|
402
|
+
listManualActions(options?: ManualActionListOptions): Promise<SessionCollectionListResult<ManualActionOccurrence>>;
|
|
403
|
+
suggestManualActions(options?: ManualActionSuggestionOptions): Promise<{
|
|
404
|
+
items: ManualActionSuggestion[];
|
|
405
|
+
}>;
|
|
406
|
+
listArtifactApprovals(options?: ArtifactApprovalTaskListOptions): Promise<SessionCollectionListResult<ArtifactApprovalTask>>;
|
|
407
|
+
decideArtifactApproval(approvalTaskId: string, input: ArtifactApprovalDecisionInput): Promise<ArtifactApprovalDecisionResult>;
|
|
366
408
|
private getRuntimeBaseUrl;
|
|
367
409
|
private controlPlaneRequest;
|
|
368
410
|
private static normalizeGraphPathSegment;
|
|
@@ -707,6 +749,35 @@ declare class EnvironmentSession extends Session {
|
|
|
707
749
|
get jobs(): {
|
|
708
750
|
list: (options?: SessionJobListOptions) => Promise<SessionCollectionListResult<SessionJobRecord>>;
|
|
709
751
|
get: (jobId: string) => Promise<SessionJobRecord>;
|
|
752
|
+
latest: (options?: Pick<SessionJobListOptions, "status">) => Promise<SessionJobRecord | null>;
|
|
753
|
+
};
|
|
754
|
+
get artifacts(): {
|
|
755
|
+
list: (options?: SessionArtifactListOptions) => Promise<SessionCollectionListResult<SessionArtifactRecord>>;
|
|
756
|
+
listForLatestJob: (options?: Omit<SessionArtifactListOptions, "jobId" | "latestJob">) => Promise<SessionCollectionListResult<SessionArtifactRecord>>;
|
|
757
|
+
get: (artifactId: string) => Promise<SessionArtifactRecord>;
|
|
758
|
+
create: (artifact: Partial<SessionArtifactRecord> & {
|
|
759
|
+
label: string;
|
|
760
|
+
}) => Promise<SessionArtifactRecord>;
|
|
761
|
+
updateInputs: (artifactId: string, patch: {
|
|
762
|
+
inputValues?: Record<string, unknown>;
|
|
763
|
+
relationships?: Record<string, string | string[] | null>;
|
|
764
|
+
expectedUpdatedAt?: number;
|
|
765
|
+
}) => Promise<SessionArtifactRecord>;
|
|
766
|
+
validate: (artifactId: string) => Promise<SessionArtifactValidationResult>;
|
|
767
|
+
execute: (artifactId: string, options: SessionArtifactExecutionOptions) => Promise<SessionArtifactExecutionResult>;
|
|
768
|
+
approve: (artifactId: string, options: SessionArtifactApprovalOptions) => Promise<SessionArtifactExecutionResult>;
|
|
769
|
+
cancel: (artifactId: string) => Promise<SessionArtifactRecord>;
|
|
770
|
+
};
|
|
771
|
+
get manualActions(): {
|
|
772
|
+
record: (input: RecordManualActionInput) => Promise<ManualActionRecordResult>;
|
|
773
|
+
list: (options?: ManualActionListOptions) => Promise<SessionCollectionListResult<ManualActionOccurrence>>;
|
|
774
|
+
suggest: (options?: ManualActionSuggestionOptions) => Promise<{
|
|
775
|
+
items: ManualActionSuggestion[];
|
|
776
|
+
}>;
|
|
777
|
+
};
|
|
778
|
+
get artifactApprovals(): {
|
|
779
|
+
list: (options?: ArtifactApprovalTaskListOptions) => Promise<SessionCollectionListResult<ArtifactApprovalTask>>;
|
|
780
|
+
decide: (approvalTaskId: string, input: ArtifactApprovalDecisionInput) => Promise<ArtifactApprovalDecisionResult>;
|
|
710
781
|
};
|
|
711
782
|
get files(): {
|
|
712
783
|
list: (options?: SessionCollectionListOptions & {
|
|
@@ -755,6 +826,8 @@ declare class EnvironmentSession extends Session {
|
|
|
755
826
|
errors: string[];
|
|
756
827
|
}>;
|
|
757
828
|
recordObject(options: RecordObjectOptions): Promise<RecordObjectResult>;
|
|
829
|
+
recordState(input: EnvironmentStateUpdateInput): Promise<RecordObjectResult>;
|
|
830
|
+
state(target: EnvironmentStateTarget): EnvironmentStateProxy;
|
|
758
831
|
recordObjects(records: RecordObjectOptions[], options?: RecordObjectsOptions): Promise<RecordObjectResult[]>;
|
|
759
832
|
enqueueRecordImport(records: RecordObjectOptions[], options?: RecordImportOptions): Promise<RecordImport>;
|
|
760
833
|
listRecordImports(status?: RecordImportStatus): Promise<RecordImport[]>;
|
|
@@ -903,15 +976,19 @@ declare class Granular {
|
|
|
903
976
|
private sortEnvironmentsByRecency;
|
|
904
977
|
private resolveOpenEnvironmentData;
|
|
905
978
|
/**
|
|
906
|
-
* List
|
|
979
|
+
* List indexed sessions using ownership filters and bounded pagination.
|
|
980
|
+
*/
|
|
981
|
+
listSessions(options: ConversationSessionListOptions): Promise<ConversationSessionInfo[]>;
|
|
982
|
+
/**
|
|
983
|
+
* List active (open) sessions for an environment.
|
|
907
984
|
*/
|
|
908
|
-
listOpenSessions(filters: {
|
|
985
|
+
listOpenSessions(filters: Omit<ConversationSessionListOptions, "status"> & {
|
|
909
986
|
environmentId: string;
|
|
910
987
|
}): Promise<ConversationSessionInfo[]>;
|
|
911
988
|
/**
|
|
912
989
|
* List closed sessions for an environment (conversations that have disconnected).
|
|
913
990
|
*/
|
|
914
|
-
listClosedSessions(filters: {
|
|
991
|
+
listClosedSessions(filters: Omit<ConversationSessionListOptions, "status"> & {
|
|
915
992
|
environmentId: string;
|
|
916
993
|
}): Promise<ConversationSessionInfo[]>;
|
|
917
994
|
getUserEnvironmentState(options: UserEnvironmentStateOptions & {
|
|
@@ -920,7 +997,6 @@ declare class Granular {
|
|
|
920
997
|
markUserEnvironmentSessionsRead(options: MarkUserEnvironmentReadOptions & {
|
|
921
998
|
environmentId: string;
|
|
922
999
|
}): Promise<UserEnvironmentState["readAtBySessionId"]>;
|
|
923
|
-
private listSessionsForEnvironment;
|
|
924
1000
|
private normalizeConversationSession;
|
|
925
1001
|
private normalizeUserEnvironmentState;
|
|
926
1002
|
private static coerceIsoDate;
|
|
@@ -931,6 +1007,7 @@ declare class Granular {
|
|
|
931
1007
|
createSession(options: {
|
|
932
1008
|
environmentId: string;
|
|
933
1009
|
clientId?: string;
|
|
1010
|
+
sessionScope?: CreateSessionOptions["sessionScope"];
|
|
934
1011
|
initialHeap?: CreateSessionOptions["initialHeap"];
|
|
935
1012
|
}): Promise<EnvironmentSession>;
|
|
936
1013
|
/**
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { E as Environment, a as EnvironmentSession, G as Granular, O as OntologyHandle, S as Session, W as WSClient } from './client-
|
|
2
|
-
import { E as EndpointMode, T as ToolWithHandler, a as EffectHandlerContext, M as ManifestEffectMetamodelSpec, R as ResolvedEffectBehaviors, S as SessionHeapEntry, b as SessionHeapList, c as SessionHeapSnapshot, P as Prompt, d as SessionTranscriptEntry } from './spend-
|
|
3
|
-
export {
|
|
4
|
-
export { BuildGranularAgentSystemPromptInput, GeneratedJobCodeIssue, GranularAgentExecutionCheckpoint, GranularAgentHeapSummaryOptions, GranularAgentPromptCapabilities, GranularAgentReferentFocus, GranularAgentSessionContext, GranularAgentToolInfo, GranularAgentWorkflowFocus, GranularReasoningTraceChunkResult, GranularReasoningTraceOptions, HarnessContinuationDecision, HarnessControllerBudgets, HarnessProjectionOptions, HarnessPromptLike, HarnessRenderedContinuation, HarnessRenderedPrompt, HarnessTemplate, HarnessTemplateManifest, HarnessTemplateSelectionOptions, HarnessTemplateStatus, HarnessVerifierSnapshot, HarnessVerifierSnapshotInput, ReviewGeneratedJobCodeOptions, buildContinuationInstruction, buildContinuationInstructionFromTemplate, buildGranularAgentCheckpointBlock, buildGranularAgentDomainBlock, buildGranularAgentFileBlock, buildGranularAgentHeapBlock, buildGranularAgentLoopBlock, buildGranularAgentReferentBlock, buildGranularAgentRuntimeImportsBlock, buildGranularAgentSessionBlock, buildGranularAgentSystemPrompt, buildGranularAgentSystemPromptFromTemplate, buildGranularAgentToolBlock, buildGranularAgentWorkflowBlock, consumeGranularReasoningOnlyChunk, consumeGranularReasoningTraceChunk, createHarnessVerifierSnapshot, evaluateContinuation, getCurrentClosureId, getDefaultHarnessTemplateId, getExclusivePromptTarget, hasOpenPrompt, hashHarnessTemplateValue, listHarnessTemplates, projectConversationReferentFocus, projectConversationReferentSummary, projectHeapSummary, projectLoopSummary, projectSessionFileSummary, projectWorkflowFocus, projectWorkflowSummary, renderContinuationInstructionFromTemplate, renderGranularAgentSystemPromptFromTemplate, resolveHarnessTemplate, reviewGeneratedJobCode, stripGranularReasoningTrace, validateHarnessTemplateManifest } from './agent-harness.mjs';
|
|
1
|
+
export { E as Environment, a as EnvironmentSession, G as Granular, O as OntologyHandle, S as Session, W as WSClient } from './client-djorlOpn.mjs';
|
|
2
|
+
import { E as EndpointMode, T as ToolWithHandler, a as EffectHandlerContext, M as ManifestEffectMetamodelSpec, R as ResolvedEffectBehaviors, S as SessionHeapEntry, b as SessionHeapList, c as SessionHeapSnapshot, P as Prompt, d as SessionTranscriptEntry } from './spend-BA-jZwZ0.mjs';
|
|
3
|
+
export { cL as APIError, A as AccessTokenProvider, bf as ArtifactApprovalDecisionInput, bg as ArtifactApprovalDecisionResult, bd as ArtifactApprovalTask, be as ArtifactApprovalTaskListOptions, bc as ArtifactApprovalTaskStatus, a9 as Assignment, aa as AssignmentListResponse, ak as Build, am as BuildListResponse, ab as BuildPolicy, aj as BuildStatus, C as ConditionIR, J as ConnectOptions, aU as ConversationActionSuggestion, aY as ConversationAppendResult, aV as ConversationMessageAction, aX as ConversationMessageInput, aW as ConversationMessagePart, aO as ConversationMessageShowRefs, L as ConversationSessionInfo, V as ConversationSessionListOptions, Q as ConversationSessionListStatus, aP as ConversationTableCell, aQ as ConversationTableColumn, aT as ConversationTableProjection, aS as ConversationTableRow, aR as ConversationTableRowReference, af as CreateEnvironmentData, a7 as CreatePermissionProfileData, a3 as CreateSandboxData, K as CreateSessionOptions, bU as DefineRelationshipOptions, cM as DeleteResponse, D as DomainState, aD as EffectHandler, aA as EffectInfo, au as EffectInvocationMetadata, at as EffectInvocationMode, av as EffectSchema, ay as EffectVersionSelector, aw as EffectWithHandler, aC as EffectsChangedEvent, ae as EnvironmentData, aL as EnvironmentFeedbackRecord, cg as EnvironmentImporter, cf as EnvironmentImporterImportOptions, ag as EnvironmentListResponse, ca as EnvironmentRecordImportSummary, cd as EnvironmentSetupLifecycleStatus, ce as EnvironmentSetupSummary, cb as EnvironmentSetupTriggerReason, b_ as EnvironmentStateMachineProxy, bY as EnvironmentStateObservationInput, b$ as EnvironmentStateProxy, bX as EnvironmentStateTarget, bZ as EnvironmentStateUpdateInput, z as GranularAuth, y as GranularOptions, a0 as GranularQuotaPolicy, a1 as GranularQuotaProgress, G as GranularSpendContext, cK as GraphQLResult, aE as InstanceEffectHandler, I as InstanceToolHandler, aN as Job, aJ as JobFeedbackInput, aI as JobFeedbackMetadata, aK as JobFeedbackRecord, aG as JobFeedbackSentiment, aH as JobFeedbackToolCall, aF as JobStatus, aM as JobSubmitResult, ah as Manifest, cz as ManifestApprovalRequiredSpec, cJ as ManifestContent, cA as ManifestCreatesSpec, cx as ManifestDryRunSpec, cD as ManifestEffectDeclaration, cC as ManifestEffectSchema, cj as ManifestEnumRuleSpec, cF as ManifestEventStreamDef, cE as ManifestEventTypeDef, ck as ManifestFilterBySpec, cH as ManifestImport, ai as ManifestListResponse, cG as ManifestOperation, cw as ManifestPostConditionSpec, ch as ManifestPropertySpec, cB as ManifestRelationshipDef, cy as ManifestReverseSpec, cv as ManifestStateMachineSpec, cm as ManifestStateMachineStateSpec, cu as ManifestStateMachineTransitionSpec, co as ManifestStateTransitionActionSpec, cp as ManifestStateTransitionAssigneeSpec, ct as ManifestStateTransitionExpectedOutcomeSpec, cn as ManifestStateTransitionInputBinding, cs as ManifestStateTransitionPermissionSpec, cq as ManifestStateTransitionRelatedStateRequirementSpec, cr as ManifestStateTransitionRequirementsSpec, ci as ManifestValidationOperator, cl as ManifestValidationRuleSpec, cI as ManifestVolume, bo as ManualActionListOptions, bm as ManualActionOccurrence, bn as ManualActionRecordResult, bk as ManualActionRelatedRecord, bi as ManualActionSource, bh as ManualActionStatus, bp as ManualActionSuggestion, bq as ManualActionSuggestionOptions, bj as ManualActionTarget, bI as MarkUserEnvironmentReadOptions, x as MatchedPolicy, bS as ModelRef, N as NormalizedOpenAIUsage, i as OPENAI_MODEL_PRICING_USD_PER_MILLION, O as OpenAIModelPricing, h as OpenAITokenSpend, l as OpenAIUsageSpendEvent, H as OpenEnvironmentOptions, a6 as PermissionProfile, a8 as PermissionProfileListResponse, a5 as PermissionRules, u as PolicyOperator, v as PolicyOrigin, s as PolicyPredicateSource, w as PolicyRuleIR, q as PolicySource, ax as PublishEffectsResult, f as PublishToolsResult, $ as QuotaLineItemFilter, Y as QuotaPeriod, X as QuotaScopeType, Z as QuotaStatus, bM as RPCRequest, bP as RPCRequestFromServer, bN as RPCResponse, c9 as RecordImport, c8 as RecordImportItem, c6 as RecordImportItemStatus, c4 as RecordImportOptions, c7 as RecordImportStats, c5 as RecordImportStatus, c3 as RecordImportWriteMode, bl as RecordManualActionInput, by as RecordMentionInput, bV as RecordObjectOptions, c0 as RecordObjectResult, bW as RecordObjectStateValue, c1 as RecordObjectsChunkInfo, c2 as RecordObjectsOptions, m as RecordOpenAIUsageSpendOptions, o as RecordOpenAIUsageSpendResult, bx as RecordSearchOptions, bw as RecordSearchResult, B as RecordUserOptions, bT as RelationshipInfo, as as ResolvedEffectApprovalRequired, aq as ResolvedEffectDryRun, ap as ResolvedEffectPostCondition, ar as ResolvedEffectReverse, cc as RunEnvironmentImporterOptions, a2 as Sandbox, a4 as SandboxListResponse, ao as SemanticVersionDiff, an as SemanticVersionDiffEntry, bb as SessionArtifactApprovalOptions, b5 as SessionArtifactAutonomyPolicy, ba as SessionArtifactExecutionOptions, b9 as SessionArtifactExecutionResult, b4 as SessionArtifactKind, b7 as SessionArtifactListOptions, b6 as SessionArtifactRecord, b3 as SessionArtifactStatus, b8 as SessionArtifactValidationResult, bA as SessionCollectionListOptions, bC as SessionCollectionListResult, aZ as SessionConversationMessage, bz as SessionDocumentResult, b0 as SessionFileKind, b2 as SessionFileRecord, a$ as SessionFileSource, b1 as SessionFileStatus, br as SessionFileUploadOptions, bt as SessionHeapFieldType, bu as SessionHeapFieldValue, bv as SessionHeapVariable, bB as SessionJobListOptions, bs as SessionJobRecord, a_ as SessionTimelineEvent, W as SpendLineItemType, _ as SpendSummary, cN as StreamEvent, cP as StreamStats, cO as StreamSubscription, F as Subject, bO as SyncMessage, g as ToolHandler, az as ToolInfo, bQ as ToolInvokeParams, bR as ToolResultParams, e as ToolSchema, aB as ToolsChangedEvent, U as User, bE as UserEnvironmentMessagePreview, bD as UserEnvironmentPrompt, bF as UserEnvironmentSessionState, bG as UserEnvironmentState, bH as UserEnvironmentStateOptions, al as Version, ad as VersionTag, ac as VersionTracking, bL as WSClientOptions, bJ as WSDisconnectInfo, bK as WSReconnectErrorInfo, p as buildOpenAISpendEventId, k as calculateOpenAITokenSpend, j as getOpenAIModelPricing, n as normalizeOpenAIUsage, r as recordOpenAIUsageSpend, t as toGranularHttpBase } from './spend-BA-jZwZ0.mjs';
|
|
4
|
+
export { BuildGranularAgentSystemPromptInput, GeneratedJobCodeIssue, GranularAgentExecutionCheckpoint, GranularAgentHeapSummaryOptions, GranularAgentManualActionMemorySuggestion, GranularAgentPromptCapabilities, GranularAgentReferentFocus, GranularAgentSessionContext, GranularAgentToolInfo, GranularAgentWorkflowFocus, GranularReasoningTraceChunkResult, GranularReasoningTraceOptions, HarnessContinuationDecision, HarnessControllerBudgets, HarnessProjectionOptions, HarnessPromptLike, HarnessRenderedContinuation, HarnessRenderedPrompt, HarnessTemplate, HarnessTemplateManifest, HarnessTemplateSelectionOptions, HarnessTemplateStatus, HarnessVerifierSnapshot, HarnessVerifierSnapshotInput, ReviewGeneratedJobCodeOptions, buildContinuationInstruction, buildContinuationInstructionFromTemplate, buildGranularAgentCheckpointBlock, buildGranularAgentDomainBlock, buildGranularAgentFileBlock, buildGranularAgentHeapBlock, buildGranularAgentLoopBlock, buildGranularAgentManualActionBlock, buildGranularAgentManualActionMemorySummary, buildGranularAgentReferentBlock, buildGranularAgentRuntimeImportsBlock, buildGranularAgentSessionBlock, buildGranularAgentSystemPrompt, buildGranularAgentSystemPromptFromTemplate, buildGranularAgentToolBlock, buildGranularAgentWorkflowBlock, consumeGranularReasoningOnlyChunk, consumeGranularReasoningTraceChunk, createHarnessVerifierSnapshot, evaluateContinuation, getCurrentClosureId, getDefaultHarnessTemplateId, getExclusivePromptTarget, hasOpenPrompt, hashHarnessTemplateValue, listHarnessTemplates, projectConversationReferentFocus, projectConversationReferentSummary, projectHeapSummary, projectLoopSummary, projectSessionFileSummary, projectWorkflowFocus, projectWorkflowSummary, renderContinuationInstructionFromTemplate, renderGranularAgentSystemPromptFromTemplate, resolveHarnessTemplate, reviewGeneratedJobCode, stripGranularReasoningTrace, validateHarnessTemplateManifest } from './agent-harness.mjs';
|
|
5
5
|
import '@automerge/automerge';
|
|
6
6
|
import '@automerge/automerge/slim';
|
|
7
7
|
|
|
@@ -29,6 +29,105 @@ type EffectRuntimeRequest = {
|
|
|
29
29
|
declare function normalizeEffectBehaviors(value?: ManifestEffectMetamodelSpec | ResolvedEffectBehaviors | null): ResolvedEffectBehaviors;
|
|
30
30
|
declare function invokeRegisteredEffect(effectMap: Map<string, ToolWithHandler>, request: EffectRuntimeRequest): Promise<unknown>;
|
|
31
31
|
|
|
32
|
+
interface ValidationRuleEvaluationInput {
|
|
33
|
+
operator?: string | null;
|
|
34
|
+
stringValue?: string;
|
|
35
|
+
string_value?: string;
|
|
36
|
+
numberValue?: number;
|
|
37
|
+
number_value?: number;
|
|
38
|
+
booleanValue?: boolean;
|
|
39
|
+
boolean_value?: boolean;
|
|
40
|
+
message?: string | null;
|
|
41
|
+
}
|
|
42
|
+
interface ValidationRuleEvaluationResult {
|
|
43
|
+
passed: boolean;
|
|
44
|
+
operator: string;
|
|
45
|
+
message?: string | null;
|
|
46
|
+
}
|
|
47
|
+
declare function evaluateValidationRule(value: unknown, rule: ValidationRuleEvaluationInput): ValidationRuleEvaluationResult;
|
|
48
|
+
declare function validationRuleFailureMessage(path: string, rule: ValidationRuleEvaluationInput): string;
|
|
49
|
+
|
|
50
|
+
type PolicyOutcome = "allow" | "confirm" | "deny";
|
|
51
|
+
type PolicySource = "manifest" | "permissionProfile" | "builtin";
|
|
52
|
+
type PolicyOrigin = {
|
|
53
|
+
kind: "manifest";
|
|
54
|
+
manifestId?: string;
|
|
55
|
+
effectKey: string;
|
|
56
|
+
} | {
|
|
57
|
+
kind: "permissionProfile";
|
|
58
|
+
profileName: string;
|
|
59
|
+
permissionProfileVersionId?: string;
|
|
60
|
+
source: PolicySource;
|
|
61
|
+
};
|
|
62
|
+
interface MatchedPolicy {
|
|
63
|
+
id: string;
|
|
64
|
+
outcome: PolicyOutcome;
|
|
65
|
+
origin: PolicyOrigin;
|
|
66
|
+
reason?: string;
|
|
67
|
+
summary: string;
|
|
68
|
+
}
|
|
69
|
+
interface PolicyDecision {
|
|
70
|
+
outcome: PolicyOutcome;
|
|
71
|
+
matches: MatchedPolicy[];
|
|
72
|
+
}
|
|
73
|
+
interface PolicyEvaluationContext {
|
|
74
|
+
input?: Record<string, unknown> | null;
|
|
75
|
+
object?: Record<string, unknown> | null;
|
|
76
|
+
stateMachines?: Record<string, string | null | undefined> | null;
|
|
77
|
+
}
|
|
78
|
+
interface PermissionProfileFile {
|
|
79
|
+
schemaVersion?: number;
|
|
80
|
+
name: string;
|
|
81
|
+
label?: string;
|
|
82
|
+
description?: string;
|
|
83
|
+
extends?: string;
|
|
84
|
+
defaultsOwnerName?: string;
|
|
85
|
+
source?: PolicySource;
|
|
86
|
+
sourcePath?: string;
|
|
87
|
+
defaults?: {
|
|
88
|
+
actionPolicy?: PolicyOutcome;
|
|
89
|
+
};
|
|
90
|
+
policies?: PermissionPolicySpec[];
|
|
91
|
+
actions?: PermissionActionSpec[];
|
|
92
|
+
}
|
|
93
|
+
interface PermissionPolicySpec {
|
|
94
|
+
id?: string;
|
|
95
|
+
ownerProfileName?: string;
|
|
96
|
+
action?: string;
|
|
97
|
+
on?: string;
|
|
98
|
+
decision?: PolicyOutcome;
|
|
99
|
+
outcome?: PolicyOutcome;
|
|
100
|
+
reason?: string;
|
|
101
|
+
when?: unknown;
|
|
102
|
+
}
|
|
103
|
+
interface PermissionActionSpec {
|
|
104
|
+
id?: string;
|
|
105
|
+
ownerProfileName?: string;
|
|
106
|
+
action: string;
|
|
107
|
+
on?: string;
|
|
108
|
+
allow?: "always";
|
|
109
|
+
deny?: "always";
|
|
110
|
+
confirm?: "always";
|
|
111
|
+
reason?: string;
|
|
112
|
+
allowWhen?: ConditionalPolicySpec[];
|
|
113
|
+
confirmWhen?: ConditionalPolicySpec[];
|
|
114
|
+
denyWhen?: ConditionalPolicySpec[];
|
|
115
|
+
limits?: LimitPolicySpec[];
|
|
116
|
+
}
|
|
117
|
+
interface ConditionalPolicySpec {
|
|
118
|
+
id?: string;
|
|
119
|
+
reason?: string;
|
|
120
|
+
when: unknown;
|
|
121
|
+
}
|
|
122
|
+
interface LimitPolicySpec {
|
|
123
|
+
id?: string;
|
|
124
|
+
input: string | string[];
|
|
125
|
+
upTo?: number;
|
|
126
|
+
above?: number;
|
|
127
|
+
decision: PolicyOutcome;
|
|
128
|
+
reason?: string;
|
|
129
|
+
}
|
|
130
|
+
|
|
32
131
|
interface JobPresentation {
|
|
33
132
|
responseText: string | null;
|
|
34
133
|
entries: SessionHeapEntry[];
|
|
@@ -75,4 +174,4 @@ declare function buildSessionTranscript(input: {
|
|
|
75
174
|
sessionHeap?: SessionHeapSnapshot;
|
|
76
175
|
}): SessionTranscriptEntry[];
|
|
77
176
|
|
|
78
|
-
export { EffectHandlerContext, EndpointMode, type JobPresentation, ManifestEffectMetamodelSpec, type NormalizedPromptChoiceOption, Prompt, ResolvedEffectBehaviors, SessionHeapEntry, SessionHeapList, SessionHeapSnapshot, SessionTranscriptEntry, ToolWithHandler, buildSessionTranscript, extractPromptTokens, invokeRegisteredEffect, isLocalApiUrl, normalizeEffectBehaviors, normalizePrompt, normalizePromptChoiceOption, normalizePromptText, normalizePromptType, resolveApiUrl, resolveAuthTokenForApiUrl, resolveJobPresentation, resolvePromptAnswer, scorePromptChoiceMatch };
|
|
177
|
+
export { type ConditionalPolicySpec, EffectHandlerContext, EndpointMode, type JobPresentation, type LimitPolicySpec, ManifestEffectMetamodelSpec, type NormalizedPromptChoiceOption, type PermissionActionSpec, type PermissionPolicySpec, type PermissionProfileFile, type PolicyDecision, type PolicyEvaluationContext, type PolicyOutcome, Prompt, ResolvedEffectBehaviors, SessionHeapEntry, SessionHeapList, SessionHeapSnapshot, SessionTranscriptEntry, ToolWithHandler, type ValidationRuleEvaluationInput, type ValidationRuleEvaluationResult, buildSessionTranscript, evaluateValidationRule, extractPromptTokens, invokeRegisteredEffect, isLocalApiUrl, normalizeEffectBehaviors, normalizePrompt, normalizePromptChoiceOption, normalizePromptText, normalizePromptType, resolveApiUrl, resolveAuthTokenForApiUrl, resolveJobPresentation, resolvePromptAnswer, scorePromptChoiceMatch, validationRuleFailureMessage };
|