@agent-native/dispatch 0.7.0 → 0.8.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 (235) hide show
  1. package/README.md +56 -3
  2. package/dist/actions/apply-dream-proposal.d.ts +3 -0
  3. package/dist/actions/apply-dream-proposal.d.ts.map +1 -0
  4. package/dist/actions/apply-dream-proposal.js +11 -0
  5. package/dist/actions/apply-dream-proposal.js.map +1 -0
  6. package/dist/actions/create-dream-report.d.ts +3 -0
  7. package/dist/actions/create-dream-report.d.ts.map +1 -0
  8. package/dist/actions/create-dream-report.js +67 -0
  9. package/dist/actions/create-dream-report.js.map +1 -0
  10. package/dist/actions/create-workspace-resource.js +3 -3
  11. package/dist/actions/create-workspace-resource.js.map +1 -1
  12. package/dist/actions/delete-workspace-resource.js +1 -1
  13. package/dist/actions/delete-workspace-resource.js.map +1 -1
  14. package/dist/actions/ensure-dream-job.d.ts +3 -0
  15. package/dist/actions/ensure-dream-job.d.ts.map +1 -0
  16. package/dist/actions/ensure-dream-job.js +73 -0
  17. package/dist/actions/ensure-dream-job.js.map +1 -0
  18. package/dist/actions/get-dream-settings.d.ts +3 -0
  19. package/dist/actions/get-dream-settings.d.ts.map +1 -0
  20. package/dist/actions/get-dream-settings.js +11 -0
  21. package/dist/actions/get-dream-settings.js.map +1 -0
  22. package/dist/actions/get-dream.d.ts +3 -0
  23. package/dist/actions/get-dream.d.ts.map +1 -0
  24. package/dist/actions/get-dream.js +13 -0
  25. package/dist/actions/get-dream.js.map +1 -0
  26. package/dist/actions/get-workspace-resource-effective-context.d.ts +3 -0
  27. package/dist/actions/get-workspace-resource-effective-context.d.ts.map +1 -0
  28. package/dist/actions/get-workspace-resource-effective-context.js +27 -0
  29. package/dist/actions/get-workspace-resource-effective-context.js.map +1 -0
  30. package/dist/actions/index.d.ts.map +1 -1
  31. package/dist/actions/index.js +30 -4
  32. package/dist/actions/index.js.map +1 -1
  33. package/dist/actions/list-dream-candidates.d.ts +3 -0
  34. package/dist/actions/list-dream-candidates.d.ts.map +1 -0
  35. package/dist/actions/list-dream-candidates.js +68 -0
  36. package/dist/actions/list-dream-candidates.js.map +1 -0
  37. package/dist/actions/list-dreams.d.ts +3 -0
  38. package/dist/actions/list-dreams.d.ts.map +1 -0
  39. package/dist/actions/list-dreams.js +17 -0
  40. package/dist/actions/list-dreams.js.map +1 -0
  41. package/dist/actions/list-workspace-resources-for-app.d.ts +3 -0
  42. package/dist/actions/list-workspace-resources-for-app.d.ts.map +1 -0
  43. package/dist/actions/list-workspace-resources-for-app.js +12 -0
  44. package/dist/actions/list-workspace-resources-for-app.js.map +1 -0
  45. package/dist/actions/list-workspace-resources.js +1 -1
  46. package/dist/actions/list-workspace-resources.js.map +1 -1
  47. package/dist/actions/navigate.d.ts +1 -0
  48. package/dist/actions/navigate.d.ts.map +1 -1
  49. package/dist/actions/navigate.js +2 -1
  50. package/dist/actions/navigate.js.map +1 -1
  51. package/dist/actions/preview-dream-proposal.d.ts +3 -0
  52. package/dist/actions/preview-dream-proposal.d.ts.map +1 -0
  53. package/dist/actions/preview-dream-proposal.js +13 -0
  54. package/dist/actions/preview-dream-proposal.js.map +1 -0
  55. package/dist/actions/preview-workspace-resource-change.d.ts +3 -0
  56. package/dist/actions/preview-workspace-resource-change.d.ts.map +1 -0
  57. package/dist/actions/preview-workspace-resource-change.js +24 -0
  58. package/dist/actions/preview-workspace-resource-change.js.map +1 -0
  59. package/dist/actions/reject-dream-proposal.d.ts +3 -0
  60. package/dist/actions/reject-dream-proposal.d.ts.map +1 -0
  61. package/dist/actions/reject-dream-proposal.js +12 -0
  62. package/dist/actions/reject-dream-proposal.js.map +1 -0
  63. package/dist/actions/restore-starter-workspace-resources.d.ts +3 -0
  64. package/dist/actions/restore-starter-workspace-resources.d.ts.map +1 -0
  65. package/dist/actions/restore-starter-workspace-resources.js +14 -0
  66. package/dist/actions/restore-starter-workspace-resources.js.map +1 -0
  67. package/dist/actions/send-code-agent-remote-command.d.ts +3 -0
  68. package/dist/actions/send-code-agent-remote-command.d.ts.map +1 -0
  69. package/dist/actions/send-code-agent-remote-command.js +53 -0
  70. package/dist/actions/send-code-agent-remote-command.js.map +1 -0
  71. package/dist/actions/set-dream-settings.d.ts +3 -0
  72. package/dist/actions/set-dream-settings.d.ts.map +1 -0
  73. package/dist/actions/set-dream-settings.js +41 -0
  74. package/dist/actions/set-dream-settings.js.map +1 -0
  75. package/dist/actions/start-workspace-app-creation.js +1 -1
  76. package/dist/actions/start-workspace-app-creation.js.map +1 -1
  77. package/dist/actions/update-workspace-resource.js +1 -1
  78. package/dist/actions/update-workspace-resource.js.map +1 -1
  79. package/dist/actions/view-screen.d.ts.map +1 -1
  80. package/dist/actions/view-screen.js +73 -2
  81. package/dist/actions/view-screen.js.map +1 -1
  82. package/dist/components/approval-value-block.d.ts +7 -0
  83. package/dist/components/approval-value-block.d.ts.map +1 -0
  84. package/dist/components/approval-value-block.js +22 -0
  85. package/dist/components/approval-value-block.js.map +1 -0
  86. package/dist/components/create-app-popover.d.ts.map +1 -1
  87. package/dist/components/create-app-popover.js +6 -5
  88. package/dist/components/create-app-popover.js.map +1 -1
  89. package/dist/components/layout/Layout.d.ts.map +1 -1
  90. package/dist/components/layout/Layout.js +8 -1
  91. package/dist/components/layout/Layout.js.map +1 -1
  92. package/dist/components/ui/chart.d.ts +1 -1
  93. package/dist/components/workspace-app-card.d.ts.map +1 -1
  94. package/dist/components/workspace-app-card.js +25 -4
  95. package/dist/components/workspace-app-card.js.map +1 -1
  96. package/dist/components/workspace-resource-effective-stack.d.ts +11 -0
  97. package/dist/components/workspace-resource-effective-stack.d.ts.map +1 -0
  98. package/dist/components/workspace-resource-effective-stack.js +59 -0
  99. package/dist/components/workspace-resource-effective-stack.js.map +1 -0
  100. package/dist/components/workspace-resource-impact-preview.d.ts +9 -0
  101. package/dist/components/workspace-resource-impact-preview.d.ts.map +1 -0
  102. package/dist/components/workspace-resource-impact-preview.js +39 -0
  103. package/dist/components/workspace-resource-impact-preview.js.map +1 -0
  104. package/dist/db/migrations.d.ts.map +1 -1
  105. package/dist/db/migrations.js +59 -0
  106. package/dist/db/migrations.js.map +1 -1
  107. package/dist/db/schema.d.ts +714 -0
  108. package/dist/db/schema.d.ts.map +1 -1
  109. package/dist/db/schema.js +44 -2
  110. package/dist/db/schema.js.map +1 -1
  111. package/dist/hooks/use-navigation-state.d.ts +3 -0
  112. package/dist/hooks/use-navigation-state.d.ts.map +1 -1
  113. package/dist/hooks/use-navigation-state.js +23 -3
  114. package/dist/hooks/use-navigation-state.js.map +1 -1
  115. package/dist/lib/utils.d.ts +2 -1
  116. package/dist/lib/utils.d.ts.map +1 -1
  117. package/dist/lib/utils.js +5 -1
  118. package/dist/lib/utils.js.map +1 -1
  119. package/dist/routes/index.d.ts.map +1 -1
  120. package/dist/routes/index.js +1 -0
  121. package/dist/routes/index.js.map +1 -1
  122. package/dist/routes/pages/approval.d.ts.map +1 -1
  123. package/dist/routes/pages/approval.js +4 -1
  124. package/dist/routes/pages/approval.js.map +1 -1
  125. package/dist/routes/pages/approvals.js +1 -1
  126. package/dist/routes/pages/approvals.js.map +1 -1
  127. package/dist/routes/pages/dream-settings.d.ts +34 -0
  128. package/dist/routes/pages/dream-settings.d.ts.map +1 -0
  129. package/dist/routes/pages/dream-settings.js +68 -0
  130. package/dist/routes/pages/dream-settings.js.map +1 -0
  131. package/dist/routes/pages/dreams.d.ts +5 -0
  132. package/dist/routes/pages/dreams.d.ts.map +1 -0
  133. package/dist/routes/pages/dreams.js +435 -0
  134. package/dist/routes/pages/dreams.js.map +1 -0
  135. package/dist/routes/pages/workspace.d.ts.map +1 -1
  136. package/dist/routes/pages/workspace.js +187 -35
  137. package/dist/routes/pages/workspace.js.map +1 -1
  138. package/dist/server/lib/app-creation-store.d.ts.map +1 -1
  139. package/dist/server/lib/app-creation-store.js +3 -2
  140. package/dist/server/lib/app-creation-store.js.map +1 -1
  141. package/dist/server/lib/dispatch-integrations.d.ts +1 -1
  142. package/dist/server/lib/dispatch-integrations.d.ts.map +1 -1
  143. package/dist/server/lib/dispatch-integrations.js +9 -4
  144. package/dist/server/lib/dispatch-integrations.js.map +1 -1
  145. package/dist/server/lib/dispatch-remote-commands.d.ts +83 -0
  146. package/dist/server/lib/dispatch-remote-commands.d.ts.map +1 -0
  147. package/dist/server/lib/dispatch-remote-commands.js +256 -0
  148. package/dist/server/lib/dispatch-remote-commands.js.map +1 -0
  149. package/dist/server/lib/dispatch-store.d.ts +26 -0
  150. package/dist/server/lib/dispatch-store.d.ts.map +1 -1
  151. package/dist/server/lib/dispatch-store.js +17 -1
  152. package/dist/server/lib/dispatch-store.js.map +1 -1
  153. package/dist/server/lib/dreams-store.d.ts +398 -0
  154. package/dist/server/lib/dreams-store.d.ts.map +1 -0
  155. package/dist/server/lib/dreams-store.js +2330 -0
  156. package/dist/server/lib/dreams-store.js.map +1 -0
  157. package/dist/server/lib/thread-debug-store.d.ts +2 -2
  158. package/dist/server/lib/vault-store.d.ts +1 -1
  159. package/dist/server/lib/workspace-resources-store.d.ts +181 -17
  160. package/dist/server/lib/workspace-resources-store.d.ts.map +1 -1
  161. package/dist/server/lib/workspace-resources-store.js +737 -108
  162. package/dist/server/lib/workspace-resources-store.js.map +1 -1
  163. package/dist/server/plugins/agent-chat.js +1 -1
  164. package/dist/server/plugins/agent-chat.js.map +1 -1
  165. package/dist/server/plugins/integrations.js +2 -2
  166. package/dist/server/plugins/integrations.js.map +1 -1
  167. package/package.json +4 -2
  168. package/src/actions/apply-dream-proposal.ts +12 -0
  169. package/src/actions/create-dream-report.ts +76 -0
  170. package/src/actions/create-workspace-resource.ts +3 -3
  171. package/src/actions/delete-workspace-resource.ts +1 -1
  172. package/src/actions/ensure-dream-job.ts +76 -0
  173. package/src/actions/get-dream-settings.ts +12 -0
  174. package/src/actions/get-dream.ts +14 -0
  175. package/src/actions/get-workspace-resource-effective-context.ts +34 -0
  176. package/src/actions/index.spec.ts +26 -0
  177. package/src/actions/index.ts +31 -4
  178. package/src/actions/list-dream-candidates.ts +77 -0
  179. package/src/actions/list-dreams.ts +17 -0
  180. package/src/actions/list-workspace-resources-for-app.ts +13 -0
  181. package/src/actions/list-workspace-resources.ts +1 -1
  182. package/src/actions/navigate.ts +2 -1
  183. package/src/actions/preview-dream-proposal.ts +14 -0
  184. package/src/actions/preview-workspace-resource-change.ts +25 -0
  185. package/src/actions/reject-dream-proposal.ts +12 -0
  186. package/src/actions/restore-starter-workspace-resources.ts +17 -0
  187. package/src/actions/send-code-agent-remote-command.ts +59 -0
  188. package/src/actions/set-dream-settings.spec.ts +81 -0
  189. package/src/actions/set-dream-settings.ts +44 -0
  190. package/src/actions/start-workspace-app-creation.ts +1 -1
  191. package/src/actions/update-workspace-resource.ts +1 -1
  192. package/src/actions/view-screen.ts +90 -2
  193. package/src/components/approval-value-block.spec.tsx +59 -0
  194. package/src/components/approval-value-block.tsx +33 -0
  195. package/src/components/create-app-popover.tsx +6 -5
  196. package/src/components/layout/Layout.tsx +8 -0
  197. package/src/components/workspace-app-card.tsx +166 -1
  198. package/src/components/workspace-resource-effective-stack.spec.tsx +125 -0
  199. package/src/components/workspace-resource-effective-stack.tsx +141 -0
  200. package/src/components/workspace-resource-impact-preview.spec.tsx +147 -0
  201. package/src/components/workspace-resource-impact-preview.tsx +116 -0
  202. package/src/db/migrations.spec.ts +79 -0
  203. package/src/db/migrations.ts +59 -0
  204. package/src/db/schema.ts +46 -2
  205. package/src/hooks/use-navigation-state.ts +24 -5
  206. package/src/lib/utils.ts +6 -1
  207. package/src/routes/index.ts +1 -0
  208. package/src/routes/pages/approval.tsx +14 -1
  209. package/src/routes/pages/approvals.tsx +1 -1
  210. package/src/routes/pages/dream-settings.spec.ts +130 -0
  211. package/src/routes/pages/dream-settings.ts +103 -0
  212. package/src/routes/pages/dreams.tsx +1828 -0
  213. package/src/routes/pages/workspace.tsx +577 -97
  214. package/src/server/lib/app-creation-store.ts +3 -2
  215. package/src/server/lib/dispatch-integrations.ts +10 -3
  216. package/src/server/lib/dispatch-remote-commands.spec.ts +167 -0
  217. package/src/server/lib/dispatch-remote-commands.ts +375 -0
  218. package/src/server/lib/dispatch-store.ts +37 -1
  219. package/src/server/lib/dreams-store.spec.ts +1492 -0
  220. package/src/server/lib/dreams-store.ts +3168 -0
  221. package/src/server/lib/workspace-resource-approval-lifecycle.spec.ts +226 -0
  222. package/src/server/lib/workspace-resources-store.spec.ts +1106 -0
  223. package/src/server/lib/workspace-resources-store.ts +1001 -134
  224. package/src/server/plugins/agent-chat.ts +1 -1
  225. package/src/server/plugins/integrations.ts +2 -2
  226. package/dist/actions/sync-workspace-resources-to-all.d.ts +0 -3
  227. package/dist/actions/sync-workspace-resources-to-all.d.ts.map +0 -1
  228. package/dist/actions/sync-workspace-resources-to-all.js +0 -9
  229. package/dist/actions/sync-workspace-resources-to-all.js.map +0 -1
  230. package/dist/actions/sync-workspace-resources-to-app.d.ts +0 -3
  231. package/dist/actions/sync-workspace-resources-to-app.d.ts.map +0 -1
  232. package/dist/actions/sync-workspace-resources-to-app.js +0 -11
  233. package/dist/actions/sync-workspace-resources-to-app.js.map +0 -1
  234. package/src/actions/sync-workspace-resources-to-all.ts +0 -10
  235. package/src/actions/sync-workspace-resources-to-app.ts +0 -12
