@agimon-ai/doompi-autocompact 0.0.1-alpha.74 → 0.0.1-alpha.76

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.
Files changed (111) hide show
  1. package/dist/api-contracts.cjs +7 -0
  2. package/dist/api-contracts.d.cts +2 -0
  3. package/dist/api-contracts.d.mts +2 -0
  4. package/dist/api-contracts.mjs +2 -0
  5. package/dist/extensions/pi.cjs +41 -0
  6. package/dist/extensions/pi.cjs.map +1 -0
  7. package/dist/extensions/pi.d.cts +5 -0
  8. package/dist/extensions/pi.d.cts.map +1 -0
  9. package/dist/extensions/pi.d.mts +5 -0
  10. package/dist/extensions/pi.d.mts.map +1 -0
  11. package/dist/extensions/pi.mjs +36 -0
  12. package/dist/extensions/pi.mjs.map +1 -0
  13. package/dist/extensions/server.cjs +25 -0
  14. package/dist/extensions/server.cjs.map +1 -0
  15. package/dist/extensions/server.d.cts +5 -0
  16. package/dist/extensions/server.d.cts.map +1 -0
  17. package/dist/extensions/server.d.mts +5 -0
  18. package/dist/extensions/server.d.mts.map +1 -0
  19. package/dist/extensions/server.mjs +21 -0
  20. package/dist/extensions/server.mjs.map +1 -0
  21. package/dist/extensions/web.mjs +161 -0
  22. package/dist/extensions/web.mjs.map +1 -0
  23. package/dist/index.cjs +3 -0
  24. package/dist/index.d.cts +3 -0
  25. package/dist/index.d.mts +3 -0
  26. package/dist/index.mjs +2 -0
  27. package/dist/src/constants/autocompact.cjs +41 -0
  28. package/dist/src/constants/autocompact.cjs.map +1 -0
  29. package/dist/src/constants/autocompact.mjs +35 -0
  30. package/dist/src/constants/autocompact.mjs.map +1 -0
  31. package/dist/src/constants/runtime.cjs +19 -0
  32. package/dist/src/constants/runtime.cjs.map +1 -0
  33. package/dist/src/constants/runtime.mjs +15 -0
  34. package/dist/src/constants/runtime.mjs.map +1 -0
  35. package/dist/src/extensions/workspaces/sessions/(backend)/_lib/piRoot.cjs +14 -0
  36. package/dist/src/extensions/workspaces/sessions/(backend)/_lib/piRoot.cjs.map +1 -0
  37. package/dist/src/extensions/workspaces/sessions/(backend)/_lib/piRoot.mjs +14 -0
  38. package/dist/src/extensions/workspaces/sessions/(backend)/_lib/piRoot.mjs.map +1 -0
  39. package/dist/src/extensions/workspaces/sessions/(backend)/hook/agent-settled.cli.cjs +6 -0
  40. package/dist/src/extensions/workspaces/sessions/(backend)/hook/agent-settled.cli.cjs.map +1 -0
  41. package/dist/src/extensions/workspaces/sessions/(backend)/hook/agent-settled.cli.mjs +7 -0
  42. package/dist/src/extensions/workspaces/sessions/(backend)/hook/agent-settled.cli.mjs.map +1 -0
  43. package/dist/src/extensions/workspaces/sessions/(backend)/hook/context.cli.cjs +6 -0
  44. package/dist/src/extensions/workspaces/sessions/(backend)/hook/context.cli.cjs.map +1 -0
  45. package/dist/src/extensions/workspaces/sessions/(backend)/hook/context.cli.mjs +7 -0
  46. package/dist/src/extensions/workspaces/sessions/(backend)/hook/context.cli.mjs.map +1 -0
  47. package/dist/src/extensions/workspaces/sessions/(backend)/hook/session-before-compact.cli.cjs +6 -0
  48. package/dist/src/extensions/workspaces/sessions/(backend)/hook/session-before-compact.cli.cjs.map +1 -0
  49. package/dist/src/extensions/workspaces/sessions/(backend)/hook/session-before-compact.cli.mjs +7 -0
  50. package/dist/src/extensions/workspaces/sessions/(backend)/hook/session-before-compact.cli.mjs.map +1 -0
  51. package/dist/src/extensions/workspaces/sessions/(backend)/hook/session-compact.cli.cjs +6 -0
  52. package/dist/src/extensions/workspaces/sessions/(backend)/hook/session-compact.cli.cjs.map +1 -0
  53. package/dist/src/extensions/workspaces/sessions/(backend)/hook/session-compact.cli.mjs +7 -0
  54. package/dist/src/extensions/workspaces/sessions/(backend)/hook/session-compact.cli.mjs.map +1 -0
  55. package/dist/src/extensions/workspaces/sessions/(backend)/hook/session-start.cli.cjs +6 -0
  56. package/dist/src/extensions/workspaces/sessions/(backend)/hook/session-start.cli.cjs.map +1 -0
  57. package/dist/src/extensions/workspaces/sessions/(backend)/hook/session-start.cli.mjs +7 -0
  58. package/dist/src/extensions/workspaces/sessions/(backend)/hook/session-start.cli.mjs.map +1 -0
  59. package/dist/src/extensions/workspaces/sessions/(backend)/hook/session-tree.cli.cjs +6 -0
  60. package/dist/src/extensions/workspaces/sessions/(backend)/hook/session-tree.cli.cjs.map +1 -0
  61. package/dist/src/extensions/workspaces/sessions/(backend)/hook/session-tree.cli.mjs +7 -0
  62. package/dist/src/extensions/workspaces/sessions/(backend)/hook/session-tree.cli.mjs.map +1 -0
  63. package/dist/src/extensions/workspaces/sessions/(backend)/hook/turn-end.cli.cjs +6 -0
  64. package/dist/src/extensions/workspaces/sessions/(backend)/hook/turn-end.cli.cjs.map +1 -0
  65. package/dist/src/extensions/workspaces/sessions/(backend)/hook/turn-end.cli.mjs +7 -0
  66. package/dist/src/extensions/workspaces/sessions/(backend)/hook/turn-end.cli.mjs.map +1 -0
  67. package/dist/src/extensions/workspaces/sessions/(backend)/root.cli.cjs +7 -0
  68. package/dist/src/extensions/workspaces/sessions/(backend)/root.cli.cjs.map +1 -0
  69. package/dist/src/extensions/workspaces/sessions/(backend)/root.cli.mjs +8 -0
  70. package/dist/src/extensions/workspaces/sessions/(backend)/root.cli.mjs.map +1 -0
  71. package/dist/src/extensions/workspaces/sessions/(backend)/root.server.cjs +18 -0
  72. package/dist/src/extensions/workspaces/sessions/(backend)/root.server.cjs.map +1 -0
  73. package/dist/src/extensions/workspaces/sessions/(backend)/root.server.mjs +18 -0
  74. package/dist/src/extensions/workspaces/sessions/(backend)/root.server.mjs.map +1 -0
  75. package/dist/src/schemas/apiContracts.cjs +13 -0
  76. package/dist/src/schemas/apiContracts.cjs.map +1 -0
  77. package/dist/src/schemas/apiContracts.d.cts +53 -0
  78. package/dist/src/schemas/apiContracts.d.cts.map +1 -0
  79. package/dist/src/schemas/apiContracts.d.mts +53 -0
  80. package/dist/src/schemas/apiContracts.d.mts.map +1 -0
  81. package/dist/src/schemas/apiContracts.mjs +13 -0
  82. package/dist/src/schemas/apiContracts.mjs.map +1 -0
  83. package/dist/src/services/autocompactRuntime/index.cjs +732 -0
  84. package/dist/src/services/autocompactRuntime/index.cjs.map +1 -0
  85. package/dist/src/services/autocompactRuntime/index.mjs +729 -0
  86. package/dist/src/services/autocompactRuntime/index.mjs.map +1 -0
  87. package/dist/src/services/autocompactTelemetry/index.cjs +43 -0
  88. package/dist/src/services/autocompactTelemetry/index.cjs.map +1 -0
  89. package/dist/src/services/autocompactTelemetry/index.mjs +42 -0
  90. package/dist/src/services/autocompactTelemetry/index.mjs.map +1 -0
  91. package/dist/src/services/compactionPolicy/index.cjs +314 -0
  92. package/dist/src/services/compactionPolicy/index.cjs.map +1 -0
  93. package/dist/src/services/compactionPolicy/index.d.cts +6 -0
  94. package/dist/src/services/compactionPolicy/index.d.cts.map +1 -0
  95. package/dist/src/services/compactionPolicy/index.d.mts +6 -0
  96. package/dist/src/services/compactionPolicy/index.d.mts.map +1 -0
  97. package/dist/src/services/compactionPolicy/index.mjs +296 -0
  98. package/dist/src/services/compactionPolicy/index.mjs.map +1 -0
  99. package/dist/src/services/modelOverrides/index.cjs +26 -0
  100. package/dist/src/services/modelOverrides/index.cjs.map +1 -0
  101. package/dist/src/services/modelOverrides/index.mjs +26 -0
  102. package/dist/src/services/modelOverrides/index.mjs.map +1 -0
  103. package/dist/src/services/summarizationModel/index.cjs +19 -0
  104. package/dist/src/services/summarizationModel/index.cjs.map +1 -0
  105. package/dist/src/services/summarizationModel/index.mjs +19 -0
  106. package/dist/src/services/summarizationModel/index.mjs.map +1 -0
  107. package/dist/src/types/autocompact.d.cts +7 -0
  108. package/dist/src/types/autocompact.d.cts.map +1 -0
  109. package/dist/src/types/autocompact.d.mts +7 -0
  110. package/dist/src/types/autocompact.d.mts.map +1 -0
  111. package/package.json +5 -5
