@vibes.diy/vibe-runtime 14.3.358 → 14.3.360
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/backend-executor.d.ts +2 -0
- package/backend-tools.d.ts +1 -0
- package/backend-worker-loader-executor.js +5 -1
- package/notify-path.d.ts +1 -0
- package/notify-path.js +1 -0
- package/package.json +4 -4
- package/parse-backend-config.js +39 -3
package/backend-executor.d.ts
CHANGED
|
@@ -90,7 +90,9 @@ export interface BackendNotifyOp {
|
|
|
90
90
|
readonly dedupeKey: string;
|
|
91
91
|
readonly path?: string;
|
|
92
92
|
readonly picture?: BackendNotifyPictureRef;
|
|
93
|
+
readonly consent?: BackendNotifyConsent;
|
|
93
94
|
}
|
|
95
|
+
export type BackendNotifyConsent = "text-later";
|
|
94
96
|
export type BackendNotifyPictureRef = string | {
|
|
95
97
|
readonly dbName: string;
|
|
96
98
|
readonly docId: string;
|
package/backend-tools.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { TxtEnDecoderSingleton } from "@adviser/cement";
|
|
|
2
2
|
import { transformBackendSource } from "./transform-backend-source.js";
|
|
3
3
|
import { loadBackendIsolateDeps } from "./backend-isolate-deps.js";
|
|
4
4
|
import { MAX_TOOL_RESULT_CHARS } from "./backend-tools.js";
|
|
5
|
-
import { isValidNotifyPath, NOTIFY_PATH_ERROR, NOTIFY_PICTURE_SHAPE_ERROR } from "./notify-path.js";
|
|
5
|
+
import { isValidNotifyPath, NOTIFY_CONSENT_ERROR, NOTIFY_PATH_ERROR, NOTIFY_PICTURE_SHAPE_ERROR } from "./notify-path.js";
|
|
6
6
|
const MAIN_MODULE = "main.js";
|
|
7
7
|
const BACKEND_MODULE = "backend.js";
|
|
8
8
|
const LOG_BODY_MAX_CHARS = 4096;
|
|
@@ -42,6 +42,10 @@ export const BACKEND_NOTIFY_SHIM = [
|
|
|
42
42
|
` if (!ok) throw new Error(${JSON.stringify(NOTIFY_PICTURE_SHAPE_ERROR)});`,
|
|
43
43
|
` sent.picture = typeof p === "string" ? p : p.fileKey === undefined ? { dbName: p.dbName, docId: p.docId } : { dbName: p.dbName, docId: p.docId, fileKey: p.fileKey };`,
|
|
44
44
|
` }`,
|
|
45
|
+
` if (op.consent !== undefined) {`,
|
|
46
|
+
` if (op.consent !== "text-later") throw new Error(${JSON.stringify(NOTIFY_CONSENT_ERROR)});`,
|
|
47
|
+
` sent.consent = op.consent;`,
|
|
48
|
+
` }`,
|
|
45
49
|
` const r = await fetch(${JSON.stringify(BACKEND_NOTIFY_OP_URL)}, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ nonce: notifyNonce, op: sent }) });`,
|
|
46
50
|
` const out = await r.json();`,
|
|
47
51
|
` if (out === undefined || out === null || out.ok !== true) throw new Error((out && out.error) || "ctx.notify failed");`,
|
package/notify-path.d.ts
CHANGED
|
@@ -2,3 +2,4 @@ export declare const NOTIFY_PATH_MAX_CHARS = 200;
|
|
|
2
2
|
export declare const NOTIFY_PATH_ERROR = "ctx.notify path must start with \"#\", be at most 200 characters, and contain no whitespace or control characters";
|
|
3
3
|
export declare function isValidNotifyPath(path: unknown): path is string;
|
|
4
4
|
export declare const NOTIFY_PICTURE_SHAPE_ERROR = "ctx.notify picture must be a record of this app ({ dbName, docId, fileKey? }) or one of its _files urls";
|
|
5
|
+
export declare const NOTIFY_CONSENT_ERROR = "ctx.notify: consent must be \"text-later\" when given";
|
package/notify-path.js
CHANGED
|
@@ -10,3 +10,4 @@ export function isValidNotifyPath(path) {
|
|
|
10
10
|
return !/[\s\u0000-\u001f\u007f-\u009f]/.test(path);
|
|
11
11
|
}
|
|
12
12
|
export const NOTIFY_PICTURE_SHAPE_ERROR = "ctx.notify picture must be a record of this app ({ dbName, docId, fileKey? }) or one of its _files urls";
|
|
13
|
+
export const NOTIFY_CONSENT_ERROR = 'ctx.notify: consent must be "text-later" when given';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibes.diy/vibe-runtime",
|
|
3
|
-
"version": "14.3.
|
|
3
|
+
"version": "14.3.360",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@adviser/cement": "~0.5.37",
|
|
39
|
-
"@vibes.diy/api-types": "14.3.
|
|
40
|
-
"@vibes.diy/base": "14.3.
|
|
41
|
-
"@vibes.diy/vibe-types": "14.3.
|
|
39
|
+
"@vibes.diy/api-types": "14.3.360",
|
|
40
|
+
"@vibes.diy/base": "14.3.360",
|
|
41
|
+
"@vibes.diy/vibe-types": "14.3.360",
|
|
42
42
|
"arktype": "~2.2.9",
|
|
43
43
|
"charwise": "~3.0.1",
|
|
44
44
|
"es-module-lexer": "~3.0.4",
|
package/parse-backend-config.js
CHANGED
|
@@ -925,9 +925,23 @@ function githubPermissionsAt(githubObj, key) {
|
|
|
925
925
|
}
|
|
926
926
|
const TOOLS_LANE = {
|
|
927
927
|
subject: "tools",
|
|
928
|
-
shadowable: [
|
|
928
|
+
shadowable: [
|
|
929
|
+
"description",
|
|
930
|
+
"for",
|
|
931
|
+
"input",
|
|
932
|
+
"handler",
|
|
933
|
+
"write",
|
|
934
|
+
"offer",
|
|
935
|
+
"textsLater",
|
|
936
|
+
"db",
|
|
937
|
+
"set",
|
|
938
|
+
"key",
|
|
939
|
+
"type",
|
|
940
|
+
"optional",
|
|
941
|
+
"enum",
|
|
942
|
+
],
|
|
929
943
|
};
|
|
930
|
-
const TOOL_KEYS = ["description", "for", "input", "handler", "write", "offer"];
|
|
944
|
+
const TOOL_KEYS = ["description", "for", "input", "handler", "write", "offer", "textsLater"];
|
|
931
945
|
const TOOL_FIELD_KEYS = ["type", "description", "optional", "enum"];
|
|
932
946
|
const TOOL_WRITE_KEYS = ["db", "set", "key"];
|
|
933
947
|
const TOOLS_SHAPE = 'tools must be `export const tools = { vote: { description: "…", input: { choice: "string" }, handler(input, ctx) { … } } }` with static literals';
|
|
@@ -1235,9 +1249,31 @@ function extractTool(tools, key) {
|
|
|
1235
1249
|
else
|
|
1236
1250
|
offer = v;
|
|
1237
1251
|
}
|
|
1252
|
+
let textsLater = false;
|
|
1253
|
+
if (keys.keys.has("textsLater")) {
|
|
1254
|
+
const start = keys.keys.get("textsLater")?.valueStart;
|
|
1255
|
+
const v = start === undefined ? undefined : literalValue(valueTextAt(tool, start));
|
|
1256
|
+
if (typeof v !== "boolean")
|
|
1257
|
+
errors.push(`${TOOLS_SHAPE} — ${where}.textsLater must be true or false`);
|
|
1258
|
+
else if (v && !offer)
|
|
1259
|
+
errors.push(`${TOOLS_SHAPE} — ${where}.textsLater goes with offer: true, on the one tool the agent offers`);
|
|
1260
|
+
else
|
|
1261
|
+
textsLater = v;
|
|
1262
|
+
}
|
|
1238
1263
|
if (errors.length > 0 || description === undefined || run === undefined)
|
|
1239
1264
|
return { errors };
|
|
1240
|
-
return {
|
|
1265
|
+
return {
|
|
1266
|
+
value: {
|
|
1267
|
+
name,
|
|
1268
|
+
description,
|
|
1269
|
+
for: audience,
|
|
1270
|
+
input,
|
|
1271
|
+
run,
|
|
1272
|
+
...(offer ? { offer: true } : {}),
|
|
1273
|
+
...(textsLater ? { textsLater: true } : {}),
|
|
1274
|
+
},
|
|
1275
|
+
errors,
|
|
1276
|
+
};
|
|
1241
1277
|
}
|
|
1242
1278
|
function extractTools(src) {
|
|
1243
1279
|
if (exportsName(src.code, "tools") === false)
|