@@ -0,0 +1,34 @@
1
+ import { defineAction } from "@agent-native/core";
2
+ import { z } from "zod";
3
+ import { getWorkspaceResourceEffectiveContext } from "../server/lib/workspace-resources-store.js";
4
+
5
+ export default defineAction({
6
+ description:
7
+ "Preview how a Dispatch workspace resource resolves for an app/user at runtime: workspace default, organization/app override, and personal override, plus whether the resource is all-app or selected-only.",
8
+ schema: z.object({
9
+ resourceId: z
10
+ .string()
11
+ .optional()
12
+ .describe("Workspace resource id to inspect."),
13
+ path: z
14
+ .string()
15
+ .optional()
16
+ .describe(
17
+ "Resource path to inspect, such as context/brand.md. Optional when resourceId is provided.",
18
+ ),
19
+ appId: z
20
+ .string()
21
+ .optional()
22
+ .describe(
23
+ "Workspace app id to preview. All-app resources are inherited by every app; selected-only resources require a grant.",
24
+ ),
25
+ userEmail: z
26
+ .string()
27
+ .optional()
28
+ .describe(
29
+ "User email for personal overrides. Defaults to the current Dispatch user.",
30
+ ),
31
+ }),
32
+ http: { method: "GET" },
33
+ run: async (args) => getWorkspaceResourceEffectiveContext(args),
34
+ });
@@ -0,0 +1,26 @@
1
+ import { describe, expect, it } from "vitest";
2
+
3
+ import { dispatchActions } from "./index.js";
4
+
5
+ describe("dispatch action registry", () => {
6
+ it("keeps workspace resources runtime-inherited instead of exposing sync actions", () => {
7
+ expect(dispatchActions).toHaveProperty("list-workspace-resources-for-app");
8
+ expect(dispatchActions).toHaveProperty(
9
+ "get-workspace-resource-effective-context",
10
+ );
11
+ expect(dispatchActions).toHaveProperty("grant-workspace-resources-to-app");
12
+ expect(dispatchActions).toHaveProperty("sync-vault-to-app");
13
+
14
+ expect(dispatchActions).not.toHaveProperty(
15
+ "sync-workspace-resources-to-app",
16
+ );
17
+ expect(dispatchActions).not.toHaveProperty(
18
+ "sync-workspace-resources-to-all",
19
+ );
20
+ expect(
21
+ Object.keys(dispatchActions).filter((name) =>
22
+ name.startsWith("sync-workspace-resources"),
23
+ ),
24
+ ).toEqual([]);
25
+ });
26
+ });
@@ -8,14 +8,19 @@ import createVaultGrant from "./create-vault-grant.js";
8
8
  import createVaultSecret from "./create-vault-secret.js";
