peertable 0.8.0 → 0.8.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "peertable",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "A round table of peer agents. No orchestrator at the head. Turn Claude Code, Codex, and Grok sessions into a team of equal, long-lived peers.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/room/client.mjs CHANGED
@@ -13,7 +13,7 @@ import { findModelsDoc, resolveSeatIdentity } from '../skill/scripts/resolve-sea
13
13
 
14
14
  // client.mjs 側のハードコード版数。package.json の version と一致していることを
15
15
  // diagnostics の version_consistency が見る(2 つの版数源の drift 検出。決定45)
16
- const MCP_VERSION = '0.8.0'
16
+ const MCP_VERSION = '0.8.2'
17
17
  const PKG_ROOT = join(dirname(fileURLToPath(import.meta.url)), '..')
18
18
 
19
19
  const USAGE = `usage:
@@ -0,0 +1,28 @@
1
+ import { execFileSync } from 'node:child_process'
2
+
3
+ export function parseWindowsCreationDate(value) {
4
+ if (value instanceof Date) {
5
+ if (Number.isNaN(value.getTime())) throw new Error('pid の CreationDate を解釈できない')
6
+ return value.toISOString()
7
+ }
8
+ if (typeof value === 'number' && Number.isFinite(value)) return new Date(value).toISOString()
9
+ const text = String(value ?? '').trim()
10
+ const microsoft = /^\/Date\((-?\d+)(?:[+-]\d+)?\)\/$/u.exec(text)
11
+ if (microsoft) return new Date(Number(microsoft[1])).toISOString()
12
+ const normalized = text.replace(/(\.\d{3})\d+(?=[+-]\d{2}:\d{2}$)/u, '$1')
13
+ const parsed = new Date(normalized)
14
+ if (Number.isNaN(parsed.getTime())) throw new Error(`pid の CreationDate を解釈できない: ${text}`)
15
+ return parsed.toISOString()
16
+ }
17
+
18
+ export function observeWindowsPidCommand(pid, hashArgv) {
19
+ const filter = `ProcessId=${pid}`
20
+ const script = `Get-CimInstance Win32_Process -Filter ${JSON.stringify(filter)} | Select-Object ProcessId,CreationDate,CommandLine | ConvertTo-Json -Compress`
21
+ const output = execFileSync('powershell.exe', ['-NoProfile', '-Command', script], { encoding: 'utf8' }).trim()
22
+ if (!output) throw new Error('pid のWin32_Processを観測できない')
23
+ const row = JSON.parse(output)
24
+ const started = parseWindowsCreationDate(row.CreationDate)
25
+ const argv = String(row.CommandLine || '').trim()
26
+ if (!started || !argv) throw new Error('pid のCreationDate/CommandLineを観測できない')
27
+ return { pid: Number(row.ProcessId), started_identity: started, argv, argv_digest: hashArgv(argv) }
28
+ }
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env node
2
+ import { writeFileSync } from 'node:fs'
3
+
4
+ const [
5
+ output, room, serverUrl, publicUrl, mode, planKey, phasesJson,
6
+ addedExclude, latticePreexisting, runtimePreexisting, addedRuntimeExclude,
7
+ addedRootMcp, addedMcpExclude, externalPane, projectJsonPreexisting,
8
+ workOrderAdapter, workOrderSpoolRef, latticeCli,
9
+ ] = process.argv.slice(2)
10
+
11
+ const bool = (value) => value === 'true'
12
+ const state = {
13
+ room,
14
+ server_url: serverUrl,
15
+ public_url: publicUrl,
16
+ mode,
17
+ plan_key: planKey,
18
+ phases: JSON.parse(phasesJson),
19
+ added_exclude: bool(addedExclude),
20
+ lattice_preexisting: bool(latticePreexisting),
21
+ runtime_preexisting: bool(runtimePreexisting),
22
+ added_runtime_exclude: bool(addedRuntimeExclude),
23
+ added_root_mcp: bool(addedRootMcp),
24
+ added_mcp_exclude: bool(addedMcpExclude),
25
+ external_pane: bool(externalPane),
26
+ project_json_preexisting: bool(projectJsonPreexisting),
27
+ work_order_adapter: bool(workOrderAdapter),
28
+ work_order_spool_ref: workOrderSpoolRef,
29
+ lattice_cli: latticeCli,
30
+ }
31
+ writeFileSync(output, `${JSON.stringify(state)}\n`, 'utf8')
@@ -9,6 +9,7 @@ import { createHash } from 'node:crypto'
9
9
  import { execFileSync } from 'node:child_process'
10
10
  import { resolve } from 'node:path'
11
11
  import { fileURLToPath } from 'node:url'
12
+ import { observeWindowsPidCommand, parseWindowsCreationDate } from './platform/windows/observe-pid-command.mjs'
12
13
 
13
14
  export function hashArgv(argv) {
14
15
  return createHash('sha256').update(String(argv), 'utf8').digest('hex')
@@ -22,6 +23,7 @@ export function observePidCommand(pid) {
22
23
  error.code = 'SEAT_IDENTITY_NO_PID'
23
24
  throw error
24
25
  }
26
+ if (process.platform === 'win32') return observeWindowsPidCommand(pid, hashArgv)
25
27
  const started = execFileSync('/bin/ps', ['-o', 'lstart=', '-p', String(pid)], { encoding: 'utf8', env: psEnv() }).trim()
26
28
  const argv = execFileSync('/bin/ps', ['-o', 'command=', '-p', String(pid)], { encoding: 'utf8', env: psEnv() }).trim()
27
29
  if (!started || !argv) {
@@ -34,23 +36,7 @@ export function observePidCommand(pid) {
34
36
 
35
37
  const AGENT = /(?:claude|codex|grok|composer)(?:\.cmd|\.exe)?(?:\s|$)/iu
36
38
 
37
- export function parseWinCreationDate(value) {
38
- if (value instanceof Date) {
39
- if (Number.isNaN(value.getTime())) throw new Error('pid の CreationDate を解釈できない')
40
- return value.toISOString()
41
- }
42
- if (typeof value === 'number' && Number.isFinite(value)) {
43
- const parsed = new Date(value)
44
- if (Number.isNaN(parsed.getTime())) throw new Error('pid の CreationDate を解釈できない')
45
- return parsed.toISOString()
46
- }
47
- const text = String(value ?? '').trim()
48
- const microsoft = /^\/Date\((-?\d+)(?:[+-]\d+)?\)\/$/u.exec(text)
49
- if (microsoft) return new Date(Number(microsoft[1])).toISOString()
50
- const parsed = new Date(text)
51
- if (Number.isNaN(parsed.getTime())) throw new Error(`pid の CreationDate を解釈できない: ${text}`)
52
- return parsed.toISOString()
53
- }
39
+ export const parseWinCreationDate = parseWindowsCreationDate
54
40
 
55
41
  // ps の lstart 書式(LC_TIME)と非ASCII argv のエスケープ(LC_CTYPE)は locale で変わり、
56
42
  // 観測者ごとに digest が割れる(2026-08-22 実測)。Lattice 側の観測も LC_ALL=C に固定している。
@@ -192,8 +192,16 @@ fi
192
192
  # **解決した CLI の実 path を残す。** 残さないと、席も teardown も PATH の `lattice` へ逸れる。
193
193
  # release 前の source tree を実測する卓では、それは**pull 系 command を持たない古い install**で、
194
194
  # 手順どおり打っても届かない(suzune の監査で実測・room [1037])。
195
- printf '{"room":"%s","server_url":"%s","public_url":"%s","mode":"%s","plan_key":"%s","phases":%s,"added_exclude":%s,"lattice_preexisting":%s,"runtime_preexisting":%s,"added_runtime_exclude":%s,"added_root_mcp":%s,"added_mcp_exclude":%s,"external_pane":%s,"project_json_preexisting":%s,"work_order_adapter":%s,"work_order_spool_ref":"%s","lattice_cli":"%s"}\n' \
196
- "$room" "$url" "$public_url" "$mode" "$plan" "$phases_json" "$added_exclude" "$lattice_preexisting" "$runtime_preexisting" "$added_runtime_exclude" "$added_root_mcp" "$added_mcp_exclude" "$external_pane" "$project_json_preexisting" "$work_order_adapter" "$work_order_spool_ref" "$lattice_cli" > "$tdir/setup-state.json"
195
+ if [ "$(node -p 'process.platform')" = win32 ]; then
196
+ node "$repo/skill/scripts/platform/windows/write-setup-state.mjs" "$tdir/setup-state.json" \
197
+ "$room" "$url" "$public_url" "$mode" "$plan" "$phases_json" "$added_exclude" \
198
+ "$lattice_preexisting" "$runtime_preexisting" "$added_runtime_exclude" "$added_root_mcp" \
199
+ "$added_mcp_exclude" "$external_pane" "$project_json_preexisting" "$work_order_adapter" \
200
+ "$work_order_spool_ref" "$lattice_cli"
201
+ else
202
+ printf '{"room":"%s","server_url":"%s","public_url":"%s","mode":"%s","plan_key":"%s","phases":%s,"added_exclude":%s,"lattice_preexisting":%s,"runtime_preexisting":%s,"added_runtime_exclude":%s,"added_root_mcp":%s,"added_mcp_exclude":%s,"external_pane":%s,"project_json_preexisting":%s,"work_order_adapter":%s,"work_order_spool_ref":"%s","lattice_cli":"%s"}\n' \
203
+ "$room" "$url" "$public_url" "$mode" "$plan" "$phases_json" "$added_exclude" "$lattice_preexisting" "$runtime_preexisting" "$added_runtime_exclude" "$added_root_mcp" "$added_mcp_exclude" "$external_pane" "$project_json_preexisting" "$work_order_adapter" "$work_order_spool_ref" "$lattice_cli" > "$tdir/setup-state.json"
204
+ fi
197
205
 
198
206
  # 稼働状態ブリッジを起こす。**teardown が止めるのと対称にする**——「起こすかは卓の任意」だった間、
199
207
  # 手で `nohup` する経路が2つの失敗を招いた: 起こし忘れと、**トークンを持たないシェルで起こす**