@modootoday/pmcp 0.17.3 → 0.18.0
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/.agents/plugins/marketplace.json +1 -1
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +60 -0
- package/README.md +29 -24
- package/dist/apply-4IGTXOCQ.js +242 -0
- package/dist/{attachment-tU5FZrgZ.d.ts → attachment-D84OGI6n.d.ts} +1 -1
- package/dist/available-DBSIVVJ6.js +73 -0
- package/dist/broadcast-3RY3OZGY.js +18 -0
- package/dist/chunk-25GHX674.js +1246 -0
- package/dist/chunk-2P4Z2NUX.js +28 -0
- package/dist/chunk-34DECPVC.js +22 -0
- package/dist/chunk-3NYG4SGU.js +45 -0
- package/dist/chunk-3PW4FI7U.js +32 -0
- package/dist/chunk-3Y3HDMHA.js +108 -0
- package/dist/chunk-47O3X4VS.js +113 -0
- package/dist/chunk-4NDEP7HU.js +26 -0
- package/dist/chunk-4VCC2NXE.js +104 -0
- package/dist/chunk-5OMOPUE6.js +39 -0
- package/dist/chunk-5QQWS4US.js +53 -0
- package/dist/chunk-5ZABTVSW.js +48 -0
- package/dist/chunk-65ZHM5RH.js +4985 -0
- package/dist/chunk-665TA55Z.js +419 -0
- package/dist/chunk-6STKGOCW.js +27 -0
- package/dist/chunk-6WXMJOMI.js +9 -0
- package/dist/chunk-73AKO4UL.js +24 -0
- package/dist/chunk-7BLPN3W6.js +31 -0
- package/dist/chunk-7DLZC73N.js +29 -0
- package/dist/chunk-7GBYECSK.js +72 -0
- package/dist/chunk-7TD53M7L.js +13 -0
- package/dist/chunk-A4PKLESO.js +112 -0
- package/dist/chunk-ABTJQ4QV.js +74 -0
- package/dist/chunk-BBTBJCFA.js +380 -0
- package/dist/chunk-BU65MNVU.js +13 -0
- package/dist/chunk-BVCTKPT3.js +83 -0
- package/dist/chunk-C4NHQGHL.js +142 -0
- package/dist/chunk-CJTKR6K6.js +1213 -0
- package/dist/chunk-DCU2EXQV.js +78 -0
- package/dist/chunk-DZ2MRTYT.js +135 -0
- package/dist/chunk-E2YOZ2FF.js +207 -0
- package/dist/chunk-E3DQB5LS.js +48 -0
- package/dist/chunk-E7OOHLQR.js +7 -0
- package/dist/chunk-EATCUWGG.js +66 -0
- package/dist/chunk-EIDIVIAD.js +33 -0
- package/dist/chunk-EJBZGIDK.js +1934 -0
- package/dist/chunk-ELAGZ635.js +252 -0
- package/dist/chunk-GZHHEHKY.js +44 -0
- package/dist/chunk-HDMBVLCZ.js +53 -0
- package/dist/chunk-HQOB7OQS.js +81 -0
- package/dist/chunk-IGYRMM62.js +28 -0
- package/dist/chunk-IJBSOWHK.js +86 -0
- package/dist/chunk-INT7QLEU.js +114 -0
- package/dist/chunk-J6QLLQVL.js +1025 -0
- package/dist/chunk-J7UYNJCR.js +9 -0
- package/dist/chunk-JEL35P7S.js +53 -0
- package/dist/chunk-JGJ4INEN.js +32 -0
- package/dist/chunk-JS5RTH4I.js +84 -0
- package/dist/chunk-JUXNIXN4.js +42 -0
- package/dist/chunk-JWRZDYB5.js +59 -0
- package/dist/chunk-KMXRRSKT.js +660 -0
- package/dist/chunk-LAZQBMAU.js +67 -0
- package/dist/chunk-LLBPVZXM.js +67 -0
- package/dist/chunk-LLT5FQBE.js +57 -0
- package/dist/chunk-LMT3PPXJ.js +17 -0
- package/dist/chunk-MM2Y43LC.js +87 -0
- package/dist/chunk-MPSQXSC6.js +346 -0
- package/dist/chunk-MVFH26QT.js +97 -0
- package/dist/chunk-MWFOUBFC.js +39 -0
- package/dist/chunk-N5AQ3PP7.js +211 -0
- package/dist/chunk-NQPURJT5.js +44 -0
- package/dist/chunk-NRBQK6UX.js +105 -0
- package/dist/chunk-NZS5CD72.js +333 -0
- package/dist/chunk-OEH47H6A.js +48 -0
- package/dist/chunk-OG7QR2DP.js +75 -0
- package/dist/chunk-OPYFEHKG.js +52 -0
- package/dist/chunk-P4N7DBD5.js +83 -0
- package/dist/chunk-PAX3QXX2.js +140 -0
- package/dist/chunk-PLX3BOOS.js +396 -0
- package/dist/chunk-PMJG2CXF.js +122 -0
- package/dist/chunk-PWSJJXLQ.js +643 -0
- package/dist/chunk-Q5H3L6Y4.js +23 -0
- package/dist/chunk-Q65R3XKX.js +155 -0
- package/dist/chunk-QEW4J3IZ.js +74 -0
- package/dist/chunk-QPL7E2HW.js +464 -0
- package/dist/chunk-R2GPCZUX.js +22 -0
- package/dist/chunk-R4L6LJJ2.js +778 -0
- package/dist/chunk-R5MT42JS.js +284 -0
- package/dist/chunk-RK4PYD7L.js +73 -0
- package/dist/chunk-RMATE45Z.js +197 -0
- package/dist/chunk-S3PIAMXV.js +230 -0
- package/dist/chunk-SG5TPMKH.js +93 -0
- package/dist/chunk-T3LKX23M.js +168 -0
- package/dist/chunk-T6GOWHK6.js +30 -0
- package/dist/chunk-TIA4SPU2.js +10 -0
- package/dist/chunk-TNCZ6444.js +57 -0
- package/dist/chunk-TVL5RTE6.js +269 -0
- package/dist/chunk-UOCLRM7P.js +151 -0
- package/dist/chunk-UPQTAHUK.js +189 -0
- package/dist/chunk-V4NPDK6X.js +14 -0
- package/dist/chunk-VJFEN6DJ.js +38 -0
- package/dist/chunk-WIW772I3.js +25 -0
- package/dist/chunk-XELAZAIM.js +136 -0
- package/dist/chunk-XNML2KIC.js +23 -0
- package/dist/chunk-XP2U3LO3.js +30 -0
- package/dist/chunk-YGOWIJPE.js +51 -0
- package/dist/chunk-YIXDHQYE.js +11 -0
- package/dist/chunk-YMHUM7AV.js +22 -0
- package/dist/chunk-YSAWTGNA.js +117 -0
- package/dist/chunk-Z4HRRXRF.js +478 -0
- package/dist/chunk-ZH6R642Z.js +102 -0
- package/dist/claude-U2JC2DNQ.js +77 -0
- package/dist/cli-VYCQJZ5X.js +41 -0
- package/dist/cli-ZTCBSDW4.js +46 -0
- package/dist/cli.js +144 -16160
- package/dist/completion-E7RRG3ZT.js +142 -0
- package/dist/config-DnpLL2kT.d.ts +46 -0
- package/dist/{service-qpCsOXkQ.d.ts → core-C1LPjxK6.d.ts} +2 -6
- package/dist/diagnostics-XXH4FLUG.js +93 -0
- package/dist/doctor-ZIOESU3N.js +538 -0
- package/dist/entry-ZNFCTDVE.js +305 -0
- package/dist/exec-mcp-X6372BLE.js +365 -0
- package/dist/harness-F2XFDYXF.js +177 -0
- package/dist/harness-egress-bridge.js +4 -4
- package/dist/harness-launch-gate.js +47 -940
- package/dist/harness-pane-runner.js +13 -80
- package/dist/harness-worker.js +21 -2703
- package/dist/hook-body.js +5221 -0
- package/dist/hook-spec-C5fWTSCH.d.ts +100 -0
- package/dist/hook.js +26 -0
- package/dist/hooks-FYE2L5RW.js +21 -0
- package/dist/host-GRY3VAHH.js +22 -0
- package/dist/host-X6BR6X4O.js +200 -0
- package/dist/host-run-GCA6H6SR.js +307 -0
- package/dist/http.d.ts +5 -42
- package/dist/http.js +21 -2234
- package/dist/import-mcp-2TTBPVLY.js +400 -0
- package/dist/index.d.ts +146 -168
- package/dist/index.js +133 -4911
- package/dist/init-627KFXTG.js +14 -0
- package/dist/install-GG7HHZK2.js +796 -0
- package/dist/invoke-LW22Z6ET.js +23 -0
- package/dist/list-MCP2FXUF.js +68 -0
- package/dist/list-NGMSQ5SH.js +65 -0
- package/dist/load-BEUBABtB.d.ts +21 -0
- package/dist/logout-6CSHUWWE.js +44 -0
- package/dist/logs-SPB6AANY.js +107 -0
- package/dist/mailbox/index.d.ts +10 -5
- package/dist/mailbox/index.js +53 -1572
- package/dist/mailbox-7BV54Q4R.js +285 -0
- package/dist/mailbox-GDJ7BWQN.js +189 -0
- package/dist/mainline-JQTTYJMI.js +639 -0
- package/dist/marketplace-G4VQET5W.js +191 -0
- package/dist/mcp-2DKVU3SW.js +15 -0
- package/dist/mcp-V23HC3LB.js +193 -0
- package/dist/models-ISU4DCMA.js +32 -0
- package/dist/opencode-CN7JLQYO.js +60 -0
- package/dist/pause-FFAYRBWI.js +18 -0
- package/dist/preview-DT7DWG5F.js +91 -0
- package/dist/project/hook-adapter.d.ts +6 -3
- package/dist/project/hook-adapter.js +66 -35
- package/dist/project-FY62G55N.js +70 -0
- package/dist/pty-XTJ4MIWK.js +94 -0
- package/dist/recovery-U6QB3PMT.js +100 -0
- package/dist/reindex-Y27QJFDB.js +22 -0
- package/dist/resume-UU4HZIUP.js +18 -0
- package/dist/run-HALGEJNJ.js +19 -0
- package/dist/run-OGA3P7FC.js +126 -0
- package/dist/serve-NBKT5BKY.js +104 -0
- package/dist/session-XM2CR425.js +159 -0
- package/dist/setup-DTKZLZUT.js +18 -0
- package/dist/start-login-UIQYQBMC.js +416 -0
- package/dist/status-A2OUTNGK.js +9 -0
- package/dist/status-H2VAHIDV.js +10 -0
- package/dist/status-NOOHW5WA.js +43 -0
- package/dist/status-VHODZPXB.js +55 -0
- package/dist/status-XQANBVXW.js +286 -0
- package/dist/stdio.d.ts +3 -13
- package/dist/stdio.js +16 -3186
- package/dist/sweep-64JDCGK6.js +18 -0
- package/dist/test-MKAXFJOL.js +561 -0
- package/dist/tools-gpHNq9Dh.d.ts +328 -0
- package/dist/tui-MWKAXE4K.js +153 -0
- package/dist/unbroadcast-KPUEFLZD.js +18 -0
- package/dist/validate-5GZ5YWNA.js +46 -0
- package/dist/worker-RQ575EJL.js +80 -0
- package/dist/worktree-create-PZSRB7PH.js +89 -0
- package/dist/worktree-list-JYB6VXLW.js +51 -0
- package/dist/worktree-sync-UF5CXPWV.js +30 -0
- package/docs/hooks/capabilities/antigravity.json +199 -0
- package/docs/hooks/capabilities/claude.json +179 -0
- package/docs/hooks/capabilities/codex.json +179 -0
- package/docs/hooks/capabilities/gemini.json +196 -0
- package/docs/hooks/capabilities/grok.json +192 -0
- package/docs/hooks/capabilities/opencode.json +184 -0
- package/docs/project-configuration.md +844 -4
- package/docs/terminal-harness.md +71 -28
- package/docs/terminal-workspace.md +91 -170
- package/gemini-extension.json +1 -1
- package/package.json +13 -1
- package/plugin.json +1 -1
- package/plugins/pmcp/.claude-plugin/plugin.json +4 -2
- package/plugins/pmcp/gemini-extension.json +1 -1
- package/plugins/pmcp/mod/commands.ts +72 -0
- package/plugins/pmcp/mod/contract.d.ts +39 -0
- package/plugins/pmcp/mod/draw.tsx +216 -0
- package/plugins/pmcp/mod/guard.ts +42 -0
- package/plugins/pmcp/mod/hooks.json +4 -0
- package/plugins/pmcp/mod/host.ts +46 -0
- package/plugins/pmcp/mod/model.ts +144 -0
- package/plugins/pmcp/mod/reader/index.ts +18 -0
- package/plugins/pmcp/mod/reader/read.ts +76 -0
- package/plugins/pmcp/mod/reader/settings.ts +54 -0
- package/plugins/pmcp/mod/reader/types.ts +38 -0
- package/plugins/pmcp/mod/register.tsx +73 -0
- package/plugins/pmcp/mod/sessions/format.ts +91 -0
- package/plugins/pmcp/mod/sessions/types.ts +162 -0
- package/plugins/pmcp/mod/snapshot.ts +75 -0
- package/plugins/pmcp/mod/spinner.tsx +30 -0
- package/plugins/pmcp/mod/state.ts +28 -0
- package/plugins/pmcp/plugin.json +1 -1
- package/plugins/pmcp/skills/agent-assets-migrate/SKILL.md +96 -0
- package/plugins/pmcp/skills/headless-agents-ci-scaffold/SKILL.md +100 -0
- package/plugins/pmcp/skills/marketplace-plugin-scaffold/SKILL.md +87 -0
- package/plugins/pmcp/skills/package-skill-catalog/SKILL.md +51 -11
- package/plugins/pmcp/skills/pmcp-project-init/SKILL.md +145 -0
- package/plugins/pmcp/skills/pmcp-sessions-and-git/SKILL.md +104 -0
- package/plugins/pmcp/skills/skill-package-scaffold/SKILL.md +88 -0
- package/schema/catalog-v1.json +158 -0
- package/schema/library.json +164 -0
- package/schema/marketplace-manifest.json +130 -0
- package/schema/plugin-manifest.json +55 -0
- package/schema/skill-frontmatter.json +144 -0
- package/schema/skill-metadata-core.json +110 -0
- package/skills/agent-assets-migrate/SKILL.md +96 -0
- package/skills/headless-agents-ci-scaffold/SKILL.md +100 -0
- package/skills/marketplace-plugin-scaffold/SKILL.md +87 -0
- package/skills/package-skill-catalog/SKILL.md +51 -11
- package/skills/pmcp-project-init/SKILL.md +145 -0
- package/skills/pmcp-sessions-and-git/SKILL.md +104 -0
- package/skills/skill-package-scaffold/SKILL.md +88 -0
- package/dist/config-BkSpjUG6.d.ts +0 -50
- package/dist/embed-DRROSD3F.d.ts +0 -53
- package/dist/hook-spec-PRSnYGLV.d.ts +0 -10
- package/dist/server-VWSY3Shw.d.ts +0 -543
- package/dist/tui-worker.js +0 -6549
- /package/dist/{tui-worker.d.ts → hook.d.ts} +0 -0
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import {
|
|
2
|
+
id,
|
|
3
|
+
integer,
|
|
4
|
+
object,
|
|
5
|
+
strings,
|
|
6
|
+
text
|
|
7
|
+
} from "./chunk-5OMOPUE6.js";
|
|
8
|
+
import {
|
|
9
|
+
runtimeExecutables
|
|
10
|
+
} from "./chunk-BU65MNVU.js";
|
|
11
|
+
|
|
12
|
+
// src/harness/groups/store.ts
|
|
13
|
+
import { randomUUID } from "crypto";
|
|
14
|
+
import {
|
|
15
|
+
closeSync,
|
|
16
|
+
constants,
|
|
17
|
+
fstatSync,
|
|
18
|
+
fsyncSync,
|
|
19
|
+
openSync,
|
|
20
|
+
readFileSync,
|
|
21
|
+
realpathSync,
|
|
22
|
+
renameSync,
|
|
23
|
+
writeFileSync
|
|
24
|
+
} from "fs";
|
|
25
|
+
import { dirname, join } from "path";
|
|
26
|
+
|
|
27
|
+
// src/harness/runtimes/docker-policy.ts
|
|
28
|
+
import { isAbsolute as isAbsolute3, posix as posix3 } from "path";
|
|
29
|
+
|
|
30
|
+
// src/harness/runtimes/egress-policy.ts
|
|
31
|
+
import { isAbsolute, posix } from "path";
|
|
32
|
+
function egressPolicy(value) {
|
|
33
|
+
const policy = object(value);
|
|
34
|
+
const hosts = strings(policy.hosts, "egress_hosts").map(
|
|
35
|
+
(host) => host.toLowerCase()
|
|
36
|
+
);
|
|
37
|
+
if (hosts.length > 16 || new Set(hosts).size !== hosts.length)
|
|
38
|
+
throw new Error("invalid_egress_hosts");
|
|
39
|
+
for (const host of hosts) {
|
|
40
|
+
if (host.length > 253 || !host.includes(".") || /^[0-9.]+$/.test(host) || !host.split(".").every(
|
|
41
|
+
(label) => /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/.test(label)
|
|
42
|
+
) || /\.(local|localhost|internal|invalid|test)$/.test(host))
|
|
43
|
+
throw new Error("invalid_egress_host");
|
|
44
|
+
}
|
|
45
|
+
if (policy.bridgeExecutable === void 0) return { hosts };
|
|
46
|
+
const executable = text(policy.bridgeExecutable, "egress_bridge_executable");
|
|
47
|
+
if (!isAbsolute(executable) || posix.normalize(executable) !== executable || /[\r\n\x1b]/.test(executable))
|
|
48
|
+
throw new Error("invalid_egress_bridge_executable");
|
|
49
|
+
return { hosts, bridgeExecutable: executable };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// src/harness/runtimes/private-profiles.ts
|
|
53
|
+
import { isAbsolute as isAbsolute2, posix as posix2 } from "path";
|
|
54
|
+
function profileName(value) {
|
|
55
|
+
const name = text(value, "private_profile");
|
|
56
|
+
if (!/^[a-z][a-z0-9-]{0,31}$/.test(name))
|
|
57
|
+
throw new Error("invalid_private_profile_name");
|
|
58
|
+
return name;
|
|
59
|
+
}
|
|
60
|
+
function privateProfiles(value) {
|
|
61
|
+
const entries = Object.entries(object(value));
|
|
62
|
+
if (!entries.length || entries.length > 16)
|
|
63
|
+
throw new Error("invalid_private_profile_grants");
|
|
64
|
+
const result = {};
|
|
65
|
+
for (const [name, entry] of entries) {
|
|
66
|
+
profileName(name);
|
|
67
|
+
const grant = object(entry);
|
|
68
|
+
const runtime = text(grant.runtime, "private_profile_runtime");
|
|
69
|
+
const directory = absolute(grant.directory, "private_profile_directory");
|
|
70
|
+
const lockExecutable = absolute(
|
|
71
|
+
grant.lockExecutable,
|
|
72
|
+
"private_profile_lock_executable"
|
|
73
|
+
);
|
|
74
|
+
const identity = grant.identity === void 0 ? void 0 : text(grant.identity, "private_profile_identity");
|
|
75
|
+
if (identity !== void 0 && !/^\d+:\d+:\d+:\d+$/.test(identity))
|
|
76
|
+
throw new Error("invalid_private_profile_identity");
|
|
77
|
+
result[name] = {
|
|
78
|
+
runtime,
|
|
79
|
+
directory,
|
|
80
|
+
lockExecutable,
|
|
81
|
+
...identity ? { identity } : {}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
if (new Set(Object.values(result).map((grant) => grant.directory)).size !== entries.length)
|
|
85
|
+
throw new Error("duplicate_private_profile_directory");
|
|
86
|
+
return result;
|
|
87
|
+
}
|
|
88
|
+
function absolute(value, field) {
|
|
89
|
+
const path = text(value, field);
|
|
90
|
+
if (!isAbsolute2(path) || posix2.normalize(path) !== path || /[\r\n\x1b]/.test(path))
|
|
91
|
+
throw new Error("invalid_private_profile_path");
|
|
92
|
+
return path;
|
|
93
|
+
}
|
|
94
|
+
function selectedProfile(policy, name, runtime) {
|
|
95
|
+
if (name === void 0) return;
|
|
96
|
+
const grant = policy.privateProfiles?.[profileName(name)];
|
|
97
|
+
if (!grant || grant.runtime !== runtime || !grant.identity)
|
|
98
|
+
throw new Error("private_profile_not_granted");
|
|
99
|
+
return grant;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// src/harness/runtimes/docker-policy.ts
|
|
103
|
+
function dockerPolicy(value) {
|
|
104
|
+
const policy = object(value);
|
|
105
|
+
if (policy.schemaVersion !== 1)
|
|
106
|
+
throw new Error("invalid_docker_policy_version");
|
|
107
|
+
if (!/^sha256:[a-f0-9]{64}$/.test(text(policy.image, "docker_image")))
|
|
108
|
+
throw new Error("docker_image_requires_digest");
|
|
109
|
+
if (policy.network !== "none")
|
|
110
|
+
throw new Error("docker_network_not_qualified");
|
|
111
|
+
if (policy.workspaceAccess !== "read-only" && policy.workspaceAccess !== "read-write")
|
|
112
|
+
throw new Error("invalid_docker_workspace_access");
|
|
113
|
+
const commands = object(policy.commands);
|
|
114
|
+
const entries = Object.entries(commands);
|
|
115
|
+
if (!entries.length || entries.length > 5)
|
|
116
|
+
throw new Error("invalid_docker_runtime_commands");
|
|
117
|
+
const parsed = {};
|
|
118
|
+
for (const [runtime, value2] of entries) {
|
|
119
|
+
if (!Object.hasOwn(runtimeExecutables, runtime))
|
|
120
|
+
throw new Error("unsupported_docker_runtime");
|
|
121
|
+
const command = strings(value2, "docker_runtime_command");
|
|
122
|
+
const executable = command[0];
|
|
123
|
+
if (!isAbsolute3(executable) || posix3.normalize(executable) !== executable || command.some((argument) => /[\r\n\x1b]/.test(argument)))
|
|
124
|
+
throw new Error("invalid_docker_runtime_command");
|
|
125
|
+
parsed[runtime] = command;
|
|
126
|
+
}
|
|
127
|
+
return {
|
|
128
|
+
schemaVersion: 1,
|
|
129
|
+
image: text(policy.image, "docker_image"),
|
|
130
|
+
network: "none",
|
|
131
|
+
workspaceAccess: policy.workspaceAccess,
|
|
132
|
+
commands: parsed,
|
|
133
|
+
...policy.egress === void 0 ? {} : { egress: egressPolicy(policy.egress) },
|
|
134
|
+
...policy.privateProfiles === void 0 ? {} : { privateProfiles: privateProfiles(policy.privateProfiles) }
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// src/harness/groups/validation.ts
|
|
139
|
+
function member(value, allowed) {
|
|
140
|
+
if (!allowed.includes(value)) throw new Error("invalid_state_value");
|
|
141
|
+
}
|
|
142
|
+
function records(value) {
|
|
143
|
+
if (!Array.isArray(value) || value.length > 4096)
|
|
144
|
+
throw new Error("invalid_state_collection");
|
|
145
|
+
return value.map(object);
|
|
146
|
+
}
|
|
147
|
+
function unique(values) {
|
|
148
|
+
if (new Set(values).size !== values.length)
|
|
149
|
+
throw new Error("duplicate_state_identity");
|
|
150
|
+
}
|
|
151
|
+
function validateState(value) {
|
|
152
|
+
const state = object(value);
|
|
153
|
+
const group = object(state.group);
|
|
154
|
+
member(group.schemaVersion, [1]);
|
|
155
|
+
for (const field of ["owner", "id", "generation"]) id(group[field], field);
|
|
156
|
+
text(group.projectRoot, "project_root");
|
|
157
|
+
strings(group.allowedRuntimes, "allowed_runtimes");
|
|
158
|
+
member(group.profile, ["native", "docker"]);
|
|
159
|
+
if (group.profile === "docker") dockerPolicy(group.dockerPolicy);
|
|
160
|
+
if (group.profile === "native" && group.dockerPolicy !== void 0)
|
|
161
|
+
throw new Error("docker_policy_requires_docker_profile");
|
|
162
|
+
member(group.state, ["ready", "paused", "stopped"]);
|
|
163
|
+
integer(group.memoryMb, "memory_budget", 128, 4096);
|
|
164
|
+
integer(group.maxActive, "max_active", 1, 5);
|
|
165
|
+
const sessions = records(group.sessions);
|
|
166
|
+
for (const session of sessions) {
|
|
167
|
+
id(session.id, "session_id");
|
|
168
|
+
member(session.role, ["main", "worker"]);
|
|
169
|
+
member(session.stopped, [true, false]);
|
|
170
|
+
}
|
|
171
|
+
unique(sessions.map((session) => session.id));
|
|
172
|
+
if (sessions.filter((s) => s.role === "main" && !s.stopped).length > 1)
|
|
173
|
+
throw new Error("multiple_active_main_sessions");
|
|
174
|
+
const leases = records(state.leases);
|
|
175
|
+
for (const lease of leases) {
|
|
176
|
+
id(lease.token, "control_token");
|
|
177
|
+
id(lease.controller, "controller");
|
|
178
|
+
member(lease.generation, [group.generation]);
|
|
179
|
+
member(lease.mode, ["cli", "native"]);
|
|
180
|
+
member(
|
|
181
|
+
lease.sessionId,
|
|
182
|
+
sessions.map((session) => session.id)
|
|
183
|
+
);
|
|
184
|
+
if (!Number.isFinite(Date.parse(text(lease.expiresAt, "control_expiry"))))
|
|
185
|
+
throw new Error("invalid_control_expiry");
|
|
186
|
+
}
|
|
187
|
+
unique(leases.map((lease) => lease.token));
|
|
188
|
+
unique(leases.map((lease) => lease.sessionId));
|
|
189
|
+
const deliveries = records(state.deliveries);
|
|
190
|
+
for (const delivery of deliveries) {
|
|
191
|
+
if (delivery.controller !== void 0)
|
|
192
|
+
id(delivery.controller, "controller");
|
|
193
|
+
id(delivery.requestId, "request_id");
|
|
194
|
+
id(delivery.sessionId, "session_id");
|
|
195
|
+
id(delivery.generation, "generation");
|
|
196
|
+
member(delivery.operation, ["write", "submit"]);
|
|
197
|
+
member(delivery.state, ["intent", "input_written", "delivery_uncertain"]);
|
|
198
|
+
if (!/^[a-f0-9]{64}$/.test(text(delivery.digest, "delivery_digest")))
|
|
199
|
+
throw new Error("invalid_delivery_digest");
|
|
200
|
+
}
|
|
201
|
+
unique(deliveries.map((delivery) => delivery.requestId));
|
|
202
|
+
return state;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// src/harness/groups/store.ts
|
|
206
|
+
function privateJson(path, value) {
|
|
207
|
+
const temporary = `${path}.${randomUUID()}.new`;
|
|
208
|
+
const descriptor = openSync(temporary, "wx", 384);
|
|
209
|
+
try {
|
|
210
|
+
writeFileSync(descriptor, `${JSON.stringify(value, null, 2)}
|
|
211
|
+
`);
|
|
212
|
+
fsyncSync(descriptor);
|
|
213
|
+
} finally {
|
|
214
|
+
closeSync(descriptor);
|
|
215
|
+
}
|
|
216
|
+
renameSync(temporary, path);
|
|
217
|
+
const directory = openSync(dirname(path), "r");
|
|
218
|
+
try {
|
|
219
|
+
fsyncSync(directory);
|
|
220
|
+
} finally {
|
|
221
|
+
closeSync(directory);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
function readPrivateJson(path) {
|
|
225
|
+
const descriptor = openSync(path, constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
226
|
+
try {
|
|
227
|
+
const stat = fstatSync(descriptor);
|
|
228
|
+
if (!stat.isFile() || (stat.mode & 63) !== 0 || stat.size > 2097152)
|
|
229
|
+
throw new Error("unsafe_state_file");
|
|
230
|
+
if (stat.uid !== process.getuid?.()) throw new Error("foreign_state_file");
|
|
231
|
+
return JSON.parse(readFileSync(descriptor, "utf8"));
|
|
232
|
+
} finally {
|
|
233
|
+
closeSync(descriptor);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
var GroupStore = class {
|
|
237
|
+
path;
|
|
238
|
+
state;
|
|
239
|
+
constructor(path) {
|
|
240
|
+
this.path = realpathSync(path);
|
|
241
|
+
this.state = validateState(readPrivateJson(path));
|
|
242
|
+
const metadata = object(
|
|
243
|
+
readPrivateJson(join(dirname(this.path), "harness.json"))
|
|
244
|
+
);
|
|
245
|
+
if (this.state.group.schemaVersion !== 1 || this.state.group.owner !== metadata.owner) {
|
|
246
|
+
throw new Error("foreign_group");
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
save() {
|
|
250
|
+
validateState(this.state);
|
|
251
|
+
privateJson(this.path, this.state);
|
|
252
|
+
}
|
|
253
|
+
session(id2) {
|
|
254
|
+
if (!this.state.group.sessions.some((entry) => entry.id === id2)) {
|
|
255
|
+
throw new Error("foreign_session");
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
export {
|
|
261
|
+
egressPolicy,
|
|
262
|
+
profileName,
|
|
263
|
+
selectedProfile,
|
|
264
|
+
dockerPolicy,
|
|
265
|
+
privateJson,
|
|
266
|
+
readPrivateJson,
|
|
267
|
+
GroupStore
|
|
268
|
+
};
|
|
269
|
+
//# sourceMappingURL=chunk-TVL5RTE6.js.map
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import {
|
|
2
|
+
marketplaceSpec
|
|
3
|
+
} from "./chunk-2P4Z2NUX.js";
|
|
4
|
+
import {
|
|
5
|
+
harnessSpec,
|
|
6
|
+
tuiSpec
|
|
7
|
+
} from "./chunk-3Y3HDMHA.js";
|
|
8
|
+
import {
|
|
9
|
+
mcpSpec
|
|
10
|
+
} from "./chunk-E3DQB5LS.js";
|
|
11
|
+
import {
|
|
12
|
+
mailboxSpec
|
|
13
|
+
} from "./chunk-JWRZDYB5.js";
|
|
14
|
+
import {
|
|
15
|
+
logsSpec
|
|
16
|
+
} from "./chunk-YGOWIJPE.js";
|
|
17
|
+
import {
|
|
18
|
+
gitSpec
|
|
19
|
+
} from "./chunk-T6GOWHK6.js";
|
|
20
|
+
import {
|
|
21
|
+
sessionsSpec
|
|
22
|
+
} from "./chunk-BVCTKPT3.js";
|
|
23
|
+
import {
|
|
24
|
+
doctorSpec,
|
|
25
|
+
projectSpec
|
|
26
|
+
} from "./chunk-LLBPVZXM.js";
|
|
27
|
+
import {
|
|
28
|
+
serveSpec
|
|
29
|
+
} from "./chunk-LLT5FQBE.js";
|
|
30
|
+
import {
|
|
31
|
+
loginSpec,
|
|
32
|
+
logoutSpec,
|
|
33
|
+
whoamiSpec
|
|
34
|
+
} from "./chunk-EIDIVIAD.js";
|
|
35
|
+
import {
|
|
36
|
+
availableSpec,
|
|
37
|
+
installSpec,
|
|
38
|
+
previewSpec,
|
|
39
|
+
syncSpec
|
|
40
|
+
} from "./chunk-ABTJQ4QV.js";
|
|
41
|
+
import {
|
|
42
|
+
hooksSpec,
|
|
43
|
+
initSpec,
|
|
44
|
+
statusSpec
|
|
45
|
+
} from "./chunk-OG7QR2DP.js";
|
|
46
|
+
import {
|
|
47
|
+
indexSpec,
|
|
48
|
+
listSpec,
|
|
49
|
+
modelsSpec,
|
|
50
|
+
validateSpec
|
|
51
|
+
} from "./chunk-INT7QLEU.js";
|
|
52
|
+
|
|
53
|
+
// src/commands/specs/completion.ts
|
|
54
|
+
var completionSpec = {
|
|
55
|
+
name: "completion",
|
|
56
|
+
describe: "Print a shell completion script for bash, zsh or fish",
|
|
57
|
+
usage: "pmcp completion bash | zsh | fish"
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// src/commands/registry.ts
|
|
61
|
+
var COMMANDS = [
|
|
62
|
+
{
|
|
63
|
+
...statusSpec,
|
|
64
|
+
load: async () => (await import("./status-XQANBVXW.js")).statusCommand
|
|
65
|
+
},
|
|
66
|
+
{ ...initSpec, load: async () => (await import("./init-627KFXTG.js")).initCommand },
|
|
67
|
+
{ ...hooksSpec, load: async () => (await import("./hooks-FYE2L5RW.js")).hooksCommand },
|
|
68
|
+
{ ...serveSpec, load: async () => (await import("./serve-NBKT5BKY.js")).serveCommand },
|
|
69
|
+
{ ...listSpec, load: async () => (await import("./list-MCP2FXUF.js")).listCommand },
|
|
70
|
+
{
|
|
71
|
+
...indexSpec,
|
|
72
|
+
load: async () => (await import("./reindex-Y27QJFDB.js")).indexCommand
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
...modelsSpec,
|
|
76
|
+
load: async () => (await import("./models-ISU4DCMA.js")).modelsCommand
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
...loginSpec,
|
|
80
|
+
load: async () => (await import("./session-XM2CR425.js")).loginCommand
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
...logoutSpec,
|
|
84
|
+
load: async () => (await import("./session-XM2CR425.js")).logoutCommand
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
...whoamiSpec,
|
|
88
|
+
load: async () => (await import("./session-XM2CR425.js")).whoamiCommand
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
...availableSpec,
|
|
92
|
+
load: async () => (await import("./available-DBSIVVJ6.js")).availableCommand
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
...previewSpec,
|
|
96
|
+
load: async () => (await import("./preview-DT7DWG5F.js")).previewCommand
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
...installSpec,
|
|
100
|
+
load: async () => (await import("./install-GG7HHZK2.js")).installCommand
|
|
101
|
+
},
|
|
102
|
+
{ ...syncSpec, load: async () => (await import("./install-GG7HHZK2.js")).syncCommand },
|
|
103
|
+
{
|
|
104
|
+
...projectSpec,
|
|
105
|
+
load: async () => (await import("./project-FY62G55N.js")).projectCommand
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
...doctorSpec,
|
|
109
|
+
load: async () => (await import("./doctor-ZIOESU3N.js")).doctorCommand
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
...sessionsSpec,
|
|
113
|
+
load: async () => (await import("./cli-VYCQJZ5X.js")).sessionsCommand
|
|
114
|
+
},
|
|
115
|
+
{ ...logsSpec, load: async () => (await import("./logs-SPB6AANY.js")).logsCommand },
|
|
116
|
+
{ ...gitSpec, load: async () => (await import("./cli-ZTCBSDW4.js")).gitCommand },
|
|
117
|
+
{ ...mcpSpec, load: async () => (await import("./mcp-2DKVU3SW.js")).mcpCommand },
|
|
118
|
+
{
|
|
119
|
+
...validateSpec,
|
|
120
|
+
load: async () => (await import("./validate-5GZ5YWNA.js")).validateCommand
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
...mailboxSpec,
|
|
124
|
+
load: async () => (await import("./mailbox-GDJ7BWQN.js")).mailboxCommand
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
...harnessSpec,
|
|
128
|
+
load: async () => (await import("./harness-F2XFDYXF.js")).harnessCommand
|
|
129
|
+
},
|
|
130
|
+
{ ...tuiSpec, load: async () => (await import("./tui-MWKAXE4K.js")).tuiCommand },
|
|
131
|
+
{
|
|
132
|
+
...marketplaceSpec,
|
|
133
|
+
load: async () => (await import("./marketplace-G4VQET5W.js")).marketplaceCommand
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
...completionSpec,
|
|
137
|
+
load: async () => (await import("./completion-E7RRG3ZT.js")).completionCommand
|
|
138
|
+
}
|
|
139
|
+
];
|
|
140
|
+
var PLANNED = [];
|
|
141
|
+
function commandNamed(name) {
|
|
142
|
+
return COMMANDS.find((command) => command.name === name);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export {
|
|
146
|
+
completionSpec,
|
|
147
|
+
COMMANDS,
|
|
148
|
+
PLANNED,
|
|
149
|
+
commandNamed
|
|
150
|
+
};
|
|
151
|
+
//# sourceMappingURL=chunk-UOCLRM7P.js.map
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import {
|
|
2
|
+
McpAuthError,
|
|
3
|
+
safeEndpoint
|
|
4
|
+
} from "./chunk-Q5H3L6Y4.js";
|
|
5
|
+
|
|
6
|
+
// src/mcp-auth/_shared.ts
|
|
7
|
+
async function request(url, init = {}) {
|
|
8
|
+
safeEndpoint(url);
|
|
9
|
+
try {
|
|
10
|
+
return await fetch(url, {
|
|
11
|
+
...init,
|
|
12
|
+
redirect: "error",
|
|
13
|
+
signal: init.signal ?? AbortSignal.timeout(3e4)
|
|
14
|
+
});
|
|
15
|
+
} catch {
|
|
16
|
+
throw new McpAuthError(
|
|
17
|
+
"MCP endpoint request failed; remote details are redacted"
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
async function responseObject(response) {
|
|
22
|
+
try {
|
|
23
|
+
const text2 = await response.text();
|
|
24
|
+
if (text2.length > 1024 * 1024) throw new Error("size");
|
|
25
|
+
const value = JSON.parse(text2);
|
|
26
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
27
|
+
throw new Error("shape");
|
|
28
|
+
return value;
|
|
29
|
+
} catch {
|
|
30
|
+
throw new McpAuthError(
|
|
31
|
+
"MCP endpoint returned an invalid document; contents are redacted"
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// src/mcp-auth/store/files.ts
|
|
37
|
+
import {
|
|
38
|
+
chmodSync,
|
|
39
|
+
closeSync,
|
|
40
|
+
constants,
|
|
41
|
+
fstatSync,
|
|
42
|
+
lstatSync,
|
|
43
|
+
mkdirSync,
|
|
44
|
+
openSync,
|
|
45
|
+
readFileSync,
|
|
46
|
+
renameSync,
|
|
47
|
+
unlinkSync,
|
|
48
|
+
writeFileSync
|
|
49
|
+
} from "fs";
|
|
50
|
+
import { homedir } from "os";
|
|
51
|
+
import { join } from "path";
|
|
52
|
+
import { randomUUID } from "crypto";
|
|
53
|
+
|
|
54
|
+
// src/mcp-auth/store/schema.ts
|
|
55
|
+
import { z } from "zod";
|
|
56
|
+
var text = z.string().min(1);
|
|
57
|
+
var oauth = z.object({
|
|
58
|
+
issuer: text,
|
|
59
|
+
tokenEndpoint: text,
|
|
60
|
+
revocationEndpoint: text.optional(),
|
|
61
|
+
clientId: text,
|
|
62
|
+
clientSecret: text.optional()
|
|
63
|
+
});
|
|
64
|
+
var scopes = z.array(z.string());
|
|
65
|
+
var pendingLogin = z.object({
|
|
66
|
+
serverUrl: text,
|
|
67
|
+
state: text,
|
|
68
|
+
verifier: text,
|
|
69
|
+
redirectUri: text,
|
|
70
|
+
authorizationUrl: text,
|
|
71
|
+
expiresAt: z.number().finite(),
|
|
72
|
+
scopes,
|
|
73
|
+
oauth
|
|
74
|
+
});
|
|
75
|
+
var credentialRecord = z.object({
|
|
76
|
+
session: z.object({
|
|
77
|
+
serverUrl: text,
|
|
78
|
+
kind: z.enum(["oauth", "bearer"]),
|
|
79
|
+
accessToken: text,
|
|
80
|
+
refreshToken: text.optional(),
|
|
81
|
+
expiresAt: z.number().finite().optional(),
|
|
82
|
+
scopes,
|
|
83
|
+
oauth: oauth.optional()
|
|
84
|
+
}).optional(),
|
|
85
|
+
pending: pendingLogin.optional(),
|
|
86
|
+
pendingLogins: z.array(pendingLogin).max(8).optional()
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// src/mcp-auth/store/files.ts
|
|
90
|
+
function credentialDirectory(env = process.env) {
|
|
91
|
+
return join(
|
|
92
|
+
env.XDG_STATE_HOME || join(homedir(), ".local", "state"),
|
|
93
|
+
"pmcp",
|
|
94
|
+
"credentials"
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
function credentialPath(name, env = process.env) {
|
|
98
|
+
if (!/^[a-z0-9][a-z0-9-]*$/.test(name))
|
|
99
|
+
throw new McpAuthError("Invalid MCP server name");
|
|
100
|
+
return join(credentialDirectory(env), `${name}.json`);
|
|
101
|
+
}
|
|
102
|
+
function privateDirectory(env) {
|
|
103
|
+
const dir = credentialDirectory(env);
|
|
104
|
+
mkdirSync(dir, { recursive: true, mode: 448 });
|
|
105
|
+
if (lstatSync(dir).isSymbolicLink())
|
|
106
|
+
throw new McpAuthError("Credential directory must not be a symbolic link");
|
|
107
|
+
chmodSync(dir, 448);
|
|
108
|
+
}
|
|
109
|
+
function readCredentials(name, env = process.env) {
|
|
110
|
+
let fd;
|
|
111
|
+
try {
|
|
112
|
+
fd = openSync(
|
|
113
|
+
credentialPath(name, env),
|
|
114
|
+
constants.O_RDONLY | constants.O_NOFOLLOW
|
|
115
|
+
);
|
|
116
|
+
} catch (error) {
|
|
117
|
+
if (error.code === "ENOENT") return {};
|
|
118
|
+
throw new McpAuthError("Cannot read private MCP credentials");
|
|
119
|
+
}
|
|
120
|
+
try {
|
|
121
|
+
const stat = fstatSync(fd);
|
|
122
|
+
if (!stat.isFile() || (stat.mode & 63) !== 0 || stat.size > 128 * 1024)
|
|
123
|
+
throw new Error("permissions");
|
|
124
|
+
return credentialRecord.parse(JSON.parse(readFileSync(fd, "utf8")));
|
|
125
|
+
} catch {
|
|
126
|
+
throw new McpAuthError(
|
|
127
|
+
"Invalid MCP credential file or permissions; contents are redacted"
|
|
128
|
+
);
|
|
129
|
+
} finally {
|
|
130
|
+
closeSync(fd);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
function writeCredentials(name, record, env = process.env) {
|
|
134
|
+
privateDirectory(env);
|
|
135
|
+
const path = credentialPath(name, env);
|
|
136
|
+
const temporary = `${path}.${randomUUID()}.tmp`;
|
|
137
|
+
try {
|
|
138
|
+
writeFileSync(temporary, JSON.stringify(record) + "\n", {
|
|
139
|
+
mode: 384,
|
|
140
|
+
flag: "wx"
|
|
141
|
+
});
|
|
142
|
+
renameSync(temporary, path);
|
|
143
|
+
} finally {
|
|
144
|
+
try {
|
|
145
|
+
unlinkSync(temporary);
|
|
146
|
+
} catch (error) {
|
|
147
|
+
if (error.code !== "ENOENT") throw error;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
function clearCredentials(name, env = process.env) {
|
|
152
|
+
try {
|
|
153
|
+
unlinkSync(credentialPath(name, env));
|
|
154
|
+
} catch (error) {
|
|
155
|
+
if (error.code !== "ENOENT")
|
|
156
|
+
throw new McpAuthError("Cannot remove MCP credential file");
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// src/mcp-auth/status.ts
|
|
161
|
+
function boundSession(name, serverUrl, env) {
|
|
162
|
+
const session = readCredentials(name, env).session;
|
|
163
|
+
if (session && session.serverUrl !== serverUrl)
|
|
164
|
+
throw new McpAuthError(
|
|
165
|
+
"MCP credentials belong to another server URL; log in for the declared URL"
|
|
166
|
+
);
|
|
167
|
+
return session;
|
|
168
|
+
}
|
|
169
|
+
function status(name, serverUrl, env = process.env) {
|
|
170
|
+
const session = boundSession(name, serverUrl, env);
|
|
171
|
+
return {
|
|
172
|
+
present: Boolean(session),
|
|
173
|
+
expiresAt: session?.expiresAt === void 0 ? null : new Date(session.expiresAt).toISOString(),
|
|
174
|
+
scopes: session?.scopes ?? []
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export {
|
|
179
|
+
request,
|
|
180
|
+
responseObject,
|
|
181
|
+
credentialPath,
|
|
182
|
+
privateDirectory,
|
|
183
|
+
readCredentials,
|
|
184
|
+
writeCredentials,
|
|
185
|
+
clearCredentials,
|
|
186
|
+
boundSession,
|
|
187
|
+
status
|
|
188
|
+
};
|
|
189
|
+
//# sourceMappingURL=chunk-UPQTAHUK.js.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// src/sessions/hook-freshness.ts
|
|
2
|
+
import { createHash } from "crypto";
|
|
3
|
+
import { existsSync, readFileSync, statSync } from "fs";
|
|
4
|
+
import { join } from "path";
|
|
5
|
+
function currentHooks(root) {
|
|
6
|
+
const policy = join(root, ".agents/pmcp-hooks/policy.json");
|
|
7
|
+
const codex = join(root, ".codex/hooks.json");
|
|
8
|
+
return {
|
|
9
|
+
policySha256: existsSync(policy) ? createHash("sha256").update(readFileSync(policy, "utf8")).digest("hex") : null,
|
|
10
|
+
codexHooksChanged: existsSync(codex) ? statSync(codex).mtimeMs : null
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
var nameOf = (record) => record.alias || record.session.slice(0, 8);
|
|
14
|
+
function restartNotes(records, current) {
|
|
15
|
+
const notes = [];
|
|
16
|
+
for (const record of records.filter((entry) => entry.live)) {
|
|
17
|
+
const started = Date.parse(record.startedAt ?? "") || 0;
|
|
18
|
+
const codexStale = record.runtime === "codex" && current.codexHooksChanged !== null && started < current.codexHooksChanged;
|
|
19
|
+
if (codexStale) {
|
|
20
|
+
notes.push(
|
|
21
|
+
`${nameOf(record)} (codex) started before .codex/hooks.json changed; Codex loads hooks only at start, so restart it`
|
|
22
|
+
);
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
const policy = record["startPolicy"];
|
|
26
|
+
if (current.policySha256 && policy !== current.policySha256)
|
|
27
|
+
notes.push(
|
|
28
|
+
`${nameOf(record)}${record.runtime ? ` (${record.runtime})` : ""} started under ${typeof policy === "string" ? "an older" : "an untracked"} pmcp policy; restart it if it should get new hook events`
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
return notes;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export {
|
|
35
|
+
currentHooks,
|
|
36
|
+
restartNotes
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=chunk-VJFEN6DJ.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
claudeSocket
|
|
3
|
+
} from "./chunk-XP2U3LO3.js";
|
|
4
|
+
import {
|
|
5
|
+
opencodeUrl
|
|
6
|
+
} from "./chunk-TIA4SPU2.js";
|
|
7
|
+
import {
|
|
8
|
+
ptyReachable,
|
|
9
|
+
ptyRef
|
|
10
|
+
} from "./chunk-3PW4FI7U.js";
|
|
11
|
+
|
|
12
|
+
// src/sessions/wake/probe.ts
|
|
13
|
+
function wakeableBy(record, context) {
|
|
14
|
+
if (ptyRef(record)) return ptyReachable(record) ? "pmcp-pty" : null;
|
|
15
|
+
if (record.runtime === "opencode")
|
|
16
|
+
return opencodeUrl(record) ? "opencode-server" : null;
|
|
17
|
+
if (record.runtime === "claude")
|
|
18
|
+
return claudeSocket(record.session, context.home) ? "claude-inbox" : null;
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export {
|
|
23
|
+
wakeableBy
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=chunk-WIW772I3.js.map
|