@odla-ai/cli 0.9.0 → 0.10.0

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.
package/dist/index.d.cts CHANGED
@@ -91,79 +91,78 @@ declare function adminAi(options: AdminAiOptions): Promise<void>;
91
91
  /** Stable, machine-readable division of work between the CLI, coding agent,
92
92
  * human operator, and Studio. Printed by `odla-ai capabilities --json`. */
93
93
  declare const CAPABILITIES: {
94
- readonly cli: readonly ["register the app and enable configured services per environment", "issue, persist, and explicitly rotate configured service credentials", "write local Worker values and push deployed Worker secrets through Wrangler stdin", "store tenant-vault secrets (including the Clerk webhook secret and reserved Clerk secret key) write-only from stdin or an env var", "push db schema/rules and configure platform AI, auth, and deployment links", "validate config offline and smoke-test a provisioned db environment", "run app-attributed hosted security discovery and independent validation without provider keys", "connect/revoke source-read-only GitHub sources and drive commit-pinned hosted security jobs without PATs or provider keys", "let admins manage system AI policy and credentials, inspect attributed usage, and read immutable admin changes through separate short-lived capability-only approvals"];
95
- readonly agent: readonly ["install and import the selected odla SDKs", "wrap the Worker with withObservability and choose useful telemetry", "make application-specific schema, rules, auth, UI, and migration decisions"];
96
- readonly human: readonly ["approve the odla device code and one-off third-party logins", "consent to production changes with --yes", "request destructive credential rotation explicitly", "review application semantics, security findings, releases, and merges", "approve redacted-source disclosure before hosted security reasoning", "approve GitHub App repository access separately from redacted-snippet disclosure"];
97
- readonly studio: readonly ["view telemetry and environment state", "perform manual credential recovery when the CLI's local shown-once copy is unavailable", "configure system AI purposes and view app/environment/run-attributed usage", "connect/revoke GitHub security sources and inspect ref-to-SHA jobs, routes, retention, coverage, and normalized reports"];
94
+ readonly cli: readonly ["register the app and enable configured services per environment", "issue, persist, and explicitly rotate configured service credentials", "write local Worker values and push deployed Worker secrets through Wrangler stdin", "store tenant-vault secrets (including the Clerk webhook secret and reserved Clerk secret key) write-only from stdin or an env var", "push db schema/rules and configure platform AI, auth, and deployment links", "apply read-only Google calendar mirror and public booking-page config, then drive state-bound consent, status, discovery, resync, and disconnect flows", "validate config offline and smoke-test a provisioned db environment", "run app-attributed hosted security discovery and independent validation without provider keys", "connect/revoke source-read-only GitHub sources and drive commit-pinned hosted security jobs without PATs or provider keys", "let admins manage system AI policy and credentials, inspect attributed usage, and read immutable admin changes through separate short-lived capability-only approvals"];
95
+ readonly agent: readonly ["install and import the selected odla SDKs", "wrap the Worker with withObservability and choose useful telemetry", "make application-specific schema, rules, auth, UI, and migration decisions", "wire @odla-ai/calendar into trusted Worker code and keep the app admin key out of browsers"];
96
+ readonly human: readonly ["approve the odla device code and one-off third-party logins", "review mirrored calendar/attendee disclosure and complete the server-issued Google consent flow", "consent to production changes with --yes", "request destructive credential rotation explicitly", "review application semantics, security findings, releases, and merges", "approve redacted-source disclosure before hosted security reasoning", "approve GitHub App repository access separately from redacted-snippet disclosure"];
97
+ readonly studio: readonly ["view telemetry and environment state", "review calendar connection, granted read scope, selected calendars, and sync health without exposing provider tokens", "perform manual credential recovery when the CLI's local shown-once copy is unavailable", "configure system AI purposes and view app/environment/run-attributed usage", "connect/revoke GitHub security sources and inspect ref-to-SHA jobs, routes, retention, coverage, and normalized reports"];
98
98
  };
99
99
  type Output = Pick<typeof console, "log">;
100
100
  /** Print the stable responsibility boundary for humans or agent tooling. */
101
101
  declare function printCapabilities(json?: boolean, out?: Output): void;
102
102
 
