create-orcha 0.1.2 → 0.1.4
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/package.json +1 -1
- package/template/orcha/AGENTS.md +15 -5
- package/template/public/app.js +1 -1
- package/template/src/server.ts +37 -15
package/package.json
CHANGED
package/template/orcha/AGENTS.md
CHANGED
|
@@ -306,9 +306,11 @@ const evaluations = await execution.evaluations;
|
|
|
306
306
|
|
|
307
307
|
`run()` input fields:
|
|
308
308
|
|
|
309
|
-
- `content` (required): a non-empty string
|
|
310
|
-
|
|
311
|
-
|
|
309
|
+
- `content` (required): a non-empty string, one content item, or an array.
|
|
310
|
+
Use `{ filePath: "./document.pdf" }` for a local file or
|
|
311
|
+
`{ url: "https://example.com/document.pdf" }` for a remote file.
|
|
312
|
+
`mimeType` is optional when it can be inferred from the extension. Durable
|
|
313
|
+
events store local paths and MIME types, never encoded file bytes.
|
|
312
314
|
- `name` (optional): trimmed session label from 1 through 200 characters.
|
|
313
315
|
- `metadata` (optional): at most 50 fields with non-empty keys and finite
|
|
314
316
|
string, number, boolean, or null values. Metadata is durable and available
|
|
@@ -382,6 +384,10 @@ export default async function lookupAccount({ accountId }) {
|
|
|
382
384
|
}
|
|
383
385
|
```
|
|
384
386
|
|
|
387
|
+
Action entrypoints can use ordinary relative project imports, TypeScript
|
|
388
|
+
modules, npm packages, transitive dependencies, and standard exports. Orcha
|
|
389
|
+
bundles the complete import graph for development and production.
|
|
390
|
+
|
|
385
391
|
Client actions use `"execution": "client"` and do not include executable
|
|
386
392
|
code. Orcha pauses until the caller submits their results. Keep action names,
|
|
387
393
|
descriptions, schemas, and implementations aligned.
|
|
@@ -629,6 +635,7 @@ type ErrorData = {
|
|
|
629
635
|
|
|
630
636
|
type UserContent =
|
|
631
637
|
| { type: "text"; text: string }
|
|
638
|
+
| { type: "file"; filePath: string; mimeType: string }
|
|
632
639
|
| {
|
|
633
640
|
type: "image" | "video" | "audio" | "url";
|
|
634
641
|
mimeType: string;
|
|
@@ -972,8 +979,11 @@ offline production compilation. Neither command invokes a provider.
|
|
|
972
979
|
6. `load_skill` updates durable session instructions. Local actions execute
|
|
973
980
|
through the configured runtime. Client actions pause safely. Tool results
|
|
974
981
|
are reordered to match the model's original call order.
|
|
975
|
-
7. Internal agent tools start or continue linked child sessions.
|
|
976
|
-
|
|
982
|
+
7. Internal agent tools start or continue linked child sessions. A
|
|
983
|
+
`run_agent` input accepts the same text or multimodal content shape as a
|
|
984
|
+
normal run. Local file paths resolve from the configured Orcha project root.
|
|
985
|
+
The parent reports `waiting_for_subagent` until each synchronous child
|
|
986
|
+
call returns.
|
|
977
987
|
8. The model loop continues until final output, failure, a pause, or the
|
|
978
988
|
maximum of 10 action rounds.
|
|
979
989
|
9. Usage is normalized and aggregated across every model call in the run.
|
package/template/public/app.js
CHANGED
|
@@ -335,7 +335,7 @@ function setInputMode(mode) {
|
|
|
335
335
|
const structured = mode === "json";
|
|
336
336
|
element.prompt.classList.toggle("json-mode", structured);
|
|
337
337
|
element.prompt.placeholder = structured
|
|
338
|
-
? '[\n { "type": "text", "text": "
|
|
338
|
+
? '[\n { "type": "text", "text": "Summarize these files." },\n { "filePath": "./documents/report.pdf" },\n { "url": "https://example.com/supporting.pdf" }\n]'
|
|
339
339
|
: "Enter a message…";
|
|
340
340
|
element.inputHelp.textContent = structured
|
|
341
341
|
? "Enter the complete MessageContent[] JSON array."
|
package/template/src/server.ts
CHANGED
|
@@ -4,9 +4,11 @@ import { dirname, resolve } from "node:path";
|
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import {
|
|
6
6
|
orcha,
|
|
7
|
+
type AgentContentInput,
|
|
7
8
|
type AgentRuntime,
|
|
8
9
|
type Execution,
|
|
9
10
|
type MessageContent,
|
|
11
|
+
type MessageContentInput,
|
|
10
12
|
type OrchaClient,
|
|
11
13
|
type SessionEvent,
|
|
12
14
|
type ToolResult,
|
|
@@ -27,7 +29,7 @@ const playgroundConfiguration = JSON.parse(
|
|
|
27
29
|
description?: string;
|
|
28
30
|
examples?: Array<{
|
|
29
31
|
label: string;
|
|
30
|
-
content:
|
|
32
|
+
content: AgentContentInput;
|
|
31
33
|
}>;
|
|
32
34
|
}
|
|
33
35
|
>;
|
|
@@ -424,19 +426,41 @@ function requiredString(value: unknown, name: string): string {
|
|
|
424
426
|
return value.trim();
|
|
425
427
|
}
|
|
426
428
|
|
|
427
|
-
function parseContent(value: unknown):
|
|
429
|
+
function parseContent(value: unknown): AgentContentInput {
|
|
428
430
|
if (typeof value === "string") {
|
|
429
431
|
return requiredString(value, "content");
|
|
430
432
|
}
|
|
431
|
-
|
|
433
|
+
const items = Array.isArray(value) ? value : [value];
|
|
434
|
+
if (items.length === 0) {
|
|
432
435
|
throw new Error(
|
|
433
|
-
"content must be a non-empty string or
|
|
436
|
+
"content must be a non-empty string, content item, or content array.",
|
|
434
437
|
);
|
|
435
438
|
}
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
439
|
+
const parsed = items.map(parseContentItem);
|
|
440
|
+
return Array.isArray(value) ? parsed : parsed[0];
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
function parseContentItem(item: unknown): MessageContentInput {
|
|
444
|
+
if (!isRecord(item)) {
|
|
445
|
+
throw new Error("Every content item must be an object.");
|
|
446
|
+
}
|
|
447
|
+
if (typeof item.filePath === "string") {
|
|
448
|
+
return {
|
|
449
|
+
filePath: item.filePath,
|
|
450
|
+
...(typeof item.mimeType === "string"
|
|
451
|
+
? { mimeType: item.mimeType }
|
|
452
|
+
: {}),
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
if (typeof item.url === "string") {
|
|
456
|
+
return {
|
|
457
|
+
url: item.url,
|
|
458
|
+
...(typeof item.mimeType === "string"
|
|
459
|
+
? { mimeType: item.mimeType }
|
|
460
|
+
: {}),
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
if (typeof item.type === "string") {
|
|
440
464
|
if (item.type === "text" && typeof item.text === "string") {
|
|
441
465
|
return { type: "text", text: item.text };
|
|
442
466
|
}
|
|
@@ -451,10 +475,8 @@ function parseContent(value: unknown): string | MessageContent[] {
|
|
|
451
475
|
fileUri: item.fileUri,
|
|
452
476
|
};
|
|
453
477
|
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
);
|
|
457
|
-
});
|
|
478
|
+
}
|
|
479
|
+
throw new Error("Content item has invalid fields.");
|
|
458
480
|
}
|
|
459
481
|
|
|
460
482
|
function isFileContentType(
|
|
@@ -567,12 +589,12 @@ async function readAllSessionHistory(
|
|
|
567
589
|
};
|
|
568
590
|
}
|
|
569
591
|
|
|
570
|
-
function sessionNameFromContent(content:
|
|
592
|
+
function sessionNameFromContent(content: AgentContentInput): string {
|
|
571
593
|
const text = typeof content === "string"
|
|
572
594
|
? content
|
|
573
|
-
: content.find(
|
|
595
|
+
: (Array.isArray(content) ? content : [content]).find(
|
|
574
596
|
(item): item is Extract<MessageContent, { type: "text" }> =>
|
|
575
|
-
item.type === "text",
|
|
597
|
+
"type" in item && item.type === "text",
|
|
576
598
|
)?.text ?? "Untitled session";
|
|
577
599
|
const normalized = text.replace(/\s+/g, " ").trim();
|
|
578
600
|
return normalized.length > 64
|