@automagik/omni 2.260714.1 → 2.260714.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +105 -3
- package/dist/server/index.js +155 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -71395,7 +71395,16 @@ var init_schema2 = __esm(() => {
|
|
|
71395
71395
|
accessModes = ["disabled", "blocklist", "allowlist"];
|
|
71396
71396
|
settingValueTypes = ["string", "integer", "boolean", "json", "secret"];
|
|
71397
71397
|
apiKeyStatuses = ["active", "revoked", "expired"];
|
|
71398
|
-
apiKeyProfiles = [
|
|
71398
|
+
apiKeyProfiles = [
|
|
71399
|
+
"cs",
|
|
71400
|
+
"personal",
|
|
71401
|
+
"scout",
|
|
71402
|
+
"coworker",
|
|
71403
|
+
"admin",
|
|
71404
|
+
"console-viewer",
|
|
71405
|
+
"console-operator",
|
|
71406
|
+
"console-admin"
|
|
71407
|
+
];
|
|
71399
71408
|
eventTypes = CORE_EVENT_TYPES;
|
|
71400
71409
|
contentTypes = [
|
|
71401
71410
|
"text",
|
|
@@ -73419,8 +73428,80 @@ var init_api_keys = __esm(() => {
|
|
|
73419
73428
|
});
|
|
73420
73429
|
|
|
73421
73430
|
// ../api/src/constants/profiles.ts
|
|
73422
|
-
var COWORKER_DEFAULT_DENYLIST_PRESET_KEY = "khal-os-core", PROFILES;
|
|
73431
|
+
var COWORKER_DEFAULT_DENYLIST_PRESET_KEY = "khal-os-core", CONSOLE_READ_SCOPES, CONSOLE_OPERATE_SCOPES, CONSOLE_ADMINISTRATION_SCOPES, CONSOLE_VIEWER_SCOPES, CONSOLE_OPERATOR_SCOPES, CONSOLE_ADMIN_SCOPES, PROFILES;
|
|
73423
73432
|
var init_profiles = __esm(() => {
|
|
73433
|
+
CONSOLE_READ_SCOPES = [
|
|
73434
|
+
"access:read",
|
|
73435
|
+
"agent-state:read",
|
|
73436
|
+
"agent-tasks:read",
|
|
73437
|
+
"agents:read",
|
|
73438
|
+
"auth:validate",
|
|
73439
|
+
"automations:read",
|
|
73440
|
+
"batch-jobs:read",
|
|
73441
|
+
"chats:read",
|
|
73442
|
+
"context:read",
|
|
73443
|
+
"conversations:read",
|
|
73444
|
+
"dead-letters:read",
|
|
73445
|
+
"event-ops:read",
|
|
73446
|
+
"events:read",
|
|
73447
|
+
"follow-up:read",
|
|
73448
|
+
"handoffs:read",
|
|
73449
|
+
"instances:read",
|
|
73450
|
+
"journeys:read",
|
|
73451
|
+
"logs:read",
|
|
73452
|
+
"media:read",
|
|
73453
|
+
"messages:read",
|
|
73454
|
+
"metrics:read",
|
|
73455
|
+
"payloads:read",
|
|
73456
|
+
"persons:read",
|
|
73457
|
+
"providers:read",
|
|
73458
|
+
"routes:read",
|
|
73459
|
+
"settings:read",
|
|
73460
|
+
"trust:read",
|
|
73461
|
+
"voice:read",
|
|
73462
|
+
"webhooks:read"
|
|
73463
|
+
];
|
|
73464
|
+
CONSOLE_OPERATE_SCOPES = [
|
|
73465
|
+
"agent-state:write",
|
|
73466
|
+
"agent-tasks:write",
|
|
73467
|
+
"automations:write",
|
|
73468
|
+
"batch-jobs:write",
|
|
73469
|
+
"chats:write",
|
|
73470
|
+
"context:write",
|
|
73471
|
+
"conversations:write",
|
|
73472
|
+
"dead-letters:write",
|
|
73473
|
+
"event-ops:write",
|
|
73474
|
+
"events:write",
|
|
73475
|
+
"follow-up:write",
|
|
73476
|
+
"instances:write",
|
|
73477
|
+
"media:write",
|
|
73478
|
+
"messages:send",
|
|
73479
|
+
"messages:write",
|
|
73480
|
+
"persons:write",
|
|
73481
|
+
"routes:write",
|
|
73482
|
+
"tts:synthesize",
|
|
73483
|
+
"turns:admin",
|
|
73484
|
+
"turns:close",
|
|
73485
|
+
"voice:write"
|
|
73486
|
+
];
|
|
73487
|
+
CONSOLE_ADMINISTRATION_SCOPES = [
|
|
73488
|
+
"access:write",
|
|
73489
|
+
"agents:write",
|
|
73490
|
+
"keys:read",
|
|
73491
|
+
"keys:write",
|
|
73492
|
+
"payloads:write",
|
|
73493
|
+
"providers:write",
|
|
73494
|
+
"settings:write",
|
|
73495
|
+
"trust:write",
|
|
73496
|
+
"webhooks:write"
|
|
73497
|
+
];
|
|
73498
|
+
CONSOLE_VIEWER_SCOPES = [...CONSOLE_READ_SCOPES];
|
|
73499
|
+
CONSOLE_OPERATOR_SCOPES = [...CONSOLE_READ_SCOPES, ...CONSOLE_OPERATE_SCOPES];
|
|
73500
|
+
CONSOLE_ADMIN_SCOPES = [
|
|
73501
|
+
...CONSOLE_READ_SCOPES,
|
|
73502
|
+
...CONSOLE_OPERATE_SCOPES,
|
|
73503
|
+
...CONSOLE_ADMINISTRATION_SCOPES
|
|
73504
|
+
];
|
|
73424
73505
|
PROFILES = {
|
|
73425
73506
|
cs: {
|
|
73426
73507
|
buckets: ["outgoing", "read", "context", "turn"],
|
|
@@ -73451,6 +73532,27 @@ var init_profiles = __esm(() => {
|
|
|
73451
73532
|
buckets: ["outgoing", "read", "context", "turn", "multimodal_in", "multimodal_out"],
|
|
73452
73533
|
requiresLocks: [],
|
|
73453
73534
|
adminOnlyFlag: true
|
|
73535
|
+
},
|
|
73536
|
+
"console-viewer": {
|
|
73537
|
+
buckets: [],
|
|
73538
|
+
requiresLocks: [],
|
|
73539
|
+
defaultOverrides: {
|
|
73540
|
+
extraScopes: CONSOLE_VIEWER_SCOPES
|
|
73541
|
+
}
|
|
73542
|
+
},
|
|
73543
|
+
"console-operator": {
|
|
73544
|
+
buckets: [],
|
|
73545
|
+
requiresLocks: [],
|
|
73546
|
+
defaultOverrides: {
|
|
73547
|
+
extraScopes: CONSOLE_OPERATOR_SCOPES
|
|
73548
|
+
}
|
|
73549
|
+
},
|
|
73550
|
+
"console-admin": {
|
|
73551
|
+
buckets: [],
|
|
73552
|
+
requiresLocks: [],
|
|
73553
|
+
defaultOverrides: {
|
|
73554
|
+
extraScopes: CONSOLE_ADMIN_SCOPES
|
|
73555
|
+
}
|
|
73454
73556
|
}
|
|
73455
73557
|
};
|
|
73456
73558
|
});
|
|
@@ -125062,7 +125164,7 @@ import { fileURLToPath } from "url";
|
|
|
125062
125164
|
// package.json
|
|
125063
125165
|
var package_default = {
|
|
125064
125166
|
name: "@automagik/omni",
|
|
125065
|
-
version: "2.260714.
|
|
125167
|
+
version: "2.260714.2",
|
|
125066
125168
|
description: "LLM-optimized CLI for Omni",
|
|
125067
125169
|
type: "module",
|
|
125068
125170
|
bin: {
|
package/dist/server/index.js
CHANGED
|
@@ -225883,7 +225883,7 @@ var init_sentry_scrub = __esm(() => {
|
|
|
225883
225883
|
var require_package7 = __commonJS((exports, module) => {
|
|
225884
225884
|
module.exports = {
|
|
225885
225885
|
name: "@omni/api",
|
|
225886
|
-
version: "2.260714.
|
|
225886
|
+
version: "2.260714.2",
|
|
225887
225887
|
type: "module",
|
|
225888
225888
|
exports: {
|
|
225889
225889
|
".": {
|
|
@@ -278135,7 +278135,16 @@ var init_schema2 = __esm(() => {
|
|
|
278135
278135
|
accessModes = ["disabled", "blocklist", "allowlist"];
|
|
278136
278136
|
settingValueTypes = ["string", "integer", "boolean", "json", "secret"];
|
|
278137
278137
|
apiKeyStatuses = ["active", "revoked", "expired"];
|
|
278138
|
-
apiKeyProfiles = [
|
|
278138
|
+
apiKeyProfiles = [
|
|
278139
|
+
"cs",
|
|
278140
|
+
"personal",
|
|
278141
|
+
"scout",
|
|
278142
|
+
"coworker",
|
|
278143
|
+
"admin",
|
|
278144
|
+
"console-viewer",
|
|
278145
|
+
"console-operator",
|
|
278146
|
+
"console-admin"
|
|
278147
|
+
];
|
|
278139
278148
|
eventTypes = CORE_EVENT_TYPES;
|
|
278140
278149
|
contentTypes = [
|
|
278141
278150
|
"text",
|
|
@@ -285031,8 +285040,80 @@ var init_genie_signature = __esm(() => {
|
|
|
285031
285040
|
});
|
|
285032
285041
|
|
|
285033
285042
|
// ../api/src/constants/profiles.ts
|
|
285034
|
-
var COWORKER_DEFAULT_DENYLIST_PRESET_KEY = "khal-os-core", PROFILES;
|
|
285043
|
+
var COWORKER_DEFAULT_DENYLIST_PRESET_KEY = "khal-os-core", CONSOLE_READ_SCOPES, CONSOLE_OPERATE_SCOPES, CONSOLE_ADMINISTRATION_SCOPES, CONSOLE_VIEWER_SCOPES, CONSOLE_OPERATOR_SCOPES, CONSOLE_ADMIN_SCOPES, PROFILES;
|
|
285035
285044
|
var init_profiles = __esm(() => {
|
|
285045
|
+
CONSOLE_READ_SCOPES = [
|
|
285046
|
+
"access:read",
|
|
285047
|
+
"agent-state:read",
|
|
285048
|
+
"agent-tasks:read",
|
|
285049
|
+
"agents:read",
|
|
285050
|
+
"auth:validate",
|
|
285051
|
+
"automations:read",
|
|
285052
|
+
"batch-jobs:read",
|
|
285053
|
+
"chats:read",
|
|
285054
|
+
"context:read",
|
|
285055
|
+
"conversations:read",
|
|
285056
|
+
"dead-letters:read",
|
|
285057
|
+
"event-ops:read",
|
|
285058
|
+
"events:read",
|
|
285059
|
+
"follow-up:read",
|
|
285060
|
+
"handoffs:read",
|
|
285061
|
+
"instances:read",
|
|
285062
|
+
"journeys:read",
|
|
285063
|
+
"logs:read",
|
|
285064
|
+
"media:read",
|
|
285065
|
+
"messages:read",
|
|
285066
|
+
"metrics:read",
|
|
285067
|
+
"payloads:read",
|
|
285068
|
+
"persons:read",
|
|
285069
|
+
"providers:read",
|
|
285070
|
+
"routes:read",
|
|
285071
|
+
"settings:read",
|
|
285072
|
+
"trust:read",
|
|
285073
|
+
"voice:read",
|
|
285074
|
+
"webhooks:read"
|
|
285075
|
+
];
|
|
285076
|
+
CONSOLE_OPERATE_SCOPES = [
|
|
285077
|
+
"agent-state:write",
|
|
285078
|
+
"agent-tasks:write",
|
|
285079
|
+
"automations:write",
|
|
285080
|
+
"batch-jobs:write",
|
|
285081
|
+
"chats:write",
|
|
285082
|
+
"context:write",
|
|
285083
|
+
"conversations:write",
|
|
285084
|
+
"dead-letters:write",
|
|
285085
|
+
"event-ops:write",
|
|
285086
|
+
"events:write",
|
|
285087
|
+
"follow-up:write",
|
|
285088
|
+
"instances:write",
|
|
285089
|
+
"media:write",
|
|
285090
|
+
"messages:send",
|
|
285091
|
+
"messages:write",
|
|
285092
|
+
"persons:write",
|
|
285093
|
+
"routes:write",
|
|
285094
|
+
"tts:synthesize",
|
|
285095
|
+
"turns:admin",
|
|
285096
|
+
"turns:close",
|
|
285097
|
+
"voice:write"
|
|
285098
|
+
];
|
|
285099
|
+
CONSOLE_ADMINISTRATION_SCOPES = [
|
|
285100
|
+
"access:write",
|
|
285101
|
+
"agents:write",
|
|
285102
|
+
"keys:read",
|
|
285103
|
+
"keys:write",
|
|
285104
|
+
"payloads:write",
|
|
285105
|
+
"providers:write",
|
|
285106
|
+
"settings:write",
|
|
285107
|
+
"trust:write",
|
|
285108
|
+
"webhooks:write"
|
|
285109
|
+
];
|
|
285110
|
+
CONSOLE_VIEWER_SCOPES = [...CONSOLE_READ_SCOPES];
|
|
285111
|
+
CONSOLE_OPERATOR_SCOPES = [...CONSOLE_READ_SCOPES, ...CONSOLE_OPERATE_SCOPES];
|
|
285112
|
+
CONSOLE_ADMIN_SCOPES = [
|
|
285113
|
+
...CONSOLE_READ_SCOPES,
|
|
285114
|
+
...CONSOLE_OPERATE_SCOPES,
|
|
285115
|
+
...CONSOLE_ADMINISTRATION_SCOPES
|
|
285116
|
+
];
|
|
285036
285117
|
PROFILES = {
|
|
285037
285118
|
cs: {
|
|
285038
285119
|
buckets: ["outgoing", "read", "context", "turn"],
|
|
@@ -285063,6 +285144,27 @@ var init_profiles = __esm(() => {
|
|
|
285063
285144
|
buckets: ["outgoing", "read", "context", "turn", "multimodal_in", "multimodal_out"],
|
|
285064
285145
|
requiresLocks: [],
|
|
285065
285146
|
adminOnlyFlag: true
|
|
285147
|
+
},
|
|
285148
|
+
"console-viewer": {
|
|
285149
|
+
buckets: [],
|
|
285150
|
+
requiresLocks: [],
|
|
285151
|
+
defaultOverrides: {
|
|
285152
|
+
extraScopes: CONSOLE_VIEWER_SCOPES
|
|
285153
|
+
}
|
|
285154
|
+
},
|
|
285155
|
+
"console-operator": {
|
|
285156
|
+
buckets: [],
|
|
285157
|
+
requiresLocks: [],
|
|
285158
|
+
defaultOverrides: {
|
|
285159
|
+
extraScopes: CONSOLE_OPERATOR_SCOPES
|
|
285160
|
+
}
|
|
285161
|
+
},
|
|
285162
|
+
"console-admin": {
|
|
285163
|
+
buckets: [],
|
|
285164
|
+
requiresLocks: [],
|
|
285165
|
+
defaultOverrides: {
|
|
285166
|
+
extraScopes: CONSOLE_ADMIN_SCOPES
|
|
285167
|
+
}
|
|
285066
285168
|
}
|
|
285067
285169
|
};
|
|
285068
285170
|
});
|
|
@@ -285420,6 +285522,17 @@ var init_scopes = __esm(() => {
|
|
|
285420
285522
|
"POST /events/search": "events:read",
|
|
285421
285523
|
"GET /events/:id": "events:read",
|
|
285422
285524
|
"GET /events/by-sender/:senderId": "events:read",
|
|
285525
|
+
"GET /follow-up/agents/:id": "follow-up:read",
|
|
285526
|
+
"PUT /follow-up/agents/:id": "follow-up:write",
|
|
285527
|
+
"DELETE /follow-up/agents/:id": "follow-up:write",
|
|
285528
|
+
"GET /follow-up/instances/:id": "follow-up:read",
|
|
285529
|
+
"PUT /follow-up/instances/:id": "follow-up:write",
|
|
285530
|
+
"DELETE /follow-up/instances/:id": "follow-up:write",
|
|
285531
|
+
"GET /follow-up/chats/:id": "follow-up:read",
|
|
285532
|
+
"PUT /follow-up/chats/:id": "follow-up:write",
|
|
285533
|
+
"DELETE /follow-up/chats/:id": "follow-up:write",
|
|
285534
|
+
"GET /handoffs": "handoffs:read",
|
|
285535
|
+
"GET /handoffs/:id": "handoffs:read",
|
|
285423
285536
|
"GET /instances": "instances:read",
|
|
285424
285537
|
"GET /instances/supported-channels": "instances:read",
|
|
285425
285538
|
"GET /instances/:id": "instances:read",
|
|
@@ -285553,6 +285666,15 @@ var init_scopes = __esm(() => {
|
|
|
285553
285666
|
"POST /turns/:id/close": "turns:admin",
|
|
285554
285667
|
"POST /turns/close-all": "turns:admin",
|
|
285555
285668
|
"POST /turns/close": "turns:close",
|
|
285669
|
+
"POST /trust/handshake": "trust:write",
|
|
285670
|
+
"GET /trust/hosts": "trust:read",
|
|
285671
|
+
"GET /trust/hosts/:id": "trust:read",
|
|
285672
|
+
"PATCH /trust/hosts/:id": "trust:write",
|
|
285673
|
+
"DELETE /trust/hosts/:id": "trust:write",
|
|
285674
|
+
"POST /voice/join": "voice:write",
|
|
285675
|
+
"POST /voice/leave": "voice:write",
|
|
285676
|
+
"GET /voice/sessions": "voice:read",
|
|
285677
|
+
"GET /voice/sessions/:id": "voice:read",
|
|
285556
285678
|
"GET /webhook-sources": "webhooks:read",
|
|
285557
285679
|
"GET /webhook-sources/:id": "webhooks:read",
|
|
285558
285680
|
"POST /webhook-sources": "webhooks:write",
|
|
@@ -356630,6 +356752,18 @@ function normalizeOverrides(overrides) {
|
|
|
356630
356752
|
denylistPresetKey: overrides.denylistPresetKey === null ? undefined : overrides.denylistPresetKey
|
|
356631
356753
|
};
|
|
356632
356754
|
}
|
|
356755
|
+
function enforceMintCeiling(c, requestedScopes) {
|
|
356756
|
+
const callerScopes = c.get("apiKey")?.scopes ?? [];
|
|
356757
|
+
const exceeding = requestedScopes.filter((scope) => !ApiKeyService.scopeAllows(callerScopes, scope));
|
|
356758
|
+
if (exceeding.length === 0)
|
|
356759
|
+
return null;
|
|
356760
|
+
return c.json({
|
|
356761
|
+
error: {
|
|
356762
|
+
code: "FORBIDDEN",
|
|
356763
|
+
message: `Cannot mint a key whose scopes exceed the caller's own. Disallowed: ${exceeding.join(", ")}`
|
|
356764
|
+
}
|
|
356765
|
+
}, 403);
|
|
356766
|
+
}
|
|
356633
356767
|
async function handleProfileCreate(c, data, services) {
|
|
356634
356768
|
try {
|
|
356635
356769
|
const resolved = resolveProfile({
|
|
@@ -356641,6 +356775,9 @@ async function handleProfileCreate(c, data, services) {
|
|
|
356641
356775
|
overrides: normalizeOverrides(data.overrides),
|
|
356642
356776
|
denylistPresetKey: data.denylistPresetKey
|
|
356643
356777
|
});
|
|
356778
|
+
const ceilingDenied = enforceMintCeiling(c, resolved.scopes);
|
|
356779
|
+
if (ceilingDenied)
|
|
356780
|
+
return ceilingDenied;
|
|
356644
356781
|
const result = await services.apiKeys.create({
|
|
356645
356782
|
name: data.name,
|
|
356646
356783
|
description: data.description,
|
|
@@ -356673,6 +356810,9 @@ async function handleLegacyCreate(c, data, services) {
|
|
|
356673
356810
|
if (!data.scopes || data.scopes.length === 0) {
|
|
356674
356811
|
return c.json({ error: { code: "VALIDATION_ERROR", message: "scopes is required when no profile is supplied" } }, 400);
|
|
356675
356812
|
}
|
|
356813
|
+
const ceilingDenied = enforceMintCeiling(c, data.scopes);
|
|
356814
|
+
if (ceilingDenied)
|
|
356815
|
+
return ceilingDenied;
|
|
356676
356816
|
const result = await services.apiKeys.create({
|
|
356677
356817
|
name: data.name,
|
|
356678
356818
|
description: data.description,
|
|
@@ -356691,8 +356831,17 @@ var init_keys = __esm(() => {
|
|
|
356691
356831
|
init_zod();
|
|
356692
356832
|
init_resolve_profile();
|
|
356693
356833
|
init_date_query();
|
|
356834
|
+
init_api_keys();
|
|
356694
356835
|
keysRoutes = new Hono2;
|
|
356695
|
-
NON_ADMIN_PROFILES = [
|
|
356836
|
+
NON_ADMIN_PROFILES = [
|
|
356837
|
+
"cs",
|
|
356838
|
+
"personal",
|
|
356839
|
+
"scout",
|
|
356840
|
+
"coworker",
|
|
356841
|
+
"console-viewer",
|
|
356842
|
+
"console-operator",
|
|
356843
|
+
"console-admin"
|
|
356844
|
+
];
|
|
356696
356845
|
profileOverridesSchema = exports_external.object({
|
|
356697
356846
|
add: exports_external.array(exports_external.string()).optional(),
|
|
356698
356847
|
remove: exports_external.array(exports_external.string()).optional(),
|
|
@@ -356706,7 +356855,7 @@ var init_keys = __esm(() => {
|
|
|
356706
356855
|
instanceIds: exports_external.array(exports_external.string().uuid()).optional().describe("Restrict key to specific instance IDs"),
|
|
356707
356856
|
rateLimit: exports_external.number().int().positive().optional().describe("Rate limit in requests per minute"),
|
|
356708
356857
|
expiresAt: exports_external.string().datetime().optional().describe("Expiration timestamp (ISO 8601)"),
|
|
356709
|
-
profile: exports_external.enum(NON_ADMIN_PROFILES).optional().describe("Profile template: cs, personal, scout, coworker. admin is CLI-only and rejected here."),
|
|
356858
|
+
profile: exports_external.enum(NON_ADMIN_PROFILES).optional().describe("Profile template: cs, personal, scout, coworker, console-viewer, console-operator, console-admin. " + "admin is CLI-only and rejected here."),
|
|
356710
356859
|
overrides: profileOverridesSchema.optional().describe("Tenant overrides merged on top of the profile template"),
|
|
356711
356860
|
chatAllowlist: exports_external.array(exports_external.string()).optional().describe("Chats this key may target (profile-aware semantics)"),
|
|
356712
356861
|
instanceAllowlist: exports_external.array(exports_external.string().uuid()).optional().describe("Instances this key may target"),
|
|
@@ -356739,7 +356888,7 @@ var init_keys = __esm(() => {
|
|
|
356739
356888
|
cursor: exports_external.string().optional().describe("Pagination cursor")
|
|
356740
356889
|
});
|
|
356741
356890
|
keysRoutes.post("/", async (c, next) => {
|
|
356742
|
-
const raw2 = await c.req.
|
|
356891
|
+
const raw2 = await c.req.json().catch(() => null);
|
|
356743
356892
|
if (raw2 && typeof raw2 === "object" && raw2.profile === "admin") {
|
|
356744
356893
|
return c.json({
|
|
356745
356894
|
error: {
|