offrouter-core 0.5.1 → 0.6.0
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/audit.d.ts +51 -2
- package/dist/audit.d.ts.map +1 -1
- package/dist/audit.js +60 -3
- package/dist/audit.js.map +1 -1
- package/dist/config.d.ts +26 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +160 -1
- package/dist/config.js.map +1 -1
- package/dist/delegation.d.ts +40 -0
- package/dist/delegation.d.ts.map +1 -1
- package/dist/delegation.js +169 -8
- package/dist/delegation.js.map +1 -1
- package/dist/index.d.ts +27 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -7
- package/dist/index.js.map +1 -1
- package/dist/llm-judge.d.ts +41 -0
- package/dist/llm-judge.d.ts.map +1 -0
- package/dist/llm-judge.js +159 -0
- package/dist/llm-judge.js.map +1 -0
- package/dist/policy.d.ts +77 -0
- package/dist/policy.d.ts.map +1 -1
- package/dist/policy.js +81 -0
- package/dist/policy.js.map +1 -1
- package/dist/provider-health.d.ts +129 -0
- package/dist/provider-health.d.ts.map +1 -0
- package/dist/provider-health.js +423 -0
- package/dist/provider-health.js.map +1 -0
- package/dist/providers/catalog-data.d.ts +7 -0
- package/dist/providers/catalog-data.d.ts.map +1 -1
- package/dist/providers/catalog-data.js +140 -53
- package/dist/providers/catalog-data.js.map +1 -1
- package/dist/providers/catalog.d.ts +3 -3
- package/dist/providers/catalog.d.ts.map +1 -1
- package/dist/providers/catalog.js +1 -0
- package/dist/providers/catalog.js.map +1 -1
- package/dist/proxy/anthropic-mapper.d.ts +585 -0
- package/dist/proxy/anthropic-mapper.d.ts.map +1 -0
- package/dist/proxy/anthropic-mapper.js +539 -0
- package/dist/proxy/anthropic-mapper.js.map +1 -0
- package/dist/proxy/anthropic-server.d.ts +24 -0
- package/dist/proxy/anthropic-server.d.ts.map +1 -0
- package/dist/proxy/anthropic-server.js +606 -0
- package/dist/proxy/anthropic-server.js.map +1 -0
- package/dist/proxy/classify.d.ts +17 -0
- package/dist/proxy/classify.d.ts.map +1 -0
- package/dist/proxy/classify.js +65 -0
- package/dist/proxy/classify.js.map +1 -0
- package/dist/proxy/responses-mapper.d.ts +15 -0
- package/dist/proxy/responses-mapper.d.ts.map +1 -1
- package/dist/proxy/responses-mapper.js +9 -2
- package/dist/proxy/responses-mapper.js.map +1 -1
- package/dist/proxy/responses-server.d.ts.map +1 -1
- package/dist/proxy/responses-server.js +14 -1
- package/dist/proxy/responses-server.js.map +1 -1
- package/dist/router.d.ts +36 -2
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +158 -23
- package/dist/router.js.map +1 -1
- package/dist/schemas.d.ts +115 -34
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +35 -0
- package/dist/schemas.js.map +1 -1
- package/dist/secret-scan.d.ts +40 -0
- package/dist/secret-scan.d.ts.map +1 -0
- package/dist/secret-scan.js +125 -0
- package/dist/secret-scan.js.map +1 -0
- package/dist/secrets.d.ts +77 -6
- package/dist/secrets.d.ts.map +1 -1
- package/dist/secrets.js +356 -32
- package/dist/secrets.js.map +1 -1
- package/dist/spend.d.ts +122 -0
- package/dist/spend.d.ts.map +1 -0
- package/dist/spend.js +279 -0
- package/dist/spend.js.map +1 -0
- package/dist/task-classifier.d.ts +45 -0
- package/dist/task-classifier.d.ts.map +1 -0
- package/dist/task-classifier.js +153 -0
- package/dist/task-classifier.js.map +1 -0
- package/dist/types.d.ts +46 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/usage-file.d.ts +2 -6
- package/dist/usage-file.d.ts.map +1 -1
- package/dist/usage-file.js +64 -6
- package/dist/usage-file.js.map +1 -1
- package/dist/usage.d.ts +64 -10
- package/dist/usage.d.ts.map +1 -1
- package/dist/usage.js +79 -5
- package/dist/usage.js.map +1 -1
- package/package.json +1 -1
package/dist/schemas.d.ts
CHANGED
|
@@ -11,24 +11,25 @@ export declare const FallbackReasonSchema: z.ZodEnum<["primary", "subscription_e
|
|
|
11
11
|
export declare const HarnessKindSchema: z.ZodEnum<["claude", "codex", "gemini", "grok", "cursor", "pi", "other"]>;
|
|
12
12
|
export declare const TaskKindSchema: z.ZodEnum<["explain", "code", "review", "plan", "research", "image", "tools", "other"]>;
|
|
13
13
|
export declare const RiskLevelSchema: z.ZodEnum<["low", "medium", "high"]>;
|
|
14
|
-
export declare const PolicyDenialCodeSchema: z.ZodEnum<["profile_not_allowlisted", "work_profile_denied", "provider_denied", "project_untrusted", "privacy_label_denied", "local_only_required", "cost_cap_exceeded", "api_key_blocked_by_subscription_first_policy", "subscription_scope_denied", "capability_missing"]>;
|
|
14
|
+
export declare const PolicyDenialCodeSchema: z.ZodEnum<["profile_not_allowlisted", "work_profile_denied", "provider_denied", "project_untrusted", "privacy_label_denied", "local_only_required", "cost_cap_exceeded", "spend_cap_exceeded", "api_key_blocked_by_subscription_first_policy", "subscription_scope_denied", "capability_missing", "model_not_allowed", "api_spend_approval_required", "subscription_switch_requires_ack"]>;
|
|
15
15
|
export declare const PolicyDenialTargetSchema: z.ZodEnum<["profile", "provider", "model", "workspace", "candidate"]>;
|
|
16
16
|
export declare const PolicyDenialSchema: z.ZodObject<{
|
|
17
|
-
code: z.ZodEnum<["profile_not_allowlisted", "work_profile_denied", "provider_denied", "project_untrusted", "privacy_label_denied", "local_only_required", "cost_cap_exceeded", "api_key_blocked_by_subscription_first_policy", "subscription_scope_denied", "capability_missing"]>;
|
|
17
|
+
code: z.ZodEnum<["profile_not_allowlisted", "work_profile_denied", "provider_denied", "project_untrusted", "privacy_label_denied", "local_only_required", "cost_cap_exceeded", "spend_cap_exceeded", "api_key_blocked_by_subscription_first_policy", "subscription_scope_denied", "capability_missing", "model_not_allowed", "api_spend_approval_required", "subscription_switch_requires_ack"]>;
|
|
18
18
|
target: z.ZodEnum<["profile", "provider", "model", "workspace", "candidate"]>;
|
|
19
19
|
id: z.ZodString;
|
|
20
20
|
message: z.ZodString;
|
|
21
21
|
}, "strict", z.ZodTypeAny, {
|
|
22
|
-
code: "subscription_scope_denied" | "profile_not_allowlisted" | "work_profile_denied" | "provider_denied" | "project_untrusted" | "privacy_label_denied" | "local_only_required" | "cost_cap_exceeded" | "api_key_blocked_by_subscription_first_policy" | "capability_missing";
|
|
22
|
+
code: "subscription_scope_denied" | "profile_not_allowlisted" | "work_profile_denied" | "provider_denied" | "project_untrusted" | "privacy_label_denied" | "local_only_required" | "cost_cap_exceeded" | "spend_cap_exceeded" | "api_key_blocked_by_subscription_first_policy" | "capability_missing" | "model_not_allowed" | "api_spend_approval_required" | "subscription_switch_requires_ack";
|
|
23
23
|
target: "profile" | "provider" | "model" | "workspace" | "candidate";
|
|
24
24
|
id: string;
|
|
25
25
|
message: string;
|
|
26
26
|
}, {
|
|
27
|
-
code: "subscription_scope_denied" | "profile_not_allowlisted" | "work_profile_denied" | "provider_denied" | "project_untrusted" | "privacy_label_denied" | "local_only_required" | "cost_cap_exceeded" | "api_key_blocked_by_subscription_first_policy" | "capability_missing";
|
|
27
|
+
code: "subscription_scope_denied" | "profile_not_allowlisted" | "work_profile_denied" | "provider_denied" | "project_untrusted" | "privacy_label_denied" | "local_only_required" | "cost_cap_exceeded" | "spend_cap_exceeded" | "api_key_blocked_by_subscription_first_policy" | "capability_missing" | "model_not_allowed" | "api_spend_approval_required" | "subscription_switch_requires_ack";
|
|
28
28
|
target: "profile" | "provider" | "model" | "workspace" | "candidate";
|
|
29
29
|
id: string;
|
|
30
30
|
message: string;
|
|
31
31
|
}>;
|
|
32
|
+
export declare const LogicalModelFamilySchema: z.ZodEnum<["frontier-coder", "fast-coder", "local-coder", "vision-helper"]>;
|
|
32
33
|
export declare const ProviderCandidateSchema: z.ZodObject<{
|
|
33
34
|
providerId: z.ZodString;
|
|
34
35
|
modelId: z.ZodString;
|
|
@@ -46,16 +47,18 @@ export declare const ProviderCandidateSchema: z.ZodObject<{
|
|
|
46
47
|
contextWindowTokens: z.ZodOptional<z.ZodNumber>;
|
|
47
48
|
maxOutputTokens: z.ZodOptional<z.ZodNumber>;
|
|
48
49
|
estimatedCostUsd: z.ZodOptional<z.ZodNumber>;
|
|
50
|
+
family: z.ZodOptional<z.ZodEnum<["frontier-coder", "fast-coder", "local-coder", "vision-helper"]>>;
|
|
49
51
|
}, "strict", z.ZodTypeAny, {
|
|
50
|
-
authTier: "subscription" | "local" | "api-key";
|
|
51
|
-
authScope: "first-party" | "third-party" | "unknown";
|
|
52
52
|
providerId: string;
|
|
53
53
|
modelId: string;
|
|
54
|
+
authTier: "subscription" | "local" | "api-key";
|
|
55
|
+
authScope: "first-party" | "third-party" | "unknown";
|
|
54
56
|
health: "healthy" | "degraded" | "dead";
|
|
55
57
|
supportsTools: boolean;
|
|
56
58
|
supportsStreaming: boolean;
|
|
57
59
|
supportsJson: boolean;
|
|
58
60
|
supportsImages: boolean;
|
|
61
|
+
family?: "frontier-coder" | "fast-coder" | "local-coder" | "vision-helper" | undefined;
|
|
59
62
|
displayName?: string | undefined;
|
|
60
63
|
subscriptionStatus?: "unknown" | "active" | "near-limit" | "exhausted" | "rate-limited" | "expired" | "unconfigured" | undefined;
|
|
61
64
|
accountId?: string | undefined;
|
|
@@ -64,15 +67,16 @@ export declare const ProviderCandidateSchema: z.ZodObject<{
|
|
|
64
67
|
maxOutputTokens?: number | undefined;
|
|
65
68
|
estimatedCostUsd?: number | undefined;
|
|
66
69
|
}, {
|
|
67
|
-
authTier: "subscription" | "local" | "api-key";
|
|
68
|
-
authScope: "first-party" | "third-party" | "unknown";
|
|
69
70
|
providerId: string;
|
|
70
71
|
modelId: string;
|
|
72
|
+
authTier: "subscription" | "local" | "api-key";
|
|
73
|
+
authScope: "first-party" | "third-party" | "unknown";
|
|
71
74
|
health: "healthy" | "degraded" | "dead";
|
|
72
75
|
supportsTools: boolean;
|
|
73
76
|
supportsStreaming: boolean;
|
|
74
77
|
supportsJson: boolean;
|
|
75
78
|
supportsImages: boolean;
|
|
79
|
+
family?: "frontier-coder" | "fast-coder" | "local-coder" | "vision-helper" | undefined;
|
|
76
80
|
displayName?: string | undefined;
|
|
77
81
|
subscriptionStatus?: "unknown" | "active" | "near-limit" | "exhausted" | "rate-limited" | "expired" | "unconfigured" | undefined;
|
|
78
82
|
accountId?: string | undefined;
|
|
@@ -81,6 +85,21 @@ export declare const ProviderCandidateSchema: z.ZodObject<{
|
|
|
81
85
|
maxOutputTokens?: number | undefined;
|
|
82
86
|
estimatedCostUsd?: number | undefined;
|
|
83
87
|
}>;
|
|
88
|
+
/** Classifier signal block on RouteDecision — never contains prompt text. */
|
|
89
|
+
export declare const RouteClassificationSchema: z.ZodObject<{
|
|
90
|
+
recommendedFamily: z.ZodEnum<["fast-coder", "frontier-coder"]>;
|
|
91
|
+
confidence: z.ZodEnum<["low", "medium", "high"]>;
|
|
92
|
+
signals: z.ZodArray<z.ZodString, "many">;
|
|
93
|
+
}, "strict", z.ZodTypeAny, {
|
|
94
|
+
recommendedFamily: "frontier-coder" | "fast-coder";
|
|
95
|
+
confidence: "low" | "medium" | "high";
|
|
96
|
+
signals: string[];
|
|
97
|
+
}, {
|
|
98
|
+
recommendedFamily: "frontier-coder" | "fast-coder";
|
|
99
|
+
confidence: "low" | "medium" | "high";
|
|
100
|
+
signals: string[];
|
|
101
|
+
}>;
|
|
102
|
+
export declare const ClassifierNameSchema: z.ZodEnum<["heuristic", "llm", "llm-fallback-heuristic"]>;
|
|
84
103
|
export declare const HarnessRefSchema: z.ZodObject<{
|
|
85
104
|
kind: z.ZodEnum<["claude", "codex", "gemini", "grok", "cursor", "pi", "other"]>;
|
|
86
105
|
profile: z.ZodString;
|
|
@@ -303,16 +322,19 @@ export declare const FallbackChainEntrySchema: z.ZodObject<{
|
|
|
303
322
|
model: z.ZodString;
|
|
304
323
|
authTier: z.ZodEnum<["subscription", "local", "api-key"]>;
|
|
305
324
|
reason: z.ZodEnum<["primary", "subscription_exhausted", "subscription_degraded", "subscription_unconfigured", "subscription_scope_denied", "local_preferred", "api_key_fallback", "policy_denied", "provider_error"]>;
|
|
325
|
+
healthScore: z.ZodOptional<z.ZodNumber>;
|
|
306
326
|
}, "strict", z.ZodTypeAny, {
|
|
307
327
|
provider: string;
|
|
308
328
|
model: string;
|
|
309
329
|
authTier: "subscription" | "local" | "api-key";
|
|
310
330
|
reason: "primary" | "subscription_exhausted" | "subscription_degraded" | "subscription_unconfigured" | "subscription_scope_denied" | "local_preferred" | "api_key_fallback" | "policy_denied" | "provider_error";
|
|
331
|
+
healthScore?: number | undefined;
|
|
311
332
|
}, {
|
|
312
333
|
provider: string;
|
|
313
334
|
model: string;
|
|
314
335
|
authTier: "subscription" | "local" | "api-key";
|
|
315
336
|
reason: "primary" | "subscription_exhausted" | "subscription_degraded" | "subscription_unconfigured" | "subscription_scope_denied" | "local_preferred" | "api_key_fallback" | "policy_denied" | "provider_error";
|
|
337
|
+
healthScore?: number | undefined;
|
|
316
338
|
}>;
|
|
317
339
|
export declare const RouteDecisionSchema: z.ZodObject<{
|
|
318
340
|
protocolVersion: z.ZodLiteral<"offrouter.route.v1">;
|
|
@@ -344,29 +366,32 @@ export declare const RouteDecisionSchema: z.ZodObject<{
|
|
|
344
366
|
model: z.ZodString;
|
|
345
367
|
authTier: z.ZodEnum<["subscription", "local", "api-key"]>;
|
|
346
368
|
reason: z.ZodEnum<["primary", "subscription_exhausted", "subscription_degraded", "subscription_unconfigured", "subscription_scope_denied", "local_preferred", "api_key_fallback", "policy_denied", "provider_error"]>;
|
|
369
|
+
healthScore: z.ZodOptional<z.ZodNumber>;
|
|
347
370
|
}, "strict", z.ZodTypeAny, {
|
|
348
371
|
provider: string;
|
|
349
372
|
model: string;
|
|
350
373
|
authTier: "subscription" | "local" | "api-key";
|
|
351
374
|
reason: "primary" | "subscription_exhausted" | "subscription_degraded" | "subscription_unconfigured" | "subscription_scope_denied" | "local_preferred" | "api_key_fallback" | "policy_denied" | "provider_error";
|
|
375
|
+
healthScore?: number | undefined;
|
|
352
376
|
}, {
|
|
353
377
|
provider: string;
|
|
354
378
|
model: string;
|
|
355
379
|
authTier: "subscription" | "local" | "api-key";
|
|
356
380
|
reason: "primary" | "subscription_exhausted" | "subscription_degraded" | "subscription_unconfigured" | "subscription_scope_denied" | "local_preferred" | "api_key_fallback" | "policy_denied" | "provider_error";
|
|
381
|
+
healthScore?: number | undefined;
|
|
357
382
|
}>, "many">>;
|
|
358
383
|
policyDenials: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
359
|
-
code: z.ZodEnum<["profile_not_allowlisted", "work_profile_denied", "provider_denied", "project_untrusted", "privacy_label_denied", "local_only_required", "cost_cap_exceeded", "api_key_blocked_by_subscription_first_policy", "subscription_scope_denied", "capability_missing"]>;
|
|
384
|
+
code: z.ZodEnum<["profile_not_allowlisted", "work_profile_denied", "provider_denied", "project_untrusted", "privacy_label_denied", "local_only_required", "cost_cap_exceeded", "spend_cap_exceeded", "api_key_blocked_by_subscription_first_policy", "subscription_scope_denied", "capability_missing", "model_not_allowed", "api_spend_approval_required", "subscription_switch_requires_ack"]>;
|
|
360
385
|
target: z.ZodEnum<["profile", "provider", "model", "workspace", "candidate"]>;
|
|
361
386
|
id: z.ZodString;
|
|
362
387
|
message: z.ZodString;
|
|
363
388
|
}, "strict", z.ZodTypeAny, {
|
|
364
|
-
code: "subscription_scope_denied" | "profile_not_allowlisted" | "work_profile_denied" | "provider_denied" | "project_untrusted" | "privacy_label_denied" | "local_only_required" | "cost_cap_exceeded" | "api_key_blocked_by_subscription_first_policy" | "capability_missing";
|
|
389
|
+
code: "subscription_scope_denied" | "profile_not_allowlisted" | "work_profile_denied" | "provider_denied" | "project_untrusted" | "privacy_label_denied" | "local_only_required" | "cost_cap_exceeded" | "spend_cap_exceeded" | "api_key_blocked_by_subscription_first_policy" | "capability_missing" | "model_not_allowed" | "api_spend_approval_required" | "subscription_switch_requires_ack";
|
|
365
390
|
target: "profile" | "provider" | "model" | "workspace" | "candidate";
|
|
366
391
|
id: string;
|
|
367
392
|
message: string;
|
|
368
393
|
}, {
|
|
369
|
-
code: "subscription_scope_denied" | "profile_not_allowlisted" | "work_profile_denied" | "provider_denied" | "project_untrusted" | "privacy_label_denied" | "local_only_required" | "cost_cap_exceeded" | "api_key_blocked_by_subscription_first_policy" | "capability_missing";
|
|
394
|
+
code: "subscription_scope_denied" | "profile_not_allowlisted" | "work_profile_denied" | "provider_denied" | "project_untrusted" | "privacy_label_denied" | "local_only_required" | "cost_cap_exceeded" | "spend_cap_exceeded" | "api_key_blocked_by_subscription_first_policy" | "capability_missing" | "model_not_allowed" | "api_spend_approval_required" | "subscription_switch_requires_ack";
|
|
370
395
|
target: "profile" | "provider" | "model" | "workspace" | "candidate";
|
|
371
396
|
id: string;
|
|
372
397
|
message: string;
|
|
@@ -376,12 +401,46 @@ export declare const RouteDecisionSchema: z.ZodObject<{
|
|
|
376
401
|
blocked: z.ZodOptional<z.ZodBoolean>;
|
|
377
402
|
needsConfiguration: z.ZodOptional<z.ZodBoolean>;
|
|
378
403
|
nearLimitWarning: z.ZodOptional<z.ZodString>;
|
|
404
|
+
classification: z.ZodOptional<z.ZodObject<{
|
|
405
|
+
recommendedFamily: z.ZodEnum<["fast-coder", "frontier-coder"]>;
|
|
406
|
+
confidence: z.ZodEnum<["low", "medium", "high"]>;
|
|
407
|
+
signals: z.ZodArray<z.ZodString, "many">;
|
|
408
|
+
}, "strict", z.ZodTypeAny, {
|
|
409
|
+
recommendedFamily: "frontier-coder" | "fast-coder";
|
|
410
|
+
confidence: "low" | "medium" | "high";
|
|
411
|
+
signals: string[];
|
|
412
|
+
}, {
|
|
413
|
+
recommendedFamily: "frontier-coder" | "fast-coder";
|
|
414
|
+
confidence: "low" | "medium" | "high";
|
|
415
|
+
signals: string[];
|
|
416
|
+
}>>;
|
|
417
|
+
classifierName: z.ZodOptional<z.ZodEnum<["heuristic", "llm", "llm-fallback-heuristic"]>>;
|
|
418
|
+
routingRule: z.ZodOptional<z.ZodObject<{
|
|
419
|
+
index: z.ZodNumber;
|
|
420
|
+
matchedKeys: z.ZodArray<z.ZodEnum<["role", "family"]>, "many">;
|
|
421
|
+
target: z.ZodEnum<["model", "provider", "tier"]>;
|
|
422
|
+
}, "strict", z.ZodTypeAny, {
|
|
423
|
+
target: "provider" | "model" | "tier";
|
|
424
|
+
index: number;
|
|
425
|
+
matchedKeys: ("role" | "family")[];
|
|
426
|
+
}, {
|
|
427
|
+
target: "provider" | "model" | "tier";
|
|
428
|
+
index: number;
|
|
429
|
+
matchedKeys: ("role" | "family")[];
|
|
430
|
+
}>>;
|
|
379
431
|
}, "strict", z.ZodTypeAny, {
|
|
380
|
-
reason: string;
|
|
381
|
-
explanation: string;
|
|
382
432
|
protocolVersion: "offrouter.route.v1";
|
|
383
|
-
requestId: string;
|
|
384
433
|
decisionId: string;
|
|
434
|
+
requestId: string;
|
|
435
|
+
reason: string;
|
|
436
|
+
explanation: string;
|
|
437
|
+
confidence?: number | undefined;
|
|
438
|
+
classification?: {
|
|
439
|
+
recommendedFamily: "frontier-coder" | "fast-coder";
|
|
440
|
+
confidence: "low" | "medium" | "high";
|
|
441
|
+
signals: string[];
|
|
442
|
+
} | undefined;
|
|
443
|
+
classifierName?: "heuristic" | "llm" | "llm-fallback-heuristic" | undefined;
|
|
385
444
|
route?: {
|
|
386
445
|
provider: string;
|
|
387
446
|
model: string;
|
|
@@ -394,24 +453,36 @@ export declare const RouteDecisionSchema: z.ZodObject<{
|
|
|
394
453
|
model: string;
|
|
395
454
|
authTier: "subscription" | "local" | "api-key";
|
|
396
455
|
reason: "primary" | "subscription_exhausted" | "subscription_degraded" | "subscription_unconfigured" | "subscription_scope_denied" | "local_preferred" | "api_key_fallback" | "policy_denied" | "provider_error";
|
|
456
|
+
healthScore?: number | undefined;
|
|
397
457
|
}[] | undefined;
|
|
398
458
|
policyDenials?: {
|
|
399
|
-
code: "subscription_scope_denied" | "profile_not_allowlisted" | "work_profile_denied" | "provider_denied" | "project_untrusted" | "privacy_label_denied" | "local_only_required" | "cost_cap_exceeded" | "api_key_blocked_by_subscription_first_policy" | "capability_missing";
|
|
459
|
+
code: "subscription_scope_denied" | "profile_not_allowlisted" | "work_profile_denied" | "provider_denied" | "project_untrusted" | "privacy_label_denied" | "local_only_required" | "cost_cap_exceeded" | "spend_cap_exceeded" | "api_key_blocked_by_subscription_first_policy" | "capability_missing" | "model_not_allowed" | "api_spend_approval_required" | "subscription_switch_requires_ack";
|
|
400
460
|
target: "profile" | "provider" | "model" | "workspace" | "candidate";
|
|
401
461
|
id: string;
|
|
402
462
|
message: string;
|
|
403
463
|
}[] | undefined;
|
|
404
|
-
confidence?: number | undefined;
|
|
405
464
|
auditSummary?: string | undefined;
|
|
406
465
|
blocked?: boolean | undefined;
|
|
407
466
|
needsConfiguration?: boolean | undefined;
|
|
408
467
|
nearLimitWarning?: string | undefined;
|
|
468
|
+
routingRule?: {
|
|
469
|
+
target: "provider" | "model" | "tier";
|
|
470
|
+
index: number;
|
|
471
|
+
matchedKeys: ("role" | "family")[];
|
|
472
|
+
} | undefined;
|
|
409
473
|
}, {
|
|
410
|
-
reason: string;
|
|
411
|
-
explanation: string;
|
|
412
474
|
protocolVersion: "offrouter.route.v1";
|
|
413
|
-
requestId: string;
|
|
414
475
|
decisionId: string;
|
|
476
|
+
requestId: string;
|
|
477
|
+
reason: string;
|
|
478
|
+
explanation: string;
|
|
479
|
+
confidence?: number | undefined;
|
|
480
|
+
classification?: {
|
|
481
|
+
recommendedFamily: "frontier-coder" | "fast-coder";
|
|
482
|
+
confidence: "low" | "medium" | "high";
|
|
483
|
+
signals: string[];
|
|
484
|
+
} | undefined;
|
|
485
|
+
classifierName?: "heuristic" | "llm" | "llm-fallback-heuristic" | undefined;
|
|
415
486
|
route?: {
|
|
416
487
|
provider: string;
|
|
417
488
|
model: string;
|
|
@@ -424,18 +495,23 @@ export declare const RouteDecisionSchema: z.ZodObject<{
|
|
|
424
495
|
model: string;
|
|
425
496
|
authTier: "subscription" | "local" | "api-key";
|
|
426
497
|
reason: "primary" | "subscription_exhausted" | "subscription_degraded" | "subscription_unconfigured" | "subscription_scope_denied" | "local_preferred" | "api_key_fallback" | "policy_denied" | "provider_error";
|
|
498
|
+
healthScore?: number | undefined;
|
|
427
499
|
}[] | undefined;
|
|
428
500
|
policyDenials?: {
|
|
429
|
-
code: "subscription_scope_denied" | "profile_not_allowlisted" | "work_profile_denied" | "provider_denied" | "project_untrusted" | "privacy_label_denied" | "local_only_required" | "cost_cap_exceeded" | "api_key_blocked_by_subscription_first_policy" | "capability_missing";
|
|
501
|
+
code: "subscription_scope_denied" | "profile_not_allowlisted" | "work_profile_denied" | "provider_denied" | "project_untrusted" | "privacy_label_denied" | "local_only_required" | "cost_cap_exceeded" | "spend_cap_exceeded" | "api_key_blocked_by_subscription_first_policy" | "capability_missing" | "model_not_allowed" | "api_spend_approval_required" | "subscription_switch_requires_ack";
|
|
430
502
|
target: "profile" | "provider" | "model" | "workspace" | "candidate";
|
|
431
503
|
id: string;
|
|
432
504
|
message: string;
|
|
433
505
|
}[] | undefined;
|
|
434
|
-
confidence?: number | undefined;
|
|
435
506
|
auditSummary?: string | undefined;
|
|
436
507
|
blocked?: boolean | undefined;
|
|
437
508
|
needsConfiguration?: boolean | undefined;
|
|
438
509
|
nearLimitWarning?: string | undefined;
|
|
510
|
+
routingRule?: {
|
|
511
|
+
target: "provider" | "model" | "tier";
|
|
512
|
+
index: number;
|
|
513
|
+
matchedKeys: ("role" | "family")[];
|
|
514
|
+
} | undefined;
|
|
439
515
|
}>;
|
|
440
516
|
export declare const PolicyDecisionSchema: z.ZodObject<{
|
|
441
517
|
allowed: z.ZodArray<z.ZodObject<{
|
|
@@ -455,16 +531,18 @@ export declare const PolicyDecisionSchema: z.ZodObject<{
|
|
|
455
531
|
contextWindowTokens: z.ZodOptional<z.ZodNumber>;
|
|
456
532
|
maxOutputTokens: z.ZodOptional<z.ZodNumber>;
|
|
457
533
|
estimatedCostUsd: z.ZodOptional<z.ZodNumber>;
|
|
534
|
+
family: z.ZodOptional<z.ZodEnum<["frontier-coder", "fast-coder", "local-coder", "vision-helper"]>>;
|
|
458
535
|
}, "strict", z.ZodTypeAny, {
|
|
459
|
-
authTier: "subscription" | "local" | "api-key";
|
|
460
|
-
authScope: "first-party" | "third-party" | "unknown";
|
|
461
536
|
providerId: string;
|
|
462
537
|
modelId: string;
|
|
538
|
+
authTier: "subscription" | "local" | "api-key";
|
|
539
|
+
authScope: "first-party" | "third-party" | "unknown";
|
|
463
540
|
health: "healthy" | "degraded" | "dead";
|
|
464
541
|
supportsTools: boolean;
|
|
465
542
|
supportsStreaming: boolean;
|
|
466
543
|
supportsJson: boolean;
|
|
467
544
|
supportsImages: boolean;
|
|
545
|
+
family?: "frontier-coder" | "fast-coder" | "local-coder" | "vision-helper" | undefined;
|
|
468
546
|
displayName?: string | undefined;
|
|
469
547
|
subscriptionStatus?: "unknown" | "active" | "near-limit" | "exhausted" | "rate-limited" | "expired" | "unconfigured" | undefined;
|
|
470
548
|
accountId?: string | undefined;
|
|
@@ -473,15 +551,16 @@ export declare const PolicyDecisionSchema: z.ZodObject<{
|
|
|
473
551
|
maxOutputTokens?: number | undefined;
|
|
474
552
|
estimatedCostUsd?: number | undefined;
|
|
475
553
|
}, {
|
|
476
|
-
authTier: "subscription" | "local" | "api-key";
|
|
477
|
-
authScope: "first-party" | "third-party" | "unknown";
|
|
478
554
|
providerId: string;
|
|
479
555
|
modelId: string;
|
|
556
|
+
authTier: "subscription" | "local" | "api-key";
|
|
557
|
+
authScope: "first-party" | "third-party" | "unknown";
|
|
480
558
|
health: "healthy" | "degraded" | "dead";
|
|
481
559
|
supportsTools: boolean;
|
|
482
560
|
supportsStreaming: boolean;
|
|
483
561
|
supportsJson: boolean;
|
|
484
562
|
supportsImages: boolean;
|
|
563
|
+
family?: "frontier-coder" | "fast-coder" | "local-coder" | "vision-helper" | undefined;
|
|
485
564
|
displayName?: string | undefined;
|
|
486
565
|
subscriptionStatus?: "unknown" | "active" | "near-limit" | "exhausted" | "rate-limited" | "expired" | "unconfigured" | undefined;
|
|
487
566
|
accountId?: string | undefined;
|
|
@@ -491,32 +570,33 @@ export declare const PolicyDecisionSchema: z.ZodObject<{
|
|
|
491
570
|
estimatedCostUsd?: number | undefined;
|
|
492
571
|
}>, "many">;
|
|
493
572
|
denials: z.ZodArray<z.ZodObject<{
|
|
494
|
-
code: z.ZodEnum<["profile_not_allowlisted", "work_profile_denied", "provider_denied", "project_untrusted", "privacy_label_denied", "local_only_required", "cost_cap_exceeded", "api_key_blocked_by_subscription_first_policy", "subscription_scope_denied", "capability_missing"]>;
|
|
573
|
+
code: z.ZodEnum<["profile_not_allowlisted", "work_profile_denied", "provider_denied", "project_untrusted", "privacy_label_denied", "local_only_required", "cost_cap_exceeded", "spend_cap_exceeded", "api_key_blocked_by_subscription_first_policy", "subscription_scope_denied", "capability_missing", "model_not_allowed", "api_spend_approval_required", "subscription_switch_requires_ack"]>;
|
|
495
574
|
target: z.ZodEnum<["profile", "provider", "model", "workspace", "candidate"]>;
|
|
496
575
|
id: z.ZodString;
|
|
497
576
|
message: z.ZodString;
|
|
498
577
|
}, "strict", z.ZodTypeAny, {
|
|
499
|
-
code: "subscription_scope_denied" | "profile_not_allowlisted" | "work_profile_denied" | "provider_denied" | "project_untrusted" | "privacy_label_denied" | "local_only_required" | "cost_cap_exceeded" | "api_key_blocked_by_subscription_first_policy" | "capability_missing";
|
|
578
|
+
code: "subscription_scope_denied" | "profile_not_allowlisted" | "work_profile_denied" | "provider_denied" | "project_untrusted" | "privacy_label_denied" | "local_only_required" | "cost_cap_exceeded" | "spend_cap_exceeded" | "api_key_blocked_by_subscription_first_policy" | "capability_missing" | "model_not_allowed" | "api_spend_approval_required" | "subscription_switch_requires_ack";
|
|
500
579
|
target: "profile" | "provider" | "model" | "workspace" | "candidate";
|
|
501
580
|
id: string;
|
|
502
581
|
message: string;
|
|
503
582
|
}, {
|
|
504
|
-
code: "subscription_scope_denied" | "profile_not_allowlisted" | "work_profile_denied" | "provider_denied" | "project_untrusted" | "privacy_label_denied" | "local_only_required" | "cost_cap_exceeded" | "api_key_blocked_by_subscription_first_policy" | "capability_missing";
|
|
583
|
+
code: "subscription_scope_denied" | "profile_not_allowlisted" | "work_profile_denied" | "provider_denied" | "project_untrusted" | "privacy_label_denied" | "local_only_required" | "cost_cap_exceeded" | "spend_cap_exceeded" | "api_key_blocked_by_subscription_first_policy" | "capability_missing" | "model_not_allowed" | "api_spend_approval_required" | "subscription_switch_requires_ack";
|
|
505
584
|
target: "profile" | "provider" | "model" | "workspace" | "candidate";
|
|
506
585
|
id: string;
|
|
507
586
|
message: string;
|
|
508
587
|
}>, "many">;
|
|
509
588
|
}, "strict", z.ZodTypeAny, {
|
|
510
589
|
allowed: {
|
|
511
|
-
authTier: "subscription" | "local" | "api-key";
|
|
512
|
-
authScope: "first-party" | "third-party" | "unknown";
|
|
513
590
|
providerId: string;
|
|
514
591
|
modelId: string;
|
|
592
|
+
authTier: "subscription" | "local" | "api-key";
|
|
593
|
+
authScope: "first-party" | "third-party" | "unknown";
|
|
515
594
|
health: "healthy" | "degraded" | "dead";
|
|
516
595
|
supportsTools: boolean;
|
|
517
596
|
supportsStreaming: boolean;
|
|
518
597
|
supportsJson: boolean;
|
|
519
598
|
supportsImages: boolean;
|
|
599
|
+
family?: "frontier-coder" | "fast-coder" | "local-coder" | "vision-helper" | undefined;
|
|
520
600
|
displayName?: string | undefined;
|
|
521
601
|
subscriptionStatus?: "unknown" | "active" | "near-limit" | "exhausted" | "rate-limited" | "expired" | "unconfigured" | undefined;
|
|
522
602
|
accountId?: string | undefined;
|
|
@@ -526,22 +606,23 @@ export declare const PolicyDecisionSchema: z.ZodObject<{
|
|
|
526
606
|
estimatedCostUsd?: number | undefined;
|
|
527
607
|
}[];
|
|
528
608
|
denials: {
|
|
529
|
-
code: "subscription_scope_denied" | "profile_not_allowlisted" | "work_profile_denied" | "provider_denied" | "project_untrusted" | "privacy_label_denied" | "local_only_required" | "cost_cap_exceeded" | "api_key_blocked_by_subscription_first_policy" | "capability_missing";
|
|
609
|
+
code: "subscription_scope_denied" | "profile_not_allowlisted" | "work_profile_denied" | "provider_denied" | "project_untrusted" | "privacy_label_denied" | "local_only_required" | "cost_cap_exceeded" | "spend_cap_exceeded" | "api_key_blocked_by_subscription_first_policy" | "capability_missing" | "model_not_allowed" | "api_spend_approval_required" | "subscription_switch_requires_ack";
|
|
530
610
|
target: "profile" | "provider" | "model" | "workspace" | "candidate";
|
|
531
611
|
id: string;
|
|
532
612
|
message: string;
|
|
533
613
|
}[];
|
|
534
614
|
}, {
|
|
535
615
|
allowed: {
|
|
536
|
-
authTier: "subscription" | "local" | "api-key";
|
|
537
|
-
authScope: "first-party" | "third-party" | "unknown";
|
|
538
616
|
providerId: string;
|
|
539
617
|
modelId: string;
|
|
618
|
+
authTier: "subscription" | "local" | "api-key";
|
|
619
|
+
authScope: "first-party" | "third-party" | "unknown";
|
|
540
620
|
health: "healthy" | "degraded" | "dead";
|
|
541
621
|
supportsTools: boolean;
|
|
542
622
|
supportsStreaming: boolean;
|
|
543
623
|
supportsJson: boolean;
|
|
544
624
|
supportsImages: boolean;
|
|
625
|
+
family?: "frontier-coder" | "fast-coder" | "local-coder" | "vision-helper" | undefined;
|
|
545
626
|
displayName?: string | undefined;
|
|
546
627
|
subscriptionStatus?: "unknown" | "active" | "near-limit" | "exhausted" | "rate-limited" | "expired" | "unconfigured" | undefined;
|
|
547
628
|
accountId?: string | undefined;
|
|
@@ -551,7 +632,7 @@ export declare const PolicyDecisionSchema: z.ZodObject<{
|
|
|
551
632
|
estimatedCostUsd?: number | undefined;
|
|
552
633
|
}[];
|
|
553
634
|
denials: {
|
|
554
|
-
code: "subscription_scope_denied" | "profile_not_allowlisted" | "work_profile_denied" | "provider_denied" | "project_untrusted" | "privacy_label_denied" | "local_only_required" | "cost_cap_exceeded" | "api_key_blocked_by_subscription_first_policy" | "capability_missing";
|
|
635
|
+
code: "subscription_scope_denied" | "profile_not_allowlisted" | "work_profile_denied" | "provider_denied" | "project_untrusted" | "privacy_label_denied" | "local_only_required" | "cost_cap_exceeded" | "spend_cap_exceeded" | "api_key_blocked_by_subscription_first_policy" | "capability_missing" | "model_not_allowed" | "api_spend_approval_required" | "subscription_switch_requires_ack";
|
|
555
636
|
target: "profile" | "provider" | "model" | "workspace" | "candidate";
|
|
556
637
|
id: string;
|
|
557
638
|
message: string;
|
package/dist/schemas.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,cAAc,iDAA+C,CAAC;AAE3E,eAAO,MAAM,eAAe,sDAI1B,CAAC;AAEH,eAAO,MAAM,wBAAwB,wGAQnC,CAAC;AAEH,eAAO,MAAM,oBAAoB,4CAA0C,CAAC;AAE5E,eAAO,MAAM,oBAAoB,+MAU/B,CAAC;AAEH,eAAO,MAAM,iBAAiB,2EAQ5B,CAAC;AAEH,eAAO,MAAM,cAAc,yFASzB,CAAC;AAEH,eAAO,MAAM,eAAe,sCAAoC,CAAC;AAEjE,eAAO,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,cAAc,iDAA+C,CAAC;AAE3E,eAAO,MAAM,eAAe,sDAI1B,CAAC;AAEH,eAAO,MAAM,wBAAwB,wGAQnC,CAAC;AAEH,eAAO,MAAM,oBAAoB,4CAA0C,CAAC;AAE5E,eAAO,MAAM,oBAAoB,+MAU/B,CAAC;AAEH,eAAO,MAAM,iBAAiB,2EAQ5B,CAAC;AAEH,eAAO,MAAM,cAAc,yFASzB,CAAC;AAEH,eAAO,MAAM,eAAe,sCAAoC,CAAC;AAEjE,eAAO,MAAM,sBAAsB,4XAejC,CAAC;AAEH,eAAO,MAAM,w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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKtB,CAAC"}
|
package/dist/schemas.js
CHANGED
|
@@ -59,9 +59,13 @@ export const PolicyDenialCodeSchema = z.enum([
|
|
|
59
59
|
"privacy_label_denied",
|
|
60
60
|
"local_only_required",
|
|
61
61
|
"cost_cap_exceeded",
|
|
62
|
+
"spend_cap_exceeded",
|
|
62
63
|
"api_key_blocked_by_subscription_first_policy",
|
|
63
64
|
"subscription_scope_denied",
|
|
64
65
|
"capability_missing",
|
|
66
|
+
"model_not_allowed",
|
|
67
|
+
"api_spend_approval_required",
|
|
68
|
+
"subscription_switch_requires_ack",
|
|
65
69
|
]);
|
|
66
70
|
export const PolicyDenialTargetSchema = z.enum([
|
|
67
71
|
"profile",
|
|
@@ -78,6 +82,12 @@ export const PolicyDenialSchema = z
|
|
|
78
82
|
message: z.string().min(1),
|
|
79
83
|
})
|
|
80
84
|
.strict();
|
|
85
|
+
export const LogicalModelFamilySchema = z.enum([
|
|
86
|
+
"frontier-coder",
|
|
87
|
+
"fast-coder",
|
|
88
|
+
"local-coder",
|
|
89
|
+
"vision-helper",
|
|
90
|
+
]);
|
|
81
91
|
export const ProviderCandidateSchema = z
|
|
82
92
|
.object({
|
|
83
93
|
providerId: z.string().min(1),
|
|
@@ -96,8 +106,22 @@ export const ProviderCandidateSchema = z
|
|
|
96
106
|
contextWindowTokens: z.number().nonnegative().optional(),
|
|
97
107
|
maxOutputTokens: z.number().nonnegative().optional(),
|
|
98
108
|
estimatedCostUsd: z.number().nonnegative().optional(),
|
|
109
|
+
family: LogicalModelFamilySchema.optional(),
|
|
99
110
|
})
|
|
100
111
|
.strict();
|
|
112
|
+
/** Classifier signal block on RouteDecision — never contains prompt text. */
|
|
113
|
+
export const RouteClassificationSchema = z
|
|
114
|
+
.object({
|
|
115
|
+
recommendedFamily: z.enum(["fast-coder", "frontier-coder"]),
|
|
116
|
+
confidence: z.enum(["low", "medium", "high"]),
|
|
117
|
+
signals: z.array(z.string().min(1)),
|
|
118
|
+
})
|
|
119
|
+
.strict();
|
|
120
|
+
export const ClassifierNameSchema = z.enum([
|
|
121
|
+
"heuristic",
|
|
122
|
+
"llm",
|
|
123
|
+
"llm-fallback-heuristic",
|
|
124
|
+
]);
|
|
101
125
|
export const HarnessRefSchema = z
|
|
102
126
|
.object({
|
|
103
127
|
kind: HarnessKindSchema,
|
|
@@ -160,6 +184,7 @@ export const FallbackChainEntrySchema = z
|
|
|
160
184
|
model: z.string().min(1),
|
|
161
185
|
authTier: AuthTierSchema,
|
|
162
186
|
reason: FallbackReasonSchema,
|
|
187
|
+
healthScore: z.number().optional(),
|
|
163
188
|
})
|
|
164
189
|
.strict();
|
|
165
190
|
export const RouteDecisionSchema = z
|
|
@@ -177,6 +202,16 @@ export const RouteDecisionSchema = z
|
|
|
177
202
|
blocked: z.boolean().optional(),
|
|
178
203
|
needsConfiguration: z.boolean().optional(),
|
|
179
204
|
nearLimitWarning: z.string().optional(),
|
|
205
|
+
classification: RouteClassificationSchema.optional(),
|
|
206
|
+
classifierName: ClassifierNameSchema.optional(),
|
|
207
|
+
routingRule: z
|
|
208
|
+
.object({
|
|
209
|
+
index: z.number().int().nonnegative(),
|
|
210
|
+
matchedKeys: z.array(z.enum(["role", "family"])),
|
|
211
|
+
target: z.enum(["model", "provider", "tier"]),
|
|
212
|
+
})
|
|
213
|
+
.strict()
|
|
214
|
+
.optional(),
|
|
180
215
|
})
|
|
181
216
|
.strict();
|
|
182
217
|
export const PolicyDecisionSchema = z
|
package/dist/schemas.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAEvD,MAAM,CAAC,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,EAAE;IACvC,cAAc,EAAE,yBAAyB,CAAC,QAAQ,EAAE;IACpD,cAAc,EAAE,oBAAoB,CAAC,QAAQ,EAAE;IAC/C,WAAW,EAAE,CAAC;SACX,MAAM,CAAC;QACN,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;QACrC,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;QAChD,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;KAC9C,CAAC;SACD,MAAM,EAAE;SACR,QAAQ,EAAE;CACd,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC;KAClC,MAAM,CAAC;IACN,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,uBAAuB,CAAC;IACzC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC;CACrC,CAAC;KACD,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** Default when policy omits outbound_secret_scan. */
|
|
2
|
+
export type OutboundSecretScanMode = "block" | "warn" | "off";
|
|
3
|
+
export declare const DEFAULT_OUTBOUND_SECRET_SCAN: OutboundSecretScanMode;
|
|
4
|
+
export interface SecretFinding {
|
|
5
|
+
/** Pattern name from SECRET_PATTERNS (e.g. "openai_api_key"). */
|
|
6
|
+
patternName: string;
|
|
7
|
+
/**
|
|
8
|
+
* Surrounding context with the match replaced by REDACTED.
|
|
9
|
+
* Never includes the matched credential value itself.
|
|
10
|
+
*/
|
|
11
|
+
redactedExcerpt: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Thrown when policy.outboundSecretScan === "block" and findings are present.
|
|
15
|
+
* Message and `patternNames` name kinds only — never matched content.
|
|
16
|
+
*/
|
|
17
|
+
export declare class OutboundSecretBlockedError extends Error {
|
|
18
|
+
readonly code: "outbound_secret_blocked";
|
|
19
|
+
readonly patternNames: string[];
|
|
20
|
+
constructor(patternNames: string[]);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Scan free text for known credential shapes.
|
|
24
|
+
* Returns findings with pattern names and redacted excerpts only.
|
|
25
|
+
*/
|
|
26
|
+
export declare function scanForSecrets(text: string): SecretFinding[];
|
|
27
|
+
/**
|
|
28
|
+
* Join message contents (system/user/assistant/tool) for a single scan pass.
|
|
29
|
+
*/
|
|
30
|
+
export declare function collectOutboundText(messages: ReadonlyArray<{
|
|
31
|
+
content: string;
|
|
32
|
+
}>): string;
|
|
33
|
+
/**
|
|
34
|
+
* Apply scan mode to findings collected from outbound text.
|
|
35
|
+
* - "off": empty result, no throw
|
|
36
|
+
* - "warn": return findings (caller audits / attaches warnings)
|
|
37
|
+
* - "block": throw OutboundSecretBlockedError when findings exist
|
|
38
|
+
*/
|
|
39
|
+
export declare function enforceOutboundSecretScan(text: string, mode: OutboundSecretScanMode | undefined): SecretFinding[];
|
|
40
|
+
//# sourceMappingURL=secret-scan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secret-scan.d.ts","sourceRoot":"","sources":["../src/secret-scan.ts"],"names":[],"mappings":"AAYA,sDAAsD;AACtD,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC;AAE9D,eAAO,MAAM,4BAA4B,EAAE,sBAA+B,CAAC;AAE3E,MAAM,WAAW,aAAa;IAC5B,iEAAiE;IACjE,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,qBAAa,0BAA2B,SAAQ,KAAK;IACnD,QAAQ,CAAC,IAAI,EAAG,yBAAyB,CAAU;IACnD,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC;gBAEpB,YAAY,EAAE,MAAM,EAAE;CASnC;AAID;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAoC5D;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,aAAa,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,GAC3C,MAAM,CAKR;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,sBAAsB,GAAG,SAAS,GACvC,aAAa,EAAE,CAiBjB"}
|