@muwi/core 0.7.0 → 0.8.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/README.md +8 -7
- package/bin/muwi +1 -1
- package/hooks/instructions.md +1 -1
- package/hooks/tool.sh +2 -2
- package/package.json +5 -2
- package/skills/muwi/SKILL.md +12 -10
- package/src/board.js +46 -0
- package/src/cli.js +78 -69
- package/src/connectors/claude.js +7 -10
- package/src/connectors/files.js +1 -1
- package/src/connectors/settings-hooks.js +6 -1
- package/src/connectors/shaped.js +2 -4
- package/src/connectors/tools.js +2 -2
- package/src/connectors/types.js +1 -1
- package/src/delegate.js +330 -0
- package/src/events.js +55 -17
- package/src/find-node.sh +2 -2
- package/src/hook.js +4 -4
- package/src/kit.js +3 -9
- package/src/layout.js +171 -0
- package/src/live.js +92 -0
- package/src/plugins.js +148 -0
- package/src/resume.js +68 -0
- package/src/session.js +23 -15
- package/src/setup.js +56 -77
- package/src/store.js +10 -5
- package/src/update.js +138 -0
- package/src/view.js +17 -17
- package/hooks/hook.sh +0 -50
- package/src/host.js +0 -111
package/src/host.js
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
// 화면 규격: 세션들이 도는 곳(터미널 앱)과, 기록을 보여 주는 화면. 코어는 그것이 무엇인지 모른다.
|
|
2
|
-
// @muwi/herdr-app이 Herdr로 구현한다. 화면이 없으면 코어는 "모름"으로 돈다:
|
|
3
|
-
// 계획과 진행 기록, muwi show·status는 그대로 되고, 세션이 살아 있는지는 알 수 없어 적힌 그대로 보여 준다.
|
|
4
|
-
// 화면은 $MUWI_HOST(화면 모듈의 경로)나, muwi setup이 setup.json에 적어 둔 경로에서 불러온다.
|
|
5
|
-
import path from 'node:path';
|
|
6
|
-
import { pathToFileURL } from 'node:url';
|
|
7
|
-
import { readJson } from './store.js';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* 이 프로세스가 도는 자리 (터미널). key는 세션 id를 주지 않는 도구에서 세션 이름으로 쓴다.
|
|
11
|
-
* terminal: 그 자리의 주소 (세션 파일에 적어 두고, 화면이 그 세션의 상태를 볼 때와 그 자리로 갈 때 쓴다). pane: 화면 안의 칸
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
/** 세션들의 지금 상태. closed: 닫힌 세션과 그 세션을 마지막으로 본 시각(ms). status: 살아 있는 세션이 하는 일 (working, blocked, done, idle) */
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
/** 맡긴 노드를 하라고 띄운 자리 (muwi run). terminal: 그 자리의 주소 */
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
/** 화면이 muwi setup에서 넣은 것. setup.json에 적어 두고, 뺄 때 그대로 돌려준다 */
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
/** 화면이 없을 때: 자리도 세션 상태도 모른다 */
|
|
53
|
-
const NONE = {
|
|
54
|
-
name: '',
|
|
55
|
-
place: () => null,
|
|
56
|
-
sessionStarted: () => {},
|
|
57
|
-
assigned: () => null,
|
|
58
|
-
states: () => ({ closed: new Map(), status: new Map() }),
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
let current = NONE;
|
|
62
|
-
let currentPath = null;
|
|
63
|
-
let failed = null;
|
|
64
|
-
|
|
65
|
-
/** 적어 둔 화면을 불러오지 못한 까닭. from: 화면의 경로 (setup.json을 읽지 못했으면 그 파일) */
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
/** 지금 쓰는 화면. 없으면 아무것도 모르는 화면 */
|
|
69
|
-
export const host = () => current;
|
|
70
|
-
/** 지금 쓰는 화면을 불러온 경로 (muwi setup이 setup.json에 적어 둔다). 화면이 없거나 코드로 정했으면 null */
|
|
71
|
-
export const hostPath = () => currentPath;
|
|
72
|
-
/** 적어 둔 화면을 불러오지 못했으면 그 경로와 까닭. 화면을 적어 두지 않았거나 불러왔으면 null */
|
|
73
|
-
export const hostFailure = () => failed;
|
|
74
|
-
/** 화면을 정한다 (시험, 화면 패키지의 입구) */
|
|
75
|
-
export function setHost(h , from = null) {
|
|
76
|
-
current = h ?? NONE;
|
|
77
|
-
currentPath = h ? from : null;
|
|
78
|
-
failed = null;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* 화면을 불러온다: $MUWI_HOST, 없으면 muwi setup이 적어 둔 경로 (setup.json의 host).
|
|
83
|
-
* 불러오지 못하면 화면 없이 돌고, 까닭은 hostFailure()로 남긴다. 훅과 muwi setup이 이것 때문에 실패하면 안 된다
|
|
84
|
-
*/
|
|
85
|
-
export async function loadHost(dir , env = process.env) {
|
|
86
|
-
let spec = env.MUWI_HOST;
|
|
87
|
-
if (!spec) {
|
|
88
|
-
const file = path.join(dir, 'setup.json');
|
|
89
|
-
try {
|
|
90
|
-
spec = readJson (file)?.host;
|
|
91
|
-
} catch (e ) {
|
|
92
|
-
// setup.json이 깨졌다 (muwi setup을 다시 하면 새로 적는다)
|
|
93
|
-
failed = { from: file, reason: firstLine(e).replace(`: ${file}`, '') };
|
|
94
|
-
return current;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
if (!spec) return current;
|
|
98
|
-
const file = path.resolve(spec);
|
|
99
|
-
try {
|
|
100
|
-
const m = await import(pathToFileURL(file).href);
|
|
101
|
-
const h = (m.default ?? m.host) ;
|
|
102
|
-
if (h && typeof h.place === 'function') setHost(h, file);
|
|
103
|
-
else failed = { from: file, reason: '화면 규격(host)을 내보내지 않아요' };
|
|
104
|
-
} catch (e ) {
|
|
105
|
-
// 화면 패키지를 지웠거나 옮겼다 (muwi setup을 다시 하면 새 경로를 적는다)
|
|
106
|
-
failed = { from: file, reason: firstLine(e) };
|
|
107
|
-
}
|
|
108
|
-
return current;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
const firstLine = (e ) => String(e?.message ?? e).split('\n')[0];
|