@treeseed/sdk 0.13.0-rc.37 → 0.13.0-rc.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.
Files changed (31) hide show
  1. package/dist/agent-capacity/validation/agent-definition-schema.d.ts +36 -36
  2. package/dist/agent-capacity/validation/agent-lab-forensics-schema.d.ts +8 -8
  3. package/dist/capacity-provider/client.d.ts +1 -1
  4. package/dist/content/validation/agent-operational-content-schemas.d.ts +8 -8
  5. package/dist/content/validation/auxiliary-content-schemas.d.ts +36 -36
  6. package/dist/content/validation/content-model-schemas.d.ts +128 -128
  7. package/dist/content/validation/portable-content-data.d.ts +15 -15
  8. package/dist/entrypoints/clients/control-plane-client.d.ts +5 -0
  9. package/dist/guarantees/index.d.ts +96 -0
  10. package/dist/guarantees/index.js +41 -0
  11. package/dist/operator-contracts/canonical-command-tree.js +6 -2
  12. package/dist/operator-contracts/catalog/communication-operations.d.ts +95 -15
  13. package/dist/operator-contracts/catalog/communication-operations.js +1 -1
  14. package/dist/operator-contracts/communication/addressing.d.ts +8 -0
  15. package/dist/operator-contracts/communication/addressing.js +57 -0
  16. package/dist/operator-contracts/communication/contracts.d.ts +418 -40
  17. package/dist/operator-contracts/communication/contracts.js +43 -11
  18. package/dist/operator-contracts/control-plane-operations.d.ts +95 -15
  19. package/dist/operator-contracts/index.d.ts +1 -0
  20. package/dist/operator-contracts/index.js +1 -0
  21. package/dist/operator-contracts/oauth.d.ts +35 -0
  22. package/dist/operator-contracts/oauth.js +7 -0
  23. package/dist/site-contracts/catalog.d.ts +16 -0
  24. package/dist/site-contracts/catalog.js +19 -0
  25. package/dist/site-contracts/cloudflare.d.ts +48 -0
  26. package/dist/site-contracts/cloudflare.js +0 -0
  27. package/dist/site-contracts/platform.d.ts +94 -0
  28. package/dist/site-contracts/platform.js +0 -0
  29. package/dist/site-contracts/plugin.d.ts +63 -0
  30. package/dist/site-contracts/plugin.js +26 -0
  31. package/package.json +25 -1
@@ -5,52 +5,84 @@ const communicationRecipientSchema = z.object({
5
5
  }).strict();
6
6
  const communicationSendRequestSchema = z.object({
7
7
  message: z.string().trim().min(1).max(1e5),
8
- topic: z.string().trim().min(1).max(240).optional(),
9
- projectId: z.string().min(1).optional(),
8
+ projectId: z.string().min(1),
10
9
  recipients: z.array(z.string().trim().min(1)).max(100).optional(),
11
- waitSeconds: z.number().int().min(0).max(3600).optional()
10
+ timeoutSeconds: z.number().int().min(1).max(3600).optional()
12
11
  }).strict();
13
12
  const communicationTargetSchema = communicationRecipientSchema.extend({
14
13
  projectSlug: z.string().min(1),
15
14
  definitionRevision: z.string().min(1),
15
+ revisions: z.object({
16
+ project: z.string().min(1),
17
+ library: z.string().min(1),
18
+ agentDefinition: z.string().min(1),
19
+ chatProfile: z.string().min(1)
20
+ }).strict(),
16
21
  invocationId: z.string().min(1).nullable(),
17
- status: z.enum(["queued", "running", "responded", "failed", "cancelled"])
22
+ requirement: z.enum(["required", "optional"]),
23
+ parentInvocationId: z.string().min(1).nullable(),
24
+ depth: z.number().int().nonnegative(),
25
+ status: z.enum(["queued", "running", "responded", "abstained", "failed", "cancelled"]),
26
+ requestedAt: z.string().datetime(),
27
+ updatedAt: z.string().datetime(),
28
+ completedAt: z.string().datetime().nullable(),
29
+ failure: z.object({ code: z.string().min(1), message: z.string().nullable() }).strict().nullable(),
30
+ capacity: z.object({
31
+ assignmentId: z.string().min(1).nullable(),
32
+ providerId: z.string().min(1).nullable(),
33
+ executionProviderId: z.string().min(1).nullable(),
34
+ laneId: z.string().min(1).nullable(),
35
+ lanePurpose: z.string().min(1).nullable(),
36
+ status: z.string().min(1).nullable(),
37
+ assignedAt: z.string().datetime().nullable(),
38
+ claimedAt: z.string().datetime().nullable(),
39
+ completedAt: z.string().datetime().nullable(),
40
+ returnedAt: z.string().datetime().nullable(),
41
+ failedAt: z.string().datetime().nullable()
42
+ }).strict()
18
43
  });
