@treeseed/sdk 0.4.13 → 0.5.1

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 (83) hide show
  1. package/dist/control-plane-client.d.ts +60 -1
  2. package/dist/control-plane-client.js +59 -0
  3. package/dist/control-plane.d.ts +1 -1
  4. package/dist/control-plane.js +11 -4
  5. package/dist/d1-store.d.ts +58 -0
  6. package/dist/d1-store.js +64 -0
  7. package/dist/dispatch.js +6 -0
  8. package/dist/graph/schema.js +4 -0
  9. package/dist/index.d.ts +5 -1
  10. package/dist/index.js +32 -0
  11. package/dist/knowledge-coop.d.ts +223 -0
  12. package/dist/knowledge-coop.js +82 -0
  13. package/dist/model-registry.js +79 -0
  14. package/dist/operations/providers/default.js +126 -7
  15. package/dist/operations/services/config-runtime.d.ts +102 -24
  16. package/dist/operations/services/config-runtime.js +896 -160
  17. package/dist/operations/services/deploy.d.ts +223 -15
  18. package/dist/operations/services/deploy.js +626 -55
  19. package/dist/operations/services/github-automation.d.ts +60 -0
  20. package/dist/operations/services/github-automation.js +138 -0
  21. package/dist/operations/services/key-agent.d.ts +118 -0
  22. package/dist/operations/services/key-agent.js +476 -0
  23. package/dist/operations/services/knowledge-coop-launch.d.ts +90 -0
  24. package/dist/operations/services/knowledge-coop-launch.js +753 -0
  25. package/dist/operations/services/knowledge-coop-packaging.d.ts +59 -0
  26. package/dist/operations/services/knowledge-coop-packaging.js +234 -0
  27. package/dist/operations/services/local-dev.d.ts +0 -1
  28. package/dist/operations/services/local-dev.js +1 -14
  29. package/dist/operations/services/project-platform.d.ts +42 -182
  30. package/dist/operations/services/project-platform.js +162 -59
  31. package/dist/operations/services/railway-deploy.d.ts +1 -0
  32. package/dist/operations/services/railway-deploy.js +31 -13
  33. package/dist/operations/services/runtime-tools.d.ts +52 -5
  34. package/dist/operations/services/runtime-tools.js +186 -26
  35. package/dist/operations/services/watch-dev.js +2 -4
  36. package/dist/operations/services/workspace-preflight.d.ts +4 -4
  37. package/dist/operations/services/workspace-preflight.js +22 -20
  38. package/dist/operations-registry.js +7 -2
  39. package/dist/platform/contracts.d.ts +39 -3
  40. package/dist/platform/deploy-config.d.ts +12 -1
  41. package/dist/platform/deploy-config.js +214 -15
  42. package/dist/platform/deploy-runtime.d.ts +1 -0
  43. package/dist/platform/deploy-runtime.js +10 -2
  44. package/dist/platform/env.yaml +93 -61
  45. package/dist/platform/environment.d.ts +13 -2
  46. package/dist/platform/environment.js +90 -20
  47. package/dist/platform/plugins/constants.d.ts +1 -0
  48. package/dist/platform/plugins/constants.js +7 -6
  49. package/dist/platform/tenant/runtime-config.js +8 -1
  50. package/dist/platform/tenant-config.js +4 -0
  51. package/dist/platform/utils/site-config-schema.js +18 -0
  52. package/dist/plugin-default.js +2 -2
  53. package/dist/scripts/key-agent.js +165 -0
  54. package/dist/scripts/tenant-build.js +4 -1
  55. package/dist/scripts/tenant-check.js +4 -1
  56. package/dist/scripts/tenant-deploy.js +43 -4
  57. package/dist/scripts/tenant-dev.js +0 -1
  58. package/dist/sdk-types.d.ts +2 -2
  59. package/dist/sdk-types.js +2 -0
  60. package/dist/sdk.d.ts +13 -0
  61. package/dist/sdk.js +40 -0
  62. package/dist/stores/knowledge-coop-store.d.ts +56 -0
  63. package/dist/stores/knowledge-coop-store.js +482 -0
  64. package/dist/treeseed/template-catalog/templates/starter-basic/template/package.json +6 -2
  65. package/dist/treeseed/template-catalog/templates/starter-basic/template/src/api/server.js +4 -0
  66. package/dist/treeseed/template-catalog/templates/starter-basic/template/src/config.yaml +25 -0
  67. package/dist/treeseed/template-catalog/templates/starter-basic/template/src/content/decisions/adopt-initial-proposal-loop.mdx +22 -0
  68. package/dist/treeseed/template-catalog/templates/starter-basic/template/src/content/people/starter-steward.mdx +11 -0
  69. package/dist/treeseed/template-catalog/templates/starter-basic/template/src/content/proposals/establish-initial-proposal-loop.mdx +17 -0
  70. package/dist/treeseed/template-catalog/templates/starter-basic/template/src/manifest.yaml +17 -10
  71. package/dist/treeseed/template-catalog/templates/starter-basic/template/treeseed.site.yaml +69 -7
  72. package/dist/treeseed/template-catalog/templates/starter-basic/template.config.json +1 -0
  73. package/dist/verification.js +90 -2
  74. package/dist/workflow/operations.d.ts +98 -0
  75. package/dist/workflow/operations.js +229 -7
  76. package/dist/workflow-state.d.ts +54 -2
  77. package/dist/workflow-state.js +170 -24
  78. package/dist/workflow-support.d.ts +1 -1
  79. package/dist/workflow-support.js +32 -2
  80. package/dist/workflow.d.ts +29 -0
  81. package/package.json +1 -1
  82. package/templates/github/deploy.workflow.yml +11 -1
  83. package/dist/scripts/sync-dev-vars.js +0 -6
