Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,19 @@ describe('AgentRuntime', () => {
const messages = runtime.buildSystemMessages(DATA_CHAT_AGENT, {});
expect(messages[0].content).not.toContain('Current Context');
});

it('tells the agent builds are live when the environment auto-publishes', () => {
const messages = runtime.buildSystemMessages(DATA_CHAT_AGENT, { autoPublishAiBuilds: true });
expect(messages[0].content).toContain('publish AUTOMATICALLY');
expect(messages[0].content).toContain('is live');
});

it('stays silent on publishing when auto-publish is off/absent', () => {
for (const ctx of [{}, { autoPublishAiBuilds: false }]) {
const messages = runtime.buildSystemMessages(DATA_CHAT_AGENT, ctx);
expect(messages[0].content).not.toContain('publish AUTOMATICALLY');
}
});
});

describe('buildRequestOptions', () => {
Expand Down
22 changes: 22 additions & 0 deletions packages/services/service-ai/src/agent-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ export interface AgentChatContext extends SkillContext {
recordId?: string;
/** Current view name */
viewName?: string;
/**
* Whether this environment auto-publishes whole-app builds. When the client
* passes `true`, the agent is told a finished build is live immediately, so
* its narration matches reality ("your app is live") instead of defaulting to
* "publish it to make it live". Absent/false keeps the conservative framing.
*/
autoPublishAiBuilds?: boolean;
}

/**
Expand Down Expand Up @@ -130,6 +137,21 @@ export class AgentRuntime {
if (ctx.length > 0) {
parts.push('\n--- Current Context ---\n' + ctx.join('\n'));
}
// Environment publishing posture. When auto-publish is on, a finished
// whole-app build is already live, so the agent should say so rather than
// ask the user to publish. Authoring skills stay neutral by default (they
// can't see this runtime setting); this is what makes the narration match
// the UI's published state instead of hedging.
if (context.autoPublishAiBuilds === true) {
parts.push(
'\n--- Publishing in this environment ---\n' +
'Whole-app builds publish AUTOMATICALLY here: the moment you finish building an app, ' +
'it is live and ready to use — there is no manual publish step for the build. Tell the ' +
'user their app is built and live (e.g. "your app is ready — open it from the launcher"). ' +
'Do NOT tell them to "publish it to make it live" for a whole-app build. Smaller ' +
'incremental edits are still staged for review — the chat panel shows each change\'s status.',
);
}
}

// Active skill bundle
Expand Down
Loading