@treeseed/sdk 0.10.6 → 0.10.8

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 (50) hide show
  1. package/dist/api/auth/d1-provider.d.ts +5 -0
  2. package/dist/api/auth/d1-provider.js +3 -0
  3. package/dist/api/auth/d1-store.d.ts +5 -0
  4. package/dist/api/auth/d1-store.js +62 -0
  5. package/dist/api/auth/memory-provider.d.ts +5 -0
  6. package/dist/api/auth/memory-provider.js +41 -0
  7. package/dist/api/types.d.ts +5 -0
  8. package/dist/index.d.ts +2 -0
  9. package/dist/index.js +58 -0
  10. package/dist/market-client.d.ts +119 -0
  11. package/dist/market-client.js +79 -0
  12. package/dist/operations/repository-operations.d.ts +129 -0
  13. package/dist/operations/repository-operations.js +634 -0
  14. package/dist/operations/services/config-runtime.d.ts +7 -6
  15. package/dist/operations/services/config-runtime.js +45 -25
  16. package/dist/operations/services/deploy.d.ts +42 -0
  17. package/dist/operations/services/deploy.js +1 -1
  18. package/dist/operations/services/project-platform.d.ts +41 -1
  19. package/dist/operations/services/project-platform.js +14 -1
  20. package/dist/operations/services/railway-api.d.ts +35 -1
  21. package/dist/operations/services/railway-api.js +240 -35
  22. package/dist/operations/services/railway-deploy.d.ts +16 -234
  23. package/dist/operations/services/railway-deploy.js +177 -62
  24. package/dist/operations/services/release-candidate.js +1 -2
  25. package/dist/operations/services/runtime-tools.d.ts +14 -0
  26. package/dist/operations/services/runtime-tools.js +15 -1
  27. package/dist/operations/services/workspace-save.d.ts +24 -0
  28. package/dist/operations/services/workspace-save.js +143 -3
  29. package/dist/operations/services/workspace-tools.js +1 -1
  30. package/dist/platform/env.yaml +163 -2
  31. package/dist/platform/environment.d.ts +1 -0
  32. package/dist/platform/environment.js +9 -0
  33. package/dist/platform-operation-store.d.ts +90 -0
  34. package/dist/platform-operation-store.js +505 -0
  35. package/dist/platform-operations.d.ts +265 -0
  36. package/dist/platform-operations.js +421 -0
  37. package/dist/reconcile/bootstrap-systems.js +3 -3
  38. package/dist/reconcile/builtin-adapters.js +225 -29
  39. package/dist/reconcile/contracts.d.ts +1 -1
  40. package/dist/reconcile/desired-state.d.ts +14 -0
  41. package/dist/reconcile/desired-state.js +4 -0
  42. package/dist/reconcile/engine.d.ts +28 -0
  43. package/dist/reconcile/state.js +3 -0
  44. package/dist/reconcile/units.js +2 -0
  45. package/dist/workflow/operations.d.ts +13 -5
  46. package/dist/workflow/operations.js +69 -12
  47. package/dist/workflow-state.d.ts +2 -0
  48. package/dist/workflow-state.js +7 -2
  49. package/dist/workflow.d.ts +2 -0
  50. package/package.json +15 -2
