@kylecheng3146/agent-ops 0.1.2 → 0.1.3
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 +11 -2
- package/dist/packages/cli/src/bin.js +184 -269
- package/dist/packages/cli/src/commands/hook.js +42 -0
- package/dist/packages/cli/src/commands/init.js +4 -1
- package/dist/packages/cli/src/commands/update.js +4 -1
- package/dist/packages/cli/src/context.js +102 -0
- package/dist/packages/cli/src/hook-entry.js +10 -0
- package/dist/packages/cli/src/hook-process.js +54 -0
- package/dist/packages/cli/src/ui.js +132 -0
- package/dist/packages/cli/src/version.js +3 -0
- package/dist/runtime/src/adapters/claude/config.js +19 -0
- package/dist/runtime/src/adapters/codex/config.js +16 -0
- package/dist/runtime/src/install/harness.js +1 -1
- package/dist/runtime/src/install/hooks.js +77 -0
- package/dist/runtime/src/install/ownership.js +20 -0
- package/dist/runtime/src/install/plan.js +27 -2
- package/dist/runtime/src/install/uninstall.js +28 -0
- package/dist/runtime/src/install/update.js +3 -0
- package/dist/runtime/src/schema/validate.js +57 -0
- package/dist/runtime/src/security/permissions.js +22 -3
- package/package.json +1 -1
- package/schemas/manifest.schema.json +33 -0
|
@@ -241,7 +241,9 @@ async function readWindowsProcessIdentity(processId) {
|
|
|
241
241
|
], {
|
|
242
242
|
encoding: "utf8",
|
|
243
243
|
maxBuffer: 4096,
|
|
244
|
-
|
|
244
|
+
// ponytail: cold PowerShell start on a loaded machine routinely
|
|
245
|
+
// passes two seconds; the lock budget above still bounds the wait.
|
|
246
|
+
timeout: 10_000,
|
|
245
247
|
windowsHide: true
|
|
246
248
|
});
|
|
247
249
|
const startedAt = result.stdout.trim();
|
|
@@ -251,10 +253,27 @@ async function readWindowsProcessIdentity(processId) {
|
|
|
251
253
|
return null;
|
|
252
254
|
}
|
|
253
255
|
}
|
|
256
|
+
/**
|
|
257
|
+
* A live process cannot change its own start time, so a successful self
|
|
258
|
+
* lookup never expires. Every other entry keeps the short TTL: foreign
|
|
259
|
+
* process IDs get recycled, and a failed self lookup must stay retryable
|
|
260
|
+
* instead of pinning the fallback identity for the whole run.
|
|
261
|
+
*/
|
|
262
|
+
export function reuseCachedProcessIdentity(entry, processId, selfProcessId, now) {
|
|
263
|
+
if (entry === undefined) {
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
266
|
+
if (processId === selfProcessId &&
|
|
267
|
+
entry.identity !== null &&
|
|
268
|
+
!entry.identity.startsWith("runtime:")) {
|
|
269
|
+
return true;
|
|
270
|
+
}
|
|
271
|
+
return now - entry.checkedAt <= PROCESS_IDENTITY_CACHE_MS;
|
|
272
|
+
}
|
|
254
273
|
async function readProcessIdentity(processId) {
|
|
255
274
|
const cached = processIdentityCache.get(processId);
|
|
256
|
-
if (cached
|
|
257
|
-
|
|
275
|
+
if (reuseCachedProcessIdentity(cached, processId, process.pid, Date.now()) &&
|
|
276
|
+
cached !== undefined) {
|
|
258
277
|
return cached.identity;
|
|
259
278
|
}
|
|
260
279
|
let identity;
|
package/package.json
CHANGED
|
@@ -26,6 +26,12 @@
|
|
|
26
26
|
"items": {
|
|
27
27
|
"$ref": "#/$defs/managedMarker"
|
|
28
28
|
}
|
|
29
|
+
},
|
|
30
|
+
"hooks": {
|
|
31
|
+
"type": "array",
|
|
32
|
+
"items": {
|
|
33
|
+
"$ref": "#/$defs/managedHook"
|
|
34
|
+
}
|
|
29
35
|
}
|
|
30
36
|
},
|
|
31
37
|
"$defs": {
|
|
@@ -104,6 +110,33 @@
|
|
|
104
110
|
}
|
|
105
111
|
}
|
|
106
112
|
},
|
|
113
|
+
"managedHook": {
|
|
114
|
+
"type": "object",
|
|
115
|
+
"additionalProperties": false,
|
|
116
|
+
"required": ["id", "path", "harness", "events", "owner"],
|
|
117
|
+
"properties": {
|
|
118
|
+
"id": {
|
|
119
|
+
"$ref": "#/$defs/id"
|
|
120
|
+
},
|
|
121
|
+
"path": {
|
|
122
|
+
"$ref": "#/$defs/relativePath"
|
|
123
|
+
},
|
|
124
|
+
"harness": {
|
|
125
|
+
"enum": ["codex", "claude"]
|
|
126
|
+
},
|
|
127
|
+
"events": {
|
|
128
|
+
"type": "array",
|
|
129
|
+
"minItems": 1,
|
|
130
|
+
"uniqueItems": true,
|
|
131
|
+
"items": {
|
|
132
|
+
"enum": ["SessionStart", "PreToolUse", "Stop"]
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
"owner": {
|
|
136
|
+
"const": "agent-ops"
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
},
|
|
107
140
|
"nonEmptyString": {
|
|
108
141
|
"type": "string",
|
|
109
142
|
"pattern": "[^\\s\\u0000]",
|