@lobu/runtime-device 24.4.0 → 24.6.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/component.json +1 -1
- package/dist/dependencies.bun.lock +77 -64
- package/dist/verify.mjs +1 -1
- package/npm-shrinkwrap.json +176 -141
- package/package.json +3 -2
- package/vendor/cli/dist/bundled-skills/lobu/SKILL.md +65 -11
- package/vendor/cli/dist/commands/_lib/apply/apply-cmd.js +20 -13
- package/vendor/cli/dist/commands/_lib/apply/client.d.ts +48 -100
- package/vendor/cli/dist/commands/_lib/apply/client.js +76 -27
- package/vendor/cli/dist/commands/_lib/apply/deployment.js +1 -1
- package/vendor/cli/dist/commands/_lib/apply/desired-state.d.ts +7 -11
- package/vendor/cli/dist/commands/_lib/apply/desired-state.js +9 -40
- package/vendor/cli/dist/commands/_lib/apply/diff.d.ts +4 -4
- package/vendor/cli/dist/commands/_lib/apply/diff.js +37 -33
- package/vendor/cli/dist/commands/_lib/apply/map-config.d.ts +1 -1
- package/vendor/cli/dist/commands/_lib/apply/map-config.js +79 -92
- package/vendor/cli/dist/commands/_lib/apply/shared.d.ts +3 -6
- package/vendor/cli/dist/commands/_lib/apply/shared.js +8 -19
- package/vendor/cli/dist/commands/_lib/view-bundler.js +9 -1
- package/vendor/cli/dist/commands/dev.js +21 -7
- package/vendor/cli/dist/commands/doctor.js +1 -8
- package/vendor/cli/dist/commands/init.js +4 -5
- package/vendor/cli/dist/config/define.d.ts +27 -28
- package/vendor/cli/dist/config/define.js +4 -5
- package/vendor/cli/dist/connectors/linkedin-identity.ts +43 -0
- package/vendor/cli/dist/connectors/linkedin.ts +154 -3
- package/vendor/cli/dist/connectors/postgres.ts +77 -48
- package/vendor/cli/dist/connectors/x-like-follow.ts +329 -0
- package/vendor/cli/dist/connectors/x.ts +709 -80
- package/vendor/cli/dist/internal/api-client.d.ts +2 -0
- package/vendor/cli/dist/internal/api-client.js +6 -1
- package/vendor/cli/dist/internal/connector-compiler.js +3 -1
- package/vendor/cli/dist/internal/node-binary.d.ts +22 -0
- package/vendor/cli/dist/internal/node-binary.js +73 -0
- package/vendor/cli/dist/internal/node-version.d.ts +7 -12
- package/vendor/cli/dist/internal/node-version.js +16 -20
- package/vendor/cli/dist/runtime-components.json +4 -4
- package/vendor/cli/dist/templates/AGENTS.md.tmpl +2 -2
- package/vendor/cli/package.json +3 -2
- package/vendor/connector-sdk/dist/reaction-client-types.d.ts +8 -2
- package/vendor/connector-sdk/dist/reaction-sdk.d.ts +5 -1
- package/vendor/connector-sdk/package.json +1 -1
- package/vendor/connector-worker/dist/compile/index.d.ts +4 -3
- package/vendor/connector-worker/dist/compile/index.js +6 -3
- package/vendor/connector-worker/dist/daemon/acp-adapters/claude.js +1 -1
- package/vendor/connector-worker/dist/daemon/agent-turn.js +21 -10
- package/vendor/connector-worker/dist/daemon/client.d.ts +25 -8
- package/vendor/connector-worker/dist/daemon/client.js +25 -3
- package/vendor/connector-worker/dist/daemon/mac-device-daemon.js +7 -1
- package/vendor/connector-worker/dist/daemon/poll-loop.d.ts +17 -0
- package/vendor/connector-worker/dist/daemon/poll-loop.js +75 -6
- package/vendor/connector-worker/dist/daemon/resource-admission.d.ts +19 -0
- package/vendor/connector-worker/dist/daemon/resource-admission.js +59 -0
- package/vendor/connector-worker/dist/daemon/resources.d.ts +20 -0
- package/vendor/connector-worker/dist/daemon/resources.js +163 -0
- package/vendor/connector-worker/dist/daemon/start.js +29 -4
- package/vendor/connector-worker/dist/daemon/worker.d.ts +2 -0
- package/vendor/connector-worker/dist/daemon/worker.js +4 -0
- package/vendor/connector-worker/dist/executor/select.d.ts +1 -1
- package/vendor/connector-worker/dist/executor/select.js +1 -1
- package/vendor/connector-worker/dist/isolate/ivm-types.d.ts +1 -2
- package/vendor/connector-worker/dist/isolate/ivm-types.js +1 -2
- package/vendor/connector-worker/dist/isolate/load.d.ts +10 -12
- package/vendor/connector-worker/dist/isolate/load.js +23 -27
- package/vendor/connector-worker/dist/self-check/index.d.ts +2 -2
- package/vendor/connector-worker/dist/self-check/index.js +2 -2
- package/vendor/connector-worker/package.json +3 -4
- package/vendor/core/dist/contracts/agent-settings.d.ts +61 -6
- package/vendor/core/dist/contracts/agent-settings.js +10 -7
- package/vendor/core/dist/contracts/tools/manage-agents.d.ts +473 -98
- package/vendor/core/dist/contracts/tools/manage-agents.js +111 -2
- package/vendor/core/dist/contracts/tools/manage-automations.d.ts +21 -18
- package/vendor/core/dist/contracts/tools/manage-automations.js +15 -15
- package/vendor/core/dist/contracts/tools/manage-entity-schema.js +2 -2
- package/vendor/core/dist/contracts/tools/manage-inference-providers.d.ts +445 -0
- package/vendor/core/dist/contracts/tools/manage-inference-providers.js +133 -0
- package/vendor/core/dist/contracts/tools/manage-views.d.ts +4 -4
- package/vendor/core/dist/contracts/tools/manage-views.js +5 -3
- package/vendor/core/dist/contracts/tools/view-host.d.ts +7 -0
- package/vendor/core/dist/contracts/tools/view-host.js +28 -0
- package/vendor/core/dist/contracts/tools/view-runtime.d.ts +2 -4
- package/vendor/core/dist/contracts/tools/view-runtime.js +19 -7
- package/vendor/core/dist/contracts/worker/device-automation.js +4 -2
- package/vendor/core/dist/error-report.d.ts +73 -0
- package/vendor/core/dist/error-report.js +346 -0
- package/vendor/core/dist/index.d.ts +3 -1
- package/vendor/core/dist/index.js +4 -1
- package/vendor/core/dist/logger.js +7 -4
- package/vendor/core/dist/otel-fetch.d.ts +19 -0
- package/vendor/core/dist/otel-fetch.js +96 -0
- package/vendor/core/dist/otel.d.ts +9 -0
- package/vendor/core/dist/otel.js +28 -7
- package/vendor/core/dist/reserved.d.ts +1 -1
- package/vendor/core/dist/reserved.js +6 -4
- package/vendor/core/dist/tool-result.d.ts +8 -0
- package/vendor/core/dist/tool-result.js +61 -0
- package/vendor/core/dist/utils/diagnostic-scrubber.js +1 -1
- package/vendor/core/dist/worker/auth.js +4 -0
- package/vendor/core/package.json +16 -1
- package/vendor/views/dist/api.d.ts +290 -0
- package/vendor/views/dist/api.js +714 -0
- package/vendor/views/dist/bridge.d.ts +157 -0
- package/vendor/views/dist/bridge.js +372 -0
- package/vendor/views/dist/components.d.ts +172 -0
- package/vendor/views/dist/components.js +376 -0
- package/vendor/views/dist/index.d.ts +13 -0
- package/vendor/views/dist/index.js +3 -0
- package/vendor/views/dist/native.d.ts +327 -0
- package/vendor/views/dist/native.js +57 -0
- package/vendor/views/package.json +53 -0
- /package/vendor/cli/dist/vendor/ora/{.bun-tag-fde20e9a6df212fa → .bun-tag-77bb9b258a474a18} +0 -0
- /package/vendor/ora/{.bun-tag-fde20e9a6df212fa → .bun-tag-77bb9b258a474a18} +0 -0
- /package/vendor/postgres/{.bun-tag-22d644c2873790db → .bun-tag-c81dacd34e959a7a} +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client spans for outbound `fetch`, from the events Node's built-in undici
|
|
3
|
+
* publishes on `diagnostics_channel`. No monkey-patching: the channels exist
|
|
4
|
+
* whether or not anyone listens, and an unsubscribed channel costs nothing.
|
|
5
|
+
*
|
|
6
|
+
* A span records method, host and a parameterized path (no query string, ids
|
|
7
|
+
* replaced), the response status and duration. A span is recorded only
|
|
8
|
+
* under an active span, so a call joins the trace of the work that made it; a
|
|
9
|
+
* background fetch with no surrounding work would only add a stray root trace
|
|
10
|
+
* per call. Upstream 5xx responses and
|
|
11
|
+
* transport failures are recorded as dependency errors; a 4xx is often an
|
|
12
|
+
* expected answer, so it is kept as an attribute rather than an error.
|
|
13
|
+
*/
|
|
14
|
+
import type { Span, Tracer } from "@opentelemetry/api";
|
|
15
|
+
export declare function instrumentFetch(options: {
|
|
16
|
+
tracer: () => Tracer | null;
|
|
17
|
+
recordError: (span: Span, error: unknown) => void;
|
|
18
|
+
}): void;
|
|
19
|
+
//# sourceMappingURL=otel-fetch.d.ts.map
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Client spans for outbound `fetch`, from the events Node's built-in undici
|
|
4
|
+
* publishes on `diagnostics_channel`. No monkey-patching: the channels exist
|
|
5
|
+
* whether or not anyone listens, and an unsubscribed channel costs nothing.
|
|
6
|
+
*
|
|
7
|
+
* A span records method, host and a parameterized path (no query string, ids
|
|
8
|
+
* replaced), the response status and duration. A span is recorded only
|
|
9
|
+
* under an active span, so a call joins the trace of the work that made it; a
|
|
10
|
+
* background fetch with no surrounding work would only add a stray root trace
|
|
11
|
+
* per call. Upstream 5xx responses and
|
|
12
|
+
* transport failures are recorded as dependency errors; a 4xx is often an
|
|
13
|
+
* expected answer, so it is kept as an attribute rather than an error.
|
|
14
|
+
*/
|
|
15
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
16
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.instrumentFetch = instrumentFetch;
|
|
20
|
+
const node_diagnostics_channel_1 = __importDefault(require("node:diagnostics_channel"));
|
|
21
|
+
const api_1 = require("@opentelemetry/api");
|
|
22
|
+
const error_report_1 = require("./error-report");
|
|
23
|
+
const spans = new WeakMap();
|
|
24
|
+
let subscribed = false;
|
|
25
|
+
let activeTracer = () => null;
|
|
26
|
+
let recordFailure = null;
|
|
27
|
+
function pathTemplate(path) {
|
|
28
|
+
const bare = (path ?? "/").split("?")[0] || "/";
|
|
29
|
+
return (0, error_report_1.parameterizeMessage)(bare).replace(/\s+/g, "");
|
|
30
|
+
}
|
|
31
|
+
function host(origin) {
|
|
32
|
+
if (!origin)
|
|
33
|
+
return "unknown";
|
|
34
|
+
try {
|
|
35
|
+
return new URL(origin).host;
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return "unknown";
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function instrumentFetch(options) {
|
|
42
|
+
activeTracer = options.tracer;
|
|
43
|
+
recordFailure = options.recordError;
|
|
44
|
+
if (subscribed)
|
|
45
|
+
return;
|
|
46
|
+
subscribed = true;
|
|
47
|
+
node_diagnostics_channel_1.default.subscribe("undici:request:create", (message) => {
|
|
48
|
+
const { request } = message;
|
|
49
|
+
const tracer = activeTracer();
|
|
50
|
+
if (!tracer || !request || !api_1.trace.getSpan(api_1.context.active()))
|
|
51
|
+
return;
|
|
52
|
+
const method = (request.method ?? "GET").toUpperCase();
|
|
53
|
+
const address = host(request.origin);
|
|
54
|
+
const span = tracer.startSpan(`HTTP ${method} ${address}`, {
|
|
55
|
+
kind: api_1.SpanKind.CLIENT,
|
|
56
|
+
attributes: {
|
|
57
|
+
"http.request.method": method,
|
|
58
|
+
"server.address": address,
|
|
59
|
+
"url.template": pathTemplate(request.path),
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
spans.set(request, span);
|
|
63
|
+
});
|
|
64
|
+
node_diagnostics_channel_1.default.subscribe("undici:request:headers", (message) => {
|
|
65
|
+
const { request, response } = message;
|
|
66
|
+
const span = spans.get(request);
|
|
67
|
+
if (!span || typeof response?.statusCode !== "number")
|
|
68
|
+
return;
|
|
69
|
+
span.setAttribute("http.response.status_code", response.statusCode);
|
|
70
|
+
if (response.statusCode >= 500) {
|
|
71
|
+
recordFailure?.(span, {
|
|
72
|
+
name: "UpstreamHttpError",
|
|
73
|
+
message: `HTTP ${response.statusCode}`,
|
|
74
|
+
code: "UPSTREAM_5XX",
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
node_diagnostics_channel_1.default.subscribe("undici:request:trailers", (message) => {
|
|
79
|
+
const { request } = message;
|
|
80
|
+
const span = spans.get(request);
|
|
81
|
+
if (!span)
|
|
82
|
+
return;
|
|
83
|
+
spans.delete(request);
|
|
84
|
+
span.end();
|
|
85
|
+
});
|
|
86
|
+
node_diagnostics_channel_1.default.subscribe("undici:request:error", (message) => {
|
|
87
|
+
const { request, error } = message;
|
|
88
|
+
const span = spans.get(request);
|
|
89
|
+
if (!span)
|
|
90
|
+
return;
|
|
91
|
+
spans.delete(request);
|
|
92
|
+
recordFailure?.(span, error);
|
|
93
|
+
span.end();
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=otel-fetch.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Span, Tracer } from "@opentelemetry/api";
|
|
2
2
|
import { SpanKind, SpanStatusCode } from "@opentelemetry/api";
|
|
3
3
|
import type { SpanProcessor } from "@opentelemetry/sdk-trace-node";
|
|
4
|
+
import { type DescribeErrorOptions } from "./error-report";
|
|
4
5
|
export interface OtelConfig {
|
|
5
6
|
serviceName: string;
|
|
6
7
|
serviceVersion?: string;
|
|
@@ -21,6 +22,14 @@ export declare function getTracer(): Tracer | null;
|
|
|
21
22
|
export declare function shutdownTracing(timeoutMs?: number): Promise<void>;
|
|
22
23
|
export declare function flushTracing(): Promise<void>;
|
|
23
24
|
export declare function createSpan(name: string, attributes?: Record<string, string | number | boolean>, kind?: SpanKind): Span | null;
|
|
25
|
+
/**
|
|
26
|
+
* Mark a span failed and attach its grouped error report: exception type,
|
|
27
|
+
* parameterized message, frame-only stack, kind and fingerprint. The raw
|
|
28
|
+
* message is never recorded, because it can carry credentials or source data.
|
|
29
|
+
* `scope` defaults to the span's name; pass it when the span was not the
|
|
30
|
+
* reporting boundary.
|
|
31
|
+
*/
|
|
32
|
+
export declare function recordError(span: Span | null | undefined, error: unknown, options?: Partial<DescribeErrorOptions>): void;
|
|
24
33
|
export declare function withSpan<T>(name: string, fn: (span: Span | null) => Promise<T>, attributes?: Record<string, string | number | boolean>): Promise<T>;
|
|
25
34
|
export declare function getCurrentSpan(): Span | undefined;
|
|
26
35
|
/** Run `fn` with `span` active, or plainly when tracing produced no span. */
|
package/vendor/core/dist/otel.js
CHANGED
|
@@ -6,6 +6,7 @@ exports.getTracer = getTracer;
|
|
|
6
6
|
exports.shutdownTracing = shutdownTracing;
|
|
7
7
|
exports.flushTracing = flushTracing;
|
|
8
8
|
exports.createSpan = createSpan;
|
|
9
|
+
exports.recordError = recordError;
|
|
9
10
|
exports.withSpan = withSpan;
|
|
10
11
|
exports.getCurrentSpan = getCurrentSpan;
|
|
11
12
|
exports.runInSpanContext = runInSpanContext;
|
|
@@ -16,7 +17,9 @@ exports.getTraceparent = getTraceparent;
|
|
|
16
17
|
const api_1 = require("@opentelemetry/api");
|
|
17
18
|
Object.defineProperty(exports, "SpanKind", { enumerable: true, get: function () { return api_1.SpanKind; } });
|
|
18
19
|
Object.defineProperty(exports, "SpanStatusCode", { enumerable: true, get: function () { return api_1.SpanStatusCode; } });
|
|
20
|
+
const error_report_1 = require("./error-report");
|
|
19
21
|
const logger_1 = require("./logger");
|
|
22
|
+
const otel_fetch_1 = require("./otel-fetch");
|
|
20
23
|
const trace_context_1 = require("./trace-context");
|
|
21
24
|
const logger = (0, logger_1.createLogger)("otel");
|
|
22
25
|
let provider = null;
|
|
@@ -91,6 +94,10 @@ function initTracing(config) {
|
|
|
91
94
|
// globally registered provider, so a later init would otherwise export
|
|
92
95
|
// into a provider this call does not own.
|
|
93
96
|
tracer = provider.getTracer(config.serviceName, config.serviceVersion);
|
|
97
|
+
(0, otel_fetch_1.instrumentFetch)({
|
|
98
|
+
tracer: () => tracer,
|
|
99
|
+
recordError: (span, error) => recordError(span, error, { kind: "dependency" }),
|
|
100
|
+
});
|
|
94
101
|
logger.info(useCustomProcessors
|
|
95
102
|
? `Tracing initialized: ${config.serviceName} (custom span processors)`
|
|
96
103
|
: `Tracing initialized: ${config.serviceName} -> ${config.otlpEndpoint}`);
|
|
@@ -140,6 +147,26 @@ function createSpan(name, attributes, kind = api_1.SpanKind.INTERNAL) {
|
|
|
140
147
|
});
|
|
141
148
|
return span;
|
|
142
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* Mark a span failed and attach its grouped error report: exception type,
|
|
152
|
+
* parameterized message, frame-only stack, kind and fingerprint. The raw
|
|
153
|
+
* message is never recorded, because it can carry credentials or source data.
|
|
154
|
+
* `scope` defaults to the span's name; pass it when the span was not the
|
|
155
|
+
* reporting boundary.
|
|
156
|
+
*/
|
|
157
|
+
function recordError(span, error, options = {}) {
|
|
158
|
+
if (!span)
|
|
159
|
+
return;
|
|
160
|
+
const name = span.name;
|
|
161
|
+
const report = (0, error_report_1.describeError)(error, {
|
|
162
|
+
scope: options.scope ?? (typeof name === "string" ? name : "span"),
|
|
163
|
+
...(options.kind ? { kind: options.kind } : {}),
|
|
164
|
+
});
|
|
165
|
+
const attributes = (0, error_report_1.errorReportAttributes)(report);
|
|
166
|
+
span.setAttributes(attributes);
|
|
167
|
+
span.addEvent("exception", attributes);
|
|
168
|
+
span.setStatus({ code: api_1.SpanStatusCode.ERROR, message: report.message });
|
|
169
|
+
}
|
|
143
170
|
async function runInSpan(span, fn) {
|
|
144
171
|
try {
|
|
145
172
|
const result = await fn(span);
|
|
@@ -147,13 +174,7 @@ async function runInSpan(span, fn) {
|
|
|
147
174
|
return result;
|
|
148
175
|
}
|
|
149
176
|
catch (error) {
|
|
150
|
-
|
|
151
|
-
span.setStatus({
|
|
152
|
-
code: api_1.SpanStatusCode.ERROR,
|
|
153
|
-
message: error instanceof Error ? error.message : String(error),
|
|
154
|
-
});
|
|
155
|
-
span.recordException(error);
|
|
156
|
-
}
|
|
177
|
+
recordError(span, error);
|
|
157
178
|
throw error;
|
|
158
179
|
}
|
|
159
180
|
finally {
|
|
@@ -38,7 +38,7 @@ export declare const RESERVED_PATHS_SET: ReadonlySet<string>;
|
|
|
38
38
|
* product words that are not knowledge types. Create-time hygiene only — not
|
|
39
39
|
* hide/prune policy (that is `$` prefix only).
|
|
40
40
|
*/
|
|
41
|
-
export declare const RESERVED_ENTITY_TYPE_SLUGS: readonly ["activity", "agents", "connectors", "data", "memory", "members", "settings", "events", "automations", "connections", "sources", "environments", "infrastructure", "inference-providers", "devices", "entity-types", "recent", "chat", "-", "organization", "user", "automation", "content", "source", "connector"];
|
|
41
|
+
export declare const RESERVED_ENTITY_TYPE_SLUGS: readonly ["activity", "agents", "connectors", "data", "memory", "members", "settings", "events", "automations", "connections", "sources", "environments", "infrastructure", "inference-providers", "devices", "entity-types", "recent", "chat", "views", "-", "organization", "user", "automation", "content", "source", "connector"];
|
|
42
42
|
/**
|
|
43
43
|
* Whether a proposed entity-type slug is illegal for user/API create.
|
|
44
44
|
* `$…` is reserved for platform-named types ($member, $resource).
|
|
@@ -113,15 +113,17 @@ exports.RESERVED_ENTITY_TYPE_SLUGS = [
|
|
|
113
113
|
// Live /$owner/<segment> routes that are NOT owner-nav segments (so they are
|
|
114
114
|
// absent from OWNER_ROUTE_SEGMENTS). Entity pages render through the
|
|
115
115
|
// `/$owner/$` splat, which a static segment always outranks, so an entity
|
|
116
|
-
// type with one of these slugs is permanently shadowed: `recent`
|
|
117
|
-
// list page to /$owner/recent
|
|
118
|
-
//
|
|
119
|
-
// /$owner/
|
|
116
|
+
// type with one of these slugs is permanently shadowed: `recent` and `chat`
|
|
117
|
+
// lose their list page to the /$owner/recent and /$owner/chat index routes,
|
|
118
|
+
// while `entity-types` and `views` have no index route and instead lose
|
|
119
|
+
// every detail page to /$owner/entity-types/$slug and
|
|
120
|
+
// /$owner/views/$view. Create-time hygiene only — deliberately not added to
|
|
120
121
|
// OWNER_ROUTE_SEGMENTS, which also feeds the SPA's entity-splat routing
|
|
121
122
|
// guard and would break any existing entity type already using the slug.
|
|
122
123
|
"entity-types",
|
|
123
124
|
"recent",
|
|
124
125
|
"chat",
|
|
126
|
+
"views",
|
|
125
127
|
// The web host's view marker (`/<type>/-/views/<key>`): a type stored as `-`
|
|
126
128
|
// would make its own list page parse as a view path.
|
|
127
129
|
view_path_1.VIEW_PATH_MARKER,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Recognize accepted approvals without treating them as completed writes. */
|
|
2
|
+
export declare function isPendingToolApproval(value: unknown): boolean;
|
|
3
|
+
/** Interpret legacy application result values; protocol errors stay with their transport. */
|
|
4
|
+
export declare function getToolResultFailure(actionName: string, value: unknown): {
|
|
5
|
+
message: string;
|
|
6
|
+
result: Record<string, unknown>;
|
|
7
|
+
} | null;
|
|
8
|
+
//# sourceMappingURL=tool-result.d.ts.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isPendingToolApproval = isPendingToolApproval;
|
|
4
|
+
exports.getToolResultFailure = getToolResultFailure;
|
|
5
|
+
/** Recognize accepted approvals without treating them as completed writes. */
|
|
6
|
+
function isPendingToolApproval(value) {
|
|
7
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
8
|
+
return false;
|
|
9
|
+
const result = value;
|
|
10
|
+
return (result.status === "pending_approval" || result.approval_queued === true);
|
|
11
|
+
}
|
|
12
|
+
/** Interpret legacy application result values; protocol errors stay with their transport. */
|
|
13
|
+
function getToolResultFailure(actionName, value) {
|
|
14
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
15
|
+
return null;
|
|
16
|
+
const result = value;
|
|
17
|
+
const hasError = result.error !== undefined && result.error !== null;
|
|
18
|
+
const summary = result.summary &&
|
|
19
|
+
typeof result.summary === "object" &&
|
|
20
|
+
!Array.isArray(result.summary)
|
|
21
|
+
? result.summary
|
|
22
|
+
: null;
|
|
23
|
+
const allAggregateItemsFailed = typeof summary?.failed === "number" &&
|
|
24
|
+
summary.failed > 0 &&
|
|
25
|
+
summary.successful === 0;
|
|
26
|
+
// Some mutation policies return `success:false` while durably queueing an
|
|
27
|
+
// approval. That is a non-terminal accepted outcome, not a business failure;
|
|
28
|
+
// callers need its approval URL/run id to continue the workflow.
|
|
29
|
+
const acceptedForApproval = isPendingToolApproval(result);
|
|
30
|
+
const reportsFailure = !acceptedForApproval &&
|
|
31
|
+
(result.success === false ||
|
|
32
|
+
result.ok === false ||
|
|
33
|
+
result.status === "failed" ||
|
|
34
|
+
result.status === "error" ||
|
|
35
|
+
result.status === "timeout" ||
|
|
36
|
+
allAggregateItemsFailed);
|
|
37
|
+
if (!hasError && !reportsFailure)
|
|
38
|
+
return null;
|
|
39
|
+
const failedItem = Array.isArray(result.results)
|
|
40
|
+
? result.results.find((item) => item !== null &&
|
|
41
|
+
typeof item === "object" &&
|
|
42
|
+
!Array.isArray(item) &&
|
|
43
|
+
item.success === false)
|
|
44
|
+
: undefined;
|
|
45
|
+
const candidates = [
|
|
46
|
+
result.error,
|
|
47
|
+
result.error_message,
|
|
48
|
+
result.message,
|
|
49
|
+
result.reason,
|
|
50
|
+
failedItem?.error,
|
|
51
|
+
failedItem?.error_message,
|
|
52
|
+
failedItem?.message,
|
|
53
|
+
failedItem?.reason,
|
|
54
|
+
];
|
|
55
|
+
const message = candidates.find((candidate) => typeof candidate === "string" && candidate.trim().length > 0);
|
|
56
|
+
return {
|
|
57
|
+
message: message?.trim() ?? `Action '${actionName}' failed`,
|
|
58
|
+
result,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=tool-result.js.map
|
|
@@ -223,7 +223,7 @@ function isSecretObjectKey(key) {
|
|
|
223
223
|
* the value is a credential, so the whole value is replaced without
|
|
224
224
|
* inspection. Credential CONTAINERS (`hasCredentialSegment`) are deliberately
|
|
225
225
|
* excluded — their collapse rule depends on the value type (see the walk),
|
|
226
|
-
* and collapsing a map parent would destroy surviving key names
|
|
226
|
+
* and collapsing a map parent would destroy surviving key names an upstream
|
|
227
227
|
* connector pre-redacted.
|
|
228
228
|
*/
|
|
229
229
|
function isStrongSecretKey(key) {
|
|
@@ -112,6 +112,10 @@ function parsePositiveIntEnv(name, fallback, allowZero = false) {
|
|
|
112
112
|
* Verify and decrypt a worker authentication token
|
|
113
113
|
*/
|
|
114
114
|
function verifyToken(token, expectedKind) {
|
|
115
|
+
// Routes try a worker token before PAT/OAuth, so most bearers seen here are
|
|
116
|
+
// something else. Only a token in the worker envelope is a failed verify.
|
|
117
|
+
if (!looksLikeWorkerToken(token))
|
|
118
|
+
return null;
|
|
115
119
|
try {
|
|
116
120
|
const parsed = JSON.parse((0, encryption_1.decrypt)(token));
|
|
117
121
|
// Decrypted plaintext is attacker-influenced — `as` would coerce `null`,
|
package/vendor/core/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobu/core",
|
|
3
|
-
"version": "24.
|
|
3
|
+
"version": "24.6.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Core types and utilities for Lobu agent platform",
|
|
6
6
|
"repository": {
|
|
@@ -136,6 +136,11 @@
|
|
|
136
136
|
"import": "./dist/contracts/tools/view-content-hash.js",
|
|
137
137
|
"require": "./dist/contracts/tools/view-content-hash.js"
|
|
138
138
|
},
|
|
139
|
+
"./contracts/tools/manage-inference-providers": {
|
|
140
|
+
"types": "./dist/contracts/tools/manage-inference-providers.d.ts",
|
|
141
|
+
"import": "./dist/contracts/tools/manage-inference-providers.js",
|
|
142
|
+
"require": "./dist/contracts/tools/manage-inference-providers.js"
|
|
143
|
+
},
|
|
139
144
|
"./contracts/tools/manage-auth-profiles": {
|
|
140
145
|
"types": "./dist/contracts/tools/manage-auth-profiles.d.ts",
|
|
141
146
|
"import": "./dist/contracts/tools/manage-auth-profiles.js",
|
|
@@ -231,6 +236,16 @@
|
|
|
231
236
|
"import": "./dist/contracts/tools/view-definition.js",
|
|
232
237
|
"require": "./dist/contracts/tools/view-definition.js"
|
|
233
238
|
},
|
|
239
|
+
"./contracts/tools/pagination": {
|
|
240
|
+
"types": "./dist/contracts/tools/pagination.d.ts",
|
|
241
|
+
"import": "./dist/contracts/tools/pagination.js",
|
|
242
|
+
"require": "./dist/contracts/tools/pagination.js"
|
|
243
|
+
},
|
|
244
|
+
"./contracts/tools/view-host": {
|
|
245
|
+
"types": "./dist/contracts/tools/view-host.d.ts",
|
|
246
|
+
"import": "./dist/contracts/tools/view-host.js",
|
|
247
|
+
"require": "./dist/contracts/tools/view-host.js"
|
|
248
|
+
},
|
|
234
249
|
"./contracts/tools/view-runtime": {
|
|
235
250
|
"types": "./dist/contracts/tools/view-runtime.d.ts",
|
|
236
251
|
"import": "./dist/contracts/tools/view-runtime.js",
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@lobu/views` authoring surface (brief §1.4): `defineView`, `useParams`,
|
|
3
|
+
* `useScope`, `useQuery`, `useAction`, `sql`, plus the `mountView` entry the
|
|
4
|
+
* compiled bundle calls once. Thin layer over the hand-written `ViewBridge` —
|
|
5
|
+
* nothing here talks to the API directly; every read and action goes through
|
|
6
|
+
* the host as `tools/call`, every param change through
|
|
7
|
+
* `ui/update-model-context`.
|
|
8
|
+
*
|
|
9
|
+
* Contract with the host (our web host, Claude, any MCP Apps host):
|
|
10
|
+
* - `ui/notifications/tool-input` `arguments` = `{ scope, params }`
|
|
11
|
+
* (in Claude these are the `open_view` tool arguments).
|
|
12
|
+
* - reads: `query_sql`, `query_sdk`, and tools the registry marks
|
|
13
|
+
* `readOnlyHint` (`read_knowledge`, `get_automation`, `query_metric`, …);
|
|
14
|
+
* actions: `invoke_view_action`. The web host refuses every other tool, so
|
|
15
|
+
* mixed read/write tools require an explicitly admitted read action.
|
|
16
|
+
* Use structured `tool()` arguments for entity and schema reads.
|
|
17
|
+
* - `setParams` → `ui/update-model-context` `{ structuredContent: { view,
|
|
18
|
+
* params } }`; the web host mirrors it into the address bar. Hosts without
|
|
19
|
+
* that capability keep params local to the frame.
|
|
20
|
+
*
|
|
21
|
+
* Read budget: reads run on a user-facing path, when the host is ready and
|
|
22
|
+
* the query changes, `refetch()` is called, or a live query receives a host
|
|
23
|
+
* data-change notification.
|
|
24
|
+
* `query_sql` runs in a read-only, org-scoped transaction with a 5 second
|
|
25
|
+
* statement timeout and returns at most 500 rows; `useQuery` reports a hit as
|
|
26
|
+
* `errorCode: "UPSTREAM_TIMEOUT"` or `truncated: true`, so render those
|
|
27
|
+
* states instead of an empty or partial table. Each cell is bounded too
|
|
28
|
+
* (strings to a 4,000-code-point head plus a suffix, JSON values to 16 KiB);
|
|
29
|
+
* `truncatedColumns` names the columns where a returned cell was cut.
|
|
30
|
+
* Never aggregate history in a view: no `GROUP BY`, `DISTINCT ON`, per-row
|
|
31
|
+
* regexp, or leading-wildcard `LIKE` over `events` (or any other table that
|
|
32
|
+
* grows with history). History grows; the answer a view shows does not.
|
|
33
|
+
*
|
|
34
|
+
* For "latest state" views, compute state at write time. One event-based
|
|
35
|
+
* pattern is an Automation bound to the entity declaring a keyed event output
|
|
36
|
+
* (`outputs: { status: { event: "account_status", key: ["account"] } }`), so
|
|
37
|
+
* each emitted update supersedes the previous event with the same output
|
|
38
|
+
* identity. The view reads current events with `read_knowledge`
|
|
39
|
+
* (registry-marked `readOnlyHint`, so the host lets a view call it), which
|
|
40
|
+
* skips superseded rows:
|
|
41
|
+
*
|
|
42
|
+
* ```tsx
|
|
43
|
+
* const { entity } = useScope();
|
|
44
|
+
* const status = useQuery<{ content: Array<{ title: string | null;
|
|
45
|
+
* metadata: Record<string, unknown> }> }>(
|
|
46
|
+
* typeof entity === "number"
|
|
47
|
+
* ? tool("read_knowledge", { entity_id: entity,
|
|
48
|
+
* semantic_type: "account_status", sort_by: "date", limit: 1 })
|
|
49
|
+
* : null
|
|
50
|
+
* );
|
|
51
|
+
* const current = status.data?.content[0];
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
import type { CollectionSelection } from "@lobu/core/contracts/tools/collection-selection";
|
|
55
|
+
import type { EntityGetInput } from "@lobu/core/contracts/tools/manage-entity";
|
|
56
|
+
import type { ViewAttachment } from "@lobu/core/contracts/tools/manage-views";
|
|
57
|
+
import { type ReactNode } from "react";
|
|
58
|
+
import { type ToolResult, ViewBridge } from "./bridge.js";
|
|
59
|
+
export type ParamValue = string | number | boolean;
|
|
60
|
+
export type Params = Record<string, ParamValue>;
|
|
61
|
+
/**
|
|
62
|
+
* What the view is rendering. `type` on a type page, `entity` (plus its
|
|
63
|
+
* `type`) on a record page, `event` on an event's page, nothing on the Data hub.
|
|
64
|
+
*
|
|
65
|
+
* `event` is the resolved stored version supplied by the host. New actions
|
|
66
|
+
* reject a superseded version; reopening resolves the permalink again.
|
|
67
|
+
* There is no event hook: read it with the same exact-id read the event page
|
|
68
|
+
* renders. Select the supplied version from the returned lineage so the
|
|
69
|
+
* displayed content and action subject stay aligned:
|
|
70
|
+
*
|
|
71
|
+
* ```tsx
|
|
72
|
+
* export const view = defineView({
|
|
73
|
+
* key: "deal-won",
|
|
74
|
+
* attach: [{ event: "deal.won", type: "deal" }],
|
|
75
|
+
* });
|
|
76
|
+
*
|
|
77
|
+
* export default function DealWon() {
|
|
78
|
+
* const { event } = useScope();
|
|
79
|
+
* const read = useQuery<{ content: Array<{ id: number;
|
|
80
|
+
* title: string | null; metadata: Record<string, unknown> }> }>(
|
|
81
|
+
* event === undefined ? null : tool("read_knowledge", { content_ids: [event] })
|
|
82
|
+
* );
|
|
83
|
+
* const subject = read.data?.content.find((row) => row.id === event);
|
|
84
|
+
* return <h1>{subject?.title}</h1>;
|
|
85
|
+
* }
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
export interface Scope {
|
|
89
|
+
type?: string;
|
|
90
|
+
entity?: number | string;
|
|
91
|
+
event?: number;
|
|
92
|
+
/** Shared collection selection; absent on record, event and workspace pages.
|
|
93
|
+
* Pass search/filters/segment to entities.list alongside entity_type: type.
|
|
94
|
+
* Host selection does not replace view-specific sort/layout params. */
|
|
95
|
+
collection?: CollectionSelection;
|
|
96
|
+
}
|
|
97
|
+
export interface ParamDef {
|
|
98
|
+
type: "string" | "number" | "boolean";
|
|
99
|
+
default?: ParamValue;
|
|
100
|
+
/** Offer this param in the host's filter bar: a set value shows as a chip
|
|
101
|
+
* above the view, and picking one updates the param. Options make it a
|
|
102
|
+
* pick list; without them the host asks for a value of the param's type. */
|
|
103
|
+
filter?: {
|
|
104
|
+
label: string;
|
|
105
|
+
options?: Array<{
|
|
106
|
+
value: ParamValue;
|
|
107
|
+
label: string;
|
|
108
|
+
}>;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Where a view appears: one page per entry.
|
|
113
|
+
*
|
|
114
|
+
* - `{ record: "deal" }` — a card on every deal's page, above its activity;
|
|
115
|
+
* `{ record: "deal", id: 7 }` pins it to one record. The card renders
|
|
116
|
+
* `inline`; "See all" (`requestDisplayMode("fullscreen")`) or the card's
|
|
117
|
+
* Open shows the same view fullscreen in the peek.
|
|
118
|
+
* - `{ collection: "deal", when? }` — a tab on the deal list page. `when`
|
|
119
|
+
* equalities must all be present in scope.collection.filters; they control
|
|
120
|
+
* discoverability, never authorization.
|
|
121
|
+
* - `{ workspace: true }` — a tab on the Data hub.
|
|
122
|
+
* - `{ event: "deal.won", type? }` — one event's page, optionally only when
|
|
123
|
+
* the event links an entity of `type`.
|
|
124
|
+
*/
|
|
125
|
+
export type Attachment = ViewAttachment;
|
|
126
|
+
/** How the host is showing the view: a card in a page (`inline`) or the
|
|
127
|
+
* view's own surface (`fullscreen`: the peek, a full page, a tab). */
|
|
128
|
+
export type DisplayMode = "inline" | "fullscreen";
|
|
129
|
+
/** The space the host gives the frame. Width is fixed or capped; an inline
|
|
130
|
+
* card's `maxHeight` is the height budget past which the host clips. */
|
|
131
|
+
export interface Container {
|
|
132
|
+
width?: number;
|
|
133
|
+
maxWidth?: number;
|
|
134
|
+
height?: number;
|
|
135
|
+
maxHeight?: number;
|
|
136
|
+
}
|
|
137
|
+
export interface ViewDefinition {
|
|
138
|
+
/** View key: the single namespace of keys (no `custom:` prefix). Required —
|
|
139
|
+
* it is the identity `invoke_view_action` and the shell route key on. */
|
|
140
|
+
key: string;
|
|
141
|
+
/** Display name; defaults to the key when the view is saved. */
|
|
142
|
+
name?: string;
|
|
143
|
+
description?: string;
|
|
144
|
+
/** Where the view appears. The attach line lives in the module; there are
|
|
145
|
+
* no attach/detach verbs. */
|
|
146
|
+
attach: Attachment[];
|
|
147
|
+
params?: Record<string, ParamDef>;
|
|
148
|
+
actions?: Record<string, {
|
|
149
|
+
emits: string;
|
|
150
|
+
}>;
|
|
151
|
+
}
|
|
152
|
+
export declare function defineView(def: ViewDefinition): ViewDefinition;
|
|
153
|
+
export declare function useParams(): readonly [
|
|
154
|
+
Params,
|
|
155
|
+
(patch: Partial<Params>) => void
|
|
156
|
+
];
|
|
157
|
+
export declare function useScope(): Scope;
|
|
158
|
+
export declare function useHost(): {
|
|
159
|
+
connected: boolean;
|
|
160
|
+
ready: boolean;
|
|
161
|
+
theme: "light" | "dark";
|
|
162
|
+
/**
|
|
163
|
+
* Ask the host to open `url`. A relative URL (`"deal/acme-renewal"`, a
|
|
164
|
+
* record's `<type>/<slug>`) resolves against the workspace root, so the same
|
|
165
|
+
* link works on every page and in every host; a full URL opens outside the
|
|
166
|
+
* app. The frame is sandboxed, so this is the only way a view navigates;
|
|
167
|
+
* rejects when the host declines.
|
|
168
|
+
*/
|
|
169
|
+
openLink: (url: string) => Promise<void>;
|
|
170
|
+
openRecord: (record: EntityGetInput, options?: {
|
|
171
|
+
mode?: "peek" | "page";
|
|
172
|
+
}) => Promise<{
|
|
173
|
+
mode: "peek" | "page";
|
|
174
|
+
}>;
|
|
175
|
+
/** `inline` as a card on a page, `fullscreen` as the view's own surface.
|
|
176
|
+
* Render a summary inline and the full view fullscreen. */
|
|
177
|
+
displayMode: DisplayMode;
|
|
178
|
+
container: Container;
|
|
179
|
+
/** Ask the host for another mode ("See all" → `"fullscreen"`). Resolves with
|
|
180
|
+
* the mode the host set, which stays the current one when it declines. */
|
|
181
|
+
requestDisplayMode: (mode: DisplayMode) => Promise<DisplayMode>;
|
|
182
|
+
};
|
|
183
|
+
/** The workspace root relative links resolve against: the shell's
|
|
184
|
+
* `lobu-workspace` meta, absent outside a server-rendered shell. */
|
|
185
|
+
export declare function resolveViewHref(href: string): string;
|
|
186
|
+
/**
|
|
187
|
+
* Tagged template: scalar values are rendered as escaped SQL literals,
|
|
188
|
+
* never spliced raw. Numbers must be finite, booleans map to true/false,
|
|
189
|
+
* null/undefined become NULL, strings are single-quote escaped; anything
|
|
190
|
+
* else (objects, arrays) throws rather than stringifying a blob into the
|
|
191
|
+
* query. `query_sql` takes no bind parameters, so the guest escapes and the
|
|
192
|
+
* server validates tables — server-side binding stays a one-paragraph
|
|
193
|
+
* proposal until a use case needs it.
|
|
194
|
+
*/
|
|
195
|
+
export interface SqlQuery {
|
|
196
|
+
kind: "sql";
|
|
197
|
+
text: string;
|
|
198
|
+
}
|
|
199
|
+
export declare function sql(strings: TemplateStringsArray, ...values: unknown[]): SqlQuery;
|
|
200
|
+
export declare function escapeLiteral(value: unknown): string;
|
|
201
|
+
/** Direct tool read, for a tool the registry marks `readOnlyHint`
|
|
202
|
+
* (`read_knowledge`, `get_automation`, …). The web host refuses mixed
|
|
203
|
+
* read/write tools require an explicitly admitted read action. */
|
|
204
|
+
export interface ToolQuery {
|
|
205
|
+
kind: "tool";
|
|
206
|
+
name: string;
|
|
207
|
+
args: Record<string, unknown>;
|
|
208
|
+
}
|
|
209
|
+
export declare function tool(name: string, args?: Record<string, unknown>): ToolQuery;
|
|
210
|
+
/**
|
|
211
|
+
* Read one `useQuery` result. A failed read is an error, never an empty
|
|
212
|
+
* result: `query_sql` answers a rejected statement (unknown table, bad column)
|
|
213
|
+
* with a normal result carrying `error` beside `rows: []`, and `query_sdk`
|
|
214
|
+
* reports a thrown script as `success: false` — both would otherwise render as
|
|
215
|
+
* "no rows". The server's typed code rides along as `errorCode`, and a capped
|
|
216
|
+
* result (`query_sql`'s `has_more`, `query_sdk`'s `return_truncated`) is
|
|
217
|
+
* flagged `truncated` instead of passing as the whole answer, and a
|
|
218
|
+
* `query_sql` cell bounded by its size limits is named in `truncatedColumns`.
|
|
219
|
+
*/
|
|
220
|
+
export declare function queryResult<T>(kind: "sql" | "sdk" | "tool", result: ToolResult): Pick<QueryState<T>, "data" | "error" | "errorCode" | "truncated" | "truncatedColumns">;
|
|
221
|
+
export interface QueryState<T> {
|
|
222
|
+
data: T | null;
|
|
223
|
+
error: string | null;
|
|
224
|
+
/** The server's typed code for a failed read, e.g. `UPSTREAM_TIMEOUT` when
|
|
225
|
+
* the statement ran past `query_sql`'s 5 second timeout. Branch on this,
|
|
226
|
+
* never on `error` text. Null on success or when the host gave no code. */
|
|
227
|
+
errorCode: string | null;
|
|
228
|
+
/** True when the server capped the answer: `query_sql` returns at most 500
|
|
229
|
+
* rows (fewer past its response-size ceiling) and `query_sdk` drops an
|
|
230
|
+
* oversized return value. `data` is then not the whole result. */
|
|
231
|
+
truncated: boolean;
|
|
232
|
+
/** `query_sql` columns where a returned cell was bounded: a string cut to
|
|
233
|
+
* its first 4,000 Unicode code points plus "… [truncated]", or a JSON value
|
|
234
|
+
* over 16 KiB replaced by `{ _truncated: true, bytes }` (attachments become
|
|
235
|
+
* null with attachments_truncated). Show those cells as too large, or select
|
|
236
|
+
* smaller elements or fields, e.g. `jsonb_array_elements(metadata->'items')`.
|
|
237
|
+
* Paginate as needed; each returned cell is still subject to these limits. */
|
|
238
|
+
truncatedColumns: string[];
|
|
239
|
+
loading: boolean;
|
|
240
|
+
refetch: () => void;
|
|
241
|
+
}
|
|
242
|
+
export interface QueryOptions {
|
|
243
|
+
/** Re-read in the background whenever workspace data changes (default
|
|
244
|
+
* true). Pass false for a read that reaches a remote source, such as a
|
|
245
|
+
* `feeds.readMany` search: it then runs once per query and again only on
|
|
246
|
+
* `refetch()`. */
|
|
247
|
+
live?: boolean;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Run a read through the host. `sql\`…\`` → `query_sql`; a string →
|
|
251
|
+
* `query_sdk` script; `tool(name, args)` → that tool; `null` skips. The first
|
|
252
|
+
* fetch waits for the host's first `tool-input`: reads before it run against
|
|
253
|
+
* defaults and double-fetch when the real scope lands.
|
|
254
|
+
*/
|
|
255
|
+
export declare function useQuery<T = unknown>(query: SqlQuery | ToolQuery | string | null, options?: QueryOptions): QueryState<T>;
|
|
256
|
+
export interface ActionResult {
|
|
257
|
+
ok: boolean;
|
|
258
|
+
error: string | null;
|
|
259
|
+
result: unknown;
|
|
260
|
+
/** Retry the same submission after a failed acknowledgement. A new call to
|
|
261
|
+
* useAction's function is a new intent, even when its value is identical. */
|
|
262
|
+
retry: (() => Promise<ActionResult>) | null;
|
|
263
|
+
}
|
|
264
|
+
/** Mint one id for a deliberate submission, retained by its retry closure. */
|
|
265
|
+
export declare function mintInteractionId(): string;
|
|
266
|
+
/** Submit a declared action. Failed acknowledgements expose an explicit retry
|
|
267
|
+
* that keeps the original value, event subject and interaction id. */
|
|
268
|
+
export declare function useAction(name: string): (value?: Record<string, unknown>) => Promise<ActionResult>;
|
|
269
|
+
export declare function defaultsFor(def: ViewDefinition): Params;
|
|
270
|
+
export declare function coerceParams(def: ViewDefinition, raw: unknown): Params;
|
|
271
|
+
export declare function coerceScope(raw: unknown): Scope;
|
|
272
|
+
/**
|
|
273
|
+
* Host bridge provider: seeds scope/params from the first tool-input,
|
|
274
|
+
* exposes reads/actions over tools/call, mirrors params through
|
|
275
|
+
* update-model-context. The server bootstrap renders this around the view's
|
|
276
|
+
* default export; `mountView` does the same for CLI-bundled entries.
|
|
277
|
+
*/
|
|
278
|
+
export declare function Provider({ def, bridge, children, }: {
|
|
279
|
+
def: ViewDefinition;
|
|
280
|
+
bridge?: ViewBridge;
|
|
281
|
+
children: ReactNode;
|
|
282
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
283
|
+
export interface MountOptions {
|
|
284
|
+
/** Test seam: drive the view against a fake parent instead of `window.parent`. */
|
|
285
|
+
bridge?: ViewBridge;
|
|
286
|
+
}
|
|
287
|
+
/** Entry point the compiled bundle calls once. Mounts the component into
|
|
288
|
+
* `#root` and connects to the host. */
|
|
289
|
+
export declare function mountView(def: ViewDefinition, Component: () => ReactNode, opts?: MountOptions): void;
|
|
290
|
+
//# sourceMappingURL=api.d.ts.map
|