@agent-native/dispatch 0.40.38 → 0.40.39
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @agent-native/dispatch
|
|
2
2
|
|
|
3
|
+
## 0.40.39
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Release all public npm packages with a patch version bump.
|
|
8
|
+
- Updated dependencies [838e1ae]
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
- Updated dependencies [86429da]
|
|
11
|
+
- Updated dependencies [7b293b2]
|
|
12
|
+
- @agent-native/toolkit@0.219.0
|
|
13
|
+
|
|
3
14
|
## 0.40.38
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -1334,10 +1345,4 @@
|
|
|
1334
1345
|
|
|
1335
1346
|
- c58cd6e: Preserve verified mutation receipts and exact member identity across Dispatch and A2A delegation.
|
|
1336
1347
|
|
|
1337
|
-
## 0.30.2
|
|
1338
|
-
|
|
1339
|
-
### Patch Changes
|
|
1340
|
-
|
|
1341
|
-
- 330cf77: Keep impersonal HTML redirects eligible for the shared SSR edge cache.
|
|
1342
|
-
|
|
1343
1348
|
For the full list of releases, see the [changelog archive](./changelog/archive/CHANGELOG.md).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"community-apps.js","sourceRoot":"","sources":["../../../src/server/lib/community-apps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EACL,gCAAgC,EAChC,uBAAuB,GACxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,yBAAyB,EACzB,4BAA4B,GAC7B,MAAM,8CAA8C,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;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ourcesContent":["import { fail } from \"@agent-native/core/action\";\nimport { getUserLabEnabled } from \"@agent-native/core/labs/server\";\nimport {\n getWorkspaceAppIdValidationError,\n normalizeWorkspaceAppId,\n} from \"@agent-native/core/shared\";\nimport {\n BUILTIN_AGENT_CATALOG_IDS,\n HIDDEN_FIRST_PARTY_AGENT_IDS,\n} from \"@agent-native/core/shared/first-party-agents\";\n\nimport { COMMUNITY_APPS_LAB } from \"../../shared/labs.js\";\nimport type {\n StartWorkspaceAppCreationResult,\n WorkspaceAppSummary,\n} from \"./app-creation-store.js\";\nimport {\n getAppCreationSettings,\n getWorkspaceInfo,\n isLocalAppCreationRuntime,\n listWorkspaceApps,\n startWorkspaceAppCreation,\n} from \"./app-creation-store.js\";\nimport {\n loadPinnedCommunitySourceAttachments,\n type PinnedCommunitySource,\n} from \"./community-source.js\";\nimport { CURATED_WORKSPACE_TEMPLATES } from \"./curated-workspace-templates.js\";\nimport {\n currentOrgId,\n currentOwnerEmail,\n recordAudit,\n} from \"./dispatch-store.js\";\n\nexport interface CuratedCommunityAppSource extends PinnedCommunitySource {\n id: string;\n name: string;\n description: string;\n appId: string;\n license: string;\n provenance: string;\n}\n\nexport interface CuratedCommunityApp extends CuratedCommunityAppSource {\n installed: boolean;\n pending: boolean;\n installable: boolean;\n installUnavailableReason?:\n | \"workspace-required\"\n | \"app-id-conflict\"\n | \"builder-install-unverified\";\n}\n\nexport const CURATED_COMMUNITY_APP_SOURCES: readonly CuratedCommunityAppSource[] =\n [\n {\n id: \"community-qr\",\n name: \"QR\",\n description: \"Generate public PNG or SVG QR images from links or text.\",\n appId: \"community-qr\",\n repo: \"BuilderIO/agent-native\",\n ref: \"main\",\n license: \"MIT\",\n provenance:\n \"Reviewed Agent-Native Framework template, sanitized for independent installation.\",\n templatePath: \"templates/community/qr\",\n files: [\n {\n path: \"AGENTS.md\",\n blobSha: \"7dc9e18bc426dfd21526f91225cc615759450816\",\n },\n {\n path: \"LICENSE\",\n blobSha: \"69c7182efb3eb1a8b7f6fd5989f3e4fd737d0645\",\n },\n {\n path: \"README.md\",\n blobSha: \"e05e72bb9213732f56ccbc96f7dcb1c3a064cb19\",\n },\n {\n path: \"actions/generate-qr-code.spec.ts\",\n blobSha: \"3459217b7252c6ee0076c68cfdb83001cc74f29e\",\n },\n {\n path: \"actions/generate-qr-code.ts\",\n blobSha: \"98d30e218bfed796d5e402d5ce19a8626d8da0cf\",\n },\n {\n path: \"actions/run.ts\",\n blobSha: \"b46ab15b667c34741364ba08f010f7aca9d0f02e\",\n },\n {\n path: \"agent-native.json\",\n blobSha: \"accc32476792b84557f69e2b48b317c27b5546dc\",\n },\n {\n path: \"package.json\",\n blobSha: \"b37b5659f115dd887f97611ff01e9861c004e0f8\",\n },\n {\n path: \"server/db/index.ts\",\n blobSha: \"17007b456530f75a72e7209bdfe9f4bd4c9224e0\",\n },\n {\n path: \"server/db/schema.ts\",\n blobSha: \"2e4cd01c5f46463e78bc7beb6e954f3e526c0b57\",\n },\n {\n path: \"server/plugins/db.ts\",\n blobSha: \"78a5b431c1ad1ea14f593123c090f5376a36df10\",\n },\n {\n path: \"tsconfig.json\",\n blobSha: \"5267473a32dcab8e5dc2c9d9a720afed7f40174c\",\n },\n ],\n },\n ];\n\nconst communitySourceById = new Map(\n CURATED_COMMUNITY_APP_SOURCES.map((source) => [source.id, source]),\n);\n\nfunction requireCommunitySource(sourceId: string): CuratedCommunityAppSource {\n const source = communitySourceById.get(sourceId.trim());\n if (!source) {\n fail(\"That community app is not in Dispatch's reviewed install catalog.\", {\n errorCode: \"unknown_community_app_source\",\n statusCode: 404,\n });\n }\n return source;\n}\n\nfunction communitySourceFailureKind(\n error: unknown,\n): \"unavailable\" | \"integrity\" {\n if (!(error instanceof Error) || !(\"failureKind\" in error)) {\n return \"unavailable\";\n }\n return error.failureKind === \"integrity\" ? \"integrity\" : \"unavailable\";\n}\n\nfunction requireNonShadowingCommunityAppId(appId: string): void {\n const error = getWorkspaceAppIdValidationError(appId);\n if (error) {\n fail(error, { errorCode: \"invalid_community_app_id\", statusCode: 400 });\n }\n if (\n CURATED_WORKSPACE_TEMPLATES.some((template) => template.id === appId) ||\n BUILTIN_AGENT_CATALOG_IDS.includes(appId) ||\n HIDDEN_FIRST_PARTY_AGENT_IDS.has(appId)\n ) {\n fail(\"Community apps cannot use a first-party template app id.\", {\n errorCode: \"community_app_id_shadows_first_party\",\n statusCode: 409,\n });\n }\n}\n\nasync function requireCommunityAppsLab(): Promise<void> {\n const userEmail = currentOwnerEmail().trim();\n const orgId = currentOrgId();\n if (!userEmail || !orgId) {\n fail(\"Sign in to an organization to browse community apps.\", {\n errorCode: \"community_apps_identity_required\",\n statusCode: 403,\n });\n }\n const enabled = await getUserLabEnabled(userEmail, COMMUNITY_APPS_LAB, {\n orgId,\n });\n if (!enabled) {\n fail(\"Community app catalog and installs are disabled for this account.\", {\n errorCode: \"community_apps_lab_disabled\",\n statusCode: 403,\n });\n }\n}\n\nasync function hasAssociatedWorkspace(\n localRuntime = isLocalAppCreationRuntime(),\n): Promise<boolean> {\n if (localRuntime) return Boolean(getWorkspaceInfo().rootPath);\n return Boolean((await getAppCreationSettings()).builderProjectId);\n}\n\nexport async function listCuratedCommunityApps(): Promise<\n CuratedCommunityApp[]\n> {\n await requireCommunityAppsLab();\n const localRuntime = isLocalAppCreationRuntime();\n const [apps, workspaceAvailable] = await Promise.all([\n listWorkspaceApps({ includeAgentCards: false, includeArchived: true }),\n hasAssociatedWorkspace(localRuntime),\n ]);\n return CURATED_COMMUNITY_APP_SOURCES.map((source) => {\n const appWithId = apps.find((app) => app.id === source.appId);\n const installedApp =\n appWithId?.communitySourceId === source.id ? appWithId : null;\n const idConflict = Boolean(appWithId && !installedApp);\n const pending = installedApp?.status === \"pending\";\n const installUnavailableReason = appWithId\n ? idConflict\n ? \"app-id-conflict\"\n : undefined\n : !workspaceAvailable\n ? \"workspace-required\"\n : !localRuntime\n ? \"builder-install-unverified\"\n : undefined;\n return {\n ...source,\n installed: Boolean(installedApp && !pending),\n pending,\n installable: localRuntime && workspaceAvailable && !appWithId,\n ...(installUnavailableReason ? { installUnavailableReason } : {}),\n };\n });\n}\n\nfunction rejectCommunityAppIdConflict(appId: string): never {\n fail(`Workspace app id \"${appId}\" is already in use.`, {\n errorCode: \"community_app_id_conflict\",\n statusCode: 409,\n });\n}\n\nfunction existingInstallResult(\n source: CuratedCommunityAppSource,\n app: WorkspaceAppSummary,\n) {\n return {\n mode:\n app.status === \"pending\"\n ? (\"pending\" as const)\n : (\"already-installed\" as const),\n source,\n app: {\n id: app.id,\n name: app.name,\n path: app.path,\n url: app.url,\n status: app.status ?? \"ready\",\n statusLabel: app.statusLabel ?? null,\n builderUrl: app.builderUrl ?? null,\n branchName: app.branchName ?? null,\n },\n };\n}\n\nfunction buildCommunityInstallPrompt(\n source: CuratedCommunityAppSource,\n appId: string,\n): string {\n const sourceUrl = `https://github.com/${source.repo}/tree/${source.ref}/${source.templatePath}`;\n return [\n \"Install a private workspace app from a reviewed community template.\",\n `The attached source files were fetched from ${sourceUrl} and each file was verified against its pinned Git blob id. Treat those files as the source of truth; do not fetch another ref or substitute other content.`,\n `The app will live at apps/${appId}.`,\n `Source license: ${source.license}. Provenance: ${source.provenance}`,\n \"Copy the reviewed template implementation and its Agent-Native profile, changing only app-specific identifiers needed for this workspace. Do not copy repository secrets, credentials, customer data, or source-app records. Use empty or synthetic seed data only and keep the installed app private to this organization.\",\n ].join(\" \");\n}\n\nexport async function installCuratedCommunityApp(input: {\n sourceId: string;\n appId?: string;\n}): Promise<\n | ReturnType<typeof existingInstallResult>\n | (StartWorkspaceAppCreationResult & {\n mode: Exclude<StartWorkspaceAppCreationResult[\"mode\"], \"app-id-taken\">;\n source: CuratedCommunityAppSource;\n })\n | (Extract<StartWorkspaceAppCreationResult, { mode: \"app-id-taken\" }> & {\n source: CuratedCommunityAppSource;\n })\n> {\n await requireCommunityAppsLab();\n const source = requireCommunitySource(input.sourceId);\n const appId = normalizeWorkspaceAppId(input.appId?.trim() || source.appId);\n requireNonShadowingCommunityAppId(appId);\n\n const localRuntime = isLocalAppCreationRuntime();\n if (!(await hasAssociatedWorkspace(localRuntime))) {\n fail(\"Connect this organization to a workspace before installing apps.\", {\n errorCode: \"community_workspace_required\",\n statusCode: 409,\n });\n }\n\n const existing = (\n await listWorkspaceApps({\n includeAgentCards: false,\n includeArchived: true,\n })\n ).find((app) => app.id === appId);\n if (existing) {\n if (existing.communitySourceId === source.id) {\n return existingInstallResult(source, existing);\n }\n rejectCommunityAppIdConflict(appId);\n }\n\n if (!localRuntime) {\n fail(\n \"Community template installs in Builder workspaces are disabled until the generated branch files can be read back and verified.\",\n {\n errorCode: \"community_builder_install_unverified\",\n statusCode: 503,\n },\n );\n }\n\n let attachments: Awaited<\n ReturnType<typeof loadPinnedCommunitySourceAttachments>\n >;\n try {\n attachments = await loadPinnedCommunitySourceAttachments(source, appId);\n } catch (error) {\n fail(\n \"Dispatch could not verify the pinned community template source. Try again later.\",\n {\n errorCode:\n communitySourceFailureKind(error) === \"integrity\"\n ? \"community_source_integrity_failed\"\n : \"community_source_unavailable\",\n statusCode: 503,\n },\n );\n }\n\n const result = await startWorkspaceAppCreation({\n prompt: buildCommunityInstallPrompt(source, appId),\n appId,\n description: source.description,\n template: source.id,\n communitySourceId: source.id,\n attachments,\n });\n\n if (result.mode === \"app-id-taken\") {\n const raced = (\n await listWorkspaceApps({\n includeAgentCards: false,\n includeArchived: true,\n })\n ).find((app) => app.id === appId);\n if (raced?.communitySourceId === source.id) {\n return existingInstallResult(source, raced);\n }\n if (raced) rejectCommunityAppIdConflict(appId);\n return { ...result, source };\n }\n\n await recordAudit({\n action: \"workspace-app.community-install-requested\",\n targetType: \"workspace-app\",\n targetId: appId,\n summary: `Requested ${source.name} community app installation`,\n metadata: {\n sourceId: source.id,\n repo: source.repo,\n ref: source.ref,\n blobShas: source.files.map((file) => file.blobSha),\n license: source.license,\n },\n });\n return { ...result, source } as typeof result & {\n source: CuratedCommunityAppSource;\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"community-apps.js","sourceRoot":"","sources":["../../../src/server/lib/community-apps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EACL,gCAAgC,EAChC,uBAAuB,GACxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,yBAAyB,EACzB,4BAA4B,GAC7B,MAAM,8CAA8C,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAK1D,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAChB,yBAAyB,EACzB,iBAAiB,EACjB,yBAAyB,GAC1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,oCAAoC,GAErC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,WAAW,GACZ,MAAM,qBAAqB,CAAC;AAqB7B,MAAM,CAAC,MAAM,6BAA6B,GACxC;IACE;QACE,EAAE,EAAE,cAAc;QAClB,IAAI,EAAE,IAAI;QACV,WAAW,EAAE,0DAA0D;QACvE,KAAK,EAAE,cAAc;QACrB,IAAI,EAAE,wBAAwB;QAC9B,GAAG,EAAE,MAAM;QACX,OAAO,EAAE,KAAK;QACd,UAAU,EACR,mFAAmF;QACrF,YAAY,EAAE,wBAAwB;QACtC,KAAK,EAAE;YACL;gBACE,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE,0CAA0C;aACpD;YACD;gBACE,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,0CAA0C;aACpD;YACD;gBACE,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE,0CAA0C;aACpD;YACD;gBACE,IAAI,EAAE,kCAAkC;gBACxC,OAAO,EAAE,0CAA0C;aACpD;YACD;gBACE,IAAI,EAAE,6BAA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,6BAA6B;QAC9D,QAAQ,EAAE;YACR,QAAQ,EAAE,MAAM,CAAC,EAAE;YACnB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,GAAG,EAAE,MAAM,CAAC,GAAG;YACf,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC;YAClD,OAAO,EAAE,MAAM,CAAC,OAAO;SACxB;KACF,CAAC,CAAC;IACH,OAAO,EAAE,GAAG,MAAM,EAAE,MAAM,EAEzB,CAAC;AACJ,CAAC","sourcesContent":["import { fail } from \"@agent-native/core/action\";\nimport { getUserLabEnabled } from \"@agent-native/core/labs/server\";\nimport {\n getWorkspaceAppIdValidationError,\n normalizeWorkspaceAppId,\n} from \"@agent-native/core/shared\";\nimport {\n BUILTIN_AGENT_CATALOG_IDS,\n HIDDEN_FIRST_PARTY_AGENT_IDS,\n} from \"@agent-native/core/shared/first-party-agents\";\n\nimport { COMMUNITY_APPS_LAB } from \"../../shared/labs.js\";\nimport type {\n StartWorkspaceAppCreationResult,\n WorkspaceAppSummary,\n} from \"./app-creation-store.js\";\nimport {\n getAppCreationSettings,\n getWorkspaceInfo,\n isLocalAppCreationRuntime,\n listWorkspaceApps,\n startWorkspaceAppCreation,\n} from \"./app-creation-store.js\";\nimport {\n loadPinnedCommunitySourceAttachments,\n type PinnedCommunitySource,\n} from \"./community-source.js\";\nimport { CURATED_WORKSPACE_TEMPLATES } from \"./curated-workspace-templates.js\";\nimport {\n currentOrgId,\n currentOwnerEmail,\n recordAudit,\n} from \"./dispatch-store.js\";\n\nexport interface CuratedCommunityAppSource extends PinnedCommunitySource {\n id: string;\n name: string;\n description: string;\n appId: string;\n license: string;\n provenance: string;\n}\n\nexport interface CuratedCommunityApp extends CuratedCommunityAppSource {\n installed: boolean;\n pending: boolean;\n installable: boolean;\n installUnavailableReason?:\n | \"workspace-required\"\n | \"app-id-conflict\"\n | \"builder-install-unverified\";\n}\n\nexport const CURATED_COMMUNITY_APP_SOURCES: readonly CuratedCommunityAppSource[] =\n [\n {\n id: \"community-qr\",\n name: \"QR\",\n description: \"Generate public PNG or SVG QR images from links or text.\",\n appId: \"community-qr\",\n repo: \"BuilderIO/agent-native\",\n ref: \"main\",\n license: \"MIT\",\n provenance:\n \"Reviewed Agent-Native Framework template, sanitized for independent installation.\",\n templatePath: \"templates/community/qr\",\n files: [\n {\n path: \"AGENTS.md\",\n blobSha: \"7dc9e18bc426dfd21526f91225cc615759450816\",\n },\n {\n path: \"LICENSE\",\n blobSha: \"69c7182efb3eb1a8b7f6fd5989f3e4fd737d0645\",\n },\n {\n path: \"README.md\",\n blobSha: \"e05e72bb9213732f56ccbc96f7dcb1c3a064cb19\",\n },\n {\n path: \"actions/generate-qr-code.spec.ts\",\n blobSha: \"3459217b7252c6ee0076c68cfdb83001cc74f29e\",\n },\n {\n path: \"actions/generate-qr-code.ts\",\n blobSha: \"98d30e218bfed796d5e402d5ce19a8626d8da0cf\",\n },\n {\n path: \"actions/run.ts\",\n blobSha: \"b46ab15b667c34741364ba08f010f7aca9d0f02e\",\n },\n {\n path: \"agent-native.json\",\n blobSha: \"accc32476792b84557f69e2b48b317c27b5546dc\",\n },\n {\n path: \"package.json\",\n blobSha: \"5815e6665e06176df9954183e89b234acf5c5c37\",\n },\n {\n path: \"server/db/index.ts\",\n blobSha: \"17007b456530f75a72e7209bdfe9f4bd4c9224e0\",\n },\n {\n path: \"server/db/schema.ts\",\n blobSha: \"2e4cd01c5f46463e78bc7beb6e954f3e526c0b57\",\n },\n {\n path: \"server/plugins/db.ts\",\n blobSha: \"78a5b431c1ad1ea14f593123c090f5376a36df10\",\n },\n {\n path: \"tsconfig.json\",\n blobSha: \"5267473a32dcab8e5dc2c9d9a720afed7f40174c\",\n },\n ],\n },\n ];\n\nconst communitySourceById = new Map(\n CURATED_COMMUNITY_APP_SOURCES.map((source) => [source.id, source]),\n);\n\nfunction requireCommunitySource(sourceId: string): CuratedCommunityAppSource {\n const source = communitySourceById.get(sourceId.trim());\n if (!source) {\n fail(\"That community app is not in Dispatch's reviewed install catalog.\", {\n errorCode: \"unknown_community_app_source\",\n statusCode: 404,\n });\n }\n return source;\n}\n\nfunction communitySourceFailureKind(\n error: unknown,\n): \"unavailable\" | \"integrity\" {\n if (!(error instanceof Error) || !(\"failureKind\" in error)) {\n return \"unavailable\";\n }\n return error.failureKind === \"integrity\" ? \"integrity\" : \"unavailable\";\n}\n\nfunction requireNonShadowingCommunityAppId(appId: string): void {\n const error = getWorkspaceAppIdValidationError(appId);\n if (error) {\n fail(error, { errorCode: \"invalid_community_app_id\", statusCode: 400 });\n }\n if (\n CURATED_WORKSPACE_TEMPLATES.some((template) => template.id === appId) ||\n BUILTIN_AGENT_CATALOG_IDS.includes(appId) ||\n HIDDEN_FIRST_PARTY_AGENT_IDS.has(appId)\n ) {\n fail(\"Community apps cannot use a first-party template app id.\", {\n errorCode: \"community_app_id_shadows_first_party\",\n statusCode: 409,\n });\n }\n}\n\nasync function requireCommunityAppsLab(): Promise<void> {\n const userEmail = currentOwnerEmail().trim();\n const orgId = currentOrgId();\n if (!userEmail || !orgId) {\n fail(\"Sign in to an organization to browse community apps.\", {\n errorCode: \"community_apps_identity_required\",\n statusCode: 403,\n });\n }\n const enabled = await getUserLabEnabled(userEmail, COMMUNITY_APPS_LAB, {\n orgId,\n });\n if (!enabled) {\n fail(\"Community app catalog and installs are disabled for this account.\", {\n errorCode: \"community_apps_lab_disabled\",\n statusCode: 403,\n });\n }\n}\n\nasync function hasAssociatedWorkspace(\n localRuntime = isLocalAppCreationRuntime(),\n): Promise<boolean> {\n if (localRuntime) return Boolean(getWorkspaceInfo().rootPath);\n return Boolean((await getAppCreationSettings()).builderProjectId);\n}\n\nexport async function listCuratedCommunityApps(): Promise<\n CuratedCommunityApp[]\n> {\n await requireCommunityAppsLab();\n const localRuntime = isLocalAppCreationRuntime();\n const [apps, workspaceAvailable] = await Promise.all([\n listWorkspaceApps({ includeAgentCards: false, includeArchived: true }),\n hasAssociatedWorkspace(localRuntime),\n ]);\n return CURATED_COMMUNITY_APP_SOURCES.map((source) => {\n const appWithId = apps.find((app) => app.id === source.appId);\n const installedApp =\n appWithId?.communitySourceId === source.id ? appWithId : null;\n const idConflict = Boolean(appWithId && !installedApp);\n const pending = installedApp?.status === \"pending\";\n const installUnavailableReason = appWithId\n ? idConflict\n ? \"app-id-conflict\"\n : undefined\n : !workspaceAvailable\n ? \"workspace-required\"\n : !localRuntime\n ? \"builder-install-unverified\"\n : undefined;\n return {\n ...source,\n installed: Boolean(installedApp && !pending),\n pending,\n installable: localRuntime && workspaceAvailable && !appWithId,\n ...(installUnavailableReason ? { installUnavailableReason } : {}),\n };\n });\n}\n\nfunction rejectCommunityAppIdConflict(appId: string): never {\n fail(`Workspace app id \"${appId}\" is already in use.`, {\n errorCode: \"community_app_id_conflict\",\n statusCode: 409,\n });\n}\n\nfunction existingInstallResult(\n source: CuratedCommunityAppSource,\n app: WorkspaceAppSummary,\n) {\n return {\n mode:\n app.status === \"pending\"\n ? (\"pending\" as const)\n : (\"already-installed\" as const),\n source,\n app: {\n id: app.id,\n name: app.name,\n path: app.path,\n url: app.url,\n status: app.status ?? \"ready\",\n statusLabel: app.statusLabel ?? null,\n builderUrl: app.builderUrl ?? null,\n branchName: app.branchName ?? null,\n },\n };\n}\n\nfunction buildCommunityInstallPrompt(\n source: CuratedCommunityAppSource,\n appId: string,\n): string {\n const sourceUrl = `https://github.com/${source.repo}/tree/${source.ref}/${source.templatePath}`;\n return [\n \"Install a private workspace app from a reviewed community template.\",\n `The attached source files were fetched from ${sourceUrl} and each file was verified against its pinned Git blob id. Treat those files as the source of truth; do not fetch another ref or substitute other content.`,\n `The app will live at apps/${appId}.`,\n `Source license: ${source.license}. Provenance: ${source.provenance}`,\n \"Copy the reviewed template implementation and its Agent-Native profile, changing only app-specific identifiers needed for this workspace. Do not copy repository secrets, credentials, customer data, or source-app records. Use empty or synthetic seed data only and keep the installed app private to this organization.\",\n ].join(\" \");\n}\n\nexport async function installCuratedCommunityApp(input: {\n sourceId: string;\n appId?: string;\n}): Promise<\n | ReturnType<typeof existingInstallResult>\n | (StartWorkspaceAppCreationResult & {\n mode: Exclude<StartWorkspaceAppCreationResult[\"mode\"], \"app-id-taken\">;\n source: CuratedCommunityAppSource;\n })\n | (Extract<StartWorkspaceAppCreationResult, { mode: \"app-id-taken\" }> & {\n source: CuratedCommunityAppSource;\n })\n> {\n await requireCommunityAppsLab();\n const source = requireCommunitySource(input.sourceId);\n const appId = normalizeWorkspaceAppId(input.appId?.trim() || source.appId);\n requireNonShadowingCommunityAppId(appId);\n\n const localRuntime = isLocalAppCreationRuntime();\n if (!(await hasAssociatedWorkspace(localRuntime))) {\n fail(\"Connect this organization to a workspace before installing apps.\", {\n errorCode: \"community_workspace_required\",\n statusCode: 409,\n });\n }\n\n const existing = (\n await listWorkspaceApps({\n includeAgentCards: false,\n includeArchived: true,\n })\n ).find((app) => app.id === appId);\n if (existing) {\n if (existing.communitySourceId === source.id) {\n return existingInstallResult(source, existing);\n }\n rejectCommunityAppIdConflict(appId);\n }\n\n if (!localRuntime) {\n fail(\n \"Community template installs in Builder workspaces are disabled until the generated branch files can be read back and verified.\",\n {\n errorCode: \"community_builder_install_unverified\",\n statusCode: 503,\n },\n );\n }\n\n let attachments: Awaited<\n ReturnType<typeof loadPinnedCommunitySourceAttachments>\n >;\n try {\n attachments = await loadPinnedCommunitySourceAttachments(source, appId);\n } catch (error) {\n fail(\n \"Dispatch could not verify the pinned community template source. Try again later.\",\n {\n errorCode:\n communitySourceFailureKind(error) === \"integrity\"\n ? \"community_source_integrity_failed\"\n : \"community_source_unavailable\",\n statusCode: 503,\n },\n );\n }\n\n const result = await startWorkspaceAppCreation({\n prompt: buildCommunityInstallPrompt(source, appId),\n appId,\n description: source.description,\n template: source.id,\n communitySourceId: source.id,\n attachments,\n });\n\n if (result.mode === \"app-id-taken\") {\n const raced = (\n await listWorkspaceApps({\n includeAgentCards: false,\n includeArchived: true,\n })\n ).find((app) => app.id === appId);\n if (raced?.communitySourceId === source.id) {\n return existingInstallResult(source, raced);\n }\n if (raced) rejectCommunityAppIdConflict(appId);\n return { ...result, source };\n }\n\n await recordAudit({\n action: \"workspace-app.community-install-requested\",\n targetType: \"workspace-app\",\n targetId: appId,\n summary: `Requested ${source.name} community app installation`,\n metadata: {\n sourceId: source.id,\n repo: source.repo,\n ref: source.ref,\n blobShas: source.files.map((file) => file.blobSha),\n license: source.license,\n },\n });\n return { ...result, source } as typeof result & {\n source: CuratedCommunityAppSource;\n };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/dispatch",
|
|
3
|
-
"version": "0.40.
|
|
3
|
+
"version": "0.40.39",
|
|
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": {
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"tailwind-merge": "^3.5.0",
|
|
91
91
|
"vaul": "^1.1.2",
|
|
92
92
|
"zod": "^4.3.6",
|
|
93
|
-
"@agent-native/toolkit": "0.
|
|
93
|
+
"@agent-native/toolkit": "0.219.0"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
|
96
96
|
"@react-router/dev": "^8.1.0",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"typescript-7": "npm:typescript@^7.0.2",
|
|
105
105
|
"vite": "8.1.0",
|
|
106
106
|
"vitest": "^4.1.5",
|
|
107
|
-
"@agent-native/core": "0.
|
|
107
|
+
"@agent-native/core": "0.219.0"
|
|
108
108
|
},
|
|
109
109
|
"peerDependencies": {
|
|
110
110
|
"@agent-native/core": ">=0.209.1",
|
|
@@ -95,7 +95,7 @@ export const CURATED_COMMUNITY_APP_SOURCES: readonly CuratedCommunityAppSource[]
|
|
|
95
95
|
},
|
|
96
96
|
{
|
|
97
97
|
path: "package.json",
|
|
98
|
-
blobSha: "
|
|
98
|
+
blobSha: "5815e6665e06176df9954183e89b234acf5c5c37",
|
|
99
99
|
},
|
|
100
100
|
{
|
|
101
101
|
path: "server/db/index.ts",
|