9
9
  import createWorkspaceResourceGrant from "./create-workspace-resource-grant.js";
10
10
  import createWorkspaceResource from "./create-workspace-resource.js";
11
+ import createDreamReport from "./create-dream-report.js";
11
12
  import deleteDestination from "./delete-destination.js";
12
13
  import deleteVaultSecret from "./delete-vault-secret.js";
13
14
  import deleteWorkspaceResource from "./delete-workspace-resource.js";
14
15
  import denyVaultRequest from "./deny-vault-request.js";
16
+ import ensureDreamJob from "./ensure-dream-job.js";
15
17
  import getAppCreationSettings from "./get-app-creation-settings.js";
16
18
  import getAgentThreadDebug from "./get-agent-thread-debug.js";
19
+ import getDream from "./get-dream.js";
20
+ import getDreamSettings from "./get-dream-settings.js";
17
21
  import getDispatchSettings from "./get-dispatch-settings.js";
18
22
  import getVaultAccessSettings from "./get-vault-access-settings.js";
23
+ import getWorkspaceResourceEffectiveContext from "./get-workspace-resource-effective-context.js";
19
24
  import getWorkspaceInfo from "./get-workspace-info.js";
20
25
  import grantWorkspaceResourcesToApp from "./grant-workspace-resources-to-app.js";
