@agent-native/dispatch 0.40.23-nightly-20261014124140 → 0.40.23

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/dispatch",
3
- "version": "0.40.23-nightly-20261014124140",
3
+ "version": "0.40.23",
4
4
  "description": "Dispatch — workspace control plane for agent-native apps. Vault, integrations, destinations, scheduled jobs, and cross-app delegation, shipped as a single drop-in package.",
5
5
  "homepage": "https://github.com/BuilderIO/agent-native#readme",
6
6
  "bugs": {
@@ -89,7 +89,7 @@
89
89
  "tailwind-merge": "^3.5.0",
90
90
  "vaul": "^1.1.2",
91
91
  "zod": "^4.3.6",
92
- "@agent-native/toolkit": "0.209.0-nightly-20261014124140"
92
+ "@agent-native/toolkit": "0.209.0"
93
93
  },
94
94
  "devDependencies": {
95
95
  "@react-router/dev": "^8.1.0",
@@ -103,10 +103,10 @@
103
103
  "typescript-7": "npm:typescript@^7.0.2",
104
104
  "vite": "8.1.0",
105
105
  "vitest": "^4.1.5",
106
- "@agent-native/core": "0.209.0-nightly-20261014124140"
106
+ "@agent-native/core": "0.209.0"
107
107
  },
