billion-context-pi 0.1.77-pr.528.338 → 0.1.77

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/dist/config.d.ts CHANGED
@@ -293,12 +293,6 @@ export interface AdapterConfig {
293
293
  * multi-session hosts (Prime RLM & co.) whose injected agent messages must
294
294
  * delimit real turns. See docs/host-adapter.md. */
295
295
  hostSession?: boolean | HostSessionConfig;
296
- /** Persistent-rules feature gate (#526): opt-in `rules: true` in acp.json.
297
- * Gates the human `/acp-rule` command (list + record — kernel
298
- * `listRules`/`addRule` against the session `.acp.json` sidecar state) and
299
- * the model-side `acp_rule` tool (#490). Custom limits via
300
- * coreOverrides.rules ({ maxRules?, maxRuleChars? }). */
301
- rules?: boolean;
302
296
  /** Legacy flat alias for `delegate.displayUsage`. Kept for backward
303
297
  * compatibility with existing acp.json files. Prefer `delegate.displayUsage`. */
304
298
  displayUsage?: "merged" | "separate";
package/dist/index.js CHANGED
@@ -187,8 +187,7 @@ var KNOWN = /* @__PURE__ */ new Set([
187
187
  "nudgeSections",
188
188
  "toolPrompts",
189
189
  "delegatePrompt",
190
- "hostSession",
191
- "rules"
190
+ "hostSession"
192
191
  ]);
193
192
  function pickKnown(parsed) {
194
193
  const out = {};
@@ -6450,63 +6449,6 @@ var RULES_USAGE_PROMPT = [
6450
6449
  "- pitfalls you ran into once and must not run into again.",
6451
6450
  "Rules are re-injected into the system prompt every turn. Omit the text argument to list recorded rules."
6452
6451
  ].join("\n");
6453
- function listRules(state) {
6454
- return state.rules ?? [];
6455
- }
6456
- function resolveRuleLimits(config) {
6457
- return {
6458
- maxRules: config?.rules?.maxRules ?? DEFAULT_RULE_LIMITS.maxRules,
6459
- maxRuleChars: config?.rules?.maxRuleChars ?? DEFAULT_RULE_LIMITS.maxRuleChars
6460
- };
6461
- }
6462
- var RULE_ID_RE = /^rule(\d+)$/;
6463
- function highestRuleNumber(state) {
6464
- let highest = 0;
6465
- for (const rule of state.rules ?? []) {
6466
- const match = RULE_ID_RE.exec(rule.id);
6467
- if (match) highest = Math.max(highest, Number(match[1]));
6468
- }
6469
- return highest;
6470
- }
6471
- function addRule(state, text, limits = {}) {
6472
- const maxRules = limits.maxRules ?? DEFAULT_RULE_LIMITS.maxRules;
6473
- const maxRuleChars = limits.maxRuleChars ?? DEFAULT_RULE_LIMITS.maxRuleChars;
6474
- const trimmed = (text ?? "").trim();
6475
- if (!trimmed) {
6476
- return {
6477
- ok: false,
6478
- error: "rule text is empty \u2014 provide the reminder to record."
6479
- };
6480
- }
6481
- if (trimmed.length > maxRuleChars) {
6482
- return {
6483
- ok: false,
6484
- error: `${trimmed.length} chars exceeds the ${maxRuleChars}-char limit \u2014 keep rules short and principle-level.`
6485
- };
6486
- }
6487
- const rules = listRules(state);
6488
- const duplicate = rules.find((rule2) => rule2.text === trimmed);
6489
- if (duplicate) {
6490
- return {
6491
- ok: false,
6492
- error: `identical rule already exists (${duplicate.id}) \u2014 no change.`
6493
- };
6494
- }
6495
- if (rules.length >= maxRules) {
6496
- return {
6497
- ok: false,
6498
- error: `rule limit reached (${maxRules}) \u2014 remove or clear outdated rules first.`
6499
- };
6500
- }
6501
- const next = Math.max(state.nextRuleId ?? 1, highestRuleNumber(state) + 1);
6502
- const rule = { id: `rule${next}`, text: trimmed };
6503
- state.rules = [...rules, rule];
6504
- state.nextRuleId = next + 1;
6505
- return { ok: true, rule };
6506
- }
6507
- function formatRulesList(rules) {
6508
- return rules.map((rule, i) => `${i + 1}. [${rule.id}] ${rule.text}`).join("\n");
6509
- }
6510
6452
  function createHeuristicClassifier(options = {}) {
6511
6453
  const aspectRatioMin = options.aspectRatioMin ?? 1.4;
6512
6454
  const aspectRatioMax = options.aspectRatioMax ?? 2.6;
@@ -7628,8 +7570,7 @@ var REF_TAG = new RegExp(`^${REF_TAG_SOURCE}\\s?\\n?`);
7628
7570
  var TRAILING_REF_TAG = new RegExp(`\\n*${REF_TAG_SOURCE}\\s*$`);
7629
7571
  var ACP_STATUS_CUSTOM_TYPE = "acp-status";
7630
7572
  var ACP_EXPORT_CUSTOM_TYPE = "acp-export";
7631
- var ACP_RULE_CUSTOM_TYPE = "acp-rule";
7632
- var CONTEXT_EXCLUDED_CUSTOM_TYPES = /* @__PURE__ */ new Set([ACP_STATUS_CUSTOM_TYPE, ACP_EXPORT_CUSTOM_TYPE, ACP_RULE_CUSTOM_TYPE]);
7573
+ var CONTEXT_EXCLUDED_CUSTOM_TYPES = /* @__PURE__ */ new Set([ACP_STATUS_CUSTOM_TYPE, ACP_EXPORT_CUSTOM_TYPE]);
7633
7574
  function isCustomMessageEntry(entry) {
7634
7575
  if (entry.type !== "custom_message") return false;
7635
7576
  if (entry.customType !== void 0 && CONTEXT_EXCLUDED_CUSTOM_TYPES.has(entry.customType)) return false;
@@ -21228,46 +21169,6 @@ function makeCommands(runtime, pi) {
21228
21169
  }
21229
21170
  }
21230
21171
  },
21231
- {
21232
- name: "acp-rule",
21233
- options: {
21234
- description: "List persistent rules recorded in this session, or record one directly (same rules the acp_rule feature keeps). Usage: /acp-rule [text to record]",
21235
- handler: async (args, ctx) => {
21236
- if (runtime.adapter.rules !== true) {
21237
- ctx.ui.notify(
21238
- 'Rules are not enabled \u2014 set "rules": true in acp.json (~/.pi/acp.json or project .pi/acp.json) to turn on persistent rules.',
21239
- "warning"
21240
- );
21241
- return;
21242
- }
21243
- const ruleText = (args ?? "").trim();
21244
- let text;
21245
- try {
21246
- const { state } = await runtime.stateFor(ctx);
21247
- if (ruleText === "") {
21248
- const rules = listRules(state);
21249
- text = rules.length === 0 ? "No rules recorded." : formatRulesList(rules);
21250
- } else {
21251
- const result = addRule(state, ruleText, resolveRuleLimits(runtime.configFor(ctx)));
21252
- if (!result.ok) {
21253
- ctx.ui.notify(result.error, "error");
21254
- return;
21255
- }
21256
- await runtime.save(state, ctx);
21257
- text = `Recorded ${result.rule.id}: ${result.rule.text}`;
21258
- }
21259
- } catch (e) {
21260
- ctx.ui.notify(e instanceof Error ? e.message : String(e), "error");
21261
- return;
21262
- }
21263
- if (typeof pi?.sendMessage === "function") {
21264
- pi.sendMessage({ customType: ACP_RULE_CUSTOM_TYPE, content: text, display: true });
21265
- return;
21266
- }
21267
- ctx.ui.notify(text);
21268
- }
21269
- }
21270
- },
21271
21172
  {
21272
21173
  name: "acp-export",
21273
21174
  options: {