@radnine/claude-session-daemon 0.9.4 → 0.9.6
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 +1 -1
- package/src/codex-process.js +11 -7
- package/src/persona-scanner.js +13 -2
package/package.json
CHANGED
package/src/codex-process.js
CHANGED
|
@@ -557,19 +557,23 @@ class CodexProcess extends EventEmitter {
|
|
|
557
557
|
|
|
558
558
|
// The child could not be spawned (codex not installed, wrong command). Node
|
|
559
559
|
// throws an uncaught exception for an unhandled 'error' event, which would
|
|
560
|
-
// take the whole daemon down with every other chat on it.
|
|
560
|
+
// take the whole daemon down with every other chat on it. Node also emits
|
|
561
|
+
// 'error' when kill() can't deliver a signal (EPERM); that process is still
|
|
562
|
+
// running, so only a failed spawn, which leaves no pid, marks it stopped.
|
|
561
563
|
_setupError() {
|
|
562
564
|
this._child.on('error', (err) => {
|
|
563
565
|
const message = err && err.code === 'ENOENT'
|
|
564
566
|
? `Codex CLI not found: ${this._codexCommand}`
|
|
565
567
|
: `Codex process error: ${err && err.message}`;
|
|
566
568
|
this._logger.error(message, { sessionId: this._sessionId, error: err && err.message });
|
|
567
|
-
this.
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
569
|
+
if (!this._child.pid) {
|
|
570
|
+
this._state = 'stopped';
|
|
571
|
+
const failure = new Error(message);
|
|
572
|
+
for (const [id, pending] of this._pending) {
|
|
573
|
+
clearTimeout(pending.timer);
|
|
574
|
+
pending.reject(failure);
|
|
575
|
+
this._pending.delete(id);
|
|
576
|
+
}
|
|
573
577
|
}
|
|
574
578
|
if (this.listenerCount('error') > 0) this.emit('error', message);
|
|
575
579
|
});
|
package/src/persona-scanner.js
CHANGED
|
@@ -20,7 +20,8 @@ const RANK_TITLES = { 1: 'Chief of Staff', 2: 'officer', 3: 'crew' };
|
|
|
20
20
|
* For each .md file:
|
|
21
21
|
* - slug is derived from the filename (minus the .md suffix)
|
|
22
22
|
* - YAML frontmatter is parsed for optional `name`, `description`, `role`, `tokens`
|
|
23
|
-
* (the heartbeat wire format calls this field `decision_tokens` — see below)
|
|
23
|
+
* (the heartbeat wire format calls this field `decision_tokens` — see below),
|
|
24
|
+
* `model` and `reasoning_effort`
|
|
24
25
|
* - body is parsed but NOT included in the returned metadata (heartbeat carries
|
|
25
26
|
* metadata only; body is re-read at activation time in Phase 3)
|
|
26
27
|
* - path is returned relative to workingDir for stable cross-pilot keys
|
|
@@ -30,6 +31,10 @@ const RANK_TITLES = { 1: 'Chief of Staff', 2: 'officer', 3: 'crew' };
|
|
|
30
31
|
* filter_parameters rule (which redacts anything matching /token/) doesn't
|
|
31
32
|
* blank the array in dev logs. Same data, name chosen for log-friendliness.
|
|
32
33
|
*
|
|
34
|
+
* `model` and `reasoning_effort` (#596) are what the persona launches with
|
|
35
|
+
* when nobody picks. They pass through as trimmed text; Rails owns the model
|
|
36
|
+
* list and drops a value it doesn't know.
|
|
37
|
+
*
|
|
33
38
|
* Failure modes are non-fatal:
|
|
34
39
|
* - missing personas directory => empty array
|
|
35
40
|
* - unreadable file => skipped with logger.warn
|
|
@@ -39,7 +44,7 @@ const RANK_TITLES = { 1: 'Chief of Staff', 2: 'officer', 3: 'crew' };
|
|
|
39
44
|
* @param {string} workingDir - The pilot's working directory.
|
|
40
45
|
* @param {object} [opts]
|
|
41
46
|
* @param {{warn: function}} [opts.logger] - Optional logger; warnings only.
|
|
42
|
-
* @returns {Promise<Array<{slug: string, name: string|null, description: string|null, path: string, role: string|null, decision_tokens: Array|null}>>}
|
|
47
|
+
* @returns {Promise<Array<{slug: string, name: string|null, description: string|null, path: string, role: string|null, decision_tokens: Array|null, model: string|null, reasoning_effort: string|null}>>}
|
|
43
48
|
*/
|
|
44
49
|
async function scanPersonas(workingDir, opts = {}) {
|
|
45
50
|
if (!workingDir) return [];
|
|
@@ -100,6 +105,8 @@ async function _parsePersonaFile(filePath, fileName, workingDir, logger) {
|
|
|
100
105
|
path: path.relative(workingDir, filePath),
|
|
101
106
|
role: _stringOrNull(frontmatter.role),
|
|
102
107
|
decision_tokens: Array.isArray(frontmatter.tokens) ? frontmatter.tokens.slice() : null,
|
|
108
|
+
model: _trimmedOrNull(frontmatter.model),
|
|
109
|
+
reasoning_effort: _trimmedOrNull(frontmatter.reasoning_effort),
|
|
103
110
|
};
|
|
104
111
|
}
|
|
105
112
|
|
|
@@ -107,6 +114,10 @@ function _stringOrNull(v) {
|
|
|
107
114
|
return typeof v === 'string' && v.length > 0 ? v : null;
|
|
108
115
|
}
|
|
109
116
|
|
|
117
|
+
function _trimmedOrNull(v) {
|
|
118
|
+
return typeof v === 'string' ? _stringOrNull(v.trim()) : null;
|
|
119
|
+
}
|
|
120
|
+
|
|
110
121
|
/**
|
|
111
122
|
* Read a persona file fresh from disk, validate it stays inside the
|
|
112
123
|
* pilot's working tree, strip frontmatter, and return the body.
|