@odla-ai/cli 0.5.0 → 0.7.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
@@ -1,3 +1,5 @@
1
+ import { SecurityReport, PlatformSecurityRun } from '@odla-ai/security';
2
+
1
3
  /**
2
4
  * Parse CLI arguments and dispatch to the matching command — the entry point
3
5
  * `bin.ts` invokes. `argv` defaults to `process.argv.slice(2)`; the first
@@ -8,7 +10,11 @@
8
10
  * Recognized commands: `version`/`-v`/`--version` and `help`/`-h`/`--help` print
9
11
  * and return; `init` scaffolds a project (requires `--app-id` and `--name`);
10
12
  * `doctor` validates config offline; `capabilities` prints the responsibility
11
- * boundary; `provision` runs the full provision (including optional secret
13
+ * boundary; `admin ai` reads/updates purpose-specific platform AI policies,
14
+ * transfers write-only credentials, and reads metadata-only attributed usage
15
+ * through separate short-lived exact-scope device grants;
16
+ * `security run` performs an explicitly acknowledged, app-attributed hosted
17
+ * reasoning pass; `provision` runs the full provision (including optional secret
12
18
  * rotation, local vars, and deployed secret push); `smoke` checks a live env;
13
19
  * `setup` and `skill install` install the bundled offline runbooks for Claude
14
20
  * Code, Codex, Cursor, Copilot, Gemini, and `AGENTS.md`-aware agents; and
@@ -21,13 +27,77 @@
21
27
  */
22
28
  declare function runCli(argv?: string[]): Promise<void>;
23
29
 
30
+ /** One exact platform scope obtainable through the admin device flow. */
31
+ type ScopedPlatformScope = "platform:ai:policy:read" | "platform:ai:policy:write" | "platform:ai:credential:read" | "platform:ai:credential:write" | "platform:ai:usage:read" | "platform:ai:audit:read" | "platform:security:self";
32
+ /** Inputs for obtaining one short-lived, exact-scope platform device grant. */
33
+ interface ScopedPlatformTokenOptions {
34
+ platform: string;
35
+ scope: ScopedPlatformScope;
36
+ open?: boolean;
37
+ fetch?: typeof fetch;
38
+ stdout?: Pick<typeof console, "log">;
39
+ openApprovalUrl?: (url: string) => Promise<void>;
40
+ tokenFile?: string;
41
+ }
42
+ /** Obtain/cache one exact platform scope without granting ambient admin. */
43
+ declare function getScopedPlatformToken(options: ScopedPlatformTokenOptions): Promise<string>;
44
+
45
+ /** Hosted platform purposes whose provider, model, and budgets an admin may route. */
46
+ declare const SYSTEM_AI_PURPOSES: readonly ["o11y.triage", "security.discovery", "security.validation"];
47
+ /** One catalog-validated, platform-funded System AI purpose. */
48
+ type SystemAiPurpose = (typeof SYSTEM_AI_PURPOSES)[number];
49
+
50
+ /** Inputs for one System AI policy/catalog read, policy update,
51
+ * credential-status read, write-only credential transfer, or metadata-only
52
+ * usage or admin-audit read. Provider values may come only from a named environment variable
53
+ * or stdin. */
54
+ interface AdminAiOptions {
55
+ action: "show" | "models" | "set" | "credentials" | "credential-set" | "usage" | "audit";
56
+ purpose?: string;
57
+ provider?: string;
58
+ model?: string;
59
+ enabled?: boolean;
60
+ maxInputBytes?: number;
61
+ maxOutputTokens?: number;
62
+ maxCallsPerRun?: number;
63
+ platform?: string;
64
+ token?: string;
65
+ json?: boolean;
66
+ open?: boolean;
67
+ fetch?: typeof fetch;
68
+ stdout?: Pick<typeof console, "log">;
69
+ openApprovalUrl?: (url: string) => Promise<void>;
70
+ credentialProvider?: string;
71
+ fromEnv?: string;
72
+ stdin?: boolean;
73
+ readStdin?: () => Promise<string>;
74
+ discoveryProvider?: string;
75
+ discoveryModel?: string;
76
+ validationProvider?: string;
77
+ validationModel?: string;
78
+ /** Optional metadata-only usage filters. */
79
+ appId?: string;
80
+ env?: string;
81
+ runId?: string;
82
+ limit?: number;
83
+ /** Separate short-lived admin-token cache; never reuses the app developer-token file. */
84
+ tokenFile?: string;
85
+ }
86
+ /** Read or update platform-funded AI routing and inspect attributed usage.
87
+ * Authentication is a short-lived,
88
+ * explicitly scoped device grant; ordinary app developer tokens never become
89
+ * platform admins. Credential writes accept values only from a named env var
90
+ * or stdin, transfer them once, and never place them in argv, output, or the
91
+ * scoped-token cache. */
92
+ declare function adminAi(options: AdminAiOptions): Promise<void>;
93
+
24
94
  /** Stable, machine-readable division of work between the CLI, coding agent,
25
95
  * human operator, and Studio. Printed by `odla-ai capabilities --json`. */
