@granular-software/sdk 0.4.62 → 0.4.63
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 +2 -2
- package/dist/agent-evals.d.ts +2 -2
- package/dist/agent-evals.js +47 -26
- package/dist/agent-evals.js.map +1 -1
- package/dist/agent-evals.mjs +47 -26
- package/dist/agent-evals.mjs.map +1 -1
- package/dist/cli/index.js +79 -48
- package/dist/{client-Bx5jIDGB.d.ts → client-KqJIH7WE.d.ts} +3 -1
- package/dist/{client-Dg0I_5B_.d.mts → client-lk-dmdKR.d.mts} +3 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +47 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +47 -26
- package/dist/index.mjs.map +1 -1
- package/dist/{spend-C8OQnF6E.d.mts → spend-DtsHRNb5.d.mts} +10 -4
- package/dist/{spend-C8OQnF6E.d.ts → spend-DtsHRNb5.d.ts} +10 -4
- package/dist/spend.d.mts +1 -1
- package/dist/spend.d.ts +1 -1
- package/package.json +1 -1
package/dist/agent-evals.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as EnvironmentSession, G as Granular } from './client-
|
|
2
|
-
import { at as GranularSpendContext, ao as OpenAITokenSpend, P as Prompt,
|
|
1
|
+
import { a as EnvironmentSession, G as Granular } from './client-lk-dmdKR.mjs';
|
|
2
|
+
import { at as GranularSpendContext, ao as OpenAITokenSpend, P as Prompt, cY as RecordObjectOptions, dO as ManifestContent, d as SessionHeapSnapshot, T as ToolWithHandler, aP as ConnectOptions, be as CreateEnvironmentData, aI as GranularOptions } from './spend-DtsHRNb5.mjs';
|
|
3
3
|
import { GranularAgentToolInfo, GeneratedJobCodeIssue, BuildGranularAgentSystemPromptInput, HarnessRenderedPrompt, HarnessRenderedContinuation, HarnessControllerBudgets } from './agent-harness.mjs';
|
|
4
4
|
import '@automerge/automerge';
|
|
5
5
|
import '@automerge/automerge/slim';
|
package/dist/agent-evals.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as EnvironmentSession, G as Granular } from './client-
|
|
2
|
-
import { at as GranularSpendContext, ao as OpenAITokenSpend, P as Prompt,
|
|
1
|
+
import { a as EnvironmentSession, G as Granular } from './client-KqJIH7WE.js';
|
|
2
|
+
import { at as GranularSpendContext, ao as OpenAITokenSpend, P as Prompt, cY as RecordObjectOptions, dO as ManifestContent, d as SessionHeapSnapshot, T as ToolWithHandler, aP as ConnectOptions, be as CreateEnvironmentData, aI as GranularOptions } from './spend-DtsHRNb5.js';
|
|
3
3
|
import { GranularAgentToolInfo, GeneratedJobCodeIssue, BuildGranularAgentSystemPromptInput, HarnessRenderedPrompt, HarnessRenderedContinuation, HarnessControllerBudgets } from './agent-harness.js';
|
|
4
4
|
import '@automerge/automerge';
|
|
5
5
|
import '@automerge/automerge/slim';
|
package/dist/agent-evals.js
CHANGED
|
@@ -15234,7 +15234,6 @@ function buildEffectMetamodelMutations(toolPath, spec) {
|
|
|
15234
15234
|
// src/client.ts
|
|
15235
15235
|
var DEFAULT_CONVERSATION_SESSION_LIST_LIMIT = 100;
|
|
15236
15236
|
var MAX_CONVERSATION_SESSION_LIST_LIMIT = 500;
|
|
15237
|
-
var MAX_CONVERSATION_SESSION_LIST_OFFSET = 1e5;
|
|
15238
15237
|
function requireUserEnvironmentSequence(value, field) {
|
|
15239
15238
|
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0) {
|
|
15240
15239
|
throw new Error(
|
|
@@ -15614,6 +15613,10 @@ var Environment = class _Environment {
|
|
|
15614
15613
|
get sessions() {
|
|
15615
15614
|
return {
|
|
15616
15615
|
list: async (options = {}) => this.listSessions(options),
|
|
15616
|
+
page: async (options = {}) => this.granular.listSessionsPage({
|
|
15617
|
+
...options,
|
|
15618
|
+
environmentId: this.environmentId
|
|
15619
|
+
}),
|
|
15617
15620
|
create: async (options) => this.createSession(options),
|
|
15618
15621
|
connect: async (sessionId, options) => this.connectSession(sessionId, options),
|
|
15619
15622
|
reopen: async (sessionId, options) => this.reopenSession(sessionId, options),
|
|
@@ -15869,7 +15872,6 @@ var Environment = class _Environment {
|
|
|
15869
15872
|
headers: {
|
|
15870
15873
|
Authorization: `Bearer ${this._apiKey}`,
|
|
15871
15874
|
"Content-Type": "application/json",
|
|
15872
|
-
Connection: "close",
|
|
15873
15875
|
...options.headers
|
|
15874
15876
|
}
|
|
15875
15877
|
});
|
|
@@ -17393,8 +17395,7 @@ var EnvironmentSession = class extends Session {
|
|
|
17393
17395
|
method: "POST",
|
|
17394
17396
|
headers: {
|
|
17395
17397
|
"Content-Type": "application/json",
|
|
17396
|
-
Authorization: `Bearer ${this.environment.authToken}
|
|
17397
|
-
Connection: "close"
|
|
17398
|
+
Authorization: `Bearer ${this.environment.authToken}`
|
|
17398
17399
|
},
|
|
17399
17400
|
body: JSON.stringify({
|
|
17400
17401
|
reason: "sdk_disconnect_http_fallback",
|
|
@@ -18096,6 +18097,21 @@ var Granular = class _Granular {
|
|
|
18096
18097
|
* List indexed sessions using ownership filters and bounded pagination.
|
|
18097
18098
|
*/
|
|
18098
18099
|
async listSessions(options) {
|
|
18100
|
+
const items = [];
|
|
18101
|
+
let cursor = options.cursor?.trim() || void 0;
|
|
18102
|
+
let pageCount = 0;
|
|
18103
|
+
do {
|
|
18104
|
+
const page = await this.listSessionsPage({ ...options, cursor });
|
|
18105
|
+
items.push(...page.items);
|
|
18106
|
+
cursor = page.nextCursor || void 0;
|
|
18107
|
+
pageCount += 1;
|
|
18108
|
+
if (pageCount > 1e4) {
|
|
18109
|
+
throw new Error("Session pagination exceeded the safe page limit");
|
|
18110
|
+
}
|
|
18111
|
+
} while (cursor);
|
|
18112
|
+
return items;
|
|
18113
|
+
}
|
|
18114
|
+
async listSessionsPage(options) {
|
|
18099
18115
|
const environmentId = options.environmentId?.trim();
|
|
18100
18116
|
const sandboxId = options.sandboxId?.trim();
|
|
18101
18117
|
const subjectId = options.subjectId?.trim();
|
|
@@ -18123,17 +18139,14 @@ var Granular = class _Granular {
|
|
|
18123
18139
|
1,
|
|
18124
18140
|
MAX_CONVERSATION_SESSION_LIST_LIMIT
|
|
18125
18141
|
);
|
|
18126
|
-
const
|
|
18127
|
-
|
|
18128
|
-
"
|
|
18129
|
-
|
|
18130
|
-
0,
|
|
18131
|
-
MAX_CONVERSATION_SESSION_LIST_OFFSET
|
|
18132
|
-
);
|
|
18142
|
+
const cursor = options.cursor?.trim();
|
|
18143
|
+
if (options.cursor !== void 0 && !cursor) {
|
|
18144
|
+
throw new Error("Session list cursor must be a non-empty string.");
|
|
18145
|
+
}
|
|
18133
18146
|
const query = new URLSearchParams({
|
|
18134
|
-
limit: String(limit)
|
|
18135
|
-
offset: String(offset)
|
|
18147
|
+
limit: String(limit)
|
|
18136
18148
|
});
|
|
18149
|
+
if (cursor) query.set("cursor", cursor);
|
|
18137
18150
|
if (environmentId) query.set("environmentId", environmentId);
|
|
18138
18151
|
if (sandboxId) query.set("sandboxId", sandboxId);
|
|
18139
18152
|
if (subjectId) query.set("userId", subjectId);
|
|
@@ -18141,11 +18154,13 @@ var Granular = class _Granular {
|
|
|
18141
18154
|
query.set("sessionScope", options.sessionScope.trim());
|
|
18142
18155
|
}
|
|
18143
18156
|
if (status !== "all") query.set("status", status);
|
|
18144
|
-
const res = await this.request(
|
|
18145
|
-
|
|
18146
|
-
|
|
18147
|
-
|
|
18148
|
-
|
|
18157
|
+
const res = await this.request(`/control/sessions?${query.toString()}`);
|
|
18158
|
+
const items = Array.isArray(res.items) ? res.items.map((row) => this.normalizeConversationSession(row)) : [];
|
|
18159
|
+
const nextCursor = res.nextCursor ?? null;
|
|
18160
|
+
if (nextCursor === cursor) {
|
|
18161
|
+
throw new Error("Session pagination cursor did not advance");
|
|
18162
|
+
}
|
|
18163
|
+
return { items, nextCursor };
|
|
18149
18164
|
}
|
|
18150
18165
|
/**
|
|
18151
18166
|
* List active (open) sessions for an environment.
|
|
@@ -18172,9 +18187,6 @@ var Granular = class _Granular {
|
|
|
18172
18187
|
if (typeof options.limit === "number") {
|
|
18173
18188
|
query.set("limit", String(options.limit));
|
|
18174
18189
|
}
|
|
18175
|
-
if (typeof options.offset === "number") {
|
|
18176
|
-
query.set("offset", String(options.offset));
|
|
18177
|
-
}
|
|
18178
18190
|
const state = await this.request(
|
|
18179
18191
|
`/sdk/user-environment-state?${query.toString()}`
|
|
18180
18192
|
);
|
|
@@ -19108,10 +19120,20 @@ var Granular = class _Granular {
|
|
|
19108
19120
|
get environments() {
|
|
19109
19121
|
return {
|
|
19110
19122
|
list: async (sandboxId) => {
|
|
19111
|
-
const
|
|
19112
|
-
|
|
19113
|
-
|
|
19114
|
-
|
|
19123
|
+
const environments = [];
|
|
19124
|
+
let cursor = null;
|
|
19125
|
+
do {
|
|
19126
|
+
const query = cursor ? `?limit=100&cursor=${encodeURIComponent(cursor)}` : "";
|
|
19127
|
+
const result = await this.request(
|
|
19128
|
+
`/control/sandboxes/${sandboxId}/environments${query}`
|
|
19129
|
+
);
|
|
19130
|
+
environments.push(...result.items.map(normalizeEnvironmentData));
|
|
19131
|
+
if (result.nextCursor && result.nextCursor === cursor) {
|
|
19132
|
+
throw new Error("Environment pagination cursor did not advance");
|
|
19133
|
+
}
|
|
19134
|
+
cursor = result.nextCursor;
|
|
19135
|
+
} while (cursor);
|
|
19136
|
+
return environments;
|
|
19115
19137
|
},
|
|
19116
19138
|
get: async (environmentId) => {
|
|
19117
19139
|
return normalizeEnvironmentData(
|
|
@@ -19321,7 +19343,6 @@ var Granular = class _Granular {
|
|
|
19321
19343
|
headers: {
|
|
19322
19344
|
Authorization: `Bearer ${this.apiKey}`,
|
|
19323
19345
|
"Content-Type": "application/json",
|
|
19324
|
-
Connection: "close",
|
|
19325
19346
|
...options.headers
|
|
19326
19347
|
}
|
|
19327
19348
|
});
|