peaks-loop 4.0.26 → 4.0.28

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.
@@ -22,6 +22,7 @@
22
22
  import { existsSync } from 'node:fs';
23
23
  import { join } from 'node:path';
24
24
  import { readBinding } from './binding-store.js';
25
+ import { getSessionMeta } from './session-manager.js';
25
26
  /**
26
27
  * Read the binding from disk and assemble the read-only view. Pure
27
28
  * helper that does no filesystem writes; safe to call from any test.
@@ -37,14 +38,34 @@ export function loadBindingStatus(projectRoot) {
37
38
  : !Object.values(binding.instances).some((inst) => inst.callerId.startsWith(outerSessionId));
38
39
  return { binding, source, projectRoot, stale, outerSessionId };
39
40
  }
40
- function readOuterSessionId() {
41
- const peaks = process.env.PEAKS_OUTER_SESSION_ID;
41
+ export function readOuterSessionId() {
42
+ return readOuterSessionIdFromEnv(process.env) ?? 'unknown';
43
+ }
44
+ /** Pure env read (no process.env dependency) so callers can inject an env. */
45
+ function readOuterSessionIdFromEnv(env) {
46
+ const peaks = env.PEAKS_OUTER_SESSION_ID;
42
47
  if (typeof peaks === 'string' && peaks.length > 0)
43
48
  return peaks;
44
- const claude = process.env.CLAUDE_CODE_SESSION_ID;
49
+ const claude = env.CLAUDE_CODE_SESSION_ID;
45
50
  if (typeof claude === 'string' && claude.length > 0)
46
51
  return claude;
47
- return 'unknown';
52
+ return undefined;
53
+ }
54
+ /**
55
+ * Resolve the outer (harness / IDE) session id for the auto-compact
56
+ * context-percent probe. Order: env signal first (PEAKS_OUTER_SESSION_ID /
57
+ * CLAUDE_CODE_SESSION_ID), then the bound peaks session's recorded
58
+ * `outerSessionId` (`session.json` meta). Returns `undefined` when neither is
59
+ * available — the caller passes `undefined` through and the adapter's fallback
60
+ * returns null → conservative-fallback. Vendor-neutral: this helper has no
61
+ * IDE-specific naming; the env-var read lives alongside the binding layer.
62
+ */
63
+ export function resolveOuterSessionId(projectRoot, sessionId, env = process.env) {
64
+ const envOuter = readOuterSessionIdFromEnv(env);
65
+ if (envOuter !== undefined)
66
+ return envOuter;
67
+ const recorded = getSessionMeta(projectRoot, sessionId)?.outerSessionId;
68
+ return typeof recorded === 'string' && recorded.length > 0 ? recorded : undefined;
48
69
  }
49
70
  /**
50
71
  * Render the binding as a pipeable ASCII table. The columns are fixed
@@ -32,9 +32,9 @@ export declare const SkillSearchInputSchema: z.ZodObject<{
32
32
  status: "status";
33
33
  resume: "resume";
34
34
  audit: "audit";
35
+ ide: "ide";
35
36
  content: "content";
36
37
  test: "test";
37
- ide: "ide";
38
38
  research: "research";
39
39
  doctor: "doctor";
40
40
  triage: "triage";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "peaks-loop",
3
- "version": "4.0.26",
3
+ "version": "4.0.28",
4
4
  "description": "Loop Engineering CLI — workflow primitive / loop guards / evaluators / slice orchestration",
5
5
  "author": "SquabbyZ",
6
6
  "keywords": [
@@ -101,10 +101,10 @@
101
101
  "fzf": "^0.5.2",
102
102
  "yaml": "^2.9.0",
103
103
  "zod": "^4.4.3",
104
- "peaks-loop-internal-runtime": "0.0.11",
105
- "peaks-loop-shared": "0.0.60",
106
- "peaks-loop-shared-channel": "0.0.28",
107
- "peaks-loop-mut": "0.1.24"
104
+ "peaks-loop-internal-runtime": "0.0.13",
105
+ "peaks-loop-mut": "0.1.26",
106
+ "peaks-loop-shared": "0.0.62",
107
+ "peaks-loop-shared-channel": "0.0.30"
108
108
  },
109
109
  "devDependencies": {
110
110
  "@changesets/cli": "2.31.1",