wtt-connect 0.2.50 → 0.2.51
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/package.json +1 -1
- package/src/main.js +3 -2
- package/src/runner.js +3 -2
package/package.json
CHANGED
package/src/main.js
CHANGED
|
@@ -138,7 +138,7 @@ Commands:
|
|
|
138
138
|
opendesign-upload --dir <path>
|
|
139
139
|
Alias for upload-artifact
|
|
140
140
|
preview-port --port <port> [--topic-id <id>] [--snapshot-dir <dir>]
|
|
141
|
-
Create a Cloud Sandbox preview URL
|
|
141
|
+
Create a Cloud Sandbox live preview URL; snapshots are opt-in
|
|
142
142
|
cleanup-previews Stop preview servers previously registered by this agent
|
|
143
143
|
help Show this help
|
|
144
144
|
`);
|
|
@@ -163,7 +163,8 @@ async function previewPort(config, argv) {
|
|
|
163
163
|
const url = preview.preview_url || preview.url;
|
|
164
164
|
if (!url) throw new Error('Cloud Sandbox preview API returned no URL');
|
|
165
165
|
const title = String(argv.title || argv.previewName || preview.name || 'Cloud Sandbox Preview').trim();
|
|
166
|
-
const
|
|
166
|
+
const wantsSnapshot = Boolean(String(argv.snapshotDir || '').trim()) && !argv.noSnapshot;
|
|
167
|
+
const snapshot = wantsSnapshot ? await createPreviewSnapshot(config, argv, { title }) : null;
|
|
167
168
|
const snapshotUrl = snapshot?.snapshot_url || '';
|
|
168
169
|
const markdown = JSON.stringify({
|
|
169
170
|
type: 'cloud_sandbox_preview',
|
package/src/runner.js
CHANGED
|
@@ -943,11 +943,12 @@ function renderCloudSandboxStorageInstruction(config, topicId = '') {
|
|
|
943
943
|
'- Before publishing a preview URL, verify the server is actually listening and serving content with `curl -fsS http://127.0.0.1:<port>/ >/dev/null`.',
|
|
944
944
|
'- If local curl fails, fix or restart the web server first. Never publish a preview URL for a dead port.',
|
|
945
945
|
'- `wtt-connect preview-port` automatically keeps the most recent preview servers for this agent and stops older registered previews beyond the retention limit. Default retention is 3 live previews; use `--keep-last <n>` only when the user asks.',
|
|
946
|
-
'-
|
|
946
|
+
'- Do not pass `--snapshot-dir` for normal live previews. Live Cloud Sandbox previews should render as inline WTT preview cards, not as ordinary index.html/document artifacts.',
|
|
947
|
+
'- If the user explicitly asks for a persistent static artifact or downloadable HTML, publish that separately with `wtt-connect upload-artifact --dir <dir> --title "Short Title"` instead of mixing it with the live preview URL.',
|
|
947
948
|
'- If you start a web server in the sandbox and the user should preview it, call the Cloudflare Sandbox outbound Worker directly with curl and include the returned `preview_url` in your reply as `[preview_url:Short Title](<preview_url>)`.',
|
|
948
949
|
'- Preview ports must be 1024-65535 and cannot be 3000. For Vite/Next-style dev servers prefer 5173, 4173, or 8080.',
|
|
949
950
|
`- Preview curl rule: curl -sS -X POST "\${WTT_SANDBOX_OUTBOX_URL:-http://wtt.preview}/preview-port" -H 'content-type: application/json' -d '{"agent_id":"'\${WTT_AGENT_ID:-cloud-agent}'","port":<port>}'`,
|
|
950
|
-
`- Prefer automatic WTT publishing when topic id is available: wtt-connect preview-port --port <port>${topicId ? ` --topic-id ${topicId}` : ' --topic-id <topic_id>'} --title "Short Title"
|
|
951
|
+
`- Prefer automatic WTT publishing when topic id is available: wtt-connect preview-port --port <port>${topicId ? ` --topic-id ${topicId}` : ' --topic-id <topic_id>'} --title "Short Title". This publishes one cloud_sandbox_preview live card.`,
|
|
951
952
|
);
|
|
952
953
|
return lines.join('\n');
|
|
953
954
|
}
|