@lobu/runtime-device 23.0.0 → 24.1.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 +30 -27
- package/npm-shrinkwrap.json +131 -115
- package/package.json +2 -1
- package/vendor/cli/dist/bundled-skills/lobu/SKILL.md +73 -0
- package/vendor/cli/dist/commands/_lib/apply/apply-cmd.js +9 -11
- package/vendor/cli/dist/commands/_lib/apply/client.d.ts +3 -11
- package/vendor/cli/dist/commands/_lib/apply/client.js +3 -3
- package/vendor/cli/dist/commands/_lib/apply/desired-state.d.ts +0 -6
- package/vendor/cli/dist/commands/_lib/apply/desired-state.js +6 -15
- package/vendor/cli/dist/commands/_lib/apply/diff.js +1 -0
- package/vendor/cli/dist/commands/_lib/apply/map-config.js +8 -0
- package/vendor/cli/dist/commands/_lib/view-bundler.d.ts +2 -9
- package/vendor/cli/dist/commands/_lib/view-bundler.js +36 -119
- package/vendor/cli/dist/config/define.d.ts +8 -0
- package/vendor/cli/dist/connectors/README.md +1 -1
- package/vendor/cli/dist/connectors/linkedin-inbox-adapter.js +4 -7
- package/vendor/cli/dist/connectors/linkedin.ts +53 -34
- package/vendor/cli/dist/connectors/reddit.ts +92 -20
- package/vendor/cli/dist/connectors/slack.ts +1 -0
- package/vendor/cli/dist/connectors/whatsapp-web-adapter.js +41 -11
- package/vendor/cli/dist/connectors/whatsapp-web-helpers.ts +1 -1
- package/vendor/cli/dist/connectors/whatsapp_web.ts +2 -2
- package/vendor/cli/dist/connectors/x-dm-adapter.js +65 -30
- package/vendor/cli/dist/connectors/x-identity.ts +5 -3
- package/vendor/cli/dist/runtime-components.json +4 -4
- package/vendor/cli/dist/templates/AGENTS.md.tmpl +10 -3
- package/vendor/cli/package.json +1 -1
- package/vendor/connector-sdk/package.json +1 -1
- package/vendor/connector-worker/dist/agent-turn/gateway-tools.d.ts +2 -2
- package/vendor/connector-worker/dist/agent-turn/gateway-tools.js +2 -2
- package/vendor/connector-worker/dist/agent-turn/guest-entry.js +34 -2
- package/vendor/connector-worker/dist/agent-turn/guest.bundle.js +362 -300
- package/vendor/connector-worker/dist/agent-turn/native-session.d.ts +12 -0
- package/vendor/connector-worker/dist/agent-turn/native-session.js +32 -6
- package/vendor/connector-worker/dist/agent-turn/types.d.ts +24 -3
- package/vendor/connector-worker/dist/daemon/agent-turn.js +5 -1
- package/vendor/connector-worker/dist/daemon/automation-acp.js +23 -11
- package/vendor/connector-worker/dist/daemon/automation.js +20 -15
- package/vendor/connector-worker/dist/isolate/prelude.js +93 -44
- package/vendor/connector-worker/package.json +1 -1
- package/vendor/core/dist/agent-policy.js +0 -3
- package/vendor/core/dist/agent-tooling.d.ts +1 -1
- package/vendor/core/dist/agent-tooling.js +3 -1
- package/vendor/core/dist/contracts/agent-settings.d.ts +6 -2
- package/vendor/core/dist/contracts/agent-settings.js +12 -1
- package/vendor/core/dist/contracts/tools/manage-views.d.ts +53 -234
- package/vendor/core/dist/contracts/tools/manage-views.js +50 -76
- package/vendor/core/dist/contracts/tools/view-attach.d.ts +5 -8
- package/vendor/core/dist/contracts/tools/view-attach.js +14 -31
- package/vendor/core/dist/contracts/tools/view-definition.d.ts +21 -0
- package/vendor/core/dist/contracts/tools/view-definition.js +165 -0
- package/vendor/core/dist/contracts/tools/view-runtime.d.ts +74 -0
- package/vendor/core/dist/contracts/tools/view-runtime.js +86 -0
- package/vendor/core/dist/contracts/worker/protocol.d.ts +39 -2
- package/vendor/core/dist/contracts/worker/protocol.js +24 -1
- package/vendor/core/dist/index.d.ts +1 -1
- package/vendor/core/dist/index.js +2 -1
- package/vendor/core/dist/suggestions.d.ts +15 -2
- package/vendor/core/dist/suggestions.js +48 -3
- package/vendor/core/dist/types.d.ts +26 -0
- package/vendor/core/dist/types.js +5 -0
- package/vendor/core/package.json +16 -5
- package/vendor/postgres/cf/src/connection.js +18 -0
- package/vendor/postgres/cjs/src/connection.js +18 -0
- package/vendor/postgres/src/connection.js +18 -0
- /package/vendor/postgres/{.bun-tag-f39dafdb2305d504 → .bun-tag-2f292c6554a8475e} +0 -0
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
* `@lobu/core` import here.
|
|
10
10
|
*/
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.SUGGESTION_LIMITS = void 0;
|
|
12
|
+
exports.FOLLOW_UP_SUGGESTIONS_PROMPT = exports.SUGGESTION_LIMITS = void 0;
|
|
13
13
|
exports.sanitizeSuggestionPrompts = sanitizeSuggestionPrompts;
|
|
14
|
+
exports.parseFollowUpSuggestions = parseFollowUpSuggestions;
|
|
14
15
|
/** Limits enforced wherever suggestions enter or leave durable storage.
|
|
15
16
|
* `maxTitleChars` counts UTF-16 code units, matching how Slack measures its
|
|
16
17
|
* 75-char button-text cap (the tightest limit a title reaches on a surface this
|
|
@@ -28,8 +29,8 @@ exports.SUGGESTION_LIMITS = {
|
|
|
28
29
|
* Normalize an untrusted `prompts` value into at most {@link SUGGESTION_LIMITS}
|
|
29
30
|
* valid `{title,message}` entries. Trims BEFORE capping length (so leading
|
|
30
31
|
* whitespace can't yield an empty displayed title), drops malformed/empty
|
|
31
|
-
* entries, and returns `[]` for any non-array input. Shared by the
|
|
32
|
-
* and
|
|
32
|
+
* entries, and returns `[]` for any non-array input. Shared by the worker
|
|
33
|
+
* and completion route so the worker (untrusted) and the server enforce one
|
|
33
34
|
* identical contract.
|
|
34
35
|
*/
|
|
35
36
|
function sanitizeSuggestionPrompts(value) {
|
|
@@ -59,6 +60,50 @@ function sanitizeSuggestionPrompts(value) {
|
|
|
59
60
|
}
|
|
60
61
|
return out;
|
|
61
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* The follow-up question asked after a human-facing turn's reply, on the same
|
|
65
|
+
* session and model that wrote it. Asked as a side request — never appended to
|
|
66
|
+
* the conversation — so the model can use the user's language and preferences
|
|
67
|
+
* retained in its current context. Reusing the prefix enables prompt caching.
|
|
68
|
+
*/
|
|
69
|
+
exports.FOLLOW_UP_SUGGESTIONS_PROMPT = [
|
|
70
|
+
"Before the user replies: decide whether your last reply needs follow-up action chips the user can tap.",
|
|
71
|
+
'Default to {"prompts":[]} when your reply leaves nothing open.',
|
|
72
|
+
'If your reply offers concrete next steps ("If you want, I can …", "Want me to …?"), turn up to three distinct offers into chips.',
|
|
73
|
+
"Otherwise offer a chip only for a concrete next step your reply leaves open that would help the user proceed.",
|
|
74
|
+
"Return no suggestions for routine answers, acknowledgements, corrections, a finished request with nothing left open, a question the user must answer in their own words, or a reply that closes the topic, and none at all if the user asked for no suggestions.",
|
|
75
|
+
"Do not invent extra work or add a generic offer to explore further.",
|
|
76
|
+
"When useful next steps remain, return 1-3 distinct actions. A single useful action is enough; never pad the list.",
|
|
77
|
+
"",
|
|
78
|
+
'Each item is {"title","message"}:',
|
|
79
|
+
'- "title": a short tappable label, at most 20 characters.',
|
|
80
|
+
'- "message": the full message sent verbatim AS THE USER if tapped.',
|
|
81
|
+
"",
|
|
82
|
+
"Write both in the language the user writes in. Write `message` in the user's voice, as a request to you:",
|
|
83
|
+
' good: "Show me the diff" bad: "I can show you the diff"',
|
|
84
|
+
'Do not call any tool. Reply with STRICT JSON {"prompts":[{"title":"...","message":"..."}]} and nothing else.',
|
|
85
|
+
].join("\n");
|
|
86
|
+
/**
|
|
87
|
+
* The chips in a reply to {@link FOLLOW_UP_SUGGESTIONS_PROMPT}, sanitized.
|
|
88
|
+
* Tolerates a markdown fence or prose around the object by parsing from the
|
|
89
|
+
* first `{` to the last `}`; anything unparseable is no suggestions.
|
|
90
|
+
*/
|
|
91
|
+
function parseFollowUpSuggestions(reply) {
|
|
92
|
+
const start = reply.indexOf("{");
|
|
93
|
+
const end = reply.lastIndexOf("}");
|
|
94
|
+
if (start < 0 || end <= start)
|
|
95
|
+
return [];
|
|
96
|
+
let parsed;
|
|
97
|
+
try {
|
|
98
|
+
parsed = JSON.parse(reply.slice(start, end + 1));
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
return [];
|
|
102
|
+
}
|
|
103
|
+
if (!parsed || typeof parsed !== "object")
|
|
104
|
+
return [];
|
|
105
|
+
return sanitizeSuggestionPrompts(parsed.prompts);
|
|
106
|
+
}
|
|
62
107
|
/**
|
|
63
108
|
* Truncate to at most `maxUnits` UTF-16 code units without splitting a
|
|
64
109
|
* surrogate pair. Counting code POINTS would undercount against platform caps
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SecretRef } from "./secret-refs";
|
|
2
|
+
import type { SuggestedPrompt } from "./suggestions";
|
|
2
3
|
/**
|
|
3
4
|
* Unified authentication profile for any model provider.
|
|
4
5
|
* Persisted per-(userId, agentId) by the gateway's UserAuthProfileStore;
|
|
@@ -30,9 +31,23 @@ export interface AuthProfile {
|
|
|
30
31
|
/** Durable secret reference for the refresh token. */
|
|
31
32
|
refreshTokenRef?: SecretRef;
|
|
32
33
|
accountId?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Refresh suspension set by the token-refresh job when the provider
|
|
36
|
+
* reports the grant itself is dead (`invalid_grant`). Suspended profiles
|
|
37
|
+
* are excluded from token refresh and credential selection until the user
|
|
38
|
+
* reconnects, which writes fresh metadata without this field.
|
|
39
|
+
*/
|
|
40
|
+
refreshSuspended?: {
|
|
41
|
+
/** Provider OAuth error code that killed the grant. */
|
|
42
|
+
code: string;
|
|
43
|
+
/** Epoch ms when the suspension was recorded. */
|
|
44
|
+
at: number;
|
|
45
|
+
};
|
|
33
46
|
};
|
|
34
47
|
createdAt: number;
|
|
35
48
|
}
|
|
49
|
+
/** True when the token-refresh job suspended this profile's grant as dead. */
|
|
50
|
+
export declare function isRefreshSuspended(profile: AuthProfile): boolean;
|
|
36
51
|
/** True if the profile has any credential source (resolved or ref). */
|
|
37
52
|
export declare function hasCredentialSource(profile: AuthProfile): boolean;
|
|
38
53
|
/**
|
|
@@ -234,6 +249,17 @@ export interface ThreadResponsePayload {
|
|
|
234
249
|
* duplicate of the reply and must always surface.
|
|
235
250
|
*/
|
|
236
251
|
repliedInBand?: boolean;
|
|
252
|
+
/**
|
|
253
|
+
* Follow-up chips for this reply, proposed by the model that wrote it. Set
|
|
254
|
+
* only on the COMPLETION row; delivered with the reply once output
|
|
255
|
+
* guardrails pass.
|
|
256
|
+
*/
|
|
257
|
+
suggestions?: SuggestedPrompt[];
|
|
258
|
+
/**
|
|
259
|
+
* The agent_turn `runs.id` that produced this terminal row. Orders a late
|
|
260
|
+
* terminal against newer turns of the same conversation.
|
|
261
|
+
*/
|
|
262
|
+
turnRunId?: number;
|
|
237
263
|
/**
|
|
238
264
|
* Raw error message. When provider context is available, the gateway labels
|
|
239
265
|
* the source and unwraps the common JSON message envelope without rewording
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SUGGESTION_LIMITS = exports.sanitizeSuggestionPrompts = void 0;
|
|
4
|
+
exports.isRefreshSuspended = isRefreshSuspended;
|
|
4
5
|
exports.hasCredentialSource = hasCredentialSource;
|
|
6
|
+
/** True when the token-refresh job suspended this profile's grant as dead. */
|
|
7
|
+
function isRefreshSuspended(profile) {
|
|
8
|
+
return Boolean(profile.metadata?.refreshSuspended);
|
|
9
|
+
}
|
|
5
10
|
/** True if the profile has any credential source (resolved or ref). */
|
|
6
11
|
function hasCredentialSource(profile) {
|
|
7
12
|
return Boolean(profile.credential || profile.credentialRef);
|
package/vendor/core/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobu/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "24.1.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Core types and utilities for Lobu agent platform",
|
|
6
6
|
"repository": {
|
|
@@ -221,6 +221,16 @@
|
|
|
221
221
|
"import": "./dist/contracts/tools/view-attach.js",
|
|
222
222
|
"require": "./dist/contracts/tools/view-attach.js"
|
|
223
223
|
},
|
|
224
|
+
"./contracts/tools/view-definition": {
|
|
225
|
+
"types": "./dist/contracts/tools/view-definition.d.ts",
|
|
226
|
+
"import": "./dist/contracts/tools/view-definition.js",
|
|
227
|
+
"require": "./dist/contracts/tools/view-definition.js"
|
|
228
|
+
},
|
|
229
|
+
"./contracts/tools/view-runtime": {
|
|
230
|
+
"types": "./dist/contracts/tools/view-runtime.d.ts",
|
|
231
|
+
"import": "./dist/contracts/tools/view-runtime.js",
|
|
232
|
+
"require": "./dist/contracts/tools/view-runtime.js"
|
|
233
|
+
},
|
|
224
234
|
"./contracts/tools/view-path": {
|
|
225
235
|
"types": "./dist/contracts/tools/view-path.d.ts",
|
|
226
236
|
"import": "./dist/contracts/tools/view-path.js",
|
|
@@ -233,14 +243,15 @@
|
|
|
233
243
|
}
|
|
234
244
|
},
|
|
235
245
|
"dependencies": {
|
|
236
|
-
"@sinclair/typebox": "^0.34.41",
|
|
237
|
-
"ajv": "^8.17.1",
|
|
238
|
-
"ajv-formats": "^3.0.1",
|
|
239
246
|
"@opentelemetry/api": "^1.9.0",
|
|
240
|
-
"@opentelemetry/sdk-trace-node": "^2.11.0",
|
|
241
247
|
"@opentelemetry/exporter-trace-otlp-grpc": "^0.222.0",
|
|
242
248
|
"@opentelemetry/resources": "^2.11.0",
|
|
249
|
+
"@opentelemetry/sdk-trace-node": "^2.11.0",
|
|
243
250
|
"@opentelemetry/semantic-conventions": "^1.28.0",
|
|
251
|
+
"@sinclair/typebox": "^0.34.41",
|
|
252
|
+
"acorn": "^8.16.0",
|
|
253
|
+
"ajv": "^8.17.1",
|
|
254
|
+
"ajv-formats": "^3.0.1",
|
|
244
255
|
"winston": "^3.17.0"
|
|
245
256
|
}
|
|
246
257
|
}
|
|
@@ -159,6 +159,14 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
|
|
|
159
159
|
if (terminated)
|
|
160
160
|
return queryError(q, Errors.connection('CONNECTION_DESTROYED', options))
|
|
161
161
|
|
|
162
|
+
if (!socket) {
|
|
163
|
+
// A stale reservation can execute after closed() clears the socket.
|
|
164
|
+
// Do not signal backpressure: this connection cannot emit a drain event
|
|
165
|
+
// to resume queries queued behind the rejected write.
|
|
166
|
+
queryError(q, Errors.connection('CONNECTION_CLOSED', options))
|
|
167
|
+
return true
|
|
168
|
+
}
|
|
169
|
+
|
|
162
170
|
if (stream)
|
|
163
171
|
return queryError(q, Errors.generic('COPY_IN_PROGRESS', 'You cannot execute queries during copy'))
|
|
164
172
|
|
|
@@ -254,6 +262,16 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
|
|
|
254
262
|
}
|
|
255
263
|
|
|
256
264
|
function nextWrite(fn) {
|
|
265
|
+
if (!socket) {
|
|
266
|
+
// Cursor and COPY writes can still arrive after closed() clears the
|
|
267
|
+
// socket. A throw from this timer would be an uncaughtException, so
|
|
268
|
+
// reject the pending queries instead. Report no backpressure: a closed
|
|
269
|
+
// socket never emits the drain event that would resume them.
|
|
270
|
+
nextWriteTimer !== null && clearImmediate(nextWriteTimer)
|
|
271
|
+
chunk = nextWriteTimer = null
|
|
272
|
+
error(Errors.connection('CONNECTION_CLOSED', options))
|
|
273
|
+
return true
|
|
274
|
+
}
|
|
257
275
|
const x = socket.write(chunk, fn)
|
|
258
276
|
nextWriteTimer !== null && clearImmediate(nextWriteTimer)
|
|
259
277
|
chunk = nextWriteTimer = null
|
|
@@ -157,6 +157,14 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
|
|
|
157
157
|
if (terminated)
|
|
158
158
|
return queryError(q, Errors.connection('CONNECTION_DESTROYED', options))
|
|
159
159
|
|
|
160
|
+
if (!socket) {
|
|
161
|
+
// A stale reservation can execute after closed() clears the socket.
|
|
162
|
+
// Do not signal backpressure: this connection cannot emit a drain event
|
|
163
|
+
// to resume queries queued behind the rejected write.
|
|
164
|
+
queryError(q, Errors.connection('CONNECTION_CLOSED', options))
|
|
165
|
+
return true
|
|
166
|
+
}
|
|
167
|
+
|
|
160
168
|
if (stream)
|
|
161
169
|
return queryError(q, Errors.generic('COPY_IN_PROGRESS', 'You cannot execute queries during copy'))
|
|
162
170
|
|
|
@@ -252,6 +260,16 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
|
|
|
252
260
|
}
|
|
253
261
|
|
|
254
262
|
function nextWrite(fn) {
|
|
263
|
+
if (!socket) {
|
|
264
|
+
// Cursor and COPY writes can still arrive after closed() clears the
|
|
265
|
+
// socket. A throw from this timer would be an uncaughtException, so
|
|
266
|
+
// reject the pending queries instead. Report no backpressure: a closed
|
|
267
|
+
// socket never emits the drain event that would resume them.
|
|
268
|
+
nextWriteTimer !== null && clearImmediate(nextWriteTimer)
|
|
269
|
+
chunk = nextWriteTimer = null
|
|
270
|
+
error(Errors.connection('CONNECTION_CLOSED', options))
|
|
271
|
+
return true
|
|
272
|
+
}
|
|
255
273
|
const x = socket.write(chunk, fn)
|
|
256
274
|
nextWriteTimer !== null && clearImmediate(nextWriteTimer)
|
|
257
275
|
chunk = nextWriteTimer = null
|
|
@@ -157,6 +157,14 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
|
|
|
157
157
|
if (terminated)
|
|
158
158
|
return queryError(q, Errors.connection('CONNECTION_DESTROYED', options))
|
|
159
159
|
|
|
160
|
+
if (!socket) {
|
|
161
|
+
// A stale reservation can execute after closed() clears the socket.
|
|
162
|
+
// Do not signal backpressure: this connection cannot emit a drain event
|
|
163
|
+
// to resume queries queued behind the rejected write.
|
|
164
|
+
queryError(q, Errors.connection('CONNECTION_CLOSED', options))
|
|
165
|
+
return true
|
|
166
|
+
}
|
|
167
|
+
|
|
160
168
|
if (stream)
|
|
161
169
|
return queryError(q, Errors.generic('COPY_IN_PROGRESS', 'You cannot execute queries during copy'))
|
|
162
170
|
|
|
@@ -252,6 +260,16 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
|
|
|
252
260
|
}
|
|
253
261
|
|
|
254
262
|
function nextWrite(fn) {
|
|
263
|
+
if (!socket) {
|
|
264
|
+
// Cursor and COPY writes can still arrive after closed() clears the
|
|
265
|
+
// socket. A throw from this timer would be an uncaughtException, so
|
|
266
|
+
// reject the pending queries instead. Report no backpressure: a closed
|
|
267
|
+
// socket never emits the drain event that would resume them.
|
|
268
|
+
nextWriteTimer !== null && clearImmediate(nextWriteTimer)
|
|
269
|
+
chunk = nextWriteTimer = null
|
|
270
|
+
error(Errors.connection('CONNECTION_CLOSED', options))
|
|
271
|
+
return true
|
|
272
|
+
}
|
|
255
273
|
const x = socket.write(chunk, fn)
|
|
256
274
|
nextWriteTimer !== null && clearImmediate(nextWriteTimer)
|
|
257
275
|
chunk = nextWriteTimer = null
|
|
File without changes
|