@ddwang/magnitude-core 0.3.1-ddwang.1
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/actions/desktopActions.d.ts +58 -0
- package/dist/actions/desktopActions.js +154 -0
- package/dist/actions/index.d.ts +26 -0
- package/dist/actions/index.js +11 -0
- package/dist/actions/taskActions.d.ts +8 -0
- package/dist/actions/taskActions.js +27 -0
- package/dist/actions/types.d.ts +31 -0
- package/dist/actions/types.js +5 -0
- package/dist/actions/util.d.ts +20 -0
- package/dist/actions/util.js +297 -0
- package/dist/actions/webActions.d.ts +79 -0
- package/dist/actions/webActions.js +190 -0
- package/dist/agent/browserAgent.d.ts +29 -0
- package/dist/agent/browserAgent.js +122 -0
- package/dist/agent/errors.d.ts +8 -0
- package/dist/agent/errors.js +68 -0
- package/dist/agent/index.d.ts +53 -0
- package/dist/agent/index.js +377 -0
- package/dist/agent/narrator.d.ts +4 -0
- package/dist/agent/narrator.js +63 -0
- package/dist/agent/pause.test.d.ts +1 -0
- package/dist/agent/pause.test.js +194 -0
- package/dist/ai/baml_client/async_client.d.ts +73 -0
- package/dist/ai/baml_client/async_client.js +152 -0
- package/dist/ai/baml_client/async_request.d.ts +35 -0
- package/dist/ai/baml_client/async_request.js +98 -0
- package/dist/ai/baml_client/config.d.ts +11 -0
- package/dist/ai/baml_client/config.js +20 -0
- package/dist/ai/baml_client/globals.d.ts +16 -0
- package/dist/ai/baml_client/globals.js +37 -0
- package/dist/ai/baml_client/index.d.ts +16 -0
- package/dist/ai/baml_client/index.js +41 -0
- package/dist/ai/baml_client/inlinedbaml.d.ts +19 -0
- package/dist/ai/baml_client/inlinedbaml.js +31 -0
- package/dist/ai/baml_client/parser.d.ts +53 -0
- package/dist/ai/baml_client/parser.js +86 -0
- package/dist/ai/baml_client/partial_types.d.ts +61 -0
- package/dist/ai/baml_client/partial_types.js +10 -0
- package/dist/ai/baml_client/sync_client.d.ts +50 -0
- package/dist/ai/baml_client/sync_client.js +100 -0
- package/dist/ai/baml_client/sync_request.d.ts +35 -0
- package/dist/ai/baml_client/sync_request.js +98 -0
- package/dist/ai/baml_client/tracing.d.ts +16 -0
- package/dist/ai/baml_client/tracing.js +18 -0
- package/dist/ai/baml_client/type_builder.d.ts +38 -0
- package/dist/ai/baml_client/type_builder.js +96 -0
- package/dist/ai/baml_client/types.d.ts +69 -0
- package/dist/ai/baml_client/types.js +15 -0
- package/dist/ai/claudeCode.d.ts +1 -0
- package/dist/ai/claudeCode.js +186 -0
- package/dist/ai/modelHarness.d.ts +39 -0
- package/dist/ai/modelHarness.js +189 -0
- package/dist/ai/multiModelHarness.d.ts +27 -0
- package/dist/ai/multiModelHarness.js +52 -0
- package/dist/ai/types.d.ts +90 -0
- package/dist/ai/types.js +5 -0
- package/dist/ai/util.d.ts +13 -0
- package/dist/ai/util.js +165 -0
- package/dist/cli.d.ts +0 -0
- package/dist/cli.js +3 -0
- package/dist/common/actions.d.ts +0 -0
- package/dist/common/actions.js +14 -0
- package/dist/common/events.d.ts +15 -0
- package/dist/common/events.js +3 -0
- package/dist/common/failure.d.ts +68 -0
- package/dist/common/failure.js +1 -0
- package/dist/common/index.d.ts +3 -0
- package/dist/common/index.js +3 -0
- package/dist/common/retry.d.ts +16 -0
- package/dist/common/retry.js +30 -0
- package/dist/common/util.d.ts +23 -0
- package/dist/common/util.js +132 -0
- package/dist/connectors/browserConnector.d.ts +40 -0
- package/dist/connectors/browserConnector.js +127 -0
- package/dist/connectors/desktopConnector.d.ts +58 -0
- package/dist/connectors/desktopConnector.js +68 -0
- package/dist/connectors/index.d.ts +10 -0
- package/dist/connectors/index.js +2 -0
- package/dist/index.cjs +6143 -0
- package/dist/index.d.cts +825 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +26 -0
- package/dist/index.mjs +6097 -0
- package/dist/logger.d.ts +3 -0
- package/dist/logger.js +15 -0
- package/dist/memory/agentMemory.d.ts +37 -0
- package/dist/memory/agentMemory.js +121 -0
- package/dist/memory/image.d.ts +26 -0
- package/dist/memory/image.js +106 -0
- package/dist/memory/index.d.ts +3 -0
- package/dist/memory/index.js +3 -0
- package/dist/memory/masking.d.ts +7 -0
- package/dist/memory/masking.js +141 -0
- package/dist/memory/masking.test.d.ts +1 -0
- package/dist/memory/masking.test.js +117 -0
- package/dist/memory/observation.d.ts +38 -0
- package/dist/memory/observation.js +79 -0
- package/dist/memory/rendering/index.d.ts +10 -0
- package/dist/memory/rendering/index.js +13 -0
- package/dist/memory/rendering/renderJsonParts.d.ts +3 -0
- package/dist/memory/rendering/renderJsonParts.js +115 -0
- package/dist/memory/rendering/renderJsonParts.test.d.ts +1 -0
- package/dist/memory/rendering/renderJsonParts.test.js +217 -0
- package/dist/memory/rendering/renderXmlParts.d.ts +7 -0
- package/dist/memory/rendering/renderXmlParts.js +127 -0
- package/dist/memory/serde.d.ts +20 -0
- package/dist/memory/serde.js +81 -0
- package/dist/memory/util.d.ts +2 -0
- package/dist/memory/util.js +17 -0
- package/dist/telemetry/events.d.ts +9 -0
- package/dist/telemetry/events.js +80 -0
- package/dist/telemetry/index.d.ts +6 -0
- package/dist/telemetry/index.js +91 -0
- package/dist/types.d.ts +30 -0
- package/dist/types.js +1 -0
- package/dist/util.d.ts +1 -0
- package/dist/util.js +12 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +3 -0
- package/dist/web/browserProvider.d.ts +23 -0
- package/dist/web/browserProvider.js +153 -0
- package/dist/web/harness.d.ts +102 -0
- package/dist/web/harness.js +340 -0
- package/dist/web/stability.d.ts +57 -0
- package/dist/web/stability.js +316 -0
- package/dist/web/tabs.d.ts +58 -0
- package/dist/web/tabs.js +293 -0
- package/dist/web/transformer.d.ts +7 -0
- package/dist/web/transformer.js +41 -0
- package/dist/web/types.d.ts +32 -0
- package/dist/web/types.js +2 -0
- package/dist/web/util.d.ts +3 -0
- package/dist/web/util.js +81 -0
- package/dist/web/visualizer/cursor.d.ts +16 -0
- package/dist/web/visualizer/cursor.js +152 -0
- package/dist/web/visualizer/index.d.ts +22 -0
- package/dist/web/visualizer/index.js +47 -0
- package/dist/web/visualizer/mouseEffects.d.ts +18 -0
- package/dist/web/visualizer/mouseEffects.js +287 -0
- package/dist/web/visualizer/typeEffects.d.ts +10 -0
- package/dist/web/visualizer/typeEffects.js +190 -0
- package/package.json +71 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*************************************************************************************************
|
|
2
|
+
|
|
3
|
+
Welcome to Baml! To use this generated code, please run one of the following:
|
|
4
|
+
|
|
5
|
+
$ npm install @boundaryml/baml
|
|
6
|
+
$ yarn add @boundaryml/baml
|
|
7
|
+
$ pnpm add @boundaryml/baml
|
|
8
|
+
|
|
9
|
+
*************************************************************************************************/
|
|
10
|
+
import type { BamlRuntime, BamlCtxManager, ClientRegistry } from "@boundaryml/baml";
|
|
11
|
+
import type { partial_types } from "./partial_types";
|
|
12
|
+
import type * as types from "./types";
|
|
13
|
+
import type TypeBuilder from "./type_builder";
|
|
14
|
+
export declare class LlmResponseParser {
|
|
15
|
+
private runtime;
|
|
16
|
+
private ctxManager;
|
|
17
|
+
constructor(runtime: BamlRuntime, ctxManager: BamlCtxManager);
|
|
18
|
+
CreatePartialRecipe(llmResponse: string, __baml_options__?: {
|
|
19
|
+
tb?: TypeBuilder;
|
|
20
|
+
clientRegistry?: ClientRegistry;
|
|
21
|
+
env?: Record<string, string | undefined>;
|
|
22
|
+
}): types.PartialRecipe;
|
|
23
|
+
ExtractData(llmResponse: string, __baml_options__?: {
|
|
24
|
+
tb?: TypeBuilder;
|
|
25
|
+
clientRegistry?: ClientRegistry;
|
|
26
|
+
env?: Record<string, string | undefined>;
|
|
27
|
+
}): types.ExtractedData;
|
|
28
|
+
QueryMemory(llmResponse: string, __baml_options__?: {
|
|
29
|
+
tb?: TypeBuilder;
|
|
30
|
+
clientRegistry?: ClientRegistry;
|
|
31
|
+
env?: Record<string, string | undefined>;
|
|
32
|
+
}): types.QueryResponse;
|
|
33
|
+
}
|
|
34
|
+
export declare class LlmStreamParser {
|
|
35
|
+
private runtime;
|
|
36
|
+
private ctxManager;
|
|
37
|
+
constructor(runtime: BamlRuntime, ctxManager: BamlCtxManager);
|
|
38
|
+
CreatePartialRecipe(llmResponse: string, __baml_options__?: {
|
|
39
|
+
tb?: TypeBuilder;
|
|
40
|
+
clientRegistry?: ClientRegistry;
|
|
41
|
+
env?: Record<string, string | undefined>;
|
|
42
|
+
}): partial_types.PartialRecipe;
|
|
43
|
+
ExtractData(llmResponse: string, __baml_options__?: {
|
|
44
|
+
tb?: TypeBuilder;
|
|
45
|
+
clientRegistry?: ClientRegistry;
|
|
46
|
+
env?: Record<string, string | undefined>;
|
|
47
|
+
}): partial_types.ExtractedData;
|
|
48
|
+
QueryMemory(llmResponse: string, __baml_options__?: {
|
|
49
|
+
tb?: TypeBuilder;
|
|
50
|
+
clientRegistry?: ClientRegistry;
|
|
51
|
+
env?: Record<string, string | undefined>;
|
|
52
|
+
}): partial_types.QueryResponse;
|
|
53
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/*************************************************************************************************
|
|
2
|
+
|
|
3
|
+
Welcome to Baml! To use this generated code, please run one of the following:
|
|
4
|
+
|
|
5
|
+
$ npm install @boundaryml/baml
|
|
6
|
+
$ yarn add @boundaryml/baml
|
|
7
|
+
$ pnpm add @boundaryml/baml
|
|
8
|
+
|
|
9
|
+
*************************************************************************************************/
|
|
10
|
+
import { toBamlError } from "@boundaryml/baml";
|
|
11
|
+
export class LlmResponseParser {
|
|
12
|
+
runtime;
|
|
13
|
+
ctxManager;
|
|
14
|
+
constructor(runtime, ctxManager) {
|
|
15
|
+
this.runtime = runtime;
|
|
16
|
+
this.ctxManager = ctxManager;
|
|
17
|
+
}
|
|
18
|
+
CreatePartialRecipe(llmResponse, __baml_options__) {
|
|
19
|
+
try {
|
|
20
|
+
const rawEnv = __baml_options__?.env ? { ...process.env, ...__baml_options__.env } : { ...process.env };
|
|
21
|
+
const env = Object.fromEntries(Object.entries(rawEnv).filter(([_, value]) => value !== undefined));
|
|
22
|
+
return this.runtime.parseLlmResponse("CreatePartialRecipe", llmResponse, false, this.ctxManager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, env);
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
throw toBamlError(error);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
ExtractData(llmResponse, __baml_options__) {
|
|
29
|
+
try {
|
|
30
|
+
const rawEnv = __baml_options__?.env ? { ...process.env, ...__baml_options__.env } : { ...process.env };
|
|
31
|
+
const env = Object.fromEntries(Object.entries(rawEnv).filter(([_, value]) => value !== undefined));
|
|
32
|
+
return this.runtime.parseLlmResponse("ExtractData", llmResponse, false, this.ctxManager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, env);
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
throw toBamlError(error);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
QueryMemory(llmResponse, __baml_options__) {
|
|
39
|
+
try {
|
|
40
|
+
const rawEnv = __baml_options__?.env ? { ...process.env, ...__baml_options__.env } : { ...process.env };
|
|
41
|
+
const env = Object.fromEntries(Object.entries(rawEnv).filter(([_, value]) => value !== undefined));
|
|
42
|
+
return this.runtime.parseLlmResponse("QueryMemory", llmResponse, false, this.ctxManager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, env);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
throw toBamlError(error);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export class LlmStreamParser {
|
|
50
|
+
runtime;
|
|
51
|
+
ctxManager;
|
|
52
|
+
constructor(runtime, ctxManager) {
|
|
53
|
+
this.runtime = runtime;
|
|
54
|
+
this.ctxManager = ctxManager;
|
|
55
|
+
}
|
|
56
|
+
CreatePartialRecipe(llmResponse, __baml_options__) {
|
|
57
|
+
try {
|
|
58
|
+
const rawEnv = __baml_options__?.env ? { ...process.env, ...__baml_options__.env } : { ...process.env };
|
|
59
|
+
const env = Object.fromEntries(Object.entries(rawEnv).filter(([_, value]) => value !== undefined));
|
|
60
|
+
return this.runtime.parseLlmResponse("CreatePartialRecipe", llmResponse, true, this.ctxManager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, env);
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
throw toBamlError(error);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
ExtractData(llmResponse, __baml_options__) {
|
|
67
|
+
try {
|
|
68
|
+
const rawEnv = __baml_options__?.env ? { ...process.env, ...__baml_options__.env } : { ...process.env };
|
|
69
|
+
const env = Object.fromEntries(Object.entries(rawEnv).filter(([_, value]) => value !== undefined));
|
|
70
|
+
return this.runtime.parseLlmResponse("ExtractData", llmResponse, true, this.ctxManager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, env);
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
throw toBamlError(error);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
QueryMemory(llmResponse, __baml_options__) {
|
|
77
|
+
try {
|
|
78
|
+
const rawEnv = __baml_options__?.env ? { ...process.env, ...__baml_options__.env } : { ...process.env };
|
|
79
|
+
const env = Object.fromEntries(Object.entries(rawEnv).filter(([_, value]) => value !== undefined));
|
|
80
|
+
return this.runtime.parseLlmResponse("QueryMemory", llmResponse, true, this.ctxManager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, env);
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
throw toBamlError(error);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/*************************************************************************************************
|
|
2
|
+
|
|
3
|
+
Welcome to Baml! To use this generated code, please run one of the following:
|
|
4
|
+
|
|
5
|
+
$ npm install @boundaryml/baml
|
|
6
|
+
$ yarn add @boundaryml/baml
|
|
7
|
+
$ pnpm add @boundaryml/baml
|
|
8
|
+
|
|
9
|
+
*************************************************************************************************/
|
|
10
|
+
import type { Image } from "@boundaryml/baml";
|
|
11
|
+
/******************************************************************************
|
|
12
|
+
*
|
|
13
|
+
* These types are used for streaming, for when an instance of a type
|
|
14
|
+
* is still being built up and any of its fields is not yet fully available.
|
|
15
|
+
*
|
|
16
|
+
******************************************************************************/
|
|
17
|
+
export interface StreamState<T> {
|
|
18
|
+
value: T;
|
|
19
|
+
state: "Pending" | "Incomplete" | "Complete";
|
|
20
|
+
}
|
|
21
|
+
export declare namespace partial_types {
|
|
22
|
+
interface AgentContext {
|
|
23
|
+
instructions?: string | null;
|
|
24
|
+
observationContent: MultiMediaMessage[];
|
|
25
|
+
connectorInstructions: ConnectorInstructions[];
|
|
26
|
+
}
|
|
27
|
+
interface BugFailureClassification {
|
|
28
|
+
reasoning?: string | null;
|
|
29
|
+
classification?: "bug" | null;
|
|
30
|
+
title?: string | null;
|
|
31
|
+
expectedResult?: string | null;
|
|
32
|
+
actualResult?: string | null;
|
|
33
|
+
severity?: "critical" | "high" | "medium" | "low" | null;
|
|
34
|
+
}
|
|
35
|
+
interface ConnectorInstructions {
|
|
36
|
+
connectorId?: string | null;
|
|
37
|
+
instructions?: string | null;
|
|
38
|
+
}
|
|
39
|
+
interface ExtractedData {
|
|
40
|
+
[key: string]: any;
|
|
41
|
+
}
|
|
42
|
+
interface MisalignmentClassification {
|
|
43
|
+
reasoning?: string | null;
|
|
44
|
+
classification?: "misalignment" | null;
|
|
45
|
+
fault?: "test" | "agent" | null;
|
|
46
|
+
message?: string | null;
|
|
47
|
+
}
|
|
48
|
+
interface MultiMediaMessage {
|
|
49
|
+
role?: "user" | "assistant" | null;
|
|
50
|
+
cacheControl?: boolean | null;
|
|
51
|
+
content: (Image | string)[];
|
|
52
|
+
}
|
|
53
|
+
interface PartialRecipe {
|
|
54
|
+
reasoning?: string | null;
|
|
55
|
+
[key: string]: any;
|
|
56
|
+
}
|
|
57
|
+
interface QueryResponse {
|
|
58
|
+
[key: string]: any;
|
|
59
|
+
}
|
|
60
|
+
type MultiMediaContentPart = Image | string | null;
|
|
61
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*************************************************************************************************
|
|
2
|
+
|
|
3
|
+
Welcome to Baml! To use this generated code, please run one of the following:
|
|
4
|
+
|
|
5
|
+
$ npm install @boundaryml/baml
|
|
6
|
+
$ yarn add @boundaryml/baml
|
|
7
|
+
$ pnpm add @boundaryml/baml
|
|
8
|
+
|
|
9
|
+
*************************************************************************************************/
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*************************************************************************************************
|
|
2
|
+
|
|
3
|
+
Welcome to Baml! To use this generated code, please run one of the following:
|
|
4
|
+
|
|
5
|
+
$ npm install @boundaryml/baml
|
|
6
|
+
$ yarn add @boundaryml/baml
|
|
7
|
+
$ pnpm add @boundaryml/baml
|
|
8
|
+
|
|
9
|
+
*************************************************************************************************/
|
|
10
|
+
import type { BamlRuntime, BamlCtxManager, Image, ClientRegistry, Collector } from "@boundaryml/baml";
|
|
11
|
+
import type { RecursivePartialNull as MovedRecursivePartialNull } from "./types";
|
|
12
|
+
import type * as types from "./types";
|
|
13
|
+
import type TypeBuilder from "./type_builder";
|
|
14
|
+
import { HttpRequest, HttpStreamRequest } from "./sync_request";
|
|
15
|
+
import { LlmResponseParser, LlmStreamParser } from "./parser";
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated Use RecursivePartialNull from 'baml_client/types' instead.
|
|
18
|
+
* Example:
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { RecursivePartialNull } from './baml_client/types'
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export type RecursivePartialNull<T> = MovedRecursivePartialNull<T>;
|
|
24
|
+
type BamlCallOptions = {
|
|
25
|
+
tb?: TypeBuilder;
|
|
26
|
+
clientRegistry?: ClientRegistry;
|
|
27
|
+
collector?: Collector | Collector[];
|
|
28
|
+
env?: Record<string, string | undefined>;
|
|
29
|
+
};
|
|
30
|
+
export declare class BamlSyncClient {
|
|
31
|
+
private runtime;
|
|
32
|
+
private ctxManager;
|
|
33
|
+
private httpRequest;
|
|
34
|
+
private httpStreamRequest;
|
|
35
|
+
private llmResponseParser;
|
|
36
|
+
private llmStreamParser;
|
|
37
|
+
private bamlOptions;
|
|
38
|
+
constructor(runtime: BamlRuntime, ctxManager: BamlCtxManager, bamlOptions?: BamlCallOptions);
|
|
39
|
+
withOptions(bamlOptions: BamlCallOptions): BamlSyncClient;
|
|
40
|
+
get stream(): void;
|
|
41
|
+
get request(): HttpRequest;
|
|
42
|
+
get streamRequest(): HttpStreamRequest;
|
|
43
|
+
get parse(): LlmResponseParser;
|
|
44
|
+
get parseStream(): LlmStreamParser;
|
|
45
|
+
CreatePartialRecipe(memory: types.AgentContext, task: string, taskData: (Image | string)[], includeClaudeSpoof: boolean, __baml_options__?: BamlCallOptions): types.PartialRecipe;
|
|
46
|
+
ExtractData(instructions: string, screenshot: Image, domContent: string, includeClaudeSpoof: boolean, __baml_options__?: BamlCallOptions): types.ExtractedData;
|
|
47
|
+
QueryMemory(memory: types.AgentContext, query: string, includeClaudeSpoof: boolean, __baml_options__?: BamlCallOptions): types.QueryResponse;
|
|
48
|
+
}
|
|
49
|
+
export declare const b: BamlSyncClient;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/*************************************************************************************************
|
|
2
|
+
|
|
3
|
+
Welcome to Baml! To use this generated code, please run one of the following:
|
|
4
|
+
|
|
5
|
+
$ npm install @boundaryml/baml
|
|
6
|
+
$ yarn add @boundaryml/baml
|
|
7
|
+
$ pnpm add @boundaryml/baml
|
|
8
|
+
|
|
9
|
+
*************************************************************************************************/
|
|
10
|
+
import { toBamlError } from "@boundaryml/baml";
|
|
11
|
+
import { HttpRequest, HttpStreamRequest } from "./sync_request";
|
|
12
|
+
import { LlmResponseParser, LlmStreamParser } from "./parser";
|
|
13
|
+
import { DO_NOT_USE_DIRECTLY_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_CTX, DO_NOT_USE_DIRECTLY_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_RUNTIME } from "./globals";
|
|
14
|
+
export class BamlSyncClient {
|
|
15
|
+
runtime;
|
|
16
|
+
ctxManager;
|
|
17
|
+
httpRequest;
|
|
18
|
+
httpStreamRequest;
|
|
19
|
+
llmResponseParser;
|
|
20
|
+
llmStreamParser;
|
|
21
|
+
bamlOptions;
|
|
22
|
+
constructor(runtime, ctxManager, bamlOptions) {
|
|
23
|
+
this.runtime = runtime;
|
|
24
|
+
this.ctxManager = ctxManager;
|
|
25
|
+
this.httpRequest = new HttpRequest(runtime, ctxManager);
|
|
26
|
+
this.httpStreamRequest = new HttpStreamRequest(runtime, ctxManager);
|
|
27
|
+
this.llmResponseParser = new LlmResponseParser(runtime, ctxManager);
|
|
28
|
+
this.llmStreamParser = new LlmStreamParser(runtime, ctxManager);
|
|
29
|
+
this.bamlOptions = bamlOptions || {};
|
|
30
|
+
}
|
|
31
|
+
withOptions(bamlOptions) {
|
|
32
|
+
return new BamlSyncClient(this.runtime, this.ctxManager, bamlOptions);
|
|
33
|
+
}
|
|
34
|
+
/*
|
|
35
|
+
* @deprecated NOT IMPLEMENTED as streaming must by async. We
|
|
36
|
+
* are not providing an async version as we want to reserve the
|
|
37
|
+
* right to provide a sync version in the future.
|
|
38
|
+
*/
|
|
39
|
+
get stream() {
|
|
40
|
+
throw new Error("stream is not available in BamlSyncClient. Use `import { b } from 'baml_client/async_client");
|
|
41
|
+
}
|
|
42
|
+
get request() {
|
|
43
|
+
return this.httpRequest;
|
|
44
|
+
}
|
|
45
|
+
get streamRequest() {
|
|
46
|
+
return this.httpStreamRequest;
|
|
47
|
+
}
|
|
48
|
+
get parse() {
|
|
49
|
+
return this.llmResponseParser;
|
|
50
|
+
}
|
|
51
|
+
get parseStream() {
|
|
52
|
+
return this.llmStreamParser;
|
|
53
|
+
}
|
|
54
|
+
CreatePartialRecipe(memory, task, taskData, includeClaudeSpoof, __baml_options__) {
|
|
55
|
+
try {
|
|
56
|
+
const options = { ...this.bamlOptions, ...(__baml_options__ || {}) };
|
|
57
|
+
const collector = options.collector ? (Array.isArray(options.collector) ? options.collector : [options.collector]) : [];
|
|
58
|
+
const rawEnv = __baml_options__?.env ? { ...process.env, ...__baml_options__.env } : { ...process.env };
|
|
59
|
+
const env = Object.fromEntries(Object.entries(rawEnv).filter(([_, value]) => value !== undefined));
|
|
60
|
+
const raw = this.runtime.callFunctionSync("CreatePartialRecipe", {
|
|
61
|
+
"memory": memory, "task": task, "taskData": taskData, "includeClaudeSpoof": includeClaudeSpoof
|
|
62
|
+
}, this.ctxManager.cloneContext(), options.tb?.__tb(), options.clientRegistry, collector, env);
|
|
63
|
+
return raw.parsed(false);
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
throw toBamlError(error);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
ExtractData(instructions, screenshot, domContent, includeClaudeSpoof, __baml_options__) {
|
|
70
|
+
try {
|
|
71
|
+
const options = { ...this.bamlOptions, ...(__baml_options__ || {}) };
|
|
72
|
+
const collector = options.collector ? (Array.isArray(options.collector) ? options.collector : [options.collector]) : [];
|
|
73
|
+
const rawEnv = __baml_options__?.env ? { ...process.env, ...__baml_options__.env } : { ...process.env };
|
|
74
|
+
const env = Object.fromEntries(Object.entries(rawEnv).filter(([_, value]) => value !== undefined));
|
|
75
|
+
const raw = this.runtime.callFunctionSync("ExtractData", {
|
|
76
|
+
"instructions": instructions, "screenshot": screenshot, "domContent": domContent, "includeClaudeSpoof": includeClaudeSpoof
|
|
77
|
+
}, this.ctxManager.cloneContext(), options.tb?.__tb(), options.clientRegistry, collector, env);
|
|
78
|
+
return raw.parsed(false);
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
throw toBamlError(error);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
QueryMemory(memory, query, includeClaudeSpoof, __baml_options__) {
|
|
85
|
+
try {
|
|
86
|
+
const options = { ...this.bamlOptions, ...(__baml_options__ || {}) };
|
|
87
|
+
const collector = options.collector ? (Array.isArray(options.collector) ? options.collector : [options.collector]) : [];
|
|
88
|
+
const rawEnv = __baml_options__?.env ? { ...process.env, ...__baml_options__.env } : { ...process.env };
|
|
89
|
+
const env = Object.fromEntries(Object.entries(rawEnv).filter(([_, value]) => value !== undefined));
|
|
90
|
+
const raw = this.runtime.callFunctionSync("QueryMemory", {
|
|
91
|
+
"memory": memory, "query": query, "includeClaudeSpoof": includeClaudeSpoof
|
|
92
|
+
}, this.ctxManager.cloneContext(), options.tb?.__tb(), options.clientRegistry, collector, env);
|
|
93
|
+
return raw.parsed(false);
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
throw toBamlError(error);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
export const b = new BamlSyncClient(DO_NOT_USE_DIRECTLY_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_RUNTIME, DO_NOT_USE_DIRECTLY_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_CTX);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*************************************************************************************************
|
|
2
|
+
|
|
3
|
+
Welcome to Baml! To use this generated code, please run one of the following:
|
|
4
|
+
|
|
5
|
+
$ npm install @boundaryml/baml
|
|
6
|
+
$ yarn add @boundaryml/baml
|
|
7
|
+
$ pnpm add @boundaryml/baml
|
|
8
|
+
|
|
9
|
+
*************************************************************************************************/
|
|
10
|
+
import type { BamlRuntime, BamlCtxManager, ClientRegistry, Image } from "@boundaryml/baml";
|
|
11
|
+
import { HTTPRequest } from "@boundaryml/baml";
|
|
12
|
+
import type * as types from "./types";
|
|
13
|
+
import type TypeBuilder from "./type_builder";
|
|
14
|
+
type BamlCallOptions = {
|
|
15
|
+
tb?: TypeBuilder;
|
|
16
|
+
clientRegistry?: ClientRegistry;
|
|
17
|
+
env?: Record<string, string | undefined>;
|
|
18
|
+
};
|
|
19
|
+
export declare class HttpRequest {
|
|
20
|
+
private runtime;
|
|
21
|
+
private ctxManager;
|
|
22
|
+
constructor(runtime: BamlRuntime, ctxManager: BamlCtxManager);
|
|
23
|
+
CreatePartialRecipe(memory: types.AgentContext, task: string, taskData: (Image | string)[], includeClaudeSpoof: boolean, __baml_options__?: BamlCallOptions): HTTPRequest;
|
|
24
|
+
ExtractData(instructions: string, screenshot: Image, domContent: string, includeClaudeSpoof: boolean, __baml_options__?: BamlCallOptions): HTTPRequest;
|
|
25
|
+
QueryMemory(memory: types.AgentContext, query: string, includeClaudeSpoof: boolean, __baml_options__?: BamlCallOptions): HTTPRequest;
|
|
26
|
+
}
|
|
27
|
+
export declare class HttpStreamRequest {
|
|
28
|
+
private runtime;
|
|
29
|
+
private ctxManager;
|
|
30
|
+
constructor(runtime: BamlRuntime, ctxManager: BamlCtxManager);
|
|
31
|
+
CreatePartialRecipe(memory: types.AgentContext, task: string, taskData: (Image | string)[], includeClaudeSpoof: boolean, __baml_options__?: BamlCallOptions): HTTPRequest;
|
|
32
|
+
ExtractData(instructions: string, screenshot: Image, domContent: string, includeClaudeSpoof: boolean, __baml_options__?: BamlCallOptions): HTTPRequest;
|
|
33
|
+
QueryMemory(memory: types.AgentContext, query: string, includeClaudeSpoof: boolean, __baml_options__?: BamlCallOptions): HTTPRequest;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/*************************************************************************************************
|
|
2
|
+
|
|
3
|
+
Welcome to Baml! To use this generated code, please run one of the following:
|
|
4
|
+
|
|
5
|
+
$ npm install @boundaryml/baml
|
|
6
|
+
$ yarn add @boundaryml/baml
|
|
7
|
+
$ pnpm add @boundaryml/baml
|
|
8
|
+
|
|
9
|
+
*************************************************************************************************/
|
|
10
|
+
import { toBamlError } from "@boundaryml/baml";
|
|
11
|
+
export class HttpRequest {
|
|
12
|
+
runtime;
|
|
13
|
+
ctxManager;
|
|
14
|
+
constructor(runtime, ctxManager) {
|
|
15
|
+
this.runtime = runtime;
|
|
16
|
+
this.ctxManager = ctxManager;
|
|
17
|
+
}
|
|
18
|
+
CreatePartialRecipe(memory, task, taskData, includeClaudeSpoof, __baml_options__) {
|
|
19
|
+
try {
|
|
20
|
+
const rawEnv = __baml_options__?.env ? { ...process.env, ...__baml_options__.env } : { ...process.env };
|
|
21
|
+
const env = Object.fromEntries(Object.entries(rawEnv).filter(([_, value]) => value !== undefined));
|
|
22
|
+
return this.runtime.buildRequestSync("CreatePartialRecipe", {
|
|
23
|
+
"memory": memory, "task": task, "taskData": taskData, "includeClaudeSpoof": includeClaudeSpoof
|
|
24
|
+
}, this.ctxManager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, false, env);
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
throw toBamlError(error);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
ExtractData(instructions, screenshot, domContent, includeClaudeSpoof, __baml_options__) {
|
|
31
|
+
try {
|
|
32
|
+
const rawEnv = __baml_options__?.env ? { ...process.env, ...__baml_options__.env } : { ...process.env };
|
|
33
|
+
const env = Object.fromEntries(Object.entries(rawEnv).filter(([_, value]) => value !== undefined));
|
|
34
|
+
return this.runtime.buildRequestSync("ExtractData", {
|
|
35
|
+
"instructions": instructions, "screenshot": screenshot, "domContent": domContent, "includeClaudeSpoof": includeClaudeSpoof
|
|
36
|
+
}, this.ctxManager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, false, env);
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
throw toBamlError(error);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
QueryMemory(memory, query, includeClaudeSpoof, __baml_options__) {
|
|
43
|
+
try {
|
|
44
|
+
const rawEnv = __baml_options__?.env ? { ...process.env, ...__baml_options__.env } : { ...process.env };
|
|
45
|
+
const env = Object.fromEntries(Object.entries(rawEnv).filter(([_, value]) => value !== undefined));
|
|
46
|
+
return this.runtime.buildRequestSync("QueryMemory", {
|
|
47
|
+
"memory": memory, "query": query, "includeClaudeSpoof": includeClaudeSpoof
|
|
48
|
+
}, this.ctxManager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, false, env);
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
throw toBamlError(error);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export class HttpStreamRequest {
|
|
56
|
+
runtime;
|
|
57
|
+
ctxManager;
|
|
58
|
+
constructor(runtime, ctxManager) {
|
|
59
|
+
this.runtime = runtime;
|
|
60
|
+
this.ctxManager = ctxManager;
|
|
61
|
+
}
|
|
62
|
+
CreatePartialRecipe(memory, task, taskData, includeClaudeSpoof, __baml_options__) {
|
|
63
|
+
try {
|
|
64
|
+
const rawEnv = __baml_options__?.env ? { ...process.env, ...__baml_options__.env } : { ...process.env };
|
|
65
|
+
const env = Object.fromEntries(Object.entries(rawEnv).filter(([_, value]) => value !== undefined));
|
|
66
|
+
return this.runtime.buildRequestSync("CreatePartialRecipe", {
|
|
67
|
+
"memory": memory, "task": task, "taskData": taskData, "includeClaudeSpoof": includeClaudeSpoof
|
|
68
|
+
}, this.ctxManager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, true, env);
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
throw toBamlError(error);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
ExtractData(instructions, screenshot, domContent, includeClaudeSpoof, __baml_options__) {
|
|
75
|
+
try {
|
|
76
|
+
const rawEnv = __baml_options__?.env ? { ...process.env, ...__baml_options__.env } : { ...process.env };
|
|
77
|
+
const env = Object.fromEntries(Object.entries(rawEnv).filter(([_, value]) => value !== undefined));
|
|
78
|
+
return this.runtime.buildRequestSync("ExtractData", {
|
|
79
|
+
"instructions": instructions, "screenshot": screenshot, "domContent": domContent, "includeClaudeSpoof": includeClaudeSpoof
|
|
80
|
+
}, this.ctxManager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, true, env);
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
throw toBamlError(error);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
QueryMemory(memory, query, includeClaudeSpoof, __baml_options__) {
|
|
87
|
+
try {
|
|
88
|
+
const rawEnv = __baml_options__?.env ? { ...process.env, ...__baml_options__.env } : { ...process.env };
|
|
89
|
+
const env = Object.fromEntries(Object.entries(rawEnv).filter(([_, value]) => value !== undefined));
|
|
90
|
+
return this.runtime.buildRequestSync("QueryMemory", {
|
|
91
|
+
"memory": memory, "query": query, "includeClaudeSpoof": includeClaudeSpoof
|
|
92
|
+
}, this.ctxManager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, true, env);
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
throw toBamlError(error);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*************************************************************************************************
|
|
2
|
+
|
|
3
|
+
Welcome to Baml! To use this generated code, please run one of the following:
|
|
4
|
+
|
|
5
|
+
$ npm install @boundaryml/baml
|
|
6
|
+
$ yarn add @boundaryml/baml
|
|
7
|
+
$ pnpm add @boundaryml/baml
|
|
8
|
+
|
|
9
|
+
*************************************************************************************************/
|
|
10
|
+
import type { BamlLogEvent } from '@boundaryml/baml';
|
|
11
|
+
declare const traceAsync: <ReturnType, F extends (...args: any[]) => Promise<ReturnType>>(name: string, func: F) => F;
|
|
12
|
+
declare const traceSync: <ReturnType, F extends (...args: any[]) => ReturnType>(name: string, func: F) => F;
|
|
13
|
+
declare const setTags: (tags: Record<string, string>) => void;
|
|
14
|
+
declare const flush: () => void;
|
|
15
|
+
declare const onLogEvent: (callback: undefined | ((event: BamlLogEvent) => void)) => void;
|
|
16
|
+
export { traceAsync, traceSync, setTags, flush, onLogEvent };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*************************************************************************************************
|
|
2
|
+
|
|
3
|
+
Welcome to Baml! To use this generated code, please run one of the following:
|
|
4
|
+
|
|
5
|
+
$ npm install @boundaryml/baml
|
|
6
|
+
$ yarn add @boundaryml/baml
|
|
7
|
+
$ pnpm add @boundaryml/baml
|
|
8
|
+
|
|
9
|
+
*************************************************************************************************/
|
|
10
|
+
import { DO_NOT_USE_DIRECTLY_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_CTX } from './globals';
|
|
11
|
+
const traceAsync = DO_NOT_USE_DIRECTLY_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_CTX.traceFnAsync.bind(DO_NOT_USE_DIRECTLY_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_CTX);
|
|
12
|
+
const traceSync = DO_NOT_USE_DIRECTLY_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_CTX.traceFnSync.bind(DO_NOT_USE_DIRECTLY_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_CTX);
|
|
13
|
+
const setTags = DO_NOT_USE_DIRECTLY_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_CTX.upsertTags.bind(DO_NOT_USE_DIRECTLY_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_CTX);
|
|
14
|
+
const flush = () => {
|
|
15
|
+
DO_NOT_USE_DIRECTLY_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_CTX.flush.bind(DO_NOT_USE_DIRECTLY_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_CTX)();
|
|
16
|
+
};
|
|
17
|
+
const onLogEvent = (callback) => DO_NOT_USE_DIRECTLY_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_CTX.onLogEvent(callback);
|
|
18
|
+
export { traceAsync, traceSync, setTags, flush, onLogEvent };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*************************************************************************************************
|
|
2
|
+
|
|
3
|
+
Welcome to Baml! To use this generated code, please run one of the following:
|
|
4
|
+
|
|
5
|
+
$ npm install @boundaryml/baml
|
|
6
|
+
$ yarn add @boundaryml/baml
|
|
7
|
+
$ pnpm add @boundaryml/baml
|
|
8
|
+
|
|
9
|
+
*************************************************************************************************/
|
|
10
|
+
import { FieldType } from '@boundaryml/baml/native';
|
|
11
|
+
import { EnumBuilder, ClassBuilder, ClassViewer } from '@boundaryml/baml/type_builder';
|
|
12
|
+
export default class TypeBuilder {
|
|
13
|
+
private tb;
|
|
14
|
+
AgentContext: ClassViewer<'AgentContext', "instructions" | "observationContent" | "connectorInstructions">;
|
|
15
|
+
BugFailureClassification: ClassViewer<'BugFailureClassification', "reasoning" | "classification" | "title" | "expectedResult" | "actualResult" | "severity">;
|
|
16
|
+
ConnectorInstructions: ClassViewer<'ConnectorInstructions', "connectorId" | "instructions">;
|
|
17
|
+
ExtractedData: ClassBuilder<'ExtractedData'>;
|
|
18
|
+
MisalignmentClassification: ClassViewer<'MisalignmentClassification', "reasoning" | "classification" | "fault" | "message">;
|
|
19
|
+
MultiMediaMessage: ClassViewer<'MultiMediaMessage', "role" | "cacheControl" | "content">;
|
|
20
|
+
PartialRecipe: ClassBuilder<'PartialRecipe', "reasoning">;
|
|
21
|
+
QueryResponse: ClassBuilder<'QueryResponse'>;
|
|
22
|
+
constructor();
|
|
23
|
+
__tb(): import("@boundaryml/baml/native").TypeBuilder;
|
|
24
|
+
string(): FieldType;
|
|
25
|
+
literalString(value: string): FieldType;
|
|
26
|
+
literalInt(value: number): FieldType;
|
|
27
|
+
literalBool(value: boolean): FieldType;
|
|
28
|
+
int(): FieldType;
|
|
29
|
+
float(): FieldType;
|
|
30
|
+
bool(): FieldType;
|
|
31
|
+
list(type: FieldType): FieldType;
|
|
32
|
+
null(): FieldType;
|
|
33
|
+
map(key: FieldType, value: FieldType): FieldType;
|
|
34
|
+
union(types: FieldType[]): FieldType;
|
|
35
|
+
addClass<Name extends string>(name: Name): ClassBuilder<Name>;
|
|
36
|
+
addEnum<Name extends string>(name: Name): EnumBuilder<Name>;
|
|
37
|
+
addBaml(baml: string): void;
|
|
38
|
+
}
|