@@ -0,0 +1,7 @@
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
5
+ const require_apiContracts = require("./src/schemas/apiContracts.cjs");
6
+ exports.apiContracts = require_apiContracts.apiContracts;
7
+ exports.default = require_apiContracts.apiContracts;
@@ -0,0 +1,2 @@
1
+ import { apiContracts } from "./src/schemas/apiContracts.cjs";
2
+ export { apiContracts, apiContracts as default };
@@ -0,0 +1,2 @@
1
+ import { apiContracts } from "./src/schemas/apiContracts.mjs";
2
+ export { apiContracts, apiContracts as default };
@@ -0,0 +1,2 @@
1
+ import { apiContracts } from "./src/schemas/apiContracts.mjs";
2
+ export { apiContracts, apiContracts as default };
@@ -0,0 +1,41 @@
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
5
+ const require_root_cli = require("../src/extensions/workspaces/sessions/(backend)/root.cli.cjs");
6
+ const require_agent_settled_cli = require("../src/extensions/workspaces/sessions/(backend)/hook/agent-settled.cli.cjs");
7
+ const require_context_cli = require("../src/extensions/workspaces/sessions/(backend)/hook/context.cli.cjs");
8
+ const require_session_before_compact_cli = require("../src/extensions/workspaces/sessions/(backend)/hook/session-before-compact.cli.cjs");
9
+ const require_session_compact_cli = require("../src/extensions/workspaces/sessions/(backend)/hook/session-compact.cli.cjs");
10
+ const require_session_start_cli = require("../src/extensions/workspaces/sessions/(backend)/hook/session-start.cli.cjs");
11
+ const require_session_tree_cli = require("../src/extensions/workspaces/sessions/(backend)/hook/session-tree.cli.cjs");
12
+ const require_turn_end_cli = require("../src/extensions/workspaces/sessions/(backend)/hook/turn-end.cli.cjs");
13
+ let _agimon_ai_doompi_core_pi_extension = require("@agimon-ai/doompi-core/pi-extension");
14
+ let _agimon_ai_doompi_core_extension_file = require("@agimon-ai/doompi-core/extension-file");
15
+ //#region generated/pi.ts
16
+ const at = (value, context) => typeof value === "function" ? value(context) : value;
17
+ const extension = (0, _agimon_ai_doompi_core_pi_extension.definePiExtension)("@agimon-ai/doompi-autocompact", async (context) => {
18
+ const scopeSession = await require_root_cli.default(context);
19
+ const contextSession = {
20
+ ...context,
21
+ root: scopeSession.value
22
+ };
23
+ return {
24
+ ...(0, _agimon_ai_doompi_core_extension_file.composeRootHooks)(scopeSession),
25
+ events: {
26
+ agent_settled: at(require_agent_settled_cli.default, contextSession),
27
+ context: at(require_context_cli.default, contextSession),
28
+ session_before_compact: at(require_session_before_compact_cli.default, contextSession),
29
+ session_compact: at(require_session_compact_cli.default, contextSession),
30
+ session_start: at(require_session_start_cli.default, contextSession),
31
+ session_tree: at(require_session_tree_cli.default, contextSession),
32
+ turn_end: at(require_turn_end_cli.default, contextSession)
33
+ },
34
+ services: [...scopeSession.services ?? []]
35
+ };
36
+ });
37
+ //#endregion
38
+ exports.default = extension;
39
+ exports.extension = extension;
40
+
41
+ //# sourceMappingURL=pi.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pi.cjs","names":["definePiExtension","rootSession","composeRootHooks","hookAgentSettled","hookContext","hookSessionBeforeCompact","hookSessionCompact","hookSessionStart","hookSessionTree","hookTurnEnd"],"sources":["../../generated/pi.ts"],"sourcesContent":["// Generated by @agimon-ai/doompi-build. Do not edit by hand.\nimport { definePiExtension, type PiPluginContext, type PiPluginContributions } from '@agimon-ai/doompi-core/pi-extension';\nimport { composeRootHooks } from '@agimon-ai/doompi-core/extension-file';\n\nimport rootSession from '../src/extensions/workspaces/sessions/(backend)/root.cli';\nimport hookAgentSettled from '../src/extensions/workspaces/sessions/(backend)/hook/agent-settled.cli';\nimport hookContext from '../src/extensions/workspaces/sessions/(backend)/hook/context.cli';\nimport hookSessionBeforeCompact from '../src/extensions/workspaces/sessions/(backend)/hook/session-before-compact.cli';\nimport hookSessionCompact from '../src/extensions/workspaces/sessions/(backend)/hook/session-compact.cli';\nimport hookSessionStart from '../src/extensions/workspaces/sessions/(backend)/hook/session-start.cli';\nimport hookSessionTree from '../src/extensions/workspaces/sessions/(backend)/hook/session-tree.cli';\nimport hookTurnEnd from '../src/extensions/workspaces/sessions/(backend)/hook/turn-end.cli';\n\ntype OptionsOf<T> = T extends (context: PiPluginContext<infer Options>) => unknown ? Options : never;\ntype InferredOptions = Exclude<OptionsOf<typeof rootSession> | OptionsOf<typeof hookAgentSettled> | OptionsOf<typeof hookContext> | OptionsOf<typeof hookSessionBeforeCompact> | OptionsOf<typeof hookSessionCompact> | OptionsOf<typeof hookSessionStart> | OptionsOf<typeof hookSessionTree> | OptionsOf<typeof hookTurnEnd>, undefined>;\ntype Intersect<Union> =\n (Union extends unknown ? (value: Union) => void : never) extends (value: infer Value) => void ? Value : never;\ntype ExtensionOptions = [InferredOptions] extends [never] ? undefined : Intersect<InferredOptions>;\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 extension = definePiExtension<ExtensionOptions>('@agimon-ai/doompi-autocompact', async (context) => {\n const scopeSession = await rootSession(context);\n const contextSession = { ...context, root: scopeSession.value };\n return {\n ...composeRootHooks(scopeSession),\n events: {\n agent_settled: at(hookAgentSettled, contextSession) as NonNullable<PiPluginContributions['events']>['agent_settled'],\n context: at(hookContext, contextSession) as NonNullable<PiPluginContributions['events']>['context'],\n session_before_compact: at(hookSessionBeforeCompact, contextSession) as NonNullable<PiPluginContributions['events']>['session_before_compact'],\n session_compact: at(hookSessionCompact, contextSession) as NonNullable<PiPluginContributions['events']>['session_compact'],\n session_start: at(hookSessionStart, contextSession) as NonNullable<PiPluginContributions['events']>['session_start'],\n session_tree: at(hookSessionTree, contextSession) as NonNullable<PiPluginContributions['events']>['session_tree'],\n turn_end: at(hookTurnEnd, contextSession) as NonNullable<PiPluginContributions['events']>['turn_end'],\n },\n services: [...(scopeSession.services ?? [])],\n };\n});\n\nexport default extension;\n"],"mappings":";;;;;;;;;;;;;;;AAoBA,MAAM,MAAY,OAA0B,YAC1C,OAAO,UAAU,aAAc,MAAwB,OAAO,IAAI;AAEpE,MAAa,aAAA,GAAYA,oCAAAA,kBAAAA,CAAoC,iCAAiC,OAAO,YAAY;CAC/G,MAAM,eAAe,MAAMC,iBAAAA,QAAY,OAAO;CAC9C,MAAM,iBAAiB;EAAE,GAAG;EAAS,MAAM,aAAa;CAAM;CAC9D,OAAO;EACL,IAAA,GAAGC,sCAAAA,iBAAAA,CAAiB,YAAY;EAChC,QAAQ;GACN,eAAe,GAAGC,0BAAAA,SAAkB,cAAc;GAClD,SAAS,GAAGC,oBAAAA,SAAa,cAAc;GACvC,wBAAwB,GAAGC,mCAAAA,SAA0B,cAAc;GACnE,iBAAiB,GAAGC,4BAAAA,SAAoB,cAAc;GACtD,eAAe,GAAGC,0BAAAA,SAAkB,cAAc;GAClD,cAAc,GAAGC,yBAAAA,SAAiB,cAAc;GAChD,UAAU,GAAGC,qBAAAA,SAAa,cAAc;EAC1C;EACA,UAAU,CAAC,GAAI,aAAa,YAAY,CAAC,CAAE;CAC7C;AACF,CAAC"}
@@ -0,0 +1,5 @@
1
+ //#region generated/pi.d.ts
2
+ export declare const extension: import("@agimon-ai/doompi-core/runtime-pi-extension").DefinedPiExtension<undefined>;
3
+ //#endregion
4
+ export { extension as default };
5
+ //# sourceMappingURL=pi.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pi.d.cts","names":[],"sources":["../../generated/pi.ts"],"mappings":";qBAuBa,iEAAS"}
@@ -0,0 +1,5 @@
1
+ //#region generated/pi.d.ts
2
+ export declare const extension: import("@agimon-ai/doompi-core/runtime-pi-extension").DefinedPiExtension<undefined>;
3
+ //#endregion
4
+ export { extension as default };
5
+ //# sourceMappingURL=pi.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pi.d.mts","names":[],"sources":["../../generated/pi.ts"],"mappings":";qBAuBa,iEAAS"}
@@ -0,0 +1,36 @@
1
+ import root_cli_default from "../src/extensions/workspaces/sessions/(backend)/root.cli.mjs";
2
+ import agent_settled_cli_default from "../src/extensions/workspaces/sessions/(backend)/hook/agent-settled.cli.mjs";
3
+ import context_cli_default from "../src/extensions/workspaces/sessions/(backend)/hook/context.cli.mjs";
4
+ import session_before_compact_cli_default from "../src/extensions/workspaces/sessions/(backend)/hook/session-before-compact.cli.mjs";
5
+ import session_compact_cli_default from "../src/extensions/workspaces/sessions/(backend)/hook/session-compact.cli.mjs";
6
+ import session_start_cli_default from "../src/extensions/workspaces/sessions/(backend)/hook/session-start.cli.mjs";
7
+ import session_tree_cli_default from "../src/extensions/workspaces/sessions/(backend)/hook/session-tree.cli.mjs";
8
+ import turn_end_cli_default from "../src/extensions/workspaces/sessions/(backend)/hook/turn-end.cli.mjs";
9
+ import { definePiExtension } from "@agimon-ai/doompi-core/pi-extension";
10
+ import { composeRootHooks } from "@agimon-ai/doompi-core/extension-file";
11
+ //#region generated/pi.ts
12
+ const at = (value, context) => typeof value === "function" ? value(context) : value;
13
+ const extension = definePiExtension("@agimon-ai/doompi-autocompact", async (context) => {
14
+ const scopeSession = await root_cli_default(context);
15
+ const contextSession = {
16
+ ...context,
17
+ root: scopeSession.value
18
+ };
19
+ return {
20
+ ...composeRootHooks(scopeSession),
21
+ events: {
22
+ agent_settled: at(agent_settled_cli_default, contextSession),
23
+ context: at(context_cli_default, contextSession),
24
+ session_before_compact: at(session_before_compact_cli_default, contextSession),
25
+ session_compact: at(session_compact_cli_default, contextSession),
26
+ session_start: at(session_start_cli_default, contextSession),
27
+ session_tree: at(session_tree_cli_default, contextSession),
28
+ turn_end: at(turn_end_cli_default, contextSession)
29
+ },
30
+ services: [...scopeSession.services ?? []]
31
+ };
32
+ });
33
+ //#endregion
34
+ export { extension as default, extension };
35
+
36
+ //# sourceMappingURL=pi.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pi.mjs","names":["rootSession","hookAgentSettled","hookContext","hookSessionBeforeCompact","hookSessionCompact","hookSessionStart","hookSessionTree","hookTurnEnd"],"sources":["../../generated/pi.ts"],"sourcesContent":["// Generated by @agimon-ai/doompi-build. Do not edit by hand.\nimport { definePiExtension, type PiPluginContext, type PiPluginContributions } from '@agimon-ai/doompi-core/pi-extension';\nimport { composeRootHooks } from '@agimon-ai/doompi-core/extension-file';\n\nimport rootSession from '../src/extensions/workspaces/sessions/(backend)/root.cli';\nimport hookAgentSettled from '../src/extensions/workspaces/sessions/(backend)/hook/agent-settled.cli';\nimport hookContext from '../src/extensions/workspaces/sessions/(backend)/hook/context.cli';\nimport hookSessionBeforeCompact from '../src/extensions/workspaces/sessions/(backend)/hook/session-before-compact.cli';\nimport hookSessionCompact from '../src/extensions/workspaces/sessions/(backend)/hook/session-compact.cli';\nimport hookSessionStart from '../src/extensions/workspaces/sessions/(backend)/hook/session-start.cli';\nimport hookSessionTree from '../src/extensions/workspaces/sessions/(backend)/hook/session-tree.cli';\nimport hookTurnEnd from '../src/extensions/workspaces/sessions/(backend)/hook/turn-end.cli';\n\ntype OptionsOf<T> = T extends (context: PiPluginContext<infer Options>) => unknown ? Options : never;\ntype InferredOptions = Exclude<OptionsOf<typeof rootSession> | OptionsOf<typeof hookAgentSettled> | OptionsOf<typeof hookContext> | OptionsOf<typeof hookSessionBeforeCompact> | OptionsOf<typeof hookSessionCompact> | OptionsOf<typeof hookSessionStart> | OptionsOf<typeof hookSessionTree> | OptionsOf<typeof hookTurnEnd>, undefined>;\ntype Intersect<Union> =\n (Union extends unknown ? (value: Union) => void : never) extends (value: infer Value) => void ? Value : never;\ntype ExtensionOptions = [InferredOptions] extends [never] ? undefined : Intersect<InferredOptions>;\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 extension = definePiExtension<ExtensionOptions>('@agimon-ai/doompi-autocompact', async (context) => {\n const scopeSession = await rootSession(context);\n const contextSession = { ...context, root: scopeSession.value };\n return {\n ...composeRootHooks(scopeSession),\n events: {\n agent_settled: at(hookAgentSettled, contextSession) as NonNullable<PiPluginContributions['events']>['agent_settled'],\n context: at(hookContext, contextSession) as NonNullable<PiPluginContributions['events']>['context'],\n session_before_compact: at(hookSessionBeforeCompact, contextSession) as NonNullable<PiPluginContributions['events']>['session_before_compact'],\n session_compact: at(hookSessionCompact, contextSession) as NonNullable<PiPluginContributions['events']>['session_compact'],\n session_start: at(hookSessionStart, contextSession) as NonNullable<PiPluginContributions['events']>['session_start'],\n session_tree: at(hookSessionTree, contextSession) as NonNullable<PiPluginContributions['events']>['session_tree'],\n turn_end: at(hookTurnEnd, contextSession) as NonNullable<PiPluginContributions['events']>['turn_end'],\n },\n services: [...(scopeSession.services ?? [])],\n };\n});\n\nexport default extension;\n"],"mappings":";;;;;;;;;;;AAoBA,MAAM,MAAY,OAA0B,YAC1C,OAAO,UAAU,aAAc,MAAwB,OAAO,IAAI;AAEpE,MAAa,YAAY,kBAAoC,iCAAiC,OAAO,YAAY;CAC/G,MAAM,eAAe,MAAMA,iBAAY,OAAO;CAC9C,MAAM,iBAAiB;EAAE,GAAG;EAAS,MAAM,aAAa;CAAM;CAC9D,OAAO;EACL,GAAG,iBAAiB,YAAY;EAChC,QAAQ;GACN,eAAe,GAAGC,2BAAkB,cAAc;GAClD,SAAS,GAAGC,qBAAa,cAAc;GACvC,wBAAwB,GAAGC,oCAA0B,cAAc;GACnE,iBAAiB,GAAGC,6BAAoB,cAAc;GACtD,eAAe,GAAGC,2BAAkB,cAAc;GAClD,cAAc,GAAGC,0BAAiB,cAAc;GAChD,UAAU,GAAGC,sBAAa,cAAc;EAC1C;EACA,UAAU,CAAC,GAAI,aAAa,YAAY,CAAC,CAAE;CAC7C;AACF,CAAC"}
@@ -0,0 +1,25 @@
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
5
+ const require_root_server = require("../src/extensions/workspaces/sessions/(backend)/root.server.cjs");
6
+ let _agimon_ai_doompi_core_extension_file = require("@agimon-ai/doompi-core/extension-file");
7
+ //#region generated/server.ts
8
+ const facet = (0, require("@agimon-ai/doompi-core/server-facet").defineServerPlugin)({
9
+ name: "@agimon-ai/doompi-autocompact",
10
+ session: async (context) => {
11
+ const scopeSession = await require_root_server.default(context);
12
+ return {
13
+ ...(0, _agimon_ai_doompi_core_extension_file.composeRootHooks)(scopeSession),
14
+ services: [...scopeSession.services ?? []],
15
+ get activities() {
16
+ return [...scopeSession.activities ?? []];
17
+ }
18
+ };
19
+ }
20
+ });
21
+ //#endregion
22
+ exports.default = facet;
23
+ exports.facet = facet;
24
+
25
+ //# sourceMappingURL=server.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.cjs","names":["defineServerPlugin","rootSession","composeRootHooks"],"sources":["../../generated/server.ts"],"sourcesContent":["// Generated by @agimon-ai/doompi-build. Do not edit by hand.\nimport { defineServerPlugin, type DoomServerSessionPlugin } from '@agimon-ai/doompi-core/server-facet';\nimport { composeRootHooks } from '@agimon-ai/doompi-core/extension-file';\n\nimport rootSession from '../src/extensions/workspaces/sessions/(backend)/root.server';\n\nexport const facet = defineServerPlugin({\n name: '@agimon-ai/doompi-autocompact',\n session: async (context) => {\n const scopeSession = await rootSession(context);\n return {\n ...composeRootHooks(scopeSession),\n services: [...(scopeSession.services ?? [])],\n get activities(): DoomServerSessionPlugin['activities'] { return [...(scopeSession.activities ?? [])]; },\n };\n },\n});\n\nexport default facet;\n"],"mappings":";;;;;;;AAMA,MAAa,SAAA,gDAAQA,CAAAA,CAAAA,mBAAAA,CAAmB;CACtC,MAAM;CACN,SAAS,OAAO,YAAY;EAC1B,MAAM,eAAe,MAAMC,oBAAAA,QAAY,OAAO;EAC9C,OAAO;GACL,IAAA,GAAGC,sCAAAA,iBAAAA,CAAiB,YAAY;GAChC,UAAU,CAAC,GAAI,aAAa,YAAY,CAAC,CAAE;GAC3C,IAAI,aAAoD;IAAE,OAAO,CAAC,GAAI,aAAa,cAAc,CAAC,CAAE;GAAG;EACzG;CACF;AACF,CAAC"}
@@ -0,0 +1,5 @@
1
+ //#region generated/server.d.ts
2
+ export declare const facet: import("@agimon-ai/doompi-core/server-facet").DoomServerFacet;
3
+ //#endregion
4
+ export { facet as default };
5
+ //# sourceMappingURL=server.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.cts","names":[],"sources":["../../generated/server.ts"],"mappings":";qBAMa,qDAAK"}
@@ -0,0 +1,5 @@
1
+ //#region generated/server.d.ts
2
+ export declare const facet: import("@agimon-ai/doompi-core/server-facet").DoomServerFacet;
3
+ //#endregion
4
+ export { facet as default };
5
+ //# sourceMappingURL=server.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.mts","names":[],"sources":["../../generated/server.ts"],"mappings":";qBAMa,qDAAK"}
@@ -0,0 +1,21 @@
1
+ import root_server_default from "../src/extensions/workspaces/sessions/(backend)/root.server.mjs";
2
+ import { composeRootHooks } from "@agimon-ai/doompi-core/extension-file";
3
+ import { defineServerPlugin } from "@agimon-ai/doompi-core/server-facet";
4
+ //#region generated/server.ts
5
+ const facet = defineServerPlugin({
6
+ name: "@agimon-ai/doompi-autocompact",
7
+ session: async (context) => {
8
+ const scopeSession = await root_server_default(context);
9
+ return {
10
+ ...composeRootHooks(scopeSession),
11
+ services: [...scopeSession.services ?? []],
12
+ get activities() {
13
+ return [...scopeSession.activities ?? []];
14
+ }
15
+ };
16
+ }
17
+ });
18
+ //#endregion
19
+ export { facet as default, facet };
20
+
21
+ //# sourceMappingURL=server.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.mjs","names":["rootSession"],"sources":["../../generated/server.ts"],"sourcesContent":["// Generated by @agimon-ai/doompi-build. Do not edit by hand.\nimport { defineServerPlugin, type DoomServerSessionPlugin } from '@agimon-ai/doompi-core/server-facet';\nimport { composeRootHooks } from '@agimon-ai/doompi-core/extension-file';\n\nimport rootSession from '../src/extensions/workspaces/sessions/(backend)/root.server';\n\nexport const facet = defineServerPlugin({\n name: '@agimon-ai/doompi-autocompact',\n session: async (context) => {\n const scopeSession = await rootSession(context);\n return {\n ...composeRootHooks(scopeSession),\n services: [...(scopeSession.services ?? [])],\n get activities(): DoomServerSessionPlugin['activities'] { return [...(scopeSession.activities ?? [])]; },\n };\n },\n});\n\nexport default facet;\n"],"mappings":";;;;AAMA,MAAa,QAAQ,mBAAmB;CACtC,MAAM;CACN,SAAS,OAAO,YAAY;EAC1B,MAAM,eAAe,MAAMA,oBAAY,OAAO;EAC9C,OAAO;GACL,GAAG,iBAAiB,YAAY;GAChC,UAAU,CAAC,GAAI,aAAa,YAAY,CAAC,CAAE;GAC3C,IAAI,aAAoD;IAAE,OAAO,CAAC,GAAI,aAAa,cAAc,CAAC,CAAE;GAAG;EACzG;CACF;AACF,CAAC"}
@@ -0,0 +1,161 @@
1
+ import { defineSettingsSection, defineWebPlugin } from "@agimon-ai/doompi-core/web";
2
+ //#region src/constants/autocompact.ts
3
+ const COMPACTION_THRESHOLDS = {
4
+ 1: {
5
+ ratio: .5,
6
+ capTokens: 2e5
7
+ },
8
+ 2: {
9
+ ratio: .75,
10
+ capTokens: 5e5
11
+ },
12
+ 3: {
13
+ ratio: .95,
14
+ capTokens: 8e5
15
+ }
16
+ };
17
+ //#endregion
18
+ //#region src/types/autocompactSettings.ts
19
+ /**
20
+ * The autocompact settings, described once for both surfaces.
21
+ *
22
+ * The cockpit's settings page renders these, and the runtime reads the same key
23
+ * paths out of `.doom/config.yaml`, so the ids, labels and key paths live here
24
+ * rather than in either place.
25
+ *
26
+ * It lives under src/types because that is the one server root a browser bundle
27
+ * may read, which also means it may import nothing outside this directory:
28
+ * pulling the config package in for the thinking levels would drag a node
29
+ * module into the page. They are spelled out instead, and a test asserts they
30
+ * still match the parser's.
31
+ */
32
+ const AUTOCOMPACT_CONFIG_SECTION_ID = "autocompact";
33
+ const AUTOCOMPACT_PATH = ["modes", AUTOCOMPACT_CONFIG_SECTION_ID];
34
+ const THRESHOLDS_KEY = "thresholds";
35
+ /** Unset means the session's own model and thinking level do the summarizing. */
36
+ const INHERIT_MODEL = "inherit the session model";
37
+ const INHERIT_THINKING = "inherit";
38
+ /** Mirrors DOOM_PLANNING_THINKING_LEVELS; pinned by this package's config test. */
39
+ const AUTOCOMPACT_THINKING_LEVELS = [
40
+ "off",
41
+ "minimal",
42
+ "low",
43
+ "medium",
44
+ "high",
45
+ "xhigh",
46
+ "max"
47
+ ];
48
+ /** The parser accepts a real boolean too; the page can only write strings. */
49
+ const AUTOCOMPACT_ENABLED_VALUES = ["true", "false"];
50
+ //#endregion
51
+ //#region src/extensions/(frontend)/_lib/autocompactSettings.ts
52
+ /**
53
+ * The autocompact settings, as the cockpit's settings page renders them.
54
+ *
55
+ * Built from the same descriptor table the runtime resolves against, so the
56
+ * page and the extension cannot disagree about which config key a field writes.
57
+ * The host owns the scope switch and the writes; this only says what the fields
58
+ * are.
59
+ */
60
+ const autocompactSettingsSection = {
61
+ id: AUTOCOMPACT_CONFIG_SECTION_ID,
62
+ label: "autocompact",
63
+ detail: "the model that writes checkpoint summaries, and when each compaction pass fires",
64
+ order: 40,
65
+ fields: [
66
+ {
67
+ id: "enabled",
68
+ label: "enabled",
69
+ keyPath: [...AUTOCOMPACT_PATH, "enabled"],
70
+ placeholder: "on",
71
+ detail: "off leaves compaction to Pi. unset is on.",
72
+ options: AUTOCOMPACT_ENABLED_VALUES
73
+ },
74
+ {
75
+ id: "model",
76
+ label: "summarization model",
77
+ keyPath: [...AUTOCOMPACT_PATH, "model"],
78
+ placeholder: INHERIT_MODEL,
79
+ detail: "model that writes the checkpoint summaries.",
80
+ models: true
81
+ },
82
+ {
83
+ id: "thinking",
84
+ label: "summarization thinking",
85
+ keyPath: [...AUTOCOMPACT_PATH, "thinking"],
86
+ placeholder: INHERIT_THINKING,
87
+ detail: "thinking level appended to the summarization model.",
88
+ options: AUTOCOMPACT_THINKING_LEVELS
89
+ },
90
+ {
91
+ id: "thresholds.pass1",
92
+ label: "pass 1 threshold",
93
+ keyPath: [
94
+ ...AUTOCOMPACT_PATH,
95
+ THRESHOLDS_KEY,
96
+ "pass1"
97
+ ],
98
+ placeholder: String(COMPACTION_THRESHOLDS[1].ratio),
99
+ detail: "fraction of the remaining context window at which the first pass fires."
100
+ },
101
+ {
102
+ id: "thresholds.pass2",
103
+ label: "pass 2 threshold",
104
+ keyPath: [
105
+ ...AUTOCOMPACT_PATH,
106
+ THRESHOLDS_KEY,
107
+ "pass2"
108
+ ],
109
+ placeholder: String(COMPACTION_THRESHOLDS[2].ratio),
110
+ detail: "second pass. a value below pass 1 is raised back to it."
111
+ },
112
+ {
113
+ id: "thresholds.pass3",
114
+ label: "pass 3 threshold",
115
+ keyPath: [
116
+ ...AUTOCOMPACT_PATH,
117
+ THRESHOLDS_KEY,
118
+ "pass3"
119
+ ],
120
+ placeholder: String(COMPACTION_THRESHOLDS[3].ratio),
121
+ detail: "last pass before Pi compacts natively. a value below pass 2 is raised back to it."
122
+ }
123
+ ].map((shape) => ({
124
+ id: shape.id,
125
+ label: shape.label,
126
+ kind: shape.models === true || shape.options !== void 0 ? "select" : "text",
127
+ keyPath: shape.keyPath,
128
+ detail: shape.detail,
129
+ placeholder: shape.placeholder,
130
+ ...shape.models === true ? { optionsFrom: "models" } : {},
131
+ ...shape.options === void 0 ? {} : { options: shape.options.map((option) => ({
132
+ value: option,
133
+ label: option
134
+ })) }
135
+ }))
136
+ };
137
+ //#endregion
138
+ //#region src/extensions/(frontend)/setting/autocompact.web.ts
139
+ var autocompact_web_default$1 = defineSettingsSection(autocompactSettingsSection);
140
+ //#endregion
141
+ //#region src/extensions/workspaces/(frontend)/setting/autocompact.web.ts
142
+ var autocompact_web_default = defineSettingsSection(autocompactSettingsSection);
143
+ //#endregion
144
+ //#region generated/web.ts
145
+ const via = (identity, value) => ({
146
+ ...identity,
147
+ ...value
148
+ });
149
+ const webPlugin = defineWebPlugin({
150
+ id: "autocompact",
151
+ global: { get settingsSections() {
152
+ return [via({ id: "autocompact" }, autocompact_web_default$1)];
153
+ } },
154
+ workspace: { get settingsSections() {
155
+ return [via({ id: "autocompact" }, autocompact_web_default)];
156
+ } }
157
+ });
158
+ //#endregion
159
+ export { webPlugin };
160
+
161
+ //# sourceMappingURL=web.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web.mjs","names":["settingAutocompact","settingAutocompact2"],"sources":["../../src/constants/autocompact.ts","../../src/types/autocompactSettings.ts","../../src/extensions/(frontend)/_lib/autocompactSettings.ts","../../src/extensions/(frontend)/setting/autocompact.web.ts","../../src/extensions/workspaces/(frontend)/setting/autocompact.web.ts","../../generated/web.ts"],"sourcesContent":["export const STATE_CUSTOM_TYPE = 'doom-autocompact-state';\nexport const CHECKPOINT_MESSAGE_TYPE = 'doom-autocompact-checkpoint';\nexport const CONTEXT_MESSAGE_TYPE = 'doom-autocompact-context';\nexport const RESUME_MESSAGE_TYPE = 'doom-autocompact-resume';\nexport const RUNTIME_STATE_MESSAGE_TYPE = 'doom-autocompact-runtime-state';\nexport const STATE_VERSION = 2;\n/** Retrying a malformed checkpoint costs a full summarization call per turn, so a pass that\n * keeps failing is abandoned instead of retried for the rest of the session. */\nexport const MAX_INVALID_CHECKPOINT_ATTEMPTS = 3;\n\nexport const COMPACTION_THRESHOLDS = {\n 1: { ratio: 0.5, capTokens: 200_000 },\n 2: { ratio: 0.75, capTokens: 500_000 },\n 3: { ratio: 0.95, capTokens: 800_000 },\n} as const;\n\nexport const CHECKPOINT_HEADINGS = [\n '## Goal',\n '## Constraints & Preferences',\n '## Progress',\n '### Done',\n '### In Progress',\n '### Blocked',\n '## Key Decisions',\n '## Next Steps',\n '## Critical Context',\n] as const;\n","/**\n * The autocompact settings, described once for both surfaces.\n *\n * The cockpit's settings page renders these, and the runtime reads the same key\n * paths out of `.doom/config.yaml`, so the ids, labels and key paths live here\n * rather than in either place.\n *\n * It lives under src/types because that is the one server root a browser bundle\n * may read, which also means it may import nothing outside this directory:\n * pulling the config package in for the thinking levels would drag a node\n * module into the page. They are spelled out instead, and a test asserts they\n * still match the parser's.\n */\n\nimport { COMPACTION_THRESHOLDS } from '../constants/autocompact';\n\nexport const AUTOCOMPACT_CONFIG_SECTION_ID = 'autocompact';\nconst AUTOCOMPACT_PATH = ['modes', AUTOCOMPACT_CONFIG_SECTION_ID] as const;\nconst THRESHOLDS_KEY = 'thresholds';\n\n/** Unset means the session's own model and thinking level do the summarizing. */\nconst INHERIT_MODEL = 'inherit the session model';\nconst INHERIT_THINKING = 'inherit';\n\n/** Mirrors DOOM_PLANNING_THINKING_LEVELS; pinned by this package's config test. */\nexport const AUTOCOMPACT_THINKING_LEVELS: readonly string[] = [\n 'off',\n 'minimal',\n 'low',\n 'medium',\n 'high',\n 'xhigh',\n 'max',\n];\n\n/** The parser accepts a real boolean too; the page can only write strings. */\nexport const AUTOCOMPACT_ENABLED_VALUES: readonly string[] = ['true', 'false'];\n\nexport interface AutocompactSettingShape {\n readonly id: string;\n readonly label: string;\n readonly keyPath: readonly string[];\n readonly placeholder: string;\n readonly detail: string;\n /** Present for a closed set; a renderer offers these rather than free text. */\n readonly options?: readonly string[];\n /** Offers the machine's authenticated models rather than free text. */\n readonly models?: boolean;\n}\n\nexport const AUTOCOMPACT_SETTING_SHAPES: readonly AutocompactSettingShape[] = [\n {\n id: 'enabled',\n label: 'enabled',\n keyPath: [...AUTOCOMPACT_PATH, 'enabled'],\n placeholder: 'on',\n detail: 'off leaves compaction to Pi. unset is on.',\n options: AUTOCOMPACT_ENABLED_VALUES,\n },\n {\n id: 'model',\n label: 'summarization model',\n keyPath: [...AUTOCOMPACT_PATH, 'model'],\n placeholder: INHERIT_MODEL,\n detail: 'model that writes the checkpoint summaries.',\n models: true,\n },\n {\n id: 'thinking',\n label: 'summarization thinking',\n keyPath: [...AUTOCOMPACT_PATH, 'thinking'],\n placeholder: INHERIT_THINKING,\n detail: 'thinking level appended to the summarization model.',\n options: AUTOCOMPACT_THINKING_LEVELS,\n },\n {\n id: 'thresholds.pass1',\n label: 'pass 1 threshold',\n keyPath: [...AUTOCOMPACT_PATH, THRESHOLDS_KEY, 'pass1'],\n placeholder: String(COMPACTION_THRESHOLDS[1].ratio),\n detail: 'fraction of the remaining context window at which the first pass fires.',\n },\n {\n id: 'thresholds.pass2',\n label: 'pass 2 threshold',\n keyPath: [...AUTOCOMPACT_PATH, THRESHOLDS_KEY, 'pass2'],\n placeholder: String(COMPACTION_THRESHOLDS[2].ratio),\n detail: 'second pass. a value below pass 1 is raised back to it.',\n },\n {\n id: 'thresholds.pass3',\n label: 'pass 3 threshold',\n keyPath: [...AUTOCOMPACT_PATH, THRESHOLDS_KEY, 'pass3'],\n placeholder: String(COMPACTION_THRESHOLDS[3].ratio),\n detail: 'last pass before Pi compacts natively. a value below pass 2 is raised back to it.',\n },\n];\n","import type { SettingsSectionContribution } from '@agimon-ai/doompi-core/web';\n\nimport { AUTOCOMPACT_CONFIG_SECTION_ID, AUTOCOMPACT_SETTING_SHAPES } from '../../../types/autocompactSettings';\n\n/**\n * The autocompact settings, as the cockpit's settings page renders them.\n *\n * Built from the same descriptor table the runtime resolves against, so the\n * page and the extension cannot disagree about which config key a field writes.\n * The host owns the scope switch and the writes; this only says what the fields\n * are.\n */\nexport const autocompactSettingsSection: SettingsSectionContribution = {\n id: AUTOCOMPACT_CONFIG_SECTION_ID,\n label: 'autocompact',\n detail: 'the model that writes checkpoint summaries, and when each compaction pass fires',\n order: 40,\n fields: AUTOCOMPACT_SETTING_SHAPES.map((shape) => ({\n id: shape.id,\n label: shape.label,\n // A model field offers the machine's authenticated models, which only the\n // host can enumerate; the rest are a closed set or free text.\n kind: shape.models === true || shape.options !== undefined ? ('select' as const) : ('text' as const),\n keyPath: shape.keyPath,\n detail: shape.detail,\n placeholder: shape.placeholder,\n ...(shape.models === true ? { optionsFrom: 'models' as const } : {}),\n ...(shape.options === undefined\n ? {}\n : { options: shape.options.map((option) => ({ value: option, label: option })) }),\n })),\n};\n","import { defineSettingsSection } from '@agimon-ai/doompi-core/web';\n\nimport { autocompactSettingsSection } from '../_lib/autocompactSettings';\n\nexport default defineSettingsSection(autocompactSettingsSection);\n","import { defineSettingsSection } from '@agimon-ai/doompi-core/web';\n\nimport { autocompactSettingsSection } from '../../../(frontend)/_lib/autocompactSettings';\n\nexport default defineSettingsSection(autocompactSettingsSection);\n","// Generated by @agimon-ai/doompi-build. Do not edit by hand.\nimport { defineWebPlugin, type WebPluginContributions } from '@agimon-ai/doompi-core/web';\n\nimport settingAutocompact from '../src/extensions/(frontend)/setting/autocompact.web';\nimport settingAutocompact2 from '../src/extensions/workspaces/(frontend)/setting/autocompact.web';\n\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T => ({ ...identity, ...(value as object) }) as T;\n\nexport const webPlugin = defineWebPlugin({\n id: 'autocompact',\n global: {\n get settingsSections(): WebPluginContributions['settingsSections'] { return [via({ id: 'autocompact' }, settingAutocompact)]; },\n },\n workspace: {\n get settingsSections(): WebPluginContributions['settingsSections'] { return [via({ id: 'autocompact' }, settingAutocompact2)]; },\n },\n});\n"],"mappings":";;AAUA,MAAa,wBAAwB;CACnC,GAAG;EAAE,OAAO;EAAK,WAAW;CAAQ;CACpC,GAAG;EAAE,OAAO;EAAM,WAAW;CAAQ;CACrC,GAAG;EAAE,OAAO;EAAM,WAAW;CAAQ;AACvC;;;;;;;;;;;;;;;;ACEA,MAAa,gCAAgC;AAC7C,MAAM,mBAAmB,CAAC,SAAS,6BAA6B;AAChE,MAAM,iBAAiB;;AAGvB,MAAM,gBAAgB;AACtB,MAAM,mBAAmB;;AAGzB,MAAa,8BAAiD;CAC5D;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;AAGA,MAAa,6BAAgD,CAAC,QAAQ,OAAO;;;;;;;;;;;ACxB7E,MAAa,6BAA0D;CACrE,IAAI;CACJ,OAAO;CACP,QAAQ;CACR,OAAO;CACP,QAAQ;EDkCR;GACE,IAAI;GACJ,OAAO;GACP,SAAS,CAAC,GAAG,kBAAkB,SAAS;GACxC,aAAa;GACb,QAAQ;GACR,SAAS;EACX;EACA;GACE,IAAI;GACJ,OAAO;GACP,SAAS,CAAC,GAAG,kBAAkB,OAAO;GACtC,aAAa;GACb,QAAQ;GACR,QAAQ;EACV;EACA;GACE,IAAI;GACJ,OAAO;GACP,SAAS,CAAC,GAAG,kBAAkB,UAAU;GACzC,aAAa;GACb,QAAQ;GACR,SAAS;EACX;EACA;GACE,IAAI;GACJ,OAAO;GACP,SAAS;IAAC,GAAG;IAAkB;IAAgB;GAAO;GACtD,aAAa,OAAO,sBAAsB,EAAE,CAAC,KAAK;GAClD,QAAQ;EACV;EACA;GACE,IAAI;GACJ,OAAO;GACP,SAAS;IAAC,GAAG;IAAkB;IAAgB;GAAO;GACtD,aAAa,OAAO,sBAAsB,EAAE,CAAC,KAAK;GAClD,QAAQ;EACV;EACA;GACE,IAAI;GACJ,OAAO;GACP,SAAS;IAAC,GAAG;IAAkB;IAAgB;GAAO;GACtD,aAAa,OAAO,sBAAsB,EAAE,CAAC,KAAK;GAClD,QAAQ;EACV;CC9EQ,CAAA,CAA2B,KAAK,WAAW;EACjD,IAAI,MAAM;EACV,OAAO,MAAM;EAGb,MAAM,MAAM,WAAW,QAAQ,MAAM,YAAY,KAAA,IAAa,WAAsB;EACpF,SAAS,MAAM;EACf,QAAQ,MAAM;EACd,aAAa,MAAM;EACnB,GAAI,MAAM,WAAW,OAAO,EAAE,aAAa,SAAkB,IAAI,CAAC;EAClE,GAAI,MAAM,YAAY,KAAA,IAClB,CAAC,IACD,EAAE,SAAS,MAAM,QAAQ,KAAK,YAAY;GAAE,OAAO;GAAQ,OAAO;EAAO,EAAE,EAAE;CACnF,EAAE;AACJ;;;AC3BA,IAAA,4BAAe,sBAAsB,0BAA0B;;;ACA/D,IAAA,0BAAe,sBAAsB,0BAA0B;;;ACE/D,MAAM,OAAU,UAAmC,WAAuB;CAAE,GAAG;CAAU,GAAI;AAAiB;AAE9G,MAAa,YAAY,gBAAgB;CACvC,IAAI;CACJ,QAAQ,EACN,IAAI,mBAA+D;EAAE,OAAO,CAAC,IAAI,EAAE,IAAI,cAAc,GAAGA,yBAAkB,CAAC;CAAG,EAChI;CACA,WAAW,EACT,IAAI,mBAA+D;EAAE,OAAO,CAAC,IAAI,EAAE,IAAI,cAAc,GAAGC,uBAAmB,CAAC;CAAG,EACjI;AACF,CAAC"}
package/dist/index.cjs ADDED
@@ -0,0 +1,3 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_index = require("./src/services/compactionPolicy/index.cjs");
3
+ exports.thresholdTokens = require_index.thresholdTokens;
@@ -0,0 +1,3 @@
1
+ import { AutocompactPass } from "./src/types/autocompact.cjs";
2
+ import { thresholdTokens } from "./src/services/compactionPolicy/index.cjs";
3
+ export { type AutocompactPass, thresholdTokens };
@@ -0,0 +1,3 @@
1
+ import { AutocompactPass } from "./src/types/autocompact.mjs";
2
+ import { thresholdTokens } from "./src/services/compactionPolicy/index.mjs";
3
+ export { type AutocompactPass, thresholdTokens };
package/dist/index.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import { thresholdTokens } from "./src/services/compactionPolicy/index.mjs";
2
+ export { thresholdTokens };
@@ -0,0 +1,41 @@
1
+ //#region src/constants/autocompact.ts
2
+ const STATE_CUSTOM_TYPE = "doom-autocompact-state";
3
+ const CHECKPOINT_MESSAGE_TYPE = "doom-autocompact-checkpoint";
4
+ const CONTEXT_MESSAGE_TYPE = "doom-autocompact-context";
5
+ const RESUME_MESSAGE_TYPE = "doom-autocompact-resume";
6
+ const RUNTIME_STATE_MESSAGE_TYPE = "doom-autocompact-runtime-state";
7
+ const COMPACTION_THRESHOLDS = {
8
+ 1: {
9
+ ratio: .5,
10
+ capTokens: 2e5
11
+ },
12
+ 2: {
13
+ ratio: .75,
14
+ capTokens: 5e5
15
+ },
16
+ 3: {
17
+ ratio: .95,
18
+ capTokens: 8e5
19
+ }
20
+ };
21
+ const CHECKPOINT_HEADINGS = [
22
+ "## Goal",
23
+ "## Constraints & Preferences",
24
+ "## Progress",
25
+ "### Done",
26
+ "### In Progress",
27
+ "### Blocked",
28
+ "## Key Decisions",
29
+ "## Next Steps",
30
+ "## Critical Context"
31
+ ];
32
+ //#endregion
33
+ exports.CHECKPOINT_HEADINGS = CHECKPOINT_HEADINGS;
34
+ exports.CHECKPOINT_MESSAGE_TYPE = CHECKPOINT_MESSAGE_TYPE;
35
+ exports.COMPACTION_THRESHOLDS = COMPACTION_THRESHOLDS;
36
+ exports.CONTEXT_MESSAGE_TYPE = CONTEXT_MESSAGE_TYPE;
37
+ exports.RESUME_MESSAGE_TYPE = RESUME_MESSAGE_TYPE;
38
+ exports.RUNTIME_STATE_MESSAGE_TYPE = RUNTIME_STATE_MESSAGE_TYPE;
39
+ exports.STATE_CUSTOM_TYPE = STATE_CUSTOM_TYPE;
40
+
41
+ //# sourceMappingURL=autocompact.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autocompact.cjs","names":[],"sources":["../../../src/constants/autocompact.ts"],"sourcesContent":["export const STATE_CUSTOM_TYPE = 'doom-autocompact-state';\nexport const CHECKPOINT_MESSAGE_TYPE = 'doom-autocompact-checkpoint';\nexport const CONTEXT_MESSAGE_TYPE = 'doom-autocompact-context';\nexport const RESUME_MESSAGE_TYPE = 'doom-autocompact-resume';\nexport const RUNTIME_STATE_MESSAGE_TYPE = 'doom-autocompact-runtime-state';\nexport const STATE_VERSION = 2;\n/** Retrying a malformed checkpoint costs a full summarization call per turn, so a pass that\n * keeps failing is abandoned instead of retried for the rest of the session. */\nexport const MAX_INVALID_CHECKPOINT_ATTEMPTS = 3;\n\nexport const COMPACTION_THRESHOLDS = {\n 1: { ratio: 0.5, capTokens: 200_000 },\n 2: { ratio: 0.75, capTokens: 500_000 },\n 3: { ratio: 0.95, capTokens: 800_000 },\n} as const;\n\nexport const CHECKPOINT_HEADINGS = [\n '## Goal',\n '## Constraints & Preferences',\n '## Progress',\n '### Done',\n '### In Progress',\n '### Blocked',\n '## Key Decisions',\n '## Next Steps',\n '## Critical Context',\n] as const;\n"],"mappings":";AAAA,MAAa,oBAAoB;AACjC,MAAa,0BAA0B;AACvC,MAAa,uBAAuB;AACpC,MAAa,sBAAsB;AACnC,MAAa,6BAA6B;AAM1C,MAAa,wBAAwB;CACnC,GAAG;EAAE,OAAO;EAAK,WAAW;CAAQ;CACpC,GAAG;EAAE,OAAO;EAAM,WAAW;CAAQ;CACrC,GAAG;EAAE,OAAO;EAAM,WAAW;CAAQ;AACvC;AAEA,MAAa,sBAAsB;CACjC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
@@ -0,0 +1,35 @@
1
+ //#region src/constants/autocompact.ts
2
+ const STATE_CUSTOM_TYPE = "doom-autocompact-state";
3
+ const CHECKPOINT_MESSAGE_TYPE = "doom-autocompact-checkpoint";
4
+ const CONTEXT_MESSAGE_TYPE = "doom-autocompact-context";
5
+ const RESUME_MESSAGE_TYPE = "doom-autocompact-resume";
6
+ const RUNTIME_STATE_MESSAGE_TYPE = "doom-autocompact-runtime-state";
7
+ const COMPACTION_THRESHOLDS = {
8
+ 1: {
9
+ ratio: .5,
10
+ capTokens: 2e5
11
+ },
12
+ 2: {
13
+ ratio: .75,
14
+ capTokens: 5e5
15
+ },
16
+ 3: {
17
+ ratio: .95,
18
+ capTokens: 8e5
19
+ }
20
+ };
21
+ const CHECKPOINT_HEADINGS = [
22
+ "## Goal",
23
+ "## Constraints & Preferences",
24
+ "## Progress",
25
+ "### Done",
26
+ "### In Progress",
27
+ "### Blocked",
28
+ "## Key Decisions",
29
+ "## Next Steps",
30
+ "## Critical Context"
31
+ ];
32
+ //#endregion
33
+ export { CHECKPOINT_HEADINGS, CHECKPOINT_MESSAGE_TYPE, COMPACTION_THRESHOLDS, CONTEXT_MESSAGE_TYPE, RESUME_MESSAGE_TYPE, RUNTIME_STATE_MESSAGE_TYPE, STATE_CUSTOM_TYPE };
34
+
35
+ //# sourceMappingURL=autocompact.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autocompact.mjs","names":[],"sources":["../../../src/constants/autocompact.ts"],"sourcesContent":["export const STATE_CUSTOM_TYPE = 'doom-autocompact-state';\nexport const CHECKPOINT_MESSAGE_TYPE = 'doom-autocompact-checkpoint';\nexport const CONTEXT_MESSAGE_TYPE = 'doom-autocompact-context';\nexport const RESUME_MESSAGE_TYPE = 'doom-autocompact-resume';\nexport const RUNTIME_STATE_MESSAGE_TYPE = 'doom-autocompact-runtime-state';\nexport const STATE_VERSION = 2;\n/** Retrying a malformed checkpoint costs a full summarization call per turn, so a pass that\n * keeps failing is abandoned instead of retried for the rest of the session. */\nexport const MAX_INVALID_CHECKPOINT_ATTEMPTS = 3;\n\nexport const COMPACTION_THRESHOLDS = {\n 1: { ratio: 0.5, capTokens: 200_000 },\n 2: { ratio: 0.75, capTokens: 500_000 },\n 3: { ratio: 0.95, capTokens: 800_000 },\n} as const;\n\nexport const CHECKPOINT_HEADINGS = [\n '## Goal',\n '## Constraints & Preferences',\n '## Progress',\n '### Done',\n '### In Progress',\n '### Blocked',\n '## Key Decisions',\n '## Next Steps',\n '## Critical Context',\n] as const;\n"],"mappings":";AAAA,MAAa,oBAAoB;AACjC,MAAa,0BAA0B;AACvC,MAAa,uBAAuB;AACpC,MAAa,sBAAsB;AACnC,MAAa,6BAA6B;AAM1C,MAAa,wBAAwB;CACnC,GAAG;EAAE,OAAO;EAAK,WAAW;CAAQ;CACpC,GAAG;EAAE,OAAO;EAAM,WAAW;CAAQ;CACrC,GAAG;EAAE,OAAO;EAAM,WAAW;CAAQ;AACvC;AAEA,MAAa,sBAAsB;CACjC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
@@ -0,0 +1,19 @@
1
+ //#region src/constants/runtime.ts
2
+ const ROOT_WORKING_LEAF = "@root";
3
+ const PLAN_DOCUMENT_ENTRY = "agent-harness-plan-document";
4
+ const FOOTER_SOURCE = "doom-autocompact";
5
+ const STATUS_KEY = "doom-autocompact";
6
+ const STATE_PHASE = {
7
+ waiting: "waiting",
8
+ checkpointPending: "checkpoint_pending",
9
+ checkpointReady: "checkpoint_ready",
10
+ compacting: "compacting"
11
+ };
12
+ //#endregion
13
+ exports.FOOTER_SOURCE = FOOTER_SOURCE;
14
+ exports.PLAN_DOCUMENT_ENTRY = PLAN_DOCUMENT_ENTRY;
15
+ exports.ROOT_WORKING_LEAF = ROOT_WORKING_LEAF;
16
+ exports.STATE_PHASE = STATE_PHASE;
17
+ exports.STATUS_KEY = STATUS_KEY;
18
+
19
+ //# sourceMappingURL=runtime.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.cjs","names":[],"sources":["../../../src/constants/runtime.ts"],"sourcesContent":["export const ROOT_WORKING_LEAF = '@root';\nexport const PLAN_DOCUMENT_ENTRY = 'agent-harness-plan-document';\nexport const FOOTER_SOURCE = 'doom-autocompact';\nexport const FOOTER_ORDER = 20;\nexport const STATUS_KEY = 'doom-autocompact';\nexport const STATE_PHASE = {\n waiting: 'waiting',\n checkpointPending: 'checkpoint_pending',\n checkpointReady: 'checkpoint_ready',\n compacting: 'compacting',\n} as const;\n\n/**\n * Above this, the context hook is worth a telemetry event. Below it the hook is\n * noise against a round trip measured in seconds, and it runs on every request.\n */\nexport const SLOW_CONTEXT_HOOK_MS = 25;\n"],"mappings":";AAAA,MAAa,oBAAoB;AACjC,MAAa,sBAAsB;AACnC,MAAa,gBAAgB;AAE7B,MAAa,aAAa;AAC1B,MAAa,cAAc;CACzB,SAAS;CACT,mBAAmB;CACnB,iBAAiB;CACjB,YAAY;AACd"}
@@ -0,0 +1,15 @@
1
+ //#region src/constants/runtime.ts
2
+ const ROOT_WORKING_LEAF = "@root";
3
+ const PLAN_DOCUMENT_ENTRY = "agent-harness-plan-document";
4
+ const FOOTER_SOURCE = "doom-autocompact";
5
+ const STATUS_KEY = "doom-autocompact";
6
+ const STATE_PHASE = {
7
+ waiting: "waiting",
8
+ checkpointPending: "checkpoint_pending",
9
+ checkpointReady: "checkpoint_ready",
10
+ compacting: "compacting"
11
+ };
12
+ //#endregion
13
+ export { FOOTER_SOURCE, PLAN_DOCUMENT_ENTRY, ROOT_WORKING_LEAF, STATE_PHASE, STATUS_KEY };
14
+
15
+ //# sourceMappingURL=runtime.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.mjs","names":[],"sources":["../../../src/constants/runtime.ts"],"sourcesContent":["export const ROOT_WORKING_LEAF = '@root';\nexport const PLAN_DOCUMENT_ENTRY = 'agent-harness-plan-document';\nexport const FOOTER_SOURCE = 'doom-autocompact';\nexport const FOOTER_ORDER = 20;\nexport const STATUS_KEY = 'doom-autocompact';\nexport const STATE_PHASE = {\n waiting: 'waiting',\n checkpointPending: 'checkpoint_pending',\n checkpointReady: 'checkpoint_ready',\n compacting: 'compacting',\n} as const;\n\n/**\n * Above this, the context hook is worth a telemetry event. Below it the hook is\n * noise against a round trip measured in seconds, and it runs on every request.\n */\nexport const SLOW_CONTEXT_HOOK_MS = 25;\n"],"mappings":";AAAA,MAAa,oBAAoB;AACjC,MAAa,sBAAsB;AACnC,MAAa,gBAAgB;AAE7B,MAAa,aAAa;AAC1B,MAAa,cAAc;CACzB,SAAS;CACT,mBAAmB;CACnB,iBAAiB;CACjB,YAAY;AACd"}
@@ -0,0 +1,14 @@
1
+ const require_index = require("../../../../../services/autocompactRuntime/index.cjs");
2
+ //#region src/extensions/workspaces/sessions/(backend)/_lib/piRoot.ts
3
+ const createAutocompactPiRoot = ({ pi, options }) => {
4
+ const runtime = require_index.createAutocompactRuntime(pi, options);
5
+ return {
6
+ value: runtime,
7
+ services: [runtime.plugin],
8
+ onStop: runtime.stop
9
+ };
10
+ };
11
+ //#endregion
12
+ exports.createAutocompactPiRoot = createAutocompactPiRoot;
13
+
14
+ //# sourceMappingURL=piRoot.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"piRoot.cjs","names":["createAutocompactRuntime"],"sources":["../../../../../../../src/extensions/workspaces/sessions/(backend)/_lib/piRoot.ts"],"sourcesContent":["import type { PiPluginContext } from '@agimon-ai/doompi-core/pi-extension';\n\nimport { createAutocompactRuntime, type AutocompactDependencies } from '../../../../../services/autocompactRuntime';\n\nexport const createAutocompactPiRoot = ({ pi, options }: PiPluginContext) => {\n const runtime = createAutocompactRuntime(pi, options as unknown as AutocompactDependencies | undefined);\n return { value: runtime, services: [runtime.plugin], onStop: runtime.stop };\n};\nexport type AutocompactScope = Awaited<ReturnType<typeof createAutocompactPiRoot>>['value'];\n"],"mappings":";;AAIA,MAAa,2BAA2B,EAAE,IAAI,cAA+B;CAC3E,MAAM,UAAUA,cAAAA,yBAAyB,IAAI,OAAyD;CACtG,OAAO;EAAE,OAAO;EAAS,UAAU,CAAC,QAAQ,MAAM;EAAG,QAAQ,QAAQ;CAAK;AAC5E"}
@@ -0,0 +1,14 @@
1
+ import { createAutocompactRuntime } from "../../../../../services/autocompactRuntime/index.mjs";
2
+ //#region src/extensions/workspaces/sessions/(backend)/_lib/piRoot.ts
3
+ const createAutocompactPiRoot = ({ pi, options }) => {
4
+ const runtime = createAutocompactRuntime(pi, options);
5
+ return {
6
+ value: runtime,
7
+ services: [runtime.plugin],
8
+ onStop: runtime.stop
9
+ };
10
+ };
11
+ //#endregion
12
+ export { createAutocompactPiRoot };
13
+
14
+ //# sourceMappingURL=piRoot.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"piRoot.mjs","names":[],"sources":["../../../../../../../src/extensions/workspaces/sessions/(backend)/_lib/piRoot.ts"],"sourcesContent":["import type { PiPluginContext } from '@agimon-ai/doompi-core/pi-extension';\n\nimport { createAutocompactRuntime, type AutocompactDependencies } from '../../../../../services/autocompactRuntime';\n\nexport const createAutocompactPiRoot = ({ pi, options }: PiPluginContext) => {\n const runtime = createAutocompactRuntime(pi, options as unknown as AutocompactDependencies | undefined);\n return { value: runtime, services: [runtime.plugin], onStop: runtime.stop };\n};\nexport type AutocompactScope = Awaited<ReturnType<typeof createAutocompactPiRoot>>['value'];\n"],"mappings":";;AAIA,MAAa,2BAA2B,EAAE,IAAI,cAA+B;CAC3E,MAAM,UAAU,yBAAyB,IAAI,OAAyD;CACtG,OAAO;EAAE,OAAO;EAAS,UAAU,CAAC,QAAQ,MAAM;EAAG,QAAQ,QAAQ;CAAK;AAC5E"}
@@ -0,0 +1,6 @@
1
+ //#region src/extensions/workspaces/sessions/(backend)/hook/agent-settled.cli.ts
2
+ var agent_settled_cli_default = (0, require("@agimon-ai/doompi-core/extension-file").defineCliHook)((context) => context.root.events.agent_settled);
3
+ //#endregion
4
+ exports.default = agent_settled_cli_default;
5
+
6
+ //# sourceMappingURL=agent-settled.cli.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-settled.cli.cjs","names":["defineCliHook"],"sources":["../../../../../../../src/extensions/workspaces/sessions/(backend)/hook/agent-settled.cli.ts"],"sourcesContent":["import { defineCliHook, type WithRoot } from '@agimon-ai/doompi-core/extension-file';\nimport type { PiEventHandlers, PiPluginContext } from '@agimon-ai/doompi-core/pi-extension';\n\nimport type { AutocompactScope } from '../_lib/piRoot';\n\nexport default defineCliHook(\n (context: WithRoot<PiPluginContext<unknown>, AutocompactScope>): PiEventHandlers['agent_settled'] =>\n context.root.events.agent_settled,\n);\n"],"mappings":";AAKA,IAAA,6BAAA,kDAAeA,CAAAA,CAAAA,cAAAA,EACZ,YACC,QAAQ,KAAK,OAAO,aACxB"}