@granular-software/sdk 0.4.25 → 0.4.26
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/agent-evals.d.mts +1 -1
- package/dist/agent-evals.d.ts +1 -1
- package/dist/agent-evals.js +30 -0
- package/dist/agent-evals.js.map +1 -1
- package/dist/agent-evals.mjs +30 -0
- package/dist/agent-evals.mjs.map +1 -1
- package/dist/cli/index.js +30 -0
- package/dist/{client-BeKRGMoT.d.mts → client-Zoo8YITZ.d.mts} +38 -1
- package/dist/{client-BeKRGMoT.d.ts → client-Zoo8YITZ.d.ts} +38 -1
- package/dist/index.d.mts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +331 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +331 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -18203,6 +18203,22 @@ var Session = class {
|
|
|
18203
18203
|
}
|
|
18204
18204
|
};
|
|
18205
18205
|
}
|
|
18206
|
+
stringifyConversationValue(value) {
|
|
18207
|
+
if (typeof value === "string") {
|
|
18208
|
+
return value;
|
|
18209
|
+
}
|
|
18210
|
+
if (typeof value === "boolean") {
|
|
18211
|
+
return value ? "Confirmed" : "Canceled";
|
|
18212
|
+
}
|
|
18213
|
+
if (value === void 0) {
|
|
18214
|
+
return "";
|
|
18215
|
+
}
|
|
18216
|
+
try {
|
|
18217
|
+
return JSON.stringify(value, null, 2);
|
|
18218
|
+
} catch {
|
|
18219
|
+
return String(value);
|
|
18220
|
+
}
|
|
18221
|
+
}
|
|
18206
18222
|
// --- Public API ---
|
|
18207
18223
|
get document() {
|
|
18208
18224
|
return this.client.doc;
|
|
@@ -18353,6 +18369,20 @@ var Session = class {
|
|
|
18353
18369
|
answer: resolvedAnswer,
|
|
18354
18370
|
value: resolvedAnswer
|
|
18355
18371
|
});
|
|
18372
|
+
try {
|
|
18373
|
+
const content = this.stringifyConversationValue(resolvedAnswer);
|
|
18374
|
+
if (content.trim()) {
|
|
18375
|
+
await this.appendConversationMessage({
|
|
18376
|
+
role: "user",
|
|
18377
|
+
content,
|
|
18378
|
+
promptId
|
|
18379
|
+
});
|
|
18380
|
+
}
|
|
18381
|
+
} catch {
|
|
18382
|
+
}
|
|
18383
|
+
}
|
|
18384
|
+
async appendConversationMessage(input) {
|
|
18385
|
+
return this.client.call("conversation.append", input);
|
|
18356
18386
|
}
|
|
18357
18387
|
/**
|
|
18358
18388
|
* Get the current list of available effects.
|
|
@@ -670,6 +670,41 @@ interface Prompt {
|
|
|
670
670
|
allowEmpty?: boolean;
|
|
671
671
|
metadata?: Record<string, unknown>;
|
|
672
672
|
}
|
|
673
|
+
interface ConversationMessageShowRefs {
|
|
674
|
+
entryPaths?: string[];
|
|
675
|
+
listNames?: string[];
|
|
676
|
+
variableNames?: string[];
|
|
677
|
+
}
|
|
678
|
+
interface ConversationMessageInput {
|
|
679
|
+
role: 'user' | 'assistant';
|
|
680
|
+
content?: string;
|
|
681
|
+
show?: ConversationMessageShowRefs;
|
|
682
|
+
jobId?: string;
|
|
683
|
+
promptId?: string;
|
|
684
|
+
timestamp?: number;
|
|
685
|
+
}
|
|
686
|
+
interface ConversationAppendResult {
|
|
687
|
+
ok: boolean;
|
|
688
|
+
messageId: string;
|
|
689
|
+
timestamp: number;
|
|
690
|
+
jobId?: string;
|
|
691
|
+
promptId?: string;
|
|
692
|
+
}
|
|
693
|
+
interface SessionTranscriptEntry {
|
|
694
|
+
id: string;
|
|
695
|
+
role: 'user' | 'assistant';
|
|
696
|
+
content: string;
|
|
697
|
+
timestamp: number;
|
|
698
|
+
jobId?: string;
|
|
699
|
+
promptId?: string;
|
|
700
|
+
code?: string;
|
|
701
|
+
jobStatus?: string;
|
|
702
|
+
jobResultPreview?: string;
|
|
703
|
+
error?: string;
|
|
704
|
+
show?: ConversationMessageShowRefs;
|
|
705
|
+
historyContent?: string;
|
|
706
|
+
source: 'conversation' | 'job_code' | 'job_result' | 'job_prompt' | 'job_agent_message';
|
|
707
|
+
}
|
|
673
708
|
type SessionHeapFieldType = 'string' | 'number' | 'boolean' | 'null' | 'unknown';
|
|
674
709
|
interface SessionHeapFieldValue {
|
|
675
710
|
name: string;
|
|
@@ -1269,6 +1304,7 @@ declare class Session {
|
|
|
1269
1304
|
constructor(client: WSClient, clientId?: string);
|
|
1270
1305
|
private extractDomainRevisionFromDoc;
|
|
1271
1306
|
private buildLegacyEffectContext;
|
|
1307
|
+
private stringifyConversationValue;
|
|
1272
1308
|
get document(): Doc<Record<string, unknown>>;
|
|
1273
1309
|
get sessionId(): string;
|
|
1274
1310
|
get domainRevision(): string | null;
|
|
@@ -1340,6 +1376,7 @@ declare class Session {
|
|
|
1340
1376
|
* Respond to a prompt request from the sandbox
|
|
1341
1377
|
*/
|
|
1342
1378
|
answerPrompt(promptId: string, answer: unknown): Promise<void>;
|
|
1379
|
+
appendConversationMessage(input: ConversationMessageInput): Promise<ConversationAppendResult>;
|
|
1343
1380
|
/**
|
|
1344
1381
|
* Get the current list of available effects.
|
|
1345
1382
|
* Consolidates effect declarations and live availability for the session.
|
|
@@ -2054,4 +2091,4 @@ declare class Granular {
|
|
|
2054
2091
|
private request;
|
|
2055
2092
|
}
|
|
2056
2093
|
|
|
2057
|
-
export { type
|
|
2094
|
+
export { type ResolvedEffectApprovalRequired as $, type AccessTokenProvider as A, type BuildPolicy as B, type ConnectOptions as C, type DomainState as D, type EndpointMode as E, type EnvironmentListResponse as F, Granular as G, type Manifest as H, type InstanceToolHandler as I, type ManifestListResponse as J, type BuildStatus as K, type Build as L, type ManifestEffectMetamodelSpec as M, type Version as N, type BuildListResponse as O, type Prompt as P, type SemanticVersionDiffEntry 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 SemanticVersionDiff as X, type ResolvedEffectPostCondition as Y, type ResolvedEffectDryRun as Z, type ResolvedEffectReverse as _, type EffectHandlerContext as a, type ManifestEventStreamDef as a$, type EffectInvocationMode as a0, type EffectInvocationMetadata as a1, type EffectSchema as a2, type EffectWithHandler as a3, type PublishEffectsResult as a4, type ToolInfo as a5, type EffectInfo as a6, type ToolsChangedEvent as a7, type EffectsChangedEvent as a8, type EffectHandler as a9, type DefineRelationshipOptions as aA, type RecordObjectOptions as aB, type RecordObjectResult as aC, type RecordObjectsChunkInfo as aD, type RecordObjectsOptions as aE, type RecordImportStatus as aF, type RecordImportItemStatus as aG, type RecordImportStats as aH, type RecordImportItem as aI, type RecordImport as aJ, type EnvironmentRecordImportSummary as aK, type ManifestPropertySpec as aL, type ManifestValidationOperator as aM, type ManifestEnumRuleSpec as aN, type ManifestFilterBySpec as aO, type ManifestValidationRuleSpec as aP, type ManifestStateMachineStateSpec as aQ, type ManifestStateMachineTransitionSpec as aR, type ManifestStateMachineSpec as aS, type ManifestPostConditionSpec as aT, type ManifestDryRunSpec as aU, type ManifestReverseSpec as aV, type ManifestApprovalRequiredSpec as aW, type ManifestRelationshipDef as aX, type ManifestEffectSchema as aY, type ManifestEffectDeclaration as aZ, type ManifestEventTypeDef as a_, type InstanceEffectHandler as aa, type JobStatus as ab, type JobFeedbackSentiment as ac, type JobFeedbackToolCall as ad, type JobFeedbackMetadata as ae, type JobFeedbackInput as af, type JobFeedbackRecord as ag, type JobSubmitResult as ah, type Job as ai, type ConversationMessageShowRefs as aj, type ConversationMessageInput as ak, type ConversationAppendResult as al, type SessionHeapFieldType as am, type SessionHeapFieldValue as an, type SessionHeapVariable as ao, type WSDisconnectInfo as ap, type WSReconnectErrorInfo as aq, type WSClientOptions as ar, type RPCRequest as as, type RPCResponse as at, type SyncMessage as au, type RPCRequestFromServer as av, type ToolInvokeParams as aw, type ToolResultParams as ax, type ModelRef as ay, type RelationshipInfo as az, type SessionHeapList as b, type ManifestOperation as b0, type ManifestImport as b1, type ManifestVolume as b2, type ManifestContent as b3, type GraphQLResult as b4, type APIError as b5, type DeleteResponse as b6, type StreamEvent as b7, type StreamSubscription as b8, type StreamStats as b9, type SessionHeapSnapshot as c, type SessionTranscriptEntry as d, Environment as e, Session as f, type ToolSchema as g, type PublishToolsResult as h, type ToolHandler as i, type GranularOptions as j, type GranularAuth as k, type RecordUserOptions as l, type Subject as m, type ConversationSessionInfo as n, type Sandbox as o, type CreateSandboxData as p, type SandboxListResponse as q, type PermissionRules as r, type PermissionProfile as s, type CreatePermissionProfileData as t, type PermissionProfileListResponse as u, type Assignment as v, type AssignmentListResponse as w, type VersionTag as x, type EnvironmentData as y, type CreateEnvironmentData as z };
|
|
@@ -670,6 +670,41 @@ interface Prompt {
|
|
|
670
670
|
allowEmpty?: boolean;
|
|
671
671
|
metadata?: Record<string, unknown>;
|
|
672
672
|
}
|
|
673
|
+
interface ConversationMessageShowRefs {
|
|
674
|
+
entryPaths?: string[];
|
|
675
|
+
listNames?: string[];
|
|
676
|
+
variableNames?: string[];
|
|
677
|
+
}
|
|
678
|
+
interface ConversationMessageInput {
|
|
679
|
+
role: 'user' | 'assistant';
|
|
680
|
+
content?: string;
|
|
681
|
+
show?: ConversationMessageShowRefs;
|
|
682
|
+
jobId?: string;
|
|
683
|
+
promptId?: string;
|
|
684
|
+
timestamp?: number;
|
|
685
|
+
}
|
|
686
|
+
interface ConversationAppendResult {
|
|
687
|
+
ok: boolean;
|
|
688
|
+
messageId: string;
|
|
689
|
+
timestamp: number;
|
|
690
|
+
jobId?: string;
|
|
691
|
+
promptId?: string;
|
|
692
|
+
}
|
|
693
|
+
interface SessionTranscriptEntry {
|
|
694
|
+
id: string;
|
|
695
|
+
role: 'user' | 'assistant';
|
|
696
|
+
content: string;
|
|
697
|
+
timestamp: number;
|
|
698
|
+
jobId?: string;
|
|
699
|
+
promptId?: string;
|
|
700
|
+
code?: string;
|
|
701
|
+
jobStatus?: string;
|
|
702
|
+
jobResultPreview?: string;
|
|
703
|
+
error?: string;
|
|
704
|
+
show?: ConversationMessageShowRefs;
|
|
705
|
+
historyContent?: string;
|
|
706
|
+
source: 'conversation' | 'job_code' | 'job_result' | 'job_prompt' | 'job_agent_message';
|
|
707
|
+
}
|
|
673
708
|
type SessionHeapFieldType = 'string' | 'number' | 'boolean' | 'null' | 'unknown';
|
|
674
709
|
interface SessionHeapFieldValue {
|
|
675
710
|
name: string;
|
|
@@ -1269,6 +1304,7 @@ declare class Session {
|
|
|
1269
1304
|
constructor(client: WSClient, clientId?: string);
|
|
1270
1305
|
private extractDomainRevisionFromDoc;
|
|
1271
1306
|
private buildLegacyEffectContext;
|
|
1307
|
+
private stringifyConversationValue;
|
|
1272
1308
|
get document(): Doc<Record<string, unknown>>;
|
|
1273
1309
|
get sessionId(): string;
|
|
1274
1310
|
get domainRevision(): string | null;
|
|
@@ -1340,6 +1376,7 @@ declare class Session {
|
|
|
1340
1376
|
* Respond to a prompt request from the sandbox
|
|
1341
1377
|
*/
|
|
1342
1378
|
answerPrompt(promptId: string, answer: unknown): Promise<void>;
|
|
1379
|
+
appendConversationMessage(input: ConversationMessageInput): Promise<ConversationAppendResult>;
|
|
1343
1380
|
/**
|
|
1344
1381
|
* Get the current list of available effects.
|
|
1345
1382
|
* Consolidates effect declarations and live availability for the session.
|
|
@@ -2054,4 +2091,4 @@ declare class Granular {
|
|
|
2054
2091
|
private request;
|
|
2055
2092
|
}
|
|
2056
2093
|
|
|
2057
|
-
export { type
|
|
2094
|
+
export { type ResolvedEffectApprovalRequired as $, type AccessTokenProvider as A, type BuildPolicy as B, type ConnectOptions as C, type DomainState as D, type EndpointMode as E, type EnvironmentListResponse as F, Granular as G, type Manifest as H, type InstanceToolHandler as I, type ManifestListResponse as J, type BuildStatus as K, type Build as L, type ManifestEffectMetamodelSpec as M, type Version as N, type BuildListResponse as O, type Prompt as P, type SemanticVersionDiffEntry 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 SemanticVersionDiff as X, type ResolvedEffectPostCondition as Y, type ResolvedEffectDryRun as Z, type ResolvedEffectReverse as _, type EffectHandlerContext as a, type ManifestEventStreamDef as a$, type EffectInvocationMode as a0, type EffectInvocationMetadata as a1, type EffectSchema as a2, type EffectWithHandler as a3, type PublishEffectsResult as a4, type ToolInfo as a5, type EffectInfo as a6, type ToolsChangedEvent as a7, type EffectsChangedEvent as a8, type EffectHandler as a9, type DefineRelationshipOptions as aA, type RecordObjectOptions as aB, type RecordObjectResult as aC, type RecordObjectsChunkInfo as aD, type RecordObjectsOptions as aE, type RecordImportStatus as aF, type RecordImportItemStatus as aG, type RecordImportStats as aH, type RecordImportItem as aI, type RecordImport as aJ, type EnvironmentRecordImportSummary as aK, type ManifestPropertySpec as aL, type ManifestValidationOperator as aM, type ManifestEnumRuleSpec as aN, type ManifestFilterBySpec as aO, type ManifestValidationRuleSpec as aP, type ManifestStateMachineStateSpec as aQ, type ManifestStateMachineTransitionSpec as aR, type ManifestStateMachineSpec as aS, type ManifestPostConditionSpec as aT, type ManifestDryRunSpec as aU, type ManifestReverseSpec as aV, type ManifestApprovalRequiredSpec as aW, type ManifestRelationshipDef as aX, type ManifestEffectSchema as aY, type ManifestEffectDeclaration as aZ, type ManifestEventTypeDef as a_, type InstanceEffectHandler as aa, type JobStatus as ab, type JobFeedbackSentiment as ac, type JobFeedbackToolCall as ad, type JobFeedbackMetadata as ae, type JobFeedbackInput as af, type JobFeedbackRecord as ag, type JobSubmitResult as ah, type Job as ai, type ConversationMessageShowRefs as aj, type ConversationMessageInput as ak, type ConversationAppendResult as al, type SessionHeapFieldType as am, type SessionHeapFieldValue as an, type SessionHeapVariable as ao, type WSDisconnectInfo as ap, type WSReconnectErrorInfo as aq, type WSClientOptions as ar, type RPCRequest as as, type RPCResponse as at, type SyncMessage as au, type RPCRequestFromServer as av, type ToolInvokeParams as aw, type ToolResultParams as ax, type ModelRef as ay, type RelationshipInfo as az, type SessionHeapList as b, type ManifestOperation as b0, type ManifestImport as b1, type ManifestVolume as b2, type ManifestContent as b3, type GraphQLResult as b4, type APIError as b5, type DeleteResponse as b6, type StreamEvent as b7, type StreamSubscription as b8, type StreamStats as b9, type SessionHeapSnapshot as c, type SessionTranscriptEntry as d, Environment as e, Session as f, type ToolSchema as g, type PublishToolsResult as h, type ToolHandler as i, type GranularOptions as j, type GranularAuth as k, type RecordUserOptions as l, type Subject as m, type ConversationSessionInfo as n, type Sandbox as o, type CreateSandboxData as p, type SandboxListResponse as q, type PermissionRules as r, type PermissionProfile as s, type CreatePermissionProfileData as t, type PermissionProfileListResponse as u, type Assignment as v, type AssignmentListResponse as w, type VersionTag as x, type EnvironmentData as y, type CreateEnvironmentData as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
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 } from './client-
|
|
2
|
-
export {
|
|
1
|
+
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 './client-Zoo8YITZ.mjs';
|
|
2
|
+
export { b5 as APIError, A as AccessTokenProvider, v as Assignment, w as AssignmentListResponse, L as Build, O as BuildListResponse, B as BuildPolicy, K as BuildStatus, C as ConnectOptions, al as ConversationAppendResult, ak as ConversationMessageInput, aj as ConversationMessageShowRefs, n as ConversationSessionInfo, z as CreateEnvironmentData, t as CreatePermissionProfileData, p as CreateSandboxData, aA as DefineRelationshipOptions, b6 as DeleteResponse, D as DomainState, a9 as EffectHandler, a6 as EffectInfo, a1 as EffectInvocationMetadata, a0 as EffectInvocationMode, a2 as EffectSchema, a3 as EffectWithHandler, a8 as EffectsChangedEvent, e as Environment, y as EnvironmentData, F as EnvironmentListResponse, aK as EnvironmentRecordImportSummary, G as Granular, k as GranularAuth, j as GranularOptions, b4 as GraphQLResult, aa as InstanceEffectHandler, I as InstanceToolHandler, ai as Job, af as JobFeedbackInput, ae as JobFeedbackMetadata, ag as JobFeedbackRecord, ac as JobFeedbackSentiment, ad as JobFeedbackToolCall, ab as JobStatus, ah as JobSubmitResult, H as Manifest, aW as ManifestApprovalRequiredSpec, b3 as ManifestContent, aU as ManifestDryRunSpec, aZ as ManifestEffectDeclaration, aY as ManifestEffectSchema, aN as ManifestEnumRuleSpec, a$ as ManifestEventStreamDef, a_ as ManifestEventTypeDef, aO as ManifestFilterBySpec, b1 as ManifestImport, J as ManifestListResponse, b0 as ManifestOperation, aT as ManifestPostConditionSpec, aL as ManifestPropertySpec, aX as ManifestRelationshipDef, aV as ManifestReverseSpec, aS as ManifestStateMachineSpec, aQ as ManifestStateMachineStateSpec, aR as ManifestStateMachineTransitionSpec, aM as ManifestValidationOperator, aP as ManifestValidationRuleSpec, b2 as ManifestVolume, ay as ModelRef, s as PermissionProfile, u as PermissionProfileListResponse, r as PermissionRules, a4 as PublishEffectsResult, h as PublishToolsResult, as as RPCRequest, av as RPCRequestFromServer, at as RPCResponse, aJ as RecordImport, aI as RecordImportItem, aG as RecordImportItemStatus, aH as RecordImportStats, aF as RecordImportStatus, aB as RecordObjectOptions, aC as RecordObjectResult, aD as RecordObjectsChunkInfo, aE as RecordObjectsOptions, l as RecordUserOptions, az as RelationshipInfo, $ as ResolvedEffectApprovalRequired, Z as ResolvedEffectDryRun, Y as ResolvedEffectPostCondition, _ as ResolvedEffectReverse, o as Sandbox, q as SandboxListResponse, X as SemanticVersionDiff, Q as SemanticVersionDiffEntry, f as Session, am as SessionHeapFieldType, an as SessionHeapFieldValue, ao as SessionHeapVariable, b7 as StreamEvent, b9 as StreamStats, b8 as StreamSubscription, m as Subject, au as SyncMessage, i as ToolHandler, a5 as ToolInfo, aw as ToolInvokeParams, ax as ToolResultParams, g as ToolSchema, a7 as ToolsChangedEvent, U as User, N as Version, x as VersionTag, V as VersionTracking, W as WSClient, ar as WSClientOptions, ap as WSDisconnectInfo, aq as WSReconnectErrorInfo } from './client-Zoo8YITZ.mjs';
|
|
3
3
|
export { BuildGranularAgentSystemPromptInput, GeneratedJobCodeIssue, GranularAgentExecutionCheckpoint, GranularAgentHeapSummaryOptions, GranularAgentSessionContext, GranularAgentToolInfo, GranularAgentWorkflowFocus, HarnessContinuationDecision, HarnessControllerBudgets, HarnessProjectionOptions, HarnessPromptLike, HarnessVerifierSnapshot, HarnessVerifierSnapshotInput, buildContinuationInstruction, buildGranularAgentCheckpointBlock, buildGranularAgentDomainBlock, buildGranularAgentHeapBlock, buildGranularAgentLoopBlock, buildGranularAgentSessionBlock, buildGranularAgentSystemPrompt, buildGranularAgentToolBlock, buildGranularAgentWorkflowBlock, createHarnessVerifierSnapshot, evaluateContinuation, getCurrentClosureId, getExclusivePromptTarget, hasOpenPrompt, projectHeapSummary, projectLoopSummary, projectWorkflowFocus, projectWorkflowSummary, reviewGeneratedJobCode } from './agent-harness.mjs';
|
|
4
4
|
import '@automerge/automerge';
|
|
5
5
|
import '@automerge/automerge/slim';
|
|
@@ -58,4 +58,9 @@ declare function normalizePromptType(raw: Record<string, unknown> | null | undef
|
|
|
58
58
|
declare function normalizePrompt(rawValue: unknown): Prompt | null;
|
|
59
59
|
declare function resolvePromptAnswer(prompt: Prompt | undefined, answer: unknown): unknown;
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
declare function buildSessionTranscript(input: {
|
|
62
|
+
liveDoc?: Record<string, unknown> | null;
|
|
63
|
+
sessionHeap?: SessionHeapSnapshot;
|
|
64
|
+
}): SessionTranscriptEntry[];
|
|
65
|
+
|
|
66
|
+
export { EffectHandlerContext, EndpointMode, type JobPresentation, ManifestEffectMetamodelSpec, Prompt, ResolvedEffectBehaviors, SessionHeapEntry, SessionHeapList, SessionHeapSnapshot, SessionTranscriptEntry, ToolWithHandler, buildSessionTranscript, extractPromptTokens, invokeRegisteredEffect, isLocalApiUrl, normalizeEffectBehaviors, normalizePrompt, normalizePromptText, normalizePromptType, resolveApiUrl, resolveAuthTokenForApiUrl, resolveJobPresentation, resolvePromptAnswer, scorePromptChoiceMatch };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
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 } from './client-
|
|
2
|
-
export {
|
|
1
|
+
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 './client-Zoo8YITZ.js';
|
|
2
|
+
export { b5 as APIError, A as AccessTokenProvider, v as Assignment, w as AssignmentListResponse, L as Build, O as BuildListResponse, B as BuildPolicy, K as BuildStatus, C as ConnectOptions, al as ConversationAppendResult, ak as ConversationMessageInput, aj as ConversationMessageShowRefs, n as ConversationSessionInfo, z as CreateEnvironmentData, t as CreatePermissionProfileData, p as CreateSandboxData, aA as DefineRelationshipOptions, b6 as DeleteResponse, D as DomainState, a9 as EffectHandler, a6 as EffectInfo, a1 as EffectInvocationMetadata, a0 as EffectInvocationMode, a2 as EffectSchema, a3 as EffectWithHandler, a8 as EffectsChangedEvent, e as Environment, y as EnvironmentData, F as EnvironmentListResponse, aK as EnvironmentRecordImportSummary, G as Granular, k as GranularAuth, j as GranularOptions, b4 as GraphQLResult, aa as InstanceEffectHandler, I as InstanceToolHandler, ai as Job, af as JobFeedbackInput, ae as JobFeedbackMetadata, ag as JobFeedbackRecord, ac as JobFeedbackSentiment, ad as JobFeedbackToolCall, ab as JobStatus, ah as JobSubmitResult, H as Manifest, aW as ManifestApprovalRequiredSpec, b3 as ManifestContent, aU as ManifestDryRunSpec, aZ as ManifestEffectDeclaration, aY as ManifestEffectSchema, aN as ManifestEnumRuleSpec, a$ as ManifestEventStreamDef, a_ as ManifestEventTypeDef, aO as ManifestFilterBySpec, b1 as ManifestImport, J as ManifestListResponse, b0 as ManifestOperation, aT as ManifestPostConditionSpec, aL as ManifestPropertySpec, aX as ManifestRelationshipDef, aV as ManifestReverseSpec, aS as ManifestStateMachineSpec, aQ as ManifestStateMachineStateSpec, aR as ManifestStateMachineTransitionSpec, aM as ManifestValidationOperator, aP as ManifestValidationRuleSpec, b2 as ManifestVolume, ay as ModelRef, s as PermissionProfile, u as PermissionProfileListResponse, r as PermissionRules, a4 as PublishEffectsResult, h as PublishToolsResult, as as RPCRequest, av as RPCRequestFromServer, at as RPCResponse, aJ as RecordImport, aI as RecordImportItem, aG as RecordImportItemStatus, aH as RecordImportStats, aF as RecordImportStatus, aB as RecordObjectOptions, aC as RecordObjectResult, aD as RecordObjectsChunkInfo, aE as RecordObjectsOptions, l as RecordUserOptions, az as RelationshipInfo, $ as ResolvedEffectApprovalRequired, Z as ResolvedEffectDryRun, Y as ResolvedEffectPostCondition, _ as ResolvedEffectReverse, o as Sandbox, q as SandboxListResponse, X as SemanticVersionDiff, Q as SemanticVersionDiffEntry, f as Session, am as SessionHeapFieldType, an as SessionHeapFieldValue, ao as SessionHeapVariable, b7 as StreamEvent, b9 as StreamStats, b8 as StreamSubscription, m as Subject, au as SyncMessage, i as ToolHandler, a5 as ToolInfo, aw as ToolInvokeParams, ax as ToolResultParams, g as ToolSchema, a7 as ToolsChangedEvent, U as User, N as Version, x as VersionTag, V as VersionTracking, W as WSClient, ar as WSClientOptions, ap as WSDisconnectInfo, aq as WSReconnectErrorInfo } from './client-Zoo8YITZ.js';
|
|
3
3
|
export { BuildGranularAgentSystemPromptInput, GeneratedJobCodeIssue, GranularAgentExecutionCheckpoint, GranularAgentHeapSummaryOptions, GranularAgentSessionContext, GranularAgentToolInfo, GranularAgentWorkflowFocus, HarnessContinuationDecision, HarnessControllerBudgets, HarnessProjectionOptions, HarnessPromptLike, HarnessVerifierSnapshot, HarnessVerifierSnapshotInput, buildContinuationInstruction, buildGranularAgentCheckpointBlock, buildGranularAgentDomainBlock, buildGranularAgentHeapBlock, buildGranularAgentLoopBlock, buildGranularAgentSessionBlock, buildGranularAgentSystemPrompt, buildGranularAgentToolBlock, buildGranularAgentWorkflowBlock, createHarnessVerifierSnapshot, evaluateContinuation, getCurrentClosureId, getExclusivePromptTarget, hasOpenPrompt, projectHeapSummary, projectLoopSummary, projectWorkflowFocus, projectWorkflowSummary, reviewGeneratedJobCode } from './agent-harness.js';
|
|
4
4
|
import '@automerge/automerge';
|
|
5
5
|
import '@automerge/automerge/slim';
|
|
@@ -58,4 +58,9 @@ declare function normalizePromptType(raw: Record<string, unknown> | null | undef
|
|
|
58
58
|
declare function normalizePrompt(rawValue: unknown): Prompt | null;
|
|
59
59
|
declare function resolvePromptAnswer(prompt: Prompt | undefined, answer: unknown): unknown;
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
declare function buildSessionTranscript(input: {
|
|
62
|
+
liveDoc?: Record<string, unknown> | null;
|
|
63
|
+
sessionHeap?: SessionHeapSnapshot;
|
|
64
|
+
}): SessionTranscriptEntry[];
|
|
65
|
+
|
|
66
|
+
export { EffectHandlerContext, EndpointMode, type JobPresentation, ManifestEffectMetamodelSpec, Prompt, ResolvedEffectBehaviors, SessionHeapEntry, SessionHeapList, SessionHeapSnapshot, SessionTranscriptEntry, ToolWithHandler, buildSessionTranscript, extractPromptTokens, invokeRegisteredEffect, isLocalApiUrl, normalizeEffectBehaviors, normalizePrompt, normalizePromptText, normalizePromptType, resolveApiUrl, resolveAuthTokenForApiUrl, resolveJobPresentation, resolvePromptAnswer, scorePromptChoiceMatch };
|
package/dist/index.js
CHANGED
|
@@ -4610,6 +4610,22 @@ var Session = class {
|
|
|
4610
4610
|
}
|
|
4611
4611
|
};
|
|
4612
4612
|
}
|
|
4613
|
+
stringifyConversationValue(value) {
|
|
4614
|
+
if (typeof value === "string") {
|
|
4615
|
+
return value;
|
|
4616
|
+
}
|
|
4617
|
+
if (typeof value === "boolean") {
|
|
4618
|
+
return value ? "Confirmed" : "Canceled";
|
|
4619
|
+
}
|
|
4620
|
+
if (value === void 0) {
|
|
4621
|
+
return "";
|
|
4622
|
+
}
|
|
4623
|
+
try {
|
|
4624
|
+
return JSON.stringify(value, null, 2);
|
|
4625
|
+
} catch {
|
|
4626
|
+
return String(value);
|
|
4627
|
+
}
|
|
4628
|
+
}
|
|
4613
4629
|
// --- Public API ---
|
|
4614
4630
|
get document() {
|
|
4615
4631
|
return this.client.doc;
|
|
@@ -4760,6 +4776,20 @@ var Session = class {
|
|
|
4760
4776
|
answer: resolvedAnswer,
|
|
4761
4777
|
value: resolvedAnswer
|
|
4762
4778
|
});
|
|
4779
|
+
try {
|
|
4780
|
+
const content = this.stringifyConversationValue(resolvedAnswer);
|
|
4781
|
+
if (content.trim()) {
|
|
4782
|
+
await this.appendConversationMessage({
|
|
4783
|
+
role: "user",
|
|
4784
|
+
content,
|
|
4785
|
+
promptId
|
|
4786
|
+
});
|
|
4787
|
+
}
|
|
4788
|
+
} catch {
|
|
4789
|
+
}
|
|
4790
|
+
}
|
|
4791
|
+
async appendConversationMessage(input) {
|
|
4792
|
+
return this.client.call("conversation.append", input);
|
|
4763
4793
|
}
|
|
4764
4794
|
/**
|
|
4765
4795
|
* Get the current list of available effects.
|
|
@@ -14784,6 +14814,306 @@ function resolveJobPresentation({
|
|
|
14784
14814
|
};
|
|
14785
14815
|
}
|
|
14786
14816
|
|
|
14817
|
+
// src/session-transcript.ts
|
|
14818
|
+
var EMPTY_HEAP = {
|
|
14819
|
+
entriesByPath: {},
|
|
14820
|
+
listsByName: {},
|
|
14821
|
+
variablesByName: {}};
|
|
14822
|
+
function asRecord4(value) {
|
|
14823
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
14824
|
+
return value;
|
|
14825
|
+
}
|
|
14826
|
+
function asArray2(value) {
|
|
14827
|
+
return Array.isArray(value) ? value : [];
|
|
14828
|
+
}
|
|
14829
|
+
function asNumber(value) {
|
|
14830
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
14831
|
+
}
|
|
14832
|
+
function asString(value) {
|
|
14833
|
+
return typeof value === "string" ? value : void 0;
|
|
14834
|
+
}
|
|
14835
|
+
function trimString(value) {
|
|
14836
|
+
return typeof value === "string" ? value.trim() : "";
|
|
14837
|
+
}
|
|
14838
|
+
function normalizeShowRefs(value) {
|
|
14839
|
+
const record = asRecord4(value);
|
|
14840
|
+
if (!record) return void 0;
|
|
14841
|
+
const normalizeRefs = (input) => {
|
|
14842
|
+
if (!Array.isArray(input)) return void 0;
|
|
14843
|
+
const refs = Array.from(
|
|
14844
|
+
new Set(
|
|
14845
|
+
input.filter((item) => typeof item === "string").map((item) => item.trim()).filter(Boolean)
|
|
14846
|
+
)
|
|
14847
|
+
);
|
|
14848
|
+
return refs.length > 0 ? refs : void 0;
|
|
14849
|
+
};
|
|
14850
|
+
const show = {
|
|
14851
|
+
entryPaths: normalizeRefs(record.entryPaths),
|
|
14852
|
+
listNames: normalizeRefs(record.listNames),
|
|
14853
|
+
variableNames: normalizeRefs(record.variableNames)
|
|
14854
|
+
};
|
|
14855
|
+
return show.entryPaths || show.listNames || show.variableNames ? show : void 0;
|
|
14856
|
+
}
|
|
14857
|
+
function stringifyTranscriptValue(value, fallback = "") {
|
|
14858
|
+
if (typeof value === "string") {
|
|
14859
|
+
return value.trim() || fallback;
|
|
14860
|
+
}
|
|
14861
|
+
if (typeof value === "boolean") {
|
|
14862
|
+
return value ? "Confirmed" : "Canceled";
|
|
14863
|
+
}
|
|
14864
|
+
if (value === void 0) {
|
|
14865
|
+
return fallback;
|
|
14866
|
+
}
|
|
14867
|
+
try {
|
|
14868
|
+
const json = JSON.stringify(value, null, 2);
|
|
14869
|
+
if (!json || json === "undefined") return fallback;
|
|
14870
|
+
return json.length > 2e3 ? `${json.slice(0, 2e3)}...` : json;
|
|
14871
|
+
} catch {
|
|
14872
|
+
return String(value);
|
|
14873
|
+
}
|
|
14874
|
+
}
|
|
14875
|
+
function buildArtifactHistory(show) {
|
|
14876
|
+
if (!show) return void 0;
|
|
14877
|
+
return `[Agent message]
|
|
14878
|
+
${stringifyTranscriptValue({ show }, "")}`;
|
|
14879
|
+
}
|
|
14880
|
+
function normalizeConversationMessage(raw) {
|
|
14881
|
+
const record = asRecord4(raw);
|
|
14882
|
+
if (!record) return null;
|
|
14883
|
+
const role = record.role === "user" ? "user" : record.role === "assistant" ? "assistant" : null;
|
|
14884
|
+
if (!role) return null;
|
|
14885
|
+
const content = trimString(
|
|
14886
|
+
record.content ?? record.reply ?? record.message ?? record.text
|
|
14887
|
+
);
|
|
14888
|
+
const show = normalizeShowRefs(record.show);
|
|
14889
|
+
const id = asString(record.id) || crypto.randomUUID();
|
|
14890
|
+
const timestamp = asNumber(record.timestamp) || asNumber(record.ts) || 0;
|
|
14891
|
+
if (!content && !show) return null;
|
|
14892
|
+
return {
|
|
14893
|
+
id,
|
|
14894
|
+
role,
|
|
14895
|
+
content,
|
|
14896
|
+
timestamp,
|
|
14897
|
+
jobId: asString(record.jobId),
|
|
14898
|
+
promptId: asString(record.promptId),
|
|
14899
|
+
show,
|
|
14900
|
+
historyContent: role === "assistant" ? content ? `[Assistant reply]
|
|
14901
|
+
${content}` : buildArtifactHistory(show) : void 0,
|
|
14902
|
+
source: "conversation"
|
|
14903
|
+
};
|
|
14904
|
+
}
|
|
14905
|
+
function normalizePromptEntries(jobId, rawPrompts, conversationPromptIds) {
|
|
14906
|
+
const promptsById = asRecord4(rawPrompts) || {};
|
|
14907
|
+
return Object.values(promptsById).map((value) => asRecord4(value)).filter((value) => Boolean(value)).sort(
|
|
14908
|
+
(left, right) => (asNumber(left.openedAt) || asNumber(left.answeredAt) || 0) - (asNumber(right.openedAt) || asNumber(right.answeredAt) || 0)
|
|
14909
|
+
).flatMap((prompt) => {
|
|
14910
|
+
const promptId = asString(prompt.promptId);
|
|
14911
|
+
if (!promptId || conversationPromptIds.has(promptId)) return [];
|
|
14912
|
+
const title = trimString(prompt.title);
|
|
14913
|
+
const message = trimString(prompt.message);
|
|
14914
|
+
const assistantContent = message || title || "Input required";
|
|
14915
|
+
const openedAt = asNumber(prompt.openedAt) || 0;
|
|
14916
|
+
const answeredAt = asNumber(prompt.answeredAt) || openedAt;
|
|
14917
|
+
const entries = [
|
|
14918
|
+
{
|
|
14919
|
+
id: `prompt:${promptId}:assistant`,
|
|
14920
|
+
role: "assistant",
|
|
14921
|
+
content: assistantContent,
|
|
14922
|
+
timestamp: openedAt,
|
|
14923
|
+
jobId,
|
|
14924
|
+
promptId,
|
|
14925
|
+
historyContent: `[Assistant reply]
|
|
14926
|
+
${assistantContent}`,
|
|
14927
|
+
source: "job_prompt"
|
|
14928
|
+
}
|
|
14929
|
+
];
|
|
14930
|
+
if (Object.prototype.hasOwnProperty.call(prompt, "answer")) {
|
|
14931
|
+
entries.push({
|
|
14932
|
+
id: `prompt:${promptId}:user`,
|
|
14933
|
+
role: "user",
|
|
14934
|
+
content: stringifyTranscriptValue(prompt.answer, ""),
|
|
14935
|
+
timestamp: answeredAt,
|
|
14936
|
+
jobId,
|
|
14937
|
+
promptId,
|
|
14938
|
+
source: "job_prompt"
|
|
14939
|
+
});
|
|
14940
|
+
}
|
|
14941
|
+
return entries;
|
|
14942
|
+
});
|
|
14943
|
+
}
|
|
14944
|
+
function normalizeAgentMessageEntries(jobId, rawMessages) {
|
|
14945
|
+
return asArray2(rawMessages).map((value) => asRecord4(value)).filter((value) => Boolean(value)).sort(
|
|
14946
|
+
(left, right) => (asNumber(left.timestamp) || asNumber(left.ts) || 0) - (asNumber(right.timestamp) || asNumber(right.ts) || 0)
|
|
14947
|
+
).flatMap((message) => {
|
|
14948
|
+
const messageId = asString(message.messageId) || asString(message.id) || crypto.randomUUID();
|
|
14949
|
+
const timestamp = asNumber(message.timestamp) || asNumber(message.ts) || 0;
|
|
14950
|
+
const reply = trimString(
|
|
14951
|
+
message.reply ?? message.message ?? message.text ?? message.content
|
|
14952
|
+
);
|
|
14953
|
+
const show = normalizeShowRefs(message.show);
|
|
14954
|
+
const entries = [];
|
|
14955
|
+
if (reply) {
|
|
14956
|
+
entries.push({
|
|
14957
|
+
id: `agent:${messageId}:text`,
|
|
14958
|
+
role: "assistant",
|
|
14959
|
+
content: reply,
|
|
14960
|
+
timestamp,
|
|
14961
|
+
jobId,
|
|
14962
|
+
historyContent: `[Assistant reply]
|
|
14963
|
+
${reply}`,
|
|
14964
|
+
source: "job_agent_message"
|
|
14965
|
+
});
|
|
14966
|
+
}
|
|
14967
|
+
if (show) {
|
|
14968
|
+
entries.push({
|
|
14969
|
+
id: `agent:${messageId}:artifacts`,
|
|
14970
|
+
role: "assistant",
|
|
14971
|
+
content: "",
|
|
14972
|
+
timestamp,
|
|
14973
|
+
jobId,
|
|
14974
|
+
show,
|
|
14975
|
+
historyContent: buildArtifactHistory(show),
|
|
14976
|
+
source: "job_agent_message"
|
|
14977
|
+
});
|
|
14978
|
+
}
|
|
14979
|
+
return entries;
|
|
14980
|
+
});
|
|
14981
|
+
}
|
|
14982
|
+
function buildJobFallbackEntries(jobId, job, sessionHeap) {
|
|
14983
|
+
const timestamp = asNumber(job.finishedAt) || asNumber(job.startedAt) || asNumber(job.submittedAt) || 0;
|
|
14984
|
+
const resultPreview = stringifyTranscriptValue(
|
|
14985
|
+
job.result,
|
|
14986
|
+
"No job result recorded."
|
|
14987
|
+
);
|
|
14988
|
+
const presentation = resolveJobPresentation({
|
|
14989
|
+
jobId,
|
|
14990
|
+
result: job.result,
|
|
14991
|
+
stdout: [],
|
|
14992
|
+
sessionHeap
|
|
14993
|
+
});
|
|
14994
|
+
const entries = [];
|
|
14995
|
+
const responseText = presentation.responseText || "";
|
|
14996
|
+
if (responseText) {
|
|
14997
|
+
entries.push({
|
|
14998
|
+
id: `job:${jobId}:result-text`,
|
|
14999
|
+
role: "assistant",
|
|
15000
|
+
content: responseText,
|
|
15001
|
+
timestamp,
|
|
15002
|
+
jobId,
|
|
15003
|
+
historyContent: `[Assistant reply]
|
|
15004
|
+
${responseText}`,
|
|
15005
|
+
source: "job_result"
|
|
15006
|
+
});
|
|
15007
|
+
}
|
|
15008
|
+
const show = {
|
|
15009
|
+
entryPaths: presentation.entries.map((entry) => entry.path),
|
|
15010
|
+
listNames: presentation.lists.map((list) => list.name)
|
|
15011
|
+
};
|
|
15012
|
+
if (show.entryPaths && show.entryPaths.length > 0 || show.listNames && show.listNames.length > 0) {
|
|
15013
|
+
entries.push({
|
|
15014
|
+
id: `job:${jobId}:result-artifacts`,
|
|
15015
|
+
role: "assistant",
|
|
15016
|
+
content: "",
|
|
15017
|
+
timestamp,
|
|
15018
|
+
jobId,
|
|
15019
|
+
show,
|
|
15020
|
+
historyContent: buildArtifactHistory(show),
|
|
15021
|
+
source: "job_result"
|
|
15022
|
+
});
|
|
15023
|
+
}
|
|
15024
|
+
if (entries.length === 0 && trimString(job.error)) {
|
|
15025
|
+
entries.push({
|
|
15026
|
+
id: `job:${jobId}:result-error`,
|
|
15027
|
+
role: "assistant",
|
|
15028
|
+
content: trimString(job.error),
|
|
15029
|
+
timestamp,
|
|
15030
|
+
jobId,
|
|
15031
|
+
historyContent: `[Assistant reply]
|
|
15032
|
+
${trimString(job.error)}`,
|
|
15033
|
+
source: "job_result"
|
|
15034
|
+
});
|
|
15035
|
+
}
|
|
15036
|
+
if (entries.length === 0 && resultPreview && resultPreview !== "No job result recorded.") {
|
|
15037
|
+
entries.push({
|
|
15038
|
+
id: `job:${jobId}:result-preview`,
|
|
15039
|
+
role: "assistant",
|
|
15040
|
+
content: resultPreview,
|
|
15041
|
+
timestamp,
|
|
15042
|
+
jobId,
|
|
15043
|
+
historyContent: `[Assistant reply]
|
|
15044
|
+
${resultPreview}`,
|
|
15045
|
+
source: "job_result"
|
|
15046
|
+
});
|
|
15047
|
+
}
|
|
15048
|
+
return entries;
|
|
15049
|
+
}
|
|
15050
|
+
function buildJobCodeEntry(jobId, job) {
|
|
15051
|
+
const code = trimString(job.source);
|
|
15052
|
+
if (!code) return null;
|
|
15053
|
+
const jobStatus = asString(job.status);
|
|
15054
|
+
const error = jobStatus === "failed" || jobStatus === "canceled" || jobStatus === "timeout" ? trimString(job.error) || `Job ${jobStatus}` : void 0;
|
|
15055
|
+
return {
|
|
15056
|
+
id: `job:${jobId}:code`,
|
|
15057
|
+
role: "assistant",
|
|
15058
|
+
content: "",
|
|
15059
|
+
timestamp: asNumber(job.submittedAt) || asNumber(job.startedAt) || asNumber(job.finishedAt) || 0,
|
|
15060
|
+
jobId,
|
|
15061
|
+
code,
|
|
15062
|
+
jobStatus,
|
|
15063
|
+
jobResultPreview: stringifyTranscriptValue(job.result, "No job result recorded."),
|
|
15064
|
+
error,
|
|
15065
|
+
source: "job_code"
|
|
15066
|
+
};
|
|
15067
|
+
}
|
|
15068
|
+
function buildSessionTranscript(input) {
|
|
15069
|
+
const liveDoc = input.liveDoc || null;
|
|
15070
|
+
const sessionHeap = input.sessionHeap || EMPTY_HEAP;
|
|
15071
|
+
const transcript = [];
|
|
15072
|
+
const conversationMessages = asArray2(asRecord4(liveDoc?.conversation)?.messages).map((message) => normalizeConversationMessage(message)).filter((message) => Boolean(message));
|
|
15073
|
+
const conversationPromptIds = new Set(
|
|
15074
|
+
conversationMessages.map((message) => message.promptId).filter((promptId) => Boolean(promptId))
|
|
15075
|
+
);
|
|
15076
|
+
const assistantConversationJobIds = new Set(
|
|
15077
|
+
conversationMessages.filter((message) => message.role === "assistant" && Boolean(message.jobId)).map((message) => message.jobId)
|
|
15078
|
+
);
|
|
15079
|
+
transcript.push(...conversationMessages);
|
|
15080
|
+
const jobsById = asRecord4(asRecord4(liveDoc?.jobs)?.byId) || {};
|
|
15081
|
+
const jobs = Object.values(jobsById).map((value) => asRecord4(value)).filter((value) => Boolean(value)).sort(
|
|
15082
|
+
(left, right) => (asNumber(left.submittedAt) || asNumber(left.startedAt) || asNumber(left.finishedAt) || 0) - (asNumber(right.submittedAt) || asNumber(right.startedAt) || asNumber(right.finishedAt) || 0)
|
|
15083
|
+
);
|
|
15084
|
+
for (const job of jobs) {
|
|
15085
|
+
const jobId = asString(job.jobId);
|
|
15086
|
+
if (!jobId) continue;
|
|
15087
|
+
const codeEntry = buildJobCodeEntry(jobId, job);
|
|
15088
|
+
if (codeEntry) {
|
|
15089
|
+
transcript.push(codeEntry);
|
|
15090
|
+
}
|
|
15091
|
+
transcript.push(
|
|
15092
|
+
...normalizePromptEntries(jobId, job.prompts, conversationPromptIds)
|
|
15093
|
+
);
|
|
15094
|
+
if (!assistantConversationJobIds.has(jobId)) {
|
|
15095
|
+
const agentEntries = normalizeAgentMessageEntries(jobId, job.agentMessages);
|
|
15096
|
+
if (agentEntries.length > 0) {
|
|
15097
|
+
transcript.push(...agentEntries);
|
|
15098
|
+
} else {
|
|
15099
|
+
transcript.push(
|
|
15100
|
+
...buildJobFallbackEntries(
|
|
15101
|
+
jobId,
|
|
15102
|
+
job,
|
|
15103
|
+
sessionHeap
|
|
15104
|
+
)
|
|
15105
|
+
);
|
|
15106
|
+
}
|
|
15107
|
+
}
|
|
15108
|
+
}
|
|
15109
|
+
return transcript.sort((left, right) => {
|
|
15110
|
+
if (left.timestamp !== right.timestamp) {
|
|
15111
|
+
return left.timestamp - right.timestamp;
|
|
15112
|
+
}
|
|
15113
|
+
return left.id.localeCompare(right.id);
|
|
15114
|
+
});
|
|
15115
|
+
}
|
|
15116
|
+
|
|
14787
15117
|
exports.Environment = Environment;
|
|
14788
15118
|
exports.Granular = Granular;
|
|
14789
15119
|
exports.Session = Session;
|
|
@@ -14797,6 +15127,7 @@ exports.buildGranularAgentSessionBlock = buildGranularAgentSessionBlock;
|
|
|
14797
15127
|
exports.buildGranularAgentSystemPrompt = buildGranularAgentSystemPrompt;
|
|
14798
15128
|
exports.buildGranularAgentToolBlock = buildGranularAgentToolBlock;
|
|
14799
15129
|
exports.buildGranularAgentWorkflowBlock = buildGranularAgentWorkflowBlock;
|
|
15130
|
+
exports.buildSessionTranscript = buildSessionTranscript;
|
|
14800
15131
|
exports.createHarnessVerifierSnapshot = createHarnessVerifierSnapshot;
|
|
14801
15132
|
exports.evaluateContinuation = evaluateContinuation;
|
|
14802
15133
|
exports.extractPromptTokens = extractPromptTokens;
|