@granular-software/sdk 0.4.18 → 0.4.19
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 +320 -0
- package/dist/agent-evals.d.ts +320 -0
- package/dist/agent-evals.js +15419 -0
- package/dist/agent-evals.js.map +1 -0
- package/dist/agent-evals.mjs +15385 -0
- package/dist/agent-evals.mjs.map +1 -0
- package/dist/agent-harness.d.mts +121 -0
- package/dist/agent-harness.d.ts +121 -0
- package/dist/agent-harness.js +986 -0
- package/dist/agent-harness.js.map +1 -0
- package/dist/agent-harness.mjs +966 -0
- package/dist/agent-harness.mjs.map +1 -0
- package/dist/cli/index.js +86 -13
- package/dist/client-BQw_gUK3.d.mts +1995 -0
- package/dist/client-BQw_gUK3.d.ts +1995 -0
- package/dist/index.d.mts +34 -1992
- package/dist/index.d.ts +34 -1992
- package/dist/index.js +1282 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1257 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -4
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
interface HarnessPromptLike {
|
|
2
|
+
id: string;
|
|
3
|
+
type?: string;
|
|
4
|
+
title?: string;
|
|
5
|
+
message?: string;
|
|
6
|
+
}
|
|
7
|
+
interface HarnessControllerBudgets {
|
|
8
|
+
maxIterations?: number;
|
|
9
|
+
maxNoProgressIterations?: number;
|
|
10
|
+
}
|
|
11
|
+
interface HarnessVerifierSnapshotInput {
|
|
12
|
+
finalCode?: string;
|
|
13
|
+
resultPreview?: string;
|
|
14
|
+
liveDoc: Record<string, unknown> | null;
|
|
15
|
+
projectionOptions?: HarnessProjectionOptions;
|
|
16
|
+
}
|
|
17
|
+
interface HarnessVerifierSnapshot {
|
|
18
|
+
codeDigest: string | null;
|
|
19
|
+
resultDigest: string | null;
|
|
20
|
+
heapDigest: string;
|
|
21
|
+
loopDigest: string;
|
|
22
|
+
}
|
|
23
|
+
interface HarnessContinuationDecision {
|
|
24
|
+
shouldContinue: boolean;
|
|
25
|
+
outcome: "continue" | "await_user" | "done" | "stalled" | "budget_exhausted";
|
|
26
|
+
reason: "workflow_closed" | "open_prompt" | "user_reply_complete" | "iteration_budget_exhausted" | "stalled_no_progress" | "progress_detected" | "no_prior_snapshot";
|
|
27
|
+
nextNoProgressCount: number;
|
|
28
|
+
}
|
|
29
|
+
interface GranularAgentSessionContext {
|
|
30
|
+
sandboxId?: string | null;
|
|
31
|
+
environmentId?: string | null;
|
|
32
|
+
userId?: string | null;
|
|
33
|
+
granularId?: string | null;
|
|
34
|
+
userName?: string | null;
|
|
35
|
+
domainRevision?: string | null;
|
|
36
|
+
}
|
|
37
|
+
interface GranularAgentToolInfo {
|
|
38
|
+
name: string;
|
|
39
|
+
description?: string;
|
|
40
|
+
className?: string;
|
|
41
|
+
static?: boolean;
|
|
42
|
+
ready?: boolean;
|
|
43
|
+
}
|
|
44
|
+
interface GranularAgentExecutionCheckpoint {
|
|
45
|
+
iteration?: number;
|
|
46
|
+
latestJobStatus?: string | null;
|
|
47
|
+
latestJobResult?: string | null;
|
|
48
|
+
latestJobError?: string | null;
|
|
49
|
+
latestActionSummary?: string[] | null;
|
|
50
|
+
controllerOutcome?: string | null;
|
|
51
|
+
controllerReason?: string | null;
|
|
52
|
+
noProgressCount?: number;
|
|
53
|
+
}
|
|
54
|
+
interface GranularAgentWorkflowFocus {
|
|
55
|
+
boundaryTimestamp: number;
|
|
56
|
+
boundaryReason: "session_start" | "last_closed_loop" | "request_start";
|
|
57
|
+
latestClosureId?: string | null;
|
|
58
|
+
activeTaskIds: string[];
|
|
59
|
+
openDecisionIds: string[];
|
|
60
|
+
openPromptIds: string[];
|
|
61
|
+
variableNames: string[];
|
|
62
|
+
listNames: string[];
|
|
63
|
+
entryPaths: string[];
|
|
64
|
+
recentActionSummary: string[];
|
|
65
|
+
}
|
|
66
|
+
interface GranularAgentHeapSummaryOptions {
|
|
67
|
+
focus?: Partial<Pick<GranularAgentWorkflowFocus, "variableNames" | "listNames" | "entryPaths">> | null;
|
|
68
|
+
maxVariables?: number;
|
|
69
|
+
maxLists?: number;
|
|
70
|
+
maxEntries?: number;
|
|
71
|
+
}
|
|
72
|
+
interface HarnessProjectionOptions {
|
|
73
|
+
boundaryTimestamp?: number | null;
|
|
74
|
+
}
|
|
75
|
+
interface BuildGranularAgentSystemPromptInput {
|
|
76
|
+
domainDocumentation?: string;
|
|
77
|
+
sessionContext?: GranularAgentSessionContext;
|
|
78
|
+
heapSummary?: string;
|
|
79
|
+
loopSummary?: string;
|
|
80
|
+
workflowSummary?: string;
|
|
81
|
+
tools?: GranularAgentToolInfo[];
|
|
82
|
+
checkpoint?: GranularAgentExecutionCheckpoint | null;
|
|
83
|
+
}
|
|
84
|
+
interface GeneratedJobCodeIssue {
|
|
85
|
+
code: "commonjs_require" | "placeholder_after_confirm" | "placeholder_after_ask_user" | "disambiguation_requires_choice" | "missing_user_reply";
|
|
86
|
+
severity: "error";
|
|
87
|
+
message: string;
|
|
88
|
+
}
|
|
89
|
+
declare function reviewGeneratedJobCode(code: string): GeneratedJobCodeIssue[];
|
|
90
|
+
declare function getCurrentClosureId(liveDoc: Record<string, unknown> | null): string | null;
|
|
91
|
+
declare function projectWorkflowFocus(liveDoc: Record<string, unknown> | null, pendingPrompts?: HarnessPromptLike[], options?: HarnessProjectionOptions): GranularAgentWorkflowFocus;
|
|
92
|
+
declare function projectWorkflowSummary(liveDoc: Record<string, unknown> | null, pendingPrompts?: HarnessPromptLike[], options?: HarnessProjectionOptions): string;
|
|
93
|
+
declare function hasOpenPrompt(liveDoc: Record<string, unknown> | null, pendingPrompts: HarnessPromptLike[]): boolean;
|
|
94
|
+
declare function getExclusivePromptTarget<T extends HarnessPromptLike>(pendingPrompts: T[]): T | null;
|
|
95
|
+
declare function projectLoopSummary(liveDoc: Record<string, unknown> | null, pendingPrompts?: HarnessPromptLike[], options?: HarnessProjectionOptions): string;
|
|
96
|
+
declare function projectHeapSummary(heap: unknown, options?: GranularAgentHeapSummaryOptions): string;
|
|
97
|
+
declare function createHarnessVerifierSnapshot(input: HarnessVerifierSnapshotInput): HarnessVerifierSnapshot;
|
|
98
|
+
declare function evaluateContinuation(input: {
|
|
99
|
+
iteration: number;
|
|
100
|
+
budgets?: HarnessControllerBudgets;
|
|
101
|
+
baselineClosureId: string | null;
|
|
102
|
+
currentClosureId: string | null;
|
|
103
|
+
liveDoc: Record<string, unknown> | null;
|
|
104
|
+
pendingPrompts: HarnessPromptLike[];
|
|
105
|
+
projectionOptions?: HarnessProjectionOptions;
|
|
106
|
+
latestResponseText?: string | null;
|
|
107
|
+
previousSnapshot?: HarnessVerifierSnapshot | null;
|
|
108
|
+
currentSnapshot: HarnessVerifierSnapshot;
|
|
109
|
+
previousNoProgressCount?: number;
|
|
110
|
+
}): HarnessContinuationDecision;
|
|
111
|
+
declare function buildContinuationInstruction(resultPreview?: string): string;
|
|
112
|
+
declare function buildGranularAgentDomainBlock(domainDocumentation?: string): string;
|
|
113
|
+
declare function buildGranularAgentSessionBlock(sessionContext?: GranularAgentSessionContext): string;
|
|
114
|
+
declare function buildGranularAgentHeapBlock(heapSummary?: string): string;
|
|
115
|
+
declare function buildGranularAgentLoopBlock(loopSummary?: string): string;
|
|
116
|
+
declare function buildGranularAgentWorkflowBlock(workflowSummary?: string): string;
|
|
117
|
+
declare function buildGranularAgentToolBlock(tools?: GranularAgentToolInfo[]): string;
|
|
118
|
+
declare function buildGranularAgentCheckpointBlock(checkpoint?: GranularAgentExecutionCheckpoint | null): string;
|
|
119
|
+
declare function buildGranularAgentSystemPrompt(input: BuildGranularAgentSystemPromptInput): string;
|
|
120
|
+
|
|
121
|
+
export { type BuildGranularAgentSystemPromptInput, type GeneratedJobCodeIssue, type GranularAgentExecutionCheckpoint, type GranularAgentHeapSummaryOptions, type GranularAgentSessionContext, type GranularAgentToolInfo, type GranularAgentWorkflowFocus, type HarnessContinuationDecision, type HarnessControllerBudgets, type HarnessProjectionOptions, type HarnessPromptLike, type HarnessVerifierSnapshot, type HarnessVerifierSnapshotInput, buildContinuationInstruction, buildGranularAgentCheckpointBlock, buildGranularAgentDomainBlock, buildGranularAgentHeapBlock, buildGranularAgentLoopBlock, buildGranularAgentSessionBlock, buildGranularAgentSystemPrompt, buildGranularAgentToolBlock, buildGranularAgentWorkflowBlock, createHarnessVerifierSnapshot, evaluateContinuation, getCurrentClosureId, getExclusivePromptTarget, hasOpenPrompt, projectHeapSummary, projectLoopSummary, projectWorkflowFocus, projectWorkflowSummary, reviewGeneratedJobCode };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
interface HarnessPromptLike {
|
|
2
|
+
id: string;
|
|
3
|
+
type?: string;
|
|
4
|
+
title?: string;
|
|
5
|
+
message?: string;
|
|
6
|
+
}
|
|
7
|
+
interface HarnessControllerBudgets {
|
|
8
|
+
maxIterations?: number;
|
|
9
|
+
maxNoProgressIterations?: number;
|
|
10
|
+
}
|
|
11
|
+
interface HarnessVerifierSnapshotInput {
|
|
12
|
+
finalCode?: string;
|
|
13
|
+
resultPreview?: string;
|
|
14
|
+
liveDoc: Record<string, unknown> | null;
|
|
15
|
+
projectionOptions?: HarnessProjectionOptions;
|
|
16
|
+
}
|
|
17
|
+
interface HarnessVerifierSnapshot {
|
|
18
|
+
codeDigest: string | null;
|
|
19
|
+
resultDigest: string | null;
|
|
20
|
+
heapDigest: string;
|
|
21
|
+
loopDigest: string;
|
|
22
|
+
}
|
|
23
|
+
interface HarnessContinuationDecision {
|
|
24
|
+
shouldContinue: boolean;
|
|
25
|
+
outcome: "continue" | "await_user" | "done" | "stalled" | "budget_exhausted";
|
|
26
|
+
reason: "workflow_closed" | "open_prompt" | "user_reply_complete" | "iteration_budget_exhausted" | "stalled_no_progress" | "progress_detected" | "no_prior_snapshot";
|
|
27
|
+
nextNoProgressCount: number;
|
|
28
|
+
}
|
|
29
|
+
interface GranularAgentSessionContext {
|
|
30
|
+
sandboxId?: string | null;
|
|
31
|
+
environmentId?: string | null;
|
|
32
|
+
userId?: string | null;
|
|
33
|
+
granularId?: string | null;
|
|
34
|
+
userName?: string | null;
|
|
35
|
+
domainRevision?: string | null;
|
|
36
|
+
}
|
|
37
|
+
interface GranularAgentToolInfo {
|
|
38
|
+
name: string;
|
|
39
|
+
description?: string;
|
|
40
|
+
className?: string;
|
|
41
|
+
static?: boolean;
|
|
42
|
+
ready?: boolean;
|
|
43
|
+
}
|
|
44
|
+
interface GranularAgentExecutionCheckpoint {
|
|
45
|
+
iteration?: number;
|
|
46
|
+
latestJobStatus?: string | null;
|
|
47
|
+
latestJobResult?: string | null;
|
|
48
|
+
latestJobError?: string | null;
|
|
49
|
+
latestActionSummary?: string[] | null;
|
|
50
|
+
controllerOutcome?: string | null;
|
|
51
|
+
controllerReason?: string | null;
|
|
52
|
+
noProgressCount?: number;
|
|
53
|
+
}
|
|
54
|
+
interface GranularAgentWorkflowFocus {
|
|
55
|
+
boundaryTimestamp: number;
|
|
56
|
+
boundaryReason: "session_start" | "last_closed_loop" | "request_start";
|
|
57
|
+
latestClosureId?: string | null;
|
|
58
|
+
activeTaskIds: string[];
|
|
59
|
+
openDecisionIds: string[];
|
|
60
|
+
openPromptIds: string[];
|
|
61
|
+
variableNames: string[];
|
|
62
|
+
listNames: string[];
|
|
63
|
+
entryPaths: string[];
|
|
64
|
+
recentActionSummary: string[];
|
|
65
|
+
}
|
|
66
|
+
interface GranularAgentHeapSummaryOptions {
|
|
67
|
+
focus?: Partial<Pick<GranularAgentWorkflowFocus, "variableNames" | "listNames" | "entryPaths">> | null;
|
|
68
|
+
maxVariables?: number;
|
|
69
|
+
maxLists?: number;
|
|
70
|
+
maxEntries?: number;
|
|
71
|
+
}
|
|
72
|
+
interface HarnessProjectionOptions {
|
|
73
|
+
boundaryTimestamp?: number | null;
|
|
74
|
+
}
|
|
75
|
+
interface BuildGranularAgentSystemPromptInput {
|
|
76
|
+
domainDocumentation?: string;
|
|
77
|
+
sessionContext?: GranularAgentSessionContext;
|
|
78
|
+
heapSummary?: string;
|
|
79
|
+
loopSummary?: string;
|
|
80
|
+
workflowSummary?: string;
|
|
81
|
+
tools?: GranularAgentToolInfo[];
|
|
82
|
+
checkpoint?: GranularAgentExecutionCheckpoint | null;
|
|
83
|
+
}
|
|
84
|
+
interface GeneratedJobCodeIssue {
|
|
85
|
+
code: "commonjs_require" | "placeholder_after_confirm" | "placeholder_after_ask_user" | "disambiguation_requires_choice" | "missing_user_reply";
|
|
86
|
+
severity: "error";
|
|
87
|
+
message: string;
|
|
88
|
+
}
|
|
89
|
+
declare function reviewGeneratedJobCode(code: string): GeneratedJobCodeIssue[];
|
|
90
|
+
declare function getCurrentClosureId(liveDoc: Record<string, unknown> | null): string | null;
|
|
91
|
+
declare function projectWorkflowFocus(liveDoc: Record<string, unknown> | null, pendingPrompts?: HarnessPromptLike[], options?: HarnessProjectionOptions): GranularAgentWorkflowFocus;
|
|
92
|
+
declare function projectWorkflowSummary(liveDoc: Record<string, unknown> | null, pendingPrompts?: HarnessPromptLike[], options?: HarnessProjectionOptions): string;
|
|
93
|
+
declare function hasOpenPrompt(liveDoc: Record<string, unknown> | null, pendingPrompts: HarnessPromptLike[]): boolean;
|
|
94
|
+
declare function getExclusivePromptTarget<T extends HarnessPromptLike>(pendingPrompts: T[]): T | null;
|
|
95
|
+
declare function projectLoopSummary(liveDoc: Record<string, unknown> | null, pendingPrompts?: HarnessPromptLike[], options?: HarnessProjectionOptions): string;
|
|
96
|
+
declare function projectHeapSummary(heap: unknown, options?: GranularAgentHeapSummaryOptions): string;
|
|
97
|
+
declare function createHarnessVerifierSnapshot(input: HarnessVerifierSnapshotInput): HarnessVerifierSnapshot;
|
|
98
|
+
declare function evaluateContinuation(input: {
|
|
99
|
+
iteration: number;
|
|
100
|
+
budgets?: HarnessControllerBudgets;
|
|
101
|
+
baselineClosureId: string | null;
|
|
102
|
+
currentClosureId: string | null;
|
|
103
|
+
liveDoc: Record<string, unknown> | null;
|
|
104
|
+
pendingPrompts: HarnessPromptLike[];
|
|
105
|
+
projectionOptions?: HarnessProjectionOptions;
|
|
106
|
+
latestResponseText?: string | null;
|
|
107
|
+
previousSnapshot?: HarnessVerifierSnapshot | null;
|
|
108
|
+
currentSnapshot: HarnessVerifierSnapshot;
|
|
109
|
+
previousNoProgressCount?: number;
|
|
110
|
+
}): HarnessContinuationDecision;
|
|
111
|
+
declare function buildContinuationInstruction(resultPreview?: string): string;
|
|
112
|
+
declare function buildGranularAgentDomainBlock(domainDocumentation?: string): string;
|
|
113
|
+
declare function buildGranularAgentSessionBlock(sessionContext?: GranularAgentSessionContext): string;
|
|
114
|
+
declare function buildGranularAgentHeapBlock(heapSummary?: string): string;
|
|
115
|
+
declare function buildGranularAgentLoopBlock(loopSummary?: string): string;
|
|
116
|
+
declare function buildGranularAgentWorkflowBlock(workflowSummary?: string): string;
|
|
117
|
+
declare function buildGranularAgentToolBlock(tools?: GranularAgentToolInfo[]): string;
|
|
118
|
+
declare function buildGranularAgentCheckpointBlock(checkpoint?: GranularAgentExecutionCheckpoint | null): string;
|
|
119
|
+
declare function buildGranularAgentSystemPrompt(input: BuildGranularAgentSystemPromptInput): string;
|
|
120
|
+
|
|
121
|
+
export { type BuildGranularAgentSystemPromptInput, type GeneratedJobCodeIssue, type GranularAgentExecutionCheckpoint, type GranularAgentHeapSummaryOptions, type GranularAgentSessionContext, type GranularAgentToolInfo, type GranularAgentWorkflowFocus, type HarnessContinuationDecision, type HarnessControllerBudgets, type HarnessProjectionOptions, type HarnessPromptLike, type HarnessVerifierSnapshot, type HarnessVerifierSnapshotInput, buildContinuationInstruction, buildGranularAgentCheckpointBlock, buildGranularAgentDomainBlock, buildGranularAgentHeapBlock, buildGranularAgentLoopBlock, buildGranularAgentSessionBlock, buildGranularAgentSystemPrompt, buildGranularAgentToolBlock, buildGranularAgentWorkflowBlock, createHarnessVerifierSnapshot, evaluateContinuation, getCurrentClosureId, getExclusivePromptTarget, hasOpenPrompt, projectHeapSummary, projectLoopSummary, projectWorkflowFocus, projectWorkflowSummary, reviewGeneratedJobCode };
|