@standardagents/builder 0.11.0 → 0.11.2
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/built-in-routes.js +167 -14
- package/dist/built-in-routes.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +158 -8
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/built-in-routes.js
CHANGED
|
@@ -13513,14 +13513,13 @@ function transformAssistantMessage2(msg) {
|
|
|
13513
13513
|
items.push(reasoningItem);
|
|
13514
13514
|
}
|
|
13515
13515
|
}
|
|
13516
|
-
|
|
13517
|
-
if (msg.content || hasToolCalls) {
|
|
13516
|
+
if (msg.content) {
|
|
13518
13517
|
const outputMessage = {
|
|
13519
13518
|
type: "message",
|
|
13520
13519
|
role: "assistant",
|
|
13521
13520
|
id: "",
|
|
13522
13521
|
status: "completed",
|
|
13523
|
-
content:
|
|
13522
|
+
content: [{ type: "output_text", text: msg.content, annotations: [] }]
|
|
13524
13523
|
};
|
|
13525
13524
|
items.push(outputMessage);
|
|
13526
13525
|
}
|
|
@@ -13528,9 +13527,13 @@ function transformAssistantMessage2(msg) {
|
|
|
13528
13527
|
for (const tc of msg.toolCalls) {
|
|
13529
13528
|
const functionCall = {
|
|
13530
13529
|
type: "function_call",
|
|
13530
|
+
id: `fc_${tc.id}`,
|
|
13531
|
+
// Unique output item ID (prefixed to distinguish from call_id)
|
|
13531
13532
|
call_id: tc.id,
|
|
13532
13533
|
name: tc.name,
|
|
13533
|
-
arguments: JSON.stringify(tc.arguments)
|
|
13534
|
+
arguments: JSON.stringify(tc.arguments),
|
|
13535
|
+
status: "completed"
|
|
13536
|
+
// Mark as completed since this is from history
|
|
13534
13537
|
};
|
|
13535
13538
|
items.push(functionCall);
|
|
13536
13539
|
}
|
|
@@ -16528,7 +16531,10 @@ __export(files_exports2, {
|
|
|
16528
16531
|
rowToFileRecord: () => rowToFileRecord
|
|
16529
16532
|
});
|
|
16530
16533
|
function isTextMimeType(mimeType) {
|
|
16531
|
-
|
|
16534
|
+
if (mimeType.startsWith("text/")) return true;
|
|
16535
|
+
return TEXT_APPLICATION_TYPES.some(
|
|
16536
|
+
(type) => mimeType === type || mimeType.startsWith(type + ";")
|
|
16537
|
+
);
|
|
16532
16538
|
}
|
|
16533
16539
|
function detectStorageBackend(location) {
|
|
16534
16540
|
if (location.startsWith("s3://")) return "s3";
|
|
@@ -16605,17 +16611,67 @@ function inferMimeType(filename) {
|
|
|
16605
16611
|
};
|
|
16606
16612
|
return mimeTypes[ext || ""] || "application/octet-stream";
|
|
16607
16613
|
}
|
|
16608
|
-
var CHUNK_SIZE2,
|
|
16614
|
+
var CHUNK_SIZE2, TEXT_APPLICATION_TYPES, FileStorage;
|
|
16609
16615
|
var init_files2 = __esm({
|
|
16610
16616
|
"src/durable-objects/files.ts"() {
|
|
16611
16617
|
CHUNK_SIZE2 = 1.75 * 1024 * 1024;
|
|
16612
|
-
|
|
16613
|
-
|
|
16618
|
+
TEXT_APPLICATION_TYPES = [
|
|
16619
|
+
// Data formats
|
|
16614
16620
|
"application/json",
|
|
16615
|
-
"application/
|
|
16621
|
+
"application/ld+json",
|
|
16622
|
+
"application/json5",
|
|
16623
|
+
"application/jsonl",
|
|
16624
|
+
"application/x-ndjson",
|
|
16616
16625
|
"application/xml",
|
|
16626
|
+
"application/xhtml+xml",
|
|
16627
|
+
"application/rss+xml",
|
|
16628
|
+
"application/atom+xml",
|
|
16629
|
+
"application/soap+xml",
|
|
16630
|
+
"application/yaml",
|
|
16617
16631
|
"application/x-yaml",
|
|
16618
|
-
"application/
|
|
16632
|
+
"application/toml",
|
|
16633
|
+
"application/x-toml",
|
|
16634
|
+
// Programming languages
|
|
16635
|
+
"application/javascript",
|
|
16636
|
+
"application/x-javascript",
|
|
16637
|
+
"application/ecmascript",
|
|
16638
|
+
"application/typescript",
|
|
16639
|
+
"application/x-typescript",
|
|
16640
|
+
"application/x-python",
|
|
16641
|
+
"application/x-ruby",
|
|
16642
|
+
"application/x-perl",
|
|
16643
|
+
"application/x-php",
|
|
16644
|
+
"application/x-sh",
|
|
16645
|
+
"application/x-bash",
|
|
16646
|
+
"application/x-csh",
|
|
16647
|
+
"application/x-zsh",
|
|
16648
|
+
"application/x-powershell",
|
|
16649
|
+
"application/x-lua",
|
|
16650
|
+
"application/x-tcl",
|
|
16651
|
+
// Query/config languages
|
|
16652
|
+
"application/sql",
|
|
16653
|
+
"application/x-sql",
|
|
16654
|
+
"application/graphql",
|
|
16655
|
+
"application/x-graphql",
|
|
16656
|
+
"application/sparql-query",
|
|
16657
|
+
"application/sparql-results+json",
|
|
16658
|
+
"application/sparql-results+xml",
|
|
16659
|
+
// Markup/templates
|
|
16660
|
+
"application/x-httpd-php",
|
|
16661
|
+
"application/x-latex",
|
|
16662
|
+
"application/x-tex",
|
|
16663
|
+
"application/rtf",
|
|
16664
|
+
"application/xslt+xml",
|
|
16665
|
+
// Web
|
|
16666
|
+
"application/x-www-form-urlencoded",
|
|
16667
|
+
"application/manifest+json",
|
|
16668
|
+
"application/webmanifest+json",
|
|
16669
|
+
"application/x-web-app-manifest+json",
|
|
16670
|
+
// Config files
|
|
16671
|
+
"application/x-ini",
|
|
16672
|
+
"application/x-properties",
|
|
16673
|
+
"application/plist",
|
|
16674
|
+
"application/x-plist"
|
|
16619
16675
|
];
|
|
16620
16676
|
FileStorage = class {
|
|
16621
16677
|
constructor(sql) {
|
|
@@ -20446,8 +20502,105 @@ var init_ThreadStateImpl = __esm({
|
|
|
20446
20502
|
// File System
|
|
20447
20503
|
// ─────────────────────────────────────────────────────────────────────────
|
|
20448
20504
|
async writeFile(path, data, mimeType, options) {
|
|
20449
|
-
const
|
|
20450
|
-
|
|
20505
|
+
const isText = this._isTextMimeType(mimeType);
|
|
20506
|
+
if (isText) {
|
|
20507
|
+
let textContent;
|
|
20508
|
+
if (typeof data === "string") {
|
|
20509
|
+
textContent = data;
|
|
20510
|
+
} else {
|
|
20511
|
+
textContent = new TextDecoder().decode(data);
|
|
20512
|
+
}
|
|
20513
|
+
const result = await this._threadInstance.writeTextFile(path, textContent, mimeType, options);
|
|
20514
|
+
return this._mapFileRecord(result.file);
|
|
20515
|
+
} else {
|
|
20516
|
+
let base64Data;
|
|
20517
|
+
if (typeof data === "string") {
|
|
20518
|
+
const encoder = new TextEncoder();
|
|
20519
|
+
const bytes = encoder.encode(data);
|
|
20520
|
+
let binary = "";
|
|
20521
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
20522
|
+
binary += String.fromCharCode(bytes[i]);
|
|
20523
|
+
}
|
|
20524
|
+
base64Data = btoa(binary);
|
|
20525
|
+
} else {
|
|
20526
|
+
const bytes = new Uint8Array(data);
|
|
20527
|
+
let binary = "";
|
|
20528
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
20529
|
+
binary += String.fromCharCode(bytes[i]);
|
|
20530
|
+
}
|
|
20531
|
+
base64Data = btoa(binary);
|
|
20532
|
+
}
|
|
20533
|
+
const result = await this._threadInstance.writeFile(path, base64Data, mimeType, options);
|
|
20534
|
+
return this._mapFileRecord(result.file);
|
|
20535
|
+
}
|
|
20536
|
+
}
|
|
20537
|
+
/**
|
|
20538
|
+
* Check if a MIME type should be stored as searchable text.
|
|
20539
|
+
* Matches the logic in FileStorage for consistency.
|
|
20540
|
+
*/
|
|
20541
|
+
_isTextMimeType(mimeType) {
|
|
20542
|
+
if (mimeType.startsWith("text/")) return true;
|
|
20543
|
+
const TEXT_APPLICATION_TYPES2 = [
|
|
20544
|
+
// Data formats
|
|
20545
|
+
"application/json",
|
|
20546
|
+
"application/ld+json",
|
|
20547
|
+
"application/json5",
|
|
20548
|
+
"application/jsonl",
|
|
20549
|
+
"application/x-ndjson",
|
|
20550
|
+
"application/xml",
|
|
20551
|
+
"application/xhtml+xml",
|
|
20552
|
+
"application/rss+xml",
|
|
20553
|
+
"application/atom+xml",
|
|
20554
|
+
"application/soap+xml",
|
|
20555
|
+
"application/yaml",
|
|
20556
|
+
"application/x-yaml",
|
|
20557
|
+
"application/toml",
|
|
20558
|
+
"application/x-toml",
|
|
20559
|
+
// Programming languages
|
|
20560
|
+
"application/javascript",
|
|
20561
|
+
"application/x-javascript",
|
|
20562
|
+
"application/ecmascript",
|
|
20563
|
+
"application/typescript",
|
|
20564
|
+
"application/x-typescript",
|
|
20565
|
+
"application/x-python",
|
|
20566
|
+
"application/x-ruby",
|
|
20567
|
+
"application/x-perl",
|
|
20568
|
+
"application/x-php",
|
|
20569
|
+
"application/x-sh",
|
|
20570
|
+
"application/x-bash",
|
|
20571
|
+
"application/x-csh",
|
|
20572
|
+
"application/x-zsh",
|
|
20573
|
+
"application/x-powershell",
|
|
20574
|
+
"application/x-lua",
|
|
20575
|
+
"application/x-tcl",
|
|
20576
|
+
// Query/config languages
|
|
20577
|
+
"application/sql",
|
|
20578
|
+
"application/x-sql",
|
|
20579
|
+
"application/graphql",
|
|
20580
|
+
"application/x-graphql",
|
|
20581
|
+
"application/sparql-query",
|
|
20582
|
+
"application/sparql-results+json",
|
|
20583
|
+
"application/sparql-results+xml",
|
|
20584
|
+
// Markup/templates
|
|
20585
|
+
"application/x-httpd-php",
|
|
20586
|
+
"application/x-latex",
|
|
20587
|
+
"application/x-tex",
|
|
20588
|
+
"application/rtf",
|
|
20589
|
+
"application/xslt+xml",
|
|
20590
|
+
// Web
|
|
20591
|
+
"application/x-www-form-urlencoded",
|
|
20592
|
+
"application/manifest+json",
|
|
20593
|
+
"application/webmanifest+json",
|
|
20594
|
+
"application/x-web-app-manifest+json",
|
|
20595
|
+
// Config files
|
|
20596
|
+
"application/x-ini",
|
|
20597
|
+
"application/x-properties",
|
|
20598
|
+
"application/plist",
|
|
20599
|
+
"application/x-plist"
|
|
20600
|
+
];
|
|
20601
|
+
return TEXT_APPLICATION_TYPES2.some(
|
|
20602
|
+
(type) => mimeType === type || mimeType.startsWith(type + ";")
|
|
20603
|
+
);
|
|
20451
20604
|
}
|
|
20452
20605
|
async readFile(path) {
|
|
20453
20606
|
const result = await this._threadInstance.readFile(path);
|
|
@@ -24279,8 +24432,8 @@ var provider_get_default = defineController(async ({ req, params, env: env2 }) =
|
|
|
24279
24432
|
}
|
|
24280
24433
|
return {
|
|
24281
24434
|
role: "tool",
|
|
24282
|
-
toolCallId: msg.tool_call_id ?? "",
|
|
24283
|
-
toolName: msg.name ?? "",
|
|
24435
|
+
toolCallId: msg.toolCallId ?? msg.tool_call_id ?? "",
|
|
24436
|
+
toolName: msg.toolName ?? msg.name ?? "",
|
|
24284
24437
|
content: typeof msg.content === "string" ? msg.content : "",
|
|
24285
24438
|
attachments: loadedAttachments
|
|
24286
24439
|
};
|