@treeseed/sdk 0.13.0-rc.65 → 0.13.0-rc.66

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 (29) hide show
  1. package/dist/.treeseed-build-complete.json +1 -1
  2. package/dist/agent-capacity/contracts/capacity/assignments/assignment-context-pack.d.ts +304 -0
  3. package/dist/agent-capacity/contracts/capacity/assignments/assignment-context-pack.js +44 -0
  4. package/dist/agent-capacity/contracts/capacity/assignments/assignment-records.d.ts +9 -0
  5. package/dist/agent-capacity/contracts/capacity/assignments/context-pack-compiler.d.ts +25 -0
  6. package/dist/agent-capacity/contracts/capacity/assignments/context-pack-compiler.js +67 -0
  7. package/dist/agent-capacity/validation/agent-definition-schema.js +2 -0
  8. package/dist/capacity/agents/agent-capacity.d.ts +2 -0
  9. package/dist/capacity/agents/agent-capacity.js +2 -0
  10. package/dist/capacity-provider/capability-ontology.d.ts +292 -3
  11. package/dist/capacity-provider/capability-ontology.js +23 -1
  12. package/dist/content/validation/agent-operational-content-schemas.d.ts +338 -16
  13. package/dist/content/validation/agent-operational-content-schemas.js +18 -3
  14. package/dist/content/validation/content-model-schemas.d.ts +362 -23
  15. package/dist/content/validation/portable-content-data.d.ts +20 -3
  16. package/dist/entrypoints/clients/control-plane-client.js +5 -3
  17. package/dist/graph/context-query-contracts.d.ts +16 -1
  18. package/dist/graph/context-query-contracts.js +5 -0
  19. package/dist/model-registry/agent-operational-models.js +1 -1
  20. package/dist/operator-contracts/canonical-command-tree.js +1 -1
  21. package/dist/operator-contracts/catalog/knowledge-share-operations.d.ts +127 -0
  22. package/dist/operator-contracts/catalog/knowledge-share-operations.js +25 -0
  23. package/dist/operator-contracts/control-plane-operations.d.ts +125 -0
  24. package/dist/operator-contracts/control-plane-operations.js +2 -0
  25. package/dist/operator-contracts/index.d.ts +1 -0
  26. package/dist/operator-contracts/index.js +1 -0
  27. package/dist/operator-contracts/knowledge/contracts.d.ts +130 -0
  28. package/dist/operator-contracts/knowledge/contracts.js +39 -0
  29. package/package.json +1 -1
@@ -23,9 +23,24 @@ export interface DeclarativeContextQuery {
23
23
  maxCharacters?: number;
24
24
  };
25
25
  tokenBudget?: number;
26
+ sources?: Array<{
27
+ scope: 'current-project' | 'team-library';
28
+ } | {
29
+ scope: 'same-team';
30
+ projectIds?: string[];
31
+ projectSlugs?: string[];
32
+ } | {
33
+ scope: 'shared-team';
34
+ teamId: string;
35
+ projectIds?: string[];
36
+ }>;
37
+ requirement?: 'required' | 'preferred';
38
+ priority?: number;
39
+ minimumBudget?: number;
40
+ maximumBudget?: number;
41
+ summarization?: 'none' | 'deterministic' | 'provider';
26
42
  format?: DeclarativeContextQueryFormat;
27
43
  filters?: Record<string, unknown>;
28
- required?: boolean;
29
44
  }
30
45
  export type HandlerContextPackSource = 'agent_spec' | 'content_frontmatter' | 'work_package' | 'task_payload' | 'default_role_context';
