@treeseed/sdk 0.6.16 → 0.6.18

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 (47) hide show
  1. package/dist/db/d1.d.ts +3493 -0
  2. package/dist/db/d1.js +8 -0
  3. package/dist/db/index.d.ts +2 -0
  4. package/dist/db/index.js +2 -0
  5. package/dist/db/node-sqlite.d.ts +3544 -0
  6. package/dist/db/node-sqlite.js +119 -0
  7. package/dist/db/schema.d.ts +6272 -0
  8. package/dist/db/schema.js +231 -0
  9. package/dist/index.d.ts +1 -0
  10. package/dist/index.js +1 -0
  11. package/dist/operations/providers/default.js +1 -0
  12. package/dist/operations/services/commit-message-provider.d.ts +33 -1
  13. package/dist/operations/services/commit-message-provider.js +228 -51
  14. package/dist/operations/services/config-runtime.js +0 -1
  15. package/dist/operations/services/deploy.d.ts +19 -5
  16. package/dist/operations/services/deploy.js +75 -36
  17. package/dist/operations/services/github-actions-verification.d.ts +123 -0
  18. package/dist/operations/services/github-actions-verification.js +440 -0
  19. package/dist/operations/services/mailpit-runtime.d.ts +5 -0
  20. package/dist/operations/services/mailpit-runtime.js +2 -2
  21. package/dist/operations/services/repository-save-orchestrator.js +64 -8
  22. package/dist/operations/services/runtime-tools.d.ts +6 -0
  23. package/dist/operations/services/runtime-tools.js +11 -0
  24. package/dist/operations-registry.js +1 -0
  25. package/dist/platform/contracts.d.ts +6 -0
  26. package/dist/platform/deploy-config.js +17 -0
  27. package/dist/reconcile/builtin-adapters.js +2 -16
  28. package/dist/reconcile/contracts.d.ts +1 -1
  29. package/dist/reconcile/desired-state.d.ts +6 -0
  30. package/dist/reconcile/desired-state.js +1 -13
  31. package/dist/reconcile/engine.d.ts +12 -0
  32. package/dist/reconcile/state.js +2 -1
  33. package/dist/reconcile/units.js +0 -1
  34. package/dist/scripts/tenant-d1-migrate-local.js +5 -2
  35. package/dist/scripts/tenant-destroy.js +3 -1
  36. package/dist/sdk.js +2 -6
  37. package/dist/types/cloudflare.d.ts +0 -1
  38. package/dist/workflow/operations.d.ts +2 -1
  39. package/dist/workflow/operations.js +115 -35
  40. package/dist/workflow-support.d.ts +1 -0
  41. package/dist/workflow-support.js +6 -0
  42. package/dist/workflow.d.ts +24 -2
  43. package/dist/workflow.js +6 -0
  44. package/package.json +19 -5
  45. package/templates/github/deploy.workflow.yml +4 -0
  46. package/dist/wrangler-d1.d.ts +0 -25
  47. package/dist/wrangler-d1.js +0 -89