21
26
  import grantVaultSecretsToApp from "./grant-vault-secrets-to-app.js";
@@ -27,6 +32,8 @@ import listDispatchApprovals from "./list-dispatch-approvals.js";
27
32
  import listDispatchAudit from "./list-dispatch-audit.js";
28
33
  import listDispatchOverview from "./list-dispatch-overview.js";
29
34
  import listDispatchUsageMetrics from "./list-dispatch-usage-metrics.js";
35
+ import listDreamCandidates from "./list-dream-candidates.js";
36
+ import listDreams from "./list-dreams.js";
30
37
  import listIntegrationsCatalog from "./list-integrations-catalog.js";
31
38
  import listLinkedIdentities from "./list-linked-identities.js";
32
39
  import listVaultAudit from "./list-vault-audit.js";
@@ -37,23 +44,29 @@ import listVaultSecrets from "./list-vault-secrets.js";
37
44
  import listWorkspaceApps from "./list-workspace-apps.js";
38
45
  import listWorkspaceResourceOptions from "./list-workspace-resource-options.js";
39
46
  import listWorkspaceResourceGrants from "./list-workspace-resource-grants.js";
47
+ import listWorkspaceResourcesForApp from "./list-workspace-resources-for-app.js";
40
48
  import listWorkspaceResources from "./list-workspace-resources.js";
41
49
  import navigate from "./navigate.js";
50
+ import applyDreamProposal from "./apply-dream-proposal.js";
51
+ import previewDreamProposal from "./preview-dream-proposal.js";
52
+ import previewWorkspaceResourceChange from "./preview-workspace-resource-change.js";
42
53
  import rejectDispatchChange from "./reject-dispatch-change.js";
54
+ import rejectDreamProposal from "./reject-dream-proposal.js";
43
55
  import removePendingWorkspaceApp from "./remove-pending-workspace-app.js";
44
56
  import requestVaultSecret from "./request-vault-secret.js";
45
57
  import revokeVaultGrant from "./revoke-vault-grant.js";
46
58
  import revokeWorkspaceResourceGrant from "./revoke-workspace-resource-grant.js";
59
+ import restoreStarterWorkspaceResources from "./restore-starter-workspace-resources.js";
47
60
  import scaffoldWorkspaceApp from "./scaffold-workspace-app.js";
48
61
  import searchAgentThreads from "./search-agent-threads.js";
62
+ import sendCodeAgentRemoteCommand from "./send-code-agent-remote-command.js";
49
63
  import sendPlatformMessage from "./send-platform-message.js";
50
64
  import setAppCreationSettings from "./set-app-creation-settings.js";
51
65
  import setDispatchApprovalPolicy from "./set-dispatch-approval-policy.js";
