@awak-app/simy-cli 0.1.5 → 0.2.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/package.json +1 -1
- package/src/agent.js +24 -3
- package/src/cli-contract.js +11 -0
package/package.json
CHANGED
package/src/agent.js
CHANGED
|
@@ -64,6 +64,11 @@ import {
|
|
|
64
64
|
scanGitRepositories,
|
|
65
65
|
writeRepositoryInventory,
|
|
66
66
|
} from "./repository-inventory.js";
|
|
67
|
+
import {
|
|
68
|
+
CLI_API_CONTRACT_VERSION,
|
|
69
|
+
CLI_VERSION,
|
|
70
|
+
withCliContract,
|
|
71
|
+
} from "./cli-contract.js";
|
|
67
72
|
|
|
68
73
|
const DEVICE_HEARTBEAT_INTERVAL_MS = 20_000;
|
|
69
74
|
|
|
@@ -99,7 +104,11 @@ export async function startAgent({
|
|
|
99
104
|
]
|
|
100
105
|
: [],
|
|
101
106
|
);
|
|
102
|
-
const
|
|
107
|
+
const installMode = updateManager?.snapshot?.()?.install_mode ?? null;
|
|
108
|
+
const availableCapabilities = withCliContract(
|
|
109
|
+
await readCapabilities(dependencies),
|
|
110
|
+
installMode,
|
|
111
|
+
);
|
|
103
112
|
const heartbeatDevice = dependencies.heartbeatDevice || heartbeatLocalDevice;
|
|
104
113
|
const runOptions = dependencies.runOptions || {};
|
|
105
114
|
const repositoryScanRoot = resolve(
|
|
@@ -274,6 +283,8 @@ export async function startAgent({
|
|
|
274
283
|
if (req.method === "GET" && url.pathname === "/v1/health") {
|
|
275
284
|
json(res, 200, {
|
|
276
285
|
ok: true,
|
|
286
|
+
cli_version: CLI_VERSION,
|
|
287
|
+
api_contract_version: CLI_API_CONTRACT_VERSION,
|
|
277
288
|
daemon,
|
|
278
289
|
web_origin: apiOrigin,
|
|
279
290
|
session_valid: isSessionValid(session, Date.now(), apiOrigin),
|
|
@@ -283,7 +294,7 @@ export async function startAgent({
|
|
|
283
294
|
return;
|
|
284
295
|
}
|
|
285
296
|
if (req.method === "GET" && url.pathname === "/v1/capabilities") {
|
|
286
|
-
json(res, 200,
|
|
297
|
+
json(res, 200, availableCapabilities);
|
|
287
298
|
return;
|
|
288
299
|
}
|
|
289
300
|
if (req.method === "POST" && agenticLoopPath === "/v1/agentic-loop/preflight") {
|
|
@@ -356,7 +367,12 @@ export async function startAgent({
|
|
|
356
367
|
startHeartbeatTimer();
|
|
357
368
|
loginUrl = null;
|
|
358
369
|
registry.emit("change", registry.list());
|
|
359
|
-
json(res, 200, {
|
|
370
|
+
json(res, 200, {
|
|
371
|
+
ok: true,
|
|
372
|
+
expires_at: session.expires_at,
|
|
373
|
+
cli_version: CLI_VERSION,
|
|
374
|
+
api_contract_version: CLI_API_CONTRACT_VERSION,
|
|
375
|
+
});
|
|
360
376
|
void synchronizeAuthorizedSession();
|
|
361
377
|
return;
|
|
362
378
|
}
|
|
@@ -698,6 +714,9 @@ export async function startAgent({
|
|
|
698
714
|
loginUrl = new URL("/local-cli/connect", apiOrigin);
|
|
699
715
|
loginUrl.searchParams.set("port", String(port));
|
|
700
716
|
loginUrl.searchParams.set("nonce", authNonce);
|
|
717
|
+
loginUrl.searchParams.set("cli_version", CLI_VERSION);
|
|
718
|
+
loginUrl.searchParams.set("api_contract_version", String(CLI_API_CONTRACT_VERSION));
|
|
719
|
+
if (installMode) loginUrl.searchParams.set("install_mode", installMode);
|
|
701
720
|
if (!quiet) {
|
|
702
721
|
console.log(`Sign in to SIMY: ${loginUrl.toString()}`);
|
|
703
722
|
console.log(`Session file: ${sessionPath(apiOrigin, sessionRoot)}`);
|
|
@@ -910,6 +929,8 @@ export async function heartbeatLocalDevice({
|
|
|
910
929
|
),
|
|
911
930
|
body: JSON.stringify({
|
|
912
931
|
port,
|
|
932
|
+
cli_version: CLI_VERSION,
|
|
933
|
+
api_contract_version: CLI_API_CONTRACT_VERSION,
|
|
913
934
|
capabilities,
|
|
914
935
|
repo_inventory: repoInventory,
|
|
915
936
|
}),
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const CLI_VERSION = "0.2.0";
|
|
2
|
+
export const CLI_API_CONTRACT_VERSION = 2;
|
|
3
|
+
|
|
4
|
+
export function withCliContract(capabilities = {}, installMode = null) {
|
|
5
|
+
return {
|
|
6
|
+
...capabilities,
|
|
7
|
+
cli_version: CLI_VERSION,
|
|
8
|
+
api_contract_version: CLI_API_CONTRACT_VERSION,
|
|
9
|
+
...(installMode ? { install_mode: installMode } : {}),
|
|
10
|
+
};
|
|
11
|
+
}
|