@agimon-ai/po-cache 0.0.0-alpha.12 → 0.0.0-alpha.121
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 +157 -18
- package/README.md +1 -1
- package/dist/apiContracts.cjs +1 -1
- package/dist/apiContracts.cjs.map +1 -1
- package/dist/apiContracts.d.mts +1 -1
- package/dist/apiContracts.mjs +1 -1
- package/dist/apiContracts.mjs.map +1 -1
- package/dist/extensions/mcp.cjs +2 -2
- package/dist/extensions/mcp.cjs.map +1 -1
- package/dist/extensions/mcp.mjs +1 -1
- package/dist/extensions/mcp.mjs.map +1 -1
- package/dist/extensions/server.cjs +49 -19
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.d.mts +2 -2
- package/dist/extensions/server.d.mts.map +1 -1
- package/dist/extensions/server.mjs +48 -18
- package/dist/extensions/server.mjs.map +1 -1
- package/package.json +21 -12
package/LICENSE
CHANGED
|
@@ -1,26 +1,165 @@
|
|
|
1
|
-
|
|
1
|
+
License text copyright © 2017 MariaDB Corporation Ab, All Rights Reserved.
|
|
2
|
+
"Business Source License" is a trademark of MariaDB Corporation Ab.
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
Parameters
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
Licensor: Agimon Pty Ltd
|
|
7
|
+
Licensed Work: Po, the software in the Po source repository and the
|
|
8
|
+
packages released from it, in each version released by
|
|
9
|
+
the Licensor.
|
|
10
|
+
The Licensed Work is (c) 2026 Agimon Pty Ltd.
|
|
11
|
+
Material identified as third-party in the "Third-party
|
|
12
|
+
components" section at the end of this file or in a
|
|
13
|
+
NOTICE file, and any package or directory whose own
|
|
14
|
+
license file grants a different license, is not part of
|
|
15
|
+
the Licensed Work and remains under its own license.
|
|
16
|
+
Additional Use Grant: You may make production use of the Licensed Work if
|
|
17
|
+
your use is Eligible Use. "Eligible Use" is production use that falls
|
|
18
|
+
within at least one of the following:
|
|
11
19
|
|
|
12
|
-
|
|
13
|
-
|
|
20
|
+
(a) Personal Use. Use by an individual for their own personal purposes,
|
|
21
|
+
and not on behalf of, or for the benefit of, an employer, client, or
|
|
22
|
+
other Organization. Use by an individual in the course of employment
|
|
23
|
+
or engagement by an Organization is use by that Organization.
|
|
14
24
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
25
|
+
(b) Small Organization Use. Use by or on behalf of an Organization whose
|
|
26
|
+
Annual Revenue is less than USD 1,000,000.
|
|
27
|
+
|
|
28
|
+
(c) Non-profit, Education and Research Use. Use, regardless of Annual
|
|
29
|
+
Revenue, by (i) an Organization registered or recognized as a
|
|
30
|
+
non-profit or charitable organization under the laws of its
|
|
31
|
+
jurisdiction, for its non-profit purposes; (ii) an accredited school,
|
|
32
|
+
college, or university, for teaching, learning, or academic research;
|
|
33
|
+
or (iii) a publicly funded research institution, for its research.
|
|
34
|
+
|
|
35
|
+
(d) Service Provider Use. Use by a consultant, contractor, agency, or other
|
|
36
|
+
service provider, regardless of its own Annual Revenue, solely to
|
|
37
|
+
build, deploy, host, operate, or support the Licensed Work for a client
|
|
38
|
+
whose own use would be Eligible Use under (a), (b), or (c). A service
|
|
39
|
+
provider's use for its own purposes is Eligible Use only if the service
|
|
40
|
+
provider itself qualifies under (b) or (c).
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
Hosted services. Offering the Licensed Work to third parties as a hosted
|
|
44
|
+
or managed service whose primary value is the Licensed Work is Eligible
|
|
45
|
+
Use only if each such third party's own use would be Eligible Use.
|
|
46
|
+
|
|
47
|
+
Definitions. "Organization" means any company, partnership, sole
|
|
48
|
+
proprietorship, trust, association, government body, or other entity, and
|
|
49
|
+
includes an individual acting in a business or professional capacity.
|
|
50
|
+
"Affiliate" means any entity that directly or indirectly controls, is
|
|
51
|
+
controlled by, or is under common control with an Organization, where
|
|
52
|
+
"control" means ownership of more than 50% of the voting interests of an
|
|
53
|
+
entity or the power to direct its management and policies by contract or
|
|
54
|
+
otherwise. "Annual Revenue" means the total gross revenue of an
|
|
55
|
+
Organization and all of its Affiliates combined, from all sources and
|
|
56
|
+
whether or not related to the Licensed Work, for its most recently
|
|
57
|
+
completed fiscal year, or, if it has not completed a fiscal year, for the
|
|
58
|
+
twelve months before the use (or since its formation, if shorter),
|
|
59
|
+
converted into US dollars at the average exchange rate for that period.
|
|
60
|
+
Proceeds of equity or debt financing are not revenue.
|
|
61
|
+
|
|
62
|
+
Threshold. If an Organization stops qualifying under (b), its existing
|
|
63
|
+
production use remains Eligible Use for 90 days after it stops
|
|
64
|
+
qualifying, after which it must obtain a commercial license or stop
|
|
65
|
+
production use. Use that was Eligible Use when it occurred never requires
|
|
66
|
+
a commercial license after the fact.
|
|
67
|
+
Change Date: Four years from the date a version of the Licensed Work
|
|
68
|
+
is first publicly released by the Licensor.
|
|
69
|
+
Change License: Apache License, Version 2.0
|
|
70
|
+
|
|
71
|
+
For information about alternative licensing arrangements for the Licensed
|
|
72
|
+
Work, please visit: https://agimon.ai/licensing
|
|
73
|
+
|
|
74
|
+
Notice
|
|
75
|
+
|
|
76
|
+
The Business Source License (this document, or the "License") is not an Open
|
|
77
|
+
Source license. However, the Licensed Work will eventually be made available
|
|
78
|
+
under an Open Source License, as stated in this License.
|
|
79
|
+
|
|
80
|
+
-----------------------------------------------------------------------------
|
|
81
|
+
|
|
82
|
+
Business Source License 1.1
|
|
83
|
+
|
|
84
|
+
Terms
|
|
85
|
+
|
|
86
|
+
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
87
|
+
works, redistribute, and make non-production use of the Licensed Work. The
|
|
88
|
+
Licensor may make an Additional Use Grant, above, permitting limited
|
|
89
|
+
production use.
|
|
90
|
+
|
|
91
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
92
|
+
available distribution of a specific version of the Licensed Work under this
|
|
93
|
+
License, whichever comes first, the Licensor hereby grants you rights under
|
|
94
|
+
the terms of the Change License, and the rights granted in the paragraph
|
|
95
|
+
above terminate.
|
|
96
|
+
|
|
97
|
+
If your use of the Licensed Work does not comply with the requirements
|
|
98
|
+
currently in effect as described in this License, you must purchase a
|
|
99
|
+
commercial license from the Licensor, its affiliated entities, or authorized
|
|
100
|
+
resellers, or you must refrain from using the Licensed Work.
|
|
101
|
+
|
|
102
|
+
All copies of the original and modified Licensed Work, and derivative works
|
|
103
|
+
of the Licensed Work, are subject to this License. This License applies
|
|
104
|
+
separately for each version of the Licensed Work and the Change Date may vary
|
|
105
|
+
for each version of the Licensed Work released by Licensor.
|
|
106
|
+
|
|
107
|
+
You must conspicuously display this License on each original or modified copy
|
|
108
|
+
of the Licensed Work. If you receive the Licensed Work in original or
|
|
109
|
+
modified form from a third party, the terms and conditions set forth in this
|
|
110
|
+
License apply to your use of that work.
|
|
111
|
+
|
|
112
|
+
Any use of the Licensed Work in violation of this License will automatically
|
|
113
|
+
terminate your rights under this License for the current and all other
|
|
114
|
+
versions of the Licensed Work.
|
|
115
|
+
|
|
116
|
+
This License does not grant you any right in any trademark or logo of
|
|
117
|
+
Licensor or its affiliates (provided that you may use a trademark or logo of
|
|
118
|
+
Licensor as expressly required by this License).
|
|
119
|
+
|
|
120
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
121
|
+
AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
122
|
+
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
|
123
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
|
124
|
+
TITLE.
|
|
125
|
+
|
|
126
|
+
MariaDB hereby grants you permission to use this License’s text to license
|
|
127
|
+
your works, and to refer to it using the trademark “Business Source License”,
|
|
128
|
+
as long as you comply with the Covenants of Licensor below.
|
|
129
|
+
|
|
130
|
+
Covenants of Licensor
|
|
131
|
+
|
|
132
|
+
In consideration of the right to use this License’s text and the “Business
|
|
133
|
+
Source License” name and trademark, Licensor covenants to MariaDB, and to all
|
|
134
|
+
other recipients of the licensed work to be provided by Licensor:
|
|
135
|
+
|
|
136
|
+
1. To specify as the Change License the GPL Version 2.0 or any later version,
|
|
137
|
+
or a license that is compatible with GPL Version 2.0 or a later version,
|
|
138
|
+
where “compatible” means that software provided under the Change License can
|
|
139
|
+
be included in a program with software provided under GPL Version 2.0 or a
|
|
140
|
+
later version. Licensor may specify additional Change Licenses without
|
|
141
|
+
limitation.
|
|
142
|
+
|
|
143
|
+
2. To either: (a) specify an additional grant of rights to use that does not
|
|
144
|
+
impose any additional restriction on the right granted in this License, as
|
|
145
|
+
the Additional Use Grant; or (b) insert the text “None”.
|
|
146
|
+
|
|
147
|
+
3. To specify a Change Date.
|
|
148
|
+
|
|
149
|
+
4. Not to modify this License in any other way.
|
|
150
|
+
|
|
151
|
+
-----------------------------------------------------------------------------
|
|
152
|
+
|
|
153
|
+
Third-party components
|
|
154
|
+
|
|
155
|
+
The following material in this package was written by third parties. It is
|
|
156
|
+
not part of the Licensed Work, is not licensed under the Business Source
|
|
157
|
+
License above, and remains under its own license, reproduced below. Where a
|
|
158
|
+
file combines third-party material with changes by Agimon Pty Ltd, the
|
|
159
|
+
third-party portions remain under their original license and the changes
|
|
160
|
+
are part of the Licensed Work.
|
|
22
161
|
|
|
23
|
-
Adapted statistics and diagnostics from pi-cache-optimizer 2.8.16
|
|
162
|
+
1. Adapted statistics and diagnostics from pi-cache-optimizer 2.8.16
|
|
24
163
|
https://github.com/jiangge/pi-cache-optimizer
|
|
25
164
|
|
|
26
165
|
MIT License
|
package/README.md
CHANGED
|
@@ -70,7 +70,7 @@ Maintained by [Agimon](https://agimon.ai/about).
|
|
|
70
70
|
|
|
71
71
|
## License
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
Business Source License 1.1: free for personal use, organisations under USD 1M revenue, non-profits and education. See [LICENSE](LICENSE) and https://agimon.ai/licensing.
|
|
74
74
|
|
|
75
75
|
## Extension lifecycle and source layout
|
|
76
76
|
|
package/dist/apiContracts.cjs
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
//#region src/schemas/apiContracts.ts
|
|
6
|
-
/** This
|
|
6
|
+
/** This server plugin contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */
|
|
7
7
|
const apiContracts = (0, require("@agimon-ai/po-core/apiContracts").defineApiContract)({
|
|
8
8
|
version: 1,
|
|
9
9
|
http: [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiContracts.cjs","names":["defineApiContract"],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract } from '@agimon-ai/po-core/apiContracts';\n\n/** This
|
|
1
|
+
{"version":3,"file":"apiContracts.cjs","names":["defineApiContract"],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract } from '@agimon-ai/po-core/apiContracts';\n\n/** This server plugin contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */\nexport const apiContracts = defineApiContract({ version: 1, http: [], sockets: [], dynamic: [] });\nexport default apiContracts;\n"],"mappings":";;;;;;AAGA,MAAa,gBAAA,4CAAeA,CAAAA,CAAAA,kBAAAA,CAAkB;CAAE,SAAS;CAAG,MAAM,CAAC;CAAG,SAAS,CAAC;CAAG,SAAS,CAAC;AAAE,CAAC"}
|
package/dist/apiContracts.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/schemas/apiContracts.d.ts
|
|
2
|
-
/** This
|
|
2
|
+
/** This server plugin contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */
|
|
3
3
|
export declare const apiContracts: {
|
|
4
4
|
version: 1;
|
|
5
5
|
protocols?: Record<string, string> | undefined;
|
package/dist/apiContracts.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineApiContract } from "@agimon-ai/po-core/apiContracts";
|
|
2
2
|
//#region src/schemas/apiContracts.ts
|
|
3
|
-
/** This
|
|
3
|
+
/** This server plugin contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */
|
|
4
4
|
const apiContracts = defineApiContract({
|
|
5
5
|
version: 1,
|
|
6
6
|
http: [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiContracts.mjs","names":[],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract } from '@agimon-ai/po-core/apiContracts';\n\n/** This
|
|
1
|
+
{"version":3,"file":"apiContracts.mjs","names":[],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract } from '@agimon-ai/po-core/apiContracts';\n\n/** This server plugin contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */\nexport const apiContracts = defineApiContract({ version: 1, http: [], sockets: [], dynamic: [] });\nexport default apiContracts;\n"],"mappings":";;;AAGA,MAAa,eAAe,kBAAkB;CAAE,SAAS;CAAG,MAAM,CAAC;CAAG,SAAS,CAAC;CAAG,SAAS,CAAC;AAAE,CAAC"}
|
package/dist/extensions/mcp.cjs
CHANGED
|
@@ -3,12 +3,12 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
let _agimon_ai_po_core_mcpFacet = require("@agimon-ai/po-core/mcpFacet");
|
|
6
|
-
let
|
|
6
|
+
let _agimon_ai_po_core_serverPlugin = require("@agimon-ai/po-core/serverPlugin");
|
|
7
7
|
//#region src/extensions/workspaces/sessions/(backend)/skill/po-use-cache.mcp.ts
|
|
8
8
|
var po_use_cache_mcp_default = (0, _agimon_ai_po_core_mcpFacet.defineMcpSkill)({
|
|
9
9
|
name: "po-use-cache",
|
|
10
10
|
description: "Inspect Po provider prompt cache policy, routing identity, and provider-observed usage.",
|
|
11
|
-
read: () => (0,
|
|
11
|
+
read: () => (0, _agimon_ai_po_core_serverPlugin.readPackageResource)(require("url").pathToFileURL(__filename).href, "src/prompts/po-use-cache/SKILL.md")
|
|
12
12
|
});
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region generated/mcp.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.cjs","names":["defineMcpSkill","readPackageResource","defineMcpPlugin","skillPoUseCache"],"sources":["../../src/extensions/workspaces/sessions/(backend)/skill/po-use-cache.mcp.ts","../../generated/mcp.ts"],"sourcesContent":["import { defineMcpSkill } from '@agimon-ai/po-core/mcpFacet';\nimport { readPackageResource } from '@agimon-ai/po-core/
|
|
1
|
+
{"version":3,"file":"mcp.cjs","names":["defineMcpSkill","readPackageResource","defineMcpPlugin","skillPoUseCache"],"sources":["../../src/extensions/workspaces/sessions/(backend)/skill/po-use-cache.mcp.ts","../../generated/mcp.ts"],"sourcesContent":["import { defineMcpSkill } from '@agimon-ai/po-core/mcpFacet';\nimport { readPackageResource } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineMcpSkill({\n name: 'po-use-cache',\n description: 'Inspect Po provider prompt cache policy, routing identity, and provider-observed usage.',\n read: () => readPackageResource(import.meta.url, 'src/prompts/po-use-cache/SKILL.md'),\n});\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineMcpPlugin, type PoMcpSessionPlugin } from '@agimon-ai/po-core/mcpFacet';\n\nimport skillPoUseCache from '../src/extensions/workspaces/sessions/(backend)/skill/po-use-cache.mcp';\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\n\nexport const mcp = defineMcpPlugin({\n name: '@agimon-ai/po-cache',\n session: (context) => ({\n get skills(): PoMcpSessionPlugin['skills'] { return [at(skillPoUseCache, context)]; },\n }) satisfies PoMcpSessionPlugin,\n});\n\nexport default mcp;\n"],"mappings":";;;;;;;AAGA,IAAA,4BAAA,GAAeA,4BAAAA,eAAAA,CAAe;CAC5B,MAAM;CACN,aAAa;CACb,aAAA,GAAYC,gCAAAA,oBAAAA,CAAAA,QAAAA,KAAAA,CAAAA,CAAAA,cAAAA,UAAAA,CAAAA,CAAAA,MAAqC,mCAAmC;AACtF,CAAC;;;ACDD,MAAM,MAAY,OAA0B,YAC1C,OAAO,UAAU,aAAc,MAAwB,OAAO,IAAI;AAEpE,MAAa,OAAA,GAAMC,4BAAAA,gBAAAA,CAAgB;CACjC,MAAM;CACN,UAAU,aAAa,EACrB,IAAI,SAAuC;EAAE,OAAO,CAAC,GAAGC,0BAAiB,OAAO,CAAC;CAAG,EACtF;AACF,CAAC"}
|
package/dist/extensions/mcp.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineMcpPlugin, defineMcpSkill } from "@agimon-ai/po-core/mcpFacet";
|
|
2
|
-
import { readPackageResource } from "@agimon-ai/po-core/
|
|
2
|
+
import { readPackageResource } from "@agimon-ai/po-core/serverPlugin";
|
|
3
3
|
//#region src/extensions/workspaces/sessions/(backend)/skill/po-use-cache.mcp.ts
|
|
4
4
|
var po_use_cache_mcp_default = defineMcpSkill({
|
|
5
5
|
name: "po-use-cache",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.mjs","names":["skillPoUseCache"],"sources":["../../src/extensions/workspaces/sessions/(backend)/skill/po-use-cache.mcp.ts","../../generated/mcp.ts"],"sourcesContent":["import { defineMcpSkill } from '@agimon-ai/po-core/mcpFacet';\nimport { readPackageResource } from '@agimon-ai/po-core/
|
|
1
|
+
{"version":3,"file":"mcp.mjs","names":["skillPoUseCache"],"sources":["../../src/extensions/workspaces/sessions/(backend)/skill/po-use-cache.mcp.ts","../../generated/mcp.ts"],"sourcesContent":["import { defineMcpSkill } from '@agimon-ai/po-core/mcpFacet';\nimport { readPackageResource } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineMcpSkill({\n name: 'po-use-cache',\n description: 'Inspect Po provider prompt cache policy, routing identity, and provider-observed usage.',\n read: () => readPackageResource(import.meta.url, 'src/prompts/po-use-cache/SKILL.md'),\n});\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineMcpPlugin, type PoMcpSessionPlugin } from '@agimon-ai/po-core/mcpFacet';\n\nimport skillPoUseCache from '../src/extensions/workspaces/sessions/(backend)/skill/po-use-cache.mcp';\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\n\nexport const mcp = defineMcpPlugin({\n name: '@agimon-ai/po-cache',\n session: (context) => ({\n get skills(): PoMcpSessionPlugin['skills'] { return [at(skillPoUseCache, context)]; },\n }) satisfies PoMcpSessionPlugin,\n});\n\nexport default mcp;\n"],"mappings":";;;AAGA,IAAA,2BAAe,eAAe;CAC5B,MAAM;CACN,aAAa;CACb,YAAY,oBAAoB,YAAY,KAAK,mCAAmC;AACtF,CAAC;;;ACDD,MAAM,MAAY,OAA0B,YAC1C,OAAO,UAAU,aAAc,MAAwB,OAAO,IAAI;AAEpE,MAAa,MAAM,gBAAgB;CACjC,MAAM;CACN,UAAU,aAAa,EACrB,IAAI,SAAuC;EAAE,OAAO,CAAC,GAAGA,0BAAiB,OAAO,CAAC;CAAG,EACtF;AACF,CAAC"}
|
|
@@ -5,10 +5,10 @@ Object.defineProperties(exports, {
|
|
|
5
5
|
const require_environment = require("../environment-CRhmV8ze.cjs");
|
|
6
6
|
const require_promptCacheTelemetry = require("../promptCacheTelemetry-DeN4LdSo.cjs");
|
|
7
7
|
let node_crypto = require("node:crypto");
|
|
8
|
-
let
|
|
8
|
+
let _agimon_ai_po_core_serverPlugin = require("@agimon-ai/po-core/serverPlugin");
|
|
9
9
|
let _agimon_ai_po_core_extensionFile = require("@agimon-ai/po-core/extensionFile");
|
|
10
|
+
let _agimon_ai_po_config = require("@agimon-ai/po-config");
|
|
10
11
|
let _agimon_ai_po_core_platform = require("@agimon-ai/po-core/platform");
|
|
11
|
-
let _agimon_ai_po_config_harnessStore = require("@agimon-ai/po-config/harnessStore");
|
|
12
12
|
let _agimon_ai_po_minor_mode = require("@agimon-ai/po-minor-mode");
|
|
13
13
|
let node_path = require("node:path");
|
|
14
14
|
let _earendil_works_pi_coding_agent = require("@earendil-works/pi-coding-agent");
|
|
@@ -152,9 +152,9 @@ function isErrorMessage(message) {
|
|
|
152
152
|
const record = typeof message === "object" && message !== null ? message : void 0;
|
|
153
153
|
return record?.stopReason === "error" || record?.stopReason === "aborted";
|
|
154
154
|
}
|
|
155
|
-
function createCacheRuntime(dependencies, environment) {
|
|
156
|
-
const parentNamespaceEnvironment = new OwnedEnvironmentValue(require_environment.PO_PROMPT_CACHE_PARENT_NAMESPACE_ENV);
|
|
157
|
-
const rootSessionEnvironment = new OwnedEnvironmentValue(require_environment.PO_PROMPT_CACHE_ROOT_SESSION_ENV);
|
|
155
|
+
function createCacheRuntime(dependencies, environment, readHarness, namespaceEnvironment) {
|
|
156
|
+
const parentNamespaceEnvironment = new OwnedEnvironmentValue(require_environment.PO_PROMPT_CACHE_PARENT_NAMESPACE_ENV, namespaceEnvironment);
|
|
157
|
+
const rootSessionEnvironment = new OwnedEnvironmentValue(require_environment.PO_PROMPT_CACHE_ROOT_SESSION_ENV, namespaceEnvironment);
|
|
158
158
|
const projectedParentNamespace = stringValue(environment[require_environment.PO_PROMPT_CACHE_PARENT_NAMESPACE_ENV]);
|
|
159
159
|
const childProjection = stringValue(environment[require_environment.PO_PROMPT_CACHE_CHILD_PROJECTION_ENV]);
|
|
160
160
|
const isProjectedChild = Boolean(projectedParentNamespace && childProjection);
|
|
@@ -164,7 +164,7 @@ function createCacheRuntime(dependencies, environment) {
|
|
|
164
164
|
const refreshParentNamespace = () => {
|
|
165
165
|
if (isProjectedChild) return parentNamespace;
|
|
166
166
|
if (!rootSessionId) return void 0;
|
|
167
|
-
const harness = (
|
|
167
|
+
const harness = readHarness();
|
|
168
168
|
parentNamespace = require_promptCacheTelemetry.createParentPromptCacheNamespace({
|
|
169
169
|
rootSessionId,
|
|
170
170
|
compositionFingerprint: harness.compositionFingerprint,
|
|
@@ -214,6 +214,12 @@ function createCacheRuntime(dependencies, environment) {
|
|
|
214
214
|
};
|
|
215
215
|
}
|
|
216
216
|
//#endregion
|
|
217
|
+
//#region src/services/environment/sync.ts
|
|
218
|
+
/** Node's optimizer integrates with the process-level Pi provider environment. */
|
|
219
|
+
function cacheEnvironment(_environment) {
|
|
220
|
+
return process.env;
|
|
221
|
+
}
|
|
222
|
+
//#endregion
|
|
217
223
|
//#region src/services/agentDirectory/index.ts
|
|
218
224
|
/** Pi's agent directory, where the optimizer keeps its state; the edge build swaps in `index.edge.ts`. */
|
|
219
225
|
function defaultAgentDirectory() {
|
|
@@ -3225,6 +3231,15 @@ function createOptimizerSupport(STATE_DIR, environment, fs) {
|
|
|
3225
3231
|
};
|
|
3226
3232
|
}
|
|
3227
3233
|
//#endregion
|
|
3234
|
+
//#region src/services/nativeOptimizer/sync.ts
|
|
3235
|
+
/** Process metadata used by Node's persisted optimizer shards. */
|
|
3236
|
+
function cacheProcessIdentity() {
|
|
3237
|
+
return {
|
|
3238
|
+
pid: process.pid,
|
|
3239
|
+
ppid: process.ppid
|
|
3240
|
+
};
|
|
3241
|
+
}
|
|
3242
|
+
//#endregion
|
|
3228
3243
|
//#region src/services/nativeOptimizer/index.ts
|
|
3229
3244
|
const STATUS_KEY = "pi-cache-stats";
|
|
3230
3245
|
const PERSIST_DEBOUNCE_MS = 2e3;
|
|
@@ -3289,8 +3304,7 @@ function createNativeOptimizer(initial, fs, stateDir = defaultAgentDirectory())
|
|
|
3289
3304
|
instanceId,
|
|
3290
3305
|
sessionHash,
|
|
3291
3306
|
process: {
|
|
3292
|
-
|
|
3293
|
-
ppid: process.ppid,
|
|
3307
|
+
...cacheProcessIdentity(),
|
|
3294
3308
|
instanceStartedAt
|
|
3295
3309
|
},
|
|
3296
3310
|
lifecycle: {
|
|
@@ -3522,7 +3536,7 @@ function createNativeOptimizer(initial, fs, stateDir = defaultAgentDirectory())
|
|
|
3522
3536
|
handle: (_event, context) => serialized(async () => {
|
|
3523
3537
|
if (started || closed) return;
|
|
3524
3538
|
started = true;
|
|
3525
|
-
releaseRetention = acquireEnvironmentValue("PI_CACHE_RETENTION", "long");
|
|
3539
|
+
releaseRetention = acquireEnvironmentValue("PI_CACHE_RETENTION", "long", cacheEnvironment(initial.environment));
|
|
3526
3540
|
await support.refreshFileConfig();
|
|
3527
3541
|
currentGlobalEpoch = await support.readGlobalStatsEpoch();
|
|
3528
3542
|
await support.removeLegacyStatsFiles();
|
|
@@ -3593,10 +3607,14 @@ function createNativeOptimizer(initial, fs, stateDir = defaultAgentDirectory())
|
|
|
3593
3607
|
var root_server_default = (0, _agimon_ai_po_core_extensionFile.defineRoot)(({ agent, context: root }) => {
|
|
3594
3608
|
if (!agent) throw new Error("Cache statistics require the native session host.");
|
|
3595
3609
|
const telemetry = new require_promptCacheTelemetry.PromptCacheTelemetry();
|
|
3610
|
+
let config;
|
|
3596
3611
|
const runtime = createCacheRuntime({
|
|
3597
3612
|
telemetry,
|
|
3598
3613
|
now: Date.now
|
|
3599
|
-
}, agent.context.environment)
|
|
3614
|
+
}, agent.context.environment, () => {
|
|
3615
|
+
if (!config) throw new Error("Cache requires the session configuration.");
|
|
3616
|
+
return config.getSnapshot().harness;
|
|
3617
|
+
}, cacheEnvironment(agent.context.environment));
|
|
3600
3618
|
const optimizer = createNativeOptimizer(agent.context, (0, _agimon_ai_po_core_platform.requirePoFs)(root));
|
|
3601
3619
|
return {
|
|
3602
3620
|
value: { hooks: optimizer.hooks.map((hook) => {
|
|
@@ -3616,9 +3634,20 @@ var root_server_default = (0, _agimon_ai_po_core_extensionFile.defineRoot)(({ ag
|
|
|
3616
3634
|
};
|
|
3617
3635
|
return hook;
|
|
3618
3636
|
}) },
|
|
3619
|
-
services: [
|
|
3620
|
-
|
|
3621
|
-
|
|
3637
|
+
services: [
|
|
3638
|
+
(context) => {
|
|
3639
|
+
context.inject([_agimon_ai_po_config.PO_CONFIG_SERVICE], (scoped) => {
|
|
3640
|
+
config = scoped.get(_agimon_ai_po_config.PO_CONFIG_SERVICE);
|
|
3641
|
+
return () => {
|
|
3642
|
+
config = void 0;
|
|
3643
|
+
};
|
|
3644
|
+
});
|
|
3645
|
+
},
|
|
3646
|
+
(context) => {
|
|
3647
|
+
new require_promptCacheTelemetry.PromptCacheTelemetryService(context, telemetry);
|
|
3648
|
+
},
|
|
3649
|
+
runtime.plugin
|
|
3650
|
+
],
|
|
3622
3651
|
async onDispose() {
|
|
3623
3652
|
try {
|
|
3624
3653
|
await optimizer.dispose();
|
|
@@ -3627,7 +3656,7 @@ var root_server_default = (0, _agimon_ai_po_core_extensionFile.defineRoot)(({ ag
|
|
|
3627
3656
|
}
|
|
3628
3657
|
}
|
|
3629
3658
|
};
|
|
3630
|
-
});
|
|
3659
|
+
}, { inject: [(0, _agimon_ai_po_core_extensionFile.defineServiceContract)(_agimon_ai_po_config.PO_CONFIG_SERVICE, { scope: "session" })] });
|
|
3631
3660
|
//#endregion
|
|
3632
3661
|
//#region src/extensions/workspaces/sessions/(backend)/hook/agent-settled.server.ts
|
|
3633
3662
|
var agent_settled_server_default = (0, _agimon_ai_po_core_extensionFile.defineHook)((context) => context.root.hooks.find((hook) => hook.event === "agent_settled"));
|
|
@@ -3690,11 +3719,12 @@ const via = (identity, value) => value === void 0 ? void 0 : {
|
|
|
3690
3719
|
...identity,
|
|
3691
3720
|
...value
|
|
3692
3721
|
};
|
|
3693
|
-
const
|
|
3722
|
+
const serverPlugin = (0, _agimon_ai_po_core_serverPlugin.defineServerPlugin)({
|
|
3694
3723
|
name: "@agimon-ai/po-cache",
|
|
3695
|
-
providerOverrides: (0,
|
|
3724
|
+
providerOverrides: (0, _agimon_ai_po_core_serverPlugin.composeServerProviderOverrides)(root_server_default),
|
|
3725
|
+
injects: (0, _agimon_ai_po_core_extensionFile.composeRootInjects)({ session: [root_server_default] }),
|
|
3696
3726
|
session: async (context) => {
|
|
3697
|
-
const scopeSession = await root_server_default
|
|
3727
|
+
const scopeSession = await context.scopeRoot("session", root_server_default, context);
|
|
3698
3728
|
const contextSession = {
|
|
3699
3729
|
...context,
|
|
3700
3730
|
root: scopeSession.value
|
|
@@ -3720,7 +3750,7 @@ const facet = (0, _agimon_ai_po_core_serverFacet.defineServerPlugin)({
|
|
|
3720
3750
|
}
|
|
3721
3751
|
});
|
|
3722
3752
|
//#endregion
|
|
3723
|
-
exports.default =
|
|
3724
|
-
exports.
|
|
3753
|
+
exports.default = serverPlugin;
|
|
3754
|
+
exports.serverPlugin = serverPlugin;
|
|
3725
3755
|
|
|
3726
3756
|
//# sourceMappingURL=server.cjs.map
|