deepspace 0.33.0 → 0.34.0

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 (37) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/README.md +5 -1
  3. package/dist/build.js.map +1 -1
  4. package/dist/{chunk-BRES7ZWJ.js → chunk-KELQ7OD5.js} +2 -2
  5. package/dist/{chunk-BRES7ZWJ.js.map → chunk-KELQ7OD5.js.map} +1 -1
  6. package/dist/{chunk-PIYDVPUE.js → chunk-SINBB5BQ.js} +2 -2
  7. package/dist/{chunk-PIYDVPUE.js.map → chunk-SINBB5BQ.js.map} +1 -1
  8. package/dist/cli.js +74 -15
  9. package/dist/cli.js.map +1 -1
  10. package/dist/documentation-client-core.js +1 -1
  11. package/dist/documentation-default-renderer.cjs +1 -1
  12. package/dist/documentation-react.js +1 -1
  13. package/dist/documentation-runtime.js +10 -10
  14. package/dist/documentation-server-core.js +1 -1
  15. package/dist/documentation.js +47 -22
  16. package/dist/documentation.js.map +1 -1
  17. package/dist/expo.d.ts +73 -0
  18. package/dist/expo.js +233 -0
  19. package/dist/expo.js.map +1 -0
  20. package/dist/index.d.ts +105 -22
  21. package/dist/index.js +50 -23
  22. package/dist/index.js.map +1 -1
  23. package/dist/server.d.ts +205 -37
  24. package/dist/server.js +290 -97
  25. package/dist/server.js.map +1 -1
  26. package/dist/worker.d.ts +312 -48
  27. package/dist/worker.js +499 -110
  28. package/dist/worker.js.map +1 -1
  29. package/features/documents/feature.json +15 -0
  30. package/features/documents/src/DocumentsListPage.tsx +22 -8
  31. package/features/documents/src/InviteDialog.tsx +63 -42
  32. package/features/documents/src/__tests__/documents-find-invitee-action.test.ts +131 -0
  33. package/features/documents/src/__tests__/documents-invitee-lookup.test.ts +67 -0
  34. package/features/documents/src/documents-find-invitee-action.ts +56 -0
  35. package/features/documents/src/documents-invitee-lookup.ts +38 -0
  36. package/features/documents/src/documents-ui.css +10 -0
  37. package/package.json +28 -8
package/dist/cli.js CHANGED
@@ -5753,6 +5753,7 @@ var ACTION_TOOLS_DELETE_WHERE_MIGRATION_ID = "2026-08-action-tools-delete-where"
5753
5753
  var BUILD_INJECTED_APP_ID_MIGRATION_ID = "2026-08-build-injected-app-id";
5754
5754
  var ACTION_ROUTES_BEARER_GUARD_MIGRATION_ID = "2026-08-action-routes-bearer-guard";
5755
5755
  var FILES_SESSION_COOKIE_READS_MIGRATION_ID = "2026-09-files-session-cookie-reads";