19
44
  const communicationResponseSchema = communicationRecipientSchema.extend({
20
45
  invocationId: z.string().min(1),
21
46
  assignmentId: z.string().min(1).nullable(),
22
47
  messageRef: z.string().min(1),
23
48
  markdown: z.string(),
24
- status: z.enum(["responded", "failed", "cancelled"]),
49
+ requirement: z.enum(["required", "optional"]),
50
+ status: z.enum(["responded", "abstained", "failed", "cancelled"]),
25
51
  createdAt: z.string().datetime()
26
52
  });
27
53
  const communicationSendReceiptSchema = z.object({
28
- schemaVersion: z.literal("treeseed.communication-send-receipt/v1"),
54
+ schemaVersion: z.literal("treeseed.communication-send-receipt/v2"),
29
55
  sendId: z.string().min(1),
30
56
  teamId: z.string().min(1),
31
57
  channel: z.string().min(1),
32
- topic: z.string().nullable(),
58
+ topic: z.object({ id: z.string().min(1), slug: z.string().min(1) }).strict(),
59
+ projectStream: z.object({ id: z.string().min(1), projectId: z.string().min(1), projectSlug: z.string().min(1) }).strict(),
33
60
  discussionId: z.string().min(1),
34
61
  messageRef: z.string().min(1),
62
+ sourceMessage: z.string(),
35
63
  status: z.enum(["queued", "running", "complete", "partial", "failed"]),
36
64
  targets: z.array(communicationTargetSchema),
37
65
  responses: z.array(communicationResponseSchema),
38
66
  createdAt: z.string().datetime(),
39
- updatedAt: z.string().datetime()
67
+ updatedAt: z.string().datetime(),
68
+ replayed: z.boolean()
40
69
  }).strict();
41
70
  const providerDiscussionResponseRequestSchema = z.object({
42
71
  leaseToken: z.string().min(1),
43
72
  runnerId: z.string().min(1),
44
- markdown: z.string().trim().min(1).max(1e5),
73
+ outcome: z.enum(["responded", "abstained"]).default("responded"),
74
+ markdown: z.string().trim().min(1).max(1e5).optional(),
45
75
  summary: z.string().trim().min(1).max(4e3).optional(),
46
76
  usage: z.record(z.unknown()).optional()
47
- }).strict();
77
+ }).strict().superRefine((value, context) => {
78
+ if (value.outcome === "responded" && !value.markdown) context.addIssue({ code: z.ZodIssueCode.custom, path: ["markdown"], message: "A response requires Markdown." });
79
+ });
48
80
  const providerDiscussionResponseReceiptSchema = z.object({
49
81
  schemaVersion: z.literal("treeseed.provider-discussion-response-receipt/v1"),
50
82
  assignmentId: z.string().min(1),
51
83
  invocationId: z.string().min(1),
52
84
  messageRef: z.string().min(1),
53
- status: z.literal("responded"),
85
+ status: z.enum(["responded", "abstained"]),
54
86
  settledAt: z.string().datetime()
55
87
  }).strict();
