offsite 0.0.45 → 0.0.46
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/apps/server/dist/main.mjs +56 -38
- package/apps/server/dist/main.mjs.map +1 -1
- package/apps/web/dist/assets/{dist-3jCLwLR5.js → dist-gQuykix2.js} +1 -1
- package/apps/web/dist/assets/index-CixqWNf5.js +782 -0
- package/apps/web/dist/index.html +1 -1
- package/apps/web/dist/sw.js +1 -1
- package/package.json +1 -1
- package/apps/web/dist/assets/index-CDkqSE9K.js +0 -782
|
@@ -171,6 +171,43 @@ function readJson(name) {
|
|
|
171
171
|
throw error;
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
+
function readSettings(name, schema, defaults) {
|
|
175
|
+
const file = path.join(home, name);
|
|
176
|
+
let value;
|
|
177
|
+
try {
|
|
178
|
+
value = readJson(name);
|
|
179
|
+
} catch (error) {
|
|
180
|
+
console.warn(`invalid ${file}, using the defaults: ${error}`);
|
|
181
|
+
return structuredClone(defaults);
|
|
182
|
+
}
|
|
183
|
+
if (value === null) return structuredClone(defaults);
|
|
184
|
+
let result = schema.safeParse(value);
|
|
185
|
+
if (result.success) return result.data;
|
|
186
|
+
while (!result.success) {
|
|
187
|
+
const issue = result.error.issues[0];
|
|
188
|
+
const targets = issue.code === "unrecognized_keys" ? issue.keys.map((key) => [...issue.path, key]) : [issue.path];
|
|
189
|
+
for (const target of targets) {
|
|
190
|
+
const discarded = discard(value, target);
|
|
191
|
+
if (discarded === null) {
|
|
192
|
+
console.warn(`invalid ${file}, using the defaults:\n${z.prettifyError(result.error)}`);
|
|
193
|
+
return structuredClone(defaults);
|
|
194
|
+
}
|
|
195
|
+
console.warn(`${file}: discarded ${discarded.map(String).join(".")} (${issue.message} at ${target.map(String).join(".")})`);
|
|
196
|
+
}
|
|
197
|
+
result = schema.safeParse(value);
|
|
198
|
+
}
|
|
199
|
+
writeJson(name, result.data);
|
|
200
|
+
return result.data;
|
|
201
|
+
}
|
|
202
|
+
function discard(value, target) {
|
|
203
|
+
const key = target.at(0);
|
|
204
|
+
if (key === void 0 || typeof value !== "object" || value === null || !Object.hasOwn(value, key)) return null;
|
|
205
|
+
const inner = target.length > 1 ? discard(Reflect.get(value, key), target.slice(1)) : null;
|
|
206
|
+
if (inner !== null) return [key, ...inner];
|
|
207
|
+
if (Array.isArray(value)) value.splice(Number(key), 1);
|
|
208
|
+
else Reflect.deleteProperty(value, key);
|
|
209
|
+
return [key];
|
|
210
|
+
}
|
|
174
211
|
function writeJson(name, value) {
|
|
175
212
|
let file = path.join(home, name);
|
|
176
213
|
mkdirSync(home, { recursive: true });
|
|
@@ -880,7 +917,6 @@ function record$1(value) {
|
|
|
880
917
|
}
|
|
881
918
|
//#endregion
|
|
882
919
|
//#region src/storage/config.ts
|
|
883
|
-
const configFile = path.join(home, "config.json");
|
|
884
920
|
const modelSetting = z.strictObject({
|
|
885
921
|
hidden: z.boolean(),
|
|
886
922
|
effort: z.string().nullable()
|
|
@@ -901,8 +937,7 @@ function accountSchema(provider) {
|
|
|
901
937
|
name: z.string(),
|
|
902
938
|
color: z.string().regex(/^#[0-9a-f]{6}$/i, "must be a hex color like #3b82f6").nullable().default(null),
|
|
903
939
|
configDir: platformDirs,
|
|
904
|
-
enabled: z.boolean().default(true)
|
|
905
|
-
hiddenModels: z.record(z.string(), z.boolean()).default({})
|
|
940
|
+
enabled: z.boolean().default(true)
|
|
906
941
|
});
|
|
907
942
|
}
|
|
908
943
|
const configSchema = z.strictObject({
|
|
@@ -919,6 +954,19 @@ const configSchema = z.strictObject({
|
|
|
919
954
|
codex: z.boolean().default(true),
|
|
920
955
|
opencode: z.boolean().default(true)
|
|
921
956
|
}).prefault({}),
|
|
957
|
+
newThreads: z.strictObject({
|
|
958
|
+
provider: z.enum([
|
|
959
|
+
"claude",
|
|
960
|
+
"codex",
|
|
961
|
+
"opencode"
|
|
962
|
+
]).default("claude"),
|
|
963
|
+
accountId: z.string().nullable().default(null),
|
|
964
|
+
models: z.strictObject({
|
|
965
|
+
claude: z.string().nullable().default(null),
|
|
966
|
+
codex: z.string().nullable().default(null),
|
|
967
|
+
opencode: z.string().nullable().default(null)
|
|
968
|
+
}).prefault({})
|
|
969
|
+
}).prefault({}),
|
|
922
970
|
commitMessage: z.strictObject({
|
|
923
971
|
provider: z.enum([
|
|
924
972
|
"claude",
|
|
@@ -981,20 +1029,7 @@ function configInfo() {
|
|
|
981
1029
|
};
|
|
982
1030
|
}
|
|
983
1031
|
function readConfig() {
|
|
984
|
-
|
|
985
|
-
try {
|
|
986
|
-
user = readJson("config.json");
|
|
987
|
-
} catch (error) {
|
|
988
|
-
console.warn(`invalid ${configFile}, using the default config: ${error}`);
|
|
989
|
-
return structuredClone(defaults$1);
|
|
990
|
-
}
|
|
991
|
-
if (user === null) return structuredClone(defaults$1);
|
|
992
|
-
const result = configSchema.safeParse(user);
|
|
993
|
-
if (!result.success) {
|
|
994
|
-
console.warn(`invalid ${configFile}, using the default config:\n${z.prettifyError(result.error)}`);
|
|
995
|
-
return structuredClone(defaults$1);
|
|
996
|
-
}
|
|
997
|
-
return result.data;
|
|
1032
|
+
return readSettings("config.json", configSchema, defaults$1);
|
|
998
1033
|
}
|
|
999
1034
|
function saveConfig(value) {
|
|
1000
1035
|
const result = configSchema.safeParse(value);
|
|
@@ -4675,7 +4710,6 @@ async function capabilities(provider, accountId, cwd) {
|
|
|
4675
4710
|
assertEnabled(provider, accountId);
|
|
4676
4711
|
const result = await providerCapabilities(provider, accountId, cwd);
|
|
4677
4712
|
const settings = readConfig().models[provider];
|
|
4678
|
-
const overrides = provider === "opencode" ? {} : storedAccount(provider, accountId).hiddenModels;
|
|
4679
4713
|
return {
|
|
4680
4714
|
...result,
|
|
4681
4715
|
defaultModel: defaultModels[provider],
|
|
@@ -4690,7 +4724,7 @@ async function capabilities(provider, accountId, cwd) {
|
|
|
4690
4724
|
return {
|
|
4691
4725
|
...model,
|
|
4692
4726
|
deprecated,
|
|
4693
|
-
hidden:
|
|
4727
|
+
hidden: setting.hidden,
|
|
4694
4728
|
effort: setting.effort ?? effort
|
|
4695
4729
|
};
|
|
4696
4730
|
})
|
|
@@ -4717,8 +4751,7 @@ function addAccount(provider, name, configDir) {
|
|
|
4717
4751
|
name: account.name,
|
|
4718
4752
|
color: null,
|
|
4719
4753
|
configDir: { [platform()]: account.configDir },
|
|
4720
|
-
enabled: true
|
|
4721
|
-
hiddenModels: {}
|
|
4754
|
+
enabled: true
|
|
4722
4755
|
}]
|
|
4723
4756
|
});
|
|
4724
4757
|
}
|
|
@@ -4738,8 +4771,7 @@ async function updateAccount(update) {
|
|
|
4738
4771
|
...item.configDir,
|
|
4739
4772
|
[platform()]: account.configDir
|
|
4740
4773
|
},
|
|
4741
|
-
enabled: update.enabled
|
|
4742
|
-
hiddenModels: update.hiddenModels
|
|
4774
|
+
enabled: update.enabled
|
|
4743
4775
|
} : item)
|
|
4744
4776
|
});
|
|
4745
4777
|
forgetClaude(update.id);
|
|
@@ -6424,7 +6456,6 @@ function savePastedImage(type, data) {
|
|
|
6424
6456
|
}
|
|
6425
6457
|
//#endregion
|
|
6426
6458
|
//#region src/storage/state.ts
|
|
6427
|
-
const stateFile = path.join(home, "state.json");
|
|
6428
6459
|
const stateSchema = z.strictObject({ composer: z.strictObject({
|
|
6429
6460
|
provider: z.enum([
|
|
6430
6461
|
"claude",
|
|
@@ -6472,20 +6503,7 @@ const stateSchema = z.strictObject({ composer: z.strictObject({
|
|
|
6472
6503
|
}).prefault({}) });
|
|
6473
6504
|
const defaults = stateSchema.parse({});
|
|
6474
6505
|
function readComposer() {
|
|
6475
|
-
|
|
6476
|
-
try {
|
|
6477
|
-
user = readJson("state.json");
|
|
6478
|
-
} catch (error) {
|
|
6479
|
-
console.warn(`invalid ${stateFile}, using the default state: ${error}`);
|
|
6480
|
-
return structuredClone(defaults.composer);
|
|
6481
|
-
}
|
|
6482
|
-
if (user === null) return structuredClone(defaults.composer);
|
|
6483
|
-
const result = stateSchema.safeParse(user);
|
|
6484
|
-
if (!result.success) {
|
|
6485
|
-
console.warn(`invalid ${stateFile}, using the default state:\n${z.prettifyError(result.error)}`);
|
|
6486
|
-
return structuredClone(defaults.composer);
|
|
6487
|
-
}
|
|
6488
|
-
return result.data.composer;
|
|
6506
|
+
return readSettings("state.json", stateSchema, defaults).composer;
|
|
6489
6507
|
}
|
|
6490
6508
|
function saveComposer(value) {
|
|
6491
6509
|
const result = stateSchema.safeParse({ composer: value });
|