@agimon-ai/doompi-cache 0.0.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +85 -0
- package/dist/adapters/node/digest.cjs +2 -0
- package/dist/adapters/node/digest.cjs.map +1 -0
- package/dist/adapters/node/digest.d.cts +5 -0
- package/dist/adapters/node/digest.d.cts.map +1 -0
- package/dist/adapters/node/digest.d.mts +5 -0
- package/dist/adapters/node/digest.d.mts.map +1 -0
- package/dist/adapters/node/digest.mjs +2 -0
- package/dist/adapters/node/digest.mjs.map +1 -0
- package/dist/env.cjs +1 -0
- package/dist/env.d.cts +2 -0
- package/dist/env.d.mts +2 -0
- package/dist/env.mjs +1 -0
- package/dist/extensions/pi.cjs +3 -0
- package/dist/extensions/pi.cjs.map +1 -0
- package/dist/extensions/pi.d.cts +43 -0
- package/dist/extensions/pi.d.cts.map +1 -0
- package/dist/extensions/pi.d.mts +43 -0
- package/dist/extensions/pi.d.mts.map +1 -0
- package/dist/extensions/pi.mjs +3 -0
- package/dist/extensions/pi.mjs.map +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +9 -0
- package/dist/index.d.mts +9 -0
- package/dist/index.mjs +1 -0
- package/dist/pi-cache-optimizer-B7B911Pz.cjs +54 -0
- package/dist/pi-cache-optimizer-B7B911Pz.cjs.map +1 -0
- package/dist/pi-cache-optimizer-CjPVk06Q.mjs +54 -0
- package/dist/pi-cache-optimizer-CjPVk06Q.mjs.map +1 -0
- package/dist/providers/promptCacheTelemetry.cjs +2 -0
- package/dist/providers/promptCacheTelemetry.cjs.map +1 -0
- package/dist/providers/promptCacheTelemetry.d.cts +18 -0
- package/dist/providers/promptCacheTelemetry.d.cts.map +1 -0
- package/dist/providers/promptCacheTelemetry.d.mts +18 -0
- package/dist/providers/promptCacheTelemetry.d.mts.map +1 -0
- package/dist/providers/promptCacheTelemetry.mjs +2 -0
- package/dist/providers/promptCacheTelemetry.mjs.map +1 -0
- package/dist/services/canonical.cjs +2 -0
- package/dist/services/canonical.cjs.map +1 -0
- package/dist/services/canonical.d.cts +10 -0
- package/dist/services/canonical.d.cts.map +1 -0
- package/dist/services/canonical.d.mts +10 -0
- package/dist/services/canonical.d.mts.map +1 -0
- package/dist/services/canonical.mjs +2 -0
- package/dist/services/canonical.mjs.map +1 -0
- package/dist/services/namespace.cjs +2 -0
- package/dist/services/namespace.cjs.map +1 -0
- package/dist/services/namespace.d.cts +10 -0
- package/dist/services/namespace.d.cts.map +1 -0
- package/dist/services/namespace.d.mts +10 -0
- package/dist/services/namespace.d.mts.map +1 -0
- package/dist/services/namespace.mjs +2 -0
- package/dist/services/namespace.mjs.map +1 -0
- package/dist/services/providerPolicy.cjs +2 -0
- package/dist/services/providerPolicy.cjs.map +1 -0
- package/dist/services/providerPolicy.d.cts +8 -0
- package/dist/services/providerPolicy.d.cts.map +1 -0
- package/dist/services/providerPolicy.d.mts +8 -0
- package/dist/services/providerPolicy.d.mts.map +1 -0
- package/dist/services/providerPolicy.mjs +2 -0
- package/dist/services/providerPolicy.mjs.map +1 -0
- package/dist/services/status.cjs +3 -0
- package/dist/services/status.cjs.map +1 -0
- package/dist/services/status.d.cts +6 -0
- package/dist/services/status.d.cts.map +1 -0
- package/dist/services/status.d.mts +6 -0
- package/dist/services/status.d.mts.map +1 -0
- package/dist/services/status.mjs +3 -0
- package/dist/services/status.mjs.map +1 -0
- package/dist/services/telemetry.cjs +2 -0
- package/dist/services/telemetry.cjs.map +1 -0
- package/dist/services/telemetry.d.cts +13 -0
- package/dist/services/telemetry.d.cts.map +1 -0
- package/dist/services/telemetry.d.mts +13 -0
- package/dist/services/telemetry.d.mts.map +1 -0
- package/dist/services/telemetry.mjs +2 -0
- package/dist/services/telemetry.mjs.map +1 -0
- package/dist/types/cache.d.cts +68 -0
- package/dist/types/cache.d.cts.map +1 -0
- package/dist/types/cache.d.mts +68 -0
- package/dist/types/cache.d.mts.map +1 -0
- package/dist/types/environment.cjs +2 -0
- package/dist/types/environment.cjs.map +1 -0
- package/dist/types/environment.d.cts +9 -0
- package/dist/types/environment.d.cts.map +1 -0
- package/dist/types/environment.d.mts +9 -0
- package/dist/types/environment.d.mts.map +1 -0
- package/dist/types/environment.mjs +2 -0
- package/dist/types/environment.mjs.map +1 -0
- package/llms.txt +11 -0
- package/package.json +90 -0
- package/src/prompts/doompi-use-cache/SKILL.md +14 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
let e=require("@deepseek-ai/cordis");const t=`doom/prompt-cache-telemetry`;var n=class extends e.Service{telemetry;constructor(e,n){super(e,t),this.telemetry=n}snapshot(){return this.telemetry.snapshot()}};function r(e){return e.get(t)}exports.DOOM_PROMPT_CACHE_TELEMETRY_SERVICE=t,exports.PromptCacheTelemetryService=n,exports.readPromptCacheTelemetry=r;
|
|
2
|
+
//# sourceMappingURL=promptCacheTelemetry.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promptCacheTelemetry.cjs","names":["Service"],"sources":["../../src/providers/promptCacheTelemetry.ts"],"sourcesContent":["import { type Context, Service } from '@deepseek-ai/cordis';\nimport type { PromptCacheTelemetryPort, PromptCacheTelemetrySnapshot } from '../types/cache.ts';\n\nexport const DOOM_PROMPT_CACHE_TELEMETRY_SERVICE = 'doom/prompt-cache-telemetry';\n\nexport class PromptCacheTelemetryService extends Service {\n constructor(\n context: Context,\n private readonly telemetry: PromptCacheTelemetryPort,\n ) {\n super(context, DOOM_PROMPT_CACHE_TELEMETRY_SERVICE);\n }\n\n snapshot(): PromptCacheTelemetrySnapshot {\n return this.telemetry.snapshot();\n }\n}\n\nexport function readPromptCacheTelemetry(context: Context): PromptCacheTelemetryService | undefined {\n return context.get(DOOM_PROMPT_CACHE_TELEMETRY_SERVICE) as PromptCacheTelemetryService | undefined;\n}\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n 'doom/prompt-cache-telemetry': PromptCacheTelemetryService;\n }\n}\n"],"mappings":"qCAGA,MAAa,EAAsC,8BAEnD,IAAa,EAAb,cAAiDA,EAAAA,OAAQ,CAGpC,UAFnB,YACE,EACA,EACA,CACA,MAAM,EAAS,CAAmC,EAFjC,KAAA,UAAA,CAGnB,CAEA,UAAyC,CACvC,OAAO,KAAK,UAAU,SAAS,CACjC,CACF,EAEA,SAAgB,EAAyB,EAA2D,CAClG,OAAO,EAAQ,IAAI,CAAmC,CACxD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PromptCacheTelemetryPort, PromptCacheTelemetrySnapshot } from "../types/cache.cjs";
|
|
2
|
+
import { Context, Service } from "@deepseek-ai/cordis";
|
|
3
|
+
//#region src/providers/promptCacheTelemetry.d.ts
|
|
4
|
+
declare const DOOM_PROMPT_CACHE_TELEMETRY_SERVICE = "doom/prompt-cache-telemetry";
|
|
5
|
+
declare class PromptCacheTelemetryService extends Service {
|
|
6
|
+
private readonly telemetry;
|
|
7
|
+
constructor(context: Context, telemetry: PromptCacheTelemetryPort);
|
|
8
|
+
snapshot(): PromptCacheTelemetrySnapshot;
|
|
9
|
+
}
|
|
10
|
+
declare function readPromptCacheTelemetry(context: Context): PromptCacheTelemetryService | undefined;
|
|
11
|
+
declare module '@deepseek-ai/cordis' {
|
|
12
|
+
interface Context {
|
|
13
|
+
'doom/prompt-cache-telemetry': PromptCacheTelemetryService;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { DOOM_PROMPT_CACHE_TELEMETRY_SERVICE, PromptCacheTelemetryService, readPromptCacheTelemetry };
|
|
18
|
+
//# sourceMappingURL=promptCacheTelemetry.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promptCacheTelemetry.d.cts","names":[],"sources":["../../src/providers/promptCacheTelemetry.ts"],"mappings":";;;cAGa;cAEA,oCAAoC;mBAG5B;EAFnB,YACE,SAAS,SACQ,WAAW;EAK9B,YAAY;;iBAKE,yBAAyB,SAAS,UAAU;;YAKhD;IACR,+BAA+B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PromptCacheTelemetryPort, PromptCacheTelemetrySnapshot } from "../types/cache.mjs";
|
|
2
|
+
import { Context, Service } from "@deepseek-ai/cordis";
|
|
3
|
+
//#region src/providers/promptCacheTelemetry.d.ts
|
|
4
|
+
declare const DOOM_PROMPT_CACHE_TELEMETRY_SERVICE = "doom/prompt-cache-telemetry";
|
|
5
|
+
declare class PromptCacheTelemetryService extends Service {
|
|
6
|
+
private readonly telemetry;
|
|
7
|
+
constructor(context: Context, telemetry: PromptCacheTelemetryPort);
|
|
8
|
+
snapshot(): PromptCacheTelemetrySnapshot;
|
|
9
|
+
}
|
|
10
|
+
declare function readPromptCacheTelemetry(context: Context): PromptCacheTelemetryService | undefined;
|
|
11
|
+
declare module '@deepseek-ai/cordis' {
|
|
12
|
+
interface Context {
|
|
13
|
+
'doom/prompt-cache-telemetry': PromptCacheTelemetryService;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { DOOM_PROMPT_CACHE_TELEMETRY_SERVICE, PromptCacheTelemetryService, readPromptCacheTelemetry };
|
|
18
|
+
//# sourceMappingURL=promptCacheTelemetry.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promptCacheTelemetry.d.mts","names":[],"sources":["../../src/providers/promptCacheTelemetry.ts"],"mappings":";;;cAGa;cAEA,oCAAoC;mBAG5B;EAFnB,YACE,SAAS,SACQ,WAAW;EAK9B,YAAY;;iBAKE,yBAAyB,SAAS,UAAU;;YAKhD;IACR,+BAA+B"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Service as e}from"@deepseek-ai/cordis";const t=`doom/prompt-cache-telemetry`;var n=class extends e{telemetry;constructor(e,n){super(e,t),this.telemetry=n}snapshot(){return this.telemetry.snapshot()}};function r(e){return e.get(t)}export{t as DOOM_PROMPT_CACHE_TELEMETRY_SERVICE,n as PromptCacheTelemetryService,r as readPromptCacheTelemetry};
|
|
2
|
+
//# sourceMappingURL=promptCacheTelemetry.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promptCacheTelemetry.mjs","names":[],"sources":["../../src/providers/promptCacheTelemetry.ts"],"sourcesContent":["import { type Context, Service } from '@deepseek-ai/cordis';\nimport type { PromptCacheTelemetryPort, PromptCacheTelemetrySnapshot } from '../types/cache.ts';\n\nexport const DOOM_PROMPT_CACHE_TELEMETRY_SERVICE = 'doom/prompt-cache-telemetry';\n\nexport class PromptCacheTelemetryService extends Service {\n constructor(\n context: Context,\n private readonly telemetry: PromptCacheTelemetryPort,\n ) {\n super(context, DOOM_PROMPT_CACHE_TELEMETRY_SERVICE);\n }\n\n snapshot(): PromptCacheTelemetrySnapshot {\n return this.telemetry.snapshot();\n }\n}\n\nexport function readPromptCacheTelemetry(context: Context): PromptCacheTelemetryService | undefined {\n return context.get(DOOM_PROMPT_CACHE_TELEMETRY_SERVICE) as PromptCacheTelemetryService | undefined;\n}\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n 'doom/prompt-cache-telemetry': PromptCacheTelemetryService;\n }\n}\n"],"mappings":"8CAGA,MAAa,EAAsC,8BAEnD,IAAa,EAAb,cAAiD,CAAQ,CAGpC,UAFnB,YACE,EACA,EACA,CACA,MAAM,EAAS,CAAmC,EAFjC,KAAA,UAAA,CAGnB,CAEA,UAAyC,CACvC,OAAO,KAAK,UAAU,SAAS,CACjC,CACF,EAEA,SAAgB,EAAyB,EAA2D,CAClG,OAAO,EAAQ,IAAI,CAAmC,CACxD"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function e(e){if(!Number.isFinite(e))throw Error(`Prompt cache identity cannot contain a non-finite number.`);return Object.is(e,-0)?0:e}function t(n){if(n===null)return null;if(typeof n==`string`)return n.normalize(`NFC`);if(typeof n==`boolean`)return n;if(typeof n==`number`)return e(n);if(Array.isArray(n))return n.map(e=>t(e));if(typeof n!=`object`)throw Error(`Unsupported prompt cache identity value: ${typeof n}.`);let r=n,i={};for(let e of Object.keys(r).sort((e,t)=>e.localeCompare(t))){let n=r[e];n!==void 0&&(i[e.normalize(`NFC`)]=t(n))}return i}function n(e){return JSON.stringify(t(e))}exports.canonicalJson=n,exports.canonicalValue=t;
|
|
2
|
+
//# sourceMappingURL=canonical.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical.cjs","names":[],"sources":["../../src/services/canonical.ts"],"sourcesContent":["export type CanonicalValue = null | boolean | number | string | readonly CanonicalValue[] | CanonicalObject;\n\nexport interface CanonicalObject {\n readonly [key: string]: CanonicalValue;\n}\n\nfunction canonicalNumber(value: number): number {\n if (!Number.isFinite(value)) throw new Error('Prompt cache identity cannot contain a non-finite number.');\n return Object.is(value, -0) ? 0 : value;\n}\n\nexport function canonicalValue(value: unknown): CanonicalValue {\n if (value === null) return null;\n if (typeof value === 'string') return value.normalize('NFC');\n if (typeof value === 'boolean') return value;\n if (typeof value === 'number') return canonicalNumber(value);\n if (Array.isArray(value)) return value.map((entry) => canonicalValue(entry));\n if (typeof value !== 'object') throw new Error(`Unsupported prompt cache identity value: ${typeof value}.`);\n\n const record = value as Readonly<Record<string, unknown>>;\n const result: Record<string, CanonicalValue> = {};\n for (const key of Object.keys(record).sort((left, right) => left.localeCompare(right))) {\n const entry = record[key];\n if (entry !== undefined) result[key.normalize('NFC')] = canonicalValue(entry);\n }\n return result;\n}\n\nexport function canonicalJson(value: unknown): string {\n return JSON.stringify(canonicalValue(value));\n}\n"],"mappings":"AAMA,SAAS,EAAgB,EAAuB,CAC9C,GAAI,CAAC,OAAO,SAAS,CAAK,EAAG,MAAU,MAAM,2DAA2D,EACxG,OAAO,OAAO,GAAG,EAAO,EAAE,EAAI,EAAI,CACpC,CAEA,SAAgB,EAAe,EAAgC,CAC7D,GAAI,IAAU,KAAM,OAAO,KAC3B,GAAI,OAAO,GAAU,SAAU,OAAO,EAAM,UAAU,KAAK,EAC3D,GAAI,OAAO,GAAU,UAAW,OAAO,EACvC,GAAI,OAAO,GAAU,SAAU,OAAO,EAAgB,CAAK,EAC3D,GAAI,MAAM,QAAQ,CAAK,EAAG,OAAO,EAAM,IAAK,GAAU,EAAe,CAAK,CAAC,EAC3E,GAAI,OAAO,GAAU,SAAU,MAAU,MAAM,4CAA4C,OAAO,EAAM,EAAE,EAE1G,IAAM,EAAS,EACT,EAAyC,CAAC,EAChD,IAAK,IAAM,KAAO,OAAO,KAAK,CAAM,CAAC,CAAC,MAAM,EAAM,IAAU,EAAK,cAAc,CAAK,CAAC,EAAG,CACtF,IAAM,EAAQ,EAAO,GACjB,IAAU,IAAA,KAAW,EAAO,EAAI,UAAU,KAAK,GAAK,EAAe,CAAK,EAC9E,CACA,OAAO,CACT,CAEA,SAAgB,EAAc,EAAwB,CACpD,OAAO,KAAK,UAAU,EAAe,CAAK,CAAC,CAC7C"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/services/canonical.d.ts
|
|
2
|
+
type CanonicalValue = null | boolean | number | string | readonly CanonicalValue[] | CanonicalObject;
|
|
3
|
+
interface CanonicalObject {
|
|
4
|
+
readonly [key: string]: CanonicalValue;
|
|
5
|
+
}
|
|
6
|
+
declare function canonicalValue(value: unknown): CanonicalValue;
|
|
7
|
+
declare function canonicalJson(value: unknown): string;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { CanonicalObject, CanonicalValue, canonicalJson, canonicalValue };
|
|
10
|
+
//# sourceMappingURL=canonical.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical.d.cts","names":[],"sources":["../../src/services/canonical.ts"],"mappings":";KAAY,6DAA6D,mBAAmB;UAE3E;YACL,cAAc;;iBAQV,eAAe,iBAAiB;iBAiBhC,cAAc"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/services/canonical.d.ts
|
|
2
|
+
type CanonicalValue = null | boolean | number | string | readonly CanonicalValue[] | CanonicalObject;
|
|
3
|
+
interface CanonicalObject {
|
|
4
|
+
readonly [key: string]: CanonicalValue;
|
|
5
|
+
}
|
|
6
|
+
declare function canonicalValue(value: unknown): CanonicalValue;
|
|
7
|
+
declare function canonicalJson(value: unknown): string;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { CanonicalObject, CanonicalValue, canonicalJson, canonicalValue };
|
|
10
|
+
//# sourceMappingURL=canonical.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical.d.mts","names":[],"sources":["../../src/services/canonical.ts"],"mappings":";KAAY,6DAA6D,mBAAmB;UAE3E;YACL,cAAc;;iBAQV,eAAe,iBAAiB;iBAiBhC,cAAc"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function e(e){if(!Number.isFinite(e))throw Error(`Prompt cache identity cannot contain a non-finite number.`);return Object.is(e,-0)?0:e}function t(n){if(n===null)return null;if(typeof n==`string`)return n.normalize(`NFC`);if(typeof n==`boolean`)return n;if(typeof n==`number`)return e(n);if(Array.isArray(n))return n.map(e=>t(e));if(typeof n!=`object`)throw Error(`Unsupported prompt cache identity value: ${typeof n}.`);let r=n,i={};for(let e of Object.keys(r).sort((e,t)=>e.localeCompare(t))){let n=r[e];n!==void 0&&(i[e.normalize(`NFC`)]=t(n))}return i}function n(e){return JSON.stringify(t(e))}export{n as canonicalJson,t as canonicalValue};
|
|
2
|
+
//# sourceMappingURL=canonical.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical.mjs","names":[],"sources":["../../src/services/canonical.ts"],"sourcesContent":["export type CanonicalValue = null | boolean | number | string | readonly CanonicalValue[] | CanonicalObject;\n\nexport interface CanonicalObject {\n readonly [key: string]: CanonicalValue;\n}\n\nfunction canonicalNumber(value: number): number {\n if (!Number.isFinite(value)) throw new Error('Prompt cache identity cannot contain a non-finite number.');\n return Object.is(value, -0) ? 0 : value;\n}\n\nexport function canonicalValue(value: unknown): CanonicalValue {\n if (value === null) return null;\n if (typeof value === 'string') return value.normalize('NFC');\n if (typeof value === 'boolean') return value;\n if (typeof value === 'number') return canonicalNumber(value);\n if (Array.isArray(value)) return value.map((entry) => canonicalValue(entry));\n if (typeof value !== 'object') throw new Error(`Unsupported prompt cache identity value: ${typeof value}.`);\n\n const record = value as Readonly<Record<string, unknown>>;\n const result: Record<string, CanonicalValue> = {};\n for (const key of Object.keys(record).sort((left, right) => left.localeCompare(right))) {\n const entry = record[key];\n if (entry !== undefined) result[key.normalize('NFC')] = canonicalValue(entry);\n }\n return result;\n}\n\nexport function canonicalJson(value: unknown): string {\n return JSON.stringify(canonicalValue(value));\n}\n"],"mappings":"AAMA,SAAS,EAAgB,EAAuB,CAC9C,GAAI,CAAC,OAAO,SAAS,CAAK,EAAG,MAAU,MAAM,2DAA2D,EACxG,OAAO,OAAO,GAAG,EAAO,EAAE,EAAI,EAAI,CACpC,CAEA,SAAgB,EAAe,EAAgC,CAC7D,GAAI,IAAU,KAAM,OAAO,KAC3B,GAAI,OAAO,GAAU,SAAU,OAAO,EAAM,UAAU,KAAK,EAC3D,GAAI,OAAO,GAAU,UAAW,OAAO,EACvC,GAAI,OAAO,GAAU,SAAU,OAAO,EAAgB,CAAK,EAC3D,GAAI,MAAM,QAAQ,CAAK,EAAG,OAAO,EAAM,IAAK,GAAU,EAAe,CAAK,CAAC,EAC3E,GAAI,OAAO,GAAU,SAAU,MAAU,MAAM,4CAA4C,OAAO,EAAM,EAAE,EAE1G,IAAM,EAAS,EACT,EAAyC,CAAC,EAChD,IAAK,IAAM,KAAO,OAAO,KAAK,CAAM,CAAC,CAAC,MAAM,EAAM,IAAU,EAAK,cAAc,CAAK,CAAC,EAAG,CACtF,IAAM,EAAQ,EAAO,GACjB,IAAU,IAAA,KAAW,EAAO,EAAI,UAAU,KAAK,GAAK,EAAe,CAAK,EAC9E,CACA,OAAO,CACT,CAEA,SAAgB,EAAc,EAAwB,CACpD,OAAO,KAAK,UAAU,EAAe,CAAK,CAAC,CAC7C"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./canonical.cjs");function t(t,n,r){return`${t}${r(e.canonicalJson(n))}`}function n(e){return e?.trim().replaceAll(`\\`,`/`)||void 0}function r(e){return e.filter(({activation:e})=>e===`active`||e===`activating`).map(({source:e,id:t,modelContextVariant:n})=>({source:e,id:t,...n?{modelContextVariant:n}:{}})).sort((e,t)=>e.source.localeCompare(t.source)||e.id.localeCompare(t.id))}function i(e,n){return t(`dpr1_`,{version:1,rootSessionId:e},n)}function a(e,a){return t(`dpn1_`,{version:1,rootSession:i(e.rootSessionId,a),compositionFingerprint:e.compositionFingerprint??null,majorMode:e.majorMode,domains:[...e.domains],profile:e.profile??null,persona:n(e.persona)??null,minorModes:r(e.minorModes)},a)}function o(e,n){return t(`dch1_`,{version:1,systemPrompt:e.systemPrompt??null,tools:[...e.tools],excludedTools:[...e.excludedTools].sort((e,t)=>e.localeCompare(t)),extensions:[...e.extensions],inheritProjectContext:e.inheritProjectContext??null,inheritSkills:e.inheritSkills??null,fanout:e.fanout??null,structuredOutputSchema:e.structuredOutputSchema??null},n)}function s(e,n){return t(`dpm1_`,{version:1,virtualProvider:e.virtualProvider??null,virtualModel:e.virtualModel??null,api:e.api??null,baseUrl:e.baseUrl??null,wireModel:e.wireModel??null},n)}function c(e,n,r,i,a){return t(`dpc1_`,{version:1,parentNamespace:e,scope:n,childProjection:a??null,modelFingerprint:r},i)}exports.createChildPromptCacheProjection=o,exports.createParentPromptCacheNamespace=a,exports.createPromptCacheKey=c,exports.createPromptCacheModelFingerprint=s,exports.createRootSessionIdentity=i;
|
|
2
|
+
//# sourceMappingURL=namespace.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespace.cjs","names":["canonicalJson"],"sources":["../../src/services/namespace.ts"],"sourcesContent":["import type {\n PromptCacheChildProjection,\n PromptCacheDigest,\n PromptCacheMinorModeState,\n PromptCacheModelIdentity,\n PromptCacheParentState,\n} from '../types/cache.ts';\nimport { canonicalJson } from './canonical.ts';\n\nconst KEY_PREFIX = 'dpc1_';\nconst PARENT_PREFIX = 'dpn1_';\nconst CHILD_PREFIX = 'dch1_';\nconst ROOT_PREFIX = 'dpr1_';\nconst MODEL_PREFIX = 'dpm1_';\n\nfunction digestIdentity(prefix: string, value: unknown, digest: PromptCacheDigest): string {\n return `${prefix}${digest(canonicalJson(value))}`;\n}\n\nfunction normalizedPersona(value: string | undefined): string | undefined {\n const normalized = value?.trim().replaceAll('\\\\', '/');\n return normalized || undefined;\n}\n\nfunction activeMinorModes(modes: readonly PromptCacheMinorModeState[]): readonly Record<string, string>[] {\n return modes\n .filter(({ activation }) => activation === 'active' || activation === 'activating')\n .map(({ source, id, modelContextVariant }) => ({\n source,\n id,\n ...(modelContextVariant ? { modelContextVariant } : {}),\n }))\n .sort((left, right) => left.source.localeCompare(right.source) || left.id.localeCompare(right.id));\n}\n\nexport function createRootSessionIdentity(rootSessionId: string, digest: PromptCacheDigest): string {\n return digestIdentity(ROOT_PREFIX, { version: 1, rootSessionId }, digest);\n}\n\nexport function createParentPromptCacheNamespace(state: PromptCacheParentState, digest: PromptCacheDigest): string {\n return digestIdentity(\n PARENT_PREFIX,\n {\n version: 1,\n rootSession: createRootSessionIdentity(state.rootSessionId, digest),\n compositionFingerprint: state.compositionFingerprint ?? null,\n majorMode: state.majorMode,\n domains: [...state.domains],\n profile: state.profile ?? null,\n persona: normalizedPersona(state.persona) ?? null,\n minorModes: activeMinorModes(state.minorModes),\n },\n digest,\n );\n}\n\nexport function createChildPromptCacheProjection(\n projection: PromptCacheChildProjection,\n digest: PromptCacheDigest,\n): string {\n return digestIdentity(\n CHILD_PREFIX,\n {\n version: 1,\n systemPrompt: projection.systemPrompt ?? null,\n tools: [...projection.tools],\n excludedTools: [...projection.excludedTools].sort((left, right) => left.localeCompare(right)),\n extensions: [...projection.extensions],\n inheritProjectContext: projection.inheritProjectContext ?? null,\n inheritSkills: projection.inheritSkills ?? null,\n fanout: projection.fanout ?? null,\n structuredOutputSchema: projection.structuredOutputSchema ?? null,\n },\n digest,\n );\n}\n\nexport function createPromptCacheModelFingerprint(model: PromptCacheModelIdentity, digest: PromptCacheDigest): string {\n return digestIdentity(\n MODEL_PREFIX,\n {\n version: 1,\n virtualProvider: model.virtualProvider ?? null,\n virtualModel: model.virtualModel ?? null,\n api: model.api ?? null,\n baseUrl: model.baseUrl ?? null,\n wireModel: model.wireModel ?? null,\n },\n digest,\n );\n}\n\nexport function createPromptCacheKey(\n parentNamespace: string,\n scope: 'parent' | 'child',\n modelFingerprint: string,\n digest: PromptCacheDigest,\n childProjection?: string,\n): string {\n return digestIdentity(\n KEY_PREFIX,\n {\n version: 1,\n parentNamespace,\n scope,\n childProjection: childProjection ?? null,\n modelFingerprint,\n },\n digest,\n );\n}\n"],"mappings":"mCAeA,SAAS,EAAe,EAAgB,EAAgB,EAAmC,CACzF,MAAO,GAAG,IAAS,EAAOA,EAAAA,cAAc,CAAK,CAAC,GAChD,CAEA,SAAS,EAAkB,EAA+C,CAExE,OADmB,GAAO,KAAK,CAAC,CAAC,WAAW,KAAM,GAAG,GAChC,IAAA,EACvB,CAEA,SAAS,EAAiB,EAAgF,CACxG,OAAO,EACJ,QAAQ,CAAE,gBAAiB,IAAe,UAAY,IAAe,YAAY,CAAC,CAClF,KAAK,CAAE,SAAQ,KAAI,0BAA2B,CAC7C,SACA,KACA,GAAI,EAAsB,CAAE,qBAAoB,EAAI,CAAC,CACvD,EAAE,CAAC,CACF,MAAM,EAAM,IAAU,EAAK,OAAO,cAAc,EAAM,MAAM,GAAK,EAAK,GAAG,cAAc,EAAM,EAAE,CAAC,CACrG,CAEA,SAAgB,EAA0B,EAAuB,EAAmC,CAClG,OAAO,EAAe,QAAa,CAAE,QAAS,EAAG,eAAc,EAAG,CAAM,CAC1E,CAEA,SAAgB,EAAiC,EAA+B,EAAmC,CACjH,OAAO,EACL,QACA,CACE,QAAS,EACT,YAAa,EAA0B,EAAM,cAAe,CAAM,EAClE,uBAAwB,EAAM,wBAA0B,KACxD,UAAW,EAAM,UACjB,QAAS,CAAC,GAAG,EAAM,OAAO,EAC1B,QAAS,EAAM,SAAW,KAC1B,QAAS,EAAkB,EAAM,OAAO,GAAK,KAC7C,WAAY,EAAiB,EAAM,UAAU,CAC/C,EACA,CACF,CACF,CAEA,SAAgB,EACd,EACA,EACQ,CACR,OAAO,EACL,QACA,CACE,QAAS,EACT,aAAc,EAAW,cAAgB,KACzC,MAAO,CAAC,GAAG,EAAW,KAAK,EAC3B,cAAe,CAAC,GAAG,EAAW,aAAa,CAAC,CAAC,MAAM,EAAM,IAAU,EAAK,cAAc,CAAK,CAAC,EAC5F,WAAY,CAAC,GAAG,EAAW,UAAU,EACrC,sBAAuB,EAAW,uBAAyB,KAC3D,cAAe,EAAW,eAAiB,KAC3C,OAAQ,EAAW,QAAU,KAC7B,uBAAwB,EAAW,wBAA0B,IAC/D,EACA,CACF,CACF,CAEA,SAAgB,EAAkC,EAAiC,EAAmC,CACpH,OAAO,EACL,QACA,CACE,QAAS,EACT,gBAAiB,EAAM,iBAAmB,KAC1C,aAAc,EAAM,cAAgB,KACpC,IAAK,EAAM,KAAO,KAClB,QAAS,EAAM,SAAW,KAC1B,UAAW,EAAM,WAAa,IAChC,EACA,CACF,CACF,CAEA,SAAgB,EACd,EACA,EACA,EACA,EACA,EACQ,CACR,OAAO,EACL,QACA,CACE,QAAS,EACT,kBACA,QACA,gBAAiB,GAAmB,KACpC,kBACF,EACA,CACF,CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PromptCacheChildProjection, PromptCacheDigest, PromptCacheModelIdentity, PromptCacheParentState } from "../types/cache.cjs";
|
|
2
|
+
//#region src/services/namespace.d.ts
|
|
3
|
+
declare function createRootSessionIdentity(rootSessionId: string, digest: PromptCacheDigest): string;
|
|
4
|
+
declare function createParentPromptCacheNamespace(state: PromptCacheParentState, digest: PromptCacheDigest): string;
|
|
5
|
+
declare function createChildPromptCacheProjection(projection: PromptCacheChildProjection, digest: PromptCacheDigest): string;
|
|
6
|
+
declare function createPromptCacheModelFingerprint(model: PromptCacheModelIdentity, digest: PromptCacheDigest): string;
|
|
7
|
+
declare function createPromptCacheKey(parentNamespace: string, scope: 'parent' | 'child', modelFingerprint: string, digest: PromptCacheDigest, childProjection?: string): string;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { createChildPromptCacheProjection, createParentPromptCacheNamespace, createPromptCacheKey, createPromptCacheModelFingerprint, createRootSessionIdentity };
|
|
10
|
+
//# sourceMappingURL=namespace.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespace.d.cts","names":[],"sources":["../../src/services/namespace.ts"],"mappings":";;iBAmCgB,0BAA0B,uBAAuB,QAAQ;iBAIzD,iCAAiC,OAAO,wBAAwB,QAAQ;iBAiBxE,iCACd,YAAY,4BACZ,QAAQ;iBAmBM,kCAAkC,OAAO,0BAA0B,QAAQ;iBAe3E,qBACd,yBACA,2BACA,0BACA,QAAQ,mBACR"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PromptCacheChildProjection, PromptCacheDigest, PromptCacheModelIdentity, PromptCacheParentState } from "../types/cache.mjs";
|
|
2
|
+
//#region src/services/namespace.d.ts
|
|
3
|
+
declare function createRootSessionIdentity(rootSessionId: string, digest: PromptCacheDigest): string;
|
|
4
|
+
declare function createParentPromptCacheNamespace(state: PromptCacheParentState, digest: PromptCacheDigest): string;
|
|
5
|
+
declare function createChildPromptCacheProjection(projection: PromptCacheChildProjection, digest: PromptCacheDigest): string;
|
|
6
|
+
declare function createPromptCacheModelFingerprint(model: PromptCacheModelIdentity, digest: PromptCacheDigest): string;
|
|
7
|
+
declare function createPromptCacheKey(parentNamespace: string, scope: 'parent' | 'child', modelFingerprint: string, digest: PromptCacheDigest, childProjection?: string): string;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { createChildPromptCacheProjection, createParentPromptCacheNamespace, createPromptCacheKey, createPromptCacheModelFingerprint, createRootSessionIdentity };
|
|
10
|
+
//# sourceMappingURL=namespace.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespace.d.mts","names":[],"sources":["../../src/services/namespace.ts"],"mappings":";;iBAmCgB,0BAA0B,uBAAuB,QAAQ;iBAIzD,iCAAiC,OAAO,wBAAwB,QAAQ;iBAiBxE,iCACd,YAAY,4BACZ,QAAQ;iBAmBM,kCAAkC,OAAO,0BAA0B,QAAQ;iBAe3E,qBACd,yBACA,2BACA,0BACA,QAAQ,mBACR"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{canonicalJson as e}from"./canonical.mjs";function t(t,n,r){return`${t}${r(e(n))}`}function n(e){return e?.trim().replaceAll(`\\`,`/`)||void 0}function r(e){return e.filter(({activation:e})=>e===`active`||e===`activating`).map(({source:e,id:t,modelContextVariant:n})=>({source:e,id:t,...n?{modelContextVariant:n}:{}})).sort((e,t)=>e.source.localeCompare(t.source)||e.id.localeCompare(t.id))}function i(e,n){return t(`dpr1_`,{version:1,rootSessionId:e},n)}function a(e,a){return t(`dpn1_`,{version:1,rootSession:i(e.rootSessionId,a),compositionFingerprint:e.compositionFingerprint??null,majorMode:e.majorMode,domains:[...e.domains],profile:e.profile??null,persona:n(e.persona)??null,minorModes:r(e.minorModes)},a)}function o(e,n){return t(`dch1_`,{version:1,systemPrompt:e.systemPrompt??null,tools:[...e.tools],excludedTools:[...e.excludedTools].sort((e,t)=>e.localeCompare(t)),extensions:[...e.extensions],inheritProjectContext:e.inheritProjectContext??null,inheritSkills:e.inheritSkills??null,fanout:e.fanout??null,structuredOutputSchema:e.structuredOutputSchema??null},n)}function s(e,n){return t(`dpm1_`,{version:1,virtualProvider:e.virtualProvider??null,virtualModel:e.virtualModel??null,api:e.api??null,baseUrl:e.baseUrl??null,wireModel:e.wireModel??null},n)}function c(e,n,r,i,a){return t(`dpc1_`,{version:1,parentNamespace:e,scope:n,childProjection:a??null,modelFingerprint:r},i)}export{o as createChildPromptCacheProjection,a as createParentPromptCacheNamespace,c as createPromptCacheKey,s as createPromptCacheModelFingerprint,i as createRootSessionIdentity};
|
|
2
|
+
//# sourceMappingURL=namespace.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespace.mjs","names":[],"sources":["../../src/services/namespace.ts"],"sourcesContent":["import type {\n PromptCacheChildProjection,\n PromptCacheDigest,\n PromptCacheMinorModeState,\n PromptCacheModelIdentity,\n PromptCacheParentState,\n} from '../types/cache.ts';\nimport { canonicalJson } from './canonical.ts';\n\nconst KEY_PREFIX = 'dpc1_';\nconst PARENT_PREFIX = 'dpn1_';\nconst CHILD_PREFIX = 'dch1_';\nconst ROOT_PREFIX = 'dpr1_';\nconst MODEL_PREFIX = 'dpm1_';\n\nfunction digestIdentity(prefix: string, value: unknown, digest: PromptCacheDigest): string {\n return `${prefix}${digest(canonicalJson(value))}`;\n}\n\nfunction normalizedPersona(value: string | undefined): string | undefined {\n const normalized = value?.trim().replaceAll('\\\\', '/');\n return normalized || undefined;\n}\n\nfunction activeMinorModes(modes: readonly PromptCacheMinorModeState[]): readonly Record<string, string>[] {\n return modes\n .filter(({ activation }) => activation === 'active' || activation === 'activating')\n .map(({ source, id, modelContextVariant }) => ({\n source,\n id,\n ...(modelContextVariant ? { modelContextVariant } : {}),\n }))\n .sort((left, right) => left.source.localeCompare(right.source) || left.id.localeCompare(right.id));\n}\n\nexport function createRootSessionIdentity(rootSessionId: string, digest: PromptCacheDigest): string {\n return digestIdentity(ROOT_PREFIX, { version: 1, rootSessionId }, digest);\n}\n\nexport function createParentPromptCacheNamespace(state: PromptCacheParentState, digest: PromptCacheDigest): string {\n return digestIdentity(\n PARENT_PREFIX,\n {\n version: 1,\n rootSession: createRootSessionIdentity(state.rootSessionId, digest),\n compositionFingerprint: state.compositionFingerprint ?? null,\n majorMode: state.majorMode,\n domains: [...state.domains],\n profile: state.profile ?? null,\n persona: normalizedPersona(state.persona) ?? null,\n minorModes: activeMinorModes(state.minorModes),\n },\n digest,\n );\n}\n\nexport function createChildPromptCacheProjection(\n projection: PromptCacheChildProjection,\n digest: PromptCacheDigest,\n): string {\n return digestIdentity(\n CHILD_PREFIX,\n {\n version: 1,\n systemPrompt: projection.systemPrompt ?? null,\n tools: [...projection.tools],\n excludedTools: [...projection.excludedTools].sort((left, right) => left.localeCompare(right)),\n extensions: [...projection.extensions],\n inheritProjectContext: projection.inheritProjectContext ?? null,\n inheritSkills: projection.inheritSkills ?? null,\n fanout: projection.fanout ?? null,\n structuredOutputSchema: projection.structuredOutputSchema ?? null,\n },\n digest,\n );\n}\n\nexport function createPromptCacheModelFingerprint(model: PromptCacheModelIdentity, digest: PromptCacheDigest): string {\n return digestIdentity(\n MODEL_PREFIX,\n {\n version: 1,\n virtualProvider: model.virtualProvider ?? null,\n virtualModel: model.virtualModel ?? null,\n api: model.api ?? null,\n baseUrl: model.baseUrl ?? null,\n wireModel: model.wireModel ?? null,\n },\n digest,\n );\n}\n\nexport function createPromptCacheKey(\n parentNamespace: string,\n scope: 'parent' | 'child',\n modelFingerprint: string,\n digest: PromptCacheDigest,\n childProjection?: string,\n): string {\n return digestIdentity(\n KEY_PREFIX,\n {\n version: 1,\n parentNamespace,\n scope,\n childProjection: childProjection ?? null,\n modelFingerprint,\n },\n digest,\n );\n}\n"],"mappings":"gDAeA,SAAS,EAAe,EAAgB,EAAgB,EAAmC,CACzF,MAAO,GAAG,IAAS,EAAO,EAAc,CAAK,CAAC,GAChD,CAEA,SAAS,EAAkB,EAA+C,CAExE,OADmB,GAAO,KAAK,CAAC,CAAC,WAAW,KAAM,GAAG,GAChC,IAAA,EACvB,CAEA,SAAS,EAAiB,EAAgF,CACxG,OAAO,EACJ,QAAQ,CAAE,gBAAiB,IAAe,UAAY,IAAe,YAAY,CAAC,CAClF,KAAK,CAAE,SAAQ,KAAI,0BAA2B,CAC7C,SACA,KACA,GAAI,EAAsB,CAAE,qBAAoB,EAAI,CAAC,CACvD,EAAE,CAAC,CACF,MAAM,EAAM,IAAU,EAAK,OAAO,cAAc,EAAM,MAAM,GAAK,EAAK,GAAG,cAAc,EAAM,EAAE,CAAC,CACrG,CAEA,SAAgB,EAA0B,EAAuB,EAAmC,CAClG,OAAO,EAAe,QAAa,CAAE,QAAS,EAAG,eAAc,EAAG,CAAM,CAC1E,CAEA,SAAgB,EAAiC,EAA+B,EAAmC,CACjH,OAAO,EACL,QACA,CACE,QAAS,EACT,YAAa,EAA0B,EAAM,cAAe,CAAM,EAClE,uBAAwB,EAAM,wBAA0B,KACxD,UAAW,EAAM,UACjB,QAAS,CAAC,GAAG,EAAM,OAAO,EAC1B,QAAS,EAAM,SAAW,KAC1B,QAAS,EAAkB,EAAM,OAAO,GAAK,KAC7C,WAAY,EAAiB,EAAM,UAAU,CAC/C,EACA,CACF,CACF,CAEA,SAAgB,EACd,EACA,EACQ,CACR,OAAO,EACL,QACA,CACE,QAAS,EACT,aAAc,EAAW,cAAgB,KACzC,MAAO,CAAC,GAAG,EAAW,KAAK,EAC3B,cAAe,CAAC,GAAG,EAAW,aAAa,CAAC,CAAC,MAAM,EAAM,IAAU,EAAK,cAAc,CAAK,CAAC,EAC5F,WAAY,CAAC,GAAG,EAAW,UAAU,EACrC,sBAAuB,EAAW,uBAAyB,KAC3D,cAAe,EAAW,eAAiB,KAC3C,OAAQ,EAAW,QAAU,KAC7B,uBAAwB,EAAW,wBAA0B,IAC/D,EACA,CACF,CACF,CAEA,SAAgB,EAAkC,EAAiC,EAAmC,CACpH,OAAO,EACL,QACA,CACE,QAAS,EACT,gBAAiB,EAAM,iBAAmB,KAC1C,aAAc,EAAM,cAAgB,KACpC,IAAK,EAAM,KAAO,KAClB,QAAS,EAAM,SAAW,KAC1B,UAAW,EAAM,WAAa,IAChC,EACA,CACF,CACF,CAEA,SAAgB,EACd,EACA,EACA,EACA,EACA,EACQ,CACR,OAAO,EACL,QACA,CACE,QAAS,EACT,kBACA,QACA,gBAAiB,GAAmB,KACpC,kBACF,EACA,CACF,CACF"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=new Set([`openai-completions`,`openai-responses`,`openai-codex-responses`,`azure-openai-responses`]),t=new Set([`anthropic-messages`,`bedrock-converse-stream`]),n=new Set([`google-generative-ai`,`google-vertex`,`google-vertex-anthropic`]);function r(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function i(r){return r.api===`openai-responses`||r.api===`openai-completions`?r.virtualProvider===`openai`?`key-and-long-retention`:`key-only`:r.api&&e.has(r.api)?`key-only`:r.api&&t.has(r.api)?`marker-only`:r.api&&n.has(r.api)?`automatic`:`unknown`}function a(t,n,i,a){if(!a||!n||!e.has(n)||!r(t))return;let o=t.prompt_cache_key;if(!(typeof o!=`string`||!o.trim()||o===i))return{...t,prompt_cache_key:i}}function o(e){if(!r(e))return;let t=e.prompt_cache_retention;return typeof t==`string`&&t.trim()?t.trim():void 0}exports.classifyPromptCacheCapability=i,exports.requestedPromptCacheRetention=o,exports.rewritePromptCacheKey=a;
|
|
2
|
+
//# sourceMappingURL=providerPolicy.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providerPolicy.cjs","names":[],"sources":["../../src/services/providerPolicy.ts"],"sourcesContent":["import type { PromptCacheCapabilityClass, PromptCacheModelIdentity } from '../types/cache.ts';\n\nconst ROUTING_KEY_APIS = new Set([\n 'openai-completions',\n 'openai-responses',\n 'openai-codex-responses',\n 'azure-openai-responses',\n]);\n\nconst MARKER_APIS = new Set(['anthropic-messages', 'bedrock-converse-stream']);\nconst AUTOMATIC_APIS = new Set(['google-generative-ai', 'google-vertex', 'google-vertex-anthropic']);\n\nfunction isRecord(value: unknown): value is Readonly<Record<string, unknown>> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nexport function classifyPromptCacheCapability(model: PromptCacheModelIdentity): PromptCacheCapabilityClass {\n if (model.api === 'openai-responses' || model.api === 'openai-completions') {\n return model.virtualProvider === 'openai' ? 'key-and-long-retention' : 'key-only';\n }\n if (model.api && ROUTING_KEY_APIS.has(model.api)) return 'key-only';\n if (model.api && MARKER_APIS.has(model.api)) return 'marker-only';\n if (model.api && AUTOMATIC_APIS.has(model.api)) return 'automatic';\n return 'unknown';\n}\n\nexport function rewritePromptCacheKey(\n payload: unknown,\n api: string | undefined,\n key: string,\n enabled: boolean,\n): Record<string, unknown> | undefined {\n if (!enabled || !api || !ROUTING_KEY_APIS.has(api) || !isRecord(payload)) return undefined;\n const current = payload.prompt_cache_key;\n if (typeof current !== 'string' || !current.trim() || current === key) return undefined;\n return { ...payload, prompt_cache_key: key };\n}\n\nexport function requestedPromptCacheRetention(payload: unknown): string | undefined {\n if (!isRecord(payload)) return undefined;\n const retention = payload.prompt_cache_retention;\n return typeof retention === 'string' && retention.trim() ? retention.trim() : undefined;\n}\n"],"mappings":"AAEA,MAAM,EAAmB,IAAI,IAAI,CAC/B,qBACA,mBACA,yBACA,wBACF,CAAC,EAEK,EAAc,IAAI,IAAI,CAAC,qBAAsB,yBAAyB,CAAC,EACvE,EAAiB,IAAI,IAAI,CAAC,uBAAwB,gBAAiB,yBAAyB,CAAC,EAEnG,SAAS,EAAS,EAA4D,CAC5E,OAAO,OAAO,GAAU,YAAY,GAAkB,CAAC,MAAM,QAAQ,CAAK,CAC5E,CAEA,SAAgB,EAA8B,EAA6D,CAOzG,OANI,EAAM,MAAQ,oBAAsB,EAAM,MAAQ,qBAC7C,EAAM,kBAAoB,SAAW,yBAA2B,WAErE,EAAM,KAAO,EAAiB,IAAI,EAAM,GAAG,EAAU,WACrD,EAAM,KAAO,EAAY,IAAI,EAAM,GAAG,EAAU,cAChD,EAAM,KAAO,EAAe,IAAI,EAAM,GAAG,EAAU,YAChD,SACT,CAEA,SAAgB,EACd,EACA,EACA,EACA,EACqC,CACrC,GAAI,CAAC,GAAW,CAAC,GAAO,CAAC,EAAiB,IAAI,CAAG,GAAK,CAAC,EAAS,CAAO,EAAG,OAC1E,IAAM,EAAU,EAAQ,iBACpB,YAAO,GAAY,UAAY,CAAC,EAAQ,KAAK,GAAK,IAAY,GAClE,MAAO,CAAE,GAAG,EAAS,iBAAkB,CAAI,CAC7C,CAEA,SAAgB,EAA8B,EAAsC,CAClF,GAAI,CAAC,EAAS,CAAO,EAAG,OACxB,IAAM,EAAY,EAAQ,uBAC1B,OAAO,OAAO,GAAc,UAAY,EAAU,KAAK,EAAI,EAAU,KAAK,EAAI,IAAA,EAChF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PromptCacheCapabilityClass, PromptCacheModelIdentity } from "../types/cache.cjs";
|
|
2
|
+
//#region src/services/providerPolicy.d.ts
|
|
3
|
+
declare function classifyPromptCacheCapability(model: PromptCacheModelIdentity): PromptCacheCapabilityClass;
|
|
4
|
+
declare function rewritePromptCacheKey(payload: unknown, api: string | undefined, key: string, enabled: boolean): Record<string, unknown> | undefined;
|
|
5
|
+
declare function requestedPromptCacheRetention(payload: unknown): string | undefined;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { classifyPromptCacheCapability, requestedPromptCacheRetention, rewritePromptCacheKey };
|
|
8
|
+
//# sourceMappingURL=providerPolicy.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providerPolicy.d.cts","names":[],"sources":["../../src/services/providerPolicy.ts"],"mappings":";;iBAgBgB,8BAA8B,OAAO,2BAA2B;iBAUhE,sBACd,kBACA,yBACA,aACA,mBACC;iBAOa,8BAA8B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PromptCacheCapabilityClass, PromptCacheModelIdentity } from "../types/cache.mjs";
|
|
2
|
+
//#region src/services/providerPolicy.d.ts
|
|
3
|
+
declare function classifyPromptCacheCapability(model: PromptCacheModelIdentity): PromptCacheCapabilityClass;
|
|
4
|
+
declare function rewritePromptCacheKey(payload: unknown, api: string | undefined, key: string, enabled: boolean): Record<string, unknown> | undefined;
|
|
5
|
+
declare function requestedPromptCacheRetention(payload: unknown): string | undefined;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { classifyPromptCacheCapability, requestedPromptCacheRetention, rewritePromptCacheKey };
|
|
8
|
+
//# sourceMappingURL=providerPolicy.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providerPolicy.d.mts","names":[],"sources":["../../src/services/providerPolicy.ts"],"mappings":";;iBAgBgB,8BAA8B,OAAO,2BAA2B;iBAUhE,sBACd,kBACA,yBACA,aACA,mBACC;iBAOa,8BAA8B"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=new Set([`openai-completions`,`openai-responses`,`openai-codex-responses`,`azure-openai-responses`]),t=new Set([`anthropic-messages`,`bedrock-converse-stream`]),n=new Set([`google-generative-ai`,`google-vertex`,`google-vertex-anthropic`]);function r(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function i(r){return r.api===`openai-responses`||r.api===`openai-completions`?r.virtualProvider===`openai`?`key-and-long-retention`:`key-only`:r.api&&e.has(r.api)?`key-only`:r.api&&t.has(r.api)?`marker-only`:r.api&&n.has(r.api)?`automatic`:`unknown`}function a(t,n,i,a){if(!a||!n||!e.has(n)||!r(t))return;let o=t.prompt_cache_key;if(!(typeof o!=`string`||!o.trim()||o===i))return{...t,prompt_cache_key:i}}function o(e){if(!r(e))return;let t=e.prompt_cache_retention;return typeof t==`string`&&t.trim()?t.trim():void 0}export{i as classifyPromptCacheCapability,o as requestedPromptCacheRetention,a as rewritePromptCacheKey};
|
|
2
|
+
//# sourceMappingURL=providerPolicy.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providerPolicy.mjs","names":[],"sources":["../../src/services/providerPolicy.ts"],"sourcesContent":["import type { PromptCacheCapabilityClass, PromptCacheModelIdentity } from '../types/cache.ts';\n\nconst ROUTING_KEY_APIS = new Set([\n 'openai-completions',\n 'openai-responses',\n 'openai-codex-responses',\n 'azure-openai-responses',\n]);\n\nconst MARKER_APIS = new Set(['anthropic-messages', 'bedrock-converse-stream']);\nconst AUTOMATIC_APIS = new Set(['google-generative-ai', 'google-vertex', 'google-vertex-anthropic']);\n\nfunction isRecord(value: unknown): value is Readonly<Record<string, unknown>> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nexport function classifyPromptCacheCapability(model: PromptCacheModelIdentity): PromptCacheCapabilityClass {\n if (model.api === 'openai-responses' || model.api === 'openai-completions') {\n return model.virtualProvider === 'openai' ? 'key-and-long-retention' : 'key-only';\n }\n if (model.api && ROUTING_KEY_APIS.has(model.api)) return 'key-only';\n if (model.api && MARKER_APIS.has(model.api)) return 'marker-only';\n if (model.api && AUTOMATIC_APIS.has(model.api)) return 'automatic';\n return 'unknown';\n}\n\nexport function rewritePromptCacheKey(\n payload: unknown,\n api: string | undefined,\n key: string,\n enabled: boolean,\n): Record<string, unknown> | undefined {\n if (!enabled || !api || !ROUTING_KEY_APIS.has(api) || !isRecord(payload)) return undefined;\n const current = payload.prompt_cache_key;\n if (typeof current !== 'string' || !current.trim() || current === key) return undefined;\n return { ...payload, prompt_cache_key: key };\n}\n\nexport function requestedPromptCacheRetention(payload: unknown): string | undefined {\n if (!isRecord(payload)) return undefined;\n const retention = payload.prompt_cache_retention;\n return typeof retention === 'string' && retention.trim() ? retention.trim() : undefined;\n}\n"],"mappings":"AAEA,MAAM,EAAmB,IAAI,IAAI,CAC/B,qBACA,mBACA,yBACA,wBACF,CAAC,EAEK,EAAc,IAAI,IAAI,CAAC,qBAAsB,yBAAyB,CAAC,EACvE,EAAiB,IAAI,IAAI,CAAC,uBAAwB,gBAAiB,yBAAyB,CAAC,EAEnG,SAAS,EAAS,EAA4D,CAC5E,OAAO,OAAO,GAAU,YAAY,GAAkB,CAAC,MAAM,QAAQ,CAAK,CAC5E,CAEA,SAAgB,EAA8B,EAA6D,CAOzG,OANI,EAAM,MAAQ,oBAAsB,EAAM,MAAQ,qBAC7C,EAAM,kBAAoB,SAAW,yBAA2B,WAErE,EAAM,KAAO,EAAiB,IAAI,EAAM,GAAG,EAAU,WACrD,EAAM,KAAO,EAAY,IAAI,EAAM,GAAG,EAAU,cAChD,EAAM,KAAO,EAAe,IAAI,EAAM,GAAG,EAAU,YAChD,SACT,CAEA,SAAgB,EACd,EACA,EACA,EACA,EACqC,CACrC,GAAI,CAAC,GAAW,CAAC,GAAO,CAAC,EAAiB,IAAI,CAAG,GAAK,CAAC,EAAS,CAAO,EAAG,OAC1E,IAAM,EAAU,EAAQ,iBACpB,YAAO,GAAY,UAAY,CAAC,EAAQ,KAAK,GAAK,IAAY,GAClE,MAAO,CAAE,GAAG,EAAS,iBAAkB,CAAI,CAC7C,CAEA,SAAgB,EAA8B,EAAsC,CAClF,GAAI,CAAC,EAAS,CAAO,EAAG,OACxB,IAAM,EAAY,EAAQ,uBAC1B,OAAO,OAAO,GAAc,UAAY,EAAU,KAAK,EAAI,EAAU,KAAK,EAAI,IAAA,EAChF"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
function e(e){let t=e.lastObservation;return t?`Last provider observation: cacheRead=${t.cacheRead}, cacheWrite=${t.cacheWrite}, input=${t.totalInput}`:`Last provider observation: none`}function t(t){return[`DoomPi provider prompt cache`,`Capability: ${t.capability}`,`Requested retention: ${t.requestedRetention??`provider default`}`,`Namespace key: ${t.keySuffix?`…${t.keySuffix}`:`unavailable`}`,e(t),`Current provider residency: unknown`,`UI CH and optimizer counters are aggregate reuse metrics, not residency guarantees.`].join(`
|
|
2
|
+
`)}exports.formatPromptCacheStatus=t;
|
|
3
|
+
//# sourceMappingURL=status.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.cjs","names":[],"sources":["../../src/services/status.ts"],"sourcesContent":["import type { PromptCacheTelemetrySnapshot } from '../types/cache.ts';\n\nfunction observationLine(snapshot: PromptCacheTelemetrySnapshot): string {\n const observation = snapshot.lastObservation;\n if (!observation) return 'Last provider observation: none';\n return `Last provider observation: cacheRead=${observation.cacheRead}, cacheWrite=${observation.cacheWrite}, input=${observation.totalInput}`;\n}\n\nexport function formatPromptCacheStatus(snapshot: PromptCacheTelemetrySnapshot): string {\n return [\n 'DoomPi provider prompt cache',\n `Capability: ${snapshot.capability}`,\n `Requested retention: ${snapshot.requestedRetention ?? 'provider default'}`,\n `Namespace key: ${snapshot.keySuffix ? `…${snapshot.keySuffix}` : 'unavailable'}`,\n observationLine(snapshot),\n 'Current provider residency: unknown',\n 'UI CH and optimizer counters are aggregate reuse metrics, not residency guarantees.',\n ].join('\\n');\n}\n"],"mappings":"AAEA,SAAS,EAAgB,EAAgD,CACvE,IAAM,EAAc,EAAS,gBAE7B,OADK,EACE,wCAAwC,EAAY,UAAU,eAAe,EAAY,WAAW,UAAU,EAAY,aADxG,iCAE3B,CAEA,SAAgB,EAAwB,EAAgD,CACtF,MAAO,CACL,+BACA,eAAe,EAAS,aACxB,wBAAwB,EAAS,oBAAsB,qBACvD,kBAAkB,EAAS,UAAY,IAAI,EAAS,YAAc,gBAClE,EAAgB,CAAQ,EACxB,sCACA,qFACF,CAAC,CAAC,KAAK;CAAI,CACb"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PromptCacheTelemetrySnapshot } from "../types/cache.cjs";
|
|
2
|
+
//#region src/services/status.d.ts
|
|
3
|
+
declare function formatPromptCacheStatus(snapshot: PromptCacheTelemetrySnapshot): string;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { formatPromptCacheStatus };
|
|
6
|
+
//# sourceMappingURL=status.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.cts","names":[],"sources":["../../src/services/status.ts"],"mappings":";;iBAQgB,wBAAwB,UAAU"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PromptCacheTelemetrySnapshot } from "../types/cache.mjs";
|
|
2
|
+
//#region src/services/status.d.ts
|
|
3
|
+
declare function formatPromptCacheStatus(snapshot: PromptCacheTelemetrySnapshot): string;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { formatPromptCacheStatus };
|
|
6
|
+
//# sourceMappingURL=status.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.mts","names":[],"sources":["../../src/services/status.ts"],"mappings":";;iBAQgB,wBAAwB,UAAU"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
function e(e){let t=e.lastObservation;return t?`Last provider observation: cacheRead=${t.cacheRead}, cacheWrite=${t.cacheWrite}, input=${t.totalInput}`:`Last provider observation: none`}function t(t){return[`DoomPi provider prompt cache`,`Capability: ${t.capability}`,`Requested retention: ${t.requestedRetention??`provider default`}`,`Namespace key: ${t.keySuffix?`…${t.keySuffix}`:`unavailable`}`,e(t),`Current provider residency: unknown`,`UI CH and optimizer counters are aggregate reuse metrics, not residency guarantees.`].join(`
|
|
2
|
+
`)}export{t as formatPromptCacheStatus};
|
|
3
|
+
//# sourceMappingURL=status.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.mjs","names":[],"sources":["../../src/services/status.ts"],"sourcesContent":["import type { PromptCacheTelemetrySnapshot } from '../types/cache.ts';\n\nfunction observationLine(snapshot: PromptCacheTelemetrySnapshot): string {\n const observation = snapshot.lastObservation;\n if (!observation) return 'Last provider observation: none';\n return `Last provider observation: cacheRead=${observation.cacheRead}, cacheWrite=${observation.cacheWrite}, input=${observation.totalInput}`;\n}\n\nexport function formatPromptCacheStatus(snapshot: PromptCacheTelemetrySnapshot): string {\n return [\n 'DoomPi provider prompt cache',\n `Capability: ${snapshot.capability}`,\n `Requested retention: ${snapshot.requestedRetention ?? 'provider default'}`,\n `Namespace key: ${snapshot.keySuffix ? `…${snapshot.keySuffix}` : 'unavailable'}`,\n observationLine(snapshot),\n 'Current provider residency: unknown',\n 'UI CH and optimizer counters are aggregate reuse metrics, not residency guarantees.',\n ].join('\\n');\n}\n"],"mappings":"AAEA,SAAS,EAAgB,EAAgD,CACvE,IAAM,EAAc,EAAS,gBAE7B,OADK,EACE,wCAAwC,EAAY,UAAU,eAAe,EAAY,WAAW,UAAU,EAAY,aADxG,iCAE3B,CAEA,SAAgB,EAAwB,EAAgD,CACtF,MAAO,CACL,+BACA,eAAe,EAAS,aACxB,wBAAwB,EAAS,oBAAsB,qBACvD,kBAAkB,EAAS,UAAY,IAAI,EAAS,YAAc,gBAClE,EAAgB,CAAQ,EACxB,sCACA,qFACF,CAAC,CAAC,KAAK;CAAI,CACb"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e=class{#e;#t={capability:`unknown`};#n=[];constructor(e=64){if(!Number.isInteger(e)||e<1)throw Error(`Prompt cache telemetry limit must be a positive integer.`);this.#e=e}beginRequest(e){this.#t={...e}}observe(e,t){let n=this.#t.namespace,r=this.#t.modelFingerprint;!n||!r||(this.#n.push({namespace:n,modelFingerprint:r,cacheRead:e.cacheRead,cacheWrite:e.cacheWrite,totalInput:e.totalInput,observedAt:t}),this.#n.length>this.#e&&this.#n.splice(0,this.#n.length-this.#e))}snapshot(){let e=[...this.#n];return{...this.#t,residency:`unknown`,observations:e,...e.length>0?{lastObservation:e.at(-1)}:{}}}reset(){this.#t={capability:`unknown`},this.#n=[]}};exports.PromptCacheTelemetry=e;
|
|
2
|
+
//# sourceMappingURL=telemetry.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry.cjs","names":["#limit","#request","#observations"],"sources":["../../src/services/telemetry.ts"],"sourcesContent":["import type {\n PromptCacheObservation,\n PromptCacheRequestStatus,\n PromptCacheTelemetryPort,\n PromptCacheTelemetrySnapshot,\n PromptCacheUsage,\n} from '../types/cache.ts';\n\nconst DEFAULT_OBSERVATION_LIMIT = 64;\n\nexport class PromptCacheTelemetry implements PromptCacheTelemetryPort {\n readonly #limit: number;\n #request: PromptCacheRequestStatus = { capability: 'unknown' };\n #observations: PromptCacheObservation[] = [];\n\n constructor(limit: number = DEFAULT_OBSERVATION_LIMIT) {\n if (!Number.isInteger(limit) || limit < 1)\n throw new Error('Prompt cache telemetry limit must be a positive integer.');\n this.#limit = limit;\n }\n\n beginRequest(status: PromptCacheRequestStatus): void {\n this.#request = { ...status };\n }\n\n observe(usage: PromptCacheUsage, observedAt: number): void {\n const namespace = this.#request.namespace;\n const modelFingerprint = this.#request.modelFingerprint;\n if (!namespace || !modelFingerprint) return;\n\n this.#observations.push({\n namespace,\n modelFingerprint,\n cacheRead: usage.cacheRead,\n cacheWrite: usage.cacheWrite,\n totalInput: usage.totalInput,\n observedAt,\n });\n if (this.#observations.length > this.#limit) {\n this.#observations.splice(0, this.#observations.length - this.#limit);\n }\n }\n\n snapshot(): PromptCacheTelemetrySnapshot {\n const observations = [...this.#observations];\n return {\n ...this.#request,\n residency: 'unknown',\n observations,\n ...(observations.length > 0 ? { lastObservation: observations.at(-1) } : {}),\n };\n }\n\n reset(): void {\n this.#request = { capability: 'unknown' };\n this.#observations = [];\n }\n}\n"],"mappings":"AAUA,IAAa,EAAb,KAAsE,CACpE,GACA,GAAqC,CAAE,WAAY,SAAU,EAC7D,GAA0C,CAAC,EAE3C,YAAY,EAAgB,GAA2B,CACrD,GAAI,CAAC,OAAO,UAAU,CAAK,GAAK,EAAQ,EACtC,MAAU,MAAM,0DAA0D,EAC5E,KAAKA,GAAS,CAChB,CAEA,aAAa,EAAwC,CACnD,KAAKC,GAAW,CAAE,GAAG,CAAO,CAC9B,CAEA,QAAQ,EAAyB,EAA0B,CACzD,IAAM,EAAY,KAAKA,GAAS,UAC1B,EAAmB,KAAKA,GAAS,iBACnC,CAAC,GAAa,CAAC,IAEnB,KAAKC,GAAc,KAAK,CACtB,YACA,mBACA,UAAW,EAAM,UACjB,WAAY,EAAM,WAClB,WAAY,EAAM,WAClB,YACF,CAAC,EACG,KAAKA,GAAc,OAAS,KAAKF,IACnC,KAAKE,GAAc,OAAO,EAAG,KAAKA,GAAc,OAAS,KAAKF,EAAM,EAExE,CAEA,UAAyC,CACvC,IAAM,EAAe,CAAC,GAAG,KAAKE,EAAa,EAC3C,MAAO,CACL,GAAG,KAAKD,GACR,UAAW,UACX,eACA,GAAI,EAAa,OAAS,EAAI,CAAE,gBAAiB,EAAa,GAAG,EAAE,CAAE,EAAI,CAAC,CAC5E,CACF,CAEA,OAAc,CACZ,KAAKA,GAAW,CAAE,WAAY,SAAU,EACxC,KAAKC,GAAgB,CAAC,CACxB,CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PromptCacheRequestStatus, PromptCacheTelemetryPort, PromptCacheTelemetrySnapshot, PromptCacheUsage } from "../types/cache.cjs";
|
|
2
|
+
//#region src/services/telemetry.d.ts
|
|
3
|
+
declare class PromptCacheTelemetry implements PromptCacheTelemetryPort {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(limit?: number);
|
|
6
|
+
beginRequest(status: PromptCacheRequestStatus): void;
|
|
7
|
+
observe(usage: PromptCacheUsage, observedAt: number): void;
|
|
8
|
+
snapshot(): PromptCacheTelemetrySnapshot;
|
|
9
|
+
reset(): void;
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { PromptCacheTelemetry };
|
|
13
|
+
//# sourceMappingURL=telemetry.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry.d.cts","names":[],"sources":["../../src/services/telemetry.ts"],"mappings":";;cAUa,gCAAgC;;EAK3C,YAAY;EAMZ,aAAa,QAAQ;EAIrB,QAAQ,OAAO,kBAAkB;EAkBjC,YAAY;EAUZ"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PromptCacheRequestStatus, PromptCacheTelemetryPort, PromptCacheTelemetrySnapshot, PromptCacheUsage } from "../types/cache.mjs";
|
|
2
|
+
//#region src/services/telemetry.d.ts
|
|
3
|
+
declare class PromptCacheTelemetry implements PromptCacheTelemetryPort {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(limit?: number);
|
|
6
|
+
beginRequest(status: PromptCacheRequestStatus): void;
|
|
7
|
+
observe(usage: PromptCacheUsage, observedAt: number): void;
|
|
8
|
+
snapshot(): PromptCacheTelemetrySnapshot;
|
|
9
|
+
reset(): void;
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { PromptCacheTelemetry };
|
|
13
|
+
//# sourceMappingURL=telemetry.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry.d.mts","names":[],"sources":["../../src/services/telemetry.ts"],"mappings":";;cAUa,gCAAgC;;EAK3C,YAAY;EAMZ,aAAa,QAAQ;EAIrB,QAAQ,OAAO,kBAAkB;EAkBjC,YAAY;EAUZ"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e=class{#e;#t={capability:`unknown`};#n=[];constructor(e=64){if(!Number.isInteger(e)||e<1)throw Error(`Prompt cache telemetry limit must be a positive integer.`);this.#e=e}beginRequest(e){this.#t={...e}}observe(e,t){let n=this.#t.namespace,r=this.#t.modelFingerprint;!n||!r||(this.#n.push({namespace:n,modelFingerprint:r,cacheRead:e.cacheRead,cacheWrite:e.cacheWrite,totalInput:e.totalInput,observedAt:t}),this.#n.length>this.#e&&this.#n.splice(0,this.#n.length-this.#e))}snapshot(){let e=[...this.#n];return{...this.#t,residency:`unknown`,observations:e,...e.length>0?{lastObservation:e.at(-1)}:{}}}reset(){this.#t={capability:`unknown`},this.#n=[]}};export{e as PromptCacheTelemetry};
|
|
2
|
+
//# sourceMappingURL=telemetry.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry.mjs","names":["#limit","#request","#observations"],"sources":["../../src/services/telemetry.ts"],"sourcesContent":["import type {\n PromptCacheObservation,\n PromptCacheRequestStatus,\n PromptCacheTelemetryPort,\n PromptCacheTelemetrySnapshot,\n PromptCacheUsage,\n} from '../types/cache.ts';\n\nconst DEFAULT_OBSERVATION_LIMIT = 64;\n\nexport class PromptCacheTelemetry implements PromptCacheTelemetryPort {\n readonly #limit: number;\n #request: PromptCacheRequestStatus = { capability: 'unknown' };\n #observations: PromptCacheObservation[] = [];\n\n constructor(limit: number = DEFAULT_OBSERVATION_LIMIT) {\n if (!Number.isInteger(limit) || limit < 1)\n throw new Error('Prompt cache telemetry limit must be a positive integer.');\n this.#limit = limit;\n }\n\n beginRequest(status: PromptCacheRequestStatus): void {\n this.#request = { ...status };\n }\n\n observe(usage: PromptCacheUsage, observedAt: number): void {\n const namespace = this.#request.namespace;\n const modelFingerprint = this.#request.modelFingerprint;\n if (!namespace || !modelFingerprint) return;\n\n this.#observations.push({\n namespace,\n modelFingerprint,\n cacheRead: usage.cacheRead,\n cacheWrite: usage.cacheWrite,\n totalInput: usage.totalInput,\n observedAt,\n });\n if (this.#observations.length > this.#limit) {\n this.#observations.splice(0, this.#observations.length - this.#limit);\n }\n }\n\n snapshot(): PromptCacheTelemetrySnapshot {\n const observations = [...this.#observations];\n return {\n ...this.#request,\n residency: 'unknown',\n observations,\n ...(observations.length > 0 ? { lastObservation: observations.at(-1) } : {}),\n };\n }\n\n reset(): void {\n this.#request = { capability: 'unknown' };\n this.#observations = [];\n }\n}\n"],"mappings":"AAUA,IAAa,EAAb,KAAsE,CACpE,GACA,GAAqC,CAAE,WAAY,SAAU,EAC7D,GAA0C,CAAC,EAE3C,YAAY,EAAgB,GAA2B,CACrD,GAAI,CAAC,OAAO,UAAU,CAAK,GAAK,EAAQ,EACtC,MAAU,MAAM,0DAA0D,EAC5E,KAAKA,GAAS,CAChB,CAEA,aAAa,EAAwC,CACnD,KAAKC,GAAW,CAAE,GAAG,CAAO,CAC9B,CAEA,QAAQ,EAAyB,EAA0B,CACzD,IAAM,EAAY,KAAKA,GAAS,UAC1B,EAAmB,KAAKA,GAAS,iBACnC,CAAC,GAAa,CAAC,IAEnB,KAAKC,GAAc,KAAK,CACtB,YACA,mBACA,UAAW,EAAM,UACjB,WAAY,EAAM,WAClB,WAAY,EAAM,WAClB,YACF,CAAC,EACG,KAAKA,GAAc,OAAS,KAAKF,IACnC,KAAKE,GAAc,OAAO,EAAG,KAAKA,GAAc,OAAS,KAAKF,EAAM,EAExE,CAEA,UAAyC,CACvC,IAAM,EAAe,CAAC,GAAG,KAAKE,EAAa,EAC3C,MAAO,CACL,GAAG,KAAKD,GACR,UAAW,UACX,eACA,GAAI,EAAa,OAAS,EAAI,CAAE,gBAAiB,EAAa,GAAG,EAAE,CAAE,EAAI,CAAC,CAC5E,CACF,CAEA,OAAc,CACZ,KAAKA,GAAW,CAAE,WAAY,SAAU,EACxC,KAAKC,GAAgB,CAAC,CACxB,CACF"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
//#region src/types/cache.d.ts
|
|
2
|
+
type PromptCacheCapabilityClass = 'key-and-long-retention' | 'key-only' | 'marker-only' | 'automatic' | 'unknown';
|
|
3
|
+
interface PromptCacheMinorModeState {
|
|
4
|
+
readonly source: string;
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly activation: string;
|
|
7
|
+
readonly modelContextVariant?: string;
|
|
8
|
+
}
|
|
9
|
+
interface PromptCacheParentState {
|
|
10
|
+
readonly rootSessionId: string;
|
|
11
|
+
readonly compositionFingerprint?: string;
|
|
12
|
+
readonly majorMode: string;
|
|
13
|
+
readonly domains: readonly string[];
|
|
14
|
+
readonly profile?: string;
|
|
15
|
+
readonly persona?: string;
|
|
16
|
+
readonly minorModes: readonly PromptCacheMinorModeState[];
|
|
17
|
+
}
|
|
18
|
+
interface PromptCacheChildProjection {
|
|
19
|
+
readonly systemPrompt?: string;
|
|
20
|
+
readonly tools: readonly string[];
|
|
21
|
+
readonly excludedTools: readonly string[];
|
|
22
|
+
readonly extensions: readonly string[];
|
|
23
|
+
readonly inheritProjectContext?: boolean;
|
|
24
|
+
readonly inheritSkills?: boolean;
|
|
25
|
+
readonly fanout?: boolean;
|
|
26
|
+
readonly structuredOutputSchema?: unknown;
|
|
27
|
+
}
|
|
28
|
+
interface PromptCacheModelIdentity {
|
|
29
|
+
readonly virtualProvider?: string;
|
|
30
|
+
readonly virtualModel?: string;
|
|
31
|
+
readonly api?: string;
|
|
32
|
+
readonly baseUrl?: string;
|
|
33
|
+
readonly wireModel?: string;
|
|
34
|
+
}
|
|
35
|
+
interface PromptCacheDigest {
|
|
36
|
+
(value: string): string;
|
|
37
|
+
}
|
|
38
|
+
interface PromptCacheUsage {
|
|
39
|
+
readonly cacheRead: number;
|
|
40
|
+
readonly cacheWrite: number;
|
|
41
|
+
readonly totalInput: number;
|
|
42
|
+
}
|
|
43
|
+
interface PromptCacheObservation extends PromptCacheUsage {
|
|
44
|
+
readonly namespace: string;
|
|
45
|
+
readonly modelFingerprint: string;
|
|
46
|
+
readonly observedAt: number;
|
|
47
|
+
}
|
|
48
|
+
interface PromptCacheRequestStatus {
|
|
49
|
+
readonly capability: PromptCacheCapabilityClass;
|
|
50
|
+
readonly namespace?: string;
|
|
51
|
+
readonly modelFingerprint?: string;
|
|
52
|
+
readonly requestedRetention?: string;
|
|
53
|
+
readonly keySuffix?: string;
|
|
54
|
+
}
|
|
55
|
+
interface PromptCacheTelemetrySnapshot extends PromptCacheRequestStatus {
|
|
56
|
+
readonly residency: 'unknown';
|
|
57
|
+
readonly observations: readonly PromptCacheObservation[];
|
|
58
|
+
readonly lastObservation?: PromptCacheObservation;
|
|
59
|
+
}
|
|
60
|
+
interface PromptCacheTelemetryPort {
|
|
61
|
+
beginRequest(status: PromptCacheRequestStatus): void;
|
|
62
|
+
observe(usage: PromptCacheUsage, observedAt: number): void;
|
|
63
|
+
snapshot(): PromptCacheTelemetrySnapshot;
|
|
64
|
+
reset(): void;
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
export { PromptCacheCapabilityClass, PromptCacheChildProjection, PromptCacheDigest, PromptCacheMinorModeState, PromptCacheModelIdentity, PromptCacheObservation, PromptCacheParentState, PromptCacheRequestStatus, PromptCacheTelemetryPort, PromptCacheTelemetrySnapshot, PromptCacheUsage };
|
|
68
|
+
//# sourceMappingURL=cache.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.cts","names":[],"sources":["../../src/types/cache.ts"],"mappings":";KAAY;UAOK;WACN;WACA;WACA;WACA;;UAGM;WACN;WACA;WACA;WACA;WACA;WACA;WACA,qBAAqB;;UAGf;WACN;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;UAGM;WACN;WACA;WACA;WACA;WACA;;UAGM;GACd;;UAGc;WACN;WACA;WACA;;UAGM,+BAA+B;WACrC;WACA;WACA;;UAGM;WACN,YAAY;WACZ;WACA;WACA;WACA;;UAGM,qCAAqC;WAC3C;WACA,uBAAuB;WACvB,kBAAkB;;UAGZ;EACf,aAAa,QAAQ;EACrB,QAAQ,OAAO,kBAAkB;EACjC,YAAY;EACZ"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
//#region src/types/cache.d.ts
|
|
2
|
+
type PromptCacheCapabilityClass = 'key-and-long-retention' | 'key-only' | 'marker-only' | 'automatic' | 'unknown';
|
|
3
|
+
interface PromptCacheMinorModeState {
|
|
4
|
+
readonly source: string;
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly activation: string;
|
|
7
|
+
readonly modelContextVariant?: string;
|
|
8
|
+
}
|
|
9
|
+
interface PromptCacheParentState {
|
|
10
|
+
readonly rootSessionId: string;
|
|
11
|
+
readonly compositionFingerprint?: string;
|
|
12
|
+
readonly majorMode: string;
|
|
13
|
+
readonly domains: readonly string[];
|
|
14
|
+
readonly profile?: string;
|
|
15
|
+
readonly persona?: string;
|
|
16
|
+
readonly minorModes: readonly PromptCacheMinorModeState[];
|
|
17
|
+
}
|
|
18
|
+
interface PromptCacheChildProjection {
|
|
19
|
+
readonly systemPrompt?: string;
|
|
20
|
+
readonly tools: readonly string[];
|
|
21
|
+
readonly excludedTools: readonly string[];
|
|
22
|
+
readonly extensions: readonly string[];
|
|
23
|
+
readonly inheritProjectContext?: boolean;
|
|
24
|
+
readonly inheritSkills?: boolean;
|
|
25
|
+
readonly fanout?: boolean;
|
|
26
|
+
readonly structuredOutputSchema?: unknown;
|
|
27
|
+
}
|
|
28
|
+
interface PromptCacheModelIdentity {
|
|
29
|
+
readonly virtualProvider?: string;
|
|
30
|
+
readonly virtualModel?: string;
|
|
31
|
+
readonly api?: string;
|
|
32
|
+
readonly baseUrl?: string;
|
|
33
|
+
readonly wireModel?: string;
|
|
34
|
+
}
|
|
35
|
+
interface PromptCacheDigest {
|
|
36
|
+
(value: string): string;
|
|
37
|
+
}
|
|
38
|
+
interface PromptCacheUsage {
|
|
39
|
+
readonly cacheRead: number;
|
|
40
|
+
readonly cacheWrite: number;
|
|
41
|
+
readonly totalInput: number;
|
|
42
|
+
}
|
|
43
|
+
interface PromptCacheObservation extends PromptCacheUsage {
|
|
44
|
+
readonly namespace: string;
|
|
45
|
+
readonly modelFingerprint: string;
|
|
46
|
+
readonly observedAt: number;
|
|
47
|
+
}
|
|
48
|
+
interface PromptCacheRequestStatus {
|
|
49
|
+
readonly capability: PromptCacheCapabilityClass;
|
|
50
|
+
readonly namespace?: string;
|
|
51
|
+
readonly modelFingerprint?: string;
|
|
52
|
+
readonly requestedRetention?: string;
|
|
53
|
+
readonly keySuffix?: string;
|
|
54
|
+
}
|
|
55
|
+
interface PromptCacheTelemetrySnapshot extends PromptCacheRequestStatus {
|
|
56
|
+
readonly residency: 'unknown';
|
|
57
|
+
readonly observations: readonly PromptCacheObservation[];
|
|
58
|
+
readonly lastObservation?: PromptCacheObservation;
|
|
59
|
+
}
|
|
60
|
+
interface PromptCacheTelemetryPort {
|
|
61
|
+
beginRequest(status: PromptCacheRequestStatus): void;
|
|
62
|
+
observe(usage: PromptCacheUsage, observedAt: number): void;
|
|
63
|
+
snapshot(): PromptCacheTelemetrySnapshot;
|
|
64
|
+
reset(): void;
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
export { PromptCacheCapabilityClass, PromptCacheChildProjection, PromptCacheDigest, PromptCacheMinorModeState, PromptCacheModelIdentity, PromptCacheObservation, PromptCacheParentState, PromptCacheRequestStatus, PromptCacheTelemetryPort, PromptCacheTelemetrySnapshot, PromptCacheUsage };
|
|
68
|
+
//# sourceMappingURL=cache.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.mts","names":[],"sources":["../../src/types/cache.ts"],"mappings":";KAAY;UAOK;WACN;WACA;WACA;WACA;;UAGM;WACN;WACA;WACA;WACA;WACA;WACA;WACA,qBAAqB;;UAGf;WACN;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;UAGM;WACN;WACA;WACA;WACA;WACA;;UAGM;GACd;;UAGc;WACN;WACA;WACA;;UAGM,+BAA+B;WACrC;WACA;WACA;;UAGM;WACN,YAAY;WACZ;WACA;WACA;WACA;;UAGM,qCAAqC;WAC3C;WACA,uBAAuB;WACvB,kBAAkB;;UAGZ;EACf,aAAa,QAAQ;EACrB,QAAQ,OAAO,kBAAkB;EACjC,YAAY;EACZ"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
exports.DOOMPI_PROMPT_CACHE_CHILD_PROJECTION_ENV=`DOOMPI_PROMPT_CACHE_CHILD_PROJECTION`,exports.DOOMPI_PROMPT_CACHE_PARENT_NAMESPACE_ENV=`DOOMPI_PROMPT_CACHE_PARENT_NAMESPACE`,exports.DOOMPI_PROMPT_CACHE_ROOT_SESSION_ENV=`DOOMPI_PROMPT_CACHE_ROOT_SESSION`,exports.PI_CACHE_RETENTION_ENV=`PI_CACHE_RETENTION`,exports.PI_CACHE_RETENTION_LONG=`long`;
|
|
2
|
+
//# sourceMappingURL=environment.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.cjs","names":[],"sources":["../../src/types/environment.ts"],"sourcesContent":["export const DOOMPI_PROMPT_CACHE_PARENT_NAMESPACE_ENV = 'DOOMPI_PROMPT_CACHE_PARENT_NAMESPACE';\nexport const DOOMPI_PROMPT_CACHE_ROOT_SESSION_ENV = 'DOOMPI_PROMPT_CACHE_ROOT_SESSION';\nexport const DOOMPI_PROMPT_CACHE_CHILD_PROJECTION_ENV = 'DOOMPI_PROMPT_CACHE_CHILD_PROJECTION';\nexport const PI_CACHE_RETENTION_ENV = 'PI_CACHE_RETENTION';\nexport const PI_CACHE_RETENTION_LONG = 'long';\n"],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/types/environment.d.ts
|
|
2
|
+
declare const DOOMPI_PROMPT_CACHE_PARENT_NAMESPACE_ENV = "DOOMPI_PROMPT_CACHE_PARENT_NAMESPACE";
|
|
3
|
+
declare const DOOMPI_PROMPT_CACHE_ROOT_SESSION_ENV = "DOOMPI_PROMPT_CACHE_ROOT_SESSION";
|
|
4
|
+
declare const DOOMPI_PROMPT_CACHE_CHILD_PROJECTION_ENV = "DOOMPI_PROMPT_CACHE_CHILD_PROJECTION";
|
|
5
|
+
declare const PI_CACHE_RETENTION_ENV = "PI_CACHE_RETENTION";
|
|
6
|
+
declare const PI_CACHE_RETENTION_LONG = "long";
|
|
7
|
+
//#endregion
|
|
8
|
+
export { DOOMPI_PROMPT_CACHE_CHILD_PROJECTION_ENV, DOOMPI_PROMPT_CACHE_PARENT_NAMESPACE_ENV, DOOMPI_PROMPT_CACHE_ROOT_SESSION_ENV, PI_CACHE_RETENTION_ENV, PI_CACHE_RETENTION_LONG };
|
|
9
|
+
//# sourceMappingURL=environment.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.d.cts","names":[],"sources":["../../src/types/environment.ts"],"mappings":";cAAa;cACA;cACA;cACA;cACA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/types/environment.d.ts
|
|
2
|
+
declare const DOOMPI_PROMPT_CACHE_PARENT_NAMESPACE_ENV = "DOOMPI_PROMPT_CACHE_PARENT_NAMESPACE";
|
|
3
|
+
declare const DOOMPI_PROMPT_CACHE_ROOT_SESSION_ENV = "DOOMPI_PROMPT_CACHE_ROOT_SESSION";
|
|
4
|
+
declare const DOOMPI_PROMPT_CACHE_CHILD_PROJECTION_ENV = "DOOMPI_PROMPT_CACHE_CHILD_PROJECTION";
|
|
5
|
+
declare const PI_CACHE_RETENTION_ENV = "PI_CACHE_RETENTION";
|
|
6
|
+
declare const PI_CACHE_RETENTION_LONG = "long";
|
|
7
|
+
//#endregion
|
|
8
|
+
export { DOOMPI_PROMPT_CACHE_CHILD_PROJECTION_ENV, DOOMPI_PROMPT_CACHE_PARENT_NAMESPACE_ENV, DOOMPI_PROMPT_CACHE_ROOT_SESSION_ENV, PI_CACHE_RETENTION_ENV, PI_CACHE_RETENTION_LONG };
|
|
9
|
+
//# sourceMappingURL=environment.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.d.mts","names":[],"sources":["../../src/types/environment.ts"],"mappings":";cAAa;cACA;cACA;cACA;cACA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=`DOOMPI_PROMPT_CACHE_PARENT_NAMESPACE`,t=`DOOMPI_PROMPT_CACHE_ROOT_SESSION`,n=`DOOMPI_PROMPT_CACHE_CHILD_PROJECTION`,r=`PI_CACHE_RETENTION`,i=`long`;export{n as DOOMPI_PROMPT_CACHE_CHILD_PROJECTION_ENV,e as DOOMPI_PROMPT_CACHE_PARENT_NAMESPACE_ENV,t as DOOMPI_PROMPT_CACHE_ROOT_SESSION_ENV,r as PI_CACHE_RETENTION_ENV,i as PI_CACHE_RETENTION_LONG};
|
|
2
|
+
//# sourceMappingURL=environment.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.mjs","names":[],"sources":["../../src/types/environment.ts"],"sourcesContent":["export const DOOMPI_PROMPT_CACHE_PARENT_NAMESPACE_ENV = 'DOOMPI_PROMPT_CACHE_PARENT_NAMESPACE';\nexport const DOOMPI_PROMPT_CACHE_ROOT_SESSION_ENV = 'DOOMPI_PROMPT_CACHE_ROOT_SESSION';\nexport const DOOMPI_PROMPT_CACHE_CHILD_PROJECTION_ENV = 'DOOMPI_PROMPT_CACHE_CHILD_PROJECTION';\nexport const PI_CACHE_RETENTION_ENV = 'PI_CACHE_RETENTION';\nexport const PI_CACHE_RETENTION_LONG = 'long';\n"],"mappings":"AAAA,MAAa,EAA2C,uCAC3C,EAAuC,mCACvC,EAA2C,uCAC3C,EAAyB,qBACzB,EAA0B"}
|
package/llms.txt
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# @agimon-ai/doompi-cache
|
|
2
|
+
|
|
3
|
+
Package-owned guidance for Provider prompt cache policy and deterministic routing for DoomPi
|
|
4
|
+
|
|
5
|
+
## How to use
|
|
6
|
+
|
|
7
|
+
- [Use Cache](./src/prompts/doompi-use-cache/SKILL.md): Run the package command and follow its package-specific usage guidance.
|
|
8
|
+
|
|
9
|
+
## Resources
|
|
10
|
+
|
|
11
|
+
- [Package README](./README.md): Installation, development commands, Pi entrypoint, and extension-specific usage.
|