Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

refactor(agent): share the no-key connectable apps line between prompts

jeffrey081bfabc8942
diff --git a/apps/node-services/src/agent/prompt/compact-meta-instructions.ts b/apps/node-services/src/agent/prompt/compact-meta-instructions.ts
index 45951644..4c469952 100644
--- a/apps/node-services/src/agent/prompt/compact-meta-instructions.ts
+++ b/apps/node-services/src/agent/prompt/compact-meta-instructions.ts
@@ -3,6 +3,7 @@ import type { MetaRoomKind } from "../executor/context-ref.js";
import { COMPACT_PACKAGE_ENVIRONMENT } from "./environment-knowledge.js";
import type { MetaInstructionsInput } from "./meta-instructions.js";
import {
+ connectableAppsOnly,
connectableAppsRule,
connectedAppsAtRunStart,
} from "./connected-apps.js";
@@ -152,13 +153,6 @@ const authority = (agentType: AgentType, roomKind: MetaRoomKind): string => {
].join("\n\n");
};
-// Without a provider key, no account or app command applies yet; only the
-// route to an authorization card does.
-const connectableAppsOnly = (connectableAppKeys: readonly string[]): string =>
- connectableAppKeys.length === 0
- ? ""
- : `\n- Connected apps: no app has an account you can use yet.${connectableAppsRule(connectableAppKeys)}`;
-
const connectedAppsCommands = (
connectedAppKeys: readonly string[],
connectableAppKeys: readonly string[],
diff --git a/apps/node-services/src/agent/prompt/connected-apps.ts b/apps/node-services/src/agent/prompt/connected-apps.ts
index 9f579df9..fad3cb31 100644
--- a/apps/node-services/src/agent/prompt/connected-apps.ts
+++ b/apps/node-services/src/agent/prompt/connected-apps.ts
@@ -10,6 +10,16 @@ export function connectableAppsRule(keys: readonly string[]): string {
: ` Apps the Human can connect: ${keys.join(", ")}. When a request needs the Human's account in one of these apps, to create or change something there or to read data that is not public, use teamhub apps, not the browser: with no account, run teamhub apps connect <app-key> to post an authorization card instead of asking for credentials, and end your turn; the card result wakes you. Then find the tool with teamhub apps search and run it with teamhub apps execute. Read a public page the usual way.`;
}
+/**
+ * The Connected apps line when no provider key is configured: no account or
+ * app command applies yet, only the route to an authorization card.
+ */
+export function connectableAppsOnly(keys: readonly string[]): string {
+ return keys.length === 0
+ ? ""
+ : `\n- Connected apps: no app has an account you can use yet.${connectableAppsRule(keys)}`;
+}
+
/** Names the apps the Agent could use when the Run started, by app key. */
export function connectedAppsAtRunStart(keys: readonly string[]): string {
return keys.length === 0
diff --git a/apps/node-services/src/agent/prompt/meta-instructions.ts b/apps/node-services/src/agent/prompt/meta-instructions.ts
index b8aaf439..1e577125 100644
--- a/apps/node-services/src/agent/prompt/meta-instructions.ts
+++ b/apps/node-services/src/agent/prompt/meta-instructions.ts
@@ -5,6 +5,7 @@ import type {
} from "../executor/types.js";
import type { MetaRoomKind } from "../executor/context-ref.js";
import {
+ connectableAppsOnly,
connectableAppsRule,
connectedAppsAtRunStart,
} from "./connected-apps.js";
@@ -226,13 +227,6 @@ const WORKSPACE = `Your workspace
- npm and uv are not always installed. If npm, uv, or a system tool you need is missing, ask the user whether to install it. Don't install anything globally (apt, brew, conda, pip --user, npm -g) without the user's yes: that changes the user's computer.
- Extract archives with tar --no-same-owner.`;
-// Without a provider key, no account or app command applies yet; only the
-// route to an authorization card does.
-const connectableAppsOnly = (connectableAppKeys: readonly string[]): string =>
- connectableAppKeys.length === 0
- ? ""
- : `\n- Connected apps: no app has an account you can use yet.${connectableAppsRule(connectableAppKeys)}`;
-
const connectedAppsCommands = (
connectedAppKeys: readonly string[],
connectableAppKeys: readonly string[],