@monoes/monomindcli 2.11.7 → 2.11.8
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/dist/src/commands/org.d.ts.map +1 -1
- package/dist/src/commands/org.js +3 -0
- package/dist/src/commands/org.js.map +1 -1
- package/dist/src/orgrt/daemon.d.ts.map +1 -1
- package/dist/src/orgrt/daemon.js +73 -12
- package/dist/src/orgrt/daemon.js.map +1 -1
- package/dist/src/orgrt/idle-deadline.d.ts +36 -0
- package/dist/src/orgrt/idle-deadline.d.ts.map +1 -0
- package/dist/src/orgrt/idle-deadline.js +63 -0
- package/dist/src/orgrt/idle-deadline.js.map +1 -0
- package/dist/src/protocol-capabilities.d.ts +3 -1
- package/dist/src/protocol-capabilities.d.ts.map +1 -1
- package/dist/src/protocol-capabilities.js +3 -0
- package/dist/src/protocol-capabilities.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Idle-watchdog deadline (#296, capability `org-idle-deadline`).
|
|
3
|
+
*
|
|
4
|
+
* The daemon's idle watchdog (daemon.ts) keeps its clock in memory, but
|
|
5
|
+
* `org status --json` runs in another process. The watchdog therefore
|
|
6
|
+
* publishes its projected stop time to `<org>/idle-watchdog.json` on each
|
|
7
|
+
* check, and status reads it back. It is a file, not a bus event, because
|
|
8
|
+
* every bus event counts as org activity and would reset the very clock
|
|
9
|
+
* it reports.
|
|
10
|
+
*/
|
|
11
|
+
import { existsSync, readFileSync, rmSync } from 'node:fs';
|
|
12
|
+
import { join } from 'node:path';
|
|
13
|
+
import { writeJsonFileAtomic } from '../utils/json-file.js';
|
|
14
|
+
import { ORG_DIR } from './types.js';
|
|
15
|
+
export const IDLE_WATCHDOG_FILE = 'idle-watchdog.json';
|
|
16
|
+
/** When the watchdog stops the run, assuming no further activity. The stop
|
|
17
|
+
* lands on the first check at or after this time (checks run every
|
|
18
|
+
* min(idle/2, 30s)), so treat it as the earliest stop, not an exact one.
|
|
19
|
+
* - after a nudge: one more idle window from the nudge;
|
|
20
|
+
* - nudge cap reached, or boss unreachable: at the end of this idle window;
|
|
21
|
+
* - otherwise: a nudge at the end of this window, then one more window. */
|
|
22
|
+
export function projectIdleStop(s) {
|
|
23
|
+
if (s.nudgedAt !== 0)
|
|
24
|
+
return s.nudgedAt + s.idleMs;
|
|
25
|
+
if (s.nudges >= s.maxNudges || !s.bossReachable)
|
|
26
|
+
return s.lastActivity + s.idleMs;
|
|
27
|
+
return s.lastActivity + 2 * s.idleMs;
|
|
28
|
+
}
|
|
29
|
+
function recordPath(root, name) {
|
|
30
|
+
return join(root, ORG_DIR, name, IDLE_WATCHDOG_FILE);
|
|
31
|
+
}
|
|
32
|
+
export function writeIdleRecord(root, name, rec) {
|
|
33
|
+
writeJsonFileAtomic(recordPath(root, name), rec);
|
|
34
|
+
}
|
|
35
|
+
export function clearIdleRecord(root, name) {
|
|
36
|
+
rmSync(recordPath(root, name), { force: true });
|
|
37
|
+
}
|
|
38
|
+
/** Status fields for a running org. A missing or mismatched record (a daemon
|
|
39
|
+
* older than this feature, or one that has not checked yet) is reported as
|
|
40
|
+
* `idle_hold: 'unknown'` rather than guessed. */
|
|
41
|
+
export function readIdleStatus(root, name, run, now = Date.now()) {
|
|
42
|
+
const unknown = { idle_stop_at: null, idle_stop_in_seconds: null, idle_hold: 'unknown' };
|
|
43
|
+
const p = recordPath(root, name);
|
|
44
|
+
if (!run || !existsSync(p))
|
|
45
|
+
return unknown;
|
|
46
|
+
let rec;
|
|
47
|
+
try {
|
|
48
|
+
rec = JSON.parse(readFileSync(p, 'utf8'));
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return unknown;
|
|
52
|
+
}
|
|
53
|
+
if (rec.run !== run)
|
|
54
|
+
return unknown;
|
|
55
|
+
if (!rec.idle_stop_at)
|
|
56
|
+
return { idle_stop_at: null, idle_stop_in_seconds: null, idle_hold: rec.hold };
|
|
57
|
+
return {
|
|
58
|
+
idle_stop_at: rec.idle_stop_at,
|
|
59
|
+
idle_stop_in_seconds: Math.max(0, Math.round((Date.parse(rec.idle_stop_at) - now) / 1000)),
|
|
60
|
+
idle_hold: null,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=idle-deadline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"idle-deadline.js","sourceRoot":"","sources":["../../../src/orgrt/idle-deadline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAqBvD;;;;;4EAK4E;AAC5E,MAAM,UAAU,eAAe,CAAC,CAO/B;IACC,IAAI,CAAC,CAAC,QAAQ,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,aAAa;QAAE,OAAO,CAAC,CAAC,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IAClF,OAAO,CAAC,CAAC,YAAY,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;AACvC,CAAC;AAED,SAAS,UAAU,CAAC,IAAY,EAAE,IAAY;IAC5C,OAAO,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,kBAAkB,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,IAAY,EAAE,GAAuB;IACjF,mBA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G,CAAC,GAAG,IAAI,CAAC,CAAC;QAC1F,SAAS,EAAE,IAAI;KAChB,CAAC;AACJ,CAAC"}
|
|
@@ -23,8 +23,10 @@ export declare const AGENT_PROTOCOL_MIN_CALLER = "1.0.0";
|
|
|
23
23
|
* events, request-scoped approvals (`--request`, `requestId`)
|
|
24
24
|
* - `org-endpoint-roles` — roles with `kind: "endpoint"` delivered by HTTP POST
|
|
25
25
|
* - `org-federation` — `federation.allow_from/allow_to` enforced across project roots
|
|
26
|
+
* - `org-idle-deadline` — `org status --json` reports `idle_stop_at`,
|
|
27
|
+
* `idle_stop_in_seconds` and `idle_hold` for a running org
|
|
26
28
|
*/
|
|
27
|
-
export declare const AGENT_PROTOCOL_CAPABILITIES: readonly ['agent-exec', 'agent-scan', 'org-json-v1', 'org-tool-providers', 'org-decision-attribution', 'org-endpoint-roles', 'org-federation'];
|
|
29
|
+
export declare const AGENT_PROTOCOL_CAPABILITIES: readonly ['agent-exec', 'agent-scan', 'org-json-v1', 'org-tool-providers', 'org-decision-attribution', 'org-endpoint-roles', 'org-federation', 'org-idle-deadline'];
|
|
28
30
|
/** The exact handshake object emitted by `monomind --version --json`. */
|
|
29
31
|
export declare function versionJsonPayload(version: string): {
|
|
30
32
|
v: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol-capabilities.d.ts","sourceRoot":"","sources":["../../src/protocol-capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,4DAA4D;AAC5D,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC,gFAAgF;AAChF,eAAO,MAAM,yBAAyB,UAAU,CAAC;AAEjD
|
|
1
|
+
{"version":3,"file":"protocol-capabilities.d.ts","sourceRoot":"","sources":["../../src/protocol-capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,4DAA4D;AAC5D,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC,gFAAgF;AAChF,eAAO,MAAM,yBAAyB,UAAU,CAAC;AAEjD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,2BAA2B,YACtC,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,oBAAoB,EACpB,0BAA0B,EAC1B,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,CACX,CAAC;AAEX,yEAAyE;AACzE,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG;IACnD,CAAC,EAAE,MAAM,CAAC;IACV,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;CACjC,CAOA"}
|
|
@@ -23,6 +23,8 @@ export const AGENT_PROTOCOL_MIN_CALLER = '1.0.0';
|
|
|
23
23
|
* events, request-scoped approvals (`--request`, `requestId`)
|
|
24
24
|
* - `org-endpoint-roles` — roles with `kind: "endpoint"` delivered by HTTP POST
|
|
25
25
|
* - `org-federation` — `federation.allow_from/allow_to` enforced across project roots
|
|
26
|
+
* - `org-idle-deadline` — `org status --json` reports `idle_stop_at`,
|
|
27
|
+
* `idle_stop_in_seconds` and `idle_hold` for a running org
|
|
26
28
|
*/
|
|
27
29
|
export const AGENT_PROTOCOL_CAPABILITIES = [
|
|
28
30
|
'agent-exec',
|
|
@@ -32,6 +34,7 @@ export const AGENT_PROTOCOL_CAPABILITIES = [
|
|
|
32
34
|
'org-decision-attribution',
|
|
33
35
|
'org-endpoint-roles',
|
|
34
36
|
'org-federation',
|
|
37
|
+
'org-idle-deadline',
|
|
35
38
|
];
|
|
36
39
|
/** The exact handshake object emitted by `monomind --version --json`. */
|
|
37
40
|
export function versionJsonPayload(version) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol-capabilities.js","sourceRoot":"","sources":["../../src/protocol-capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAExC,gFAAgF;AAChF,MAAM,CAAC,MAAM,yBAAyB,GAAG,OAAO,CAAC;AAEjD
|
|
1
|
+
{"version":3,"file":"protocol-capabilities.js","sourceRoot":"","sources":["../../src/protocol-capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAExC,gFAAgF;AAChF,MAAM,CAAC,MAAM,yBAAyB,GAAG,OAAO,CAAC;AAEjD;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,YAAY;IACZ,YAAY;IACZ,aAAa;IACb,oBAAoB;IACpB,0BAA0B;IAC1B,oBAAoB;IACpB,gBAAgB;IAChB,mBAAmB;CACX,CAAC;AAEX,yEAAyE;AACzE,MAAM,UAAU,kBAAkB,CAAC,OAAe;IAMhD,OAAO;QACL,CAAC,EAAE,sBAAsB;QACzB,OAAO;QACP,UAAU,EAAE,yBAAyB;QACrC,YAAY,EAAE,2BAA2B;KAC1C,CAAC;AACJ,CAAC"}
|