@phyzess/pappra 0.0.0-stage → 0.1.0-beta.10
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/LICENSE +21 -0
- package/README.md +99 -2
- package/THIRD_PARTY_NOTICES.md +16 -0
- package/assets/integrations/skills/pappra/SKILL.md +71 -0
- package/assets/integrations/skills/pappra/references/hosts.md +40 -0
- package/assets/integrations/skills/pappra/references/lifecycle.md +41 -0
- package/assets/integrations/skills/pappra/references/operations.md +27 -0
- package/assets/manifest.json +4 -0
- package/dist/app/collaboration.d.ts +170 -0
- package/dist/app/collaboration.js +1643 -0
- package/dist/app/doctor.d.ts +9 -0
- package/dist/app/doctor.js +1030 -0
- package/dist/app/init.d.ts +171 -0
- package/dist/app/init.js +1442 -0
- package/dist/cli/commands/code.d.ts +16 -0
- package/dist/cli/commands/code.js +127 -0
- package/dist/cli/commands/collaboration.d.ts +13 -0
- package/dist/cli/commands/collaboration.js +186 -0
- package/dist/cli/commands/continuity.d.ts +29 -0
- package/dist/cli/commands/continuity.js +133 -0
- package/dist/cli/commands/docs.d.ts +12 -0
- package/dist/cli/commands/docs.js +234 -0
- package/dist/cli/commands/doctor.d.ts +14 -0
- package/dist/cli/commands/doctor.js +57 -0
- package/dist/cli/commands/host.d.ts +17 -0
- package/dist/cli/commands/host.js +199 -0
- package/dist/cli/commands/init.d.ts +59 -0
- package/dist/cli/commands/init.js +845 -0
- package/dist/cli/commands/runtime.d.ts +14 -0
- package/dist/cli/commands/runtime.js +263 -0
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.js +10 -0
- package/dist/cli/output.d.ts +4 -0
- package/dist/cli/output.js +1 -0
- package/dist/cli/run.d.ts +2 -0
- package/dist/cli/run.js +749 -0
- package/dist/code/budget.d.ts +14 -0
- package/dist/code/budget.js +39 -0
- package/dist/code/exec.d.ts +23 -0
- package/dist/code/exec.js +133 -0
- package/dist/code/identity.d.ts +13 -0
- package/dist/code/identity.js +214 -0
- package/dist/code/index.d.ts +6 -0
- package/dist/code/index.js +3 -0
- package/dist/code/providers/codegraph.d.ts +59 -0
- package/dist/code/providers/codegraph.js +567 -0
- package/dist/code/registration.d.ts +9 -0
- package/dist/code/registration.js +293 -0
- package/dist/code/service.d.ts +53 -0
- package/dist/code/service.js +633 -0
- package/dist/code/text.d.ts +3 -0
- package/dist/code/text.js +202 -0
- package/dist/collab/admission.d.ts +450 -0
- package/dist/collab/admission.js +797 -0
- package/dist/collab/canonical.d.ts +26 -0
- package/dist/collab/canonical.js +136 -0
- package/dist/collab/contracts.d.ts +73 -0
- package/dist/collab/contracts.js +76 -0
- package/dist/collab/envelope.d.ts +52 -0
- package/dist/collab/envelope.js +241 -0
- package/dist/collab/fingerprint.d.ts +7 -0
- package/dist/collab/fingerprint.js +58 -0
- package/dist/collab/handoff.d.ts +350 -0
- package/dist/collab/handoff.js +513 -0
- package/dist/collab/index.d.ts +9 -0
- package/dist/collab/index.js +8 -0
- package/dist/collab/lifecycle.d.ts +449 -0
- package/dist/collab/lifecycle.js +534 -0
- package/dist/collab/messages.d.ts +148 -0
- package/dist/collab/messages.js +583 -0
- package/dist/collab/notify.d.ts +47 -0
- package/dist/collab/notify.js +140 -0
- package/dist/collab/preflight.d.ts +31 -0
- package/dist/collab/preflight.js +271 -0
- package/dist/collab/resources.d.ts +119 -0
- package/dist/collab/resources.js +451 -0
- package/dist/collab/store.d.ts +143 -0
- package/dist/collab/store.js +606 -0
- package/dist/collab/types.d.ts +354 -0
- package/dist/collab/types.js +1 -0
- package/dist/collab/validation.d.ts +10 -0
- package/dist/collab/validation.js +303 -0
- package/dist/continuity/context.d.ts +24 -0
- package/dist/continuity/context.js +179 -0
- package/dist/continuity/index.d.ts +3 -0
- package/dist/continuity/index.js +1 -0
- package/dist/continuity/paths.d.ts +37 -0
- package/dist/continuity/paths.js +258 -0
- package/dist/continuity/service.d.ts +59 -0
- package/dist/continuity/service.js +1258 -0
- package/dist/hosts/claude/native.d.ts +79 -0
- package/dist/hosts/claude/native.js +853 -0
- package/dist/hosts/codex/native.d.ts +345 -0
- package/dist/hosts/codex/native.js +1528 -0
- package/dist/hosts/codex/protocol.d.ts +51 -0
- package/dist/hosts/codex/protocol.js +42 -0
- package/dist/hosts/detect.d.ts +29 -0
- package/dist/hosts/detect.js +73 -0
- package/dist/hosts/index.d.ts +10 -0
- package/dist/hosts/index.js +10 -0
- package/dist/hosts/integration/bundle-export.d.ts +24 -0
- package/dist/hosts/integration/bundle-export.js +128 -0
- package/dist/hosts/integration/bundle.d.ts +19 -0
- package/dist/hosts/integration/bundle.js +99 -0
- package/dist/hosts/integration/hook-entry.d.ts +1 -0
- package/dist/hosts/integration/hook-entry.js +68 -0
- package/dist/hosts/integration/hook.d.ts +32 -0
- package/dist/hosts/integration/hook.js +781 -0
- package/dist/hosts/integration/pappra-extension-runtime.mjs +24610 -0
- package/dist/hosts/integration/pappra-hook.mjs +24728 -0
- package/dist/hosts/integration/pi-extension-runtime.d.ts +18 -0
- package/dist/hosts/integration/pi-extension-runtime.js +89 -0
- package/dist/hosts/integration/pi-template.d.ts +3 -0
- package/dist/hosts/integration/pi-template.js +5 -0
- package/dist/hosts/integration/service.d.ts +49 -0
- package/dist/hosts/integration/service.js +1421 -0
- package/dist/hosts/integration/support.d.ts +59 -0
- package/dist/hosts/integration/support.js +66 -0
- package/dist/hosts/integration/templates.d.ts +22 -0
- package/dist/hosts/integration/templates.js +75 -0
- package/dist/hosts/pi/protocol.d.ts +22 -0
- package/dist/hosts/pi/protocol.js +28 -0
- package/dist/hosts/pi/query-result.d.ts +22 -0
- package/dist/hosts/pi/query-result.js +710 -0
- package/dist/hosts/pi/rpc.d.ts +939 -0
- package/dist/hosts/pi/rpc.js +1659 -0
- package/dist/hosts/pilot.d.ts +485 -0
- package/dist/hosts/pilot.js +593 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +4 -0
- package/dist/infra/fs.d.ts +27 -0
- package/dist/infra/fs.js +130 -0
- package/dist/infra/git.d.ts +60 -0
- package/dist/infra/git.js +358 -0
- package/dist/infra/owned-process-group.d.ts +173 -0
- package/dist/infra/owned-process-group.js +571 -0
- package/dist/install/apply.d.ts +65 -0
- package/dist/install/apply.js +663 -0
- package/dist/install/index.d.ts +5 -0
- package/dist/install/index.js +5 -0
- package/dist/install/ownership.d.ts +85 -0
- package/dist/install/ownership.js +430 -0
- package/dist/install/plan.d.ts +39 -0
- package/dist/install/plan.js +97 -0
- package/dist/install/rollback.d.ts +18 -0
- package/dist/install/rollback.js +544 -0
- package/dist/install/runtime.d.ts +76 -0
- package/dist/install/runtime.js +1252 -0
- package/dist/knowledge/catalog.d.ts +47 -0
- package/dist/knowledge/catalog.js +308 -0
- package/dist/knowledge/context.d.ts +28 -0
- package/dist/knowledge/context.js +61 -0
- package/dist/knowledge/index.d.ts +3 -0
- package/dist/knowledge/index.js +1 -0
- package/dist/knowledge/journal.d.ts +16 -0
- package/dist/knowledge/journal.js +109 -0
- package/dist/knowledge/lifecycle.d.ts +8 -0
- package/dist/knowledge/lifecycle.js +1001 -0
- package/dist/knowledge/paths.d.ts +37 -0
- package/dist/knowledge/paths.js +236 -0
- package/dist/knowledge/refs.d.ts +36 -0
- package/dist/knowledge/refs.js +267 -0
- package/dist/knowledge/service.d.ts +21 -0
- package/dist/knowledge/service.js +393 -0
- package/dist/knowledge/types.d.ts +171 -0
- package/dist/knowledge/types.js +1 -0
- package/dist/knowledge/write.d.ts +8 -0
- package/dist/knowledge/write.js +1223 -0
- package/dist/package-info.d.ts +8 -0
- package/dist/package-info.js +25 -0
- package/dist/schemas/code.d.ts +377 -0
- package/dist/schemas/code.js +145 -0
- package/dist/schemas/collaboration.d.ts +115 -0
- package/dist/schemas/collaboration.js +106 -0
- package/dist/schemas/continuity.d.ts +315 -0
- package/dist/schemas/continuity.js +199 -0
- package/dist/schemas/diagnostics.d.ts +28 -0
- package/dist/schemas/diagnostics.js +27 -0
- package/dist/schemas/doctor.d.ts +157 -0
- package/dist/schemas/doctor.js +75 -0
- package/dist/schemas/document.d.ts +644 -0
- package/dist/schemas/document.js +296 -0
- package/dist/schemas/errors.d.ts +177 -0
- package/dist/schemas/errors.js +176 -0
- package/dist/schemas/evidence.d.ts +24 -0
- package/dist/schemas/evidence.js +16 -0
- package/dist/schemas/host.d.ts +436 -0
- package/dist/schemas/host.js +203 -0
- package/dist/schemas/index.d.ts +15 -0
- package/dist/schemas/index.js +15 -0
- package/dist/schemas/init.d.ts +121 -0
- package/dist/schemas/init.js +94 -0
- package/dist/schemas/install.d.ts +227 -0
- package/dist/schemas/install.js +147 -0
- package/dist/schemas/machine.d.ts +43 -0
- package/dist/schemas/machine.js +96 -0
- package/dist/schemas/outcome.d.ts +23 -0
- package/dist/schemas/outcome.js +17 -0
- package/dist/schemas/paths.d.ts +19 -0
- package/dist/schemas/paths.js +63 -0
- package/dist/schemas/workspace.d.ts +120 -0
- package/dist/schemas/workspace.js +201 -0
- package/dist/workspace/config-file.d.ts +36 -0
- package/dist/workspace/config-file.js +237 -0
- package/dist/workspace/config.d.ts +28 -0
- package/dist/workspace/config.js +79 -0
- package/dist/workspace/discover.d.ts +34 -0
- package/dist/workspace/discover.js +195 -0
- package/dist/workspace/documents.d.ts +21 -0
- package/dist/workspace/documents.js +395 -0
- package/dist/workspace/ignore.d.ts +10 -0
- package/dist/workspace/ignore.js +48 -0
- package/dist/workspace/index.d.ts +7 -0
- package/dist/workspace/index.js +3 -0
- package/dist/workspace/repositories.d.ts +24 -0
- package/dist/workspace/repositories.js +411 -0
- package/dist/workspace/resolve.d.ts +24 -0
- package/dist/workspace/resolve.js +268 -0
- package/dist/workspace/types.d.ts +71 -0
- package/dist/workspace/types.js +1 -0
- package/dist/workspace/validation.d.ts +18 -0
- package/dist/workspace/validation.js +197 -0
- package/package.json +111 -4
- package/skills/pappra/SKILL.md +71 -0
- package/skills/pappra/references/hosts.md +40 -0
- package/skills/pappra/references/lifecycle.md +41 -0
- package/skills/pappra/references/operations.md +27 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { HostLifecycleEvent, HostName } from '../../schemas/host.js';
|
|
2
|
+
export declare const HOST_SUPPORT: {
|
|
3
|
+
readonly pi: {
|
|
4
|
+
readonly surface: 'pi-extension';
|
|
5
|
+
readonly version: '1.3.0';
|
|
6
|
+
readonly hookScope: 'project';
|
|
7
|
+
readonly events: {
|
|
8
|
+
readonly startup: 'session_start';
|
|
9
|
+
readonly resume: 'session_start';
|
|
10
|
+
readonly compact: 'session_before_compact';
|
|
11
|
+
readonly 'checkpoint-request': 'pappra-checkpoint';
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
readonly codex: {
|
|
15
|
+
readonly surface: 'codex-hooks';
|
|
16
|
+
readonly version: '0.163.0';
|
|
17
|
+
readonly hookScope: 'user';
|
|
18
|
+
readonly events: {
|
|
19
|
+
readonly startup: 'SessionStart';
|
|
20
|
+
readonly resume: 'SessionStart';
|
|
21
|
+
readonly compact: null;
|
|
22
|
+
readonly 'checkpoint-request': null;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
readonly claude: {
|
|
26
|
+
readonly surface: 'claude-hooks';
|
|
27
|
+
readonly version: '2.1.292';
|
|
28
|
+
readonly hookScope: 'project';
|
|
29
|
+
readonly events: {
|
|
30
|
+
readonly startup: 'SessionStart';
|
|
31
|
+
readonly resume: 'SessionStart';
|
|
32
|
+
readonly compact: 'PostCompact';
|
|
33
|
+
readonly 'checkpoint-request': null;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export declare function nativeEventFor(host: HostName, event: HostLifecycleEvent): string | null;
|
|
38
|
+
export declare function isSupportedVersion(host: HostName, version: string | null): boolean;
|
|
39
|
+
export declare function surfaceFor(host: HostName): (typeof HOST_SUPPORT)[HostName]['surface'];
|
|
40
|
+
/**
|
|
41
|
+
* Observed plugin-hook support. `verified` means a real host session produced a
|
|
42
|
+
* `.pappra/local/host-events/<host>` record; `unsupported` means a control hook
|
|
43
|
+
* fired while the bundled plugin hook did not; `unverified` means no
|
|
44
|
+
* authenticated session was available. See docs/host-plugin-validation.md.
|
|
45
|
+
*/
|
|
46
|
+
export declare const HOST_PLUGIN_HOOKS: {
|
|
47
|
+
readonly pi: {
|
|
48
|
+
readonly state: 'verified';
|
|
49
|
+
readonly evidence: 'Pi 1.3.0 fires the packaged extension: `pi install <dir> -l -a` plus `pi -p -a` wrote a session_start event.';
|
|
50
|
+
};
|
|
51
|
+
readonly codex: {
|
|
52
|
+
readonly state: 'unsupported';
|
|
53
|
+
readonly evidence: 'Codex 0.163.0 does not load plugin hooks: a control hook in CODEX_HOME fired during `codex exec --dangerously-bypass-hook-trust` while the bundled plugin hook never ran, including with a .codex-plugin/plugin.json copy.';
|
|
54
|
+
};
|
|
55
|
+
readonly claude: {
|
|
56
|
+
readonly state: 'verified';
|
|
57
|
+
readonly evidence: 'Claude Code 2.1.292 passed `claude plugin validate`, then a project-scope marketplace install and `claude -p` wrote a SessionStart event from ${CLAUDE_PLUGIN_ROOT}/hooks/pappra-hook.mjs.';
|
|
58
|
+
};
|
|
59
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export const HOST_SUPPORT = {
|
|
2
|
+
pi: {
|
|
3
|
+
surface: 'pi-extension',
|
|
4
|
+
version: '1.3.0',
|
|
5
|
+
hookScope: 'project',
|
|
6
|
+
events: {
|
|
7
|
+
startup: 'session_start',
|
|
8
|
+
resume: 'session_start',
|
|
9
|
+
compact: 'session_before_compact',
|
|
10
|
+
'checkpoint-request': 'pappra-checkpoint',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
codex: {
|
|
14
|
+
surface: 'codex-hooks',
|
|
15
|
+
version: '0.163.0',
|
|
16
|
+
// Codex 0.163.0 loads lifecycle hooks only from its user configuration
|
|
17
|
+
// directory (CODEX_HOME); project `.codex/hooks.json` is not loaded.
|
|
18
|
+
hookScope: 'user',
|
|
19
|
+
events: {
|
|
20
|
+
startup: 'SessionStart',
|
|
21
|
+
resume: 'SessionStart',
|
|
22
|
+
compact: null,
|
|
23
|
+
'checkpoint-request': null,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
claude: {
|
|
27
|
+
surface: 'claude-hooks',
|
|
28
|
+
version: '2.1.292',
|
|
29
|
+
hookScope: 'project',
|
|
30
|
+
events: {
|
|
31
|
+
startup: 'SessionStart',
|
|
32
|
+
resume: 'SessionStart',
|
|
33
|
+
compact: 'PostCompact',
|
|
34
|
+
'checkpoint-request': null,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
export function nativeEventFor(host, event) {
|
|
39
|
+
return HOST_SUPPORT[host].events[event];
|
|
40
|
+
}
|
|
41
|
+
export function isSupportedVersion(host, version) {
|
|
42
|
+
return version === HOST_SUPPORT[host].version;
|
|
43
|
+
}
|
|
44
|
+
export function surfaceFor(host) {
|
|
45
|
+
return HOST_SUPPORT[host].surface;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Observed plugin-hook support. `verified` means a real host session produced a
|
|
49
|
+
* `.pappra/local/host-events/<host>` record; `unsupported` means a control hook
|
|
50
|
+
* fired while the bundled plugin hook did not; `unverified` means no
|
|
51
|
+
* authenticated session was available. See docs/host-plugin-validation.md.
|
|
52
|
+
*/
|
|
53
|
+
export const HOST_PLUGIN_HOOKS = {
|
|
54
|
+
pi: {
|
|
55
|
+
state: 'verified',
|
|
56
|
+
evidence: 'Pi 1.3.0 fires the packaged extension: `pi install <dir> -l -a` plus `pi -p -a` wrote a session_start event.',
|
|
57
|
+
},
|
|
58
|
+
codex: {
|
|
59
|
+
state: 'unsupported',
|
|
60
|
+
evidence: 'Codex 0.163.0 does not load plugin hooks: a control hook in CODEX_HOME fired during `codex exec --dangerously-bypass-hook-trust` while the bundled plugin hook never ran, including with a .codex-plugin/plugin.json copy.',
|
|
61
|
+
},
|
|
62
|
+
claude: {
|
|
63
|
+
state: 'verified',
|
|
64
|
+
evidence: 'Claude Code 2.1.292 passed `claude plugin validate`, then a project-scope marketplace install and `claude -p` wrote a SessionStart event from ${CLAUDE_PLUGIN_ROOT}/hooks/pappra-hook.mjs.',
|
|
65
|
+
},
|
|
66
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { HostName, HostLifecycleEvent } from '../../schemas/host.js';
|
|
2
|
+
export declare const PAPPRA_MANAGED_MARKER = "pappra-managed";
|
|
3
|
+
export interface RenderedHostTemplate {
|
|
4
|
+
readonly path: string;
|
|
5
|
+
readonly bytes: Buffer;
|
|
6
|
+
readonly kind: 'extension' | 'hook';
|
|
7
|
+
}
|
|
8
|
+
export declare function renderHookCommand(host: HostName, event: HostLifecycleEvent, hookExpression: string): string;
|
|
9
|
+
interface HookEntry {
|
|
10
|
+
readonly hooks: readonly {
|
|
11
|
+
readonly type: 'command';
|
|
12
|
+
readonly command: string;
|
|
13
|
+
readonly timeout: number;
|
|
14
|
+
}[];
|
|
15
|
+
}
|
|
16
|
+
export declare function renderHookConfigPatch(host: 'codex' | 'claude', hookExpression: string): {
|
|
17
|
+
readonly hooks: Record<string, readonly HookEntry[]>;
|
|
18
|
+
};
|
|
19
|
+
export declare function renderHostTemplate(host: HostName, hookExpression: string): RenderedHostTemplate;
|
|
20
|
+
export declare function hostConfigRelativePath(host: HostName): 'settings.json' | 'hooks.json' | null;
|
|
21
|
+
export declare function hostConfigName(host: HostName): string;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { basename } from 'node:path';
|
|
2
|
+
export const PAPPRA_MANAGED_MARKER = 'pappra-managed';
|
|
3
|
+
function shellQuote(value) {
|
|
4
|
+
return `'${value.replaceAll("'", "'\\''")}'`;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Host placeholders such as ${CLAUDE_PROJECT_DIR} only expand inside double
|
|
8
|
+
* quotes; absolute paths are single-quoted to survive spaces and quotes.
|
|
9
|
+
*/
|
|
10
|
+
function pathExpression(value) {
|
|
11
|
+
return value.includes('${') ? `"${value}"` : shellQuote(value);
|
|
12
|
+
}
|
|
13
|
+
export function renderHookCommand(host, event, hookExpression) {
|
|
14
|
+
return `${shellQuote(process.execPath)} ${pathExpression(hookExpression)} ${shellQuote(host)} ${shellQuote(event)} # ${PAPPRA_MANAGED_MARKER}`;
|
|
15
|
+
}
|
|
16
|
+
export function renderHookConfigPatch(host, hookExpression) {
|
|
17
|
+
const entry = (event) => ({
|
|
18
|
+
hooks: [
|
|
19
|
+
{
|
|
20
|
+
type: 'command',
|
|
21
|
+
command: renderHookCommand(host, event, hookExpression),
|
|
22
|
+
timeout: 1,
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
});
|
|
26
|
+
return host === 'claude'
|
|
27
|
+
? {
|
|
28
|
+
hooks: {
|
|
29
|
+
SessionStart: [entry('startup')],
|
|
30
|
+
PostCompact: [entry('compact')],
|
|
31
|
+
},
|
|
32
|
+
}
|
|
33
|
+
: {
|
|
34
|
+
hooks: {
|
|
35
|
+
SessionStart: [entry('startup')],
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export function renderHostTemplate(host, hookExpression) {
|
|
40
|
+
if (host === 'pi') {
|
|
41
|
+
const source = `/**
|
|
42
|
+
* Generated Pappra Pi extension. It registers bounded local lifecycle handlers;
|
|
43
|
+
* it does not start processes, models, network requests or background work.
|
|
44
|
+
*/
|
|
45
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
46
|
+
import { createPiExtension } from "./runtime.mjs";
|
|
47
|
+
|
|
48
|
+
export default function (pi: ExtensionAPI): void {
|
|
49
|
+
createPiExtension(pi);
|
|
50
|
+
}
|
|
51
|
+
`;
|
|
52
|
+
return {
|
|
53
|
+
path: 'templates/pi/entry.ts',
|
|
54
|
+
bytes: Buffer.from(source),
|
|
55
|
+
kind: 'extension',
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const patch = renderHookConfigPatch(host, hookExpression);
|
|
59
|
+
return {
|
|
60
|
+
path: `templates/${host}/hooks.json`,
|
|
61
|
+
bytes: Buffer.from(`${JSON.stringify(patch, null, 2)}\n`),
|
|
62
|
+
kind: 'hook',
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export function hostConfigRelativePath(host) {
|
|
66
|
+
if (host === 'claude')
|
|
67
|
+
return 'settings.json';
|
|
68
|
+
if (host === 'codex')
|
|
69
|
+
return 'hooks.json';
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
export function hostConfigName(host) {
|
|
73
|
+
const path = hostConfigRelativePath(host);
|
|
74
|
+
return path === null ? 'pi-extension' : basename(path);
|
|
75
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface PiData {
|
|
2
|
+
[key: string]: unknown;
|
|
3
|
+
sessionId?: string;
|
|
4
|
+
sessionFile?: string;
|
|
5
|
+
isStreaming?: boolean;
|
|
6
|
+
isCompacting?: boolean;
|
|
7
|
+
pendingMessageCount?: number;
|
|
8
|
+
messageCount?: number;
|
|
9
|
+
disposition?: string;
|
|
10
|
+
steering?: unknown[];
|
|
11
|
+
followUp?: unknown[];
|
|
12
|
+
}
|
|
13
|
+
export interface PiRecord {
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
type: string;
|
|
16
|
+
id?: string;
|
|
17
|
+
command?: string;
|
|
18
|
+
success?: boolean;
|
|
19
|
+
error?: string;
|
|
20
|
+
data?: PiData;
|
|
21
|
+
}
|
|
22
|
+
export declare function isPiRecord(value: unknown): value is PiRecord;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { object } from '../../collab/validation.js';
|
|
2
|
+
export function isPiRecord(value) {
|
|
3
|
+
if (!object(value) || typeof value['type'] !== 'string')
|
|
4
|
+
return false;
|
|
5
|
+
for (const key of ['id', 'command', 'error'])
|
|
6
|
+
if (value[key] !== undefined && typeof value[key] !== 'string')
|
|
7
|
+
return false;
|
|
8
|
+
if (value['success'] !== undefined && typeof value['success'] !== 'boolean')
|
|
9
|
+
return false;
|
|
10
|
+
const data = value['data'];
|
|
11
|
+
if (data === undefined)
|
|
12
|
+
return true;
|
|
13
|
+
if (!object(data))
|
|
14
|
+
return false;
|
|
15
|
+
for (const key of ['sessionId', 'sessionFile', 'disposition'])
|
|
16
|
+
if (data[key] !== undefined && typeof data[key] !== 'string')
|
|
17
|
+
return false;
|
|
18
|
+
for (const key of ['isStreaming', 'isCompacting'])
|
|
19
|
+
if (data[key] !== undefined && typeof data[key] !== 'boolean')
|
|
20
|
+
return false;
|
|
21
|
+
for (const key of ['pendingMessageCount', 'messageCount'])
|
|
22
|
+
if (data[key] !== undefined && typeof data[key] !== 'number')
|
|
23
|
+
return false;
|
|
24
|
+
for (const key of ['steering', 'followUp'])
|
|
25
|
+
if (data[key] !== undefined && !Array.isArray(data[key]))
|
|
26
|
+
return false;
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface QueryOptions {
|
|
2
|
+
session: string;
|
|
3
|
+
cwd: string;
|
|
4
|
+
expectedSession: string;
|
|
5
|
+
taskId: string;
|
|
6
|
+
assignmentId: string;
|
|
7
|
+
attempt: number;
|
|
8
|
+
inputDigest: string;
|
|
9
|
+
output?: string;
|
|
10
|
+
evidenceDir?: string;
|
|
11
|
+
piBin?: string;
|
|
12
|
+
timeoutMs?: number;
|
|
13
|
+
graceMs?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface RecoveryResult {
|
|
16
|
+
schema: string;
|
|
17
|
+
status: string;
|
|
18
|
+
blockers: string[];
|
|
19
|
+
recovered?: unknown;
|
|
20
|
+
[key: string]: unknown;
|
|
21
|
+
}
|
|
22
|
+
export declare function queryPiResult(options: QueryOptions): Promise<RecoveryResult>;
|