26
96
  declare const CAPABILITIES: {
27
- 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", "push db schema/rules and configure platform AI, auth, and deployment links", "validate config offline and smoke-test a provisioned db environment"];
97
+ 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", "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", "let admins manage system AI policy and credentials, inspect attributed usage, and read immutable admin changes through separate short-lived capability-only approvals"];
28
98
  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"];
29
- 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"];
30
- readonly studio: readonly ["view telemetry and environment state", "perform manual credential recovery when the CLI's local shown-once copy is unavailable"];
99
+ 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"];
100
+ 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"];
31
101
  };
32
102
  type Output = Pick<typeof console, "log">;
33
103
  /** Print the stable responsibility boundary for humans or agent tooling. */
@@ -300,6 +370,61 @@ interface SecretsPushOptions {
300
370
  */
301
371
  declare function secretsPush(options: SecretsPushOptions): Promise<void>;
302
372
 
373
+ /** Built-in security coverage profile selected for a hosted reasoning run. */
374
+ type HostedSecurityProfile = "odla" | "cloudflare-app" | "generic";
375
+ /** Exact attribution and authorization need supplied to a lazy token callback. */
376
+ interface HostedSecurityTokenRequest {
377
+ platform: string;
378
+ appId: string;
379
+ env: string;
380
+ selfAudit: boolean;
381
+ /** Self-audit asks the caller for an explicitly scoped platform credential. */
382
+ /** Ordinary app runs use owner authority and therefore request no platform scope. */
383
+ scope: "platform:security:self" | null;
384
+ }
385
+ /** Local snapshot/orchestration controls for an app-attributed hosted security
386
+ * run. The platform supplies model routes and provider credentials. */
387
+ interface RunHostedSecurityOptions {
388
+ /** Project config; loaded for customer-app runs and ignored for self-audit. */
389
+ configPath?: string;
390
+ /** Scan odla itself under the protected odla-ai/prod identity. */
391
+ selfAudit?: boolean;
392
+ /** Repository directory to snapshot. Defaults to the config root or cwd for self-audit. */
393
+ target?: string;
394
+ /** Private artifact directory. Defaults to `<target>/.odla/security/hosted`. */
395
+ out?: string;
396
+ /** Customer environment. Must be declared in config. Self-audit always uses prod. */
397
+ env?: string;
398
+ profile?: HostedSecurityProfile;
399
+ maxHuntTasks?: number;
400
+ /** Exact acknowledgement required before any source capture or network call. */
401
+ sourceDisclosureAck?: "redacted";
402
+ /** Optional client correlation id; the platform returns the authoritative run id. */
403
+ runId?: string;
404
+ /** Platform override. Customer runs otherwise use config.platformUrl. */
405
+ platform?: string;
406
+ /** Injected app credential; for self-audit this must be explicitly scoped by the caller. */
407
+ token?: string;
408
+ /** Lazy token acquisition. Receives the exact app/env and required scope. */
409
+ getToken?: (request: HostedSecurityTokenRequest) => string | Promise<string>;
410
+ fetch?: typeof fetch;
411
+ signal?: AbortSignal;
412
+ stdout?: Pick<typeof console, "log" | "error">;
413
+ }
414
+ /** Completed local report, public platform run metadata, and private artifact path. */
415
+ interface HostedSecurityResult {
416
+ report: SecurityReport;
417
+ run: Readonly<PlatformSecurityRun>;
418
+ output: string;
419
+ }
420
+ /**
421
+ * Run the hosted, redacted-source security harness for an odla app or odla's
422
+ * protected self-audit identity. Provider/model selection and provider secrets
423
+ * remain platform-owned; this function accepts only an app/scoped bearer and
424
+ * the opaque role grants remain inside @odla-ai/security's reasoner closures.
425
+ */
426
+ declare function runHostedSecurity(options: RunHostedSecurityOptions): Promise<HostedSecurityResult>;
427
+
303
428
  /** Agent harnesses with a first-class local adapter. */
304
429
  declare const AGENT_HARNESSES: readonly ["claude", "codex", "cursor", "copilot", "gemini", "agents"];
305
430
  /** A supported coding-agent harness. `agents` is the portable `AGENTS.md` adapter. */
@@ -379,4 +504,4 @@ declare function installSkill(options?: SkillInstallOptions): SkillInstallResult
379
504
  */
380
505
  declare function smoke(options: SmokeOptions): Promise<void>;
381
506
 
382
- export { AGENT_HARNESSES, type AgentHarness, type AgentHarnessSelector, CAPABILITIES, type HarnessInstallResult, type LoadedProjectConfig, type LocalCredentials, type OdlaProjectConfig, type ProvisionOptions, type ProvisionPlan, type SecretsPushOptions, type SkillInstallOptions, type SkillInstallResult, type SmokeOptions, doctor, initProject, installSkill, printCapabilities, provision, redactSecrets, runCli, secretsPush, smoke };
507
+ export { AGENT_HARNESSES, type AdminAiOptions, type AgentHarness, type AgentHarnessSelector, CAPABILITIES, type HarnessInstallResult, type HostedSecurityProfile, type HostedSecurityResult, type HostedSecurityTokenRequest, type LoadedProjectConfig, type LocalCredentials, type OdlaProjectConfig, type ProvisionOptions, type ProvisionPlan, type RunHostedSecurityOptions, SYSTEM_AI_PURPOSES, type ScopedPlatformTokenOptions, type SecretsPushOptions, type SkillInstallOptions, type SkillInstallResult, type SmokeOptions, type SystemAiPurpose, adminAi, doctor, getScopedPlatformToken, initProject, installSkill, printCapabilities, provision, redactSecrets, runCli, runHostedSecurity, secretsPush, smoke };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { SecurityReport, PlatformSecurityRun } from '@odla-ai/security';
2
+
1
3
  /**
2
4
  * Parse CLI arguments and dispatch to the matching command — the entry point
3
5
  * `bin.ts` invokes. `argv` defaults to `process.argv.slice(2)`; the first
@@ -8,7 +10,11 @@
8
10
  * Recognized commands: `version`/`-v`/`--version` and `help`/`-h`/`--help` print
9
11
  * and return; `init` scaffolds a project (requires `--app-id` and `--name`);
10
12
  * `doctor` validates config offline; `capabilities` prints the responsibility
11
- * boundary; `provision` runs the full provision (including optional secret
13
+ * boundary; `admin ai` reads/updates purpose-specific platform AI policies,
14
+ * transfers write-only credentials, and reads metadata-only attributed usage
15
+ * through separate short-lived exact-scope device grants;
16
+ * `security run` performs an explicitly acknowledged, app-attributed hosted
17
+ * reasoning pass; `provision` runs the full provision (including optional secret
12
18
  * rotation, local vars, and deployed secret push); `smoke` checks a live env;
13
19
  * `setup` and `skill install` install the bundled offline runbooks for Claude
14
20
  * Code, Codex, Cursor, Copilot, Gemini, and `AGENTS.md`-aware agents; and
@@ -21,13 +27,77 @@
21
27
  */
22
28
  declare function runCli(argv?: string[]): Promise<void>;
23
29
 
30
+ /** One exact platform scope obtainable through the admin device flow. */
31
+ type ScopedPlatformScope = "platform:ai:policy:read" | "platform:ai:policy:write" | "platform:ai:credential:read" | "platform:ai:credential:write" | "platform:ai:usage:read" | "platform:ai:audit:read" | "platform:security:self";
32
+ /** Inputs for obtaining one short-lived, exact-scope platform device grant. */
33
+ interface ScopedPlatformTokenOptions {
34
+ platform: string;
35
+ scope: ScopedPlatformScope;
36
+ open?: boolean;
37
+ fetch?: typeof fetch;
38
+ stdout?: Pick<typeof console, "log">;
39
+ openApprovalUrl?: (url: string) => Promise<void>;
40
+ tokenFile?: string;
41
+ }
42
+ /** Obtain/cache one exact platform scope without granting ambient admin. */
43
+ declare function getScopedPlatformToken(options: ScopedPlatformTokenOptions): Promise<string>;
44
+
45
+ /** Hosted platform purposes whose provider, model, and budgets an admin may route. */
46
+ declare const SYSTEM_AI_PURPOSES: readonly ["o11y.triage", "security.discovery", "security.validation"];
47
+ /** One catalog-validated, platform-funded System AI purpose. */
48
+ type SystemAiPurpose = (typeof SYSTEM_AI_PURPOSES)[number];
49
+
50
+ /** Inputs for one System AI policy/catalog read, policy update,
51
+ * credential-status read, write-only credential transfer, or metadata-only
52
+ * usage or admin-audit read. Provider values may come only from a named environment variable
53
+ * or stdin. */
54
+ interface AdminAiOptions {
55
+ action: "show" | "models" | "set" | "credentials" | "credential-set" | "usage" | "audit";
56
+ purpose?: string;
57
+ provider?: string;
58
+ model?: string;
59
+ enabled?: boolean;
60
+ maxInputBytes?: number;
61
+ maxOutputTokens?: number;
62
+ maxCallsPerRun?: number;
63
+ platform?: string;
64
+ token?: string;
65
+ json?: boolean;
66
+ open?: boolean;
67
+ fetch?: typeof fetch;
68
+ stdout?: Pick<typeof console, "log">;
69
+ openApprovalUrl?: (url: string) => Promise<void>;
70
+ credentialProvider?: string;
71
+ fromEnv?: string;
72
+ stdin?: boolean;
73
+ readStdin?: () => Promise<string>;
74
+ discoveryProvider?: string;
75
+ discoveryModel?: string;
76
+ validationProvider?: string;
77
+ validationModel?: string;
78
+ /** Optional metadata-only usage filters. */
79
+ appId?: string;
80
+ env?: string;
81
+ runId?: string;
82
+ limit?: number;
83
+ /** Separate short-lived admin-token cache; never reuses the app developer-token file. */
84
+ tokenFile?: string;
85
+ }
86
+ /** Read or update platform-funded AI routing and inspect attributed usage.
87
+ * Authentication is a short-lived,
88
+ * explicitly scoped device grant; ordinary app developer tokens never become
89
+ * platform admins. Credential writes accept values only from a named env var
90
+ * or stdin, transfer them once, and never place them in argv, output, or the
91
+ * scoped-token cache. */
92
+ declare function adminAi(options: AdminAiOptions): Promise<void>;
93
+
24
94
  /** Stable, machine-readable division of work between the CLI, coding agent,
25
95
  * human operator, and Studio. Printed by `odla-ai capabilities --json`. */
26
96
  declare const CAPABILITIES: {
27
- 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", "push db schema/rules and configure platform AI, auth, and deployment links", "validate config offline and smoke-test a provisioned db environment"];
97
+ 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", "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", "let admins manage system AI policy and credentials, inspect attributed usage, and read immutable admin changes through separate short-lived capability-only approvals"];
28
98
  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"];
29
- 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"];
30
- readonly studio: readonly ["view telemetry and environment state", "perform manual credential recovery when the CLI's local shown-once copy is unavailable"];
99
+ 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"];
100
+ 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"];
31
101
  };
32
102
  type Output = Pick<typeof console, "log">;
33
103
  /** Print the stable responsibility boundary for humans or agent tooling. */
@@ -300,6 +370,61 @@ interface SecretsPushOptions {
300
370
  */
301
371
  declare function secretsPush(options: SecretsPushOptions): Promise<void>;
302
372
 
373
+ /** Built-in security coverage profile selected for a hosted reasoning run. */
374
+ type HostedSecurityProfile = "odla" | "cloudflare-app" | "generic";
375
+ /** Exact attribution and authorization need supplied to a lazy token callback. */
376
+ interface HostedSecurityTokenRequest {
377
+ platform: string;
378
+ appId: string;
379
+ env: string;
380
+ selfAudit: boolean;
381
+ /** Self-audit asks the caller for an explicitly scoped platform credential. */
382
+ /** Ordinary app runs use owner authority and therefore request no platform scope. */
383
+ scope: "platform:security:self" | null;
384
+ }
385
+ /** Local snapshot/orchestration controls for an app-attributed hosted security
386
+ * run. The platform supplies model routes and provider credentials. */
387
+ interface RunHostedSecurityOptions {
388
+ /** Project config; loaded for customer-app runs and ignored for self-audit. */
389
+ configPath?: string;
390
+ /** Scan odla itself under the protected odla-ai/prod identity. */
391
+ selfAudit?: boolean;
392
+ /** Repository directory to snapshot. Defaults to the config root or cwd for self-audit. */
393
+ target?: string;
394
+ /** Private artifact directory. Defaults to `<target>/.odla/security/hosted`. */
395
+ out?: string;
396
+ /** Customer environment. Must be declared in config. Self-audit always uses prod. */
397
+ env?: string;
398
+ profile?: HostedSecurityProfile;
399
+ maxHuntTasks?: number;
400
+ /** Exact acknowledgement required before any source capture or network call. */
401
+ sourceDisclosureAck?: "redacted";
402
+ /** Optional client correlation id; the platform returns the authoritative run id. */
403
+ runId?: string;
404
+ /** Platform override. Customer runs otherwise use config.platformUrl. */
405
+ platform?: string;
406
+ /** Injected app credential; for self-audit this must be explicitly scoped by the caller. */
407
+ token?: string;
408
+ /** Lazy token acquisition. Receives the exact app/env and required scope. */
409
+ getToken?: (request: HostedSecurityTokenRequest) => string | Promise<string>;
410
+ fetch?: typeof fetch;
411
+ signal?: AbortSignal;
412
+ stdout?: Pick<typeof console, "log" | "error">;
413
+ }
414
+ /** Completed local report, public platform run metadata, and private artifact path. */
415
+ interface HostedSecurityResult {
416
+ report: SecurityReport;
417
+ run: Readonly<PlatformSecurityRun>;
418
+ output: string;
419
+ }
420
+ /**
421
+ * Run the hosted, redacted-source security harness for an odla app or odla's
422
+ * protected self-audit identity. Provider/model selection and provider secrets
423
+ * remain platform-owned; this function accepts only an app/scoped bearer and
424
+ * the opaque role grants remain inside @odla-ai/security's reasoner closures.
425
+ */
426
+ declare function runHostedSecurity(options: RunHostedSecurityOptions): Promise<HostedSecurityResult>;
427
+
303
428
  /** Agent harnesses with a first-class local adapter. */
304
429
  declare const AGENT_HARNESSES: readonly ["claude", "codex", "cursor", "copilot", "gemini", "agents"];
305
430
  /** A supported coding-agent harness. `agents` is the portable `AGENTS.md` adapter. */
@@ -379,4 +504,4 @@ declare function installSkill(options?: SkillInstallOptions): SkillInstallResult
379
504
  */
380
505
  declare function smoke(options: SmokeOptions): Promise<void>;
381
506
 
382
- export { AGENT_HARNESSES, type AgentHarness, type AgentHarnessSelector, CAPABILITIES, type HarnessInstallResult, type LoadedProjectConfig, type LocalCredentials, type OdlaProjectConfig, type ProvisionOptions, type ProvisionPlan, type SecretsPushOptions, type SkillInstallOptions, type SkillInstallResult, type SmokeOptions, doctor, initProject, installSkill, printCapabilities, provision, redactSecrets, runCli, secretsPush, smoke };
507
+ export { AGENT_HARNESSES, type AdminAiOptions, type AgentHarness, type AgentHarnessSelector, CAPABILITIES, type HarnessInstallResult, type HostedSecurityProfile, type HostedSecurityResult, type HostedSecurityTokenRequest, type LoadedProjectConfig, type LocalCredentials, type OdlaProjectConfig, type ProvisionOptions, type ProvisionPlan, type RunHostedSecurityOptions, SYSTEM_AI_PURPOSES, type ScopedPlatformTokenOptions, type SecretsPushOptions, type SkillInstallOptions, type SkillInstallResult, type SmokeOptions, type SystemAiPurpose, adminAi, doctor, getScopedPlatformToken, initProject, installSkill, printCapabilities, provision, redactSecrets, runCli, runHostedSecurity, secretsPush, smoke };
package/dist/index.js CHANGED
@@ -2,26 +2,34 @@
2
2
  import {
3
3
  AGENT_HARNESSES,
4
4
  CAPABILITIES,
5
+ SYSTEM_AI_PURPOSES,
6
+ adminAi,
5
7
  doctor,
8
+ getScopedPlatformToken,
6
9
  initProject,
7
10
  installSkill,
8
11
  printCapabilities,
9
12
  provision,
10
13
  redactSecrets,
11
14
  runCli,
15
+ runHostedSecurity,
12
16
  secretsPush,
13
17
  smoke
14
- } from "./chunk-7WZIZCGA.js";
18
+ } from "./chunk-643B2AKG.js";
15
19
  export {
16
20
  AGENT_HARNESSES,
17
21
  CAPABILITIES,
22
+ SYSTEM_AI_PURPOSES,
23
+ adminAi,
18
24
  doctor,
25
+ getScopedPlatformToken,
19
26
  initProject,
20
27
  installSkill,
21
28
  printCapabilities,
22
29
  provision,
23
30
  redactSecrets,
24
31
  runCli,
32
+ runHostedSecurity,
25
33
  secretsPush,
26
34
  smoke
27
35
  };