@capybara-hq/kernel 0.1.0-rc.97 → 0.1.0-rc.99
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/bootstrap.json +17 -17
- package/dist/catalog/git-source.d.ts +5 -0
- package/dist/catalog/git-source.js +9 -5
- package/dist/catalog/marketplace-fetch.d.ts +9 -0
- package/dist/catalog/marketplace-fetch.js +9 -5
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/channels/channels.schemas.d.ts +10 -0
- package/dist/channels/channels.schemas.js +7 -0
- package/dist/channels/connections.service.d.ts +7 -0
- package/dist/channels/connections.service.js +4 -0
- package/dist/channels/features.d.ts +18 -1
- package/dist/channels/features.js +22 -0
- package/dist/channels/outbound.d.ts +19 -0
- package/dist/channels/outbound.js +531 -18
- package/dist/channels/phrases.d.ts +10 -0
- package/dist/channels/phrases.js +4 -0
- package/dist/channels/progress.d.ts +75 -0
- package/dist/channels/progress.js +216 -0
- package/dist/conversations/event-log.d.ts +8 -2
- package/dist/conversations/events.d.ts +6 -0
- package/dist/conversations/events.js +7 -1
- package/dist/conversations/prompt-suggestions.js +2 -2
- package/dist/db/kernel-schema.d.ts +16 -0
- package/dist/evals/run-replay.js +2 -2
- package/dist/evals/step-replay.js +2 -2
- package/dist/evals/worker.js +3 -1
- package/dist/extensions/plugin-icons.d.ts +7 -0
- package/dist/extensions/plugin-icons.js +8 -0
- package/dist/models/purposes.js +2 -2
- package/dist/net/safe-fetch.d.ts +22 -4
- package/dist/net/safe-fetch.js +74 -0
- package/dist/platform/file-ref.d.ts +2 -0
- package/dist/platform/file-ref.js +1 -3
- package/dist/platform/ops/channels.ops.js +24 -5
- package/dist/runtime/model-call.d.ts +23 -2
- package/dist/runtime/model-call.js +64 -9
- package/dist/runtime/run-drafts.d.ts +46 -4
- package/dist/runtime/run-drafts.js +110 -9
- package/dist/runtime/run-steps.d.ts +2 -1
- package/dist/runtime/run-steps.js +6 -2
- package/dist/runtime/runtime.module.js +3 -0
- package/dist/runtime/stream.controller.d.ts +7 -5
- package/dist/runtime/stream.controller.js +10 -6
- package/dist/runtime/stream.js +9 -1
- package/dist/runtime/write-base.d.ts +95 -0
- package/dist/runtime/write-base.js +281 -0
- package/dist/runtime/write-base.service.d.ts +68 -0
- package/dist/runtime/write-base.service.js +184 -0
- package/dist/sandbox/kernel-read.d.ts +39 -9
- package/dist/sandbox/kernel-read.js +33 -3
- package/dist/sandbox/operation-authority.d.ts +16 -12
- package/dist/sandbox/operation-authority.js +33 -20
- package/dist/sandbox/operation-intents.d.ts +10 -4
- package/dist/sandbox/operation-intents.js +31 -11
- package/dist/sandbox/sandbox.service.d.ts +30 -7
- package/dist/sandbox/sandbox.service.js +47 -13
- package/dist/tools/builtins/agent.js +4 -0
- package/dist/tools/builtins/image/generate.js +1 -0
- package/dist/tools/builtins/platform.js +4 -3
- package/dist/tools/builtins/sandbox/bash.d.ts +3 -1
- package/dist/tools/builtins/sandbox/bash.js +23 -11
- package/dist/tools/builtins/sandbox/common.d.ts +4 -1
- package/dist/tools/builtins/sandbox/common.js +5 -2
- package/dist/tools/builtins/sandbox/edit.js +1 -0
- package/dist/tools/builtins/sandbox/glob.js +2 -1
- package/dist/tools/builtins/sandbox/grep.js +2 -1
- package/dist/tools/builtins/sandbox/search-command.d.ts +4 -3
- package/dist/tools/builtins/sandbox/search-command.js +11 -3
- package/dist/tools/builtins/sandbox/write.js +1 -0
- package/dist/tools/builtins/send-message.js +1 -0
- package/dist/tools/info.d.ts +21 -2
- package/dist/tools/info.js +55 -12
- package/dist/tools/network-asks.d.ts +23 -0
- package/dist/tools/network-asks.js +24 -5
- package/dist/tools/pipeline.d.ts +3 -1
- package/dist/tools/pipeline.js +76 -12
- package/dist/tools/registry.d.ts +12 -11
- package/dist/tools/registry.js +6 -5
- package/package.json +3 -3
- package/src/migrations/0185_channel_process_display.sql +13 -0
|
@@ -194,6 +194,16 @@ export const unavailableHostNote = (host, why) => `[network] ${host} was blocked
|
|
|
194
194
|
export const taskGrantIgnoredNote = (hosts) => `${blockedLead(hosts)} The scheduled task approves ${pron(hosts)}, but this device did not apply the task's network grant. The device owner can add ${pron(hosts)} to the device's network list on its page. Continue without ${pron(hosts)}.`;
|
|
195
195
|
/** An unattended run in `fail` mode (spec §8.3): no ask, the creator can add a task grant. */
|
|
196
196
|
export const unattendedNetworkNote = (hosts) => `[network] ${list(hosts)} ${one(hosts) ? "is" : "are"} blocked on this device and this scheduled run cannot ask for network access. The task's owner can add ${pron(hosts)} to the task's approved domains. Continue without ${pron(hosts)}.`;
|
|
197
|
+
/**
|
|
198
|
+
* The sandbox denial line a command result keeps beside its network notes: one instruction about
|
|
199
|
+
* running outside the sandbox, never two. An address note that says how (or why not) replaces the
|
|
200
|
+
* line; one that states only the fact keeps the line's retry part; without one the line is whole.
|
|
201
|
+
*/
|
|
202
|
+
export function denialHintFor(hint, addressNote) {
|
|
203
|
+
if (hint === undefined || addressNote === "remedy")
|
|
204
|
+
return "";
|
|
205
|
+
return addressNote === "fact" ? hint.afterAddressFact : hint.full;
|
|
206
|
+
}
|
|
197
207
|
/** Hosts in first-seen order, deduplicated, lower-cased, trailing dot dropped. */
|
|
198
208
|
function hostsOf(blocked) {
|
|
199
209
|
const seen = new Set();
|
|
@@ -325,11 +335,20 @@ export function planNetworkAsk(blocked, run, ctx) {
|
|
|
325
335
|
notes.push(orgLayerNote(org));
|
|
326
336
|
if (platform.length > 0)
|
|
327
337
|
notes.push(platformCeilingNote(platform));
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
338
|
+
let addressNote;
|
|
339
|
+
if (address.length > 0) {
|
|
340
|
+
const why = ctx.unattended != null ? ESCALATION_UNATTENDED_WHY : ctx.escalationRefusal;
|
|
341
|
+
const escalate = ctx.escalation === true && ctx.unattended == null;
|
|
342
|
+
notes.push(escalate ? addressEscalationNote(address) : addressLayerNote(address, why));
|
|
343
|
+
addressNote = escalate || why !== undefined ? "remedy" : "fact";
|
|
344
|
+
}
|
|
345
|
+
return {
|
|
346
|
+
ask,
|
|
347
|
+
...(ask.length > 0 && offer !== null && { offer }),
|
|
348
|
+
notes,
|
|
349
|
+
missingGrants,
|
|
350
|
+
...(addressNote !== undefined && { addressNote }),
|
|
351
|
+
};
|
|
333
352
|
}
|
|
334
353
|
/**
|
|
335
354
|
* Why a host is not asked about where nothing can be offered (a device with no own list whose
|
package/dist/tools/pipeline.d.ts
CHANGED
|
@@ -718,7 +718,9 @@ export declare class ToolPipeline {
|
|
|
718
718
|
/**
|
|
719
719
|
* A plugin tool's inline card (`ToolResult.card` → `tool_result.card`, display only): `view` must
|
|
720
720
|
* be an `inline` ui contribution of the same extension and `key` at most 200 characters; anything
|
|
721
|
-
* else is dropped with a warning and the result is written as usual.
|
|
721
|
+
* else is dropped with a warning and the result is written as usual. `placement` is kept when
|
|
722
|
+
* `pinned` or `process` (an unknown value means `output`); `text` only with `pinned`, 1 to
|
|
723
|
+
* {@link CARD_TEXT_MAX} characters; `badge` only with `pinned`, 1 to {@link CARD_BADGE_MAX}.
|
|
722
724
|
*/
|
|
723
725
|
private cardOf;
|
|
724
726
|
/**
|
package/dist/tools/pipeline.js
CHANGED
|
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
8
8
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
9
|
};
|
|
10
|
-
import { DeviceAccessError, ToolError, validateInputForm, validateToolDisplay, } from "@capybara-hq/plugin-sdk";
|
|
10
|
+
import { CARD_BADGE_MAX, CARD_TEXT_MAX, DeviceAccessError, ToolError, validateInputForm, validateToolDisplay, } from "@capybara-hq/plugin-sdk";
|
|
11
11
|
import { Inject, Injectable, Optional } from "@nestjs/common";
|
|
12
12
|
import { sql } from "kysely";
|
|
13
13
|
import { backgroundMaxSeconds } from "../background/launch.js";
|
|
@@ -67,7 +67,7 @@ import { canonicalJson } from "./canonical-json.js";
|
|
|
67
67
|
import { CredentialMissing, Credentials } from "./credentials.js";
|
|
68
68
|
import { ToolDrift } from "./drift.js";
|
|
69
69
|
import { ElicitationSession } from "./elicitation.js";
|
|
70
|
-
import { addressEscalationHint, blockedEventHosts, clipKept, deviceAskTerms, NETWORK_ASK_KEPT_MAX_BYTES, networkBlockedIdemKey, planNetworkAsk, serviceAskedNote, serviceAskTerms, settledNetworkNotes, withNetworkNotes, } from "./network-asks.js";
|
|
70
|
+
import { addressEscalationHint, blockedEventHosts, clipKept, denialHintFor, deviceAskTerms, NETWORK_ASK_KEPT_MAX_BYTES, networkBlockedIdemKey, planNetworkAsk, serviceAskedNote, serviceAskTerms, settledNetworkNotes, withNetworkNotes, } from "./network-asks.js";
|
|
71
71
|
import { OrgToolSwitches, toolTurnedOffReason } from "./org-tool-switches.js";
|
|
72
72
|
import { renderResult, resolveOutputRefs, spillIfLarge, ToolOutputs } from "./outputs.js";
|
|
73
73
|
import { createDecidePolicy } from "./policy.js";
|
|
@@ -531,6 +531,15 @@ function networkReportOf(result) {
|
|
|
531
531
|
["device", "org", "address", "unknown"].includes(b.layer));
|
|
532
532
|
return blocked.length === 0 ? undefined : { deviceId: r.deviceId, blocked };
|
|
533
533
|
}
|
|
534
|
+
/** A builtin result's kernel-internal sandbox denial line (`BuiltinResult.networkReport.denialHint`). */
|
|
535
|
+
function denialHintOf(result) {
|
|
536
|
+
const h = result?.networkReport
|
|
537
|
+
?.denialHint;
|
|
538
|
+
if (h === undefined || typeof h.full !== "string" || typeof h.afterAddressFact !== "string") {
|
|
539
|
+
return undefined;
|
|
540
|
+
}
|
|
541
|
+
return { full: h.full, afterAddressFact: h.afterAddressFact };
|
|
542
|
+
}
|
|
534
543
|
/**
|
|
535
544
|
* A kernel-internal device code (see `BuiltinResult.loginCode` and `KeptToolResult.loginCode`):
|
|
536
545
|
* the shape is checked again here so a malformed value never reaches the log (the event schema
|
|
@@ -925,6 +934,7 @@ let ToolPipeline = class ToolPipeline {
|
|
|
925
934
|
accountId: ctx.accountId,
|
|
926
935
|
agentId: ctx.agentId,
|
|
927
936
|
conversationId: ctx.conversationId,
|
|
937
|
+
rootConversationId: ctx.parent?.rootConversationId ?? ctx.conversationId,
|
|
928
938
|
runId: ctx.runId,
|
|
929
939
|
callId: call.id,
|
|
930
940
|
rawInput: call.input,
|
|
@@ -1384,6 +1394,11 @@ let ToolPipeline = class ToolPipeline {
|
|
|
1384
1394
|
const commandReport = outcome.kind === "result" && tool.source.kind === "builtin"
|
|
1385
1395
|
? networkReportOf(outcome.result)
|
|
1386
1396
|
: undefined;
|
|
1397
|
+
// the denial line `Bash` left out of its content: appended here in the form that goes with
|
|
1398
|
+
// the network notes (`denialHintFor`), after the output (and its truncation line)
|
|
1399
|
+
const denialHint = outcome.kind === "result" && tool.source.kind === "builtin"
|
|
1400
|
+
? denialHintOf(outcome.result)
|
|
1401
|
+
: undefined;
|
|
1387
1402
|
// a device service's refusals reported in the call scope (browser use spec §7.1), any source:
|
|
1388
1403
|
// asked as "always" only, the call runs again once approved
|
|
1389
1404
|
// a report about another device than the conversation's is ignored: only the device the call
|
|
@@ -1417,6 +1432,7 @@ let ToolPipeline = class ToolPipeline {
|
|
|
1417
1432
|
// carried into the kept result so a resumed run writes the event too (it was written
|
|
1418
1433
|
// with `network_blocked` below when the ask was created)
|
|
1419
1434
|
...(loginCode !== undefined && { loginCode }),
|
|
1435
|
+
...(denialHint !== undefined && { denialHint }),
|
|
1420
1436
|
}, reviewedRoots.escalation, reviewedRoots.escalationRefusal, scoped === undefined
|
|
1421
1437
|
? undefined
|
|
1422
1438
|
: {
|
|
@@ -1432,8 +1448,10 @@ let ToolPipeline = class ToolPipeline {
|
|
|
1432
1448
|
}
|
|
1433
1449
|
if (handled.event !== null)
|
|
1434
1450
|
pre.push(handled.event);
|
|
1435
|
-
content = withNetworkNotes(content, handled.notes);
|
|
1451
|
+
content = withNetworkNotes(content + denialHintFor(denialHint, handled.addressNote), handled.notes);
|
|
1436
1452
|
}
|
|
1453
|
+
else
|
|
1454
|
+
content += denialHintFor(denialHint, undefined);
|
|
1437
1455
|
await this.writeResult(ctx, call.id, outKey, {
|
|
1438
1456
|
content,
|
|
1439
1457
|
isError: rendered.isError,
|
|
@@ -2279,8 +2297,9 @@ let ToolPipeline = class ToolPipeline {
|
|
|
2279
2297
|
}
|
|
2280
2298
|
}
|
|
2281
2299
|
const offer = plan.offer;
|
|
2300
|
+
const addressNote = plan.addressNote;
|
|
2282
2301
|
if (plan.ask.length === 0 || offer === undefined)
|
|
2283
|
-
return { kind: "write", event, notes: plan.notes };
|
|
2302
|
+
return { kind: "write", event, notes: plan.notes, addressNote };
|
|
2284
2303
|
// one ask per call: a service call that ran again after its ask is not asked again; only a
|
|
2285
2304
|
// would-be ask is replaced, the plan's other notes (a host on the list, not yet applied) stay
|
|
2286
2305
|
if (service !== undefined &&
|
|
@@ -2289,6 +2308,7 @@ let ToolPipeline = class ToolPipeline {
|
|
|
2289
2308
|
kind: "write",
|
|
2290
2309
|
event,
|
|
2291
2310
|
notes: [...plan.notes, serviceAskedNote(plan.ask.map((h) => h.host))],
|
|
2311
|
+
addressNote,
|
|
2292
2312
|
};
|
|
2293
2313
|
}
|
|
2294
2314
|
// the device's owner is the only person who may decide (spec §5.2)
|
|
@@ -2300,7 +2320,7 @@ let ToolPipeline = class ToolPipeline {
|
|
|
2300
2320
|
.where("deleted_at", "is", null)
|
|
2301
2321
|
.executeTakeFirst();
|
|
2302
2322
|
if (owner === undefined)
|
|
2303
|
-
return { kind: "write", event, notes: plan.notes };
|
|
2323
|
+
return { kind: "write", event, notes: plan.notes, addressNote };
|
|
2304
2324
|
let { content, outputId } = result;
|
|
2305
2325
|
if (Buffer.byteLength(content, "utf8") > NETWORK_ASK_KEPT_MAX_BYTES && outputId === undefined) {
|
|
2306
2326
|
// output under the spill threshold but over what an ask keeps: archive it after all
|
|
@@ -2313,10 +2333,10 @@ let ToolPipeline = class ToolPipeline {
|
|
|
2313
2333
|
content = spilled.content;
|
|
2314
2334
|
outputId = spilled.outputId;
|
|
2315
2335
|
}
|
|
2316
|
-
const { text: _text, ...rest } = result;
|
|
2336
|
+
const { text: _text, denialHint, ...rest } = result;
|
|
2317
2337
|
const kept = {
|
|
2318
2338
|
...rest,
|
|
2319
|
-
content: withNetworkNotes(clipKept(content), plan.notes),
|
|
2339
|
+
content: withNetworkNotes(clipKept(content) + denialHintFor(denialHint, addressNote), plan.notes),
|
|
2320
2340
|
...(outputId !== undefined && { outputId }),
|
|
2321
2341
|
};
|
|
2322
2342
|
// the command ran: the call's display-only events (a `device_code`) and network_blocked with
|
|
@@ -2615,9 +2635,6 @@ let ToolPipeline = class ToolPipeline {
|
|
|
2615
2635
|
reviewed?.escalationRefusal !== undefined && {
|
|
2616
2636
|
sandboxEscalationRefusal: reviewed.escalationRefusal,
|
|
2617
2637
|
}),
|
|
2618
|
-
// a sub-agent works in its root conversation's sandbox (spec §10.1, at every depth)
|
|
2619
|
-
...(tool.source.kind === "builtin" &&
|
|
2620
|
-
ctx.parent !== undefined && { sandboxConversationId: ctx.parent.rootConversationId }),
|
|
2621
2638
|
...(tool.source.kind === "builtin" &&
|
|
2622
2639
|
ctx.parent !== undefined && { parentRunId: ctx.parent.runId }),
|
|
2623
2640
|
...(tool.source.kind === "builtin" &&
|
|
@@ -2988,7 +3005,9 @@ let ToolPipeline = class ToolPipeline {
|
|
|
2988
3005
|
/**
|
|
2989
3006
|
* A plugin tool's inline card (`ToolResult.card` → `tool_result.card`, display only): `view` must
|
|
2990
3007
|
* be an `inline` ui contribution of the same extension and `key` at most 200 characters; anything
|
|
2991
|
-
* else is dropped with a warning and the result is written as usual.
|
|
3008
|
+
* else is dropped with a warning and the result is written as usual. `placement` is kept when
|
|
3009
|
+
* `pinned` or `process` (an unknown value means `output`); `text` only with `pinned`, 1 to
|
|
3010
|
+
* {@link CARD_TEXT_MAX} characters; `badge` only with `pinned`, 1 to {@link CARD_BADGE_MAX}.
|
|
2992
3011
|
*/
|
|
2993
3012
|
cardOf(result, plugin, toolKey) {
|
|
2994
3013
|
const c = result?.card;
|
|
@@ -3004,7 +3023,52 @@ let ToolPipeline = class ToolPipeline {
|
|
|
3004
3023
|
});
|
|
3005
3024
|
return undefined;
|
|
3006
3025
|
}
|
|
3007
|
-
|
|
3026
|
+
// placement: an unknown value falls back to `output` (recorded as absent)
|
|
3027
|
+
let placement;
|
|
3028
|
+
if (x.placement === "pinned" || x.placement === "process")
|
|
3029
|
+
placement = x.placement;
|
|
3030
|
+
else if (x.placement !== undefined && x.placement !== "output") {
|
|
3031
|
+
this.deps.log.warn("tool returned an inline card with an unknown placement; using output", {
|
|
3032
|
+
toolKey,
|
|
3033
|
+
placement: typeof x.placement === "string" ? x.placement.slice(0, 50) : undefined,
|
|
3034
|
+
});
|
|
3035
|
+
}
|
|
3036
|
+
// text: only a pinned card carries it, at most CARD_TEXT_MAX characters
|
|
3037
|
+
let text;
|
|
3038
|
+
if (x.text !== undefined) {
|
|
3039
|
+
if (placement !== "pinned") {
|
|
3040
|
+
this.deps.log.warn("tool returned inline card text without a pinned placement; text dropped", {
|
|
3041
|
+
toolKey,
|
|
3042
|
+
});
|
|
3043
|
+
}
|
|
3044
|
+
else if (typeof x.text !== "string" || x.text === "" || x.text.length > CARD_TEXT_MAX) {
|
|
3045
|
+
this.deps.log.warn("tool returned inline card text that is empty or too long; text dropped", {
|
|
3046
|
+
toolKey,
|
|
3047
|
+
});
|
|
3048
|
+
}
|
|
3049
|
+
else
|
|
3050
|
+
text = x.text;
|
|
3051
|
+
}
|
|
3052
|
+
// badge: only a pinned card carries it, at most CARD_BADGE_MAX characters
|
|
3053
|
+
let badge;
|
|
3054
|
+
if (x.badge !== undefined) {
|
|
3055
|
+
if (placement !== "pinned") {
|
|
3056
|
+
this.deps.log.warn("tool returned an inline card badge without a pinned placement; badge dropped", { toolKey });
|
|
3057
|
+
}
|
|
3058
|
+
else if (typeof x.badge !== "string" || x.badge === "" || x.badge.length > CARD_BADGE_MAX) {
|
|
3059
|
+
this.deps.log.warn("tool returned an inline card badge that is empty or too long; badge dropped", { toolKey });
|
|
3060
|
+
}
|
|
3061
|
+
else
|
|
3062
|
+
badge = x.badge;
|
|
3063
|
+
}
|
|
3064
|
+
return {
|
|
3065
|
+
plugin,
|
|
3066
|
+
view: x.view,
|
|
3067
|
+
...(x.key !== undefined && { key: x.key }),
|
|
3068
|
+
...(placement !== undefined && { placement }),
|
|
3069
|
+
...(text !== undefined && { text }),
|
|
3070
|
+
...(badge !== undefined && { badge }),
|
|
3071
|
+
};
|
|
3008
3072
|
}
|
|
3009
3073
|
/**
|
|
3010
3074
|
* A plugin tool's `InputRequired.open` (display only): `contribution` must be a
|
package/dist/tools/registry.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ import type { ConversationKindForHooks } from "../runtime/hook-calls.js";
|
|
|
13
13
|
import type { ExecutionClaim } from "../runtime/run-execution.js";
|
|
14
14
|
import { BuiltinTools } from "./builtins/builtin-tools.js";
|
|
15
15
|
import { Credentials } from "./credentials.js";
|
|
16
|
+
import type { DenialHint } from "./network-asks.js";
|
|
16
17
|
import { OrgToolSwitches } from "./org-tool-switches.js";
|
|
17
18
|
export { BUILTIN_TOOL_NAMES } from "./builtin-names.js";
|
|
18
19
|
export { canonicalJson } from "./canonical-json.js";
|
|
@@ -50,12 +51,6 @@ export interface BuiltinCallContext extends ToolCallContext {
|
|
|
50
51
|
* only by `sandbox.limits.maxCommandSeconds` and the tool timeouts.
|
|
51
52
|
*/
|
|
52
53
|
runDeadline?: number;
|
|
53
|
-
/**
|
|
54
|
-
* The conversation whose sandbox this call uses (sub-agents spec §10.1, agent map spec §6): the
|
|
55
|
-
* root conversation for a sub-agent's call at any depth, the conversation itself otherwise (the
|
|
56
|
-
* default when absent).
|
|
57
|
-
*/
|
|
58
|
-
sandboxConversationId?: string;
|
|
59
54
|
/**
|
|
60
55
|
* The working root the command review judged this call against (project root spec §4.3): a
|
|
61
56
|
* sandbox tool runs there instead of reading the working root again, so it executes exactly what
|
|
@@ -141,10 +136,13 @@ export type BuiltinResult = (ToolResult & {
|
|
|
141
136
|
* Kernel-internal (never written to the log or sent to the model): the network hosts a
|
|
142
137
|
* foreground command on a device was refused (`Bash`; network ask-to-allow spec §6.2). The
|
|
143
138
|
* pipeline turns it into `network_blocked`, an ask to the device owner or notes.
|
|
139
|
+
* `denialHint`: the sandbox denial line, left out of the content; the pipeline appends the
|
|
140
|
+
* form that goes with its notes (`denialHintFor`).
|
|
144
141
|
*/
|
|
145
142
|
networkReport?: {
|
|
146
143
|
deviceId: string;
|
|
147
144
|
blocked: NetworkBlockedHost[];
|
|
145
|
+
denialHint?: DenialHint;
|
|
148
146
|
};
|
|
149
147
|
/**
|
|
150
148
|
* Kernel-internal (never written to the log or sent to the model): `gh auth login --web`'s
|
|
@@ -197,6 +195,8 @@ export interface CallPolicyContext {
|
|
|
197
195
|
accountId: string;
|
|
198
196
|
agentId: string;
|
|
199
197
|
conversationId: string;
|
|
198
|
+
/** The root of the conversation tree; absent outside the pipeline (then the conversation itself). */
|
|
199
|
+
rootConversationId?: string;
|
|
200
200
|
/** Null outside a run (a builtin called directly). */
|
|
201
201
|
runId: string | null;
|
|
202
202
|
/** The tool call being decided (a call id is unique within its run). Absent outside the pipeline. */
|
|
@@ -302,12 +302,13 @@ export interface UnavailableTool {
|
|
|
302
302
|
/** The first 16 hex digits of sha256(canonicalJson(v)): a fingerprint independent of key order. */
|
|
303
303
|
export declare function contentHash(v: unknown): string;
|
|
304
304
|
/**
|
|
305
|
-
* `ToolSpec` fields the model never sees: the display-only `title
|
|
306
|
-
* and an extension tool's own time limit `timeoutMs`. Left
|
|
307
|
-
* adding or changing them never changes
|
|
308
|
-
* to drift review and never invalidates a
|
|
305
|
+
* `ToolSpec` fields the model never sees: the display-only `title`, `keyArgs` (UI refresh B) and
|
|
306
|
+
* `inputView` (streaming input preview), and an extension tool's own time limit `timeoutMs`. Left
|
|
307
|
+
* out of the definition fingerprint, so adding or changing them never changes
|
|
308
|
+
* `model_call.request.tools`, never sends a connector tool to drift review and never invalidates a
|
|
309
|
+
* remembered grant.
|
|
309
310
|
*/
|
|
310
|
-
export declare const NON_MODEL_SPEC_FIELDS: readonly ["title", "keyArgs", "timeoutMs"];
|
|
311
|
+
export declare const NON_MODEL_SPEC_FIELDS: readonly ["title", "keyArgs", "inputView", "timeoutMs"];
|
|
311
312
|
/** A tool spec without its {@link NON_MODEL_SPEC_FIELDS} (non-objects unchanged). */
|
|
312
313
|
export declare function withoutNonModelFields<T>(spec: T): T;
|
|
313
314
|
/**
|
package/dist/tools/registry.js
CHANGED
|
@@ -35,12 +35,13 @@ export function contentHash(v) {
|
|
|
35
35
|
return createHash("sha256").update(canonicalJson(v)).digest("hex").slice(0, 16);
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
|
-
* `ToolSpec` fields the model never sees: the display-only `title
|
|
39
|
-
* and an extension tool's own time limit `timeoutMs`. Left
|
|
40
|
-
* adding or changing them never changes
|
|
41
|
-
* to drift review and never invalidates a
|
|
38
|
+
* `ToolSpec` fields the model never sees: the display-only `title`, `keyArgs` (UI refresh B) and
|
|
39
|
+
* `inputView` (streaming input preview), and an extension tool's own time limit `timeoutMs`. Left
|
|
40
|
+
* out of the definition fingerprint, so adding or changing them never changes
|
|
41
|
+
* `model_call.request.tools`, never sends a connector tool to drift review and never invalidates a
|
|
42
|
+
* remembered grant.
|
|
42
43
|
*/
|
|
43
|
-
export const NON_MODEL_SPEC_FIELDS = ["title", "keyArgs", "timeoutMs"];
|
|
44
|
+
export const NON_MODEL_SPEC_FIELDS = ["title", "keyArgs", "inputView", "timeoutMs"];
|
|
44
45
|
/** A tool spec without its {@link NON_MODEL_SPEC_FIELDS} (non-objects unchanged). */
|
|
45
46
|
export function withoutNonModelFields(spec) {
|
|
46
47
|
if (spec === null || typeof spec !== "object" || Array.isArray(spec))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capybara-hq/kernel",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.99",
|
|
4
4
|
"description": "Capybara kernel: config, database, plugin host and HTTP API of the Capybara agent platform",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"yaml": "^2.9.1",
|
|
67
67
|
"yauzl": "3.4.0",
|
|
68
68
|
"zod": "^4.6.7",
|
|
69
|
-
"@capybara-hq/plugin-sdk": "^0.1.0-rc.
|
|
69
|
+
"@capybara-hq/plugin-sdk": "^0.1.0-rc.82"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@langchain/langgraph-checkpoint-validation": "^1.2.0",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"@types/ws": "^8.18.2",
|
|
76
76
|
"@types/yauzl": "3.4.0",
|
|
77
77
|
"ws": "^8.22.0",
|
|
78
|
-
"@capybara-hq/testing": "0.1.0-rc.
|
|
78
|
+
"@capybara-hq/testing": "0.1.0-rc.44"
|
|
79
79
|
},
|
|
80
80
|
"scripts": {
|
|
81
81
|
"build": "tsc -b"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
-- Conversation process blocks: how an IM channel shows a run's process. Per connection,
|
|
2
|
+
-- 'detailed' | 'brief' | 'off'; NULL follows the chat type (direct chats detailed, groups brief).
|
|
3
|
+
ALTER TABLE channel_connections ADD COLUMN IF NOT EXISTS process_display text
|
|
4
|
+
CHECK (process_display IN ('detailed', 'brief', 'off'));
|
|
5
|
+
-- The run's one progress message, edited in place: its IM message id, the run it belongs to and
|
|
6
|
+
-- when its last milestone was sent, so any replica delivering the conversation edits the same one.
|
|
7
|
+
ALTER TABLE channel_deliveries ADD COLUMN IF NOT EXISTS progress_message_id text;
|
|
8
|
+
ALTER TABLE channel_deliveries ADD COLUMN IF NOT EXISTS progress_run_id text;
|
|
9
|
+
ALTER TABLE channel_deliveries ADD COLUMN IF NOT EXISTS milestone_at timestamptz;
|
|
10
|
+
-- The run's progress card was posted again after the platform rejected an edit (once per run).
|
|
11
|
+
ALTER TABLE channel_deliveries ADD COLUMN IF NOT EXISTS progress_reposted boolean NOT NULL DEFAULT false;
|
|
12
|
+
-- The ended run's card got its final edit (or the platform refused it for good): leave it alone.
|
|
13
|
+
ALTER TABLE channel_deliveries ADD COLUMN IF NOT EXISTS progress_final boolean NOT NULL DEFAULT false;
|