@multiplayer-app/sandbox 0.0.32 → 0.0.33-beta.2
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/agents/content-generator.agent.d.ts +8 -0
- package/dist/agents/content-generator.agent.d.ts.map +1 -1
- package/dist/agents/content-generator.agent.js +53 -6
- package/dist/agents/content-generator.agent.js.map +1 -1
- package/dist/agents/notebook.agent.d.ts.map +1 -1
- package/dist/agents/notebook.agent.js +2 -1
- package/dist/agents/notebook.agent.js.map +1 -1
- package/dist/agents/shared/build-plan.tools.d.ts.map +1 -1
- package/dist/agents/shared/build-plan.tools.js +4 -4
- package/dist/agents/shared/build-plan.tools.js.map +1 -1
- package/dist/agents/shared/content-generator-system-prompt.d.ts +3 -2
- package/dist/agents/shared/content-generator-system-prompt.d.ts.map +1 -1
- package/dist/agents/shared/content-generator-system-prompt.js +41 -24
- package/dist/agents/shared/content-generator-system-prompt.js.map +1 -1
- package/dist/agents/shared/publish-session-artifacts.tool.d.ts +5 -0
- package/dist/agents/shared/publish-session-artifacts.tool.d.ts.map +1 -1
- package/dist/agents/shared/publish-session-artifacts.tool.js +154 -15
- package/dist/agents/shared/publish-session-artifacts.tool.js.map +1 -1
- package/dist/agents/shared/session-quality-report.tool.js +1 -1
- package/dist/agents/shared/session-quality-report.tool.js.map +1 -1
- package/dist/agents/shared/update-session-artifacts.tool.d.ts +5 -0
- package/dist/agents/shared/update-session-artifacts.tool.d.ts.map +1 -1
- package/dist/agents/shared/update-session-artifacts.tool.js +136 -26
- package/dist/agents/shared/update-session-artifacts.tool.js.map +1 -1
- package/dist/agents/shared/validate-artifact-content.tools.d.ts +4 -0
- package/dist/agents/shared/validate-artifact-content.tools.d.ts.map +1 -1
- package/dist/agents/shared/validate-artifact-content.tools.js +24 -1
- package/dist/agents/shared/validate-artifact-content.tools.js.map +1 -1
- package/dist/agents/skills/designer.skill.d.ts.map +1 -1
- package/dist/agents/skills/designer.skill.js +75 -113
- package/dist/agents/skills/designer.skill.js.map +1 -1
- package/dist/agents/skills/skill-injection.d.ts.map +1 -1
- package/dist/agents/skills/skill-injection.js +9 -3
- package/dist/agents/skills/skill-injection.js.map +1 -1
- package/dist/context.d.ts +4 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js.map +1 -1
- package/dist/create-builder-api.d.ts +6 -0
- package/dist/create-builder-api.d.ts.map +1 -1
- package/dist/create-builder-api.js +2 -0
- package/dist/create-builder-api.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/notebooks/notebook-storage-paths.d.ts +8 -0
- package/dist/lib/notebooks/notebook-storage-paths.d.ts.map +1 -0
- package/dist/lib/notebooks/notebook-storage-paths.js +22 -0
- package/dist/lib/notebooks/notebook-storage-paths.js.map +1 -0
- package/dist/lib/notebooks/notebook-yjs-content.d.ts +6 -0
- package/dist/lib/notebooks/notebook-yjs-content.d.ts.map +1 -0
- package/dist/lib/notebooks/notebook-yjs-content.js +42 -0
- package/dist/lib/notebooks/notebook-yjs-content.js.map +1 -0
- package/dist/lib/object-storage/keys.d.ts +1 -0
- package/dist/lib/object-storage/keys.d.ts.map +1 -1
- package/dist/lib/object-storage/keys.js +5 -0
- package/dist/lib/object-storage/keys.js.map +1 -1
- package/dist/lib/object-storage/named-snapshot-paths.d.ts +9 -0
- package/dist/lib/object-storage/named-snapshot-paths.d.ts.map +1 -0
- package/dist/lib/object-storage/named-snapshot-paths.js +39 -0
- package/dist/lib/object-storage/named-snapshot-paths.js.map +1 -0
- package/dist/lib/session-artifacts/hashline-diff-guide.d.ts +1 -1
- package/dist/lib/session-artifacts/hashline-diff-guide.d.ts.map +1 -1
- package/dist/lib/session-artifacts/hashline-diff-guide.js +9 -5
- package/dist/lib/session-artifacts/hashline-diff-guide.js.map +1 -1
- package/dist/lib/session-artifacts/parse-hashline-diff.d.ts +13 -0
- package/dist/lib/session-artifacts/parse-hashline-diff.d.ts.map +1 -1
- package/dist/lib/session-artifacts/parse-hashline-diff.js +72 -0
- package/dist/lib/session-artifacts/parse-hashline-diff.js.map +1 -1
- package/dist/lib/session-pages/artifact-quality-audit.d.ts.map +1 -1
- package/dist/lib/session-pages/artifact-quality-audit.js +19 -14
- package/dist/lib/session-pages/artifact-quality-audit.js.map +1 -1
- package/dist/lib/session-pages/artifact-storage-paths.d.ts +1 -0
- package/dist/lib/session-pages/artifact-storage-paths.d.ts.map +1 -1
- package/dist/lib/session-pages/artifact-storage-paths.js +9 -5
- package/dist/lib/session-pages/artifact-storage-paths.js.map +1 -1
- package/dist/lib/session-pages/html-artifact-template.d.ts +16 -0
- package/dist/lib/session-pages/html-artifact-template.d.ts.map +1 -1
- package/dist/lib/session-pages/html-artifact-template.js +166 -10
- package/dist/lib/session-pages/html-artifact-template.js.map +1 -1
- package/dist/lib/session-pages/index.d.ts +4 -0
- package/dist/lib/session-pages/index.d.ts.map +1 -1
- package/dist/lib/session-pages/index.js +11 -1
- package/dist/lib/session-pages/index.js.map +1 -1
- package/dist/lib/session-pages/write-session-artifacts.d.ts +1 -0
- package/dist/lib/session-pages/write-session-artifacts.d.ts.map +1 -1
- package/dist/lib/session-pages/write-session-artifacts.js +4 -1
- package/dist/lib/session-pages/write-session-artifacts.js.map +1 -1
- package/dist/lib/session-plans/build-plan.d.ts +13 -3
- package/dist/lib/session-plans/build-plan.d.ts.map +1 -1
- package/dist/lib/session-plans/build-plan.js +37 -6
- package/dist/lib/session-plans/build-plan.js.map +1 -1
- package/dist/lib/yjs-pending/flush-worker.d.ts +1 -1
- package/dist/lib/yjs-pending/flush-worker.d.ts.map +1 -1
- package/dist/lib/yjs-pending/flush-worker.js +3 -33
- package/dist/lib/yjs-pending/flush-worker.js.map +1 -1
- package/dist/lib/yjs-pending/snapshot-retention.d.ts +6 -0
- package/dist/lib/yjs-pending/snapshot-retention.d.ts.map +1 -0
- package/dist/lib/yjs-pending/snapshot-retention.js +33 -0
- package/dist/lib/yjs-pending/snapshot-retention.js.map +1 -0
- package/dist/lib/yjs-pending/yjs-persistence.d.ts +1 -0
- package/dist/lib/yjs-pending/yjs-persistence.d.ts.map +1 -1
- package/dist/lib/yjs-pending/yjs-persistence.js +36 -0
- package/dist/lib/yjs-pending/yjs-persistence.js.map +1 -1
- package/dist/realtime/session-artifact-yjs-store.d.ts +21 -0
- package/dist/realtime/session-artifact-yjs-store.d.ts.map +1 -1
- package/dist/realtime/session-artifact-yjs-store.js +84 -0
- package/dist/realtime/session-artifact-yjs-store.js.map +1 -1
- package/dist/routes/notebooks.d.ts.map +1 -1
- package/dist/routes/notebooks.js +2 -0
- package/dist/routes/notebooks.js.map +1 -1
- package/dist/routes/schemas.d.ts +2 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +2 -0
- package/dist/server.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import type { AgentConfig } from '@multiplayer-app/ai-agent-types';
|
|
2
2
|
import type { BuilderApiAgentDeps } from '../builder-api-config';
|
|
3
|
+
/**
|
|
4
|
+
* Parent stop budget. Models otherwise round-robin updateSessionArtifact on
|
|
5
|
+
* every published file ("polish index, then contact, then index…") until the
|
|
6
|
+
* old 16-step cap. Count tool names conservatively from serialized steps.
|
|
7
|
+
*/
|
|
8
|
+
export declare function shouldStopContentGenerator({ steps }: {
|
|
9
|
+
steps: unknown[];
|
|
10
|
+
}): boolean;
|
|
3
11
|
export declare function createContentGeneratorAgent(deps: BuilderApiAgentDeps): AgentConfig;
|
|
4
12
|
//# sourceMappingURL=content-generator.agent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-generator.agent.d.ts","sourceRoot":"","sources":["../../src/agents/content-generator.agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAA;AAElE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"content-generator.agent.d.ts","sourceRoot":"","sources":["../../src/agents/content-generator.agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAA;AAElE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAUhE;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,OAAO,EAAE,CAAA;CAAE,GAAG,OAAO,CAUnF;AAOD,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,mBAAmB,GAAG,WAAW,CAqDlF"}
|
|
@@ -1,32 +1,76 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shouldStopContentGenerator = shouldStopContentGenerator;
|
|
3
4
|
exports.createContentGeneratorAgent = createContentGeneratorAgent;
|
|
4
5
|
const ai_agent_types_1 = require("@multiplayer-app/ai-agent-types");
|
|
5
6
|
const publish_session_artifacts_tool_1 = require("./shared/publish-session-artifacts.tool");
|
|
7
|
+
const app_vm_tools_1 = require("./shared/app-vm.tools");
|
|
6
8
|
const content_generator_system_prompt_1 = require("./shared/content-generator-system-prompt");
|
|
7
9
|
const update_session_artifacts_tool_1 = require("./shared/update-session-artifacts.tool");
|
|
10
|
+
const session_quality_report_tool_1 = require("./shared/session-quality-report.tool");
|
|
8
11
|
const session_pages_1 = require("../lib/session-pages");
|
|
9
12
|
const agent_context_1 = require("./shared/agent-context");
|
|
13
|
+
const skills_1 = require("./skills");
|
|
14
|
+
/**
|
|
15
|
+
* Parent stop budget. Models otherwise round-robin updateSessionArtifact on
|
|
16
|
+
* every published file ("polish index, then contact, then index…") until the
|
|
17
|
+
* old 16-step cap. Count tool names conservatively from serialized steps.
|
|
18
|
+
*/
|
|
19
|
+
function shouldStopContentGenerator({ steps }) {
|
|
20
|
+
if (steps.length >= 6)
|
|
21
|
+
return true;
|
|
22
|
+
const blob = JSON.stringify(steps !== null && steps !== void 0 ? steps : []);
|
|
23
|
+
const updateCalls = countToolMentions(blob, 'updateSessionArtifact');
|
|
24
|
+
const publishCalls = countToolMentions(blob, 'publishSessionArtifacts');
|
|
25
|
+
// After a landing is on disk, at most one follow-up edit pass — not one per file.
|
|
26
|
+
if (updateCalls >= 2)
|
|
27
|
+
return true;
|
|
28
|
+
// Two publish delegations is already past the intended "one ship + one repair" path.
|
|
29
|
+
if (publishCalls >= 2 && updateCalls >= 1)
|
|
30
|
+
return true;
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
function countToolMentions(blob, toolName) {
|
|
34
|
+
var _a, _b;
|
|
35
|
+
const re = new RegExp(`"(?:name|title)"\\s*:\\s*"${toolName}"`, 'g');
|
|
36
|
+
return (_b = (_a = blob.match(re)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
37
|
+
}
|
|
10
38
|
function createContentGeneratorAgent(deps) {
|
|
11
39
|
return {
|
|
12
40
|
name: 'content-generator',
|
|
13
41
|
description: 'Generates and updates session artifacts: HTML pages, optional split CSS/JS, JSON data, and Markdown docs',
|
|
14
42
|
defaultModel: deps.defaultModel,
|
|
15
43
|
systemPrompt: content_generator_system_prompt_1.CONTENT_GENERATOR_SYSTEM_PROMPT,
|
|
16
|
-
stopWhen:
|
|
44
|
+
stopWhen: shouldStopContentGenerator,
|
|
17
45
|
prepareStep: async (options, context) => {
|
|
18
|
-
|
|
19
|
-
return undefined;
|
|
20
|
-
}
|
|
46
|
+
var _a;
|
|
21
47
|
const sessionId = (0, agent_context_1.getRootChatId)(context);
|
|
22
48
|
if (!sessionId) {
|
|
23
49
|
return undefined;
|
|
24
50
|
}
|
|
25
|
-
const
|
|
51
|
+
const stepCount = (_a = options.stepCount) !== null && _a !== void 0 ? _a : 0;
|
|
52
|
+
const [artifacts, customSkills] = await Promise.all([
|
|
53
|
+
(0, session_pages_1.listSessionArtifacts)(sessionId),
|
|
54
|
+
stepCount === 0 ? (0, skills_1.loadAccountSkills)(context) : Promise.resolve([]),
|
|
55
|
+
]);
|
|
56
|
+
const customSkillCatalog = customSkills.length
|
|
57
|
+
? `\nAccount skills (add to the catalog; same-name entries replace built-ins):\n${customSkills
|
|
58
|
+
.map((skill) => `- ${skill.name} — ${skill.description}. Use for: ${skill.whenToUse}`)
|
|
59
|
+
.join('\n')}`
|
|
60
|
+
: '';
|
|
61
|
+
const artifactList = artifacts.length
|
|
62
|
+
? artifacts.map((artifact) => artifact.path).join(', ')
|
|
63
|
+
: '(none yet)';
|
|
64
|
+
const stopPolish = artifacts.length > 0 && stepCount >= 1
|
|
65
|
+
? `\nSTOP RULE: HTML already exists (${artifactList}). If the last publish/update returned previewUrl or an updated path, FINISH with a short summary NOW. Do NOT round-robin updateSessionArtifact across every file. Do NOT invent nindex.html / contact.html / data/*.json unless the user asked. At most ONE updateSessionArtifact for a named blocking error — then stop.`
|
|
66
|
+
: '';
|
|
26
67
|
return {
|
|
27
68
|
messages: [
|
|
28
69
|
...options.messages,
|
|
29
|
-
{
|
|
70
|
+
{
|
|
71
|
+
role: 'system',
|
|
72
|
+
content: `Existing session artifacts RIGHT NOW: ${artifactList}. These paths MUST go through updateSessionArtifact — publishing them again always fails. Any path NOT in this list does not exist yet — create it with publishSessionArtifacts, never updateSessionArtifact. No build plan — ship with publish/update directly.${customSkillCatalog}${stopPolish}`,
|
|
73
|
+
},
|
|
30
74
|
],
|
|
31
75
|
};
|
|
32
76
|
},
|
|
@@ -35,6 +79,9 @@ function createContentGeneratorAgent(deps) {
|
|
|
35
79
|
{ type: ai_agent_types_1.AgentToolType.REQUEST_CLARIFICATION, userConfigurable: true },
|
|
36
80
|
publish_session_artifacts_tool_1.publishSessionArtifactsSubagentTool,
|
|
37
81
|
update_session_artifacts_tool_1.updateSessionArtifactsSubagentTool,
|
|
82
|
+
app_vm_tools_1.writeAppFilesTool,
|
|
83
|
+
app_vm_tools_1.runAppCommandTool,
|
|
84
|
+
session_quality_report_tool_1.getSessionQualityReportTool,
|
|
38
85
|
],
|
|
39
86
|
};
|
|
40
87
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-generator.agent.js","sourceRoot":"","sources":["../../src/agents/content-generator.agent.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"content-generator.agent.js","sourceRoot":"","sources":["../../src/agents/content-generator.agent.ts"],"names":[],"mappings":";;AAiBA,gEAUC;AAOD,kEAqDC;AAtFD,oEAA+D;AAE/D,4FAA6F;AAC7F,wDAA4E;AAC5E,8FAA0F;AAC1F,0FAA2F;AAC3F,sFAAkF;AAClF,wDAA2D;AAC3D,0DAAsD;AACtD,qCAA4C;AAE5C;;;;GAIG;AACH,SAAgB,0BAA0B,CAAC,EAAE,KAAK,EAAwB;IACxE,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC;QAAE,OAAO,IAAI,CAAA;IAClC,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC,CAAA;IACxC,MAAM,WAAW,GAAG,iBAAiB,CAAC,IAAI,EAAE,uBAAuB,CAAC,CAAA;IACpE,MAAM,YAAY,GAAG,iBAAiB,CAAC,IAAI,EAAE,yBAAyB,CAAC,CAAA;IACvE,kFAAkF;IAClF,IAAI,WAAW,IAAI,CAAC;QAAE,OAAO,IAAI,CAAA;IACjC,qFAAqF;IACrF,IAAI,YAAY,IAAI,CAAC,IAAI,WAAW,IAAI,CAAC;QAAE,OAAO,IAAI,CAAA;IACtD,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAY,EAAE,QAAgB;;IACvD,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,6BAA6B,QAAQ,GAAG,EAAE,GAAG,CAAC,CAAA;IACpE,OAAO,MAAA,MAAA,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,0CAAE,MAAM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;YAEhB,MAAM,UAAU,GACd,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,SAAS,IAAI,CAAC;gBACpC,CAAC,CAAC,qCAAqC,YAAY,4TAA4T;gBAC/W,CAAC,CAAC,EAAE,CAAA;YAER,OAAO;gBACL,QAAQ,EAAE;oBACR,GAAG,OAAO,CAAC,QAAQ;oBACnB;wBACE,IAAI,EAAE,QAAQ;wBACd,OAAO,EAAE,yCAAyC,YAAY,mQAAmQ,kBAAkB,GAAG,UAAU,EAAE;qBACnW;iBACF;aACF,CAAA;QACH,CAAC;QACD,KAAK,EAAE;YACL,EAAE,IAAI,EAAE,8BAAa,CAAC,UAAU,EAAE,gBAAgB,EAAE,IAAI,EAAE;YAC1D,EAAE,IAAI,EAAE,8BAAa,CAAC,qBAAqB,EAAE,gBAAgB,EAAE,IAAI,EAAE;YACrE,oEAAmC;YACnC,kEAAkC;YAClC,gCAAiB;YACjB,gCAAiB;YACjB,yDAA2B;SAC5B;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notebook.agent.d.ts","sourceRoot":"","sources":["../../src/agents/notebook.agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAA;AAElE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAOhE,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,mBAAmB,GAAG,WAAW,
|
|
1
|
+
{"version":3,"file":"notebook.agent.d.ts","sourceRoot":"","sources":["../../src/agents/notebook.agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAA;AAElE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAOhE,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,mBAAmB,GAAG,WAAW,CA4C1E"}
|
|
@@ -13,7 +13,8 @@ function createNotebookAgent(deps) {
|
|
|
13
13
|
description: 'Reads, searches, and edits the collaborative notebook the user has open, including runnable SQL, code, and chart blocks',
|
|
14
14
|
defaultModel: deps.defaultModel,
|
|
15
15
|
systemPrompt: notebook_agent_system_prompt_1.NOTEBOOK_AGENT_SYSTEM_PROMPT,
|
|
16
|
-
|
|
16
|
+
// Safety net against runaway tool-retry loops.
|
|
17
|
+
stopWhen: ({ steps }) => steps.length >= 64,
|
|
17
18
|
prepareStep: async (options, context) => {
|
|
18
19
|
if (options.stepCount > 0) {
|
|
19
20
|
return undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notebook.agent.js","sourceRoot":"","sources":["../../src/agents/notebook.agent.ts"],"names":[],"mappings":";;AASA,
|
|
1
|
+
{"version":3,"file":"notebook.agent.js","sourceRoot":"","sources":["../../src/agents/notebook.agent.ts"],"names":[],"mappings":";;AASA,kDA4CC;AApDD,oEAA+D;AAE/D,sCAA+C;AAC/C,8EAAuF;AACvF,uFAAmF;AACnF,wFAAoF;AACpF,4DAA8E;AAE9E,SAAgB,mBAAmB,CAAC,IAAyB;IAC3D,OAAO;QACL,IAAI,EAAE,oBAAoB;QAC1B,WAAW,EACT,yHAAyH;QAC3H,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,YAAY,EAAE,2DAA4B;QAC1C,+CAA+C;QAC/C,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAwB,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE;QACjE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;YACtC,IAAI,OAAO,CAAC,SAAS,GAAG,CAAC,EAAE,CAAC;gBAC1B,OAAO,SAAS,CAAA;YAClB,CAAC;YAED,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,IAAA,sCAAqB,EAAC,OAAO,CAAC,CAAA;gBACnD,MAAM,QAAQ,GAAG,MAAM,IAAA,uDAA0B,GAAE,CAAC,mBAAmB,CACrE,MAAM,CAAC,SAAS,EAChB,MAAM,CAAC,UAAU,CAClB,CAAA;gBACD,MAAM,OAAO,GAAG,IAAA,kCAAY,EAAC,IAAA,wCAAkB,EAAC,QAAQ,CAAC,CAAC,CAAA;gBAC1D,OAAO;oBACL,QAAQ,EAAE;wBACR,GAAG,OAAO,CAAC,QAAQ;wBACnB;4BACE,IAAI,EAAE,QAAiB;4BACvB,OAAO,EAAE,sDACP,OAAO,CAAC,MAAM,GAAG,CAAC;gCAChB,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,KAAK,KAAK,CAAC,IAAI,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;gCACvF,CAAC,CAAC,kBACN,EAAE;yBACH;qBACF;iBACF,CAAA;YACH,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,IAAA,4BAAmB,GAAE,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,EAAE,0CAA0C,CAAC,CAAA;gBAC/E,OAAO,SAAS,CAAA;YAClB,CAAC;QACH,CAAC;QACD,KAAK,EAAE;YACL,EAAE,IAAI,EAAE,8BAAa,CAAC,qBAAqB,EAAE,gBAAgB,EAAE,IAAI,EAAE;YACrE,GAAG,8BAAa;SACjB;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-plan.tools.d.ts","sourceRoot":"","sources":["../../../src/agents/shared/build-plan.tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,SAAS,EAAE,MAAM,iCAAiC,CAAA;
|
|
1
|
+
{"version":3,"file":"build-plan.tools.d.ts","sourceRoot":"","sources":["../../../src/agents/shared/build-plan.tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,SAAS,EAAE,MAAM,iCAAiC,CAAA;AAoGnF,eAAO,MAAM,mBAAmB,EAAE,SA6BjC,CAAA;AASD,eAAO,MAAM,mBAAmB,EAAE,SA8DjC,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,SAkB9B,CAAA"}
|
|
@@ -25,7 +25,7 @@ async function readPlan(sessionId) {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
async function writePlan(sessionId, plan) {
|
|
28
|
-
await (0, session_artifact_yjs_store_1.getSessionArtifactYjsStore)().
|
|
28
|
+
await (0, session_artifact_yjs_store_1.getSessionArtifactYjsStore)().upsertFromContent(sessionId, build_plan_1.BUILD_PLAN_PATH, (0, build_plan_1.serializeBuildPlan)(plan));
|
|
29
29
|
}
|
|
30
30
|
const openAdvisorySchema = zod_1.z.object({
|
|
31
31
|
path: zod_1.z.string(),
|
|
@@ -54,9 +54,9 @@ const createPlanInputSchema = zod_1.z.object({
|
|
|
54
54
|
title: zod_1.z.string().min(1).max(200).describe('Short name of what is being built'),
|
|
55
55
|
designBrief: zod_1.z
|
|
56
56
|
.string()
|
|
57
|
-
.min(
|
|
58
|
-
.max(
|
|
59
|
-
.describe(
|
|
57
|
+
.min(120)
|
|
58
|
+
.max(1400)
|
|
59
|
+
.describe(`Session-wide design contract BEFORE building. MUST include: (1) accent hex + darker hover hex (topic-fit, never default indigo), (2) neutral scale slate/zinc/stone/neutral, (3) Google Font pairing by name (never Inter), (4) tone, (5) layout pack ${build_plan_1.LAYOUT_PACKS.join('|')}, (6) signature layout+surface+motion (e.g. "signature: split + hard grid + scroll reveal"), (7) radius sharp|soft|pill and/or density airy|comfortable|dense, (8) light/dark strategy, (9) atmosphere matching the signature (not always blur-orb+glass), (10) anti-cliché note (explicitly ban the default centered blur-orb SaaS hero unless the pack requires it). Pick a pack that fits the product — vary across sessions.`),
|
|
60
60
|
tasks: zod_1.z
|
|
61
61
|
.array(zod_1.z.object({
|
|
62
62
|
title: zod_1.z.string().min(1).max(120).describe('One concrete deliverable, e.g. "Landing page hero + nav"'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-plan.tools.js","sourceRoot":"","sources":["../../../src/agents/shared/build-plan.tools.ts"],"names":[],"mappings":";;;AACA,oEAA+D;AAC/D,6BAAuB;AACvB,mDAA+C;AAC/C,yCAAkD;AAClD,0FAAsF;AACtF,
|
|
1
|
+
{"version":3,"file":"build-plan.tools.js","sourceRoot":"","sources":["../../../src/agents/shared/build-plan.tools.ts"],"names":[],"mappings":";;;AACA,oEAA+D;AAC/D,6BAAuB;AACvB,mDAA+C;AAC/C,yCAAkD;AAClD,0FAAsF;AACtF,mEAc2C;AAC3C,2DAIgC;AAEhC,SAAS,gBAAgB,CAAC,OAA2B;IACnD,MAAM,SAAS,GAAG,IAAA,6BAAa,EAAC,OAAO,CAAC,CAAA;IACxC,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAA;IAC3C,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,KAAK,UAAU,QAAQ,CAAC,SAAiB;IACvC,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,IAAA,uDAA0B,GAAE,CAAC,aAAa,CAAC,SAAS,EAAE,4BAAe,CAAC,CAAA;QAC5F,OAAO,IAAA,2BAAc,EAAC,OAAO,CAAC,CAAA;IAChC,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC;AAED,KAAK,UAAU,SAAS,CAAC,SAAiB,EAAE,IAAe;IACzD,MAAM,IAAA,uDAA0B,GAAE,CAAC,iBAAiB,CAClD,SAAS,EACT,4BAAe,EACf,IAAA,+BAAkB,EAAC,IAAI,CAAC,CACzB,CAAA;AACH,CAAC;AAED,MAAM,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IAClC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,QAAQ,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC;IAC7B,UAAU,EAAE,OA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E;YAC9D,MAAM,SAAS,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAA;YAC3C,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,SAAS,CAAC,CAAA;YACtC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;QAClD,CAAC;KACF;CACF,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
/** Shared system prompt for content-generator / html-generator agents.
|
|
2
|
-
|
|
1
|
+
/** Shared system prompt for content-generator / html-generator agents.
|
|
2
|
+
* No build-plan tools — publish/update directly for speed. */
|
|
3
|
+
export declare const CONTENT_GENERATOR_SYSTEM_PROMPT: string;
|
|
3
4
|
//# sourceMappingURL=content-generator-system-prompt.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-generator-system-prompt.d.ts","sourceRoot":"","sources":["../../../src/agents/shared/content-generator-system-prompt.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"content-generator-system-prompt.d.ts","sourceRoot":"","sources":["../../../src/agents/shared/content-generator-system-prompt.ts"],"names":[],"mappings":"AAEA;8DAC8D;AAC9D,eAAO,MAAM,+BAA+B,QAyCiC,CAAA"}
|
|
@@ -1,32 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CONTENT_GENERATOR_SYSTEM_PROMPT = void 0;
|
|
4
|
-
|
|
4
|
+
const skills_1 = require("../skills");
|
|
5
|
+
/** Shared system prompt for content-generator / html-generator agents.
|
|
6
|
+
* No build-plan tools — publish/update directly for speed. */
|
|
5
7
|
exports.CONTENT_GENERATOR_SYSTEM_PROMPT = `You generate and update session artifacts for both UI and docs. Use publishSessionArtifacts for NEW files and updateSessionArtifact for EXISTING files.
|
|
6
8
|
|
|
7
|
-
Workflow
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
2.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
-
|
|
9
|
+
# Workflow — NO build plan (do not invent plan/task tooling)
|
|
10
|
+
|
|
11
|
+
There is no createBuildPlan / updateBuildTask / getBuildPlan. Do not narrate fake plans or task ids. Ship artifacts directly.
|
|
12
|
+
|
|
13
|
+
1. CLARIFY only when genuinely needed (audience, single vs multi-page, data source). Ask 1–3 questions in ONE round via request_clarification. Skip when the user says "don't ask" or the request is clear.
|
|
14
|
+
|
|
15
|
+
2. DESIGN CONTRACT (keep in your head, put verbatim into every parentContext):
|
|
16
|
+
Exact accent hex + darker hover hex (topic-fit — EV→teal/lime, finance→emerald/navy, tax/filing→green/navy, health→coral; never default indigo), neutral scale (slate/zinc/stone/neutral), Google Font pairing by name (never Inter), tone, layout pack (product | launch | editorial | magazine | split-hero | dark-terminal | bento | brutalist | workspace | story), signature (layout + surface + motion), radius (sharp|soft|pill) and/or density (airy|comfortable|dense), light/dark strategy, atmosphere matching the signature, anti-cliché note that bans the default centered blur-orb SaaS hero unless the pack truly needs a marketing hero. Vary pack+signature across sessions. Include this full brief in parentContext on every publish/update.
|
|
17
|
+
|
|
18
|
+
3. BUILD (SPEED FIRST) — anti-loop contract:
|
|
19
|
+
- Landing / magazine / single page: ONE publishSessionArtifacts with ONLY index.html (complete fragment). No contact.html, about.html, nindex.html, or data/*.json unless the user explicitly asked.
|
|
20
|
+
- Success = previewUrl returned. Then FINISH. Do not open a polish tour.
|
|
21
|
+
- Subagent may repair ONCE inside publish. If that still fails, you may call publishSessionArtifacts ONE more time with the named audit fixes — then stop or report the remaining rule names. Never empty files:[].
|
|
22
|
+
- updateSessionArtifact: at most ONE call per user message, and only for a path that already exists AND a blocking error rule name (or an explicit user edit). Never update every file in sequence. Never call update just to "add fonts" / "improve design" / "replace emoji" after a successful publish — the server repairs fonts and strips emoji.
|
|
23
|
+
- Do NOT call getSessionQualityReport unless the user asks to polish/audit, or zero HTML files exist after publish.
|
|
24
|
+
|
|
25
|
+
4. FINISH: short summary with previewUrl. No plan status narration. No extra tool calls after success.
|
|
26
|
+
|
|
27
|
+
Follow-ups in an existing session: one updateSessionArtifact (or one publish for a new path). Then stop.
|
|
28
|
+
|
|
29
|
+
Artifact mechanics:
|
|
30
|
+
1. UI/HTML (default): publish body/main fragments per .html page (page logic in <script>, styling via Tailwind utilities). Server wraps fragments in a Tailwind shell — no doctype/html/head unless the user wants a full custom document. Prefer the design-brief Google Fonts (<link> + font-family); the server injects a non-Inter fallback if missing.
|
|
31
|
+
2. Split assets only when the user asks (./styles.css, ./script.js).
|
|
32
|
+
3. Docs: .md; optional data under data/*.json.
|
|
33
|
+
4. Paths relative (no leading slash). Existing artifacts are listed in a system message — never re-publish them.
|
|
34
|
+
5. parentContext MUST include the design brief plus any knowledge-tool outputs / data the subagent cannot see. Put visual requirements in artifacts[].requirements too.
|
|
35
|
+
6. HTML structural edits: WHOLESALE complete-page rewrite (no hashline ping-pong). Tiny label tweaks may use hashline.
|
|
36
|
+
7. Never tell the user a file exists without a previewUrl / updated path from the tool.
|
|
37
|
+
|
|
38
|
+
Skills — server selects guides automatically:
|
|
39
|
+
${(0, skills_1.getSkillCatalog)()}
|
|
40
|
+
|
|
41
|
+
Omit the skills field for HTML. Pass skills: [] only for doc/data-only work.
|
|
42
|
+
|
|
43
|
+
App workspace (real apps): writeAppFiles + runAppCommand when the user wants a multi-file app with deps/build. Single pages stay on session artifacts.
|
|
26
44
|
|
|
27
45
|
Rules:
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
- When editing, keep the same layout model as the session (inline vs split files).`;
|
|
46
|
+
- Production-grade UI; no flat AI-indigo templates; never Inter; Lucide SVG icons not emoji; no lorem / template adjectives (revolutionary/seamless/…).
|
|
47
|
+
- Prefer href="index.html" or #section-id over href="#".
|
|
48
|
+
- Speed over ceremony: one successful publish beats multi-step polish loops.`;
|
|
32
49
|
//# sourceMappingURL=content-generator-system-prompt.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-generator-system-prompt.js","sourceRoot":"","sources":["../../../src/agents/shared/content-generator-system-prompt.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"content-generator-system-prompt.js","sourceRoot":"","sources":["../../../src/agents/shared/content-generator-system-prompt.ts"],"names":[],"mappings":";;;AAAA,sCAA2C;AAE3C;8DAC8D;AACjD,QAAA,+BAA+B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgC7C,IAAA,wBAAe,GAAE;;;;;;;;;6EAS0D,CAAA"}
|
|
@@ -11,4 +11,9 @@ export declare const publishArtifactsInputSchema: z.ZodObject<{
|
|
|
11
11
|
previewPath: z.ZodOptional<z.ZodString>;
|
|
12
12
|
}, z.core.$strip>;
|
|
13
13
|
export declare const publishSessionArtifactsSubagentTool: AgentTool;
|
|
14
|
+
/** Two rejected writes are the complete repair budget (initial + one repair).
|
|
15
|
+
* Keep a small absolute cap as a provider/framework safety net. */
|
|
16
|
+
export declare function shouldStopPublishSubagent({ steps }: {
|
|
17
|
+
steps: unknown[];
|
|
18
|
+
}): boolean;
|
|
14
19
|
//# sourceMappingURL=publish-session-artifacts.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish-session-artifacts.tool.d.ts","sourceRoot":"","sources":["../../../src/agents/shared/publish-session-artifacts.tool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"publish-session-artifacts.tool.d.ts","sourceRoot":"","sources":["../../../src/agents/shared/publish-session-artifacts.tool.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAqB,SAAS,EAAE,MAAM,iCAAiC,CAAA;AAEnF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAwDvB,eAAO,MAAM,2BAA2B;;;;;;;;;iBAOtC,CAAA;AAiKF,eAAO,MAAM,mCAAmC,EAAE,SAmGjD,CAAA;AAQD;mEACmE;AACnE,wBAAgB,yBAAyB,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,OAAO,EAAE,CAAA;CAAE,GAAG,OAAO,CAOlF"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.publishSessionArtifactsSubagentTool = exports.publishArtifactsInputSchema = void 0;
|
|
4
|
+
exports.shouldStopPublishSubagent = shouldStopPublishSubagent;
|
|
5
|
+
const node_crypto_1 = require("node:crypto");
|
|
4
6
|
const ai_agent_types_1 = require("@multiplayer-app/ai-agent-types");
|
|
5
7
|
const zod_1 = require("zod");
|
|
6
8
|
const context_1 = require("../../context");
|
|
@@ -8,6 +10,23 @@ const agent_context_1 = require("./agent-context");
|
|
|
8
10
|
const artifact_events_1 = require("../../lib/socket/artifact-events");
|
|
9
11
|
const session_pages_1 = require("../../lib/session-pages");
|
|
10
12
|
const logger_1 = require("../../logger");
|
|
13
|
+
const skills_1 = require("../skills");
|
|
14
|
+
/** Which subagent created each path — self-revision republishes are allowed,
|
|
15
|
+
* cross-delegation overwrites are not. */
|
|
16
|
+
const publishedBy = new Map();
|
|
17
|
+
/** Last rejected content hash per session+path — detects models resending an
|
|
18
|
+
* unchanged file after an audit rejection so the error can escalate. */
|
|
19
|
+
const rejectedContentHashes = new Map();
|
|
20
|
+
/** Create-only conflict attempts per subagent+paths — retrying never helps. */
|
|
21
|
+
const conflictAttempts = new Map();
|
|
22
|
+
const REJECTED_HASHES_LIMIT = 500;
|
|
23
|
+
function rememberRejectedHash(map) {
|
|
24
|
+
if (map.size > REJECTED_HASHES_LIMIT) {
|
|
25
|
+
const oldest = map.keys().next().value;
|
|
26
|
+
if (oldest !== undefined)
|
|
27
|
+
map.delete(oldest);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
11
30
|
const artifactFileSchema = zod_1.z.object({
|
|
12
31
|
path: zod_1.z
|
|
13
32
|
.string()
|
|
@@ -17,7 +36,7 @@ const artifactFileSchema = zod_1.z.object({
|
|
|
17
36
|
fragment: zod_1.z
|
|
18
37
|
.boolean()
|
|
19
38
|
.optional()
|
|
20
|
-
.describe('For .html only: true = content is a body/main fragment; server wraps
|
|
39
|
+
.describe('For .html only: true = content is a body/main fragment; server wraps it in a Tailwind CSS shell. Omit to auto-detect (non-document HTML is wrapped).'),
|
|
21
40
|
title: zod_1.z
|
|
22
41
|
.string()
|
|
23
42
|
.optional()
|
|
@@ -32,18 +51,86 @@ exports.publishArtifactsInputSchema = zod_1.z.object({
|
|
|
32
51
|
.describe('Which published file to open in preview (default index.html)'),
|
|
33
52
|
});
|
|
34
53
|
async function executePublishSessionArtifacts(input, context) {
|
|
35
|
-
var _a, _b, _c;
|
|
54
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
36
55
|
const sessionId = (0, agent_context_1.getRootChatId)(context);
|
|
37
56
|
if (!sessionId) {
|
|
38
57
|
throw new Error('Session ID is required');
|
|
39
58
|
}
|
|
40
59
|
try {
|
|
41
|
-
|
|
42
|
-
|
|
60
|
+
// Refuse common invented typo paths that models create alongside index.html
|
|
61
|
+
// (nindex.html, indexx.html) — these kick off multi-file polish loops.
|
|
62
|
+
const typoPaths = input.files
|
|
63
|
+
.map((file) => (0, session_pages_1.normalizeArtifactPath)(file.path))
|
|
64
|
+
.filter((path) => /^(nindex|indexx|indx|indeks)\.html$/i.test(path));
|
|
65
|
+
if (typoPaths.length > 0) {
|
|
66
|
+
throw new Error(`Invalid path(s): ${typoPaths.join(', ')}. For a landing page publish ONLY index.html — do not invent typo alternate paths.`);
|
|
67
|
+
}
|
|
68
|
+
// Hard create-only guard: republishing an existing path is always a mistake
|
|
69
|
+
// (fixes go through updateSessionArtifact) and repeated publishes previously
|
|
70
|
+
// produced duplicated documents.
|
|
71
|
+
const existing = await (0, session_pages_1.readSessionArtifacts)(sessionId, input.files.map((file) => file.path));
|
|
72
|
+
const subagentId = String((_b = (_a = context === null || context === void 0 ? void 0 : context.data) === null || _a === void 0 ? void 0 : _a.subagentChatId) !== null && _b !== void 0 ? _b : '');
|
|
73
|
+
// Self-revision is legitimate: a subagent may re-publish a path IT created
|
|
74
|
+
// in this run (models iterate on their own fresh work). Only paths created
|
|
75
|
+
// by someone else are conflicts.
|
|
76
|
+
const conflicts = existing
|
|
77
|
+
.filter((entry) => entry.found)
|
|
78
|
+
.map((entry) => entry.path)
|
|
79
|
+
.filter((path) => !subagentId || publishedBy.get(`${sessionId}:${path}`) !== subagentId);
|
|
80
|
+
if (conflicts.length > 0) {
|
|
81
|
+
// A publish subagent has no update tool, so retrying a conflicting
|
|
82
|
+
// publish is always futile — escalate hard on the second attempt.
|
|
83
|
+
const conflictKey = `${String((_d = (_c = context === null || context === void 0 ? void 0 : context.data) === null || _c === void 0 ? void 0 : _c.subagentChatId) !== null && _d !== void 0 ? _d : sessionId)}:${conflicts.join(',')}`;
|
|
84
|
+
const attempts = ((_e = conflictAttempts.get(conflictKey)) !== null && _e !== void 0 ? _e : 0) + 1;
|
|
85
|
+
rememberRejectedHash(conflictAttempts);
|
|
86
|
+
conflictAttempts.set(conflictKey, attempts);
|
|
87
|
+
const escalation = attempts > 1
|
|
88
|
+
? ' STOP CALLING publishSessionArtifacts — you cannot resolve this conflict from here. End your turn NOW with a short text reply to the parent reporting that these paths already exist and changes must go through updateSessionArtifact.'
|
|
89
|
+
: '';
|
|
90
|
+
throw new Error(`Path(s) already exist: ${conflicts.join(', ')}. Files were already published — do NOT publish again; use updateSessionArtifact for changes.${escalation}`);
|
|
91
|
+
}
|
|
92
|
+
// Server-side quality gate. Errors block the publish atomically.
|
|
93
|
+
// Warnings are ignored here (consistency pass re-audits for errors only).
|
|
94
|
+
const auditFailures = [];
|
|
95
|
+
let resentUnchanged = false;
|
|
96
|
+
for (const file of input.files) {
|
|
97
|
+
if (!file.path.toLowerCase().endsWith('.html'))
|
|
98
|
+
continue;
|
|
99
|
+
const prepared = (0, session_pages_1.prepareHtmlArtifactContent)(file.content, {
|
|
100
|
+
fragment: file.fragment,
|
|
101
|
+
title: file.title,
|
|
102
|
+
});
|
|
103
|
+
const findings = (0, session_pages_1.auditHtmlArtifact)(prepared).findings;
|
|
104
|
+
const errors = findings.filter((finding) => finding.severity === 'error');
|
|
105
|
+
if (errors.length > 0) {
|
|
106
|
+
const rejectionKey = `${sessionId}:${file.path}`;
|
|
107
|
+
const contentHash = (0, node_crypto_1.createHash)('sha256').update(file.content).digest('hex');
|
|
108
|
+
if (rejectedContentHashes.get(rejectionKey) === contentHash) {
|
|
109
|
+
resentUnchanged = true;
|
|
110
|
+
}
|
|
111
|
+
rememberRejectedHash(rejectedContentHashes);
|
|
112
|
+
rejectedContentHashes.set(rejectionKey, contentHash);
|
|
113
|
+
auditFailures.push(`${file.path}: ${errors.map((finding) => `[${finding.rule}] ${finding.message}`).join(' ')}`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
if (auditFailures.length > 0) {
|
|
117
|
+
const resendWarning = resentUnchanged
|
|
118
|
+
? 'YOU RESENT THE SAME FILE WITHOUT CHANGING IT — that will never pass. Each finding below names its own fix; apply it literally (edit the markup/style/script it points at), then publish again.\n'
|
|
119
|
+
: '';
|
|
120
|
+
throw new Error(`Quality audit failed — nothing was published. ${resendWarning}Fix every finding, then call publishSessionArtifacts again with ALL files:\n${auditFailures.join('\n')}`);
|
|
121
|
+
}
|
|
122
|
+
const defaultPreviewPath = (_g = (_f = input.files[0]) === null || _f === void 0 ? void 0 : _f.path) !== null && _g !== void 0 ? _g : 'index.html';
|
|
123
|
+
const previewPathInput = (_h = input.previewPath) !== null && _h !== void 0 ? _h : defaultPreviewPath;
|
|
43
124
|
const stored = await (0, session_pages_1.writeSessionArtifacts)({
|
|
44
125
|
sessionId,
|
|
45
126
|
files: input.files,
|
|
46
127
|
});
|
|
128
|
+
if (subagentId) {
|
|
129
|
+
for (const artifact of stored.artifacts) {
|
|
130
|
+
rememberRejectedHash(publishedBy);
|
|
131
|
+
publishedBy.set(`${sessionId}:${artifact.path}`, subagentId);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
47
134
|
const publishedAt = new Date().toISOString();
|
|
48
135
|
const previewPath = (0, session_pages_1.normalizeArtifactPath)(previewPathInput);
|
|
49
136
|
const previewUrl = `${(0, context_1.getBuilderApiContext)().config.apiPrefix}/sessions/${sessionId}/${previewPath}`;
|
|
@@ -101,6 +188,10 @@ exports.publishSessionArtifactsSubagentTool = {
|
|
|
101
188
|
.string()
|
|
102
189
|
.describe('Overall goal that connects all requested artifacts.'),
|
|
103
190
|
artifacts: zod_1.z.array(zod_1.z.object({
|
|
191
|
+
path: zod_1.z
|
|
192
|
+
.string()
|
|
193
|
+
.min(1)
|
|
194
|
+
.describe('Exact new session-relative path to create, e.g. index.html or data/metrics.json.'),
|
|
104
195
|
name: zod_1.z
|
|
105
196
|
.string()
|
|
106
197
|
.describe('Human-readable artifact name.'),
|
|
@@ -113,25 +204,73 @@ exports.publishSessionArtifactsSubagentTool = {
|
|
|
113
204
|
.describe('Requirements specific to this artifact.'),
|
|
114
205
|
})),
|
|
115
206
|
parentContext: zod_1.z.string().min(1).describe('Additional context provided by the parent agent to help complete the task. May include project requirements, user requests, design decisions, architecture details, existing artifact summaries, related files, constraints, assumptions, acceptance criteria, prior conversation excerpts, or any other information relevant to implementing the requested changes.'),
|
|
207
|
+
skills: zod_1.z
|
|
208
|
+
.array(zod_1.z.string())
|
|
209
|
+
.optional()
|
|
210
|
+
.describe('Relevant built-in and account skill guides are selected automatically. Pass [] for doc-only publishes to skip dynamic skill guidance; otherwise omit this field.'),
|
|
116
211
|
}),
|
|
117
212
|
subAgent: {
|
|
118
213
|
name: 'session-artefact-creator',
|
|
119
214
|
description: 'Creates new session artifact files only (HTML, CSS, JS, Markdown, data). Never overwrites an existing path; publish fails if any target path is already on disk.',
|
|
120
|
-
systemPrompt: `You create new
|
|
215
|
+
systemPrompt: `You create complete new session artifacts. The parent sends JSON:
|
|
216
|
+
{ task, artifacts: [{ path, name, description, requirements }], parentContext }.
|
|
217
|
+
|
|
218
|
+
# Contract, in priority order
|
|
219
|
+
1. Create exactly the requested NEW paths. Never invent alternate or "revised" paths and never overwrite.
|
|
220
|
+
2. Use parentContext as authoritative session context; you cannot see the parent chat or its tool results.
|
|
221
|
+
3. Produce complete, usable content. No placeholders, omitted rows, dead controls, or narration about work you did not publish.
|
|
222
|
+
4. Call publishSessionArtifacts directly. It is the only tool available and the server performs the authoritative structural audit.
|
|
223
|
+
|
|
224
|
+
# HTML output — beauty bar
|
|
225
|
+
- Publish body fragments: header, main/sections, footer, optional style/script. Set fragment: true and a meaningful title. Do not emit doctype/html/head or a Tailwind CDN tag; the server supplies the shell.
|
|
226
|
+
- Tailwind preflight is on: every visible element needs utility classes. Full-bleed section backgrounds; max-w-6xl columns live INSIDE sections.
|
|
227
|
+
- Visual quality is the product: follow the design brief's layout pack + signature (never default to centered blur-orb + glass sticky nav). Distinctive Google Fonts from the brief (never Inter), topic-fit accent hex, atmosphere matching the signature surface, radius/density from the brief, Lucide SVG icons, real product copy. Marketing packs: generous section spacing (py-20+); product/workspace packs: denser chrome-first layouts.
|
|
228
|
+
- First viewport follows the pack: marketing = brand + one headline + one subhead + CTA pair + signature visual plane (no KPI soup, no hero-in-a-card); product/workspace = app chrome + primary content.
|
|
229
|
+
- Include working mobile nav when links collapse, and any controls the page shows (vanilla JS). Motions match the brief signature (2–3 max) behind prefers-reduced-motion.
|
|
230
|
+
- Load the design-brief Google Font pairing in the fragment (<link> + font-family). The shell also injects a non-Inter fallback if you forget — do not spend a repair turn on fonts alone.
|
|
231
|
+
- Reuse any injected Session design system / parsed tokens exactly — same accent hex, fonts, and chrome across pages.
|
|
121
232
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
233
|
+
# Publish and repair budget
|
|
234
|
+
- Make one publish call containing all requested files and set previewPath to the main HTML or Markdown file.
|
|
235
|
+
- Do not republish to polish warnings or "make it nicer" — one successful publish ends the task.
|
|
236
|
+
- Fatal findings that block publish include: unclosed tags, undefined CSS variables, lorem ipsum, and generic "Item 1" sample data. Emoji, missing fonts, and "Welcome to our…" template phrases are repaired server-side — do not loop on them.
|
|
237
|
+
- Create exactly the requested paths. For a landing: ONLY index.html — never nindex.html / contact.html / about.html unless listed in the parent artifacts[].
|
|
238
|
+
- If publish is rejected, change the content to address every named blocking finding and retry ONCE.
|
|
239
|
+
- If the second publish is rejected, stop. Reply with the exact remaining rule names and paths; do not generate the full files a third time.
|
|
240
|
+
- A path-conflict error is not repairable here. Stop immediately and tell the parent to use updateSessionArtifact.
|
|
241
|
+
|
|
242
|
+
# Generation skill guides
|
|
243
|
+
Apply the injected guides relevant to this artifact. Designer, accessibility, and copywriting guidance always apply to HTML:
|
|
244
|
+
|
|
245
|
+
${skills_1.STATIC_SKILL_GUIDES}
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
Your first response must be the publishSessionArtifacts tool call, not prose.
|
|
131
249
|
`,
|
|
132
|
-
|
|
250
|
+
prepareStep: (0, skills_1.createSkillInjectingPrepareStep)(),
|
|
251
|
+
stopWhen: shouldStopPublishSubagent,
|
|
252
|
+
// Full pages are large tool payloads; without this, provider default caps (~2-4k tokens) silently truncate styling/content.
|
|
253
|
+
maxOutputTokens: 16000,
|
|
254
|
+
// Tool availability enforces the workflow. Do not expose validation
|
|
255
|
+
// tools while simultaneously instructing the model not to call them.
|
|
133
256
|
tools: [publishSessionArtifactsTool],
|
|
134
257
|
},
|
|
135
258
|
},
|
|
136
259
|
};
|
|
260
|
+
const TERMINAL_PUBLISH_FAILURES = [
|
|
261
|
+
'Quality audit failed',
|
|
262
|
+
'Path(s) already exist',
|
|
263
|
+
'Session ID is required',
|
|
264
|
+
];
|
|
265
|
+
/** Two rejected writes are the complete repair budget (initial + one repair).
|
|
266
|
+
* Keep a small absolute cap as a provider/framework safety net. */
|
|
267
|
+
function shouldStopPublishSubagent({ steps }) {
|
|
268
|
+
if (steps.length >= 4)
|
|
269
|
+
return true;
|
|
270
|
+
const rejectedWrites = steps.filter((step) => {
|
|
271
|
+
const serialized = JSON.stringify(step !== null && step !== void 0 ? step : {});
|
|
272
|
+
return TERMINAL_PUBLISH_FAILURES.some((marker) => serialized.includes(marker));
|
|
273
|
+
}).length;
|
|
274
|
+
return rejectedWrites >= 2;
|
|
275
|
+
}
|
|
137
276
|
//# sourceMappingURL=publish-session-artifacts.tool.js.map
|