@@ -0,0 +1,231 @@
1
+ import { index, integer, primaryKey, sqliteTable, text, uniqueIndex } from "drizzle-orm/sqlite-core";
2
+ const betterAuthUser = sqliteTable("better_auth_user", {
3
+ id: text("id").primaryKey(),
4
+ name: text("name").notNull(),
5
+ email: text("email").notNull().unique(),
6
+ username: text("username").unique(),
7
+ firstName: text("firstName"),
8
+ lastName: text("lastName"),
9
+ emailVerified: integer("emailVerified", { mode: "boolean" }).notNull().default(false),
10
+ image: text("image"),
11
+ createdAt: integer("createdAt", { mode: "timestamp_ms" }).notNull(),
12
+ updatedAt: integer("updatedAt", { mode: "timestamp_ms" }).notNull()
13
+ });
14
+ const betterAuthSession = sqliteTable("better_auth_session", {
15
+ id: text("id").primaryKey(),
16
+ expiresAt: integer("expiresAt", { mode: "timestamp_ms" }).notNull(),
17
+ token: text("token").notNull().unique(),
18
+ createdAt: integer("createdAt", { mode: "timestamp_ms" }).notNull(),
19
+ updatedAt: integer("updatedAt", { mode: "timestamp_ms" }).notNull(),
20
+ ipAddress: text("ipAddress"),
21
+ userAgent: text("userAgent"),
22
+ userId: text("userId").notNull().references(() => betterAuthUser.id, { onDelete: "cascade" })
23
+ });
24
+ const betterAuthAccount = sqliteTable("better_auth_account", {
25
+ id: text("id").primaryKey(),
26
+ accountId: text("accountId").notNull(),
27
+ providerId: text("providerId").notNull(),
28
+ userId: text("userId").notNull().references(() => betterAuthUser.id, { onDelete: "cascade" }),
29
+ accessToken: text("accessToken"),
30
+ refreshToken: text("refreshToken"),
31
+ idToken: text("idToken"),
32
+ accessTokenExpiresAt: integer("accessTokenExpiresAt", { mode: "timestamp_ms" }),
33
+ refreshTokenExpiresAt: integer("refreshTokenExpiresAt", { mode: "timestamp_ms" }),
34
+ scope: text("scope"),
35
+ password: text("password"),
36
+ createdAt: integer("createdAt", { mode: "timestamp_ms" }).notNull(),
37
+ updatedAt: integer("updatedAt", { mode: "timestamp_ms" }).notNull()
38
+ }, (table) => [
39
+ uniqueIndex("idx_better_auth_account_provider_account").on(table.providerId, table.accountId)
40
+ ]);
41
+ const betterAuthVerification = sqliteTable("better_auth_verification", {
42
+ id: text("id").primaryKey(),
43
+ identifier: text("identifier").notNull(),
44
+ value: text("value").notNull(),
45
+ expiresAt: integer("expiresAt", { mode: "timestamp_ms" }).notNull(),
46
+ createdAt: integer("createdAt", { mode: "timestamp_ms" }).notNull(),
47
+ updatedAt: integer("updatedAt", { mode: "timestamp_ms" }).notNull()
48
+ });
49
+ const users = sqliteTable("users", {
50
+ id: text("id").primaryKey(),
51
+ email: text("email"),
52
+ username: text("username").unique(),
53
+ displayName: text("display_name"),
54
+ status: text("status").notNull().default("active"),
55
+ metadataJson: text("metadata_json"),
56
+ createdAt: text("created_at").notNull(),
57
+ updatedAt: text("updated_at").notNull()
58
+ });
59
+ const userIdentities = sqliteTable("user_identities", {
60
+ id: text("id").primaryKey(),
61
+ userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
62
+ provider: text("provider").notNull(),
63
+ providerSubject: text("provider_subject").notNull(),
64
+ email: text("email"),
65
+ emailVerified: integer("email_verified", { mode: "boolean" }).notNull().default(false),
66
+ profileJson: text("profile_json"),
67
+ createdAt: text("created_at").notNull(),
68
+ updatedAt: text("updated_at").notNull()
69
+ }, (table) => [
70
+ uniqueIndex("idx_user_identities_provider_subject").on(table.provider, table.providerSubject)
71
+ ]);
72
+ const roles = sqliteTable("roles", {
73
+ id: text("id").primaryKey(),
74
+ key: text("key").notNull().unique(),
75
+ description: text("description"),
76
+ createdAt: text("created_at").notNull()
77
+ });
78
+ const permissions = sqliteTable("permissions", {
79
+ id: text("id").primaryKey(),
80
+ key: text("key").notNull().unique(),
81
+ resource: text("resource").notNull(),
82
+ action: text("action").notNull(),
83
+ scope: text("scope").notNull(),
84
+ description: text("description"),
85
+ createdAt: text("created_at").notNull()
86
+ });
87
+ const rolePermissions = sqliteTable("role_permissions", {
88
+ roleId: text("role_id").notNull().references(() => roles.id, { onDelete: "cascade" }),
89
+ permissionId: text("permission_id").notNull().references(() => permissions.id, { onDelete: "cascade" }),
90
+ createdAt: text("created_at").notNull()
91
+ }, (table) => [
92
+ primaryKey({ columns: [table.roleId, table.permissionId] })
93
+ ]);
94
+ const userRoleBindings = sqliteTable("user_role_bindings", {
95
+ id: text("id").primaryKey(),
96
+ userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
97
+ roleId: text("role_id").notNull().references(() => roles.id, { onDelete: "cascade" }),
98
+ createdAt: text("created_at").notNull()
99
+ }, (table) => [
100
+ uniqueIndex("idx_user_role_bindings_user_role").on(table.userId, table.roleId)
101
+ ]);
102
+ const teams = sqliteTable("teams", {
103
+ id: text("id").primaryKey(),
104
+ slug: text("slug").notNull().unique(),
105
+ name: text("name").notNull().unique(),
106
+ displayName: text("display_name"),
107
+ logoUrl: text("logo_url"),
108
+ profileSummary: text("profile_summary"),
109
+ metadataJson: text("metadata_json"),
110
+ createdAt: text("created_at").notNull(),
111
+ updatedAt: text("updated_at").notNull()
112
+ });
113
+ const teamInvites = sqliteTable("team_invites", {
114
+ id: text("id").primaryKey(),
115
+ teamId: text("team_id").notNull().references(() => teams.id, { onDelete: "cascade" }),
116
+ email: text("email").notNull(),
117
+ roleKey: text("role_key").notNull(),
118
+ tokenPrefix: text("token_prefix").notNull(),
119
+ tokenHash: text("token_hash").notNull(),
120
+ status: text("status").notNull().default("pending"),
121
+ invitedByUserId: text("invited_by_user_id").references(() => users.id, { onDelete: "set null" }),
122
+ acceptedByUserId: text("accepted_by_user_id").references(() => users.id, { onDelete: "set null" }),
123
+ acceptedAt: text("accepted_at"),
124
+ expiresAt: text("expires_at").notNull(),
125
+ createdAt: text("created_at").notNull(),
126
+ updatedAt: text("updated_at").notNull()
127
+ }, (table) => [
128
+ index("idx_team_invites_team_status").on(table.teamId, table.status, table.createdAt),
129
+ index("idx_team_invites_token_prefix").on(table.tokenPrefix)
130
+ ]);
131
+ const teamMemberships = sqliteTable("team_memberships", {
132
+ id: text("id").primaryKey(),
133
+ teamId: text("team_id").notNull().references(() => teams.id, { onDelete: "cascade" }),
134
+ userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
135
+ status: text("status").notNull().default("active"),
136
+ createdAt: text("created_at").notNull(),
137
+ updatedAt: text("updated_at").notNull()
138
+ }, (table) => [
139
+ uniqueIndex("idx_team_memberships_team_user").on(table.teamId, table.userId)
140
+ ]);
141
+ const webSessions = sqliteTable("web_sessions", {
142
+ id: text("id").primaryKey(),
143
+ userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
144
+ identityId: text("identity_id"),
145
+ betterAuthSessionId: text("better_auth_session_id"),
146
+ provider: text("provider").notNull(),
147
+ providerSubject: text("provider_subject").notNull(),
148
+ email: text("email"),
149
+ displayName: text("display_name"),
150
+ principalJson: text("principal_json").notNull(),
151
+ ipAddress: text("ip_address"),
152
+ userAgent: text("user_agent"),
153
+ authenticatedAt: text("authenticated_at").notNull(),
154
+ lastSeenAt: text("last_seen_at").notNull(),
155
+ expiresAt: text("expires_at").notNull(),
156
+ revokedAt: text("revoked_at"),
157
+ createdAt: text("created_at").notNull(),
158
+ updatedAt: text("updated_at").notNull()
159
+ });
160
+ const projects = sqliteTable("projects", {
161
+ id: text("id").primaryKey(),
162
+ teamId: text("team_id").notNull().references(() => teams.id, { onDelete: "cascade" }),
163
+ slug: text("slug").notNull(),
164
+ name: text("name").notNull(),
165
+ description: text("description"),
166
+ metadataJson: text("metadata_json"),
167
+ createdAt: text("created_at").notNull(),
168
+ updatedAt: text("updated_at").notNull()
169
+ }, (table) => [
170
+ uniqueIndex("idx_projects_team_slug").on(table.teamId, table.slug)
171
+ ]);
172
+ const remoteJobs = sqliteTable("remote_jobs", {
173
+ id: text("id").primaryKey(),
174
+ projectId: text("project_id").notNull().references(() => projects.id, { onDelete: "cascade" }),
175
+ namespace: text("namespace").notNull(),
176
+ operation: text("operation").notNull(),
177
+ status: text("status").notNull(),
178
+ preferredMode: text("preferred_mode"),
179
+ selectedTarget: text("selected_target"),
180
+ requestedByType: text("requested_by_type").notNull(),
181
+ requestedById: text("requested_by_id"),
182
+ inputJson: text("input_json"),
183
+ outputJson: text("output_json"),
184
+ errorJson: text("error_json"),
185
+ idempotencyKey: text("idempotency_key"),
186
+ createdAt: text("created_at").notNull(),
187
+ updatedAt: text("updated_at").notNull(),
188
+ startedAt: text("started_at"),
189
+ finishedAt: text("finished_at")
190
+ });
191
+ const treeseedSchema = {
192
+ better_auth_user: betterAuthUser,
193
+ better_auth_session: betterAuthSession,
194
+ better_auth_account: betterAuthAccount,
195
+ better_auth_verification: betterAuthVerification,
196
+ user: betterAuthUser,
197
+ session: betterAuthSession,
198
+ account: betterAuthAccount,
199
+ verification: betterAuthVerification,
200
+ users,
201
+ userIdentities,
202
+ roles,
203
+ permissions,
204
+ rolePermissions,
205
+ userRoleBindings,
206
+ teams,
207
+ teamInvites,
208
+ teamMemberships,
209
+ webSessions,
210
+ projects,
211
+ remoteJobs
212
+ };
213
+ export {
214
+ betterAuthAccount,
215
+ betterAuthSession,
216
+ betterAuthUser,
217
+ betterAuthVerification,
218
+ permissions,
219
+ projects,
220
+ remoteJobs,
221
+ rolePermissions,
222
+ roles,
223
+ teamInvites,
224
+ teamMemberships,
225
+ teams,
226
+ treeseedSchema,
227
+ userIdentities,
228
+ userRoleBindings,
229
+ users,
230
+ webSessions
231
+ };
package/dist/index.d.ts CHANGED
@@ -26,6 +26,7 @@ export { TREESEED_REMOTE_CONTRACT_HEADER, TREESEED_REMOTE_CONTRACT_VERSION, Clou
26
26
  export { TRESEED_OPERATION_SPECS, findTreeseedOperation, listTreeseedOperationNames, } from './operations-registry.ts';
27
27
  export { TreeseedOperationsSdk } from './operations/runtime.ts';
28
28
  export { TreeseedWorkflowSdk } from './workflow.ts';
29
+ export * from './db/index.ts';
29
30
  export { collectTreeseedReconcileStatus, createTreeseedReconcileRegistry, deriveTreeseedDesiredUnits, destroyTreeseedTargetUnits, observeTreeseedUnits, planTreeseedReconciliation, reconcileTreeseedTarget, } from './reconcile/index.ts';
30
31
  export { getTreeseedVerifyDriverStatus, runTreeseedVerifyDriver } from './verification.ts';
31
32
  export type { KnowledgeCoopLaunchPreflightReport, KnowledgeCoopLaunchFailurePhase, KnowledgeCoopManagedLaunchInput, KnowledgeCoopManagedLaunchResult, AgentMessageKind, AgentMessageRecord, AgentStatusRecord, DirectBoardItemSummary, InboxItem, KnowledgeCoopJobStatus, LaunchProjectRequest, LaunchProjectResult, LinkedProjectRecordRef, ProjectConnectionStatus, ProjectOverviewSummary, ReleaseDetail, ReleaseState, ReleaseSummary, SharePackageState, SharePackageStatus, TeamCapability, TeamHomeSummary, TeamMemberSummary, WorkstreamDetail, WorkstreamEvent, WorkstreamState, WorkstreamSummary, SdkContentEntry, SdkDispatchCapability, SdkDispatchConfig, SdkDispatchCredentialSource, SdkDispatchExecutionClass, SdkDispatchNamespace, SdkDispatchPolicy, SdkDispatchRequest, SdkDispatchResult, SdkDispatchTarget, SdkCursorEntity, SdkFilterCondition, SdkFollowRequest, SdkGraphEdge, SdkGraphEdgeType, SdkGraphDslRelation, SdkGraphDslParseResult, SdkGraphModelConfig, SdkGraphNode, SdkGraphNodeType, SdkGraphPathExplanation, SdkGraphQueryStage, SdkGraphQueryView, SdkGraphQueryOptions, SdkGraphQueryRequest, SdkGraphQueryResult, SdkGraphRankingBuildInput, SdkGraphRankingDiagnostics, SdkGraphRankingIndex, SdkGraphRankingNodeResult, SdkGraphRankingProvider, SdkGraphRankingQueryRequest, SdkGraphRankingQueryResult, SdkGraphRankingSearchRequest, SdkGraphRefreshPayload, SdkGraphRefreshRequest, SdkGraphSearchOptions, SdkGraphSearchResult, SdkGraphSeed, SdkGraphSeedResolution, SdkGraphTraversalResult, SdkGraphWhereFilter, SdkContextPack, SdkContextPackRequest, SdkGetRequest, SdkJsonEnvelope, SdkLeaseEntity, SdkManagerContextPayload, SdkMessageEntity, SdkModelFieldBinding, SdkModelDefinition, SdkModelRegistry, SdkModelName, SdkMutationRequest, SdkOperation, SdkPickRequest, SdkPickResult, SdkQueueMessageEnvelope, SdkRunEntity, SdkSearchRequest, SdkTaskEntity, SdkTaskEventEntity, SdkTaskOutputEntity, SdkWorkDayEntity, SdkGraphRunEntity, SdkReportEntity, SdkSubscriptionEntity, SdkTemplateCatalogEntry, SdkTemplateCatalogPublisher, SdkTemplateCatalogResponse, SdkTemplateCatalogSource, SdkUpdateRequest, ProjectCapabilityGrant, ProjectConnection, ProjectConnectionMode, ProjectDeployment, ProjectDeploymentKind, ProjectDeploymentStatus, ProjectEnvironment, ProjectExecutionOwner, ProjectHosting, ProjectInfrastructureResource, ProjectInfrastructureResourceKind, ProjectInfrastructureResourceProvider, ProjectRunnerRegistrationState, RemoteJob, RemoteJobEvent, RemoteJobStatus, AgentPool, AgentPoolAutoscalePolicy, AgentPoolRegistration, AgentPoolScaleDecision, AgentPoolStatus, CatalogArtifactVersion, CatalogItem, CatalogItemFilters, CatalogItemOfferMode, ProjectEnvironmentName, ProjectWorkdaySummary, TreeseedHostingKind, TreeseedHostingRegistration, PriorityOverride, WorkdayWindow, WorkdaySchedule, TaskCreditWeight, TaskCreditBudget, WorkdayPolicy, PrioritySnapshotItem, PrioritySnapshot, TaskCreditLedgerEntry, ScaleDecision, TeamStorageLocator, UpsertAgentPoolRequest, UpsertCatalogArtifactVersionRequest, UpsertCatalogItemRequest, UpsertProjectEnvironmentRequest, UpsertProjectHostingRequest, UpsertProjectInfrastructureResourceRequest, UpsertTeamStorageLocatorRequest, CreateProjectDeploymentRequest, RecordAgentPoolRegistrationRequest, WorkerPoolScaleResult, WorkerPoolScaler, } from './sdk-types.ts';
package/dist/index.js CHANGED
@@ -143,6 +143,7 @@ import {
143
143
  } from "./operations-registry.js";
144
144
  import { TreeseedOperationsSdk } from "./operations/runtime.js";
145
145
  import { TreeseedWorkflowSdk } from "./workflow.js";
146
+ export * from "./db/index.js";
146
147
  import {
147
148
  collectTreeseedReconcileStatus,
148
149
  createTreeseedReconcileRegistry,
@@ -625,6 +625,7 @@ class DefaultTreeseedOperationsProvider {
625
625
  constructor() {
626
626
  this.operations = [
627
627
  new WorkflowOperation("status"),
628
+ new WorkflowOperation("ci"),
628
629
  new WorkflowOperation("tasks"),
629
630
  new WorkflowOperation("switch", "switch"),
630
631
  new WorkflowOperation("save"),
@@ -1,5 +1,28 @@
1
1
  export declare const DEFAULT_COMMIT_AI_MODEL = "@cf/google/gemma-4-26b-a4b-it";
2
2
  export type CommitMessageProviderMode = 'auto' | 'cloudflare' | 'fallback' | 'generated';
3
+ export type CommitMessageDependencyUpdate = {
4
+ packageName: string;
5
+ field?: string | null;
6
+ from: string;
7
+ to: string;
8
+ tagName?: string | null;
9
+ };
10
+ export type CommitMessageSubmodulePointer = {
11
+ path: string;
12
+ oldSha: string | null;
13
+ newSha: string | null;
14
+ packageName?: string | null;
15
+ };
16
+ export type CommitMessagePackageChange = {
17
+ name: string;
18
+ path: string;
19
+ oldSha?: string | null;
20
+ newSha?: string | null;
21
+ tagName?: string | null;
22
+ version?: string | null;
23
+ dependencySpec?: string | null;
24
+ commitSubject?: string | null;
25
+ };
3
26
  export type CommitMessageContext = {
4
27
  repoName: string;
5
28
  repoPath: string;
@@ -10,6 +33,9 @@ export type CommitMessageContext = {
10
33
  diff: string;
11
34
  plannedVersion: string | null;
12
35
  plannedTag: string | null;
36
+ dependencyUpdates?: CommitMessageDependencyUpdate[];
37
+ submodulePointers?: CommitMessageSubmodulePointer[];
38
+ packageChanges?: CommitMessagePackageChange[];
13
39
  userMessage?: string;
14
40
  };
15
41
  export type CommitMessageResult = {
@@ -27,7 +53,13 @@ type CommitMessageOptions = {
27
53
  env?: NodeJS.ProcessEnv;
28
54
  fetchImpl?: typeof fetch;
29
55
  };
30
- export declare function formatCommitMessage(type: string, scope: string, summary: string, bullets: string[]): string;
56
+ export type CommitMessageSections = {
57
+ intent?: string[];
58
+ changes: string[];
59
+ packageChanges?: string[];
60
+ dependencyUpdates?: string[];
61
+ };
62
+ export declare function formatCommitMessage(type: string, scope: string, summary: string, sections: CommitMessageSections | string[]): string;
31
63
  export declare function generateFallbackCommitMessage(context: CommitMessageContext): string;
32
64
  export declare function generateRepositoryCommitMessage(context: CommitMessageContext, options?: CommitMessageOptions): Promise<CommitMessageResult>;
33
65
  export {};