@@ -10,6 +10,11 @@ export declare class D1AuthProvider implements ApiAuthProvider {
10
10
  startDeviceFlow(request: DeviceCodeStartRequest): Promise<DeviceCodeStartResponse>;
11
11
  pollDeviceFlow(request: DeviceCodePollRequest): Promise<DeviceCodePollResponse>;
12
12
  refreshAccessToken(request: TokenRefreshRequest): Promise<TokenRefreshResponse>;
13
+ issueUserSession(userId: string, options?: {
14
+ sessionType?: string;
15
+ scopes?: string[];
16
+ data?: Record<string, unknown>;
17
+ }): Promise<TokenRefreshResponse>;
13
18
  approveDeviceFlow(request: DeviceCodeApproveRequest): Promise<{
14
19
  ok: true;
15
20
  }>;
@@ -34,6 +34,9 @@ class D1AuthProvider {
34
34
  refreshAccessToken(request) {
35
35
  return this.store.refreshAccessToken(request);
36
36
  }
37
+ issueUserSession(userId, options = {}) {
38
+ return this.store.issueUserSession(userId, options);
39
+ }
37
40
  approveDeviceFlow(request) {
38
41
  return this.store.approveDeviceFlow(request);
39
42
  }
@@ -58,6 +58,11 @@ export declare class D1AuthStore {
58
58
  ok: true;
59
59
  }>;
60
60
  pollDeviceFlow(request: DeviceCodePollRequest): Promise<DeviceCodePollResponse>;
61
+ issueUserSession(userId: string, options?: {
62
+ sessionType?: string;
63
+ scopes?: string[];
64
+ data?: Record<string, unknown>;
65
+ }): Promise<TokenRefreshResponse>;
61
66
  refreshAccessToken(request: TokenRefreshRequest): Promise<TokenRefreshResponse>;
62
67
  createPersonalAccessToken(userId: string, input: {
63
68
  name: string;
@@ -650,6 +650,68 @@ class D1AuthStore {
650
650
  }
651
651
  };
652
652
  }
653
+ async issueUserSession(userId, options = {}) {
654
+ await this.ensureInitialized();
655
+ const principalRecord = await this.principalForUser(userId);
656
+ const refreshToken = nextOpaqueToken("refresh");
657
+ const sessionId = randomUUID();
658
+ const refreshTokenHash = stableHash(refreshToken, this.config.authSecret);
659
+ const expiresAt = addSeconds(now(), this.config.accessTokenTtlSeconds);
660
+ const refreshExpiresAt = addSeconds(now(), this.config.refreshTokenTtlSeconds);
661
+ const requestedScopes = options.scopes && options.scopes.length > 0 ? [...new Set(options.scopes)] : principalRecord.principal.scopes;
662
+ await this.run(
663
+ `INSERT INTO auth_sessions (id, user_id, session_type, refresh_token_hash, scopes_json, expires_at, revoked_at, data_json, created_at, updated_at)
664
+ VALUES (?, ?, ?, ?, ?, ?, NULL, ?, ?, ?)`,
665
+ [
666
+ sessionId,
667
+ userId,
668
+ options.sessionType?.trim() || "web",
669
+ refreshTokenHash,
670
+ JSON.stringify(requestedScopes),
671
+ refreshExpiresAt.toISOString(),
672
+ JSON.stringify(options.data ?? {}),
673
+ isoNow(),
674
+ isoNow()
675
+ ]
676
+ );
677
+ const accessToken = createAccessToken({
678
+ sub: principalRecord.principal.id,
679
+ displayName: principalRecord.principal.displayName,
680
+ scopes: requestedScopes,
681
+ roles: principalRecord.principal.roles,
682
+ permissions: principalRecord.principal.permissions,
683
+ metadata: {
684
+ ...principalRecord.principal.metadata,
685
+ sessionId
686
+ },
687
+ iat: Math.floor(Date.now() / 1e3),
688
+ exp: Math.floor(expiresAt.getTime() / 1e3),
689
+ iss: this.config.issuer,
690
+ jti: randomUUID(),
691
+ tokenType: "access"
692
+ }, this.config.authSecret);
693
+ await this.writeAuditEvent({
694
+ actorType: "user",
695
+ actorId: userId,
696
+ eventType: "auth.session_issued",
697
+ targetType: "auth_session",
698
+ targetId: sessionId,
699
+ data: { sessionType: options.sessionType ?? "web" }
700
+ });
701
+ return {
702
+ ok: true,
703
+ status: "approved",
704
+ accessToken,
705
+ refreshToken,
706
+ tokenType: "Bearer",
707
+ expiresAt: expiresAt.toISOString(),
708
+ expiresInSeconds: this.config.accessTokenTtlSeconds,
709
+ principal: {
710
+ ...principalRecord.principal,
711
+ scopes: requestedScopes
712
+ }
713
+ };
714
+ }
653
715
  async refreshAccessToken(request) {
654
716
  await this.ensureInitialized();
655
717
  const refreshHash = stableHash(request.refreshToken, this.config.authSecret);
@@ -11,6 +11,11 @@ export declare class MemoryDeviceCodeAuthProvider implements ApiAuthProvider {
11
11
  }>;
12
12
  pollDeviceFlow(request: DeviceCodePollRequest): Promise<DeviceCodePollResponse>;
13
13
  refreshAccessToken(request: TokenRefreshRequest): Promise<TokenRefreshResponse>;
14
+ issueUserSession(userId: string, options?: {
15
+ sessionType?: string;
16
+ scopes?: string[];
17
+ data?: Record<string, unknown>;
18
+ }): Promise<TokenRefreshResponse>;
14
19
  authenticateBearerToken(token: string): Promise<{
15
20
  principal: ApiPrincipal;
16
21
  credential: {
@@ -154,6 +154,47 @@ class MemoryDeviceCodeAuthProvider {
154
154
  principal: session.principal
155
155
  };
156
156
  }
157
+ async issueUserSession(userId, options = {}) {
158
+ const principal = {
159
+ id: userId,
160
+ displayName: userId,
161
+ scopes: options.scopes ?? ["auth:me"],
162
+ roles: ["member"],
163
+ permissions: ["auth:read:self"],
164
+ metadata: {
165
+ ...options.data ?? {},
166
+ sessionType: options.sessionType ?? "web"
167
+ }
168
+ };
169
+ const refreshToken = nextOpaqueToken("refresh");
170
+ this.refreshSessions.set(refreshToken, {
171
+ principal,
172
+ expiresAt: nowSeconds() + this.config.refreshTokenTtlSeconds
173
+ });
174
+ const expiresAt = nowSeconds() + this.config.accessTokenTtlSeconds;
175
+ return {
176
+ ok: true,
177
+ status: "approved",
178
+ accessToken: createAccessToken({
179
+ sub: principal.id,
180
+ displayName: principal.displayName,
181
+ scopes: principal.scopes,
182
+ roles: principal.roles,
183
+ permissions: principal.permissions,
184
+ metadata: principal.metadata,
185
+ iat: nowSeconds(),
186
+ exp: expiresAt,
187
+ iss: this.config.issuer,
188
+ jti: randomUUID(),
189
+ tokenType: "access"
190
+ }, this.config.authSecret),
191
+ refreshToken,
192
+ tokenType: "Bearer",
193
+ expiresAt: formatExpiry(expiresAt),
194
+ expiresInSeconds: this.config.accessTokenTtlSeconds,
195
+ principal
196
+ };
197
+ }
157
198
  async authenticateBearerToken(token) {
158
199
  const payload = verifyAccessToken(token, this.config.authSecret);
159
200
  return payload ? {
@@ -83,6 +83,11 @@ export interface ApiAuthProvider {
83
83
  expiresInSeconds: number;
84
84
  principal: ApiPrincipal;
85
85
  }>;
86
+ issueUserSession?(userId: string, options?: {
87
+ sessionType?: string;
88
+ scopes?: string[];
89
+ data?: Record<string, unknown>;
90
+ }): Promise<TokenRefreshResponse>;
86
91
  }
87
92
  export type ApiRuntimeProviderSelections = {
88
93
  auth: string;
package/dist/index.d.ts CHANGED
@@ -5,6 +5,8 @@ export { createControlPlaneReporter } from './control-plane.ts';
5
5
  export { ControlPlaneClient } from './control-plane-client.ts';
6
6
  export * from './seeds/index.ts';
7
7
  export { CAPACITY_PROVIDER_ENDPOINTS, CAPACITY_PROVIDER_DEPLOYMENT_SERVICE_ROLES, CAPACITY_PROVIDER_ENV_KEYS, CAPACITY_PROVIDER_SCOPES, CapacityProviderApiError, MarketProviderClient, assertCapacityProviderOkEnvelope, assertCapacityProviderPortfolioManifest, assertCapacityProviderRegistrationResponse, buildCapacityProviderAuthHeaders, deployCapacityProviderToManagedMarketHost, deployCapacityProviderToRailway, isCapacityProviderSecretEnvKey, redactCapacityProviderEnv, redactCapacityProviderSecret, renderCapacityProviderSelfHostInstructions, persistCapacityProviderConnectionToTreeseedConfig, resolveCapacityProviderEnvironment, resolveCapacityProviderLaunchEnvironment, } from './capacity-provider.ts';
8
+ export { PLATFORM_OPERATION_ENDPOINTS, PLATFORM_OPERATION_NAMESPACES, PLATFORM_OPERATION_SCOPES, PLATFORM_OPERATION_STATUSES, PLATFORM_OPERATION_TARGETS, PlatformOperationApiError, PlatformRunnerClient, assertPlatformOperation, assertPlatformOperationEvent, assertPlatformOperationOkEnvelope, buildPlatformRunnerAuthHeaders, createPlatformOperationExecutorRegistry, derivePlatformOperationNavigation, isPlatformOperationSuccessful, isPlatformOperationTerminal, pollPlatformOperation, runPlatformOperationOnce, type PlatformOperation, type PlatformOperationEvent, type PlatformOperationNavigationResult, type PlatformOperationPollOptions, type PlatformOperationPollResult, } from './platform-operations.ts';
9
+ export { PLATFORM_CONTENT_COLLECTIONS, PLATFORM_WORK_CONTENT_COLLECTIONS, createPlatformRepositoryClaim, derivePlatformRepositoryKey, executePlatformRepositoryOperation, normalizePlatformContentInput, normalizePlatformRelationArray, platformContentRelationPolicy, resolvePlatformRepositoryWorkspacePath, slugifyPlatformContent, type PlatformContentCollection, type PlatformRepositoryClaim, type PlatformRepositoryClaimInput, type PlatformRepositoryDescriptor, type PlatformRepositoryOperationInput, type PlatformRepositoryOperationOptions, type PlatformRepositoryOperationResult, type PlatformRepositoryPathPolicy, type PlatformRepositoryVerificationCommand, type PlatformRepositoryVerificationResult, type NormalizedPlatformContentInput, } from './operations/repository-operations.ts';
8
10
  export { DEFAULT_EXECUTION_PROFILE_ID, DEFAULT_EXECUTION_PROFILES, DEFAULT_TASK_ADMISSION_POLICY, buildTaskEstimateProfileFromActuals, computeWorkdayBudgetEnvelope, decideTaskAdmission, estimateAttentionForTask, estimateConfidenceFromProfile, estimateLearningPercentile, estimateLearningVariance, estimateForClassification, estimateProfileConfidenceScore, estimateUtilityForTask, isInterruptedUsageActual, normalizeHybridExecutionPlan, mutationRequiresRepositoryClaim, normalizePlanningPolicy, normalizePredictiveReservePolicy, normalizeTaskPlanProposal, normalizeExecutionProfile, normalizeAttentionPolicy, normalizeTaskAdmissionPolicy, normalizeUtilityPolicy, predictReserveForCapacityPlan, progressivelyAdmitPlanProposal, rankPlannedTaskNodes, reservationHasCapacity, reserveCreditsForEstimate, routeAndReserveCapacity, scoreCapacityLane, selectBestCapacityLane, selectTaskEstimateProfile, settleCapacityActuals, shouldInterruptForCapacity, synthesizePlanEstimate, createReservationReleaseEntry, summarizeCapacityPlan, summarizeProjectCapacityPlan, summarizeTeamCapacityPlan, validateTaskPlanProposal, } from './capacity.ts';
9
11
  export { executeKnowledgeHubProviderLaunch, validateKnowledgeHubProviderLaunchPrerequisites, } from './operations/services/hub-provider-launch.ts';
10
12
  export { createKnowledgeHubRepositories, defaultHubContentResolutionPolicy, executeKnowledgeHubLaunch, normalizeKnowledgeHubLaunchIntent, planKnowledgeHubLaunch, planKnowledgeHubRepositories, validateRepositoryHost, type HubContentResolutionPolicy, type KnowledgeHubLaunchIntent, type KnowledgeHubLaunchPhase, type KnowledgeHubLaunchPlan, type KnowledgeHubLaunchResult, type KnowledgeHubRepositoryPlan, type RepositoryHost, } from './operations/services/hub-launch.ts';
package/dist/index.js CHANGED
@@ -25,6 +25,37 @@ import {
25
25
  resolveCapacityProviderEnvironment,
26
26
  resolveCapacityProviderLaunchEnvironment
27
27
  } from "./capacity-provider.js";
28
+ import {
29
+ PLATFORM_OPERATION_ENDPOINTS,
30
+ PLATFORM_OPERATION_NAMESPACES,
31
+ PLATFORM_OPERATION_SCOPES,
32
+ PLATFORM_OPERATION_STATUSES,
33
+ PLATFORM_OPERATION_TARGETS,
34
+ PlatformOperationApiError,
35
+ PlatformRunnerClient,
36
+ assertPlatformOperation,
37
+ assertPlatformOperationEvent,
38
+ assertPlatformOperationOkEnvelope,
39
+ buildPlatformRunnerAuthHeaders,
40
+ createPlatformOperationExecutorRegistry,
41
+ derivePlatformOperationNavigation,
42
+ isPlatformOperationSuccessful,
43
+ isPlatformOperationTerminal,
44
+ pollPlatformOperation,
45
+ runPlatformOperationOnce
46
+ } from "./platform-operations.js";
47
+ import {
48
+ PLATFORM_CONTENT_COLLECTIONS,
49
+ PLATFORM_WORK_CONTENT_COLLECTIONS,
50
+ createPlatformRepositoryClaim,
51
+ derivePlatformRepositoryKey,
52
+ executePlatformRepositoryOperation,
53
+ normalizePlatformContentInput,
54
+ normalizePlatformRelationArray,
55
+ platformContentRelationPolicy,
56
+ resolvePlatformRepositoryWorkspacePath,
57
+ slugifyPlatformContent
58
+ } from "./operations/repository-operations.js";
28
59
  import {
29
60
  DEFAULT_EXECUTION_PROFILE_ID,
30
61
  DEFAULT_EXECUTION_PROFILES,
@@ -290,9 +321,18 @@ export {
290
321
  MarketApiError,
291
322
  MarketClient,
292
323
  MarketProviderClient,
324
+ PLATFORM_CONTENT_COLLECTIONS,
325
+ PLATFORM_OPERATION_ENDPOINTS,
326
+ PLATFORM_OPERATION_NAMESPACES,
327
+ PLATFORM_OPERATION_SCOPES,
328
+ PLATFORM_OPERATION_STATUSES,
329
+ PLATFORM_OPERATION_TARGETS,
330
+ PLATFORM_WORK_CONTENT_COLLECTIONS,
293
331
  PROJECT_JOB_STATUSES,
294
332
  PROJECT_TEAM_CAPABILITIES,
295
333
  PUBLISHED_CONTENT_MANIFEST_SCHEMA_VERSION,
334
+ PlatformOperationApiError,
335
+ PlatformRunnerClient,
296
336
  RELEASE_STATES,
297
337
  RemoteTemplateCatalogClient,
298
338
  RemoteTreeseedAuthClient,
@@ -319,11 +359,15 @@ export {
319
359
  assertCapacityProviderOkEnvelope,
320
360
  assertCapacityProviderPortfolioManifest,
321
361
  assertCapacityProviderRegistrationResponse,
362
+ assertPlatformOperation,
363
+ assertPlatformOperationEvent,
364
+ assertPlatformOperationOkEnvelope,
322
365
  buildBuiltinModelRegistry,
323
366
  buildCapacityProviderAuthHeaders,
324
367
  buildCopilotAllowToolArgs,
325
368
  buildKnowledgePackMarketPackage,
326
369
  buildModelRegistry,
370
+ buildPlatformRunnerAuthHeaders,
327
371
  buildScopedModelRegistry,
328
372
  buildTaskEstimateProfileFromActuals,
329
373
  buildTemplateMarketPackage,
@@ -339,6 +383,8 @@ export {
339
383
  createDefaultGraphRankingProvider,
340
384
  createFilesystemContentSource,
341
385
  createKnowledgeHubRepositories,
386
+ createPlatformOperationExecutorRegistry,
387
+ createPlatformRepositoryClaim,
342
388
  createPublishedContentPipeline,
343
389
  createReservationReleaseEntry,
344
390
  createTeamScopedR2OverlayContentPublishProvider,
@@ -353,6 +399,8 @@ export {
353
399
  deniedAgentOperationResult,
354
400
  deployCapacityProviderToManagedMarketHost,
355
401
  deployCapacityProviderToRailway,
402
+ derivePlatformOperationNavigation,
403
+ derivePlatformRepositoryKey,
356
404
  deriveTreeseedDesiredUnits,
357
405
  destroyTreeseedTargetUnits,
358
406
  ensureRailwayEnvironment,
@@ -367,6 +415,7 @@ export {
367
415
  estimateUtilityForTask,
368
416
  executeKnowledgeHubLaunch,
369
417
  executeKnowledgeHubProviderLaunch,
418
+ executePlatformRepositoryOperation,
370
419
  executeSdkOperation,
371
420
  findDispatchCapability,
372
421
  findSdkOperation,
@@ -380,6 +429,8 @@ export {
380
429
  isAgentOperationName,
381
430
  isCapacityProviderSecretEnvKey,
382
431
  isInterruptedUsageActual,
432
+ isPlatformOperationSuccessful,
433
+ isPlatformOperationTerminal,
383
434
  isTeamScopedR2ContentEnabled,
384
435
  listIntegratedMarketCatalog,
385
436
  listRailwayEnvironments,
@@ -404,6 +455,8 @@ export {
404
455
  normalizeKnowledgeHubLaunchIntent,
405
456
  normalizeMutationData,
406
457
  normalizePlanningPolicy,
458
+ normalizePlatformContentInput,
459
+ normalizePlatformRelationArray,
407
460
  normalizePredictiveReservePolicy,
408
461
  normalizeProjectJobStatus,
409
462
  normalizeRecordToCanonicalShape,
@@ -422,6 +475,8 @@ export {
422
475
  planKnowledgeHubLaunch,
423
476
  planKnowledgeHubRepositories,
424
477
  planTreeseedReconciliation,
478
+ platformContentRelationPolicy,
479
+ pollPlatformOperation,
425
480
  predictReserveForCapacityPlan,
426
481
  preprocessAliasedRecord,
427
482
  progressivelyAdmitPlanProposal,
@@ -450,6 +505,7 @@ export {
450
505
  resolveMarketSession,
451
506
  resolveModelDefinition,
452
507
  resolveModelField,
508
+ resolvePlatformRepositoryWorkspacePath,
453
509
  resolvePublishedContentBucketBinding,
454
510
  resolvePublishedContentManifestKey,
455
511
  resolvePublishedContentPreviewRoot,
@@ -464,6 +520,7 @@ export {
464
520
  resolveTreeseedToolBinary,
465
521
  resolveTreeseedToolCommand,
466
522
  routeAndReserveCapacity,
523
+ runPlatformOperationOnce,
467
524
  runTreeseedCopilotTask,
468
525
  runTreeseedVerifyDriver,
469
526
  scoreCapacityLane,
@@ -474,6 +531,7 @@ export {
474
531
  settleCapacityActuals,
475
532
  shouldInterruptForCapacity,
476
533
  signEditorialPreviewToken,
534
+ slugifyPlatformContent,
477
535
  summarizeCapacityPlan,
478
536
  summarizeProjectCapacityPlan,
479
537
  summarizeTeamCapacityPlan,
@@ -19,6 +19,13 @@ export interface MarketSession {
19
19
  expiresAt?: string;
20
20
  principal?: ApiPrincipal | null;
21
21
  }
22
+ export interface MarketWebAuthSession {
23
+ accessToken: string;
24
+ refreshToken?: string | null;
25
+ expiresInSeconds?: number;
26
+ principal: ApiPrincipal;
27
+ session?: Record<string, unknown> | null;
28
+ }
22
29
  export interface MarketRegistryState {
23
30
  version: 1;
24
31
  activeMarketId: string;
@@ -128,6 +135,118 @@ export declare class MarketClient {
128
135
  logout(): Promise<{
129
136
  ok: true;
130
137
  }>;
138
+ webSignUp(body: {
139
+ email: string;
140
+ password: string;
141
+ username?: string | null;
142
+ name?: string | null;
143
+ firstName?: string | null;
144
+ lastName?: string | null;
145
+ }): Promise<{
146
+ ok: true;
147
+ payload: MarketWebAuthSession;
148
+ }>;
149
+ webSignIn(body: {
150
+ email?: string;
151
+ username?: string;
152
+ login?: string;
153
+ password: string;
154
+ }): Promise<{
155
+ ok: true;
156
+ payload: MarketWebAuthSession;
157
+ }>;
158
+ checkWebUsername(username: string): Promise<{
159
+ ok: true;
160
+ payload: {
161
+ username: string;
162
+ available: boolean;
163
+ status: string;
164
+ };
165
+ }>;
166
+ webSessions(): Promise<{
167
+ ok: true;
168
+ payload: unknown[];
169
+ }>;
170
+ revokeWebSession(sessionId: string): Promise<{
171
+ ok: true;
172
+ payload: {
173
+ sessionId: string;
174
+ };
175
+ }>;
176
+ updateWebProfile(body: {
177
+ name?: string | null;
178
+ image?: string | null;
179
+ }): Promise<{
180
+ ok: true;
181
+ payload: MarketWebAuthSession;
182
+ }>;
183
+ webAppearance(): Promise<{
184
+ ok: true;
185
+ payload: {
186
+ scheme: string;
187
+ mode: string;
188
+ };
189
+ }>;
190
+ updateWebAppearance(body: {
191
+ colorScheme?: string | null;
192
+ scheme?: string | null;
193
+ themeMode?: string | null;
194
+ mode?: string | null;
195
+ }): Promise<{
196
+ ok: true;
197
+ payload: {
198
+ scheme: string;
199
+ mode: string;
200
+ };
201
+ }>;
202
+ updateWebEmail(body: {
203
+ email: string;
204
+ }): Promise<{
205
+ ok: true;
206
+ payload: MarketWebAuthSession;
207
+ }>;
208
+ updateWebPassword(body: {
209
+ currentPassword?: string;
210
+ password: string;
211
+ }): Promise<{
212
+ ok: true;
213
+ payload: {
214
+ changed: true;
215
+ };
216
+ }>;
217
+ requestWebPasswordReset(body: {
218
+ email: string;
219
+ }): Promise<{
220
+ ok: true;
221
+ payload: {
222
+ sent: true;
223
+ resetToken?: string | null;
224
+ };
225
+ }>;
226
+ completeWebPasswordReset(body: {
227
+ token: string;
228
+ password: string;
229
+ }): Promise<{
230
+ ok: true;
231
+ payload: {
232
+ reset: true;
233
+ };
234
+ }>;
235
+ accountDeletionBlockers(): Promise<{
236
+ ok: true;
237
+ payload: {
238
+ blockers: unknown[];
239
+ canDelete: boolean;
240
+ };
241
+ }>;
242
+ deleteAccount(body?: {
243
+ confirmation?: string;
244
+ }): Promise<{
245
+ ok: true;
246
+ payload: {
247
+ deleted: true;
248
+ };
249
+ }>;
131
250
  me(): Promise<{
132
251
  ok: true;
133
252
  payload: {
@@ -319,6 +319,85 @@ class MarketClient {
319
319
  requireAuth: true
320
320
  });
321
321
  }
322
+ webSignUp(body) {
323
+ return this.request("/v1/auth/web/sign-up", {
324
+ method: "POST",
325
+ body
326
+ });
327
+ }
328
+ webSignIn(body) {
329
+ return this.request("/v1/auth/web/sign-in", {
330
+ method: "POST",
331
+ body
332
+ });
333
+ }
334
+ checkWebUsername(username) {
335
+ return this.request(
336
+ `/v1/auth/web/username/check?username=${encodeURIComponent(username)}`
337
+ );
338
+ }
339
+ webSessions() {
340
+ return this.request("/v1/auth/web/sessions", { requireAuth: true });
341
+ }
342
+ revokeWebSession(sessionId) {
343
+ return this.request(
344
+ `/v1/auth/web/sessions/${encodeURIComponent(sessionId)}/revoke`,
345
+ { method: "POST", requireAuth: true }
346
+ );
347
+ }
348
+ updateWebProfile(body) {
349
+ return this.request("/v1/auth/web/profile", {
350
+ method: "PATCH",
351
+ body,
352
+ requireAuth: true
353
+ });
354
+ }
355
+ webAppearance() {
356
+ return this.request("/v1/auth/web/appearance", { requireAuth: true });
357
+ }
358
+ updateWebAppearance(body) {
359
+ return this.request("/v1/auth/web/appearance", {
360
+ method: "PATCH",
361
+ body,
362
+ requireAuth: true
363
+ });
364
+ }
365
+ updateWebEmail(body) {
366
+ return this.request("/v1/auth/web/email", {
367
+ method: "PATCH",
368
+ body,
369
+ requireAuth: true
370
+ });
371
+ }
372
+ updateWebPassword(body) {
373
+ return this.request("/v1/auth/web/password", {
374
+ method: "PATCH",
375
+ body,
376
+ requireAuth: true
377
+ });
378
+ }
379
+ requestWebPasswordReset(body) {
380
+ return this.request("/v1/auth/web/password-reset/request", {
381
+ method: "POST",
382
+ body
383
+ });
384
+ }
385
+ completeWebPasswordReset(body) {
386
+ return this.request("/v1/auth/web/password-reset/complete", {
387
+ method: "POST",
388
+ body
389
+ });
390
+ }
391
+ accountDeletionBlockers() {
392
+ return this.request("/v1/auth/web/account/deletion-blockers", { requireAuth: true });
393
+ }
394
+ deleteAccount(body = {}) {
395
+ return this.request("/v1/auth/web/account", {
396
+ method: "DELETE",
397
+ body,
398
+ requireAuth: true
399
+ });
400
+ }
322
401
  me() {
323
402
  return this.request("/v1/me", { requireAuth: true });
324
403
  }
@@ -0,0 +1,129 @@
1
+ export declare const PLATFORM_CONTENT_COLLECTIONS: readonly ["objectives", "questions", "notes", "proposals", "decisions", "agents"];
2
+ export declare const PLATFORM_WORK_CONTENT_COLLECTIONS: readonly ["objectives", "questions", "notes", "proposals", "decisions"];
3
+ export type PlatformContentCollection = (typeof PLATFORM_CONTENT_COLLECTIONS)[number];
4
+ export interface PlatformRepositoryDescriptor {
5
+ provider?: 'github' | 'local' | string;
6
+ owner?: string;
7
+ name: string;
8
+ defaultBranch?: string;
9
+ cloneUrl: string;
10
+ writeMode?: 'workspace' | 'branch' | 'direct' | 'pull_request';
11
+ branchName?: string;
12
+ push?: boolean;
13
+ pathPolicies?: PlatformRepositoryPathPolicy[];
14
+ verificationCommands?: PlatformRepositoryVerificationCommand[];
15
+ }
16
+ export interface PlatformRepositoryPathPolicy {
17
+ allow: string;
18
+ }
19
+ export interface PlatformRepositoryVerificationCommand {
20
+ command: string;
21
+ args?: string[];
22
+ workingDirectory?: string;
23
+ timeoutMs?: number;
24
+ }
25
+ export interface PlatformRepositoryClaimInput {
26
+ repository: PlatformRepositoryDescriptor;
27
+ runnerId: string;
28
+ workspaceRoot: string;
29
+ branch?: string | null;
30
+ commitSha?: string | null;
31
+ leaseSeconds?: number;
32
+ metadata?: Record<string, unknown>;
33
+ }
34
+ export interface PlatformRepositoryClaim {
35
+ id: string;
36
+ repositoryKey: string;
37
+ runnerId: string;
38
+ workspacePath: string;
39
+ branch: string | null;
40
+ commitSha: string | null;
41
+ claimState: 'active' | 'released' | 'expired' | string;
42
+ leaseExpiresAt: string | null;
43
+ metadata: Record<string, unknown>;
44
+ createdAt: string;
45
+ updatedAt: string;
46
+ }
47
+ export interface PlatformRepositoryOperationInput {
48
+ projectId?: string;
49
+ teamId?: string;
50
+ createdBy?: string;
51
+ repository: PlatformRepositoryDescriptor;
52
+ collection?: string;
53
+ parentCollection?: string;
54
+ parentSlug?: string;
55
+ targetCollection?: string;
56
+ proposalSlugs?: string[];
57
+ decisionType?: string;
58
+ reason?: string;
59
+ title?: string;
60
+ slug?: string;
61
+ normalized?: NormalizedPlatformContentInput;
62
+ payload?: Record<string, unknown>;
63
+ commitMessage?: string;
64
+ approvalRequired?: boolean;
65
+ approvalId?: string;
66
+ }
67
+ export interface PlatformRepositoryOperationOptions {
68
+ workspaceRoot: string;
69
+ environment?: string;
70
+ }
71
+ export interface NormalizedPlatformContentInput {
72
+ slug: string;
73
+ extension: 'md' | 'mdx';
74
+ frontmatter: Record<string, unknown>;
75
+ body: string;
76
+ }
77
+ export interface PlatformRepositoryOperationResult {
78
+ ok: true;
79
+ operation: string;
80
+ repository: {
81
+ key: string;
82
+ provider: string;
83
+ owner: string | null;
84
+ name: string;
85
+ cloneUrl: string;
86
+ };
87
+ baseBranch: string;
88
+ repositoryPath: string;
89
+ workspacePath: string;
90
+ href: string | null;
91
+ branch: string | null;
92
+ operationBranch: string | null;
93
+ commitSha: string | null;
94
+ changedPaths: string[];
95
+ verification: PlatformRepositoryVerificationResult | null;
96
+ pullRequest: null;
97
+ workflowRun: null;
98
+ output: Record<string, unknown>;
99
+ }
100
+ export interface PlatformRepositoryVerificationResult {
101
+ status: 'passed' | 'failed' | 'skipped';
102
+ commands: Array<{
103
+ command: string;
104
+ args: string[];
105
+ cwd: string;
106
+ exitCode: number;
107
+ stdout: string;
108
+ stderr: string;
109
+ }>;
110
+ }
111
+ export declare class PlatformRepositoryVerificationError extends Error {
112
+ readonly verification: PlatformRepositoryVerificationResult;
113
+ constructor(message: string, verification: PlatformRepositoryVerificationResult);
114
+ }
115
+ export declare function slugifyPlatformContent(value: unknown): string;
116
+ export declare function normalizePlatformRelationArray(value: unknown): string[];
117
+ export declare function platformContentRelationPolicy(parentCollection: string, targetCollection: string): {
118
+ sourceField?: string;
119
+ targetField?: string;
120
+ sourceSingle?: boolean;
121
+ targetSingle?: boolean;
122
+ };
123
+ export declare function normalizePlatformContentInput(collection: string, body: Record<string, unknown>): NormalizedPlatformContentInput | {
124
+ error: string;
125
+ };
126
+ export declare function derivePlatformRepositoryKey(repository: PlatformRepositoryDescriptor): string;
127
+ export declare function resolvePlatformRepositoryWorkspacePath(workspaceRoot: string, repository: PlatformRepositoryDescriptor): string;
128
+ export declare function createPlatformRepositoryClaim(input: PlatformRepositoryClaimInput): PlatformRepositoryClaim;
129
+ export declare function executePlatformRepositoryOperation(operation: 'write_content_record' | 'create_related_content' | 'create_decision_from_proposals' | string, input: PlatformRepositoryOperationInput, options: PlatformRepositoryOperationOptions): Promise<PlatformRepositoryOperationResult>;