@cognolo/runtime 0.4.3 → 0.4.4
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/cloud.d.ts +6 -1
- package/dist/cloud.js +9 -1
- package/dist/route.js +17 -4
- package/dist/version.d.ts +1 -1
- package/dist/version.js +7 -1
- package/package.json +1 -1
package/dist/cloud.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export interface CloudOptions {
|
|
|
19
19
|
commit?: string;
|
|
20
20
|
/** The customer organisation shown in the badge, if the host knows it. */
|
|
21
21
|
tenant?: string | (() => string | undefined);
|
|
22
|
-
/** How many tools this app has, reported on the heartbeat. */
|
|
22
|
+
/** How many tools this app has, reported on the heartbeat. `cognoloRoute` reports the list itself (`reportTools`). */
|
|
23
23
|
toolCount?: number;
|
|
24
24
|
/** How old the rules may be before the next use checks for new ones. Default 30 seconds. */
|
|
25
25
|
intervalMs?: number;
|
|
@@ -271,6 +271,11 @@ export interface CognoloCloud<C = unknown> {
|
|
|
271
271
|
reportCredit(state: "shown" | "hidden"): void;
|
|
272
272
|
/** Whether the AI provider accepted the model key on the last call (`refused`: it turned it down). Told to the cloud with the next heartbeat (soon, if it changed). Never the key. */
|
|
273
273
|
reportModelKey?(state: "ok" | "refused"): void;
|
|
274
|
+
/** The tools this app has, by name and risk, for the owner's Tools page. Display only: the cloud decides nothing from it. */
|
|
275
|
+
reportTools?(tools: {
|
|
276
|
+
name: string;
|
|
277
|
+
risk: string;
|
|
278
|
+
}[]): void;
|
|
274
279
|
/**
|
|
275
280
|
* Check for rules once now, then send a heartbeat every `heartbeatMs` (and any waiting events), so the dashboard knows
|
|
276
281
|
* the app is alive. It never checks for rules on a timer: use does that. Does not keep the process alive. A server
|
package/dist/cloud.js
CHANGED
|
@@ -43,6 +43,7 @@ export function cognoloCloud(o) {
|
|
|
43
43
|
let modelKey = null;
|
|
44
44
|
let modelChoice = null;
|
|
45
45
|
let passkeys = null;
|
|
46
|
+
let toolList = null;
|
|
46
47
|
const unnamedReads = new Set();
|
|
47
48
|
let unnamedSeen = false;
|
|
48
49
|
const locked = o.lockLook === true ? LOOK_FIELDS : LOOK_FIELDS.filter((f) => o.lockLook?.includes(f));
|
|
@@ -93,7 +94,7 @@ export function cognoloCloud(o) {
|
|
|
93
94
|
await call("/v1/runtime/heartbeat", {
|
|
94
95
|
method: "POST",
|
|
95
96
|
headers: { "content-type": "application/json" },
|
|
96
|
-
body: JSON.stringify({ env: o.env, commit: deployedCommit(o.commit), version: RUNTIME_VERSION, rulesVersion: bundle?.version ?? null, tools: o.toolCount ?? null, tenant: tenant ?? null, credit, lookLocked: locked, layouts, modelKey, modelChoice, ...(passkeys ? { passkeys } : {}), ...(unnamedSeen ? { outsideUnnamed: [...unnamedReads].sort() } : {}) }),
|
|
97
|
+
body: JSON.stringify({ env: o.env, commit: deployedCommit(o.commit), version: RUNTIME_VERSION, rulesVersion: bundle?.version ?? null, tools: toolList?.length ?? o.toolCount ?? null, ...(toolList ? { toolList } : {}), tenant: tenant ?? null, credit, lookLocked: locked, layouts, modelKey, modelChoice, ...(passkeys ? { passkeys } : {}), ...(unnamedSeen ? { outsideUnnamed: [...unnamedReads].sort() } : {}) }),
|
|
97
98
|
});
|
|
98
99
|
}
|
|
99
100
|
catch { }
|
|
@@ -361,6 +362,13 @@ export function cognoloCloud(o) {
|
|
|
361
362
|
modelChoice = state;
|
|
362
363
|
void (beating ?? Promise.resolve()).then(beat);
|
|
363
364
|
},
|
|
365
|
+
reportTools(tools) {
|
|
366
|
+
const next = tools.filter((t) => /^[A-Za-z0-9_.-]{1,128}$/.test(t.name)).slice(0, 500).map((t) => ({ name: t.name, risk: t.risk })).sort((x, y) => x.name.localeCompare(y.name));
|
|
367
|
+
if (JSON.stringify(next) === JSON.stringify(toolList))
|
|
368
|
+
return;
|
|
369
|
+
toolList = next;
|
|
370
|
+
void (beating ?? Promise.resolve()).then(beat);
|
|
371
|
+
},
|
|
364
372
|
reportModelKey(state) {
|
|
365
373
|
if (state === modelKey)
|
|
366
374
|
return;
|
package/dist/route.js
CHANGED
|
@@ -412,7 +412,7 @@ export function cognoloRoute(o) {
|
|
|
412
412
|
if (pkOrigins.length && ((from !== null && !pkOrigins.includes(from)) || (site !== null && site !== "same-origin")))
|
|
413
413
|
return json({ error: PASSKEY_NOT_HERE }, 403);
|
|
414
414
|
try {
|
|
415
|
-
const opened = await
|
|
415
|
+
const opened = await open(req, await rc.params);
|
|
416
416
|
if (notSetUp())
|
|
417
417
|
return json({ error: NOT_SET_UP }, 503);
|
|
418
418
|
if (!o.passkeys || !pkOrigins.length)
|
|
@@ -446,6 +446,19 @@ export function cognoloRoute(o) {
|
|
|
446
446
|
return fail(e);
|
|
447
447
|
}
|
|
448
448
|
}
|
|
449
|
+
const toolsSeen = new Map();
|
|
450
|
+
const open = async (req, params) => {
|
|
451
|
+
const x = await o.open(req, params);
|
|
452
|
+
let changed = false;
|
|
453
|
+
for (const t of x.tools)
|
|
454
|
+
if (toolsSeen.size < 500 && toolsSeen.get(t.name) !== t.risk) {
|
|
455
|
+
toolsSeen.set(t.name, t.risk);
|
|
456
|
+
changed = true;
|
|
457
|
+
}
|
|
458
|
+
if (changed)
|
|
459
|
+
o.cloud?.reportTools?.([...toolsSeen].map(([name, risk]) => ({ name, risk })));
|
|
460
|
+
return x;
|
|
461
|
+
};
|
|
449
462
|
const counter = outsideCounter({ counts: o.outsideCounts, env: o.env, onTrip: (t) => o.cloud?.reportFuse?.(t) });
|
|
450
463
|
const guardsNow = () => { const c = o.cloud?.protect?.(); return { hide: [...(o.protect?.hide ?? []), ...(c?.hide ?? [])], mask: [...(o.protect?.mask ?? []), ...(c?.mask ?? [])] }; };
|
|
451
464
|
const changesHere = () => !!o.passkeys && pkOrigins.length > 0 && !!o.passkey?.freshSignIn && !o.cloud?.passkey?.().clickOnly;
|
|
@@ -465,7 +478,7 @@ export function cognoloRoute(o) {
|
|
|
465
478
|
return no("Send { gate: { tool, input } }.", 400);
|
|
466
479
|
const via = "webmcp";
|
|
467
480
|
try {
|
|
468
|
-
const opened = await
|
|
481
|
+
const opened = await open(req, await rc.params);
|
|
469
482
|
const cloud = o.cloud;
|
|
470
483
|
if (!cloud?.outside)
|
|
471
484
|
return no(GATE_CANT);
|
|
@@ -744,7 +757,7 @@ export function cognoloRoute(o) {
|
|
|
744
757
|
if (!message && !Object.keys(decisions).length && !start && !make && !go && !ask && !send)
|
|
745
758
|
return json({ error: "Say something, or approve or decline the waiting actions." }, 400);
|
|
746
759
|
try {
|
|
747
|
-
const opened = await
|
|
760
|
+
const opened = await open(req, await rc.params);
|
|
748
761
|
if (notSetUp())
|
|
749
762
|
return json({ error: NOT_SET_UP }, 503);
|
|
750
763
|
const { scope } = opened;
|
|
@@ -1470,7 +1483,7 @@ export function cognoloRoute(o) {
|
|
|
1470
1483
|
};
|
|
1471
1484
|
async function GET(req, rc) {
|
|
1472
1485
|
try {
|
|
1473
|
-
const opened = await
|
|
1486
|
+
const opened = await open(req, await rc.params);
|
|
1474
1487
|
if (notSetUp())
|
|
1475
1488
|
return json({ badge: { ...badge(opened.tenant), notice: NOT_SET_UP } });
|
|
1476
1489
|
await o.cloud?.ready();
|
package/dist/version.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** The runtime's version, reported to the cloud on every heartbeat. A test keeps it equal to package.json. */
|
|
2
|
-
export declare const RUNTIME_VERSION = "0.4.
|
|
2
|
+
export declare const RUNTIME_VERSION = "0.4.4";
|
|
3
3
|
/**
|
|
4
4
|
* The deployed git commit: the app's own setting, then `COGNOLO_COMMIT`, then a host's own variable (only a plain git hash
|
|
5
5
|
* counts from those). Null when nothing says, as when running on a developer's machine.
|
package/dist/version.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const RUNTIME_VERSION = "0.4.
|
|
1
|
+
export const RUNTIME_VERSION = "0.4.4";
|
|
2
2
|
const HOST_COMMIT_VARS = ["VERCEL_GIT_COMMIT_SHA", "RENDER_GIT_COMMIT", "RAILWAY_GIT_COMMIT_SHA", "COMMIT_REF", "CF_PAGES_COMMIT_SHA", "HEROKU_SLUG_COMMIT", "SOURCE_VERSION", "GITHUB_SHA"];
|
|
3
3
|
export function deployedCommit(own, env = typeof process === "undefined" ? {} : process.env) {
|
|
4
4
|
if (own)
|
|
@@ -14,6 +14,12 @@ export function deployedCommit(own, env = typeof process === "undefined" ? {} :
|
|
|
14
14
|
}
|
|
15
15
|
export const installSpec = (version) => `@cognolo/runtime@${version}`;
|
|
16
16
|
export const RELEASES = [
|
|
17
|
+
{
|
|
18
|
+
version: "0.4.4",
|
|
19
|
+
date: "2026-12-04",
|
|
20
|
+
summary: "The app tells Cognolo which tools people have opened, by name and risk, so the owner's Tools page shows each tool running there, including ones written by hand. It is for display only and changes nothing about what any AI may do.",
|
|
21
|
+
steps: ["Nothing to do beyond the usual update."],
|
|
22
|
+
},
|
|
17
23
|
{
|
|
18
24
|
version: "0.4.3",
|
|
19
25
|
date: "2026-12-01",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cognolo/runtime",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "Cognolo's runtime: an AI assistant inside your own web app that acts through your app's own functions and permission checks, with a person approving changes.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|