@capybara-hq/kernel 0.1.0-rc.85 → 0.1.0-rc.86
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/catalog/marketplaces.service.d.ts +1 -1
- package/dist/channels/cards.d.ts +7 -3
- package/dist/channels/cards.js +9 -4
- package/dist/channels/phrases.d.ts +10 -0
- package/dist/channels/phrases.js +10 -0
- package/dist/config/docs.js +1 -1
- package/dist/config/schema.d.ts +3 -0
- package/dist/config/schema.js +18 -12
- package/dist/ctx/create-ctx.d.ts +10 -1
- package/dist/ctx/create-ctx.js +42 -2
- package/dist/device-access/device-access.module.d.ts +7 -0
- package/dist/device-access/device-access.module.js +41 -0
- package/dist/device-access/device-access.service.d.ts +142 -0
- package/dist/device-access/device-access.service.js +464 -0
- package/dist/device-access/token.d.ts +6 -0
- package/dist/device-access/token.js +6 -0
- package/dist/device-access/viewer-routes.d.ts +45 -0
- package/dist/device-access/viewer-routes.js +81 -0
- package/dist/device-access/viewer.d.ts +244 -0
- package/dist/device-access/viewer.js +844 -0
- package/dist/dial-in/access.d.ts +19 -0
- package/dist/dial-in/access.js +23 -0
- package/dist/dial-in/gateway.d.ts +48 -6
- package/dist/dial-in/gateway.js +145 -10
- package/dist/dial-in/keys.d.ts +7 -0
- package/dist/dial-in/keys.js +7 -0
- package/dist/dial-in/routes.d.ts +11 -3
- package/dist/dial-in/routes.js +15 -4
- package/dist/dial-in/streams.d.ts +58 -0
- package/dist/dial-in/streams.js +283 -0
- package/dist/errors.d.ts +2 -0
- package/dist/errors.js +2 -0
- package/dist/extensions/host.d.ts +13 -1
- package/dist/extensions/host.js +20 -1
- package/dist/extensions/permission-set.d.ts +15 -1
- package/dist/extensions/permission-set.js +13 -1
- package/dist/extensions/permission-view.d.ts +6 -4
- package/dist/extensions/permission-view.js +6 -1
- package/dist/http/error.filter.js +2 -0
- package/dist/http/gateway-routes.d.ts +8 -4
- package/dist/http/gateway-routes.js +4 -3
- package/dist/infra/lock/lock.service.d.ts +5 -1
- package/dist/infra/lock/lock.service.js +10 -4
- package/dist/infra/throttler/named-throttlers.d.ts +3 -0
- package/dist/infra/throttler/named-throttlers.js +16 -0
- package/dist/kernel.module.js +3 -0
- package/dist/roles/gateway-role.d.ts +13 -6
- package/dist/roles/gateway-role.js +27 -9
- package/dist/roles/gateway.module.d.ts +2 -1
- package/dist/roles/gateway.module.js +13 -3
- package/dist/sandbox/device-services.d.ts +62 -0
- package/dist/sandbox/device-services.js +183 -0
- package/dist/sandbox/leases.d.ts +18 -1
- package/dist/sandbox/leases.js +75 -1
- package/dist/sandbox/network-grants.js +5 -2
- package/dist/sandbox/sandbox.module.d.ts +2 -1
- package/dist/sandbox/sandbox.module.js +5 -2
- package/dist/sandbox/sandbox.service.d.ts +44 -1
- package/dist/sandbox/sandbox.service.js +142 -5
- package/dist/tools/approvals.service.d.ts +45 -20
- package/dist/tools/approvals.service.js +19 -9
- package/dist/tools/call-scope.d.ts +60 -0
- package/dist/tools/call-scope.js +23 -0
- package/dist/tools/network-asks.d.ts +13 -0
- package/dist/tools/network-asks.js +26 -2
- package/dist/tools/pipeline.d.ts +30 -1
- package/dist/tools/pipeline.js +285 -54
- package/dist/tools/questions.service.d.ts +24 -3
- package/dist/tools/questions.service.js +3 -1
- package/package.json +3 -3
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type FormAnswer, type InputForm } from "@capybara-hq/plugin-sdk";
|
|
2
2
|
import { EventLog } from "../conversations/event-log.js";
|
|
3
|
+
import type { ReviewRecord } from "../conversations/events.js";
|
|
3
4
|
import { type PersonRef } from "../identity/account-avatar.js";
|
|
4
5
|
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
5
6
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
@@ -7,6 +8,20 @@ import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
|
7
8
|
import { KernelEvents } from "../infra/events/kernel-events.js";
|
|
8
9
|
import { RunResume } from "../runtime/run-jobs.js";
|
|
9
10
|
export type QuestionStatus = "pending" | "answered" | "skipped" | "expired" | "cancelled";
|
|
11
|
+
/**
|
|
12
|
+
* What the round that asked collected for the call's result and is not the tool's own state: a
|
|
13
|
+
* device service launch's review record and the hosts a device service reported refused
|
|
14
|
+
* (`ctx.deviceAccess`, the call scope). A later round (the resume, which starts nothing) writes
|
|
15
|
+
* the result with them, so they are not lost with the round that asked.
|
|
16
|
+
*/
|
|
17
|
+
export interface QuestionCarried {
|
|
18
|
+
review?: ReviewRecord;
|
|
19
|
+
blocked?: {
|
|
20
|
+
deviceId: string | null;
|
|
21
|
+
hosts: string[];
|
|
22
|
+
url: string | null;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
10
25
|
/** 一条输入请求(`AskUserQuestion`、插件工具的 `input_required`、MCP elicitation 共用)。 */
|
|
11
26
|
export interface QuestionRecord {
|
|
12
27
|
id: string;
|
|
@@ -20,6 +35,8 @@ export interface QuestionRecord {
|
|
|
20
35
|
step: number;
|
|
21
36
|
form: InputForm;
|
|
22
37
|
state: unknown;
|
|
38
|
+
/** {@link QuestionCarried}, when the round that asked collected any. */
|
|
39
|
+
carried?: QuestionCarried;
|
|
23
40
|
status: QuestionStatus;
|
|
24
41
|
answer: FormAnswer | null;
|
|
25
42
|
answeredBy: string | null;
|
|
@@ -38,9 +55,13 @@ export interface QuestionAskInput {
|
|
|
38
55
|
toolKey: string;
|
|
39
56
|
form: InputForm;
|
|
40
57
|
state: unknown;
|
|
58
|
+
carried?: QuestionCarried;
|
|
41
59
|
}
|
|
42
|
-
/**
|
|
43
|
-
|
|
60
|
+
/**
|
|
61
|
+
* The web's view of an input request: without the plugin's state (the tool's own resume data)
|
|
62
|
+
* and without what the round carried for the call's result ({@link QuestionCarried}).
|
|
63
|
+
*/
|
|
64
|
+
export type QuestionView = Omit<QuestionRecord, "state" | "carried"> & {
|
|
44
65
|
/** Who answered (next to `answeredBy`); null while open or when the account is gone. */
|
|
45
66
|
answeredByPerson: PersonRef | null;
|
|
46
67
|
};
|
|
@@ -78,7 +99,7 @@ export declare class QuestionsService {
|
|
|
78
99
|
*/
|
|
79
100
|
get(orgId: string, questionId: string, accountId: string): Promise<QuestionView>;
|
|
80
101
|
/** The web's view of a question: no plugin state, plus the answerer as a person. */
|
|
81
|
-
view({ state: _state, ...rest }: QuestionRecord): Promise<QuestionView>;
|
|
102
|
+
view({ state: _state, carried: _carried, ...rest }: QuestionRecord): Promise<QuestionView>;
|
|
82
103
|
/** 某个调用的全部输入请求(按轮次升序)。 */
|
|
83
104
|
forCall(runId: string, callId: string): Promise<QuestionRecord[]>;
|
|
84
105
|
/**
|
|
@@ -36,6 +36,7 @@ function toRecord(r) {
|
|
|
36
36
|
step: spec.step,
|
|
37
37
|
form: spec.form,
|
|
38
38
|
state: spec.state ?? null,
|
|
39
|
+
...(spec.carried !== undefined && { carried: spec.carried }),
|
|
39
40
|
status: r.status,
|
|
40
41
|
answer: (r.answer ?? null),
|
|
41
42
|
answeredBy: r.answered_by,
|
|
@@ -89,6 +90,7 @@ let QuestionsService = class QuestionsService {
|
|
|
89
90
|
state: input.state ?? null,
|
|
90
91
|
toolKey: input.toolKey,
|
|
91
92
|
step: input.step,
|
|
93
|
+
...(input.carried !== undefined && { carried: input.carried }),
|
|
92
94
|
};
|
|
93
95
|
const t = this.db.db;
|
|
94
96
|
await t
|
|
@@ -152,7 +154,7 @@ let QuestionsService = class QuestionsService {
|
|
|
152
154
|
return this.view(toRecord(row));
|
|
153
155
|
}
|
|
154
156
|
/** The web's view of a question: no plugin state, plus the answerer as a person. */
|
|
155
|
-
async view({ state: _state, ...rest }) {
|
|
157
|
+
async view({ state: _state, carried: _carried, ...rest }) {
|
|
156
158
|
const answeredByPerson = rest.answeredBy === null
|
|
157
159
|
? null
|
|
158
160
|
: ((await loadPeople(this.db.db, [rest.answeredBy])).get(rest.answeredBy) ?? null);
|
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.86",
|
|
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.70"
|
|
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.40"
|
|
79
79
|
},
|
|
80
80
|
"scripts": {
|
|
81
81
|
"build": "tsc -b"
|