@ai-devkit/daemon-client 0.2.1 → 0.4.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/dist/autostart.d.ts +6 -1
- package/dist/autostart.js +373 -48
- package/dist/binary.d.ts +18 -2
- package/dist/binary.js +42 -6
- package/dist/client.d.ts +24 -1
- package/dist/client.js +85 -0
- package/dist/gen/AgentLookupResult.d.ts +28 -0
- package/dist/gen/AgentLookupResult.js +12 -0
- package/dist/gen/AgentNameParams.d.ts +7 -0
- package/dist/gen/AgentNameParams.js +5 -0
- package/dist/gen/AgentRenameParams.d.ts +7 -0
- package/dist/gen/AgentRenameParams.js +4 -0
- package/dist/gen/AgentRenameResult.d.ts +17 -0
- package/dist/gen/AgentRenameResult.js +6 -0
- package/dist/gen/AgentStartParams.d.ts +0 -1
- package/dist/gen/AgentStartResult.d.ts +0 -1
- package/dist/gen/AgentUnregisterResult.d.ts +7 -0
- package/dist/gen/AgentUnregisterResult.js +4 -0
- package/dist/gen/EnrichedAgent.d.ts +0 -1
- package/dist/gen/Event.d.ts +0 -1
- package/dist/gen/Request.d.ts +0 -1
- package/dist/gen/Response.d.ts +0 -1
- package/dist/gen/index.d.ts +0 -1
- package/dist/index.d.ts +5 -1
- package/package.json +8 -7
- package/dist/__tests__/client.test.d.ts +0 -2
- package/dist/__tests__/client.test.d.ts.map +0 -1
- package/dist/__tests__/client.test.js +0 -117
- package/dist/__tests__/daemon-sweep.test.d.ts +0 -2
- package/dist/__tests__/daemon-sweep.test.d.ts.map +0 -1
- package/dist/__tests__/daemon-sweep.test.js +0 -356
- package/dist/__tests__/integration.test.d.ts +0 -2
- package/dist/__tests__/integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration.test.js +0 -612
- package/dist/autostart.d.ts.map +0 -1
- package/dist/binary.d.ts.map +0 -1
- package/dist/client.d.ts.map +0 -1
- package/dist/gen/AgentStartParams.d.ts.map +0 -1
- package/dist/gen/AgentStartResult.d.ts.map +0 -1
- package/dist/gen/EnrichedAgent.d.ts.map +0 -1
- package/dist/gen/Event.d.ts.map +0 -1
- package/dist/gen/Request.d.ts.map +0 -1
- package/dist/gen/Response.d.ts.map +0 -1
- package/dist/gen/index.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { AgentStartParams } from "./gen/AgentStartParams.js";
|
|
2
2
|
import type { AgentStartResult } from "./gen/AgentStartResult.js";
|
|
3
|
+
import type { AgentLookupResult } from "./gen/AgentLookupResult.js";
|
|
4
|
+
import type { AgentUnregisterResult } from "./gen/AgentUnregisterResult.js";
|
|
5
|
+
import type { AgentRenameResult } from "./gen/AgentRenameResult.js";
|
|
3
6
|
import type { EnrichedAgent } from "./gen/EnrichedAgent.js";
|
|
4
7
|
import type { Event } from "./gen/Event.js";
|
|
5
8
|
/** Wire event pushed by the daemon — generated from devkit-core via ts-rs. */
|
|
@@ -53,9 +56,29 @@ export declare class DaemonClient {
|
|
|
53
56
|
* timeout covers the pid-resolution deadline plus a margin.
|
|
54
57
|
*/
|
|
55
58
|
startAgent(params: AgentStartParams): Promise<AgentStartResult>;
|
|
59
|
+
/**
|
|
60
|
+
* Resolve an exact registered name to its location data (pid, runtime,
|
|
61
|
+
* runtimeRef, cwd, liveness). Dead/tombstoned registrations resolve with
|
|
62
|
+
* `alive: false`; unknown names reject with `DaemonRpcError` code
|
|
63
|
+
* `not_found`. Generic on purpose — kill, send, open, channel and console
|
|
64
|
+
* all drive their runtime ops from this payload.
|
|
65
|
+
*/
|
|
66
|
+
lookupAgent(name: string): Promise<AgentLookupResult>;
|
|
67
|
+
/**
|
|
68
|
+
* Remove a name's registration outright (no tombstone) so the name is free
|
|
69
|
+
* for the next start. Does not touch the runtime — teardown is the
|
|
70
|
+
* caller's job, using `lookupAgent` data. Rejects `not_found` if unknown.
|
|
71
|
+
*/
|
|
72
|
+
unregisterAgent(name: string): Promise<AgentUnregisterResult>;
|
|
73
|
+
/**
|
|
74
|
+
* Rename a registered agent and its runtime handle (tmux session / live
|
|
75
|
+
* herdr agent) atomically, daemon-side. Rejects coded `not_found`,
|
|
76
|
+
* `name_in_use`, `runtime_rename_failed` (registry left unchanged),
|
|
77
|
+
* `runtime_unavailable`, `invalid_params`.
|
|
78
|
+
*/
|
|
79
|
+
renameAgent(from: string, to: string): Promise<AgentRenameResult>;
|
|
56
80
|
private onData;
|
|
57
81
|
/** Reject every in-flight request and mark the socket dead. Idempotent. */
|
|
58
82
|
private onSocketDead;
|
|
59
83
|
close(): void;
|
|
60
84
|
}
|
|
61
|
-
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.js
CHANGED
|
@@ -444,6 +444,91 @@ export function daemonSocketPath() {
|
|
|
444
444
|
}).call(this);
|
|
445
445
|
}
|
|
446
446
|
},
|
|
447
|
+
{
|
|
448
|
+
key: "lookupAgent",
|
|
449
|
+
value: /**
|
|
450
|
+
* Resolve an exact registered name to its location data (pid, runtime,
|
|
451
|
+
* runtimeRef, cwd, liveness). Dead/tombstoned registrations resolve with
|
|
452
|
+
* `alive: false`; unknown names reject with `DaemonRpcError` code
|
|
453
|
+
* `not_found`. Generic on purpose — kill, send, open, channel and console
|
|
454
|
+
* all drive their runtime ops from this payload.
|
|
455
|
+
*/ function lookupAgent(name) {
|
|
456
|
+
return _async_to_generator(function() {
|
|
457
|
+
return _ts_generator(this, function(_state) {
|
|
458
|
+
switch(_state.label){
|
|
459
|
+
case 0:
|
|
460
|
+
return [
|
|
461
|
+
4,
|
|
462
|
+
this.request("agent.lookup", {
|
|
463
|
+
name: name
|
|
464
|
+
})
|
|
465
|
+
];
|
|
466
|
+
case 1:
|
|
467
|
+
return [
|
|
468
|
+
2,
|
|
469
|
+
_state.sent()
|
|
470
|
+
];
|
|
471
|
+
}
|
|
472
|
+
});
|
|
473
|
+
}).call(this);
|
|
474
|
+
}
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
key: "unregisterAgent",
|
|
478
|
+
value: /**
|
|
479
|
+
* Remove a name's registration outright (no tombstone) so the name is free
|
|
480
|
+
* for the next start. Does not touch the runtime — teardown is the
|
|
481
|
+
* caller's job, using `lookupAgent` data. Rejects `not_found` if unknown.
|
|
482
|
+
*/ function unregisterAgent(name) {
|
|
483
|
+
return _async_to_generator(function() {
|
|
484
|
+
return _ts_generator(this, function(_state) {
|
|
485
|
+
switch(_state.label){
|
|
486
|
+
case 0:
|
|
487
|
+
return [
|
|
488
|
+
4,
|
|
489
|
+
this.request("agent.unregister", {
|
|
490
|
+
name: name
|
|
491
|
+
})
|
|
492
|
+
];
|
|
493
|
+
case 1:
|
|
494
|
+
return [
|
|
495
|
+
2,
|
|
496
|
+
_state.sent()
|
|
497
|
+
];
|
|
498
|
+
}
|
|
499
|
+
});
|
|
500
|
+
}).call(this);
|
|
501
|
+
}
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
key: "renameAgent",
|
|
505
|
+
value: /**
|
|
506
|
+
* Rename a registered agent and its runtime handle (tmux session / live
|
|
507
|
+
* herdr agent) atomically, daemon-side. Rejects coded `not_found`,
|
|
508
|
+
* `name_in_use`, `runtime_rename_failed` (registry left unchanged),
|
|
509
|
+
* `runtime_unavailable`, `invalid_params`.
|
|
510
|
+
*/ function renameAgent(from, to) {
|
|
511
|
+
return _async_to_generator(function() {
|
|
512
|
+
return _ts_generator(this, function(_state) {
|
|
513
|
+
switch(_state.label){
|
|
514
|
+
case 0:
|
|
515
|
+
return [
|
|
516
|
+
4,
|
|
517
|
+
this.request("agent.rename", {
|
|
518
|
+
from: from,
|
|
519
|
+
to: to
|
|
520
|
+
})
|
|
521
|
+
];
|
|
522
|
+
case 1:
|
|
523
|
+
return [
|
|
524
|
+
2,
|
|
525
|
+
_state.sent()
|
|
526
|
+
];
|
|
527
|
+
}
|
|
528
|
+
});
|
|
529
|
+
}).call(this);
|
|
530
|
+
}
|
|
531
|
+
},
|
|
447
532
|
{
|
|
448
533
|
key: "onData",
|
|
449
534
|
value: function onData(chunk) {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `agent.lookup` result — a registered agent's location data, enough for a
|
|
3
|
+
* client to drive its runtime directly (tmux `kill-session`/`send-keys` via
|
|
4
|
+
* `runtimeRef.session`, herdr pane ops via `runtimeRef.paneId`). Generic on
|
|
5
|
+
* purpose: kill, send, open, channel and console all resolve through it.
|
|
6
|
+
*
|
|
7
|
+
* Tombstoned registrations (process gone, row retained for cleanup) resolve
|
|
8
|
+
* too: `alive` is false and `goneAt` carries the sweep timestamp (ms).
|
|
9
|
+
* `alive` is a `kill(pid, 0)` probe at lookup time — callers must not
|
|
10
|
+
* signal `pid` when it is false (the number may since have been recycled).
|
|
11
|
+
*/
|
|
12
|
+
export type AgentLookupResult = {
|
|
13
|
+
name: string;
|
|
14
|
+
type: string;
|
|
15
|
+
pid: number;
|
|
16
|
+
/**
|
|
17
|
+
* Runtime provider: "tmux" | "herdr".
|
|
18
|
+
*/
|
|
19
|
+
runtime: string;
|
|
20
|
+
/**
|
|
21
|
+
* Provider-specific handle; `null` when the registration has none.
|
|
22
|
+
*/
|
|
23
|
+
runtimeRef: unknown;
|
|
24
|
+
cwd: string;
|
|
25
|
+
pinned: boolean;
|
|
26
|
+
alive: boolean;
|
|
27
|
+
goneAt?: number;
|
|
28
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
2
|
+
/**
|
|
3
|
+
* `agent.lookup` result — a registered agent's location data, enough for a
|
|
4
|
+
* client to drive its runtime directly (tmux `kill-session`/`send-keys` via
|
|
5
|
+
* `runtimeRef.session`, herdr pane ops via `runtimeRef.paneId`). Generic on
|
|
6
|
+
* purpose: kill, send, open, channel and console all resolve through it.
|
|
7
|
+
*
|
|
8
|
+
* Tombstoned registrations (process gone, row retained for cleanup) resolve
|
|
9
|
+
* too: `alive` is false and `goneAt` carries the sweep timestamp (ms).
|
|
10
|
+
* `alive` is a `kill(pid, 0)` probe at lookup time — callers must not
|
|
11
|
+
* signal `pid` when it is false (the number may since have been recycled).
|
|
12
|
+
*/ export { };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
2
|
+
/**
|
|
3
|
+
* Params for name-addressed agent ops (`agent.lookup`, `agent.unregister`).
|
|
4
|
+
* Exact registered name — partial/fuzzy matching stays client-side.
|
|
5
|
+
*/ export { };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `agent.rename` result. `runtimeRenamed` is false when there was no live
|
|
3
|
+
* runtime handle to rename (tmux session gone, dead herdr agent) — the
|
|
4
|
+
* registry-only case, explained in `warnings`.
|
|
5
|
+
*/
|
|
6
|
+
export type AgentRenameResult = {
|
|
7
|
+
from: string;
|
|
8
|
+
to: string;
|
|
9
|
+
pid: number;
|
|
10
|
+
runtime: string;
|
|
11
|
+
/**
|
|
12
|
+
* Updated provider handle (tmux `session` / herdr `agentName` = `to`).
|
|
13
|
+
*/
|
|
14
|
+
runtimeRef: unknown;
|
|
15
|
+
runtimeRenamed: boolean;
|
|
16
|
+
warnings: Array<string>;
|
|
17
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
2
|
+
/**
|
|
3
|
+
* `agent.rename` result. `runtimeRenamed` is false when there was no live
|
|
4
|
+
* runtime handle to rename (tmux session gone, dead herdr agent) — the
|
|
5
|
+
* registry-only case, explained in `warnings`.
|
|
6
|
+
*/ export { };
|
package/dist/gen/Event.d.ts
CHANGED
package/dist/gen/Request.d.ts
CHANGED
package/dist/gen/Response.d.ts
CHANGED
package/dist/gen/index.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,11 @@ export { DaemonClient, daemonSocketPath, DaemonRpcError } from "./client.js";
|
|
|
2
2
|
export type { DaemonEvent } from "./client.js";
|
|
3
3
|
export type { AgentStartParams } from "./gen/AgentStartParams.js";
|
|
4
4
|
export type { AgentStartResult } from "./gen/AgentStartResult.js";
|
|
5
|
+
export type { AgentLookupResult } from "./gen/AgentLookupResult.js";
|
|
6
|
+
export type { AgentNameParams } from "./gen/AgentNameParams.js";
|
|
7
|
+
export type { AgentUnregisterResult } from "./gen/AgentUnregisterResult.js";
|
|
8
|
+
export type { AgentRenameParams } from "./gen/AgentRenameParams.js";
|
|
9
|
+
export type { AgentRenameResult } from "./gen/AgentRenameResult.js";
|
|
5
10
|
export type { EnrichedAgent, Event } from "./gen/index.js";
|
|
6
11
|
export { resolveDaemonBinary } from "./binary.js";
|
|
7
12
|
export { ensureDaemon } from "./autostart.js";
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-devkit/daemon-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Thin client for the devkitd coordination daemon (unix socket, JSON-RPC, subscribe)",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -26,10 +26,11 @@
|
|
|
26
26
|
"dev": "swc src -d dist --strip-leading-paths --watch",
|
|
27
27
|
"typecheck": "tsc --noEmit",
|
|
28
28
|
"test": "vitest run",
|
|
29
|
-
"lint": "oxlint src",
|
|
29
|
+
"lint": "oxlint src tests",
|
|
30
30
|
"fmt": "oxfmt",
|
|
31
31
|
"fmt:check": "oxfmt --check",
|
|
32
|
-
"clean": "rm -rf dist"
|
|
32
|
+
"clean": "rm -rf dist",
|
|
33
|
+
"prepublishOnly": "npm run build"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
36
|
"@swc/cli": "^0.8.1",
|
|
@@ -38,9 +39,9 @@
|
|
|
38
39
|
"vitest": "^4.1.8"
|
|
39
40
|
},
|
|
40
41
|
"optionalDependencies": {
|
|
41
|
-
"@ai-devkit/devkitd-darwin-arm64": "0.
|
|
42
|
-
"@ai-devkit/devkitd-darwin-x64": "0.
|
|
43
|
-
"@ai-devkit/devkitd-linux-arm64": "0.
|
|
44
|
-
"@ai-devkit/devkitd-linux-x64": "0.
|
|
42
|
+
"@ai-devkit/devkitd-darwin-arm64": "0.4.0",
|
|
43
|
+
"@ai-devkit/devkitd-darwin-x64": "0.4.0",
|
|
44
|
+
"@ai-devkit/devkitd-linux-arm64": "0.4.0",
|
|
45
|
+
"@ai-devkit/devkitd-linux-x64": "0.4.0"
|
|
45
46
|
}
|
|
46
47
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/client.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
function _array_like_to_array(arr, len) {
|
|
2
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
|
-
return arr2;
|
|
5
|
-
}
|
|
6
|
-
function _array_with_holes(arr) {
|
|
7
|
-
if (Array.isArray(arr)) return arr;
|
|
8
|
-
}
|
|
9
|
-
function _iterable_to_array_limit(arr, i) {
|
|
10
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
11
|
-
if (_i == null) return;
|
|
12
|
-
var _arr = [];
|
|
13
|
-
var _n = true;
|
|
14
|
-
var _d = false;
|
|
15
|
-
var _s, _e;
|
|
16
|
-
try {
|
|
17
|
-
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
18
|
-
_arr.push(_s.value);
|
|
19
|
-
if (i && _arr.length === i) break;
|
|
20
|
-
}
|
|
21
|
-
} catch (err) {
|
|
22
|
-
_d = true;
|
|
23
|
-
_e = err;
|
|
24
|
-
} finally{
|
|
25
|
-
try {
|
|
26
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
27
|
-
} finally{
|
|
28
|
-
if (_d) throw _e;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return _arr;
|
|
32
|
-
}
|
|
33
|
-
function _non_iterable_rest() {
|
|
34
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
35
|
-
}
|
|
36
|
-
function _sliced_to_array(arr, i) {
|
|
37
|
-
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
38
|
-
}
|
|
39
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
40
|
-
if (!o) return;
|
|
41
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
42
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
43
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
44
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
45
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
46
|
-
}
|
|
47
|
-
import { describe, it, expect, afterEach } from "vitest";
|
|
48
|
-
import * as fs from "node:fs";
|
|
49
|
-
import * as os from "node:os";
|
|
50
|
-
import * as path from "node:path";
|
|
51
|
-
import { resolveDaemonBinary } from "../binary.js";
|
|
52
|
-
import { daemonSocketPath } from "../client.js";
|
|
53
|
-
describe("resolveDaemonBinary", function() {
|
|
54
|
-
var saved = {
|
|
55
|
-
DEVKITD_BIN: process.env.DEVKITD_BIN,
|
|
56
|
-
AI_DEVKITD_BIN: process.env.AI_DEVKITD_BIN
|
|
57
|
-
};
|
|
58
|
-
afterEach(function() {
|
|
59
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
60
|
-
try {
|
|
61
|
-
for(var _iterator = Object.entries(saved)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
62
|
-
var _step_value = _sliced_to_array(_step.value, 2), k = _step_value[0], v = _step_value[1];
|
|
63
|
-
if (v === undefined) delete process.env[k];
|
|
64
|
-
else process.env[k] = v;
|
|
65
|
-
}
|
|
66
|
-
} catch (err) {
|
|
67
|
-
_didIteratorError = true;
|
|
68
|
-
_iteratorError = err;
|
|
69
|
-
} finally{
|
|
70
|
-
try {
|
|
71
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
72
|
-
_iterator.return();
|
|
73
|
-
}
|
|
74
|
-
} finally{
|
|
75
|
-
if (_didIteratorError) {
|
|
76
|
-
throw _iteratorError;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
it("honors DEVKITD_BIN when the file exists", function() {
|
|
82
|
-
var fake = path.join(os.tmpdir(), "fake-daemon-".concat(process.pid));
|
|
83
|
-
fs.writeFileSync(fake, "#!/bin/sh\n");
|
|
84
|
-
process.env.DEVKITD_BIN = fake;
|
|
85
|
-
expect(resolveDaemonBinary()).toBe(fake);
|
|
86
|
-
fs.unlinkSync(fake);
|
|
87
|
-
});
|
|
88
|
-
it("accepts AI_DEVKITD_BIN as a deprecated alias", function() {
|
|
89
|
-
delete process.env.DEVKITD_BIN;
|
|
90
|
-
var fake = path.join(os.tmpdir(), "fake-daemon-legacy-".concat(process.pid));
|
|
91
|
-
fs.writeFileSync(fake, "#!/bin/sh\n");
|
|
92
|
-
process.env.AI_DEVKITD_BIN = fake;
|
|
93
|
-
expect(resolveDaemonBinary()).toBe(fake);
|
|
94
|
-
fs.unlinkSync(fake);
|
|
95
|
-
});
|
|
96
|
-
it("DEVKITD_BIN wins over AI_DEVKITD_BIN", function() {
|
|
97
|
-
var a = path.join(os.tmpdir(), "fake-a-".concat(process.pid));
|
|
98
|
-
var b = path.join(os.tmpdir(), "fake-b-".concat(process.pid));
|
|
99
|
-
fs.writeFileSync(a, "#!/bin/sh\n");
|
|
100
|
-
fs.writeFileSync(b, "#!/bin/sh\n");
|
|
101
|
-
process.env.DEVKITD_BIN = a;
|
|
102
|
-
process.env.AI_DEVKITD_BIN = b;
|
|
103
|
-
expect(resolveDaemonBinary()).toBe(a);
|
|
104
|
-
fs.unlinkSync(a);
|
|
105
|
-
fs.unlinkSync(b);
|
|
106
|
-
});
|
|
107
|
-
it("ignores DEVKITD_BIN pointing at a missing file", function() {
|
|
108
|
-
delete process.env.AI_DEVKITD_BIN;
|
|
109
|
-
process.env.DEVKITD_BIN = "/nonexistent/devkitd-nope";
|
|
110
|
-
expect(resolveDaemonBinary()).not.toBe("/nonexistent/devkitd-nope");
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
describe("daemonSocketPath", function() {
|
|
114
|
-
it("lives under ~/.ai-devkit", function() {
|
|
115
|
-
expect(daemonSocketPath()).toBe(path.join(os.homedir(), ".ai-devkit", "daemon.sock"));
|
|
116
|
-
});
|
|
117
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"daemon-sweep.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/daemon-sweep.test.ts"],"names":[],"mappings":""}
|