@spacefast/common 0.0.26 → 0.2.1
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/connect-targets.d.ts +6 -146
- package/dist/agents/connect-targets.js +63 -295
- package/dist/agents/private-key-oauth.d.ts +31 -1
- package/dist/agents/private-key-oauth.js +124 -33
- package/dist/agents/registry/core.d.ts +292 -0
- package/dist/agents/registry/core.js +1388 -0
- package/dist/agents/registry/deeplink-probes.d.ts +23 -0
- package/dist/agents/registry/deeplink-probes.js +18 -0
- package/dist/agents/registry/node.d.ts +56 -0
- package/dist/agents/registry/node.js +339 -0
- package/dist/brand-assets-build.js +1 -2
- package/dist/brand-assets.js +4 -7
- package/dist/brand.d.ts +17 -0
- package/dist/brand.js +24 -4
- package/dist/config/domains.d.ts +55 -28
- package/dist/config/domains.js +85 -41
- package/dist/config/index.js +1 -2
- package/dist/contracts/abuse.js +9 -24
- package/dist/contracts/access-profiles.d.ts +86 -0
- package/dist/contracts/access-profiles.js +89 -0
- package/dist/contracts/access.d.ts +21 -27
- package/dist/contracts/access.js +33 -64
- package/dist/contracts/activity.d.ts +18 -1
- package/dist/contracts/activity.js +70 -26
- package/dist/contracts/analytics.js +8 -10
- package/dist/contracts/api-keys.d.ts +77 -52
- package/dist/contracts/api-keys.js +44 -24
- package/dist/contracts/application-journal.d.ts +216 -0
- package/dist/contracts/application-journal.js +167 -0
- package/dist/contracts/auth.d.ts +90 -17
- package/dist/contracts/auth.js +86 -17
- package/dist/contracts/beta.d.ts +9 -4
- package/dist/contracts/beta.js +20 -16
- package/dist/contracts/billing.js +7 -11
- package/dist/contracts/bootstrap.d.ts +791 -0
- package/dist/contracts/bootstrap.js +51 -0
- package/dist/contracts/builds.d.ts +186 -7
- package/dist/contracts/builds.js +75 -21
- package/dist/contracts/channels.d.ts +43 -0
- package/dist/contracts/channels.js +25 -9
- package/dist/contracts/cli.d.ts +7 -0
- package/dist/contracts/cli.js +6 -0
- package/dist/contracts/collab-public.d.ts +1 -1
- package/dist/contracts/collab-public.js +5 -8
- package/dist/contracts/comments.d.ts +45 -35
- package/dist/contracts/comments.js +107 -77
- package/dist/contracts/commerce.d.ts +165 -0
- package/dist/contracts/commerce.js +146 -0
- package/dist/contracts/common.d.ts +3 -3
- package/dist/contracts/common.js +18 -29
- package/dist/contracts/content-contract-verification.d.ts +521 -0
- package/dist/contracts/content-contract-verification.js +320 -0
- package/dist/contracts/content-platform-fixture.d.ts +1278 -0
- package/dist/contracts/content-platform-fixture.js +44 -0
- package/dist/contracts/content-program.d.ts +994 -0
- package/dist/contracts/content-program.js +658 -0
- package/dist/contracts/content-sync.d.ts +290 -0
- package/dist/contracts/content-sync.js +167 -0
- package/dist/contracts/content.d.ts +432 -0
- package/dist/contracts/content.js +303 -0
- package/dist/contracts/continuation.d.ts +17 -1
- package/dist/contracts/continuation.js +23 -23
- package/dist/contracts/countries.js +3 -4
- package/dist/contracts/crons.d.ts +17 -0
- package/dist/contracts/crons.js +33 -15
- package/dist/contracts/dashboard-prefs.d.ts +56 -0
- package/dist/contracts/dashboard-prefs.js +51 -0
- package/dist/contracts/device-auth.d.ts +234 -37
- package/dist/contracts/device-auth.js +267 -53
- package/dist/contracts/docs.d.ts +6 -10
- package/dist/contracts/docs.js +5 -13
- package/dist/contracts/domains.d.ts +499 -102
- package/dist/contracts/domains.js +169 -58
- package/dist/contracts/email-preferences.d.ts +3 -3
- package/dist/contracts/email-preferences.js +6 -7
- package/dist/contracts/enums.d.ts +26 -26
- package/dist/contracts/enums.js +61 -54
- package/dist/contracts/error-code-meta.d.ts +269 -7
- package/dist/contracts/error-code-meta.js +80 -5
- package/dist/contracts/error-codes.d.ts +5 -5
- package/dist/contracts/error-codes.js +78 -16
- package/dist/contracts/events.d.ts +100 -20
- package/dist/contracts/events.js +107 -20
- package/dist/contracts/execution.d.ts +47 -66
- package/dist/contracts/execution.js +51 -64
- package/dist/contracts/feature-lifecycle.d.ts +70 -14
- package/dist/contracts/feature-lifecycle.js +86 -15
- package/dist/contracts/features.d.ts +100 -37
- package/dist/contracts/features.js +21 -27
- package/dist/contracts/fixtures/content-platform-v1.json +1108 -0
- package/dist/contracts/frame-session.d.ts +192 -0
- package/dist/contracts/frame-session.js +164 -0
- package/dist/contracts/functions.d.ts +218 -211
- package/dist/contracts/functions.js +273 -260
- package/dist/contracts/grant-copy.d.ts +43 -0
- package/dist/contracts/grant-copy.js +44 -0
- package/dist/contracts/grants.d.ts +64 -56
- package/dist/contracts/grants.js +124 -23
- package/dist/contracts/ids.d.ts +4 -1
- package/dist/contracts/ids.js +4 -1
- package/dist/contracts/internal.d.ts +5 -4
- package/dist/contracts/internal.js +12 -3
- package/dist/contracts/mcp.d.ts +17 -0
- package/dist/contracts/mcp.js +23 -0
- package/dist/contracts/me.d.ts +6 -1
- package/dist/contracts/me.js +12 -6
- package/dist/contracts/notifications.d.ts +27 -29
- package/dist/contracts/notifications.js +9 -4
- package/dist/contracts/oauth-resources.d.ts +112 -10
- package/dist/contracts/oauth-resources.js +116 -11
- package/dist/contracts/oauth-scope-actions.d.ts +90 -0
- package/dist/contracts/oauth-scope-actions.js +126 -0
- package/dist/contracts/operations.d.ts +27 -4
- package/dist/contracts/operations.js +11 -5
- package/dist/contracts/pages.d.ts +29 -5
- package/dist/contracts/pages.js +22 -5
- package/dist/contracts/partner-notifications.d.ts +3 -0
- package/dist/contracts/partner-notifications.js +65 -0
- package/dist/contracts/{platform.d.ts → partner.d.ts} +29 -42
- package/dist/contracts/{platform.js → partner.js} +27 -40
- package/dist/contracts/plan-policy.d.ts +1 -1
- package/dist/contracts/principal-assertion.d.ts +43 -0
- package/dist/contracts/principal-assertion.js +67 -0
- package/dist/contracts/principals.d.ts +73 -0
- package/dist/contracts/principals.js +59 -0
- package/dist/contracts/privacy.d.ts +11 -0
- package/dist/contracts/privacy.js +17 -0
- package/dist/contracts/problem-document.js +3 -4
- package/dist/contracts/publish-archive.d.ts +116 -18
- package/dist/contracts/publish-archive.js +6 -3
- package/dist/contracts/push-new.d.ts +4 -4
- package/dist/contracts/quotas.js +3 -3
- package/dist/contracts/realtime.d.ts +52 -0
- package/dist/contracts/realtime.js +54 -0
- package/dist/contracts/repository-connections.d.ts +1 -1
- package/dist/contracts/repository-connections.js +6 -2
- package/dist/contracts/resources.d.ts +105 -14
- package/dist/contracts/resources.js +145 -21
- package/dist/contracts/route-inventory.d.ts +358 -0
- package/dist/contracts/route-inventory.js +141 -0
- package/dist/contracts/runtime-api.d.ts +112 -35
- package/dist/contracts/runtime-api.js +86 -66
- package/dist/contracts/runtime-app.d.ts +11 -21
- package/dist/contracts/runtime-app.js +39 -24
- package/dist/contracts/runtime-components.d.ts +143 -0
- package/dist/contracts/runtime-components.js +199 -0
- package/dist/contracts/runtime-db.d.ts +45 -19
- package/dist/contracts/runtime-db.js +85 -20
- package/dist/contracts/runtime-purge.js +3 -5
- package/dist/contracts/runtime-services.d.ts +43 -75
- package/dist/contracts/runtime-services.js +29 -49
- package/dist/contracts/runtime-storage.d.ts +14 -14
- package/dist/contracts/runtime-storage.js +28 -13
- package/dist/contracts/sf-config-v1.d.ts +14 -18
- package/dist/contracts/slugs.js +13 -4
- package/dist/contracts/space-config.d.ts +235 -28
- package/dist/contracts/space-config.js +246 -91
- package/dist/contracts/spaces.d.ts +360 -255
- package/dist/contracts/spaces.js +190 -122
- package/dist/contracts/superadmin-activity.d.ts +3 -43
- package/dist/contracts/superadmin-activity.js +6 -30
- package/dist/contracts/superadmin-emails.d.ts +1 -0
- package/dist/contracts/superadmin-emails.js +17 -1
- package/dist/contracts/superadmin-runtime.d.ts +199 -0
- package/dist/contracts/superadmin-runtime.js +141 -0
- package/dist/contracts/superadmin-search.d.ts +22 -2
- package/dist/contracts/superadmin-search.js +14 -6
- package/dist/contracts/superadmin-spaces.d.ts +435 -186
- package/dist/contracts/superadmin-spaces.js +131 -25
- package/dist/contracts/superadmin-teams.d.ts +3 -0
- package/dist/contracts/superadmin-teams.js +1 -2
- package/dist/contracts/superadmin-tenants.d.ts +627 -6
- package/dist/contracts/superadmin-tenants.js +32 -7
- package/dist/contracts/superadmin.d.ts +98 -16
- package/dist/contracts/superadmin.js +63 -10
- package/dist/contracts/tags.d.ts +85 -58
- package/dist/contracts/tags.js +44 -34
- package/dist/contracts/teams.d.ts +72 -9
- package/dist/contracts/teams.js +84 -25
- package/dist/contracts/tenants.d.ts +135 -0
- package/dist/contracts/tenants.js +120 -0
- package/dist/contracts/test-triggers.d.ts +70 -0
- package/dist/contracts/test-triggers.js +116 -0
- package/dist/contracts/theme-json.js +3 -8
- package/dist/contracts/transfers.d.ts +1 -0
- package/dist/contracts/transfers.js +1 -0
- package/dist/contracts/usage.d.ts +209 -0
- package/dist/contracts/usage.js +124 -12
- package/dist/contracts/variables.d.ts +2 -2
- package/dist/contracts/variables.js +9 -13
- package/dist/contracts/webhooks.d.ts +13 -5
- package/dist/contracts/webhooks.js +3 -1
- package/dist/contracts/zero.d.ts +57 -64
- package/dist/contracts/zero.js +68 -66
- package/dist/dashboard-paths/index.d.ts +24 -21
- package/dist/dashboard-paths/index.js +35 -47
- package/dist/dashboard-paths/route-reservations.generated.d.ts +2 -0
- package/dist/dashboard-paths/route-reservations.generated.js +36 -0
- package/dist/docs/agent-arrival.d.ts +92 -0
- package/dist/docs/agent-arrival.js +227 -0
- package/dist/docs/agent-output-policy.d.ts +6 -0
- package/dist/docs/agent-output-policy.js +22 -0
- package/dist/docs/agent-prose.d.ts +11 -17
- package/dist/docs/agent-prose.js +62 -37
- package/dist/docs/agent-setup.d.ts +72 -41
- package/dist/docs/agent-setup.js +336 -436
- package/dist/docs/catalog.d.ts +147 -89
- package/dist/docs/catalog.js +157 -42
- package/dist/docs/error-docs.d.ts +2098 -1
- package/dist/docs/error-docs.js +281 -16
- package/dist/docs/index-build.d.ts +0 -1
- package/dist/docs/index-build.js +2 -3
- package/dist/docs/page-context-prompt.d.ts +77 -0
- package/dist/docs/page-context-prompt.js +131 -0
- package/dist/docs/reference-urls.d.ts +46 -0
- package/dist/docs/reference-urls.js +79 -0
- package/dist/docs/search.d.ts +6 -8
- package/dist/docs/search.js +10 -13
- package/dist/docs/skill-distribution.d.ts +4 -1
- package/dist/docs/skill-distribution.js +10 -5
- package/dist/docs/skills.d.ts +117 -117
- package/dist/docs/skills.js +120 -72
- package/dist/docs/start-prompts.d.ts +45 -0
- package/dist/docs/start-prompts.js +62 -0
- package/dist/domain-exploration.js +9 -13
- package/dist/og-template.d.ts +56 -0
- package/dist/og-template.js +56 -0
- package/dist/slug-policy/index.js +5 -11
- package/dist/utils/browser-credential.d.ts +13 -6
- package/dist/utils/browser-credential.js +14 -7
- package/dist/utils/build-settings.d.ts +16 -0
- package/dist/utils/build-settings.js +63 -17
- package/dist/utils/canonical-json.d.ts +3 -5
- package/dist/utils/canonical-json.js +3 -5
- package/dist/utils/cast-transport.d.ts +5 -17
- package/dist/utils/cast-transport.js +6 -19
- package/dist/utils/claim-token.js +1 -2
- package/dist/utils/comment-avatars.js +4 -6
- package/dist/utils/concurrency.js +2 -3
- package/dist/utils/content-type.d.ts +7 -6
- package/dist/utils/content-type.js +73 -51
- package/dist/utils/credential-policy.d.ts +50 -6
- package/dist/utils/credential-policy.js +123 -57
- package/dist/utils/egress-policy.fixtures.json +1 -1
- package/dist/utils/generate-space-name.d.ts +3 -8
- package/dist/utils/generate-space-name.js +3 -8
- package/dist/utils/grants.d.ts +0 -1
- package/dist/utils/grants.js +4 -7
- package/dist/utils/gravatar.d.ts +2 -4
- package/dist/utils/gravatar.js +6 -12
- package/dist/utils/id-hints.js +14 -23
- package/dist/utils/idempotency.d.ts +3 -3
- package/dist/utils/idempotency.js +6 -7
- package/dist/utils/local-space-state.d.ts +15 -15
- package/dist/utils/local-space-state.js +34 -23
- package/dist/utils/oauth-signed-query.d.ts +3 -5
- package/dist/utils/oauth-signed-query.js +6 -9
- package/dist/utils/one-shot-replay.d.ts +3 -5
- package/dist/utils/one-shot-replay.js +3 -5
- package/dist/utils/page-colors.d.ts +4 -10
- package/dist/utils/page-colors.js +11 -35
- package/dist/utils/page-fonts.js +6 -11
- package/dist/utils/page-preview.d.ts +0 -1
- package/dist/utils/page-preview.js +0 -1
- package/dist/utils/pages.d.ts +22 -11
- package/dist/utils/pages.js +70 -30
- package/dist/utils/privacy-regions.d.ts +19 -0
- package/dist/utils/privacy-regions.js +91 -0
- package/dist/utils/publish-form-data.d.ts +4 -5
- package/dist/utils/publish-form-data.js +2 -3
- package/dist/utils/publish-policy.d.ts +10 -23
- package/dist/utils/publish-policy.js +63 -116
- package/dist/utils/query-client.d.ts +2 -0
- package/dist/utils/query-client.js +10 -1
- package/dist/utils/runtime-paths.d.ts +4 -4
- package/dist/utils/runtime-paths.js +6 -8
- package/dist/utils/runtime-upload.d.ts +4 -0
- package/dist/utils/runtime-upload.js +5 -0
- package/dist/utils/secure-local-file.d.ts +3 -3
- package/dist/utils/secure-local-file.js +18 -24
- package/dist/utils/space-config.d.ts +11 -14
- package/dist/utils/space-config.js +10 -16
- package/dist/utils/static-runtime-policy.d.ts +5 -8
- package/dist/utils/static-runtime-policy.generated.d.ts +16 -0
- package/dist/utils/static-runtime-policy.generated.js +70 -0
- package/dist/utils/static-runtime-policy.js +17 -84
- package/dist/utils/storage-policy.js +1 -2
- package/dist/utils/upload-session.js +8 -14
- package/dist/utils/version-path.js +11 -19
- package/dist/utils/wpcom-auth-redirects.d.ts +5 -14
- package/dist/utils/wpcom-auth-redirects.js +1 -4
- package/dist/vocabulary.d.ts +7 -7
- package/dist/vocabulary.js +30 -16
- package/package.json +14 -2
- package/dist/agents/client-registry.d.ts +0 -22
- package/dist/agents/client-registry.js +0 -41
- package/dist/docs/agent-handoff-document.d.ts +0 -15
- package/dist/docs/agent-handoff-document.js +0 -180
- package/dist/docs/agent-solutions.d.ts +0 -110
- package/dist/docs/agent-solutions.js +0 -183
- package/dist/utils/query-keys.d.ts +0 -84
- package/dist/utils/query-keys.js +0 -108
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* "Copy for AI" for a dashboard page: what Spacefast is, what the user is
|
|
3
|
+
* looking at, the state of the thing on screen, the values already typed into
|
|
4
|
+
* the open form, the docs, the API operations, and the equivalent CLI commands.
|
|
5
|
+
*
|
|
6
|
+
* The output is a pasted prompt an agent reads whole, not a manual. Three rules
|
|
7
|
+
* keep it useful rather than decorative:
|
|
8
|
+
*
|
|
9
|
+
* 1. **Positioning first.** An agent that has never heard of Spacefast is
|
|
10
|
+
* told what it is before it is handed endpoints (`SPACEFAST_POSITIONING`).
|
|
11
|
+
* 2. **Every reference is specific.** Docs entries, API operations and CLI
|
|
12
|
+
* commands each carry their own deep link. Three commands never share one
|
|
13
|
+
* link to a section root.
|
|
14
|
+
* 3. **Nothing here is written twice.** Commands, usage lines, URLs and
|
|
15
|
+
* schema locations come from the registries that own them — the oclif
|
|
16
|
+
* manifest, the OpenAPI document, ./skill-distribution.ts,
|
|
17
|
+
* ./agent-setup.ts and ./reference-urls.ts. This module formats; it does
|
|
18
|
+
* not remember.
|
|
19
|
+
*
|
|
20
|
+
* Filtering secrets is the caller's job: the dashboard picks which form fields
|
|
21
|
+
* are safe to include.
|
|
22
|
+
*/
|
|
23
|
+
import { BRAND, SPACEFAST_POSITIONING, SPACEFAST_POSITIONING_SHORT } from "../brand.js";
|
|
24
|
+
import { serviceOrigin } from "../config/domains.js";
|
|
25
|
+
import { agentSetupUrl } from "./agent-setup.js";
|
|
26
|
+
import { spacefastInstallCurlCommand } from "./skill-distribution.js";
|
|
27
|
+
const FORM_HYGIENE_NOTE = "These values exclude secrets. Never ask the user to paste a credential, and never echo one back.";
|
|
28
|
+
/** One form value as a single line. Untouched fields return null so they are dropped. */
|
|
29
|
+
function formatValue(value) {
|
|
30
|
+
if (Array.isArray(value)) {
|
|
31
|
+
const items = value.filter((item) => item.trim() !== "");
|
|
32
|
+
return items.length > 0 ? items.join(", ") : null;
|
|
33
|
+
}
|
|
34
|
+
const text = String(value);
|
|
35
|
+
return text.trim() === "" ? null : text;
|
|
36
|
+
}
|
|
37
|
+
function formLines(form) {
|
|
38
|
+
return Object.entries(form.values).flatMap(([key, value]) => {
|
|
39
|
+
const formatted = formatValue(value);
|
|
40
|
+
return formatted === null ? [] : [`- ${key}: ${formatted}`];
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* `sf builds ls --space docs --json # List builds. Docs: https://…#sf-builds-ls`
|
|
45
|
+
*
|
|
46
|
+
* One line per command, so a page with eight commands still fits on a screen.
|
|
47
|
+
* A command with neither summary nor link is just the invocation.
|
|
48
|
+
*/
|
|
49
|
+
function cliLine(entry) {
|
|
50
|
+
const notes = [entry.summary, entry.docsUrl ? `Docs: ${entry.docsUrl}` : undefined].filter((part) => part !== undefined && part.trim() !== "");
|
|
51
|
+
return notes.length === 0 ? entry.command : `${entry.command} # ${notes.join(" ")}`;
|
|
52
|
+
}
|
|
53
|
+
/** Builds the copy-ready markdown prompt for one dashboard page. Pure: same input, same bytes. */
|
|
54
|
+
export function buildPageContextPrompt(input) {
|
|
55
|
+
const lines = [
|
|
56
|
+
`# ${input.page.title}`,
|
|
57
|
+
"",
|
|
58
|
+
SPACEFAST_POSITIONING,
|
|
59
|
+
"",
|
|
60
|
+
`The user is on this ${BRAND.productName} dashboard page: ${input.page.url}`,
|
|
61
|
+
];
|
|
62
|
+
if (input.page.description)
|
|
63
|
+
lines.push(input.page.description);
|
|
64
|
+
if (input.facts && input.facts.items.length > 0) {
|
|
65
|
+
lines.push("", `## ${input.facts.title}`, "");
|
|
66
|
+
for (const fact of input.facts.items)
|
|
67
|
+
lines.push(`- ${fact.label}: ${fact.value}`);
|
|
68
|
+
}
|
|
69
|
+
const values = input.form ? formLines(input.form) : [];
|
|
70
|
+
if (input.form && values.length > 0) {
|
|
71
|
+
lines.push("", "## Continue what's in progress", "", `${input.form.surface}:`, ...values);
|
|
72
|
+
lines.push("", FORM_HYGIENE_NOTE);
|
|
73
|
+
}
|
|
74
|
+
if (input.docs.length > 0) {
|
|
75
|
+
lines.push("", "## Read the docs", "");
|
|
76
|
+
for (const doc of input.docs)
|
|
77
|
+
lines.push(`- ${doc.title} — ${doc.url}`);
|
|
78
|
+
}
|
|
79
|
+
if (input.operations.length > 0) {
|
|
80
|
+
lines.push("", "## Call the API", "");
|
|
81
|
+
for (const operation of input.operations) {
|
|
82
|
+
// A spec without a summary for this operation ends the line at the path,
|
|
83
|
+
// rather than at a dash pointing to nothing.
|
|
84
|
+
const call = `- ${operation.method} ${operation.path}`;
|
|
85
|
+
lines.push(operation.summary.trim() === "" ? call : `${call} — ${operation.summary}`);
|
|
86
|
+
// The reference page carries the parameters and the request/response
|
|
87
|
+
// schemas, so the prompt links there instead of copying a shape that
|
|
88
|
+
// would drift from the spec on the next deploy.
|
|
89
|
+
if (operation.docsUrl)
|
|
90
|
+
lines.push(` Schema: ${operation.docsUrl}`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (input.cli.length > 0) {
|
|
94
|
+
lines.push("", "## Run the CLI", "", "```bash");
|
|
95
|
+
for (const entry of input.cli)
|
|
96
|
+
lines.push(cliLine(entry));
|
|
97
|
+
lines.push("```", "", "## Get the CLI", "", "```bash");
|
|
98
|
+
lines.push(spacefastInstallCurlCommand, "sf login", "```");
|
|
99
|
+
}
|
|
100
|
+
if (input.mcp) {
|
|
101
|
+
lines.push("", "## Or connect over MCP", "", `Hosted MCP endpoint: ${serviceOrigin("mcp", "prod")} — per-client setup: ${agentSetupUrl}`);
|
|
102
|
+
}
|
|
103
|
+
return `${lines.join("\n")}\n`;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Adds one private exchange to the safe page brief. The caller must send this
|
|
107
|
+
* result only to the clipboard. The private URL must not enter a rendered node,
|
|
108
|
+
* a query string, a log, or a cache key.
|
|
109
|
+
*
|
|
110
|
+
* The wording is calibrated on fresh-agent evals. First person — the user is
|
|
111
|
+
* the one pasting it, so the user is speaking. It says what the link is BEFORE
|
|
112
|
+
* asking for the fetch, because an unexplained "fetch this and obey it" reads
|
|
113
|
+
* as a phishing template to a careful agent. And it names the right mechanics:
|
|
114
|
+
* the naive `curl <url>` puts the bearer in argv and shell history, so the
|
|
115
|
+
* prompt says to use a URL-fetch tool.
|
|
116
|
+
*/
|
|
117
|
+
export function buildPrivatePageContextPrompt(input) {
|
|
118
|
+
const context = input.context.trimEnd();
|
|
119
|
+
const closing = input.closing ??
|
|
120
|
+
"Then continue the page task with the references above. Publish or change data only when the task requires it.";
|
|
121
|
+
return `${context}
|
|
122
|
+
|
|
123
|
+
## Connect ${input.targetLabel} privately
|
|
124
|
+
|
|
125
|
+
${SPACEFAST_POSITIONING_SHORT} I made you a one-use sign-in link. Fetch it with your URL-fetch tool and follow the document it returns: ${input.handoffUrl}
|
|
126
|
+
|
|
127
|
+
Keep the link out of shell commands, logs, and replies. Fetching is read-only and leaves the link live. Expires: ${input.expiresAt}.
|
|
128
|
+
|
|
129
|
+
${closing}
|
|
130
|
+
`;
|
|
131
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** The single CLI reference page. Every command is an anchor on it. */
|
|
2
|
+
export declare const CLI_DOCS_URL: string;
|
|
3
|
+
/** The API reference index. Every operation is a page under it. */
|
|
4
|
+
export declare const API_REFERENCE_URL: string;
|
|
5
|
+
/**
|
|
6
|
+
* The partner API reference index. The docs exporter publishes two reference
|
|
7
|
+
* trees from two OpenAPI documents — the consumer spec under
|
|
8
|
+
* {@link API_REFERENCE_URL} and the partner spec here — with the same
|
|
9
|
+
* `<tag>/<operationid>` page shape under each. Partner-visibility operations
|
|
10
|
+
* exist only in the second tree, so linking them at the consumer base lands on
|
|
11
|
+
* a page that was never generated.
|
|
12
|
+
*/
|
|
13
|
+
export declare const PARTNER_API_REFERENCE_URL: string;
|
|
14
|
+
/** Which of the two published reference trees an operation's page lives in. */
|
|
15
|
+
export type ApiDocsVisibility = "public" | "partner";
|
|
16
|
+
/**
|
|
17
|
+
* The docs site's heading-anchor slug: lowercase, every run of anything that
|
|
18
|
+
* is not a letter or digit collapsed to one dash, no leading or trailing dash.
|
|
19
|
+
* `sf api METHODORPATH [PATH]` → `sf-api-methodorpath-path`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function docsHeadingAnchor(heading: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Deep link to one CLI command's section of the CLI reference.
|
|
24
|
+
*
|
|
25
|
+
* `commandName` is the manifest's rendered invocation — `sf builds ls`,
|
|
26
|
+
* `sf domains add HOSTNAME` — exactly as the docs exporter prints it in the
|
|
27
|
+
* heading. Anything that does not slugify to something (an empty name) falls
|
|
28
|
+
* back to the page rather than emitting a `#` that scrolls nowhere.
|
|
29
|
+
*/
|
|
30
|
+
export declare function cliCommandDocsUrl(commandName: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Deep link to one API operation's reference page, which is also where its
|
|
33
|
+
* request and response schemas are rendered.
|
|
34
|
+
*
|
|
35
|
+
* `tag` is the operation's first OpenAPI tag; the reference groups pages by it.
|
|
36
|
+
* An untagged operation has no page of its own, so it gets the index.
|
|
37
|
+
*
|
|
38
|
+
* `visibility` picks the tree. It defaults to `"public"`, which is right for
|
|
39
|
+
* every caller reading the consumer spec; pass `"partner"` for an operation
|
|
40
|
+
* that only appears in the partner document.
|
|
41
|
+
*/
|
|
42
|
+
export declare function apiOperationDocsUrl(operation: {
|
|
43
|
+
readonly operationId: string;
|
|
44
|
+
readonly tag?: string;
|
|
45
|
+
readonly visibility?: ApiDocsVisibility;
|
|
46
|
+
}): string;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Deep links into the published documentation, derived rather than written.
|
|
3
|
+
*
|
|
4
|
+
* The docs site freezes two generated route shapes (they are public contracts
|
|
5
|
+
* and can never move):
|
|
6
|
+
*
|
|
7
|
+
* - `/docs/cli` is one page per CLI, with one `## \`sf <command>\`` heading
|
|
8
|
+
* per command. Its anchors are the heading text slugified, so
|
|
9
|
+
* `## \`sf builds cancel BUILD\`` is `#sf-builds-cancel-build`.
|
|
10
|
+
* - `/docs/api/reference/<tag>/<operationid>` is one page per API operation,
|
|
11
|
+
* carrying that operation's parameters and request/response schemas. Both
|
|
12
|
+
* segments are lowercased.
|
|
13
|
+
*
|
|
14
|
+
* Everything here is a pure function of what a registry already holds — the
|
|
15
|
+
* oclif manifest's command name, the OpenAPI operation's id and tag. Nothing
|
|
16
|
+
* in this file is a second copy of a URL that could drift from the docs; a
|
|
17
|
+
* caller that cannot produce the registry value gets the section root instead
|
|
18
|
+
* of a guess.
|
|
19
|
+
*
|
|
20
|
+
* This module deliberately imports only the domain registry. The dashboard
|
|
21
|
+
* resolves references against the megabyte-scale docs catalog and CLI manifest
|
|
22
|
+
* behind a dynamic import, and a URL helper that dragged the catalog in with it
|
|
23
|
+
* would undo that.
|
|
24
|
+
*/
|
|
25
|
+
import { DOCS_BASE_URL } from "../config/domains.js";
|
|
26
|
+
/** The single CLI reference page. Every command is an anchor on it. */
|
|
27
|
+
export const CLI_DOCS_URL = `${DOCS_BASE_URL}/cli`;
|
|
28
|
+
/** The API reference index. Every operation is a page under it. */
|
|
29
|
+
export const API_REFERENCE_URL = `${DOCS_BASE_URL}/api/reference`;
|
|
30
|
+
/**
|
|
31
|
+
* The partner API reference index. The docs exporter publishes two reference
|
|
32
|
+
* trees from two OpenAPI documents — the consumer spec under
|
|
33
|
+
* {@link API_REFERENCE_URL} and the partner spec here — with the same
|
|
34
|
+
* `<tag>/<operationid>` page shape under each. Partner-visibility operations
|
|
35
|
+
* exist only in the second tree, so linking them at the consumer base lands on
|
|
36
|
+
* a page that was never generated.
|
|
37
|
+
*/
|
|
38
|
+
export const PARTNER_API_REFERENCE_URL = `${DOCS_BASE_URL}/partners/api/reference`;
|
|
39
|
+
/**
|
|
40
|
+
* The docs site's heading-anchor slug: lowercase, every run of anything that
|
|
41
|
+
* is not a letter or digit collapsed to one dash, no leading or trailing dash.
|
|
42
|
+
* `sf api METHODORPATH [PATH]` → `sf-api-methodorpath-path`.
|
|
43
|
+
*/
|
|
44
|
+
export function docsHeadingAnchor(heading) {
|
|
45
|
+
return heading
|
|
46
|
+
.toLowerCase()
|
|
47
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
48
|
+
.replace(/^-+|-+$/g, "");
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Deep link to one CLI command's section of the CLI reference.
|
|
52
|
+
*
|
|
53
|
+
* `commandName` is the manifest's rendered invocation — `sf builds ls`,
|
|
54
|
+
* `sf domains add HOSTNAME` — exactly as the docs exporter prints it in the
|
|
55
|
+
* heading. Anything that does not slugify to something (an empty name) falls
|
|
56
|
+
* back to the page rather than emitting a `#` that scrolls nowhere.
|
|
57
|
+
*/
|
|
58
|
+
export function cliCommandDocsUrl(commandName) {
|
|
59
|
+
const anchor = docsHeadingAnchor(commandName);
|
|
60
|
+
return anchor === "" ? CLI_DOCS_URL : `${CLI_DOCS_URL}#${anchor}`;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Deep link to one API operation's reference page, which is also where its
|
|
64
|
+
* request and response schemas are rendered.
|
|
65
|
+
*
|
|
66
|
+
* `tag` is the operation's first OpenAPI tag; the reference groups pages by it.
|
|
67
|
+
* An untagged operation has no page of its own, so it gets the index.
|
|
68
|
+
*
|
|
69
|
+
* `visibility` picks the tree. It defaults to `"public"`, which is right for
|
|
70
|
+
* every caller reading the consumer spec; pass `"partner"` for an operation
|
|
71
|
+
* that only appears in the partner document.
|
|
72
|
+
*/
|
|
73
|
+
export function apiOperationDocsUrl(operation) {
|
|
74
|
+
const base = operation.visibility === "partner" ? PARTNER_API_REFERENCE_URL : API_REFERENCE_URL;
|
|
75
|
+
const tag = operation.tag?.trim() ?? "";
|
|
76
|
+
if (tag === "" || operation.operationId.trim() === "")
|
|
77
|
+
return base;
|
|
78
|
+
return `${base}/${tag.toLowerCase()}/${operation.operationId.toLowerCase()}`;
|
|
79
|
+
}
|
package/dist/docs/search.d.ts
CHANGED
|
@@ -26,19 +26,17 @@ export interface DocsCommandResult {
|
|
|
26
26
|
}
|
|
27
27
|
/** Entries visible at `viewTier`, in catalog order. */
|
|
28
28
|
export declare function visibleEntries(index: DocsIndex, viewTier: CliDisclosureTier): DocIndexEntry[];
|
|
29
|
-
/** Exact topic lookup by slug (case-insensitive). Ignores tier
|
|
29
|
+
/** Exact topic lookup by slug (case-insensitive). Ignores tier, because explicit intent wins. */
|
|
30
30
|
export declare function findTopic(index: DocsIndex, slug: string): DocIndexEntry | undefined;
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* an intentional "show me everything at this tier" request, not a search.
|
|
32
|
+
* Caps ranked query results so a broad term cannot return the whole catalog
|
|
33
|
+
* (~390 entries are generated error references). An empty query is a listing,
|
|
34
|
+
* not a search, and stays uncapped.
|
|
36
35
|
*/
|
|
37
36
|
export declare const SEARCH_DOCS_RESULT_LIMIT = 25;
|
|
38
37
|
/**
|
|
39
|
-
* Rank docs matching `query` within the tier.
|
|
40
|
-
* listing
|
|
41
|
-
* the result count at {@link SEARCH_DOCS_RESULT_LIMIT}.
|
|
38
|
+
* Rank docs matching `query` within the tier. An empty query returns the full
|
|
39
|
+
* tier listing in catalog order.
|
|
42
40
|
*/
|
|
43
41
|
export declare function searchDocs(index: DocsIndex, options: {
|
|
44
42
|
query?: string;
|
package/dist/docs/search.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
// Pure, offline search + tier filtering over a docs index.
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
// (`--full`) and REFERENCE (`--all`).
|
|
1
|
+
// Pure, offline search + tier filtering over a docs index. The CLI's `sf docs`
|
|
2
|
+
// (bundled JSON) and the control-plane's GET /v1/docs (in-memory, catalog-
|
|
3
|
+
// derived) both use it, so they rank and gate identically. ESSENTIAL by default;
|
|
4
|
+
// `--full` and `--all` widen the tier.
|
|
6
5
|
import { tierVisibleAt } from "../vocabulary.js";
|
|
7
6
|
function toResult(entry) {
|
|
8
7
|
return {
|
|
@@ -21,7 +20,7 @@ function toTopic(entry) {
|
|
|
21
20
|
export function visibleEntries(index, viewTier) {
|
|
22
21
|
return index.entries.filter((entry) => tierVisibleAt(viewTier, entry.tier));
|
|
23
22
|
}
|
|
24
|
-
/** Exact topic lookup by slug (case-insensitive). Ignores tier
|
|
23
|
+
/** Exact topic lookup by slug (case-insensitive). Ignores tier, because explicit intent wins. */
|
|
25
24
|
export function findTopic(index, slug) {
|
|
26
25
|
const needle = slug.trim().toLowerCase();
|
|
27
26
|
if (!needle)
|
|
@@ -53,16 +52,14 @@ function scoreEntry(entry, tokens) {
|
|
|
53
52
|
return total;
|
|
54
53
|
}
|
|
55
54
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* an intentional "show me everything at this tier" request, not a search.
|
|
55
|
+
* Caps ranked query results so a broad term cannot return the whole catalog
|
|
56
|
+
* (~390 entries are generated error references). An empty query is a listing,
|
|
57
|
+
* not a search, and stays uncapped.
|
|
60
58
|
*/
|
|
61
59
|
export const SEARCH_DOCS_RESULT_LIMIT = 25;
|
|
62
60
|
/**
|
|
63
|
-
* Rank docs matching `query` within the tier.
|
|
64
|
-
* listing
|
|
65
|
-
* the result count at {@link SEARCH_DOCS_RESULT_LIMIT}.
|
|
61
|
+
* Rank docs matching `query` within the tier. An empty query returns the full
|
|
62
|
+
* tier listing in catalog order.
|
|
66
63
|
*/
|
|
67
64
|
export function searchDocs(index, options) {
|
|
68
65
|
const pool = visibleEntries(index, options.tier);
|
|
@@ -5,12 +5,15 @@ export declare const spacefastSkillRepoRef = "spacefast/plugins";
|
|
|
5
5
|
export declare const spacefastSkillUrl: string;
|
|
6
6
|
export declare const spacefastSkillFetchCommand: string;
|
|
7
7
|
export declare const spacefastSkillInstallCommand = "npx -y skills add spacefast/plugins --skill spacefast -g -y";
|
|
8
|
+
export declare const publishedSkillsCliPackageSpec = "skills@1.5.23";
|
|
9
|
+
export declare const spacefastPublishedSkillInstallCommand = "npx -y skills@1.5.23 add spacefast/plugins --skill spacefast -g -y";
|
|
8
10
|
export declare const spacefastInstallCurlCommand: string;
|
|
9
11
|
export declare const spacefastInstallPowerShellCommand: string;
|
|
10
12
|
export declare const spacefastInstallNpmCommand = "npm install -g spacefast";
|
|
13
|
+
/** Runs the CLI with no install wherever npx exists; same commands as `sf`. */
|
|
14
|
+
export declare const spacefastNpxCommand = "npx -y spacefast";
|
|
11
15
|
export declare const spacefastClaudePluginAddCommand = "claude plugin marketplace add spacefast/plugins";
|
|
12
16
|
export declare const spacefastClaudePluginInstallCommand = "claude plugin install spacefast@spacefast";
|
|
13
17
|
export declare const spacefastClaudeDesktopExtensionUrl = "https://github.com/spacefast/plugins/releases/latest/download/claude-desktop.mcpb";
|
|
14
18
|
export declare const spacefastCodexPluginAddCommand = "codex plugin marketplace add spacefast/plugins";
|
|
15
19
|
export declare const spacefastCodexPluginInstallCommand = "codex plugin add spacefast@spacefast";
|
|
16
|
-
export declare const spacefastCodexSkillInstallCommand = "npx -y skills add spacefast/plugins --skill spacefast -g -a codex -y";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SKILLS_CLI_PACKAGE_SPEC } from "../agents/registry/core.js";
|
|
1
2
|
import { serviceOrigin } from "../config/domains.js";
|
|
2
3
|
export const spacefastSkillName = "spacefast";
|
|
3
4
|
export const spacefastSkillRepoOwner = "spacefast";
|
|
@@ -5,17 +6,21 @@ export const spacefastSkillRepoName = "plugins";
|
|
|
5
6
|
export const spacefastSkillRepoRef = `${spacefastSkillRepoOwner}/${spacefastSkillRepoName}`;
|
|
6
7
|
export const spacefastSkillUrl = `${serviceOrigin("api", "prod")}/skill`;
|
|
7
8
|
export const spacefastSkillFetchCommand = `curl -fsSL ${spacefastSkillUrl}`;
|
|
8
|
-
export const spacefastSkillInstallCommand = `npx -y
|
|
9
|
+
export const spacefastSkillInstallCommand = `npx -y ${SKILLS_CLI_PACKAGE_SPEC} add ${spacefastSkillRepoRef} --skill ${spacefastSkillName} -g -y`;
|
|
10
|
+
// Published plugin and marketplace artifacts are scanned as executable supply-chain inputs.
|
|
11
|
+
// Keep their installer exact even though interactive setup instructions intentionally track latest.
|
|
12
|
+
export const publishedSkillsCliPackageSpec = "skills@1.5.23";
|
|
13
|
+
export const spacefastPublishedSkillInstallCommand = `npx -y ${publishedSkillsCliPackageSpec} add ${spacefastSkillRepoRef} --skill ${spacefastSkillName} -g -y`;
|
|
9
14
|
export const spacefastInstallCurlCommand = `curl -fsSL ${serviceOrigin("www", "prod")}/install.sh | bash`;
|
|
10
15
|
export const spacefastInstallPowerShellCommand = `irm ${serviceOrigin("www", "prod")}/install.ps1 | iex`;
|
|
11
16
|
// The npm lane: the `spacefast` package ships both the `sf` and `spacefast` bins.
|
|
12
17
|
export const spacefastInstallNpmCommand = "npm install -g spacefast";
|
|
18
|
+
/** Runs the CLI with no install wherever npx exists; same commands as `sf`. */
|
|
19
|
+
export const spacefastNpxCommand = "npx -y spacefast";
|
|
13
20
|
export const spacefastClaudePluginAddCommand = `claude plugin marketplace add ${spacefastSkillRepoRef}`;
|
|
14
21
|
export const spacefastClaudePluginInstallCommand = `claude plugin install ${spacefastSkillName}@${spacefastSkillName}`;
|
|
15
22
|
export const spacefastClaudeDesktopExtensionUrl = `https://github.com/${spacefastSkillRepoRef}/releases/latest/download/claude-desktop.mcpb`;
|
|
16
|
-
// Codex mirrors the Claude plugin commands
|
|
17
|
-
//
|
|
18
|
-
// assembled dist/plugins tree.
|
|
23
|
+
// Codex mirrors the Claude plugin commands: same marketplace repo, same plugin
|
|
24
|
+
// name. The release workflow validates both installs against dist/plugins.
|
|
19
25
|
export const spacefastCodexPluginAddCommand = `codex plugin marketplace add ${spacefastSkillRepoRef}`;
|
|
20
26
|
export const spacefastCodexPluginInstallCommand = `codex plugin add ${spacefastSkillName}@${spacefastSkillName}`;
|
|
21
|
-
export const spacefastCodexSkillInstallCommand = `npx -y skills add ${spacefastSkillRepoRef} --skill ${spacefastSkillName} -g -a codex -y`;
|