31
46
  export interface DeclarativeContextQuerySourceRef {
@@ -68,6 +68,11 @@ function compileDeclarativeContextQuery(query, options = {}) {
68
68
  }
69
69
  if (query.resultLimit !== void 0 && !asPositiveInteger(query.resultLimit)) errors.push(`Context query "${id || "<unknown>"}" resultLimit must be a positive integer.`);
70
70
  if (query.tokenBudget !== void 0 && !asPositiveInteger(query.tokenBudget)) errors.push(`Context query "${id || "<unknown>"}" tokenBudget must be a positive integer.`);
71
+ if (query.minimumBudget !== void 0 && !asPositiveInteger(query.minimumBudget)) errors.push(`Context query "${id || "<unknown>"}" minimumBudget must be a positive integer.`);
72
+ if (query.maximumBudget !== void 0 && !asPositiveInteger(query.maximumBudget)) errors.push(`Context query "${id || "<unknown>"}" maximumBudget must be a positive integer.`);
73
+ if (query.minimumBudget !== void 0 && query.maximumBudget !== void 0 && query.minimumBudget > query.maximumBudget) errors.push(`Context query "${id || "<unknown>"}" minimumBudget cannot exceed maximumBudget.`);
74
+ if (query.priority !== void 0 && (!Number.isInteger(query.priority) || query.priority < 0 || query.priority > 100)) errors.push(`Context query "${id || "<unknown>"}" priority must be an integer from 0 through 100.`);
75
+ if (query.sources?.some((source) => source.scope === "shared-team" && !source.teamId.trim())) errors.push(`Context query "${id || "<unknown>"}" shared-team sources require a teamId.`);
71
76
  const scope = query.scope === void 0 ? void 0 : normalizeString(query.scope);
72
77
  if (scope !== void 0 && (!scope || !scope.startsWith("/"))) {
73
78
  errors.push(`Context query "${id || "<unknown>"}" scope must start with "/".`);
@@ -23,7 +23,7 @@ const data = (key, alias = key) => field(key, { aliases: alias === key ? [] : [a
23
23
  function buildAgentOperationalModelRegistry(repoRoot) {
24
24
  const lifecycle = { id: id(), title: title(), status: field("status", { filterable: true, contentKeys: ["status"], writeContentKey: "status" }), team_id: ref("team_id", "teamId"), project_id: ref("project_id", "projectId"), workday_id: ref("workday_id", "workdayId"), assignment_id: ref("assignment_id", "assignmentId"), updated_at: updated() };
25
25
  return {
26
- agent_context_query: model({ name: "agent_context_query", aliases: ["agent_context_queries"], collection: "agent-context-queries", entityType: "AgentContextQuery", repoRoot, fields: { id: id(), title: title(), description: data("description"), revision: data("revision"), maturity: data("maturity"), purpose: data("purpose"), query: data("query"), target: data("target"), scope: data("scope"), code_scopes: data("code_scopes", "codeScopes"), relations: refs("relations", "relations"), depth: data("depth"), result_limit: data("result_limit", "resultLimit"), context_budget: data("context_budget", "contextBudget"), token_budget: data("token_budget", "tokenBudget"), format: data("format"), filters: data("filters"), required: data("required") } }),
26
+ agent_context_query: model({ name: "agent_context_query", aliases: ["agent_context_queries"], collection: "agent-context-queries", entityType: "AgentContextQuery", repoRoot, fields: { id: id(), title: title(), description: data("description"), revision: data("revision"), maturity: data("maturity"), purpose: data("purpose"), query: data("query"), target: data("target"), scope: data("scope"), code_scopes: data("code_scopes", "codeScopes"), relations: refs("relations", "relations"), depth: data("depth"), result_limit: data("result_limit", "resultLimit"), context_budget: data("context_budget", "contextBudget"), token_budget: data("token_budget", "tokenBudget"), format: data("format"), filters: data("filters"), sources: data("sources"), requirement: data("requirement"), priority: data("priority"), minimum_budget: data("minimum_budget", "minimumBudget"), maximum_budget: data("maximum_budget", "maximumBudget"), summarization: data("summarization") } }),
27
27
  agent_context_query_set: model({ name: "agent_context_query_set", aliases: ["agent_context_query_sets"], collection: "agent-context-query-sets", entityType: "AgentContextQuerySet", repoRoot, fields: { id: id(), title: title(), description: data("description"), revision: data("revision"), query_refs: refs("query_refs", "queryRefs"), merge_policy: data("merge_policy", "mergePolicy") }, references: [{ field: "query_refs", edgeType: "REFERENCES", targetModels: ["agent_context_query"], multiple: true }] }),
28
28
  agent_instruction_template: model({ name: "agent_instruction_template", aliases: ["agent_instruction_templates"], collection: "agent-instruction-templates", entityType: "AgentInstructionTemplate", repoRoot, fields: { id: id(), title: title(), description: data("description"), revision: data("revision"), kind: data("kind"), instructions: data("instructions"), output_skeleton: data("output_skeleton", "outputSkeleton"), variables: refs("variables", "variables"), applies_to_profiles: refs("applies_to_profiles", "appliesToProfiles") } }),
29
29
  discussion_topic: model({ name: "discussion_topic", aliases: ["discussion_topics"], collection: "discussion-topics", entityType: "DiscussionTopic", repoRoot, fields: { id: id(), title: title(), description: data("description"), slug: field("slug", { filterable: true, contentKeys: ["slug"], writeContentKey: "slug" }), group_ids: refs("group_ids", "groupIds"), parent_topic_id: ref("parent_topic_id", "parentTopicId"), status: field("status", { filterable: true, contentKeys: ["status"], writeContentKey: "status" }) }, references: [{ field: "parent_topic_id", edgeType: "PARENT_OF", targetModels: ["discussion_topic"] }] }),
@@ -309,7 +309,7 @@ function libraryRead(segment, extraArguments = [], extraOptions = []) {
309
309
  description: `${segment[0].toUpperCase()}${segment.slice(1)} project library knowledge.`,
310
310
  kind: "read",
311
311
  arguments: ["project", ...extraArguments].map((name) => ({ name, description: `${name} value.`, required: true })),
312
- options: [{ name: "--ref", description: "Exact commit or protected library ref.", type: "string" }, ...extraOptions],
312
+ options: [{ name: "--ref", description: "Earlier historical revision; omit for the current library.", type: "string" }, ...extraOptions],
313
313
  resultSchemaId: `treeseed.command.library.${segment}/v1`,
314
314
  execution: local(`local.library.${segment}`)
315
315
  };
@@ -0,0 +1,127 @@
1
+ export declare function knowledgeShareOperations(): {
2
+ shares: {
3
+ list: import("../control-plane-operation.js").ControlPlaneOperationBinding<{
4
+ teamId: string;
5
+ }, {}, undefined, {
6
+ items: {
7
+ status: "revoked" | "active" | "expired";
8
+ schemaVersion: "treeseed.knowledge-share/v1";
9
+ id: string;
10
+ createdAt: string;
11
+ updatedAt: string;
12
+ targetTeamId: string;
13
+ projectIds: string[];
14
+ sourceTeamId: string;
15
+ revokedAt: string | null;
16
+ expiresAt?: string | null | undefined;
17
+ operations?: ("read" | "context" | "query" | "graph")[] | undefined;
18
+ paths?: string[] | undefined;
19
+ contentModels?: string[] | undefined;
20
+ }[];
21
+ }>;
22
+ show: import("../control-plane-operation.js").ControlPlaneOperationBinding<{
23
+ teamId: string;
24
+ shareId: string;
25
+ }, {}, undefined, {
26
+ status: "revoked" | "active" | "expired";
27
+ schemaVersion: "treeseed.knowledge-share/v1";
28
+ id: string;
29
+ createdAt: string;
30
+ updatedAt: string;
31
+ targetTeamId: string;
32
+ projectIds: string[];
33
+ sourceTeamId: string;
34
+ revokedAt: string | null;
35
+ expiresAt?: string | null | undefined;
36
+ operations?: ("read" | "context" | "query" | "graph")[] | undefined;
37
+ paths?: string[] | undefined;
38
+ contentModels?: string[] | undefined;
39
+ }>;
40
+ grant: import("../control-plane-operation.js").ControlPlaneOperationBinding<{
41
+ teamId: string;
42
+ }, {}, {
43
+ targetTeamId: string;
44
+ projectIds: string[];
45
+ expiresAt?: string | null | undefined;
46
+ operations?: ("read" | "context" | "query" | "graph")[] | undefined;
47
+ paths?: string[] | undefined;
48
+ contentModels?: string[] | undefined;
49
+ }, {
50
+ status: "revoked" | "active" | "expired";
51
+ schemaVersion: "treeseed.knowledge-share/v1";
52
+ id: string;
53
+ createdAt: string;
54
+ updatedAt: string;
55
+ targetTeamId: string;
56
+ projectIds: string[];
57
+ sourceTeamId: string;
58
+ revokedAt: string | null;
59
+ expiresAt?: string | null | undefined;
60
+ operations?: ("read" | "context" | "query" | "graph")[] | undefined;
61
+ paths?: string[] | undefined;
62
+ contentModels?: string[] | undefined;
63
+ }>;
64
+ revoke: import("../control-plane-operation.js").ControlPlaneOperationBinding<{
65
+ teamId: string;
66
+ shareId: string;
67
+ }, {}, {}, {
68
+ status: "revoked" | "active" | "expired";
69
+ schemaVersion: "treeseed.knowledge-share/v1";
70
+ id: string;
71
+ createdAt: string;
72
+ updatedAt: string;
73
+ targetTeamId: string;
74
+ projectIds: string[];
75
+ sourceTeamId: string;
76
+ revokedAt: string | null;
77
+ expiresAt?: string | null | undefined;
78
+ operations?: ("read" | "context" | "query" | "graph")[] | undefined;
79
+ paths?: string[] | undefined;
80
+ contentModels?: string[] | undefined;
81
+ }>;
82
+ };
83
+ teamSearch: import("../control-plane-operation.js").ControlPlaneOperationBinding<{
84
+ teamId: string;
85
+ }, {}, {
86
+ request: Record<string, unknown>;
87
+ projectIds?: string[] | undefined;
88
+ projectSlugs?: string[] | undefined;
89
+ sharedSources?: {
90
+ teamId: string;
91
+ projectIds?: string[] | undefined;
92
+ }[] | undefined;
93
+ }, Record<string, unknown>>;
94
+ teamQuery: import("../control-plane-operation.js").ControlPlaneOperationBinding<{
95
+ teamId: string;
96
+ }, {}, {
97
+ request: Record<string, unknown>;
98
+ projectIds?: string[] | undefined;
99
+ projectSlugs?: string[] | undefined;
100
+ sharedSources?: {
101
+ teamId: string;
102
+ projectIds?: string[] | undefined;
103
+ }[] | undefined;
104
+ }, Record<string, unknown>>;
105
+ teamContext: import("../control-plane-operation.js").ControlPlaneOperationBinding<{
106
+ teamId: string;
107
+ }, {}, {
108
+ request: Record<string, unknown>;
109
+ projectIds?: string[] | undefined;
110
+ projectSlugs?: string[] | undefined;
111
+ sharedSources?: {
112
+ teamId: string;
113
+ projectIds?: string[] | undefined;
114
+ }[] | undefined;
115
+ }, Record<string, unknown>>;
116
+ teamGraph: import("../control-plane-operation.js").ControlPlaneOperationBinding<{
117
+ teamId: string;
118
+ }, {}, {
119
+ request: Record<string, unknown>;
120
+ projectIds?: string[] | undefined;
121
+ projectSlugs?: string[] | undefined;
122
+ sharedSources?: {
123
+ teamId: string;
124
+ projectIds?: string[] | undefined;
125
+ }[] | undefined;
126
+ }, Record<string, unknown>>;
127
+ };
@@ -0,0 +1,25 @@
1
+ import { z } from "zod";
2
+ import { defineOperation as define } from "../operation-builder.js";
3
+ import { knowledgeShareGrantInputSchema, knowledgeShareSchema, teamKnowledgeRequestSchema } from "../knowledge/contracts.js";
4
+ const none = z.undefined(), empty = z.object({}).strict(), teamPath = z.object({ teamId: z.string().min(1) }).strict();
5
+ const sharePath = z.object({ teamId: z.string().min(1), shareId: z.string().min(1) }).strict();
6
+ const parameters = (operationId) => `treeseed.${operationId}.parameters/v1`;
7
+ const readDescriptor = (operationId, path) => ({ operationId, description: `Read ${operationId}.`, rest: { method: "GET", path }, parameters: parameters(operationId), capability: "knowledge.read", authentication: "oauth", oauthScopes: ["treeseed:read"], kind: "read", riskClass: "ordinary", confirmation: "never", surfaces: ["rest", "cli", "mcp_tool"], cacheScope: "principal", pagination: "none" });
8
+ const execute = (operationId, path) => define({ operationId, description: `Execute ${operationId} across authorized team knowledge.`, rest: { method: "POST", path }, parameters: parameters(operationId), capability: "knowledge.read", authentication: "oauth", oauthScopes: ["treeseed:read"], kind: "read", riskClass: "ordinary", confirmation: "never", surfaces: ["rest", "mcp_tool"], cacheScope: "none", pagination: "none" }, { path: teamPath, query: empty, body: teamKnowledgeRequestSchema, output: z.record(z.unknown()) });
9
+ function knowledgeShareOperations() {
10
+ return {
11
+ shares: {
12
+ list: define(readDescriptor("knowledge.shares.list", "/v1/teams/{teamId}/knowledge/shares"), { path: teamPath, query: empty, body: none, output: z.object({ items: z.array(knowledgeShareSchema) }).strict() }),
13
+ show: define(readDescriptor("knowledge.shares.show", "/v1/teams/{teamId}/knowledge/shares/{shareId}"), { path: sharePath, query: empty, body: none, output: knowledgeShareSchema }),
14
+ grant: define({ operationId: "knowledge.shares.grant", description: "Grant bounded read-only knowledge access to another team.", rest: { method: "POST", path: "/v1/teams/{teamId}/knowledge/shares" }, parameters: parameters("knowledge.shares.grant"), capability: "knowledge.share", authentication: "oauth", oauthScopes: ["treeseed:projects:write"], kind: "mutation", riskClass: "authority", confirmation: "input_required", surfaces: ["rest", "cli", "mcp_tool"], cacheScope: "none", pagination: "none" }, { path: teamPath, query: empty, body: knowledgeShareGrantInputSchema, output: knowledgeShareSchema }),
15
+ revoke: define({ operationId: "knowledge.shares.revoke", description: "Revoke a cross-team knowledge share.", rest: { method: "DELETE", path: "/v1/teams/{teamId}/knowledge/shares/{shareId}" }, parameters: parameters("knowledge.shares.revoke"), capability: "knowledge.share", authentication: "oauth", oauthScopes: ["treeseed:projects:write"], kind: "mutation", riskClass: "authority", confirmation: "input_required", surfaces: ["rest", "cli", "mcp_tool"], cacheScope: "none", pagination: "none" }, { path: sharePath, query: empty, body: empty, output: knowledgeShareSchema })
16
+ },
17
+ teamSearch: execute("knowledge.team.search", "/v1/teams/{teamId}/knowledge/search"),
18
+ teamQuery: execute("knowledge.team.query", "/v1/teams/{teamId}/knowledge/query"),
19
+ teamContext: execute("knowledge.team.context", "/v1/teams/{teamId}/knowledge/context"),
20
+ teamGraph: execute("knowledge.team.graph", "/v1/teams/{teamId}/knowledge/graph")
21
+ };
22
+ }
23
+ export {
24
+ knowledgeShareOperations
25
+ };
@@ -645,6 +645,131 @@ export declare const CONTROL_PLANE_OPERATIONS: {
645
645
  readonly publishReview: import("./control-plane-operation.js").ControlPlaneOperationBinding<{
646
646
  reviewId: string;
647
647
  }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
648
+ readonly shares: {
649
+ list: import("./control-plane-operation.js").ControlPlaneOperationBinding<{
650
+ teamId: string;
651
+ }, {}, undefined, {
652
+ items: {
653
+ status: "revoked" | "active" | "expired";
654
+ schemaVersion: "treeseed.knowledge-share/v1";
655
+ id: string;
656
+ createdAt: string;
657
+ updatedAt: string;
658
+ targetTeamId: string;
659
+ projectIds: string[];
660
+ sourceTeamId: string;
661
+ revokedAt: string | null;
662
+ expiresAt?: string | null | undefined;
663
+ operations?: ("read" | "context" | "query" | "graph")[] | undefined;
664
+ paths?: string[] | undefined;
665
+ contentModels?: string[] | undefined;
666
+ }[];
667
+ }>;
668
+ show: import("./control-plane-operation.js").ControlPlaneOperationBinding<{
669
+ teamId: string;
670
+ shareId: string;
671
+ }, {}, undefined, {
672
+ status: "revoked" | "active" | "expired";
673
+ schemaVersion: "treeseed.knowledge-share/v1";
674
+ id: string;
675
+ createdAt: string;
676
+ updatedAt: string;
677
+ targetTeamId: string;
678
+ projectIds: string[];
679
+ sourceTeamId: string;
680
+ revokedAt: string | null;
681
+ expiresAt?: string | null | undefined;
682
+ operations?: ("read" | "context" | "query" | "graph")[] | undefined;
683
+ paths?: string[] | undefined;
684
+ contentModels?: string[] | undefined;
685
+ }>;
686
+ grant: import("./control-plane-operation.js").ControlPlaneOperationBinding<{
687
+ teamId: string;
688
+ }, {}, {
689
+ targetTeamId: string;
690
+ projectIds: string[];
691
+ expiresAt?: string | null | undefined;
692
+ operations?: ("read" | "context" | "query" | "graph")[] | undefined;
693
+ paths?: string[] | undefined;
694
+ contentModels?: string[] | undefined;
695
+ }, {
696
+ status: "revoked" | "active" | "expired";
697
+ schemaVersion: "treeseed.knowledge-share/v1";
698
+ id: string;
699
+ createdAt: string;
700
+ updatedAt: string;
701
+ targetTeamId: string;
702
+ projectIds: string[];
703
+ sourceTeamId: string;
704
+ revokedAt: string | null;
705
+ expiresAt?: string | null | undefined;
706
+ operations?: ("read" | "context" | "query" | "graph")[] | undefined;
707
+ paths?: string[] | undefined;
708
+ contentModels?: string[] | undefined;
709
+ }>;
710
+ revoke: import("./control-plane-operation.js").ControlPlaneOperationBinding<{
711
+ teamId: string;
712
+ shareId: string;
713
+ }, {}, {}, {
714
+ status: "revoked" | "active" | "expired";
715
+ schemaVersion: "treeseed.knowledge-share/v1";
716
+ id: string;
717
+ createdAt: string;
718
+ updatedAt: string;
719
+ targetTeamId: string;
720
+ projectIds: string[];
721
+ sourceTeamId: string;
722
+ revokedAt: string | null;
723
+ expiresAt?: string | null | undefined;
724
+ operations?: ("read" | "context" | "query" | "graph")[] | undefined;
725
+ paths?: string[] | undefined;
726
+ contentModels?: string[] | undefined;
727
+ }>;
728
+ };
729
+ readonly teamSearch: import("./control-plane-operation.js").ControlPlaneOperationBinding<{
730
+ teamId: string;
731
+ }, {}, {
732
+ request: Record<string, unknown>;
733
+ projectIds?: string[] | undefined;
734
+ projectSlugs?: string[] | undefined;
735
+ sharedSources?: {
736
+ teamId: string;
737
+ projectIds?: string[] | undefined;
738
+ }[] | undefined;
739
+ }, Record<string, unknown>>;
740
+ readonly teamQuery: import("./control-plane-operation.js").ControlPlaneOperationBinding<{
741
+ teamId: string;
742
+ }, {}, {
743
+ request: Record<string, unknown>;
744
+ projectIds?: string[] | undefined;
745
+ projectSlugs?: string[] | undefined;
746
+ sharedSources?: {
747
+ teamId: string;
748
+ projectIds?: string[] | undefined;
749
+ }[] | undefined;
750
+ }, Record<string, unknown>>;
751
+ readonly teamContext: import("./control-plane-operation.js").ControlPlaneOperationBinding<{
752
+ teamId: string;
753
+ }, {}, {
754
+ request: Record<string, unknown>;
755
+ projectIds?: string[] | undefined;
756
+ projectSlugs?: string[] | undefined;
757
+ sharedSources?: {
758
+ teamId: string;
759
+ projectIds?: string[] | undefined;
760
+ }[] | undefined;
761
+ }, Record<string, unknown>>;
762
+ readonly teamGraph: import("./control-plane-operation.js").ControlPlaneOperationBinding<{
763
+ teamId: string;
764
+ }, {}, {
765
+ request: Record<string, unknown>;
766
+ projectIds?: string[] | undefined;
767
+ projectSlugs?: string[] | undefined;
768
+ sharedSources?: {
769
+ teamId: string;
770
+ projectIds?: string[] | undefined;
771
+ }[] | undefined;
772
+ }, Record<string, unknown>>;
648
773
  };
649
774
  readonly governance: {
650
775
  readonly proposals: import("./control-plane-operation.js").ControlPlaneOperationBinding<{
@@ -5,6 +5,7 @@ import { inboxOperations } from "./catalog/inbox-operations.js";
5
5
  import { adminAccountOperations, adminTeamOperations } from "./catalog/admin-account-team-operations.js";
6
6
  import { TREEAI_CONTROL_PLANE_OPERATIONS } from "./catalog/treeai-operations.js";
7
7
  import { capabilityOntologyOperations } from "./catalog/capability-ontology-operations.js";
8
+ import { knowledgeShareOperations } from "./catalog/knowledge-share-operations.js";
8
9
  import { buildControlPlaneCatalog, flattenControlPlaneOperations } from "./catalog/control-plane-catalog.js";
9
10
  const empty = z.object({}).strict();
10
11
  const none = z.undefined();
@@ -187,6 +188,7 @@ const CONTROL_PLANE_OPERATIONS = {
187
188
  updateStatus: resource("discussions.status.update", "POST", "/v1/discussions/{discussionId}/status", { discussionId: z.string().min(1) }, { capability: "discussions.write", scopes: ["treeseed:knowledge:write"], concurrency: true })
188
189
  },
189
190
  knowledge: {
191
+ ...knowledgeShareOperations(),
190
192
  library: resource("knowledge.library.list", "GET", "/v1/knowledge/library", {}, { capability: "knowledge.read", surfaces: ["rest", "mcp_tool", "mcp_resource"], pagination: "cursor" }),
191
193
  reader: resource("knowledge.reader.show", "GET", "/v1/knowledge/reader", {}, { capability: "knowledge.read", surfaces: ["rest", "mcp_resource"] }),
192
194
  context: resource("knowledge.context.show", "GET", "/v1/knowledge/context", {}, { capability: "knowledge.read", surfaces: ["rest", "mcp_tool"] }),
@@ -9,5 +9,6 @@ export * from './oauth.js';
9
9
  export * from './communication/contracts.js';
10
10
  export * from './communication/addressing.js';
11
11
  export * from './inbox/contracts.js';
12
+ export * from './knowledge/contracts.js';
12
13
  export * from '../capacity-provider/capability-ontology.js';
13
14
  export * from './seed/seed-bundle.js';
@@ -9,5 +9,6 @@ export * from "./oauth.js";
9
9
  export * from "./communication/contracts.js";
10
10
  export * from "./communication/addressing.js";
11
11
  export * from "./inbox/contracts.js";
12
+ export * from "./knowledge/contracts.js";
12
13
  export * from "../capacity-provider/capability-ontology.js";
13
14
  export * from "./seed/seed-bundle.js";
@@ -0,0 +1,130 @@
1
+ import { z } from 'zod';
2
+ export declare const knowledgeShareOperationSchema: z.ZodEnum<["read", "query", "context", "graph"]>;
3
+ export declare const knowledgeShareGrantInputSchema: z.ZodObject<{
4
+ targetTeamId: z.ZodString;
5
+ projectIds: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
6
+ contentModels: z.ZodDefault<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>>;
7
+ paths: z.ZodDefault<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>>;
8
+ operations: z.ZodDefault<z.ZodEffects<z.ZodArray<z.ZodEnum<["read", "query", "context", "graph"]>, "many">, ("read" | "context" | "query" | "graph")[], ("read" | "context" | "query" | "graph")[]>>;
9
+ expiresAt: z.ZodDefault<z.ZodNullable<z.ZodString>>;
10
+ }, "strict", z.ZodTypeAny, {
11
+ expiresAt: string | null;
12
+ operations: ("read" | "context" | "query" | "graph")[];
13
+ paths: string[];
14
+ targetTeamId: string;
15
+ projectIds: string[];
16
+ contentModels: string[];
17
+ }, {
18
+ targetTeamId: string;
19
+ projectIds: string[];
20
+ expiresAt?: string | null | undefined;
21
+ operations?: ("read" | "context" | "query" | "graph")[] | undefined;
22
+ paths?: string[] | undefined;
23
+ contentModels?: string[] | undefined;
24
+ }>;
25
+ export declare const knowledgeShareSchema: z.ZodEffects<z.ZodObject<{
26
+ targetTeamId: z.ZodString;
27
+ projectIds: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
28
+ contentModels: z.ZodDefault<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>>;
29
+ paths: z.ZodDefault<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>>;
30
+ operations: z.ZodDefault<z.ZodEffects<z.ZodArray<z.ZodEnum<["read", "query", "context", "graph"]>, "many">, ("read" | "context" | "query" | "graph")[], ("read" | "context" | "query" | "graph")[]>>;
31
+ expiresAt: z.ZodDefault<z.ZodNullable<z.ZodString>>;
32
+ } & {
33
+ schemaVersion: z.ZodLiteral<"treeseed.knowledge-share/v1">;
34
+ id: z.ZodString;
35
+ sourceTeamId: z.ZodString;
36
+ status: z.ZodEnum<["active", "revoked", "expired"]>;
37
+ createdAt: z.ZodString;
38
+ updatedAt: z.ZodString;
39
+ revokedAt: z.ZodNullable<z.ZodString>;
40
+ }, "strict", z.ZodTypeAny, {
41
+ status: "revoked" | "active" | "expired";
42
+ schemaVersion: "treeseed.knowledge-share/v1";
43
+ id: string;
44
+ createdAt: string;
45
+ expiresAt: string | null;
46
+ operations: ("read" | "context" | "query" | "graph")[];
47
+ paths: string[];
48
+ updatedAt: string;
49
+ targetTeamId: string;
50
+ projectIds: string[];
51
+ contentModels: string[];
52
+ sourceTeamId: string;
53
+ revokedAt: string | null;
54
+ }, {
55
+ status: "revoked" | "active" | "expired";
56
+ schemaVersion: "treeseed.knowledge-share/v1";
57
+ id: string;
58
+ createdAt: string;
59
+ updatedAt: string;
60
+ targetTeamId: string;
61
+ projectIds: string[];
62
+ sourceTeamId: string;
63
+ revokedAt: string | null;
64
+ expiresAt?: string | null | undefined;
65
+ operations?: ("read" | "context" | "query" | "graph")[] | undefined;
66
+ paths?: string[] | undefined;
67
+ contentModels?: string[] | undefined;
68
+ }>, {
69
+ status: "revoked" | "active" | "expired";
70
+ schemaVersion: "treeseed.knowledge-share/v1";
71
+ id: string;
72
+ createdAt: string;
73
+ expiresAt: string | null;
74
+ operations: ("read" | "context" | "query" | "graph")[];
75
+ paths: string[];
76
+ updatedAt: string;
77
+ targetTeamId: string;
78
+ projectIds: string[];
79
+ contentModels: string[];
80
+ sourceTeamId: string;
81
+ revokedAt: string | null;
82
+ }, {
83
+ status: "revoked" | "active" | "expired";
84
+ schemaVersion: "treeseed.knowledge-share/v1";
85
+ id: string;
86
+ createdAt: string;
87
+ updatedAt: string;
88
+ targetTeamId: string;
89
+ projectIds: string[];
90
+ sourceTeamId: string;
91
+ revokedAt: string | null;
92
+ expiresAt?: string | null | undefined;
93
+ operations?: ("read" | "context" | "query" | "graph")[] | undefined;
94
+ paths?: string[] | undefined;
95
+ contentModels?: string[] | undefined;
96
+ }>;
97
+ export declare const teamKnowledgeRequestSchema: z.ZodObject<{
98
+ projectIds: z.ZodDefault<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>>;
99
+ projectSlugs: z.ZodDefault<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>>;
100
+ sharedSources: z.ZodDefault<z.ZodArray<z.ZodObject<{
101
+ teamId: z.ZodString;
102
+ projectIds: z.ZodDefault<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>>;
103
+ }, "strict", z.ZodTypeAny, {
104
+ teamId: string;
105
+ projectIds: string[];
106
+ }, {
107
+ teamId: string;
108
+ projectIds?: string[] | undefined;
109
+ }>, "many">>;
110
+ request: z.ZodRecord<z.ZodString, z.ZodUnknown>;
111
+ }, "strict", z.ZodTypeAny, {
112
+ request: Record<string, unknown>;
113
+ projectIds: string[];
114
+ projectSlugs: string[];
115
+ sharedSources: {
116
+ teamId: string;
117
+ projectIds: string[];
118
+ }[];
119
+ }, {
120
+ request: Record<string, unknown>;
121
+ projectIds?: string[] | undefined;
122
+ projectSlugs?: string[] | undefined;
123
+ sharedSources?: {
124
+ teamId: string;
125
+ projectIds?: string[] | undefined;
126
+ }[] | undefined;
127
+ }>;
128
+ export type KnowledgeShare = z.infer<typeof knowledgeShareSchema>;
129
+ export type KnowledgeShareGrantInput = z.infer<typeof knowledgeShareGrantInputSchema>;
130
+ export type TeamKnowledgeRequest = z.infer<typeof teamKnowledgeRequestSchema>;
@@ -0,0 +1,39 @@
1
+ import { z } from "zod";
2
+ const nonEmpty = z.string().trim().min(1);
3
+ const uniqueStrings = (minimum = 0) => z.array(nonEmpty).min(minimum).superRefine((values, context) => {
4
+ if (new Set(values).size !== values.length) context.addIssue({ code: z.ZodIssueCode.custom, message: "Values must be unique." });
5
+ });
6
+ const knowledgeShareOperationSchema = z.enum(["read", "query", "context", "graph"]);
7
+ const knowledgeShareGrantInputSchema = z.object({
8
+ targetTeamId: nonEmpty,
9
+ projectIds: uniqueStrings(1),
10
+ contentModels: uniqueStrings().default([]),
11
+ paths: uniqueStrings(1).default(["**"]),
12
+ operations: z.array(knowledgeShareOperationSchema).min(1).superRefine((values, context) => {
13
+ if (new Set(values).size !== values.length) context.addIssue({ code: z.ZodIssueCode.custom, message: "Operations must be unique." });
14
+ }).default(["read", "query", "context", "graph"]),
15
+ expiresAt: z.string().datetime({ offset: true }).nullable().default(null)
16
+ }).strict();
17
+ const knowledgeShareSchema = knowledgeShareGrantInputSchema.extend({
18
+ schemaVersion: z.literal("treeseed.knowledge-share/v1"),
19
+ id: nonEmpty,
20
+ sourceTeamId: nonEmpty,
21
+ status: z.enum(["active", "revoked", "expired"]),
22
+ createdAt: z.string().datetime({ offset: true }),
23
+ updatedAt: z.string().datetime({ offset: true }),
24
+ revokedAt: z.string().datetime({ offset: true }).nullable()
25
+ }).strict().superRefine((value, context) => {
26
+ if (value.sourceTeamId === value.targetTeamId) context.addIssue({ code: z.ZodIssueCode.custom, path: ["targetTeamId"], message: "Knowledge shares are only for another team." });
27
+ });
28
+ const teamKnowledgeRequestSchema = z.object({
29
+ projectIds: uniqueStrings().default([]),
30
+ projectSlugs: uniqueStrings().default([]),
31
+ sharedSources: z.array(z.object({ teamId: nonEmpty, projectIds: uniqueStrings().default([]) }).strict()).default([]),
32
+ request: z.record(z.unknown())
33
+ }).strict();
34
+ export {
35
+ knowledgeShareGrantInputSchema,
36
+ knowledgeShareOperationSchema,
37
+ knowledgeShareSchema,
38
+ teamKnowledgeRequestSchema
39
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@treeseed/sdk",
3
- "version": "0.13.0-rc.65",
3
+ "version": "0.13.0-rc.66",
4
4
  "description": "Portable TreeSeed contracts, standards, and typed remote control-plane clients.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {