@lamplitisles/codex-for-love 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6203,12 +6203,14 @@ const schema = object({
6203
6203
  version: literal(SUPPORTED_CODEX_VERSION).default(SUPPORTED_CODEX_VERSION),
6204
6204
  home: string().min(1).optional(),
6205
6205
  provenance: string().min(1).optional(),
6206
- local_compaction: boolean().default(false)
6206
+ local_compaction: boolean().default(false),
6207
+ context_round_limit: number$1().int().min(0).default(10)
6207
6208
  }).strict().default({
6208
6209
  command: "codex-app-server",
6209
6210
  model: DEFAULT_CODEX_MODEL,
6210
6211
  version: SUPPORTED_CODEX_VERSION,
6211
- local_compaction: false
6212
+ local_compaction: false,
6213
+ context_round_limit: 10
6212
6214
  }),
6213
6215
  speech: object({
6214
6216
  endpoint: url().default("https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation"),
@@ -62601,6 +62603,8 @@ function partnerPaths(workspace) {
62601
62603
  audio: join(managedRoot, "audio")
62602
62604
  };
62603
62605
  }
62606
+ //#endregion
62607
+ //#region apps/partner/runtime/context-bootstrap.ts
62604
62608
  const CONTEXT_TOKEN_BUDGET = 4e3;
62605
62609
  const hookFileName = "session-start-hook.mjs";
62606
62610
  const companionMcpFileName = import.meta.url.endsWith(".mjs") ? "companion-mcp.mjs" : "companion-mcp.ts";
@@ -62621,7 +62625,7 @@ function finalAgentText(items) {
62621
62625
  return texts.length ? texts.join("\n\n").trim() : void 0;
62622
62626
  }
62623
62627
  /** Select newest completed conversational sides without copying tool or image payloads. */
62624
- function selectTextRounds(turns, budget = CONTEXT_TOKEN_BUDGET, limit = 5) {
62628
+ function selectTextRounds(turns, budget = CONTEXT_TOKEN_BUDGET, limit = 10) {
62625
62629
  const candidates = [];
62626
62630
  for (const turn of turns) {
62627
62631
  if (turn.status !== "completed" || !turn.items) continue;
@@ -62681,6 +62685,10 @@ function shellQuote(value) {
62681
62685
  function hookCommand(contextPath) {
62682
62686
  return `${shellQuote(process.execPath)} ${shellQuote(fileURLToPath(new URL(`./${hookFileName}`, import.meta.url)))} ${shellQuote(contextPath)}`;
62683
62687
  }
62688
+ /** A release path changes, but a hook targeting this internal bootstrap remains CFL-owned. */
62689
+ function ownsBootstrapHook(value, contextPath) {
62690
+ return isRecord$1(value) && value.type === "command" && typeof value.command === "string" && value.command.includes(hookFileName) && value.command.includes(shellQuote(contextPath));
62691
+ }
62684
62692
  function isRecord$1(value) {
62685
62693
  return typeof value === "object" && value !== null && !Array.isArray(value);
62686
62694
  }
@@ -62759,31 +62767,21 @@ async function ensureHookDeclaration(workspace, contextPath, partnerConfigPath,
62759
62767
  const sessionStart = Array.isArray(hooks.SessionStart) ? hooks.SessionStart : [];
62760
62768
  let changed = ensureCompanionMcp(config, workspace, partnerConfigPath);
62761
62769
  changed = ensureKeetMcp(config, keetEndpoint) || changed;
62762
- let own = false;
62763
- const normalizedGroups = sessionStart.map((group) => {
62764
- if (!isRecord$1(group) || !Array.isArray(group.hooks)) return group;
62765
- let groupChanged = false;
62766
- const handlers = group.hooks.map((handler) => {
62767
- if (!isRecord$1(handler) || handler.type !== "command" || handler.command !== command) return handler;
62768
- own = true;
62769
- if (group.matcher === "startup|compact" && handler.additionalContextLimit === 0) return handler;
62770
- groupChanged = true;
62771
- return {
62772
- ...handler,
62773
- type: "command",
62774
- command,
62775
- additionalContextLimit: 0
62776
- };
62770
+ const own = sessionStart.flatMap((group) => isRecord$1(group) && Array.isArray(group.hooks) ? group.hooks.filter((handler) => ownsBootstrapHook(handler, contextPath)).map((handler) => ({
62771
+ group,
62772
+ handler
62773
+ })) : []);
62774
+ const canonical = own.length === 1 && own[0].group.matcher === "startup|compact" && own[0].handler.command === command && own[0].handler.additionalContextLimit === 0;
62775
+ let normalizedGroups = sessionStart;
62776
+ if (!canonical) {
62777
+ normalizedGroups = sessionStart.flatMap((group) => {
62778
+ if (!isRecord$1(group) || !Array.isArray(group.hooks)) return [group];
62779
+ const handlers = group.hooks.filter((handler) => !ownsBootstrapHook(handler, contextPath));
62780
+ return handlers.length ? [{
62781
+ ...group,
62782
+ hooks: handlers
62783
+ }] : [];
62777
62784
  });
62778
- if (!groupChanged) return group;
62779
- changed = true;
62780
- return {
62781
- ...group,
62782
- matcher: "startup|compact",
62783
- hooks: handlers
62784
- };
62785
- });
62786
- if (!own) {
62787
62785
  normalizedGroups.push({
62788
62786
  matcher: "startup|compact",
62789
62787
  hooks: [{
@@ -65939,7 +65937,7 @@ async function createPartner(config, credentials, dependencies = {}) {
65939
65937
  }
65940
65938
  async function refreshBootstrap() {
65941
65939
  const history = (await readRelationshipJournal(paths.relationshipJournal)).reverse();
65942
- const rounds = selectTextRounds([...turns.values()], CONTEXT_TOKEN_BUDGET, 5);
65940
+ const rounds = selectTextRounds([...turns.values()], CONTEXT_TOKEN_BUDGET, config.codex.context_round_limit);
65943
65941
  await writeBootstrapFile(bootstrapPath(paths.workspaceRoot), {
65944
65942
  startupPending,
65945
65943
  context: formatBootstrapContext(stateFromHistory(history)),
@@ -22694,12 +22694,14 @@ const schema = object({
22694
22694
  version: literal(SUPPORTED_CODEX_VERSION).default(SUPPORTED_CODEX_VERSION),
22695
22695
  home: string().min(1).optional(),
22696
22696
  provenance: string().min(1).optional(),
22697
- local_compaction: boolean().default(false)
22697
+ local_compaction: boolean().default(false),
22698
+ context_round_limit: number().int().min(0).default(10)
22698
22699
  }).strict().default({
22699
22700
  command: "codex-app-server",
22700
22701
  model: DEFAULT_CODEX_MODEL,
22701
22702
  version: SUPPORTED_CODEX_VERSION,
22702
- local_compaction: false
22703
+ local_compaction: false,
22704
+ context_round_limit: 10
22703
22705
  }),
22704
22706
  speech: object({
22705
22707
  endpoint: url().default("https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation"),
@@ -1 +0,0 @@
1
- import{i as e,t}from"../chunks/Bg1Ry2sd.js";export{e as load_css,t as start};