@m6d/cortex 0.11.1 → 0.12.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/README.md CHANGED
@@ -116,7 +116,8 @@ Throw `new CortexError(kind, detail)` from a tool, a variable resolver, `verify`
116
116
  import { createTriggerClient } from "@m6d/cortex";
117
117
 
118
118
  const triggers = createTriggerClient({
119
- url: "https://engine.cortex.example.com", // ENGINE_PUBLIC_URL
119
+ url: "https://engine.cortex.example.com", // the engine's public origin, ENGINE_PUBLIC_URL
120
+ org: "acme", // the slug of the agent's org
120
121
  agent: "reviewer",
121
122
  secrets: { "pr-opened": process.env.PR_TRIGGER_SECRET! },
122
123
  });
package/dist/index.d.ts CHANGED
@@ -79,6 +79,7 @@ declare const runFinishedEventSchema: z.ZodObject<{
79
79
  stopped: "stopped";
80
80
  parent_cancelled: "parent_cancelled";
81
81
  lost: "lost";
82
+ output_limit: "output_limit";
82
83
  }>>;
83
84
  result: z.ZodUnknown;
84
85
  waits: z.ZodArray<z.ZodObject<{
@@ -1358,6 +1359,7 @@ declare const runRecordSchema: z.ZodObject<{
1358
1359
  stopped: "stopped";
1359
1360
  parent_cancelled: "parent_cancelled";
1360
1361
  lost: "lost";
1362
+ output_limit: "output_limit";
1361
1363
  }>>;
1362
1364
  result: z.ZodUnknown;
1363
1365
  waits: z.ZodArray<z.ZodObject<{
@@ -1455,6 +1457,7 @@ declare const fireAnswerSchema: z.ZodUnion<readonly [
1455
1457
  stopped: "stopped";
1456
1458
  parent_cancelled: "parent_cancelled";
1457
1459
  lost: "lost";
1460
+ output_limit: "output_limit";
1458
1461
  }>>;
1459
1462
  result: z.ZodUnknown;
1460
1463
  waits: z.ZodArray<z.ZodObject<{
@@ -1474,6 +1477,8 @@ export type FireAnswer = z.infer<typeof fireAnswerSchema>;
1474
1477
  export type TriggerClientConfig = {
1475
1478
  /** The engine's public origin (`ENGINE_PUBLIC_URL`) as the caller reaches it. */
1476
1479
  url: string;
1480
+ /** The slug of the org the agent belongs to. */
1481
+ org: string;
1477
1482
  /** The agent whose triggers are fired. */
1478
1483
  agent: string;
1479
1484
  /** The value of the fire credential shared by the caller's triggers. */
@@ -1521,7 +1526,7 @@ export declare function createTriggerClient(config: TriggerClientConfig): {
1521
1526
  kind: "turn" | "subagent" | "tool";
1522
1527
  subagentRunId: string | null;
1523
1528
  status: "completed" | "cancelled" | "failed" | "running" | "waiting";
1524
- reason: "timeout" | "cancelled" | "no_output" | "invalid_output" | "stopped" | "parent_cancelled" | "lost" | null;
1529
+ reason: "timeout" | "cancelled" | "no_output" | "invalid_output" | "stopped" | "parent_cancelled" | "lost" | "output_limit" | null;
1525
1530
  result: unknown;
1526
1531
  waits: {
1527
1532
  kind: "approval" | "client_tool";
@@ -1563,7 +1568,7 @@ export declare function createTriggerClient(config: TriggerClientConfig): {
1563
1568
  kind: "turn" | "subagent" | "tool";
1564
1569
  subagentRunId: string | null;
1565
1570
  status: "completed" | "cancelled" | "failed" | "running" | "waiting";
1566
- reason: "timeout" | "cancelled" | "no_output" | "invalid_output" | "stopped" | "parent_cancelled" | "lost" | null;
1571
+ reason: "timeout" | "cancelled" | "no_output" | "invalid_output" | "stopped" | "parent_cancelled" | "lost" | "output_limit" | null;
1567
1572
  result: unknown;
1568
1573
  waits: {
1569
1574
  kind: "approval" | "client_tool";
@@ -1595,7 +1600,7 @@ export declare function createTriggerClient(config: TriggerClientConfig): {
1595
1600
  kind: "turn" | "subagent" | "tool";
1596
1601
  subagentRunId: string | null;
1597
1602
  status: "completed" | "cancelled" | "failed" | "running" | "waiting";
1598
- reason: "timeout" | "cancelled" | "no_output" | "invalid_output" | "stopped" | "parent_cancelled" | "lost" | null;
1603
+ reason: "timeout" | "cancelled" | "no_output" | "invalid_output" | "stopped" | "parent_cancelled" | "lost" | "output_limit" | null;
1599
1604
  result: unknown;
1600
1605
  waits: {
1601
1606
  kind: "approval" | "client_tool";
@@ -1619,7 +1624,7 @@ export declare function createTriggerClient(config: TriggerClientConfig): {
1619
1624
  kind: "turn" | "subagent" | "tool";
1620
1625
  subagentRunId: string | null;
1621
1626
  status: "completed" | "cancelled" | "failed" | "running" | "waiting";
1622
- reason: "timeout" | "cancelled" | "no_output" | "invalid_output" | "stopped" | "parent_cancelled" | "lost" | null;
1627
+ reason: "timeout" | "cancelled" | "no_output" | "invalid_output" | "stopped" | "parent_cancelled" | "lost" | "output_limit" | null;
1623
1628
  result: unknown;
1624
1629
  waits: {
1625
1630
  kind: "approval" | "client_tool";
@@ -5314,7 +5319,7 @@ export type ManagementProcedures = {
5314
5319
  id: string;
5315
5320
  kind: "turn" | "subagent" | "tool";
5316
5321
  status: "running" | "waiting" | "completed" | "failed" | "cancelled";
5317
- reason: "no_output" | "invalid_output" | "stopped" | "cancelled" | "parent_cancelled" | "lost" | "timeout" | null;
5322
+ reason: "no_output" | "invalid_output" | "stopped" | "cancelled" | "parent_cancelled" | "lost" | "timeout" | "output_limit" | null;
5318
5323
  createdAt: string;
5319
5324
  finishedAt: string | null;
5320
5325
  source: "user" | "trigger" | "schedule" | "run" | null;
@@ -5490,7 +5495,7 @@ export type ManagementProcedures = {
5490
5495
  id: string;
5491
5496
  kind: "turn" | "subagent" | "tool";
5492
5497
  status: "running" | "waiting" | "completed" | "failed" | "cancelled";
5493
- reason: "no_output" | "invalid_output" | "stopped" | "cancelled" | "parent_cancelled" | "lost" | "timeout" | null;
5498
+ reason: "no_output" | "invalid_output" | "stopped" | "cancelled" | "parent_cancelled" | "lost" | "timeout" | "output_limit" | null;
5494
5499
  createdAt: string;
5495
5500
  finishedAt: string | null;
5496
5501
  source: "user" | "trigger" | "schedule" | "run" | null;
@@ -5661,6 +5666,120 @@ export type ManagementProcedures = {
5661
5666
  updatedAt: string;
5662
5667
  };
5663
5668
  };
5669
+ /** 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. */
5670
+ "orgs.create": {
5671
+ input: {
5672
+ /** The org's address in engine URLs (`/orgs/<slug>/...`): lowercase letters, digits and single hyphens, unique, and never changed. */
5673
+ slug: string;
5674
+ name: string;
5675
+ ownerEmail: string;
5676
+ };
5677
+ output: {
5678
+ id: string;
5679
+ slug: string;
5680
+ name: string;
5681
+ suspendedAt: string | null;
5682
+ purgeAt: string | null;
5683
+ createdAt: string;
5684
+ updatedAt: string;
5685
+ invitation: {
5686
+ id: string;
5687
+ email: string;
5688
+ expiresAt: string;
5689
+ invitePath: string;
5690
+ };
5691
+ };
5692
+ };
5693
+ /** Delete an org: it is suspended at once and purged with all its data and files after 30 days, unless restored first. */
5694
+ "orgs.delete": {
5695
+ input: {
5696
+ id: string;
5697
+ };
5698
+ output: {
5699
+ id: string;
5700
+ slug: string;
5701
+ name: string;
5702
+ suspendedAt: string | null;
5703
+ purgeAt: string | null;
5704
+ createdAt: string;
5705
+ updatedAt: string;
5706
+ };
5707
+ };
5708
+ /** 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. */
5709
+ "orgs.inviteOwner": {
5710
+ input: {
5711
+ id: string;
5712
+ ownerEmail: string;
5713
+ };
5714
+ output: {
5715
+ id: string;
5716
+ email: string;
5717
+ expiresAt: string;
5718
+ invitePath: string;
5719
+ };
5720
+ };
5721
+ /** List the deployment's orgs with pagination and search by name or slug, suspended and deleted ones included. */
5722
+ "orgs.list": {
5723
+ input: {
5724
+ pageIndex?: number;
5725
+ pageSize?: number;
5726
+ q?: string;
5727
+ };
5728
+ output: {
5729
+ items: Array<{
5730
+ id: string;
5731
+ slug: string;
5732
+ name: string;
5733
+ suspendedAt: string | null;
5734
+ purgeAt: string | null;
5735
+ createdAt: string;
5736
+ updatedAt: string;
5737
+ }>;
5738
+ /** Every row the caller may see, ignoring the search and filters. */
5739
+ count: number;
5740
+ /** The rows matching the search and filters, over all pages: the total to report. */
5741
+ filteredCount: number;
5742
+ };
5743
+ };
5744
+ /** Each org's id, slug and name, suspended and deleted ones included, for selectors. */
5745
+ "orgs.options": {
5746
+ input: undefined;
5747
+ output: Array<{
5748
+ id: string;
5749
+ slug: string;
5750
+ name: string;
5751
+ }>;
5752
+ };
5753
+ /** Restore a suspended or deleted org before its purge, as it was, its assistant brought up to this release. */
5754
+ "orgs.restore": {
5755
+ input: {
5756
+ id: string;
5757
+ };
5758
+ output: {
5759
+ id: string;
5760
+ slug: string;
5761
+ name: string;
5762
+ suspendedAt: string | null;
5763
+ purgeAt: string | null;
5764
+ createdAt: string;
5765
+ updatedAt: string;
5766
+ };
5767
+ };
5768
+ /** Suspend an org: its engine routes, sessions and credentials are refused until it is restored. */
5769
+ "orgs.suspend": {
5770
+ input: {
5771
+ id: string;
5772
+ };
5773
+ output: {
5774
+ id: string;
5775
+ slug: string;
5776
+ name: string;
5777
+ suspendedAt: string | null;
5778
+ purgeAt: string | null;
5779
+ createdAt: string;
5780
+ updatedAt: string;
5781
+ };
5782
+ };
5664
5783
  /** Components of every kind shared with this agent alone: what deleting it leaves shared with nobody, unless `agents.delete` names them in `deleteComponentIds`. */
5665
5784
  "publishing.exclusive": {
5666
5785
  input: {
@@ -5715,13 +5834,13 @@ export type ManagementProcedures = {
5715
5834
  input: {
5716
5835
  name: string;
5717
5836
  description: string;
5718
- 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">;
5837
+ 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">;
5719
5838
  };
5720
5839
  output: {
5721
5840
  id: string;
5722
5841
  name: string;
5723
5842
  description: string;
5724
- 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">;
5843
+ 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">;
5725
5844
  };
5726
5845
  };
5727
5846
  /** Delete a role; the built-in Administrator role cannot be deleted. */
@@ -5743,7 +5862,7 @@ export type ManagementProcedures = {
5743
5862
  id: string;
5744
5863
  name: string;
5745
5864
  description: string;
5746
- 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">;
5865
+ 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">;
5747
5866
  builtInId: string | null;
5748
5867
  createdAt: string;
5749
5868
  assignedUsers: number;
@@ -5759,14 +5878,14 @@ export type ManagementProcedures = {
5759
5878
  input: {
5760
5879
  name: string;
5761
5880
  description: string;
5762
- 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">;
5881
+ 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">;
5763
5882
  id: string;
5764
5883
  };
5765
5884
  output: {
5766
5885
  id: string;
5767
5886
  name: string;
5768
5887
  description: string;
5769
- 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">;
5888
+ 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">;
5770
5889
  };
5771
5890
  };
5772
5891
  /** Delete a secret; fails while a credential or an agent's auth (its signing secret or reCAPTCHA API key) still references it. */
@@ -5911,7 +6030,6 @@ export type ManagementProcedures = {
5911
6030
  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;
5912
6031
  syncAttempt: number;
5913
6032
  syncSettledAttempt: number;
5914
- system: boolean;
5915
6033
  signInChecksPerMinute: number;
5916
6034
  triggerChecksPerMinute: number;
5917
6035
  modelProvider: string | null;
@@ -5958,7 +6076,6 @@ export type ManagementProcedures = {
5958
6076
  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;
5959
6077
  syncAttempt: number;
5960
6078
  syncSettledAttempt: number;
5961
- system: boolean;
5962
6079
  signInChecksPerMinute: number;
5963
6080
  triggerChecksPerMinute: number;
5964
6081
  modelProvider: string | null;
@@ -5980,7 +6097,6 @@ export type ManagementProcedures = {
5980
6097
  description: string | null;
5981
6098
  url: string | null;
5982
6099
  keySecretName: string | null;
5983
- system: boolean;
5984
6100
  syncedAt: string | null;
5985
6101
  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;
5986
6102
  createdAt: string;
@@ -6022,7 +6138,6 @@ export type ManagementProcedures = {
6022
6138
  description: string | null;
6023
6139
  url: string | null;
6024
6140
  keySecretName: string | null;
6025
- system: boolean;
6026
6141
  syncedAt: string | null;
6027
6142
  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;
6028
6143
  createdAt: string;
@@ -6034,11 +6149,9 @@ export type ManagementProcedures = {
6034
6149
  filteredCount: number;
6035
6150
  };
6036
6151
  };
6037
- /** 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. */
6152
+ /** Each server's id, name and display name, for selectors. */
6038
6153
  "servers.options": {
6039
- input: {
6040
- includeSystem?: boolean;
6041
- };
6154
+ input: undefined;
6042
6155
  output: Array<{
6043
6156
  id: string;
6044
6157
  name: string;
@@ -6100,7 +6213,6 @@ export type ManagementProcedures = {
6100
6213
  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;
6101
6214
  syncAttempt: number;
6102
6215
  syncSettledAttempt: number;
6103
- system: boolean;
6104
6216
  signInChecksPerMinute: number;
6105
6217
  triggerChecksPerMinute: number;
6106
6218
  modelProvider: string | null;
@@ -6331,23 +6443,27 @@ export type ManagementProcedures = {
6331
6443
  name: string;
6332
6444
  };
6333
6445
  };
6334
- /** Deployment settings: log and thread retention. */
6446
+ /** The org's settings: log and thread retention, and the browser origins its engine routes admit. */
6335
6447
  "settings.get": {
6336
6448
  input: undefined;
6337
6449
  output: {
6338
6450
  logRetentionDays: number;
6339
6451
  threadRetentionDays: number | null;
6452
+ corsOrigins: Array<string>;
6340
6453
  };
6341
6454
  };
6342
- /** Change retention settings. */
6455
+ /** Change the org's settings: retention, and the browser origins its engine routes admit. */
6343
6456
  "settings.update": {
6344
6457
  input: {
6345
6458
  logRetentionDays: number;
6346
6459
  threadRetentionDays?: number;
6460
+ /** Browser origins, beside the console's own, that may call the org's engine routes, such as a site embedding its widget. */
6461
+ corsOrigins: Array<string>;
6347
6462
  };
6348
6463
  output: {
6349
6464
  logRetentionDays: number;
6350
6465
  threadRetentionDays: number | null;
6466
+ corsOrigins: Array<string>;
6351
6467
  };
6352
6468
  };
6353
6469
  /** How many published skills an agent has. */
@@ -7558,7 +7674,7 @@ export type ManagementProcedures = {
7558
7674
  kind: "turn" | "subagent" | "tool";
7559
7675
  subagentRunId: string | null;
7560
7676
  status: "running" | "waiting" | "completed" | "failed" | "cancelled";
7561
- reason: "no_output" | "invalid_output" | "stopped" | "cancelled" | "parent_cancelled" | "lost" | "timeout" | null;
7677
+ reason: "no_output" | "invalid_output" | "stopped" | "cancelled" | "parent_cancelled" | "lost" | "timeout" | "output_limit" | null;
7562
7678
  result: unknown;
7563
7679
  waits: Array<{
7564
7680
  kind: "approval" | "client_tool";
@@ -7642,7 +7758,7 @@ export type ManagementProcedures = {
7642
7758
  kind: "turn" | "subagent" | "tool";
7643
7759
  subagentRunId: string | null;
7644
7760
  status: "running" | "waiting" | "completed" | "failed" | "cancelled";
7645
- reason: "no_output" | "invalid_output" | "stopped" | "cancelled" | "parent_cancelled" | "lost" | "timeout" | null;
7761
+ reason: "no_output" | "invalid_output" | "stopped" | "cancelled" | "parent_cancelled" | "lost" | "timeout" | "output_limit" | null;
7646
7762
  result: unknown;
7647
7763
  waits: Array<{
7648
7764
  kind: "approval" | "client_tool";
@@ -7726,8 +7842,8 @@ export type ManagementProcedures = {
7726
7842
  id: string;
7727
7843
  name: string;
7728
7844
  displayName: Partial<Record<"en" | "ar", string>>;
7845
+ fireUrl: string | null;
7729
7846
  }>;
7730
- engineUrl: string | null;
7731
7847
  variables: Array<{
7732
7848
  name: string;
7733
7849
  description: string;
@@ -7934,21 +8050,48 @@ export type ManagementProcedures = {
7934
8050
  name: string;
7935
8051
  };
7936
8052
  };
7937
- /** Create a user with a temporary password and roles. */
7938
- "users.create": {
8053
+ /** 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. */
8054
+ "users.accounts": {
8055
+ input: {
8056
+ pageIndex?: number;
8057
+ pageSize?: number;
8058
+ q?: string;
8059
+ orgId?: string;
8060
+ };
8061
+ output: {
8062
+ items: Array<{
8063
+ id: string;
8064
+ name: string;
8065
+ email: string;
8066
+ banned: boolean;
8067
+ mustChangePassword: boolean;
8068
+ createdAt: string;
8069
+ orgs: Array<{
8070
+ id: string;
8071
+ name: string;
8072
+ }>;
8073
+ manageable: boolean;
8074
+ }>;
8075
+ /** Every row the caller may see, ignoring the search and filters. */
8076
+ count: number;
8077
+ /** The rows matching the search and filters, over all pages: the total to report. */
8078
+ filteredCount: number;
8079
+ };
8080
+ };
8081
+ /** Invite an email into the org with roles; returns the accept link's path, shown only once, which expires in 7 days. */
8082
+ "users.invite": {
7939
8083
  input: {
7940
- name: string;
7941
8084
  email: string;
7942
- tempPassword: string;
7943
8085
  roleIds: Array<string>;
7944
8086
  };
7945
8087
  output: {
7946
8088
  id: string;
7947
- name: string;
7948
8089
  email: string;
8090
+ expiresAt: string;
8091
+ invitePath: string;
7949
8092
  };
7950
8093
  };
7951
- /** List users with pagination, search, and their roles. */
8094
+ /** List the org's members with pagination, search, their roles, and whether each is active in the org. */
7952
8095
  "users.list": {
7953
8096
  input: {
7954
8097
  pageIndex?: number;
@@ -7962,6 +8105,32 @@ export type ManagementProcedures = {
7962
8105
  email: string;
7963
8106
  banned: boolean;
7964
8107
  mustChangePassword: boolean;
8108
+ joinedAt: string;
8109
+ deactivatedAt: string | null;
8110
+ roles: Array<{
8111
+ id: string;
8112
+ name: string;
8113
+ builtInId: string | null;
8114
+ }>;
8115
+ }>;
8116
+ /** Every row the caller may see, ignoring the search and filters. */
8117
+ count: number;
8118
+ /** The rows matching the search and filters, over all pages: the total to report. */
8119
+ filteredCount: number;
8120
+ };
8121
+ };
8122
+ /** List the org's invitations not yet accepted, with the roles each grants. */
8123
+ "users.listInvitations": {
8124
+ input: {
8125
+ pageIndex?: number;
8126
+ pageSize?: number;
8127
+ q?: string;
8128
+ };
8129
+ output: {
8130
+ items: Array<{
8131
+ id: string;
8132
+ email: string;
8133
+ expiresAt: string;
7965
8134
  createdAt: string;
7966
8135
  roles: Array<{
7967
8136
  id: string;
@@ -7975,6 +8144,20 @@ export type ManagementProcedures = {
7975
8144
  filteredCount: number;
7976
8145
  };
7977
8146
  };
8147
+ /** Remove a member from the org with their roles and management keys there; the account stays. */
8148
+ "users.remove": {
8149
+ input: {
8150
+ userId: string;
8151
+ };
8152
+ output: null;
8153
+ };
8154
+ /** Revoke a pending invitation; its link stops working. */
8155
+ "users.revokeInvitation": {
8156
+ input: {
8157
+ id: string;
8158
+ };
8159
+ output: null;
8160
+ };
7978
8161
  /** Role id and name pairs for assignment. */
7979
8162
  "users.roleOptions": {
7980
8163
  input: undefined;
@@ -7984,7 +8167,15 @@ export type ManagementProcedures = {
7984
8167
  builtInId: string | null;
7985
8168
  }>;
7986
8169
  };
7987
- /** Deactivate or reactivate a user; deactivation also revokes their sessions and management keys. */
8170
+ /** Deactivate or reactivate an account in every org; deactivation also ends its sessions and revokes its management keys. */
8171
+ "users.setAccountActive": {
8172
+ input: {
8173
+ userId: string;
8174
+ active: boolean;
8175
+ };
8176
+ output: null;
8177
+ };
8178
+ /** Deactivate or reactivate a member in the org; deactivation also revokes their management keys there. */
7988
8179
  "users.setActive": {
7989
8180
  input: {
7990
8181
  userId: string;
@@ -7992,7 +8183,7 @@ export type ManagementProcedures = {
7992
8183
  };
7993
8184
  output: null;
7994
8185
  };
7995
- /** Replace the user's roles. */
8186
+ /** Replace a member's roles in the org. */
7996
8187
  "users.setRoles": {
7997
8188
  input: {
7998
8189
  userId: string;
@@ -8000,7 +8191,7 @@ export type ManagementProcedures = {
8000
8191
  };
8001
8192
  output: null;
8002
8193
  };
8003
- /** Set a temporary password the user must change on next login; this also revokes their sessions and management keys. */
8194
+ /** Set a temporary password the user must change on next login; this also ends their sessions and revokes their management keys in every org. */
8004
8195
  "users.setTempPassword": {
8005
8196
  input: {
8006
8197
  userId: string;
package/dist/index.js CHANGED
@@ -13424,7 +13424,8 @@ var RUN_REASONS = [
13424
13424
  "cancelled",
13425
13425
  "parent_cancelled",
13426
13426
  "lost",
13427
- "timeout"
13427
+ "timeout",
13428
+ "output_limit"
13428
13429
  ];
13429
13430
  var INPUT_DELIVERIES = ["prompt", "steer", "followUp", "answer", "note"];
13430
13431
  var INPUT_REFUSALS = [
@@ -13485,14 +13486,17 @@ var runAnswerSchema = z.object({
13485
13486
  // ../../internal/contracts/src/triggers/index.ts
13486
13487
  import { z as z2 } from "zod";
13487
13488
  var TRIGGER_ANSWER_TOOL_NAME = "submitAnswer";
13488
- function agentRoute(agentName) {
13489
- return `/agents/${encodeURIComponent(agentName)}`;
13489
+ function orgRoute(orgSlug) {
13490
+ return `/orgs/${encodeURIComponent(orgSlug)}`;
13490
13491
  }
13491
- function triggerRoute(agentName, name) {
13492
- return `${agentRoute(agentName)}/triggers/${encodeURIComponent(name)}`;
13492
+ function agentRoute(orgSlug, agentName) {
13493
+ return `${orgRoute(orgSlug)}/agents/${encodeURIComponent(agentName)}`;
13493
13494
  }
13494
- function runRoute(agentName, runId) {
13495
- return `${agentRoute(agentName)}/runs/${encodeURIComponent(runId)}`;
13495
+ function triggerRoute(orgSlug, agentName, name) {
13496
+ return `${agentRoute(orgSlug, agentName)}/triggers/${encodeURIComponent(name)}`;
13497
+ }
13498
+ function runRoute(orgSlug, agentName, runId) {
13499
+ return `${agentRoute(orgSlug, agentName)}/runs/${encodeURIComponent(runId)}`;
13496
13500
  }
13497
13501
  var fireStartedSchema = z2.object({
13498
13502
  inputId: z2.uuid(),
@@ -13958,7 +13962,7 @@ function createTriggerClient(config) {
13958
13962
  return secret;
13959
13963
  }
13960
13964
  function runPath(runId) {
13961
- return runRoute(config.agent, runId);
13965
+ return runRoute(config.org, config.agent, runId);
13962
13966
  }
13963
13967
  async function send(trigger, path, init, parse, acceptedErrors = []) {
13964
13968
  const headers = new Headers(init.headers);
@@ -13992,7 +13996,7 @@ function createTriggerClient(config) {
13992
13996
  }
13993
13997
  return {
13994
13998
  async fire(trigger, payload, options = {}) {
13995
- return await post(trigger, triggerRoute(config.agent, trigger), payload, options);
13999
+ return await post(trigger, triggerRoute(config.org, config.agent, trigger), payload, options);
13996
14000
  },
13997
14001
  async answer(trigger, runId, decision, options = {}) {
13998
14002
  return await post(trigger, `${runPath(runId)}/answer`, runAnswerSchema.parse(decision), options);
@@ -14010,7 +14014,7 @@ function createTriggerClient(config) {
14010
14014
  if (options.before !== undefined)
14011
14015
  query.set("before", options.before);
14012
14016
  const suffix = query.size ? `?${query.toString()}` : "";
14013
- return await send(trigger, `${triggerRoute(config.agent, trigger)}/runs${suffix}`, { method: "GET", signal: options.signal }, (answer) => runListSchema.parse(answer));
14017
+ return await send(trigger, `${triggerRoute(config.org, config.agent, trigger)}/runs${suffix}`, { method: "GET", signal: options.signal }, (answer) => runListSchema.parse(answer));
14014
14018
  },
14015
14019
  async cancel(trigger, runId, options = {}) {
14016
14020
  return await send(trigger, `${runPath(runId)}/cancel`, { method: "POST", signal: options.signal }, (answer) => runCancelSchema.parse(answer));
@@ -14106,6 +14110,13 @@ var managementProcedureKinds = {
14106
14110
  "observability.unhealthyToolIds": "query",
14107
14111
  "observability.unusedSkillIds": "query",
14108
14112
  "observability.updateSchemaDrift": "mutation",
14113
+ "orgs.create": "mutation",
14114
+ "orgs.delete": "mutation",
14115
+ "orgs.inviteOwner": "mutation",
14116
+ "orgs.list": "query",
14117
+ "orgs.options": "query",
14118
+ "orgs.restore": "mutation",
14119
+ "orgs.suspend": "mutation",
14109
14120
  "publishing.exclusive": "query",
14110
14121
  "publishing.history": "query",
14111
14122
  "publishing.latest": "query",
@@ -14180,9 +14191,14 @@ var managementProcedureKinds = {
14180
14191
  "triggers.setAudience": "mutation",
14181
14192
  "triggers.toggle": "mutation",
14182
14193
  "triggers.update": "mutation",
14183
- "users.create": "mutation",
14194
+ "users.accounts": "query",
14195
+ "users.invite": "mutation",
14184
14196
  "users.list": "query",
14197
+ "users.listInvitations": "query",
14198
+ "users.remove": "mutation",
14199
+ "users.revokeInvitation": "mutation",
14185
14200
  "users.roleOptions": "query",
14201
+ "users.setAccountActive": "mutation",
14186
14202
  "users.setActive": "mutation",
14187
14203
  "users.setRoles": "mutation",
14188
14204
  "users.setTempPassword": "mutation",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m6d/cortex",
3
- "version": "0.11.1",
3
+ "version": "0.12.1",
4
4
  "description": "Cortex for TypeScript backends: serve the server protocol and dataset hosts, fire triggers, and call the management API",
5
5
  "license": "MIT",
6
6
  "type": "module",