@lobu/runtime-device 24.4.0 → 24.5.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 +45 -47
- package/dist/verify.mjs +1 -1
- package/npm-shrinkwrap.json +42 -58
- package/package.json +2 -2
- package/vendor/cli/dist/bundled-skills/lobu/SKILL.md +8 -2
- 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/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/postgres.ts +77 -48
- 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/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 +2 -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/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/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 +6 -1
- /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
|
@@ -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.5.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",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|