@m6d/cortex 0.12.1 → 0.13.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
@@ -118,6 +118,8 @@ import { createTriggerClient } from "@m6d/cortex";
118
118
  const triggers = createTriggerClient({
119
119
  url: "https://engine.cortex.example.com", // the engine's public origin, ENGINE_PUBLIC_URL
120
120
  org: "acme", // the slug of the agent's org
121
+ project: "web", // the agent's project
122
+ environment: "production", // the environment it is served from
121
123
  agent: "reviewer",
122
124
  secrets: { "pr-opened": process.env.PR_TRIGGER_SECRET! },
123
125
  });
package/dist/index.d.ts CHANGED
@@ -1380,11 +1380,12 @@ declare const runAnswerSchema: z.ZodObject<{
1380
1380
  approved: z.ZodBoolean;
1381
1381
  }, z.core.$strip>;
1382
1382
  export type RunAnswer = z.infer<typeof runAnswerSchema>;
1383
- declare const MESSAGE_BUSY: readonly [
1384
- "queue",
1385
- "steer"
1386
- ];
1387
- export type MessageBusy = (typeof MESSAGE_BUSY)[number];
1383
+ declare const environmentAddressSchema: z.ZodObject<{
1384
+ org: z.ZodString;
1385
+ project: z.ZodString;
1386
+ environment: z.ZodString;
1387
+ }, z.core.$strip>;
1388
+ export type EnvironmentAddress = z.infer<typeof environmentAddressSchema>;
1388
1389
  declare const fireAnswerSchema: z.ZodUnion<readonly [
1389
1390
  z.ZodObject<{
1390
1391
  inputId: z.ZodUUID;
@@ -1474,11 +1475,15 @@ declare const fireAnswerSchema: z.ZodUnion<readonly [
1474
1475
  }, z.core.$strip>
1475
1476
  ]>;
1476
1477
  export type FireAnswer = z.infer<typeof fireAnswerSchema>;
1477
- export type TriggerClientConfig = {
1478
+ declare const MESSAGE_BUSY: readonly [
1479
+ "queue",
1480
+ "steer"
1481
+ ];
1482
+ export type MessageBusy = (typeof MESSAGE_BUSY)[number];
1483
+ /** Where the agent is served from, by its environment's names, and how to reach and fire it. */
1484
+ export type TriggerClientConfig = EnvironmentAddress & {
1478
1485
  /** The engine's public origin (`ENGINE_PUBLIC_URL`) as the caller reaches it. */
1479
1486
  url: string;
1480
- /** The slug of the org the agent belongs to. */
1481
- org: string;
1482
1487
  /** The agent whose triggers are fired. */
1483
1488
  agent: string;
1484
1489
  /** The value of the fire credential shared by the caller's triggers. */
@@ -2123,6 +2128,9 @@ export type ManagementProcedures = {
2123
2128
  locationPicker: boolean;
2124
2129
  messages: boolean;
2125
2130
  whileBusy: "refuse" | "queue" | "steer";
2131
+ a2a: boolean;
2132
+ a2aPushHostnames: string | number | boolean | null | Record<string, unknown> | Array<unknown>;
2133
+ description: string;
2126
2134
  media: Array<"mermaid" | "vega-lite" | "map" | "report">;
2127
2135
  suggestions: Record<"en" | "ar", Array<{
2128
2136
  title: string;
@@ -2171,6 +2179,9 @@ export type ManagementProcedures = {
2171
2179
  locationPicker: boolean;
2172
2180
  messages: boolean;
2173
2181
  whileBusy: "refuse" | "queue" | "steer";
2182
+ a2a: boolean;
2183
+ a2aPushHostnames: string | number | boolean | null | Record<string, unknown> | Array<unknown>;
2184
+ description: string;
2174
2185
  media: Array<"mermaid" | "vega-lite" | "map" | "report">;
2175
2186
  suggestions: Record<"en" | "ar", Array<{
2176
2187
  title: string;
@@ -2231,6 +2242,9 @@ export type ManagementProcedures = {
2231
2242
  locationPicker: boolean;
2232
2243
  messages: boolean;
2233
2244
  whileBusy: "refuse" | "queue" | "steer";
2245
+ a2a: boolean;
2246
+ a2aPushHostnames: string | number | boolean | null | Record<string, unknown> | Array<unknown>;
2247
+ description: string;
2234
2248
  media: Array<"mermaid" | "vega-lite" | "map" | "report">;
2235
2249
  suggestions: Record<"en" | "ar", Array<{
2236
2250
  title: string;
@@ -2400,6 +2414,9 @@ export type ManagementProcedures = {
2400
2414
  locationPicker: boolean;
2401
2415
  messages: boolean;
2402
2416
  whileBusy: "refuse" | "queue" | "steer";
2417
+ a2a: boolean;
2418
+ a2aPushHostnames: string | number | boolean | null | Record<string, unknown> | Array<unknown>;
2419
+ description: string;
2403
2420
  media: Array<"mermaid" | "vega-lite" | "map" | "report">;
2404
2421
  suggestions: Record<"en" | "ar", Array<{
2405
2422
  title: string;
@@ -2436,6 +2453,9 @@ export type ManagementProcedures = {
2436
2453
  media?: Array<"mermaid" | "vega-lite" | "map" | "report">;
2437
2454
  messages?: boolean;
2438
2455
  whileBusy?: "refuse" | "queue" | "steer";
2456
+ a2a?: boolean;
2457
+ a2aPushHostnames?: Array<string>;
2458
+ description?: string;
2439
2459
  defaultLocale?: "en" | "ar";
2440
2460
  context?: {
2441
2461
  maxContextTokens: number;
@@ -2516,6 +2536,9 @@ export type ManagementProcedures = {
2516
2536
  locationPicker: boolean;
2517
2537
  messages: boolean;
2518
2538
  whileBusy: "refuse" | "queue" | "steer";
2539
+ a2a: boolean;
2540
+ a2aPushHostnames: string | number | boolean | null | Record<string, unknown> | Array<unknown>;
2541
+ description: string;
2519
2542
  media: Array<"mermaid" | "vega-lite" | "map" | "report">;
2520
2543
  suggestions: Record<"en" | "ar", Array<{
2521
2544
  title: string;
@@ -2564,6 +2587,9 @@ export type ManagementProcedures = {
2564
2587
  locationPicker: boolean;
2565
2588
  messages: boolean;
2566
2589
  whileBusy: "refuse" | "queue" | "steer";
2590
+ a2a: boolean;
2591
+ a2aPushHostnames: string | number | boolean | null | Record<string, unknown> | Array<unknown>;
2592
+ description: string;
2567
2593
  media: Array<"mermaid" | "vega-lite" | "map" | "report">;
2568
2594
  suggestions: Record<"en" | "ar", Array<{
2569
2595
  title: string;
@@ -3447,31 +3473,7 @@ export type ManagementProcedures = {
3447
3473
  updatedAt: string;
3448
3474
  };
3449
3475
  };
3450
- /** The caller's live management keys in name order, with pagination and search: name, display name, fingerprint, scope, and dates. Never the key itself. */
3451
- "managementKeys.list": {
3452
- input: {
3453
- pageIndex?: number;
3454
- pageSize?: number;
3455
- q?: string;
3456
- };
3457
- output: {
3458
- items: Array<{
3459
- id: string;
3460
- name: string;
3461
- displayName: Partial<Record<"en" | "ar", string>>;
3462
- fingerprint: string;
3463
- permissions: Array<string> | null;
3464
- lastUsedAt: string | null;
3465
- revokedAt: string | null;
3466
- createdAt: string;
3467
- }>;
3468
- /** Every row the caller may see, ignoring the search and filters. */
3469
- count: number;
3470
- /** The rows matching the search and filters, over all pages: the total to report. */
3471
- filteredCount: number;
3472
- };
3473
- };
3474
- /** The management key this request authenticated with (name, display name, fingerprint, scope, dates). Refused for a session or an operator token, which are not keys. */
3476
+ /** The management key this request authenticated with (name, display name, fingerprint, scope, dates) and the environment it acts in, by org slug, project and environment name. Refused for a session or an operator token, which are not keys. */
3475
3477
  "managementKeys.mine": {
3476
3478
  input: undefined;
3477
3479
  output: {
@@ -3483,6 +3485,11 @@ export type ManagementProcedures = {
3483
3485
  lastUsedAt: string | null;
3484
3486
  revokedAt: string | null;
3485
3487
  createdAt: string;
3488
+ environment: {
3489
+ org: string;
3490
+ project: string;
3491
+ environment: string;
3492
+ };
3486
3493
  };
3487
3494
  };
3488
3495
  /** What manifests.sync would create, update and delete, kind by kind, after the same checks, dataset host reads, OpenAPI document reads and knowledge document reads, changing nothing: it mints no trigger secret, stores no document and enqueues no job. `conflicts` lists each field that both the manifest and a live write changed since the last apply and that neither `resolutions` nor `prefer` answers; each keeps the manifest's value in what the preview judges. A field holding named parts (an agent's settings, greeting and suggestions, a collection's documents) conflicts part by part, its `key` naming the part. */
@@ -3543,6 +3550,9 @@ export type ManagementProcedures = {
3543
3550
  media?: Array<"mermaid" | "vega-lite" | "map" | "report">;
3544
3551
  messages?: boolean;
3545
3552
  whileBusy?: "refuse" | "queue" | "steer";
3553
+ a2a?: boolean;
3554
+ a2aPushHostnames?: Array<string>;
3555
+ description?: string;
3546
3556
  defaultLocale?: "en" | "ar";
3547
3557
  context?: {
3548
3558
  maxContextTokens?: number;
@@ -4205,6 +4215,9 @@ export type ManagementProcedures = {
4205
4215
  media?: Array<"mermaid" | "vega-lite" | "map" | "report">;
4206
4216
  messages?: boolean;
4207
4217
  whileBusy?: "refuse" | "queue" | "steer";
4218
+ a2a?: boolean;
4219
+ a2aPushHostnames?: Array<string>;
4220
+ description?: string;
4208
4221
  defaultLocale?: "en" | "ar";
4209
4222
  context?: {
4210
4223
  maxContextTokens?: number;
@@ -5334,16 +5347,16 @@ export type ManagementProcedures = {
5334
5347
  };
5335
5348
  threadId: string | null;
5336
5349
  threadTitle: string | null;
5337
- result: unknown;
5338
5350
  waits: Array<{
5339
5351
  kind: "approval" | "client_tool";
5340
5352
  toolCallId: string;
5341
5353
  toolName: string;
5342
5354
  input: unknown;
5343
5355
  }>;
5356
+ result: unknown;
5344
5357
  };
5345
5358
  };
5346
- /** Token and message usage of the agents the caller may read: totals and per user, server, agent and day, optionally for one agent within a day range. */
5359
+ /** Token and message usage of the agents the caller may read: totals and per server, agent and day, optionally for one agent within a day range. */
5347
5360
  "observability.getUsage": {
5348
5361
  input: {
5349
5362
  dateFrom?: string;
@@ -5362,22 +5375,6 @@ export type ManagementProcedures = {
5362
5375
  threads: number;
5363
5376
  activeUsers: number;
5364
5377
  };
5365
- perUser: Array<{
5366
- scopeId: string;
5367
- scope: {
5368
- name: string;
5369
- displayName: Partial<Record<"en" | "ar", string>>;
5370
- };
5371
- userId: string;
5372
- triggerName: string | null;
5373
- threads: number;
5374
- inputTokens: number;
5375
- cacheReadTokens: number;
5376
- cacheWriteTokens: number;
5377
- outputTokens: number;
5378
- totalTokens: number;
5379
- messages: number;
5380
- }>;
5381
5378
  perServer: Array<{
5382
5379
  serverId: string | null;
5383
5380
  server: {
@@ -5510,6 +5507,12 @@ export type ManagementProcedures = {
5510
5507
  };
5511
5508
  threadId: string | null;
5512
5509
  threadTitle: string | null;
5510
+ waits: Array<{
5511
+ kind: "approval" | "client_tool";
5512
+ toolCallId: string;
5513
+ toolName: string;
5514
+ input: unknown;
5515
+ }>;
5513
5516
  }>;
5514
5517
  /** Every row the caller may see, ignoring the search and filters. */
5515
5518
  count: number;
@@ -5638,6 +5641,40 @@ export type ManagementProcedures = {
5638
5641
  filteredCount: number;
5639
5642
  };
5640
5643
  };
5644
+ /** Each end user's token and message usage and threads, most tokens first, with pagination, search by user id, and the usage summary's filters. */
5645
+ "observability.listUsageUsers": {
5646
+ input: {
5647
+ pageIndex?: number;
5648
+ pageSize?: number;
5649
+ q?: string;
5650
+ dateFrom?: string;
5651
+ dateTo?: string;
5652
+ agentId?: string;
5653
+ includeTest?: boolean;
5654
+ };
5655
+ output: {
5656
+ items: Array<{
5657
+ scopeId: string;
5658
+ scope: {
5659
+ name: string;
5660
+ displayName: Partial<Record<"en" | "ar", string>>;
5661
+ };
5662
+ userId: string;
5663
+ triggerName: string | null;
5664
+ threads: number;
5665
+ inputTokens: number;
5666
+ cacheReadTokens: number;
5667
+ cacheWriteTokens: number;
5668
+ outputTokens: number;
5669
+ totalTokens: number;
5670
+ messages: number;
5671
+ }>;
5672
+ /** Every row the caller may see, ignoring the search and filters. */
5673
+ count: number;
5674
+ /** The rows matching the search and filters, over all pages: the total to report. */
5675
+ filteredCount: number;
5676
+ };
5677
+ };
5641
5678
  /** Ids of tools whose recent executions exceed the failure threshold. */
5642
5679
  "observability.unhealthyToolIds": {
5643
5680
  input: undefined;
@@ -5705,6 +5742,24 @@ export type ManagementProcedures = {
5705
5742
  updatedAt: string;
5706
5743
  };
5707
5744
  };
5745
+ /** Delete an environment: it serves nothing at once and the daily purge removes it with all it holds. Refused as `last_environment` for a project's last one. */
5746
+ "orgs.deleteEnvironment": {
5747
+ input: {
5748
+ id: string;
5749
+ };
5750
+ output: {
5751
+ environments: number;
5752
+ };
5753
+ };
5754
+ /** Delete a project and every environment in it: they serve nothing at once and the daily purge removes them with all they hold. Refused as `last_project` for an org's last project. */
5755
+ "orgs.deleteProject": {
5756
+ input: {
5757
+ id: string;
5758
+ };
5759
+ output: {
5760
+ environments: number;
5761
+ };
5762
+ };
5708
5763
  /** 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
5764
  "orgs.inviteOwner": {
5710
5765
  input: {
@@ -5750,6 +5805,21 @@ export type ManagementProcedures = {
5750
5805
  name: string;
5751
5806
  }>;
5752
5807
  };
5808
+ /** Rename the caller's org; its slug, its address in URLs, never changes. Returns the org. */
5809
+ "orgs.rename": {
5810
+ input: {
5811
+ name: string;
5812
+ };
5813
+ output: {
5814
+ id: string;
5815
+ slug: string;
5816
+ name: string;
5817
+ suspendedAt: string | null;
5818
+ purgeAt: string | null;
5819
+ createdAt: string;
5820
+ updatedAt: string;
5821
+ };
5822
+ };
5753
5823
  /** Restore a suspended or deleted org before its purge, as it was, its assistant brought up to this release. */
5754
5824
  "orgs.restore": {
5755
5825
  input: {
@@ -5780,6 +5850,20 @@ export type ManagementProcedures = {
5780
5850
  updatedAt: string;
5781
5851
  };
5782
5852
  };
5853
+ /** Set a project's display name; its name, its address in URLs, never changes. Returns the project. */
5854
+ "orgs.updateProject": {
5855
+ input: {
5856
+ id: string;
5857
+ displayName: Partial<Record<"en" | "ar", string>>;
5858
+ };
5859
+ output: {
5860
+ id: string;
5861
+ name: string;
5862
+ displayName: Partial<Record<"en" | "ar", string>>;
5863
+ createdAt: string;
5864
+ updatedAt: string;
5865
+ };
5866
+ };
5783
5867
  /** Components of every kind shared with this agent alone: what deleting it leaves shared with nobody, unless `agents.delete` names them in `deleteComponentIds`. */
5784
5868
  "publishing.exclusive": {
5785
5869
  input: {
@@ -5834,13 +5918,13 @@ export type ManagementProcedures = {
5834
5918
  input: {
5835
5919
  name: string;
5836
5920
  description: string;
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">;
5921
+ 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" | "projects:manage" | "orgs:manage">;
5838
5922
  };
5839
5923
  output: {
5840
5924
  id: string;
5841
5925
  name: string;
5842
5926
  description: string;
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">;
5927
+ 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" | "projects:manage" | "orgs:manage">;
5844
5928
  };
5845
5929
  };
5846
5930
  /** Delete a role; the built-in Administrator role cannot be deleted. */
@@ -5862,7 +5946,7 @@ export type ManagementProcedures = {
5862
5946
  id: string;
5863
5947
  name: string;
5864
5948
  description: string;
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">;
5949
+ 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" | "projects:manage" | "orgs:manage">;
5866
5950
  builtInId: string | null;
5867
5951
  createdAt: string;
5868
5952
  assignedUsers: number;
@@ -5878,14 +5962,14 @@ export type ManagementProcedures = {
5878
5962
  input: {
5879
5963
  name: string;
5880
5964
  description: string;
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">;
5965
+ 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" | "projects:manage" | "orgs:manage">;
5882
5966
  id: string;
5883
5967
  };
5884
5968
  output: {
5885
5969
  id: string;
5886
5970
  name: string;
5887
5971
  description: string;
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">;
5972
+ 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" | "projects:manage" | "orgs:manage">;
5889
5973
  };
5890
5974
  };
5891
5975
  /** Delete a secret; fails while a credential or an agent's auth (its signing secret or reCAPTCHA API key) still references it. */
@@ -6443,7 +6527,7 @@ export type ManagementProcedures = {
6443
6527
  name: string;
6444
6528
  };
6445
6529
  };
6446
- /** The org's settings: log and thread retention, and the browser origins its engine routes admit. */
6530
+ /** The caller's environment's settings: log and thread retention, and the browser origins its engine routes admit. */
6447
6531
  "settings.get": {
6448
6532
  input: undefined;
6449
6533
  output: {
@@ -6452,12 +6536,12 @@ export type ManagementProcedures = {
6452
6536
  corsOrigins: Array<string>;
6453
6537
  };
6454
6538
  };
6455
- /** Change the org's settings: retention, and the browser origins its engine routes admit. */
6539
+ /** Change the caller's environment's settings: retention, and the browser origins its engine routes admit. */
6456
6540
  "settings.update": {
6457
6541
  input: {
6458
6542
  logRetentionDays: number;
6459
6543
  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. */
6544
+ /** Browser origins, beside the console's own, that may call the environment's engine routes, such as a site embedding its widget. */
6461
6545
  corsOrigins: Array<string>;
6462
6546
  };
6463
6547
  output: {
@@ -9748,6 +9832,9 @@ declare const manifestAgentSchema: z.ZodObject<{
9748
9832
  refuse: "refuse";
9749
9833
  queue: "queue";
9750
9834
  }>>;
9835
+ a2a: z.ZodDefault<z.ZodBoolean>;
9836
+ a2aPushHostnames: z.ZodDefault<z.ZodArray<z.ZodString>>;
9837
+ description: z.ZodDefault<z.ZodString>;
9751
9838
  defaultLocale: z.ZodDefault<z.ZodEnum<{
9752
9839
  en: "en";
9753
9840
  ar: "ar";
@@ -9878,6 +9965,9 @@ declare const manifestSchema: z.ZodObject<{
9878
9965
  refuse: "refuse";
9879
9966
  queue: "queue";
9880
9967
  }>>;
9968
+ a2a: z.ZodDefault<z.ZodBoolean>;
9969
+ a2aPushHostnames: z.ZodDefault<z.ZodArray<z.ZodString>>;
9970
+ description: z.ZodDefault<z.ZodString>;
9881
9971
  defaultLocale: z.ZodDefault<z.ZodEnum<{
9882
9972
  en: "en";
9883
9973
  ar: "ar";
@@ -11023,6 +11113,9 @@ export declare function defineManifest(manifest: Manifest): {
11023
11113
  media?: ("map" | "mermaid" | "vega-lite" | "report")[] | undefined;
11024
11114
  messages?: boolean | undefined;
11025
11115
  whileBusy?: "steer" | "refuse" | "queue" | undefined;
11116
+ a2a?: boolean | undefined;
11117
+ a2aPushHostnames?: string[] | undefined;
11118
+ description?: string | undefined;
11026
11119
  defaultLocale?: "en" | "ar" | undefined;
11027
11120
  context?: {
11028
11121
  maxContextTokens?: number | undefined;
package/dist/index.js CHANGED
@@ -13486,17 +13486,22 @@ var runAnswerSchema = z.object({
13486
13486
  // ../../internal/contracts/src/triggers/index.ts
13487
13487
  import { z as z2 } from "zod";
13488
13488
  var TRIGGER_ANSWER_TOOL_NAME = "submitAnswer";
13489
- function orgRoute(orgSlug) {
13490
- return `/orgs/${encodeURIComponent(orgSlug)}`;
13489
+ var environmentAddressSchema = z2.object({
13490
+ org: z2.string(),
13491
+ project: z2.string(),
13492
+ environment: z2.string()
13493
+ });
13494
+ function environmentRoute({ org, project, environment }) {
13495
+ return `/orgs/${encodeURIComponent(org)}/projects/${encodeURIComponent(project)}/envs/${encodeURIComponent(environment)}`;
13491
13496
  }
13492
- function agentRoute(orgSlug, agentName) {
13493
- return `${orgRoute(orgSlug)}/agents/${encodeURIComponent(agentName)}`;
13497
+ function agentRoute(address, agentName) {
13498
+ return `${environmentRoute(address)}/agents/${encodeURIComponent(agentName)}`;
13494
13499
  }
13495
- function triggerRoute(orgSlug, agentName, name) {
13496
- return `${agentRoute(orgSlug, agentName)}/triggers/${encodeURIComponent(name)}`;
13500
+ function triggerRoute(address, agentName, name) {
13501
+ return `${agentRoute(address, agentName)}/triggers/${encodeURIComponent(name)}`;
13497
13502
  }
13498
- function runRoute(orgSlug, agentName, runId) {
13499
- return `${agentRoute(orgSlug, agentName)}/runs/${encodeURIComponent(runId)}`;
13503
+ function runRoute(address, agentName, runId) {
13504
+ return `${agentRoute(address, agentName)}/runs/${encodeURIComponent(runId)}`;
13500
13505
  }
13501
13506
  var fireStartedSchema = z2.object({
13502
13507
  inputId: z2.uuid(),
@@ -13962,7 +13967,7 @@ function createTriggerClient(config) {
13962
13967
  return secret;
13963
13968
  }
13964
13969
  function runPath(runId) {
13965
- return runRoute(config.org, config.agent, runId);
13970
+ return runRoute(config, config.agent, runId);
13966
13971
  }
13967
13972
  async function send(trigger, path, init, parse, acceptedErrors = []) {
13968
13973
  const headers = new Headers(init.headers);
@@ -13996,7 +14001,7 @@ function createTriggerClient(config) {
13996
14001
  }
13997
14002
  return {
13998
14003
  async fire(trigger, payload, options = {}) {
13999
- return await post(trigger, triggerRoute(config.org, config.agent, trigger), payload, options);
14004
+ return await post(trigger, triggerRoute(config, config.agent, trigger), payload, options);
14000
14005
  },
14001
14006
  async answer(trigger, runId, decision, options = {}) {
14002
14007
  return await post(trigger, `${runPath(runId)}/answer`, runAnswerSchema.parse(decision), options);
@@ -14014,7 +14019,7 @@ function createTriggerClient(config) {
14014
14019
  if (options.before !== undefined)
14015
14020
  query.set("before", options.before);
14016
14021
  const suffix = query.size ? `?${query.toString()}` : "";
14017
- return await send(trigger, `${triggerRoute(config.org, config.agent, trigger)}/runs${suffix}`, { method: "GET", signal: options.signal }, (answer) => runListSchema.parse(answer));
14022
+ return await send(trigger, `${triggerRoute(config, config.agent, trigger)}/runs${suffix}`, { method: "GET", signal: options.signal }, (answer) => runListSchema.parse(answer));
14018
14023
  },
14019
14024
  async cancel(trigger, runId, options = {}) {
14020
14025
  return await send(trigger, `${runPath(runId)}/cancel`, { method: "POST", signal: options.signal }, (answer) => runCancelSchema.parse(answer));
@@ -14072,7 +14077,6 @@ var managementProcedureKinds = {
14072
14077
  "documents.prepareUpload": "mutation",
14073
14078
  "documents.remove": "mutation",
14074
14079
  "documents.retry": "mutation",
14075
- "managementKeys.list": "query",
14076
14080
  "managementKeys.mine": "query",
14077
14081
  "manifests.preview": "mutation",
14078
14082
  "manifests.sync": "mutation",
@@ -14107,16 +14111,21 @@ var managementProcedureKinds = {
14107
14111
  "observability.listSkillMisses": "query",
14108
14112
  "observability.listSkillUsage": "query",
14109
14113
  "observability.listToolHealth": "query",
14114
+ "observability.listUsageUsers": "query",
14110
14115
  "observability.unhealthyToolIds": "query",
14111
14116
  "observability.unusedSkillIds": "query",
14112
14117
  "observability.updateSchemaDrift": "mutation",
14113
14118
  "orgs.create": "mutation",
14114
14119
  "orgs.delete": "mutation",
14120
+ "orgs.deleteEnvironment": "mutation",
14121
+ "orgs.deleteProject": "mutation",
14115
14122
  "orgs.inviteOwner": "mutation",
14116
14123
  "orgs.list": "query",
14117
14124
  "orgs.options": "query",
14125
+ "orgs.rename": "mutation",
14118
14126
  "orgs.restore": "mutation",
14119
14127
  "orgs.suspend": "mutation",
14128
+ "orgs.updateProject": "mutation",
14120
14129
  "publishing.exclusive": "query",
14121
14130
  "publishing.history": "query",
14122
14131
  "publishing.latest": "query",
@@ -14414,6 +14423,7 @@ function overridable(fields) {
14414
14423
  }
14415
14424
  var HOSTNAME_PATTERN = /^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?(\.[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/;
14416
14425
  var FETCH_IMAGE_HOSTS_LIMIT = 20;
14426
+ var A2A_PUSH_HOSTS_LIMIT = 20;
14417
14427
  var SUGGESTION_LIMITS = { perLocale: 6, titleLength: 120, promptLength: 2000 };
14418
14428
  var trimmedText = (max) => z7.string().min(1).max(max).refine((text) => text === text.trim(), "text has surrounding whitespace");
14419
14429
  var suggestionsSchema = z7.record(localeSchema, z7.array(z7.object({
@@ -15263,6 +15273,9 @@ var agentSettingsSchema = z7.strictObject({
15263
15273
  media: z7.array(z7.enum(MEDIA_FORMS)).default([...DEFAULT_MEDIA_FORMS]),
15264
15274
  messages: z7.boolean().default(true),
15265
15275
  whileBusy: z7.enum(WHILE_BUSY).default("refuse"),
15276
+ a2a: z7.boolean().default(false),
15277
+ a2aPushHostnames: z7.array(z7.string().max(253).regex(HOSTNAME_PATTERN)).max(A2A_PUSH_HOSTS_LIMIT).default([]),
15278
+ description: z7.string().trim().max(1000).default(""),
15266
15279
  defaultLocale: localeSchema.default(BASE_LOCALE),
15267
15280
  context: z7.strictObject({
15268
15281
  maxContextTokens: setting(agentContext.maxContextTokens),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m6d/cortex",
3
- "version": "0.12.1",
3
+ "version": "0.13.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",