66
+ import setDreamSettings from "./set-dream-settings.js";
52
67
  import setVaultAccessSettings from "./set-vault-access-settings.js";
53
68
  import startWorkspaceAppCreation from "./start-workspace-app-creation.js";
54
69
  import syncVaultToApp from "./sync-vault-to-app.js";
55
- import syncWorkspaceResourcesToAll from "./sync-workspace-resources-to-all.js";
56
- import syncWorkspaceResourcesToApp from "./sync-workspace-resources-to-app.js";
57
70
  import unarchiveWorkspaceApp from "./unarchive-workspace-app.js";
58
71
  import updateWorkspaceAppMetadata from "./update-workspace-app-metadata.js";
59
72
  import updateVaultSecret from "./update-vault-secret.js";
@@ -77,14 +90,20 @@ export const dispatchActions: Record<string, ActionEntry> = {
77
90
  "create-vault-secret": createVaultSecret,
78
91
  "create-workspace-resource-grant": createWorkspaceResourceGrant,
79
92
  "create-workspace-resource": createWorkspaceResource,
93
+ "create-dream-report": createDreamReport,
80
94
  "delete-destination": deleteDestination,
81
95
  "delete-vault-secret": deleteVaultSecret,
82
96
  "delete-workspace-resource": deleteWorkspaceResource,
83
97
  "deny-vault-request": denyVaultRequest,
98
+ "ensure-dream-job": ensureDreamJob,
84
99
  "get-app-creation-settings": getAppCreationSettings,
85
100
  "get-agent-thread-debug": getAgentThreadDebug,
101
+ "get-dream": getDream,
102
+ "get-dream-settings": getDreamSettings,
86
103
  "get-dispatch-settings": getDispatchSettings,
87
104
  "get-vault-access-settings": getVaultAccessSettings,
105
+ "get-workspace-resource-effective-context":
106
+ getWorkspaceResourceEffectiveContext,
88
107
  "get-workspace-info": getWorkspaceInfo,
89
108
  "grant-workspace-resources-to-app": grantWorkspaceResourcesToApp,
90
109
  "grant-vault-secrets-to-app": grantVaultSecretsToApp,
@@ -96,6 +115,8 @@ export const dispatchActions: Record<string, ActionEntry> = {
96
115
  "list-dispatch-audit": listDispatchAudit,
97
116
  "list-dispatch-overview": listDispatchOverview,
98
117
  "list-dispatch-usage-metrics": listDispatchUsageMetrics,
118
+ "list-dream-candidates": listDreamCandidates,
119
+ "list-dreams": listDreams,
99
120
  "list-integrations-catalog": listIntegrationsCatalog,
100
121
  "list-linked-identities": listLinkedIdentities,
101
122
  "list-vault-audit": listVaultAudit,
@@ -106,23 +127,29 @@ export const dispatchActions: Record<string, ActionEntry> = {
106
127
  "list-workspace-apps": listWorkspaceApps,
107
128
  "list-workspace-resource-options": listWorkspaceResourceOptions,
108
129
  "list-workspace-resource-grants": listWorkspaceResourceGrants,
130
+ "list-workspace-resources-for-app": listWorkspaceResourcesForApp,
109
131
  "list-workspace-resources": listWorkspaceResources,
110
132
  navigate: navigate,
133
+ "apply-dream-proposal": applyDreamProposal,
134
+ "preview-dream-proposal": previewDreamProposal,
135
+ "preview-workspace-resource-change": previewWorkspaceResourceChange,
111
136
  "reject-dispatch-change": rejectDispatchChange,
137
+ "reject-dream-proposal": rejectDreamProposal,
112
138
  "remove-pending-workspace-app": removePendingWorkspaceApp,
113
139
  "request-vault-secret": requestVaultSecret,
114
140
  "revoke-vault-grant": revokeVaultGrant,
115
141
  "revoke-workspace-resource-grant": revokeWorkspaceResourceGrant,
142
+ "restore-starter-workspace-resources": restoreStarterWorkspaceResources,
116
143
  "scaffold-workspace-app": scaffoldWorkspaceApp,
117
144
  "search-agent-threads": searchAgentThreads,
145
+ "send-code-agent-remote-command": sendCodeAgentRemoteCommand,
118
146
  "send-platform-message": sendPlatformMessage,
119
147
  "set-app-creation-settings": setAppCreationSettings,
120
148
  "set-dispatch-approval-policy": setDispatchApprovalPolicy,
149
+ "set-dream-settings": setDreamSettings,
121
150
  "set-vault-access-settings": setVaultAccessSettings,
122
151
  "start-workspace-app-creation": startWorkspaceAppCreation,
123
152
  "sync-vault-to-app": syncVaultToApp,
124
- "sync-workspace-resources-to-all": syncWorkspaceResourcesToAll,
125
- "sync-workspace-resources-to-app": syncWorkspaceResourcesToApp,
126
153
  "unarchive-workspace-app": unarchiveWorkspaceApp,
127
154
  "update-workspace-app-metadata": updateWorkspaceAppMetadata,
128
155
  "update-vault-secret": updateVaultSecret,
@@ -0,0 +1,77 @@
1
+ import { defineAction } from "@agent-native/core";
2
+ import { z } from "zod";
3
+ import { listDreamCandidates } from "../server/lib/dreams-store.js";
4
+
5
+ export default defineAction({
6
+ description:
7
+ "List recent agent threads worth reviewing in a Dispatch dream pass, scored from grounded signals like corrections, failures, tool errors, feedback, evals, and satisfaction.",
8
+ schema: z.object({
9
+ sourceId: z
10
+ .string()
11
+ .default("current")
12
+ .describe(
13
+ "Thread debug source id from list-agent-thread-sources. Use 'all' to scan every connected source.",
14
+ ),
15
+ sourceIds: z
16
+ .array(z.string().min(1))
17
+ .optional()
18
+ .describe(
19
+ "Optional explicit source ids to scan together. When provided, sourceId is treated as aggregate.",
20
+ ),
21
+ allSources: z.coerce
22
+ .boolean()
23
+ .default(false)
24
+ .describe(
25
+ "Scan every connected thread-debug source with partial results.",
26
+ ),
27
+ query: z
28
+ .string()
29
+ .optional()
30
+ .describe("Optional search term to focus candidate discovery."),
31
+ ownerEmail: z
32
+ .string()
33
+ .optional()
34
+ .describe(
35
+ "Optional owner email filter. Admins may pass '*' or omit to use their admin-visible scope.",
36
+ ),
37
+ limit: z.coerce.number().int().min(1).max(50).default(20),
38
+ sourceTimeoutMs: z.coerce
39
+ .number()
40
+ .int()
41
+ .min(1000)
42
+ .max(60000)
43
+ .default(15000)
44
+ .describe("Per-source timeout in milliseconds for partial scans."),
45
+ sourceConcurrency: z.coerce
46
+ .number()
47
+ .int()
48
+ .min(1)
49
+ .max(8)
50
+ .default(2)
51
+ .describe("How many thread-debug sources to scan at once."),
52
+ sourceStartStaggerMs: z.coerce
53
+ .number()
54
+ .int()
55
+ .min(0)
56
+ .max(5000)
57
+ .default(250)
58
+ .describe("Delay between source starts within a scan batch."),
59
+ threadConcurrency: z.coerce
60
+ .number()
61
+ .int()
62
+ .min(1)
63
+ .max(10)
64
+ .default(3)
65
+ .describe("How many threads to inspect at once within each source."),
66
+ threadTimeoutMs: z.coerce
67
+ .number()
68
+ .int()
69
+ .min(1000)
70
+ .max(30000)
71
+ .default(8000)
72
+ .describe("Per-thread debug timeout in milliseconds."),
73
+ }),
74
+ http: { method: "GET" },
75
+ readOnly: true,
76
+ run: async (input) => listDreamCandidates(input),
77
+ });
@@ -0,0 +1,17 @@
1
+ import { defineAction } from "@agent-native/core";
2
+ import { z } from "zod";
3
+ import { listDreams } from "../server/lib/dreams-store.js";
4
+
5
+ export default defineAction({
6
+ description: "List Dispatch dream reports with proposal status counts.",
7
+ schema: z.object({
8
+ limit: z.coerce.number().int().min(1).max(100).default(25),
9
+ status: z
10
+ .enum(["running", "completed", "failed", "all"])
11
+ .default("all")
12
+ .describe("Optional dream status filter."),
13
+ }),
14
+ http: { method: "GET" },
15
+ readOnly: true,
16
+ run: async (input) => listDreams(input),
17
+ });
@@ -0,0 +1,13 @@
1
+ import { defineAction } from "@agent-native/core";
2
+ import { z } from "zod";
3
+ import { listWorkspaceResourcesForApp } from "../server/lib/workspace-resources-store.js";
4
+
5
+ export default defineAction({
6
+ description:
7
+ "List the inherited workspace and explicitly granted resources an app receives, including auto-loaded instructions.",
8
+ schema: z.object({
9
+ appId: z.string().describe("Workspace app ID"),
10
+ }),
11
+ http: { method: "GET" },
12
+ run: async (args) => listWorkspaceResourcesForApp(args.appId),
13
+ });
@@ -4,7 +4,7 @@ import { listWorkspaceResources } from "../server/lib/workspace-resources-store.
4
4
 
5
5
  export default defineAction({
6
6
  description:
7
- "List all workspace-wide resources (skills, instructions, agents, and knowledge packs) that can be shared across apps.",
7
+ "List all workspace-wide resources (skills, instructions, agent profiles, and reference resources) that apps inherit at runtime.",
8
8
  schema: z.object({
9
9
  kind: z
10
10
  .enum(["skill", "instruction", "agent", "knowledge"])
@@ -5,6 +5,7 @@
5
5
  *
6
6
  * Usage:
7
7
  * pnpm action navigate --view=overview
8
+ * pnpm action navigate --view=dreams
8
9
  * pnpm action navigate --view=<custom-dispatch-extension-id>
9
10
  * pnpm action navigate --path=/some/route
10
11
  *
@@ -25,7 +26,7 @@ export default defineAction({
25
26
  .string()
26
27
  .optional()
27
28
  .describe(
28
- "Named dispatch view to navigate to. Built-in views include overview, apps, metrics, new-app, vault, integrations, messaging, workspace, agents, destinations, identities, approvals, audit, thread-debug, and team. Generated Dispatch extension tabs can also use their nav item id.",
29
+ "Named dispatch view to navigate to. Built-in views include overview, apps, metrics, new-app, vault, integrations, messaging, workspace, agents, destinations, identities, approvals, audit, thread-debug, dreams, and team. Generated Dispatch extension tabs can also use their nav item id.",
29
30
  ),
30
31
  path: z.string().optional().describe("URL path to navigate to"),
31
32
  }),
@@ -0,0 +1,14 @@
1
+ import { defineAction } from "@agent-native/core";
2
+ import { z } from "zod";
3
+ import { previewDreamProposal } from "../server/lib/dreams-store.js";
4
+
5
+ export default defineAction({
6
+ description:
7
+ "Preview one Dispatch dream proposal before applying it, including target, current content, proposed content, and approval behavior.",
8
+ schema: z.object({
9
+ id: z.string().min(1).describe("Dream proposal id."),
10
+ }),
11
+ http: { method: "GET" },
12
+ readOnly: true,
13
+ run: async ({ id }) => previewDreamProposal(id),
14
+ });
@@ -0,0 +1,25 @@
1
+ import { defineAction } from "@agent-native/core";
2
+ import { z } from "zod";
3
+ import { previewWorkspaceResourceChange } from "../server/lib/workspace-resources-store.js";
4
+
5
+ export default defineAction({
6
+ description:
7
+ "Preview the impact of creating, updating, or deleting a workspace resource, including All-app reach, overrides, and whether Dispatch approval will be requested.",
8
+ schema: z.object({
9
+ operation: z
10
+ .enum(["create", "update", "delete"])
11
+ .optional()
12
+ .describe("Change operation to preview."),
13
+ resourceId: z.string().optional().describe("Existing resource id."),
14
+ path: z
15
+ .string()
16
+ .optional()
17
+ .describe("Resource path, such as context/brand.md."),
18
+ scope: z
19
+ .enum(["all", "selected"])
20
+ .optional()
21
+ .describe("Resulting resource scope after the change."),
22
+ }),
23
+ http: { method: "GET" },
24
+ run: async (args) => previewWorkspaceResourceChange(args),
25
+ });
@@ -0,0 +1,12 @@
1
+ import { defineAction } from "@agent-native/core";
2
+ import { z } from "zod";
3
+ import { rejectDreamProposal } from "../server/lib/dreams-store.js";
4
+
5
+ export default defineAction({
6
+ description: "Reject one pending Dispatch dream proposal.",
7
+ schema: z.object({
8
+ id: z.string().min(1).describe("Dream proposal id."),
9
+ reason: z.string().optional().describe("Optional rejection reason."),
10
+ }),
11
+ run: async ({ id, reason }) => rejectDreamProposal(id, reason),
12
+ });
@@ -0,0 +1,17 @@
1
+ import { defineAction } from "@agent-native/core";
2
+ import { z } from "zod";
3
+ import { restoreStarterWorkspaceResources } from "../server/lib/workspace-resources-store.js";
4
+
5
+ export default defineAction({
6
+ description:
7
+ "Restore missing starter global workspace resources such as company, brand, messaging, guardrails, and company voice. Existing resources are left unchanged.",
8
+ schema: z.object({
9
+ paths: z
10
+ .array(z.string())
11
+ .optional()
12
+ .describe(
13
+ "Optional starter resource paths to restore. Omit to restore every missing starter resource.",
14
+ ),
15
+ }),
16
+ run: async (args) => restoreStarterWorkspaceResources(args),
17
+ });
@@ -0,0 +1,59 @@
1
+ import { defineAction } from "@agent-native/core";
2
+ import { getRequestUserEmail } from "@agent-native/core/server";
3
+ import { z } from "zod";
4
+ import {
5
+ enqueueRemoteCodeCommand,
6
+ type RemoteCodeCommandEnvelope,
7
+ } from "../server/lib/dispatch-remote-commands.js";
8
+
9
+ const commandSchema = z.discriminatedUnion("type", [
10
+ z.object({ type: z.literal("create"), prompt: z.string().min(1) }),
11
+ z.object({ type: z.literal("list") }),
12
+ z.object({ type: z.literal("status"), runRef: z.string().optional() }),
13
+ z.object({
14
+ type: z.literal("continue"),
15
+ runRef: z.string().min(1),
16
+ text: z.string().min(1),
17
+ }),
18
+ z.object({ type: z.literal("approve"), approvalId: z.string().min(1) }),
19
+ z.object({ type: z.literal("deny"), approvalId: z.string().min(1) }),
20
+ z.object({ type: z.literal("stop"), runRef: z.string().min(1) }),
21
+ ]);
22
+
23
+ export default defineAction({
24
+ description:
25
+ "Route a command to the remote Agent-Native Code host through the integration relay.",
26
+ schema: z.object({
27
+ command: commandSchema,
28
+ source: z
29
+ .object({
30
+ platform: z.string().default("dispatch"),
31
+ externalThreadId: z.string().default("dispatch"),
32
+ senderId: z.string().optional(),
33
+ senderName: z.string().optional(),
34
+ messageId: z.string().optional(),
35
+ timestamp: z.number().optional(),
36
+ })
37
+ .optional(),
38
+ }),
39
+ run: async ({ command, source }) => {
40
+ const ownerEmail = getRequestUserEmail();
41
+ if (!ownerEmail) throw new Error("no authenticated user");
42
+
43
+ const envelope: RemoteCodeCommandEnvelope = {
44
+ kind: "code-agent",
45
+ ownerEmail,
46
+ command,
47
+ source: {
48
+ platform: source?.platform || "dispatch",
49
+ externalThreadId: source?.externalThreadId || "dispatch",
50
+ senderId: source?.senderId,
51
+ senderName: source?.senderName,
52
+ messageId: source?.messageId,
53
+ timestamp: source?.timestamp ?? Date.now(),
54
+ },
55
+ };
56
+
57
+ return enqueueRemoteCodeCommand(envelope);
58
+ },
59
+ });
@@ -0,0 +1,81 @@
1
+ import { beforeEach, describe, expect, it, vi } from "vitest";
2
+
3
+ const mocks = vi.hoisted(() => ({
4
+ setDreamSettings: vi.fn(),
5
+ }));
6
+
7
+ vi.mock("../server/lib/dreams-store.js", () => ({
8
+ setDreamSettings: mocks.setDreamSettings,
9
+ }));
10
+
11
+ import action from "./set-dream-settings.js";
12
+
13
+ describe("set-dream-settings action", () => {
14
+ beforeEach(() => {
15
+ vi.clearAllMocks();
16
+ mocks.setDreamSettings.mockImplementation(async (input) => ({
17
+ enabled: false,
18
+ schedule: "0 9 * * 1",
19
+ sourceId: "all",
20
+ sourceIds: [],
21
+ allSources: true,
22
+ query: null,
23
+ limit: 8,
24
+ sourceTimeoutMs: 30000,
25
+ sourceConcurrency: 2,
26
+ sourceStartStaggerMs: 250,
27
+ threadConcurrency: 3,
28
+ threadTimeoutMs: 8000,
29
+ minCandidateCount: 1,
30
+ ...input,
31
+ }));
32
+ });
33
+
34
+ it("coerces numeric fields and preserves explicit clears", async () => {
35
+ await action.run({
36
+ enabled: true,
37
+ schedule: "0 8 * * 2",
38
+ sourceId: "current",
39
+ sourceIds: [],
40
+ allSources: false,
41
+ query: "",
42
+ limit: "50",
43
+ sourceTimeoutMs: "60000",
44
+ sourceConcurrency: "8",
45
+ sourceStartStaggerMs: "5000",
46
+ threadConcurrency: "10",
47
+ threadTimeoutMs: "30000",
48
+ minCandidateCount: "0",
49
+ } as any);
50
+
51
+ expect(mocks.setDreamSettings).toHaveBeenCalledWith({
52
+ enabled: true,
53
+ schedule: "0 8 * * 2",
54
+ sourceId: "current",
55
+ sourceIds: [],
56
+ allSources: false,
57
+ query: "",
58
+ limit: 50,
59
+ sourceTimeoutMs: 60000,
60
+ sourceConcurrency: 8,
61
+ sourceStartStaggerMs: 5000,
62
+ threadConcurrency: 10,
63
+ threadTimeoutMs: 30000,
64
+ minCandidateCount: 0,
65
+ });
66
+ });
67
+
68
+ it("rejects out-of-range numeric settings before writing", async () => {
69
+ await expect(action.run({ limit: "0" } as any)).rejects.toThrow(
70
+ /Invalid action parameters/,
71
+ );
72
+ await expect(
73
+ action.run({ sourceTimeoutMs: "60001" } as any),
74
+ ).rejects.toThrow(/Invalid action parameters/);
75
+ await expect(
76
+ action.run({ threadTimeoutMs: "30001" } as any),
77
+ ).rejects.toThrow(/Invalid action parameters/);
78
+
79
+ expect(mocks.setDreamSettings).not.toHaveBeenCalled();
80
+ });
81
+ });
@@ -0,0 +1,44 @@
1
+ import { defineAction } from "@agent-native/core";
2
+ import { z } from "zod";
3
+ import { setDreamSettings } from "../server/lib/dreams-store.js";
4
+
5
+ export default defineAction({
6
+ description:
7
+ "Update recurring Dispatch dream settings without immediately running or applying a dream pass.",
8
+ schema: z.object({
9
+ enabled: z
10
+ .boolean()
11
+ .optional()
12
+ .describe("Whether recurring dreams are on."),
13
+ schedule: z
14
+ .string()
15
+ .optional()
16
+ .describe('Five-field cron schedule, for example "0 9 * * 1".'),
17
+ sourceId: z
18
+ .string()
19
+ .optional()
20
+ .describe(
21
+ "Thread debug source id. Use 'all' for every connected source.",
22
+ ),
23
+ sourceIds: z
24
+ .array(z.string().min(1))
25
+ .optional()
26
+ .describe("Optional explicit source ids to scan together."),
27
+ allSources: z.coerce
28
+ .boolean()
29
+ .optional()
30
+ .describe("Scan every connected thread-debug source."),
31
+ query: z
32
+ .string()
33
+ .optional()
34
+ .describe("Optional search term for recurring dream passes."),
35
+ limit: z.coerce.number().int().min(1).max(50).optional(),
36
+ sourceTimeoutMs: z.coerce.number().int().min(1000).max(60000).optional(),
37
+ sourceConcurrency: z.coerce.number().int().min(1).max(8).optional(),
38
+ sourceStartStaggerMs: z.coerce.number().int().min(0).max(5000).optional(),
39
+ threadConcurrency: z.coerce.number().int().min(1).max(10).optional(),
40
+ threadTimeoutMs: z.coerce.number().int().min(1000).max(30000).optional(),
41
+ minCandidateCount: z.coerce.number().int().min(0).max(50).optional(),
42
+ }),
43
+ run: async (input) => setDreamSettings(input),
44
+ });
@@ -5,7 +5,7 @@ import { startWorkspaceAppCreation } from "../server/lib/app-creation-store.js";
5
5
 
6
6
  export default defineAction({
7
7
  description:
8
- "Start creating a new workspace app from Dispatch when the request truly needs its own app. In local dev this returns a code-agent prompt; in production it creates a Builder branch when a Builder project is configured. The result must be a separate workspace app under apps/<app-id>, not a new route or file in apps/starter. If the request needs Mail, Calendar, Analytics, or another first-party app, use the existing hosted/connected app via links or A2A; do not clone, wrap, or nest those templates inside the new app unless the user explicitly asks for a customized copy.",
8
+ "Start creating a new workspace app from Dispatch when the request truly needs its own app. In local dev this returns a code-agent prompt; in production it creates a Builder branch when a Builder project is configured. The result must be a separate workspace app under apps/<app-id>, not a new route or file in apps/starter. If the request needs Mail, Calendar, Analytics, Brain, or another first-party app, use the existing hosted/connected app via links or A2A; do not clone, wrap, or nest those templates inside the new app unless the user explicitly asks for a customized copy.",
9
9
  schema: z.object({
10
10
  prompt: z.string().min(1).describe("The user's app creation request"),
11
11
  appId: z
@@ -4,7 +4,7 @@ import { updateWorkspaceResource } from "../server/lib/workspace-resources-store
4
4
 
5
5
  export default defineAction({
6
6
  description:
7
- "Update a workspace resource's name, description, content, or scope.",
7
+ "Update a workspace resource's name, description, content, or scope. When Dispatch approval policy is enabled, changes that affect All-app resources queue an approval request before taking effect.",
8
8
  schema: z.object({
9
9
  id: z.string().describe("Resource ID"),
10
10
  name: z.string().optional().describe("New name"),