@@ -9,6 +9,10 @@ site:
9
9
  items:
10
10
  - label: Handbook
11
11
  href: /knowledge/handbook/
12
+ - label: Proposals
13
+ href: /proposals/
14
+ - label: Decisions
15
+ href: /decisions/
12
16
  - label: Build
13
17
  items:
14
18
  - label: Welcome
@@ -38,3 +42,24 @@ models:
38
42
  docs:
39
43
  defaults:
40
44
  tags: []
45
+ notes:
46
+ defaults:
47
+ author: __SITE_NAME__
48
+ draft: false
49
+ tags: []
50
+ questions:
51
+ defaults:
52
+ draft: false
53
+ tags: []
54
+ objectives:
55
+ defaults:
56
+ draft: false
57
+ tags: []
58
+ proposals:
59
+ defaults:
60
+ draft: false
61
+ tags: []
62
+ decisions:
63
+ defaults:
64
+ draft: false
65
+ tags: []
@@ -0,0 +1,22 @@
1
+ ---
2
+ id: decision:adopt-initial-proposal-loop
3
+ title: Adopt The Initial Proposal Loop
4
+ description: Seed the starter with a decision record alongside the initial proposal.
5
+ date: 2026-04-17
6
+ summary: The starter demonstrates that decisions are first-class records, not hidden implementation residue.
7
+ status: live
8
+ decisionType: approved
9
+ rationale: Teams benefit from a visible pattern for recording what was chosen and why.
10
+ authority: Starter template
11
+ primaryContributor: starter-steward
12
+ relatedObjectives: []
13
+ relatedQuestions: []
14
+ relatedNotes: []
15
+ relatedProposals:
16
+ - establish-initial-proposal-loop
17
+ relatedBooks: []
18
+ implements:
19
+ - starter
20
+ ---
21
+
22
+ This starter decision exists to make the proposal-to-decision loop visible in a freshly generated TreeSeed site.
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: Starter Steward
3
+ role: Maintainer
4
+ affiliation: Starter template
5
+ status: live
6
+ tags:
7
+ - stewardship
8
+ - starter
9
+ ---
10
+
11
+ This placeholder profile exists so the starter can model contributor-linked content from the first commit.
@@ -0,0 +1,17 @@
1
+ ---
2
+ id: proposal:establish-initial-proposal-loop
3
+ title: Establish The Initial Proposal Loop
4
+ description: Seed the starter with a proposal so suggested changes are explicit from day one.
5
+ date: 2026-04-17
6
+ summary: The starter should show how a team can move from questions and objectives into a concrete proposal.
7
+ status: live
8
+ proposalType: strategy
9
+ motivation: New sites should inherit a visible proposal-to-decision pattern instead of recreating it ad hoc.
10
+ primaryContributor: starter-steward
11
+ relatedObjectives: []
12
+ relatedQuestions: []
13
+ relatedNotes: []
14
+ relatedBooks: []
15
+ ---
16
+
17
+ Use this starter proposal as a placeholder for the first concrete change a team wants to make in its site or operating model.
@@ -3,17 +3,24 @@ siteConfigPath: ./src/config.yaml
3
3
  content:
4
4
  docs: ./src/content/knowledge
5
5
  pages: ./src/content/pages
6
- notes: ./src/content/empty
7
- questions: ./src/content/empty
8
- objectives: ./src/content/empty
9
- people: ./src/content/empty
10
- agents: ./src/content/empty
11
- books: ./src/content/empty
6
+ notes: ./src/content/notes
7
+ questions: ./src/content/questions
8
+ objectives: ./src/content/objectives
9
+ proposals: ./src/content/proposals
10
+ decisions: ./src/content/decisions
11
+ people: ./src/content/people
12
+ agents: ./src/content/agents
13
+ books: ./src/content/books
14
+ templates: ./src/content/templates
15
+ knowledge_packs: ./src/content/knowledge-packs
16
+ workdays: ./src/content/workdays
12
17
  features:
13
18
  docs: true
14
19
  books: false
15
- notes: false
16
- questions: false
17
- objectives: false
18
- agents: false
20
+ notes: true
21
+ questions: true
22
+ objectives: true
23
+ proposals: true
24
+ decisions: true
25
+ agents: true
19
26
  forms: false
@@ -5,12 +5,14 @@ contactEmail: __CONTACT_EMAIL__
5
5
  hosting:
6
6
  kind: hosted_project
7
7
  registration: optional
8
- marketBaseUrl: https://api.treeseed.ai
8
+ marketBaseUrl: https://knowledge.coop
9
9
  teamId: __SITE_SLUG__
10
10
  projectId: __SITE_SLUG__
11
11
  cloudflare:
12
12
  accountId: replace-with-cloudflare-account-id
13
13
  workerName: __SITE_SLUG__
14
+ queueName: __SITE_SLUG__-agent-work
15
+ dlqName: __SITE_SLUG__-agent-work-dlq
14
16
  pages:
15
17
  projectName: __SITE_SLUG__
16
18
  previewProjectName: __SITE_SLUG__-staging
@@ -23,17 +25,77 @@ cloudflare:
23
25
  manifestKeyTemplate: teams/{teamId}/published/common.json
24
26
  previewRootTemplate: teams/{teamId}/previews
25
27
  previewTtlHours: 168
