@lobu/runtime-device 24.11.0 → 24.11.1
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/npm-shrinkwrap.json +7 -7
- package/package.json +1 -1
- package/vendor/cli/dist/bundled-skills/lobu/SKILL.md +12 -0
- package/vendor/cli/dist/commands/browser.js +22 -4
- package/vendor/cli/dist/internal/oauth.d.ts +6 -0
- package/vendor/cli/dist/internal/oauth.js +26 -3
- package/vendor/cli/dist/runtime-components.json +4 -4
- package/vendor/cli/package.json +1 -1
- package/vendor/connector-sdk/package.json +1 -1
- package/vendor/connector-worker/package.json +1 -1
- package/vendor/core/package.json +1 -1
- package/vendor/views/package.json +1 -1
package/dist/component.json
CHANGED
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobu/runtime-device",
|
|
3
|
-
"version": "24.11.
|
|
3
|
+
"version": "24.11.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@lobu/runtime-device",
|
|
9
|
-
"version": "24.11.
|
|
9
|
+
"version": "24.11.1",
|
|
10
10
|
"license": "BUSL-1.1",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@lobu/cli": "file:vendor/cli",
|
|
@@ -5278,7 +5278,7 @@
|
|
|
5278
5278
|
},
|
|
5279
5279
|
"vendor/cli": {
|
|
5280
5280
|
"name": "@lobu/cli",
|
|
5281
|
-
"version": "24.11.
|
|
5281
|
+
"version": "24.11.1",
|
|
5282
5282
|
"license": "Apache-2.0",
|
|
5283
5283
|
"dependencies": {
|
|
5284
5284
|
"@clack/prompts": "^1.2.0",
|
|
@@ -5310,7 +5310,7 @@
|
|
|
5310
5310
|
},
|
|
5311
5311
|
"vendor/connector-sdk": {
|
|
5312
5312
|
"name": "@lobu/connector-sdk",
|
|
5313
|
-
"version": "24.11.
|
|
5313
|
+
"version": "24.11.1",
|
|
5314
5314
|
"license": "BUSL-1.1",
|
|
5315
5315
|
"dependencies": {
|
|
5316
5316
|
"@lobu/core": "file:../core",
|
|
@@ -5325,7 +5325,7 @@
|
|
|
5325
5325
|
},
|
|
5326
5326
|
"vendor/connector-worker": {
|
|
5327
5327
|
"name": "@lobu/connector-worker",
|
|
5328
|
-
"version": "24.11.
|
|
5328
|
+
"version": "24.11.1",
|
|
5329
5329
|
"license": "BUSL-1.1",
|
|
5330
5330
|
"dependencies": {
|
|
5331
5331
|
"@agentclientprotocol/sdk": "1.4.0",
|
|
@@ -5350,7 +5350,7 @@
|
|
|
5350
5350
|
},
|
|
5351
5351
|
"vendor/core": {
|
|
5352
5352
|
"name": "@lobu/core",
|
|
5353
|
-
"version": "24.11.
|
|
5353
|
+
"version": "24.11.1",
|
|
5354
5354
|
"license": "Apache-2.0",
|
|
5355
5355
|
"dependencies": {
|
|
5356
5356
|
"@opentelemetry/api": "^1.9.0",
|
|
@@ -5417,7 +5417,7 @@
|
|
|
5417
5417
|
},
|
|
5418
5418
|
"vendor/views": {
|
|
5419
5419
|
"name": "@lobu/views",
|
|
5420
|
-
"version": "24.11.
|
|
5420
|
+
"version": "24.11.1",
|
|
5421
5421
|
"license": "Apache-2.0",
|
|
5422
5422
|
"dependencies": {
|
|
5423
5423
|
"@lobu/core": "file:../core"
|
package/package.json
CHANGED
|
@@ -181,6 +181,18 @@ lobu memory run search_memory '{"query":"Acme"}' --org <org-slug>
|
|
|
181
181
|
|
|
182
182
|
Use `search_memory` first when the user asks about a specific entity or workspace memory. Use `save_memory` to persist durable memory. To update existing knowledge, search first, then save with `supersedes_event_id` so the old row is tombstoned rather than deleted.
|
|
183
183
|
|
|
184
|
+
### Answering questions about a record
|
|
185
|
+
|
|
186
|
+
Recent events can contain only counters or timestamp updates; a relevant linked record may hold the investigation, decision, or outcome. Use the existing read APIs to gather that context:
|
|
187
|
+
|
|
188
|
+
1. Start with `search_memory` to resolve the record and its workspace. Discover the current signatures with `search_sdk`, then use `query_sdk` with the selected workspace's `entities.get` and `knowledge.read`. Event `entity_ids` identify records the event concerns; co-occurrence does not assert a relationship.
|
|
189
|
+
2. When relationships could answer the question, call `entities.listLinks` on the resolved record or relevant event-linked records. Use relationship type and direction to select context relevant to the question, rather than expanding every event. Keep expansion to one hop and fetch at most five distinct related records in total with `entities.get`. Bound link pages too: start with `limit: 20` and inspect at most two pages total; use the returned offset/page metadata for stored records and `next_cursor` for source-backed records. Deduplicate records by workspace, type, and ID/key. If the budget ends while more results remain, say the context is partial.
|
|
190
|
+
3. For stored event evidence in current-state questions, use live heads (`is_superseded: false`), not the first row of an exact-ID read: `content_ids` can return the supersede history before its current head. If no live head is returned, follow the returned pagination for at most two pages total, then report current evidence unavailable if it is still missing. Keep historical versions when the question asks what happened at an earlier time. An event ID identifies a stored version; a source item's stable identity is its connection/source plus `origin_id`.
|
|
191
|
+
4. Preserve the meaning and direction of each relationship. Skip `acl_managed` links for ordinary business context unless the question concerns permissions. An identity association or a shared email address does not by itself verify the same human; a shared support mailbox can represent several people. Neither proves employment or collaboration. Fetch supporting evidence when that distinction matters, and distinguish a stored assertion from a verified source fact.
|
|
192
|
+
5. Cite returned record/event URLs or source links for the answer. Treat `relationship_failures`, `record_failures`, unreadable linked records, and unfinished pages as coverage limits, not proof that no relationship or evidence exists. Respect the selected workspace and caller's access; do not switch workspaces or fall back to raw SQL to bypass a denied read. Manual claims and connector configuration ownership are not automatically supporting event evidence.
|
|
193
|
+
|
|
194
|
+
For example, when asked what happened with an issue, follow an explicitly returned investigation/task relationship and read that record's conclusion as well as the issue's recent activity. Report a stored task's conclusion as recorded context; it does not independently prove that a repair is currently deployed. This workflow reads context only; it does not create links or merge records.
|
|
195
|
+
|
|
184
196
|
## MCP Client Setup
|
|
185
197
|
|
|
186
198
|
Use the actual MCP URL for the user's runtime. Never hardcode a hosted URL unless the user explicitly asks for that instance.
|
|
@@ -8,6 +8,7 @@ import { fileURLToPath } from "node:url";
|
|
|
8
8
|
import { promisify } from "node:util";
|
|
9
9
|
import { apiUrlToGatewayOrigin, findContextByOrigin, loadContextConfig, resolveContext, } from "../internal/context.js";
|
|
10
10
|
import { getContextToken } from "../internal/credentials.js";
|
|
11
|
+
import { isTransientRefreshFailure } from "../internal/oauth.js";
|
|
11
12
|
import { deleteDeviceState, loadDeviceState, } from "../internal/device-state.js";
|
|
12
13
|
import { extractApiError, fetchWithRetry, parseJsonResponse, } from "../internal/http.js";
|
|
13
14
|
import { resolveBrowserExecutable } from "./_lib/chrome-for-testing.js";
|
|
@@ -160,7 +161,7 @@ async function deviceBearers(record) {
|
|
|
160
161
|
if (live)
|
|
161
162
|
bearers.push(live.workerApiToken);
|
|
162
163
|
if (await contextStillTargets(record)) {
|
|
163
|
-
const login = await getContextToken(record.context);
|
|
164
|
+
const login = await loginUnlessOutage(() => getContextToken(record.context), bearers.length > 0);
|
|
164
165
|
if (login)
|
|
165
166
|
bearers.push(login);
|
|
166
167
|
}
|
|
@@ -169,6 +170,23 @@ async function deviceBearers(record) {
|
|
|
169
170
|
}
|
|
170
171
|
return bearers;
|
|
171
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* The context's login, or undefined without one. A refresh that failed only
|
|
175
|
+
* because the issuer was unreachable or answered badly keeps the saved login,
|
|
176
|
+
* and yields undefined only when the caller still holds the browser's own
|
|
177
|
+
* credential; with nothing to fall back on the failure is reported as-is
|
|
178
|
+
* instead of as a missing login.
|
|
179
|
+
*/
|
|
180
|
+
async function loginUnlessOutage(resolve, canFallBack) {
|
|
181
|
+
try {
|
|
182
|
+
return (await resolve()) ?? undefined;
|
|
183
|
+
}
|
|
184
|
+
catch (error) {
|
|
185
|
+
if (canFallBack && isTransientRefreshFailure(error))
|
|
186
|
+
return undefined;
|
|
187
|
+
throw error;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
172
190
|
/**
|
|
173
191
|
* This browser's device and the bearer that listed it. A bearer that does not
|
|
174
192
|
* list it may simply belong to another account, so the device counts as
|
|
@@ -225,9 +243,9 @@ async function credentialForBrowser(record, interactive) {
|
|
|
225
243
|
throw new Error(`Context "${record.context}" no longer points at ${record.gatewayOrigin}, where browser "${record.name}" is registered. Point it back, or run \`lobu browser rm ${record.name}\` and start the browser again.`);
|
|
226
244
|
}
|
|
227
245
|
const live = await liveCredential(record);
|
|
228
|
-
const login = interactive
|
|
229
|
-
?
|
|
230
|
-
:
|
|
246
|
+
const login = await loginUnlessOutage(() => interactive
|
|
247
|
+
? requireInstallationLogin(record.context)
|
|
248
|
+
: getContextToken(record.context), live !== undefined);
|
|
231
249
|
if (!login) {
|
|
232
250
|
if (live)
|
|
233
251
|
return live;
|
|
@@ -93,6 +93,12 @@ export declare function pollDeviceToken(tokenEndpoint: string, client: Registere
|
|
|
93
93
|
export declare function refreshTokens(tokenEndpoint: string, client: RegisteredClient, refreshToken: string, options?: {
|
|
94
94
|
resource?: string;
|
|
95
95
|
}): Promise<TokenResponse | null>;
|
|
96
|
+
/**
|
|
97
|
+
* A refresh that failed without the issuer rejecting the grant (`refreshTokens`
|
|
98
|
+
* throws these instead of returning null). The saved login may work again, so
|
|
99
|
+
* a caller that holds another usable credential can serve the request with it.
|
|
100
|
+
*/
|
|
101
|
+
export declare function isTransientRefreshFailure(error: unknown): boolean;
|
|
96
102
|
export declare function fetchUserInfo(userinfoEndpoint: string, accessToken: string): Promise<UserInfo | null>;
|
|
97
103
|
/** RFC 7009 — best-effort. Network failures are intentionally swallowed. */
|
|
98
104
|
export declare function revokeToken(revocationEndpoint: string, client: RegisteredClient, token: string, hint: "access_token" | "refresh_token"): Promise<void>;
|
|
@@ -143,10 +143,30 @@ export async function refreshTokens(tokenEndpoint, client, refreshToken, options
|
|
|
143
143
|
refresh_token: refreshToken,
|
|
144
144
|
...(options.resource ? { resource: options.resource } : {}),
|
|
145
145
|
}));
|
|
146
|
-
if (!body.ok
|
|
147
|
-
|
|
146
|
+
if (!body.ok) {
|
|
147
|
+
const code = pickString(body.data, "error");
|
|
148
|
+
// Only an explicit OAuth rejection invalidates the saved grant. Transport,
|
|
149
|
+
// gateway, rate-limit and malformed-response failures say nothing about
|
|
150
|
+
// whether it can be used again; throwing keeps callers from deleting it.
|
|
151
|
+
if ((body.status === 400 || body.status === 401) &&
|
|
152
|
+
(code === "invalid_grant" ||
|
|
153
|
+
code === "invalid_client" ||
|
|
154
|
+
code === "unauthorized_client")) {
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
throw new OAuthError("refresh_failed", `Could not refresh your saved login (${body.status ? `HTTP ${body.status}` : "network unavailable"}). Your login was kept; try again shortly.`);
|
|
158
|
+
}
|
|
148
159
|
return parseTokenResponse(body.data);
|
|
149
160
|
}
|
|
161
|
+
/**
|
|
162
|
+
* A refresh that failed without the issuer rejecting the grant (`refreshTokens`
|
|
163
|
+
* throws these instead of returning null). The saved login may work again, so
|
|
164
|
+
* a caller that holds another usable credential can serve the request with it.
|
|
165
|
+
*/
|
|
166
|
+
export function isTransientRefreshFailure(error) {
|
|
167
|
+
return (error instanceof OAuthError &&
|
|
168
|
+
(error.code === "refresh_failed" || error.code === "invalid_token_response"));
|
|
169
|
+
}
|
|
150
170
|
export async function fetchUserInfo(userinfoEndpoint, accessToken) {
|
|
151
171
|
let response;
|
|
152
172
|
try {
|
|
@@ -213,7 +233,10 @@ async function postJson(url, body) {
|
|
|
213
233
|
errorMessage: `Network error: ${err.message}`,
|
|
214
234
|
};
|
|
215
235
|
}
|
|
216
|
-
const
|
|
236
|
+
const raw = await response.json().catch(() => ({}));
|
|
237
|
+
const data = raw && typeof raw === "object" && !Array.isArray(raw)
|
|
238
|
+
? raw
|
|
239
|
+
: {};
|
|
217
240
|
if (response.ok)
|
|
218
241
|
return { ok: true, status: response.status, data };
|
|
219
242
|
const errorMessage = pickString(data, "error_description") ??
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"server": "dist/server.bundle.mjs",
|
|
6
6
|
"embeddingsServer": "dist/embeddings-server.mjs"
|
|
7
7
|
},
|
|
8
|
-
"version": "24.11.
|
|
8
|
+
"version": "24.11.1",
|
|
9
9
|
"verify": "dist/verify.mjs"
|
|
10
10
|
},
|
|
11
11
|
"device": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"connector": "node_modules/@lobu/cli/dist/commands/connector.js",
|
|
17
17
|
"worker": "node_modules/@lobu/connector-worker/dist/bin.js"
|
|
18
18
|
},
|
|
19
|
-
"version": "24.11.
|
|
19
|
+
"version": "24.11.1",
|
|
20
20
|
"verify": "dist/verify.mjs"
|
|
21
21
|
},
|
|
22
22
|
"postgres": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"entries": {
|
|
25
25
|
"postgres": "dist/index.mjs"
|
|
26
26
|
},
|
|
27
|
-
"version": "24.11.
|
|
27
|
+
"version": "24.11.1",
|
|
28
28
|
"verify": "dist/verify.mjs"
|
|
29
29
|
},
|
|
30
30
|
"embeddings": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"entries": {
|
|
33
33
|
"embeddings": "dist/embeddings.js"
|
|
34
34
|
},
|
|
35
|
-
"version": "24.11.
|
|
35
|
+
"version": "24.11.1",
|
|
36
36
|
"verify": "dist/verify.mjs"
|
|
37
37
|
}
|
|
38
38
|
}
|
package/vendor/cli/package.json
CHANGED
package/vendor/core/package.json
CHANGED