@capybara-hq/kernel 0.1.0-rc.66 → 0.1.0-rc.67
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 +0 -8
- package/dist/admin/admin.schemas.d.ts +3 -0
- package/dist/agents/admin-agents.d.ts +2 -2
- package/dist/agents/admin-agents.js +2 -1
- package/dist/agents/agent-lookup.js +2 -1
- package/dist/agents/agent-profile.service.d.ts +5 -2
- package/dist/agents/agent-profile.service.js +13 -2
- package/dist/agents/agents.controller.d.ts +4 -3
- package/dist/agents/agents.controller.js +7 -3
- package/dist/agents/agents.module.js +3 -0
- package/dist/agents/agents.schemas.d.ts +6 -6
- package/dist/agents/agents.service.d.ts +23 -2
- package/dist/agents/agents.service.js +61 -6
- package/dist/agents/avatar-view.d.ts +8 -0
- package/dist/agents/avatar-view.js +12 -0
- package/dist/agents/profile.d.ts +38 -13
- package/dist/agents/profile.js +31 -20
- package/dist/background/poll.job.d.ts +1 -1
- package/dist/background/poll.job.js +8 -6
- package/dist/background/tasks.service.js +1 -1
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/channels/inbound.d.ts +2 -3
- package/dist/channels/inbound.js +2 -3
- package/dist/channels/phrases.d.ts +3 -3
- package/dist/channels/phrases.js +3 -3
- package/dist/config/schema.d.ts +1 -0
- package/dist/config/schema.js +14 -1
- package/dist/conversations/conversations.service.d.ts +4 -3
- package/dist/conversations/conversations.service.js +4 -2
- package/dist/ctx/create-ctx.js +5 -2
- package/dist/ctx/device-provider-check.d.ts +7 -0
- package/dist/ctx/device-provider-check.js +21 -0
- package/dist/db/kernel-schema.d.ts +7 -0
- package/dist/devices/access.d.ts +16 -46
- package/dist/devices/access.js +26 -62
- package/dist/devices/access.module.js +2 -2
- package/dist/devices/conversation-devices.d.ts +38 -18
- package/dist/devices/conversation-devices.js +69 -51
- package/dist/devices/default-provider-setting.d.ts +45 -0
- package/dist/devices/default-provider-setting.js +59 -0
- package/dist/devices/device-projects.service.js +7 -2
- package/dist/devices/device-provider-selection.d.ts +37 -0
- package/dist/devices/device-provider-selection.js +86 -0
- package/dist/devices/device-provider-selection.module.d.ts +3 -0
- package/dist/devices/device-provider-selection.module.js +22 -0
- package/dist/devices/devices.controller.d.ts +8 -5
- package/dist/devices/devices.controller.js +7 -4
- package/dist/devices/devices.module.js +3 -1
- package/dist/devices/devices.schemas.js +2 -2
- package/dist/devices/devices.service.d.ts +72 -83
- package/dist/devices/devices.service.js +139 -248
- package/dist/devices/dto.d.ts +9 -0
- package/dist/devices/dto.js +15 -2
- package/dist/devices/label.d.ts +3 -5
- package/dist/devices/label.js +3 -14
- package/dist/devices/legacy-cleanup.job.d.ts +2 -2
- package/dist/devices/legacy-cleanup.job.js +6 -6
- package/dist/errors.d.ts +15 -1
- package/dist/errors.js +15 -1
- package/dist/extensions/guide-places.d.ts +2 -1
- package/dist/extensions/guide-places.js +8 -2
- package/dist/extensions/locks.d.ts +1 -1
- package/dist/extensions/locks.js +1 -1
- package/dist/extensions/org-config.d.ts +20 -4
- package/dist/extensions/org-config.js +23 -6
- package/dist/extensions/permission-view.d.ts +2 -2
- package/dist/extensions/permission-view.js +2 -2
- package/dist/extensions/plugin-guides.d.ts +1 -1
- package/dist/extensions/plugin-guides.js +11 -3
- package/dist/extensions/point-defaults.d.ts +14 -0
- package/dist/extensions/point-defaults.js +70 -47
- package/dist/extensions/resolve.js +7 -2
- package/dist/identity/settings.d.ts +8 -0
- package/dist/identity/settings.js +24 -1
- package/dist/infra/config/kernel-config.service.js +2 -0
- package/dist/lifecycle/kernel-lifecycle.js +7 -6
- package/dist/local-devices/device-routes.d.ts +1 -1
- package/dist/local-devices/device-routes.js +1 -1
- package/dist/local-devices/local-device-provider.d.ts +14 -11
- package/dist/local-devices/local-device-provider.js +14 -0
- package/dist/local-devices/local-devices.module.d.ts +4 -4
- package/dist/local-devices/local-devices.module.js +5 -3
- package/dist/local-devices/owner-report.js +2 -1
- package/dist/local-devices/targets.d.ts +2 -0
- package/dist/local-devices/targets.js +10 -0
- package/dist/orgs/settings.service.d.ts +26 -1
- package/dist/orgs/settings.service.js +44 -3
- package/dist/platform/ops/admin.ops.js +8 -3
- package/dist/platform/ops/agents.ops.d.ts +6 -1
- package/dist/platform/ops/agents.ops.js +38 -11
- package/dist/platform/ops/devices.ops.js +25 -20
- package/dist/platform/ops/orgs.ops.js +1 -0
- package/dist/platform/ops/themes.ops.js +1 -1
- package/dist/runtime/plugin-context.service.js +1 -12
- package/dist/sandbox/cloud-permission-snapshot.d.ts +2 -2
- package/dist/sandbox/cloud-permission-snapshot.js +3 -3
- package/dist/sandbox/device-reports.d.ts +50 -0
- package/dist/sandbox/device-reports.js +157 -0
- package/dist/sandbox/held-operations.d.ts +8 -8
- package/dist/sandbox/leases.d.ts +1 -1
- package/dist/sandbox/leases.js +1 -1
- package/dist/sandbox/operation-authority.d.ts +5 -2
- package/dist/sandbox/operation-authority.js +12 -11
- package/dist/sandbox/operation-reconcile.job.d.ts +2 -2
- package/dist/sandbox/operation-reconcile.job.js +5 -5
- package/dist/sandbox/permission-availability.d.ts +2 -2
- package/dist/sandbox/permission-call-types.d.ts +5 -0
- package/dist/sandbox/permission-facts.d.ts +2 -2
- package/dist/sandbox/permission-facts.js +5 -5
- package/dist/sandbox/providers.d.ts +23 -24
- package/dist/sandbox/providers.js +38 -46
- package/dist/sandbox/providers.module.js +3 -3
- package/dist/sandbox/sandbox.module.d.ts +1 -1
- package/dist/sandbox/sandbox.module.js +7 -2
- package/dist/sandbox/sandbox.service.d.ts +95 -68
- package/dist/sandbox/sandbox.service.js +212 -208
- package/dist/setup/setup-guides.service.d.ts +4 -1
- package/dist/setup/setup-guides.service.js +6 -1
- package/dist/themes/avatar-preset-key.d.ts +6 -0
- package/dist/themes/avatar-preset-key.js +9 -0
- package/dist/themes/theme-state.d.ts +29 -1
- package/dist/themes/theme-state.js +40 -1
- package/dist/themes/themes.service.d.ts +28 -1
- package/dist/themes/themes.service.js +36 -2
- package/dist/tools/builtins/image/generate.d.ts +3 -0
- package/dist/tools/builtins/image/generate.js +21 -11
- package/dist/tools/builtins/image/index.d.ts +1 -1
- package/dist/tools/builtins/image/index.js +1 -1
- package/dist/tools/builtins/sandbox/common.d.ts +36 -12
- package/dist/tools/builtins/sandbox/common.js +62 -18
- package/dist/tools/builtins/sandbox/read.d.ts +5 -2
- package/dist/tools/builtins/sandbox/read.js +9 -6
- package/dist/tools/builtins/sandbox/task-output.d.ts +2 -2
- package/dist/tools/builtins/sandbox/task-output.js +6 -5
- package/dist/tools/builtins/skill-load.js +13 -4
- package/dist/until-aborted.d.ts +5 -0
- package/dist/until-aborted.js +16 -0
- package/package.json +4 -4
- package/src/migrations/0176_device_report.sql +6 -0
|
@@ -19,8 +19,8 @@ export interface TaskEnv {
|
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* The task tools' dependencies; throws the tool's error when they are missing, or when the
|
|
22
|
-
* conversation's device cannot run (
|
|
23
|
-
*
|
|
22
|
+
* conversation's device cannot run (its provider off in the org, or no provider on there: ruling
|
|
23
|
+
* R8, {@link sandboxUnusableError}).
|
|
24
24
|
*/
|
|
25
25
|
export declare function taskEnv(deps: SandboxToolDeps, ctx: BuiltinCallContext): Promise<TaskEnv>;
|
|
26
26
|
/**
|
|
@@ -8,7 +8,7 @@ import { formatElapsed, taskReasonText } from "../../../background/render.js";
|
|
|
8
8
|
import { notRunningAs, RECREATED } from "../../../background/stop.js";
|
|
9
9
|
import { isManagedTask } from "../../../background/store.js";
|
|
10
10
|
import { RetirementPendingError, retirementPending, } from "../../../sandbox/sandbox.service.js";
|
|
11
|
-
import { clip, display, mapSandboxError,
|
|
11
|
+
import { clip, display, mapSandboxError, runTimeLeftMs, sandboxBaseTimeoutMs, sandboxConversationOf, sandboxUnusableError, unavailableWhenNoSandbox, } from "./common.js";
|
|
12
12
|
import { parseDeviceCode } from "./device-code.js";
|
|
13
13
|
import { assertDeviceOfRunAccount } from "./device-owner.js";
|
|
14
14
|
/** How long `TaskOutput` waits with `block` when `timeout` is not given (ms). */
|
|
@@ -57,12 +57,13 @@ const SPEC = {
|
|
|
57
57
|
};
|
|
58
58
|
/**
|
|
59
59
|
* The task tools' dependencies; throws the tool's error when they are missing, or when the
|
|
60
|
-
* conversation's device cannot run (
|
|
61
|
-
*
|
|
60
|
+
* conversation's device cannot run (its provider off in the org, or no provider on there: ruling
|
|
61
|
+
* R8, {@link sandboxUnusableError}).
|
|
62
62
|
*/
|
|
63
63
|
export async function taskEnv(deps, ctx) {
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
const unusable = await sandboxUnusableError(deps, ctx.orgId, sandboxConversationOf(ctx));
|
|
65
|
+
if (unusable !== null)
|
|
66
|
+
throw unusable;
|
|
66
67
|
const { background, tasks } = deps;
|
|
67
68
|
if (!background || !tasks || !deps.sandbox.ifRunning) {
|
|
68
69
|
throw new ToolError("Background tasks are not available here; use Bash without run_in_background instead.");
|
|
@@ -11,7 +11,7 @@ import { resolveSkillForkType } from "../../runtime/subagents/roster.js";
|
|
|
11
11
|
import { invocationOf, resolveSkills } from "../../skills/catalog.js";
|
|
12
12
|
import { PLATFORM_SOURCE, skillFileStore } from "../../skills/usable.js";
|
|
13
13
|
import { AGENT_TOOL, SANDBOX_TOOL_NAMES } from "../builtin-names.js";
|
|
14
|
-
import { checkToolPath, clip, display, inSandboxPreparation, inToolSandbox, mapSandboxError, sandboxBaseTimeoutMs, sandboxConversationOf,
|
|
14
|
+
import { checkToolPath, clip, display, inSandboxPreparation, inToolSandbox, mapSandboxError, sandboxBaseTimeoutMs, sandboxConversationOf, sandboxUnusableReason, withNotices, withPathLease, } from "./sandbox/common.js";
|
|
15
15
|
/**
|
|
16
16
|
* Builtin tool `Skill` (M5 T14, ruling M17): resolves the name against the latest skills catalog
|
|
17
17
|
* snapshot in the log to an id and version, and returns that version's SKILL.md body and file list
|
|
@@ -533,6 +533,12 @@ async function loadProjectSkill(deps, ctx, asked, bare, args) {
|
|
|
533
533
|
display: display(`加载项目技能 ${asked}`, `Loaded project skill ${asked}`),
|
|
534
534
|
};
|
|
535
535
|
}
|
|
536
|
+
/** Why a skill's files cannot reach the device, per {@link DeviceUnusableReason}. */
|
|
537
|
+
const SKILL_NO_DEVICE_CAUSE = {
|
|
538
|
+
"provider-off": "This conversation's device runs on a device provider that is off in this organization or not installed",
|
|
539
|
+
"no-device": "This conversation has no device (its owner has no default device and the organization has no default device provider)",
|
|
540
|
+
none: "No device provider is on in this organization",
|
|
541
|
+
};
|
|
536
542
|
/** 内置工具 `Skill`(见文件头)。 */
|
|
537
543
|
export function skillLoadTool(deps) {
|
|
538
544
|
return {
|
|
@@ -603,14 +609,17 @@ export function skillLoadTool(deps) {
|
|
|
603
609
|
const others = manifest.files.filter((f) => f.path !== SKILL_ENTRY_FILE);
|
|
604
610
|
let notices = [];
|
|
605
611
|
let filesText;
|
|
612
|
+
const unusable = others.length === 0
|
|
613
|
+
? null
|
|
614
|
+
: await sandboxUnusableReason(deps, ctx.orgId, sandboxConversationOf(ctx));
|
|
606
615
|
if (others.length === 0) {
|
|
607
616
|
filesText = "This skill has no files besides its instructions.";
|
|
608
617
|
}
|
|
609
|
-
else if (
|
|
618
|
+
else if (unusable !== null) {
|
|
610
619
|
filesText =
|
|
611
620
|
`Skill files (for reference):\n${fileList(manifest.files)}\n` +
|
|
612
|
-
|
|
613
|
-
"follow the instructions without running them.";
|
|
621
|
+
SKILL_NO_DEVICE_CAUSE[unusable] +
|
|
622
|
+
", so the skill's scripts and other files are not available; follow the instructions without running them.";
|
|
614
623
|
}
|
|
615
624
|
else if (!hasSandboxTools(ctx)) {
|
|
616
625
|
// 模型跑不了脚本:不为它创建沙箱、不复制
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `p`, or a rejection with `signal.reason` once `signal` aborts, whatever `p` does: an extension
|
|
3
|
+
* call that ignores its signal never holds the caller past it (a late settle of `p` is dropped).
|
|
4
|
+
*/
|
|
5
|
+
export declare function untilAborted<T>(p: Promise<T>, signal: AbortSignal): Promise<T>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `p`, or a rejection with `signal.reason` once `signal` aborts, whatever `p` does: an extension
|
|
3
|
+
* call that ignores its signal never holds the caller past it (a late settle of `p` is dropped).
|
|
4
|
+
*/
|
|
5
|
+
export function untilAborted(p, signal) {
|
|
6
|
+
return new Promise((resolve, reject) => {
|
|
7
|
+
const onAbort = () => reject(signal.reason);
|
|
8
|
+
if (signal.aborted) {
|
|
9
|
+
p.catch(() => { });
|
|
10
|
+
onAbort();
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
14
|
+
p.then(resolve, reject).finally(() => signal.removeEventListener("abort", onAbort));
|
|
15
|
+
});
|
|
16
|
+
}
|
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.67",
|
|
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.51"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@langchain/langgraph-checkpoint-validation": "^1.2.0",
|
|
@@ -75,8 +75,8 @@
|
|
|
75
75
|
"@types/ws": "^8.18.2",
|
|
76
76
|
"@types/yauzl": "3.4.0",
|
|
77
77
|
"ws": "^8.22.0",
|
|
78
|
-
"@capybara-hq/
|
|
79
|
-
"@capybara-hq/
|
|
78
|
+
"@capybara-hq/testing": "0.1.0-rc.33",
|
|
79
|
+
"@capybara-hq/device": "0.1.0-rc.27"
|
|
80
80
|
},
|
|
81
81
|
"scripts": {
|
|
82
82
|
"build": "tsc -b"
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
-- Device providers (spec 2026-11-21-device-provider-design): what a device's provider last told
|
|
2
|
+
-- about it (`device-provider@1` `report()`, a DeviceReport as JSON) and when. Shown to people
|
|
3
|
+
-- only, never used for enforcement; request paths read this copy and never call the provider.
|
|
4
|
+
-- Expand-only, no backfill: null until the device's next create or resume refreshes it.
|
|
5
|
+
ALTER TABLE devices ADD COLUMN IF NOT EXISTS report jsonb;
|
|
6
|
+
ALTER TABLE devices ADD COLUMN IF NOT EXISTS report_at timestamptz;
|