@topolo/cli 0.4.5 → 0.4.6

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 (2) hide show
  1. package/dist/index.js +71 -17
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -75,6 +75,7 @@ var APP_API_URLS = {
75
75
  auth: "https://auth.topolo.app",
76
76
  backup: "https://backup.topolo.app",
77
77
  books: "https://books.topolo.app",
78
+ brand: "https://brand.topolo.app",
78
79
  bugfix: "https://bugfix.topolo.app",
79
80
  bytes: "https://bytes.topolo.app",
80
81
  calendar: "https://calendar.topolo.app",
@@ -255,6 +256,38 @@ var APPLICATIONS = {
255
256
  }
256
257
  ]
257
258
  },
259
+ "brand": {
260
+ "id": "brand",
261
+ "appDir": "TopoloBrand",
262
+ "name": "topolo-brand",
263
+ "packageName": "@topolo/topolo-brand",
264
+ "productionUrl": "https://brand.topolo.app",
265
+ "services": [
266
+ "brand"
267
+ ],
268
+ "deployTargets": [
269
+ {
270
+ "name": "topolo-brand",
271
+ "kind": "worker",
272
+ "apiUrl": "https://brand.topolo.app",
273
+ "domains": [
274
+ "brand.topolo.app"
275
+ ],
276
+ "routes": [
277
+ "brand.topolo.app"
278
+ ],
279
+ "appId": "brand"
280
+ },
281
+ {
282
+ "name": "topolo-brand-api",
283
+ "kind": "worker",
284
+ "apiUrl": null,
285
+ "domains": [],
286
+ "routes": [],
287
+ "appId": null
288
+ }
289
+ ]
290
+ },
258
291
  "bugfix": {
259
292
  "id": "bugfix",
260
293
  "appDir": "TopoloBugFix",
@@ -2369,6 +2402,8 @@ var TopoloClient = class _TopoloClient {
2369
2402
  requireConfirmForWrites;
2370
2403
  timeoutMs;
2371
2404
  fetchImpl;
2405
+ credentialProvider;
2406
+ credentialLoadInFlight = null;
2372
2407
  refreshCredential;
2373
2408
  refreshInFlight = null;
2374
2409
  debug;
@@ -2396,6 +2431,7 @@ var TopoloClient = class _TopoloClient {
2396
2431
  this.requireConfirmForWrites = options.requireConfirmForWrites !== false;
2397
2432
  this.timeoutMs = options.timeoutMs ?? 3e4;
2398
2433
  this.fetchImpl = options.fetch ?? fetch;
2434
+ this.credentialProvider = options.credentialProvider;
2399
2435
  this.refreshCredential = options.refreshCredential;
2400
2436
  this.debug = options.debug;
2401
2437
  }
@@ -2418,6 +2454,7 @@ var TopoloClient = class _TopoloClient {
2418
2454
  `Mutating ${method} requests require { confirm: true }. This guardrail prevents agents from issuing writes without an explicit human-in-the-loop acknowledgement.`
2419
2455
  );
2420
2456
  }
2457
+ await this.loadCurrentCredential();
2421
2458
  const resolvedService = opts.baseUrl ? { serviceKey: normalizeLookupKey(opts.service), baseUrl: requireHttpOrigin(opts.baseUrl) } : await this.resolveRequestService(opts.service);
2422
2459
  const baseUrl = resolvedService.baseUrl;
2423
2460
  const url = new URL(opts.path, baseUrl.endsWith("/") ? baseUrl : `${baseUrl}/`);
@@ -2529,6 +2566,19 @@ var TopoloClient = class _TopoloClient {
2529
2566
  });
2530
2567
  return parsed;
2531
2568
  }