56
88
  export {
@@ -466,72 +466,151 @@ export declare const CONTROL_PLANE_OPERATIONS: {
466
466
  channel: string;
467
467
  }, {}, {
468
468
  message: string;
469
- projectId?: string | undefined;
469
+ projectId: string;
470
+ timeoutSeconds?: number | undefined;
470
471
  recipients?: string[] | undefined;
471
- topic?: string | undefined;
472
- waitSeconds?: number | undefined;
473
472
  }, {
474
473
  status: "partial" | "failed" | "complete" | "running" | "queued";
475
- schemaVersion: "treeseed.communication-send-receipt/v1";
474
+ schemaVersion: "treeseed.communication-send-receipt/v2";
476
475
  createdAt: string;
477
476
  responses: {
478
- status: "failed" | "cancelled" | "responded";
477
+ status: "failed" | "cancelled" | "responded" | "abstained";
479
478
  createdAt: string;
480
479
  projectId: string;
481
480
  agentSlug: string;
482
481
  assignmentId: string | null;
483
482
  invocationId: string;
483
+ requirement: "required" | "optional";
484
484
  messageRef: string;
485
485
  markdown: string;
486
486
  }[];
487
487
  teamId: string;
488
488
  channel: string;
489
- topic: string | null;
489
+ updatedAt: string;
490
490
  messageRef: string;
491
491
  sendId: string;
492
+ topic: {
493
+ id: string;
494
+ slug: string;
495
+ };
496
+ projectStream: {
497
+ id: string;
498
+ projectId: string;
499
+ projectSlug: string;
500
+ };
492
501
  discussionId: string;
502
+ sourceMessage: string;
493
503
  targets: {
494
- status: "failed" | "running" | "cancelled" | "queued" | "responded";
504
+ status: "failed" | "running" | "cancelled" | "queued" | "responded" | "abstained";
505
+ completedAt: string | null;
495
506
  projectId: string;
496
507
  agentSlug: string;
508
+ capacity: {
509
+ status: string | null;
510
+ completedAt: string | null;
511
+ providerId: string | null;
512
+ assignmentId: string | null;
513
+ executionProviderId: string | null;
514
+ laneId: string | null;
515
+ lanePurpose: string | null;
516
+ assignedAt: string | null;
517
+ claimedAt: string | null;
518
+ returnedAt: string | null;
519
+ failedAt: string | null;
520
+ };
497
521
  projectSlug: string;
498
522
  definitionRevision: string;
523
+ revisions: {
524
+ project: string;
525
+ library: string;
526
+ agentDefinition: string;
527
+ chatProfile: string;
528
+ };
499
529
  invocationId: string | null;
530
+ requirement: "required" | "optional";
531
+ parentInvocationId: string | null;
532
+ depth: number;
533
+ requestedAt: string;
534
+ updatedAt: string;
535
+ failure: {
536
+ code: string;
537
+ message: string | null;
538
+ } | null;
500
539
  }[];
501
- updatedAt: string;
540
+ replayed: boolean;
502
541
  }>;
503
542
  readonly sendStatus: ControlPlaneOperationBinding<{
504
543
  teamId: string;
505
544
  sendId: string;
506
545
  }, {}, undefined, {
507
546
  status: "partial" | "failed" | "complete" | "running" | "queued";
508
- schemaVersion: "treeseed.communication-send-receipt/v1";
547
+ schemaVersion: "treeseed.communication-send-receipt/v2";
509
548
  createdAt: string;
510
549
  responses: {
511
- status: "failed" | "cancelled" | "responded";
550
+ status: "failed" | "cancelled" | "responded" | "abstained";
512
551
  createdAt: string;
513
552
  projectId: string;
514
553
  agentSlug: string;
515
554
  assignmentId: string | null;
516
555
  invocationId: string;
556
+ requirement: "required" | "optional";
517
557
  messageRef: string;
518
558
  markdown: string;
519
559
  }[];
520
560
  teamId: string;
521
561
  channel: string;
522
- topic: string | null;
562
+ updatedAt: string;
523
563
  messageRef: string;
524
564
  sendId: string;
565
+ topic: {
566
+ id: string;
567
+ slug: string;
568
+ };
569
+ projectStream: {
570
+ id: string;
571
+ projectId: string;
572
+ projectSlug: string;
573
+ };
525
574
  discussionId: string;
575
+ sourceMessage: string;
526
576
  targets: {
527
- status: "failed" | "running" | "cancelled" | "queued" | "responded";
577
+ status: "failed" | "running" | "cancelled" | "queued" | "responded" | "abstained";
578
+ completedAt: string | null;
528
579
  projectId: string;
529
580
  agentSlug: string;
581
+ capacity: {
582
+ status: string | null;
583
+ completedAt: string | null;
584
+ providerId: string | null;
585
+ assignmentId: string | null;
586
+ executionProviderId: string | null;
587
+ laneId: string | null;
588
+ lanePurpose: string | null;
589
+ assignedAt: string | null;
590
+ claimedAt: string | null;
591
+ returnedAt: string | null;
592
+ failedAt: string | null;
593
+ };
530
594
  projectSlug: string;
531
595
  definitionRevision: string;
596
+ revisions: {
597
+ project: string;
598
+ library: string;
599
+ agentDefinition: string;
600
+ chatProfile: string;
601
+ };
532
602
  invocationId: string | null;
603
+ requirement: "required" | "optional";
604
+ parentInvocationId: string | null;
605
+ depth: number;
606
+ requestedAt: string;
607
+ updatedAt: string;
608
+ failure: {
609
+ code: string;
610
+ message: string | null;
611
+ } | null;
533
612
  }[];
534
- updatedAt: string;
613
+ replayed: boolean;
535
614
  }>;
536
615
  };
