@agentknight/client 0.9.42 → 0.9.44
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/LICENSE +201 -201
- package/README.md +305 -299
- package/dist/cli.js +40 -9
- package/dist/upgrade-worker.js +1740 -917
- package/package.json +10 -10
package/dist/cli.js
CHANGED
|
@@ -33,7 +33,7 @@ function readAppVersion() {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
// src/cli-options.ts
|
|
36
|
-
import { AgentSelectionSchema } from "@agentknight/sdk";
|
|
36
|
+
import { AgentSelectionSchema, CODING_AGENT_IDS } from "@agentknight/sdk";
|
|
37
37
|
import { PeerChatRequestSchema } from "@agentknight/sdk";
|
|
38
38
|
function parseCliOptions(args) {
|
|
39
39
|
let envFile;
|
|
@@ -94,7 +94,7 @@ function parseCliOptions(args) {
|
|
|
94
94
|
agents: value === "none" ? [] : value?.split(",").map((id) => id.trim())
|
|
95
95
|
});
|
|
96
96
|
if (!parsed.success) {
|
|
97
|
-
throw new Error(
|
|
97
|
+
throw new Error(`--agents requires comma-separated ${CODING_AGENT_IDS.join(",")} or none`);
|
|
98
98
|
}
|
|
99
99
|
agents = parsed.data.agents;
|
|
100
100
|
index += 1;
|
|
@@ -143,7 +143,7 @@ Usage:
|
|
|
143
143
|
|
|
144
144
|
Options:
|
|
145
145
|
--env <path> Use a file as the authoritative PC configuration
|
|
146
|
-
--agents <list> Sync
|
|
146
|
+
--agents <list> Sync ${CODING_AGENT_IDS.join(",")} (comma-separated), or none
|
|
147
147
|
-h, --help Show this help
|
|
148
148
|
-v, --version Show the installed CLI version
|
|
149
149
|
|
|
@@ -1365,6 +1365,8 @@ function fileResultSchema(mediaTypes, extended) {
|
|
|
1365
1365
|
}
|
|
1366
1366
|
var SessionFileReadResultDataSchema = fileResultSchema(SESSION_FILE_MEDIA_TYPES, false);
|
|
1367
1367
|
var SessionFileReadV2ResultDataSchema = fileResultSchema(SESSION_FILE_V2_MEDIA_TYPES, true);
|
|
1368
|
+
var SessionFileDownloadDataSchema = SessionFileReadDataSchema;
|
|
1369
|
+
var SessionFileDownloadResultDataSchema = fileResultSchema(["application/octet-stream"], true);
|
|
1368
1370
|
var SessionGitProjectSchema = z13.object({
|
|
1369
1371
|
localRepositoryKey: z13.string().length(43).regex(/^[A-Za-z0-9_-]{43}$/),
|
|
1370
1372
|
worktreeRoot: z13.string().min(1).max(SESSION_PROJECT_IDENTITY_MAX_PATH_LENGTH),
|
|
@@ -1416,6 +1418,22 @@ var SessionGitDiffResultDataSchema = z14.object({
|
|
|
1416
1418
|
context.addIssue({ code: "custom", message: "Expected a text patch or an explicit binary change" });
|
|
1417
1419
|
}
|
|
1418
1420
|
});
|
|
1421
|
+
var SessionGitDiffFileErrorSchema = z14.object({
|
|
1422
|
+
code: z14.enum(["DIFF_BLOCKED", "DIFF_FILE_UNAVAILABLE"]),
|
|
1423
|
+
message: z14.string().min(1).max(512)
|
|
1424
|
+
}).strict();
|
|
1425
|
+
var SessionGitDiffPartialEntrySchema = SessionGitDiffEntrySchema.extend({
|
|
1426
|
+
// Error paths are display-only: they must never be used for file requests.
|
|
1427
|
+
path: z14.string().min(1).max(32768).refine((value) => !value.includes("\0")),
|
|
1428
|
+
error: SessionGitDiffFileErrorSchema.optional()
|
|
1429
|
+
}).superRefine((value, context) => {
|
|
1430
|
+
if (value.error === void 0 && !SessionGitDiffEntrySchema.shape.path.safeParse(value.path).success) {
|
|
1431
|
+
context.addIssue({ code: "custom", message: "A readable diff entry must have a safe path" });
|
|
1432
|
+
}
|
|
1433
|
+
});
|
|
1434
|
+
var SessionGitDiffPartialResultDataSchema = SessionGitDiffResultDataSchema.safeExtend({
|
|
1435
|
+
files: z14.array(SessionGitDiffPartialEntrySchema).max(SESSION_GIT_DIFF_MAX_FILES).optional()
|
|
1436
|
+
});
|
|
1419
1437
|
var SessionGitDiffGzipResultDataSchema = z14.object({
|
|
1420
1438
|
encoding: z14.literal("gzip"),
|
|
1421
1439
|
byteLength: z14.number().int().min(1).max(SESSION_GIT_DIFF_MAX_RESPONSE_BYTES),
|
|
@@ -3008,8 +3026,9 @@ var AndroidProtocolSchemas = {
|
|
|
3008
3026
|
...ScheduleAndroidSchemas,
|
|
3009
3027
|
SessionCommunication: SessionCommunicationSchema,
|
|
3010
3028
|
SessionGitDiffData: SessionGitDiffDataSchema,
|
|
3011
|
-
SessionGitDiffEntry:
|
|
3012
|
-
SessionGitDiffResultData:
|
|
3029
|
+
SessionGitDiffEntry: SessionGitDiffPartialEntrySchema,
|
|
3030
|
+
SessionGitDiffResultData: SessionGitDiffPartialResultDataSchema,
|
|
3031
|
+
SessionGitDiffFileError: SessionGitDiffFileErrorSchema,
|
|
3013
3032
|
SessionGitDiffGzipResultData: SessionGitDiffGzipResultDataSchema,
|
|
3014
3033
|
SessionRenameData: SessionRenameDataSchema,
|
|
3015
3034
|
SessionRenameResultData: SessionRenameResultDataSchema,
|
|
@@ -3018,6 +3037,8 @@ var AndroidProtocolSchemas = {
|
|
|
3018
3037
|
SessionFileReadData: SessionFileReadDataSchema,
|
|
3019
3038
|
SessionFileReadResultData: SessionFileReadResultDataSchema,
|
|
3020
3039
|
SessionFileReadV2ResultData: SessionFileReadV2ResultDataSchema,
|
|
3040
|
+
SessionFileDownloadData: SessionFileDownloadDataSchema,
|
|
3041
|
+
SessionFileDownloadResultData: SessionFileDownloadResultDataSchema,
|
|
3021
3042
|
SessionResourceReadData: SessionResourceReadDataSchema,
|
|
3022
3043
|
SessionResourceReadResultData: SessionResourceReadResultDataSchema,
|
|
3023
3044
|
SessionDirectoryListRequest: SessionDirectoryListRequestSchema,
|
|
@@ -3109,6 +3130,7 @@ var AndroidProtocolSchemas = {
|
|
|
3109
3130
|
// src/config.ts
|
|
3110
3131
|
import {
|
|
3111
3132
|
AgentSelectionSchema as AgentSelectionSchema2,
|
|
3133
|
+
CODING_AGENT_IDS as CODING_AGENT_IDS2,
|
|
3112
3134
|
SessionImageRelayUrlSchema,
|
|
3113
3135
|
SessionImagesConfigSchema
|
|
3114
3136
|
} from "@agentknight/sdk";
|
|
@@ -3142,10 +3164,11 @@ var EnvironmentSchema = z28.object({
|
|
|
3142
3164
|
AGENTKNIGHT_MACHINE_NAME: z28.string().trim().min(1).max(120).optional(),
|
|
3143
3165
|
AGENTKNIGHT_HOME: z28.string().trim().min(1).optional(),
|
|
3144
3166
|
AGENTKNIGHT_WORKSPACE_ROOT: z28.string().trim().min(1).optional(),
|
|
3145
|
-
AGENTKNIGHT_CODING_AGENT: z28.enum(["managed",
|
|
3167
|
+
AGENTKNIGHT_CODING_AGENT: z28.enum(["managed", ...CODING_AGENT_IDS2]).default("managed"),
|
|
3146
3168
|
AGENTKNIGHT_GROUP_CHAT_ENABLED: EnabledBooleanStringSchema,
|
|
3147
3169
|
AGENTKNIGHT_PEER_CHAT_ENABLED: EnabledBooleanStringSchema,
|
|
3148
3170
|
PI_CODING_AGENT_DIR: OptionalPathSchema,
|
|
3171
|
+
AGENTKNIGHT_CODEX_COMMAND: OptionalPathSchema,
|
|
3149
3172
|
AGENTKNIGHT_ACP_COMMAND: OptionalPathSchema,
|
|
3150
3173
|
AGENTKNIGHT_ACP_ARGS: AcpArgumentsSchema,
|
|
3151
3174
|
SESSION_REFRESH_INTERVAL_MS: z28.coerce.number().int().min(5e3).max(36e5).default(3e4),
|
|
@@ -3188,6 +3211,7 @@ function codingAgentConfig(environment) {
|
|
|
3188
3211
|
case "managed":
|
|
3189
3212
|
return {
|
|
3190
3213
|
kind: "managed",
|
|
3214
|
+
...environment.AGENTKNIGHT_CODEX_COMMAND === void 0 ? {} : { codexCommand: environment.AGENTKNIGHT_CODEX_COMMAND },
|
|
3191
3215
|
...environment.PI_CODING_AGENT_DIR === void 0 ? {} : { piDirectory: environment.PI_CODING_AGENT_DIR },
|
|
3192
3216
|
...environment.AGENTKNIGHT_ACP_COMMAND === void 0 ? {} : {
|
|
3193
3217
|
acp: { command: environment.AGENTKNIGHT_ACP_COMMAND, args: environment.AGENTKNIGHT_ACP_ARGS }
|
|
@@ -3200,6 +3224,13 @@ function codingAgentConfig(environment) {
|
|
|
3200
3224
|
kind: "pi",
|
|
3201
3225
|
...environment.PI_CODING_AGENT_DIR === void 0 ? {} : { agentDirectory: environment.PI_CODING_AGENT_DIR }
|
|
3202
3226
|
};
|
|
3227
|
+
case "codex":
|
|
3228
|
+
return {
|
|
3229
|
+
kind: "codex",
|
|
3230
|
+
...environment.AGENTKNIGHT_CODEX_COMMAND === void 0 ? {} : { command: environment.AGENTKNIGHT_CODEX_COMMAND }
|
|
3231
|
+
};
|
|
3232
|
+
case "claude":
|
|
3233
|
+
return { kind: "claude" };
|
|
3203
3234
|
case "acp":
|
|
3204
3235
|
if (environment.AGENTKNIGHT_ACP_COMMAND === void 0) {
|
|
3205
3236
|
throw new Error("AGENTKNIGHT_ACP_COMMAND is required");
|
|
@@ -6832,7 +6863,7 @@ import { link, lstat as lstat2, mkdir as mkdir6, readFile as readFile5, readlink
|
|
|
6832
6863
|
import { homedir as homedir3, hostname } from "node:os";
|
|
6833
6864
|
import { dirname as dirname6, join as join12, resolve as resolve9 } from "node:path";
|
|
6834
6865
|
import { z as z37 } from "zod";
|
|
6835
|
-
import { DeviceIdentitySchema } from "@agentknight/sdk";
|
|
6866
|
+
import { DeviceIdentitySchema, LEGACY_CLIENT_STATE_DIRECTORY } from "@agentknight/sdk";
|
|
6836
6867
|
import { DeviceIdentitySchema as DeviceIdentitySchema2 } from "@agentknight/sdk";
|
|
6837
6868
|
var LegacyDeviceIdentitySchema = z37.object({
|
|
6838
6869
|
schemaVersion: z37.literal(1),
|
|
@@ -6871,8 +6902,8 @@ async function requireDirectory(path) {
|
|
|
6871
6902
|
}
|
|
6872
6903
|
async function readLegacyStableDeviceId(userHome) {
|
|
6873
6904
|
const defaultHome = defaultClientHome(userHome);
|
|
6874
|
-
const movedRoot = join12(defaultHome,
|
|
6875
|
-
const legacyRoot = join12(userHome,
|
|
6905
|
+
const movedRoot = join12(defaultHome, LEGACY_CLIENT_STATE_DIRECTORY);
|
|
6906
|
+
const legacyRoot = join12(userHome, LEGACY_CLIENT_STATE_DIRECTORY);
|
|
6876
6907
|
const movedExists = await requireDirectory(defaultHome) && await requireDirectory(movedRoot);
|
|
6877
6908
|
const legacyInfo = await optionalStat(legacyRoot);
|
|
6878
6909
|
let legacyDirectory;
|