@ai-development-environment/control-agent 0.0.48 → 0.0.49
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/control-agent.js +373 -227
- package/package.json +1 -1
package/dist/control-agent.js
CHANGED
|
@@ -3728,15 +3728,15 @@ var require_windows = __commonJS({
|
|
|
3728
3728
|
}
|
|
3729
3729
|
return false;
|
|
3730
3730
|
}
|
|
3731
|
-
function checkStat(
|
|
3732
|
-
if (!
|
|
3731
|
+
function checkStat(stat8, path, options) {
|
|
3732
|
+
if (!stat8.isSymbolicLink() && !stat8.isFile()) {
|
|
3733
3733
|
return false;
|
|
3734
3734
|
}
|
|
3735
3735
|
return checkPathExt(path, options);
|
|
3736
3736
|
}
|
|
3737
3737
|
function isexe(path, options, cb2) {
|
|
3738
|
-
fs.stat(path, function(er2,
|
|
3739
|
-
cb2(er2, er2 ? false : checkStat(
|
|
3738
|
+
fs.stat(path, function(er2, stat8) {
|
|
3739
|
+
cb2(er2, er2 ? false : checkStat(stat8, path, options));
|
|
3740
3740
|
});
|
|
3741
3741
|
}
|
|
3742
3742
|
function sync(path, options) {
|
|
@@ -3752,20 +3752,20 @@ var require_mode = __commonJS({
|
|
|
3752
3752
|
isexe.sync = sync;
|
|
3753
3753
|
var fs = __require("fs");
|
|
3754
3754
|
function isexe(path, options, cb2) {
|
|
3755
|
-
fs.stat(path, function(er2,
|
|
3756
|
-
cb2(er2, er2 ? false : checkStat(
|
|
3755
|
+
fs.stat(path, function(er2, stat8) {
|
|
3756
|
+
cb2(er2, er2 ? false : checkStat(stat8, options));
|
|
3757
3757
|
});
|
|
3758
3758
|
}
|
|
3759
3759
|
function sync(path, options) {
|
|
3760
3760
|
return checkStat(fs.statSync(path), options);
|
|
3761
3761
|
}
|
|
3762
|
-
function checkStat(
|
|
3763
|
-
return
|
|
3762
|
+
function checkStat(stat8, options) {
|
|
3763
|
+
return stat8.isFile() && checkMode(stat8, options);
|
|
3764
3764
|
}
|
|
3765
|
-
function checkMode(
|
|
3766
|
-
var mod =
|
|
3767
|
-
var uid =
|
|
3768
|
-
var gid =
|
|
3765
|
+
function checkMode(stat8, options) {
|
|
3766
|
+
var mod = stat8.mode;
|
|
3767
|
+
var uid = stat8.uid;
|
|
3768
|
+
var gid = stat8.gid;
|
|
3769
3769
|
var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
|
|
3770
3770
|
var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
|
|
3771
3771
|
var u = parseInt("100", 8);
|
|
@@ -6711,6 +6711,42 @@ function parseSkillApplyPayload(value) {
|
|
|
6711
6711
|
};
|
|
6712
6712
|
}
|
|
6713
6713
|
|
|
6714
|
+
// ../agent-contract/src/runs.ts
|
|
6715
|
+
var RUN_SESSION_READ_JOB_KIND = "runs.session.read";
|
|
6716
|
+
var RUN_SESSION_FILE_PROVIDERS = ["CLAUDE", "CODEX"];
|
|
6717
|
+
var MAX_RUN_SESSION_FILE_BYTES = 64 * 1024 * 1024;
|
|
6718
|
+
function objectValue6(value, name) {
|
|
6719
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
6720
|
+
throw new Error(`${name} must be an object`);
|
|
6721
|
+
}
|
|
6722
|
+
return value;
|
|
6723
|
+
}
|
|
6724
|
+
function stringValue6(value, name) {
|
|
6725
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
6726
|
+
throw new Error(`${name} must be a non-empty string`);
|
|
6727
|
+
}
|
|
6728
|
+
return value;
|
|
6729
|
+
}
|
|
6730
|
+
function isRunSessionFileProvider(value) {
|
|
6731
|
+
return RUN_SESSION_FILE_PROVIDERS.includes(value);
|
|
6732
|
+
}
|
|
6733
|
+
function parseRunSessionReadPayload(value) {
|
|
6734
|
+
const payload = objectValue6(value, "runs.session.read payload");
|
|
6735
|
+
const provider = stringValue6(payload.provider, "provider");
|
|
6736
|
+
if (!isRunSessionFileProvider(provider)) {
|
|
6737
|
+
throw new Error(`Unsupported session file provider: ${provider}`);
|
|
6738
|
+
}
|
|
6739
|
+
const nativeId = stringValue6(payload.nativeId, "nativeId");
|
|
6740
|
+
if (/[/\\]/.test(nativeId) || nativeId.includes("..")) {
|
|
6741
|
+
throw new Error("nativeId contains invalid path characters");
|
|
6742
|
+
}
|
|
6743
|
+
return {
|
|
6744
|
+
provider,
|
|
6745
|
+
nativeId,
|
|
6746
|
+
folder: stringValue6(payload.folder, "folder")
|
|
6747
|
+
};
|
|
6748
|
+
}
|
|
6749
|
+
|
|
6714
6750
|
// ../agent-contract/src/builds.ts
|
|
6715
6751
|
var IOS_SOURCE_DISCOVER_JOB_KIND = "ios.source.discover";
|
|
6716
6752
|
var IOS_SOURCE_PARSE_JOB_KIND = "ios.source.parse";
|
|
@@ -6796,20 +6832,20 @@ var DEFAULT_BUILD_ADVANCED_SETTINGS = {
|
|
|
6796
6832
|
priorXctestrunPath: null
|
|
6797
6833
|
};
|
|
6798
6834
|
var BUILD_REPORT_KINDS = ["TEST_RESULTS", "CODE_COVERAGE"];
|
|
6799
|
-
function
|
|
6835
|
+
function objectValue7(value, name) {
|
|
6800
6836
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
6801
6837
|
throw new Error(`${name} must be an object`);
|
|
6802
6838
|
}
|
|
6803
6839
|
return value;
|
|
6804
6840
|
}
|
|
6805
|
-
function
|
|
6841
|
+
function stringValue7(value, name) {
|
|
6806
6842
|
if (typeof value !== "string" || !value.trim()) {
|
|
6807
6843
|
throw new Error(`${name} must be a non-empty string`);
|
|
6808
6844
|
}
|
|
6809
6845
|
return value;
|
|
6810
6846
|
}
|
|
6811
6847
|
function nullableString4(value, name) {
|
|
6812
|
-
return value === null || value === void 0 ? null :
|
|
6848
|
+
return value === null || value === void 0 ? null : stringValue7(value, name);
|
|
6813
6849
|
}
|
|
6814
6850
|
function booleanValue2(value, name) {
|
|
6815
6851
|
if (typeof value !== "boolean") throw new Error(`${name} must be a boolean`);
|
|
@@ -6822,14 +6858,14 @@ function enumValue3(value, values, name) {
|
|
|
6822
6858
|
return value;
|
|
6823
6859
|
}
|
|
6824
6860
|
function safeRelativePath2(value, name) {
|
|
6825
|
-
const path =
|
|
6861
|
+
const path = stringValue7(value, name);
|
|
6826
6862
|
if (path.startsWith("/") || /^[A-Za-z]:[\\/]/.test(path) || path.split(/[\\/]/).includes("..") || path.includes("\0")) {
|
|
6827
6863
|
throw new Error(`${name} must stay within the worktree`);
|
|
6828
6864
|
}
|
|
6829
6865
|
return path.replaceAll("\\", "/");
|
|
6830
6866
|
}
|
|
6831
6867
|
function safeAbsolutePath(value, name) {
|
|
6832
|
-
const path =
|
|
6868
|
+
const path = stringValue7(value, name);
|
|
6833
6869
|
if (!path.startsWith("/") || path.split("/").includes("..") || path.includes("\0")) {
|
|
6834
6870
|
throw new Error(`${name} must be an absolute normalized path`);
|
|
6835
6871
|
}
|
|
@@ -6837,12 +6873,12 @@ function safeAbsolutePath(value, name) {
|
|
|
6837
6873
|
}
|
|
6838
6874
|
function worktreeIdentity(value) {
|
|
6839
6875
|
return {
|
|
6840
|
-
codebaseId:
|
|
6841
|
-
worktreeId:
|
|
6876
|
+
codebaseId: stringValue7(value.codebaseId, "build payload.codebaseId"),
|
|
6877
|
+
worktreeId: stringValue7(value.worktreeId, "build payload.worktreeId"),
|
|
6842
6878
|
branch: nullableString4(value.branch, "build payload.branch"),
|
|
6843
|
-
folder:
|
|
6844
|
-
gitDirectory:
|
|
6845
|
-
expectedOrigin:
|
|
6879
|
+
folder: stringValue7(value.folder, "build payload.folder"),
|
|
6880
|
+
gitDirectory: stringValue7(value.gitDirectory, "build payload.gitDirectory"),
|
|
6881
|
+
expectedOrigin: stringValue7(
|
|
6846
6882
|
value.expectedOrigin,
|
|
6847
6883
|
"build payload.expectedOrigin"
|
|
6848
6884
|
),
|
|
@@ -6851,7 +6887,7 @@ function worktreeIdentity(value) {
|
|
|
6851
6887
|
};
|
|
6852
6888
|
}
|
|
6853
6889
|
function parseBuildSource(value) {
|
|
6854
|
-
const source =
|
|
6890
|
+
const source = objectValue7(value, "build source");
|
|
6855
6891
|
const kind = enumValue3(source.kind, BUILD_SOURCE_KINDS, "build source.kind");
|
|
6856
6892
|
const relativePath = safeRelativePath2(
|
|
6857
6893
|
source.relativePath,
|
|
@@ -6869,16 +6905,16 @@ function parseBuildSource(value) {
|
|
|
6869
6905
|
return { kind, relativePath };
|
|
6870
6906
|
}
|
|
6871
6907
|
function parseBuildDestination(value) {
|
|
6872
|
-
const destination =
|
|
6908
|
+
const destination = objectValue7(value, "build destination");
|
|
6873
6909
|
return {
|
|
6874
6910
|
type: enumValue3(
|
|
6875
6911
|
destination.type,
|
|
6876
6912
|
BUILD_DESTINATION_TYPES,
|
|
6877
6913
|
"build destination.type"
|
|
6878
6914
|
),
|
|
6879
|
-
id:
|
|
6880
|
-
name:
|
|
6881
|
-
platform:
|
|
6915
|
+
id: stringValue7(destination.id, "build destination.id"),
|
|
6916
|
+
name: stringValue7(destination.name, "build destination.name"),
|
|
6917
|
+
platform: stringValue7(destination.platform, "build destination.platform"),
|
|
6882
6918
|
osVersion: nullableString4(
|
|
6883
6919
|
destination.osVersion,
|
|
6884
6920
|
"build destination.osVersion"
|
|
@@ -6894,14 +6930,14 @@ function parseBuildDestination(value) {
|
|
|
6894
6930
|
}
|
|
6895
6931
|
function stringArray2(value, name) {
|
|
6896
6932
|
if (!Array.isArray(value)) throw new Error(`${name} must be an array`);
|
|
6897
|
-
return value.map((item, index) =>
|
|
6933
|
+
return value.map((item, index) => stringValue7(item, `${name}[${index}]`));
|
|
6898
6934
|
}
|
|
6899
6935
|
function parseBuildAdvancedSettings(value) {
|
|
6900
6936
|
const input = {
|
|
6901
6937
|
...DEFAULT_BUILD_ADVANCED_SETTINGS,
|
|
6902
|
-
...
|
|
6938
|
+
...objectValue7(value ?? {}, "advanced settings")
|
|
6903
6939
|
};
|
|
6904
|
-
const overrides =
|
|
6940
|
+
const overrides = objectValue7(
|
|
6905
6941
|
input.buildSettingOverrides ?? {},
|
|
6906
6942
|
"advanced settings.buildSettingOverrides"
|
|
6907
6943
|
);
|
|
@@ -6910,7 +6946,7 @@ function parseBuildAdvancedSettings(value) {
|
|
|
6910
6946
|
if (!APPROVED_BUILD_SETTING_OVERRIDES.includes(key)) {
|
|
6911
6947
|
throw new Error(`Build setting override ${key} is not approved`);
|
|
6912
6948
|
}
|
|
6913
|
-
buildSettingOverrides[key] =
|
|
6949
|
+
buildSettingOverrides[key] = stringValue7(
|
|
6914
6950
|
rawValue,
|
|
6915
6951
|
`advanced settings.buildSettingOverrides.${key}`
|
|
6916
6952
|
);
|
|
@@ -7002,7 +7038,7 @@ function parseBuildAdvancedSettings(value) {
|
|
|
7002
7038
|
};
|
|
7003
7039
|
}
|
|
7004
7040
|
function parseScript(value, index) {
|
|
7005
|
-
const script =
|
|
7041
|
+
const script = objectValue7(value, `build scripts[${index}]`);
|
|
7006
7042
|
const timeout = script.timeoutSeconds;
|
|
7007
7043
|
const position = script.position;
|
|
7008
7044
|
if (typeof timeout !== "number" || !Number.isInteger(timeout) || timeout < 1 || timeout > 3600) {
|
|
@@ -7012,8 +7048,8 @@ function parseScript(value, index) {
|
|
|
7012
7048
|
throw new Error(`build scripts[${index}].position is invalid`);
|
|
7013
7049
|
}
|
|
7014
7050
|
return {
|
|
7015
|
-
id:
|
|
7016
|
-
name:
|
|
7051
|
+
id: stringValue7(script.id, `build scripts[${index}].id`),
|
|
7052
|
+
name: stringValue7(script.name, `build scripts[${index}].name`),
|
|
7017
7053
|
preBuildScript: nullableString4(
|
|
7018
7054
|
script.preBuildScript,
|
|
7019
7055
|
`build scripts[${index}].preBuildScript`
|
|
@@ -7032,7 +7068,7 @@ function parseScript(value, index) {
|
|
|
7032
7068
|
};
|
|
7033
7069
|
}
|
|
7034
7070
|
function httpUrl(value, name) {
|
|
7035
|
-
const text2 =
|
|
7071
|
+
const text2 = stringValue7(value, name);
|
|
7036
7072
|
let url;
|
|
7037
7073
|
try {
|
|
7038
7074
|
url = new URL(text2);
|
|
@@ -7046,7 +7082,7 @@ function httpUrl(value, name) {
|
|
|
7046
7082
|
}
|
|
7047
7083
|
function parseBuildTelemetrySettings(value) {
|
|
7048
7084
|
if (value === void 0 || value === null) return void 0;
|
|
7049
|
-
const input =
|
|
7085
|
+
const input = objectValue7(value, "build job payload.telemetry");
|
|
7050
7086
|
return {
|
|
7051
7087
|
localBaseUrl: httpUrl(
|
|
7052
7088
|
input.localBaseUrl,
|
|
@@ -7079,10 +7115,10 @@ function parseBuildTelemetrySettings(value) {
|
|
|
7079
7115
|
};
|
|
7080
7116
|
}
|
|
7081
7117
|
function parseBuildSourceDiscoverPayload(value) {
|
|
7082
|
-
return worktreeIdentity(
|
|
7118
|
+
return worktreeIdentity(objectValue7(value, "source discovery payload"));
|
|
7083
7119
|
}
|
|
7084
7120
|
function parseBuildSourceParsePayload(value) {
|
|
7085
|
-
const input =
|
|
7121
|
+
const input = objectValue7(value, "source parse payload");
|
|
7086
7122
|
return {
|
|
7087
7123
|
...worktreeIdentity(input),
|
|
7088
7124
|
source: parseBuildSource(input.source),
|
|
@@ -7094,12 +7130,12 @@ function parseBuildSourceParsePayload(value) {
|
|
|
7094
7130
|
};
|
|
7095
7131
|
}
|
|
7096
7132
|
function parseBuildDestinationsPayload(value) {
|
|
7097
|
-
const input =
|
|
7133
|
+
const input = objectValue7(value, "destinations payload");
|
|
7098
7134
|
return {
|
|
7099
7135
|
...worktreeIdentity(input),
|
|
7100
7136
|
source: parseBuildSource(input.source),
|
|
7101
|
-
scheme:
|
|
7102
|
-
configuration:
|
|
7137
|
+
scheme: stringValue7(input.scheme, "destinations payload.scheme"),
|
|
7138
|
+
configuration: stringValue7(
|
|
7103
7139
|
input.configuration,
|
|
7104
7140
|
"destinations payload.configuration"
|
|
7105
7141
|
),
|
|
@@ -7111,7 +7147,7 @@ function parseBuildDestinationsPayload(value) {
|
|
|
7111
7147
|
};
|
|
7112
7148
|
}
|
|
7113
7149
|
function parseBuildRunDestinationsPayload(value) {
|
|
7114
|
-
const input =
|
|
7150
|
+
const input = objectValue7(value, "run destinations payload");
|
|
7115
7151
|
return {
|
|
7116
7152
|
...worktreeIdentity(input),
|
|
7117
7153
|
destinationType: enumValue3(
|
|
@@ -7122,7 +7158,7 @@ function parseBuildRunDestinationsPayload(value) {
|
|
|
7122
7158
|
};
|
|
7123
7159
|
}
|
|
7124
7160
|
function parseBuildJobPayload(value) {
|
|
7125
|
-
const input =
|
|
7161
|
+
const input = objectValue7(value, "build job payload");
|
|
7126
7162
|
if (!Array.isArray(input.scripts)) {
|
|
7127
7163
|
throw new Error("build job payload.scripts must be an array");
|
|
7128
7164
|
}
|
|
@@ -7150,14 +7186,14 @@ function parseBuildJobPayload(value) {
|
|
|
7150
7186
|
}
|
|
7151
7187
|
return {
|
|
7152
7188
|
...worktreeIdentity(input),
|
|
7153
|
-
buildId:
|
|
7154
|
-
artifactDirectory:
|
|
7189
|
+
buildId: stringValue7(input.buildId, "build job payload.buildId"),
|
|
7190
|
+
artifactDirectory: stringValue7(
|
|
7155
7191
|
input.artifactDirectory,
|
|
7156
7192
|
"build job payload.artifactDirectory"
|
|
7157
7193
|
),
|
|
7158
7194
|
source: parseBuildSource(input.source),
|
|
7159
|
-
scheme:
|
|
7160
|
-
configuration:
|
|
7195
|
+
scheme: stringValue7(input.scheme, "build job payload.scheme"),
|
|
7196
|
+
configuration: stringValue7(
|
|
7161
7197
|
input.configuration,
|
|
7162
7198
|
"build job payload.configuration"
|
|
7163
7199
|
),
|
|
@@ -7173,7 +7209,7 @@ function parseBuildJobPayload(value) {
|
|
|
7173
7209
|
};
|
|
7174
7210
|
}
|
|
7175
7211
|
function parseBuildReportPayload(value) {
|
|
7176
|
-
const input =
|
|
7212
|
+
const input = objectValue7(value, "build report payload");
|
|
7177
7213
|
return {
|
|
7178
7214
|
...parseBuildDeletePayload(input),
|
|
7179
7215
|
reportKind: enumValue3(
|
|
@@ -7189,8 +7225,8 @@ function parseBuildReportPayload(value) {
|
|
|
7189
7225
|
};
|
|
7190
7226
|
}
|
|
7191
7227
|
function parseBuildDeletePayload(value) {
|
|
7192
|
-
const input =
|
|
7193
|
-
const buildId =
|
|
7228
|
+
const input = objectValue7(value, "build delete payload");
|
|
7229
|
+
const buildId = stringValue7(input.buildId, "build delete payload.buildId");
|
|
7194
7230
|
const artifactDirectory = safeAbsolutePath(
|
|
7195
7231
|
input.artifactDirectory,
|
|
7196
7232
|
"build delete payload.artifactDirectory"
|
|
@@ -7201,14 +7237,14 @@ function parseBuildDeletePayload(value) {
|
|
|
7201
7237
|
return {
|
|
7202
7238
|
buildId,
|
|
7203
7239
|
artifactDirectory,
|
|
7204
|
-
codebaseId:
|
|
7240
|
+
codebaseId: stringValue7(
|
|
7205
7241
|
input.codebaseId,
|
|
7206
7242
|
"build delete payload.codebaseId"
|
|
7207
7243
|
)
|
|
7208
7244
|
};
|
|
7209
7245
|
}
|
|
7210
7246
|
function parseBuildArtifactDownloadPayload(value) {
|
|
7211
|
-
const input =
|
|
7247
|
+
const input = objectValue7(value, "build artifact download payload");
|
|
7212
7248
|
const identity = parseBuildDeletePayload(input);
|
|
7213
7249
|
return {
|
|
7214
7250
|
...identity,
|
|
@@ -7216,21 +7252,21 @@ function parseBuildArtifactDownloadPayload(value) {
|
|
|
7216
7252
|
input.artifactRelativePath,
|
|
7217
7253
|
"build artifact download payload.artifactRelativePath"
|
|
7218
7254
|
),
|
|
7219
|
-
uploadId:
|
|
7255
|
+
uploadId: stringValue7(
|
|
7220
7256
|
input.uploadId,
|
|
7221
7257
|
"build artifact download payload.uploadId"
|
|
7222
7258
|
)
|
|
7223
7259
|
};
|
|
7224
7260
|
}
|
|
7225
7261
|
function parseBuildDeploymentPayload(value) {
|
|
7226
|
-
const input =
|
|
7262
|
+
const input = objectValue7(value, "build deployment payload");
|
|
7227
7263
|
if (!Array.isArray(input.deployments) || !input.deployments.length) {
|
|
7228
7264
|
throw new Error("build deployment payload.deployments must not be empty");
|
|
7229
7265
|
}
|
|
7230
7266
|
const deployments = input.deployments.map((value2, index) => {
|
|
7231
|
-
const deployment =
|
|
7267
|
+
const deployment = objectValue7(value2, `deployments[${index}]`);
|
|
7232
7268
|
return {
|
|
7233
|
-
id:
|
|
7269
|
+
id: stringValue7(deployment.id, `deployments[${index}].id`),
|
|
7234
7270
|
destination: parseBuildDestination(deployment.destination)
|
|
7235
7271
|
};
|
|
7236
7272
|
});
|
|
@@ -7249,8 +7285,8 @@ function parseBuildDeploymentPayload(value) {
|
|
|
7249
7285
|
}
|
|
7250
7286
|
return {
|
|
7251
7287
|
...worktreeIdentity(input),
|
|
7252
|
-
buildId:
|
|
7253
|
-
artifactDirectory:
|
|
7288
|
+
buildId: stringValue7(input.buildId, "build deployment payload.buildId"),
|
|
7289
|
+
artifactDirectory: stringValue7(
|
|
7254
7290
|
input.artifactDirectory,
|
|
7255
7291
|
"build deployment payload.artifactDirectory"
|
|
7256
7292
|
),
|
|
@@ -7258,7 +7294,7 @@ function parseBuildDeploymentPayload(value) {
|
|
|
7258
7294
|
input.artifactRelativePath,
|
|
7259
7295
|
"build deployment payload.artifactRelativePath"
|
|
7260
7296
|
),
|
|
7261
|
-
bundleIdentifier:
|
|
7297
|
+
bundleIdentifier: stringValue7(
|
|
7262
7298
|
input.bundleIdentifier,
|
|
7263
7299
|
"build deployment payload.bundleIdentifier"
|
|
7264
7300
|
),
|
|
@@ -7266,8 +7302,8 @@ function parseBuildDeploymentPayload(value) {
|
|
|
7266
7302
|
};
|
|
7267
7303
|
}
|
|
7268
7304
|
function parseBuildExportSettings(value) {
|
|
7269
|
-
const input =
|
|
7270
|
-
const profiles =
|
|
7305
|
+
const input = objectValue7(value, "export settings");
|
|
7306
|
+
const profiles = objectValue7(
|
|
7271
7307
|
input.provisioningProfiles ?? {},
|
|
7272
7308
|
"export settings.provisioningProfiles"
|
|
7273
7309
|
);
|
|
@@ -7294,8 +7330,8 @@ function parseBuildExportSettings(value) {
|
|
|
7294
7330
|
),
|
|
7295
7331
|
provisioningProfiles: Object.fromEntries(
|
|
7296
7332
|
Object.entries(profiles).map(([key, profile]) => [
|
|
7297
|
-
|
|
7298
|
-
|
|
7333
|
+
stringValue7(key, "export settings provisioning profile bundle id"),
|
|
7334
|
+
stringValue7(profile, `export settings.provisioningProfiles.${key}`)
|
|
7299
7335
|
])
|
|
7300
7336
|
),
|
|
7301
7337
|
uploadSymbols: booleanValue2(
|
|
@@ -7330,12 +7366,12 @@ function parseBuildExportSettings(value) {
|
|
|
7330
7366
|
};
|
|
7331
7367
|
}
|
|
7332
7368
|
function parseBuildExportPayload(value) {
|
|
7333
|
-
const input =
|
|
7369
|
+
const input = objectValue7(value, "build export payload");
|
|
7334
7370
|
return {
|
|
7335
7371
|
...worktreeIdentity(input),
|
|
7336
|
-
buildId:
|
|
7337
|
-
exportId:
|
|
7338
|
-
artifactDirectory:
|
|
7372
|
+
buildId: stringValue7(input.buildId, "build export payload.buildId"),
|
|
7373
|
+
exportId: stringValue7(input.exportId, "build export payload.exportId"),
|
|
7374
|
+
artifactDirectory: stringValue7(
|
|
7339
7375
|
input.artifactDirectory,
|
|
7340
7376
|
"build export payload.artifactDirectory"
|
|
7341
7377
|
),
|
|
@@ -7352,14 +7388,14 @@ function provisioningProfileType(profile) {
|
|
|
7352
7388
|
return profile.hasProvisionedDevices ? "AD_HOC" : "APP_STORE";
|
|
7353
7389
|
}
|
|
7354
7390
|
function parseBuildSigningInspectPayload(value) {
|
|
7355
|
-
const input =
|
|
7391
|
+
const input = objectValue7(value, "build signing payload");
|
|
7356
7392
|
return {
|
|
7357
|
-
buildId:
|
|
7358
|
-
codebaseId:
|
|
7393
|
+
buildId: stringValue7(input.buildId, "build signing payload.buildId"),
|
|
7394
|
+
codebaseId: stringValue7(
|
|
7359
7395
|
input.codebaseId,
|
|
7360
7396
|
"build signing payload.codebaseId"
|
|
7361
7397
|
),
|
|
7362
|
-
artifactDirectory:
|
|
7398
|
+
artifactDirectory: stringValue7(
|
|
7363
7399
|
input.artifactDirectory,
|
|
7364
7400
|
"build signing payload.artifactDirectory"
|
|
7365
7401
|
),
|
|
@@ -7385,13 +7421,13 @@ var SIGNING_ASSET_JOB_KINDS = [
|
|
|
7385
7421
|
SIGNING_IDENTITY_IMPORT_JOB_KIND,
|
|
7386
7422
|
SIGNING_IDENTITY_DELETE_JOB_KIND
|
|
7387
7423
|
];
|
|
7388
|
-
function
|
|
7424
|
+
function objectValue8(value, name) {
|
|
7389
7425
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
7390
7426
|
throw new Error(`${name} must be an object`);
|
|
7391
7427
|
}
|
|
7392
7428
|
return value;
|
|
7393
7429
|
}
|
|
7394
|
-
function
|
|
7430
|
+
function stringValue8(value, name) {
|
|
7395
7431
|
if (typeof value !== "string" || !value.trim() || value.includes("\0")) {
|
|
7396
7432
|
throw new Error(`${name} must be a non-empty string`);
|
|
7397
7433
|
}
|
|
@@ -7402,19 +7438,19 @@ function exactKeys2(value, allowed, name) {
|
|
|
7402
7438
|
if (unexpected) throw new Error(`Unexpected ${name} field: ${unexpected}`);
|
|
7403
7439
|
}
|
|
7404
7440
|
function signingScanPayload(value) {
|
|
7405
|
-
const input =
|
|
7441
|
+
const input = objectValue8(value, "signing scan payload");
|
|
7406
7442
|
exactKeys2(input, [], "signing scan payload");
|
|
7407
7443
|
return {};
|
|
7408
7444
|
}
|
|
7409
7445
|
function signingProfileKeyPayload(value) {
|
|
7410
|
-
const input =
|
|
7446
|
+
const input = objectValue8(value, "signing profile payload");
|
|
7411
7447
|
exactKeys2(input, ["uuid"], "signing profile payload");
|
|
7412
|
-
return { uuid:
|
|
7448
|
+
return { uuid: stringValue8(input.uuid, "signing profile payload.uuid") };
|
|
7413
7449
|
}
|
|
7414
7450
|
function signingProfileInstallPayload(value) {
|
|
7415
|
-
const input =
|
|
7451
|
+
const input = objectValue8(value, "signing profile install payload");
|
|
7416
7452
|
exactKeys2(input, ["contentBase64"], "signing profile install payload");
|
|
7417
|
-
const contentBase64 =
|
|
7453
|
+
const contentBase64 = stringValue8(
|
|
7418
7454
|
input.contentBase64,
|
|
7419
7455
|
"signing profile install payload.contentBase64"
|
|
7420
7456
|
);
|
|
@@ -7424,21 +7460,21 @@ function signingProfileInstallPayload(value) {
|
|
|
7424
7460
|
return { contentBase64 };
|
|
7425
7461
|
}
|
|
7426
7462
|
function signingIdentityImportPayload(value) {
|
|
7427
|
-
const input =
|
|
7463
|
+
const input = objectValue8(value, "signing identity import payload");
|
|
7428
7464
|
exactKeys2(input, ["transferId", "sha256"], "signing identity import payload");
|
|
7429
|
-
const sha256 =
|
|
7465
|
+
const sha256 = stringValue8(input.sha256, "signing identity import sha256");
|
|
7430
7466
|
if (!/^[A-Fa-f0-9]{64}$/.test(sha256)) {
|
|
7431
7467
|
throw new Error("Signing identity import SHA-256 is invalid");
|
|
7432
7468
|
}
|
|
7433
7469
|
return {
|
|
7434
|
-
transferId:
|
|
7470
|
+
transferId: stringValue8(input.transferId, "signing identity transfer ID"),
|
|
7435
7471
|
sha256: sha256.toUpperCase()
|
|
7436
7472
|
};
|
|
7437
7473
|
}
|
|
7438
7474
|
function signingIdentityDeletePayload(value) {
|
|
7439
|
-
const input =
|
|
7475
|
+
const input = objectValue8(value, "signing identity delete payload");
|
|
7440
7476
|
exactKeys2(input, ["sha1"], "signing identity delete payload");
|
|
7441
|
-
const sha1 =
|
|
7477
|
+
const sha1 = stringValue8(input.sha1, "signing identity SHA-1");
|
|
7442
7478
|
if (!/^[A-Fa-f0-9]{40}$/.test(sha1)) {
|
|
7443
7479
|
throw new Error("Signing identity SHA-1 is invalid");
|
|
7444
7480
|
}
|
|
@@ -7460,7 +7496,8 @@ var AGENT_CAPABILITIES = [
|
|
|
7460
7496
|
"runs.protocol.v1",
|
|
7461
7497
|
"runs.provider.codex",
|
|
7462
7498
|
"runs.provider.claude",
|
|
7463
|
-
"runs.provider.opencode"
|
|
7499
|
+
"runs.provider.opencode",
|
|
7500
|
+
RUN_SESSION_READ_JOB_KIND
|
|
7464
7501
|
];
|
|
7465
7502
|
function collectInventory() {
|
|
7466
7503
|
const disk = statfsSync("/", { bigint: true });
|
|
@@ -9949,11 +9986,92 @@ var applySkills = async (payload) => {
|
|
|
9949
9986
|
return { ...successfulProcess4, results };
|
|
9950
9987
|
};
|
|
9951
9988
|
|
|
9989
|
+
// src/handlers/runs.ts
|
|
9990
|
+
import { readFile as readFile4, readdir as readdir5, stat as stat5 } from "node:fs/promises";
|
|
9991
|
+
import { homedir as homedir6 } from "node:os";
|
|
9992
|
+
import { join as join6 } from "node:path";
|
|
9993
|
+
var successfulProcess5 = {
|
|
9994
|
+
exitCode: 0,
|
|
9995
|
+
signal: null,
|
|
9996
|
+
timedOut: false,
|
|
9997
|
+
cancelled: false
|
|
9998
|
+
};
|
|
9999
|
+
async function fileExists(path) {
|
|
10000
|
+
try {
|
|
10001
|
+
return (await stat5(path)).isFile();
|
|
10002
|
+
} catch {
|
|
10003
|
+
return false;
|
|
10004
|
+
}
|
|
10005
|
+
}
|
|
10006
|
+
async function findClaudeSessionFile(nativeId, home) {
|
|
10007
|
+
const projectsDir = join6(home, ".claude", "projects");
|
|
10008
|
+
let entries;
|
|
10009
|
+
try {
|
|
10010
|
+
entries = await readdir5(projectsDir, { withFileTypes: true });
|
|
10011
|
+
} catch {
|
|
10012
|
+
return null;
|
|
10013
|
+
}
|
|
10014
|
+
const target2 = `${nativeId}.jsonl`;
|
|
10015
|
+
for (const entry of entries) {
|
|
10016
|
+
if (!entry.isDirectory()) continue;
|
|
10017
|
+
const candidate = join6(projectsDir, entry.name, target2);
|
|
10018
|
+
if (await fileExists(candidate)) return candidate;
|
|
10019
|
+
}
|
|
10020
|
+
return null;
|
|
10021
|
+
}
|
|
10022
|
+
async function findCodexSessionFile(nativeId, home) {
|
|
10023
|
+
const sessionsDir = join6(home, ".codex", "sessions");
|
|
10024
|
+
const suffix = `-${nativeId}.jsonl`;
|
|
10025
|
+
const walk = async (dir) => {
|
|
10026
|
+
let entries;
|
|
10027
|
+
try {
|
|
10028
|
+
entries = await readdir5(dir, { withFileTypes: true });
|
|
10029
|
+
} catch {
|
|
10030
|
+
return null;
|
|
10031
|
+
}
|
|
10032
|
+
for (const entry of entries) {
|
|
10033
|
+
const path = join6(dir, entry.name);
|
|
10034
|
+
if (entry.isDirectory()) {
|
|
10035
|
+
const found = await walk(path);
|
|
10036
|
+
if (found) return found;
|
|
10037
|
+
} else if (entry.isFile() && entry.name.endsWith(suffix)) {
|
|
10038
|
+
return path;
|
|
10039
|
+
}
|
|
10040
|
+
}
|
|
10041
|
+
return null;
|
|
10042
|
+
};
|
|
10043
|
+
return walk(sessionsDir);
|
|
10044
|
+
}
|
|
10045
|
+
async function locateSessionFile(payload, home) {
|
|
10046
|
+
return payload.provider === "CLAUDE" ? findClaudeSessionFile(payload.nativeId, home) : findCodexSessionFile(payload.nativeId, home);
|
|
10047
|
+
}
|
|
10048
|
+
var readRunSession = async (payload) => {
|
|
10049
|
+
const input = parseRunSessionReadPayload(payload);
|
|
10050
|
+
const path = await locateSessionFile(input, homedir6());
|
|
10051
|
+
if (!path) {
|
|
10052
|
+
throw new Error(
|
|
10053
|
+
`No ${input.provider === "CLAUDE" ? "Claude" : "Codex"} session file found for this run on this agent`
|
|
10054
|
+
);
|
|
10055
|
+
}
|
|
10056
|
+
const { size } = await stat5(path);
|
|
10057
|
+
if (size > MAX_RUN_SESSION_FILE_BYTES) {
|
|
10058
|
+
throw new Error(
|
|
10059
|
+
`Session file is too large to export (${size} bytes exceeds the ${MAX_RUN_SESSION_FILE_BYTES} byte limit)`
|
|
10060
|
+
);
|
|
10061
|
+
}
|
|
10062
|
+
const contents = await readFile4(path);
|
|
10063
|
+
return {
|
|
10064
|
+
...successfulProcess5,
|
|
10065
|
+
filename: path.split("/").at(-1) ?? `${input.nativeId}.jsonl`,
|
|
10066
|
+
contentBase64: contents.toString("base64")
|
|
10067
|
+
};
|
|
10068
|
+
};
|
|
10069
|
+
|
|
9952
10070
|
// src/handlers/worktrees.ts
|
|
9953
10071
|
import { createWriteStream, watch } from "node:fs";
|
|
9954
|
-
import { mkdtemp as mkdtemp2, open, readFile as
|
|
10072
|
+
import { mkdtemp as mkdtemp2, open, readFile as readFile5, realpath as realpath4, rm as rm5, stat as stat6 } from "node:fs/promises";
|
|
9955
10073
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
9956
|
-
import { basename as basename3, dirname as dirname5, join as
|
|
10074
|
+
import { basename as basename3, dirname as dirname5, join as join7, relative as relative4 } from "node:path";
|
|
9957
10075
|
import { spawn as spawn4 } from "node:child_process";
|
|
9958
10076
|
|
|
9959
10077
|
// src/git-code-state.ts
|
|
@@ -10148,7 +10266,7 @@ async function worktreeCodeStateHash(folder, timeoutMs, signal) {
|
|
|
10148
10266
|
}
|
|
10149
10267
|
|
|
10150
10268
|
// src/handlers/worktrees.ts
|
|
10151
|
-
var
|
|
10269
|
+
var successfulProcess6 = {
|
|
10152
10270
|
exitCode: 0,
|
|
10153
10271
|
signal: null,
|
|
10154
10272
|
timedOut: false,
|
|
@@ -10363,7 +10481,7 @@ async function origin(folder, timeoutMs, signal) {
|
|
|
10363
10481
|
}
|
|
10364
10482
|
async function validateWorktree(input, timeoutMs, signal) {
|
|
10365
10483
|
const folder = await realpath4(input.folder);
|
|
10366
|
-
if (!(await
|
|
10484
|
+
if (!(await stat6(folder)).isDirectory())
|
|
10367
10485
|
throw new Error("Worktree is missing");
|
|
10368
10486
|
const observedGitDirectory = await gitDirectory(folder, timeoutMs, signal);
|
|
10369
10487
|
if (observedGitDirectory !== input.gitDirectory) {
|
|
@@ -10590,9 +10708,9 @@ function parseNumstat(value) {
|
|
|
10590
10708
|
}
|
|
10591
10709
|
async function untrackedLines(folder, path) {
|
|
10592
10710
|
try {
|
|
10593
|
-
const file = await
|
|
10711
|
+
const file = await stat6(`${folder}/${path}`);
|
|
10594
10712
|
if (!file.isFile() || file.size > 1024 * 1024) return null;
|
|
10595
|
-
const contents = await
|
|
10713
|
+
const contents = await readFile5(`${folder}/${path}`);
|
|
10596
10714
|
if (contents.includes(0)) return null;
|
|
10597
10715
|
const text2 = contents.toString("utf8");
|
|
10598
10716
|
return text2 ? text2.split("\n").length - (text2.endsWith("\n") ? 1 : 0) : 0;
|
|
@@ -10801,7 +10919,7 @@ async function comparisonSides(input, folder, timeoutMs, signal) {
|
|
|
10801
10919
|
if (!input.path) return { before: null, after: null };
|
|
10802
10920
|
const path = input.path;
|
|
10803
10921
|
const previousPath = input.previousPath ?? path;
|
|
10804
|
-
const currentPath =
|
|
10922
|
+
const currentPath = join7(folder, path);
|
|
10805
10923
|
if (input.scope === "UNTRACKED") {
|
|
10806
10924
|
return { before: null, after: { kind: "FILE", path: currentPath } };
|
|
10807
10925
|
}
|
|
@@ -10886,7 +11004,7 @@ async function availableSide(side, folder, timeoutMs, signal) {
|
|
|
10886
11004
|
try {
|
|
10887
11005
|
const resolved = await realpath4(side.path);
|
|
10888
11006
|
const difference = relative4(folder, resolved);
|
|
10889
|
-
return difference !== ".." && !difference.startsWith("../") && (await
|
|
11007
|
+
return difference !== ".." && !difference.startsWith("../") && (await stat6(resolved)).isFile();
|
|
10890
11008
|
} catch {
|
|
10891
11009
|
return false;
|
|
10892
11010
|
}
|
|
@@ -10957,7 +11075,7 @@ async function inspectRequestedDiff(input, folder, timeoutMs, signal) {
|
|
|
10957
11075
|
let patch;
|
|
10958
11076
|
if (input.scope === "UNTRACKED") {
|
|
10959
11077
|
const bounded = await readBoundedFile(
|
|
10960
|
-
|
|
11078
|
+
join7(folder, input.path),
|
|
10961
11079
|
MAX_DIFF_BYTES
|
|
10962
11080
|
);
|
|
10963
11081
|
const contents = bounded.contents;
|
|
@@ -11043,7 +11161,7 @@ var inspectWorktreeDiff = async (payload, timeoutMs, signal) => {
|
|
|
11043
11161
|
const input = worktreeDiffPayload(payload);
|
|
11044
11162
|
const folder = await validateWorktree(input, timeoutMs, signal);
|
|
11045
11163
|
return {
|
|
11046
|
-
...
|
|
11164
|
+
...successfulProcess6,
|
|
11047
11165
|
diff: await inspectRequestedDiff(input, folder, timeoutMs, signal)
|
|
11048
11166
|
};
|
|
11049
11167
|
};
|
|
@@ -11145,8 +11263,8 @@ var downloadWorktreeDiffAsset = async (payload, timeoutMs, signal, _onLog, conte
|
|
|
11145
11263
|
if (!/^\d+$/.test(size) || Number(size) > 20 * 1024 * 1024) {
|
|
11146
11264
|
throw new Error("Diff image exceeds the 20 MiB limit");
|
|
11147
11265
|
}
|
|
11148
|
-
temporaryDirectory = await mkdtemp2(
|
|
11149
|
-
uploadPath =
|
|
11266
|
+
temporaryDirectory = await mkdtemp2(join7(tmpdir2(), "ade-diff-image-"));
|
|
11267
|
+
uploadPath = join7(temporaryDirectory, basename3(input.path));
|
|
11150
11268
|
await writeGitObject(
|
|
11151
11269
|
folder,
|
|
11152
11270
|
selected.specification,
|
|
@@ -11155,7 +11273,7 @@ var downloadWorktreeDiffAsset = async (payload, timeoutMs, signal, _onLog, conte
|
|
|
11155
11273
|
signal
|
|
11156
11274
|
);
|
|
11157
11275
|
}
|
|
11158
|
-
const information = await
|
|
11276
|
+
const information = await stat6(uploadPath);
|
|
11159
11277
|
if (!information.isFile() || information.size > 20 * 1024 * 1024) {
|
|
11160
11278
|
throw new Error("Diff image exceeds the 20 MiB limit");
|
|
11161
11279
|
}
|
|
@@ -11165,7 +11283,7 @@ var downloadWorktreeDiffAsset = async (payload, timeoutMs, signal, _onLog, conte
|
|
|
11165
11283
|
filename: basename3(input.path),
|
|
11166
11284
|
contentType: imageContentType(input.path)
|
|
11167
11285
|
});
|
|
11168
|
-
return
|
|
11286
|
+
return successfulProcess6;
|
|
11169
11287
|
} finally {
|
|
11170
11288
|
if (temporaryDirectory) {
|
|
11171
11289
|
await rm5(temporaryDirectory, { recursive: true, force: true });
|
|
@@ -11180,11 +11298,11 @@ var watchWorktree = async (payload, timeoutMs, signal, _onLog, context) => {
|
|
|
11180
11298
|
closeWorktreeWatch(current);
|
|
11181
11299
|
activeWorktreeWatches.delete(input.gitDirectory);
|
|
11182
11300
|
}
|
|
11183
|
-
return
|
|
11301
|
+
return successfulProcess6;
|
|
11184
11302
|
}
|
|
11185
11303
|
if (!context) throw new Error("Worktree activity reporting is unavailable");
|
|
11186
11304
|
const folder = await validateWorktree(input, timeoutMs, signal);
|
|
11187
|
-
if (current?.watchId === input.watchId) return
|
|
11305
|
+
if (current?.watchId === input.watchId) return successfulProcess6;
|
|
11188
11306
|
if (current) {
|
|
11189
11307
|
closeWorktreeWatch(current);
|
|
11190
11308
|
activeWorktreeWatches.delete(input.gitDirectory);
|
|
@@ -11226,14 +11344,14 @@ var watchWorktree = async (payload, timeoutMs, signal, _onLog, context) => {
|
|
|
11226
11344
|
activeWorktreeWatches.delete(input.gitDirectory);
|
|
11227
11345
|
throw error;
|
|
11228
11346
|
}
|
|
11229
|
-
return
|
|
11347
|
+
return successfulProcess6;
|
|
11230
11348
|
};
|
|
11231
11349
|
var inspectWorktree = async (payload, timeoutMs, signal) => {
|
|
11232
11350
|
const input = worktreeJobPayload(payload);
|
|
11233
11351
|
const folder = await validateWorktree(input, timeoutMs, signal);
|
|
11234
11352
|
if (!input.baseBranch) throw new Error("A base branch is required");
|
|
11235
11353
|
return {
|
|
11236
|
-
...
|
|
11354
|
+
...successfulProcess6,
|
|
11237
11355
|
detail: await inspectWorktreeDetail(
|
|
11238
11356
|
folder,
|
|
11239
11357
|
input.baseBranch,
|
|
@@ -11306,7 +11424,7 @@ async function chooseNewBranch(folder, candidates, allowedCurrentBranch, timeout
|
|
|
11306
11424
|
}
|
|
11307
11425
|
async function validateBranchRoot(input, timeoutMs, signal) {
|
|
11308
11426
|
const rootFolder = await realpath4(input.rootFolder);
|
|
11309
|
-
if (!(await
|
|
11427
|
+
if (!(await stat6(rootFolder)).isDirectory()) {
|
|
11310
11428
|
throw new Error("Base repository is missing");
|
|
11311
11429
|
}
|
|
11312
11430
|
if (await origin(rootFolder, timeoutMs, signal) !== input.expectedOrigin) {
|
|
@@ -11369,13 +11487,13 @@ var branchWorktree = async (payload, timeoutMs, signal) => {
|
|
|
11369
11487
|
timeoutMs,
|
|
11370
11488
|
signal
|
|
11371
11489
|
) : input.candidates[0];
|
|
11372
|
-
const targetFolder = input.action === "CREATE" ?
|
|
11490
|
+
const targetFolder = input.action === "CREATE" ? join7(
|
|
11373
11491
|
dirname5(rootFolder),
|
|
11374
11492
|
`${basename3(rootFolder)}-${branch.replaceAll("/", "-")}`
|
|
11375
11493
|
) : changeFolder;
|
|
11376
11494
|
if (input.action === "CREATE") {
|
|
11377
11495
|
try {
|
|
11378
|
-
await
|
|
11496
|
+
await stat6(targetFolder);
|
|
11379
11497
|
throw new Error(`Worktree folder already exists: ${targetFolder}`);
|
|
11380
11498
|
} catch (error) {
|
|
11381
11499
|
if (!(error instanceof Error) || !("code" in error) || error.code !== "ENOENT") {
|
|
@@ -11464,7 +11582,7 @@ var branchWorktree = async (payload, timeoutMs, signal) => {
|
|
|
11464
11582
|
throw new Error(worktree.error || "Could not inspect the updated worktree");
|
|
11465
11583
|
}
|
|
11466
11584
|
return {
|
|
11467
|
-
...
|
|
11585
|
+
...successfulProcess6,
|
|
11468
11586
|
worktree,
|
|
11469
11587
|
branch,
|
|
11470
11588
|
baseBranch: input.baseBranch,
|
|
@@ -11519,7 +11637,7 @@ var pushMovedWorktree = async (payload, timeoutMs, signal) => {
|
|
|
11519
11637
|
throw new Error("The source branch changed while it was being pushed");
|
|
11520
11638
|
}
|
|
11521
11639
|
return {
|
|
11522
|
-
...
|
|
11640
|
+
...successfulProcess6,
|
|
11523
11641
|
moveId: input.moveId,
|
|
11524
11642
|
branch,
|
|
11525
11643
|
headSha: pushedHeadSha
|
|
@@ -11609,12 +11727,12 @@ var checkoutMovedWorktree = async (payload, timeoutMs, signal) => {
|
|
|
11609
11727
|
`Branch ${input.branch} is already checked out in ${occupiedFolder}`
|
|
11610
11728
|
);
|
|
11611
11729
|
}
|
|
11612
|
-
targetFolder =
|
|
11730
|
+
targetFolder = join7(
|
|
11613
11731
|
dirname5(rootFolder),
|
|
11614
11732
|
`${basename3(rootFolder)}-${input.branch.replaceAll("/", "-")}`
|
|
11615
11733
|
);
|
|
11616
11734
|
try {
|
|
11617
|
-
await
|
|
11735
|
+
await stat6(targetFolder);
|
|
11618
11736
|
throw new Error(`Worktree folder already exists: ${targetFolder}`);
|
|
11619
11737
|
} catch (error) {
|
|
11620
11738
|
if (!(error instanceof Error) || !("code" in error) || error.code !== "ENOENT") {
|
|
@@ -11719,7 +11837,7 @@ var checkoutMovedWorktree = async (payload, timeoutMs, signal) => {
|
|
|
11719
11837
|
if (switched.exitCode !== 0) {
|
|
11720
11838
|
if (!input.stashOnFailure && hasChanges(targetChanges)) {
|
|
11721
11839
|
return {
|
|
11722
|
-
...
|
|
11840
|
+
...successfulProcess6,
|
|
11723
11841
|
moveId: input.moveId,
|
|
11724
11842
|
outcome: "NEEDS_STASH",
|
|
11725
11843
|
message: cleanError2(
|
|
@@ -11764,7 +11882,7 @@ var checkoutMovedWorktree = async (payload, timeoutMs, signal) => {
|
|
|
11764
11882
|
);
|
|
11765
11883
|
}
|
|
11766
11884
|
return {
|
|
11767
|
-
...
|
|
11885
|
+
...successfulProcess6,
|
|
11768
11886
|
moveId: input.moveId,
|
|
11769
11887
|
outcome: "CHECKED_OUT",
|
|
11770
11888
|
worktree,
|
|
@@ -11775,7 +11893,7 @@ var checkoutMovedWorktree = async (payload, timeoutMs, signal) => {
|
|
|
11775
11893
|
var deleteWorktree = async (payload, timeoutMs, signal) => {
|
|
11776
11894
|
const input = worktreeDeleteJobPayload(payload);
|
|
11777
11895
|
const rootFolder = await realpath4(input.rootFolder);
|
|
11778
|
-
if (!(await
|
|
11896
|
+
if (!(await stat6(rootFolder)).isDirectory()) {
|
|
11779
11897
|
throw new Error("Base repository is missing");
|
|
11780
11898
|
}
|
|
11781
11899
|
if (await origin(rootFolder, timeoutMs, signal) !== input.expectedOrigin) {
|
|
@@ -11862,7 +11980,7 @@ var deleteWorktree = async (payload, timeoutMs, signal) => {
|
|
|
11862
11980
|
);
|
|
11863
11981
|
}
|
|
11864
11982
|
return {
|
|
11865
|
-
...
|
|
11983
|
+
...successfulProcess6,
|
|
11866
11984
|
moveId: input.moveId,
|
|
11867
11985
|
deleted: true,
|
|
11868
11986
|
branch,
|
|
@@ -11956,7 +12074,7 @@ var operateWorktree = async (payload, timeoutMs, signal) => {
|
|
|
11956
12074
|
break;
|
|
11957
12075
|
}
|
|
11958
12076
|
return {
|
|
11959
|
-
...
|
|
12077
|
+
...successfulProcess6,
|
|
11960
12078
|
worktree: await inspectWorktreeItem(
|
|
11961
12079
|
folder,
|
|
11962
12080
|
folder,
|
|
@@ -11975,12 +12093,12 @@ import {
|
|
|
11975
12093
|
mkdir as mkdir4,
|
|
11976
12094
|
mkdtemp as mkdtemp3,
|
|
11977
12095
|
open as open2,
|
|
11978
|
-
readdir as
|
|
11979
|
-
readFile as
|
|
12096
|
+
readdir as readdir6,
|
|
12097
|
+
readFile as readFile6,
|
|
11980
12098
|
realpath as realpath5,
|
|
11981
12099
|
rename as rename3,
|
|
11982
12100
|
rm as rm6,
|
|
11983
|
-
stat as
|
|
12101
|
+
stat as stat7,
|
|
11984
12102
|
writeFile as writeFile4
|
|
11985
12103
|
} from "node:fs/promises";
|
|
11986
12104
|
import { createReadStream as createReadStream3, createWriteStream as createWriteStream2 } from "node:fs";
|
|
@@ -11990,13 +12108,13 @@ import {
|
|
|
11990
12108
|
basename as basename4,
|
|
11991
12109
|
dirname as dirname6,
|
|
11992
12110
|
isAbsolute as isAbsolute4,
|
|
11993
|
-
join as
|
|
12111
|
+
join as join8,
|
|
11994
12112
|
relative as relative5,
|
|
11995
12113
|
resolve as resolve5,
|
|
11996
12114
|
sep as sep4
|
|
11997
12115
|
} from "node:path";
|
|
11998
12116
|
import { spawn as spawn5 } from "node:child_process";
|
|
11999
|
-
var
|
|
12117
|
+
var successfulProcess7 = {
|
|
12000
12118
|
exitCode: 0,
|
|
12001
12119
|
signal: null,
|
|
12002
12120
|
timedOut: false,
|
|
@@ -12052,7 +12170,7 @@ function requireSuccess3(result, fallback) {
|
|
|
12052
12170
|
}
|
|
12053
12171
|
async function validateWorktree2(input, timeoutMs, signal) {
|
|
12054
12172
|
const folder = await realpath5(input.folder);
|
|
12055
|
-
if (!(await
|
|
12173
|
+
if (!(await stat7(folder)).isDirectory())
|
|
12056
12174
|
throw new Error("Worktree is missing");
|
|
12057
12175
|
const gitDirectory2 = requireSuccess3(
|
|
12058
12176
|
await command2(
|
|
@@ -12099,7 +12217,7 @@ async function validateSource(root, source) {
|
|
|
12099
12217
|
if (difference === ".." || difference.startsWith(`..${sep4}`) || isAbsolute4(difference)) {
|
|
12100
12218
|
throw new Error("Build source resolves outside the worktree");
|
|
12101
12219
|
}
|
|
12102
|
-
const information = await
|
|
12220
|
+
const information = await stat7(resolved);
|
|
12103
12221
|
if (source.kind === "PACKAGE" && !information.isFile()) {
|
|
12104
12222
|
throw new Error("Package.swift is missing");
|
|
12105
12223
|
}
|
|
@@ -12113,9 +12231,9 @@ async function discoverSourcesInFolder(folder) {
|
|
|
12113
12231
|
const queue = [folder];
|
|
12114
12232
|
while (queue.length && sources.length < DISCOVERY_LIMIT) {
|
|
12115
12233
|
const current = queue.shift();
|
|
12116
|
-
for (const entry of await
|
|
12234
|
+
for (const entry of await readdir6(current, { withFileTypes: true })) {
|
|
12117
12235
|
if (entry.isSymbolicLink()) continue;
|
|
12118
|
-
const absolute =
|
|
12236
|
+
const absolute = join8(current, entry.name);
|
|
12119
12237
|
const path = relative5(folder, absolute).split(sep4).join("/");
|
|
12120
12238
|
if (entry.isDirectory()) {
|
|
12121
12239
|
if (entry.name.endsWith(".xcodeproj")) {
|
|
@@ -12186,10 +12304,10 @@ function metadataFromList(value) {
|
|
|
12186
12304
|
};
|
|
12187
12305
|
}
|
|
12188
12306
|
async function workspaceProjectPaths(workspacePath2, folder) {
|
|
12189
|
-
const contentsPath =
|
|
12307
|
+
const contentsPath = join8(workspacePath2, "contents.xcworkspacedata");
|
|
12190
12308
|
let contents;
|
|
12191
12309
|
try {
|
|
12192
|
-
contents = await
|
|
12310
|
+
contents = await readFile6(contentsPath, "utf8");
|
|
12193
12311
|
} catch {
|
|
12194
12312
|
return [];
|
|
12195
12313
|
}
|
|
@@ -12215,7 +12333,7 @@ async function workspaceProjectPaths(workspacePath2, folder) {
|
|
|
12215
12333
|
try {
|
|
12216
12334
|
const resolved = await realpath5(candidate);
|
|
12217
12335
|
const resolvedDifference = relative5(folder, resolved);
|
|
12218
|
-
if (resolvedDifference === ".." || resolvedDifference.startsWith(`..${sep4}`) || isAbsolute4(resolvedDifference) || !(await
|
|
12336
|
+
if (resolvedDifference === ".." || resolvedDifference.startsWith(`..${sep4}`) || isAbsolute4(resolvedDifference) || !(await stat7(resolved)).isDirectory()) {
|
|
12219
12337
|
continue;
|
|
12220
12338
|
}
|
|
12221
12339
|
projects.push(resolved);
|
|
@@ -12406,7 +12524,7 @@ async function dependentSigningRequirements(source, absolutePath, folder, rootTa
|
|
|
12406
12524
|
for (const project of projects.slice(0, 50)) {
|
|
12407
12525
|
const converted = await command2(
|
|
12408
12526
|
"plutil",
|
|
12409
|
-
["-convert", "json", "-o", "-",
|
|
12527
|
+
["-convert", "json", "-o", "-", join8(project, "project.pbxproj")],
|
|
12410
12528
|
Math.min(timeoutMs, 15e3),
|
|
12411
12529
|
signal,
|
|
12412
12530
|
folder
|
|
@@ -12494,7 +12612,7 @@ var discoverBuildSources = async (payload, timeoutMs, signal) => {
|
|
|
12494
12612
|
const input = parseBuildSourceDiscoverPayload(payload);
|
|
12495
12613
|
const folder = await validateWorktree2(input, timeoutMs, signal);
|
|
12496
12614
|
return {
|
|
12497
|
-
...
|
|
12615
|
+
...successfulProcess7,
|
|
12498
12616
|
sources: await discoverSourcesInFolder(folder)
|
|
12499
12617
|
};
|
|
12500
12618
|
};
|
|
@@ -12528,7 +12646,7 @@ var parseBuildSourceMetadata = async (payload, timeoutMs, signal) => {
|
|
|
12528
12646
|
)
|
|
12529
12647
|
]);
|
|
12530
12648
|
return {
|
|
12531
|
-
...
|
|
12649
|
+
...successfulProcess7,
|
|
12532
12650
|
schemes: uniqueSorted(metadata.schemes),
|
|
12533
12651
|
configurations: uniqueSorted(configurations),
|
|
12534
12652
|
testPlans: plans,
|
|
@@ -12643,8 +12761,8 @@ function genericBuildDestinations(action) {
|
|
|
12643
12761
|
];
|
|
12644
12762
|
}
|
|
12645
12763
|
async function listPhysicalDevices(timeoutMs, signal) {
|
|
12646
|
-
const directory = await mkdtemp3(
|
|
12647
|
-
const output =
|
|
12764
|
+
const directory = await mkdtemp3(join8(tmpdir3(), "ade-devices-"));
|
|
12765
|
+
const output = join8(directory, "devices.json");
|
|
12648
12766
|
try {
|
|
12649
12767
|
const result = await command2(
|
|
12650
12768
|
"xcrun",
|
|
@@ -12662,7 +12780,7 @@ async function listPhysicalDevices(timeoutMs, signal) {
|
|
|
12662
12780
|
signal
|
|
12663
12781
|
);
|
|
12664
12782
|
if (result.exitCode !== 0) return [];
|
|
12665
|
-
return physicalDestinations(JSON.parse(await
|
|
12783
|
+
return physicalDestinations(JSON.parse(await readFile6(output, "utf8")));
|
|
12666
12784
|
} finally {
|
|
12667
12785
|
await rm6(directory, { recursive: true, force: true });
|
|
12668
12786
|
}
|
|
@@ -12699,7 +12817,7 @@ var inspectBuildDestinations = async (payload, timeoutMs, signal) => {
|
|
|
12699
12817
|
listPhysicalDevices(timeoutMs, signal)
|
|
12700
12818
|
]);
|
|
12701
12819
|
return {
|
|
12702
|
-
...
|
|
12820
|
+
...successfulProcess7,
|
|
12703
12821
|
destinations: [
|
|
12704
12822
|
...genericBuildDestinations(input.action),
|
|
12705
12823
|
...simulators.exitCode === 0 ? simulatorDestinations(JSON.parse(simulators.stdout)) : [],
|
|
@@ -12720,12 +12838,12 @@ var inspectBuildRunDestinations = async (payload, timeoutMs, signal) => {
|
|
|
12720
12838
|
);
|
|
12721
12839
|
requireSuccess3(simulators, "Could not inspect available simulators");
|
|
12722
12840
|
return {
|
|
12723
|
-
...
|
|
12841
|
+
...successfulProcess7,
|
|
12724
12842
|
destinations: simulatorDestinations(JSON.parse(simulators.stdout))
|
|
12725
12843
|
};
|
|
12726
12844
|
}
|
|
12727
12845
|
return {
|
|
12728
|
-
...
|
|
12846
|
+
...successfulProcess7,
|
|
12729
12847
|
destinations: await listPhysicalDevices(timeoutMs, signal)
|
|
12730
12848
|
};
|
|
12731
12849
|
};
|
|
@@ -13042,7 +13160,7 @@ function actionArgument(action) {
|
|
|
13042
13160
|
}[action];
|
|
13043
13161
|
}
|
|
13044
13162
|
function xcodeBuildArguments(input) {
|
|
13045
|
-
const resultBundle =
|
|
13163
|
+
const resultBundle = join8(input.artifactDirectory, "result.xcresult");
|
|
13046
13164
|
const sourcePath = containedPath2(input.folder, input.source.relativePath);
|
|
13047
13165
|
const usesCapturedTestProducts = input.action === "TEST_WITHOUT_BUILDING";
|
|
13048
13166
|
const args = [
|
|
@@ -13064,13 +13182,13 @@ function xcodeBuildArguments(input) {
|
|
|
13064
13182
|
if (input.action === "ARCHIVE") {
|
|
13065
13183
|
args.push(
|
|
13066
13184
|
"-archivePath",
|
|
13067
|
-
|
|
13185
|
+
join8(input.artifactDirectory, "archive.xcarchive")
|
|
13068
13186
|
);
|
|
13069
13187
|
}
|
|
13070
13188
|
if (input.action === "BUILD_FOR_TESTING") {
|
|
13071
13189
|
args.push(
|
|
13072
13190
|
"-testProductsPath",
|
|
13073
|
-
|
|
13191
|
+
join8(input.artifactDirectory, "test-products.xctestproducts")
|
|
13074
13192
|
);
|
|
13075
13193
|
}
|
|
13076
13194
|
if (input.action === "TEST_WITHOUT_BUILDING" && input.advancedSettings.priorTestProductsPath) {
|
|
@@ -13133,15 +13251,15 @@ function classifyFailure(output) {
|
|
|
13133
13251
|
}
|
|
13134
13252
|
async function runHook(options) {
|
|
13135
13253
|
const phaseDirectory = options.phase === "PRE_BUILD" ? "pre" : "post";
|
|
13136
|
-
const directory =
|
|
13254
|
+
const directory = join8(
|
|
13137
13255
|
options.input.artifactDirectory,
|
|
13138
13256
|
"hooks",
|
|
13139
13257
|
phaseDirectory
|
|
13140
13258
|
);
|
|
13141
13259
|
const prefix = `${String(options.script.position).padStart(3, "0")}-${options.script.id}`;
|
|
13142
|
-
const file =
|
|
13143
|
-
const runner =
|
|
13144
|
-
const log =
|
|
13260
|
+
const file = join8(directory, `${prefix}.mjs`);
|
|
13261
|
+
const runner = join8(directory, `${prefix}.runner.mjs`);
|
|
13262
|
+
const log = join8(directory, `${prefix}.log`);
|
|
13145
13263
|
const started = Date.now();
|
|
13146
13264
|
try {
|
|
13147
13265
|
await mkdir4(directory, { recursive: true, mode: 448 });
|
|
@@ -13226,26 +13344,26 @@ if (typeof hookModule.default === "function") {
|
|
|
13226
13344
|
}
|
|
13227
13345
|
async function pathExists(path) {
|
|
13228
13346
|
try {
|
|
13229
|
-
await
|
|
13347
|
+
await stat7(path);
|
|
13230
13348
|
return true;
|
|
13231
13349
|
} catch {
|
|
13232
13350
|
return false;
|
|
13233
13351
|
}
|
|
13234
13352
|
}
|
|
13235
13353
|
async function pathSize(path) {
|
|
13236
|
-
const information = await
|
|
13354
|
+
const information = await stat7(path);
|
|
13237
13355
|
if (information.isFile()) return information.size;
|
|
13238
13356
|
if (!information.isDirectory()) return 0;
|
|
13239
13357
|
let size = 0;
|
|
13240
|
-
for (const entry of await
|
|
13358
|
+
for (const entry of await readdir6(path, { withFileTypes: true })) {
|
|
13241
13359
|
if (entry.isSymbolicLink()) continue;
|
|
13242
|
-
size += await pathSize(
|
|
13360
|
+
size += await pathSize(join8(path, entry.name));
|
|
13243
13361
|
}
|
|
13244
13362
|
return size;
|
|
13245
13363
|
}
|
|
13246
13364
|
async function fileChecksum(path) {
|
|
13247
13365
|
try {
|
|
13248
|
-
const information = await
|
|
13366
|
+
const information = await stat7(path);
|
|
13249
13367
|
if (!information.isFile()) return null;
|
|
13250
13368
|
const hash = createHash5("sha256");
|
|
13251
13369
|
await pipeline(createReadStream3(path), hash);
|
|
@@ -13269,7 +13387,7 @@ async function plistString(plistPath, keyPath, timeoutMs, signal) {
|
|
|
13269
13387
|
}
|
|
13270
13388
|
}
|
|
13271
13389
|
async function archiveApplicationProperties(archivePath, timeoutMs, signal) {
|
|
13272
|
-
const plistPath =
|
|
13390
|
+
const plistPath = join8(archivePath, "Info.plist");
|
|
13273
13391
|
const read = (key) => plistString(plistPath, `ApplicationProperties.${key}`, timeoutMs, signal);
|
|
13274
13392
|
const [bundleIdentifier2, bundleShortVersion, bundleVersion, applicationPath] = await Promise.all([
|
|
13275
13393
|
read("CFBundleIdentifier"),
|
|
@@ -13428,9 +13546,9 @@ function normalizeCoverage(value) {
|
|
|
13428
13546
|
};
|
|
13429
13547
|
}
|
|
13430
13548
|
async function writeJsonReport(input, kind, timeoutMs, signal) {
|
|
13431
|
-
const resultBundle =
|
|
13549
|
+
const resultBundle = join8(input.artifactDirectory, "result.xcresult");
|
|
13432
13550
|
const filename = kind === "TEST_RESULTS" ? "test-results.json" : "code-coverage.json";
|
|
13433
|
-
const destination =
|
|
13551
|
+
const destination = join8(input.artifactDirectory, filename);
|
|
13434
13552
|
const temporary = `${destination}.tmp-${randomUUID3()}`;
|
|
13435
13553
|
try {
|
|
13436
13554
|
if (!await pathExists(resultBundle)) {
|
|
@@ -13458,7 +13576,7 @@ async function writeJsonReport(input, kind, timeoutMs, signal) {
|
|
|
13458
13576
|
),
|
|
13459
13577
|
`Could not generate ${filename}`
|
|
13460
13578
|
);
|
|
13461
|
-
const serialized = await
|
|
13579
|
+
const serialized = await readFile6(temporary, "utf8");
|
|
13462
13580
|
const parsed = JSON.parse(serialized);
|
|
13463
13581
|
const normalized = kind === "TEST_RESULTS" ? normalizeTestResults(parsed) : normalizeCoverage(parsed);
|
|
13464
13582
|
await rename3(temporary, destination);
|
|
@@ -13565,7 +13683,7 @@ async function snapshotCoverageChanges(input, folder, timeoutMs, signal) {
|
|
|
13565
13683
|
const types = changeTypesFromStatus(status2.stdout);
|
|
13566
13684
|
for (const path of untracked.stdout.split("\0").filter(Boolean)) {
|
|
13567
13685
|
try {
|
|
13568
|
-
const contents = await
|
|
13686
|
+
const contents = await readFile6(join8(folder, path));
|
|
13569
13687
|
if (contents.includes(0)) continue;
|
|
13570
13688
|
const lineCount = contents.length ? contents.toString("utf8").split("\n").length - (contents.toString("utf8").endsWith("\n") ? 1 : 0) : 0;
|
|
13571
13689
|
lines.set(
|
|
@@ -13599,7 +13717,7 @@ async function addChangedCoverage(report, changes, input, folder, timeoutMs, sig
|
|
|
13599
13717
|
let covered = 0;
|
|
13600
13718
|
let executable = 0;
|
|
13601
13719
|
if (coveragePath && change.lines.length) {
|
|
13602
|
-
const temporary2 =
|
|
13720
|
+
const temporary2 = join8(
|
|
13603
13721
|
input.artifactDirectory,
|
|
13604
13722
|
`.changed-coverage-${randomUUID3()}.json`
|
|
13605
13723
|
);
|
|
@@ -13623,7 +13741,7 @@ async function addChangedCoverage(report, changes, input, folder, timeoutMs, sig
|
|
|
13623
13741
|
);
|
|
13624
13742
|
if (result.exitCode === 0 && !result.cancelled && !result.timedOut) {
|
|
13625
13743
|
const parsed = jsonObject(
|
|
13626
|
-
JSON.parse(await
|
|
13744
|
+
JSON.parse(await readFile6(temporary2, "utf8"))
|
|
13627
13745
|
);
|
|
13628
13746
|
const lineData = parsed?.[coveragePath];
|
|
13629
13747
|
if (Array.isArray(lineData)) {
|
|
@@ -13660,7 +13778,7 @@ async function addChangedCoverage(report, changes, input, folder, timeoutMs, sig
|
|
|
13660
13778
|
changedLineCoverage: changedExecutableLines ? changedCoveredLines / changedExecutableLines : null
|
|
13661
13779
|
};
|
|
13662
13780
|
const data = { ...report.data, changedFiles };
|
|
13663
|
-
const destination =
|
|
13781
|
+
const destination = join8(input.artifactDirectory, "worktree-coverage.json");
|
|
13664
13782
|
const temporary = `${destination}.tmp-${randomUUID3()}`;
|
|
13665
13783
|
await writeFile4(temporary, JSON.stringify({ summary, data }, null, 2), {
|
|
13666
13784
|
mode: 384
|
|
@@ -13708,13 +13826,13 @@ async function findFiles(root, predicate, limit = 20) {
|
|
|
13708
13826
|
const current = queue.shift();
|
|
13709
13827
|
let entries;
|
|
13710
13828
|
try {
|
|
13711
|
-
entries = await
|
|
13829
|
+
entries = await readdir6(current, { withFileTypes: true });
|
|
13712
13830
|
} catch {
|
|
13713
13831
|
continue;
|
|
13714
13832
|
}
|
|
13715
13833
|
for (const entry of entries) {
|
|
13716
13834
|
if (entry.isSymbolicLink()) continue;
|
|
13717
|
-
const path =
|
|
13835
|
+
const path = join8(current, entry.name);
|
|
13718
13836
|
if (entry.isDirectory()) queue.push(path);
|
|
13719
13837
|
else if (entry.isFile() && predicate(entry.name)) results.push(path);
|
|
13720
13838
|
if (results.length >= limit) break;
|
|
@@ -13724,7 +13842,7 @@ async function findFiles(root, predicate, limit = 20) {
|
|
|
13724
13842
|
}
|
|
13725
13843
|
async function captureArtifacts(input, folder, signal, includeProducts = true) {
|
|
13726
13844
|
const artifacts = [];
|
|
13727
|
-
const resultBundle =
|
|
13845
|
+
const resultBundle = join8(input.artifactDirectory, "result.xcresult");
|
|
13728
13846
|
if (await pathExists(resultBundle)) {
|
|
13729
13847
|
const coverageProbe = await command2(
|
|
13730
13848
|
"xcrun",
|
|
@@ -13751,7 +13869,7 @@ async function captureArtifacts(input, folder, signal, includeProducts = true) {
|
|
|
13751
13869
|
);
|
|
13752
13870
|
}
|
|
13753
13871
|
if (!includeProducts) return artifacts;
|
|
13754
|
-
const archivePath =
|
|
13872
|
+
const archivePath = join8(input.artifactDirectory, "archive.xcarchive");
|
|
13755
13873
|
if (await pathExists(archivePath)) {
|
|
13756
13874
|
artifacts.push(
|
|
13757
13875
|
await artifact(input.artifactDirectory, "ARCHIVE", archivePath)
|
|
@@ -13774,10 +13892,10 @@ async function captureArtifacts(input, folder, signal, includeProducts = true) {
|
|
|
13774
13892
|
if (apps.length === 1) {
|
|
13775
13893
|
const settings = apps[0].buildSettings;
|
|
13776
13894
|
const productName = settings.FULL_PRODUCT_NAME ?? settings.WRAPPER_NAME;
|
|
13777
|
-
const source = settings.TARGET_BUILD_DIR && productName ?
|
|
13895
|
+
const source = settings.TARGET_BUILD_DIR && productName ? join8(settings.TARGET_BUILD_DIR, productName) : null;
|
|
13778
13896
|
if (source && await pathExists(source)) {
|
|
13779
|
-
const productDirectory =
|
|
13780
|
-
const destination =
|
|
13897
|
+
const productDirectory = join8(input.artifactDirectory, "products");
|
|
13898
|
+
const destination = join8(productDirectory, basename4(source));
|
|
13781
13899
|
await mkdir4(productDirectory, { recursive: true, mode: 448 });
|
|
13782
13900
|
await rm6(destination, { recursive: true, force: true });
|
|
13783
13901
|
await cp(source, destination, {
|
|
@@ -13794,7 +13912,7 @@ async function captureArtifacts(input, folder, signal, includeProducts = true) {
|
|
|
13794
13912
|
}
|
|
13795
13913
|
}
|
|
13796
13914
|
if (input.action === "BUILD_FOR_TESTING") {
|
|
13797
|
-
const testDirectory =
|
|
13915
|
+
const testDirectory = join8(
|
|
13798
13916
|
input.artifactDirectory,
|
|
13799
13917
|
"test-products.xctestproducts"
|
|
13800
13918
|
);
|
|
@@ -13829,10 +13947,10 @@ var runIosBuild = async (payload, timeoutMs, signal, onLog, context) => {
|
|
|
13829
13947
|
const testProductsPath = input.advancedSettings.priorTestProductsPath;
|
|
13830
13948
|
const xctestrunPath = input.advancedSettings.priorXctestrunPath;
|
|
13831
13949
|
if (testProductsPath) {
|
|
13832
|
-
if (!testProductsPath.endsWith(".xctestproducts") || !await pathExists(testProductsPath) || !(await
|
|
13950
|
+
if (!testProductsPath.endsWith(".xctestproducts") || !await pathExists(testProductsPath) || !(await stat7(testProductsPath)).isDirectory()) {
|
|
13833
13951
|
throw new Error("The captured test-products artifact is unavailable");
|
|
13834
13952
|
}
|
|
13835
|
-
} else if (!xctestrunPath?.endsWith(".xctestrun") || !await pathExists(xctestrunPath) || !(await
|
|
13953
|
+
} else if (!xctestrunPath?.endsWith(".xctestrun") || !await pathExists(xctestrunPath) || !(await stat7(xctestrunPath)).isFile()) {
|
|
13836
13954
|
throw new Error("The captured .xctestrun artifact is unavailable");
|
|
13837
13955
|
}
|
|
13838
13956
|
}
|
|
@@ -13845,11 +13963,11 @@ var runIosBuild = async (payload, timeoutMs, signal, onLog, context) => {
|
|
|
13845
13963
|
signal
|
|
13846
13964
|
);
|
|
13847
13965
|
await mkdir4(input.artifactDirectory, { recursive: true, mode: 448 });
|
|
13848
|
-
const rawLog =
|
|
13966
|
+
const rawLog = join8(input.artifactDirectory, "build.log");
|
|
13849
13967
|
const logger = new BuildLogger(input.buildId, context, rawLog, process.env);
|
|
13850
13968
|
try {
|
|
13851
13969
|
const scriptExecutions = [];
|
|
13852
|
-
const contextPath =
|
|
13970
|
+
const contextPath = join8(input.artifactDirectory, "context.json");
|
|
13853
13971
|
const baseHookContext = {
|
|
13854
13972
|
buildId: input.buildId,
|
|
13855
13973
|
branch: input.branch ?? null,
|
|
@@ -14086,7 +14204,7 @@ var generateIosBuildReport = async (payload, timeoutMs, signal, onLog) => {
|
|
|
14086
14204
|
if (!isAbsolute4(input.artifactDirectory) || basename4(input.artifactDirectory) !== input.buildId) {
|
|
14087
14205
|
throw new Error("Build artifact directory is invalid");
|
|
14088
14206
|
}
|
|
14089
|
-
if (signal.aborted) return { ...
|
|
14207
|
+
if (signal.aborted) return { ...successfulProcess7, cancelled: true };
|
|
14090
14208
|
const report = await writeJsonReport(
|
|
14091
14209
|
input,
|
|
14092
14210
|
input.reportKind,
|
|
@@ -14100,14 +14218,14 @@ var generateIosBuildReport = async (payload, timeoutMs, signal, onLog) => {
|
|
|
14100
14218
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
14101
14219
|
});
|
|
14102
14220
|
return {
|
|
14103
|
-
...
|
|
14221
|
+
...successfulProcess7,
|
|
14104
14222
|
report,
|
|
14105
14223
|
artifacts: report.artifact ? [report.artifact] : []
|
|
14106
14224
|
};
|
|
14107
14225
|
};
|
|
14108
14226
|
var deleteIosBuild = async (payload, _timeoutMs, signal, onLog) => {
|
|
14109
14227
|
const input = parseBuildDeletePayload(payload);
|
|
14110
|
-
if (signal.aborted) return { ...
|
|
14228
|
+
if (signal.aborted) return { ...successfulProcess7, cancelled: true };
|
|
14111
14229
|
await rm6(input.artifactDirectory, { recursive: true, force: true });
|
|
14112
14230
|
await onLog({
|
|
14113
14231
|
sequence: 0,
|
|
@@ -14115,7 +14233,7 @@ var deleteIosBuild = async (payload, _timeoutMs, signal, onLog) => {
|
|
|
14115
14233
|
message: `Deleted build folder ${input.artifactDirectory}`,
|
|
14116
14234
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
14117
14235
|
});
|
|
14118
|
-
return
|
|
14236
|
+
return successfulProcess7;
|
|
14119
14237
|
};
|
|
14120
14238
|
var downloadIosBuildArtifact = async (payload, timeoutMs, signal, onLog, context) => {
|
|
14121
14239
|
const input = parseBuildArtifactDownloadPayload(payload);
|
|
@@ -14130,14 +14248,14 @@ var downloadIosBuildArtifact = async (payload, timeoutMs, signal, onLog, context
|
|
|
14130
14248
|
if (!difference || difference === ".." || difference.startsWith(`..${sep4}`) || isAbsolute4(difference)) {
|
|
14131
14249
|
throw new Error("Build artifact resolves outside the build folder");
|
|
14132
14250
|
}
|
|
14133
|
-
const information = await
|
|
14251
|
+
const information = await stat7(target2);
|
|
14134
14252
|
let uploadPath = target2;
|
|
14135
14253
|
let filename = basename4(target2);
|
|
14136
14254
|
let contentType = "application/octet-stream";
|
|
14137
14255
|
let temporaryArchive = null;
|
|
14138
14256
|
try {
|
|
14139
14257
|
if (information.isDirectory()) {
|
|
14140
|
-
temporaryArchive =
|
|
14258
|
+
temporaryArchive = join8(
|
|
14141
14259
|
tmpdir3(),
|
|
14142
14260
|
`ade-build-artifact-${randomUUID3()}.tar.gz`
|
|
14143
14261
|
);
|
|
@@ -14168,7 +14286,7 @@ var downloadIosBuildArtifact = async (payload, timeoutMs, signal, onLog, context
|
|
|
14168
14286
|
filename,
|
|
14169
14287
|
contentType
|
|
14170
14288
|
});
|
|
14171
|
-
return
|
|
14289
|
+
return successfulProcess7;
|
|
14172
14290
|
} finally {
|
|
14173
14291
|
if (temporaryArchive) {
|
|
14174
14292
|
await rm6(temporaryArchive, { force: true });
|
|
@@ -14207,24 +14325,24 @@ var deployIosBuild = async (payload, timeoutMs, signal, _onLog, context) => {
|
|
|
14207
14325
|
if (!await pathExists(appPath) || !appPath.endsWith(".app")) {
|
|
14208
14326
|
throw new Error("Runnable app artifact is missing");
|
|
14209
14327
|
}
|
|
14210
|
-
const deploymentsDirectory =
|
|
14328
|
+
const deploymentsDirectory = join8(input.artifactDirectory, "deployments");
|
|
14211
14329
|
await mkdir4(deploymentsDirectory, { recursive: true, mode: 448 });
|
|
14212
14330
|
const logger = new BuildLogger(
|
|
14213
14331
|
input.buildId,
|
|
14214
14332
|
context,
|
|
14215
|
-
|
|
14333
|
+
join8(deploymentsDirectory, "deployments.log"),
|
|
14216
14334
|
process.env
|
|
14217
14335
|
);
|
|
14218
14336
|
try {
|
|
14219
14337
|
const outcomes = [];
|
|
14220
14338
|
for (const deployment of input.deployments) {
|
|
14221
|
-
const directory =
|
|
14339
|
+
const directory = join8(
|
|
14222
14340
|
input.artifactDirectory,
|
|
14223
14341
|
"deployments",
|
|
14224
14342
|
deployment.id
|
|
14225
14343
|
);
|
|
14226
14344
|
await mkdir4(directory, { recursive: true, mode: 448 });
|
|
14227
|
-
const logPath =
|
|
14345
|
+
const logPath = join8(directory, "deployment.log");
|
|
14228
14346
|
const started = Date.now();
|
|
14229
14347
|
let failure = null;
|
|
14230
14348
|
try {
|
|
@@ -14439,14 +14557,14 @@ var exportIosArchive = async (payload, timeoutMs, signal, _onLog, context) => {
|
|
|
14439
14557
|
if (!await pathExists(archivePath) || !archivePath.endsWith(".xcarchive")) {
|
|
14440
14558
|
throw new Error("Archive artifact is missing");
|
|
14441
14559
|
}
|
|
14442
|
-
const exportDirectory =
|
|
14560
|
+
const exportDirectory = join8(
|
|
14443
14561
|
input.artifactDirectory,
|
|
14444
14562
|
"exports",
|
|
14445
14563
|
input.exportId
|
|
14446
14564
|
);
|
|
14447
14565
|
await mkdir4(exportDirectory, { recursive: true, mode: 448 });
|
|
14448
|
-
const plistPath =
|
|
14449
|
-
const logPath =
|
|
14566
|
+
const plistPath = join8(exportDirectory, "ExportOptions.plist");
|
|
14567
|
+
const logPath = join8(exportDirectory, "export.log");
|
|
14450
14568
|
await writeFile4(plistPath, exportPlist(input.settings), { mode: 384 });
|
|
14451
14569
|
const logger = new BuildLogger(input.buildId, context, logPath, process.env);
|
|
14452
14570
|
try {
|
|
@@ -14528,6 +14646,7 @@ var handlers = {
|
|
|
14528
14646
|
[SKILL_SCAN_JOB_KIND]: scanSkills,
|
|
14529
14647
|
[SKILL_READ_JOB_KIND]: readSkills,
|
|
14530
14648
|
[SKILL_APPLY_JOB_KIND]: applySkills,
|
|
14649
|
+
[RUN_SESSION_READ_JOB_KIND]: readRunSession,
|
|
14531
14650
|
[IOS_SOURCE_DISCOVER_JOB_KIND]: discoverBuildSources,
|
|
14532
14651
|
[IOS_SOURCE_PARSE_JOB_KIND]: parseBuildSourceMetadata,
|
|
14533
14652
|
[IOS_DESTINATIONS_JOB_KIND]: inspectBuildDestinations,
|
|
@@ -14802,14 +14921,14 @@ var CodebaseMonitor = class {
|
|
|
14802
14921
|
// src/runs/run-manager.ts
|
|
14803
14922
|
import { execFile as execFile4 } from "node:child_process";
|
|
14804
14923
|
import { mkdir as mkdir6, rm as rm11 } from "node:fs/promises";
|
|
14805
|
-
import { dirname as dirname8, join as
|
|
14924
|
+
import { dirname as dirname8, join as join13 } from "node:path";
|
|
14806
14925
|
import { promisify as promisify4 } from "node:util";
|
|
14807
14926
|
|
|
14808
14927
|
// src/runs/git-checkpoint.ts
|
|
14809
14928
|
import { execFile as execFile2 } from "node:child_process";
|
|
14810
14929
|
import { copyFile, mkdtemp as mkdtemp4, rm as rm7 } from "node:fs/promises";
|
|
14811
14930
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
14812
|
-
import { join as
|
|
14931
|
+
import { join as join9 } from "node:path";
|
|
14813
14932
|
import { promisify as promisify2 } from "node:util";
|
|
14814
14933
|
var execFileAsync = promisify2(execFile2);
|
|
14815
14934
|
async function git3(cwd, args, env) {
|
|
@@ -14924,12 +15043,12 @@ async function captureGitCheckpoint(cwd, runId, kind) {
|
|
|
14924
15043
|
const manifest = await optionalGit(cwd, ["status", "--porcelain=v2", "-z"]);
|
|
14925
15044
|
const staged = await optionalGit(cwd, ["diff", "--cached", "--stat", "HEAD"]);
|
|
14926
15045
|
const unstaged = await optionalGit(cwd, ["diff", "--stat", "HEAD"]);
|
|
14927
|
-
const directory = await mkdtemp4(
|
|
15046
|
+
const directory = await mkdtemp4(join9(tmpdir4(), "aide-run-index-"));
|
|
14928
15047
|
let worktreeTree = null;
|
|
14929
15048
|
let refName = null;
|
|
14930
15049
|
try {
|
|
14931
15050
|
const actualIndex = await git3(cwd, ["rev-parse", "--git-path", "index"]);
|
|
14932
|
-
const temporaryIndex =
|
|
15051
|
+
const temporaryIndex = join9(directory, "index");
|
|
14933
15052
|
try {
|
|
14934
15053
|
await copyFile(actualIndex, temporaryIndex);
|
|
14935
15054
|
} catch {
|
|
@@ -14990,12 +15109,12 @@ import { randomUUID as randomUUID4 } from "node:crypto";
|
|
|
14990
15109
|
import {
|
|
14991
15110
|
appendFile,
|
|
14992
15111
|
mkdir as mkdir5,
|
|
14993
|
-
readFile as
|
|
15112
|
+
readFile as readFile7,
|
|
14994
15113
|
rename as rename4,
|
|
14995
15114
|
rm as rm8,
|
|
14996
15115
|
writeFile as writeFile5
|
|
14997
15116
|
} from "node:fs/promises";
|
|
14998
|
-
import { dirname as dirname7, join as
|
|
15117
|
+
import { dirname as dirname7, join as join10 } from "node:path";
|
|
14999
15118
|
var RunJournal = class {
|
|
15000
15119
|
constructor(runId, attemptId) {
|
|
15001
15120
|
this.runId = runId;
|
|
@@ -15014,13 +15133,13 @@ var RunJournal = class {
|
|
|
15014
15133
|
this.attemptId = attemptId;
|
|
15015
15134
|
}
|
|
15016
15135
|
get directory() {
|
|
15017
|
-
return
|
|
15136
|
+
return join10(dirname7(configPath()), "runs", this.runId);
|
|
15018
15137
|
}
|
|
15019
15138
|
get eventsPath() {
|
|
15020
|
-
return
|
|
15139
|
+
return join10(this.directory, "events.jsonl");
|
|
15021
15140
|
}
|
|
15022
15141
|
get statePath() {
|
|
15023
|
-
return
|
|
15142
|
+
return join10(this.directory, "state.json");
|
|
15024
15143
|
}
|
|
15025
15144
|
async load() {
|
|
15026
15145
|
if (this.loaded) return;
|
|
@@ -15034,7 +15153,7 @@ var RunJournal = class {
|
|
|
15034
15153
|
async loadState() {
|
|
15035
15154
|
await mkdir5(this.directory, { recursive: true, mode: 448 });
|
|
15036
15155
|
try {
|
|
15037
|
-
const state = JSON.parse(await
|
|
15156
|
+
const state = JSON.parse(await readFile7(this.statePath, "utf8"));
|
|
15038
15157
|
this.acknowledged = state.acknowledged ?? -1;
|
|
15039
15158
|
this.nextSequence = state.nextSequence ?? 0;
|
|
15040
15159
|
} catch {
|
|
@@ -15109,7 +15228,7 @@ var RunJournal = class {
|
|
|
15109
15228
|
}
|
|
15110
15229
|
async readEvents() {
|
|
15111
15230
|
try {
|
|
15112
|
-
return (await
|
|
15231
|
+
return (await readFile7(this.eventsPath, "utf8")).split("\n").filter(Boolean).map((line) => JSON.parse(line));
|
|
15113
15232
|
} catch (error) {
|
|
15114
15233
|
if (error.code === "ENOENT") return [];
|
|
15115
15234
|
throw error;
|
|
@@ -41028,6 +41147,37 @@ function claudeEnvironment() {
|
|
|
41028
41147
|
CLAUDE_CODE_DISABLE_BACKGROUND_TASKS: "1"
|
|
41029
41148
|
};
|
|
41030
41149
|
}
|
|
41150
|
+
function claudeModelUsages(record, fallbackModel) {
|
|
41151
|
+
const toolCallCount = Number(record.num_turns ?? 0);
|
|
41152
|
+
const entries = Object.entries(asRecord(record.modelUsage)).filter(
|
|
41153
|
+
(entry) => Boolean(entry[1]) && typeof entry[1] === "object"
|
|
41154
|
+
);
|
|
41155
|
+
if (entries.length) {
|
|
41156
|
+
return entries.map(([model2, usage3]) => ({
|
|
41157
|
+
model: model2,
|
|
41158
|
+
inputTokens: Number(usage3.inputTokens ?? 0),
|
|
41159
|
+
outputTokens: Number(usage3.outputTokens ?? 0),
|
|
41160
|
+
cacheReadTokens: Number(usage3.cacheReadInputTokens ?? 0),
|
|
41161
|
+
cacheWriteTokens: Number(usage3.cacheCreationInputTokens ?? 0),
|
|
41162
|
+
estimatedCost: Number(usage3.costUSD ?? 0),
|
|
41163
|
+
toolCallCount,
|
|
41164
|
+
pricingSource: "claude-agent-sdk"
|
|
41165
|
+
}));
|
|
41166
|
+
}
|
|
41167
|
+
const usage2 = asRecord(record.usage);
|
|
41168
|
+
return [
|
|
41169
|
+
{
|
|
41170
|
+
model: fallbackModel,
|
|
41171
|
+
inputTokens: Number(usage2.input_tokens ?? 0),
|
|
41172
|
+
outputTokens: Number(usage2.output_tokens ?? 0),
|
|
41173
|
+
cacheReadTokens: Number(usage2.cache_read_input_tokens ?? 0),
|
|
41174
|
+
cacheWriteTokens: Number(usage2.cache_creation_input_tokens ?? 0),
|
|
41175
|
+
estimatedCost: Number(record.total_cost_usd ?? 0),
|
|
41176
|
+
toolCallCount,
|
|
41177
|
+
pricingSource: "claude-agent-sdk"
|
|
41178
|
+
}
|
|
41179
|
+
];
|
|
41180
|
+
}
|
|
41031
41181
|
var ClaudeAdapter = class {
|
|
41032
41182
|
key = "CLAUDE";
|
|
41033
41183
|
capabilities = {
|
|
@@ -41143,17 +41293,9 @@ var ClaudeAdapter = class {
|
|
|
41143
41293
|
}
|
|
41144
41294
|
if (record.type === "result") {
|
|
41145
41295
|
finalOutput = typeof record.result === "string" ? record.result : finalOutput;
|
|
41146
|
-
const usage2
|
|
41147
|
-
|
|
41148
|
-
|
|
41149
|
-
inputTokens: Number(usage2.input_tokens ?? 0),
|
|
41150
|
-
outputTokens: Number(usage2.output_tokens ?? 0),
|
|
41151
|
-
cacheReadTokens: Number(usage2.cache_read_input_tokens ?? 0),
|
|
41152
|
-
cacheWriteTokens: Number(usage2.cache_creation_input_tokens ?? 0),
|
|
41153
|
-
estimatedCost: Number(record.total_cost_usd ?? 0),
|
|
41154
|
-
toolCallCount: Number(record.num_turns ?? 0),
|
|
41155
|
-
pricingSource: "claude-agent-sdk"
|
|
41156
|
-
});
|
|
41296
|
+
for (const usage2 of claudeModelUsages(record, input.run.model)) {
|
|
41297
|
+
await callbacks.onUsage(usage2);
|
|
41298
|
+
}
|
|
41157
41299
|
if (record.is_error) {
|
|
41158
41300
|
const errors = Array.isArray(record.errors) ? record.errors.map(String).join("; ") : "Claude execution failed";
|
|
41159
41301
|
return { status: "FAILED", finalOutput, error: errors };
|
|
@@ -41253,7 +41395,7 @@ import {
|
|
|
41253
41395
|
} from "node:child_process";
|
|
41254
41396
|
import { mkdtemp as mkdtemp5, rm as rm10, writeFile as writeFile6 } from "node:fs/promises";
|
|
41255
41397
|
import { tmpdir as tmpdir5 } from "node:os";
|
|
41256
|
-
import { join as
|
|
41398
|
+
import { join as join12 } from "node:path";
|
|
41257
41399
|
import { createInterface } from "node:readline";
|
|
41258
41400
|
import { promisify as promisify3 } from "node:util";
|
|
41259
41401
|
var SUPPORTED_CODEX_APP_SERVER_MINORS = ["0.144", "0.145"];
|
|
@@ -41277,6 +41419,26 @@ function supportedCodexVersion(version) {
|
|
|
41277
41419
|
)
|
|
41278
41420
|
);
|
|
41279
41421
|
}
|
|
41422
|
+
function codexTokenUsage(value, model2) {
|
|
41423
|
+
const total = asRecord(value);
|
|
41424
|
+
const inputTokens = Number(total.inputTokens ?? total.input_tokens ?? 0);
|
|
41425
|
+
const cacheReadTokens = Number(
|
|
41426
|
+
total.cachedInputTokens ?? total.cache_read_tokens ?? 0
|
|
41427
|
+
);
|
|
41428
|
+
return {
|
|
41429
|
+
model: model2,
|
|
41430
|
+
inputTokens: Math.max(0, inputTokens - cacheReadTokens),
|
|
41431
|
+
outputTokens: Number(total.outputTokens ?? total.output_tokens ?? 0),
|
|
41432
|
+
reasoningTokens: Number(
|
|
41433
|
+
total.reasoningTokens ?? total.reasoning_tokens ?? 0
|
|
41434
|
+
),
|
|
41435
|
+
cacheReadTokens,
|
|
41436
|
+
cacheWriteTokens: Number(
|
|
41437
|
+
total.cacheWriteTokens ?? total.cache_write_tokens ?? 0
|
|
41438
|
+
),
|
|
41439
|
+
pricingSource: "codex-app-server"
|
|
41440
|
+
};
|
|
41441
|
+
}
|
|
41280
41442
|
var CodexAppServer = class {
|
|
41281
41443
|
process;
|
|
41282
41444
|
nextId = 1;
|
|
@@ -41360,7 +41522,7 @@ var CodexAppServer = class {
|
|
|
41360
41522
|
}
|
|
41361
41523
|
}
|
|
41362
41524
|
async createBundledModelCatalog() {
|
|
41363
|
-
const directory = await mkdtemp5(
|
|
41525
|
+
const directory = await mkdtemp5(join12(tmpdir5(), "aide-codex-models-"));
|
|
41364
41526
|
try {
|
|
41365
41527
|
const { stdout } = await execFileAsync2(
|
|
41366
41528
|
"codex",
|
|
@@ -41370,7 +41532,7 @@ var CodexAppServer = class {
|
|
|
41370
41532
|
maxBuffer: 16 * 1024 * 1024
|
|
41371
41533
|
}
|
|
41372
41534
|
);
|
|
41373
|
-
const catalogPath =
|
|
41535
|
+
const catalogPath = join12(directory, "models.json");
|
|
41374
41536
|
await writeFile6(catalogPath, stdout, "utf8");
|
|
41375
41537
|
this.modelCatalogDirectory = directory;
|
|
41376
41538
|
return catalogPath;
|
|
@@ -41630,23 +41792,7 @@ var CodexAdapter = class {
|
|
|
41630
41792
|
const usageSignature = JSON.stringify(total);
|
|
41631
41793
|
if (usageSignature !== lastUsageSignature) {
|
|
41632
41794
|
lastUsageSignature = usageSignature;
|
|
41633
|
-
await callbacks.onUsage(
|
|
41634
|
-
model: input.run.model,
|
|
41635
|
-
inputTokens: Number(total.inputTokens ?? total.input_tokens ?? 0),
|
|
41636
|
-
outputTokens: Number(
|
|
41637
|
-
total.outputTokens ?? total.output_tokens ?? 0
|
|
41638
|
-
),
|
|
41639
|
-
reasoningTokens: Number(
|
|
41640
|
-
total.reasoningTokens ?? total.reasoning_tokens ?? 0
|
|
41641
|
-
),
|
|
41642
|
-
cacheReadTokens: Number(
|
|
41643
|
-
total.cachedInputTokens ?? total.cache_read_tokens ?? 0
|
|
41644
|
-
),
|
|
41645
|
-
cacheWriteTokens: Number(
|
|
41646
|
-
total.cacheWriteTokens ?? total.cache_write_tokens ?? 0
|
|
41647
|
-
),
|
|
41648
|
-
pricingSource: "codex-app-server"
|
|
41649
|
-
});
|
|
41795
|
+
await callbacks.onUsage(codexTokenUsage(total, input.run.model));
|
|
41650
41796
|
}
|
|
41651
41797
|
}
|
|
41652
41798
|
if (message.method && !message.method.endsWith("/delta")) {
|
|
@@ -48080,7 +48226,7 @@ var RunManager = class {
|
|
|
48080
48226
|
5
|
|
48081
48227
|
);
|
|
48082
48228
|
await this.completeCommand(command3.id, "SUCCEEDED");
|
|
48083
|
-
await rm11(
|
|
48229
|
+
await rm11(join13(dirname8(configPath()), "runs", run.id, "attachments"), {
|
|
48084
48230
|
recursive: true,
|
|
48085
48231
|
force: true
|
|
48086
48232
|
}).catch(() => void 0);
|
|
@@ -48261,7 +48407,7 @@ var RunManager = class {
|
|
|
48261
48407
|
this.active.delete(run.id);
|
|
48262
48408
|
this.interruptionRequests.delete(run.id);
|
|
48263
48409
|
this.executingCommands.delete(command3.id);
|
|
48264
|
-
await rm11(
|
|
48410
|
+
await rm11(join13(dirname8(configPath()), "runs", run.id, "attachments"), {
|
|
48265
48411
|
recursive: true,
|
|
48266
48412
|
force: true
|
|
48267
48413
|
}).catch(() => void 0);
|
|
@@ -48489,11 +48635,11 @@ var RunManager = class {
|
|
|
48489
48635
|
}
|
|
48490
48636
|
async stageAttachments(runId, attachments) {
|
|
48491
48637
|
if (!attachments.length) return [];
|
|
48492
|
-
const directory =
|
|
48638
|
+
const directory = join13(dirname8(configPath()), "runs", runId, "attachments");
|
|
48493
48639
|
await mkdir6(directory, { recursive: true, mode: 448 });
|
|
48494
48640
|
return Promise.all(
|
|
48495
48641
|
attachments.map(async (attachment) => {
|
|
48496
|
-
const path =
|
|
48642
|
+
const path = join13(
|
|
48497
48643
|
directory,
|
|
48498
48644
|
`${attachment.id}-${safeFilename(attachment.filename)}`
|
|
48499
48645
|
);
|