28
+ surfaces:
29
+ web:
30
+ enabled: true
31
+ provider: cloudflare
32
+ rootDir: .
33
+ publicBaseUrl: https://__SITE_SLUG__.pages.dev
34
+ localBaseUrl: http://127.0.0.1:4321
35
+ api:
36
+ enabled: true
37
+ provider: railway
38
+ rootDir: .
39
+ localBaseUrl: http://127.0.0.1:3000
40
+ services:
41
+ api:
42
+ enabled: true
43
+ provider: railway
44
+ rootDir: .
45
+ publicBaseUrl: https://__SITE_SLUG__-api.up.railway.app
46
+ railway:
47
+ serviceName: __SITE_SLUG__-api
48
+ buildCommand: npm run build
49
+ startCommand: node ./src/api/server.js
50
+ environments:
51
+ local:
52
+ baseUrl: http://127.0.0.1:3000
53
+ manager:
54
+ enabled: true
55
+ provider: railway
56
+ railway:
57
+ serviceName: __SITE_SLUG__-manager
58
+ rootDir: .
59
+ buildCommand: npm run build
60
+ startCommand: node ./node_modules/@treeseed/core/dist/services/manager.js
61
+ schedule: '*/5 * * * *'
62
+ worker:
63
+ enabled: true
64
+ provider: railway
65
+ railway:
66
+ serviceName: __SITE_SLUG__-worker
67
+ rootDir: .
68
+ buildCommand: npm run build
69
+ startCommand: node ./node_modules/@treeseed/core/dist/services/worker.js
70
+ workdayStart:
71
+ enabled: true
72
+ provider: railway
73
+ railway:
74
+ serviceName: __SITE_SLUG__-workday-start
75
+ rootDir: .
76
+ buildCommand: npm run build
77
+ startCommand: node ./node_modules/@treeseed/core/dist/services/workday-start.js
78
+ schedule: '0 9 * * 1-5'
79
+ workdayReport:
80
+ enabled: true
81
+ provider: railway
82
+ railway:
83
+ serviceName: __SITE_SLUG__-workday-report
84
+ rootDir: .
85
+ buildCommand: npm run build
86
+ startCommand: node ./node_modules/@treeseed/core/dist/services/workday-report.js
87
+ schedule: '5 17 * * 1-5'
26
88
  plugins:
27
- - package: '@treeseed/sdk/plugin-default'
89
+ - package: '@treeseed/core/plugin-default'
28
90
  providers:
29
91
  forms: store_only
30
92
  agents:
31
- execution: stub
93
+ execution: copilot
32
94
  mutation: local_branch
33
- repository: stub
34
- verification: stub
35
- notification: stub
36
- research: stub
95
+ repository: git
96
+ verification: local
97
+ notification: sdk_message
98
+ research: project_graph
37
99
  deploy: cloudflare
38
100
  content:
39
101
  runtime: team_scoped_r2_overlay
@@ -78,6 +78,7 @@
78
78
  "astro.config.ts",
79
79
  "tsconfig.json",
80
80
  "treeseed.site.yaml",
81
+ "src/api/server.js",
81
82
  "src/content.config.ts",
82
83
  "src/config.yaml",
83
84
  "src/manifest.yaml",
