@capybara-hq/kernel 0.1.0-rc.57 → 0.1.0-rc.58
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/admin/extensions.controller.d.ts +2 -10
- package/dist/admin/extensions.controller.js +2 -24
- package/dist/admin/extensions.schemas.d.ts +21 -0
- package/dist/admin/extensions.schemas.js +37 -0
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/catalog/org-extension-switch.d.ts +3 -1
- package/dist/catalog/org-extension-switch.js +12 -5
- package/dist/catalog/org-extension.controller.d.ts +2 -21
- package/dist/catalog/org-extension.controller.js +1 -38
- package/dist/catalog/org-extension.schemas.d.ts +31 -0
- package/dist/catalog/org-extension.schemas.js +65 -0
- package/dist/channels/actions.js +2 -0
- package/dist/channels/cards.d.ts +8 -0
- package/dist/channels/cards.js +18 -0
- package/dist/channels/outbound.js +8 -1
- package/dist/channels/phrases.d.ts +10 -0
- package/dist/channels/phrases.js +10 -0
- package/dist/conversations/conversations.module.js +4 -0
- package/dist/conversations/events.d.ts +1 -0
- package/dist/conversations/events.js +5 -0
- package/dist/conversations/leak-check.d.ts +26 -0
- package/dist/conversations/leak-check.js +69 -0
- package/dist/ctx/secrets.d.ts +5 -0
- package/dist/ctx/secrets.js +5 -0
- package/dist/db/kernel-schema.d.ts +15 -0
- package/dist/errors.d.ts +9 -0
- package/dist/errors.js +9 -0
- package/dist/extensions/deployment-config.d.ts +6 -2
- package/dist/extensions/deployment-config.js +35 -23
- package/dist/extensions/org-config.d.ts +2 -0
- package/dist/extensions/org-config.js +1 -0
- package/dist/extensions/org-overrides.d.ts +2 -0
- package/dist/extensions/org-overrides.js +3 -2
- package/dist/identity/initial-passwords.job.d.ts +3 -2
- package/dist/identity/initial-passwords.job.js +9 -5
- package/dist/platform/exclusions.js +1 -41
- package/dist/platform/method.js +1 -0
- package/dist/platform/operation.d.ts +30 -2
- package/dist/platform/operation.js +1 -1
- package/dist/platform/ops/extensions-admin.ops.d.ts +15 -2
- package/dist/platform/ops/extensions-admin.ops.js +153 -5
- package/dist/platform/ops/extensions.ops.d.ts +19 -5
- package/dist/platform/ops/extensions.ops.js +285 -10
- package/dist/platform/ops/person-inputs.d.ts +35 -0
- package/dist/platform/ops/person-inputs.js +79 -0
- package/dist/platform/ops/plugins.ops.d.ts +2 -0
- package/dist/platform/ops/plugins.ops.js +30 -17
- package/dist/platform/parity.d.ts +6 -2
- package/dist/platform/parity.js +38 -1
- package/dist/platform/person-fields.d.ts +103 -0
- package/dist/platform/person-fields.js +381 -0
- package/dist/platform/platform.module.d.ts +3 -3
- package/dist/platform/platform.module.js +6 -5
- package/dist/platform/sealed-inputs.d.ts +44 -0
- package/dist/platform/sealed-inputs.js +116 -0
- package/dist/runtime/waits.js +8 -2
- package/dist/tools/approvals.controller.d.ts +1 -0
- package/dist/tools/approvals.controller.js +19 -0
- package/dist/tools/approvals.service.d.ts +50 -1
- package/dist/tools/approvals.service.js +118 -10
- package/dist/tools/builtins/builtin-tools.d.ts +3 -0
- package/dist/tools/builtins/builtin-tools.js +31 -9
- package/dist/tools/builtins/platform.d.ts +20 -0
- package/dist/tools/builtins/platform.js +174 -15
- package/dist/tools/pipeline.d.ts +24 -2
- package/dist/tools/pipeline.js +80 -17
- package/dist/tools/policy.d.ts +3 -0
- package/dist/tools/policy.js +6 -0
- package/dist/tools/registry.d.ts +22 -0
- package/dist/tools/tools.module.js +3 -0
- package/package.json +4 -4
- package/src/migrations/0169_platform_sealed_inputs.sql +23 -0
|
@@ -7,6 +7,7 @@ import { type OrgOverrideSummary, OrgOverrides } from "../extensions/org-overrid
|
|
|
7
7
|
import type { AdminExtensionView } from "../extensions/permission-view.js";
|
|
8
8
|
import { type Principal } from "../identity/principal.js";
|
|
9
9
|
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
10
|
+
import { AdminExtensionConfigBody } from "./extensions.schemas.js";
|
|
10
11
|
declare const ApproveSchema: z.ZodObject<{
|
|
11
12
|
sha256: z.ZodNullable<z.ZodString>;
|
|
12
13
|
reviewHash: z.ZodString;
|
|
@@ -14,15 +15,6 @@ declare const ApproveSchema: z.ZodObject<{
|
|
|
14
15
|
declare const InstallSchema: z.ZodObject<{
|
|
15
16
|
sha256: z.ZodString;
|
|
16
17
|
}, z.core.$strip>;
|
|
17
|
-
declare const ConfigSchema: z.ZodObject<{
|
|
18
|
-
values: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
19
|
-
secretEntries: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
20
|
-
path: z.ZodString;
|
|
21
|
-
key: z.ZodString;
|
|
22
|
-
value: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
23
|
-
renameFrom: z.ZodOptional<z.ZodString>;
|
|
24
|
-
}, z.core.$strict>>>;
|
|
25
|
-
}, z.core.$strip>;
|
|
26
18
|
declare const NpmSchema: z.ZodObject<{
|
|
27
19
|
package: z.ZodString;
|
|
28
20
|
version: z.ZodOptional<z.ZodString>;
|
|
@@ -80,7 +72,7 @@ export declare class AdminExtensionsController {
|
|
|
80
72
|
* loads (no restart). `secretEntries` set, rename or remove single keys of a secret record a
|
|
81
73
|
* config UI hint draws per item (a path no hint names -> 400 `validation_failed`).
|
|
82
74
|
*/
|
|
83
|
-
putConfig(principal: Principal, name: string, body: z.infer<typeof
|
|
75
|
+
putConfig(principal: Principal, name: string, body: z.infer<typeof AdminExtensionConfigBody>): Promise<DeploymentConfigView>;
|
|
84
76
|
/**
|
|
85
77
|
* Clears the deployment config saved here: the stored fields and every stored secret value of
|
|
86
78
|
* the extension; audits `extension.config_cleared`. Fields from the startup config (file / Nacos
|
|
@@ -19,6 +19,7 @@ import { CurrentPrincipal, patTokenId, requireUser, SuperAdmin, } from "../ident
|
|
|
19
19
|
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
20
20
|
import { createZodDto } from "../infra/validation/create-zod-dto.js";
|
|
21
21
|
import { ZBody, ZParam } from "../infra/validation/zod-params.js";
|
|
22
|
+
import { AdminExtensionConfigBody } from "./extensions.schemas.js";
|
|
22
23
|
const ApproveSchema = z.object({
|
|
23
24
|
/** 安装记录的包(审阅时的 sha256);配置声明的插件为 null。 */
|
|
24
25
|
sha256: z
|
|
@@ -31,29 +32,6 @@ const InstallSchema = z.object({
|
|
|
31
32
|
/** 包存储里的包(上传 / npm 导入返回的 sha256)。 */
|
|
32
33
|
sha256: z.string().regex(/^[0-9a-f]{64}$/),
|
|
33
34
|
});
|
|
34
|
-
const SecretEntrySchema = z
|
|
35
|
-
.object({
|
|
36
|
-
/** A secret record field some `x-ui.secrets[].path` names. */
|
|
37
|
-
path: z.string().min(1).max(256),
|
|
38
|
-
key: z.string().min(1).max(256),
|
|
39
|
-
/** A string sets the key, `null` removes it. */
|
|
40
|
-
value: z.string().max(65_536).nullable().optional(),
|
|
41
|
-
/** Moves the value at this key to `key` first. */
|
|
42
|
-
renameFrom: z.string().min(1).max(256).optional(),
|
|
43
|
-
})
|
|
44
|
-
.strict()
|
|
45
|
-
.refine((e) => e.value !== undefined || e.renameFrom !== undefined, {
|
|
46
|
-
message: "an entry needs value or renameFrom",
|
|
47
|
-
})
|
|
48
|
-
.refine((e) => e.key !== "__proto__" && e.renameFrom !== "__proto__", {
|
|
49
|
-
message: "__proto__ is not a valid key",
|
|
50
|
-
});
|
|
51
|
-
const ConfigSchema = z.object({
|
|
52
|
-
/** 字段点路径 → 新值(`null` 清除)。 */
|
|
53
|
-
values: z.record(z.string().min(1).max(256), z.unknown()),
|
|
54
|
-
/** Single keys of hinted secret records (extension config forms spec §4.3), applied in order. */
|
|
55
|
-
secretEntries: z.array(SecretEntrySchema).max(200).optional(),
|
|
56
|
-
});
|
|
57
35
|
const NpmSchema = z.object({
|
|
58
36
|
package: z.string().min(1).max(214),
|
|
59
37
|
version: z.string().min(1).max(256).optional(),
|
|
@@ -62,7 +40,7 @@ class ExtensionApproveBody extends createZodDto(ApproveSchema, "ExtensionApprove
|
|
|
62
40
|
}
|
|
63
41
|
class ExtensionInstallBody extends createZodDto(InstallSchema, "ExtensionInstallBody") {
|
|
64
42
|
}
|
|
65
|
-
class ExtensionConfigBody extends createZodDto(
|
|
43
|
+
class ExtensionConfigBody extends createZodDto(AdminExtensionConfigBody, "ExtensionConfigBody") {
|
|
66
44
|
}
|
|
67
45
|
class ExtensionNpmImportBody extends createZodDto(NpmSchema, "ExtensionNpmImportBody") {
|
|
68
46
|
}
|
|
@@ -4,4 +4,25 @@ import type { RouteSchemas } from "../platform/route-schemas.js";
|
|
|
4
4
|
export declare const AdminExtensionNamePathParams: z.ZodObject<{
|
|
5
5
|
name: z.ZodString;
|
|
6
6
|
}, z.core.$strip>;
|
|
7
|
+
/**
|
|
8
|
+
* One key of a secret record a config UI hint draws per item (extension config forms spec §4.3).
|
|
9
|
+
* `value` is a secret (`secret()` meta): a Platform operation never takes it as a param
|
|
10
|
+
* (`platform-op-secret-param`).
|
|
11
|
+
*/
|
|
12
|
+
export declare const AdminExtensionSecretEntry: z.ZodObject<{
|
|
13
|
+
path: z.ZodString;
|
|
14
|
+
key: z.ZodString;
|
|
15
|
+
value: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
16
|
+
renameFrom: z.ZodOptional<z.ZodString>;
|
|
17
|
+
}, z.core.$strict>;
|
|
18
|
+
/** `PUT /admin/extensions/:name/config`: the deployment config fields to save. */
|
|
19
|
+
export declare const AdminExtensionConfigBody: z.ZodObject<{
|
|
20
|
+
values: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
21
|
+
secretEntries: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
22
|
+
path: z.ZodString;
|
|
23
|
+
key: z.ZodString;
|
|
24
|
+
value: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
25
|
+
renameFrom: z.ZodOptional<z.ZodString>;
|
|
26
|
+
}, z.core.$strict>>>;
|
|
27
|
+
}, z.core.$strip>;
|
|
7
28
|
export declare const ADMIN_EXTENSION_ROUTES: readonly RouteSchemas[];
|
|
@@ -1,10 +1,47 @@
|
|
|
1
|
+
import { secret } from "@capybara-hq/plugin-sdk";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
/** `:name` as the lifecycle and detail routes take it (`@Param`). */
|
|
3
4
|
export const AdminExtensionNamePathParams = z.object({ name: z.string().min(1) });
|
|
5
|
+
/**
|
|
6
|
+
* One key of a secret record a config UI hint draws per item (extension config forms spec §4.3).
|
|
7
|
+
* `value` is a secret (`secret()` meta): a Platform operation never takes it as a param
|
|
8
|
+
* (`platform-op-secret-param`).
|
|
9
|
+
*/
|
|
10
|
+
export const AdminExtensionSecretEntry = z
|
|
11
|
+
.object({
|
|
12
|
+
/** A secret record field some `x-ui.secrets[].path` names. */
|
|
13
|
+
path: z.string().min(1).max(256),
|
|
14
|
+
key: z.string().min(1).max(256),
|
|
15
|
+
/** A string sets the key, `null` removes it. */
|
|
16
|
+
value: secret(z.string().max(65_536).nullable().optional()),
|
|
17
|
+
/** Moves the value at this key to `key` first. */
|
|
18
|
+
renameFrom: z.string().min(1).max(256).optional(),
|
|
19
|
+
})
|
|
20
|
+
.strict()
|
|
21
|
+
.refine((e) => e.value !== undefined || e.renameFrom !== undefined, {
|
|
22
|
+
message: "an entry needs value or renameFrom",
|
|
23
|
+
})
|
|
24
|
+
.refine((e) => e.key !== "__proto__" && e.renameFrom !== "__proto__", {
|
|
25
|
+
message: "__proto__ is not a valid key",
|
|
26
|
+
});
|
|
27
|
+
/** `PUT /admin/extensions/:name/config`: the deployment config fields to save. */
|
|
28
|
+
export const AdminExtensionConfigBody = z.object({
|
|
29
|
+
/** Field dot path -> new value (`null` clears, omitted keeps). */
|
|
30
|
+
values: z.record(z.string().min(1).max(256), z.unknown()),
|
|
31
|
+
/** Single keys of hinted secret records (extension config forms spec §4.3), applied in order. */
|
|
32
|
+
secretEntries: z.array(AdminExtensionSecretEntry).max(200).optional(),
|
|
33
|
+
});
|
|
4
34
|
export const ADMIN_EXTENSION_ROUTES = [
|
|
5
35
|
{ route: "GET /api/v1/admin/extensions" },
|
|
6
36
|
{ route: "GET /api/v1/admin/extensions/:name", params: AdminExtensionNamePathParams },
|
|
7
37
|
{ route: "POST /api/v1/admin/extensions/:name/enable", params: AdminExtensionNamePathParams },
|
|
8
38
|
{ route: "POST /api/v1/admin/extensions/:name/disable", params: AdminExtensionNamePathParams },
|
|
9
39
|
{ route: "DELETE /api/v1/admin/extensions/:name", params: AdminExtensionNamePathParams },
|
|
40
|
+
{ route: "GET /api/v1/admin/extensions/:name/config", params: AdminExtensionNamePathParams },
|
|
41
|
+
{
|
|
42
|
+
route: "PUT /api/v1/admin/extensions/:name/config",
|
|
43
|
+
params: AdminExtensionNamePathParams,
|
|
44
|
+
body: AdminExtensionConfigBody,
|
|
45
|
+
},
|
|
46
|
+
{ route: "DELETE /api/v1/admin/extensions/:name/config", params: AdminExtensionNamePathParams },
|
|
10
47
|
];
|
|
@@ -188,7 +188,7 @@ export declare function headsToResolve(entries: readonly MarketplaceEntry[], imp
|
|
|
188
188
|
/** The host versions (an entry's `minKernel` is judged against them). */
|
|
189
189
|
export declare const HOST_VERSIONS: {
|
|
190
190
|
readonly kernel: string;
|
|
191
|
-
readonly sdk: "0.1.0-rc.
|
|
191
|
+
readonly sdk: "0.1.0-rc.42";
|
|
192
192
|
};
|
|
193
193
|
/** Whether this deployment satisfies the entry's `minKernel`. */
|
|
194
194
|
export declare const entryCompatible: (e: Pick<MarketplaceEntry, "minKernel">) => boolean;
|
|
@@ -40,7 +40,9 @@ export declare class OrgExtensionSwitch {
|
|
|
40
40
|
*/
|
|
41
41
|
put(orgId: string, actor: string, extension: string, body: OrgExtensionInput & {
|
|
42
42
|
confirm?: string | undefined;
|
|
43
|
-
}, actorTokenId?: string
|
|
43
|
+
}, actorTokenId?: string,
|
|
44
|
+
/** Merged into the audit details (a Platform operation's `via: "agent"`). */
|
|
45
|
+
auditDetail?: Record<string, unknown>): Promise<OrgExtensionPutResult>;
|
|
44
46
|
private applyAtomic;
|
|
45
47
|
private apply;
|
|
46
48
|
}
|
|
@@ -44,8 +44,11 @@ let OrgExtensionSwitch = class OrgExtensionSwitch {
|
|
|
44
44
|
* keep the direct write.
|
|
45
45
|
* - `config` is always written directly, after the switch.
|
|
46
46
|
*/
|
|
47
|
-
async put(orgId, actor, extension, body, actorTokenId
|
|
47
|
+
async put(orgId, actor, extension, body, actorTokenId,
|
|
48
|
+
/** Merged into the audit details (a Platform operation's `via: "agent"`). */
|
|
49
|
+
auditDetail) {
|
|
48
50
|
const { confirm, ...input } = body;
|
|
51
|
+
const audited = auditDetail !== undefined ? { auditDetail } : {};
|
|
49
52
|
const plan = input.enabled === undefined
|
|
50
53
|
? { kind: "direct" }
|
|
51
54
|
: await this.configs.switchPlan(extension, input.enabled);
|
|
@@ -55,7 +58,7 @@ let OrgExtensionSwitch = class OrgExtensionSwitch {
|
|
|
55
58
|
if (plan.kind === "direct") {
|
|
56
59
|
return {
|
|
57
60
|
kind: "done",
|
|
58
|
-
view: await this.configs.put(orgId, extension, input, actor, actorTokenId),
|
|
61
|
+
view: await this.configs.put(orgId, extension, input, actor, actorTokenId, audited),
|
|
59
62
|
};
|
|
60
63
|
}
|
|
61
64
|
const { enabled } = input;
|
|
@@ -79,6 +82,7 @@ let OrgExtensionSwitch = class OrgExtensionSwitch {
|
|
|
79
82
|
input,
|
|
80
83
|
confirm,
|
|
81
84
|
actorTokenId,
|
|
85
|
+
auditDetail,
|
|
82
86
|
};
|
|
83
87
|
const r = await (installing ? this.apply(args, true) : this.applyAtomic(args));
|
|
84
88
|
if (r !== "readBack")
|
|
@@ -91,6 +95,7 @@ let OrgExtensionSwitch = class OrgExtensionSwitch {
|
|
|
91
95
|
kind: "done",
|
|
92
96
|
view: await this.configs.put(orgId, extension, { enabled: true }, actor, actorTokenId, {
|
|
93
97
|
ifDisabled: { skipped: false },
|
|
98
|
+
...audited,
|
|
94
99
|
}),
|
|
95
100
|
};
|
|
96
101
|
}
|
|
@@ -98,7 +103,8 @@ let OrgExtensionSwitch = class OrgExtensionSwitch {
|
|
|
98
103
|
return this.apply(a, false);
|
|
99
104
|
}
|
|
100
105
|
async apply(a, installing) {
|
|
101
|
-
const { orgId, actor, extension, itemId, enabled, input, confirm, actorTokenId } = a;
|
|
106
|
+
const { orgId, actor, extension, itemId, enabled, input, confirm, actorTokenId, auditDetail } = a;
|
|
107
|
+
const audited = auditDetail !== undefined ? { auditDetail } : {};
|
|
102
108
|
// Switching on inside the transaction relies on the live install seen before it: one removed
|
|
103
109
|
// meanwhile would run the install saga here, which commits on its own. Refuse instead; the
|
|
104
110
|
// retry takes the install path.
|
|
@@ -111,7 +117,7 @@ let OrgExtensionSwitch = class OrgExtensionSwitch {
|
|
|
111
117
|
enabled: true,
|
|
112
118
|
...(input.config !== undefined && { inputs: { extensionConfig: input.config } }),
|
|
113
119
|
}
|
|
114
|
-
: { enabled: false, ...(confirm !== undefined && { confirm }) }, actorTokenId)
|
|
120
|
+
: { enabled: false, ...(confirm !== undefined && { confirm }) }, actorTokenId, auditDetail)
|
|
115
121
|
.catch((e) => {
|
|
116
122
|
throw configInvalidOf(e) ?? e;
|
|
117
123
|
});
|
|
@@ -126,12 +132,13 @@ let OrgExtensionSwitch = class OrgExtensionSwitch {
|
|
|
126
132
|
kind: "done",
|
|
127
133
|
view: await this.configs.put(orgId, extension, { enabled: true }, actor, actorTokenId, {
|
|
128
134
|
ifDisabled: { skipped: false },
|
|
135
|
+
...audited,
|
|
129
136
|
}),
|
|
130
137
|
};
|
|
131
138
|
}
|
|
132
139
|
return {
|
|
133
140
|
kind: "done",
|
|
134
|
-
view: await this.configs.put(orgId, extension, { config: input.config, ...(enabled && { enabled: true }) }, actor, actorTokenId, installing ? { ifDisabled: { skipped: false } } :
|
|
141
|
+
view: await this.configs.put(orgId, extension, { config: input.config, ...(enabled && { enabled: true }) }, actor, actorTokenId, installing ? { ifDisabled: { skipped: false }, ...audited } : audited),
|
|
135
142
|
};
|
|
136
143
|
}
|
|
137
144
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LocalizedName, SuggestedAppearance } from "@capybara-hq/plugin-sdk";
|
|
2
|
-
import { z } from "zod";
|
|
2
|
+
import type { z } from "zod";
|
|
3
3
|
import { type ClientBuildSummary, ClientBuilds } from "../client/client-builds.service.js";
|
|
4
4
|
import { ExtensionDisplayNames } from "../extensions/display-name.js";
|
|
5
5
|
import { OrgExtensionConfigs, type OrgExtensionView } from "../extensions/org-config.js";
|
|
@@ -10,27 +10,9 @@ import { type OrgContext } from "../orgs/org.guard.js";
|
|
|
10
10
|
import { type OrgToolSwitch, OrgToolSwitches, type OrgToolSwitchResult } from "../tools/org-tool-switches.js";
|
|
11
11
|
import { AppearanceApplyBody } from "./appearance.schemas.js";
|
|
12
12
|
import { type AppearanceResult, AppearanceService } from "./appearance.service.js";
|
|
13
|
-
import { OrgExtensionParams as ExtensionParams, OrgExtensionToolParams as ToolParams, OrgToolSwitchPut as ToolSwitchPut } from "./org-extension.schemas.js";
|
|
13
|
+
import { OrgExtensionParams as ExtensionParams, OrgOverridesPut as OverridesPut, OrgOverridesTake as OverridesTake, OrgExtensionPut as PutBody, OrgExtensionToolParams as ToolParams, OrgToolSwitchPut as ToolSwitchPut } from "./org-extension.schemas.js";
|
|
14
14
|
import { OrgExtensionSwitch } from "./org-extension-switch.js";
|
|
15
15
|
import type { UninstallPreview } from "./plugin-install.js";
|
|
16
|
-
declare const PutBody: z.ZodObject<{
|
|
17
|
-
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
-
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
19
|
-
force: z.ZodOptional<z.ZodBoolean>;
|
|
20
|
-
confirm: z.ZodOptional<z.ZodString>;
|
|
21
|
-
}, z.core.$strict>;
|
|
22
|
-
declare const OverridesPut: z.ZodObject<{
|
|
23
|
-
values: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
24
|
-
secretEntries: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
25
|
-
path: z.ZodString;
|
|
26
|
-
key: z.ZodString;
|
|
27
|
-
value: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
28
|
-
renameFrom: z.ZodOptional<z.ZodString>;
|
|
29
|
-
}, z.core.$strict>>>;
|
|
30
|
-
}, z.core.$strict>;
|
|
31
|
-
declare const OverridesTake: z.ZodObject<{
|
|
32
|
-
paths: z.ZodArray<z.ZodString>;
|
|
33
|
-
}, z.core.$strict>;
|
|
34
16
|
/**
|
|
35
17
|
* One extension of the org list: the org view plus the plugin's display name, the URL of its
|
|
36
18
|
* plugin's icon on the org's catalog route (null without one or when the org may not see the
|
|
@@ -130,4 +112,3 @@ export declare class OrgExtensionToolSwitchesController {
|
|
|
130
112
|
*/
|
|
131
113
|
set(principal: Principal, org: OrgContext, { extension, tool }: z.infer<typeof ToolParams>, body: z.infer<typeof ToolSwitchPut>): Promise<OrgToolSwitchResult>;
|
|
132
114
|
}
|
|
133
|
-
export {};
|
|
@@ -8,7 +8,6 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
8
8
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
9
|
};
|
|
10
10
|
import { Controller, Delete, Get, HttpCode, Inject, Param, Post, Put } from "@nestjs/common";
|
|
11
|
-
import { z } from "zod";
|
|
12
11
|
import { ClientBuilds } from "../client/client-builds.service.js";
|
|
13
12
|
import { ExtensionDisplayNames } from "../extensions/display-name.js";
|
|
14
13
|
import { OrgExtensionConfigs, providesOf, } from "../extensions/org-config.js";
|
|
@@ -22,46 +21,10 @@ import { roleAtLeast } from "../orgs/roles.js";
|
|
|
22
21
|
import { OrgToolSwitches, } from "../tools/org-tool-switches.js";
|
|
23
22
|
import { AppearanceApplyBody } from "./appearance.schemas.js";
|
|
24
23
|
import { AppearanceService } from "./appearance.service.js";
|
|
25
|
-
import { OrgExtensionParams as ExtensionParams, OrgExtensionToolParams as ToolParams, OrgToolSwitchPut as ToolSwitchPut, } from "./org-extension.schemas.js";
|
|
24
|
+
import { OrgExtensionParams as ExtensionParams, OrgOverridesPut as OverridesPut, OrgOverridesTake as OverridesTake, OrgExtensionPut as PutBody, OrgExtensionToolParams as ToolParams, OrgToolSwitchPut as ToolSwitchPut, } from "./org-extension.schemas.js";
|
|
26
25
|
import { OrgExtensionSwitch } from "./org-extension-switch.js";
|
|
27
|
-
const PutBody = z
|
|
28
|
-
.object({
|
|
29
|
-
enabled: z.boolean().optional(),
|
|
30
|
-
config: z.record(z.string(), z.unknown()).optional(),
|
|
31
|
-
force: z.boolean().optional(),
|
|
32
|
-
/** The hash of the plugin uninstall preview, to confirm switching the extension's plugin off. */
|
|
33
|
-
confirm: z.string().optional(),
|
|
34
|
-
})
|
|
35
|
-
.strict();
|
|
36
26
|
class OrgExtensionPutBody extends createZodDto(PutBody, "OrgExtensionPutBody") {
|
|
37
27
|
}
|
|
38
|
-
const OverrideSecretEntry = z
|
|
39
|
-
.object({
|
|
40
|
-
/** A secret record field of the copy some `x-ui.secrets[].path` names. */
|
|
41
|
-
path: z.string().min(1).max(256),
|
|
42
|
-
key: z.string().min(1).max(256),
|
|
43
|
-
/** A string sets the key, `null` removes it. */
|
|
44
|
-
value: z.string().max(65_536).nullable().optional(),
|
|
45
|
-
/** Moves the value at this key to `key` first. */
|
|
46
|
-
renameFrom: z.string().min(1).max(256).optional(),
|
|
47
|
-
})
|
|
48
|
-
.strict()
|
|
49
|
-
.refine((e) => e.value !== undefined || e.renameFrom !== undefined, {
|
|
50
|
-
message: "an entry needs value or renameFrom",
|
|
51
|
-
})
|
|
52
|
-
.refine((e) => e.key !== "__proto__" && e.renameFrom !== "__proto__", {
|
|
53
|
-
message: "__proto__ is not a valid key",
|
|
54
|
-
});
|
|
55
|
-
const OverridesPut = z
|
|
56
|
-
.object({
|
|
57
|
-
/** Overridable field dot path -> new value (`null` clears); secret fields too. */
|
|
58
|
-
values: z.record(z.string().min(1).max(256), z.unknown()),
|
|
59
|
-
secretEntries: z.array(OverrideSecretEntry).max(200).optional(),
|
|
60
|
-
})
|
|
61
|
-
.strict();
|
|
62
|
-
const OverridesTake = z
|
|
63
|
-
.object({ paths: z.array(z.string().min(1).max(256)).min(1).max(200) })
|
|
64
|
-
.strict();
|
|
65
28
|
class OrgToolSwitchPutBody extends createZodDto(ToolSwitchPut, "OrgToolSwitchPutBody") {
|
|
66
29
|
}
|
|
67
30
|
class OrgExtensionParamsDto extends createZodDto(ExtensionParams, "OrgExtensionParams") {
|
|
@@ -12,4 +12,35 @@ export declare const OrgToolSwitchPut: z.ZodObject<{
|
|
|
12
12
|
enabled: z.ZodBoolean;
|
|
13
13
|
confirm: z.ZodOptional<z.ZodString>;
|
|
14
14
|
}, z.core.$strict>;
|
|
15
|
+
/** `PUT /orgs/:orgId/extensions/:extension`: enablement and / or the org config. */
|
|
16
|
+
export declare const OrgExtensionPut: z.ZodObject<{
|
|
17
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
19
|
+
force: z.ZodOptional<z.ZodBoolean>;
|
|
20
|
+
confirm: z.ZodOptional<z.ZodString>;
|
|
21
|
+
}, z.core.$strict>;
|
|
22
|
+
/**
|
|
23
|
+
* One key of a secret record of the org's copy. `value` is a secret (`secret()` meta): a Platform
|
|
24
|
+
* operation never takes it as a param (`platform-op-secret-param`).
|
|
25
|
+
*/
|
|
26
|
+
export declare const OrgOverrideSecretEntry: z.ZodObject<{
|
|
27
|
+
path: z.ZodString;
|
|
28
|
+
key: z.ZodString;
|
|
29
|
+
value: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
30
|
+
renameFrom: z.ZodOptional<z.ZodString>;
|
|
31
|
+
}, z.core.$strict>;
|
|
32
|
+
/** `PUT …/overrides`: overridable fields of the org's copy. */
|
|
33
|
+
export declare const OrgOverridesPut: z.ZodObject<{
|
|
34
|
+
values: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
35
|
+
secretEntries: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
36
|
+
path: z.ZodString;
|
|
37
|
+
key: z.ZodString;
|
|
38
|
+
value: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
39
|
+
renameFrom: z.ZodOptional<z.ZodString>;
|
|
40
|
+
}, z.core.$strict>>>;
|
|
41
|
+
}, z.core.$strict>;
|
|
42
|
+
/** `POST …/overrides/take`: the non-secret fields to take from the platform. */
|
|
43
|
+
export declare const OrgOverridesTake: z.ZodObject<{
|
|
44
|
+
paths: z.ZodArray<z.ZodString>;
|
|
45
|
+
}, z.core.$strict>;
|
|
15
46
|
export declare const ORG_EXTENSION_ROUTES: readonly RouteSchemas[];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { secret } from "@capybara-hq/plugin-sdk";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
/** Route parameters of the overrides and tool switch routes (decision R20). */
|
|
3
4
|
export const OrgExtensionParams = z.object({ extension: z.string().min(1).max(64) });
|
|
@@ -11,6 +12,50 @@ export const OrgToolSwitchPut = z
|
|
|
11
12
|
confirm: z.string().min(1).max(128).optional(),
|
|
12
13
|
})
|
|
13
14
|
.strict();
|
|
15
|
+
/** `PUT /orgs/:orgId/extensions/:extension`: enablement and / or the org config. */
|
|
16
|
+
export const OrgExtensionPut = z
|
|
17
|
+
.object({
|
|
18
|
+
enabled: z.boolean().optional(),
|
|
19
|
+
/** The whole org config: secret fields omitted keep, `null` clears, a value sets. */
|
|
20
|
+
config: z.record(z.string(), z.unknown()).optional(),
|
|
21
|
+
force: z.boolean().optional(),
|
|
22
|
+
/** The hash of the plugin uninstall preview, to confirm switching the extension's plugin off. */
|
|
23
|
+
confirm: z.string().optional(),
|
|
24
|
+
})
|
|
25
|
+
.strict();
|
|
26
|
+
/**
|
|
27
|
+
* One key of a secret record of the org's copy. `value` is a secret (`secret()` meta): a Platform
|
|
28
|
+
* operation never takes it as a param (`platform-op-secret-param`).
|
|
29
|
+
*/
|
|
30
|
+
export const OrgOverrideSecretEntry = z
|
|
31
|
+
.object({
|
|
32
|
+
/** A secret record field of the copy some `x-ui.secrets[].path` names. */
|
|
33
|
+
path: z.string().min(1).max(256),
|
|
34
|
+
key: z.string().min(1).max(256),
|
|
35
|
+
/** A string sets the key, `null` removes it. */
|
|
36
|
+
value: secret(z.string().max(65_536).nullable().optional()),
|
|
37
|
+
/** Moves the value at this key to `key` first. */
|
|
38
|
+
renameFrom: z.string().min(1).max(256).optional(),
|
|
39
|
+
})
|
|
40
|
+
.strict()
|
|
41
|
+
.refine((e) => e.value !== undefined || e.renameFrom !== undefined, {
|
|
42
|
+
message: "an entry needs value or renameFrom",
|
|
43
|
+
})
|
|
44
|
+
.refine((e) => e.key !== "__proto__" && e.renameFrom !== "__proto__", {
|
|
45
|
+
message: "__proto__ is not a valid key",
|
|
46
|
+
});
|
|
47
|
+
/** `PUT …/overrides`: overridable fields of the org's copy. */
|
|
48
|
+
export const OrgOverridesPut = z
|
|
49
|
+
.object({
|
|
50
|
+
/** Overridable field dot path -> new value (`null` clears); secret fields too. */
|
|
51
|
+
values: z.record(z.string().min(1).max(256), z.unknown()),
|
|
52
|
+
secretEntries: z.array(OrgOverrideSecretEntry).max(200).optional(),
|
|
53
|
+
})
|
|
54
|
+
.strict();
|
|
55
|
+
/** `POST …/overrides/take`: the non-secret fields to take from the platform. */
|
|
56
|
+
export const OrgOverridesTake = z
|
|
57
|
+
.object({ paths: z.array(z.string().min(1).max(256)).min(1).max(200) })
|
|
58
|
+
.strict();
|
|
14
59
|
export const ORG_EXTENSION_ROUTES = [
|
|
15
60
|
{ route: "GET /api/v1/orgs/:orgId/extensions" },
|
|
16
61
|
{ route: "GET /api/v1/orgs/:orgId/extensions/:extension/tools", params: OrgExtensionParams },
|
|
@@ -19,4 +64,24 @@ export const ORG_EXTENSION_ROUTES = [
|
|
|
19
64
|
params: OrgExtensionToolParams,
|
|
20
65
|
body: OrgToolSwitchPut,
|
|
21
66
|
},
|
|
67
|
+
{
|
|
68
|
+
route: "PUT /api/v1/orgs/:orgId/extensions/:extension",
|
|
69
|
+
params: OrgExtensionParams,
|
|
70
|
+
body: OrgExtensionPut,
|
|
71
|
+
},
|
|
72
|
+
{ route: "GET /api/v1/orgs/:orgId/extensions/:extension/overrides", params: OrgExtensionParams },
|
|
73
|
+
{
|
|
74
|
+
route: "PUT /api/v1/orgs/:orgId/extensions/:extension/overrides",
|
|
75
|
+
params: OrgExtensionParams,
|
|
76
|
+
body: OrgOverridesPut,
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
route: "DELETE /api/v1/orgs/:orgId/extensions/:extension/overrides",
|
|
80
|
+
params: OrgExtensionParams,
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
route: "POST /api/v1/orgs/:orgId/extensions/:extension/overrides/take",
|
|
84
|
+
params: OrgExtensionParams,
|
|
85
|
+
body: OrgOverridesTake,
|
|
86
|
+
},
|
|
22
87
|
];
|
package/dist/channels/actions.js
CHANGED
|
@@ -14,6 +14,8 @@ const REPLY_FOR = {
|
|
|
14
14
|
"approval.scope_not_allowed": "invalidAction",
|
|
15
15
|
// a network ask clicked by someone other than the device's owner
|
|
16
16
|
"approval.not_yours": "cannotHandle",
|
|
17
|
+
// an approval with person fields is approved only on the web (platform web parity spec R5)
|
|
18
|
+
"auth.session_required": "cannotHandle",
|
|
17
19
|
};
|
|
18
20
|
/**
|
|
19
21
|
* IM 卡片上的按钮操作(Review Focus 2):点击者按入站同样的规则映射到账号(未绑定 → 私聊回绑定卡片、群里只提示去私聊),
|
package/dist/channels/cards.d.ts
CHANGED
|
@@ -81,6 +81,14 @@ export declare function commandCardText(detail: Pick<CommandAskDetail, "kind" |
|
|
|
81
81
|
escalation?: PermissionEscalation;
|
|
82
82
|
workingRoot?: string;
|
|
83
83
|
}, scopes: readonly string[], locale: ChannelLocale, redact?: (s: string) => string): NetworkCardText;
|
|
84
|
+
/**
|
|
85
|
+
* The `bind` card of an approval whose Platform call needs the person to type secrets: the values
|
|
86
|
+
* pass only through the web, never an IM vendor, so IM gets a link to the conversation instead of
|
|
87
|
+
* an approval card. Undefined when the approval does not exist or has no person fields.
|
|
88
|
+
*/
|
|
89
|
+
export declare function personFieldsCard(d: CardDeps, approvalId: string, base: string, locale: ChannelLocale): Promise<Extract<ChannelCard, {
|
|
90
|
+
kind: "bind";
|
|
91
|
+
}> | undefined>;
|
|
84
92
|
/**
|
|
85
93
|
* The approval card in the approval's current state; undefined when the approval does not exist.
|
|
86
94
|
* A role escalation offers only "once". A network ask names its hosts and command and labels its
|
package/dist/channels/cards.js
CHANGED
|
@@ -270,6 +270,24 @@ export function commandCardText(detail, scopes, locale, redact = (s) => s) {
|
|
|
270
270
|
},
|
|
271
271
|
};
|
|
272
272
|
}
|
|
273
|
+
/**
|
|
274
|
+
* The `bind` card of an approval whose Platform call needs the person to type secrets: the values
|
|
275
|
+
* pass only through the web, never an IM vendor, so IM gets a link to the conversation instead of
|
|
276
|
+
* an approval card. Undefined when the approval does not exist or has no person fields.
|
|
277
|
+
*/
|
|
278
|
+
export async function personFieldsCard(d, approvalId, base, locale) {
|
|
279
|
+
const v = await d.approvals.describe(approvalId);
|
|
280
|
+
const n = v?.personFields?.length ?? 0;
|
|
281
|
+
if (!v || n === 0)
|
|
282
|
+
return undefined;
|
|
283
|
+
return {
|
|
284
|
+
kind: "bind",
|
|
285
|
+
text: n === 1
|
|
286
|
+
? phrase("personFieldOnWeb", locale)
|
|
287
|
+
: phrase("personFieldsOnWeb", locale).replace("{count}", String(n)),
|
|
288
|
+
url: `${base}${v.conversationPath}`,
|
|
289
|
+
};
|
|
290
|
+
}
|
|
273
291
|
/**
|
|
274
292
|
* The approval card in the approval's current state; undefined when the approval does not exist.
|
|
275
293
|
* A role escalation offers only "once". A network ask names its hosts and command and labels its
|
|
@@ -26,7 +26,7 @@ import { StorageService } from "../storage/storage.service.js";
|
|
|
26
26
|
import { ApprovalsService } from "../tools/approvals.service.js";
|
|
27
27
|
import { QuestionsService } from "../tools/questions.service.js";
|
|
28
28
|
import { ToolRegistry } from "../tools/registry.js";
|
|
29
|
-
import { approvalCard, cardMessage, connectUrl, conversationUrl, questionCard, webBase, } from "./cards.js";
|
|
29
|
+
import { approvalCard, cardMessage, connectUrl, conversationUrl, personFieldsCard, questionCard, webBase, } from "./cards.js";
|
|
30
30
|
import { ChannelConnections, FILE_CALL_TIMEOUT_MS, } from "./connections.service.js";
|
|
31
31
|
import { FileSlots, fileKind, fileLinkText, fileRootText, planFileDelivery, pluginFileName, readArtifactCapped, } from "./file-delivery.js";
|
|
32
32
|
import { ChannelInbound } from "./inbound.js";
|
|
@@ -1009,6 +1009,13 @@ class Delivery {
|
|
|
1009
1009
|
await this.send({ text: phrase("handleOnWeb", this.locale) }, this.key(seq));
|
|
1010
1010
|
return this.advance(seq);
|
|
1011
1011
|
}
|
|
1012
|
+
// secrets are typed on the web only: IM gets a link, never an approval card (no card is
|
|
1013
|
+
// recorded, so `approval_decided` has nothing to update)
|
|
1014
|
+
const bind = await personFieldsCard(this.d, approvalId, this.base, this.locale);
|
|
1015
|
+
if (bind) {
|
|
1016
|
+
await this.send(cardMessage(bind.text, bind), this.key(seq));
|
|
1017
|
+
return this.advance(seq);
|
|
1018
|
+
}
|
|
1012
1019
|
const card = await approvalCard(this.d, approvalId, this.base, this.locale, this.s.redact);
|
|
1013
1020
|
if (!card)
|
|
1014
1021
|
return;
|
|
@@ -207,6 +207,16 @@ export declare const CHANNEL_PHRASES: {
|
|
|
207
207
|
readonly zh: "需要先完成连接器授权";
|
|
208
208
|
readonly en: "A connector needs to be connected first";
|
|
209
209
|
};
|
|
210
|
+
/** A person-field approval (secrets typed on the web) with one field: the bind card's text. */
|
|
211
|
+
readonly personFieldOnWeb: {
|
|
212
|
+
readonly zh: "需要在网页填写 1 项";
|
|
213
|
+
readonly en: "1 field to fill in on the web";
|
|
214
|
+
};
|
|
215
|
+
/** A person-field approval with several fields: the bind card's text; `{count}` fields. */
|
|
216
|
+
readonly personFieldsOnWeb: {
|
|
217
|
+
readonly zh: "需要在网页填写 {count} 项";
|
|
218
|
+
readonly en: "{count} fields to fill in on the web";
|
|
219
|
+
};
|
|
210
220
|
/** 部署未配置 http.publicUrl,无法给出网页链接与卡片时的退回文本。 */
|
|
211
221
|
readonly handleOnWeb: {
|
|
212
222
|
readonly zh: "有一条请求需要你到 Capybara 网页上处理。";
|
package/dist/channels/phrases.js
CHANGED
|
@@ -169,6 +169,16 @@ export const CHANNEL_PHRASES = {
|
|
|
169
169
|
questionTitle: { zh: "需要你的回答", en: "Your input is needed" },
|
|
170
170
|
/** 连接卡片的随附文本。 */
|
|
171
171
|
connectTitle: { zh: "需要先完成连接器授权", en: "A connector needs to be connected first" },
|
|
172
|
+
/** A person-field approval (secrets typed on the web) with one field: the bind card's text. */
|
|
173
|
+
personFieldOnWeb: {
|
|
174
|
+
zh: "需要在网页填写 1 项",
|
|
175
|
+
en: "1 field to fill in on the web",
|
|
176
|
+
},
|
|
177
|
+
/** A person-field approval with several fields: the bind card's text; `{count}` fields. */
|
|
178
|
+
personFieldsOnWeb: {
|
|
179
|
+
zh: "需要在网页填写 {count} 项",
|
|
180
|
+
en: "{count} fields to fill in on the web",
|
|
181
|
+
},
|
|
172
182
|
/** 部署未配置 http.publicUrl,无法给出网页链接与卡片时的退回文本。 */
|
|
173
183
|
handleOnWeb: {
|
|
174
184
|
zh: "有一条请求需要你到 Capybara 网页上处理。",
|
|
@@ -23,6 +23,7 @@ import { ConversationsService } from "./conversations.service.js";
|
|
|
23
23
|
import { ConversationDeviceStatus } from "./device-status.js";
|
|
24
24
|
import { EventLogModule } from "./event-log.js";
|
|
25
25
|
import { ConversationFiles } from "./files.js";
|
|
26
|
+
import { ConversationLeakCheckModule } from "./leak-check.js";
|
|
26
27
|
import { ConversationOutputs } from "./outputs-read.js";
|
|
27
28
|
import { PermissionProfileStoreModule } from "./permission-profile-store.module.js";
|
|
28
29
|
import { PermissionProfilesService } from "./permission-profiles.service.js";
|
|
@@ -56,6 +57,8 @@ ConversationsModule = __decorate([
|
|
|
56
57
|
DevicesModule,
|
|
57
58
|
// the stop of a deleted conversation's background tasks
|
|
58
59
|
BackgroundModule,
|
|
60
|
+
// the leak check of a person's card values (its own module: the tools module uses it too)
|
|
61
|
+
ConversationLeakCheckModule,
|
|
59
62
|
],
|
|
60
63
|
providers: [
|
|
61
64
|
PermissionProfilesService,
|
|
@@ -78,6 +81,7 @@ ConversationsModule = __decorate([
|
|
|
78
81
|
ConversationArtifacts,
|
|
79
82
|
ConversationFiles,
|
|
80
83
|
ConversationDeviceStatus,
|
|
84
|
+
ConversationLeakCheckModule,
|
|
81
85
|
],
|
|
82
86
|
})
|
|
83
87
|
], ConversationsModule);
|
|
@@ -1531,6 +1531,7 @@ export declare const ConversationEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
1531
1531
|
}>>;
|
|
1532
1532
|
byAccountId: z.ZodNullable<z.ZodString>;
|
|
1533
1533
|
reason: z.ZodOptional<z.ZodString>;
|
|
1534
|
+
inputsProvided: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1534
1535
|
}, z.core.$strip>;
|
|
1535
1536
|
}, z.core.$strip>, z.ZodObject<{
|
|
1536
1537
|
type: z.ZodLiteral<"approval_updated">;
|
|
@@ -1278,6 +1278,11 @@ export const ConversationEventSchema = z.discriminatedUnion("type", [
|
|
|
1278
1278
|
* denied call's `tool_result`).
|
|
1279
1279
|
*/
|
|
1280
1280
|
reason: z.string().max(APPROVAL_DENY_REASON_MAX_CHARS).optional(),
|
|
1281
|
+
/**
|
|
1282
|
+
* The person field paths whose values the person entered with the approval (platform web
|
|
1283
|
+
* parity spec §4.3; display only, never a value).
|
|
1284
|
+
*/
|
|
1285
|
+
inputsProvided: z.array(z.string().max(200)).max(32).optional(),
|
|
1281
1286
|
})),
|
|
1282
1287
|
/**
|
|
1283
1288
|
* A still-pending approval changed without a decision: a network ask's "always allow on this
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
2
|
+
/** Values shorter than this are never matched: a short value would match ordinary text. */
|
|
3
|
+
export declare const LEAK_CHECK_MIN_LENGTH = 8;
|
|
4
|
+
/**
|
|
5
|
+
* Whether a value a person is about to seal (an approval card's secret field) already appeared in
|
|
6
|
+
* the conversation. The event payloads are searched in PG (`strpos` over the payload's JSON text,
|
|
7
|
+
* for the root conversation and every sub-agent below it, every event type), so the value is a
|
|
8
|
+
* bind parameter and never leaves the database; it is never logged.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ConversationLeakCheck {
|
|
11
|
+
private readonly db;
|
|
12
|
+
constructor(db: KernelDb);
|
|
13
|
+
/**
|
|
14
|
+
* The keys of `values` (value paths) whose value, 8 characters or more, appears in the event
|
|
15
|
+
* log of `conversationId`'s root conversation tree. Runs inside the caller's transaction when
|
|
16
|
+
* there is one.
|
|
17
|
+
*/
|
|
18
|
+
leaked(conversationId: string, values: Readonly<Record<string, string>>): Promise<string[]>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The one {@link ConversationLeakCheck} (the database only), its own module so the tools module
|
|
22
|
+
* (the approval decision) imports it without importing the conversations module, which imports
|
|
23
|
+
* the tools module.
|
|
24
|
+
*/
|
|
25
|
+
export declare class ConversationLeakCheckModule {
|
|
26
|
+
}
|