audit-tools 0.34.1 → 0.34.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.
|
@@ -45,9 +45,20 @@ export declare function deriveCredentialIdentity(source: {
|
|
|
45
45
|
* credential identity. Returns null when neither is available, and the caller then
|
|
46
46
|
* falls back to a pool-scoped key — correct, because a source we cannot attribute to
|
|
47
47
|
* a credential must not be merged with anyone else's allowance.
|
|
48
|
+
*
|
|
49
|
+
* ⚠ The explicit-account namespace is the SERVICE, never the transport. Account is only
|
|
50
|
+
* meaningful WITHIN a service (`spec/backend-identity-axes.md`), so a proxied lane
|
|
51
|
+
* (`transport: claude-worker`, `service: nim`) and a direct lane
|
|
52
|
+
* (`transport: openai-compatible`, `service: nim`) both declaring `account: "work"` are
|
|
53
|
+
* ONE real credential at one vendor and must yield ONE partition (`nim#work`). Keying on
|
|
54
|
+
* the transport split them into two, double-booking the budget this key protects. Service
|
|
55
|
+
* is normalized to `declared ?? transport` at the producer (`collectDispatchableSources`),
|
|
56
|
+
* so the fallback here only fires for an un-normalized source and preserves the old
|
|
57
|
+
* transport-namespaced key in that case.
|
|
48
58
|
*/
|
|
49
59
|
export declare function deriveAccountKey(source: {
|
|
50
60
|
transport: string;
|
|
61
|
+
service?: string;
|
|
51
62
|
endpoint?: string;
|
|
52
63
|
api_key_env?: string;
|
|
53
64
|
api_key?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accountId.d.ts","sourceRoot":"","sources":["../../../src/shared/quota/accountId.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE;IAC/C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,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C,eAAe,GAAG,IAAI,GAAG,SAAS,CAAC,GAChE,eAAe,GAAG,IAAI,CAuCxB"}
|
|
@@ -52,10 +52,20 @@ export function deriveCredentialIdentity(source) {
|
|
|
52
52
|
* credential identity. Returns null when neither is available, and the caller then
|
|
53
53
|
* falls back to a pool-scoped key — correct, because a source we cannot attribute to
|
|
54
54
|
* a credential must not be merged with anyone else's allowance.
|
|
55
|
+
*
|
|
56
|
+
* ⚠ The explicit-account namespace is the SERVICE, never the transport. Account is only
|
|
57
|
+
* meaningful WITHIN a service (`spec/backend-identity-axes.md`), so a proxied lane
|
|
58
|
+
* (`transport: claude-worker`, `service: nim`) and a direct lane
|
|
59
|
+
* (`transport: openai-compatible`, `service: nim`) both declaring `account: "work"` are
|
|
60
|
+
* ONE real credential at one vendor and must yield ONE partition (`nim#work`). Keying on
|
|
61
|
+
* the transport split them into two, double-booking the budget this key protects. Service
|
|
62
|
+
* is normalized to `declared ?? transport` at the producer (`collectDispatchableSources`),
|
|
63
|
+
* so the fallback here only fires for an un-normalized source and preserves the old
|
|
64
|
+
* transport-namespaced key in that case.
|
|
55
65
|
*/
|
|
56
66
|
export function deriveAccountKey(source) {
|
|
57
67
|
if (source.account)
|
|
58
|
-
return `${source.transport}#${source.account}`;
|
|
68
|
+
return `${source.service ?? source.transport}#${source.account}`;
|
|
59
69
|
return deriveCredentialIdentity(source);
|
|
60
70
|
}
|
|
61
71
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accountId.js","sourceRoot":"","sources":["../../../src/shared/quota/accountId.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,wBAAwB,CAAC,MAIxC;IACC,MAAM,kBAAkB,GAAG,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAA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