@koda-sl/baker-bridge 0.119.0 → 0.121.0-dev.ba3f112da
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 +1 -19
- package/dist/hono/agent-session.d.ts +0 -3
- package/dist/hono/agent-session.d.ts.map +1 -1
- package/dist/hono/agent-session.js +0 -15
- package/dist/hono/agent-session.js.map +1 -1
- package/dist/hono/agent.d.ts +0 -2
- package/dist/hono/agent.d.ts.map +1 -1
- package/dist/hono/agent.js +2 -10
- package/dist/hono/agent.js.map +1 -1
- package/dist/hono/baker-ui-tool-schemas.test.js +0 -6
- package/dist/hono/baker-ui-tool-schemas.test.js.map +1 -1
- package/dist/hono/bridge-job.d.ts +1 -13
- package/dist/hono/bridge-job.d.ts.map +1 -1
- package/dist/hono/bridge-job.js +5 -69
- package/dist/hono/bridge-job.js.map +1 -1
- package/dist/hono/bridge-job.test.js +1 -113
- package/dist/hono/bridge-job.test.js.map +1 -1
- package/dist/hono/connection-input.d.ts +1 -8
- package/dist/hono/connection-input.d.ts.map +1 -1
- package/dist/hono/connection-input.js +1 -2
- package/dist/hono/connection-input.js.map +1 -1
- package/dist/hono/connection-input.test.js +8 -17
- package/dist/hono/connection-input.test.js.map +1 -1
- package/dist/hono/convex.d.ts +0 -8
- package/dist/hono/convex.d.ts.map +1 -1
- package/dist/hono/convex.js +0 -8
- package/dist/hono/convex.js.map +1 -1
- package/dist/hono/latitude-telemetry.d.ts.map +1 -1
- package/dist/hono/latitude-telemetry.js +2 -8
- package/dist/hono/latitude-telemetry.js.map +1 -1
- package/dist/hono/prompt-context.d.ts +1 -8
- package/dist/hono/prompt-context.d.ts.map +1 -1
- package/dist/hono/prompt-context.js +7 -45
- package/dist/hono/prompt-context.js.map +1 -1
- package/dist/hono/prompt-context.test.js +1 -35
- package/dist/hono/prompt-context.test.js.map +1 -1
- package/dist/hono/relay.d.ts +1 -10
- package/dist/hono/relay.d.ts.map +1 -1
- package/dist/hono/relay.js +0 -6
- package/dist/hono/relay.js.map +1 -1
- package/dist/hono/server.d.ts.map +1 -1
- package/dist/hono/server.js +0 -22
- package/dist/hono/server.js.map +1 -1
- package/dist/hono/tag-input.d.ts +3 -105
- package/dist/hono/tag-input.d.ts.map +1 -1
- package/dist/hono/tag-input.js +9 -20
- package/dist/hono/tag-input.js.map +1 -1
- package/dist/hono/tag-input.test.js +1 -19
- package/dist/hono/tag-input.test.js.map +1 -1
- package/dist/hono/types.d.ts +0 -8
- package/dist/hono/types.d.ts.map +1 -1
- package/package.json +2 -5
- package/dist/broker/baker-api.d.ts +0 -23
- package/dist/broker/baker-api.d.ts.map +0 -1
- package/dist/broker/baker-api.js +0 -55
- package/dist/broker/baker-api.js.map +0 -1
- package/dist/broker/broker-client.d.ts +0 -10
- package/dist/broker/broker-client.d.ts.map +0 -1
- package/dist/broker/broker-client.js +0 -60
- package/dist/broker/broker-client.js.map +0 -1
- package/dist/broker/ca.d.ts +0 -38
- package/dist/broker/ca.d.ts.map +0 -1
- package/dist/broker/ca.js +0 -80
- package/dist/broker/ca.js.map +0 -1
- package/dist/broker/ca.test.d.ts +0 -2
- package/dist/broker/ca.test.d.ts.map +0 -1
- package/dist/broker/ca.test.js +0 -58
- package/dist/broker/ca.test.js.map +0 -1
- package/dist/broker/credential-cache.d.ts +0 -24
- package/dist/broker/credential-cache.d.ts.map +0 -1
- package/dist/broker/credential-cache.js +0 -69
- package/dist/broker/credential-cache.js.map +0 -1
- package/dist/broker/credential-cache.test.d.ts +0 -2
- package/dist/broker/credential-cache.test.d.ts.map +0 -1
- package/dist/broker/credential-cache.test.js +0 -120
- package/dist/broker/credential-cache.test.js.map +0 -1
- package/dist/broker/credential-text.d.ts +0 -45
- package/dist/broker/credential-text.d.ts.map +0 -1
- package/dist/broker/credential-text.js +0 -103
- package/dist/broker/credential-text.js.map +0 -1
- package/dist/broker/credential-text.test.d.ts +0 -2
- package/dist/broker/credential-text.test.d.ts.map +0 -1
- package/dist/broker/credential-text.test.js +0 -54
- package/dist/broker/credential-text.test.js.map +0 -1
- package/dist/broker/env.d.ts +0 -19
- package/dist/broker/env.d.ts.map +0 -1
- package/dist/broker/env.js +0 -16
- package/dist/broker/env.js.map +0 -1
- package/dist/broker/main.d.ts +0 -3
- package/dist/broker/main.d.ts.map +0 -1
- package/dist/broker/main.js +0 -51
- package/dist/broker/main.js.map +0 -1
- package/dist/broker/proxy.d.ts +0 -24
- package/dist/broker/proxy.d.ts.map +0 -1
- package/dist/broker/proxy.integration.test.d.ts +0 -2
- package/dist/broker/proxy.integration.test.d.ts.map +0 -1
- package/dist/broker/proxy.integration.test.js +0 -201
- package/dist/broker/proxy.integration.test.js.map +0 -1
- package/dist/broker/proxy.js +0 -147
- package/dist/broker/proxy.js.map +0 -1
- package/dist/broker/rewrite.d.ts +0 -44
- package/dist/broker/rewrite.d.ts.map +0 -1
- package/dist/broker/rewrite.js +0 -291
- package/dist/broker/rewrite.js.map +0 -1
- package/dist/broker/rewrite.test.d.ts +0 -2
- package/dist/broker/rewrite.test.d.ts.map +0 -1
- package/dist/broker/rewrite.test.js +0 -171
- package/dist/broker/rewrite.test.js.map +0 -1
- package/dist/broker/socket-service.d.ts +0 -18
- package/dist/broker/socket-service.d.ts.map +0 -1
- package/dist/broker/socket-service.js +0 -103
- package/dist/broker/socket-service.js.map +0 -1
- package/dist/broker/socket-service.test.d.ts +0 -2
- package/dist/broker/socket-service.test.d.ts.map +0 -1
- package/dist/broker/socket-service.test.js +0 -73
- package/dist/broker/socket-service.test.js.map +0 -1
- package/dist/broker/token-bucket.d.ts +0 -9
- package/dist/broker/token-bucket.d.ts.map +0 -1
- package/dist/broker/token-bucket.js +0 -18
- package/dist/broker/token-bucket.js.map +0 -1
- package/dist/broker/usage-reporter.d.ts +0 -18
- package/dist/broker/usage-reporter.d.ts.map +0 -1
- package/dist/broker/usage-reporter.js +0 -31
- package/dist/broker/usage-reporter.js.map +0 -1
- package/dist/broker/usage-reporter.test.d.ts +0 -2
- package/dist/broker/usage-reporter.test.d.ts.map +0 -1
- package/dist/broker/usage-reporter.test.js +0 -20
- package/dist/broker/usage-reporter.test.js.map +0 -1
- package/dist/hono/credential-input.d.ts +0 -39
- package/dist/hono/credential-input.d.ts.map +0 -1
- package/dist/hono/credential-input.js +0 -78
- package/dist/hono/credential-input.js.map +0 -1
- package/dist/hono/credential-scrub.d.ts +0 -41
- package/dist/hono/credential-scrub.d.ts.map +0 -1
- package/dist/hono/credential-scrub.js +0 -152
- package/dist/hono/credential-scrub.js.map +0 -1
- package/dist/hono/credential-scrub.test.d.ts +0 -2
- package/dist/hono/credential-scrub.test.d.ts.map +0 -1
- package/dist/hono/credential-scrub.test.js +0 -105
- package/dist/hono/credential-scrub.test.js.map +0 -1
|
@@ -18,7 +18,6 @@ vi.mock("./runtime-files.ts", async (importOriginal) => {
|
|
|
18
18
|
import { AVATAR_CASTING_TOOL_NAME } from "./avatar-casting.js";
|
|
19
19
|
import { BridgeJobExecutor, createStallDetector, isContextOverflowRefusal, isControlChannelDeny, parsePlanDecision, remapAnswersToQuestionText, } from "./bridge-job.js";
|
|
20
20
|
import { CONNECTION_INPUT_TOOL_NAME } from "./connection-input.js";
|
|
21
|
-
import { CREDENTIAL_INPUT_TOOL_NAME } from "./credential-input.js";
|
|
22
21
|
import { FLOW_INPUT_TOOL_NAME } from "./flow-input.js";
|
|
23
22
|
import { bridgeRuntimeFiles } from "./runtime-files.js";
|
|
24
23
|
import { TAG_INPUT_TOOL_NAME } from "./tag-input.js";
|
|
@@ -50,7 +49,6 @@ function activeControls() {
|
|
|
50
49
|
pendingTagInputs: new Map(),
|
|
51
50
|
pendingFlowInputs: new Map(),
|
|
52
51
|
pendingConnectionInputs: new Map(),
|
|
53
|
-
pendingCredentialInputs: new Map(),
|
|
54
52
|
pendingVoiceCasts: new Map(),
|
|
55
53
|
pendingAvatarCastings: new Map(),
|
|
56
54
|
isActive: () => active,
|
|
@@ -84,8 +82,6 @@ function recordingRelay() {
|
|
|
84
82
|
flowInputResolved: () => Promise.resolve(),
|
|
85
83
|
connectionInputRequest: () => Promise.resolve(true),
|
|
86
84
|
connectionInputResolved: () => Promise.resolve(),
|
|
87
|
-
credentialInputRequest: () => Promise.resolve(true),
|
|
88
|
-
credentialInputResolved: () => Promise.resolve(),
|
|
89
85
|
avatarCastingRequest: () => Promise.resolve(true),
|
|
90
86
|
avatarCastingResolved: () => Promise.resolve(),
|
|
91
87
|
assistantEvent: (target, event, model) => {
|
|
@@ -1447,24 +1443,6 @@ describe("BridgeJobExecutor", () => {
|
|
|
1447
1443
|
expect(queryInputs[0]?.prompt).toBe("make the headline bigger");
|
|
1448
1444
|
expect(queryInputs[0]?.reminder).toContain('landing "Homepage" (slug: homepage)');
|
|
1449
1445
|
});
|
|
1450
|
-
it("explains a credential the message names beside it, together with the viewing reference", async () => {
|
|
1451
|
-
const queryInputs = [];
|
|
1452
|
-
const executor = createExecutor({
|
|
1453
|
-
queryInputs,
|
|
1454
|
-
queryResults: [scriptedMessages(resultMessage(0, "session_credential"))],
|
|
1455
|
-
});
|
|
1456
|
-
await executor.execute({
|
|
1457
|
-
threadId: "thread_credential",
|
|
1458
|
-
turnId: "turn_credential",
|
|
1459
|
-
prompt: "log in with user admin and password {{credential:password}}",
|
|
1460
|
-
history: history([]),
|
|
1461
|
-
currentReference: { type: "landing", slug: "homepage", title: "Homepage" },
|
|
1462
|
-
credentials: [{ name: "password", label: "Login password", allowedHosts: [] }],
|
|
1463
|
-
}, activeControls());
|
|
1464
|
-
expect(queryInputs[0]?.prompt).toBe("log in with user admin and password {{credential:password}}");
|
|
1465
|
-
expect(queryInputs[0]?.reminder).toContain('landing "Homepage"');
|
|
1466
|
-
expect(queryInputs[0]?.reminder).toContain("`{{credential:password}}` is a credential the user saved");
|
|
1467
|
-
});
|
|
1468
1446
|
it("strips newlines from the viewing reference so a crafted title can't inject instructions", async () => {
|
|
1469
1447
|
const queryInputs = [];
|
|
1470
1448
|
const executor = createExecutor({
|
|
@@ -2266,94 +2244,6 @@ describe("BridgeJobExecutor", () => {
|
|
|
2266
2244
|
await executor.execute({ threadId: "thread_pl", turnId: "turn_pl", prompt: "Connect HubSpot" }, controls);
|
|
2267
2245
|
expect(reloads).toBe(0);
|
|
2268
2246
|
});
|
|
2269
|
-
it("turns request_credential away in a Runtime without Credentials", async () => {
|
|
2270
|
-
const relay = recordingRelay();
|
|
2271
|
-
const requests = [];
|
|
2272
|
-
relay.credentialInputRequest = (_target, request) => {
|
|
2273
|
-
requests.push(request);
|
|
2274
|
-
return Promise.resolve(true);
|
|
2275
|
-
};
|
|
2276
|
-
let decision;
|
|
2277
|
-
const executor = new BridgeJobExecutor({
|
|
2278
|
-
sdk: {
|
|
2279
|
-
query: (input) => ({
|
|
2280
|
-
async *[Symbol.asyncIterator]() {
|
|
2281
|
-
decision = await input.options.canUseTool?.(CREDENTIAL_INPUT_TOOL_NAME, {
|
|
2282
|
-
label: "Shopify admin token",
|
|
2283
|
-
reason: "so I can update the theme",
|
|
2284
|
-
allowedHosts: ["acme.myshopify.com"],
|
|
2285
|
-
}, {
|
|
2286
|
-
toolUseID: "t1",
|
|
2287
|
-
requestId: "req_t1",
|
|
2288
|
-
signal: input.options.abortController?.signal ?? new AbortController().signal,
|
|
2289
|
-
});
|
|
2290
|
-
yield resultMessage(0, "session_credential_off");
|
|
2291
|
-
},
|
|
2292
|
-
}),
|
|
2293
|
-
},
|
|
2294
|
-
model: "claude-test",
|
|
2295
|
-
sessionStore: { load: async () => undefined, save: async () => undefined, clear: async () => undefined },
|
|
2296
|
-
relay,
|
|
2297
|
-
});
|
|
2298
|
-
await executor.execute({ threadId: "thread_co", turnId: "turn_co", prompt: "Fix my theme" }, activeControls());
|
|
2299
|
-
expect(requests).toEqual([]);
|
|
2300
|
-
expect(decision).toMatchObject({ behavior: "deny", message: expect.stringContaining("not available") });
|
|
2301
|
-
});
|
|
2302
|
-
it("parks a credential request and hands the agent only the placeholder the user's answer stored", async () => {
|
|
2303
|
-
vi.stubEnv("BAKER_CREDENTIALS", "1");
|
|
2304
|
-
const relay = recordingRelay();
|
|
2305
|
-
const requests = [];
|
|
2306
|
-
relay.credentialInputRequest = (_target, request) => {
|
|
2307
|
-
requests.push(request);
|
|
2308
|
-
return Promise.resolve(true);
|
|
2309
|
-
};
|
|
2310
|
-
const controls = activeControls();
|
|
2311
|
-
let decision;
|
|
2312
|
-
const executor = new BridgeJobExecutor({
|
|
2313
|
-
sdk: {
|
|
2314
|
-
query: (input) => ({
|
|
2315
|
-
async *[Symbol.asyncIterator]() {
|
|
2316
|
-
const asked = input.options.canUseTool?.(CREDENTIAL_INPUT_TOOL_NAME, {
|
|
2317
|
-
label: "Shopify admin token",
|
|
2318
|
-
reason: "so I can update the theme",
|
|
2319
|
-
allowedHosts: ["acme.myshopify.com"],
|
|
2320
|
-
}, {
|
|
2321
|
-
toolUseID: "t1",
|
|
2322
|
-
requestId: "req_t1",
|
|
2323
|
-
signal: input.options.abortController?.signal ?? new AbortController().signal,
|
|
2324
|
-
});
|
|
2325
|
-
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
2326
|
-
for (const [, pending] of controls.pendingCredentialInputs) {
|
|
2327
|
-
pending.resolve({
|
|
2328
|
-
status: "stored",
|
|
2329
|
-
name: "shopify-admin-token",
|
|
2330
|
-
placeholder: "{{credential:shopify-admin-token}}",
|
|
2331
|
-
allowedHosts: ["acme.myshopify.com"],
|
|
2332
|
-
});
|
|
2333
|
-
}
|
|
2334
|
-
decision = await asked;
|
|
2335
|
-
yield resultMessage(0, "session_credential");
|
|
2336
|
-
},
|
|
2337
|
-
}),
|
|
2338
|
-
},
|
|
2339
|
-
model: "claude-test",
|
|
2340
|
-
sessionStore: { load: async () => undefined, save: async () => undefined, clear: async () => undefined },
|
|
2341
|
-
relay,
|
|
2342
|
-
});
|
|
2343
|
-
await executor.execute({ threadId: "thread_cr", turnId: "turn_cr", prompt: "Fix my theme" }, controls);
|
|
2344
|
-
expect(requests).toEqual([
|
|
2345
|
-
{
|
|
2346
|
-
toolUseId: "t1",
|
|
2347
|
-
label: "Shopify admin token",
|
|
2348
|
-
reason: "so I can update the theme",
|
|
2349
|
-
allowedHosts: ["acme.myshopify.com"],
|
|
2350
|
-
},
|
|
2351
|
-
]);
|
|
2352
|
-
expect(decision).toMatchObject({
|
|
2353
|
-
behavior: "allow",
|
|
2354
|
-
updatedInput: { resolution: { status: "stored", placeholder: "{{credential:shopify-admin-token}}" } },
|
|
2355
|
-
});
|
|
2356
|
-
});
|
|
2357
2247
|
it("refuses to ask for an avatar's face in a tool that renders only text", async () => {
|
|
2358
2248
|
// Shipped three times, in both modes, after the agent had just read the doc saying
|
|
2359
2249
|
// not to: "Elige el rostro para Clara, tu presentadora de placas solares" with
|
|
@@ -3766,9 +3656,7 @@ describe("BridgeJobExecutor review mode", () => {
|
|
|
3766
3656
|
const options = queryInputs[0]?.options;
|
|
3767
3657
|
expect(options.model).toBe("claude-session-model");
|
|
3768
3658
|
expect(options.outputFormat).toBeUndefined();
|
|
3769
|
-
|
|
3770
|
-
expect(Object.keys(options.hooks ?? {})).toEqual(["PostToolUse"]);
|
|
3771
|
-
expect(options.hooks?.PostToolUse).toHaveLength(1);
|
|
3659
|
+
expect(options.hooks).toBeUndefined();
|
|
3772
3660
|
expect(options.env?.MAX_STRUCTURED_OUTPUT_RETRIES).toBeUndefined();
|
|
3773
3661
|
expect(options.disallowedTools).not.toContain("Write");
|
|
3774
3662
|
expect(options.env?.BAKER_DEBUG_LOG).toBeUndefined();
|