@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.
Files changed (302) hide show
  1. package/dist/agents/connect-targets.d.ts +6 -146
  2. package/dist/agents/connect-targets.js +63 -295
  3. package/dist/agents/private-key-oauth.d.ts +31 -1
  4. package/dist/agents/private-key-oauth.js +124 -33
  5. package/dist/agents/registry/core.d.ts +292 -0
  6. package/dist/agents/registry/core.js +1388 -0
  7. package/dist/agents/registry/deeplink-probes.d.ts +23 -0
  8. package/dist/agents/registry/deeplink-probes.js +18 -0
  9. package/dist/agents/registry/node.d.ts +56 -0
  10. package/dist/agents/registry/node.js +339 -0
  11. package/dist/brand-assets-build.js +1 -2
  12. package/dist/brand-assets.js +4 -7
  13. package/dist/brand.d.ts +17 -0
  14. package/dist/brand.js +24 -4
  15. package/dist/config/domains.d.ts +55 -28
  16. package/dist/config/domains.js +85 -41
  17. package/dist/config/index.js +1 -2
  18. package/dist/contracts/abuse.js +9 -24
  19. package/dist/contracts/access-profiles.d.ts +86 -0
  20. package/dist/contracts/access-profiles.js +89 -0
  21. package/dist/contracts/access.d.ts +21 -27
  22. package/dist/contracts/access.js +33 -64
  23. package/dist/contracts/activity.d.ts +18 -1
  24. package/dist/contracts/activity.js +70 -26
  25. package/dist/contracts/analytics.js +8 -10
  26. package/dist/contracts/api-keys.d.ts +77 -52
  27. package/dist/contracts/api-keys.js +44 -24
  28. package/dist/contracts/application-journal.d.ts +216 -0
  29. package/dist/contracts/application-journal.js +167 -0
  30. package/dist/contracts/auth.d.ts +90 -17
  31. package/dist/contracts/auth.js +86 -17
  32. package/dist/contracts/beta.d.ts +9 -4
  33. package/dist/contracts/beta.js +20 -16
  34. package/dist/contracts/billing.js +7 -11
  35. package/dist/contracts/bootstrap.d.ts +791 -0
  36. package/dist/contracts/bootstrap.js +51 -0
  37. package/dist/contracts/builds.d.ts +186 -7
  38. package/dist/contracts/builds.js +75 -21
  39. package/dist/contracts/channels.d.ts +43 -0
  40. package/dist/contracts/channels.js +25 -9
  41. package/dist/contracts/cli.d.ts +7 -0
  42. package/dist/contracts/cli.js +6 -0
  43. package/dist/contracts/collab-public.d.ts +1 -1
  44. package/dist/contracts/collab-public.js +5 -8
  45. package/dist/contracts/comments.d.ts +45 -35
  46. package/dist/contracts/comments.js +107 -77
  47. package/dist/contracts/commerce.d.ts +165 -0
  48. package/dist/contracts/commerce.js +146 -0
  49. package/dist/contracts/common.d.ts +3 -3
  50. package/dist/contracts/common.js +18 -29
  51. package/dist/contracts/content-contract-verification.d.ts +521 -0
  52. package/dist/contracts/content-contract-verification.js +320 -0
  53. package/dist/contracts/content-platform-fixture.d.ts +1278 -0
  54. package/dist/contracts/content-platform-fixture.js +44 -0
  55. package/dist/contracts/content-program.d.ts +994 -0
  56. package/dist/contracts/content-program.js +658 -0
  57. package/dist/contracts/content-sync.d.ts +290 -0
  58. package/dist/contracts/content-sync.js +167 -0
  59. package/dist/contracts/content.d.ts +432 -0
  60. package/dist/contracts/content.js +303 -0
  61. package/dist/contracts/continuation.d.ts +17 -1
  62. package/dist/contracts/continuation.js +23 -23
  63. package/dist/contracts/countries.js +3 -4
  64. package/dist/contracts/crons.d.ts +17 -0
  65. package/dist/contracts/crons.js +33 -15
  66. package/dist/contracts/dashboard-prefs.d.ts +56 -0
  67. package/dist/contracts/dashboard-prefs.js +51 -0
  68. package/dist/contracts/device-auth.d.ts +234 -37
  69. package/dist/contracts/device-auth.js +267 -53
  70. package/dist/contracts/docs.d.ts +6 -10
  71. package/dist/contracts/docs.js +5 -13
  72. package/dist/contracts/domains.d.ts +499 -102
  73. package/dist/contracts/domains.js +169 -58
  74. package/dist/contracts/email-preferences.d.ts +3 -3
  75. package/dist/contracts/email-preferences.js +6 -7
  76. package/dist/contracts/enums.d.ts +26 -26
  77. package/dist/contracts/enums.js +61 -54
  78. package/dist/contracts/error-code-meta.d.ts +269 -7
  79. package/dist/contracts/error-code-meta.js +80 -5
  80. package/dist/contracts/error-codes.d.ts +5 -5
  81. package/dist/contracts/error-codes.js +78 -16
  82. package/dist/contracts/events.d.ts +100 -20
  83. package/dist/contracts/events.js +107 -20
  84. package/dist/contracts/execution.d.ts +47 -66
  85. package/dist/contracts/execution.js +51 -64
  86. package/dist/contracts/feature-lifecycle.d.ts +70 -14
  87. package/dist/contracts/feature-lifecycle.js +86 -15
  88. package/dist/contracts/features.d.ts +100 -37
  89. package/dist/contracts/features.js +21 -27
  90. package/dist/contracts/fixtures/content-platform-v1.json +1108 -0
  91. package/dist/contracts/frame-session.d.ts +192 -0
  92. package/dist/contracts/frame-session.js +164 -0
  93. package/dist/contracts/functions.d.ts +218 -211
  94. package/dist/contracts/functions.js +273 -260
  95. package/dist/contracts/grant-copy.d.ts +43 -0
  96. package/dist/contracts/grant-copy.js +44 -0
  97. package/dist/contracts/grants.d.ts +64 -56
  98. package/dist/contracts/grants.js +124 -23
  99. package/dist/contracts/ids.d.ts +4 -1
  100. package/dist/contracts/ids.js +4 -1
  101. package/dist/contracts/internal.d.ts +5 -4
  102. package/dist/contracts/internal.js +12 -3
  103. package/dist/contracts/mcp.d.ts +17 -0
  104. package/dist/contracts/mcp.js +23 -0
  105. package/dist/contracts/me.d.ts +6 -1
  106. package/dist/contracts/me.js +12 -6
  107. package/dist/contracts/notifications.d.ts +27 -29
  108. package/dist/contracts/notifications.js +9 -4
  109. package/dist/contracts/oauth-resources.d.ts +112 -10
  110. package/dist/contracts/oauth-resources.js +116 -11
  111. package/dist/contracts/oauth-scope-actions.d.ts +90 -0
  112. package/dist/contracts/oauth-scope-actions.js +126 -0
  113. package/dist/contracts/operations.d.ts +27 -4
  114. package/dist/contracts/operations.js +11 -5
  115. package/dist/contracts/pages.d.ts +29 -5
  116. package/dist/contracts/pages.js +22 -5
  117. package/dist/contracts/partner-notifications.d.ts +3 -0
  118. package/dist/contracts/partner-notifications.js +65 -0
  119. package/dist/contracts/{platform.d.ts → partner.d.ts} +29 -42
  120. package/dist/contracts/{platform.js → partner.js} +27 -40
  121. package/dist/contracts/plan-policy.d.ts +1 -1
  122. package/dist/contracts/principal-assertion.d.ts +43 -0
  123. package/dist/contracts/principal-assertion.js +67 -0
  124. package/dist/contracts/principals.d.ts +73 -0
  125. package/dist/contracts/principals.js +59 -0
  126. package/dist/contracts/privacy.d.ts +11 -0
  127. package/dist/contracts/privacy.js +17 -0
  128. package/dist/contracts/problem-document.js +3 -4
  129. package/dist/contracts/publish-archive.d.ts +116 -18
  130. package/dist/contracts/publish-archive.js +6 -3
  131. package/dist/contracts/push-new.d.ts +4 -4
  132. package/dist/contracts/quotas.js +3 -3
  133. package/dist/contracts/realtime.d.ts +52 -0
  134. package/dist/contracts/realtime.js +54 -0
  135. package/dist/contracts/repository-connections.d.ts +1 -1
  136. package/dist/contracts/repository-connections.js +6 -2
  137. package/dist/contracts/resources.d.ts +105 -14
  138. package/dist/contracts/resources.js +145 -21
  139. package/dist/contracts/route-inventory.d.ts +358 -0
  140. package/dist/contracts/route-inventory.js +141 -0
  141. package/dist/contracts/runtime-api.d.ts +112 -35
  142. package/dist/contracts/runtime-api.js +86 -66
  143. package/dist/contracts/runtime-app.d.ts +11 -21
  144. package/dist/contracts/runtime-app.js +39 -24
  145. package/dist/contracts/runtime-components.d.ts +143 -0
  146. package/dist/contracts/runtime-components.js +199 -0
  147. package/dist/contracts/runtime-db.d.ts +45 -19
  148. package/dist/contracts/runtime-db.js +85 -20
  149. package/dist/contracts/runtime-purge.js +3 -5
  150. package/dist/contracts/runtime-services.d.ts +43 -75
  151. package/dist/contracts/runtime-services.js +29 -49
  152. package/dist/contracts/runtime-storage.d.ts +14 -14
  153. package/dist/contracts/runtime-storage.js +28 -13
  154. package/dist/contracts/sf-config-v1.d.ts +14 -18
  155. package/dist/contracts/slugs.js +13 -4
  156. package/dist/contracts/space-config.d.ts +235 -28
  157. package/dist/contracts/space-config.js +246 -91
  158. package/dist/contracts/spaces.d.ts +360 -255
  159. package/dist/contracts/spaces.js +190 -122
  160. package/dist/contracts/superadmin-activity.d.ts +3 -43
  161. package/dist/contracts/superadmin-activity.js +6 -30
  162. package/dist/contracts/superadmin-emails.d.ts +1 -0
  163. package/dist/contracts/superadmin-emails.js +17 -1
  164. package/dist/contracts/superadmin-runtime.d.ts +199 -0
  165. package/dist/contracts/superadmin-runtime.js +141 -0
  166. package/dist/contracts/superadmin-search.d.ts +22 -2
  167. package/dist/contracts/superadmin-search.js +14 -6
  168. package/dist/contracts/superadmin-spaces.d.ts +435 -186
  169. package/dist/contracts/superadmin-spaces.js +131 -25
  170. package/dist/contracts/superadmin-teams.d.ts +3 -0
  171. package/dist/contracts/superadmin-teams.js +1 -2
  172. package/dist/contracts/superadmin-tenants.d.ts +627 -6
  173. package/dist/contracts/superadmin-tenants.js +32 -7
  174. package/dist/contracts/superadmin.d.ts +98 -16
  175. package/dist/contracts/superadmin.js +63 -10
  176. package/dist/contracts/tags.d.ts +85 -58
  177. package/dist/contracts/tags.js +44 -34
  178. package/dist/contracts/teams.d.ts +72 -9
  179. package/dist/contracts/teams.js +84 -25
  180. package/dist/contracts/tenants.d.ts +135 -0
  181. package/dist/contracts/tenants.js +120 -0
  182. package/dist/contracts/test-triggers.d.ts +70 -0
  183. package/dist/contracts/test-triggers.js +116 -0
  184. package/dist/contracts/theme-json.js +3 -8
  185. package/dist/contracts/transfers.d.ts +1 -0
  186. package/dist/contracts/transfers.js +1 -0
  187. package/dist/contracts/usage.d.ts +209 -0
  188. package/dist/contracts/usage.js +124 -12
  189. package/dist/contracts/variables.d.ts +2 -2
  190. package/dist/contracts/variables.js +9 -13
  191. package/dist/contracts/webhooks.d.ts +13 -5
  192. package/dist/contracts/webhooks.js +3 -1
  193. package/dist/contracts/zero.d.ts +57 -64
  194. package/dist/contracts/zero.js +68 -66
  195. package/dist/dashboard-paths/index.d.ts +24 -21
  196. package/dist/dashboard-paths/index.js +35 -47
  197. package/dist/dashboard-paths/route-reservations.generated.d.ts +2 -0
  198. package/dist/dashboard-paths/route-reservations.generated.js +36 -0
  199. package/dist/docs/agent-arrival.d.ts +92 -0
  200. package/dist/docs/agent-arrival.js +227 -0
  201. package/dist/docs/agent-output-policy.d.ts +6 -0
  202. package/dist/docs/agent-output-policy.js +22 -0
  203. package/dist/docs/agent-prose.d.ts +11 -17
  204. package/dist/docs/agent-prose.js +62 -37
  205. package/dist/docs/agent-setup.d.ts +72 -41
  206. package/dist/docs/agent-setup.js +336 -436
  207. package/dist/docs/catalog.d.ts +147 -89
  208. package/dist/docs/catalog.js +157 -42
  209. package/dist/docs/error-docs.d.ts +2098 -1
  210. package/dist/docs/error-docs.js +281 -16
  211. package/dist/docs/index-build.d.ts +0 -1
  212. package/dist/docs/index-build.js +2 -3
  213. package/dist/docs/page-context-prompt.d.ts +77 -0
  214. package/dist/docs/page-context-prompt.js +131 -0
  215. package/dist/docs/reference-urls.d.ts +46 -0
  216. package/dist/docs/reference-urls.js +79 -0
  217. package/dist/docs/search.d.ts +6 -8
  218. package/dist/docs/search.js +10 -13
  219. package/dist/docs/skill-distribution.d.ts +4 -1
  220. package/dist/docs/skill-distribution.js +10 -5
  221. package/dist/docs/skills.d.ts +117 -117
  222. package/dist/docs/skills.js +120 -72
  223. package/dist/docs/start-prompts.d.ts +45 -0
  224. package/dist/docs/start-prompts.js +62 -0
  225. package/dist/domain-exploration.js +9 -13
  226. package/dist/og-template.d.ts +56 -0
  227. package/dist/og-template.js +56 -0
  228. package/dist/slug-policy/index.js +5 -11
  229. package/dist/utils/browser-credential.d.ts +13 -6
  230. package/dist/utils/browser-credential.js +14 -7
  231. package/dist/utils/build-settings.d.ts +16 -0
  232. package/dist/utils/build-settings.js +63 -17
  233. package/dist/utils/canonical-json.d.ts +3 -5
  234. package/dist/utils/canonical-json.js +3 -5
  235. package/dist/utils/cast-transport.d.ts +5 -17
  236. package/dist/utils/cast-transport.js +6 -19
  237. package/dist/utils/claim-token.js +1 -2
  238. package/dist/utils/comment-avatars.js +4 -6
  239. package/dist/utils/concurrency.js +2 -3
  240. package/dist/utils/content-type.d.ts +7 -6
  241. package/dist/utils/content-type.js +73 -51
  242. package/dist/utils/credential-policy.d.ts +50 -6
  243. package/dist/utils/credential-policy.js +123 -57
  244. package/dist/utils/egress-policy.fixtures.json +1 -1
  245. package/dist/utils/generate-space-name.d.ts +3 -8
  246. package/dist/utils/generate-space-name.js +3 -8
  247. package/dist/utils/grants.d.ts +0 -1
  248. package/dist/utils/grants.js +4 -7
  249. package/dist/utils/gravatar.d.ts +2 -4
  250. package/dist/utils/gravatar.js +6 -12
  251. package/dist/utils/id-hints.js +14 -23
  252. package/dist/utils/idempotency.d.ts +3 -3
  253. package/dist/utils/idempotency.js +6 -7
  254. package/dist/utils/local-space-state.d.ts +15 -15
  255. package/dist/utils/local-space-state.js +34 -23
  256. package/dist/utils/oauth-signed-query.d.ts +3 -5
  257. package/dist/utils/oauth-signed-query.js +6 -9
  258. package/dist/utils/one-shot-replay.d.ts +3 -5
  259. package/dist/utils/one-shot-replay.js +3 -5
  260. package/dist/utils/page-colors.d.ts +4 -10
  261. package/dist/utils/page-colors.js +11 -35
  262. package/dist/utils/page-fonts.js +6 -11
  263. package/dist/utils/page-preview.d.ts +0 -1
  264. package/dist/utils/page-preview.js +0 -1
  265. package/dist/utils/pages.d.ts +22 -11
  266. package/dist/utils/pages.js +70 -30
  267. package/dist/utils/privacy-regions.d.ts +19 -0
  268. package/dist/utils/privacy-regions.js +91 -0
  269. package/dist/utils/publish-form-data.d.ts +4 -5
  270. package/dist/utils/publish-form-data.js +2 -3
  271. package/dist/utils/publish-policy.d.ts +10 -23
  272. package/dist/utils/publish-policy.js +63 -116
  273. package/dist/utils/query-client.d.ts +2 -0
  274. package/dist/utils/query-client.js +10 -1
  275. package/dist/utils/runtime-paths.d.ts +4 -4
  276. package/dist/utils/runtime-paths.js +6 -8
  277. package/dist/utils/runtime-upload.d.ts +4 -0
  278. package/dist/utils/runtime-upload.js +5 -0
  279. package/dist/utils/secure-local-file.d.ts +3 -3
  280. package/dist/utils/secure-local-file.js +18 -24
  281. package/dist/utils/space-config.d.ts +11 -14
  282. package/dist/utils/space-config.js +10 -16
  283. package/dist/utils/static-runtime-policy.d.ts +5 -8
  284. package/dist/utils/static-runtime-policy.generated.d.ts +16 -0
  285. package/dist/utils/static-runtime-policy.generated.js +70 -0
  286. package/dist/utils/static-runtime-policy.js +17 -84
  287. package/dist/utils/storage-policy.js +1 -2
  288. package/dist/utils/upload-session.js +8 -14
  289. package/dist/utils/version-path.js +11 -19
  290. package/dist/utils/wpcom-auth-redirects.d.ts +5 -14
  291. package/dist/utils/wpcom-auth-redirects.js +1 -4
  292. package/dist/vocabulary.d.ts +7 -7
  293. package/dist/vocabulary.js +30 -16
  294. package/package.json +14 -2
  295. package/dist/agents/client-registry.d.ts +0 -22
  296. package/dist/agents/client-registry.js +0 -41
  297. package/dist/docs/agent-handoff-document.d.ts +0 -15
  298. package/dist/docs/agent-handoff-document.js +0 -180
  299. package/dist/docs/agent-solutions.d.ts +0 -110
  300. package/dist/docs/agent-solutions.js +0 -183
  301. package/dist/utils/query-keys.d.ts +0 -84
  302. package/dist/utils/query-keys.js +0 -108
