@guren/server 2.34.0 → 2.36.0
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/{DocsViewerServiceProvider-BVPZjwQp.js → DocsViewerServiceProvider-DzrxQoYh.js} +15 -4
- package/dist/Event-COT3f5Xd.js +28 -0
- package/dist/{Gate-C252SwRR.js → Gate-BHyDcDKo.js} +45 -5
- package/dist/{HttpException-BlQ2yEmT.js → HttpException-2tfZGamp.js} +8 -2
- package/dist/{McpServiceProvider-CXOokGax.js → McpServiceProvider-BOeQyt7u.js} +2 -0
- package/dist/PrivateChannel-1krGz028.js +187 -0
- package/dist/{Resource-BBKaFgXf.js → Resource-PhnO_wNO.js} +116 -15
- package/dist/agent/derive.d.ts +23 -1
- package/dist/agent/dispatch.d.ts +12 -1
- package/dist/agent/pipeline.d.ts +6 -0
- package/dist/agent/public.d.ts +1 -1
- package/dist/agent/public.js +1 -1
- package/dist/{api-token-DJcqSybf.js → api-token-Cs1myxf6.js} +16 -2
- package/dist/auth/index.js +2 -2
- package/dist/{auth-Bj9uEHuC.js → auth-DYWBlmpS.js} +2 -2
- package/dist/authorization/Gate.d.ts +4 -1
- package/dist/authorization/index.js +2 -2
- package/dist/{authorization-C81TXOWD.js → authorization-rxx6aprN.js} +1 -1
- package/dist/broadcasting/BroadcastManager.d.ts +19 -5
- package/dist/broadcasting/event-target.d.ts +9 -0
- package/dist/broadcasting/index.d.ts +3 -1
- package/dist/broadcasting/index.js +3 -2
- package/dist/broadcasting/sender-envelope.d.ts +26 -0
- package/dist/broadcasting/types.d.ts +27 -2
- package/dist/{broadcasting-3pvO94xV.js → broadcasting-Bh6QoMpy.js} +51 -96
- package/dist/{contained-path-BkNSBljW.js → contained-path-DOVauNQC.js} +1 -22
- package/dist/{context-af2n5abO.js → context--l2HdOhy.js} +1 -1
- package/dist/{dev-banner-B_QaY29h.js → dev-banner-DGxB3HGY.js} +8 -4
- package/dist/{dispatch-ENWpBxbE.js → dispatch-CDNqcB3Q.js} +51 -12
- package/dist/errors/ExceptionHandler.d.ts +5 -1
- package/dist/errors/HttpException.d.ts +6 -0
- package/dist/errors/exceptions/NotFoundHttpException.d.ts +2 -0
- package/dist/errors/wants-html.d.ts +7 -0
- package/dist/{errors-JpkcCjjn.js → errors-C8neC8go.js} +1 -1
- package/dist/events/index.js +2 -1
- package/dist/{events-B6gfJkCH.js → events-DW197Nur.js} +2 -28
- package/dist/http/dev-banner.d.ts +6 -1
- package/dist/http/middleware/csrf.d.ts +1 -1
- package/dist/http/middleware/redirect-safety.d.ts +8 -0
- package/dist/http/vite-dev-server.d.ts +18 -1
- package/dist/http/vite-manifest.d.ts +4 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.js +305 -161
- package/dist/internal/agent-principal.d.ts +8 -0
- package/dist/internal/testing.d.ts +1 -0
- package/dist/internal/testing.js +4 -4
- package/dist/mcp/index.js +1 -1
- package/dist/mvc/Router.d.ts +13 -0
- package/dist/mvc/inertia/InertiaEngine.d.ts +3 -0
- package/dist/mvc/inertia/props.d.ts +54 -3
- package/dist/providers/InertiaServiceProvider.d.ts +7 -0
- package/dist/runtime/index.js +5 -3
- package/dist/storage/index.js +1 -1
- package/dist/{storage-YPbsV9ju.js → storage-ziIKgHON.js} +2 -1
- package/dist/trim-slashes-BLY9hKAa.js +22 -0
- package/dist/vite/index.d.ts +2 -0
- package/dist/vite/index.js +283 -1
- package/dist/vite/mcp-app.d.ts +59 -0
- package/dist/vite/plugin.d.ts +12 -0
- package/dist/{vite-manifest-DO0pU1vm.js → vite-dev-server-Ag90otai.js} +25 -114
- package/dist/vite-manifest-BdXRybeq.js +129 -0
- package/package.json +1 -1
- package/dist/host-port-t6wQFaRu.js +0 -15
package/dist/{DocsViewerServiceProvider-BVPZjwQp.js → DocsViewerServiceProvider-DzrxQoYh.js}
RENAMED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { n as ServiceProvider } from "./ServiceProvider-G0YclITd.js";
|
|
2
2
|
import { n as createDocsViewerAccessGuard, r as isDocsViewerEnabled, t as DOCS_VIEWER_PATH } from "./endpoint-CTIzcagh.js";
|
|
3
|
-
import { createRequire } from "node:module";
|
|
4
3
|
import { createHash } from "node:crypto";
|
|
5
|
-
import { join } from "node:path";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
6
5
|
import { readFile } from "node:fs/promises";
|
|
7
6
|
//#region src/docs-viewer/DocsViewerServiceProvider.ts
|
|
8
7
|
/**
|
|
@@ -12,6 +11,18 @@ import { readFile } from "node:fs/promises";
|
|
|
12
11
|
*/
|
|
13
12
|
const DATA_CACHE_TTL_MS = 15e3;
|
|
14
13
|
/**
|
|
14
|
+
* `node_modules/mermaid/dist/mermaid.min.js` in `cwd` or its nearest ancestor.
|
|
15
|
+
* Read off the disk, not through the module resolver: Bun caches a failed
|
|
16
|
+
* resolution for the life of the process.
|
|
17
|
+
*/
|
|
18
|
+
async function readAppMermaid(cwd) {
|
|
19
|
+
for (let dir = cwd;; dir = dirname(dir)) try {
|
|
20
|
+
return await readFile(join(dir, "node_modules", "mermaid", "dist", "mermaid.min.js"));
|
|
21
|
+
} catch (error) {
|
|
22
|
+
if (dirname(dir) === dir) throw error;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
15
26
|
* The docs viewer (RFC 0005) at /_guren/docs: a read-only, loopback-guarded UI
|
|
16
27
|
* over the OKF docs bundle, mounted only while `isDocsViewerEnabled()` holds.
|
|
17
28
|
*/
|
|
@@ -61,7 +72,7 @@ var DocsViewerServiceProvider = class extends ServiceProvider {
|
|
|
61
72
|
let mermaid = null;
|
|
62
73
|
hono.get(`${DOCS_VIEWER_PATH}/assets/mermaid.js`, async (ctx) => {
|
|
63
74
|
try {
|
|
64
|
-
mermaid ??=
|
|
75
|
+
mermaid ??= readAppMermaid(cwd);
|
|
65
76
|
const source = await mermaid;
|
|
66
77
|
return ctx.body(new Uint8Array(source), 200, {
|
|
67
78
|
"Content-Type": "text/javascript",
|
|
@@ -69,7 +80,7 @@ var DocsViewerServiceProvider = class extends ServiceProvider {
|
|
|
69
80
|
});
|
|
70
81
|
} catch {
|
|
71
82
|
mermaid = null;
|
|
72
|
-
return ctx.json({ message: "mermaid is not installed (bun add -d mermaid)" }, 404);
|
|
83
|
+
return ctx.json({ message: "mermaid is not installed (bun add -d mermaid)" }, 404, { "Cache-Control": "no-store" });
|
|
73
84
|
}
|
|
74
85
|
});
|
|
75
86
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region src/events/Event.ts
|
|
2
|
+
/** Base class for all application events. */
|
|
3
|
+
var Event = class {
|
|
4
|
+
timestamp = /* @__PURE__ */ new Date();
|
|
5
|
+
/**
|
|
6
|
+
* Stable wire name: queued emits record it and the worker resolves the class
|
|
7
|
+
* back from it. Declare it as a static field to pin the name against a
|
|
8
|
+
* rename or identifier mangling.
|
|
9
|
+
* @default the class name
|
|
10
|
+
*/
|
|
11
|
+
static get eventName() {
|
|
12
|
+
return this.name;
|
|
13
|
+
}
|
|
14
|
+
get eventName() {
|
|
15
|
+
return resolveEventName(this.constructor);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Only an *own* `eventName` counts: statics are inherited, so reading the
|
|
20
|
+
* prototype chain would make every subclass of a pinned event claim its
|
|
21
|
+
* parent's name and take over its listeners. The base class's own entry is the
|
|
22
|
+
* accessor, which answers with the class name.
|
|
23
|
+
*/
|
|
24
|
+
function resolveEventName(eventClass) {
|
|
25
|
+
return (Object.prototype.hasOwnProperty.call(eventClass, "eventName") ? eventClass.eventName : void 0) ?? eventClass.name;
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { resolveEventName as n, Event as t };
|
|
@@ -1,6 +1,42 @@
|
|
|
1
|
-
import { t as HttpException } from "./HttpException-
|
|
1
|
+
import { n as NOT_FOUND_MESSAGE, t as HttpException } from "./HttpException-2tfZGamp.js";
|
|
2
2
|
import { g as warnDeprecatedSetter, h as warnDeprecatedGetter, i as bindAmbient, n as ambientBinding } from "./default-application-s9SE-Er7.js";
|
|
3
|
-
import { r as getAuthContext } from "./context
|
|
3
|
+
import { r as getAuthContext } from "./context--l2HdOhy.js";
|
|
4
|
+
//#region src/errors/exceptions/NotFoundHttpException.ts
|
|
5
|
+
/**
|
|
6
|
+
* Set, non-enumerable, by the `for*()` constructors, whose message the framework
|
|
7
|
+
* wrote from the record. Registry-keyed so a second copy of the package reads it;
|
|
8
|
+
* no public field marks it, since the constructor takes a developer's message too.
|
|
9
|
+
*/
|
|
10
|
+
const COMPOSED_MESSAGE = Symbol.for("guren.notFound.composedMessage");
|
|
11
|
+
function composed(error) {
|
|
12
|
+
Object.defineProperty(error, COMPOSED_MESSAGE, { value: true });
|
|
13
|
+
return error;
|
|
14
|
+
}
|
|
15
|
+
/** Whether a `for*()` constructor wrote `error`'s message, which the exception handler replaces outside debug. */
|
|
16
|
+
function hasComposedMessage(error) {
|
|
17
|
+
return error[COMPOSED_MESSAGE] === true;
|
|
18
|
+
}
|
|
19
|
+
/** 404: the requested resource could not be found. */
|
|
20
|
+
var NotFoundHttpException = class NotFoundHttpException extends HttpException {
|
|
21
|
+
resourceType;
|
|
22
|
+
resourceId;
|
|
23
|
+
constructor(message = NOT_FOUND_MESSAGE, resourceType, resourceId) {
|
|
24
|
+
super(404, message);
|
|
25
|
+
this.name = "NotFoundHttpException";
|
|
26
|
+
this.resourceType = resourceType;
|
|
27
|
+
this.resourceId = resourceId;
|
|
28
|
+
}
|
|
29
|
+
static forModel(model, id) {
|
|
30
|
+
return composed(new NotFoundHttpException(`${model} with ID ${id} not found.`, model, id));
|
|
31
|
+
}
|
|
32
|
+
static forRoute(path) {
|
|
33
|
+
return composed(new NotFoundHttpException(`Route ${path} not found.`, "Route"));
|
|
34
|
+
}
|
|
35
|
+
static forResource(resource) {
|
|
36
|
+
return composed(new NotFoundHttpException(`${resource} not found.`, resource));
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
//#endregion
|
|
4
40
|
//#region src/errors/exceptions/AuthorizationException.ts
|
|
5
41
|
/** 403: the user is authenticated but not allowed to perform the action. */
|
|
6
42
|
var AuthorizationException = class AuthorizationException extends HttpException {
|
|
@@ -48,7 +84,7 @@ const Response = {
|
|
|
48
84
|
denyAsNotFound(message) {
|
|
49
85
|
return {
|
|
50
86
|
allowed: false,
|
|
51
|
-
message: message ?? "Not
|
|
87
|
+
message: message ?? "Not Found",
|
|
52
88
|
status: 404
|
|
53
89
|
};
|
|
54
90
|
}
|
|
@@ -78,10 +114,14 @@ function isPlainRecord(value) {
|
|
|
78
114
|
function isPolicyTuple(value) {
|
|
79
115
|
return (value.length === 1 || value.length === 2) && (typeof value[0] === "function" || typeof value[0] === "string");
|
|
80
116
|
}
|
|
81
|
-
/**
|
|
117
|
+
/**
|
|
118
|
+
* Honours `denyWithStatus()` / `denyAsNotFound()` so a policy can hide a record as a 404.
|
|
119
|
+
* A 404 is a `NotFoundHttpException`, so a renderer registered for missing records renders it too.
|
|
120
|
+
*/
|
|
82
121
|
function denialToException(response) {
|
|
83
122
|
const message = response.message ?? "This action is unauthorized.";
|
|
84
123
|
const status = response.status;
|
|
124
|
+
if (status === 404) return new NotFoundHttpException(message);
|
|
85
125
|
if (typeof status === "number" && status !== 403) return new HttpException(status, message);
|
|
86
126
|
return new AuthorizationException(message);
|
|
87
127
|
}
|
|
@@ -275,4 +315,4 @@ async function authorize(ability, ...args) {
|
|
|
275
315
|
return resolveGate().authorize(ability, ...args);
|
|
276
316
|
}
|
|
277
317
|
//#endregion
|
|
278
|
-
export { cannot as a, denialToException as c, resolveGate as d, setGate as f, can as i, getGate as l, Response as n, createGate as o, AuthorizationException as p, authorize as r, defineGate as s, Gate as t, isAuthorizationResponse as u };
|
|
318
|
+
export { cannot as a, denialToException as c, resolveGate as d, setGate as f, hasComposedMessage as h, can as i, getGate as l, NotFoundHttpException as m, Response as n, createGate as o, AuthorizationException as p, authorize as r, defineGate as s, Gate as t, isAuthorizationResponse as u };
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
//#region src/errors/HttpException.ts
|
|
2
|
+
/**
|
|
3
|
+
* The one 404 message the framework writes itself: `HttpException.notFound()`,
|
|
4
|
+
* `NotFoundHttpException`, `denyAsNotFound()`, `abort(404)`, and what the exception
|
|
5
|
+
* handler puts in place of a message naming a record outside debug.
|
|
6
|
+
*/
|
|
7
|
+
const NOT_FOUND_MESSAGE = "Not Found";
|
|
2
8
|
/** Base HTTP exception class. */
|
|
3
9
|
var HttpException = class HttpException extends Error {
|
|
4
10
|
statusCode;
|
|
@@ -42,7 +48,7 @@ var HttpException = class HttpException extends Error {
|
|
|
42
48
|
static forbidden(message = "Forbidden") {
|
|
43
49
|
return new HttpException(403, message);
|
|
44
50
|
}
|
|
45
|
-
static notFound(message =
|
|
51
|
+
static notFound(message = NOT_FOUND_MESSAGE) {
|
|
46
52
|
return new HttpException(404, message);
|
|
47
53
|
}
|
|
48
54
|
static methodNotAllowed(message = "Method Not Allowed") {
|
|
@@ -81,4 +87,4 @@ var HttpException = class HttpException extends Error {
|
|
|
81
87
|
}
|
|
82
88
|
};
|
|
83
89
|
//#endregion
|
|
84
|
-
export { HttpException as t };
|
|
90
|
+
export { NOT_FOUND_MESSAGE as n, HttpException as t };
|
|
@@ -48,6 +48,8 @@ var McpServiceProvider = class extends ServiceProvider {
|
|
|
48
48
|
"/_guren/browser/:run/screenshots/:sha256",
|
|
49
49
|
"/_guren/ui",
|
|
50
50
|
"/_guren/ui.json",
|
|
51
|
+
"/_guren/mcp-apps",
|
|
52
|
+
"/_guren/mcp-apps/sandbox",
|
|
51
53
|
DEV_CENTER_FEEDBACK_ROUTE
|
|
52
54
|
]) {
|
|
53
55
|
hono.use(path, createMcpAccessGuard());
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { n as resolveEventName } from "./Event-COT3f5Xd.js";
|
|
2
|
+
//#region src/broadcasting/event-target.ts
|
|
3
|
+
/**
|
|
4
|
+
* The one reading of a broadcastable event (RFC 0037 §1): which name and which
|
|
5
|
+
* channels it is broadcast as. `BroadcastManager.broadcastEvent()` sends with it
|
|
6
|
+
* and `live()` subscribes with it, so a live prop cannot listen for a name the
|
|
7
|
+
* sender never uses.
|
|
8
|
+
*/
|
|
9
|
+
/** `broadcastAs()`, else the event's `eventName`, else its class name. */
|
|
10
|
+
function broadcastNameOf(event) {
|
|
11
|
+
const name = event.broadcastAs?.() ?? event.eventName ?? classEventName(event);
|
|
12
|
+
if (typeof name !== "string" || name === "") throw new Error("A broadcast event needs a name: define broadcastAs(), extend Event, or construct it from a class.");
|
|
13
|
+
return name;
|
|
14
|
+
}
|
|
15
|
+
/** The wire names `broadcastOn()` returns, prefix included, verbatim. */
|
|
16
|
+
function broadcastChannelsOf(event) {
|
|
17
|
+
const channels = event.broadcastOn();
|
|
18
|
+
if (!Array.isArray(channels) || channels.some((channel) => typeof channel !== "string")) throw new Error(`${describe(event)}.broadcastOn() must return an array of channel names.`);
|
|
19
|
+
return channels;
|
|
20
|
+
}
|
|
21
|
+
function classEventName(event) {
|
|
22
|
+
const ctor = event.constructor;
|
|
23
|
+
return ctor && ctor !== Object ? resolveEventName(ctor) : void 0;
|
|
24
|
+
}
|
|
25
|
+
function describe(event) {
|
|
26
|
+
const ctor = event.constructor;
|
|
27
|
+
return ctor && ctor !== Object && ctor.name ? ctor.name : "The event";
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/broadcasting/sender-envelope.ts
|
|
31
|
+
/**
|
|
32
|
+
* The sender of a broadcast, carried inside its payload (RFC 0037 §4) so every
|
|
33
|
+
* driver passes it across instances. `__inertia.socketId` and `__inertia.userId`
|
|
34
|
+
* are reserved: every manager publish path strips them from what the app passes
|
|
35
|
+
* before marking, so a relayed payload cannot forge a mark, and delivery strips
|
|
36
|
+
* them before any client sees the payload.
|
|
37
|
+
*/
|
|
38
|
+
const ENVELOPE_KEY = "__inertia";
|
|
39
|
+
/** `s_` and 32 hex digits: what `registerWebSocketClient()` issues. */
|
|
40
|
+
const SOCKET_ID_PATTERN = /^s_[0-9a-f]{32}$/;
|
|
41
|
+
function isSocketId(value) {
|
|
42
|
+
return typeof value === "string" && SOCKET_ID_PATTERN.test(value);
|
|
43
|
+
}
|
|
44
|
+
/** A user id that survives JSON as itself: `NaN` and the infinities become `null` on the Redis driver. */
|
|
45
|
+
function isSenderUserId(value) {
|
|
46
|
+
return typeof value === "string" || typeof value === "number" && Number.isFinite(value);
|
|
47
|
+
}
|
|
48
|
+
function isPlainObject(value) {
|
|
49
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
50
|
+
const prototype = Object.getPrototypeOf(value);
|
|
51
|
+
return prototype === Object.prototype || prototype === null;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The payload with the sender added. An object that is not plain (a class
|
|
55
|
+
* instance, one with `toJSON()`) is marked as the JSON a client would receive;
|
|
56
|
+
* an array or a primitive cannot carry a mark.
|
|
57
|
+
*/
|
|
58
|
+
function markSender(data, sender) {
|
|
59
|
+
const object = isPlainObject(data) ? data : asJsonObject(data);
|
|
60
|
+
if (!object) return data;
|
|
61
|
+
const envelope = isPlainObject(object[ENVELOPE_KEY]) ? object[ENVELOPE_KEY] : {};
|
|
62
|
+
return {
|
|
63
|
+
...object,
|
|
64
|
+
[ENVELOPE_KEY]: {
|
|
65
|
+
...envelope,
|
|
66
|
+
socketId: sender.socketId,
|
|
67
|
+
userId: sender.userId
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function asJsonObject(data) {
|
|
72
|
+
if (typeof data !== "object" || data === null || Array.isArray(data)) return void 0;
|
|
73
|
+
const json = JSON.parse(JSON.stringify(data));
|
|
74
|
+
return isPlainObject(json) ? json : void 0;
|
|
75
|
+
}
|
|
76
|
+
function readSender(data) {
|
|
77
|
+
if (!isPlainObject(data) || !isPlainObject(data[ENVELOPE_KEY])) return void 0;
|
|
78
|
+
const { socketId, userId } = data[ENVELOPE_KEY];
|
|
79
|
+
if (!isSocketId(socketId) || !isSenderUserId(userId)) return void 0;
|
|
80
|
+
return {
|
|
81
|
+
socketId,
|
|
82
|
+
userId
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The payload without the reserved fields, valid or not, and without the
|
|
87
|
+
* envelope once nothing else is in it.
|
|
88
|
+
*/
|
|
89
|
+
function stripSender(data) {
|
|
90
|
+
if (!isPlainObject(data) || !isPlainObject(data[ENVELOPE_KEY])) return data;
|
|
91
|
+
if (!("socketId" in data[ENVELOPE_KEY]) && !("userId" in data[ENVELOPE_KEY])) return data;
|
|
92
|
+
const { socketId: _socketId, userId: _userId, ...rest } = data[ENVELOPE_KEY];
|
|
93
|
+
const { [ENVELOPE_KEY]: _envelope, ...payload } = data;
|
|
94
|
+
return Object.keys(rest).length > 0 ? {
|
|
95
|
+
...payload,
|
|
96
|
+
[ENVELOPE_KEY]: rest
|
|
97
|
+
} : payload;
|
|
98
|
+
}
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region src/broadcasting/channels/Channel.ts
|
|
101
|
+
var Channel = class {
|
|
102
|
+
name;
|
|
103
|
+
driver;
|
|
104
|
+
constructor(name, driver) {
|
|
105
|
+
this.name = name;
|
|
106
|
+
this.driver = driver;
|
|
107
|
+
}
|
|
108
|
+
async broadcast(event, data) {
|
|
109
|
+
await this.driver.publish(this.name, event, stripSender(data));
|
|
110
|
+
}
|
|
111
|
+
/** Returns an unsubscribe function. */
|
|
112
|
+
subscribe(callback) {
|
|
113
|
+
return this.driver.subscribe(this.name, (e) => {
|
|
114
|
+
callback(e.event, stripSender(e.data));
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
getChannelName() {
|
|
118
|
+
return this.name;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region src/broadcasting/channels/PresenceChannel.ts
|
|
123
|
+
/** Broadcast channel that tracks the members who have joined it. */
|
|
124
|
+
var PresenceChannel = class PresenceChannel extends Channel {
|
|
125
|
+
static PREFIX = "presence-";
|
|
126
|
+
presenceDriver;
|
|
127
|
+
constructor(name, driver) {
|
|
128
|
+
const channelName = name.startsWith(PresenceChannel.PREFIX) ? name : `${PresenceChannel.PREFIX}${name}`;
|
|
129
|
+
super(channelName, driver);
|
|
130
|
+
if (this.isPresenceDriver(driver)) this.presenceDriver = driver;
|
|
131
|
+
else throw new Error("Driver does not support presence channels. Ensure the driver implements PresenceBroadcastDriver interface.");
|
|
132
|
+
}
|
|
133
|
+
isPresenceDriver(driver) {
|
|
134
|
+
return "getMembers" in driver && "addMember" in driver && "removeMember" in driver;
|
|
135
|
+
}
|
|
136
|
+
members() {
|
|
137
|
+
return this.presenceDriver.getMembers(this.name);
|
|
138
|
+
}
|
|
139
|
+
async join(member) {
|
|
140
|
+
this.presenceDriver.addMember(this.name, member);
|
|
141
|
+
await this.broadcast("presence:joining", { member });
|
|
142
|
+
}
|
|
143
|
+
async leave(memberId) {
|
|
144
|
+
const member = this.members().find((m) => m.id === memberId);
|
|
145
|
+
this.presenceDriver.removeMember(this.name, memberId);
|
|
146
|
+
if (member) await this.broadcast("presence:leaving", { member });
|
|
147
|
+
}
|
|
148
|
+
hasMember(memberId) {
|
|
149
|
+
return this.members().some((m) => m.id === memberId);
|
|
150
|
+
}
|
|
151
|
+
getMember(memberId) {
|
|
152
|
+
return this.members().find((m) => m.id === memberId);
|
|
153
|
+
}
|
|
154
|
+
count() {
|
|
155
|
+
return this.members().length;
|
|
156
|
+
}
|
|
157
|
+
getBaseName() {
|
|
158
|
+
return this.name.startsWith(PresenceChannel.PREFIX) ? this.name.slice(PresenceChannel.PREFIX.length) : this.name;
|
|
159
|
+
}
|
|
160
|
+
static isPresenceChannel(name) {
|
|
161
|
+
return name.startsWith(PresenceChannel.PREFIX);
|
|
162
|
+
}
|
|
163
|
+
static normalize(name) {
|
|
164
|
+
return name.startsWith(PresenceChannel.PREFIX) ? name : `${PresenceChannel.PREFIX}${name}`;
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region src/broadcasting/channels/PrivateChannel.ts
|
|
169
|
+
/** Broadcast channel that requires authentication to subscribe. */
|
|
170
|
+
var PrivateChannel = class PrivateChannel extends Channel {
|
|
171
|
+
static PREFIX = "private-";
|
|
172
|
+
constructor(name, driver) {
|
|
173
|
+
const channelName = name.startsWith(PrivateChannel.PREFIX) ? name : `${PrivateChannel.PREFIX}${name}`;
|
|
174
|
+
super(channelName, driver);
|
|
175
|
+
}
|
|
176
|
+
getBaseName() {
|
|
177
|
+
return this.name.startsWith(PrivateChannel.PREFIX) ? this.name.slice(PrivateChannel.PREFIX.length) : this.name;
|
|
178
|
+
}
|
|
179
|
+
static isPrivateChannel(name) {
|
|
180
|
+
return name.startsWith(PrivateChannel.PREFIX);
|
|
181
|
+
}
|
|
182
|
+
static normalize(name) {
|
|
183
|
+
return name.startsWith(PrivateChannel.PREFIX) ? name : `${PrivateChannel.PREFIX}${name}`;
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
//#endregion
|
|
187
|
+
export { isSocketId as a, stripSender as c, isSenderUserId as i, broadcastChannelsOf as l, PresenceChannel as n, markSender as o, Channel as r, readSender as s, PrivateChannel as t, broadcastNameOf as u };
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { i as parseRequestBody, n as flattenRequestQueries, o as parseRequestUploads, t as asRecord } from "./request-CLOYytGP.js";
|
|
2
2
|
import { n as getValidatedInput, r as readValidatedInput } from "./validated-input-D84J8wcC.js";
|
|
3
|
-
import { n as ValidationException } from "./errors-
|
|
3
|
+
import { n as ValidationException } from "./errors-C8neC8go.js";
|
|
4
4
|
import { n as parseImportMap, t as DEFAULT_DEV_STYLES_ENTRY } from "./inertia-defaults-BjrcT7za.js";
|
|
5
5
|
import { t as resolveOptional } from "./resolve-optional-ax6gPWTp.js";
|
|
6
6
|
import { g as warnDeprecatedSetter, h as warnDeprecatedGetter } from "./default-application-s9SE-Er7.js";
|
|
7
7
|
import { n as initialPageElement, t as INITIAL_PAGE_SELECTOR } from "./initial-page-U637q3gO.js";
|
|
8
|
+
import { l as broadcastChannelsOf, n as PresenceChannel, t as PrivateChannel, u as broadcastNameOf } from "./PrivateChannel-1krGz028.js";
|
|
8
9
|
import { n as ServiceProvider } from "./ServiceProvider-G0YclITd.js";
|
|
9
|
-
import { o as getApiTokenOrFail } from "./api-token-
|
|
10
|
-
import { r as getAuthContext } from "./context
|
|
10
|
+
import { F as readAgentSharedProps, o as getApiTokenOrFail } from "./api-token-Cs1myxf6.js";
|
|
11
|
+
import { r as getAuthContext } from "./context--l2HdOhy.js";
|
|
11
12
|
import { r as tryGetRequestContainer } from "./request-container-BbuH0JJy.js";
|
|
12
13
|
import { a as resolveI18n } from "./i18n-BShPpJZa.js";
|
|
13
|
-
import { d as resolveGate } from "./Gate-
|
|
14
|
+
import { d as resolveGate } from "./Gate-BHyDcDKo.js";
|
|
14
15
|
import { t as jsx_runtime_exports } from "./jsx-runtime.js";
|
|
15
16
|
import { getCookie } from "hono/cookie";
|
|
16
17
|
import { isAbsolute, resolve } from "node:path";
|
|
@@ -78,6 +79,8 @@ function copyStackFromError(target, source) {
|
|
|
78
79
|
*/
|
|
79
80
|
const DEFERRED_BRAND = Symbol.for("guren.inertia.deferred");
|
|
80
81
|
const ALWAYS_BRAND = Symbol.for("guren.inertia.always");
|
|
82
|
+
const LIVE_BRAND = Symbol.for("guren.inertia.live");
|
|
83
|
+
const LIVE_OUTERMOST = "live() must be the outermost prop helper: write live(always(…)) or live(defer(…)), never the other way round.";
|
|
81
84
|
/**
|
|
82
85
|
* A prop sent on every response, partial reloads included, whatever the
|
|
83
86
|
* `only`/`except` lists say (Laravel's `Inertia::always()`). The protocol's
|
|
@@ -85,6 +88,7 @@ const ALWAYS_BRAND = Symbol.for("guren.inertia.always");
|
|
|
85
88
|
* flash the partial filter drops is gone with the request.
|
|
86
89
|
*/
|
|
87
90
|
function always(value) {
|
|
91
|
+
if (isLiveProp(value)) throw new Error(LIVE_OUTERMOST);
|
|
88
92
|
return Object.freeze({
|
|
89
93
|
[ALWAYS_BRAND]: true,
|
|
90
94
|
value,
|
|
@@ -111,6 +115,80 @@ function isDeferredProp(value) {
|
|
|
111
115
|
return typeof value === "object" && value !== null && value[DEFERRED_BRAND] === true;
|
|
112
116
|
}
|
|
113
117
|
/**
|
|
118
|
+
* A prop the client reloads whenever one of the given broadcast events
|
|
119
|
+
* arrives (Inertia's live props, RFC 0037). The entry is computed here, so a
|
|
120
|
+
* mistake throws in the action that wrote it. Wraps any other prop input.
|
|
121
|
+
*/
|
|
122
|
+
function live(value, options) {
|
|
123
|
+
if (isLiveProp(value)) throw new Error("A live prop cannot wrap another live prop.");
|
|
124
|
+
const entry = {
|
|
125
|
+
listeners: liveListeners(options.on),
|
|
126
|
+
...options.throttle !== void 0 ? { throttle: liveThrottle(options.throttle) } : {}
|
|
127
|
+
};
|
|
128
|
+
return Object.freeze({
|
|
129
|
+
[LIVE_BRAND]: true,
|
|
130
|
+
value,
|
|
131
|
+
entry,
|
|
132
|
+
toJSON: () => isAlwaysProp(value) ? value.toJSON() : value
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
function isLiveProp(value) {
|
|
136
|
+
return typeof value === "object" && value !== null && value[LIVE_BRAND] === true;
|
|
137
|
+
}
|
|
138
|
+
function liveThrottle(throttle) {
|
|
139
|
+
if (!Number.isFinite(throttle) || throttle < 0) throw new Error(`A live prop's throttle is milliseconds, a finite number of zero or more; got ${throttle}.`);
|
|
140
|
+
return throttle;
|
|
141
|
+
}
|
|
142
|
+
function isListenerInput(value) {
|
|
143
|
+
return typeof value.broadcastOn !== "function";
|
|
144
|
+
}
|
|
145
|
+
/** Listeners grouped per channel, events deduplicated: the shape the Laravel adapter's `addLiveListener()` sends. */
|
|
146
|
+
function liveListeners(on) {
|
|
147
|
+
const sources = Array.isArray(on) ? on : [on];
|
|
148
|
+
if (sources.length === 0) throw new Error("A live prop must listen for at least one event.");
|
|
149
|
+
const byChannel = /* @__PURE__ */ new Map();
|
|
150
|
+
for (const source of sources) {
|
|
151
|
+
if (typeof source === "function") throw new Error(`live() reads channels off an event instance: pass new ${source.name || "TheEvent"}(…), not the class.`);
|
|
152
|
+
const { event, channels } = isListenerInput(source) ? {
|
|
153
|
+
event: source.event,
|
|
154
|
+
channels: typeof source.channel === "string" ? [source.channel] : [...source.channel ?? []]
|
|
155
|
+
} : {
|
|
156
|
+
event: broadcastNameOf(source),
|
|
157
|
+
channels: broadcastChannelsOf(source)
|
|
158
|
+
};
|
|
159
|
+
if (typeof event !== "string" || event === "") throw new Error("A live prop listener needs an event name.");
|
|
160
|
+
if (channels.length === 0) throw new Error(`A live prop listening for "${event}" has no channel: the event broadcasts on none.`);
|
|
161
|
+
for (const wireName of channels) {
|
|
162
|
+
const channel = liveChannel(wireName);
|
|
163
|
+
const key = `${channel.type}:${channel.name}`;
|
|
164
|
+
const listener = byChannel.get(key) ?? {
|
|
165
|
+
channel,
|
|
166
|
+
events: []
|
|
167
|
+
};
|
|
168
|
+
if (!listener.events.includes(event)) listener.events.push(event);
|
|
169
|
+
byChannel.set(key, listener);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return [...byChannel.values()];
|
|
173
|
+
}
|
|
174
|
+
/** A Guren wire name as Inertia's `{ name, type }`; the prefixes are the channel classes' own. */
|
|
175
|
+
function liveChannel(wireName) {
|
|
176
|
+
if (wireName.startsWith(`${PrivateChannel.PREFIX}encrypted-`)) throw new Error(`Guren has no encrypted channels; "${wireName}" cannot be live.`);
|
|
177
|
+
for (const [prefix, type] of [[PrivateChannel.PREFIX, "private"], [PresenceChannel.PREFIX, "presence"]]) if (wireName.startsWith(prefix)) {
|
|
178
|
+
const name = wireName.slice(prefix.length);
|
|
179
|
+
if (name === "") throw new Error(`"${wireName}" names no channel.`);
|
|
180
|
+
return {
|
|
181
|
+
name,
|
|
182
|
+
type
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
if (wireName === "") throw new Error("A live prop channel name is empty.");
|
|
186
|
+
return {
|
|
187
|
+
name: wireName,
|
|
188
|
+
type: "public"
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
114
192
|
* A header list as its top-level prop names: `author.name` selects `author`.
|
|
115
193
|
* The prototype client (`@guren/inertia-client/prototype`) answers a fixture
|
|
116
194
|
* with the same rule; the two cannot import each other, so keep them in step.
|
|
@@ -143,7 +221,10 @@ function isSelected(key, partial) {
|
|
|
143
221
|
* every sibling rather than leaving the ones already started unhandled.
|
|
144
222
|
*/
|
|
145
223
|
function startProp(value) {
|
|
146
|
-
return Promise.resolve().then(() => isDeferredProp(value) ? value.resolve() : value())
|
|
224
|
+
return Promise.resolve().then(() => isDeferredProp(value) ? value.resolve() : value()).then((resolved) => {
|
|
225
|
+
if (isLiveProp(resolved)) throw new Error(LIVE_OUTERMOST);
|
|
226
|
+
return resolved;
|
|
227
|
+
});
|
|
147
228
|
}
|
|
148
229
|
/**
|
|
149
230
|
* The props a response carries under the protocol's evaluation rules: a full
|
|
@@ -155,16 +236,23 @@ function startProp(value) {
|
|
|
155
236
|
async function resolveInertiaProps(input, partial) {
|
|
156
237
|
const props = {};
|
|
157
238
|
const deferredProps = {};
|
|
239
|
+
const liveProps = {};
|
|
158
240
|
const pending = [];
|
|
159
|
-
for (const [key,
|
|
241
|
+
for (const [key, given] of Object.entries(input)) {
|
|
242
|
+
const liveProp = isLiveProp(given) ? given : void 0;
|
|
243
|
+
const raw = liveProp ? liveProp.value : given;
|
|
160
244
|
const alwaysProp = isAlwaysProp(raw);
|
|
161
245
|
const value = alwaysProp ? raw.value : raw;
|
|
162
246
|
const deferred = isDeferredProp(value);
|
|
163
247
|
if (partial) {
|
|
164
248
|
if (!alwaysProp && !isSelected(key, partial)) continue;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
249
|
+
if (liveProp) liveProps[key] = liveProp.entry;
|
|
250
|
+
} else {
|
|
251
|
+
if (liveProp) liveProps[key] = liveProp.entry;
|
|
252
|
+
if (deferred) {
|
|
253
|
+
(deferredProps[value.group] ??= []).push(key);
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
168
256
|
}
|
|
169
257
|
if (deferred || typeof value === "function") {
|
|
170
258
|
props[key] = void 0;
|
|
@@ -174,10 +262,11 @@ async function resolveInertiaProps(input, partial) {
|
|
|
174
262
|
} else props[key] = value;
|
|
175
263
|
}
|
|
176
264
|
if (pending.length > 0) await Promise.all(pending);
|
|
177
|
-
return
|
|
265
|
+
return {
|
|
178
266
|
props,
|
|
179
|
-
deferredProps
|
|
180
|
-
|
|
267
|
+
...Object.keys(deferredProps).length > 0 ? { deferredProps } : {},
|
|
268
|
+
...Object.keys(liveProps).length > 0 ? { liveProps } : {}
|
|
269
|
+
};
|
|
181
270
|
}
|
|
182
271
|
//#endregion
|
|
183
272
|
//#region src/support/default-headers.ts
|
|
@@ -308,7 +397,8 @@ async function buildInertiaPage(component, props, options) {
|
|
|
308
397
|
props: resolved.props,
|
|
309
398
|
url: options.url ?? inertiaPageUrl(options.request) ?? "",
|
|
310
399
|
version: options.version,
|
|
311
|
-
...resolved.deferredProps ? { deferredProps: resolved.deferredProps } : {}
|
|
400
|
+
...resolved.deferredProps ? { deferredProps: resolved.deferredProps } : {},
|
|
401
|
+
...resolved.liveProps ? { liveProps: resolved.liveProps } : {}
|
|
312
402
|
};
|
|
313
403
|
}
|
|
314
404
|
/**
|
|
@@ -923,7 +1013,7 @@ var Controller = class {
|
|
|
923
1013
|
const ctx = this.ctx;
|
|
924
1014
|
const component = typeof componentOrPage === "string" ? componentOrPage : componentOrPage.component ?? componentOrPage.id;
|
|
925
1015
|
const { response, page } = await renderInertia(component, {
|
|
926
|
-
...await
|
|
1016
|
+
...await resolveSharedProps(ctx, this._container),
|
|
927
1017
|
...props
|
|
928
1018
|
}, {
|
|
929
1019
|
...options,
|
|
@@ -1114,6 +1204,17 @@ var Controller = class {
|
|
|
1114
1204
|
return asRecord(await this.getRawBody());
|
|
1115
1205
|
}
|
|
1116
1206
|
};
|
|
1207
|
+
/**
|
|
1208
|
+
* Shared props, narrowed to what the agent pipeline allowed this exact request (RFC 0038 §6).
|
|
1209
|
+
* An empty allowlist runs no resolver; a non-empty one runs them all, since one resolver returns several keys.
|
|
1210
|
+
*/
|
|
1211
|
+
async function resolveSharedProps(ctx, container) {
|
|
1212
|
+
const allowed = readAgentSharedProps(ctx.req.raw);
|
|
1213
|
+
if (allowed?.size === 0) return {};
|
|
1214
|
+
const shared = await resolveSharedInertiaProps(ctx, container);
|
|
1215
|
+
if (!allowed) return shared;
|
|
1216
|
+
return Object.fromEntries(Object.entries(shared).filter(([key]) => allowed.has(key)));
|
|
1217
|
+
}
|
|
1117
1218
|
//#endregion
|
|
1118
1219
|
//#region src/http/resources/Resource.ts
|
|
1119
1220
|
/**
|
|
@@ -1184,4 +1285,4 @@ var JsonResource = class extends Resource {
|
|
|
1184
1285
|
}
|
|
1185
1286
|
};
|
|
1186
1287
|
//#endregion
|
|
1187
|
-
export {
|
|
1288
|
+
export { isLiveProp as A, setInertiaDocument as C, defer as D, always as E, ensureErrorStackTracePolyfill as M, isAlwaysProp as O, serializePage as S, withDefaultHeaders as T, INERTIA_VARY as _, renderDocument as a, inertia as b, getRequestLocale as c, mountModuleRoutes as d, definePlugin as f, shareInertiaProps as g, setInertiaSharedProps as h, Controller as i, live as j, isDeferredProp as k, getRequestTranslator as l, resolveSharedInertiaProps as m, Resource as n, LOCALE_CONTEXT_KEY as o, getInertiaSharedPropsResolver as p, collect as r, detectLocaleMiddleware as s, JsonResource as t, defineModule as u, acceptsJson as v, setInertiaSsrRenderer as w, mergeInertiaVary as x, buildInertiaPage as y };
|
package/dist/agent/derive.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* result, and `guren check` turns those warnings into a failing build. Opt-in —
|
|
9
9
|
* a route becomes a tool only by declaring `.agent()` *and* carrying a name.
|
|
10
10
|
*/
|
|
11
|
-
import type { ResourceResponseShape, RouteDefinition } from '../mvc/Router.js';
|
|
11
|
+
import type { AgentRouteMetadata, ResourceResponseShape, RouteDefinition } from '../mvc/Router.js';
|
|
12
12
|
import { type JsonSchemaObject } from '../internal/zod-json-schema.js';
|
|
13
13
|
/**
|
|
14
14
|
* A JSON Schema 2020-12 object as an agent tool advertises it — an alias of the
|
|
@@ -34,6 +34,15 @@ export interface DerivedAgentToolExposure {
|
|
|
34
34
|
mcp: boolean;
|
|
35
35
|
webMcp: boolean;
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* MCP Apps metadata (RFC 0038), resolved: `visibility` always present, so no
|
|
39
|
+
* consumer re-applies the specification's both-audiences default.
|
|
40
|
+
*/
|
|
41
|
+
export interface DerivedAgentToolUi {
|
|
42
|
+
/** The Inertia page rendering this tool's result. Absent for a tool only a view calls. */
|
|
43
|
+
page?: string;
|
|
44
|
+
visibility: Array<'model' | 'app'>;
|
|
45
|
+
}
|
|
37
46
|
export interface DerivedAgentTool {
|
|
38
47
|
/** Tool identity: `agent.toolName` when given, otherwise the route name, verbatim. */
|
|
39
48
|
toolName: string;
|
|
@@ -89,6 +98,14 @@ export interface DerivedAgentTool {
|
|
|
89
98
|
/** Declared verbatim: argument fields masked in agent audit logs. */
|
|
90
99
|
redact?: string[];
|
|
91
100
|
expose: DerivedAgentToolExposure;
|
|
101
|
+
/**
|
|
102
|
+
* Input names two sources declared, of which the later one won. A visit that
|
|
103
|
+
* carries both cannot be rebuilt into one flat call, so the MCP Apps bridge
|
|
104
|
+
* leaves such a tool alone (RFC 0038 §5). Absent when there were none.
|
|
105
|
+
*/
|
|
106
|
+
inputCollisions?: string[];
|
|
107
|
+
/** Declared `ui`, normalized (RFC 0038). Absent when the route declares none. */
|
|
108
|
+
ui?: DerivedAgentToolUi;
|
|
92
109
|
/**
|
|
93
110
|
* What could not be expressed while deriving *this* tool, unprefixed. The
|
|
94
111
|
* same lines appear prefixed in {@link DeriveAgentToolsResult.warnings};
|
|
@@ -119,3 +136,8 @@ export type AgentToolInputSource = 'params' | 'path' | 'query' | 'body';
|
|
|
119
136
|
* @param definitions Registered routes, as `Router.definitions()` hands them out.
|
|
120
137
|
*/
|
|
121
138
|
export declare function deriveAgentTools(definitions: RouteDefinition[]): DeriveAgentToolsResult;
|
|
139
|
+
/**
|
|
140
|
+
* The declared `ui` resolved, or why it is malformed. The one rule: the
|
|
141
|
+
* derivation and `guren check` both judge a declaration through it.
|
|
142
|
+
*/
|
|
143
|
+
export declare function deriveAgentToolUi(declared: NonNullable<AgentRouteMetadata['ui']>): DerivedAgentToolUi | string;
|
package/dist/agent/dispatch.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { DerivedAgentTool } from './derive.js';
|
|
8
8
|
import type { AgentSurface } from './events.js';
|
|
9
|
+
import type { InertiaPagePayload } from '../mvc/inertia/InertiaEngine.js';
|
|
9
10
|
export interface BuildToolRequestOptions {
|
|
10
11
|
/**
|
|
11
12
|
* Origin the synthesized URL is built on. Never leaves the process — the
|
|
@@ -95,6 +96,16 @@ export interface ToolCallOutcome {
|
|
|
95
96
|
* route as a rehearsal that never ran.
|
|
96
97
|
*/
|
|
97
98
|
preflightVerdict?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* A 3xx response's `Location`, resolved against the dispatched request's URL
|
|
101
|
+
* when the caller passes it (a relative `../13` means the route's own path).
|
|
102
|
+
* Read by adapters instead of parsing `content`.
|
|
103
|
+
*/
|
|
104
|
+
location?: string;
|
|
105
|
+
/** A 422 response's `errors` object, when the body carries one (RFC 0038 §6). */
|
|
106
|
+
errors?: Record<string, string[]>;
|
|
107
|
+
/** The whole Inertia page a `ui` page tool's action answered with, before `content` unwraps it to its props. */
|
|
108
|
+
inertiaPage?: InertiaPagePayload;
|
|
98
109
|
}
|
|
99
110
|
/**
|
|
100
111
|
* Whether the tool advertises an object output schema — the only kind MCP
|
|
@@ -110,4 +121,4 @@ export declare function advertisesStructuredOutput(tool: DerivedAgentTool): bool
|
|
|
110
121
|
* with the handler's body; other → capped text. An object-`outputSchema` success
|
|
111
122
|
* lacking an object becomes `isError`: the SDK client rejects it after the route ran.
|
|
112
123
|
*/
|
|
113
|
-
export declare function mapToolResponse(tool: DerivedAgentTool, response: Response): Promise<ToolCallOutcome>;
|
|
124
|
+
export declare function mapToolResponse(tool: DerivedAgentTool, response: Response, requestUrl?: string): Promise<ToolCallOutcome>;
|