103
- interface DoctorOptions {
104
- configPath: string;
105
- stdout?: Pick<typeof console, "log" | "error">;
103
+ declare const CALENDAR_STATES: readonly ["not_connected", "authorizing", "needs_sync", "initial_sync", "healthy", "degraded", "disconnected", "failed"];
104
+ type CalendarConnectionState = (typeof CALENDAR_STATES)[number];
105
+ /** Owner-visible, secret-free calendar connection and sync health. */
106
+ interface CalendarStatus {
107
+ env: string;
108
+ enabled: boolean;
109
+ /** True when the platform has provider credentials for this connection. */
110
+ connected: boolean;
111
+ provider: "google" | null;
112
+ status: CalendarConnectionState;
113
+ access?: "read";
114
+ calendars: string[];
115
+ attendeePolicy?: "full" | "hashed";
116
+ /** True once a booking projection may have established the DB privacy policy. */
117
+ attendeePolicyLocked?: boolean;
118
+ bookingPageUrl?: string | null;
119
+ grantedScopes: string[];
120
+ attemptId?: string;
121
+ lastSuccessfulSyncAt?: number;
122
+ lastFullSyncAt?: number;
123
+ watchExpiresAt?: number;
124
+ bookingCount?: number;
125
+ error?: {
126
+ code?: string;
127
+ message?: string;
128
+ };
129
+ }
130
+ /** One Google calendar the connected identity may select for mirroring. */
131
+ interface AvailableGoogleCalendar {
132
+ id: string;
133
+ summary?: string;
134
+ primary?: boolean;
135
+ selected?: boolean;
136
+ accessRole?: "freeBusyReader" | "reader" | "writer" | "owner";
106
137
  }
107
- /**
108
- * Validate and summarize an odla project config entirely offline — no network
109
- * calls and no file writes. Loads `configPath`, builds the provision plan, and
110
- * resolves the schema and rules (synthesizing deny-all rules from the schema
111
- * when `db.rules` is omitted and `db.defaultRules` isn't `false`), then prints a
112
- * summary line for the app, envs, services, schema entity count, rules namespace
113
- * count, and AI provider.
114
- *
115
- * It then collects warnings for the mistakes provision can't fix silently: a
116
- * schema with no entities, a rules namespace with no matching entity, the `ai`
117
- * service enabled without an `ai.provider`, `auth.clerk` entries that reference
118
- * an unset env var (`$FOO`), an `ai.keyEnv` that isn't set (provider key upload
119
- * will be skipped), and — when `o11y` is enabled — any env whose local
120
- * credentials lack an ingest token. It also folds in the shared rule linter,
121
- * git-tracked secret-shaped files, and wrangler config warnings. Prints `ok`
122
- * when clean, otherwise the warning list. Purely advisory: never throws on
123
- * warnings and never mutates anything.
124
- *
125
- * @param options.configPath Path to the `odla.config.mjs` to inspect.
126
- * @param options.stdout Optional console-like sink (defaults to `console`).
127
- */
128
- declare function doctor(options: DoctorOptions): Promise<void>;
129
138
 
130
- interface InitOptions {
131
- rootDir?: string;
132
- configPath?: string;
133
- appId: string;
134
- name: string;
135
- envs?: string[];
136
- services?: string[];
137
- aiProvider?: string;
138
- force?: boolean;
139
+ interface CalendarLifecycleOptions {
140
+ configPath: string;
141
+ env?: string;
142
+ token?: string;
143
+ open?: boolean;
144
+ interactive?: boolean;
145
+ yes?: boolean;
146
+ json?: boolean;
147
+ fetch?: typeof fetch;
139
148
  stdout?: Pick<typeof console, "log" | "error">;
149
+ openConsentUrl?: (url: string) => Promise<void>;
150
+ wait?: (milliseconds: number, signal?: AbortSignal) => Promise<void>;
151
+ pollTimeoutMs?: number;
152
+ now?: () => number;
153
+ signal?: AbortSignal;
140
154
  }
141
- /**
142
- * Scaffold a new odla project into `rootDir` (default: cwd). Writes an
143
- * `odla.config.mjs` (default name, overridable via `configPath`) plus starter
144
- * `src/odla/schema.mjs` (a single `notes` entity) and `src/odla/rules.mjs`
145
- * (deny-all), and creates the `src/odla` and `.odla` directories. Also runs
146
- * `ensureGitignore` so the local token/credentials paths are ignored.
147
- *
148
- * Fully local and synchronous — no network calls. The config file is only
149
- * written when it doesn't already exist unless `force` is set (otherwise it
150
- * throws); the schema/rules files are written only when missing (never
151
- * overwritten, even with `force`). `appId` must match `^[a-z0-9][a-z0-9-]*$` or
152
- * it throws. Defaults: `envs` → `["dev"]`, `services` → `["db","ai"]`,
153
- * `aiProvider` → `"anthropic"` (which also picks the `keyEnv`, e.g.
154
- * `ANTHROPIC_API_KEY`/`OPENAI_API_KEY`/`GOOGLE_API_KEY`).
155
- *
156
- * @param options.appId Slug for the app (lowercase alphanumerics and hyphens).
157
- * @param options.name Human-readable app name embedded in the config.
158
- * @param options.rootDir Project root (defaults to `process.cwd()`).
159
- * @param options.configPath Config filename relative to root (default `odla.config.mjs`).
160
- * @param options.envs Environment names (default `["dev"]`; production is an explicit opt-in).
161
- * @param options.services Enabled services (default `["db","ai"]`).
162
- * @param options.aiProvider AI provider slug (default `"anthropic"`).
163
- * @param options.force Overwrite an existing config file instead of throwing.
164
- * @param options.stdout Optional console-like sink (defaults to `console`).
165
- */
166
- declare function initProject(options: InitOptions): void;
155
+ /** Read the owner-visible Google connection and mirror health for one env. */
156
+ declare function calendarStatus(options: CalendarLifecycleOptions): Promise<CalendarStatus>;
157
+ /** List calendars visible to the connected Google identity for config authoring. */
158
+ declare function calendarCalendars(options: CalendarLifecycleOptions): Promise<AvailableGoogleCalendar[]>;
159
+ /** Apply the public booking page setting, then complete Google consent + initial sync. */
160
+ declare function calendarConnect(options: CalendarLifecycleOptions): Promise<CalendarStatus>;
161
+ /** Ask the hosted connector for an immediate incremental/full recovery sync. */
162
+ declare function calendarResync(options: CalendarLifecycleOptions): Promise<CalendarStatus>;
163
+ /** Stop watches and delete this connection's encrypted platform token/cursors
164
+ * without purging the mirror or revoking the shared Google project grant. */
165
+ declare function calendarDisconnect(options: CalendarLifecycleOptions): Promise<CalendarStatus>;
167
166
 
168
167
  interface RunResult {
169
168
  code: number;
@@ -188,6 +187,41 @@ interface ClerkAuthConfig {
188
187
  audience?: string;
189
188
  mode?: "client" | "full";
190
189
  }
190
+ /** Read-only event selection applied by the hosted Google calendar connector. */
191
+ interface GoogleCalendarMatchConfig {
192
+ /** Mirror only events whose summary begins with this value. */
193
+ summaryPrefix?: string;
194
+ /** Require the connected identity to organize the event. Defaults to true. */
195
+ organizerSelf?: boolean;
196
+ /** Require at least one attendee. Defaults to true. */
197
+ requireAttendees?: boolean;
198
+ }
199
+ /** Google Calendar intent. OAuth credentials never belong in this config. */
200
+ interface GoogleCalendarConfig {
201
+ /** One through ten provider calendar ids to mirror in each odla environment. */
202
+ calendars: Record<OdlaEnvName, string[]>;
203
+ /** Public Google Appointment Schedule URL for static embed/link mode. */
204
+ bookingPageUrl?: Record<OdlaEnvName, string | null>;
205
+ match?: GoogleCalendarMatchConfig;
206
+ /** Store normalized attendee addresses, or only SHA-256 match keys. */
207
+ attendeePolicy?: "full" | "hashed";
208
+ }
209
+ interface CalendarConfig {
210
+ google: GoogleCalendarConfig;
211
+ }
212
+ /** Canonical, environment-specific config sent to the calendar controller. */
213
+ interface CalendarServiceConfig extends Record<string, unknown> {
214
+ provider: "google";
215
+ access: "read";
216
+ /** Deduplicated provider ids; the hosted connector accepts at most ten. */
217
+ calendars: string[];
218
+ match: {
219
+ organizerSelf: boolean;
220
+ requireAttendees: boolean;
221
+ summaryPrefix?: string;
222
+ };
223
+ attendeePolicy: "full" | "hashed";
224
+ }
191
225
  /** Authored `odla.config.mjs` contract consumed by doctor and provision. */
192
226
  interface OdlaProjectConfig {
193
227
  platformUrl?: string;
@@ -216,6 +250,7 @@ interface OdlaProjectConfig {
216
250
  /** Vault secret name. Defaults to @odla-ai/ai's provider default. */
217
251
  secretName?: string;
218
252
  };
253
+ calendar?: CalendarConfig;
219
254
  o11y?: {
220
255
  /** This service's name in the collector. Defaults to the app id. */
221
256
  service?: string;
@@ -280,6 +315,10 @@ interface ProvisionOptions {
280
315
  interactive?: boolean;
281
316
  /** Test/embedding override for opening the approval URL. Defaults to the OS browser opener. */
282
317
  openApprovalUrl?: (url: string) => Promise<void>;
318
+ /** Test/embedding override for calendar connection polling. */
319
+ calendarPollWait?: (milliseconds: number, signal?: AbortSignal) => Promise<void>;
320
+ /** Maximum calendar consent + initial-sync wait. Defaults to ten minutes. */
321
+ calendarPollTimeoutMs?: number;
283
322
  /** Explicit consent for a non-dry-run plan containing `prod` or `production`. */
284
323
  yes?: boolean;
285
324
  fetch?: typeof fetch;
@@ -303,10 +342,86 @@ interface ProvisionPlan {
303
342
  interface SmokeOptions {
304
343
  configPath: string;
305
344
  env?: string;
345
+ /** Developer-token override used only for owner-visible calendar health. */
346
+ token?: string;
347
+ open?: boolean;
348
+ interactive?: boolean;
349
+ openApprovalUrl?: (url: string) => Promise<void>;
306
350
  fetch?: typeof fetch;
307
351
  stdout?: Pick<typeof console, "log" | "error">;
308
352
  }
309
353
 
354
+ declare const GOOGLE_CALENDAR_READ_SCOPE = "https://www.googleapis.com/auth/calendar.events.readonly";
355
+ /** Resolve the checked-in calendar block into one controller-safe env payload. */
356
+ declare function calendarServiceConfig(cfg: LoadedProjectConfig, env: string): CalendarServiceConfig;
357
+ /** Public Appointment Schedule URL to apply separately from connector config. */
358
+ declare function calendarBookingPageUrl(cfg: LoadedProjectConfig, env: string): string | null | undefined;
359
+
360
+ interface DoctorOptions {
361
+ configPath: string;
362
+ stdout?: Pick<typeof console, "log" | "error">;
363
+ }
364
+ /**
365
+ * Validate and summarize an odla project config entirely offline — no network
366
+ * calls and no file writes. Loads `configPath`, builds the provision plan, and
367
+ * resolves the schema and rules (synthesizing deny-all rules from the schema
368
+ * when `db.rules` is omitted and `db.defaultRules` isn't `false`), then prints a
369
+ * summary line for the app, envs, services, schema entity count, rules namespace
370
+ * count, and AI provider.
371
+ *
372
+ * It then collects warnings for the mistakes provision can't fix silently: a
373
+ * schema with no entities, a rules namespace with no matching entity, the `ai`
374
+ * service enabled without an `ai.provider`, `auth.clerk` entries that reference
375
+ * an unset env var (`$FOO`), an `ai.keyEnv` that isn't set (provider key upload
376
+ * will be skipped), and — when `o11y` is enabled — any env whose local
377
+ * credentials lack an ingest token. It also folds in the shared rule linter,
378
+ * git-tracked secret-shaped files, and wrangler config warnings. Prints `ok`
379
+ * when clean, otherwise the warning list. Purely advisory: never throws on
380
+ * warnings and never mutates anything.
381
+ *
382
+ * @param options.configPath Path to the `odla.config.mjs` to inspect.
383
+ * @param options.stdout Optional console-like sink (defaults to `console`).
384
+ */
385
+ declare function doctor(options: DoctorOptions): Promise<void>;
386
+
387
+ interface InitOptions {
388
+ rootDir?: string;
389
+ configPath?: string;
390
+ appId: string;
391
+ name: string;
392
+ envs?: string[];
393
+ services?: string[];
394
+ aiProvider?: string;
395
+ force?: boolean;
396
+ stdout?: Pick<typeof console, "log" | "error">;
397
+ }
398
+ /**
399
+ * Scaffold a new odla project into `rootDir` (default: cwd). Writes an
400
+ * `odla.config.mjs` (default name, overridable via `configPath`) plus starter
401
+ * `src/odla/schema.mjs` (a single `notes` entity) and `src/odla/rules.mjs`
402
+ * (deny-all), and creates the `src/odla` and `.odla` directories. Also runs
403
+ * `ensureGitignore` so the local token/credentials paths are ignored.
404
+ *
405
+ * Fully local and synchronous — no network calls. The config file is only
406
+ * written when it doesn't already exist unless `force` is set (otherwise it
407
+ * throws); the schema/rules files are written only when missing (never
408
+ * overwritten, even with `force`). `appId` must match `^[a-z0-9][a-z0-9-]*$` or
409
+ * it throws. Defaults: `envs` → `["dev"]`, `services` → `["db","ai"]`,
410
+ * `aiProvider` → `"anthropic"` (which also picks the `keyEnv`, e.g.
411
+ * `ANTHROPIC_API_KEY`/`OPENAI_API_KEY`/`GOOGLE_API_KEY`).
412
+ *
413
+ * @param options.appId Slug for the app (lowercase alphanumerics and hyphens).
414
+ * @param options.name Human-readable app name embedded in the config.
415
+ * @param options.rootDir Project root (defaults to `process.cwd()`).
416
+ * @param options.configPath Config filename relative to root (default `odla.config.mjs`).
417
+ * @param options.envs Environment names (default `["dev"]`; production is an explicit opt-in).
418
+ * @param options.services Enabled services (default `["db","ai"]`).
419
+ * @param options.aiProvider AI provider slug (default `"anthropic"`).
420
+ * @param options.force Overwrite an existing config file instead of throwing.
421
+ * @param options.stdout Optional console-like sink (defaults to `console`).
422
+ */
423
+ declare function initProject(options: InitOptions): void;
424
+
310
425
  /**
311
426
  * Provision an app end-to-end from its config — the primary deploy path, and
312
427
  * (apart from key rotation) idempotent, so re-running is safe. Obtains a
@@ -666,4 +781,4 @@ declare function installSkill(options?: SkillInstallOptions): SkillInstallResult
666
781
  */
667
782
  declare function smoke(options: SmokeOptions): Promise<void>;
668
783
 
669
- export { AGENT_HARNESSES, type AdminAiOptions, type AgentHarness, type AgentHarnessSelector, CAPABILITIES, type CliDependencies, type ConnectGitHubSecuritySourceOptions, type DisconnectGitHubSecuritySourceOptions, type FollowHostedSecurityJobOptions, type GetHostedSecurityIntentOptions, type GetHostedSecurityJobOptions, type HarnessInstallResult, type HostedSecurityProfile, type HostedSecurityResult, type HostedSecurityTokenRequest, type ListGitHubSecuritySourcesOptions, type ListHostedSecurityJobsOptions, type LoadedProjectConfig, type LocalCredentials, type OdlaProjectConfig, type ProvisionOptions, type ProvisionPlan, type RunHostedSecurityOptions, SYSTEM_AI_PURPOSES, type ScopedPlatformTokenOptions, type SecretsPushOptions, type SecretsSetOptions, type SkillInstallOptions, type SkillInstallResult, type SmokeOptions, type StartHostedSecurityJobOptions, type SystemAiPurpose, adminAi, connectGitHubSecuritySource, disconnectGitHubSecuritySource, doctor, followHostedSecurityJob, getHostedSecurityIntent, getHostedSecurityJob, getHostedSecurityPlan, getHostedSecurityReport, getScopedPlatformToken, inferGitHubRepository, initProject, installSkill, isTerminalHostedSecurityStatus, listGitHubSecuritySources, listHostedSecurityJobs, printCapabilities, provision, redactSecrets, repositoryFromGitRemote, runCli, runHostedSecurity, secretsPush, secretsSet, secretsSetClerkKey, smoke, startHostedSecurityJob };
784
+ export { AGENT_HARNESSES, type AdminAiOptions, type AgentHarness, type AgentHarnessSelector, type AvailableGoogleCalendar, CAPABILITIES, type CalendarConfig, type CalendarConnectionState, type CalendarLifecycleOptions, type CalendarServiceConfig, type CalendarStatus, type CliDependencies, type ConnectGitHubSecuritySourceOptions, type DisconnectGitHubSecuritySourceOptions, type FollowHostedSecurityJobOptions, GOOGLE_CALENDAR_READ_SCOPE, type GetHostedSecurityIntentOptions, type GetHostedSecurityJobOptions, type GoogleCalendarConfig, type GoogleCalendarMatchConfig, type HarnessInstallResult, type HostedSecurityProfile, type HostedSecurityResult, type HostedSecurityTokenRequest, type ListGitHubSecuritySourcesOptions, type ListHostedSecurityJobsOptions, type LoadedProjectConfig, type LocalCredentials, type OdlaProjectConfig, type ProvisionOptions, type ProvisionPlan, type RunHostedSecurityOptions, SYSTEM_AI_PURPOSES, type ScopedPlatformTokenOptions, type SecretsPushOptions, type SecretsSetOptions, type SkillInstallOptions, type SkillInstallResult, type SmokeOptions, type StartHostedSecurityJobOptions, type SystemAiPurpose, adminAi, calendarBookingPageUrl, calendarCalendars, calendarConnect, calendarDisconnect, calendarResync, calendarServiceConfig, calendarStatus, connectGitHubSecuritySource, disconnectGitHubSecuritySource, doctor, followHostedSecurityJob, getHostedSecurityIntent, getHostedSecurityJob, getHostedSecurityPlan, getHostedSecurityReport, getScopedPlatformToken, inferGitHubRepository, initProject, installSkill, isTerminalHostedSecurityStatus, listGitHubSecuritySources, listHostedSecurityJobs, printCapabilities, provision, redactSecrets, repositoryFromGitRemote, runCli, runHostedSecurity, secretsPush, secretsSet, secretsSetClerkKey, smoke, startHostedSecurityJob };
package/dist/index.d.ts CHANGED
@@ -91,79 +91,78 @@ declare function adminAi(options: AdminAiOptions): Promise<void>;
91
91
  /** Stable, machine-readable division of work between the CLI, coding agent,
92
92
  * human operator, and Studio. Printed by `odla-ai capabilities --json`. */
93
93
  declare const CAPABILITIES: {
94
- readonly cli: readonly ["register the app and enable configured services per environment", "issue, persist, and explicitly rotate configured service credentials", "write local Worker values and push deployed Worker secrets through Wrangler stdin", "store tenant-vault secrets (including the Clerk webhook secret and reserved Clerk secret key) write-only from stdin or an env var", "push db schema/rules and configure platform AI, auth, and deployment links", "validate config offline and smoke-test a provisioned db environment", "run app-attributed hosted security discovery and independent validation without provider keys", "connect/revoke source-read-only GitHub sources and drive commit-pinned hosted security jobs without PATs or provider keys", "let admins manage system AI policy and credentials, inspect attributed usage, and read immutable admin changes through separate short-lived capability-only approvals"];
95
- readonly agent: readonly ["install and import the selected odla SDKs", "wrap the Worker with withObservability and choose useful telemetry", "make application-specific schema, rules, auth, UI, and migration decisions"];
96
- readonly human: readonly ["approve the odla device code and one-off third-party logins", "consent to production changes with --yes", "request destructive credential rotation explicitly", "review application semantics, security findings, releases, and merges", "approve redacted-source disclosure before hosted security reasoning", "approve GitHub App repository access separately from redacted-snippet disclosure"];
97
- readonly studio: readonly ["view telemetry and environment state", "perform manual credential recovery when the CLI's local shown-once copy is unavailable", "configure system AI purposes and view app/environment/run-attributed usage", "connect/revoke GitHub security sources and inspect ref-to-SHA jobs, routes, retention, coverage, and normalized reports"];
94
+ readonly cli: readonly ["register the app and enable configured services per environment", "issue, persist, and explicitly rotate configured service credentials", "write local Worker values and push deployed Worker secrets through Wrangler stdin", "store tenant-vault secrets (including the Clerk webhook secret and reserved Clerk secret key) write-only from stdin or an env var", "push db schema/rules and configure platform AI, auth, and deployment links", "apply read-only Google calendar mirror and public booking-page config, then drive state-bound consent, status, discovery, resync, and disconnect flows", "validate config offline and smoke-test a provisioned db environment", "run app-attributed hosted security discovery and independent validation without provider keys", "connect/revoke source-read-only GitHub sources and drive commit-pinned hosted security jobs without PATs or provider keys", "let admins manage system AI policy and credentials, inspect attributed usage, and read immutable admin changes through separate short-lived capability-only approvals"];
95
+ readonly agent: readonly ["install and import the selected odla SDKs", "wrap the Worker with withObservability and choose useful telemetry", "make application-specific schema, rules, auth, UI, and migration decisions", "wire @odla-ai/calendar into trusted Worker code and keep the app admin key out of browsers"];
96
+ readonly human: readonly ["approve the odla device code and one-off third-party logins", "review mirrored calendar/attendee disclosure and complete the server-issued Google consent flow", "consent to production changes with --yes", "request destructive credential rotation explicitly", "review application semantics, security findings, releases, and merges", "approve redacted-source disclosure before hosted security reasoning", "approve GitHub App repository access separately from redacted-snippet disclosure"];
97
+ readonly studio: readonly ["view telemetry and environment state", "review calendar connection, granted read scope, selected calendars, and sync health without exposing provider tokens", "perform manual credential recovery when the CLI's local shown-once copy is unavailable", "configure system AI purposes and view app/environment/run-attributed usage", "connect/revoke GitHub security sources and inspect ref-to-SHA jobs, routes, retention, coverage, and normalized reports"];
98
98
  };
99
99
  type Output = Pick<typeof console, "log">;
100
100
  /** Print the stable responsibility boundary for humans or agent tooling. */
101
101
  declare function printCapabilities(json?: boolean, out?: Output): void;
102
102
 
103
- interface DoctorOptions {
104
- configPath: string;
105
- stdout?: Pick<typeof console, "log" | "error">;
103
+ declare const CALENDAR_STATES: readonly ["not_connected", "authorizing", "needs_sync", "initial_sync", "healthy", "degraded", "disconnected", "failed"];
104
+ type CalendarConnectionState = (typeof CALENDAR_STATES)[number];
105
+ /** Owner-visible, secret-free calendar connection and sync health. */
106
+ interface CalendarStatus {
107
+ env: string;
108
+ enabled: boolean;
109
+ /** True when the platform has provider credentials for this connection. */
110
+ connected: boolean;
111
+ provider: "google" | null;
112
+ status: CalendarConnectionState;
113
+ access?: "read";
114
+ calendars: string[];
115
+ attendeePolicy?: "full" | "hashed";
116
+ /** True once a booking projection may have established the DB privacy policy. */
117
+ attendeePolicyLocked?: boolean;
118
+ bookingPageUrl?: string | null;
119
+ grantedScopes: string[];
120
+ attemptId?: string;
121
+ lastSuccessfulSyncAt?: number;
122
+ lastFullSyncAt?: number;
123
+ watchExpiresAt?: number;
124
+ bookingCount?: number;
125
+ error?: {
126
+ code?: string;
127
+ message?: string;
128
+ };
129
+ }
130
+ /** One Google calendar the connected identity may select for mirroring. */
131
+ interface AvailableGoogleCalendar {
132
+ id: string;
133
+ summary?: string;
134
+ primary?: boolean;
135
+ selected?: boolean;
136
+ accessRole?: "freeBusyReader" | "reader" | "writer" | "owner";
106
137
  }
107
- /**
108
- * Validate and summarize an odla project config entirely offline — no network
109
- * calls and no file writes. Loads `configPath`, builds the provision plan, and
110
- * resolves the schema and rules (synthesizing deny-all rules from the schema
111
- * when `db.rules` is omitted and `db.defaultRules` isn't `false`), then prints a
112
- * summary line for the app, envs, services, schema entity count, rules namespace
113
- * count, and AI provider.
114
- *
115
- * It then collects warnings for the mistakes provision can't fix silently: a
116
- * schema with no entities, a rules namespace with no matching entity, the `ai`
117
- * service enabled without an `ai.provider`, `auth.clerk` entries that reference
118
- * an unset env var (`$FOO`), an `ai.keyEnv` that isn't set (provider key upload
119
- * will be skipped), and — when `o11y` is enabled — any env whose local
120
- * credentials lack an ingest token. It also folds in the shared rule linter,
121
- * git-tracked secret-shaped files, and wrangler config warnings. Prints `ok`
122
- * when clean, otherwise the warning list. Purely advisory: never throws on
123
- * warnings and never mutates anything.
124
- *
125
- * @param options.configPath Path to the `odla.config.mjs` to inspect.
126
- * @param options.stdout Optional console-like sink (defaults to `console`).
127
- */
128
- declare function doctor(options: DoctorOptions): Promise<void>;
129
138
 
130
- interface InitOptions {
131
- rootDir?: string;
132
- configPath?: string;
133
- appId: string;
134
- name: string;
135
- envs?: string[];
136
- services?: string[];
137
- aiProvider?: string;
138
- force?: boolean;
139
+ interface CalendarLifecycleOptions {
140
+ configPath: string;
141
+ env?: string;
142
+ token?: string;
143
+ open?: boolean;
144
+ interactive?: boolean;
145
+ yes?: boolean;
146
+ json?: boolean;
147
+ fetch?: typeof fetch;
139
148
  stdout?: Pick<typeof console, "log" | "error">;
149
+ openConsentUrl?: (url: string) => Promise<void>;
150
+ wait?: (milliseconds: number, signal?: AbortSignal) => Promise<void>;
151
+ pollTimeoutMs?: number;
152
+ now?: () => number;
153
+ signal?: AbortSignal;
140
154
  }
141
- /**
142
- * Scaffold a new odla project into `rootDir` (default: cwd). Writes an
143
- * `odla.config.mjs` (default name, overridable via `configPath`) plus starter
144
- * `src/odla/schema.mjs` (a single `notes` entity) and `src/odla/rules.mjs`
145
- * (deny-all), and creates the `src/odla` and `.odla` directories. Also runs
146
- * `ensureGitignore` so the local token/credentials paths are ignored.
147
- *
148
- * Fully local and synchronous — no network calls. The config file is only
149
- * written when it doesn't already exist unless `force` is set (otherwise it
150
- * throws); the schema/rules files are written only when missing (never
151
- * overwritten, even with `force`). `appId` must match `^[a-z0-9][a-z0-9-]*$` or
152
- * it throws. Defaults: `envs` → `["dev"]`, `services` → `["db","ai"]`,
153
- * `aiProvider` → `"anthropic"` (which also picks the `keyEnv`, e.g.
154
- * `ANTHROPIC_API_KEY`/`OPENAI_API_KEY`/`GOOGLE_API_KEY`).
155
- *
156
- * @param options.appId Slug for the app (lowercase alphanumerics and hyphens).
157
- * @param options.name Human-readable app name embedded in the config.
158
- * @param options.rootDir Project root (defaults to `process.cwd()`).
159
- * @param options.configPath Config filename relative to root (default `odla.config.mjs`).
160
- * @param options.envs Environment names (default `["dev"]`; production is an explicit opt-in).
161
- * @param options.services Enabled services (default `["db","ai"]`).
162
- * @param options.aiProvider AI provider slug (default `"anthropic"`).
163
- * @param options.force Overwrite an existing config file instead of throwing.
164
- * @param options.stdout Optional console-like sink (defaults to `console`).
165
- */
166
- declare function initProject(options: InitOptions): void;
155
+ /** Read the owner-visible Google connection and mirror health for one env. */
156
+ declare function calendarStatus(options: CalendarLifecycleOptions): Promise<CalendarStatus>;
157
+ /** List calendars visible to the connected Google identity for config authoring. */
158
+ declare function calendarCalendars(options: CalendarLifecycleOptions): Promise<AvailableGoogleCalendar[]>;
159
+ /** Apply the public booking page setting, then complete Google consent + initial sync. */
160
+ declare function calendarConnect(options: CalendarLifecycleOptions): Promise<CalendarStatus>;
161
+ /** Ask the hosted connector for an immediate incremental/full recovery sync. */
162
+ declare function calendarResync(options: CalendarLifecycleOptions): Promise<CalendarStatus>;
163
+ /** Stop watches and delete this connection's encrypted platform token/cursors
164
+ * without purging the mirror or revoking the shared Google project grant. */
165
+ declare function calendarDisconnect(options: CalendarLifecycleOptions): Promise<CalendarStatus>;
167
166
 
168
167
  interface RunResult {
169
168
  code: number;
@@ -188,6 +187,41 @@ interface ClerkAuthConfig {
188
187
  audience?: string;
189
188
  mode?: "client" | "full";
190
189
  }
190
+ /** Read-only event selection applied by the hosted Google calendar connector. */
191
+ interface GoogleCalendarMatchConfig {
192
+ /** Mirror only events whose summary begins with this value. */
193
+ summaryPrefix?: string;
194
+ /** Require the connected identity to organize the event. Defaults to true. */
195
+ organizerSelf?: boolean;
196
+ /** Require at least one attendee. Defaults to true. */
197
+ requireAttendees?: boolean;
198
+ }
199
+ /** Google Calendar intent. OAuth credentials never belong in this config. */
200
+ interface GoogleCalendarConfig {
201
+ /** One through ten provider calendar ids to mirror in each odla environment. */
202
+ calendars: Record<OdlaEnvName, string[]>;
203
+ /** Public Google Appointment Schedule URL for static embed/link mode. */
204
+ bookingPageUrl?: Record<OdlaEnvName, string | null>;
205
+ match?: GoogleCalendarMatchConfig;
206
+ /** Store normalized attendee addresses, or only SHA-256 match keys. */
207
+ attendeePolicy?: "full" | "hashed";
208
+ }
209
+ interface CalendarConfig {
210
+ google: GoogleCalendarConfig;
211
+ }
212
+ /** Canonical, environment-specific config sent to the calendar controller. */
213
+ interface CalendarServiceConfig extends Record<string, unknown> {
214
+ provider: "google";
215
+ access: "read";
216
+ /** Deduplicated provider ids; the hosted connector accepts at most ten. */
217
+ calendars: string[];
218
+ match: {
219
+ organizerSelf: boolean;
220
+ requireAttendees: boolean;
221
+ summaryPrefix?: string;
222
+ };
223
+ attendeePolicy: "full" | "hashed";
224
+ }
191
225
  /** Authored `odla.config.mjs` contract consumed by doctor and provision. */
192
226
  interface OdlaProjectConfig {
193
227
  platformUrl?: string;
@@ -216,6 +250,7 @@ interface OdlaProjectConfig {
216
250
  /** Vault secret name. Defaults to @odla-ai/ai's provider default. */
217
251
  secretName?: string;
218
252
  };
253
+ calendar?: CalendarConfig;
219
254
  o11y?: {
220
255
  /** This service's name in the collector. Defaults to the app id. */
221
256
  service?: string;
@@ -280,6 +315,10 @@ interface ProvisionOptions {
280
315
  interactive?: boolean;
281
316
  /** Test/embedding override for opening the approval URL. Defaults to the OS browser opener. */
282
317
  openApprovalUrl?: (url: string) => Promise<void>;
318
+ /** Test/embedding override for calendar connection polling. */
319
+ calendarPollWait?: (milliseconds: number, signal?: AbortSignal) => Promise<void>;
320
+ /** Maximum calendar consent + initial-sync wait. Defaults to ten minutes. */
321
+ calendarPollTimeoutMs?: number;
283
322
  /** Explicit consent for a non-dry-run plan containing `prod` or `production`. */
284
323
  yes?: boolean;
285
324
  fetch?: typeof fetch;
@@ -303,10 +342,86 @@ interface ProvisionPlan {
303
342
  interface SmokeOptions {
304
343
  configPath: string;
305
344
  env?: string;
345
+ /** Developer-token override used only for owner-visible calendar health. */
346
+ token?: string;
347
+ open?: boolean;
348
+ interactive?: boolean;
349
+ openApprovalUrl?: (url: string) => Promise<void>;
306
350
  fetch?: typeof fetch;
307
351
  stdout?: Pick<typeof console, "log" | "error">;
308
352
  }
309
353
 
354
+ declare const GOOGLE_CALENDAR_READ_SCOPE = "https://www.googleapis.com/auth/calendar.events.readonly";
355
+ /** Resolve the checked-in calendar block into one controller-safe env payload. */
356
+ declare function calendarServiceConfig(cfg: LoadedProjectConfig, env: string): CalendarServiceConfig;
357
+ /** Public Appointment Schedule URL to apply separately from connector config. */
358
+ declare function calendarBookingPageUrl(cfg: LoadedProjectConfig, env: string): string | null | undefined;
359
+
360
+ interface DoctorOptions {
361
+ configPath: string;
362
+ stdout?: Pick<typeof console, "log" | "error">;
363
+ }
364
+ /**
365
+ * Validate and summarize an odla project config entirely offline — no network
366
+ * calls and no file writes. Loads `configPath`, builds the provision plan, and
367
+ * resolves the schema and rules (synthesizing deny-all rules from the schema
368
+ * when `db.rules` is omitted and `db.defaultRules` isn't `false`), then prints a
369
+ * summary line for the app, envs, services, schema entity count, rules namespace
370
+ * count, and AI provider.
371
+ *
372
+ * It then collects warnings for the mistakes provision can't fix silently: a
373
+ * schema with no entities, a rules namespace with no matching entity, the `ai`
374
+ * service enabled without an `ai.provider`, `auth.clerk` entries that reference
375
+ * an unset env var (`$FOO`), an `ai.keyEnv` that isn't set (provider key upload
376
+ * will be skipped), and — when `o11y` is enabled — any env whose local
377
+ * credentials lack an ingest token. It also folds in the shared rule linter,
378
+ * git-tracked secret-shaped files, and wrangler config warnings. Prints `ok`
379
+ * when clean, otherwise the warning list. Purely advisory: never throws on
380
+ * warnings and never mutates anything.
381
+ *
382
+ * @param options.configPath Path to the `odla.config.mjs` to inspect.
383
+ * @param options.stdout Optional console-like sink (defaults to `console`).
384
+ */
385
+ declare function doctor(options: DoctorOptions): Promise<void>;
386
+
387
+ interface InitOptions {
388
+ rootDir?: string;
389
+ configPath?: string;
390
+ appId: string;
391
+ name: string;
392
+ envs?: string[];
393
+ services?: string[];
394
+ aiProvider?: string;
395
+ force?: boolean;
396
+ stdout?: Pick<typeof console, "log" | "error">;
397
+ }
398
+ /**
399
+ * Scaffold a new odla project into `rootDir` (default: cwd). Writes an
400
+ * `odla.config.mjs` (default name, overridable via `configPath`) plus starter
401
+ * `src/odla/schema.mjs` (a single `notes` entity) and `src/odla/rules.mjs`
402
+ * (deny-all), and creates the `src/odla` and `.odla` directories. Also runs
403
+ * `ensureGitignore` so the local token/credentials paths are ignored.
404
+ *
405
+ * Fully local and synchronous — no network calls. The config file is only
406
+ * written when it doesn't already exist unless `force` is set (otherwise it
407
+ * throws); the schema/rules files are written only when missing (never
408
+ * overwritten, even with `force`). `appId` must match `^[a-z0-9][a-z0-9-]*$` or
409
+ * it throws. Defaults: `envs` → `["dev"]`, `services` → `["db","ai"]`,
410
+ * `aiProvider` → `"anthropic"` (which also picks the `keyEnv`, e.g.
411
+ * `ANTHROPIC_API_KEY`/`OPENAI_API_KEY`/`GOOGLE_API_KEY`).
412
+ *
413
+ * @param options.appId Slug for the app (lowercase alphanumerics and hyphens).
414
+ * @param options.name Human-readable app name embedded in the config.
415
+ * @param options.rootDir Project root (defaults to `process.cwd()`).
416
+ * @param options.configPath Config filename relative to root (default `odla.config.mjs`).
417
+ * @param options.envs Environment names (default `["dev"]`; production is an explicit opt-in).
418
+ * @param options.services Enabled services (default `["db","ai"]`).
419
+ * @param options.aiProvider AI provider slug (default `"anthropic"`).
420
+ * @param options.force Overwrite an existing config file instead of throwing.
421
+ * @param options.stdout Optional console-like sink (defaults to `console`).
422
+ */
423
+ declare function initProject(options: InitOptions): void;
424
+
310
425
  /**
311
426
  * Provision an app end-to-end from its config — the primary deploy path, and
312
427
  * (apart from key rotation) idempotent, so re-running is safe. Obtains a
@@ -666,4 +781,4 @@ declare function installSkill(options?: SkillInstallOptions): SkillInstallResult
666
781
  */
667
782
  declare function smoke(options: SmokeOptions): Promise<void>;
668
783
 
669
- export { AGENT_HARNESSES, type AdminAiOptions, type AgentHarness, type AgentHarnessSelector, CAPABILITIES, type CliDependencies, type ConnectGitHubSecuritySourceOptions, type DisconnectGitHubSecuritySourceOptions, type FollowHostedSecurityJobOptions, type GetHostedSecurityIntentOptions, type GetHostedSecurityJobOptions, type HarnessInstallResult, type HostedSecurityProfile, type HostedSecurityResult, type HostedSecurityTokenRequest, type ListGitHubSecuritySourcesOptions, type ListHostedSecurityJobsOptions, type LoadedProjectConfig, type LocalCredentials, type OdlaProjectConfig, type ProvisionOptions, type ProvisionPlan, type RunHostedSecurityOptions, SYSTEM_AI_PURPOSES, type ScopedPlatformTokenOptions, type SecretsPushOptions, type SecretsSetOptions, type SkillInstallOptions, type SkillInstallResult, type SmokeOptions, type StartHostedSecurityJobOptions, type SystemAiPurpose, adminAi, connectGitHubSecuritySource, disconnectGitHubSecuritySource, doctor, followHostedSecurityJob, getHostedSecurityIntent, getHostedSecurityJob, getHostedSecurityPlan, getHostedSecurityReport, getScopedPlatformToken, inferGitHubRepository, initProject, installSkill, isTerminalHostedSecurityStatus, listGitHubSecuritySources, listHostedSecurityJobs, printCapabilities, provision, redactSecrets, repositoryFromGitRemote, runCli, runHostedSecurity, secretsPush, secretsSet, secretsSetClerkKey, smoke, startHostedSecurityJob };
784
+ export { AGENT_HARNESSES, type AdminAiOptions, type AgentHarness, type AgentHarnessSelector, type AvailableGoogleCalendar, CAPABILITIES, type CalendarConfig, type CalendarConnectionState, type CalendarLifecycleOptions, type CalendarServiceConfig, type CalendarStatus, type CliDependencies, type ConnectGitHubSecuritySourceOptions, type DisconnectGitHubSecuritySourceOptions, type FollowHostedSecurityJobOptions, GOOGLE_CALENDAR_READ_SCOPE, type GetHostedSecurityIntentOptions, type GetHostedSecurityJobOptions, type GoogleCalendarConfig, type GoogleCalendarMatchConfig, type HarnessInstallResult, type HostedSecurityProfile, type HostedSecurityResult, type HostedSecurityTokenRequest, type ListGitHubSecuritySourcesOptions, type ListHostedSecurityJobsOptions, type LoadedProjectConfig, type LocalCredentials, type OdlaProjectConfig, type ProvisionOptions, type ProvisionPlan, type RunHostedSecurityOptions, SYSTEM_AI_PURPOSES, type ScopedPlatformTokenOptions, type SecretsPushOptions, type SecretsSetOptions, type SkillInstallOptions, type SkillInstallResult, type SmokeOptions, type StartHostedSecurityJobOptions, type SystemAiPurpose, adminAi, calendarBookingPageUrl, calendarCalendars, calendarConnect, calendarDisconnect, calendarResync, calendarServiceConfig, calendarStatus, connectGitHubSecuritySource, disconnectGitHubSecuritySource, doctor, followHostedSecurityJob, getHostedSecurityIntent, getHostedSecurityJob, getHostedSecurityPlan, getHostedSecurityReport, getScopedPlatformToken, inferGitHubRepository, initProject, installSkill, isTerminalHostedSecurityStatus, listGitHubSecuritySources, listHostedSecurityJobs, printCapabilities, provision, redactSecrets, repositoryFromGitRemote, runCli, runHostedSecurity, secretsPush, secretsSet, secretsSetClerkKey, smoke, startHostedSecurityJob };