@contractspec/bundle.library 3.10.0 → 3.10.2
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/.turbo/turbo-build.log +212 -206
- package/CHANGELOG.md +43 -0
- package/dist/components/docs/DocsIndexPage.js +2 -2
- package/dist/components/docs/docsManifest.js +1 -1
- package/dist/components/docs/guides/GuideProviderBackedKnowledgePage.d.ts +1 -0
- package/dist/components/docs/guides/GuideProviderBackedKnowledgePage.js +73 -0
- package/dist/components/docs/guides/GuidesIndexPage.js +1 -1
- package/dist/components/docs/guides/guides.docblocks.js +10 -1
- package/dist/components/docs/guides/index.d.ts +1 -0
- package/dist/components/docs/guides/index.js +132 -52
- package/dist/components/docs/index.js +414 -284
- package/dist/components/docs/integrations/IntegrationsGmailPage.js +3 -3
- package/dist/components/docs/integrations/IntegrationsGoogleCalendarPage.js +1 -1
- package/dist/components/docs/integrations/IntegrationsGoogleDrivePage.d.ts +1 -0
- package/dist/components/docs/integrations/IntegrationsGoogleDrivePage.js +22 -0
- package/dist/components/docs/integrations/IntegrationsOverviewPage.js +1 -1
- package/dist/components/docs/integrations/index.d.ts +1 -0
- package/dist/components/docs/integrations/index.js +65 -45
- package/dist/components/docs/knowledge/KnowledgeGovernancePage.d.ts +1 -0
- package/dist/components/docs/knowledge/KnowledgeGovernancePage.js +23 -0
- package/dist/components/docs/knowledge/KnowledgeOverviewPage.js +1 -1
- package/dist/components/docs/knowledge/KnowledgeSourcesPage.js +11 -2
- package/dist/components/docs/knowledge/index.d.ts +1 -0
- package/dist/components/docs/knowledge/index.js +49 -19
- package/dist/index.js +430 -300
- package/dist/node/components/docs/DocsIndexPage.js +2 -2
- package/dist/node/components/docs/docsManifest.js +1 -1
- package/dist/node/components/docs/guides/GuideProviderBackedKnowledgePage.js +72 -0
- package/dist/node/components/docs/guides/GuidesIndexPage.js +1 -1
- package/dist/node/components/docs/guides/guides.docblocks.js +10 -1
- package/dist/node/components/docs/guides/index.js +132 -52
- package/dist/node/components/docs/index.js +414 -284
- package/dist/node/components/docs/integrations/IntegrationsGmailPage.js +3 -3
- package/dist/node/components/docs/integrations/IntegrationsGoogleCalendarPage.js +1 -1
- package/dist/node/components/docs/integrations/IntegrationsGoogleDrivePage.js +21 -0
- package/dist/node/components/docs/integrations/IntegrationsOverviewPage.js +1 -1
- package/dist/node/components/docs/integrations/index.js +65 -45
- package/dist/node/components/docs/knowledge/KnowledgeGovernancePage.js +22 -0
- package/dist/node/components/docs/knowledge/KnowledgeOverviewPage.js +1 -1
- package/dist/node/components/docs/knowledge/KnowledgeSourcesPage.js +11 -2
- package/dist/node/components/docs/knowledge/index.js +49 -19
- package/dist/node/index.js +430 -300
- package/package.json +59 -23
- package/src/components/docs/docsManifest.ts +62 -0
- package/src/components/docs/generated/docs-index._common.json +32 -0
- package/src/components/docs/generated/docs-index.manifest.json +2 -2
- package/src/components/docs/generated/docs-index.notifications.json +7 -7
- package/src/components/docs/guides/GuideProviderBackedKnowledgePage.tsx +191 -0
- package/src/components/docs/guides/GuidesIndexPage.tsx +7 -0
- package/src/components/docs/guides/guides.docblocks.ts +20 -0
- package/src/components/docs/guides/index.ts +1 -0
- package/src/components/docs/integrations/IntegrationsGmailPage.tsx +23 -2
- package/src/components/docs/integrations/IntegrationsGoogleCalendarPage.tsx +2 -2
- package/src/components/docs/integrations/IntegrationsGoogleDrivePage.tsx +88 -0
- package/src/components/docs/integrations/IntegrationsOverviewPage.tsx +1 -0
- package/src/components/docs/integrations/index.ts +1 -0
- package/src/components/docs/knowledge/KnowledgeGovernancePage.tsx +94 -0
- package/src/components/docs/knowledge/KnowledgeOverviewPage.tsx +10 -0
- package/src/components/docs/knowledge/KnowledgeSourcesPage.tsx +45 -0
- package/src/components/docs/knowledge/index.ts +1 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { CodeBlock } from '@contractspec/lib.design-system';
|
|
2
|
+
import Link from '@contractspec/lib.ui-link';
|
|
3
|
+
import { ChevronRight } from 'lucide-react';
|
|
4
|
+
|
|
5
|
+
export function IntegrationsGoogleDrivePage() {
|
|
6
|
+
return (
|
|
7
|
+
<div className="space-y-8">
|
|
8
|
+
<div className="space-y-4">
|
|
9
|
+
<h1 className="font-bold text-4xl">Google Drive</h1>
|
|
10
|
+
<p className="text-muted-foreground">
|
|
11
|
+
Google Drive is modeled as a storage and knowledge-ingestion provider
|
|
12
|
+
with explicit delta watch state. The contract covers file listing,
|
|
13
|
+
file retrieval, Drive watches, channel/resource expiry, replay
|
|
14
|
+
checkpoints, dedupe, idempotency, and tombstones.
|
|
15
|
+
</p>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<div className="space-y-4">
|
|
19
|
+
<h2 className="font-bold text-2xl">Provider contract</h2>
|
|
20
|
+
<CodeBlock
|
|
21
|
+
language="typescript"
|
|
22
|
+
filename="google-drive-provider.ts"
|
|
23
|
+
code={`interface GoogleDriveProvider {
|
|
24
|
+
listFiles(query?: GoogleDriveListFilesQuery): Promise<GoogleDriveListFilesResult>;
|
|
25
|
+
getFile(fileId: string): Promise<GoogleDriveFile | null>;
|
|
26
|
+
watchChanges?(input: GoogleDriveWatchInput): Promise<GoogleDriveWatchResult>;
|
|
27
|
+
}`}
|
|
28
|
+
/>
|
|
29
|
+
<p className="text-muted-foreground text-sm">
|
|
30
|
+
The provider advertises <code>storage.objects</code>,{' '}
|
|
31
|
+
<code>knowledge.ingestion.drive</code>, and{' '}
|
|
32
|
+
<code>provider.delta.watch</code>. Runtime implementations should
|
|
33
|
+
persist returned deltas before acknowledging sync work.
|
|
34
|
+
</p>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
<div className="space-y-4">
|
|
38
|
+
<h2 className="font-bold text-2xl">Delta-aware ingestion</h2>
|
|
39
|
+
<CodeBlock
|
|
40
|
+
language="typescript"
|
|
41
|
+
filename="drive-sync.ts"
|
|
42
|
+
code={`await knowledge.syncDriveFiles(
|
|
43
|
+
{
|
|
44
|
+
query: "mimeType = 'text/plain' and trashed = false",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
sourceId: "src_drive_support",
|
|
48
|
+
evidenceRef: "audit://sync/drive/support",
|
|
49
|
+
},
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
await knowledge.watchDriveChanges(
|
|
53
|
+
{
|
|
54
|
+
channelId: "drive-support-watch",
|
|
55
|
+
webhookUrl: "https://app.example.com/webhooks/google-drive",
|
|
56
|
+
},
|
|
57
|
+
{ sourceId: "src_drive_support" },
|
|
58
|
+
);`}
|
|
59
|
+
/>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<div className="space-y-4">
|
|
63
|
+
<h2 className="font-bold text-2xl">Production checklist</h2>
|
|
64
|
+
<ul className="list-inside list-disc space-y-2 text-muted-foreground">
|
|
65
|
+
<li>Persist `ProviderDeltaSyncState` per Drive source.</li>
|
|
66
|
+
<li>Renew webhook channels before `webhookChannel.expiresAt`.</li>
|
|
67
|
+
<li>Skip tombstoned files before indexing or mutating them.</li>
|
|
68
|
+
<li>
|
|
69
|
+
Record replay checkpoint and idempotency evidence for retries.
|
|
70
|
+
</li>
|
|
71
|
+
<li>
|
|
72
|
+
Use mutation governance before changing permissions or sending
|
|
73
|
+
outbound notifications.
|
|
74
|
+
</li>
|
|
75
|
+
</ul>
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
<div className="flex items-center gap-4 pt-4">
|
|
79
|
+
<Link href="/docs/integrations/gmail" className="btn-ghost">
|
|
80
|
+
Previous: Gmail API
|
|
81
|
+
</Link>
|
|
82
|
+
<Link href="/docs/knowledge/governance" className="btn-primary">
|
|
83
|
+
Knowledge governance <ChevronRight size={16} />
|
|
84
|
+
</Link>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
@@ -24,6 +24,7 @@ const groups = [
|
|
|
24
24
|
{ title: 'Qdrant', href: '/docs/integrations/qdrant' },
|
|
25
25
|
{ title: 'S3 storage', href: '/docs/integrations/s3' },
|
|
26
26
|
{ title: 'Gmail', href: '/docs/integrations/gmail' },
|
|
27
|
+
{ title: 'Google Drive', href: '/docs/integrations/google-drive' },
|
|
27
28
|
{ title: 'Google Calendar', href: '/docs/integrations/google-calendar' },
|
|
28
29
|
],
|
|
29
30
|
},
|
|
@@ -3,6 +3,7 @@ export { IntegrationsElevenLabsPage } from './IntegrationsElevenLabsPage';
|
|
|
3
3
|
export { IntegrationsGithubPage } from './IntegrationsGithubPage';
|
|
4
4
|
export { IntegrationsGmailPage } from './IntegrationsGmailPage';
|
|
5
5
|
export { IntegrationsGoogleCalendarPage } from './IntegrationsGoogleCalendarPage';
|
|
6
|
+
export { IntegrationsGoogleDrivePage } from './IntegrationsGoogleDrivePage';
|
|
6
7
|
export { IntegrationsHealthRoutingPage } from './IntegrationsHealthRoutingPage';
|
|
7
8
|
export { IntegrationsMistralPage } from './IntegrationsMistralPage';
|
|
8
9
|
export { IntegrationsOpenAIPage } from './IntegrationsOpenAIPage';
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { CodeBlock } from '@contractspec/lib.design-system';
|
|
2
|
+
import Link from '@contractspec/lib.ui-link';
|
|
3
|
+
import { ChevronRight } from 'lucide-react';
|
|
4
|
+
|
|
5
|
+
export function KnowledgeGovernancePage() {
|
|
6
|
+
return (
|
|
7
|
+
<div className="space-y-8">
|
|
8
|
+
<div className="space-y-4">
|
|
9
|
+
<h1 className="font-bold text-4xl">Knowledge mutation governance</h1>
|
|
10
|
+
<p className="text-muted-foreground">
|
|
11
|
+
Provider-backed knowledge is not read-only forever. Email sends, Drive
|
|
12
|
+
permission changes, tombstone handling, replay repairs, and source
|
|
13
|
+
metadata updates all need explicit governance before they mutate an
|
|
14
|
+
external system.
|
|
15
|
+
</p>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<div className="grid gap-4 md:grid-cols-2">
|
|
19
|
+
<div className="card-subtle space-y-2 p-4">
|
|
20
|
+
<h2 className="font-semibold text-lg">Fail closed</h2>
|
|
21
|
+
<p className="text-muted-foreground text-sm">
|
|
22
|
+
Non-dry-run mutations require an idempotency key and audit evidence.
|
|
23
|
+
Approval-required operations need approval refs. Outbound sends also
|
|
24
|
+
need an approved send gate.
|
|
25
|
+
</p>
|
|
26
|
+
</div>
|
|
27
|
+
<div className="card-subtle space-y-2 p-4">
|
|
28
|
+
<h2 className="font-semibold text-lg">Leave evidence</h2>
|
|
29
|
+
<p className="text-muted-foreground text-sm">
|
|
30
|
+
Every evaluation returns an audit envelope with status, missing
|
|
31
|
+
evidence, idempotency, approval refs, and the decision timestamp.
|
|
32
|
+
</p>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<div className="space-y-4">
|
|
37
|
+
<h2 className="font-bold text-2xl">Runtime gate</h2>
|
|
38
|
+
<CodeBlock
|
|
39
|
+
language="typescript"
|
|
40
|
+
filename="knowledge-governance.ts"
|
|
41
|
+
code={`const result = await executeGovernedKnowledgeMutation(
|
|
42
|
+
{
|
|
43
|
+
operation: "drive.permission.update",
|
|
44
|
+
sourceId: "src_drive_support",
|
|
45
|
+
requiresApproval: true,
|
|
46
|
+
governance: {
|
|
47
|
+
idempotencyKey: "tenant:drive-permission:123",
|
|
48
|
+
auditEvidence: { evidenceRef: "audit://drive/permission/123" },
|
|
49
|
+
approvalRefs: [{ id: "approval-123" }],
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
() => drive.updatePermission(input),
|
|
53
|
+
{ audit: (envelope) => auditTrail.write(envelope) },
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
if (result.status === "blocked") {
|
|
57
|
+
return result.auditEnvelope.requiredEvidence;
|
|
58
|
+
}`}
|
|
59
|
+
/>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<div className="space-y-4">
|
|
63
|
+
<h2 className="font-bold text-2xl">ContractSpec surface</h2>
|
|
64
|
+
<p className="text-muted-foreground">
|
|
65
|
+
Use <code>knowledge.mutation.evaluateGovernance</code> when an app or
|
|
66
|
+
control-plane workflow needs to expose mutation decisions as a
|
|
67
|
+
contracted action. It mirrors the runtime helper and gives Connect,
|
|
68
|
+
ops tools, and review packets one stable contract to reference.
|
|
69
|
+
</p>
|
|
70
|
+
<CodeBlock
|
|
71
|
+
language="typescript"
|
|
72
|
+
filename="knowledge-operation.ts"
|
|
73
|
+
code={`import {
|
|
74
|
+
EvaluateKnowledgeMutationGovernance,
|
|
75
|
+
} from "@contractspec/lib.contracts-spec/knowledge/operations";
|
|
76
|
+
|
|
77
|
+
registry.register(EvaluateKnowledgeMutationGovernance);`}
|
|
78
|
+
/>
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
<div className="flex items-center gap-4 pt-4">
|
|
82
|
+
<Link href="/docs/knowledge/sources" className="btn-ghost">
|
|
83
|
+
Knowledge sources
|
|
84
|
+
</Link>
|
|
85
|
+
<Link
|
|
86
|
+
href="/docs/guides/provider-backed-knowledge"
|
|
87
|
+
className="btn-primary"
|
|
88
|
+
>
|
|
89
|
+
Adoption guide <ChevronRight size={16} />
|
|
90
|
+
</Link>
|
|
91
|
+
</div>
|
|
92
|
+
</div>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
@@ -16,6 +16,16 @@ const knowledgeTracks = [
|
|
|
16
16
|
body: 'Connect tenant-owned sources explicitly instead of letting context leak in through prompts alone.',
|
|
17
17
|
href: '/docs/knowledge/sources',
|
|
18
18
|
},
|
|
19
|
+
{
|
|
20
|
+
title: 'Governance',
|
|
21
|
+
body: 'Gate provider-backed mutations with dry-runs, approvals, idempotency, audit evidence, and outbound-send policy.',
|
|
22
|
+
href: '/docs/knowledge/governance',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
title: 'Provider-backed adoption',
|
|
26
|
+
body: 'Wire Gmail and Google Drive ingestion through checkpointed deltas, tombstones, watches, and Connect evidence.',
|
|
27
|
+
href: '/docs/guides/provider-backed-knowledge',
|
|
28
|
+
},
|
|
19
29
|
{
|
|
20
30
|
title: 'Examples',
|
|
21
31
|
body: 'See how support, compliance, and product systems consume trusted knowledge at runtime.',
|
|
@@ -230,6 +230,43 @@ export function KnowledgeSourcesPage() {
|
|
|
230
230
|
</ol>
|
|
231
231
|
</div>
|
|
232
232
|
|
|
233
|
+
<div className="space-y-4">
|
|
234
|
+
<h2 className="font-bold text-2xl">Provider delta state</h2>
|
|
235
|
+
<p className="text-muted-foreground">
|
|
236
|
+
Runtime-backed providers should persist a{' '}
|
|
237
|
+
<strong>ProviderDeltaSyncState</strong> per source before sync work is
|
|
238
|
+
acknowledged. Gmail and Google Drive adapters use that checkpoint to
|
|
239
|
+
resume cursors, renew watches, skip tombstones, dedupe webhook events,
|
|
240
|
+
and replay from a known point after retries.
|
|
241
|
+
</p>
|
|
242
|
+
<div className="overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm">
|
|
243
|
+
<pre>{`type ProviderDeltaSyncState = {
|
|
244
|
+
lease?: { holder: string; expiresAt: string; renewalWindowMs: number };
|
|
245
|
+
cursor?: { cursor?: string; watermark?: string; watermarkVersion?: string };
|
|
246
|
+
webhookChannel?: { channelId: string; resourceId?: string; expiresAt?: string };
|
|
247
|
+
providerEventId?: string;
|
|
248
|
+
dedupeKey?: string;
|
|
249
|
+
idempotencyKey?: string;
|
|
250
|
+
replayCheckpoint?: { checkpointId: string; sequence?: string | number };
|
|
251
|
+
tombstone?: { deletedAt: string; reason?: string };
|
|
252
|
+
};`}</pre>
|
|
253
|
+
</div>
|
|
254
|
+
<div className="flex flex-wrap gap-3">
|
|
255
|
+
<Link href="/docs/integrations/gmail" className="btn-ghost">
|
|
256
|
+
Gmail integration
|
|
257
|
+
</Link>
|
|
258
|
+
<Link href="/docs/integrations/google-drive" className="btn-ghost">
|
|
259
|
+
Google Drive integration
|
|
260
|
+
</Link>
|
|
261
|
+
<Link
|
|
262
|
+
href="/docs/guides/provider-backed-knowledge"
|
|
263
|
+
className="btn-ghost"
|
|
264
|
+
>
|
|
265
|
+
Provider-backed guide
|
|
266
|
+
</Link>
|
|
267
|
+
</div>
|
|
268
|
+
</div>
|
|
269
|
+
|
|
233
270
|
<div className="space-y-4">
|
|
234
271
|
<h2 className="font-bold text-2xl">Best practices</h2>
|
|
235
272
|
<ul className="list-inside list-disc space-y-2 text-muted-foreground">
|
|
@@ -247,6 +284,14 @@ export function KnowledgeSourcesPage() {
|
|
|
247
284
|
Document the purpose and ownership of each source for your team
|
|
248
285
|
</li>
|
|
249
286
|
<li>Use manual sync for sensitive or infrequently updated content</li>
|
|
287
|
+
<li>
|
|
288
|
+
Run external mutations through{' '}
|
|
289
|
+
<Link href="/docs/knowledge/governance" className="text-primary">
|
|
290
|
+
knowledge mutation governance
|
|
291
|
+
</Link>{' '}
|
|
292
|
+
before sending email, changing Drive permissions, or repairing
|
|
293
|
+
replay state.
|
|
294
|
+
</li>
|
|
250
295
|
</ul>
|
|
251
296
|
</div>
|
|
252
297
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { KnowledgeCategoriesPage } from './KnowledgeCategoriesPage';
|
|
2
2
|
export { KnowledgeExamplesPage } from './KnowledgeExamplesPage';
|
|
3
|
+
export { KnowledgeGovernancePage } from './KnowledgeGovernancePage';
|
|
3
4
|
export { KnowledgeOverviewPage } from './KnowledgeOverviewPage';
|
|
4
5
|
export { KnowledgeSourcesPage } from './KnowledgeSourcesPage';
|
|
5
6
|
export { KnowledgeSpacesPage } from './KnowledgeSpacesPage';
|