@m6d/cortex-cli 0.24.2 → 0.25.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m6d/cortex-cli",
3
- "version": "0.24.2",
3
+ "version": "0.25.1",
4
4
  "description": "Scaffold Cortex projects and manage a Cortex deployment",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -516,6 +516,13 @@ export const managementProcedureKinds = {
516
516
  "observability.unhealthyToolIds": "query",
517
517
  "observability.unusedSkillIds": "query",
518
518
  "observability.updateSchemaDrift": "mutation",
519
+ "orgs.create": "mutation",
520
+ "orgs.delete": "mutation",
521
+ "orgs.inviteOwner": "mutation",
522
+ "orgs.list": "query",
523
+ "orgs.options": "query",
524
+ "orgs.restore": "mutation",
525
+ "orgs.suspend": "mutation",
519
526
  "publishing.exclusive": "query",
520
527
  "publishing.history": "query",
521
528
  "publishing.latest": "query",
@@ -590,9 +597,14 @@ export const managementProcedureKinds = {
590
597
  "triggers.setAudience": "mutation",
591
598
  "triggers.toggle": "mutation",
592
599
  "triggers.update": "mutation",
593
- "users.create": "mutation",
600
+ "users.accounts": "query",
601
+ "users.invite": "mutation",
594
602
  "users.list": "query",
603
+ "users.listInvitations": "query",
604
+ "users.remove": "mutation",
605
+ "users.revokeInvitation": "mutation",
595
606
  "users.roleOptions": "query",
607
+ "users.setAccountActive": "mutation",
596
608
  "users.setActive": "mutation",
597
609
  "users.setRoles": "mutation",
598
610
  "users.setTempPassword": "mutation",
@@ -3841,7 +3853,7 @@ export type ManagementProcedures = {
3841
3853
  id: string;
3842
3854
  kind: "turn" | "subagent" | "tool";
3843
3855
  status: "running" | "waiting" | "completed" | "failed" | "cancelled";
3844
- reason: "no_output" | "invalid_output" | "stopped" | "cancelled" | "parent_cancelled" | "lost" | "timeout" | null;
3856
+ reason: "no_output" | "invalid_output" | "stopped" | "cancelled" | "parent_cancelled" | "lost" | "timeout" | "output_limit" | null;
3845
3857
  createdAt: string;
3846
3858
  finishedAt: string | null;
3847
3859
  source: "user" | "trigger" | "schedule" | "run" | null;
@@ -4017,7 +4029,7 @@ export type ManagementProcedures = {
4017
4029
  id: string;
4018
4030
  kind: "turn" | "subagent" | "tool";
4019
4031
  status: "running" | "waiting" | "completed" | "failed" | "cancelled";
4020
- reason: "no_output" | "invalid_output" | "stopped" | "cancelled" | "parent_cancelled" | "lost" | "timeout" | null;
4032
+ reason: "no_output" | "invalid_output" | "stopped" | "cancelled" | "parent_cancelled" | "lost" | "timeout" | "output_limit" | null;
4021
4033
  createdAt: string;
4022
4034
  finishedAt: string | null;
4023
4035
  source: "user" | "trigger" | "schedule" | "run" | null;
@@ -4188,6 +4200,120 @@ export type ManagementProcedures = {
4188
4200
  updatedAt: string;
4189
4201
  };
4190
4202
  };
4203
+ /** Create an org with its Administrator role and assistant, and invite its owner as Administrator; returns the org and the invitation, whose link path is shown only once and expires in 7 days. */
4204
+ "orgs.create": {
4205
+ input: {
4206
+ /** The org's address in engine URLs (`/orgs/<slug>/...`): lowercase letters, digits and single hyphens, unique, and never changed. */
4207
+ slug: string;
4208
+ name: string;
4209
+ ownerEmail: string;
4210
+ };
4211
+ output: {
4212
+ id: string;
4213
+ slug: string;
4214
+ name: string;
4215
+ suspendedAt: string | null;
4216
+ purgeAt: string | null;
4217
+ createdAt: string;
4218
+ updatedAt: string;
4219
+ invitation: {
4220
+ id: string;
4221
+ email: string;
4222
+ expiresAt: string;
4223
+ invitePath: string;
4224
+ };
4225
+ };
4226
+ };
4227
+ /** Delete an org: it is suspended at once and purged with all its data and files after 30 days, unless restored first. */
4228
+ "orgs.delete": {
4229
+ input: {
4230
+ id: string;
4231
+ };
4232
+ output: {
4233
+ id: string;
4234
+ slug: string;
4235
+ name: string;
4236
+ suspendedAt: string | null;
4237
+ purgeAt: string | null;
4238
+ createdAt: string;
4239
+ updatedAt: string;
4240
+ };
4241
+ };
4242
+ /** Invite an email into an org as its Administrator, so an org left without one gets it back; returns the invitation link's path, shown only once, which expires in 7 days. */
4243
+ "orgs.inviteOwner": {
4244
+ input: {
4245
+ id: string;
4246
+ ownerEmail: string;
4247
+ };
4248
+ output: {
4249
+ id: string;
4250
+ email: string;
4251
+ expiresAt: string;
4252
+ invitePath: string;
4253
+ };
4254
+ };
4255
+ /** List the deployment's orgs with pagination and search by name or slug, suspended and deleted ones included. */
4256
+ "orgs.list": {
4257
+ input: {
4258
+ pageIndex?: number;
4259
+ pageSize?: number;
4260
+ q?: string;
4261
+ };
4262
+ output: {
4263
+ items: Array<{
4264
+ id: string;
4265
+ slug: string;
4266
+ name: string;
4267
+ suspendedAt: string | null;
4268
+ purgeAt: string | null;
4269
+ createdAt: string;
4270
+ updatedAt: string;
4271
+ }>;
4272
+ /** Every row the caller may see, ignoring the search and filters. */
4273
+ count: number;
4274
+ /** The rows matching the search and filters, over all pages: the total to report. */
4275
+ filteredCount: number;
4276
+ };
4277
+ };
4278
+ /** Each org's id, slug and name, suspended and deleted ones included, for selectors. */
4279
+ "orgs.options": {
4280
+ input: undefined;
4281
+ output: Array<{
4282
+ id: string;
4283
+ slug: string;
4284
+ name: string;
4285
+ }>;
4286
+ };
4287
+ /** Restore a suspended or deleted org before its purge, as it was, its assistant brought up to this release. */
4288
+ "orgs.restore": {
4289
+ input: {
4290
+ id: string;
4291
+ };
4292
+ output: {
4293
+ id: string;
4294
+ slug: string;
4295
+ name: string;
4296
+ suspendedAt: string | null;
4297
+ purgeAt: string | null;
4298
+ createdAt: string;
4299
+ updatedAt: string;
4300
+ };
4301
+ };
4302
+ /** Suspend an org: its engine routes, sessions and credentials are refused until it is restored. */
4303
+ "orgs.suspend": {
4304
+ input: {
4305
+ id: string;
4306
+ };
4307
+ output: {
4308
+ id: string;
4309
+ slug: string;
4310
+ name: string;
4311
+ suspendedAt: string | null;
4312
+ purgeAt: string | null;
4313
+ createdAt: string;
4314
+ updatedAt: string;
4315
+ };
4316
+ };
4191
4317
  /** Components of every kind shared with this agent alone: what deleting it leaves shared with nobody, unless `agents.delete` names them in `deleteComponentIds`. */
4192
4318
  "publishing.exclusive": {
4193
4319
  input: {
@@ -4242,13 +4368,13 @@ export type ManagementProcedures = {
4242
4368
  input: {
4243
4369
  name: string;
4244
4370
  description: string;
4245
- permissions: Array<"agents:read" | "agents:write" | "tools:read" | "tools:write" | "tools:execute" | "services:read" | "services:write" | "skills:read" | "skills:write" | "triggers:read" | "triggers:write" | "triggers:fire" | "datasets:read" | "datasets:write" | "datasets:test" | "webhooks:read" | "webhooks:write" | "mcp-servers:read" | "mcp-servers:write" | "knowledge:read" | "knowledge:write" | "secrets:read" | "secrets:write" | "credentials:read" | "credentials:write" | "model-providers:read" | "model-providers:write" | "management-keys:use" | "servers:read" | "servers:write" | "threads:read" | "playground:use" | "publishing:read" | "manifests:apply" | "audit:read" | "observability:read" | "settings:manage" | "users:manage" | "roles:manage">;
4371
+ permissions: Array<"agents:read" | "agents:write" | "tools:read" | "tools:write" | "tools:execute" | "services:read" | "services:write" | "skills:read" | "skills:write" | "triggers:read" | "triggers:write" | "triggers:fire" | "datasets:read" | "datasets:write" | "datasets:test" | "webhooks:read" | "webhooks:write" | "mcp-servers:read" | "mcp-servers:write" | "knowledge:read" | "knowledge:write" | "secrets:read" | "secrets:write" | "credentials:read" | "credentials:write" | "model-providers:read" | "model-providers:write" | "management-keys:use" | "servers:read" | "servers:write" | "threads:read" | "playground:use" | "publishing:read" | "manifests:apply" | "audit:read" | "observability:read" | "settings:manage" | "users:manage" | "roles:manage" | "orgs:manage">;
4246
4372
  };
4247
4373
  output: {
4248
4374
  id: string;
4249
4375
  name: string;
4250
4376
  description: string;
4251
- permissions: Array<"agents:read" | "agents:write" | "tools:read" | "tools:write" | "tools:execute" | "services:read" | "services:write" | "skills:read" | "skills:write" | "triggers:read" | "triggers:write" | "triggers:fire" | "datasets:read" | "datasets:write" | "datasets:test" | "webhooks:read" | "webhooks:write" | "mcp-servers:read" | "mcp-servers:write" | "knowledge:read" | "knowledge:write" | "secrets:read" | "secrets:write" | "credentials:read" | "credentials:write" | "model-providers:read" | "model-providers:write" | "management-keys:use" | "servers:read" | "servers:write" | "threads:read" | "playground:use" | "publishing:read" | "manifests:apply" | "audit:read" | "observability:read" | "settings:manage" | "users:manage" | "roles:manage">;
4377
+ permissions: Array<"agents:read" | "agents:write" | "tools:read" | "tools:write" | "tools:execute" | "services:read" | "services:write" | "skills:read" | "skills:write" | "triggers:read" | "triggers:write" | "triggers:fire" | "datasets:read" | "datasets:write" | "datasets:test" | "webhooks:read" | "webhooks:write" | "mcp-servers:read" | "mcp-servers:write" | "knowledge:read" | "knowledge:write" | "secrets:read" | "secrets:write" | "credentials:read" | "credentials:write" | "model-providers:read" | "model-providers:write" | "management-keys:use" | "servers:read" | "servers:write" | "threads:read" | "playground:use" | "publishing:read" | "manifests:apply" | "audit:read" | "observability:read" | "settings:manage" | "users:manage" | "roles:manage" | "orgs:manage">;
4252
4378
  };
4253
4379
  };
4254
4380
  /** Delete a role; the built-in Administrator role cannot be deleted. */
@@ -4270,7 +4396,7 @@ export type ManagementProcedures = {
4270
4396
  id: string;
4271
4397
  name: string;
4272
4398
  description: string;
4273
- permissions: Array<"agents:read" | "agents:write" | "tools:read" | "tools:write" | "tools:execute" | "services:read" | "services:write" | "skills:read" | "skills:write" | "triggers:read" | "triggers:write" | "triggers:fire" | "datasets:read" | "datasets:write" | "datasets:test" | "webhooks:read" | "webhooks:write" | "mcp-servers:read" | "mcp-servers:write" | "knowledge:read" | "knowledge:write" | "secrets:read" | "secrets:write" | "credentials:read" | "credentials:write" | "model-providers:read" | "model-providers:write" | "management-keys:use" | "servers:read" | "servers:write" | "threads:read" | "playground:use" | "publishing:read" | "manifests:apply" | "audit:read" | "observability:read" | "settings:manage" | "users:manage" | "roles:manage">;
4399
+ permissions: Array<"agents:read" | "agents:write" | "tools:read" | "tools:write" | "tools:execute" | "services:read" | "services:write" | "skills:read" | "skills:write" | "triggers:read" | "triggers:write" | "triggers:fire" | "datasets:read" | "datasets:write" | "datasets:test" | "webhooks:read" | "webhooks:write" | "mcp-servers:read" | "mcp-servers:write" | "knowledge:read" | "knowledge:write" | "secrets:read" | "secrets:write" | "credentials:read" | "credentials:write" | "model-providers:read" | "model-providers:write" | "management-keys:use" | "servers:read" | "servers:write" | "threads:read" | "playground:use" | "publishing:read" | "manifests:apply" | "audit:read" | "observability:read" | "settings:manage" | "users:manage" | "roles:manage" | "orgs:manage">;
4274
4400
  builtInId: string | null;
4275
4401
  createdAt: string;
4276
4402
  assignedUsers: number;
@@ -4286,14 +4412,14 @@ export type ManagementProcedures = {
4286
4412
  input: {
4287
4413
  name: string;
4288
4414
  description: string;
4289
- permissions: Array<"agents:read" | "agents:write" | "tools:read" | "tools:write" | "tools:execute" | "services:read" | "services:write" | "skills:read" | "skills:write" | "triggers:read" | "triggers:write" | "triggers:fire" | "datasets:read" | "datasets:write" | "datasets:test" | "webhooks:read" | "webhooks:write" | "mcp-servers:read" | "mcp-servers:write" | "knowledge:read" | "knowledge:write" | "secrets:read" | "secrets:write" | "credentials:read" | "credentials:write" | "model-providers:read" | "model-providers:write" | "management-keys:use" | "servers:read" | "servers:write" | "threads:read" | "playground:use" | "publishing:read" | "manifests:apply" | "audit:read" | "observability:read" | "settings:manage" | "users:manage" | "roles:manage">;
4415
+ permissions: Array<"agents:read" | "agents:write" | "tools:read" | "tools:write" | "tools:execute" | "services:read" | "services:write" | "skills:read" | "skills:write" | "triggers:read" | "triggers:write" | "triggers:fire" | "datasets:read" | "datasets:write" | "datasets:test" | "webhooks:read" | "webhooks:write" | "mcp-servers:read" | "mcp-servers:write" | "knowledge:read" | "knowledge:write" | "secrets:read" | "secrets:write" | "credentials:read" | "credentials:write" | "model-providers:read" | "model-providers:write" | "management-keys:use" | "servers:read" | "servers:write" | "threads:read" | "playground:use" | "publishing:read" | "manifests:apply" | "audit:read" | "observability:read" | "settings:manage" | "users:manage" | "roles:manage" | "orgs:manage">;
4290
4416
  id: string;
4291
4417
  };
4292
4418
  output: {
4293
4419
  id: string;
4294
4420
  name: string;
4295
4421
  description: string;
4296
- permissions: Array<"agents:read" | "agents:write" | "tools:read" | "tools:write" | "tools:execute" | "services:read" | "services:write" | "skills:read" | "skills:write" | "triggers:read" | "triggers:write" | "triggers:fire" | "datasets:read" | "datasets:write" | "datasets:test" | "webhooks:read" | "webhooks:write" | "mcp-servers:read" | "mcp-servers:write" | "knowledge:read" | "knowledge:write" | "secrets:read" | "secrets:write" | "credentials:read" | "credentials:write" | "model-providers:read" | "model-providers:write" | "management-keys:use" | "servers:read" | "servers:write" | "threads:read" | "playground:use" | "publishing:read" | "manifests:apply" | "audit:read" | "observability:read" | "settings:manage" | "users:manage" | "roles:manage">;
4422
+ permissions: Array<"agents:read" | "agents:write" | "tools:read" | "tools:write" | "tools:execute" | "services:read" | "services:write" | "skills:read" | "skills:write" | "triggers:read" | "triggers:write" | "triggers:fire" | "datasets:read" | "datasets:write" | "datasets:test" | "webhooks:read" | "webhooks:write" | "mcp-servers:read" | "mcp-servers:write" | "knowledge:read" | "knowledge:write" | "secrets:read" | "secrets:write" | "credentials:read" | "credentials:write" | "model-providers:read" | "model-providers:write" | "management-keys:use" | "servers:read" | "servers:write" | "threads:read" | "playground:use" | "publishing:read" | "manifests:apply" | "audit:read" | "observability:read" | "settings:manage" | "users:manage" | "roles:manage" | "orgs:manage">;
4297
4423
  };
4298
4424
  };
4299
4425
  /** Delete a secret; fails while a credential or an agent's auth (its signing secret or reCAPTCHA API key) still references it. */
@@ -4438,7 +4564,6 @@ export type ManagementProcedures = {
4438
4564
  syncError: "egress_blocked" | "timeout" | "upstream_failed" | "response_too_large" | "upstream_status" | "invalid_manifest" | "key_unavailable" | "name_taken" | "credential_in_name" | "variable_in_use" | "verify_in_use" | "still_referenced" | "unexpected" | null;
4439
4565
  syncAttempt: number;
4440
4566
  syncSettledAttempt: number;
4441
- system: boolean;
4442
4567
  signInChecksPerMinute: number;
4443
4568
  triggerChecksPerMinute: number;
4444
4569
  modelProvider: string | null;
@@ -4485,7 +4610,6 @@ export type ManagementProcedures = {
4485
4610
  syncError: "egress_blocked" | "timeout" | "upstream_failed" | "response_too_large" | "upstream_status" | "invalid_manifest" | "key_unavailable" | "name_taken" | "credential_in_name" | "variable_in_use" | "verify_in_use" | "still_referenced" | "unexpected" | null;
4486
4611
  syncAttempt: number;
4487
4612
  syncSettledAttempt: number;
4488
- system: boolean;
4489
4613
  signInChecksPerMinute: number;
4490
4614
  triggerChecksPerMinute: number;
4491
4615
  modelProvider: string | null;
@@ -4507,7 +4631,6 @@ export type ManagementProcedures = {
4507
4631
  description: string | null;
4508
4632
  url: string | null;
4509
4633
  keySecretName: string | null;
4510
- system: boolean;
4511
4634
  syncedAt: string | null;
4512
4635
  syncError: "egress_blocked" | "timeout" | "upstream_failed" | "response_too_large" | "upstream_status" | "invalid_manifest" | "key_unavailable" | "name_taken" | "credential_in_name" | "variable_in_use" | "verify_in_use" | "still_referenced" | "unexpected" | null;
4513
4636
  createdAt: string;
@@ -4549,7 +4672,6 @@ export type ManagementProcedures = {
4549
4672
  description: string | null;
4550
4673
  url: string | null;
4551
4674
  keySecretName: string | null;
4552
- system: boolean;
4553
4675
  syncedAt: string | null;
4554
4676
  syncError: "egress_blocked" | "timeout" | "upstream_failed" | "response_too_large" | "upstream_status" | "invalid_manifest" | "key_unavailable" | "name_taken" | "credential_in_name" | "variable_in_use" | "verify_in_use" | "still_referenced" | "unexpected" | null;
4555
4677
  createdAt: string;
@@ -4561,11 +4683,9 @@ export type ManagementProcedures = {
4561
4683
  filteredCount: number;
4562
4684
  };
4563
4685
  };
4564
- /** Each server's id, name and display name, for selectors. Cortex's own system server is left out unless `includeSystem` asks for it, as a filter over its threads does. */
4686
+ /** Each server's id, name and display name, for selectors. */
4565
4687
  "servers.options": {
4566
- input: {
4567
- includeSystem?: boolean;
4568
- };
4688
+ input: undefined;
4569
4689
  output: Array<{
4570
4690
  id: string;
4571
4691
  name: string;
@@ -4627,7 +4747,6 @@ export type ManagementProcedures = {
4627
4747
  syncError: "egress_blocked" | "timeout" | "upstream_failed" | "response_too_large" | "upstream_status" | "invalid_manifest" | "key_unavailable" | "name_taken" | "credential_in_name" | "variable_in_use" | "verify_in_use" | "still_referenced" | "unexpected" | null;
4628
4748
  syncAttempt: number;
4629
4749
  syncSettledAttempt: number;
4630
- system: boolean;
4631
4750
  signInChecksPerMinute: number;
4632
4751
  triggerChecksPerMinute: number;
4633
4752
  modelProvider: string | null;
@@ -4858,23 +4977,27 @@ export type ManagementProcedures = {
4858
4977
  name: string;
4859
4978
  };
4860
4979
  };
4861
- /** Deployment settings: log and thread retention. */
4980
+ /** The org's settings: log and thread retention, and the browser origins its engine routes admit. */
4862
4981
  "settings.get": {
4863
4982
  input: undefined;
4864
4983
  output: {
4865
4984
  logRetentionDays: number;
4866
4985
  threadRetentionDays: number | null;
4986
+ corsOrigins: Array<string>;
4867
4987
  };
4868
4988
  };
4869
- /** Change retention settings. */
4989
+ /** Change the org's settings: retention, and the browser origins its engine routes admit. */
4870
4990
  "settings.update": {
4871
4991
  input: {
4872
4992
  logRetentionDays: number;
4873
4993
  threadRetentionDays?: number;
4994
+ /** Browser origins, beside the console's own, that may call the org's engine routes, such as a site embedding its widget. */
4995
+ corsOrigins: Array<string>;
4874
4996
  };
4875
4997
  output: {
4876
4998
  logRetentionDays: number;
4877
4999
  threadRetentionDays: number | null;
5000
+ corsOrigins: Array<string>;
4878
5001
  };
4879
5002
  };
4880
5003
  /** How many published skills an agent has. */
@@ -6085,7 +6208,7 @@ export type ManagementProcedures = {
6085
6208
  kind: "turn" | "subagent" | "tool";
6086
6209
  subagentRunId: string | null;
6087
6210
  status: "running" | "waiting" | "completed" | "failed" | "cancelled";
6088
- reason: "no_output" | "invalid_output" | "stopped" | "cancelled" | "parent_cancelled" | "lost" | "timeout" | null;
6211
+ reason: "no_output" | "invalid_output" | "stopped" | "cancelled" | "parent_cancelled" | "lost" | "timeout" | "output_limit" | null;
6089
6212
  result: unknown;
6090
6213
  waits: Array<{
6091
6214
  kind: "approval" | "client_tool";
@@ -6169,7 +6292,7 @@ export type ManagementProcedures = {
6169
6292
  kind: "turn" | "subagent" | "tool";
6170
6293
  subagentRunId: string | null;
6171
6294
  status: "running" | "waiting" | "completed" | "failed" | "cancelled";
6172
- reason: "no_output" | "invalid_output" | "stopped" | "cancelled" | "parent_cancelled" | "lost" | "timeout" | null;
6295
+ reason: "no_output" | "invalid_output" | "stopped" | "cancelled" | "parent_cancelled" | "lost" | "timeout" | "output_limit" | null;
6173
6296
  result: unknown;
6174
6297
  waits: Array<{
6175
6298
  kind: "approval" | "client_tool";
@@ -6253,8 +6376,8 @@ export type ManagementProcedures = {
6253
6376
  id: string;
6254
6377
  name: string;
6255
6378
  displayName: Partial<Record<"en" | "ar", string>>;
6379
+ fireUrl: string | null;
6256
6380
  }>;
6257
- engineUrl: string | null;
6258
6381
  variables: Array<{
6259
6382
  name: string;
6260
6383
  description: string;
@@ -6461,21 +6584,48 @@ export type ManagementProcedures = {
6461
6584
  name: string;
6462
6585
  };
6463
6586
  };
6464
- /** Create a user with a temporary password and roles. */
6465
- "users.create": {
6587
+ /** List every account on the deployment with pagination, search by name or email, the orgs each is a member of, and optionally only one org's members. */
6588
+ "users.accounts": {
6589
+ input: {
6590
+ pageIndex?: number;
6591
+ pageSize?: number;
6592
+ q?: string;
6593
+ orgId?: string;
6594
+ };
6595
+ output: {
6596
+ items: Array<{
6597
+ id: string;
6598
+ name: string;
6599
+ email: string;
6600
+ banned: boolean;
6601
+ mustChangePassword: boolean;
6602
+ createdAt: string;
6603
+ orgs: Array<{
6604
+ id: string;
6605
+ name: string;
6606
+ }>;
6607
+ manageable: boolean;
6608
+ }>;
6609
+ /** Every row the caller may see, ignoring the search and filters. */
6610
+ count: number;
6611
+ /** The rows matching the search and filters, over all pages: the total to report. */
6612
+ filteredCount: number;
6613
+ };
6614
+ };
6615
+ /** Invite an email into the org with roles; returns the accept link's path, shown only once, which expires in 7 days. */
6616
+ "users.invite": {
6466
6617
  input: {
6467
- name: string;
6468
6618
  email: string;
6469
- tempPassword: string;
6470
6619
  roleIds: Array<string>;
6471
6620
  };
6472
6621
  output: {
6473
6622
  id: string;
6474
- name: string;
6475
6623
  email: string;
6624
+ expiresAt: string;
6625
+ invitePath: string;
6476
6626
  };
6477
6627
  };
6478
- /** List users with pagination, search, and their roles. */
6628
+ /** List the org's members with pagination, search, their roles, and whether each is active in the org. */
6479
6629
  "users.list": {
6480
6630
  input: {
6481
6631
  pageIndex?: number;
@@ -6489,6 +6639,32 @@ export type ManagementProcedures = {
6489
6639
  email: string;
6490
6640
  banned: boolean;
6491
6641
  mustChangePassword: boolean;
6642
+ joinedAt: string;
6643
+ deactivatedAt: string | null;
6644
+ roles: Array<{
6645
+ id: string;
6646
+ name: string;
6647
+ builtInId: string | null;
6648
+ }>;
6649
+ }>;
6650
+ /** Every row the caller may see, ignoring the search and filters. */
6651
+ count: number;
6652
+ /** The rows matching the search and filters, over all pages: the total to report. */
6653
+ filteredCount: number;
6654
+ };
6655
+ };
6656
+ /** List the org's invitations not yet accepted, with the roles each grants. */
6657
+ "users.listInvitations": {
6658
+ input: {
6659
+ pageIndex?: number;
6660
+ pageSize?: number;
6661
+ q?: string;
6662
+ };
6663
+ output: {
6664
+ items: Array<{
6665
+ id: string;
6666
+ email: string;
6667
+ expiresAt: string;
6492
6668
  createdAt: string;
6493
6669
  roles: Array<{
6494
6670
  id: string;
@@ -6502,6 +6678,20 @@ export type ManagementProcedures = {
6502
6678
  filteredCount: number;
6503
6679
  };
6504
6680
  };
6681
+ /** Remove a member from the org with their roles and management keys there; the account stays. */
6682
+ "users.remove": {
6683
+ input: {
6684
+ userId: string;
6685
+ };
6686
+ output: null;
6687
+ };
6688
+ /** Revoke a pending invitation; its link stops working. */
6689
+ "users.revokeInvitation": {
6690
+ input: {
6691
+ id: string;
6692
+ };
6693
+ output: null;
6694
+ };
6505
6695
  /** Role id and name pairs for assignment. */
6506
6696
  "users.roleOptions": {
6507
6697
  input: undefined;
@@ -6511,7 +6701,15 @@ export type ManagementProcedures = {
6511
6701
  builtInId: string | null;
6512
6702
  }>;
6513
6703
  };
6514
- /** Deactivate or reactivate a user; deactivation also revokes their sessions and management keys. */
6704
+ /** Deactivate or reactivate an account in every org; deactivation also ends its sessions and revokes its management keys. */
6705
+ "users.setAccountActive": {
6706
+ input: {
6707
+ userId: string;
6708
+ active: boolean;
6709
+ };
6710
+ output: null;
6711
+ };
6712
+ /** Deactivate or reactivate a member in the org; deactivation also revokes their management keys there. */
6515
6713
  "users.setActive": {
6516
6714
  input: {
6517
6715
  userId: string;
@@ -6519,7 +6717,7 @@ export type ManagementProcedures = {
6519
6717
  };
6520
6718
  output: null;
6521
6719
  };
6522
- /** Replace the user's roles. */
6720
+ /** Replace a member's roles in the org. */
6523
6721
  "users.setRoles": {
6524
6722
  input: {
6525
6723
  userId: string;
@@ -6527,7 +6725,7 @@ export type ManagementProcedures = {
6527
6725
  };
6528
6726
  output: null;
6529
6727
  };
6530
- /** Set a temporary password the user must change on next login; this also revokes their sessions and management keys. */
6728
+ /** Set a temporary password the user must change on next login; this also ends their sessions and revokes their management keys in every org. */
6531
6729
  "users.setTempPassword": {
6532
6730
  input: {
6533
6731
  userId: string;
@@ -14,7 +14,8 @@ export type RunStatus = (typeof RUN_STATUSES)[number];
14
14
  /**
15
15
  * Why a run ended as it did: a trigger's answer that never came or never
16
16
  * fit its schema, a stop, a cancel (its own, or its parent's), a producer
17
- * that died (`lost`), or one that ran out of time.
17
+ * that died (`lost`), one that ran out of time, or a model answer the
18
+ * output limit cut off (`output_limit`).
18
19
  */
19
20
  export const RUN_REASONS = [
20
21
  "no_output",
@@ -24,6 +25,7 @@ export const RUN_REASONS = [
24
25
  "parent_cancelled",
25
26
  "lost",
26
27
  "timeout",
28
+ "output_limit",
27
29
  ] as const;
28
30
  export type RunReason = (typeof RUN_REASONS)[number];
29
31
 
@@ -128,8 +130,8 @@ export type WaitState = (typeof WAIT_STATES)[number];
128
130
 
129
131
  /**
130
132
  * One call a waiting run waits on, and the arguments it was made with: an
131
- * approval, which `POST /agents/:agentName/runs/:id/answer` decides, or a
132
- * client tool's call, which its widget answers.
133
+ * approval, which `POST /orgs/:org/agents/:agentName/runs/:id/answer`
134
+ * decides, or a client tool's call, which its widget answers.
133
135
  */
134
136
  export const runWaitSchema = z.object({
135
137
  kind: z.enum(WAIT_KINDS),
@@ -140,9 +142,9 @@ export const runWaitSchema = z.object({
140
142
  export type RunWait = z.infer<typeof runWaitSchema>;
141
143
 
142
144
  /**
143
- * A run as `GET /agents/:agentName/runs/:id` reads it, and each row of
144
- * `GET /agents/:agentName/triggers/:name/runs`: the input it answers, and
145
- * its thread, null once that thread is gone.
145
+ * A run as `GET /orgs/:org/agents/:agentName/runs/:id` reads it, and each
146
+ * row of `GET /orgs/:org/agents/:agentName/triggers/:name/runs`: the input
147
+ * it answers, and its thread, null once that thread is gone.
146
148
  */
147
149
  export const runRecordSchema = z.object({
148
150
  id: z.uuid(),
@@ -167,18 +169,18 @@ export const runRecordSchema = z.object({
167
169
  });
168
170
  export type RunRecord = z.infer<typeof runRecordSchema>;
169
171
 
170
- /** `GET /agents/:agentName/triggers/:name/runs`: a page of the trigger's runs, newest first. */
172
+ /** `GET /orgs/:org/agents/:agentName/triggers/:name/runs`: a page of the trigger's runs, newest first. */
171
173
  export const runListSchema = z.object({ runs: z.array(runRecordSchema) });
172
174
  export type RunList = z.infer<typeof runListSchema>;
173
175
 
174
- /** `POST /agents/:agentName/runs/:id/cancel`: whether it stopped or ended anything; a run already over is left as it is. */
176
+ /** `POST /orgs/:org/agents/:agentName/runs/:id/cancel`: whether it stopped or ended anything; a run already over is left as it is. */
175
177
  export const runCancelSchema = z.object({ cancelled: z.boolean() });
176
178
  export type RunCancel = z.infer<typeof runCancelSchema>;
177
179
 
178
180
  /**
179
- * `POST /agents/:agentName/runs/:id/answer`: the decision on one call the
180
- * run waits on. A call id is as long as the model provider made it (some
181
- * carry a signature), so only the request's body limit bounds it.
181
+ * `POST /orgs/:org/agents/:agentName/runs/:id/answer`: the decision on one
182
+ * call the run waits on. A call id is as long as the model provider made it
183
+ * (some carry a signature), so only the request's body limit bounds it.
182
184
  */
183
185
  export const runAnswerSchema = z.object({
184
186
  toolCallId: z.string().min(1),
@@ -231,7 +231,7 @@ const runEventFields = {
231
231
  * A run parked on calls that wait for a decision, as every receiver hears
232
232
  * of it: a webhook's body and the agent's server's event are this one
233
233
  * object. `runId` names the run a receiver decides through
234
- * `POST /agents/:agentName/runs/:id/answer`. Every call it waits on is
234
+ * `POST /orgs/:org/agents/:agentName/runs/:id/answer`. Every call it waits on is
235
235
  * named, a client tool's among them; one whose input would carry the event
236
236
  * past `SERVER_REQUEST_MAX_BYTES` comes without its input. A run waiting
237
237
  * only on its widget's calls is not announced.
@@ -4,7 +4,7 @@ import { inputReceiptSchema, runRecordSchema } from "../runs/index";
4
4
 
5
5
  /*
6
6
  * Triggers: named entry points on an agent. A caller fires one over
7
- * `POST /agents/:agentName/triggers/:name` with the trigger's secret as its
7
+ * `POST /orgs/:org/agents/:agentName/triggers/:name` with the trigger's secret as its
8
8
  * bearer; the fire is an input on the thread the trigger's policy names,
9
9
  * and the run that takes it is read and decided under `/runs/:id`. These
10
10
  * are the shapes Cortex answers that caller with.
@@ -13,19 +13,24 @@ import { inputReceiptSchema, runRecordSchema } from "../runs/index";
13
13
  /** The tool a trigger run with an output schema answers through; no other tool may take its name. */
14
14
  export const TRIGGER_ANSWER_TOOL_NAME = "submitAnswer";
15
15
 
16
- /** The engine route of agent `agentName`, which the widget chats with and its triggers and runs sit under. */
17
- export function agentRoute(agentName: string) {
18
- return `/agents/${encodeURIComponent(agentName)}`;
16
+ /** The engine route of org `orgSlug`, which its agents' routes and its sign-ins sit under. */
17
+ export function orgRoute(orgSlug: string) {
18
+ return `/orgs/${encodeURIComponent(orgSlug)}`;
19
19
  }
20
20
 
21
- /** The engine route a trigger is fired at on agent `agentName`; its runs are listed under it. */
22
- export function triggerRoute(agentName: string, name: string) {
23
- return `${agentRoute(agentName)}/triggers/${encodeURIComponent(name)}`;
21
+ /** The engine route of agent `agentName` in org `orgSlug`, which the widget chats with and its triggers and runs sit under. */
22
+ export function agentRoute(orgSlug: string, agentName: string) {
23
+ return `${orgRoute(orgSlug)}/agents/${encodeURIComponent(agentName)}`;
24
24
  }
25
25
 
26
- /** The engine route a run of agent `agentName` is read at, and answered and cancelled under. */
27
- export function runRoute(agentName: string, runId: string) {
28
- return `${agentRoute(agentName)}/runs/${encodeURIComponent(runId)}`;
26
+ /** The engine route a trigger is fired at on agent `agentName` in org `orgSlug`; its runs are listed under it. */
27
+ export function triggerRoute(orgSlug: string, agentName: string, name: string) {
28
+ return `${agentRoute(orgSlug, agentName)}/triggers/${encodeURIComponent(name)}`;
29
+ }
30
+
31
+ /** The engine route a run of agent `agentName` in org `orgSlug` is read at, and answered and cancelled under. */
32
+ export function runRoute(orgSlug: string, agentName: string, runId: string) {
33
+ return `${agentRoute(orgSlug, agentName)}/runs/${encodeURIComponent(runId)}`;
29
34
  }
30
35
 
31
36
  /** What a fire answers once its run started: its input, run and thread; `GET .../runs/:id` reads the run. */
@@ -43,7 +48,7 @@ export const fireRejectedSchema = z.object({
43
48
  });
44
49
 
45
50
  /**
46
- * What `POST /agents/:agentName/triggers/:name` answers as JSON: the run it
51
+ * What `POST /orgs/:org/agents/:agentName/triggers/:name` answers as JSON: the run it
47
52
  * started (`started`, 202); with `?wait=`, that run once it ended (a
48
53
  * `RunRecord`, 200) or parked on a decision (202); the fire's input while it
49
54
  * waits on the thread, once refused, or once cancelled before any run took
@@ -8,6 +8,7 @@
8
8
  * alike.
9
9
  */
10
10
 
11
+ import { isRecord } from "../json/index";
11
12
  import type { RunReason, RunStatus } from "../runs/index";
12
13
 
13
14
  /** The UI locales every localized value is keyed by; the console's message catalogs follow it. */
@@ -215,7 +216,7 @@ export type AccountConnection = {
215
216
  };
216
217
 
217
218
  /**
218
- * The form `POST /oauth/start` takes, posted into the window a sign-in runs
219
+ * The form `POST /orgs/:org/oauth/start` takes, posted into the window a sign-in runs
219
220
  * in with its bearer in the body, so no link can start one: the console's
220
221
  * operator token and the server's id for the shared connection.
221
222
  */
@@ -335,6 +336,58 @@ export function approvalTitleOf(input: unknown) {
335
336
  return modelLineOf(input, APPROVAL_TITLE_FIELD);
336
337
  }
337
338
 
339
+ /** One input field an approval tool's schema declares (`ApprovalInput`). */
340
+ export type ApprovalField = {
341
+ name: string;
342
+ /** The field may carry a secret: it, anything inside it, or anything containing it is marked `x-sensitive`. */
343
+ sensitive?: true;
344
+ /** Cortex fills the field itself and refuses a call that writes it, so no card shows it. */
345
+ sourced?: true;
346
+ };
347
+
348
+ /** How the calls of a tool that waits for the user's approval show their input (`ToolCallMetadata.approvalInput`). */
349
+ export type ApprovalInput = {
350
+ /** The fields its schema declares, in its order. */
351
+ fields: ApprovalField[];
352
+ /** Any other key the model writes may carry a secret, as the schemas that would admit it say. */
353
+ extraSensitive?: true;
354
+ };
355
+
356
+ /**
357
+ * Each key of a call's input as its tool's `approval` classes it, with its
358
+ * value: the declared fields the input holds, in the tool's order, then the
359
+ * keys the model added, in its. The title, which the card shows apart, is
360
+ * none of them.
361
+ */
362
+ export function approvalKeysOf(input: unknown, approval: ApprovalInput | undefined) {
363
+ if (!isRecord(input) || !approval) return [];
364
+ const declared = new Set(approval.fields.map(({ name }) => name));
365
+ const extra = Object.keys(input).filter(
366
+ (name) => !declared.has(name) && name !== APPROVAL_TITLE_FIELD,
367
+ );
368
+ return approval.fields
369
+ .filter(({ name }) => Object.hasOwn(input, name))
370
+ .concat(
371
+ extra.map((name) => ({
372
+ name,
373
+ ...(approval.extraSensitive && { sensitive: true as const }),
374
+ })),
375
+ )
376
+ .map((field) => ({ ...field, value: input[field.name] }));
377
+ }
378
+
379
+ /**
380
+ * What a call the user decides on will run with: every key it forwards
381
+ * (`approvalKeysOf`) but the fields Cortex fills. A sensitive one says only
382
+ * that it is set (`hidden`), never its value.
383
+ */
384
+ export function approvalEntriesOf(input: unknown, approval: ApprovalInput | undefined) {
385
+ return approvalKeysOf(input, approval).flatMap(({ name, value, sensitive, sourced }) => {
386
+ if (sourced) return [];
387
+ return [sensitive ? { name, hidden: true as const } : { name, value }];
388
+ });
389
+ }
390
+
338
391
  /**
339
392
  * What Cortex stamps on a tool call's `metadata.cortex` from its first chunk,
340
393
  * so the live part and the stored one agree.
@@ -355,6 +408,12 @@ export type ToolCallMetadata = {
355
408
  * live run asked it.
356
409
  */
357
410
  paused?: { runId: string; interrupt: RunInterrupt };
411
+ /**
412
+ * Set on a call of a tool that waits for the user's approval: how its card shows the
413
+ * input (`approvalEntriesOf`) while the call waits. Every view of the call leaves a
414
+ * sensitive key's value out.
415
+ */
416
+ approvalInput?: ApprovalInput;
358
417
  };
359
418
 
360
419
  /** An interrupt as a paused run raises it on its end, in AG-UI's shape. */
@@ -28,7 +28,7 @@ import { applyPorts, type Ports } from "@/scaffold/ports";
28
28
  * `@m6d/cortex` range below are stamped by scripts/sync-package-versions.ts
29
29
  * before the CLI publishes, so a scaffold pins what was current then.
30
30
  */
31
- const CORTEX_VERSION = "0.23.2";
31
+ const CORTEX_VERSION = "0.24.1";
32
32
 
33
33
  /** This machine as Cortex's containers name it: the one private host the stack's egress policy admits. */
34
34
  export const DOCKER_HOST = "host.docker.internal";
@@ -147,7 +147,7 @@ function packageJson({ name, datasets, setup }: Project) {
147
147
  verify: "bun run format:check && bun run lint && bun run spellcheck && bun run check && bun run audit",
148
148
  },
149
149
  dependencies: {
150
- "@m6d/cortex": "~0.11.1",
150
+ "@m6d/cortex": "~0.12.1",
151
151
  // drizzle 1.0 is in beta; this is the build `@m6d/cortex/drizzle` is tested against.
152
152
  ...(datasets ? { "drizzle-orm": "1.0.0-beta.15-859cf75" } : {}),
153
153
  hono: "^4.12.3",
@@ -330,6 +330,9 @@ x-cortex: &cortex
330
330
  # address the app reaches it at inside the stack.
331
331
  ENGINE_PUBLIC_URL: http://localhost:{{port.engine}}
332
332
  ENGINE_INTERNAL_URL: http://engine:3001
333
+ # The console's public origin: its playground and assistant call the
334
+ # engine from there, and MCP clients sign in to its /api/mcp.
335
+ CONSOLE_PUBLIC_URL: http://localhost:{{port.cortex}}
333
336
  # Docker Desktop resolves host.docker.internal on its own; Linux needs this.
334
337
  extra_hosts:
335
338
  - host.docker.internal:host-gateway
@@ -391,21 +394,14 @@ services:
391
394
  MC_HOST_local: http://minio:\${S3_SECRET_ACCESS_KEY:?run bun install to generate .env}@minio:9000
392
395
  command: ["mb", "--ignore-existing", "local/cortex"]
393
396
 
394
- # One-shot: migrate the database, then create the first admin and its key.
395
- migrator:
397
+ # One-shot: migrate and set up the database, then create the first admin and its key.
398
+ bootstrap:
396
399
  <<: *cortex
397
- command: ["bun", "run", "db:migrate"]
400
+ command: ["bun", "run", "bootstrap"]
398
401
  depends_on:
399
402
  postgres:
400
403
  condition: service_healthy
401
404
 
402
- seeder:
403
- <<: *cortex
404
- command: ["bun", "run", "db:seed:admin"]
405
- depends_on:
406
- migrator:
407
- condition: service_completed_successfully
408
-
409
405
  # The console and the management API.
410
406
  app:
411
407
  <<: *cortex
@@ -413,7 +409,7 @@ services:
413
409
  ports:
414
410
  - "127.0.0.1:{{port.cortex}}:3000"
415
411
  depends_on:
416
- seeder:
412
+ bootstrap:
417
413
  condition: service_completed_successfully
418
414
  minio-init:
419
415
  condition: service_completed_successfully
@@ -423,7 +419,7 @@ services:
423
419
  restart: unless-stopped
424
420
  command: ["bun", "src/jobs/worker.ts"]
425
421
  depends_on:
426
- seeder:
422
+ bootstrap:
427
423
  condition: service_completed_successfully
428
424
  minio-init:
429
425
  condition: service_completed_successfully
@@ -440,12 +436,10 @@ services:
440
436
  environment:
441
437
  <<: *cortex-environment
442
438
  PORT: "3001"
443
- # Browser origins allowed to call the engine: the console's, for its playground and assistant.
444
- ENGINE_CORS_ORIGINS: http://localhost:{{port.cortex}},http://127.0.0.1:{{port.cortex}}
445
439
  ports:
446
440
  - "127.0.0.1:{{port.engine}}:3001"
447
441
  depends_on:
448
- seeder:
442
+ bootstrap:
449
443
  condition: service_completed_successfully
450
444
  redis:
451
445
  condition: service_healthy