5756
+ var AI_SDK_7_MIGRATION_ID = "2026-09-ai-sdk-7";
5756
5757
  function validateAppMigrationIds(value) {
5757
5758
  if (!Array.isArray(value)) {
5758
5759
  return { valid: false, reason: "app migrations must be a JSON string array" };
@@ -5816,6 +5817,12 @@ var APP_MIGRATION_GUIDANCE = [
5816
5817
  description: "Let private file URLs render in <img>/<audio>/<video> for the signed-in user",
5817
5818
  files: ["the app-owned HTTP route file that proxies /api/files/*"],
5818
5819
  guidance: "In the /api/files/* proxy only, replace `const auth = await resolveAuth(c.req.raw, c.env)` with `const auth = (await resolveAuth(c.req.raw, c.env)) ?? (await resolveSessionReadAuth(c.req.raw, c.env))`, importing resolveSessionReadAuth from 'deepspace/worker'. It identifies same-origin GET/HEAD by the app-origin session cookie and returns null for everything else. Do not add it to resolveAuth, which also gates writes. In the same route, skip the JSON URL rewrite for HEAD: change `if (contentType.includes('application/json'))` to `if (contentType.includes('application/json') && c.req.method !== 'HEAD')`, because a HEAD answer carries the content-type but no body and parsing it would turn every failed media probe into a 500."
5820
+ },
5821
+ {
5822
+ id: AI_SDK_7_MIGRATION_ID,
5823
+ description: "Move the app's own AI code to AI SDK 7",
5824
+ files: ["src/ai/chat-routes.ts", 'every other file importing from "ai"'],
5825
+ guidance: "Run `npx @ai-sdk/codemod v7 src` and review its diff: it renames `system` to `instructions` in ANY object, including non-AI-SDK request bodies, so revert those. Then by hand: in the chat route's `onEnd` (formerly `onFinish`), persist `responseMessages` \u2014 `response.messages` now holds only the final step, which drops earlier tool calls \u2014 and since `onEnd` no longer runs after an abort, also persist in `onAbort({ steps })` from the completed steps' `response.messages`. Replace `result.toUIMessageStreamResponse(options)` with `createUIMessageStreamResponse({ headers, stream: toUIMessageStream({ stream: result.stream, ...options }) })` imported from 'ai'. A tool's `execute` options now include `context`. `role: 'system'` messages inside `messages` are rejected unless the call sets `allowSystemInMessages: true`."
5819
5826
  }
5820
5827
  ];
5821
5828
  var APP_MIGRATION_DEFINITIONS = APP_MIGRATION_GUIDANCE.map(({ id, description }) => ({
@@ -5874,7 +5881,11 @@ async function buildDeployBundle(options) {
5874
5881
  env: {
5875
5882
  ...wranglerViteEnv(process.env, preparedWranglerConfig),
5876
5883
  // The Vite plugin's one documentation compile stamps release URLs.
5877
- DEEPSPACE_DOCUMENTATION_BASE_URL: `https://${appName}.${appDomain}/docs`
5884
+ DEEPSPACE_DOCUMENTATION_BASE_URL: `https://${appName}.${appDomain}/docs`,
5885
+ // The scaffold's build-time prerender (prerender.ts) builds canonical
5886
+ // URLs and the sitemap on this, so a staging deploy resolves to
5887
+ // spacestest.com instead of the wrangler name on app.space.
5888
+ DEEPSPACE_SITE_ORIGIN: `https://${appName}.${appDomain}`
5878
5889
  }
5879
5890
  });
5880
5891
  } catch (error) {
@@ -10993,9 +11004,19 @@ function formatCurrency(value, currency) {
10993
11004
  return `${value} ${currency}`;
10994
11005
  }
10995
11006
  function priceLabel(billing) {
10996
- if (billing.baseCost === null) return "metered at the provider's actual cost";
10997
- const figure = `${formatCurrency(billing.baseCost, billing.currency)} ${billingUnit(billing.model)}`;
10998
- return billing.variesWithInput ? `base ${figure} (some inputs cost less or more)` : figure;
11007
+ if (billing.baseCost === null) {
11008
+ const price2 = "metered at the provider's actual cost plus platform markup";
11009
+ return billing.freeTierPriceDiffers ? `${price2}; free-tier pricing differs` : price2;
11010
+ }
11011
+ const tokenScale = billing.model === "per_token" ? 1e6 : 1;
11012
+ const unit = billing.model === "per_token" ? "per 1M tokens" : billingUnit(billing.model);
11013
+ const paidCost = (billing.paidBaseCost ?? billing.baseCost) * tokenScale;
11014
+ const figure = `${formatCurrency(paidCost, billing.currency)} ${unit}`;
11015
+ const price = billing.variesWithInput ? `base ${figure} (some inputs cost less or more)` : figure;
11016
+ if (!billing.freeTierPriceDiffers) return price;
11017
+ const freeFigure = `${formatCurrency(billing.baseCost * tokenScale, billing.currency)} ${unit}`;
11018
+ const freePrice = billing.variesWithInput ? `base ${freeFigure} (some inputs cost less or more)` : freeFigure;
11019
+ return `paid tier: ${price}; free tier: ${freePrice}`;
10999
11020
  }
11000
11021
  function billingUnit(model) {
11001
11022
  if (model === "per_token") return "per token";
@@ -11561,14 +11582,31 @@ async function requestJson(url, init, token, timeout) {
11561
11582
  clearTimeout(timer);
11562
11583
  }
11563
11584
  }
11585
+ var MAX_DETAIL_TEXT = 2e3;
11586
+ var DETAIL_PROSE_KEYS = /* @__PURE__ */ new Set(["error", "detail", "guidance", "message"]);
11587
+ function describeDetail(detail) {
11588
+ const parts = [];
11589
+ for (const [key, value] of Object.entries(detail)) {
11590
+ if (value === void 0 || value === null || value === "") continue;
11591
+ const prose = typeof value === "string" && DETAIL_PROSE_KEYS.has(key);
11592
+ parts.push(prose ? value : `${key}: ${JSON.stringify(value)}`);
11593
+ }
11594
+ const text2 = parts.join(" ");
11595
+ return text2.length > MAX_DETAIL_TEXT ? `${text2.slice(0, MAX_DETAIL_TEXT)}\u2026` : text2;
11596
+ }
11564
11597
  function httpRefusal(response, tokens) {
11565
11598
  const server = isRecord(response.body) ? response.body : void 0;
11566
11599
  const code = safeServerCode(server?.code);
11567
- const message = typeof server?.error === "string" ? redact(server.error, tokens).slice(0, 500) : "";
11600
+ const baseMessage = typeof server?.error === "string" ? redact(server.error, tokens).slice(0, 500) : "";
11601
+ const redactedDetail = isRecord(server?.detail) ? redactValue(server.detail, tokens) : void 0;
11602
+ const detail = isRecord(redactedDetail) ? { extra: { detail: redactedDetail } } : {};
11603
+ const detailText = isRecord(redactedDetail) ? describeDetail(redactedDetail) : "";
11604
+ const message = detailText ? `${baseMessage} ${detailText}`.trim() : baseMessage;
11568
11605
  if (response.status === 403) {
11569
11606
  return new Refusal(
11570
11607
  message || "You are not allowed to use this app agent.",
11571
- code ?? "agent_forbidden"
11608
+ code ?? "agent_forbidden",
11609
+ detail
11572
11610
  );
11573
11611
  }
11574
11612
  if (response.status === 404 && !server) {
@@ -11579,7 +11617,8 @@ function httpRefusal(response, tokens) {
11579
11617
  }
11580
11618
  return new Refusal(
11581
11619
  message || `App agent request failed (${response.status}).`,
11582
- code ?? (response.status === 404 ? "agent_endpoint_not_found" : "agent_request_failed")
11620
+ code ?? (response.status === 404 ? "agent_endpoint_not_found" : "agent_request_failed"),
11621
+ detail
11583
11622
  );
11584
11623
  }
11585
11624
  async function callAgent(target2, path, init, timeout) {
@@ -16045,7 +16084,7 @@ import { join as join28, resolve as resolve22 } from "path";
16045
16084
  // package.json
16046
16085
  var package_default = {
16047
16086
  name: "deepspace",
16048
- version: "0.33.0",
16087
+ version: "0.34.0",
16049
16088
  engines: {
16050
16089
  node: ">=22.15.0 <23 || >=24 <25 || >=26 <27"
16051
16090
  },
@@ -16086,6 +16125,10 @@ var package_default = {
16086
16125
  types: "./dist/build.d.ts",
16087
16126
  import: "./dist/build.js"
16088
16127
  },
16128
+ "./expo": {
16129
+ types: "./dist/expo.d.ts",
16130
+ import: "./dist/expo.js"
16131
+ },
16089
16132
  "./documentation": {
16090
16133
  types: "./dist/documentation.d.ts",
16091
16134
  import: "./dist/documentation.js"
@@ -16109,19 +16152,19 @@ var package_default = {
16109
16152
  prepublishOnly: "pnpm build"
16110
16153
  },
16111
16154
  dependencies: {
16112
- "@ai-sdk/anthropic": "2.0.91",
16113
- "@ai-sdk/openai": "2.0.116",
16114
- "@ai-sdk/openai-compatible": "1.0.46",
16155
+ "@ai-sdk/anthropic": "4.0.58",
16156
+ "@ai-sdk/openai": "4.0.71",
16157
+ "@ai-sdk/openai-compatible": "3.0.53",
16115
16158
  "@clack/prompts": "^1.2.0",
16116
16159
  "@mdx-js/mdx": "^3.1.1",
16117
16160
  acorn: "^8.16.0",
16118
- ai: "5.0.222",
16161
+ ai: "7.0.107",
16119
16162
  "better-auth": "1.6.23",
16120
16163
  citty: "^0.2.0",
16121
16164
  "cross-spawn": "^7.0.6",
16122
16165
  esbuild: "^0.27.0",
16123
16166
  "highlight.js": "^11.11.1",
16124
- hono: "^4.12.34",
16167
+ hono: "^4.13.7",
16125
16168
  jose: "^6.1.0",
16126
16169
  marked: "^18.0.7",
16127
16170
  "mdast-util-gfm": "^3.1.0",
@@ -16130,7 +16173,7 @@ var package_default = {
16130
16173
  "remark-frontmatter": "^5.0.0",
16131
16174
  "remark-gfm": "^4.0.1",
16132
16175
  "sanitize-html": "^2.17.7",
16133
- "smol-toml": "^1.6.1",
16176
+ "smol-toml": "^1.7.1",
16134
16177
  yaml: "^2.9.0",
16135
16178
  yjs: "^13.6.0",
16136
16179
  zod: "^4.3.6"
@@ -16141,7 +16184,11 @@ var package_default = {
16141
16184
  "lucide-react": ">=0.400.0",
16142
16185
  react: "^18.0.0 || ^19.0.0",
16143
16186
  "react-dom": "^18.0.0 || ^19.0.0",
16144
- "tailwind-merge": ">=2.0.0"
16187
+ "tailwind-merge": ">=2.0.0",
16188
+ "expo-crypto": "~57.0.0",
16189
+ "expo-linking": "~57.0.0",
16190
+ "expo-secure-store": "~57.0.0",
16191
+ "expo-web-browser": "~57.0.0"
16145
16192
  },
16146
16193
  peerDependenciesMeta: {
16147
16194
  "@playwright/test": {
@@ -16161,6 +16208,18 @@ var package_default = {
16161
16208
  },
16162
16209
  "lucide-react": {
16163
16210
  optional: true
16211
+ },
16212
+ "expo-crypto": {
16213
+ optional: true
16214
+ },
16215
+ "expo-linking": {
16216
+ optional: true
16217
+ },
16218
+ "expo-secure-store": {
16219
+ optional: true
16220
+ },
16221
+ "expo-web-browser": {
16222
+ optional: true
16164
16223
  }
16165
16224
  },
16166
16225
  devDependencies: {