@@ -1,6 +1,7 @@
1
- import { existsSync, readdirSync, readFileSync } from "node:fs";
1
+ import { existsSync, mkdtempSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
2
2
  import * as childProcess from "node:child_process";
3
- import { basename, resolve } from "node:path";
3
+ import { basename, relative, resolve } from "node:path";
4
+ import { tmpdir } from "node:os";
4
5
  import { fileURLToPath } from "node:url";
5
6
  function defaultWrite(message, stream = "stdout") {
6
7
  if (!message) return;
@@ -38,6 +39,84 @@ function readPackageManifest(packageJsonPath) {
38
39
  return null;
39
40
  }
40
41
  }
42
+ function createWorkspaceActWorkflow(options) {
43
+ const relativePackageRoot = relative(options.workspaceRoot, options.packageRoot).replace(/\\/g, "/");
44
+ const siblingPreparationCommands = options.localTreeseedSiblingDependencies.map((packageName) => {
45
+ const packageDir = `packages/${packageName.split("/")[1]}`;
46
+ const manifest = readPackageManifest(resolve(options.workspaceRoot, packageDir, "package.json"));
47
+ if (!manifest) {
48
+ return null;
49
+ }
50
+ const commands = [
51
+ `if test -f ${packageDir}/package-lock.json; then`,
52
+ ` npm --prefix ${packageDir} ci`,
53
+ "else",
54
+ ` npm --prefix ${packageDir} install --no-audit --no-fund`,
55
+ "fi"
56
+ ];
57
+ if (manifest.scripts?.["build:dist"]) {
58
+ commands.push(`npm --prefix ${packageDir} run build:dist`);
59
+ }
60
+ return commands.join("\n");
61
+ }).filter((command) => Boolean(command)).join("\n");
62
+ const workflowRoot = mkdtempSync(resolve(tmpdir(), "treeseed-verify-act-"));
63
+ const workflowPath = resolve(workflowRoot, "verify.yml");
64
+ writeFileSync(
65
+ workflowPath,
66
+ `name: Treeseed Local Verify
67
+
68
+ on:
69
+ workflow_dispatch:
70
+
71
+ jobs:
72
+ verify:
73
+ runs-on: ubuntu-latest
74
+ defaults:
75
+ run:
76
+ working-directory: ${relativePackageRoot}
77
+ env:
78
+ CI: "true"
79
+ TREESEED_GITHUB_AUTOMATION_MODE: stub
80
+ TREESEED_STAGE_WAIT_MODE: skip
81
+ TREESEED_AGENT_DISABLE_GIT: "true"
82
+ TREESEED_FIXTURE_ID: treeseed-working-site
83
+ steps:
84
+ - name: Checkout
85
+ uses: actions/checkout@v4
86
+ with:
87
+ submodules: recursive
88
+
89
+ - name: Setup Node
90
+ uses: actions/setup-node@v4
91
+ with:
92
+ node-version: 24.12.0
93
+
94
+ - name: Assert node:sqlite availability
95
+ run: node -e "import('node:sqlite').then(() => console.log('node:sqlite available')).catch((error) => { console.error(error); process.exit(1); })"
96
+
97
+ ${siblingPreparationCommands ? ` - name: Prepare sibling packages
98
+ working-directory: .
99
+ run: |
100
+ ${siblingPreparationCommands.split("\n").map((line) => ` ${line}`).join("\n")}
101
+
102
+ ` : ""} - name: Install dependencies
103
+ run: |
104
+ if test -f package-lock.json; then
105
+ npm ci
106
+ else
107
+ npm install --no-audit --no-fund
108
+ fi
109
+
110
+ - name: Verify package
111
+ run: npm run verify:direct
112
+ `,
113
+ "utf8"
114
+ );
115
+ return {
116
+ cwd: options.workspaceRoot,
117
+ args: ["act", options.eventName, "-W", workflowPath, "-j", "verify"]
118
+ };
119
+ }
41
120
  function findWorkspaceRoot(packageRoot) {
42
121
  let current = packageRoot;
43
122
  while (true) {
@@ -150,6 +229,15 @@ function runTreeseedVerifyDriver(options = {}) {
150
229
  write(detail || "Treeseed verify requires a running Docker daemon when TREESEED_VERIFY_DRIVER=act.", "stderr");
151
230
  return 1;
152
231
  }
232
+ if (status.workspaceRoot && status.localTreeseedSiblingDependencies.length > 0) {
233
+ const workspaceAct = createWorkspaceActWorkflow({
234
+ workspaceRoot: status.workspaceRoot,
235
+ packageRoot: status.packageRoot,
236
+ eventName: status.eventName,
237
+ localTreeseedSiblingDependencies: status.localTreeseedSiblingDependencies
238
+ });
239
+ return runCommand("gh", workspaceAct.args, workspaceAct.cwd);
240
+ }
153
241
  return runCommand("gh", ["act", status.eventName, "-W", ".github/workflows/verify.yml", "-j", "verify"], status.packageRoot);
154
242
  }
155
243
  if (status.prefersDirectForLocalWorkspace) {
@@ -45,8 +45,81 @@ type WorkflowRepoReport = {
45
45
  export declare function workflowStatus(helpers: WorkflowOperationHelpers): Promise<TreeseedWorkflowResult<import("../workflow-state.ts").TreeseedWorkflowState>>;
46
46
  export declare function workflowTasks(helpers: WorkflowOperationHelpers): Promise<TreeseedWorkflowResult<{
47
47
  tasks: TreeseedTaskBranchMetadata[];
48
+ workstreams: Array<{
49
+ id: string;
50
+ title: string;
51
+ linkedDirectRefs: Array<{
52
+ model: "objective" | "question" | "note";
53
+ id: string;
54
+ }>;
55
+ branch: string;
56
+ local: boolean;
57
+ remote: boolean;
58
+ current: boolean;
59
+ previewUrl: string | null;
60
+ lastSaveAt: string | null;
61
+ verificationResult: "ready" | "needs_attention" | "unknown";
62
+ stagingCandidate: boolean;
63
+ archived: boolean;
64
+ }>;
48
65
  }>>;
49
66
  export declare function workflowConfig(helpers: WorkflowOperationHelpers, input?: TreeseedConfigInput): Promise<TreeseedWorkflowResult<{
67
+ mode: string;
68
+ scopes: ("local" | "staging" | "prod")[];
69
+ sync: "none" | "cloudflare" | "railway" | "github" | "all" | undefined;
70
+ configPath: string;
71
+ keyPath: string;
72
+ repairs: unknown[];
73
+ preflight: {
74
+ ok: boolean;
75
+ requireAuth: boolean;
76
+ missingCommands: string[];
77
+ failingAuth: string[];
78
+ checks: {
79
+ commands: {
80
+ [k: string]: {
81
+ installed: boolean;
82
+ path: string | null;
83
+ };
84
+ };
85
+ auth: {};
86
+ };
87
+ };
88
+ toolHealth: {
89
+ githubCli: {
90
+ name: any;
91
+ available: any;
92
+ detail: any;
93
+ };
94
+ ghActExtension: {
95
+ name: any;
96
+ available: any;
97
+ detail: any;
98
+ };
99
+ dockerDaemon: {
100
+ name: any;
101
+ available: any;
102
+ detail: any;
103
+ };
104
+ wranglerCli: {
105
+ name: any;
106
+ available: any;
107
+ detail: any;
108
+ };
109
+ railwayCli: {
110
+ name: any;
111
+ available: any;
112
+ detail: any;
113
+ };
114
+ actVerificationReady: any;
115
+ remediation: string[];
116
+ };
117
+ market: any;
118
+ connection: import("../sdk-types.ts").ProjectConnection | null;
119
+ runnerTokenIssued: boolean;
120
+ } & {
121
+ finalState?: WorkflowStatePayload;
122
+ }> | TreeseedWorkflowResult<{
50
123
  mode: string;
51
124
  scopes: ("local" | "staging" | "prod")[];
52
125
  sync: "none" | "cloudflare" | "railway" | "github" | "all";
@@ -66,6 +139,7 @@ export declare function workflowConfig(helpers: WorkflowOperationHelpers, input?
66
139
  ready: any;
67
140
  detail: any;
68
141
  }[];
142
+ issues: any[];
69
143
  };
70
144
  }[];
71
145
  repairs: import("../operations/services/config-runtime.ts").TreeseedRepairAction[];
@@ -100,9 +174,21 @@ export declare function workflowConfig(helpers: WorkflowOperationHelpers, input?
100
174
  available: any;
101
175
  detail: any;
102
176
  };
177
+ wranglerCli: {
178
+ name: any;
179
+ available: any;
180
+ detail: any;
181
+ };
182
+ railwayCli: {
183
+ name: any;
184
+ available: any;
185
+ detail: any;
186
+ };
103
187
  actVerificationReady: any;
104
188
  remediation: string[];
105
189
  };
190
+ context: import("../operations/services/config-runtime.ts").TreeseedCollectedConfigContext;
191
+ secretSession: import("../operations/services/config-runtime.ts").TreeseedConfigSecretSessionBootstrap;
106
192
  } & {
107
193
  finalState?: WorkflowStatePayload;
108
194
  }> | TreeseedWorkflowResult<{
@@ -142,9 +228,21 @@ export declare function workflowConfig(helpers: WorkflowOperationHelpers, input?
142
228
  available: any;
143
229
  detail: any;
144
230
  };
231
+ wranglerCli: {
232
+ name: any;
233
+ available: any;
234
+ detail: any;
235
+ };
236
+ railwayCli: {
237
+ name: any;
238
+ available: any;
239
+ detail: any;
240
+ };
145
241
  actVerificationReady: any;
146
242
  remediation: string[];
147
243
  };
244
+ context: import("../operations/services/config-runtime.ts").TreeseedCollectedConfigContext;
245
+ secretSession: import("../operations/services/config-runtime.ts").TreeseedConfigSecretSessionBootstrap;
148
246
  } & {
149
247
  finalState?: WorkflowStatePayload;
150
248
  }>>;