@intutic/shared-types 2.2.0 → 2.4.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/anomaly.d.ts +6 -10
- package/dist/anomaly.d.ts.map +1 -1
- package/dist/anomaly.js +0 -2
- package/dist/anomaly.js.map +1 -1
- package/dist/api-contracts.d.ts +1 -1
- package/dist/api-contracts.js +1 -1
- package/dist/attenuation.d.ts +1 -1
- package/dist/attenuation.js +1 -1
- package/dist/auth.d.ts +116 -9
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +20 -5
- package/dist/auth.js.map +1 -1
- package/dist/billing.d.ts +1 -1
- package/dist/billing.js +1 -1
- package/dist/cloudProbe.d.ts +54 -0
- package/dist/cloudProbe.d.ts.map +1 -0
- package/dist/cloudProbe.js +254 -0
- package/dist/cloudProbe.js.map +1 -0
- package/dist/destructiveSql.d.ts +48 -0
- package/dist/destructiveSql.d.ts.map +1 -0
- package/dist/destructiveSql.js +43 -0
- package/dist/destructiveSql.js.map +1 -0
- package/dist/devInventory.d.ts +120 -0
- package/dist/devInventory.d.ts.map +1 -0
- package/dist/devInventory.js +80 -0
- package/dist/devInventory.js.map +1 -0
- package/dist/enums.d.ts +66 -21
- package/dist/enums.d.ts.map +1 -1
- package/dist/enums.js +55 -31
- package/dist/enums.js.map +1 -1
- package/dist/errors.js +3 -3
- package/dist/errors.js.map +1 -1
- package/dist/finops.d.ts +52 -2
- package/dist/finops.d.ts.map +1 -1
- package/dist/finops.js +15 -1
- package/dist/finops.js.map +1 -1
- package/dist/gateDecisions.d.ts +18 -0
- package/dist/gateDecisions.d.ts.map +1 -0
- package/dist/gateDecisions.js +20 -0
- package/dist/gateDecisions.js.map +1 -0
- package/dist/gateIdentity.d.ts +23 -0
- package/dist/gateIdentity.d.ts.map +1 -0
- package/dist/gateIdentity.js +32 -0
- package/dist/gateIdentity.js.map +1 -0
- package/dist/gateKind.d.ts +172 -0
- package/dist/gateKind.d.ts.map +1 -0
- package/dist/gateKind.js +160 -0
- package/dist/gateKind.js.map +1 -0
- package/dist/gateLimits.d.ts +170 -0
- package/dist/gateLimits.d.ts.map +1 -0
- package/dist/gateLimits.js +96 -0
- package/dist/gateLimits.js.map +1 -0
- package/dist/gitRemote.d.ts +17 -0
- package/dist/gitRemote.d.ts.map +1 -0
- package/dist/gitRemote.js +71 -0
- package/dist/gitRemote.js.map +1 -0
- package/dist/governanceCoverage.d.ts +1 -1
- package/dist/governanceCoverage.js +1 -1
- package/dist/guardrailIr.d.ts +9 -9
- package/dist/guardrailIr.d.ts.map +1 -1
- package/dist/guardrailIr.js +3 -3
- package/dist/guardrailIr.js.map +1 -1
- package/dist/guardrailRender.d.ts +1 -1
- package/dist/guardrailRender.js +1 -1
- package/dist/harnessRules.d.ts +74 -0
- package/dist/harnessRules.d.ts.map +1 -0
- package/dist/harnessRules.js +142 -0
- package/dist/harnessRules.js.map +1 -0
- package/dist/holdMessages.d.ts +25 -0
- package/dist/holdMessages.d.ts.map +1 -0
- package/dist/holdMessages.js +34 -0
- package/dist/holdMessages.js.map +1 -0
- package/dist/identity.d.ts +1 -1
- package/dist/identity.js +2 -2
- package/dist/identity.js.map +1 -1
- package/dist/index.d.ts +42 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +161 -10
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +1 -1
- package/dist/mcpBudgets.d.ts +191 -0
- package/dist/mcpBudgets.d.ts.map +1 -0
- package/dist/mcpBudgets.js +144 -0
- package/dist/mcpBudgets.js.map +1 -0
- package/dist/mcpRegistryRecord.d.ts +143 -0
- package/dist/mcpRegistryRecord.d.ts.map +1 -0
- package/dist/mcpRegistryRecord.js +229 -0
- package/dist/mcpRegistryRecord.js.map +1 -0
- package/dist/mcpToolRisk.d.ts +82 -0
- package/dist/mcpToolRisk.d.ts.map +1 -0
- package/dist/mcpToolRisk.js +334 -0
- package/dist/mcpToolRisk.js.map +1 -0
- package/dist/modelCatalog.d.ts +2 -2
- package/dist/modelCatalog.generated.js +1 -1
- package/dist/modelCatalog.generated.js.map +1 -1
- package/dist/modelCatalog.js +2 -2
- package/dist/notifications.d.ts +24 -151
- package/dist/notifications.d.ts.map +1 -1
- package/dist/notifications.js +266 -1
- package/dist/notifications.js.map +1 -1
- package/dist/phrases.d.ts +87 -0
- package/dist/phrases.d.ts.map +1 -0
- package/dist/phrases.js +241 -0
- package/dist/phrases.js.map +1 -0
- package/dist/piiDetectors.d.ts +97 -0
- package/dist/piiDetectors.d.ts.map +1 -0
- package/dist/piiDetectors.js +96 -0
- package/dist/piiDetectors.js.map +1 -0
- package/dist/piiDetectors.json +71 -0
- package/dist/policy.d.ts +1 -1
- package/dist/policy.js +1 -1
- package/dist/policyGuardrails.d.ts +127 -10
- package/dist/policyGuardrails.d.ts.map +1 -1
- package/dist/policyGuardrails.js +59 -6
- package/dist/policyGuardrails.js.map +1 -1
- package/dist/posturePresets.js +1 -1
- package/dist/posturePresets.js.map +1 -1
- package/dist/providerVerification.d.ts +36 -10
- package/dist/providerVerification.d.ts.map +1 -1
- package/dist/providerVerification.js +80 -20
- package/dist/providerVerification.js.map +1 -1
- package/dist/providers.d.ts +54 -17
- package/dist/providers.d.ts.map +1 -1
- package/dist/providers.js +135 -26
- package/dist/providers.js.map +1 -1
- package/dist/regoBuiltins.d.ts +42 -0
- package/dist/regoBuiltins.d.ts.map +1 -0
- package/dist/regoBuiltins.js +732 -0
- package/dist/regoBuiltins.js.map +1 -0
- package/dist/regoRules.d.ts +105 -0
- package/dist/regoRules.d.ts.map +1 -0
- package/dist/regoRules.js +407 -0
- package/dist/regoRules.js.map +1 -0
- package/dist/ruleLoadFailures.d.ts +15 -0
- package/dist/ruleLoadFailures.d.ts.map +1 -0
- package/dist/ruleLoadFailures.js +26 -0
- package/dist/ruleLoadFailures.js.map +1 -0
- package/dist/scriptScan.d.ts +5 -5
- package/dist/scriptScan.js +3 -3
- package/dist/sequence.d.ts +52 -0
- package/dist/sequence.d.ts.map +1 -0
- package/dist/sequence.js +127 -0
- package/dist/sequence.js.map +1 -0
- package/dist/session.d.ts +1 -1
- package/dist/session.js +1 -1
- package/dist/skillScan.d.ts +3 -3
- package/dist/skillScan.d.ts.map +1 -1
- package/dist/skillScan.js +26 -4
- package/dist/skillScan.js.map +1 -1
- package/dist/sop.d.ts +5 -5
- package/dist/sop.js +2 -2
- package/dist/sourceProviders.d.ts +1 -8
- package/dist/sourceProviders.d.ts.map +1 -1
- package/dist/sourceProviders.js +2 -9
- package/dist/sourceProviders.js.map +1 -1
- package/dist/spendBudgets.d.ts +122 -0
- package/dist/spendBudgets.d.ts.map +1 -0
- package/dist/spendBudgets.js +92 -0
- package/dist/spendBudgets.js.map +1 -0
- package/dist/ssoGroupClearance.d.ts +18 -2
- package/dist/ssoGroupClearance.d.ts.map +1 -1
- package/dist/ssoGroupClearance.js +43 -4
- package/dist/ssoGroupClearance.js.map +1 -1
- package/dist/sync.d.ts +0 -1
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +0 -1
- package/dist/sync.js.map +1 -1
- package/dist/taskManagement.d.ts +0 -2
- package/dist/taskManagement.d.ts.map +1 -1
- package/dist/taskManagement.js +0 -2
- package/dist/taskManagement.js.map +1 -1
- package/dist/toolPoison.d.ts +33 -0
- package/dist/toolPoison.d.ts.map +1 -0
- package/dist/toolPoison.js +85 -0
- package/dist/toolPoison.js.map +1 -0
- package/dist/upstreamRetry.d.ts +121 -0
- package/dist/upstreamRetry.d.ts.map +1 -0
- package/dist/upstreamRetry.js +90 -0
- package/dist/upstreamRetry.js.map +1 -0
- package/dist/usage.d.ts +186 -0
- package/dist/usage.d.ts.map +1 -1
- package/dist/wasmBinary.d.ts +25 -0
- package/dist/wasmBinary.d.ts.map +1 -0
- package/dist/wasmBinary.js +111 -0
- package/dist/wasmBinary.js.map +1 -0
- package/dist/wasmFuel.d.ts +52 -0
- package/dist/wasmFuel.d.ts.map +1 -0
- package/dist/wasmFuel.js +320 -0
- package/dist/wasmFuel.js.map +1 -0
- package/dist/wasmMemoryCap.d.ts +21 -0
- package/dist/wasmMemoryCap.d.ts.map +1 -0
- package/dist/wasmMemoryCap.js +58 -0
- package/dist/wasmMemoryCap.js.map +1 -0
- package/dist/wasmRuleDescriptor.d.ts +43 -0
- package/dist/wasmRuleDescriptor.d.ts.map +1 -0
- package/dist/wasmRuleDescriptor.js +65 -0
- package/dist/wasmRuleDescriptor.js.map +1 -0
- package/dist/workspaceSettings.d.ts +95 -17
- package/dist/workspaceSettings.d.ts.map +1 -1
- package/dist/workspaceSettings.js +2 -1
- package/dist/workspaceSettings.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spend budgets and key rate limits — how much LLM spend a workspace, one
|
|
3
|
+
* virtual key or one member may run up per day or per month, and how many
|
|
4
|
+
* requests and tokens a virtual key may send per minute.
|
|
5
|
+
*
|
|
6
|
+
* A budget is `hard` or `soft`. The LLM proxy refuses a request that a hard
|
|
7
|
+
* budget's remainder does not cover (`BUDGET_EXCEEDED`, 429, before the
|
|
8
|
+
* request leaves); a soft budget never refuses. Both raise the workspace's
|
|
9
|
+
* budget alerts — once at the alert threshold and once at the limit, per
|
|
10
|
+
* period — as `finops.budget.threshold` / `finops.budget.exceeded`.
|
|
11
|
+
*
|
|
12
|
+
* Periods are fixed UTC windows, like MCP call budgets (`mcpBudgets.ts`): a
|
|
13
|
+
* day starts at 00:00 UTC, a month on the 1st at 00:00 UTC. The window id is
|
|
14
|
+
* part of every per-key and per-member spend counter's Valkey key, so a new
|
|
15
|
+
* day or month starts from zero and an old counter expires on its own.
|
|
16
|
+
*
|
|
17
|
+
* Spend is what the control plane records per completed call
|
|
18
|
+
* (`finopsService.incrementSpend`), so a request's own cost lands after it
|
|
19
|
+
* finishes: the proxy checks a hard budget against the spend recorded so far
|
|
20
|
+
* plus the request's estimated cost, with the same 20% margin the workspace
|
|
21
|
+
* cap has always used.
|
|
22
|
+
*
|
|
23
|
+
* @module
|
|
24
|
+
*/
|
|
25
|
+
import { z } from 'zod';
|
|
26
|
+
/** A budget's period: a UTC calendar day or a UTC calendar month. */
|
|
27
|
+
export type SpendBudgetPeriod = 'day' | 'month';
|
|
28
|
+
/** `hard` refuses requests the remainder does not cover; `soft` only alerts. */
|
|
29
|
+
export type SpendBudgetEnforcement = 'hard' | 'soft';
|
|
30
|
+
/**
|
|
31
|
+
* Whose spend a budget limits:
|
|
32
|
+
* - `workspace` every call in the workspace (Settings › Billing › Budget Limits);
|
|
33
|
+
* - `key` the calls one virtual key makes;
|
|
34
|
+
* - `member` the calls made with the virtual keys one member owns.
|
|
35
|
+
*/
|
|
36
|
+
export type SpendBudgetScope = 'workspace' | 'key' | 'member';
|
|
37
|
+
export interface SpendBudget {
|
|
38
|
+
period: SpendBudgetPeriod;
|
|
39
|
+
limitUsd: number;
|
|
40
|
+
enforcement: SpendBudgetEnforcement;
|
|
41
|
+
}
|
|
42
|
+
export declare const SPEND_BUDGET_PERIODS: readonly SpendBudgetPeriod[];
|
|
43
|
+
export declare const SPEND_BUDGET_SCOPES: readonly SpendBudgetScope[];
|
|
44
|
+
export declare const MAX_SPEND_BUDGET_USD = 1000000;
|
|
45
|
+
/**
|
|
46
|
+
* The member budget that applies to every member without one of their own,
|
|
47
|
+
* period by period. A member's own day budget replaces the default day
|
|
48
|
+
* budget; the default month budget still applies to them unless they have a
|
|
49
|
+
* month budget too.
|
|
50
|
+
*/
|
|
51
|
+
export declare const MEMBER_BUDGET_DEFAULT = "default";
|
|
52
|
+
export declare const SpendBudgetSchema: z.ZodObject<{
|
|
53
|
+
period: z.ZodEnum<["day", "month"]>;
|
|
54
|
+
limitUsd: z.ZodNumber;
|
|
55
|
+
enforcement: z.ZodDefault<z.ZodEnum<["hard", "soft"]>>;
|
|
56
|
+
}, "strict", z.ZodTypeAny, {
|
|
57
|
+
period: "day" | "month";
|
|
58
|
+
limitUsd: number;
|
|
59
|
+
enforcement: "hard" | "soft";
|
|
60
|
+
}, {
|
|
61
|
+
period: "day" | "month";
|
|
62
|
+
limitUsd: number;
|
|
63
|
+
enforcement?: "hard" | "soft" | undefined;
|
|
64
|
+
}>;
|
|
65
|
+
/** One budget per period at most: a key or member has a day budget, a month budget, both or neither. */
|
|
66
|
+
export declare const SpendBudgetListSchema: z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
67
|
+
period: z.ZodEnum<["day", "month"]>;
|
|
68
|
+
limitUsd: z.ZodNumber;
|
|
69
|
+
enforcement: z.ZodDefault<z.ZodEnum<["hard", "soft"]>>;
|
|
70
|
+
}, "strict", z.ZodTypeAny, {
|
|
71
|
+
period: "day" | "month";
|
|
72
|
+
limitUsd: number;
|
|
73
|
+
enforcement: "hard" | "soft";
|
|
74
|
+
}, {
|
|
75
|
+
period: "day" | "month";
|
|
76
|
+
limitUsd: number;
|
|
77
|
+
enforcement?: "hard" | "soft" | undefined;
|
|
78
|
+
}>, "many">, {
|
|
79
|
+
period: "day" | "month";
|
|
80
|
+
limitUsd: number;
|
|
81
|
+
enforcement: "hard" | "soft";
|
|
82
|
+
}[], {
|
|
83
|
+
period: "day" | "month";
|
|
84
|
+
limitUsd: number;
|
|
85
|
+
enforcement?: "hard" | "soft" | undefined;
|
|
86
|
+
}[]>;
|
|
87
|
+
/** Requests and tokens one virtual key may send per minute; `null` (or absent) means no limit. */
|
|
88
|
+
export interface KeyRateLimit {
|
|
89
|
+
rpm: number | null;
|
|
90
|
+
tpm: number | null;
|
|
91
|
+
}
|
|
92
|
+
export declare const MAX_KEY_RPM = 100000;
|
|
93
|
+
export declare const MAX_KEY_TPM = 100000000;
|
|
94
|
+
export declare const KeyRateLimitSchema: z.ZodObject<{
|
|
95
|
+
rpm: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
96
|
+
tpm: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
97
|
+
}, "strict", z.ZodTypeAny, {
|
|
98
|
+
rpm?: number | null | undefined;
|
|
99
|
+
tpm?: number | null | undefined;
|
|
100
|
+
}, {
|
|
101
|
+
rpm?: number | null | undefined;
|
|
102
|
+
tpm?: number | null | undefined;
|
|
103
|
+
}>;
|
|
104
|
+
/**
|
|
105
|
+
* One hard budget as the proxy reads it from a virtual key's cached auth
|
|
106
|
+
* entry (`hardBudgets`) and from `GET /api/v1/auth/key-context`. Soft budgets
|
|
107
|
+
* are not sent: the proxy never refuses on one.
|
|
108
|
+
*/
|
|
109
|
+
export interface HardBudgetWire {
|
|
110
|
+
scope: SpendBudgetScope;
|
|
111
|
+
period: SpendBudgetPeriod;
|
|
112
|
+
limitUsd: number;
|
|
113
|
+
}
|
|
114
|
+
/** The UTC window a moment falls in: its id (part of the counter key), when it began and when it resets. */
|
|
115
|
+
export declare function spendBudgetWindow(period: SpendBudgetPeriod, nowMs: number): {
|
|
116
|
+
id: string;
|
|
117
|
+
startMs: number;
|
|
118
|
+
resetAtMs: number;
|
|
119
|
+
};
|
|
120
|
+
/** A budget in words, for alerts, refusals and the dashboard. */
|
|
121
|
+
export declare function describeSpendBudget(scope: SpendBudgetScope, budget: SpendBudget, subjectLabel?: string): string;
|
|
122
|
+
//# sourceMappingURL=spendBudgets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spendBudgets.d.ts","sourceRoot":"","sources":["../src/spendBudgets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,qEAAqE;AACrE,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,OAAO,CAAA;AAE/C,gFAAgF;AAChF,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,MAAM,CAAA;AAEpD;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,KAAK,GAAG,QAAQ,CAAA;AAE7D,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,iBAAiB,CAAA;IACzB,QAA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M spend a workspace, one
|
|
4
|
+
* virtual key or one member may run up per day or per month, and how many
|
|
5
|
+
* requests and tokens a virtual key may send per minute.
|
|
6
|
+
*
|
|
7
|
+
* A budget is `hard` or `soft`. The LLM proxy refuses a request that a hard
|
|
8
|
+
* budget's remainder does not cover (`BUDGET_EXCEEDED`, 429, before the
|
|
9
|
+
* request leaves); a soft budget never refuses. Both raise the workspace's
|
|
10
|
+
* budget alerts — once at the alert threshold and once at the limit, per
|
|
11
|
+
* period — as `finops.budget.threshold` / `finops.budget.exceeded`.
|
|
12
|
+
*
|
|
13
|
+
* Periods are fixed UTC windows, like MCP call budgets (`mcpBudgets.ts`): a
|
|
14
|
+
* day starts at 00:00 UTC, a month on the 1st at 00:00 UTC. The window id is
|
|
15
|
+
* part of every per-key and per-member spend counter's Valkey key, so a new
|
|
16
|
+
* day or month starts from zero and an old counter expires on its own.
|
|
17
|
+
*
|
|
18
|
+
* Spend is what the control plane records per completed call
|
|
19
|
+
* (`finopsService.incrementSpend`), so a request's own cost lands after it
|
|
20
|
+
* finishes: the proxy checks a hard budget against the spend recorded so far
|
|
21
|
+
* plus the request's estimated cost, with the same 20% margin the workspace
|
|
22
|
+
* cap has always used.
|
|
23
|
+
*
|
|
24
|
+
* @module
|
|
25
|
+
*/
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.KeyRateLimitSchema = exports.MAX_KEY_TPM = exports.MAX_KEY_RPM = exports.SpendBudgetListSchema = exports.SpendBudgetSchema = exports.MEMBER_BUDGET_DEFAULT = exports.MAX_SPEND_BUDGET_USD = exports.SPEND_BUDGET_SCOPES = exports.SPEND_BUDGET_PERIODS = void 0;
|
|
28
|
+
exports.spendBudgetWindow = spendBudgetWindow;
|
|
29
|
+
exports.describeSpendBudget = describeSpendBudget;
|
|
30
|
+
const zod_1 = require("zod");
|
|
31
|
+
exports.SPEND_BUDGET_PERIODS = ['day', 'month'];
|
|
32
|
+
exports.SPEND_BUDGET_SCOPES = ['workspace', 'key', 'member'];
|
|
33
|
+
exports.MAX_SPEND_BUDGET_USD = 1_000_000;
|
|
34
|
+
/**
|
|
35
|
+
* The member budget that applies to every member without one of their own,
|
|
36
|
+
* period by period. A member's own day budget replaces the default day
|
|
37
|
+
* budget; the default month budget still applies to them unless they have a
|
|
38
|
+
* month budget too.
|
|
39
|
+
*/
|
|
40
|
+
exports.MEMBER_BUDGET_DEFAULT = 'default';
|
|
41
|
+
exports.SpendBudgetSchema = zod_1.z
|
|
42
|
+
.object({
|
|
43
|
+
period: zod_1.z.enum(['day', 'month']),
|
|
44
|
+
limitUsd: zod_1.z.number().positive().max(exports.MAX_SPEND_BUDGET_USD),
|
|
45
|
+
enforcement: zod_1.z.enum(['hard', 'soft']).default('hard'),
|
|
46
|
+
})
|
|
47
|
+
.strict();
|
|
48
|
+
/** One budget per period at most: a key or member has a day budget, a month budget, both or neither. */
|
|
49
|
+
exports.SpendBudgetListSchema = zod_1.z
|
|
50
|
+
.array(exports.SpendBudgetSchema)
|
|
51
|
+
.max(2)
|
|
52
|
+
.superRefine((list, ctx) => {
|
|
53
|
+
const seen = new Set();
|
|
54
|
+
list.forEach((b, i) => {
|
|
55
|
+
if (seen.has(b.period))
|
|
56
|
+
ctx.addIssue({ code: 'custom', path: [i, 'period'], message: `two ${b.period} budgets` });
|
|
57
|
+
seen.add(b.period);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
exports.MAX_KEY_RPM = 100_000;
|
|
61
|
+
exports.MAX_KEY_TPM = 100_000_000;
|
|
62
|
+
exports.KeyRateLimitSchema = zod_1.z
|
|
63
|
+
.object({
|
|
64
|
+
rpm: zod_1.z.number().int().min(1).max(exports.MAX_KEY_RPM).nullable().optional(),
|
|
65
|
+
tpm: zod_1.z.number().int().min(1).max(exports.MAX_KEY_TPM).nullable().optional(),
|
|
66
|
+
})
|
|
67
|
+
.strict();
|
|
68
|
+
/** The UTC window a moment falls in: its id (part of the counter key), when it began and when it resets. */
|
|
69
|
+
function spendBudgetWindow(period, nowMs) {
|
|
70
|
+
const d = new Date(nowMs);
|
|
71
|
+
const y = d.getUTCFullYear();
|
|
72
|
+
const m = d.getUTCMonth();
|
|
73
|
+
if (period === 'day') {
|
|
74
|
+
const startMs = Date.UTC(y, m, d.getUTCDate());
|
|
75
|
+
return { id: new Date(startMs).toISOString().slice(0, 10), startMs, resetAtMs: startMs + 86_400_000 };
|
|
76
|
+
}
|
|
77
|
+
const startMs = Date.UTC(y, m, 1);
|
|
78
|
+
return { id: new Date(startMs).toISOString().slice(0, 7), startMs, resetAtMs: Date.UTC(y, m + 1, 1) };
|
|
79
|
+
}
|
|
80
|
+
/** A budget in words, for alerts, refusals and the dashboard. */
|
|
81
|
+
function describeSpendBudget(scope, budget, subjectLabel) {
|
|
82
|
+
const whose = scope === 'workspace'
|
|
83
|
+
? 'Workspace'
|
|
84
|
+
: scope === 'key'
|
|
85
|
+
? `Key ${subjectLabel ?? ''}`.trim()
|
|
86
|
+
: subjectLabel === exports.MEMBER_BUDGET_DEFAULT || subjectLabel === undefined
|
|
87
|
+
? 'Member'
|
|
88
|
+
: `Member ${subjectLabel}`;
|
|
89
|
+
const per = budget.period === 'day' ? 'day' : 'month';
|
|
90
|
+
return `${whose} ${budget.enforcement} budget: $${budget.limitUsd.toFixed(2)} per ${per}`;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=spendBudgets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spendBudgets.js","sourceRoot":"","sources":["../src/spendBudgets.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AAoFH,8CAaC;AAGD,kDAWC;AA7GD,6BAAuB;AAsBV,QAAA,oBAAoB,GAAiC,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;AACrE,QAAA,mBAAmB,GAAgC,CAAC,WAAW,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAA;AACjF,QAAA,oBAAoB,GAAG,SAAS,CAAA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AAmB,CAAC,KAAuB,EAAE,MAAmB,EAAE,YAAqB;IACrG,MAAM,KAAK,GACT,KAAK,KAAK,WAAW;QACnB,CAAC,CAAC,WAAW;QACb,CAAC,CAAC,KAAK,KAAK,KAAK;YACf,CAAC,CAAC,OAAO,YAAY,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE;YACpC,CAAC,CAAC,YAAY,KAAK,6BAAqB,IAAI,YAAY,KAAK,SAAS;gBACpE,CAAC,CAAC,QAAQ;gBACV,CAAC,CAAC,UAAU,YAAY,EAAE,CAAA;IAClC,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAA;IACrD,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,WAAW,aAAa,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,GAAG,EAAE,CAAA;AAC3F,CAAC"}
|
|
@@ -22,7 +22,10 @@
|
|
|
22
22
|
*
|
|
23
23
|
* Names and groups match exactly — no case folding, no patterns — because
|
|
24
24
|
* that is what the server has always done and a gate that matched more loosely
|
|
25
|
-
* would refuse calls the server allows.
|
|
25
|
+
* would refuse calls the server allows. The one widening is MCP's two names
|
|
26
|
+
* for one tool ({@link ssoGroupToolMatches}): an entry naming the tool as its
|
|
27
|
+
* server declares it (`run_query`) also matches the name a harness hook sees
|
|
28
|
+
* (`mcp__postgres__run_query`), at every gate.
|
|
26
29
|
*
|
|
27
30
|
* @module
|
|
28
31
|
*/
|
|
@@ -65,10 +68,23 @@ export declare const SsoGroupPolicySchema: z.ZodObject<{
|
|
|
65
68
|
export declare function parseSsoGroupPolicy(value: unknown): SsoGroupPolicy | null;
|
|
66
69
|
/** A rule id that survives `ruleIdFromReason` (`[A-Za-z0-9_.:-]`). */
|
|
67
70
|
export declare function ssoGroupRuleId(kind: 'require_obo' | 'high_risk', toolName: string): string;
|
|
71
|
+
/**
|
|
72
|
+
* Whether a call that goes by `name` is the tool a policy entry names.
|
|
73
|
+
*
|
|
74
|
+
* Exactly, or — for an entry that is an MCP tool's own name, not starting
|
|
75
|
+
* with `mcp__` — as the name a harness hook gives that tool on any server:
|
|
76
|
+
* `mcp__<server>__<entry>`, the server part non-empty. The MCP proxy sees
|
|
77
|
+
* `run_query` where Claude Code's hook sees `mcp__postgres__run_query`, so
|
|
78
|
+
* without this an entry written one way held at one gate and not the other.
|
|
79
|
+
* An entry that already names the harness form (`mcp__postgres__run_query`)
|
|
80
|
+
* matches only that server's tool.
|
|
81
|
+
*/
|
|
82
|
+
export declare function ssoGroupToolMatches(entry: string, name: string): boolean;
|
|
68
83
|
/**
|
|
69
84
|
* Decides one tool call. `toolNames` is every name the call goes by — the MCP
|
|
70
85
|
* proxy sees `create_issue` where a harness hook sees
|
|
71
|
-
* `mcp__github__create_issue` — and a policy entry naming any of them applies
|
|
86
|
+
* `mcp__github__create_issue` — and a policy entry naming any of them applies
|
|
87
|
+
* ({@link ssoGroupToolMatches}). The rule id and reason name the entry.
|
|
72
88
|
* `memberGroups` null means the caller does not know the member's groups.
|
|
73
89
|
*/
|
|
74
90
|
export declare function evaluateSsoGroupClearance(policy: SsoGroupPolicy | null, toolNames: string | readonly string[], memberGroups: readonly string[] | null): SsoGroupDecision;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssoGroupClearance.d.ts","sourceRoot":"","sources":["../src/ssoGroupClearance.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ssoGroupClearance.d.ts","sourceRoot":"","sources":["../src/ssoGroupClearance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEzE,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,iBAAi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terns — because
|
|
25
25
|
* that is what the server has always done and a gate that matched more loosely
|
|
26
|
-
* would refuse calls the server allows.
|
|
26
|
+
* would refuse calls the server allows. The one widening is MCP's two names
|
|
27
|
+
* for one tool ({@link ssoGroupToolMatches}): an entry naming the tool as its
|
|
28
|
+
* server declares it (`run_query`) also matches the name a harness hook sees
|
|
29
|
+
* (`mcp__postgres__run_query`), at every gate.
|
|
27
30
|
*
|
|
28
31
|
* @module
|
|
29
32
|
*/
|
|
@@ -31,6 +34,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
31
34
|
exports.SSO_GROUP_RECORD_TAG = exports.SsoGroupPolicySchema = void 0;
|
|
32
35
|
exports.parseSsoGroupPolicy = parseSsoGroupPolicy;
|
|
33
36
|
exports.ssoGroupRuleId = ssoGroupRuleId;
|
|
37
|
+
exports.ssoGroupToolMatches = ssoGroupToolMatches;
|
|
34
38
|
exports.evaluateSsoGroupClearance = evaluateSsoGroupClearance;
|
|
35
39
|
exports.encodeSsoGroupRecord = encodeSsoGroupRecord;
|
|
36
40
|
exports.decodeSsoGroupRecord = decodeSsoGroupRecord;
|
|
@@ -79,17 +83,52 @@ function parseSsoGroupPolicy(value) {
|
|
|
79
83
|
function ssoGroupRuleId(kind, toolName) {
|
|
80
84
|
return `sso_group.${kind}.${toolName.replace(/[^A-Za-z0-9_.:-]/g, '_')}`;
|
|
81
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Whether a call that goes by `name` is the tool a policy entry names.
|
|
88
|
+
*
|
|
89
|
+
* Exactly, or — for an entry that is an MCP tool's own name, not starting
|
|
90
|
+
* with `mcp__` — as the name a harness hook gives that tool on any server:
|
|
91
|
+
* `mcp__<server>__<entry>`, the server part non-empty. The MCP proxy sees
|
|
92
|
+
* `run_query` where Claude Code's hook sees `mcp__postgres__run_query`, so
|
|
93
|
+
* without this an entry written one way held at one gate and not the other.
|
|
94
|
+
* An entry that already names the harness form (`mcp__postgres__run_query`)
|
|
95
|
+
* matches only that server's tool.
|
|
96
|
+
*/
|
|
97
|
+
function ssoGroupToolMatches(entry, name) {
|
|
98
|
+
if (name === entry)
|
|
99
|
+
return true;
|
|
100
|
+
if (entry.startsWith('mcp__') || !name.startsWith('mcp__'))
|
|
101
|
+
return false;
|
|
102
|
+
const suffix = `__${entry}`;
|
|
103
|
+
return name.length > 'mcp__'.length + suffix.length && name.endsWith(suffix);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* The first entry of `list` a call matches: an exact match on any of its
|
|
107
|
+
* names first, then an MCP tool's own name matching a harness name.
|
|
108
|
+
*/
|
|
109
|
+
function matchingEntry(list, names) {
|
|
110
|
+
const exact = names.find((n) => list.includes(n));
|
|
111
|
+
if (exact !== undefined)
|
|
112
|
+
return exact;
|
|
113
|
+
for (const n of names) {
|
|
114
|
+
const entry = list.find((e) => ssoGroupToolMatches(e, n));
|
|
115
|
+
if (entry !== undefined)
|
|
116
|
+
return entry;
|
|
117
|
+
}
|
|
118
|
+
return undefined;
|
|
119
|
+
}
|
|
82
120
|
/**
|
|
83
121
|
* Decides one tool call. `toolNames` is every name the call goes by — the MCP
|
|
84
122
|
* proxy sees `create_issue` where a harness hook sees
|
|
85
|
-
* `mcp__github__create_issue` — and a policy entry naming any of them applies
|
|
123
|
+
* `mcp__github__create_issue` — and a policy entry naming any of them applies
|
|
124
|
+
* ({@link ssoGroupToolMatches}). The rule id and reason name the entry.
|
|
86
125
|
* `memberGroups` null means the caller does not know the member's groups.
|
|
87
126
|
*/
|
|
88
127
|
function evaluateSsoGroupClearance(policy, toolNames, memberGroups) {
|
|
89
128
|
if (!policy)
|
|
90
129
|
return { clearance: 'GRANTED', ruleId: null, reason: '' };
|
|
91
130
|
const names = typeof toolNames === 'string' ? [toolNames] : toolNames;
|
|
92
|
-
const obo =
|
|
131
|
+
const obo = matchingEntry(policy.requireOboFor, names);
|
|
93
132
|
if (obo !== undefined) {
|
|
94
133
|
return {
|
|
95
134
|
clearance: 'REQUIRES_OBO',
|
|
@@ -97,7 +136,7 @@ function evaluateSsoGroupClearance(policy, toolNames, memberGroups) {
|
|
|
97
136
|
reason: `SSO group policy: ${obo} is on-behalf-of only, and a tool-call gate has no OBO token to present`,
|
|
98
137
|
};
|
|
99
138
|
}
|
|
100
|
-
const risky =
|
|
139
|
+
const risky = matchingEntry(policy.highRiskTools, names);
|
|
101
140
|
if (risky === undefined)
|
|
102
141
|
return { clearance: 'GRANTED', ruleId: null, reason: '' };
|
|
103
142
|
if (memberGroups && policy.requiredGroups.some((g) => memberGroups.includes(g))) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssoGroupClearance.js","sourceRoot":"","sources":["../src/ssoGroupClearance.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"ssoGroupClearance.js","sourceRoot":"","sources":["../src/ssoGroupClearance.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;;;AA4CH,kDAUC;AAGD,wCAEC;AAaD,kDAKC;AAuBD,8DA+BC;AAsCD,oDAEC;AAGD,oDAgBC;AA5LD,6BAAuB;AAYvB,SAAS,UAAU,CAAC,KAAc;IAChC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;AAC5F,CAAC;AAED,gFAAgF;AAChF,MAAM,kBAAkB,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AACrD,MAAM,sBAAsB,GAAG,OAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;AAE/E;;;;;GAKG;AACU,QAAA,oBAAoB,GAAG,OAAC;KACl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AC,CAAC,IAAI,CAAA;QACV,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,CAAC,UAAU,CAAC,EAAE,CAAA;IACtD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC"}
|
package/dist/sync.d.ts
CHANGED
package/dist/sync.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../src/sync.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../src/sync.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAG/D,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAK7C,oDAAoD;AACpD,MAAM,WAAW,YAAY;IAC3B,uBAAuB;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,oEAAoE;IACpE,OAAO,EAAE,MAAM,CAAA;IACf,gDAAgD;IAChD,WAAW,EAAE,MAAM,CAAA;IACnB,0DAA0D;IAC1D,cAAc,EAAE,WAAW,EAAE,CAAA;IAC7B,6FAA6F;IAC7F,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,6DAA6D;AAC7D,MAAM,WAAW,iBAAiB;IAChC,wCAAwC;IACxC,WAAW,EAAE,MAAM,CAAA;IACnB,yEAAyE;IACzE,aAAa,EAAE,MAAM,CAAA;IACrB,oDAAoD;IACpD,IAAI,EAAE,YAAY,EAAE,CAAA;IACpB,sEAAsE;IACtE,QAAQ,EAAE,MAAM,CAAA;IAChB;;;;;OAKG;IACH,QAAQ,EAAE,iBAAiB,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|
|
1
|
-
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../src/sync.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../src/sync.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,6BAAuB;AACvB,yCAAwC;AAyOxC,wEAAwE;AAExE,+DAA+D;AAClD,QAAA,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC1C,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B,WAAW,EAAE,OAAC,CAAC,UAAU,CAAC,sBAAW,CAAC;IACtC,KAAK,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,CAAC;QACtB,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QAC3B,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,EAAG,cAAc;QACjD,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC;QACpC,OAAO,EAAE,OAAC,CAAC,OAAO,EAAE;KACrB,CAAC,CAAC;IACH,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAA;AAEF,gDAAgD;AACnC,QAAA,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IACzC,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACtC,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACrC,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,SAAS,EAAE,OAAC,CAAC,KAAK,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AC,GAAG,EAAE,CAAC,WAAW,EAAE;KAC1C,CAAC,CAAC;CACJ,CAAC,CAAA"}
|
package/dist/taskManagement.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Task Management Adapter — Generic interface for external task/issue trackers.
|
|
3
3
|
*
|
|
4
|
-
* TD-022 item 3.9: TaskManagementAdapter interface
|
|
5
|
-
*
|
|
6
4
|
* Provides a unified abstraction over external task management tools
|
|
7
5
|
* (Jira, Linear, GitHub Issues, etc.) so the control plane can
|
|
8
6
|
* create/update tasks based on governance events.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taskManagement.d.ts","sourceRoot":"","sources":["../src/taskManagement.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"taskManagement.d.ts","sourceRoot":"","sources":["../src/taskManagement.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,2CAA2C;AAC3C,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,WAAW,CAAA;AAE/E,+CAA+C;AAC/C,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAA;AAEjE,iDAAiD;AACjD,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,aAAa,GAAG,UAAU,GAAG,QAAQ,CAAA;AAEvE,gEAAgE;AAChE,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,YAAY,CAAA;IACtB,+EAA+E;IAC/E,OAAO,EAAE,MAAM,CAAA;IACf,uCAAuC;IACvC,SAAS,EAAE,MAAM,CAAA;IACjB,uDAAuD;IACvD,UAAU,EAAE,MAAM,CAAA;IAClB,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACnC;AAED,uCAAuC;AACvC,MAAM,WAAW,iBAAiB;IAChC,iCAAiC;IACjC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ACb,MAAM,EAAE,UAAU,CAAA;IAClB,QAAQ,EAAE,YAAY,CAAA;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAID;;;;;;;GAOG;AACH,MAAM,WAAW,qBAAqB;IACpC,sCAAsC;IACtC,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAA;IAE/B;;;OAGG;IACH,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC,CAAA;IAElC;;;;OAIG;IACH,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAEjE;;;;OAIG;IACH,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAEjE;;;;OAIG;IACH,OAAO,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAA;IAE7D;;;;;OAKG;IACH,WAAW,CACT,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,UAAU,CAAC;QAAC,QAAQ,CAAC,EAAE,YAAY,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAC5E,OAAO,CAAC,YAAY,EAAE,CAAC,CAAA;CAC3B"}
|
package/dist/taskManagement.js
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Task Management Adapter — Generic interface for external task/issue trackers.
|
|
4
4
|
*
|
|
5
|
-
* TD-022 item 3.9: TaskManagementAdapter interface
|
|
6
|
-
*
|
|
7
5
|
* Provides a unified abstraction over external task management tools
|
|
8
6
|
* (Jira, Linear, GitHub Issues, etc.) so the control plane can
|
|
9
7
|
* create/update tasks based on governance events.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taskManagement.js","sourceRoot":"","sources":["../src/taskManagement.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"taskManagement.js","sourceRoot":"","sources":["../src/taskManagement.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* toolPoison.ts — Tool-description poisoning patterns.
|
|
3
|
+
*
|
|
4
|
+
* Direct TypeScript port of `packages/proxy/src/tool_poison.rs`'s `scan`
|
|
5
|
+
* function and its seven named patterns. This is a SEPARATE pattern set from
|
|
6
|
+
* the MCP proxy's `injection.ts`, on purpose: `tool_poison.rs`'s own module
|
|
7
|
+
* doc records that it tried reusing `injection::scan` for this and measured
|
|
8
|
+
* that its five patterns match ZERO of the tool-poisoning payloads — they are
|
|
9
|
+
* tuned for conversational jailbreak phrasing ("ignore previous
|
|
10
|
+
* instructions"), while a poisoned tool description reads like documentation,
|
|
11
|
+
* not a jailbreak.
|
|
12
|
+
*
|
|
13
|
+
* Two consumers, which is why it lives here: the MCP proxy's
|
|
14
|
+
* `tool_poisoning` detector (`packages/mcp-proxy/src/anomaly/detectors.ts`)
|
|
15
|
+
* and the tool-change risk score (`mcpToolRisk.ts`), which the control plane
|
|
16
|
+
* computes when a server's tool set changes.
|
|
17
|
+
*
|
|
18
|
+
* The Rust source gates each pattern behind a cheap substring pre-check
|
|
19
|
+
* (`GATES`) before running the regex. That optimization is not ported — it is
|
|
20
|
+
* a performance detail proven equivalent to the plain regex loop (the Rust
|
|
21
|
+
* module's own `gating_never_changes_a_verdict` test), and the volume of tool
|
|
22
|
+
* descriptions scanned here is orders of magnitude below the Rust proxy's
|
|
23
|
+
* request path. The pattern SOURCE TEXT below is unchanged from the Rust
|
|
24
|
+
* `PATTERNS` array.
|
|
25
|
+
*
|
|
26
|
+
@module
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* Pattern names matching this tool description, deduplicated, empty when it
|
|
30
|
+
* looks like ordinary prose (the overwhelmingly common case).
|
|
31
|
+
*/
|
|
32
|
+
export declare function scanToolDescription(description: string): string[];
|
|
33
|
+
//# sourceMappingURL=toolPoison.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolPoison.d.ts","sourceRoot":"","sources":["../src/toolPoison.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAkDH;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAOjE"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* toolPoison.ts — Tool-description poisoning patterns.
|
|
4
|
+
*
|
|
5
|
+
* Direct TypeScript port of `packages/proxy/src/tool_poison.rs`'s `scan`
|
|
6
|
+
* function and its seven named patterns. This is a SEPARATE pattern set from
|
|
7
|
+
* the MCP proxy's `injection.ts`, on purpose: `tool_poison.rs`'s own module
|
|
8
|
+
* doc records that it tried reusing `injection::scan` for this and measured
|
|
9
|
+
* that its five patterns match ZERO of the tool-poisoning payloads — they are
|
|
10
|
+
* tuned for conversational jailbreak phrasing ("ignore previous
|
|
11
|
+
* instructions"), while a poisoned tool description reads like documentation,
|
|
12
|
+
* not a jailbreak.
|
|
13
|
+
*
|
|
14
|
+
* Two consumers, which is why it lives here: the MCP proxy's
|
|
15
|
+
* `tool_poisoning` detector (`packages/mcp-proxy/src/anomaly/detectors.ts`)
|
|
16
|
+
* and the tool-change risk score (`mcpToolRisk.ts`), which the control plane
|
|
17
|
+
* computes when a server's tool set changes.
|
|
18
|
+
*
|
|
19
|
+
* The Rust source gates each pattern behind a cheap substring pre-check
|
|
20
|
+
* (`GATES`) before running the regex. That optimization is not ported — it is
|
|
21
|
+
* a performance detail proven equivalent to the plain regex loop (the Rust
|
|
22
|
+
* module's own `gating_never_changes_a_verdict` test), and the volume of tool
|
|
23
|
+
* descriptions scanned here is orders of magnitude below the Rust proxy's
|
|
24
|
+
* request path. The pattern SOURCE TEXT below is unchanged from the Rust
|
|
25
|
+
* `PATTERNS` array.
|
|
26
|
+
*
|
|
27
|
+
@module
|
|
28
|
+
*/
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.scanToolDescription = scanToolDescription;
|
|
31
|
+
/**
|
|
32
|
+
* Ported verbatim from `tool_poison.rs`'s `PATTERNS` const. All bounded
|
|
33
|
+
* repetitions here are small fixed-width gaps (`{0,40}`, `{0,60}`, `{0,80}`)
|
|
34
|
+
* over a handful of alternations — the same "no wide bounded repetition, no
|
|
35
|
+
* RegexSet performance regression" shape the MCP proxy's `injection.ts` documents, not the
|
|
36
|
+
* `dlp.rs` shape that regressed.
|
|
37
|
+
*/
|
|
38
|
+
const PATTERNS = [
|
|
39
|
+
{
|
|
40
|
+
name: 'hidden-instruction-block',
|
|
41
|
+
regex: /<\s*(important|secret|system|hidden|instructions?)\s*>/i,
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'conceal-from-user',
|
|
45
|
+
regex: /\bdo\s+not\s+(mention|tell|inform|reveal|disclose|show)\b[^.!?]{0,40}\buser\b|\bwithout\s+(informing|telling|notifying|alerting)\s+the\s+user\b/i,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: 'sidechannel-exfil',
|
|
49
|
+
regex: /\b(pass|send|include|append|forward|provide)\b[^.!?]{0,60}\b(content|value|text)s?\s+of\b[^.!?]{0,40}(~\/|\.env|\.ssh|id_rsa|credential|secret|token|api[_ ]?key)/i,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'read-sensitive-path',
|
|
53
|
+
// Rust's own comment: no `\b` before the alternation, because a word
|
|
54
|
+
// boundary cannot exist before a literal `.` — `\b\.env` matches
|
|
55
|
+
// nothing. Preserved exactly, including that absence.
|
|
56
|
+
regex: /\b(read|open|cat|load|access)\b[^.!?]{0,30}(~\/\.\w+|\.ssh\/|id_rsa|\.env\b|\.aws\/|mcp\.json|\/etc\/passwd)/i,
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'cross-tool-shadowing',
|
|
60
|
+
regex: /\buse\s+this\s+tool\s+instead\s+of\b|\bdo\s+not\s+use\s+the\s+\w+\s+tool\b|\bthis\s+tool\s+supersedes\b/i,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: 'agent-directed-precondition',
|
|
64
|
+
regex: /\bbefore\s+(using|calling|invoking)\s+(this|the)\s+tool\b[^.!?]{0,80}\b(you\s+must|first\s+read|first\s+call)\b/i,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: 'tool-scoped-instruction-override',
|
|
68
|
+
regex: /\b(ignore|disregard|override)\b[^.!?]{0,40}\b(other\s+tools?|previous\s+tools?|system\s+prompt)\b/i,
|
|
69
|
+
},
|
|
70
|
+
];
|
|
71
|
+
/**
|
|
72
|
+
* Pattern names matching this tool description, deduplicated, empty when it
|
|
73
|
+
* looks like ordinary prose (the overwhelmingly common case).
|
|
74
|
+
*/
|
|
75
|
+
function scanToolDescription(description) {
|
|
76
|
+
if (!description)
|
|
77
|
+
return [];
|
|
78
|
+
const found = [];
|
|
79
|
+
for (const { name, regex } of PATTERNS) {
|
|
80
|
+
if (regex.test(description))
|
|
81
|
+
found.push(name);
|
|
82
|
+
}
|
|
83
|
+
return found;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=toolPoison.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolPoison.js","sourceRoot":"","sources":["../src/toolPoison.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;;AAsDH,kDAOC;AAtDD;;;;;;GAMG;AACH,MAAM,QAAQ,GAAiC;IAC7C;QACE,IAAI,EAAE,0BAA0B;QAChC,KAAK,EAAE,yDAAyD;KACjE;IACD;QACE,IAAI,EAAE,mBAAmB;QACzB,KAAK,EACH,kJAAkJ;KACrJ;IACD;QACE,IAAI,EAAE,mBAAmB;QACzB,KAAK,EACH,oKAAoK;KACvK;IACD;QACE,IAAI,EAAE,qBAAqB;QAC3B,qEAAqE;QACrE,iEAAiE;QACjE,sDAAsD;QACtD,KAAK,EAAE,+GAA+G;KACvH;IACD;QACE,IAAI,EAAE,sBAAsB;QAC5B,KAAK,EAAE,0GAA0G;KAClH;IACD;QACE,IAAI,EAAE,6BAA6B;QACnC,KAAK,EAAE,kHAAkH;KAC1H;IACD;QACE,IAAI,EAAE,kCAAkC;QACxC,KAAK,EAAE,oGAAoG;KAC5G;CACF,CAAA;AAED;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,WAAmB;IACrD,IAAI,CAAC,WAAW;QAAE,OAAO,EAAE,CAAA;IAC3B,MAAM,KAAK,GAAa,EAAE,CAAA;IAC1B,KAAK,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,QAAQ,EAAE,CAAC;QACvC,IAAI,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC;YAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC/C,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC"}
|