orchajs 0.17.0 → 0.19.0
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/README.md +70 -9
- package/dist/amarsia/metadata.d.ts +0 -1
- package/dist/amarsia/metadata.js +0 -1
- package/dist/amarsia/sync.d.ts +0 -1
- package/dist/amarsia/sync.js +0 -1
- package/dist/cli-agents-template.d.ts +0 -1
- package/dist/cli-agents-template.js +0 -1
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +4 -5
- package/dist/compiler/build-project.d.ts +0 -1
- package/dist/compiler/build-project.js +2 -3
- package/dist/compiler/compile.d.ts +0 -1
- package/dist/compiler/compile.js +0 -1
- package/dist/env.d.ts +0 -1
- package/dist/env.js +5 -3
- package/dist/errors.d.ts +0 -1
- package/dist/errors.js +0 -1
- package/dist/file-content.d.ts +0 -1
- package/dist/file-content.js +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/integrations/esbuild.d.ts +0 -1
- package/dist/integrations/esbuild.js +0 -1
- package/dist/orcha.d.ts +0 -1
- package/dist/orcha.js +0 -1
- package/dist/playground/public/app.css +0 -1
- package/dist/playground/public/app.js +9 -10
- package/dist/playground/server.d.ts +0 -1
- package/dist/playground/server.js +9 -5
- package/dist/playground/source.d.ts +0 -1
- package/dist/playground/source.js +0 -1
- package/dist/project-loader.d.ts +0 -1
- package/dist/project-loader.js +1 -2
- package/dist/providers/anthropic.d.ts +0 -1
- package/dist/providers/anthropic.js +0 -1
- package/dist/providers/bedrock.d.ts +0 -1
- package/dist/providers/bedrock.js +0 -1
- package/dist/providers/catalog.d.ts +0 -1
- package/dist/providers/catalog.js +0 -1
- package/dist/providers/deepseek.d.ts +0 -1
- package/dist/providers/deepseek.js +0 -1
- package/dist/providers/dispatcher.d.ts +0 -1
- package/dist/providers/dispatcher.js +0 -1
- package/dist/providers/google-gemini.d.ts +67 -5
- package/dist/providers/google-gemini.js +13 -3
- package/dist/providers/google-genai.d.ts +0 -1
- package/dist/providers/google-genai.js +2 -3
- package/dist/providers/index.d.ts +0 -1
- package/dist/providers/index.js +27 -2
- package/dist/providers/openai.d.ts +0 -1
- package/dist/providers/openai.js +0 -1
- package/dist/providers/sse.d.ts +0 -1
- package/dist/providers/sse.js +0 -1
- package/dist/providers/types.d.ts +0 -1
- package/dist/providers/types.js +0 -1
- package/dist/providers/vertex-ai.d.ts +0 -1
- package/dist/providers/vertex-ai.js +2 -3
- package/dist/runtime/actions/context.d.ts +0 -1
- package/dist/runtime/actions/context.js +25 -2
- package/dist/runtime/actions/execute.d.ts +0 -1
- package/dist/runtime/actions/execute.js +14 -2
- package/dist/runtime/actions/native.d.ts +0 -1
- package/dist/runtime/actions/native.js +0 -1
- package/dist/runtime/actions/sandbox.d.ts +0 -1
- package/dist/runtime/actions/sandbox.js +0 -1
- package/dist/runtime/agent.d.ts +0 -1
- package/dist/runtime/agent.js +0 -1
- package/dist/runtime/context.d.ts +0 -1
- package/dist/runtime/context.js +0 -1
- package/dist/runtime/create-orcha.d.ts +0 -1
- package/dist/runtime/create-orcha.js +0 -1
- package/dist/runtime/execution.d.ts +0 -1
- package/dist/runtime/execution.js +0 -1
- package/dist/runtime/session-events.d.ts +0 -1
- package/dist/runtime/session-events.js +0 -1
- package/dist/runtime/structured-output.d.ts +0 -1
- package/dist/runtime/structured-output.js +0 -1
- package/dist/storage/browser-indexeddb.d.ts +0 -1
- package/dist/storage/browser-indexeddb.js +0 -1
- package/dist/storage/create-store.d.ts +0 -1
- package/dist/storage/create-store.js +0 -1
- package/dist/storage/edge-store.d.ts +0 -1
- package/dist/storage/edge-store.js +0 -1
- package/dist/storage/migrate.d.ts +0 -1
- package/dist/storage/migrate.js +0 -1
- package/dist/storage/node-jsonl.d.ts +0 -1
- package/dist/storage/node-jsonl.js +0 -1
- package/dist/storage/node-sqlite.d.ts +0 -1
- package/dist/storage/node-sqlite.js +1 -2
- package/dist/storage/react-native-jsonl.d.ts +0 -1
- package/dist/storage/react-native-jsonl.js +0 -1
- package/dist/testing.d.ts +0 -1
- package/dist/testing.js +0 -1
- package/dist/types.d.ts +0 -1
- package/dist/types.js +0 -1
- package/dist-cjs/amarsia/metadata.js +18 -19
- package/dist-cjs/amarsia/sync.js +1 -2
- package/dist-cjs/cli-agents-template.js +1 -2
- package/dist-cjs/compiler/build-project.js +24 -25
- package/dist-cjs/compiler/compile.js +31 -32
- package/dist-cjs/env.js +10 -8
- package/dist-cjs/errors.js +1 -2
- package/dist-cjs/file-content.js +6 -7
- package/dist-cjs/index.js +1 -2
- package/dist-cjs/integrations/esbuild.js +4 -5
- package/dist-cjs/orcha.js +4 -5
- package/dist-cjs/playground/server.js +34 -31
- package/dist-cjs/playground/source.js +11 -12
- package/dist-cjs/project-loader.js +11 -12
- package/dist-cjs/providers/anthropic.js +1 -2
- package/dist-cjs/providers/bedrock.js +8 -9
- package/dist-cjs/providers/catalog.js +1 -2
- package/dist-cjs/providers/deepseek.js +1 -2
- package/dist-cjs/providers/dispatcher.js +1 -2
- package/dist-cjs/providers/google-gemini.js +13 -4
- package/dist-cjs/providers/google-genai.js +2 -3
- package/dist-cjs/providers/index.js +25 -2
- package/dist-cjs/providers/openai.js +1 -2
- package/dist-cjs/providers/sse.js +1 -2
- package/dist-cjs/providers/types.js +1 -2
- package/dist-cjs/providers/vertex-ai.js +6 -3
- package/dist-cjs/runtime/actions/context.js +26 -3
- package/dist-cjs/runtime/actions/execute.js +17 -3
- package/dist-cjs/runtime/actions/native.js +3 -4
- package/dist-cjs/runtime/actions/sandbox.js +1 -2
- package/dist-cjs/runtime/agent.js +3 -4
- package/dist-cjs/runtime/context.js +1 -2
- package/dist-cjs/runtime/create-orcha.js +3 -4
- package/dist-cjs/runtime/execution.js +1 -2
- package/dist-cjs/runtime/session-events.js +1 -2
- package/dist-cjs/runtime/structured-output.js +1 -2
- package/dist-cjs/storage/browser-indexeddb.js +1 -2
- package/dist-cjs/storage/create-store.js +1 -2
- package/dist-cjs/storage/edge-store.js +1 -2
- package/dist-cjs/storage/migrate.js +1 -2
- package/dist-cjs/storage/node-jsonl.js +10 -11
- package/dist-cjs/storage/node-sqlite.js +8 -9
- package/dist-cjs/storage/react-native-jsonl.js +1 -2
- package/dist-cjs/testing.js +17 -18
- package/dist-cjs/types/google-genai-sdk.d.js +2 -0
- package/dist-cjs/types.js +1 -2
- package/package.json +40 -12
- package/dist/amarsia/metadata.d.ts.map +0 -1
- package/dist/amarsia/metadata.js.map +0 -1
- package/dist/amarsia/sync.d.ts.map +0 -1
- package/dist/amarsia/sync.js.map +0 -1
- package/dist/cli-agents-template.d.ts.map +0 -1
- package/dist/cli-agents-template.js.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/compiler/build-project.d.ts.map +0 -1
- package/dist/compiler/build-project.js.map +0 -1
- package/dist/compiler/compile.d.ts.map +0 -1
- package/dist/compiler/compile.js.map +0 -1
- package/dist/env.d.ts.map +0 -1
- package/dist/env.js.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js.map +0 -1
- package/dist/file-content.d.ts.map +0 -1
- package/dist/file-content.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/integrations/esbuild.d.ts.map +0 -1
- package/dist/integrations/esbuild.js.map +0 -1
- package/dist/orcha.d.ts.map +0 -1
- package/dist/orcha.js.map +0 -1
- package/dist/playground/public/app.css.map +0 -7
- package/dist/playground/public/app.js.map +0 -7
- package/dist/playground/server.d.ts.map +0 -1
- package/dist/playground/server.js.map +0 -1
- package/dist/playground/source.d.ts.map +0 -1
- package/dist/playground/source.js.map +0 -1
- package/dist/project-loader.d.ts.map +0 -1
- package/dist/project-loader.js.map +0 -1
- package/dist/providers/anthropic.d.ts.map +0 -1
- package/dist/providers/anthropic.js.map +0 -1
- package/dist/providers/bedrock.d.ts.map +0 -1
- package/dist/providers/bedrock.js.map +0 -1
- package/dist/providers/catalog.d.ts.map +0 -1
- package/dist/providers/catalog.js.map +0 -1
- package/dist/providers/deepseek.d.ts.map +0 -1
- package/dist/providers/deepseek.js.map +0 -1
- package/dist/providers/dispatcher.d.ts.map +0 -1
- package/dist/providers/dispatcher.js.map +0 -1
- package/dist/providers/google-gemini.d.ts.map +0 -1
- package/dist/providers/google-gemini.js.map +0 -1
- package/dist/providers/google-genai.d.ts.map +0 -1
- package/dist/providers/google-genai.js.map +0 -1
- package/dist/providers/index.d.ts.map +0 -1
- package/dist/providers/index.js.map +0 -1
- package/dist/providers/openai.d.ts.map +0 -1
- package/dist/providers/openai.js.map +0 -1
- package/dist/providers/sse.d.ts.map +0 -1
- package/dist/providers/sse.js.map +0 -1
- package/dist/providers/types.d.ts.map +0 -1
- package/dist/providers/types.js.map +0 -1
- package/dist/providers/vertex-ai.d.ts.map +0 -1
- package/dist/providers/vertex-ai.js.map +0 -1
- package/dist/runtime/actions/context.d.ts.map +0 -1
- package/dist/runtime/actions/context.js.map +0 -1
- package/dist/runtime/actions/execute.d.ts.map +0 -1
- package/dist/runtime/actions/execute.js.map +0 -1
- package/dist/runtime/actions/native.d.ts.map +0 -1
- package/dist/runtime/actions/native.js.map +0 -1
- package/dist/runtime/actions/sandbox.d.ts.map +0 -1
- package/dist/runtime/actions/sandbox.js.map +0 -1
- package/dist/runtime/agent.d.ts.map +0 -1
- package/dist/runtime/agent.js.map +0 -1
- package/dist/runtime/context.d.ts.map +0 -1
- package/dist/runtime/context.js.map +0 -1
- package/dist/runtime/create-orcha.d.ts.map +0 -1
- package/dist/runtime/create-orcha.js.map +0 -1
- package/dist/runtime/execution.d.ts.map +0 -1
- package/dist/runtime/execution.js.map +0 -1
- package/dist/runtime/session-events.d.ts.map +0 -1
- package/dist/runtime/session-events.js.map +0 -1
- package/dist/runtime/structured-output.d.ts.map +0 -1
- package/dist/runtime/structured-output.js.map +0 -1
- package/dist/storage/browser-indexeddb.d.ts.map +0 -1
- package/dist/storage/browser-indexeddb.js.map +0 -1
- package/dist/storage/create-store.d.ts.map +0 -1
- package/dist/storage/create-store.js.map +0 -1
- package/dist/storage/edge-store.d.ts.map +0 -1
- package/dist/storage/edge-store.js.map +0 -1
- package/dist/storage/migrate.d.ts.map +0 -1
- package/dist/storage/migrate.js.map +0 -1
- package/dist/storage/node-jsonl.d.ts.map +0 -1
- package/dist/storage/node-jsonl.js.map +0 -1
- package/dist/storage/node-sqlite.d.ts.map +0 -1
- package/dist/storage/node-sqlite.js.map +0 -1
- package/dist/storage/react-native-jsonl.d.ts.map +0 -1
- package/dist/storage/react-native-jsonl.js.map +0 -1
- package/dist/testing.d.ts.map +0 -1
- package/dist/testing.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist-cjs/amarsia/metadata.js.map +0 -7
- package/dist-cjs/amarsia/sync.js.map +0 -7
- package/dist-cjs/cli-agents-template.js.map +0 -7
- package/dist-cjs/compiler/build-project.js.map +0 -7
- package/dist-cjs/compiler/compile.js.map +0 -7
- package/dist-cjs/env.js.map +0 -7
- package/dist-cjs/errors.js.map +0 -7
- package/dist-cjs/file-content.js.map +0 -7
- package/dist-cjs/index.js.map +0 -7
- package/dist-cjs/integrations/esbuild.js.map +0 -7
- package/dist-cjs/orcha.js.map +0 -7
- package/dist-cjs/playground/server.js.map +0 -7
- package/dist-cjs/playground/source.js.map +0 -7
- package/dist-cjs/project-loader.js.map +0 -7
- package/dist-cjs/providers/anthropic.js.map +0 -7
- package/dist-cjs/providers/bedrock.js.map +0 -7
- package/dist-cjs/providers/catalog.js.map +0 -7
- package/dist-cjs/providers/deepseek.js.map +0 -7
- package/dist-cjs/providers/dispatcher.js.map +0 -7
- package/dist-cjs/providers/google-gemini.js.map +0 -7
- package/dist-cjs/providers/google-genai.js.map +0 -7
- package/dist-cjs/providers/index.js.map +0 -7
- package/dist-cjs/providers/openai.js.map +0 -7
- package/dist-cjs/providers/sse.js.map +0 -7
- package/dist-cjs/providers/types.js.map +0 -7
- package/dist-cjs/providers/vertex-ai.js.map +0 -7
- package/dist-cjs/runtime/actions/context.js.map +0 -7
- package/dist-cjs/runtime/actions/execute.js.map +0 -7
- package/dist-cjs/runtime/actions/native.js.map +0 -7
- package/dist-cjs/runtime/actions/sandbox.js.map +0 -7
- package/dist-cjs/runtime/agent.js.map +0 -7
- package/dist-cjs/runtime/context.js.map +0 -7
- package/dist-cjs/runtime/create-orcha.js.map +0 -7
- package/dist-cjs/runtime/execution.js.map +0 -7
- package/dist-cjs/runtime/session-events.js.map +0 -7
- package/dist-cjs/runtime/structured-output.js.map +0 -7
- package/dist-cjs/storage/browser-indexeddb.js.map +0 -7
- package/dist-cjs/storage/create-store.js.map +0 -7
- package/dist-cjs/storage/edge-store.js.map +0 -7
- package/dist-cjs/storage/migrate.js.map +0 -7
- package/dist-cjs/storage/node-jsonl.js.map +0 -7
- package/dist-cjs/storage/node-sqlite.js.map +0 -7
- package/dist-cjs/storage/react-native-jsonl.js.map +0 -7
- package/dist-cjs/testing.js.map +0 -7
- package/dist-cjs/types.js.map +0 -7
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
2
|
import { randomBytes } from "node:crypto";
|
|
3
|
-
import { existsSync
|
|
3
|
+
import { existsSync } from "node:fs";
|
|
4
4
|
import { readFile } from "node:fs/promises";
|
|
5
5
|
import { dirname, extname, isAbsolute, relative, resolve } from "node:path";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
import { createServer, } from "node:http";
|
|
8
|
+
import { watch } from "chokidar";
|
|
8
9
|
import { orcha } from "../orcha.js";
|
|
9
10
|
import { loadProject } from "../project-loader.js";
|
|
10
11
|
import { listTests, runTests } from "../testing.js";
|
|
@@ -82,18 +83,22 @@ export async function startPlayground(options = {}) {
|
|
|
82
83
|
}
|
|
83
84
|
}
|
|
84
85
|
};
|
|
85
|
-
const watcher = watch(resolve(projectRoot, "orcha"), {
|
|
86
|
+
const watcher = watch(resolve(projectRoot, "orcha"), { ignoreInitial: true }).on("all", () => {
|
|
86
87
|
clearTimeout(reloadTimer);
|
|
87
88
|
reloadTimer = setTimeout(() => void reload(), 100);
|
|
88
89
|
});
|
|
89
90
|
await new Promise((resolveStop) => {
|
|
90
91
|
const stop = () => {
|
|
91
92
|
clearTimeout(reloadTimer);
|
|
92
|
-
watcher.close();
|
|
93
93
|
for (const client of projectClients) {
|
|
94
94
|
client.end();
|
|
95
95
|
}
|
|
96
|
-
|
|
96
|
+
void Promise.all([
|
|
97
|
+
watcher.close(),
|
|
98
|
+
new Promise((resolveClosed) => {
|
|
99
|
+
server.close(() => resolveClosed());
|
|
100
|
+
}),
|
|
101
|
+
]).then(() => resolveStop());
|
|
97
102
|
};
|
|
98
103
|
process.once("SIGINT", stop);
|
|
99
104
|
process.once("SIGTERM", stop);
|
|
@@ -662,4 +667,3 @@ function validateMutationRequest(request, mutationToken) {
|
|
|
662
667
|
}
|
|
663
668
|
}
|
|
664
669
|
}
|
|
665
|
-
//# sourceMappingURL=server.js.map
|
package/dist/project-loader.d.ts
CHANGED
package/dist/project-loader.js
CHANGED
|
@@ -24,7 +24,7 @@ export async function loadProject(projectRoot) {
|
|
|
24
24
|
bundle: true,
|
|
25
25
|
format: "esm",
|
|
26
26
|
platform: "node",
|
|
27
|
-
target: "
|
|
27
|
+
target: "node18",
|
|
28
28
|
packages: "external",
|
|
29
29
|
logLevel: "silent",
|
|
30
30
|
});
|
|
@@ -56,4 +56,3 @@ function restoreEnvironment(name, value) {
|
|
|
56
56
|
process.env[name] = value;
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
//# sourceMappingURL=project-loader.js.map
|
|
@@ -12,4 +12,3 @@ export interface BedrockContentClient {
|
|
|
12
12
|
}
|
|
13
13
|
export declare const bedrockProvider: ProviderAdapter;
|
|
14
14
|
export declare function generateBedrockContent(client: BedrockContentClient, request: ProviderRequest): Promise<ProviderResponse>;
|
|
15
|
-
//# sourceMappingURL=bedrock.d.ts.map
|
|
@@ -2,4 +2,3 @@ import type { ProviderName } from "../types.js";
|
|
|
2
2
|
import type { ProviderAdapter, ProviderResponseGenerator } from "./types.js";
|
|
3
3
|
export type ProviderAdapterRegistry = Partial<Record<ProviderName, ProviderAdapter>>;
|
|
4
4
|
export declare function createProviderResponseGenerator(providers: ProviderAdapterRegistry): ProviderResponseGenerator;
|
|
5
|
-
//# sourceMappingURL=dispatcher.d.ts.map
|
|
@@ -1,13 +1,75 @@
|
|
|
1
|
-
import type { Content, GenerateContentConfig, GenerateContentResponse } from "@google/genai/web";
|
|
2
1
|
import type { ProviderRequest, ProviderResponse } from "./types.js";
|
|
2
|
+
interface GooglePart {
|
|
3
|
+
text?: string;
|
|
4
|
+
thought?: boolean;
|
|
5
|
+
thoughtSignature?: string;
|
|
6
|
+
inlineData?: {
|
|
7
|
+
mimeType: string;
|
|
8
|
+
data: string;
|
|
9
|
+
};
|
|
10
|
+
fileData?: {
|
|
11
|
+
mimeType: string;
|
|
12
|
+
fileUri: string;
|
|
13
|
+
};
|
|
14
|
+
functionCall?: {
|
|
15
|
+
id?: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
args?: Record<string, unknown>;
|
|
18
|
+
};
|
|
19
|
+
functionResponse?: {
|
|
20
|
+
id?: string;
|
|
21
|
+
name: string;
|
|
22
|
+
response: Record<string, unknown>;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
interface GoogleContent {
|
|
26
|
+
role: string;
|
|
27
|
+
parts: GooglePart[];
|
|
28
|
+
}
|
|
29
|
+
interface GoogleGenerateContentConfig {
|
|
30
|
+
systemInstruction: string;
|
|
31
|
+
maxOutputTokens?: number;
|
|
32
|
+
tools?: Array<{
|
|
33
|
+
functionDeclarations: Array<{
|
|
34
|
+
name: string;
|
|
35
|
+
description: string;
|
|
36
|
+
parametersJsonSchema: Record<string, unknown>;
|
|
37
|
+
}>;
|
|
38
|
+
}>;
|
|
39
|
+
responseMimeType?: string;
|
|
40
|
+
responseJsonSchema?: Record<string, unknown>;
|
|
41
|
+
thinkingConfig?: {
|
|
42
|
+
includeThoughts: boolean;
|
|
43
|
+
thinkingLevel?: string;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
interface GoogleGenerateContentResponse {
|
|
47
|
+
responseId?: string;
|
|
48
|
+
candidates?: Array<{
|
|
49
|
+
finishReason?: string;
|
|
50
|
+
content?: {
|
|
51
|
+
parts?: GooglePart[];
|
|
52
|
+
};
|
|
53
|
+
}>;
|
|
54
|
+
promptFeedback?: {
|
|
55
|
+
blockReason?: string;
|
|
56
|
+
};
|
|
57
|
+
usageMetadata?: {
|
|
58
|
+
promptTokenCount?: number;
|
|
59
|
+
candidatesTokenCount?: number;
|
|
60
|
+
thoughtsTokenCount?: number;
|
|
61
|
+
cachedContentTokenCount?: number;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
3
64
|
export interface GoogleContentClient {
|
|
4
65
|
models: {
|
|
5
66
|
generateContentStream(parameters: {
|
|
6
67
|
model: string;
|
|
7
|
-
contents:
|
|
8
|
-
config:
|
|
9
|
-
}): Promise<AsyncGenerator<
|
|
68
|
+
contents: GoogleContent[];
|
|
69
|
+
config: GoogleGenerateContentConfig;
|
|
70
|
+
}): Promise<AsyncGenerator<GoogleGenerateContentResponse>>;
|
|
10
71
|
};
|
|
11
72
|
}
|
|
73
|
+
export declare function toGoogleContentClient(client: unknown): GoogleContentClient;
|
|
12
74
|
export declare function generateGoogleContent(client: GoogleContentClient, request: ProviderRequest, provider: "googlegenai" | "vertexai"): Promise<ProviderResponse>;
|
|
13
|
-
|
|
75
|
+
export {};
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import { OrchaError } from "../errors.js";
|
|
2
2
|
import { readLocalFileContent } from "../file-content.js";
|
|
3
3
|
import { parseStructuredOutput } from "../runtime/structured-output.js";
|
|
4
|
+
export function toGoogleContentClient(client) {
|
|
5
|
+
if (typeof client !== "object" ||
|
|
6
|
+
client === null ||
|
|
7
|
+
!("models" in client) ||
|
|
8
|
+
typeof client.models !== "object" ||
|
|
9
|
+
client.models === null ||
|
|
10
|
+
!("generateContentStream" in client.models) ||
|
|
11
|
+
typeof client.models.generateContentStream !== "function") {
|
|
12
|
+
throw new Error("The installed @google/genai package does not expose a compatible client.");
|
|
13
|
+
}
|
|
14
|
+
return client;
|
|
15
|
+
}
|
|
4
16
|
export async function generateGoogleContent(client, request, provider) {
|
|
5
17
|
request.signal?.throwIfAborted();
|
|
6
18
|
if (request.outputType === "image" || request.outputType === "audio") {
|
|
@@ -31,8 +43,7 @@ export async function generateGoogleContent(client, request, provider) {
|
|
|
31
43
|
includeThoughts: true,
|
|
32
44
|
};
|
|
33
45
|
if (request.reasoningLevel) {
|
|
34
|
-
config.thinkingConfig.thinkingLevel =
|
|
35
|
-
request.reasoningLevel;
|
|
46
|
+
config.thinkingConfig.thinkingLevel = request.reasoningLevel;
|
|
36
47
|
}
|
|
37
48
|
const stream = await client.models.generateContentStream({
|
|
38
49
|
model: request.model,
|
|
@@ -346,4 +357,3 @@ function parseDataUri(uri) {
|
|
|
346
357
|
function isRecord(value) {
|
|
347
358
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
348
359
|
}
|
|
349
|
-
//# sourceMappingURL=google-gemini.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GoogleGenAI } from "@google/genai/web";
|
|
2
|
-
import { generateGoogleContent } from "./google-gemini.js";
|
|
2
|
+
import { generateGoogleContent, toGoogleContentClient, } from "./google-gemini.js";
|
|
3
3
|
export const googleGenAIProvider = {
|
|
4
4
|
name: "googlegenai",
|
|
5
5
|
generate: generateGoogleGenAI,
|
|
@@ -14,6 +14,5 @@ async function generateGoogleGenAI(configuration, request) {
|
|
|
14
14
|
? { httpOptions: { baseUrl: configuration.baseUrl } }
|
|
15
15
|
: {}),
|
|
16
16
|
});
|
|
17
|
-
return generateGoogleContent(client, request, "googlegenai");
|
|
17
|
+
return generateGoogleContent(toGoogleContentClient(client), request, "googlegenai");
|
|
18
18
|
}
|
|
19
|
-
//# sourceMappingURL=google-genai.js.map
|
package/dist/providers/index.js
CHANGED
|
@@ -15,16 +15,42 @@ function loadProvider(name) {
|
|
|
15
15
|
throw new OrchaError("provider_error", `Provider "${name}" is not implemented by this version of OrchaJS.`);
|
|
16
16
|
}
|
|
17
17
|
const descriptor = builtInProviderCatalog[name];
|
|
18
|
-
const loading = import(`./${descriptor.moduleFile}`)
|
|
18
|
+
const loading = import(`./${descriptor.moduleFile}`)
|
|
19
|
+
.then((module) => {
|
|
19
20
|
const provider = module[descriptor.exportName];
|
|
20
21
|
if (!isProviderAdapter(provider) || provider.name !== name) {
|
|
21
22
|
throw new Error(`Provider module "${descriptor.moduleFile}" does not export "${descriptor.exportName}".`);
|
|
22
23
|
}
|
|
23
24
|
return provider;
|
|
25
|
+
})
|
|
26
|
+
.catch((error) => {
|
|
27
|
+
loadedProviders.delete(name);
|
|
28
|
+
const dependency = missingProviderDependency(name, error);
|
|
29
|
+
if (dependency) {
|
|
30
|
+
const nodeRequirement = dependency === "@google/genai"
|
|
31
|
+
? " Node.js 20 or newer is also required."
|
|
32
|
+
: "";
|
|
33
|
+
throw new OrchaError("provider_error", `Provider "${name}" requires the optional "${dependency}" package.${nodeRequirement} Install it in the application that uses this provider.`, { cause: error });
|
|
34
|
+
}
|
|
35
|
+
throw error;
|
|
24
36
|
});
|
|
25
37
|
loadedProviders.set(name, loading);
|
|
26
38
|
return loading;
|
|
27
39
|
}
|
|
40
|
+
function missingProviderDependency(name, error) {
|
|
41
|
+
if (!(error instanceof Error)) {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
if (name === "bedrock" &&
|
|
45
|
+
error.message.includes("@aws-sdk/client-bedrock-runtime")) {
|
|
46
|
+
return "@aws-sdk/client-bedrock-runtime";
|
|
47
|
+
}
|
|
48
|
+
if ((name === "googlegenai" || name === "vertexai") &&
|
|
49
|
+
error.message.includes("@google/genai")) {
|
|
50
|
+
return "@google/genai";
|
|
51
|
+
}
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
28
54
|
function isProviderAdapter(value) {
|
|
29
55
|
return (typeof value === "object" &&
|
|
30
56
|
value !== null &&
|
|
@@ -32,4 +58,3 @@ function isProviderAdapter(value) {
|
|
|
32
58
|
"generate" in value &&
|
|
33
59
|
typeof value.generate === "function");
|
|
34
60
|
}
|
|
35
|
-
//# sourceMappingURL=index.js.map
|
package/dist/providers/openai.js
CHANGED
package/dist/providers/sse.d.ts
CHANGED
package/dist/providers/sse.js
CHANGED
|
@@ -69,4 +69,3 @@ export interface ProviderAdapter {
|
|
|
69
69
|
generate(configuration: ProviderConfiguration, request: ProviderRequest): Promise<ProviderResponse>;
|
|
70
70
|
}
|
|
71
71
|
export type ProviderResponseGenerator = (name: ProviderName, configuration: ProviderConfiguration, request: ProviderRequest) => Promise<ProviderResponse>;
|
|
72
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/providers/types.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GoogleGenAI } from "@google/genai/node";
|
|
2
|
-
import { generateGoogleContent } from "./google-gemini.js";
|
|
2
|
+
import { generateGoogleContent, toGoogleContentClient, } from "./google-gemini.js";
|
|
3
3
|
export const vertexAIProvider = {
|
|
4
4
|
name: "vertexai",
|
|
5
5
|
generate: generateVertexAI,
|
|
@@ -35,6 +35,5 @@ async function generateVertexAI(configuration, request) {
|
|
|
35
35
|
? { httpOptions: { baseUrl: configuration.baseUrl } }
|
|
36
36
|
: {}),
|
|
37
37
|
});
|
|
38
|
-
return generateGoogleContent(client, request, "vertexai");
|
|
38
|
+
return generateGoogleContent(toGoogleContentClient(client), request, "vertexai");
|
|
39
39
|
}
|
|
40
|
-
//# sourceMappingURL=vertex-ai.js.map
|
|
@@ -20,7 +20,7 @@ export function createLocalActionContext(options) {
|
|
|
20
20
|
...init,
|
|
21
21
|
redirect: "manual",
|
|
22
22
|
signal: init?.signal
|
|
23
|
-
?
|
|
23
|
+
? combineAbortSignals(init.signal, timeoutSignal)
|
|
24
24
|
: timeoutSignal,
|
|
25
25
|
});
|
|
26
26
|
if (response.status >= 300 && response.status < 400) {
|
|
@@ -33,6 +33,30 @@ export function createLocalActionContext(options) {
|
|
|
33
33
|
},
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
|
+
function combineAbortSignals(first, second) {
|
|
37
|
+
const controller = new AbortController();
|
|
38
|
+
const registrations = [];
|
|
39
|
+
const cleanup = () => {
|
|
40
|
+
for (const { signal, listener } of registrations) {
|
|
41
|
+
signal.removeEventListener("abort", listener);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const register = (signal) => {
|
|
45
|
+
const abort = () => controller.abort(signal.reason);
|
|
46
|
+
if (signal.aborted) {
|
|
47
|
+
abort();
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
51
|
+
registrations.push({ signal, listener: abort });
|
|
52
|
+
};
|
|
53
|
+
controller.signal.addEventListener("abort", cleanup, { once: true });
|
|
54
|
+
register(first);
|
|
55
|
+
if (!controller.signal.aborted) {
|
|
56
|
+
register(second);
|
|
57
|
+
}
|
|
58
|
+
return controller.signal;
|
|
59
|
+
}
|
|
36
60
|
function isAllowedHost(hostname, allowedHosts) {
|
|
37
61
|
return allowedHosts.some((allowed) => {
|
|
38
62
|
if (allowed.startsWith("*.")) {
|
|
@@ -42,4 +66,3 @@ function isAllowedHost(hostname, allowedHosts) {
|
|
|
42
66
|
return hostname === allowed;
|
|
43
67
|
});
|
|
44
68
|
}
|
|
45
|
-
//# sourceMappingURL=context.js.map
|
|
@@ -6,9 +6,21 @@ export async function executeLocalAction(options) {
|
|
|
6
6
|
return executeNativeAction(options.action, options.parameters, context);
|
|
7
7
|
}
|
|
8
8
|
if (process.env.ORCHA_INCLUDE_SANDBOX !== "0") {
|
|
9
|
-
const { executeSandboxedAction } = await
|
|
9
|
+
const { executeSandboxedAction } = await loadSandboxRuntime();
|
|
10
10
|
return executeSandboxedAction(options.action, options.parameters, context, options.configuration.sandbox);
|
|
11
11
|
}
|
|
12
12
|
throw new Error("The production bundle was built without the QuickJS sandbox.");
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
async function loadSandboxRuntime() {
|
|
15
|
+
try {
|
|
16
|
+
return await import("./sandbox.js");
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
if (error instanceof Error &&
|
|
20
|
+
(error.message.includes("quickjs-emscripten-core") ||
|
|
21
|
+
error.message.includes("@jitl/quickjs-singlefile-cjs-release-sync"))) {
|
|
22
|
+
throw new Error('Sandboxed actions require the optional "quickjs-emscripten-core" and "@jitl/quickjs-singlefile-cjs-release-sync" packages. Install both in the application that selects the sandbox runtime.', { cause: error });
|
|
23
|
+
}
|
|
24
|
+
throw error;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import type { CompiledActionManifest } from "../../types.js";
|
|
2
2
|
import type { LocalActionContext } from "./context.js";
|
|
3
3
|
export declare function executeNativeAction(action: CompiledActionManifest, parameters: Record<string, unknown>, context: LocalActionContext): Promise<unknown>;
|
|
4
|
-
//# sourceMappingURL=native.d.ts.map
|
package/dist/runtime/agent.d.ts
CHANGED
package/dist/runtime/agent.js
CHANGED
|
@@ -9,4 +9,3 @@ export interface OrchaRuntimeContext {
|
|
|
9
9
|
}
|
|
10
10
|
export declare function setOrchaRuntimeContext(client: object, context: OrchaRuntimeContext): void;
|
|
11
11
|
export declare function getOrchaRuntimeContext(client: object): OrchaRuntimeContext;
|
|
12
|
-
//# sourceMappingURL=context.d.ts.map
|
package/dist/runtime/context.js
CHANGED
|
@@ -9,4 +9,3 @@ export interface Orcha {
|
|
|
9
9
|
export type OrchaClient = Orcha & Record<string, AgentRuntime>;
|
|
10
10
|
export type BundleResolver = (configuration: OrchaInitConfiguration) => CompiledBundle;
|
|
11
11
|
export declare function createOrcha(resolveBundle: BundleResolver, generateProviderResponse: ProviderResponseGenerator): OrchaClient;
|
|
12
|
-
//# sourceMappingURL=create-orcha.d.ts.map
|
|
@@ -2,4 +2,3 @@ import type { EvaluationResult, Execution, ExecutionSnapshot, RunResult } from "
|
|
|
2
2
|
export type OutputSnapshotPublisher<TOutput> = (output: TOutput) => void;
|
|
3
3
|
export type ExecutionSnapshotPublisher<TOutput> = (snapshot: ExecutionSnapshot<TOutput>) => void;
|
|
4
4
|
export declare function createExecution<TOutput>(sessionId: string, execute: (publishOutput: OutputSnapshotPublisher<TOutput>, publishSnapshot: ExecutionSnapshotPublisher<TOutput>) => Promise<RunResult<TOutput>>, resolveEvaluations?: () => Promise<EvaluationResult[]>): Execution<TOutput>;
|
|
5
|
-
//# sourceMappingURL=execution.d.ts.map
|
|
@@ -9,4 +9,3 @@ export declare class SessionEventWriter {
|
|
|
9
9
|
}
|
|
10
10
|
export declare function messagesFromEvents(events: SessionEvent[], includeRun?: number): ProviderMessage[];
|
|
11
11
|
export declare function normalizePersistedToolResults(value: unknown[]): ProviderToolResult[] | undefined;
|
|
12
|
-
//# sourceMappingURL=session-events.d.ts.map
|
|
@@ -5,4 +5,3 @@ export interface SessionStoreMigrationResult {
|
|
|
5
5
|
}
|
|
6
6
|
export declare function migrateSessionStore(source: SessionStore, destination: SessionStore): Promise<SessionStoreMigrationResult>;
|
|
7
7
|
export declare function exportSessionJsonl(store: SessionStore, sessionId: string): Promise<string>;
|
|
8
|
-
//# sourceMappingURL=migrate.d.ts.map
|
package/dist/storage/migrate.js
CHANGED
|
@@ -32,4 +32,3 @@ function assertCompatibleHistory(sessionId, source, destination) {
|
|
|
32
32
|
function incompatibleHistory(sessionId) {
|
|
33
33
|
return new Error(`Cannot migrate session "${sessionId}" because the destination contains conflicting history.`);
|
|
34
34
|
}
|
|
35
|
-
//# sourceMappingURL=migrate.js.map
|
|
@@ -11,4 +11,3 @@ export declare class NodeJsonlSessionStore implements SessionStore {
|
|
|
11
11
|
subscribeAll(listener: (sessionId: string, events: SessionEvent[]) => void): () => void;
|
|
12
12
|
}
|
|
13
13
|
export declare function sessionAgentDirectoryName(agent: string): string;
|
|
14
|
-
//# sourceMappingURL=node-jsonl.d.ts.map
|