@volter/supercode-interchange 0.1.4 → 0.1.5
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/README.md +13 -0
- package/package.json +1 -1
- package/session-launch-agent.mjs +30 -0
- package/session-read.d.ts +3 -1
- package/session-read.mjs +12 -2
package/README.md
CHANGED
|
@@ -110,6 +110,19 @@ cover recorded posture/policies through npm and operator streams, including
|
|
|
110
110
|
unknown posture for malformed records. The manifest's other branches,
|
|
111
111
|
corpus/scale, concurrent reads and independent source review remain open.
|
|
112
112
|
|
|
113
|
+
`sessions.launch_agent` reads `<harness home>/supercode/launches/<session id>.json`
|
|
114
|
+
in the same caller-owned load lane. Claude `projects` and Codex `sessions`
|
|
115
|
+
ancestors select the transcript's recorded home, independent of current vendor
|
|
116
|
+
defaults; no transcript must exist. Unsupported locators, unsafe ids, absent,
|
|
117
|
+
invalid UTF-8 or malformed records, and nonobject environments return null.
|
|
118
|
+
The environment is recorded metadata, never caller authority. The new
|
|
119
|
+
`launch_agent` capability marker refuses older read services explicitly.
|
|
120
|
+
Native runtime launch-record writers remain for their separate replacement.
|
|
121
|
+
[Private Mac/Windows conversations](../../docs/evidence/session-launch-metadata-2026-10-08.md)
|
|
122
|
+
record selected-home answers and null malformed metadata through npm and
|
|
123
|
+
operator streams; concurrent path/record replacement and runtime writing remain
|
|
124
|
+
unqualified.
|
|
125
|
+
|
|
113
126
|
`resolveHarnessHomes` follows native HOME-first defaults and preserves explicitly empty harness-specific
|
|
114
127
|
home values. `projectMetadata` applies workspace scope, native lineage, repository-family, profile, time and
|
|
115
128
|
metadata-search filters with stable newest-first ordering. It clones raw rows before descendant roll-up.
|
package/package.json
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Recorded launch metadata is a reading, never caller authority. The native
|
|
2
|
+
// runtime writer remains until its own replacement boundary.
|
|
3
|
+
import { readFileSync } from 'node:fs';
|
|
4
|
+
import { basename, dirname, isAbsolute, sep } from 'node:path';
|
|
5
|
+
import { parseNativeJson } from './native-json.mjs';
|
|
6
|
+
|
|
7
|
+
export function recordedLaunchAgent(locator, { cwd = process.cwd() } = {}) {
|
|
8
|
+
if (locator.storage.kind !== 'file' || !locator.session_id.length
|
|
9
|
+
|| /[^A-Za-z0-9_-]/.test(locator.session_id)) return null;
|
|
10
|
+
const store = locator.harness === 'codex' ? 'sessions' : locator.harness === 'claude-code' ? 'projects' : null;
|
|
11
|
+
if (store == null) return null;
|
|
12
|
+
// Walk the lexical path, starting with the path itself as Path::ancestors
|
|
13
|
+
// does. Resolving '..' first could choose a different recorded harness home.
|
|
14
|
+
let at = locator.storage.path, home = null;
|
|
15
|
+
for (;;) {
|
|
16
|
+
if (basename(at) === store) { home = dirname(at); break; }
|
|
17
|
+
const parent = dirname(at);
|
|
18
|
+
if (parent === at || at === '.') break;
|
|
19
|
+
at = parent;
|
|
20
|
+
}
|
|
21
|
+
if (home == null) return null;
|
|
22
|
+
// Leave '..' for the filesystem, including its symlink semantics.
|
|
23
|
+
const path = `${isAbsolute(home) ? '' : `${cwd}${sep}`}${home}${sep}supercode${sep}launches${sep}${locator.session_id}.json`;
|
|
24
|
+
try {
|
|
25
|
+
const text = new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(readFileSync(path));
|
|
26
|
+
const record = parseNativeJson(text);
|
|
27
|
+
const environment = record && !Array.isArray(record) && typeof record === 'object' ? record.environment : null;
|
|
28
|
+
return environment && !Array.isArray(environment) && typeof environment === 'object' ? environment : null;
|
|
29
|
+
} catch { return null; }
|
|
30
|
+
}
|
package/session-read.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { SessionFollower } from './session-codecs.js';
|
|
|
3
3
|
import type { ProjectedSessionResult, NormalizedSession, RecordedSessionProfile, RecordedSessionProfileChange } from './session-model.js';
|
|
4
4
|
export const SESSION_READ_METHODS: readonly string[];
|
|
5
5
|
export const SESSION_READ_EVENT: 'harness.v1.sessions.event';
|
|
6
|
-
export const SESSION_READ_CAPABILITY: Readonly<{ version: 1; owner: 'caller'; language: 'typescript'; native_parser: false; recorded_config: true }>;
|
|
6
|
+
export const SESSION_READ_CAPABILITY: Readonly<{ version: 1; owner: 'caller'; language: 'typescript'; native_parser: false; recorded_config: true; launch_agent: true }>;
|
|
7
7
|
export interface SessionReadContext { cwd?: string; env?: Record<string, string | undefined> }
|
|
8
8
|
export function parseSessionWire(text: string): unknown;
|
|
9
9
|
export function stringifySessionWire(value: unknown): string;
|
|
@@ -12,3 +12,5 @@ export function loadSessionRead(params: unknown, context?: SessionReadContext):
|
|
|
12
12
|
export function openSessionReadFollower(params: unknown, context?: SessionReadContext): Promise<SessionFollower>;
|
|
13
13
|
/** Recorded values only; malformed complete Claude runtime state leaves mode unknown. */
|
|
14
14
|
export function loadRecordedSessionConfiguration(params: unknown, context?: SessionReadContext): Promise<{ harness: string; session_id: string | null; cwd: unknown; model: unknown; approval_policy: unknown; sandbox_policy: unknown; permission_mode: string | null }>;
|
|
15
|
+
/** Best-effort recorded environment only, independent of transcript existence or caller authority. */
|
|
16
|
+
export function loadSessionLaunchAgent(params: unknown, context?: SessionReadContext): Promise<{ environment: Record<string, unknown> | null }>;
|
package/session-read.mjs
CHANGED
|
@@ -9,10 +9,11 @@ import { SessionFollower } from './session-follower.mjs';
|
|
|
9
9
|
import { normalizedSessionJson } from './session-model.mjs';
|
|
10
10
|
import { boundSessionView, projectedMessageWindow, projectedSessionJson, projectedSessionResult, projectedSessionSummary, recordedSessionProfile, recordedSessionProfileHistory } from './session-views.mjs';
|
|
11
11
|
import { recordedSessionConfiguration } from './session-recorded-config.mjs';
|
|
12
|
+
import { recordedLaunchAgent } from './session-launch-agent.mjs';
|
|
12
13
|
|
|
13
|
-
export const SESSION_READ_METHODS = Object.freeze(['harness.v1.sessions.load', 'harness.v1.sessions.follow', 'harness.v1.sessions.unfollow', 'harness.v1.sessions.recorded_config']);
|
|
14
|
+
export const SESSION_READ_METHODS = Object.freeze(['harness.v1.sessions.load', 'harness.v1.sessions.follow', 'harness.v1.sessions.unfollow', 'harness.v1.sessions.recorded_config', 'harness.v1.sessions.launch_agent']);
|
|
14
15
|
export const SESSION_READ_EVENT = 'harness.v1.sessions.event';
|
|
15
|
-
export const SESSION_READ_CAPABILITY = Object.freeze({ version: 1, owner: 'caller', language: 'typescript', native_parser: false, recorded_config: true });
|
|
16
|
+
export const SESSION_READ_CAPABILITY = Object.freeze({ version: 1, owner: 'caller', language: 'typescript', native_parser: false, recorded_config: true, launch_agent: true });
|
|
16
17
|
export { parseNativeJson as parseSessionWire, stringifyNativeJson as stringifySessionWire };
|
|
17
18
|
const invalid = (message) => { throw Object.assign(new Error(message), { rpcCode: -32602 }); };
|
|
18
19
|
const object = (value, name) => {
|
|
@@ -111,3 +112,12 @@ export async function loadRecordedSessionConfiguration(params, context = {}) {
|
|
|
111
112
|
const { locator } = parseSessionReadParams({ locator: params.locator }, context);
|
|
112
113
|
return recordedSessionConfiguration(await loadSessionLocator(locator, { ...context, fidelity: 'byte_lossless', includeSubagents: true }), locator.harness);
|
|
113
114
|
}
|
|
115
|
+
|
|
116
|
+
export async function loadSessionLaunchAgent(params, context = {}) {
|
|
117
|
+
object(params, 'launch metadata params');
|
|
118
|
+
const { locator } = parseSessionReadParams({ locator: params.locator }, context);
|
|
119
|
+
// This door needs no transcript or parser. Preserve the original lexical
|
|
120
|
+
// path for the harness-home lookup, rather than the normalized load path.
|
|
121
|
+
locator.storage.path = params.locator.storage.path;
|
|
122
|
+
return { environment: recordedLaunchAgent(locator, context) };
|
|
123
|
+
}
|