@@ -1,25 +1,22 @@
1
+ import { SPACEFAST_POSITIONING } from "../brand.js";
1
2
  import { serviceOrigin } from "../config/domains.js";
2
- // Single home for the agent-facing prose that was triplicated across the three
3
- // surfaces that teach an agent how to publish:
3
+ // Single home for the agent-facing prose the three publish-teaching surfaces
4
+ // share:
4
5
  //
5
6
  // - packages/cli/skill.template.md (the SKILL.md router + copies)
6
7
  // - packages/common/src/docs/agent-setup.ts (the /ai and /ai.txt page body)
7
8
  // - spacefast/www (the agent-card / discovery prose)
8
9
  //
9
- // Each surface re-stated the publish sequence, the secret rules, and the receipt
10
- // shape in its own words, so they drifted. These fragments are the one source of
11
- // truth. They are plain Markdown strings (no surface-specific framing) so any
12
- // surface can splice them in: the skill template substitutes the `{{prose.*}}`
13
- // placeholders during generation, and the TS surfaces import the strings.
14
- //
15
- // Keep these grounded in the real API receipt and the real /v1/publish flow. If
16
- // the receipt shape or secret handling changes, change it here once.
10
+ // These are plain Markdown strings with no surface-specific framing: the skill
11
+ // template substitutes the `{{prose.*}}` placeholders during generation, and the
12
+ // TS surfaces import them. Keep them grounded in the real API receipt and the
13
+ // real /v1/publish flow; if either changes, change it here once.
17
14
  const API_ORIGIN = serviceOrigin("api", "prod");
