@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
|
@@ -19,16 +19,25 @@
|
|
|
19
19
|
* provider credential and the MCP route accepts it as the bearer.
|
|
20
20
|
*/
|
|
21
21
|
import { mcpToolResult, toolImageBudget } from '@lobu/plugin-toolkit';
|
|
22
|
+
import { FOLLOW_UP_SUGGESTIONS_PROMPT, parseFollowUpSuggestions } from '@lobu/core/agent-tooling';
|
|
22
23
|
import { createGatewayTools } from './gateway-tools.js';
|
|
23
24
|
import { createTurnMediaTools } from './media-tools.js';
|
|
24
25
|
import { createTurnMemoryHooks } from './memory.js';
|
|
25
26
|
import { estimatePromptTokenCost, memoryFlushDue, MEMORY_FLUSH_STATE_CUSTOM_TYPE } from '@lobu/core/memory-flush';
|
|
26
27
|
import { isRetrievalTool, summarizeToolTrace } from '@lobu/core/tool-trace-summary';
|
|
27
|
-
import { createNativeSession, nativeSessionJsonl, promptNativeSession } from './native-session.js';
|
|
28
|
+
import { askAside, createNativeSession, nativeSessionJsonl, promptNativeSession } from './native-session.js';
|
|
28
29
|
import { MAX_TOOL_CALLS_PER_TURN } from './types.js';
|
|
29
30
|
import { createWorkspace, INPUT_DIR, SKILLS_DIR, } from './workspace.js';
|
|
30
31
|
/** Third-party MCP server on the other side of the gateway: generous, never forever. */
|
|
31
32
|
const TOOL_CALL_TIMEOUT_MS = 120_000;
|
|
33
|
+
/**
|
|
34
|
+
* The follow-up chips request. It runs after the answer has streamed and
|
|
35
|
+
* before the turn completes, so this bounds how much later the reply is
|
|
36
|
+
* marked done; a slower model simply yields no chips.
|
|
37
|
+
*/
|
|
38
|
+
const FOLLOW_UPS_TIMEOUT_MS = 10_000;
|
|
39
|
+
/** A chips reply is a few short JSON objects. */
|
|
40
|
+
const FOLLOW_UPS_MAX_TOKENS = 400;
|
|
32
41
|
/**
|
|
33
42
|
* What of a tool's output the host sees in the event stream.
|
|
34
43
|
*
|
|
@@ -454,7 +463,7 @@ export async function runAgentTurn(input, emit, takeSteering = () => [], runtime
|
|
|
454
463
|
// another request every time and an answer could still follow `ask_user`.
|
|
455
464
|
//
|
|
456
465
|
// `block` keeps its job — a sibling scheduled in the same batch must not
|
|
457
|
-
// RUN, since `
|
|
466
|
+
// RUN, since `send_message` posts to the user — and
|
|
458
467
|
// `agent.abort()` is what ends generation. Pi's own `terminate` hint cannot
|
|
459
468
|
// do it here: `shouldTerminateToolBatch` needs every result in the batch to
|
|
460
469
|
// set it, and a blocked call is short-circuited as `kind:'immediate'`, which
|
|
@@ -743,6 +752,28 @@ export async function runAgentTurn(input, emit, takeSteering = () => [], runtime
|
|
|
743
752
|
}
|
|
744
753
|
if (ended)
|
|
745
754
|
throw new Error(ended);
|
|
755
|
+
// Follow-up chips, asked of the model that just answered. They ride the
|
|
756
|
+
// result, so the gateway delivers them with the reply: embedded on web's
|
|
757
|
+
// `complete`, posted after the reply on chat, and dropped if a guardrail
|
|
758
|
+
// blocks it. Skipped when the turn already handed control back
|
|
759
|
+
// (`ask_user`), posted its answer in-band, or answered steered follow-ups
|
|
760
|
+
// as well — each of those inputs completes on its own.
|
|
761
|
+
let suggestions = [];
|
|
762
|
+
if (input.tools?.followUps && !askedUser && !repliedInBand && steeredMessages.size === 0 && finalText.trim()) {
|
|
763
|
+
try {
|
|
764
|
+
const reply = await askAside(session, credential, FOLLOW_UP_SUGGESTIONS_PROMPT, {
|
|
765
|
+
maxTokens: FOLLOW_UPS_MAX_TOKENS,
|
|
766
|
+
signal: AbortSignal.timeout(FOLLOW_UPS_TIMEOUT_MS),
|
|
767
|
+
});
|
|
768
|
+
suggestions = parseFollowUpSuggestions(reply);
|
|
769
|
+
}
|
|
770
|
+
catch (error) {
|
|
771
|
+
// Chips are optional: a slow or failed request leaves the answer as is.
|
|
772
|
+
console.warn('follow-up suggestions failed; the turn completes without them', {
|
|
773
|
+
error: error instanceof Error ? error.message : String(error),
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
}
|
|
746
777
|
return {
|
|
747
778
|
// The answer is the last assistant message WITH TEXT after each user
|
|
748
779
|
// message, not the accumulated stream: a model that narrates before a
|
|
@@ -792,6 +823,7 @@ export async function runAgentTurn(input, emit, takeSteering = () => [], runtime
|
|
|
792
823
|
}];
|
|
793
824
|
}),
|
|
794
825
|
...(repliedInBand ? { repliedInBand: true } : {}),
|
|
826
|
+
...(suggestions.length > 0 ? { suggestions } : {}),
|
|
795
827
|
};
|
|
796
828
|
}
|
|
797
829
|
finally {
|