@bbclaw/core 0.1.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/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/providers/anthropic/index.d.ts +44 -0
- package/dist/providers/anthropic/index.d.ts.map +1 -0
- package/dist/providers/anthropic/index.js +75 -0
- package/dist/providers/anthropic/index.js.map +1 -0
- package/dist/providers/index.d.ts +8 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +8 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/openai-compat/index.d.ts +59 -0
- package/dist/providers/openai-compat/index.d.ts.map +1 -0
- package/dist/providers/openai-compat/index.js +175 -0
- package/dist/providers/openai-compat/index.js.map +1 -0
- package/dist/providers/openai-compat/presets.d.ts +22 -0
- package/dist/providers/openai-compat/presets.d.ts.map +1 -0
- package/dist/providers/openai-compat/presets.js +73 -0
- package/dist/providers/openai-compat/presets.js.map +1 -0
- package/dist/providers/openai-compat/requestTranslate.d.ts +39 -0
- package/dist/providers/openai-compat/requestTranslate.d.ts.map +1 -0
- package/dist/providers/openai-compat/requestTranslate.js +228 -0
- package/dist/providers/openai-compat/requestTranslate.js.map +1 -0
- package/dist/providers/openai-compat/sseParser.d.ts +29 -0
- package/dist/providers/openai-compat/sseParser.d.ts.map +1 -0
- package/dist/providers/openai-compat/sseParser.js +139 -0
- package/dist/providers/openai-compat/sseParser.js.map +1 -0
- package/dist/providers/openai-compat/streamAdapter.d.ts +45 -0
- package/dist/providers/openai-compat/streamAdapter.d.ts.map +1 -0
- package/dist/providers/openai-compat/streamAdapter.js +233 -0
- package/dist/providers/openai-compat/streamAdapter.js.map +1 -0
- package/dist/providers/openai-compat/types.d.ts +126 -0
- package/dist/providers/openai-compat/types.d.ts.map +1 -0
- package/dist/providers/openai-compat/types.js +11 -0
- package/dist/providers/openai-compat/types.js.map +1 -0
- package/dist/providers/selector.d.ts +52 -0
- package/dist/providers/selector.d.ts.map +1 -0
- package/dist/providers/selector.js +101 -0
- package/dist/providers/selector.js.map +1 -0
- package/dist/providers/types.d.ts +114 -0
- package/dist/providers/types.d.ts.map +1 -0
- package/dist/providers/types.js +152 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/providers/web-bridge/deepseek/spec.d.ts +22 -0
- package/dist/providers/web-bridge/deepseek/spec.d.ts.map +1 -0
- package/dist/providers/web-bridge/deepseek/spec.js +70 -0
- package/dist/providers/web-bridge/deepseek/spec.js.map +1 -0
- package/dist/providers/web-bridge/historySerializer.d.ts +49 -0
- package/dist/providers/web-bridge/historySerializer.d.ts.map +1 -0
- package/dist/providers/web-bridge/historySerializer.js +152 -0
- package/dist/providers/web-bridge/historySerializer.js.map +1 -0
- package/dist/providers/web-bridge/index.d.ts +10 -0
- package/dist/providers/web-bridge/index.d.ts.map +1 -0
- package/dist/providers/web-bridge/index.js +10 -0
- package/dist/providers/web-bridge/index.js.map +1 -0
- package/dist/providers/web-bridge/promptInjector.d.ts +63 -0
- package/dist/providers/web-bridge/promptInjector.d.ts.map +1 -0
- package/dist/providers/web-bridge/promptInjector.js +189 -0
- package/dist/providers/web-bridge/promptInjector.js.map +1 -0
- package/dist/providers/web-bridge/provider.d.ts +59 -0
- package/dist/providers/web-bridge/provider.d.ts.map +1 -0
- package/dist/providers/web-bridge/provider.js +176 -0
- package/dist/providers/web-bridge/provider.js.map +1 -0
- package/dist/providers/web-bridge/shared/BrowserSession.d.ts +51 -0
- package/dist/providers/web-bridge/shared/BrowserSession.d.ts.map +1 -0
- package/dist/providers/web-bridge/shared/BrowserSession.js +88 -0
- package/dist/providers/web-bridge/shared/BrowserSession.js.map +1 -0
- package/dist/providers/web-bridge/shared/WebBridgeAdapter.d.ts +97 -0
- package/dist/providers/web-bridge/shared/WebBridgeAdapter.d.ts.map +1 -0
- package/dist/providers/web-bridge/shared/WebBridgeAdapter.js +359 -0
- package/dist/providers/web-bridge/shared/WebBridgeAdapter.js.map +1 -0
- package/dist/providers/web-bridge/shared/observerScript.d.ts +41 -0
- package/dist/providers/web-bridge/shared/observerScript.d.ts.map +1 -0
- package/dist/providers/web-bridge/shared/observerScript.js +138 -0
- package/dist/providers/web-bridge/shared/observerScript.js.map +1 -0
- package/dist/providers/web-bridge/shared/types.d.ts +94 -0
- package/dist/providers/web-bridge/shared/types.d.ts.map +1 -0
- package/dist/providers/web-bridge/shared/types.js +25 -0
- package/dist/providers/web-bridge/shared/types.js.map +1 -0
- package/dist/providers/web-bridge/toolUseParser.d.ts +70 -0
- package/dist/providers/web-bridge/toolUseParser.d.ts.map +1 -0
- package/dist/providers/web-bridge/toolUseParser.js +360 -0
- package/dist/providers/web-bridge/toolUseParser.js.map +1 -0
- package/package.json +36 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observerScript.js","sourceRoot":"","sources":["../../../../src/providers/web-bridge/shared/observerScript.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAaH,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuG7B,CAAA;AAEH;;;;;;;GAOG;AACH,MAAM,UAAU,yBAAyB,CAAC,SAAkC;IAC1E,OAAO,GAAG,aAAa,IAAI,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAA;AAC1D,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types shared across all WebBridge implementations.
|
|
3
|
+
*
|
|
4
|
+
* Each "adapter" is just a WebBridgeSpec object plus a service-specific set of
|
|
5
|
+
* fallback strategies for finding UI elements. The common WebBridgeAdapter
|
|
6
|
+
* class consumes the spec and provides lifecycle, observer injection, and
|
|
7
|
+
* streaming.
|
|
8
|
+
*/
|
|
9
|
+
import type { Locator, Page } from 'playwright';
|
|
10
|
+
/**
|
|
11
|
+
* CSS selectors used to locate elements inside the target service's DOM.
|
|
12
|
+
*
|
|
13
|
+
* Each value is a comma-separated list of CSS selectors so we can supply
|
|
14
|
+
* multiple aliases. The first match wins. This is the simplest way to make a
|
|
15
|
+
* scraper resilient to minor class-name churn (webpack hash regeneration,
|
|
16
|
+
* minor refactors, etc).
|
|
17
|
+
*
|
|
18
|
+
* If a service redesigns its DOM entirely, the fix is to widen these
|
|
19
|
+
* selectors — they're intentionally exposed as part of the spec so a single
|
|
20
|
+
* file change can recover a broken adapter.
|
|
21
|
+
*/
|
|
22
|
+
export interface WebBridgeSelectors {
|
|
23
|
+
/** Text input where the user types a prompt. */
|
|
24
|
+
composer: string;
|
|
25
|
+
/**
|
|
26
|
+
* Container around each rendered AI response. The page may have many of
|
|
27
|
+
* these (one per turn); we slice by turn boundary at runtime.
|
|
28
|
+
*/
|
|
29
|
+
responseRoot: string;
|
|
30
|
+
/** Container around each user-side message bubble. */
|
|
31
|
+
userMessage: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Strategy for finding the "new chat" / "新对话" button. We try a list of
|
|
35
|
+
* locator strategies in order; the first one to click successfully wins.
|
|
36
|
+
* A bare URL navigation is always tried last as a fallback in the adapter.
|
|
37
|
+
*/
|
|
38
|
+
export type NewChatStrategy = (page: Page) => Locator;
|
|
39
|
+
/**
|
|
40
|
+
* Anti-bot mitigation level. `off` is the default for well-behaved services
|
|
41
|
+
* (DeepSeek, Kimi); `aggressive` is needed for OpenAI/Anthropic web with
|
|
42
|
+
* Cloudflare protection. Implemented in {@link applyStealth}.
|
|
43
|
+
*/
|
|
44
|
+
export type StealthLevel = 'off' | 'basic' | 'aggressive';
|
|
45
|
+
/**
|
|
46
|
+
* A complete description of a web-bridge target. Lives in a per-service file
|
|
47
|
+
* (e.g. deepseek/spec.ts) and is consumed by WebBridgeAdapter.
|
|
48
|
+
*/
|
|
49
|
+
export interface WebBridgeSpec {
|
|
50
|
+
/** Stable identifier — also used as the provider id. */
|
|
51
|
+
readonly serviceId: 'deepseek-web' | 'kimi-web' | 'chatgpt-web' | 'claude-ai-web' | 'gemini-web' | 'tongyi-web';
|
|
52
|
+
/** Display label. */
|
|
53
|
+
readonly displayName: string;
|
|
54
|
+
/** Initial URL to navigate to. */
|
|
55
|
+
readonly homeUrl: string;
|
|
56
|
+
/** DOM selectors with aliases. */
|
|
57
|
+
readonly selectors: WebBridgeSelectors;
|
|
58
|
+
/** Ordered fallback strategies for the "new chat" button. */
|
|
59
|
+
readonly newChatStrategies: NewChatStrategy[];
|
|
60
|
+
/** Recommended anti-bot level for this service. */
|
|
61
|
+
readonly stealthLevel: StealthLevel;
|
|
62
|
+
/**
|
|
63
|
+
* Maximum context window the service's chat UI is willing to accept (in
|
|
64
|
+
* approximate tokens). Used by capability advertisement; conservative
|
|
65
|
+
* defaults are fine — we'd rather under-promise.
|
|
66
|
+
*/
|
|
67
|
+
readonly contextWindowEstimate: number;
|
|
68
|
+
}
|
|
69
|
+
/** State observable from outside the adapter. */
|
|
70
|
+
export interface WebBridgeState {
|
|
71
|
+
/** Page is open and not navigated away. */
|
|
72
|
+
running: boolean;
|
|
73
|
+
/** Running headless (true) vs visible (false). */
|
|
74
|
+
headless: boolean;
|
|
75
|
+
/** Currently mid-turn (awaiting a response). */
|
|
76
|
+
busy: boolean;
|
|
77
|
+
/** Service has confirmed login (composer reachable). */
|
|
78
|
+
loggedIn: boolean | 'unknown';
|
|
79
|
+
}
|
|
80
|
+
/** Listener types for the adapter's event hooks. */
|
|
81
|
+
export type ResponseTextListener = (cumulativeText: string, done: boolean) => void;
|
|
82
|
+
export type ExternalUserMessageListener = (text: string) => void;
|
|
83
|
+
export type StateChangeListener = (state: WebBridgeState) => void;
|
|
84
|
+
/** Error thrown when login is required (composer never appears within timeout). */
|
|
85
|
+
export declare class BridgeLoginRequiredError extends Error {
|
|
86
|
+
readonly code: "login-required";
|
|
87
|
+
constructor(message?: string);
|
|
88
|
+
}
|
|
89
|
+
/** Error thrown when the target page DOM has changed beyond recognition. */
|
|
90
|
+
export declare class BridgeDOMUnrecognizedError extends Error {
|
|
91
|
+
readonly code: "dom-unrecognized";
|
|
92
|
+
constructor(message: string);
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/providers/web-bridge/shared/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAE/C;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,kBAAkB;IACjC,gDAAgD;IAChD,QAAQ,EAAE,MAAM,CAAA;IAChB;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAA;IACpB,sDAAsD;IACtD,WAAW,EAAE,MAAM,CAAA;CACpB;AAED;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAA;AAErD;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,OAAO,GAAG,YAAY,CAAA;AAEzD;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,wDAAwD;IACxD,QAAQ,CAAC,SAAS,EAAE,cAAc,GAAG,UAAU,GAAG,aAAa,GAAG,eAAe,GAAG,YAAY,GAAG,YAAY,CAAA;IAC/G,qBAAqB;IACrB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,kCAAkC;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,kCAAkC;IAClC,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAA;IACtC,6DAA6D;IAC7D,QAAQ,CAAC,iBAAiB,EAAE,eAAe,EAAE,CAAA;IAC7C,mDAAmD;IACnD,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAA;IACnC;;;;OAIG;IACH,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAA;CACvC;AAED,iDAAiD;AACjD,MAAM,WAAW,cAAc;IAC7B,2CAA2C;IAC3C,OAAO,EAAE,OAAO,CAAA;IAChB,kDAAkD;IAClD,QAAQ,EAAE,OAAO,CAAA;IACjB,gDAAgD;IAChD,IAAI,EAAE,OAAO,CAAA;IACb,wDAAwD;IACxD,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B;AAED,oDAAoD;AACpD,MAAM,MAAM,oBAAoB,GAAG,CAAC,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;AAClF,MAAM,MAAM,2BAA2B,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;AAChE,MAAM,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAA;AAEjE,mFAAmF;AACnF,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,QAAQ,CAAC,IAAI,EAAG,gBAAgB,CAAS;gBAC7B,OAAO,SAA8B;CAIlD;AAED,4EAA4E;AAC5E,qBAAa,0BAA2B,SAAQ,KAAK;IACnD,QAAQ,CAAC,IAAI,EAAG,kBAAkB,CAAS;gBAC/B,OAAO,EAAE,MAAM;CAI5B"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types shared across all WebBridge implementations.
|
|
3
|
+
*
|
|
4
|
+
* Each "adapter" is just a WebBridgeSpec object plus a service-specific set of
|
|
5
|
+
* fallback strategies for finding UI elements. The common WebBridgeAdapter
|
|
6
|
+
* class consumes the spec and provides lifecycle, observer injection, and
|
|
7
|
+
* streaming.
|
|
8
|
+
*/
|
|
9
|
+
/** Error thrown when login is required (composer never appears within timeout). */
|
|
10
|
+
export class BridgeLoginRequiredError extends Error {
|
|
11
|
+
code = 'login-required';
|
|
12
|
+
constructor(message = 'Web bridge requires login') {
|
|
13
|
+
super(message);
|
|
14
|
+
this.name = 'BridgeLoginRequiredError';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/** Error thrown when the target page DOM has changed beyond recognition. */
|
|
18
|
+
export class BridgeDOMUnrecognizedError extends Error {
|
|
19
|
+
code = 'dom-unrecognized';
|
|
20
|
+
constructor(message) {
|
|
21
|
+
super(message);
|
|
22
|
+
this.name = 'BridgeDOMUnrecognizedError';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/providers/web-bridge/shared/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAoFH,mFAAmF;AACnF,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IACxC,IAAI,GAAG,gBAAyB,CAAA;IACzC,YAAY,OAAO,GAAG,2BAA2B;QAC/C,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAA;IACxC,CAAC;CACF;AAED,4EAA4E;AAC5E,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IAC1C,IAAI,GAAG,kBAA2B,CAAA;IAC3C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAA;IAC1C,CAAC;CACF"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Streaming parser for the web-bridge tool-use XML protocol (arg-tag format).
|
|
3
|
+
*
|
|
4
|
+
* Feeds on text deltas from the web bridge (cumulative text diffed into
|
|
5
|
+
* deltas upstream) and yields Anthropic-shaped content_block events. The
|
|
6
|
+
* adapter consumes these and emits them as part of its overall stream.
|
|
7
|
+
*
|
|
8
|
+
* Grammar:
|
|
9
|
+
*
|
|
10
|
+
* <tool_use>
|
|
11
|
+
* <name>ToolName</name>
|
|
12
|
+
* <arg name="key1">raw text value 1</arg>
|
|
13
|
+
* <arg name="key2">raw text value 2 (may span lines)</arg>
|
|
14
|
+
* ...
|
|
15
|
+
* </tool_use>
|
|
16
|
+
*
|
|
17
|
+
* State machine:
|
|
18
|
+
*
|
|
19
|
+
* text → (sees "<tool_use>") → inside-tool-use
|
|
20
|
+
* inside-tool-use → (sees "<name>") → reading-name
|
|
21
|
+
* reading-name → (sees "</name>") → awaiting-arg-or-close
|
|
22
|
+
* emits content_block_start (tool_use, input={})
|
|
23
|
+
* awaiting-arg-or-close → (sees "<arg name=\"") → reading-arg-name
|
|
24
|
+
* → (sees "</tool_use>") → flushing → done
|
|
25
|
+
* reading-arg-name → (sees "\">") → reading-arg-value
|
|
26
|
+
* reading-arg-value → (sees "</arg>") → awaiting-arg-or-close
|
|
27
|
+
*
|
|
28
|
+
* Safety properties:
|
|
29
|
+
* - Text-state buffer holds back the last MAX_TAG_LEN chars until either
|
|
30
|
+
* a tag is matched or the window grows past it, so a partial "<tool_us"
|
|
31
|
+
* never leaks as text.
|
|
32
|
+
* - Arg-value reading uses indexOf("</arg>") to delimit, with a hold-back
|
|
33
|
+
* for partial close-tag prefixes spread across chunks.
|
|
34
|
+
* - Mid-arg or mid-name truncation at flush time yields a tool_use block
|
|
35
|
+
* with input={_malformed: rawBuffer} so the upper layer can surface a
|
|
36
|
+
* clear error rather than silently dropping the call.
|
|
37
|
+
* - One tool_use per turn: anything after the first </tool_use> is
|
|
38
|
+
* ignored, matching the protocol the model is taught.
|
|
39
|
+
*/
|
|
40
|
+
import type { RawMessageStreamEvent, StopReason } from '@anthropic-ai/sdk/resources/messages/messages.js';
|
|
41
|
+
export declare class ToolUseStreamParser {
|
|
42
|
+
private buffer;
|
|
43
|
+
private state;
|
|
44
|
+
private nextBlockIndex;
|
|
45
|
+
private textOpen;
|
|
46
|
+
private toolUseOpen;
|
|
47
|
+
private detectedToolUse;
|
|
48
|
+
private toolUseId;
|
|
49
|
+
private args;
|
|
50
|
+
/** Tracks the raw bytes consumed between <tool_use> and </tool_use> so we
|
|
51
|
+
* can dump them as _malformed if the block ends mid-parse. */
|
|
52
|
+
private rawSinceOpen;
|
|
53
|
+
feed(delta: string): Generator<RawMessageStreamEvent>;
|
|
54
|
+
flush(): Generator<RawMessageStreamEvent>;
|
|
55
|
+
get stopReason(): StopReason;
|
|
56
|
+
private collectPartialForMalformed;
|
|
57
|
+
private consume;
|
|
58
|
+
private step;
|
|
59
|
+
private stepText;
|
|
60
|
+
private stepInsideToolUse;
|
|
61
|
+
private stepReadingName;
|
|
62
|
+
private stepAwaitingArgOrClose;
|
|
63
|
+
private stepReadingArgName;
|
|
64
|
+
private stepAwaitingArgValue;
|
|
65
|
+
private stepReadingArgValue;
|
|
66
|
+
private emitText;
|
|
67
|
+
private recoverMalformedToText;
|
|
68
|
+
private resetToText;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=toolUseParser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolUseParser.d.ts","sourceRoot":"","sources":["../../../src/providers/web-bridge/toolUseParser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAGH,OAAO,KAAK,EACV,qBAAqB,EACrB,UAAU,EACX,MAAM,kDAAkD,CAAA;AA+BzD,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,KAAK,CAAgC;IAC7C,OAAO,CAAC,cAAc,CAAI;IAC1B,OAAO,CAAC,QAAQ,CAAQ;IACxB,OAAO,CAAC,WAAW,CAAQ;IAC3B,OAAO,CAAC,eAAe,CAAQ;IAC/B,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,IAAI,CAA6B;IACzC;mEAC+D;IAC/D,OAAO,CAAC,YAAY,CAAK;IAEjB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC,qBAAqB,CAAC;IAMrD,KAAK,IAAI,SAAS,CAAC,qBAAqB,CAAC;IA2BjD,IAAI,UAAU,IAAI,UAAU,CAE3B;IAID,OAAO,CAAC,0BAA0B;IAiBlC,OAAO,CAAE,OAAO;IAUhB,OAAO,CAAE,IAAI;IA4Bb,OAAO,CAAE,QAAQ;IAuBjB,OAAO,CAAE,iBAAiB;IAyB1B,OAAO,CAAE,eAAe;IAsCxB,OAAO,CAAE,sBAAsB;IAyC/B,OAAO,CAAE,kBAAkB;IA0B3B,OAAO,CAAE,oBAAoB;IAa7B,OAAO,CAAE,mBAAmB;IA0B5B,OAAO,CAAE,QAAQ;IAiBjB,OAAO,CAAE,sBAAsB;IAI/B,OAAO,CAAC,WAAW;CAIpB"}
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Streaming parser for the web-bridge tool-use XML protocol (arg-tag format).
|
|
3
|
+
*
|
|
4
|
+
* Feeds on text deltas from the web bridge (cumulative text diffed into
|
|
5
|
+
* deltas upstream) and yields Anthropic-shaped content_block events. The
|
|
6
|
+
* adapter consumes these and emits them as part of its overall stream.
|
|
7
|
+
*
|
|
8
|
+
* Grammar:
|
|
9
|
+
*
|
|
10
|
+
* <tool_use>
|
|
11
|
+
* <name>ToolName</name>
|
|
12
|
+
* <arg name="key1">raw text value 1</arg>
|
|
13
|
+
* <arg name="key2">raw text value 2 (may span lines)</arg>
|
|
14
|
+
* ...
|
|
15
|
+
* </tool_use>
|
|
16
|
+
*
|
|
17
|
+
* State machine:
|
|
18
|
+
*
|
|
19
|
+
* text → (sees "<tool_use>") → inside-tool-use
|
|
20
|
+
* inside-tool-use → (sees "<name>") → reading-name
|
|
21
|
+
* reading-name → (sees "</name>") → awaiting-arg-or-close
|
|
22
|
+
* emits content_block_start (tool_use, input={})
|
|
23
|
+
* awaiting-arg-or-close → (sees "<arg name=\"") → reading-arg-name
|
|
24
|
+
* → (sees "</tool_use>") → flushing → done
|
|
25
|
+
* reading-arg-name → (sees "\">") → reading-arg-value
|
|
26
|
+
* reading-arg-value → (sees "</arg>") → awaiting-arg-or-close
|
|
27
|
+
*
|
|
28
|
+
* Safety properties:
|
|
29
|
+
* - Text-state buffer holds back the last MAX_TAG_LEN chars until either
|
|
30
|
+
* a tag is matched or the window grows past it, so a partial "<tool_us"
|
|
31
|
+
* never leaks as text.
|
|
32
|
+
* - Arg-value reading uses indexOf("</arg>") to delimit, with a hold-back
|
|
33
|
+
* for partial close-tag prefixes spread across chunks.
|
|
34
|
+
* - Mid-arg or mid-name truncation at flush time yields a tool_use block
|
|
35
|
+
* with input={_malformed: rawBuffer} so the upper layer can surface a
|
|
36
|
+
* clear error rather than silently dropping the call.
|
|
37
|
+
* - One tool_use per turn: anything after the first </tool_use> is
|
|
38
|
+
* ignored, matching the protocol the model is taught.
|
|
39
|
+
*/
|
|
40
|
+
import { randomUUID } from 'node:crypto';
|
|
41
|
+
import { ARG_CLOSE, ARG_OPEN_PREFIX, ARG_OPEN_SUFFIX, TOOL_NAME_CLOSE, TOOL_NAME_OPEN, TOOL_USE_CLOSE, TOOL_USE_OPEN, unescapeArgContent, } from './promptInjector.js';
|
|
42
|
+
const MAX_TAG_LEN = Math.max(TOOL_USE_OPEN.length, TOOL_USE_CLOSE.length, TOOL_NAME_OPEN.length, TOOL_NAME_CLOSE.length, ARG_OPEN_PREFIX.length, ARG_CLOSE.length);
|
|
43
|
+
export class ToolUseStreamParser {
|
|
44
|
+
buffer = '';
|
|
45
|
+
state = { kind: 'text' };
|
|
46
|
+
nextBlockIndex = 0;
|
|
47
|
+
textOpen = false;
|
|
48
|
+
toolUseOpen = false;
|
|
49
|
+
detectedToolUse = false;
|
|
50
|
+
toolUseId = '';
|
|
51
|
+
args = {};
|
|
52
|
+
/** Tracks the raw bytes consumed between <tool_use> and </tool_use> so we
|
|
53
|
+
* can dump them as _malformed if the block ends mid-parse. */
|
|
54
|
+
rawSinceOpen = '';
|
|
55
|
+
*feed(delta) {
|
|
56
|
+
if (this.state.kind === 'done')
|
|
57
|
+
return;
|
|
58
|
+
this.buffer += delta;
|
|
59
|
+
yield* this.consume(false);
|
|
60
|
+
}
|
|
61
|
+
*flush() {
|
|
62
|
+
if (this.state.kind === 'done')
|
|
63
|
+
return;
|
|
64
|
+
yield* this.consume(true);
|
|
65
|
+
if (this.toolUseOpen) {
|
|
66
|
+
// Stream ended mid-tool-use. Salvage by emitting whatever args we
|
|
67
|
+
// already parsed plus a _malformed marker holding any in-flight
|
|
68
|
+
// partial. Tool execution layer will refuse to run with this input
|
|
69
|
+
// and surface a clean error to the model.
|
|
70
|
+
const partial = this.collectPartialForMalformed();
|
|
71
|
+
const input = { ...this.args };
|
|
72
|
+
if (partial)
|
|
73
|
+
input._malformed = partial;
|
|
74
|
+
yield {
|
|
75
|
+
type: 'content_block_delta',
|
|
76
|
+
index: this.nextBlockIndex - 1,
|
|
77
|
+
delta: { type: 'input_json_delta', partial_json: JSON.stringify(input) },
|
|
78
|
+
};
|
|
79
|
+
yield { type: 'content_block_stop', index: this.nextBlockIndex - 1 };
|
|
80
|
+
this.toolUseOpen = false;
|
|
81
|
+
}
|
|
82
|
+
if (this.textOpen) {
|
|
83
|
+
yield { type: 'content_block_stop', index: this.nextBlockIndex - 1 };
|
|
84
|
+
this.textOpen = false;
|
|
85
|
+
}
|
|
86
|
+
this.state = { kind: 'done' };
|
|
87
|
+
}
|
|
88
|
+
get stopReason() {
|
|
89
|
+
return this.detectedToolUse ? 'tool_use' : 'end_turn';
|
|
90
|
+
}
|
|
91
|
+
// ----------------------------------------------------------------
|
|
92
|
+
collectPartialForMalformed() {
|
|
93
|
+
switch (this.state.kind) {
|
|
94
|
+
case 'reading-arg-value':
|
|
95
|
+
return this.state.valueSoFar + this.buffer;
|
|
96
|
+
case 'reading-arg-name':
|
|
97
|
+
return `<arg name="${this.state.nameSoFar}${this.buffer}`;
|
|
98
|
+
case 'awaiting-arg-value':
|
|
99
|
+
return `<arg name="${this.state.argName}">${this.buffer}`;
|
|
100
|
+
case 'awaiting-arg-or-close':
|
|
101
|
+
case 'inside-tool-use':
|
|
102
|
+
case 'reading-name':
|
|
103
|
+
return this.rawSinceOpen + this.buffer || null;
|
|
104
|
+
default:
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
*consume(final) {
|
|
109
|
+
// Loop until no progress is possible.
|
|
110
|
+
while (true) {
|
|
111
|
+
const before = { kind: this.state.kind, len: this.buffer.length };
|
|
112
|
+
yield* this.step(final);
|
|
113
|
+
if (this.state.kind === before.kind && this.buffer.length === before.len)
|
|
114
|
+
return;
|
|
115
|
+
if (this.state.kind === 'done')
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
*step(final) {
|
|
120
|
+
switch (this.state.kind) {
|
|
121
|
+
case 'text':
|
|
122
|
+
yield* this.stepText(final);
|
|
123
|
+
return;
|
|
124
|
+
case 'inside-tool-use':
|
|
125
|
+
yield* this.stepInsideToolUse(final);
|
|
126
|
+
return;
|
|
127
|
+
case 'reading-name':
|
|
128
|
+
yield* this.stepReadingName(final);
|
|
129
|
+
return;
|
|
130
|
+
case 'awaiting-arg-or-close':
|
|
131
|
+
yield* this.stepAwaitingArgOrClose(final);
|
|
132
|
+
return;
|
|
133
|
+
case 'reading-arg-name':
|
|
134
|
+
yield* this.stepReadingArgName(final);
|
|
135
|
+
return;
|
|
136
|
+
case 'awaiting-arg-value':
|
|
137
|
+
yield* this.stepAwaitingArgValue(final);
|
|
138
|
+
return;
|
|
139
|
+
case 'reading-arg-value':
|
|
140
|
+
yield* this.stepReadingArgValue(final);
|
|
141
|
+
return;
|
|
142
|
+
case 'done':
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
*stepText(final) {
|
|
147
|
+
const idx = this.buffer.indexOf(TOOL_USE_OPEN);
|
|
148
|
+
if (idx !== -1) {
|
|
149
|
+
const before = this.buffer.slice(0, idx);
|
|
150
|
+
if (before.length > 0)
|
|
151
|
+
yield* this.emitText(before);
|
|
152
|
+
this.buffer = this.buffer.slice(idx + TOOL_USE_OPEN.length);
|
|
153
|
+
if (this.textOpen) {
|
|
154
|
+
yield { type: 'content_block_stop', index: this.nextBlockIndex - 1 };
|
|
155
|
+
this.textOpen = false;
|
|
156
|
+
}
|
|
157
|
+
this.rawSinceOpen = TOOL_USE_OPEN;
|
|
158
|
+
this.state = { kind: 'inside-tool-use' };
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
// No marker yet — flush text up to the safety window.
|
|
162
|
+
const safeLen = final ? this.buffer.length : Math.max(0, this.buffer.length - MAX_TAG_LEN);
|
|
163
|
+
if (safeLen > 0) {
|
|
164
|
+
const safe = this.buffer.slice(0, safeLen);
|
|
165
|
+
this.buffer = this.buffer.slice(safeLen);
|
|
166
|
+
yield* this.emitText(safe);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
*stepInsideToolUse(final) {
|
|
170
|
+
const trimmed = this.buffer.trimStart();
|
|
171
|
+
const consumed = this.buffer.length - trimmed.length;
|
|
172
|
+
this.buffer = trimmed;
|
|
173
|
+
this.rawSinceOpen += ' '.repeat(consumed);
|
|
174
|
+
if (this.buffer.startsWith(TOOL_NAME_OPEN)) {
|
|
175
|
+
this.buffer = this.buffer.slice(TOOL_NAME_OPEN.length);
|
|
176
|
+
this.rawSinceOpen += TOOL_NAME_OPEN;
|
|
177
|
+
this.state = { kind: 'reading-name', nameSoFar: '' };
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
if (this.buffer.length === 0)
|
|
181
|
+
return;
|
|
182
|
+
if (this.buffer.length < TOOL_NAME_OPEN.length && !final) {
|
|
183
|
+
// Re-buffer the whitespace so it's preserved across feeds.
|
|
184
|
+
this.buffer = ' '.repeat(consumed) + this.buffer;
|
|
185
|
+
this.rawSinceOpen = this.rawSinceOpen.slice(0, -consumed);
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
if (final) {
|
|
189
|
+
yield* this.recoverMalformedToText(this.rawSinceOpen + this.buffer);
|
|
190
|
+
this.resetToText();
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
*stepReadingName(final) {
|
|
194
|
+
if (this.state.kind !== 'reading-name')
|
|
195
|
+
return;
|
|
196
|
+
const idx = this.buffer.indexOf(TOOL_NAME_CLOSE);
|
|
197
|
+
if (idx !== -1) {
|
|
198
|
+
const name = (this.state.nameSoFar + this.buffer.slice(0, idx)).trim();
|
|
199
|
+
this.rawSinceOpen += this.buffer.slice(0, idx + TOOL_NAME_CLOSE.length);
|
|
200
|
+
this.buffer = this.buffer.slice(idx + TOOL_NAME_CLOSE.length);
|
|
201
|
+
if (!name) {
|
|
202
|
+
yield* this.recoverMalformedToText(this.rawSinceOpen);
|
|
203
|
+
this.resetToText();
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
// Open the tool_use content block now that we know the name.
|
|
207
|
+
this.toolUseId = `toolu_${randomUUID().replace(/-/g, '').slice(0, 22)}`;
|
|
208
|
+
const blockIndex = this.nextBlockIndex++;
|
|
209
|
+
this.toolUseOpen = true;
|
|
210
|
+
this.detectedToolUse = true;
|
|
211
|
+
this.args = {};
|
|
212
|
+
yield {
|
|
213
|
+
type: 'content_block_start',
|
|
214
|
+
index: blockIndex,
|
|
215
|
+
content_block: { type: 'tool_use', id: this.toolUseId, name, input: {} },
|
|
216
|
+
};
|
|
217
|
+
this.state = { kind: 'awaiting-arg-or-close' };
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
const holdLen = Math.max(0, this.buffer.length - MAX_TAG_LEN);
|
|
221
|
+
if (holdLen > 0) {
|
|
222
|
+
this.state.nameSoFar += this.buffer.slice(0, holdLen);
|
|
223
|
+
this.rawSinceOpen += this.buffer.slice(0, holdLen);
|
|
224
|
+
this.buffer = this.buffer.slice(holdLen);
|
|
225
|
+
}
|
|
226
|
+
if (final) {
|
|
227
|
+
yield* this.recoverMalformedToText(this.rawSinceOpen + this.state.nameSoFar + this.buffer);
|
|
228
|
+
this.resetToText();
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
*stepAwaitingArgOrClose(final) {
|
|
232
|
+
const trimmed = this.buffer.trimStart();
|
|
233
|
+
const consumed = this.buffer.length - trimmed.length;
|
|
234
|
+
this.buffer = trimmed;
|
|
235
|
+
this.rawSinceOpen += ' '.repeat(consumed);
|
|
236
|
+
if (this.buffer.startsWith(TOOL_USE_CLOSE)) {
|
|
237
|
+
this.buffer = this.buffer.slice(TOOL_USE_CLOSE.length);
|
|
238
|
+
this.rawSinceOpen += TOOL_USE_CLOSE;
|
|
239
|
+
// Flush args as a single input_json_delta and close the block.
|
|
240
|
+
yield {
|
|
241
|
+
type: 'content_block_delta',
|
|
242
|
+
index: this.nextBlockIndex - 1,
|
|
243
|
+
delta: {
|
|
244
|
+
type: 'input_json_delta',
|
|
245
|
+
partial_json: JSON.stringify(this.args),
|
|
246
|
+
},
|
|
247
|
+
};
|
|
248
|
+
yield { type: 'content_block_stop', index: this.nextBlockIndex - 1 };
|
|
249
|
+
this.toolUseOpen = false;
|
|
250
|
+
// One tool_use per turn — anything after is ignored.
|
|
251
|
+
this.state = { kind: 'done' };
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
if (this.buffer.startsWith(ARG_OPEN_PREFIX)) {
|
|
255
|
+
this.buffer = this.buffer.slice(ARG_OPEN_PREFIX.length);
|
|
256
|
+
this.rawSinceOpen += ARG_OPEN_PREFIX;
|
|
257
|
+
this.state = { kind: 'reading-arg-name', nameSoFar: '' };
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
if (this.buffer.length === 0)
|
|
261
|
+
return;
|
|
262
|
+
if (this.buffer.length < ARG_OPEN_PREFIX.length && !final) {
|
|
263
|
+
this.buffer = ' '.repeat(consumed) + this.buffer;
|
|
264
|
+
this.rawSinceOpen = this.rawSinceOpen.slice(0, -consumed);
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
if (final) {
|
|
268
|
+
// Salvage already-parsed args via flush() path.
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
*stepReadingArgName(final) {
|
|
272
|
+
if (this.state.kind !== 'reading-arg-name')
|
|
273
|
+
return;
|
|
274
|
+
const idx = this.buffer.indexOf(ARG_OPEN_SUFFIX);
|
|
275
|
+
if (idx !== -1) {
|
|
276
|
+
const argName = (this.state.nameSoFar + this.buffer.slice(0, idx)).trim();
|
|
277
|
+
this.rawSinceOpen += this.buffer.slice(0, idx + ARG_OPEN_SUFFIX.length);
|
|
278
|
+
this.buffer = this.buffer.slice(idx + ARG_OPEN_SUFFIX.length);
|
|
279
|
+
if (!argName) {
|
|
280
|
+
// Malformed — leave salvage to flush.
|
|
281
|
+
this.state = { kind: 'done' };
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
this.state = { kind: 'awaiting-arg-value', argName };
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
const holdLen = Math.max(0, this.buffer.length - ARG_OPEN_SUFFIX.length);
|
|
288
|
+
if (holdLen > 0) {
|
|
289
|
+
this.state.nameSoFar += this.buffer.slice(0, holdLen);
|
|
290
|
+
this.rawSinceOpen += this.buffer.slice(0, holdLen);
|
|
291
|
+
this.buffer = this.buffer.slice(holdLen);
|
|
292
|
+
}
|
|
293
|
+
if (final) {
|
|
294
|
+
// Salvage via flush().
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
*stepAwaitingArgValue(_final) {
|
|
298
|
+
if (this.state.kind !== 'awaiting-arg-value')
|
|
299
|
+
return;
|
|
300
|
+
// Transition directly into reading-arg-value with the existing buffer.
|
|
301
|
+
// Argument content is RAW text — no leading-whitespace skipping; the
|
|
302
|
+
// model's example shows content on its own line, so we DO eat exactly
|
|
303
|
+
// one leading newline if present (cosmetic, matches the taught format).
|
|
304
|
+
if (this.buffer.startsWith('\n')) {
|
|
305
|
+
this.buffer = this.buffer.slice(1);
|
|
306
|
+
this.rawSinceOpen += '\n';
|
|
307
|
+
}
|
|
308
|
+
this.state = { kind: 'reading-arg-value', argName: this.state.argName, valueSoFar: '' };
|
|
309
|
+
}
|
|
310
|
+
*stepReadingArgValue(final) {
|
|
311
|
+
if (this.state.kind !== 'reading-arg-value')
|
|
312
|
+
return;
|
|
313
|
+
const idx = this.buffer.indexOf(ARG_CLOSE);
|
|
314
|
+
if (idx !== -1) {
|
|
315
|
+
// Trim the cosmetic trailing newline that often precedes </arg>.
|
|
316
|
+
let rawValue = this.state.valueSoFar + this.buffer.slice(0, idx);
|
|
317
|
+
if (rawValue.endsWith('\n'))
|
|
318
|
+
rawValue = rawValue.slice(0, -1);
|
|
319
|
+
const decoded = unescapeArgContent(rawValue);
|
|
320
|
+
this.args[this.state.argName] = decoded;
|
|
321
|
+
this.rawSinceOpen += this.buffer.slice(0, idx + ARG_CLOSE.length);
|
|
322
|
+
this.buffer = this.buffer.slice(idx + ARG_CLOSE.length);
|
|
323
|
+
this.state = { kind: 'awaiting-arg-or-close' };
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
// No close yet. Append all but the last (ARG_CLOSE.length - 1) chars to
|
|
327
|
+
// valueSoFar; the tail might be the start of </arg>.
|
|
328
|
+
const safeLen = final ? this.buffer.length : Math.max(0, this.buffer.length - (ARG_CLOSE.length - 1));
|
|
329
|
+
if (safeLen > 0) {
|
|
330
|
+
this.state.valueSoFar += this.buffer.slice(0, safeLen);
|
|
331
|
+
this.rawSinceOpen += this.buffer.slice(0, safeLen);
|
|
332
|
+
this.buffer = this.buffer.slice(safeLen);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
// ---------------------------------------------------------------
|
|
336
|
+
*emitText(text) {
|
|
337
|
+
if (!this.textOpen) {
|
|
338
|
+
const index = this.nextBlockIndex++;
|
|
339
|
+
yield {
|
|
340
|
+
type: 'content_block_start',
|
|
341
|
+
index,
|
|
342
|
+
content_block: { type: 'text', text: '', citations: null },
|
|
343
|
+
};
|
|
344
|
+
this.textOpen = true;
|
|
345
|
+
}
|
|
346
|
+
yield {
|
|
347
|
+
type: 'content_block_delta',
|
|
348
|
+
index: this.nextBlockIndex - 1,
|
|
349
|
+
delta: { type: 'text_delta', text },
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
*recoverMalformedToText(raw) {
|
|
353
|
+
yield* this.emitText(raw);
|
|
354
|
+
}
|
|
355
|
+
resetToText() {
|
|
356
|
+
this.state = { kind: 'text' };
|
|
357
|
+
this.rawSinceOpen = '';
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
//# sourceMappingURL=toolUseParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolUseParser.js","sourceRoot":"","sources":["../../../src/providers/web-bridge/toolUseParser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAKxC,OAAO,EACL,SAAS,EACT,eAAe,EACf,eAAe,EACf,eAAe,EACf,cAAc,EACd,cAAc,EACd,aAAa,EACb,kBAAkB,GACnB,MAAM,qBAAqB,CAAA;AAY5B,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAC1B,aAAa,CAAC,MAAM,EACpB,cAAc,CAAC,MAAM,EACrB,cAAc,CAAC,MAAM,EACrB,eAAe,CAAC,MAAM,EACtB,eAAe,CAAC,MAAM,EACtB,SAAS,CAAC,MAAM,CACjB,CAAA;AAED,MAAM,OAAO,mBAAmB;IACtB,MAAM,GAAG,EAAE,CAAA;IACX,KAAK,GAAgB,EAAE,IAAI,EAAE,MAAM,EAAE,CAAA;IACrC,cAAc,GAAG,CAAC,CAAA;IAClB,QAAQ,GAAG,KAAK,CAAA;IAChB,WAAW,GAAG,KAAK,CAAA;IACnB,eAAe,GAAG,KAAK,CAAA;IACvB,SAAS,GAAG,EAAE,CAAA;IACd,IAAI,GAA2B,EAAE,CAAA;IACzC;mEAC+D;IACvD,YAAY,GAAG,EAAE,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D,CAAA;YACD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAA;QACtB,CAAC;QACD,MAAM;YACJ,IAAI,EAAE,qBAAqB;YAC3B,KAAK,EAAE,IAAI,CAAC,cAAc,GAAG,CAAC;YAC9B,KAAK,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE;SACpC,CAAA;IACH,CAAC;IAEO,CAAC,sBAAsB,CAAC,GAAW;QACzC,KAAK,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;IAC3B,CAAC;IAEO,WAAW;QACjB,IAAI,CAAC,KAAK,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAA;QAC7B,IAAI,CAAC,YAAY,GAAG,EAAE,CAAA;IACxB,CAAC;CACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bbclaw/core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "BBClaw agent runtime and provider abstraction.",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./providers": {
|
|
15
|
+
"types": "./dist/providers/index.d.ts",
|
|
16
|
+
"default": "./dist/providers/index.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"README.md"
|
|
22
|
+
],
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@anthropic-ai/sdk": "^0.40.0",
|
|
28
|
+
"playwright": "^1.49.0",
|
|
29
|
+
"@bbclaw/shared": "0.1.0"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"typecheck": "tsc --noEmit",
|
|
33
|
+
"build": "tsc",
|
|
34
|
+
"test": "vitest run"
|
|
35
|
+
}
|
|
36
|
+
}
|