@agent-native/core 0.101.6 → 0.101.10
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/corpus/README.md +1 -1
- package/corpus/core/CHANGELOG.md +28 -0
- package/corpus/core/docs/content/deployment.mdx +9 -7
- package/corpus/core/docs/content/locales/ar-SA/deployment.mdx +9 -7
- package/corpus/core/docs/content/locales/de-DE/deployment.mdx +9 -7
- package/corpus/core/docs/content/locales/es-ES/deployment.mdx +9 -7
- package/corpus/core/docs/content/locales/fr-FR/deployment.mdx +9 -7
- package/corpus/core/docs/content/locales/hi-IN/deployment.mdx +9 -7
- package/corpus/core/docs/content/locales/ja-JP/deployment.mdx +9 -7
- package/corpus/core/docs/content/locales/ko-KR/deployment.mdx +9 -7
- package/corpus/core/docs/content/locales/pt-BR/deployment.mdx +9 -7
- package/corpus/core/docs/content/locales/zh-CN/deployment.mdx +9 -7
- package/corpus/core/docs/content/locales/zh-TW/deployment.mdx +9 -7
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/a2a/artifact-response.ts +255 -12
- package/corpus/core/src/agent/thread-data-builder.ts +84 -11
- package/corpus/core/src/client/review/ReviewCommentComposer.tsx +9 -1
- package/corpus/core/src/client/review/ReviewThreadPanel.tsx +17 -2
- package/corpus/core/src/client/settings/SettingsPanel.tsx +41 -21
- package/corpus/core/src/client/settings/useBuilderStatus.ts +28 -9
- package/corpus/core/src/client/setup-connections/BuilderConnectCard.tsx +2 -7
- package/corpus/core/src/integrations/a2a-continuation-processor.ts +99 -7
- package/corpus/core/src/integrations/adapters/discord.ts +3 -1
- package/corpus/core/src/integrations/adapters/email.ts +4 -1
- package/corpus/core/src/integrations/adapters/google-docs.ts +4 -1
- package/corpus/core/src/integrations/adapters/microsoft-teams.ts +3 -1
- package/corpus/core/src/integrations/adapters/slack.ts +38 -9
- package/corpus/core/src/integrations/adapters/telegram.ts +32 -10
- package/corpus/core/src/integrations/adapters/whatsapp.ts +5 -1
- package/corpus/core/src/integrations/index.ts +1 -0
- package/corpus/core/src/integrations/types.ts +9 -2
- package/corpus/core/src/integrations/webhook-handler.ts +69 -45
- package/corpus/core/src/server/agent-chat/action-filters-a2a.ts +1 -0
- package/corpus/core/src/server/auth.ts +25 -1
- package/corpus/core/src/server/builder-browser.ts +353 -1
- package/corpus/core/src/server/core-routes-plugin.ts +601 -223
- package/corpus/templates/calendar/app/components/calendar/DayView.tsx +80 -1
- package/corpus/templates/calendar/app/components/calendar/EventCard.tsx +28 -3
- package/corpus/templates/calendar/app/components/calendar/EventDetailPanel.tsx +5 -1
- package/corpus/templates/calendar/app/components/calendar/EventDetailPopover.tsx +30 -3
- package/corpus/templates/calendar/app/components/calendar/OutOfOfficeEvent.tsx +196 -0
- package/corpus/templates/calendar/app/components/calendar/WeekView.tsx +115 -1
- package/corpus/templates/calendar/app/lib/out-of-office.ts +45 -0
- package/corpus/templates/calendar/changelog/2026-07-14-out-of-office-blocks-now-sit-behind-meetings-and-event-stack.md +6 -0
- package/corpus/templates/content/.agents/skills/content/SKILL.md +31 -0
- package/corpus/templates/content/.agents/skills/document-editing/SKILL.md +35 -21
- package/corpus/templates/content/AGENTS.md +32 -9
- package/corpus/templates/content/actions/_builder-cms-intent-lookup.ts +87 -0
- package/corpus/templates/content/actions/_builder-cms-read-client.ts +173 -25
- package/corpus/templates/content/actions/_builder-cms-source-adapter.ts +1 -0
- package/corpus/templates/content/actions/_builder-cms-write-adapter.ts +427 -18
- package/corpus/templates/content/actions/_builder-cms-write-client.ts +17 -73
- package/corpus/templates/content/actions/_builder-cms-write-settings.ts +27 -7
- package/corpus/templates/content/actions/_builder-source-execution-claim.ts +124 -0
- package/corpus/templates/content/actions/_builder-source-execution-preservation.ts +21 -0
- package/corpus/templates/content/actions/_builder-source-timings.ts +57 -0
- package/corpus/templates/content/actions/_database-source-utils.ts +1071 -170
- package/corpus/templates/content/actions/_database-utils.ts +104 -13
- package/corpus/templates/content/actions/_local-file-documents.ts +53 -1
- package/corpus/templates/content/actions/_preview-document-draft.ts +31 -0
- package/corpus/templates/content/actions/_property-utils.ts +7 -1
- package/corpus/templates/content/actions/cancel-prepared-builder-source-update.ts +309 -0
- package/corpus/templates/content/actions/configure-document-property.ts +11 -0
- package/corpus/templates/content/actions/create-content-database.ts +11 -0
- package/corpus/templates/content/actions/create-document.ts +9 -0
- package/corpus/templates/content/actions/create-inline-content-database.ts +3 -0
- package/corpus/templates/content/actions/execute-builder-source-batch.ts +120 -49
- package/corpus/templates/content/actions/execute-builder-source-execution.ts +608 -264
- package/corpus/templates/content/actions/export-content-source.ts +1 -0
- package/corpus/templates/content/actions/get-content-database.ts +13 -1
- package/corpus/templates/content/actions/get-document.ts +12 -2
- package/corpus/templates/content/actions/get-preview-document-draft.ts +26 -0
- package/corpus/templates/content/actions/import-content-source.ts +6 -0
- package/corpus/templates/content/actions/list-documents.ts +3 -0
- package/corpus/templates/content/actions/materialize-builder-required-fields.ts +550 -0
- package/corpus/templates/content/actions/prepare-builder-source-execution.ts +112 -65
- package/corpus/templates/content/actions/prepare-builder-source-review.ts +463 -170
- package/corpus/templates/content/actions/preview-builder-source-review.ts +99 -0
- package/corpus/templates/content/actions/pull-document.ts +2 -0
- package/corpus/templates/content/actions/search-documents.ts +5 -1
- package/corpus/templates/content/actions/set-content-database-source-write-mode.ts +2 -2
- package/corpus/templates/content/actions/update-document.ts +16 -1
- package/corpus/templates/content/actions/update-preview-document-draft.ts +153 -0
- package/corpus/templates/content/actions/view-screen.ts +15 -2
- package/corpus/templates/content/app/components/editor/DescriptionField.tsx +121 -0
- package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +14 -0
- package/corpus/templates/content/app/components/editor/DocumentProperties.tsx +250 -49
- package/corpus/templates/content/app/components/editor/VisualEditor.tsx +57 -5
- package/corpus/templates/content/app/components/editor/body-hydration.ts +27 -0
- package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +2414 -589
- package/corpus/templates/content/app/components/editor/database/settings.tsx +13 -10
- package/corpus/templates/content/app/components/editor/database-sources/BuilderSourceReviewDialog.tsx +358 -75
- package/corpus/templates/content/app/components/editor/previewDocumentSaveController.ts +124 -29
- package/corpus/templates/content/app/components/editor/previewDocumentSaveRegistry.ts +2 -0
- package/corpus/templates/content/app/global.css +18 -1
- package/corpus/templates/content/app/hooks/use-content-database.ts +68 -0
- package/corpus/templates/content/app/hooks/use-documents.ts +53 -4
- package/corpus/templates/content/app/i18n/zh-TW.ts +30 -0
- package/corpus/templates/content/app/i18n-data.ts +339 -0
- package/corpus/templates/content/changelog/2026-07-10-builder-backed-preview-edits-are-preserved-when-article-bodi.md +6 -0
- package/corpus/templates/content/changelog/2026-07-10-builder-cms-sources-can-now-be-enabled-for-guarded-staged-or.md +6 -0
- package/corpus/templates/content/changelog/2026-07-13-builder-connection-setup-is-now-available-directly-from-conn.md +6 -0
- package/corpus/templates/content/changelog/2026-07-13-builder-reviews-now-hide-already-applied-writes-detect-nativ.md +6 -0
- package/corpus/templates/content/changelog/2026-07-13-required-builder-publishing-fields-can-now-be-added-directly.md +6 -0
- package/corpus/templates/content/changelog/2026-07-13-you-can-now-cancel-a-prepared-builder-update-safely-before-i.md +6 -0
- package/corpus/templates/content/changelog/2026-07-14-builder-account-connection-now-remains-available-when-branch.md +6 -0
- package/corpus/templates/content/changelog/2026-07-14-builder-backed-articles-now-preserve-fifth-and-sixth-level-h.md +6 -0
- package/corpus/templates/content/changelog/2026-07-14-builder-sources-now-review-and-publish-rich-article-updates-.md +6 -0
- package/corpus/templates/content/changelog/2026-07-14-builder-writes-now-stop-retries-when-reconciliation-is-needed.md +6 -0
- package/corpus/templates/content/changelog/2026-07-14-file-and-media-links-now-validate-before-saving.md +6 -0
- package/corpus/templates/content/changelog/2026-07-14-pages-and-databases-can-describe-themselves-with-guidance-fo.md +6 -0
- package/corpus/templates/content/changelog/2026-07-14-slack-follow-ups-now-retain-created-content-identity-and-per.md +6 -0
- package/corpus/templates/content/parity/matrix.md +27 -25
- package/corpus/templates/content/parity/matrix.ts +50 -2
- package/corpus/templates/content/server/db/schema.ts +51 -0
- package/corpus/templates/content/server/lib/document-context.ts +76 -0
- package/corpus/templates/content/server/lib/public-documents.ts +3 -0
- package/corpus/templates/content/server/plugins/auth.ts +1 -0
- package/corpus/templates/content/server/plugins/db.ts +59 -0
- package/corpus/templates/content/server/routes/api/document-agent-context.json.get.ts +5 -0
- package/corpus/templates/content/shared/api.ts +87 -1
- package/corpus/templates/content/shared/builder-mdx.ts +705 -15
- package/corpus/templates/content/shared/content-source.ts +7 -0
- package/corpus/templates/content/shared/nfm.ts +3 -3
- package/corpus/templates/content/shared/properties.ts +2 -0
- package/corpus/templates/design/app/components/design/ReadOnlyDesignBanner.tsx +52 -7
- package/corpus/templates/design/app/components/design/ReviewCommentsPanel.tsx +36 -4
- package/corpus/templates/design/app/components/visual-editor/ReviewCanvasPins.tsx +4 -1
- package/corpus/templates/design/app/i18n/ar-SA.ts +1 -0
- package/corpus/templates/design/app/i18n/de-DE.ts +1 -0
- package/corpus/templates/design/app/i18n/en-US.ts +1 -0
- package/corpus/templates/design/app/i18n/es-ES.ts +1 -0
- package/corpus/templates/design/app/i18n/fr-FR.ts +1 -0
- package/corpus/templates/design/app/i18n/hi-IN.ts +1 -0
- package/corpus/templates/design/app/i18n/ja-JP.ts +1 -0
- package/corpus/templates/design/app/i18n/ko-KR.ts +1 -0
- package/corpus/templates/design/app/i18n/pt-BR.ts +1 -0
- package/corpus/templates/design/app/i18n/zh-CN.ts +1 -0
- package/corpus/templates/design/app/i18n/zh-TW.ts +1 -0
- package/corpus/templates/design/app/pages/design-editor/selection-state.ts +8 -0
- package/corpus/templates/design/app/pages/design-editor/tool-state.ts +11 -0
- package/corpus/templates/design/changelog/2026-07-14-reviewers-can-now-pin-comments-from-the-canvas-toolbar-targe.md +6 -0
- package/corpus/templates/design/changelog/2026-07-15-viewer-comment-controls-now-sit-inside-the-read-only-notice-.md +6 -0
- package/corpus/templates/design/shared/review-anchor.ts +48 -0
- package/corpus/templates/plan/server/plan-mdx.ts +53 -7
- package/dist/a2a/artifact-response.d.ts +15 -0
- package/dist/a2a/artifact-response.d.ts.map +1 -1
- package/dist/a2a/artifact-response.js +204 -5
- package/dist/a2a/artifact-response.js.map +1 -1
- package/dist/agent/thread-data-builder.d.ts +6 -0
- package/dist/agent/thread-data-builder.d.ts.map +1 -1
- package/dist/agent/thread-data-builder.js +71 -8
- package/dist/agent/thread-data-builder.js.map +1 -1
- package/dist/client/review/ReviewCommentComposer.d.ts +2 -1
- package/dist/client/review/ReviewCommentComposer.d.ts.map +1 -1
- package/dist/client/review/ReviewCommentComposer.js +3 -3
- package/dist/client/review/ReviewCommentComposer.js.map +1 -1
- package/dist/client/review/ReviewThreadPanel.d.ts +9 -1
- package/dist/client/review/ReviewThreadPanel.d.ts.map +1 -1
- package/dist/client/review/ReviewThreadPanel.js +6 -4
- package/dist/client/review/ReviewThreadPanel.js.map +1 -1
- package/dist/client/settings/SettingsPanel.d.ts +3 -0
- package/dist/client/settings/SettingsPanel.d.ts.map +1 -1
- package/dist/client/settings/SettingsPanel.js +11 -4
- package/dist/client/settings/SettingsPanel.js.map +1 -1
- package/dist/client/settings/useBuilderStatus.d.ts +8 -4
- package/dist/client/settings/useBuilderStatus.d.ts.map +1 -1
- package/dist/client/settings/useBuilderStatus.js +19 -6
- package/dist/client/settings/useBuilderStatus.js.map +1 -1
- package/dist/client/setup-connections/BuilderConnectCard.d.ts.map +1 -1
- package/dist/client/setup-connections/BuilderConnectCard.js +2 -5
- package/dist/client/setup-connections/BuilderConnectCard.js.map +1 -1
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/integrations/a2a-continuation-processor.d.ts.map +1 -1
- package/dist/integrations/a2a-continuation-processor.js +72 -6
- package/dist/integrations/a2a-continuation-processor.js.map +1 -1
- package/dist/integrations/adapters/discord.d.ts.map +1 -1
- package/dist/integrations/adapters/discord.js +1 -0
- package/dist/integrations/adapters/discord.js.map +1 -1
- package/dist/integrations/adapters/email.d.ts.map +1 -1
- package/dist/integrations/adapters/email.js +2 -0
- package/dist/integrations/adapters/email.js.map +1 -1
- package/dist/integrations/adapters/google-docs.d.ts.map +1 -1
- package/dist/integrations/adapters/google-docs.js +2 -0
- package/dist/integrations/adapters/google-docs.js.map +1 -1
- package/dist/integrations/adapters/microsoft-teams.d.ts.map +1 -1
- package/dist/integrations/adapters/microsoft-teams.js +1 -0
- package/dist/integrations/adapters/microsoft-teams.js.map +1 -1
- package/dist/integrations/adapters/slack.d.ts.map +1 -1
- package/dist/integrations/adapters/slack.js +21 -6
- package/dist/integrations/adapters/slack.js.map +1 -1
- package/dist/integrations/adapters/telegram.d.ts.map +1 -1
- package/dist/integrations/adapters/telegram.js +11 -2
- package/dist/integrations/adapters/telegram.js.map +1 -1
- package/dist/integrations/adapters/whatsapp.d.ts.map +1 -1
- package/dist/integrations/adapters/whatsapp.js +3 -0
- package/dist/integrations/adapters/whatsapp.js.map +1 -1
- package/dist/integrations/index.d.ts +1 -1
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/index.js.map +1 -1
- package/dist/integrations/types.d.ts +8 -2
- package/dist/integrations/types.d.ts.map +1 -1
- package/dist/integrations/types.js.map +1 -1
- package/dist/integrations/webhook-handler.d.ts.map +1 -1
- package/dist/integrations/webhook-handler.js +40 -43
- package/dist/integrations/webhook-handler.js.map +1 -1
- package/dist/observability/routes.d.ts +5 -5
- package/dist/provider-api/corpus-jobs.d.ts +2 -2
- package/dist/secrets/routes.d.ts +9 -9
- package/dist/server/agent-chat/action-filters-a2a.d.ts.map +1 -1
- package/dist/server/agent-chat/action-filters-a2a.js +1 -0
- package/dist/server/agent-chat/action-filters-a2a.js.map +1 -1
- package/dist/server/auth.d.ts +1 -0
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +19 -2
- package/dist/server/auth.js.map +1 -1
- package/dist/server/builder-browser.d.ts +78 -0
- package/dist/server/builder-browser.d.ts.map +1 -1
- package/dist/server/builder-browser.js +246 -1
- package/dist/server/builder-browser.js.map +1 -1
- package/dist/server/core-routes-plugin.d.ts +41 -0
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +260 -14
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/docs/content/deployment.mdx +9 -7
- package/docs/content/locales/ar-SA/deployment.mdx +9 -7
- package/docs/content/locales/de-DE/deployment.mdx +9 -7
- package/docs/content/locales/es-ES/deployment.mdx +9 -7
- package/docs/content/locales/fr-FR/deployment.mdx +9 -7
- package/docs/content/locales/hi-IN/deployment.mdx +9 -7
- package/docs/content/locales/ja-JP/deployment.mdx +9 -7
- package/docs/content/locales/ko-KR/deployment.mdx +9 -7
- package/docs/content/locales/pt-BR/deployment.mdx +9 -7
- package/docs/content/locales/zh-CN/deployment.mdx +9 -7
- package/docs/content/locales/zh-TW/deployment.mdx +9 -7
- package/package.json +2 -2
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { resolveAccess } from "@agent-native/core/sharing";
|
|
2
|
+
import { and, eq, isNull } from "drizzle-orm";
|
|
3
|
+
|
|
4
|
+
import { getDb, schema } from "../db/index.js";
|
|
5
|
+
|
|
6
|
+
export type DocumentContextPathEntry = {
|
|
7
|
+
id: string;
|
|
8
|
+
kind: "page" | "database";
|
|
9
|
+
title: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/** Focused-read context only: owned descriptions stay on their objects; this
|
|
14
|
+
* assembles the live path without copying ancestor prose into descendants. */
|
|
15
|
+
export async function getDocumentContextPath(
|
|
16
|
+
document: Pick<typeof schema.documents.$inferSelect, "id" | "parentId">,
|
|
17
|
+
): Promise<DocumentContextPathEntry[]> {
|
|
18
|
+
const db = getDb();
|
|
19
|
+
const path: DocumentContextPathEntry[] = [];
|
|
20
|
+
const seen = new Set<string>([document.id]);
|
|
21
|
+
let parentId = document.parentId;
|
|
22
|
+
while (parentId && !seen.has(parentId)) {
|
|
23
|
+
seen.add(parentId);
|
|
24
|
+
const parentAccess = await resolveAccess("document", parentId);
|
|
25
|
+
// A child share must not disclose prose from an inaccessible ancestor.
|
|
26
|
+
if (!parentAccess) break;
|
|
27
|
+
const parent = parentAccess.resource;
|
|
28
|
+
const [database] = await db
|
|
29
|
+
.select()
|
|
30
|
+
.from(schema.contentDatabases)
|
|
31
|
+
.where(
|
|
32
|
+
and(
|
|
33
|
+
eq(schema.contentDatabases.documentId, parent.id),
|
|
34
|
+
isNull(schema.contentDatabases.deletedAt),
|
|
35
|
+
),
|
|
36
|
+
);
|
|
37
|
+
path.unshift({
|
|
38
|
+
id: database?.id ?? parent.id,
|
|
39
|
+
kind: database ? "database" : "page",
|
|
40
|
+
title: database?.title ?? parent.title,
|
|
41
|
+
description: parent.description,
|
|
42
|
+
});
|
|
43
|
+
parentId = parent.parentId;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const [membership] = await db
|
|
47
|
+
.select({ database: schema.contentDatabases })
|
|
48
|
+
.from(schema.contentDatabaseItems)
|
|
49
|
+
.innerJoin(
|
|
50
|
+
schema.contentDatabases,
|
|
51
|
+
eq(schema.contentDatabases.id, schema.contentDatabaseItems.databaseId),
|
|
52
|
+
)
|
|
53
|
+
.where(
|
|
54
|
+
and(
|
|
55
|
+
eq(schema.contentDatabaseItems.documentId, document.id),
|
|
56
|
+
isNull(schema.contentDatabases.deletedAt),
|
|
57
|
+
),
|
|
58
|
+
);
|
|
59
|
+
if (
|
|
60
|
+
membership &&
|
|
61
|
+
!path.some((entry) => entry.id === membership.database.id)
|
|
62
|
+
) {
|
|
63
|
+
const databaseDocumentAccess = await resolveAccess(
|
|
64
|
+
"document",
|
|
65
|
+
membership.database.documentId,
|
|
66
|
+
);
|
|
67
|
+
if (!databaseDocumentAccess) return path;
|
|
68
|
+
path.push({
|
|
69
|
+
id: membership.database.id,
|
|
70
|
+
kind: "database",
|
|
71
|
+
title: membership.database.title,
|
|
72
|
+
description: databaseDocumentAccess.resource.description,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return path;
|
|
76
|
+
}
|
|
@@ -9,6 +9,7 @@ export const PUBLIC_DOCUMENT_CONTEXT_EXCERPT_CHARS = 2_400;
|
|
|
9
9
|
type PublicDocumentPromptInput = {
|
|
10
10
|
id: string;
|
|
11
11
|
title: string;
|
|
12
|
+
description?: string;
|
|
12
13
|
content: string;
|
|
13
14
|
updatedAt: string | Date;
|
|
14
15
|
};
|
|
@@ -44,6 +45,7 @@ ${fullDocumentGuidance}
|
|
|
44
45
|
|
|
45
46
|
Document ID: ${doc.id}
|
|
46
47
|
Title: ${doc.title}
|
|
48
|
+
Description: ${doc.description || "(none)"}
|
|
47
49
|
Updated at: ${doc.updatedAt}
|
|
48
50
|
|
|
49
51
|
Markdown excerpt:
|
|
@@ -92,6 +94,7 @@ async function getPublicDocumentForEvent(event: H3Event) {
|
|
|
92
94
|
.select({
|
|
93
95
|
id: documents.id,
|
|
94
96
|
title: documents.title,
|
|
97
|
+
description: documents.description,
|
|
95
98
|
content: documents.content,
|
|
96
99
|
updatedAt: documents.updatedAt,
|
|
97
100
|
visibility: documents.visibility,
|
|
@@ -635,6 +635,65 @@ const runContentMigrations = runMigrations(
|
|
|
635
635
|
sql: `CREATE INDEX IF NOT EXISTS document_property_values_document_property_idx ON document_property_values (document_id, property_id);
|
|
636
636
|
CREATE INDEX IF NOT EXISTS document_property_values_property_document_idx ON document_property_values (property_id, document_id)`,
|
|
637
637
|
},
|
|
638
|
+
{
|
|
639
|
+
version: 65,
|
|
640
|
+
name: "content-owned-descriptions",
|
|
641
|
+
sql: `ALTER TABLE documents ADD COLUMN IF NOT EXISTS description TEXT NOT NULL DEFAULT '';
|
|
642
|
+
ALTER TABLE document_property_definitions ADD COLUMN IF NOT EXISTS description TEXT NOT NULL DEFAULT ''`,
|
|
643
|
+
},
|
|
644
|
+
{
|
|
645
|
+
version: 66,
|
|
646
|
+
name: "document-preview-drafts-private-cas",
|
|
647
|
+
sql: `CREATE TABLE IF NOT EXISTS document_preview_drafts (
|
|
648
|
+
id TEXT PRIMARY KEY,
|
|
649
|
+
owner_email TEXT NOT NULL,
|
|
650
|
+
org_id TEXT NOT NULL DEFAULT '',
|
|
651
|
+
document_id TEXT NOT NULL,
|
|
652
|
+
title TEXT NOT NULL,
|
|
653
|
+
content TEXT NOT NULL,
|
|
654
|
+
base_document_updated_at TEXT,
|
|
655
|
+
loaded_content_was_empty INTEGER NOT NULL DEFAULT 0,
|
|
656
|
+
deferred_reason TEXT,
|
|
657
|
+
version INTEGER NOT NULL DEFAULT 1,
|
|
658
|
+
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
659
|
+
updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
660
|
+
);
|
|
661
|
+
CREATE UNIQUE INDEX IF NOT EXISTS document_preview_drafts_owner_org_document_unique ON document_preview_drafts (owner_email, org_id, document_id);
|
|
662
|
+
CREATE INDEX IF NOT EXISTS document_preview_drafts_owner_org_document_idx ON document_preview_drafts (owner_email, org_id, document_id)`,
|
|
663
|
+
},
|
|
664
|
+
{
|
|
665
|
+
version: 67,
|
|
666
|
+
name: "builder-source-execution-attempt-token",
|
|
667
|
+
sql: `ALTER TABLE content_database_source_executions ADD COLUMN IF NOT EXISTS attempt_token TEXT`,
|
|
668
|
+
},
|
|
669
|
+
{
|
|
670
|
+
version: 68,
|
|
671
|
+
name: "builder-source-execution-claims",
|
|
672
|
+
// Non-destructive concurrency fence. Existing duplicate execution rows
|
|
673
|
+
// remain intact as ambiguity evidence; the claim chooses one canonical
|
|
674
|
+
// row for every future prepare/execute path.
|
|
675
|
+
sql: `CREATE TABLE IF NOT EXISTS content_database_source_execution_claims (
|
|
676
|
+
id TEXT PRIMARY KEY,
|
|
677
|
+
owner_email TEXT NOT NULL DEFAULT 'local@localhost',
|
|
678
|
+
source_id TEXT NOT NULL,
|
|
679
|
+
idempotency_key TEXT NOT NULL,
|
|
680
|
+
execution_id TEXT NOT NULL,
|
|
681
|
+
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
682
|
+
);
|
|
683
|
+
CREATE UNIQUE INDEX IF NOT EXISTS content_database_source_execution_claims_source_key_unique
|
|
684
|
+
ON content_database_source_execution_claims (source_id, idempotency_key)`,
|
|
685
|
+
},
|
|
686
|
+
{
|
|
687
|
+
version: 69,
|
|
688
|
+
name: "builder-source-execution-claims-owner-scope",
|
|
689
|
+
sql: `ALTER TABLE content_database_source_execution_claims ADD COLUMN IF NOT EXISTS owner_email TEXT NOT NULL DEFAULT 'local@localhost';
|
|
690
|
+
UPDATE content_database_source_execution_claims
|
|
691
|
+
SET owner_email = COALESCE(
|
|
692
|
+
(SELECT owner_email FROM content_database_source_executions
|
|
693
|
+
WHERE content_database_source_executions.id = content_database_source_execution_claims.execution_id),
|
|
694
|
+
owner_email
|
|
695
|
+
)`,
|
|
696
|
+
},
|
|
638
697
|
],
|
|
639
698
|
{ table: "content_migrations" },
|
|
640
699
|
);
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
DOCUMENT_AGENT_RESOURCE_KIND,
|
|
17
17
|
} from "../../../shared/agent-readable.js";
|
|
18
18
|
import { getDb, schema } from "../../db/index.js";
|
|
19
|
+
import { getDocumentContextPath } from "../../lib/document-context.js";
|
|
19
20
|
|
|
20
21
|
function queryString(value: unknown): string {
|
|
21
22
|
if (typeof value === "string") return value;
|
|
@@ -45,7 +46,9 @@ export default defineEventHandler(async (event) => {
|
|
|
45
46
|
const [document] = await db
|
|
46
47
|
.select({
|
|
47
48
|
id: schema.documents.id,
|
|
49
|
+
parentId: schema.documents.parentId,
|
|
48
50
|
title: schema.documents.title,
|
|
51
|
+
description: schema.documents.description,
|
|
49
52
|
content: schema.documents.content,
|
|
50
53
|
icon: schema.documents.icon,
|
|
51
54
|
visibility: schema.documents.visibility,
|
|
@@ -77,11 +80,13 @@ export default defineEventHandler(async (event) => {
|
|
|
77
80
|
resourceType: "document",
|
|
78
81
|
id: document.id,
|
|
79
82
|
title: document.title,
|
|
83
|
+
description: document.description,
|
|
80
84
|
icon: document.icon,
|
|
81
85
|
content: document.content,
|
|
82
86
|
visibility: document.visibility,
|
|
83
87
|
createdAt: document.createdAt,
|
|
84
88
|
updatedAt: document.updatedAt,
|
|
89
|
+
contextPath: await getDocumentContextPath(document),
|
|
85
90
|
url: buildContentPublicDocumentUrl(document.id, {
|
|
86
91
|
basePath: getConfiguredAppBasePath(),
|
|
87
92
|
token: tokenAccess ? token : null,
|
|
@@ -8,11 +8,19 @@ import type {
|
|
|
8
8
|
|
|
9
9
|
export type DocumentAccessRole = "owner" | "viewer" | "editor" | "admin";
|
|
10
10
|
|
|
11
|
+
export interface ContentContextPathEntry {
|
|
12
|
+
id: string;
|
|
13
|
+
kind: "page" | "database";
|
|
14
|
+
title: string;
|
|
15
|
+
description: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
11
18
|
export interface Document {
|
|
12
19
|
id: string;
|
|
13
20
|
parentId: string | null;
|
|
14
21
|
title: string;
|
|
15
22
|
content: string;
|
|
23
|
+
description?: string;
|
|
16
24
|
icon: string | null;
|
|
17
25
|
position: number;
|
|
18
26
|
isFavorite: boolean;
|
|
@@ -27,6 +35,7 @@ export interface Document {
|
|
|
27
35
|
properties?: DocumentProperty[];
|
|
28
36
|
database?: ContentDatabase;
|
|
29
37
|
databaseMembership?: ContentDatabaseMembership;
|
|
38
|
+
contextPath?: ContentContextPathEntry[];
|
|
30
39
|
createdAt: string;
|
|
31
40
|
updatedAt: string;
|
|
32
41
|
}
|
|
@@ -90,12 +99,14 @@ export interface DocumentCreateRequest {
|
|
|
90
99
|
title?: string;
|
|
91
100
|
parentId?: string | null;
|
|
92
101
|
content?: string;
|
|
102
|
+
description?: string;
|
|
93
103
|
icon?: string;
|
|
94
104
|
}
|
|
95
105
|
|
|
96
106
|
export interface DocumentUpdateRequest {
|
|
97
107
|
title?: string;
|
|
98
108
|
content?: string;
|
|
109
|
+
description?: string;
|
|
99
110
|
icon?: string | null;
|
|
100
111
|
isFavorite?: boolean;
|
|
101
112
|
loadedUpdatedAt?: string;
|
|
@@ -158,6 +169,7 @@ export interface DocumentPropertyDefinition {
|
|
|
158
169
|
databaseId: string | null;
|
|
159
170
|
name: string;
|
|
160
171
|
type: DocumentPropertyType;
|
|
172
|
+
description?: string;
|
|
161
173
|
visibility: DocumentPropertyVisibility;
|
|
162
174
|
options: DocumentPropertyOptions;
|
|
163
175
|
position: number;
|
|
@@ -182,6 +194,7 @@ export interface ConfigureDocumentPropertyRequest {
|
|
|
182
194
|
documentId: string;
|
|
183
195
|
name: string;
|
|
184
196
|
type: DocumentPropertyType;
|
|
197
|
+
description?: string;
|
|
185
198
|
visibility?: DocumentPropertyVisibility;
|
|
186
199
|
options?: DocumentPropertyOptions;
|
|
187
200
|
}
|
|
@@ -213,6 +226,7 @@ export interface ContentDatabase {
|
|
|
213
226
|
id: string;
|
|
214
227
|
documentId: string;
|
|
215
228
|
title: string;
|
|
229
|
+
description?: string;
|
|
216
230
|
viewConfig: ContentDatabaseViewConfig;
|
|
217
231
|
createdAt: string;
|
|
218
232
|
updatedAt: string;
|
|
@@ -352,6 +366,7 @@ export type ContentDatabaseBodyHydrationState =
|
|
|
352
366
|
| "pending"
|
|
353
367
|
| "hydrating"
|
|
354
368
|
| "hydrated"
|
|
369
|
+
| "unavailable"
|
|
355
370
|
| "error";
|
|
356
371
|
|
|
357
372
|
export interface ContentDatabaseBodyHydration {
|
|
@@ -365,6 +380,7 @@ export interface ContentDatabaseBodyHydrationSummary {
|
|
|
365
380
|
pending: number;
|
|
366
381
|
hydrating: number;
|
|
367
382
|
hydrated: number;
|
|
383
|
+
unavailable?: number;
|
|
368
384
|
error: number;
|
|
369
385
|
total: number;
|
|
370
386
|
}
|
|
@@ -438,6 +454,8 @@ export type ContentDatabaseSourceExecutionState =
|
|
|
438
454
|
| "write_disabled"
|
|
439
455
|
| "blocked"
|
|
440
456
|
| "running"
|
|
457
|
+
| "response_received"
|
|
458
|
+
| "reconciliation_required"
|
|
441
459
|
| "succeeded"
|
|
442
460
|
| "failed";
|
|
443
461
|
|
|
@@ -493,6 +511,8 @@ export interface ContentDatabaseSourceFieldChange {
|
|
|
493
511
|
sourceFieldKey: string;
|
|
494
512
|
currentValue: DocumentPropertyValue;
|
|
495
513
|
proposedValue: DocumentPropertyValue;
|
|
514
|
+
/** Exact provider-native JSON value; review continues to show proposedValue. */
|
|
515
|
+
builderValueJson?: string;
|
|
496
516
|
}
|
|
497
517
|
|
|
498
518
|
export interface ContentDatabaseSourceBodyChange {
|
|
@@ -633,6 +653,7 @@ export interface ContentDatabaseSource {
|
|
|
633
653
|
allowDraftWrites?: boolean;
|
|
634
654
|
allowPublishWrites?: boolean;
|
|
635
655
|
allowedWriteModes?: ContentDatabaseSourcePushMode[];
|
|
656
|
+
builderModelFields?: BuilderCmsModelFieldSummary[];
|
|
636
657
|
federation?: ContentDatabaseSourceFederation;
|
|
637
658
|
};
|
|
638
659
|
fields: ContentDatabaseSourceFieldMapping[];
|
|
@@ -653,6 +674,7 @@ export interface BuilderCmsModelFieldSummary {
|
|
|
653
674
|
label?: string;
|
|
654
675
|
type: string;
|
|
655
676
|
inputType?: string;
|
|
677
|
+
model?: string;
|
|
656
678
|
enum?: string[];
|
|
657
679
|
options?: string[];
|
|
658
680
|
required: boolean;
|
|
@@ -692,6 +714,7 @@ export interface ContentDatabaseResponse {
|
|
|
692
714
|
properties: DocumentProperty[];
|
|
693
715
|
items: ContentDatabaseItem[];
|
|
694
716
|
source: ContentDatabaseSource | null;
|
|
717
|
+
contextPath?: ContentContextPathEntry[];
|
|
695
718
|
// All attached sources (NEXT). `source` stays as `sources[0] ?? null` for
|
|
696
719
|
// back-compat; multi-source consumers read `sources`.
|
|
697
720
|
sources?: ContentDatabaseSource[];
|
|
@@ -710,6 +733,12 @@ export interface ContentDatabaseResponse {
|
|
|
710
733
|
duplicatedDocumentIds?: string[];
|
|
711
734
|
deletedItemIds?: string[];
|
|
712
735
|
deletedDocumentIds?: string[];
|
|
736
|
+
timings?: BuilderActionTiming[];
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
export interface BuilderActionTiming {
|
|
740
|
+
name: string;
|
|
741
|
+
durationMs: number;
|
|
713
742
|
}
|
|
714
743
|
|
|
715
744
|
export interface ContentDatabaseUnavailableResponse {
|
|
@@ -737,11 +766,13 @@ export interface CreateDatabaseRequest {
|
|
|
737
766
|
documentId?: string;
|
|
738
767
|
parentId?: string | null;
|
|
739
768
|
title?: string;
|
|
769
|
+
description?: string;
|
|
740
770
|
}
|
|
741
771
|
|
|
742
772
|
export interface CreateInlineDatabaseRequest {
|
|
743
773
|
hostDocumentId: string;
|
|
744
774
|
title?: string;
|
|
775
|
+
description?: string;
|
|
745
776
|
}
|
|
746
777
|
|
|
747
778
|
export interface CreateInlineDatabaseResponse {
|
|
@@ -941,6 +972,25 @@ export interface PrepareBuilderSourceExecutionRequest {
|
|
|
941
972
|
confirmUnpublish?: boolean;
|
|
942
973
|
}
|
|
943
974
|
|
|
975
|
+
export interface CancelPreparedBuilderSourceUpdateRequest {
|
|
976
|
+
databaseId?: string;
|
|
977
|
+
documentId?: string;
|
|
978
|
+
sourceId: string;
|
|
979
|
+
changeSetId: string;
|
|
980
|
+
note?: string;
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
export interface CancelPreparedBuilderSourceUpdateResponse extends ContentDatabaseResponse {
|
|
984
|
+
cancellation: {
|
|
985
|
+
sourceId: string;
|
|
986
|
+
changeSetId: string;
|
|
987
|
+
executionIds: string[];
|
|
988
|
+
status: "cancelled" | "already_cancelled";
|
|
989
|
+
cancelledAt: string;
|
|
990
|
+
cancelledBy: string;
|
|
991
|
+
};
|
|
992
|
+
}
|
|
993
|
+
|
|
944
994
|
export interface ValidateBuilderSourceExecutionRequest {
|
|
945
995
|
databaseId?: string;
|
|
946
996
|
documentId?: string;
|
|
@@ -971,6 +1021,7 @@ export interface PrepareBuilderSourceReviewRequest {
|
|
|
971
1021
|
pushModeConfirmation?: ContentDatabaseSourcePushMode;
|
|
972
1022
|
publicationTransition?: BuilderCmsPublicationTransitionIntent;
|
|
973
1023
|
confirmUnpublish?: boolean;
|
|
1024
|
+
transitions?: Record<string, ExecuteBuilderSourceBatchTransition>;
|
|
974
1025
|
}
|
|
975
1026
|
|
|
976
1027
|
export interface ExecuteBuilderSourceBatchTransition {
|
|
@@ -987,12 +1038,17 @@ export interface ExecuteBuilderSourceBatchRequest {
|
|
|
987
1038
|
transitions?: Record<string, ExecuteBuilderSourceBatchTransition>;
|
|
988
1039
|
}
|
|
989
1040
|
|
|
990
|
-
export type BuilderSourceBatchItemStatus =
|
|
1041
|
+
export type BuilderSourceBatchItemStatus =
|
|
1042
|
+
| "succeeded"
|
|
1043
|
+
| "blocked"
|
|
1044
|
+
| "reconciliation_required"
|
|
1045
|
+
| "failed";
|
|
991
1046
|
|
|
992
1047
|
export interface BuilderSourceBatchItemResult {
|
|
993
1048
|
changeSetId: string;
|
|
994
1049
|
status: BuilderSourceBatchItemStatus;
|
|
995
1050
|
message?: string;
|
|
1051
|
+
timings?: BuilderActionTiming[];
|
|
996
1052
|
}
|
|
997
1053
|
|
|
998
1054
|
export interface ExecuteBuilderSourceBatchResponse {
|
|
@@ -1000,9 +1056,11 @@ export interface ExecuteBuilderSourceBatchResponse {
|
|
|
1000
1056
|
total: number;
|
|
1001
1057
|
succeeded: number;
|
|
1002
1058
|
blocked: number;
|
|
1059
|
+
reconciliationRequired: number;
|
|
1003
1060
|
failed: number;
|
|
1004
1061
|
};
|
|
1005
1062
|
results: BuilderSourceBatchItemResult[];
|
|
1063
|
+
timings?: BuilderActionTiming[];
|
|
1006
1064
|
}
|
|
1007
1065
|
|
|
1008
1066
|
export interface SetContentDatabaseSourceWriteModeRequest {
|
|
@@ -1083,6 +1141,8 @@ export interface ContentDatabaseSourceReviewRowSummary {
|
|
|
1083
1141
|
databaseItemId: string | null;
|
|
1084
1142
|
documentId: string | null;
|
|
1085
1143
|
title: string;
|
|
1144
|
+
/** Existing Builder entry targeted by this write; null for new drafts. */
|
|
1145
|
+
targetEntryId?: string | null;
|
|
1086
1146
|
fieldChanges: ContentDatabaseSourceFieldChange[];
|
|
1087
1147
|
bodyChange: ContentDatabaseSourceBodyChange | null;
|
|
1088
1148
|
riskLevel: ContentDatabaseSourceRiskLevel;
|
|
@@ -1112,18 +1172,44 @@ export interface ContentDatabaseSourceReviewPayload {
|
|
|
1112
1172
|
| "stale"
|
|
1113
1173
|
| "write_disabled"
|
|
1114
1174
|
| "running"
|
|
1175
|
+
| "reconciliation_required"
|
|
1115
1176
|
| "succeeded"
|
|
1116
1177
|
| "failed";
|
|
1117
1178
|
message: string;
|
|
1118
1179
|
};
|
|
1119
1180
|
}
|
|
1120
1181
|
|
|
1182
|
+
export interface PreviewBuilderSourceReviewRequest {
|
|
1183
|
+
databaseId?: string;
|
|
1184
|
+
documentId?: string;
|
|
1185
|
+
sourceId?: string;
|
|
1186
|
+
scope?: "selected" | "all";
|
|
1187
|
+
documentIds?: string[];
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
export interface PreviewBuilderSourceReviewResponse {
|
|
1191
|
+
sourceId: string;
|
|
1192
|
+
sourceTable: string;
|
|
1193
|
+
changeSetIds: string[];
|
|
1194
|
+
review: ContentDatabaseSourceReviewPayload | null;
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1121
1197
|
export interface PrepareBuilderSourceReviewResponse {
|
|
1122
1198
|
database: ContentDatabase;
|
|
1123
1199
|
properties: DocumentProperty[];
|
|
1124
1200
|
items: ContentDatabaseItem[];
|
|
1125
1201
|
source: ContentDatabaseSource | null;
|
|
1126
1202
|
review: ContentDatabaseSourceReviewPayload;
|
|
1203
|
+
/**
|
|
1204
|
+
* Maps the operator-selected diff identities to the immutable change-set
|
|
1205
|
+
* identities prepared for execution. These differ when a cancelled or
|
|
1206
|
+
* otherwise closed synthetic diff is reviewed again as a new revision.
|
|
1207
|
+
*/
|
|
1208
|
+
preparedChangeSetMappings: Array<{
|
|
1209
|
+
requestedChangeSetId: string;
|
|
1210
|
+
preparedChangeSetId: string;
|
|
1211
|
+
}>;
|
|
1212
|
+
timings?: BuilderActionTiming[];
|
|
1127
1213
|
}
|
|
1128
1214
|
|
|
1129
1215
|
export interface ProcessBuilderBodyHydrationRequest {
|