pi-fabric 0.78.0 → 0.79.1
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 +1 -0
- package/dist/chunks/{chunk-DYEOFQ64.js → chunk-5OVYFN4A.js} +2 -2
- package/dist/chunks/{chunk-E3V22XGU.js → chunk-6GRNSFDJ.js} +2 -1
- package/dist/chunks/chunk-6GRNSFDJ.js.map +7 -0
- package/dist/chunks/chunk-7O2SJRDL.js +1046 -0
- package/dist/chunks/chunk-7O2SJRDL.js.map +7 -0
- package/dist/chunks/{chunk-DUIHQAIZ.js → chunk-ESE4P267.js} +2 -2
- package/dist/chunks/chunk-HDTW3CML.js +273 -0
- package/dist/chunks/chunk-HDTW3CML.js.map +7 -0
- package/dist/chunks/{chunk-2AF5ANEB.js → chunk-NQIGNZBM.js} +4 -4
- package/dist/chunks/chunk-OTB7OOQS.js +84 -0
- package/dist/chunks/chunk-OTB7OOQS.js.map +7 -0
- package/dist/chunks/{chunk-PFF3X7OO.js → chunk-R32YJVKM.js} +2 -2
- package/dist/chunks/{chunk-3QPTSKDG.js → chunk-R6KHFESZ.js} +64 -17
- package/dist/chunks/chunk-R6KHFESZ.js.map +7 -0
- package/dist/chunks/{chunk-2E3CAABA.js → chunk-XWRRKI63.js} +11 -4
- package/dist/chunks/chunk-XWRRKI63.js.map +7 -0
- package/dist/chunks/{fabric-runtime-state-H2NCRJWK.js → fabric-runtime-state-SX47QTFW.js} +59 -162
- package/dist/chunks/fabric-runtime-state-SX47QTFW.js.map +7 -0
- package/dist/chunks/{settings-FUL3U3N4.js → settings-OXHVJMMW.js} +3 -3
- package/dist/commands/fabric.d.ts.map +1 -1
- package/dist/config.d.ts +4 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/core/action-registry.d.ts +5 -1
- package/dist/core/action-registry.d.ts.map +1 -1
- package/dist/core/action-registry.js +2 -1
- package/dist/core/file-lock.d.ts +11 -0
- package/dist/core/file-lock.d.ts.map +1 -0
- package/dist/entropy/active.d.ts +7 -0
- package/dist/entropy/active.d.ts.map +1 -0
- package/dist/entropy/compiled-store.d.ts +13 -0
- package/dist/entropy/compiled-store.d.ts.map +1 -0
- package/dist/entropy/compiled-surface.d.ts +43 -0
- package/dist/entropy/compiled-surface.d.ts.map +1 -0
- package/dist/entropy/compiler.d.ts +23 -0
- package/dist/entropy/compiler.d.ts.map +1 -0
- package/dist/entropy/corpus.d.ts +9 -0
- package/dist/entropy/corpus.d.ts.map +1 -0
- package/dist/entropy/fingerprint.d.ts +9 -0
- package/dist/entropy/fingerprint.d.ts.map +1 -0
- package/dist/entropy/index.d.ts +11 -0
- package/dist/entropy/index.d.ts.map +1 -0
- package/dist/entropy/index.js +91 -0
- package/dist/entropy/index.js.map +7 -0
- package/dist/entropy/meter.d.ts +9 -0
- package/dist/entropy/meter.d.ts.map +1 -0
- package/dist/entropy/passes.d.ts +12 -0
- package/dist/entropy/passes.d.ts.map +1 -0
- package/dist/entropy/sessions.d.ts +32 -0
- package/dist/entropy/sessions.d.ts.map +1 -0
- package/dist/entropy/surface.d.ts +30 -0
- package/dist/entropy/surface.d.ts.map +1 -0
- package/dist/entropy/types.d.ts +151 -0
- package/dist/entropy/types.d.ts.map +1 -0
- package/dist/fabric-runtime-state.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +286 -15
- package/dist/index.js.map +3 -3
- package/dist/memory/discovery.d.ts +2 -0
- package/dist/memory/discovery.d.ts.map +1 -1
- package/dist/memory/discovery.js +5 -3
- package/dist/providers/memory-provider.js +2 -2
- package/dist/repairs/store.d.ts.map +1 -1
- package/dist/residency/host.js +4 -4
- package/dist/residency/pi-entry.js +4 -4
- package/docs/certification.md +2 -1
- package/docs/configuration.md +2 -0
- package/docs/entropy.md +264 -0
- package/docs/interface.md +1 -0
- package/docs/repairs.md +2 -0
- package/docs/speculation.md +13 -0
- package/package.json +2 -1
- package/dist/chunks/chunk-2E3CAABA.js.map +0 -7
- package/dist/chunks/chunk-3QPTSKDG.js.map +0 -7
- package/dist/chunks/chunk-E3V22XGU.js.map +0 -7
- package/dist/chunks/fabric-runtime-state-H2NCRJWK.js.map +0 -7
- /package/dist/chunks/{chunk-DYEOFQ64.js.map → chunk-5OVYFN4A.js.map} +0 -0
- /package/dist/chunks/{chunk-DUIHQAIZ.js.map → chunk-ESE4P267.js.map} +0 -0
- /package/dist/chunks/{chunk-2AF5ANEB.js.map → chunk-NQIGNZBM.js.map} +0 -0
- /package/dist/chunks/{chunk-PFF3X7OO.js.map → chunk-R32YJVKM.js.map} +0 -0
- /package/dist/chunks/{settings-FUL3U3N4.js.map → settings-OXHVJMMW.js.map} +0 -0
package/README.md
CHANGED
|
@@ -133,6 +133,7 @@ See the [interface & commands reference](docs/interface.md) for every view, keyb
|
|
|
133
133
|
- [External providers](docs/providers.md): the versioned provider protocol for extensions.
|
|
134
134
|
- [Architecture & security](docs/architecture.md): the host bridge, sandboxing, tool-call robustness, and limits.
|
|
135
135
|
- [Catalog repairs](docs/repairs.md): unique extra keys and unknown actions promoted into silent schema maps.
|
|
136
|
+
- [Tool entropy](docs/entropy.md): the deterministic entropy meter, on-demand session measurement, reduction proposals, the autonomous compile loop with its ratchet gate, and `certify:entropy`.
|
|
136
137
|
- [Speculative PTC](docs/speculation.md): pre-launching literal read calls while the program streams, with epoch + freshness guarantees.
|
|
137
138
|
- [Skills](docs/skills.md): the core-first invocation policy and user-invoked advanced patterns.
|
|
138
139
|
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
enumerateAllSessions,
|
|
16
16
|
resolveScope,
|
|
17
17
|
resolveSessionTarget
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-6GRNSFDJ.js";
|
|
19
19
|
import {
|
|
20
20
|
expandSessionEntriesChecked,
|
|
21
21
|
normalizeSession
|
|
@@ -865,4 +865,4 @@ export {
|
|
|
865
865
|
normalizeMemoryArgs,
|
|
866
866
|
MemoryProvider
|
|
867
867
|
};
|
|
868
|
-
//# sourceMappingURL=chunk-
|
|
868
|
+
//# sourceMappingURL=chunk-5OVYFN4A.js.map
|
|
@@ -102,9 +102,10 @@ var resolveScope = (input) => {
|
|
|
102
102
|
|
|
103
103
|
export {
|
|
104
104
|
encodeCwdDir,
|
|
105
|
+
sessionDirForCwd,
|
|
105
106
|
enumerateAllSessions,
|
|
106
107
|
AmbiguousSessionError,
|
|
107
108
|
resolveSessionTarget,
|
|
108
109
|
resolveScope
|
|
109
110
|
};
|
|
110
|
-
//# sourceMappingURL=chunk-
|
|
111
|
+
//# sourceMappingURL=chunk-6GRNSFDJ.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/memory/discovery.ts"],
|
|
4
|
+
"sourcesContent": ["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { readSessionHeader } from \"./normalize.js\";\n\nexport interface SessionRef {\n id: string;\n file: string;\n cwd: string;\n mtime: number;\n}\n\nexport interface ResolveScopeInput {\n agentDir: string;\n cwd: string;\n scope: string;\n sessionId?: string;\n sessionFile?: string;\n maxSessions: number;\n}\n\nconst SESSIONS_SUBDIR = \"sessions\";\n\nconst isJsonlFile = (name: string): boolean => name.endsWith(\".jsonl\");\n\n/** Encode a cwd into the safe directory name pi stores session files under. */\nexport const encodeCwdDir = (cwd: string): string =>\n `--${path.resolve(cwd).replace(/^[/\\\\]/, \"\").replace(/[/\\\\:]/g, \"-\")}--`;\n\n/** Directory pi stores this project's session JSONL files under. */\nexport const sessionDirForCwd = (cwd: string, agentDir: string): string =>\n path.join(agentDir, SESSIONS_SUBDIR, encodeCwdDir(cwd));\n\nconst listJsonlInDir = (dir: string): string[] => {\n try {\n return fs\n .readdirSync(dir, { withFileTypes: true })\n .filter((entry) => entry.isFile() && isJsonlFile(entry.name))\n .map((entry) => path.join(dir, entry.name));\n } catch {\n return [];\n }\n};\n\nconst statMtime = (file: string): number => {\n try {\n return fs.statSync(file).mtimeMs;\n } catch {\n return 0;\n }\n};\n\nconst refFromFile = (file: string): SessionRef => {\n const header = readSessionHeader(file);\n return {\n id: header?.sessionId ?? path.basename(file, \".jsonl\"),\n file,\n cwd: header?.cwd ?? \"\",\n mtime: statMtime(file),\n };\n};\n\nconst sessionsDirRoot = (agentDir: string): string => path.join(agentDir, SESSIONS_SUBDIR);\n\nconst compareRefsByRecency = (left: SessionRef, right: SessionRef): number => {\n if (right.mtime !== left.mtime) return right.mtime - left.mtime;\n return left.file < right.file ? -1 : left.file > right.file ? 1 : 0;\n};\n\n/**\n * Enumerate every session JSONL file under the agent dir, newest first by\n * file mtime. Bounded by `maxSessions`. Returns refs with resolved cwd and\n * sessionId from each file header (falling back to the file stem).\n */\nexport const enumerateAllSessions = (agentDir: string, maxSessions: number): SessionRef[] => {\n const root = sessionsDirRoot(agentDir);\n let projectDirs: string[] = [];\n try {\n projectDirs = fs\n .readdirSync(root, { withFileTypes: true })\n .filter((entry) => entry.isDirectory())\n .map((entry) => path.join(root, entry.name));\n } catch {\n return [];\n }\n const files: string[] = [];\n for (const dir of projectDirs) {\n for (const file of listJsonlInDir(dir)) files.push(file);\n }\n return files\n .map(refFromFile)\n .sort(compareRefsByRecency)\n .slice(0, Math.max(1, maxSessions));\n};\n\nconst newestSessionInDir = (dir: string): SessionRef | null => {\n const files = listJsonlInDir(dir);\n if (files.length === 0) return null;\n return files\n .map(refFromFile)\n .sort(compareRefsByRecency)[0]!;\n};\n\nexport class AmbiguousSessionError extends Error {\n readonly code = \"ambiguous_session\";\n\n constructor(\n readonly session: string,\n readonly candidates: string[],\n ) {\n super(`Session id ${JSON.stringify(session)} is ambiguous; use an exact session file path.`);\n this.name = \"AmbiguousSessionError\";\n }\n}\n\nexport const resolveSessionTarget = (\n agentDir: string,\n target: string,\n): SessionRef | null => {\n if (target.endsWith(\".jsonl\") && fs.existsSync(target)) {\n return refFromFile(path.resolve(target));\n }\n const all = enumerateAllSessions(agentDir, Number.MAX_SAFE_INTEGER);\n const byId = all.filter((ref) => ref.id === target);\n if (byId.length > 1) throw new AmbiguousSessionError(target, byId.map((ref) => ref.file));\n if (byId.length === 1) return byId[0]!;\n const byStem = all.filter((ref) => path.basename(ref.file, \".jsonl\") === target);\n if (byStem.length > 1) throw new AmbiguousSessionError(target, byStem.map((ref) => ref.file));\n return byStem[0] ?? null;\n};\n\n/**\n * Resolve a scope string into the concrete set of session files to search.\n *\n * - `session` (default): the current session file (from invocation context\n * if available, else the newest session for the current cwd).\n * - `project`: all sessions stored under the current cwd's default session dir.\n * - `global`: all sessions under the agent dir, bounded by `maxSessions`.\n * - `session:<id-or-path>`: one specific session by id or file path.\n */\nexport const resolveScope = (input: ResolveScopeInput): SessionRef[] => {\n const scope = input.scope?.trim();\n if (scope.startsWith(\"session:\")) {\n const target = scope.slice(\"session:\".length).trim();\n const ref = resolveSessionTarget(input.agentDir, target);\n return ref ? [ref] : [];\n }\n if (scope === \"global\") {\n return enumerateAllSessions(input.agentDir, input.maxSessions);\n }\n if (scope === \"project\") {\n const dir = sessionDirForCwd(input.cwd, input.agentDir);\n return listJsonlInDir(dir)\n .map(refFromFile)\n .sort(compareRefsByRecency)\n .slice(0, Math.max(1, input.maxSessions));\n }\n // default: session\n if (input.sessionFile) {\n const ref = refFromFile(input.sessionFile);\n return [ref];\n }\n const dir = sessionDirForCwd(input.cwd, input.agentDir);\n const newest = newestSessionInDir(dir);\n return newest ? [newest] : [];\n};\n"],
|
|
5
|
+
"mappings": ";;;;;AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AAmBjB,IAAM,kBAAkB;AAExB,IAAM,cAAc,CAAC,SAA0B,KAAK,SAAS,QAAQ;AAG9D,IAAM,eAAe,CAAC,QAC3B,KAAK,KAAK,QAAQ,GAAG,EAAE,QAAQ,UAAU,EAAE,EAAE,QAAQ,WAAW,GAAG,CAAC;AAG/D,IAAM,mBAAmB,CAAC,KAAa,aAC5C,KAAK,KAAK,UAAU,iBAAiB,aAAa,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