18
15
  const PUBLISH_ENDPOINT = `${API_ORIGIN}/v1/publish`;
19
16
  const EXCHANGE_ENDPOINT = `${API_ORIGIN}/v1/claim/exchange`;
20
- // Centralized secret/credential patterns excluded from a publish archive. The
21
- // `find` preflight and the `zip -x` exclusions are derived from the same list so
22
- // they can never disagree, and the no-install / skill copies stay identical.
17
+ // Secret/credential patterns excluded from a publish archive. The `find`
18
+ // preflight and the `zip -x` exclusions both derive from this list, so the
19
+ // no-install and skill copies cannot disagree.
23
20
  export const ARCHIVE_SECRET_GLOBS = [
24
21
  ".env*",
25
22
  ".npmrc",
@@ -58,10 +55,7 @@ function findExpr(globs) {
58
55
  .map((glob) => (glob.includes("/") ? `-path "${glob}"` : `-name "${glob}"`))
59
56
  .join(" -o ");
60
57
  }
61
- /**
62
- * The credential rules every surface must repeat. Treat tokens as secrets, keep
63
- * them out of logs and transcripts, and never echo them back.
64
- */
58
+ /** The credential rules every surface must repeat. */
65
59
  export const SECRET_RULES_PROSE = [
66
60
  "Treat space keys, upload tokens, device codes, and API keys as credentials. Do not print",
67
61
  "them, paste them into chat, commit them, archive them, or include them in shared logs. Avoid",
@@ -70,6 +64,10 @@ export const SECRET_RULES_PROSE = [
70
64
  "clear them after use, and avoid durable auth unless the user explicitly asks.",
71
65
  ].join("\n");
72
66
  export const POSITIONING_PROSE = [
67
+ // What the product is, before any claim about it. One constant, shared with
68
+ // the dashboard's copied page context (see docs/page-context-prompt.ts).
69
+ SPACEFAST_POSITIONING,
70
+ "",
73
71
  "Spacefast is the best place to share AI artifacts.",
74
72
  "Spaces serve files directly; app code runs only through a declared Zero or Functions runtime.",
75
73
  "",
@@ -94,16 +92,18 @@ export const FAILURE_CONDUCT_PROSE = [
94
92
  FEEDBACK_PROSE,
95
93
  ].join("\n");
96
94
  export const LANE_PICKER_PROSE = [
97
- "Pick the lane by environment: filesystem plus repeat work means CLI or On-Device MCP; no",
98
- "filesystem means hosted MCP; one-off publish means curl; CI means an agent account. After",
99
- "success, recommend the best next-time setup for the user's client.",
95
+ "Pick the lane by environment: a one-off publish means curl; a git checkout means the push.new",
96
+ "remote; repeat work with a filesystem means the CLI the best setup, `npx -y spacefast` runs it",
97
+ "with no install, and `sf plugins` installs your client's plugin; no filesystem means hosted MCP;",
98
+ "CI means a machine OAuth client. After success, recommend the best next-time setup for the",
99
+ "user's client.",
100
100
  ].join("\n");
101
101
  export const HOW_TO_RESEARCH_PROSE = [
102
102
  "For an error, fetch the problem document's `type` URL. For capability questions, search the OpenAPI catalog with `execute` or append",
103
103
  "`.md` to website docs URLs. For contracts, read `publish-spec.json` or OpenAPI. Never guess",
104
104
  "limits: publish, then read diagnostics.",
105
105
  ].join("\n");
106
- /** Curl/API skill lane: docs URLs only no MCP or CLI tools required. */
106
+ /** Curl/API skill lane: docs URLs only, no MCP or CLI tools required. */
107
107
  export const HOW_TO_RESEARCH_API_PROSE = [
108
108
  "For an error, fetch the problem document's `type` URL. For capability questions, append `.md` to website docs",
109
109
  "URLs (for example `https://spacefast.com/docs/agents.md`) or read",
@@ -112,8 +112,9 @@ export const HOW_TO_RESEARCH_API_PROSE = [
112
112
  ].join("\n");
113
113
  /** MCP plugin skill lane: prefer skills for workflows and execute for the OpenAPI catalog. */
114
114
  export const HOW_TO_RESEARCH_MCP_PROSE = [
115
- "For an error, fetch the problem document's `type` URL when present. For workflows, call the `skills` tool",
116
- "(list/search, then read by exact name). For capability questions, use `execute` with `tools.search`.",
115
+ "For an error, fetch the problem document's `type` URL when present. For workflows and how-to",
116
+ "recipes, call `search_docs`; the `skills` tool serves the `execute` guide, not workflow recipes.",
117
+ "For capability questions, use `execute` with `tools.search`.",
117
118
  "For contracts, read `publish-spec.json` or OpenAPI via docs. Never guess limits: publish,",
118
119
  "then inspect status or diagnostics through `execute`.",
119
120
  ].join("\n");
@@ -128,9 +129,8 @@ export const ENV_NOTES_API_PROSE = [
128
129
  "https://spacefast.com/docs/agents.",
129
130
  ].join("\n");
130
131
  /**
131
- * The CHECK verb: before ever creating a space, look for the one the project
132
- * already has. This is what keeps a returning agent from pushing a duplicate
133
- * anonymous space instead of a new version.
132
+ * The CHECK verb: look for an existing space before creating one, so a returning
133
+ * agent publishes a new version instead of a duplicate anonymous space.
134
134
  */
135
135
  export const CHECK_BEFORE_PUBLISH_PROSE = [
136
136
  "Before creating a space, check whether this project already has one:",
@@ -220,6 +220,34 @@ export const SAVE_STATE_MCP_PROSE = [
220
220
  * The UPDATE verb: a new version to the SAME space. Never re-run the
221
221
  * first-publish recipe when saved state exists.
222
222
  */
223
+ /*
224
+ * Push to deploy. Written for an agent that is already in a checkout, where a
225
+ * push is fewer moves than an upload — and where the receipt comes back in the
226
+ * push output, so there is no second call to learn the URL.
227
+ *
228
+ * The GitHub note is not an aside: a space bound to a GitHub repository refuses
229
+ * direct pushes, and an agent that does not know that reads the refusal as a
230
+ * broken remote instead of as the answer it is.
231
+ */
232
+ export const PUSH_TO_DEPLOY_PROSE = [
233
+ "A space's git remote is a real remote, and pushing to it publishes. Every publish receipt",
234
+ "and the Space resource carry `git.remoteUrl`; authenticate as HTTP Basic user `t` with the",
235
+ "space key or an API key as the password. The same key you already have works — publishing",
236
+ "and pushing are one credential, not two.",
237
+ "",
238
+ "```bash",
239
+ "git remote add spacefast https://t:<key>@push.new/<space-slug>.git",
240
+ "git push spacefast main",
241
+ "```",
242
+ "",
243
+ "The push output is the receipt: it reports the live URL, the immutable version URL, and —",
244
+ "for an anonymous space — the claim link and its expiry, as `remote:` lines. Report those to",
245
+ "the user the same way you would report a publish receipt. A deploy that outruns the push",
246
+ "prints a status URL instead and finishes on its own; the push still exits 0.",
247
+ "",
248
+ "If `git.managedBy` is `github`, this space deploys from `git.repository` and a direct push is",
249
+ "refused. Push to that GitHub repository instead, or tell the user to disconnect GitHub first.",
250
+ ].join("\n");
223
251
  export const UPDATE_SPACE_PROSE = [
224
252
  "To publish a new version of an existing space, send the same `spaceId` with bearer auth —",
225
253
  "never re-run the first-publish recipe when saved state exists:",
@@ -256,7 +284,7 @@ export const CONTINUE_AFTER_CLAIM_PROSE = [
256
284
  "Save `data.credential.accessToken` into `.spacefast/state.json` (replace the `claimToken`",
257
285
  'field with `"accessToken"`), then retry the publish with the new bearer. The exchange works',
258
286
  "exactly once; if it returns `continuation_used` or `continuation_unavailable`, ask the user",
259
- "to create an API key in the dashboard (Account → API keys).",
287
+ "to create an API key in the dashboard (teamAgents → API keys).",
260
288
  ].join("\n");
261
289
  const LEXICAL_PUBLISH_PATH_PREFLIGHT = [
262
290
  'case "$publish_target" in /*) check_path="$publish_target" ;; *) check_path="$PWD/$publish_target" ;; esac',
@@ -322,7 +350,7 @@ const SECURE_ARCHIVE_RECIPE = [
322
350
  ];
323
351
  /**
324
352
  * The zero-install publish sequence: a replay-safe curl loop for a file, a
325
- * secret-preflighted zip for a folder. This is the load-bearing rung 0 — an
353
+ * secret-preflighted zip for a folder. This is the load-bearing rung 0. An
326
354
  * agent that stops here must still succeed.
327
355
  */
328
356
  export const PUBLISH_SEQUENCE_PROSE = [
@@ -376,7 +404,7 @@ export const PUBLISH_SEQUENCE_PROSE = [
376
404
  * What the JSON publish receipt contains and how to read it. The receipt is the
377
405
  * source of truth; never invent a separate success signal.
378
406
  */
379
- export const RECEIPT_SHAPE_PROSE = [
407
+ export const RECEIPT_CONTRACT_PROSE = [
380
408
  "The JSON receipt is the source of truth:",
381
409
  "",
382
410
  "- `data.space.liveUrl` — the live URL.",
@@ -422,18 +450,14 @@ export const SIGNED_UPLOAD_PROSE = [
422
450
  "For each `data.upload.targets[]`, send `target.method` to `target.url` with `target.headers`.",
423
451
  'If `target.body.kind` is `url`, send JSON `{ "url": target.body.url }`; otherwise send the',
424
452
  "local file bytes for `target.path`. Then call `data.links.finalize` and share the final receipt.",
425
- "If the session expires or only a page of files is returned, follow `data.links.resume`.",
453
+ "If the session expires or only a page of files is returned, follow `data.links.refresh`.",
426
454
  "",
427
455
  "A manifest entry may name a `sourceUrl`, so bytes that already live on a public HTTPS URL never",
428
456
  "have to round-trip through the agent. Do not base64 large archives into chat or MCP tool arguments.",
429
457
  ].join("\n");
430
458
  /**
431
- * Named fragments for the skill-template generator. The templates carry
432
- * `{{prose.secretRules}}`, `{{prose.publishSequence}}`,
433
- * `{{prose.receiptShape}}`, `{{prose.signedUpload}}`,
434
- * `{{prose.checkBeforePublish}}`, `{{prose.saveState}}`,
435
- * `{{prose.updateSpace}}`, and `{{prose.continueAfterClaim}}` placeholders;
436
- * generate-skill.mjs substitutes these.
459
+ * Named fragments for the skill-template generator: the templates carry
460
+ * `{{prose.<key>}}` placeholders and generate-skill.mjs substitutes these.
437
461
  */
438
462
  export const AGENT_PROSE = {
439
463
  positioning: POSITIONING_PROSE,
@@ -441,7 +465,7 @@ export const AGENT_PROSE = {
441
465
  explainToUser: EXPLAIN_TO_USER_PROSE,
442
466
  failureConduct: FAILURE_CONDUCT_PROSE,
443
467
  publishSequence: PUBLISH_SEQUENCE_PROSE,
444
- receiptShape: RECEIPT_SHAPE_PROSE,
468
+ receiptContract: RECEIPT_CONTRACT_PROSE,
445
469
  signedUpload: SIGNED_UPLOAD_PROSE,
446
470
  checkBeforePublish: CHECK_BEFORE_PUBLISH_PROSE,
447
471
  checkBeforePublishApi: CHECK_BEFORE_PUBLISH_API_PROSE,
@@ -451,6 +475,7 @@ export const AGENT_PROSE = {
451
475
  saveStateApi: SAVE_STATE_API_PROSE,
452
476
  saveStateMcp: SAVE_STATE_MCP_PROSE,
453
477
  updateSpace: UPDATE_SPACE_PROSE,
478
+ pushToDeploy: PUSH_TO_DEPLOY_PROSE,
454
479
  continueAfterClaim: CONTINUE_AFTER_CLAIM_PROSE,
455
480
  lanePicker: LANE_PICKER_PROSE,
456
481
  howToResearch: HOW_TO_RESEARCH_PROSE,
@@ -1,73 +1,104 @@
1
1
  import { type ConnectTarget, type ConnectTargetId } from "../agents/connect-targets.js";
2
+ import type { AgentHandoffTarget } from "../contracts/device-auth.js";
2
3
  export declare const agentSetupUrl: string;
3
- export declare const agentSetupTextUrl: string;
4
4
  export declare const agentSetupHostLabel: string;
5
5
  export declare const agentSetupPrompt: string;
6
6
  export declare const anonymousPublishCurlCommand: string;
7
+ export declare const AGENT_HANDOFF_TOKEN_PATTERN: RegExp;
7
8
  /**
8
- * Typed, safe decline states for the app-private redemption exchange.
9
- * `invalid_handoff` is the single answer for both an unknown document ID and a wrong secret, so a
10
- * decline never becomes an existence oracle; state-specific reasons are returned only after the
11
- * supplied secret authenticates the handoff. `already_redeemed` makes one-use explicit: after the
12
- * first exchange succeeds, the second fails with this reason. Declines are terminal and never
13
- * reveal whether a secret was close to correct.
9
+ * Decline states for the app-private redemption exchange. `invalid_handoff` is
10
+ * the single answer for both an unknown document ID and a wrong secret, so a
11
+ * decline never becomes an existence oracle; the other reasons are returned only
12
+ * after the supplied secret authenticates the handoff. Declines are terminal.
14
13
  */
15
14
  export declare const AGENT_HANDOFF_DECLINE_REASONS: readonly ["invalid_handoff", "expired", "already_redeemed", "revoked", "client_mismatch", "origin_mismatch"];
16
15
  export type AgentHandoffDeclineReason = (typeof AGENT_HANDOFF_DECLINE_REASONS)[number];
17
- export type AgentHandoffAction = Readonly<{
18
- kind: "copy";
19
- label: string;
20
- sensitive: boolean;
21
- value: string;
22
- }> | Readonly<{
23
- kind: "open";
24
- label: string;
25
- href: string;
26
- }>;
27
16
  export type AgentHandoff = Readonly<{
28
- actions: readonly AgentHandoffAction[];
29
- documentUrl: string;
30
- instructions: string;
31
17
  prompt: string;
18
+ secret: string;
19
+ url: string;
32
20
  }>;
33
21
  /**
34
22
  * The single shared grammar for handoff links:
35
- * `<access-origin>/agent/<documentId>/<oneUseToken>`. The document ID must match
36
- * `[A-Za-z0-9_-]{1,512}` and the token `[A-Za-z0-9_-]{16,512}`; the two must differ;
37
- * queries, fragments, and URL userinfo are forbidden. The URL must sit exactly on the caller's
38
- * configured HTTP(S) access origin; the clean static document may live on a separate explicitly
39
- * supplied dashboard origin.
40
- * Normalization is part of the contract: the input is WHATWG-URL-normalized first (backslashes,
41
- * dot segments, stray tab/CR/LF, empty userinfo, case, default ports), the grammar is enforced on
42
- * the normalized URL, and only the reconstructed canonical URL ever leaves this function.
43
- * Dashboard minting, CLI ingestion, and control-plane validation must all use this parser so the
44
- * grammar can never fork.
23
+ * `<access-origin>/handoffs/<token>`. The token is the bearer credential.
24
+ * Queries, fragments, and userinfo are forbidden. Dashboard minting, CLI
25
+ * ingestion, and control-plane redemption all use this parser so the grammar
26
+ * cannot fork.
45
27
  */
46
- export declare function parseAgentHandoffUrl(value: string, expectedOrigin: string, documentOrigin?: string): Readonly<{
47
- documentId: string;
48
- documentUrl: string;
28
+ export type ParsedAgentHandoffUrl = Readonly<{
29
+ /** The canonical link, exactly as it must be presented back for redemption. */
49
30
  handoffUrl: string;
31
+ /** The bearer credential carried in the last path segment. */
50
32
  secret: string;
51
33
  }>;
34
+ export declare function parseAgentHandoffUrl(value: string, expectedOrigin: string): ParsedAgentHandoffUrl;
52
35
  /** Connect targets whose handoff continues through the CLI stdin exchange. */
53
36
  export declare const AGENT_HANDOFF_CLI_TARGET_IDS: readonly ConnectTargetId[];
54
- export declare const AGENT_HANDOFF_PREAMBLE = "Talk to the user before installing tools or publishing. Confirm the file or folder they want to publish.";
55
- /** The fetch-safety contract: reading the document never consumes or leaks a handoff. */
56
- export declare const AGENT_HANDOFF_FETCH_SAFETY = "Keep the original handoff link private. Fetching this clean document URL did not use or send its credential; the credential is spent only by one successful exchange. An expired, used, or revoked link fails safely, so ask the user for a fresh one from the dashboard.";
57
- export declare const AGENT_HANDOFF_CREDENTIAL_HYGIENE = "Keep the private handoff URL out of commands, request URLs, logs, and replies.";
37
+ export declare const AGENT_HANDOFF_PREAMBLE = "Talk to the user before you install tools or publish. Confirm the file or folder to publish.";
38
+ export declare const AGENT_HANDOFF_CREDENTIAL_HYGIENE = "Keep the handoff URL out of command arguments, logs, and replies. It goes in exactly two places: the stdin prompt of `sf setup agent`, or the redeem request body.";
58
39
  export declare const AGENT_HANDOFF_CLI_APPROVAL_GUIDANCE: string;
59
- export declare const AGENT_HANDOFF_BROWSER_APPROVAL_GUIDANCE = "When the client opens browser approval, ask the user to approve there before publishing.";
60
- export declare const AGENT_HANDOFF_PUBLISH_PROSE = "After approval, confirm the selected Space and permissions, then publish only the files the user approved. Report the bare Live and immutable Version addresses separately from the private Access URL; create a scoped Link when a recipient needs access.";
40
+ export declare const AGENT_HANDOFF_PUBLISH_PROSE = "After login, confirm the Space and the files with the user, then publish the simplest way that fits: a one-off through `sf publish` or the publish API; a git checkout by pushing to the Space's push.new remote (`git.remoteUrl`); for repeat work the CLI is best, and `sf plugins` installs your client's plugin. Report the Live URL and the immutable Version URL; keep the private Access URL out of shared replies. Create a scoped Link only when a recipient needs access.";
61
41
  /** One target's Connect prose: blurb, copyable setup blocks, deeplink/download lines. */
62
42
  export declare function agentHandoffConnectSections(target: ConnectTarget): string[];
43
+ /**
44
+ * Everything the agent needs to know about the link, said once, where it acts
45
+ * on it. "The URL you fetched" doubles as the only reference to the bearer —
46
+ * the document never repeats it, so the live secret stays out of whatever the
47
+ * agent caches or quotes next (`renderAgentHandoffDocument` takes an ORIGIN,
48
+ * never a URL, so the token cannot even reach the renderer).
49
+ */
50
+ export declare const AGENT_HANDOFF_EXCHANGE_PROSE: string;
51
+ /**
52
+ * The per-handoff setup document served from `/handoffs/<token>`.
53
+ *
54
+ * Takes the handoff's ORIGIN, never its URL: the bearer must not be able to
55
+ * reach this renderer, so it cannot end up in the bytes an agent caches.
56
+ *
57
+ * Reading order is the argument: what Spacefast is, talk to the user, exchange
58
+ * the link for a durable API key — the only expiring step, so it comes before
59
+ * client setup — then connect the client, then publish.
60
+ */
61
+ export declare function renderAgentHandoffDocument(input: {
62
+ handoffOrigin: string;
63
+ mcpEndpoint: string;
64
+ targetId: AgentHandoffTarget;
65
+ }): string;
66
+ /**
67
+ * The document behind an anonymous (signed-out) handoff link. Same opening as
68
+ * the signed-in "any" document, ordered by usefulness: the two things the
69
+ * agent can actually do (publish with the no-account POST, or have the user
70
+ * sign in for a real handoff) come before the optional client catalog. The
71
+ * link itself grants nothing — its fetch only feeds the /start arrival watch —
72
+ * and the document doesn't narrate that; "Get a credential" states the one
73
+ * fact the agent needs.
74
+ */
75
+ export declare function renderAnonymousAgentHandoffDocument(input: {
76
+ mcpEndpoint: string;
77
+ }): string;
63
78
  /** Builds every copy-ready handoff artifact from one validated URL and target catalog row. */
64
79
  export declare function buildAgentHandoff(input: {
65
80
  expectedOrigin: string;
66
- documentOrigin?: string;
67
81
  mcpEndpoint: string;
68
82
  targetId: ConnectTargetId;
69
83
  url: string;
70
84
  }): AgentHandoff;
85
+ /**
86
+ * The signed-out half: a handoff that carries no team, no Space, and no
87
+ * authority, so its document is the public setup guide. It exists only so the
88
+ * fetch is observable — /start can tell the visitor their agent arrived without
89
+ * first making them sign up.
90
+ *
91
+ * The handoff line is APPENDED to the caller's prompt rather than replacing it:
92
+ * signed out, the prompt is still the thing carrying the user's actual task.
93
+ * One gesture, one sentence, single-sourced so no surface can word it
94
+ * differently. With no task selected the handoff line IS the prompt — the
95
+ * fetched document carries the whole setup, so the copy stays a single link.
96
+ */
97
+ export declare function buildAnonymousAgentHandoff(input: {
98
+ expectedOrigin: string;
99
+ url: string;
100
+ /** The caller's own prompt text. The handoff line goes after it. */
101
+ context: string;
102
+ }): AgentHandoff;
71
103
  export declare function renderAgentSetupTemplate(value: string): string;
72
- export declare function aiInstructionsText(): string;
73
104
  export declare function agentSetupMarkdown(): string;