537
616
  readonly capacity: {
@@ -1068,13 +1147,14 @@ export declare const CONTROL_PLANE_OPERATIONS: {
1068
1147
  readonly discussionResponse: ControlPlaneOperationBinding<{
1069
1148
  assignmentId: string;
1070
1149
  }, {}, {
1071
- markdown: string;
1072
1150
  leaseToken: string;
1073
1151
  runnerId: string;
1074
1152
  summary?: string | undefined;
1075
1153
  usage?: Record<string, unknown> | undefined;
1154
+ markdown?: string | undefined;
1155
+ outcome?: "responded" | "abstained" | undefined;
1076
1156
  }, {
1077
- status: "responded";
1157
+ status: "responded" | "abstained";
1078
1158
  schemaVersion: "treeseed.provider-discussion-response-receipt/v1";
1079
1159
  assignmentId: string;
1080
1160
  invocationId: string;
@@ -7,4 +7,5 @@ export * from './control-plane-operations.js';
7
7
  export * from './mcp.js';
8
8
  export * from './oauth.js';
9
9
  export * from './communication/contracts.js';
10
+ export * from './communication/addressing.js';
10
11
  export * from './seed/seed-bundle.js';
@@ -7,4 +7,5 @@ export * from "./control-plane-operations.js";
7
7
  export * from "./mcp.js";
8
8
  export * from "./oauth.js";
9
9
  export * from "./communication/contracts.js";
10
+ export * from "./communication/addressing.js";
10
11
  export * from "./seed/seed-bundle.js";
@@ -1,4 +1,9 @@
1
1
  import type { OAuthScope } from './control-plane-operation.js';
2
+ export declare const OAUTH_CLIENT_IDS: {
3
+ readonly cli: "trsd";
4
+ readonly admin: "treeseed-admin";
5
+ };
6
+ export type OAuthClientId = typeof OAUTH_CLIENT_IDS[keyof typeof OAUTH_CLIENT_IDS];
2
7
  export interface ApiPrincipal {
3
8
  id: string;
4
9
  displayName?: string;
@@ -18,6 +23,36 @@ export interface OAuthAuthorizationServerMetadata {
18
23
  code_challenge_methods_supported: ['S256'];
19
24
  scopes_supported: OAuthScope[];
20
25
  }
26
+ export interface OAuthAuthorizationPresentation {
27
+ schemaVersion: 'treeseed.oauth.authorization-presentation/v1';
28
+ clientId: string;
29
+ clientName: string;
30
+ redirectUri: string;
31
+ redirectOrigin: string;
32
+ responseType: 'code';
33
+ codeChallenge: string;
34
+ codeChallengeMethod: 'S256';
35
+ scopes: OAuthScope[];
36
+ state: string | null;
37
+ }
38
+ export interface OAuthAuthorizationDecisionRequest {
39
+ clientId: string;
40
+ redirectUri: string;
41
+ responseType: 'code';
42
+ codeChallenge: string;
43
+ codeChallengeMethod: 'S256';
44
+ scope: OAuthScope[];
45
+ state?: string | null;
46
+ decision: 'approve' | 'deny';
47
+ identifier?: string;
48
+ password?: string;
49
+ }
50
+ export interface OAuthAuthorizationDecisionResult {
51
+ schemaVersion: 'treeseed.oauth.authorization-decision/v1';
52
+ approved: boolean;
53
+ redirectTo: string;
54
+ expiresIn?: number;
55
+ }
21
56
  export interface OAuthProtectedResourceMetadata {
22
57
  resource: string;
23
58
  authorization_servers: string[];
@@ -0,0 +1,7 @@
1
+ const OAUTH_CLIENT_IDS = {
2
+ cli: "trsd",
3
+ admin: "treeseed-admin"
4
+ };
5
+ export {
6
+ OAUTH_CLIENT_IDS
7
+ };
@@ -0,0 +1,16 @@
1
+ export declare const REMOTE_CONTRACT_HEADER = "x-treeseed-contract-version";
2
+ export declare const REMOTE_CONTRACT_VERSION = 1;
3
+ export declare const COMMERCE_OFFER_MODES: readonly ["free", "private", "contact", "one_time", "one_time_current_version", "subscription", "subscription_updates", "professional_hosting", "scoped_contract", "external"];
4
+ export type CommerceOfferMode = typeof COMMERCE_OFFER_MODES[number];
5
+ export type CatalogItemOfferMode = CommerceOfferMode;
6
+ export interface CatalogItem {
7
+ id?: string;
8
+ slug: string;
9
+ name?: string;
10
+ title?: string;
11
+ description?: string;
12
+ visibility?: string;
13
+ offerMode?: CommerceOfferMode;
14
+ priceModel?: CommerceOfferMode;
15
+ [key: string]: any;
16
+ }
@@ -0,0 +1,19 @@
1
+ const REMOTE_CONTRACT_HEADER = "x-treeseed-contract-version";
2
+ const REMOTE_CONTRACT_VERSION = 1;
3
+ const COMMERCE_OFFER_MODES = [
4
+ "free",
5
+ "private",
6
+ "contact",
7
+ "one_time",
8
+ "one_time_current_version",
9
+ "subscription",
10
+ "subscription_updates",
11
+ "professional_hosting",
12
+ "scoped_contract",
13
+ "external"
14
+ ];
15
+ export {
16
+ COMMERCE_OFFER_MODES,
17
+ REMOTE_CONTRACT_HEADER,
18
+ REMOTE_CONTRACT_VERSION
19
+ };
@@ -0,0 +1,48 @@
1
+ export interface KvNamespacePutOptions {
2
+ expirationTtl?: number;
3
+ }
4
+ export interface KvNamespaceLike {
5
+ get(key: string): Promise<string | null>;
6
+ put(key: string, value: string, options?: KvNamespacePutOptions): Promise<void>;
7
+ }
8
+ export interface D1PreparedStatementLike {
9
+ bind(...values: unknown[]): D1PreparedStatementLike;
10
+ run(): Promise<unknown>;
11
+ first<T = Record<string, unknown>>(): Promise<T | null>;
12
+ all<T = Record<string, unknown>>(): Promise<{
13
+ results: T[];
14
+ }>;
15
+ raw<T = unknown[]>(): Promise<T[]>;
16
+ }
17
+ export interface D1DatabaseLike {
18
+ prepare(query: string): D1PreparedStatementLike;
19
+ batch?(statements: D1PreparedStatementLike[]): Promise<unknown[]>;
20
+ exec?(query: string): Promise<unknown>;
21
+ }
22
+ export interface CloudflareRuntimeAssets {
23
+ fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
24
+ }
25
+ export interface R2ObjectLike {
26
+ text(): Promise<string>;
27
+ arrayBuffer(): Promise<ArrayBuffer>;
28
+ json<T = unknown>(): Promise<T>;
29
+ httpEtag?: string;
30
+ etag?: string;
31
+ size?: number;
32
+ uploaded?: Date;
33
+ writeHttpMetadata?(headers: Headers): void;
34
+ }
35
+ export interface R2BucketLike {
36
+ get(key: string): Promise<R2ObjectLike | null>;
37
+ head?(key: string): Promise<R2ObjectLike | null>;
38
+ put(key: string, value: string | ArrayBuffer | ArrayBufferView | ReadableStream, options?: Record<string, unknown>): Promise<unknown>;
39
+ delete?(key: string | string[]): Promise<void>;
40
+ }
41
+ export interface CloudflareRuntime {
42
+ env: {
43
+ FORM_GUARD_KV: KvNamespaceLike;
44
+ SITE_DATA_DB: D1DatabaseLike;
45
+ ASSETS?: CloudflareRuntimeAssets;
46
+ [key: string]: unknown;
47
+ };
48
+ }
File without changes
@@ -0,0 +1,94 @@
1
+ export type ContentCollection = 'pages' | 'notes' | 'questions' | 'objectives' | 'proposals' | 'decisions' | 'people' | 'agents' | 'books' | 'docs' | 'templates' | 'workdays' | 'groups' | 'group_edges';
2
+ export type ThemeMode = 'light' | 'dark' | 'system';
3
+ export type ColorSchemeId = 'fern' | 'lichen' | 'cedar' | 'tidepool' | (string & {});
4
+ export interface SemanticColorTokens {
5
+ canvas: string;
6
+ canvasSubtle: string;
7
+ surface: string;
8
+ surfaceMuted: string;
9
+ surfaceRaised: string;
10
+ surfaceOverlay: string;
11
+ text: string;
12
+ textMuted: string;
13
+ textSubtle: string;
14
+ textInverse: string;
15
+ link: string;
16
+ linkHover: string;
17
+ border: string;
18
+ borderMuted: string;
19
+ borderStrong: string;
20
+ focus: string;
21
+ accent: string;
22
+ accentHover: string;
23
+ accentStrong: string;
24
+ accentSoft: string;
25
+ accentText: string;
26
+ info: string;
27
+ infoSoft: string;
28
+ infoText: string;
29
+ infoBorder: string;
30
+ success: string;
31
+ successSoft: string;
32
+ successText: string;
33
+ successBorder: string;
34
+ warning: string;
35
+ warningSoft: string;
36
+ warningText: string;
37
+ warningBorder: string;
38
+ danger: string;
39
+ dangerSoft: string;
40
+ dangerText: string;
41
+ dangerBorder: string;
42
+ shadow: string;
43
+ grid: string;
44
+ }
45
+ export interface SchemeTokens {
46
+ light: SemanticColorTokens;
47
+ dark: SemanticColorTokens;
48
+ }
49
+ export interface ThemeConfig {
50
+ defaultScheme?: ColorSchemeId;
51
+ defaultMode?: ThemeMode;
52
+ schemes?: Record<string, Partial<{
53
+ light: Partial<SemanticColorTokens>;
54
+ dark: Partial<SemanticColorTokens>;
55
+ }>>;
56
+ }
57
+ export type PlatformSurfaceName = 'web' | 'api' | (string & {});
58
+ export type PlatformResourceKind = 'pages' | 'styles' | 'components' | 'routes' | 'middleware' | 'handlers' | 'config';
59
+ export interface PlatformLayerDefinition {
60
+ root: string;
61
+ kinds?: PlatformResourceKind[];
62
+ }
63
+ export interface ManagedServiceEnvironmentConfig {
64
+ baseUrl?: string;
65
+ domain?: string;
66
+ serviceName?: string;
67
+ [key: string]: unknown;
68
+ }
69
+ export interface DeployConfig {
70
+ content?: Record<string, unknown>;
71
+ forms?: Record<string, unknown>;
72
+ surfaces?: Record<string, unknown>;
73
+ services?: Record<string, unknown>;
74
+ [key: string]: any;
75
+ }
76
+ export interface TenantConfig {
77
+ id?: string;
78
+ name?: string;
79
+ root?: string;
80
+ content: Record<string, string | undefined>;
81
+ features?: Record<string, boolean | undefined>;
82
+ site?: {
83
+ models?: Partial<Record<ContentCollection, {
84
+ rendered?: boolean;
85
+ }>>;
86
+ };
87
+ theme?: ThemeConfig;
88
+ plugins?: Array<{
89
+ package: string;
90
+ enabled?: boolean;
91
+ config?: Record<string, unknown>;
92
+ }>;
93
+ [key: string]: any;
94
+ }
File without changes
@@ -0,0 +1,63 @@
1
+ import type { DeployConfig, PlatformLayerDefinition, PlatformResourceKind, PlatformSurfaceName, TenantConfig } from './platform.js';
2
+ export type RouteOwner = 'market' | 'admin' | 'core';
3
+ export type RouteResponseKind = 'page' | 'message' | 'redirect' | 'data' | 'proxy' | 'action' | 'feed';
4
+ export type RouteArchetype = 'action' | 'auth-form' | 'collection' | 'dashboard' | 'detail' | 'feed' | 'message' | 'profile' | 'reader' | 'redirect' | 'settings' | 'wizard';
5
+ export type RouteNavigationPosture = 'primary' | 'secondary' | 'contextual' | 'hidden';
6
+ export type RouteStatus = 'active' | 'planned' | 'deprecated';
7
+ export interface RouteCapability {
8
+ id: string;
9
+ owner: RouteOwner;
10
+ responseKind: RouteResponseKind;
11
+ archetype: RouteArchetype;
12
+ shell: string;
13
+ template: string;
14
+ surface: 'auth' | 'public' | 'personal' | 'team' | 'content' | 'system';
15
+ resourceType: string;
16
+ accessPolicy: string[];
17
+ viewModelDependencies: string[];
18
+ navigation: RouteNavigationPosture;
19
+ states: Array<'loading' | 'empty' | 'forbidden' | 'unavailable' | 'validation' | 'conflict' | 'retry' | 'success' | 'not-found'>;
20
+ selector: string;
21
+ status: RouteStatus;
22
+ guarantees: string[];
23
+ description: string;
24
+ knowledgePageIds?: string[];
25
+ }
26
+ export interface SiteRouteContribution {
27
+ pattern: string;
28
+ entrypoint?: string;
29
+ resourcePath?: string;
30
+ capability?: RouteCapability;
31
+ }
32
+ export interface SiteExtensionContribution {
33
+ routes?: SiteRouteContribution[];
34
+ starlightComponents?: Record<string, string>;
35
+ customCss?: string[];
36
+ remarkPlugins?: unknown[];
37
+ rehypePlugins?: unknown[];
38
+ envSchema?: Record<string, unknown>;
39
+ vitePlugins?: unknown[];
40
+ integrations?: unknown[];
41
+ routeMiddleware?: unknown[];
42
+ }
43
+ export interface PluginSiteContext {
44
+ projectRoot: string;
45
+ tenantConfig: TenantConfig;
46
+ deployConfig?: DeployConfig;
47
+ pluginConfig: Record<string, unknown>;
48
+ }
49
+ export interface Plugin {
50
+ id?: string;
51
+ provides?: Record<string, unknown>;
52
+ siteProviders?: Record<string, SiteExtensionContribution | ((context: PluginSiteContext) => SiteExtensionContribution)>;
53
+ siteHooks?: SiteExtensionContribution | ((context: PluginSiteContext) => SiteExtensionContribution);
54
+ siteLayers?: PlatformLayerDefinition[] | ((context: PluginSiteContext) => PlatformLayerDefinition[] | undefined);
55
+ platformLayers?: Array<PlatformLayerDefinition & {
56
+ surface?: PlatformSurfaceName;
57
+ kinds?: PlatformResourceKind[];
58
+ }>;
59
+ [key: string]: unknown;
60
+ }
61
+ export declare function defineRoute<T extends SiteRouteContribution>(route: T): T;
62
+ export declare function validateRouteCapabilities(routes: readonly SiteRouteContribution[]): readonly SiteRouteContribution[];
63
+ export declare function definePlugin<T extends Plugin>(plugin: T): T;
@@ -0,0 +1,26 @@
1
+ function defineRoute(route) {
2
+ if (!route.pattern.startsWith("/")) throw new Error(`TreeSeed route pattern must start with "/": ${route.pattern}`);
3
+ if (route.capability && !/^[a-z][a-z0-9.-]+$/u.test(route.capability.id)) throw new Error(`Invalid TreeSeed route capability id: ${route.capability.id}`);
4
+ return route;
5
+ }
6
+ function validateRouteCapabilities(routes) {
7
+ const patterns = /* @__PURE__ */ new Set();
8
+ const ids = /* @__PURE__ */ new Set();
9
+ for (const route of routes) {
10
+ defineRoute(route);
11
+ if (patterns.has(route.pattern)) throw new Error(`Duplicate TreeSeed route pattern: ${route.pattern}`);
12
+ patterns.add(route.pattern);
13
+ if (!route.capability) throw new Error(`TreeSeed route ${route.pattern} is missing capability metadata.`);
14
+ if (ids.has(route.capability.id)) throw new Error(`Duplicate TreeSeed route capability id: ${route.capability.id}`);
15
+ ids.add(route.capability.id);
16
+ }
17
+ return routes;
18
+ }
19
+ function definePlugin(plugin) {
20
+ return plugin;
21
+ }
22
+ export {
23
+ definePlugin,
24
+ defineRoute,
25
+ validateRouteCapabilities
26
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@treeseed/sdk",
3
- "version": "0.13.0-rc.37",
3
+ "version": "0.13.0-rc.39",
4
4
  "description": "Portable TreeSeed contracts, standards, and typed remote control-plane clients.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -85,6 +85,30 @@
85
85
  "types": "./dist/operator-contracts/index.d.ts",
86
86
  "default": "./dist/operator-contracts/index.js"
87
87
  },
88
+ "./guarantees": {
89
+ "types": "./dist/guarantees/index.d.ts",
90
+ "default": "./dist/guarantees/index.js"
91
+ },
92
+ "./site-contracts/platform": {
93
+ "types": "./dist/site-contracts/platform.d.ts",
94
+ "default": "./dist/site-contracts/platform.js"
95
+ },
96
+ "./site-contracts/plugin": {
97
+ "types": "./dist/site-contracts/plugin.d.ts",
98
+ "default": "./dist/site-contracts/plugin.js"
99
+ },
100
+ "./site-contracts/cloudflare": {
101
+ "types": "./dist/site-contracts/cloudflare.d.ts",
102
+ "default": "./dist/site-contracts/cloudflare.js"
103
+ },
104
+ "./site-contracts/catalog": {
105
+ "types": "./dist/site-contracts/catalog.d.ts",
106
+ "default": "./dist/site-contracts/catalog.js"
107
+ },
108
+ "./field-aliases": {
109
+ "types": "./dist/entrypoints/models/field-aliases.d.ts",
110
+ "default": "./dist/entrypoints/models/field-aliases.js"
111
+ },
88
112
  "./control-plane-client": {
89
113
  "types": "./dist/entrypoints/clients/control-plane-client.d.ts",
90
114
  "default": "./dist/entrypoints/clients/control-plane-client.js"