2569
+ async loadCurrentCredential() {
2570
+ if (!this.credentialProvider) return;
2571
+ this.credentialLoadInFlight ??= this.credentialProvider().then((credential) => {
2572
+ if (!credential) {
2573
+ throw new TopoloAuthError("The configured Topolo credential is no longer available.");
2574
+ }
2575
+ this.credential = credential;
2576
+ return credential;
2577
+ }).finally(() => {
2578
+ this.credentialLoadInFlight = null;
2579
+ });
2580
+ await this.credentialLoadInFlight;
2581
+ }
2532
2582
  async refreshRejectedAccessToken(attemptedAccessToken) {
2533
2583
  if (this.credential.kind === "access_token" && this.credential.accessToken !== attemptedAccessToken) {
2534
2584
  return this.credential;
@@ -3197,6 +3247,7 @@ function normalizeActionCatalogEntry(item) {
3197
3247
  permissionName: pickActionString(a.permission_name) ?? pickActionString(a.permissionName) ?? "",
3198
3248
  requiredPermission: pickActionString(a.required_permission) ?? pickActionString(a.requiredPermission) ?? "",
3199
3249
  authorizationMode: pickAuthorizationMode(a.authorization_mode ?? a.authorizationMode),
3250
+ allowedServices: stringArray(a.allowed_services ?? a.allowedServices),
3200
3251
  inputSchema: plainObject(a.input_schema ?? a.inputSchema),
3201
3252
  outputSchema: plainObject(a.output_schema ?? a.outputSchema),
3202
3253
  agentContract: plainObject(a.agent_contract ?? a.agentContract),
@@ -3218,7 +3269,7 @@ function pickAgentAccess(value) {
3218
3269
  return value === "auto" || value === "confirm" || value === "off" ? value : null;
3219
3270
  }
3220
3271
  function pickAuthorizationMode(value) {
3221
- return value === "runtime" ? "runtime" : "static";
3272
+ return value === "runtime" || value === "public" || value === "service" ? value : "static";
3222
3273
  }
3223
3274
  function plainObject(value) {
3224
3275
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
@@ -3312,6 +3363,7 @@ var CrmModule = class {
3312
3363
  constructor(client) {
3313
3364
  this.client = client;
3314
3365
  }
3366
+ client;
3315
3367
  async listContacts(options = {}) {
3316
3368
  const res = await this.client.request({
3317
3369
  service: "crm",
@@ -3357,6 +3409,7 @@ var IdentityModule = class {
3357
3409
  constructor(client) {
3358
3410
  this.client = client;
3359
3411
  }
3412
+ client;
3360
3413
  /** Returns the resolved user, organization, and permission set for the
3361
3414
  * current credential. Equivalent to `TopoloClient.introspect()` — exposed
3362
3415
  * on this module for symmetry with the other domain modules. */
@@ -3489,6 +3542,7 @@ var APP_API_URLS2 = {
3489
3542
  auth: "https://auth.topolo.app",
3490
3543
  backup: "https://backup.topolo.app",
3491
3544
  books: "https://books.topolo.app",
3545
+ brand: "https://brand.topolo.app",
3492
3546
  bugfix: "https://bugfix.topolo.app",
3493
3547
  bytes: "https://bytes.topolo.app",
3494
3548
  calendar: "https://calendar.topolo.app",
@@ -5964,6 +6018,7 @@ function packageJson(application, target, options) {
5964
6018
  version: "0.1.0",
5965
6019
  private: true,
5966
6020
  type: "module",
6021
+ ...target === "platform" ? { packageManager: "pnpm@10.17.1" } : {},
5967
6022
  scripts,
5968
6023
  dependencies,
5969
6024
  devDependencies
@@ -5982,7 +6037,7 @@ function topoloPackageVersion(packageName, target) {
5982
6037
  "@topolo/login": "^0.1.0",
5983
6038
  "@topolo-io/app-funnel": "^0.1.6",
5984
6039
  "@topolo-io/app-launcher": "^0.1.15",
5985
- "@topolo-io/app-shell": "^0.5.54",
6040
+ "@topolo-io/app-shell": "^0.8.4",
5986
6041
  "@topolo-io/auth-client": "^1.2.1",
5987
6042
  "@topolo-io/auth-middleware": "^0.4.0",
5988
6043
  "@topolo-io/error-middleware": "^0.6.0",
@@ -7459,6 +7514,7 @@ function platformWorkerTs(application, options) {
7459
7514
  "import { withSecurityHeaders } from '@topolo-io/security-headers';",
7460
7515
  "import { withErrorReporting } from '@topolo-io/error-middleware';",
7461
7516
  "import { SCAFFOLD_APP_NAME, SCAFFOLD_SERVICE_SLUG, resolveRuntimeAppId } from './app-identity';",
7517
+ "import { topoloActionContracts } from '../../../topolo.action-contracts.mjs';",
7462
7518
  ...options.resources.workflow ? ["import { WorkflowEntrypoint, type WorkflowEvent, type WorkflowStep } from 'cloudflare:workers';"] : [],
7463
7519
  "",
7464
7520
  "export interface Env {",
@@ -7487,6 +7543,7 @@ function platformWorkerTs(application, options) {
7487
7543
  " // so rt.verifyAuth() targets the correct Auth service per deploy.",
7488
7544
  " authBaseUrl: (env) => env.AUTH_BASE_URL,",
7489
7545
  " authGateway: { enabled: false },",
7546
+ " actionContracts: topoloActionContracts,",
7490
7547
  "});",
7491
7548
  "",
7492
7549
  "async function handleRequest(",
@@ -7516,9 +7573,10 @@ function platformWorkerTs(application, options) {
7516
7573
  " }, { status: 200 });",
7517
7574
  " }",
7518
7575
  "",
7576
+ " const auth = await rt.verifyAuth({ appId });",
7577
+ " if (!auth.ok) return rt.authError(auth);",
7578
+ "",
7519
7579
  " if (url.pathname === '/api/widget') {",
7520
- " const auth = await rt.verifyAuth({ appId });",
7521
- " if (!auth.ok) return rt.authError(auth);",
7522
7580
  " return rt.json(createTopoloWidgetResponse({",
7523
7581
  " appId,",
7524
7582
  " serviceName: SCAFFOLD_APP_NAME,",
@@ -7526,12 +7584,6 @@ function platformWorkerTs(application, options) {
7526
7584
  " }), { status: 200, headers: { 'Cache-Control': 'public, max-age=15' } });",
7527
7585
  " }",
7528
7586
  "",
7529
- " const auth = await rt.verifyAuth({ appId });",
7530
- "",
7531
- " if (!auth.ok) {",
7532
- " return rt.authError(auth);",
7533
- " }",
7534
- "",
7535
7587
  " if (url.pathname === '/api/bootstrap') {",
7536
7588
  ...bootstrapBody,
7537
7589
  " }",
@@ -7890,8 +7942,8 @@ function topoloAppManifestJson(application, options) {
7890
7942
  },
7891
7943
  compatibilityFlags: ["nodejs_compat"],
7892
7944
  buildCommand: {
7893
- staging: "cd ../.. && DEPLOY_ENVIRONMENT=staging VITE_TOPOLO_AUTH_URL=https://auth.stg.topolo.us npm run build",
7894
- production: "cd ../.. && DEPLOY_ENVIRONMENT=production VITE_TOPOLO_AUTH_URL=https://auth.topolo.app npm run build"
7945
+ staging: "cd ../.. && DEPLOY_ENVIRONMENT=staging VITE_TOPOLO_AUTH_URL=https://auth.stg.topolo.us pnpm run build",
7946
+ production: "cd ../.. && DEPLOY_ENVIRONMENT=production VITE_TOPOLO_AUTH_URL=https://auth.topolo.app pnpm run build"
7895
7947
  },
7896
7948
  healthcheckPath: options.api ? "/api/health" : "/",
7897
7949
  ...options.api ? {
@@ -7949,12 +8001,14 @@ function topoloActionContractsMjs() {
7949
8001
  " name: 'widget.get',",
7950
8002
  " method: 'GET',",
7951
8003
  " path: '/api/widget',",
8004
+ " permission: 'workspace:read',",
7952
8005
  " input: emptyInput,",
7953
8006
  " },",
7954
8007
  " 'workspace.bootstrap': {",
7955
8008
  " name: 'workspace.bootstrap',",
7956
8009
  " method: 'GET',",
7957
8010
  " path: '/api/bootstrap',",
8011
+ " permission: 'workspace:read',",
7958
8012
  " input: emptyInput,",
7959
8013
  " },",
7960
8014
  "};",
@@ -8145,7 +8199,7 @@ function cloudcontrolJson(application, options) {
8145
8199
  cloudflare_account_id: STAGING_CLOUDFLARE_ACCOUNT_ID,
8146
8200
  config_path: "apps/web/wrangler.toml",
8147
8201
  workdir: "apps/web",
8148
- build_command: "DEPLOY_ENVIRONMENT=staging VITE_TOPOLO_AUTH_URL=https://auth.stg.topolo.us npm run build",
8202
+ build_command: "cd ../.. && DEPLOY_ENVIRONMENT=staging VITE_TOPOLO_AUTH_URL=https://auth.stg.topolo.us pnpm run build",
8149
8203
  output_dir: null,
8150
8204
  production_branch: "staging",
8151
8205
  healthcheck_path: "/api/health",
@@ -8178,7 +8232,7 @@ function cloudcontrolJson(application, options) {
8178
8232
  cloudflare_account_id: CLOUDFLARE_ACCOUNT_ID,
8179
8233
  config_path: "apps/web/wrangler.toml",
8180
8234
  workdir: "apps/web",
8181
- build_command: "DEPLOY_ENVIRONMENT=production VITE_TOPOLO_AUTH_URL=https://auth.topolo.app npm run build",
8235
+ build_command: "cd ../.. && DEPLOY_ENVIRONMENT=production VITE_TOPOLO_AUTH_URL=https://auth.topolo.app pnpm run build",
8182
8236
  output_dir: null,
8183
8237
  production_branch: "main",
8184
8238
  healthcheck_path: "/api/health",
@@ -8246,17 +8300,17 @@ function cloudcontrolJson(application, options) {
8246
8300
  ci_targets: [
8247
8301
  {
8248
8302
  name: "typecheck",
8249
- command: "npm run typecheck",
8303
+ command: "pnpm run typecheck",
8250
8304
  required: true
8251
8305
  },
8252
8306
  {
8253
8307
  name: "test",
8254
- command: "npm run test",
8308
+ command: "pnpm run test",
8255
8309
  required: true
8256
8310
  },
8257
8311
  {
8258
8312
  name: "build",
8259
- command: "npm run build",
8313
+ command: "pnpm run build",
8260
8314
  required: true
8261
8315
  }
8262
8316
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topolo/cli",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "description": "Command-line interface for Topolo developers, operators, and agents, with internal first-party scaffolding available under the topolo platform namespace.",
5
5
  "type": "module",
6
6
  "bin": {