108
108
  "peerDependencies": {
109
- "@agent-native/core": "0.209.0-nightly-20261014124140",
109
+ "@agent-native/core": ">=0.198.6",
110
110
  "react": ">=19.2.7",
111
111
  "react-dom": ">=19.2.7",
112
112
  "react-router": ">=8"
@@ -22,7 +22,6 @@ const attachmentSchema = z.discriminatedUnion("type", [
22
22
  name: z.string().min(1),
23
23
  dataUrl: z.string(),
24
24
  text: z.string().optional(),
25
- size: z.number().int().nonnegative(),
26
25
  id: z.string().min(1),
27
26
  }),
28
27
  z.object({
@@ -2133,7 +2133,6 @@ describe("startWorkspaceAppCreation", () => {
2133
2133
  name: "notes.txt",
2134
2134
  dataUrl: "",
2135
2135
  text: "Requirements",
2136
- size: Buffer.byteLength("Requirements", "utf8"),
2137
2136
  id: "file-notes",
2138
2137
  },
2139
2138
  ],
@@ -2153,6 +2152,74 @@ describe("startWorkspaceAppCreation", () => {
2153
2152
  );
2154
2153
  });
2155
2154
 
2155
+ it("rejects an invalid attachment before reserving the app or calling Builder", async () => {
2156
+ stubHostedRuntime();
2157
+ stubBuilderProjectConfigured();
2158
+ mocks.runBuilderAgent.mockClear();
2159
+
2160
+ await expect(
2161
+ runWithRequestContext(
2162
+ { userEmail: "dev@example.test", orgId: "org-123" },
2163
+ () =>
2164
+ startWorkspaceAppCreation({
2165
+ prompt: "Build an app",
2166
+ appId: "onboarding",
2167
+ attachments: [
2168
+ {
2169
+ type: "upload",
2170
+ contentType: "text/plain",
2171
+ name: "notes.md",
2172
+ dataUrl: "",
2173
+ id: "file-notes",
2174
+ },
2175
+ ],
2176
+ }),
2177
+ ),
2178
+ ).rejects.toMatchObject({ errorCode: "invalid_attachment" });
2179
+ expect(mocks.runBuilderAgent).not.toHaveBeenCalled();
2180
+ });
2181
+
2182
+ it("logs why Builder could not start the branch", async () => {
2183
+ stubHostedRuntime();
2184
+ stubBuilderProjectConfigured();
2185
+ mocks.resolveBuilderCredentialsDetailed.mockResolvedValue(
2186
+ credentials({
2187
+ privateKey: "priv",
2188
+ publicKey: "pub",
2189
+ userId: "builder-user-42",
2190
+ }),
2191
+ );
2192
+ mocks.runBuilderAgent.mockRejectedValue(
2193
+ new Error("Builder agent run failed (500)", {
2194
+ cause: new Error("socket hang up"),
2195
+ }),
2196
+ );
2197
+ const warn = vi.spyOn(console, "warn").mockImplementation(() => {});
2198
+
2199
+ const result = (await runWithRequestContext(
2200
+ { userEmail: "dev@example.test", orgId: "org-123" },
2201
+ () =>
2202
+ startWorkspaceAppCreation({
2203
+ prompt: "Build an app",
2204
+ appId: "onboarding",
2205
+ }),
2206
+ )) as any;
2207
+
2208
+ expect(result).toMatchObject({
2209
+ mode: "builder-unavailable",
2210
+ reason: "builder-error",
2211
+ });
2212
+ const logged = warn.mock.calls.find(
2213
+ ([message]) =>
2214
+ message === "[dispatch] workspace app creation unavailable",
2215
+ );
2216
+ expect(logged?.[1]).toMatchObject({
2217
+ appId: "onboarding",
2218
+ reason: "builder-error",
2219
+ error: expect.stringContaining("socket hang up"),
2220
+ });
2221
+ });
2222
+
2156
2223
  it("does not let an organization member persist an auto-provisioned project", async () => {
2157
2224
  stubHostedRuntime();
2158
2225
  mocks.state.orgRole = "member";
@@ -5,6 +5,7 @@ import { fileURLToPath } from "node:url";
5
5
 
6
6
  import { canonicalA2AAudience, signA2AToken } from "@agent-native/core/a2a";
7
7
  import { isActionContractError } from "@agent-native/core/action";
8
+ import { describeErrorWithCauses } from "@agent-native/core/agent/engine/error-detail";
8
9
  import { getDbExec } from "@agent-native/core/db";
9
10
  import {
10
11
  getOrgDomain,
@@ -21,6 +22,7 @@ import {
21
22
  readConfiguredWorkspaceAppHomePath,
22
23
  resolveAppRuntimeUrl,
23
24
  resolveVercelDeploymentProtectionHeaders,
25
+ normalizeBuilderAgentAttachments,
24
26
  runBuilderAgent,
25
27
  type BuilderAgentAttachment,
26
28
  } from "@agent-native/core/server";
@@ -2782,6 +2784,12 @@ function builderUnavailable(input: {
2782
2784
  input.err instanceof Error && input.err.message
2783
2785
  ? input.err.message
2784
2786
  : input.fallbackDetail;
2787
+ console.warn("[dispatch] workspace app creation unavailable", {
2788
+ appId: input.appId,
2789
+ projectId: input.projectId,
2790
+ reason,
2791
+ error: describeErrorWithCauses(input.err),
2792
+ });
2785
2793
  const base = {
2786
2794
  mode: "builder-unavailable" as const,
2787
2795
  appId: input.appId,
@@ -2894,11 +2902,16 @@ export async function startWorkspaceAppCreation(input: {
2894
2902
  });
2895
2903
  assertValidWorkspaceAppId(initial.appId);
2896
2904
  requireWorkspaceAppOrgId();
2905
+ normalizeBuilderAgentAttachments(input.attachments);
2897
2906
  const isLocal = isLocalAppCreationRuntime();
2898
2907
 
2899
2908
  if (!isLocal) {
2900
2909
  const authorization = await remoteAppCreationAuthorization();
2901
2910
  if (authorization.ok === false) {
2911
+ console.warn("[dispatch] workspace app creation not authorized", {
2912
+ appId: initial.appId,
2913
+ reason: authorization.reason,
2914
+ });
2902
2915
  return {
2903
2916
  mode: "builder-unavailable",
2904
2917
  appId: initial.appId,
@@ -2972,6 +2985,10 @@ export async function startWorkspaceAppCreation(input: {
2972
2985
  builderProjectId = (await ensureBuilderProjectForWorkspace()).projectId;
2973
2986
  } catch (err) {
2974
2987
  if (err instanceof AppCreationSettingsAuthorizationError) {
2988
+ console.warn(
2989
+ "[dispatch] workspace app creation needs an owner or admin to configure the Builder project",
2990
+ { appId: built.appId },
2991
+ );
2975
2992
  return {
2976
2993
  mode: "builder-unavailable",
2977
2994
  appId: built.appId,