@atomic-chat/core 0.20.7 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/launch.d.ts +23 -3
- package/dist/cli/launch.js +59 -8
- package/dist/cli/launch.js.map +1 -1
- package/dist/cli/main.d.ts +1 -1
- package/dist/contracts/events.d.ts +8 -0
- package/dist/contracts/settings.d.ts +5 -0
- package/dist/contracts/settings.js.map +1 -1
- package/dist/core/atomic-core.d.ts +3 -1
- package/dist/core/atomic-core.js +4 -1
- package/dist/core/atomic-core.js.map +1 -1
- package/dist/core/create.js +4 -1
- package/dist/core/create.js.map +1 -1
- package/dist/core/sessions.js +1 -0
- package/dist/core/sessions.js.map +1 -1
- package/dist/integrations/catalog.d.ts +25 -8
- package/dist/integrations/catalog.js +105 -38
- package/dist/integrations/catalog.js.map +1 -1
- package/dist/integrations/configure/atomic-agent.d.ts +9 -1
- package/dist/integrations/configure/atomic-agent.js +42 -3
- package/dist/integrations/configure/atomic-agent.js.map +1 -1
- package/dist/integrations/configure/backup.d.ts +21 -0
- package/dist/integrations/configure/backup.js +52 -0
- package/dist/integrations/configure/backup.js.map +1 -0
- package/dist/integrations/configure/claude-code.d.ts +11 -4
- package/dist/integrations/configure/claude-code.js +73 -24
- package/dist/integrations/configure/claude-code.js.map +1 -1
- package/dist/integrations/configure/cline.d.ts +14 -4
- package/dist/integrations/configure/cline.js +78 -6
- package/dist/integrations/configure/cline.js.map +1 -1
- package/dist/integrations/configure/codex.d.ts +5 -3
- package/dist/integrations/configure/codex.js +12 -5
- package/dist/integrations/configure/codex.js.map +1 -1
- package/dist/integrations/configure/copilot.d.ts +28 -5
- package/dist/integrations/configure/copilot.js +124 -8
- package/dist/integrations/configure/copilot.js.map +1 -1
- package/dist/integrations/configure/droid.d.ts +13 -7
- package/dist/integrations/configure/droid.js +48 -17
- package/dist/integrations/configure/droid.js.map +1 -1
- package/dist/integrations/configure/dsh.d.ts +36 -20
- package/dist/integrations/configure/dsh.js +250 -48
- package/dist/integrations/configure/dsh.js.map +1 -1
- package/dist/integrations/configure/goose.d.ts +21 -7
- package/dist/integrations/configure/goose.js +141 -10
- package/dist/integrations/configure/goose.js.map +1 -1
- package/dist/integrations/configure/hermes.d.ts +63 -10
- package/dist/integrations/configure/hermes.js +360 -75
- package/dist/integrations/configure/hermes.js.map +1 -1
- package/dist/integrations/configure/json-backup.d.ts +73 -0
- package/dist/integrations/configure/json-backup.js +292 -0
- package/dist/integrations/configure/json-backup.js.map +1 -0
- package/dist/integrations/configure/json-key-backup.d.ts +43 -0
- package/dist/integrations/configure/json-key-backup.js +113 -0
- package/dist/integrations/configure/json-key-backup.js.map +1 -0
- package/dist/integrations/configure/kilo.d.ts +4 -4
- package/dist/integrations/configure/kilo.js +6 -9
- package/dist/integrations/configure/kilo.js.map +1 -1
- package/dist/integrations/configure/legacy-env-block.d.ts +18 -0
- package/dist/integrations/configure/legacy-env-block.js +47 -0
- package/dist/integrations/configure/legacy-env-block.js.map +1 -0
- package/dist/integrations/configure/mimo.d.ts +3 -2
- package/dist/integrations/configure/mimo.js +8 -9
- package/dist/integrations/configure/mimo.js.map +1 -1
- package/dist/integrations/configure/muse.d.ts +3 -3
- package/dist/integrations/configure/muse.js +5 -6
- package/dist/integrations/configure/muse.js.map +1 -1
- package/dist/integrations/configure/openclaude.d.ts +22 -7
- package/dist/integrations/configure/openclaude.js +132 -39
- package/dist/integrations/configure/openclaude.js.map +1 -1
- package/dist/integrations/configure/openclaw.d.ts +19 -5
- package/dist/integrations/configure/openclaw.js +79 -23
- package/dist/integrations/configure/openclaw.js.map +1 -1
- package/dist/integrations/configure/opencode-style.d.ts +53 -11
- package/dist/integrations/configure/opencode-style.js +218 -23
- package/dist/integrations/configure/opencode-style.js.map +1 -1
- package/dist/integrations/configure/opencode.d.ts +5 -4
- package/dist/integrations/configure/opencode.js +8 -10
- package/dist/integrations/configure/opencode.js.map +1 -1
- package/dist/integrations/configure/openhands.d.ts +5 -4
- package/dist/integrations/configure/openhands.js +7 -7
- package/dist/integrations/configure/openhands.js.map +1 -1
- package/dist/integrations/configure/pi.d.ts +6 -5
- package/dist/integrations/configure/pi.js +79 -30
- package/dist/integrations/configure/pi.js.map +1 -1
- package/dist/integrations/configure/poolside.d.ts +5 -4
- package/dist/integrations/configure/poolside.js +7 -7
- package/dist/integrations/configure/poolside.js.map +1 -1
- package/dist/integrations/configure/registry.d.ts +6 -0
- package/dist/integrations/configure/registry.js +1 -0
- package/dist/integrations/configure/registry.js.map +1 -1
- package/dist/integrations/configure/zcode.d.ts +6 -7
- package/dist/integrations/configure/zcode.js +26 -11
- package/dist/integrations/configure/zcode.js.map +1 -1
- package/dist/integrations/configure/zed.d.ts +16 -4
- package/dist/integrations/configure/zed.js +61 -13
- package/dist/integrations/configure/zed.js.map +1 -1
- package/dist/models/gguf/kv-cache.d.ts +20 -1
- package/dist/models/gguf/kv-cache.js +97 -7
- package/dist/models/gguf/kv-cache.js.map +1 -1
- package/dist/models/gguf/reader.d.ts +5 -3
- package/dist/models/gguf/reader.js +10 -6
- package/dist/models/gguf/reader.js.map +1 -1
- package/dist/runtime/llamacpp/args.d.ts +14 -0
- package/dist/runtime/llamacpp/args.js +48 -4
- package/dist/runtime/llamacpp/args.js.map +1 -1
- package/dist/runtime/llamacpp/ctx-ladder.d.ts +6 -3
- package/dist/runtime/llamacpp/ctx-ladder.js +6 -3
- package/dist/runtime/llamacpp/ctx-ladder.js.map +1 -1
- package/dist/runtime/llamacpp/fit-margin.d.ts +24 -0
- package/dist/runtime/llamacpp/fit-margin.js +31 -0
- package/dist/runtime/llamacpp/fit-margin.js.map +1 -1
- package/dist/runtime/llamacpp/generation-limits.d.ts +45 -0
- package/dist/runtime/llamacpp/generation-limits.js +61 -0
- package/dist/runtime/llamacpp/generation-limits.js.map +1 -0
- package/dist/runtime/llamacpp/load-plan.d.ts +14 -2
- package/dist/runtime/llamacpp/load-plan.js +64 -13
- package/dist/runtime/llamacpp/load-plan.js.map +1 -1
- package/dist/runtime/llamacpp/runtime.d.ts +1 -0
- package/dist/runtime/llamacpp/runtime.js +2 -0
- package/dist/runtime/llamacpp/runtime.js.map +1 -1
- package/dist/runtime/managed-engines/runtime.js +13 -2
- package/dist/runtime/managed-engines/runtime.js.map +1 -1
- package/dist/runtime/managed-engines/spec.d.ts +6 -0
- package/dist/runtime/managed-engines/spec.js.map +1 -1
- package/dist/runtime/managed-models/auto-limits.d.ts +47 -0
- package/dist/runtime/managed-models/auto-limits.js +60 -0
- package/dist/runtime/managed-models/auto-limits.js.map +1 -0
- package/dist/runtime/managed-models/index.d.ts +1 -0
- package/dist/runtime/managed-models/index.js +1 -0
- package/dist/runtime/managed-models/index.js.map +1 -1
- package/dist/runtime/mlx/config.d.ts +9 -5
- package/dist/runtime/mlx/config.js +12 -6
- package/dist/runtime/mlx/config.js.map +1 -1
- package/dist/runtime/mlx/model-files.d.ts +9 -0
- package/dist/runtime/mlx/model-files.js +26 -0
- package/dist/runtime/mlx/model-files.js.map +1 -1
- package/dist/runtime/mlx/runtime.d.ts +7 -0
- package/dist/runtime/mlx/runtime.js +24 -2
- package/dist/runtime/mlx/runtime.js.map +1 -1
- package/dist/runtime/sglang/adapter.d.ts +4 -0
- package/dist/runtime/sglang/adapter.js +9 -6
- package/dist/runtime/sglang/adapter.js.map +1 -1
- package/dist/runtime/sglang/engine.js +2 -1
- package/dist/runtime/sglang/engine.js.map +1 -1
- package/dist/runtime/sglang/memory.d.ts +11 -1
- package/dist/runtime/sglang/memory.js +34 -3
- package/dist/runtime/sglang/memory.js.map +1 -1
- package/dist/runtime/sglang/settings.d.ts +2 -1
- package/dist/runtime/sglang/settings.js +11 -7
- package/dist/runtime/sglang/settings.js.map +1 -1
- package/dist/runtime/vllm/adapter.d.ts +4 -0
- package/dist/runtime/vllm/adapter.js +9 -6
- package/dist/runtime/vllm/adapter.js.map +1 -1
- package/dist/runtime/vllm/engine.js +1 -0
- package/dist/runtime/vllm/engine.js.map +1 -1
- package/dist/runtime/vllm/memory.d.ts +12 -1
- package/dist/runtime/vllm/memory.js +44 -2
- package/dist/runtime/vllm/memory.js.map +1 -1
- package/dist/runtime/vllm/settings.d.ts +2 -1
- package/dist/runtime/vllm/settings.js +12 -7
- package/dist/runtime/vllm/settings.js.map +1 -1
- package/dist/server/public/context-window.d.ts +29 -0
- package/dist/server/public/context-window.js +77 -0
- package/dist/server/public/context-window.js.map +1 -0
- package/dist/server/public/decision-preview.js +1 -0
- package/dist/server/public/decision-preview.js.map +1 -1
- package/dist/server/public/errors.d.ts +15 -4
- package/dist/server/public/errors.js +53 -7
- package/dist/server/public/errors.js.map +1 -1
- package/dist/server/public/forward.js +65 -5
- package/dist/server/public/forward.js.map +1 -1
- package/dist/server/public/index.d.ts +1 -0
- package/dist/server/public/index.js +1 -0
- package/dist/server/public/index.js.map +1 -1
- package/dist/server/public/listing.d.ts +9 -2
- package/dist/server/public/listing.js +30 -9
- package/dist/server/public/listing.js.map +1 -1
- package/dist/server/public/responses.js +9 -5
- package/dist/server/public/responses.js.map +1 -1
- package/dist/server/public/system-messages.d.ts +39 -0
- package/dist/server/public/system-messages.js +166 -0
- package/dist/server/public/system-messages.js.map +1 -0
- package/dist/server/public/telemetry.d.ts +9 -0
- package/dist/server/public/telemetry.js +42 -6
- package/dist/server/public/telemetry.js.map +1 -1
- package/dist/server/public/thinking.d.ts +26 -0
- package/dist/server/public/thinking.js +62 -0
- package/dist/server/public/thinking.js.map +1 -0
- package/dist/server/public/trace.d.ts +8 -0
- package/dist/server/public/trace.js +17 -0
- package/dist/server/public/trace.js.map +1 -1
- package/dist/server/public/types.d.ts +8 -0
- package/dist/server/shims/index.d.ts +1 -0
- package/dist/server/shims/index.js +1 -0
- package/dist/server/shims/index.js.map +1 -1
- package/dist/server/shims/reminders.d.ts +8 -0
- package/dist/server/shims/reminders.js +14 -0
- package/dist/server/shims/reminders.js.map +1 -0
- package/dist/server/shims/responses.d.ts +33 -9
- package/dist/server/shims/responses.js +160 -36
- package/dist/server/shims/responses.js.map +1 -1
- package/dist/settings/default-migrations.d.ts +34 -0
- package/dist/settings/default-migrations.js +47 -0
- package/dist/settings/default-migrations.js.map +1 -0
- package/dist/settings/schema/atomic-prism.json +23 -9
- package/dist/settings/schema/llamacpp-upstream.json +23 -9
- package/dist/settings/schema/llamacpp.json +23 -9
- package/dist/settings/schema/sglang.json +8 -8
- package/dist/settings/schema/vllm.json +8 -8
- package/dist/settings/schema.js +1 -0
- package/dist/settings/schema.js.map +1 -1
- package/dist/settings/store.d.ts +6 -0
- package/dist/settings/store.js +18 -1
- package/dist/settings/store.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../../src/integrations/configure/codex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAEpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAE9C,oEAAoE;AACpE,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAAA;AAC1C,sDAAsD;AACtD,MAAM,CAAC,MAAM,0BAA0B,GAAG,0BAA0B,CAAA;AACpE;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAU,CAAA;AAIrD;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,GAAsB,EAAE,IAAY;IAC5D,MAAM,GAAG,G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ACH,CAAC;IAED,MAAM,GAAG,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,CAAA;IAC/C,MAAM,MAAM,GAAG,MAAM,uBAAuB,CAAC,KAAK,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAA;IAC3E,IAAI,MAAM,CAAC,IAAI,KAAK,UAAU;QAAE,MAAM,IAAI,eAAe,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,CAAA;IAEpF,MAAM,iBAAiB,CAAC,KAAK,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,CAAA;AACtG,CAAC;AAED,cAAc,CAAC,OAAO,EAAE,cAAc,CAAC,CAAA"}
|
|
@@ -1,10 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* GitHub Copilot CLI
|
|
3
|
-
*
|
|
4
|
-
* `COPILOT_OFFLINE` is on so no GitHub sign-in is required and traffic stays on the local provider.
|
|
2
|
+
* GitHub Copilot CLI — an `atomic-chat` provider and its model in Copilot's `providers.json`.
|
|
3
|
+
* Twin of `copilot_config.rs` in the app.
|
|
5
4
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Earlier releases persisted `COPILOT_PROVIDER_*`, `COPILOT_MODEL` and `COPILOT_OFFLINE=true`
|
|
6
|
+
* user-wide (a marked block in the shell rc, `setx` on Windows), which put every `copilot` the user
|
|
7
|
+
* ran on the local server — and a `providers.json` with any provider in it overrides those
|
|
8
|
+
* variables anyway. The file is Copilot's documented home for named providers, holds the window
|
|
9
|
+
* limits the variables could not, and lists the model beside the user's own; `launch` selects it for
|
|
10
|
+
* the run through `COPILOT_MODEL=atomic-chat/<model>` (catalog `childEnv`), which Copilot reads like
|
|
11
|
+
* `--model`. Our entries are replaced in place; every other provider and model is kept.
|
|
12
|
+
*
|
|
13
|
+
* Copilot reads `apiKey` literally (no variable references), so a keyed server's key is written into
|
|
14
|
+
* the owner-only file, and a keyless one gets no key at all, as Copilot allows for a local server.
|
|
15
|
+
*
|
|
16
|
+
* Connect also removes exactly the rc blocks an earlier release wrote: a block must open and close
|
|
17
|
+
* with our marker and hold only `export COPILOT_…` and blank lines, or the file stays as it is. The
|
|
18
|
+
* Windows variables are removed by the desktop app.
|
|
8
19
|
*/
|
|
9
20
|
import type { ConfigureWriter } from './registry.js';
|
|
21
|
+
/** Our provider's `name`; Copilot addresses the model as `atomic-chat/<model id>`. */
|
|
22
|
+
export declare const COPILOT_PROVIDER_NAME = "atomic-chat";
|
|
23
|
+
/**
|
|
24
|
+
* `providers.json` where Copilot reads it: `$COPILOT_PROVIDERS_CONFIG`, else
|
|
25
|
+
* `$COPILOT_HOME/providers.json`, else `~/.copilot/providers.json`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function copilotProvidersPath(env: NodeJS.ProcessEnv, home: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* `text` without the blocks an earlier release wrote, or `undefined` when there is nothing it can
|
|
30
|
+
* vouch for.
|
|
31
|
+
*/
|
|
32
|
+
export declare function stripLegacyCopilotBlock(text: string): string | undefined;
|
|
10
33
|
export declare const configureCopilot: ConfigureWriter;
|
|
@@ -1,14 +1,130 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* GitHub Copilot CLI
|
|
3
|
-
*
|
|
4
|
-
* `COPILOT_OFFLINE` is on so no GitHub sign-in is required and traffic stays on the local provider.
|
|
2
|
+
* GitHub Copilot CLI — an `atomic-chat` provider and its model in Copilot's `providers.json`.
|
|
3
|
+
* Twin of `copilot_config.rs` in the app.
|
|
5
4
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Earlier releases persisted `COPILOT_PROVIDER_*`, `COPILOT_MODEL` and `COPILOT_OFFLINE=true`
|
|
6
|
+
* user-wide (a marked block in the shell rc, `setx` on Windows), which put every `copilot` the user
|
|
7
|
+
* ran on the local server — and a `providers.json` with any provider in it overrides those
|
|
8
|
+
* variables anyway. The file is Copilot's documented home for named providers, holds the window
|
|
9
|
+
* limits the variables could not, and lists the model beside the user's own; `launch` selects it for
|
|
10
|
+
* the run through `COPILOT_MODEL=atomic-chat/<model>` (catalog `childEnv`), which Copilot reads like
|
|
11
|
+
* `--model`. Our entries are replaced in place; every other provider and model is kept.
|
|
12
|
+
*
|
|
13
|
+
* Copilot reads `apiKey` literally (no variable references), so a keyed server's key is written into
|
|
14
|
+
* the owner-only file, and a keyless one gets no key at all, as Copilot allows for a local server.
|
|
15
|
+
*
|
|
16
|
+
* Connect also removes exactly the rc blocks an earlier release wrote: a block must open and close
|
|
17
|
+
* with our marker and hold only `export COPILOT_…` and blank lines, or the file stays as it is. The
|
|
18
|
+
* Windows variables are removed by the desktop app.
|
|
8
19
|
*/
|
|
20
|
+
import { AtomicCoreError } from '../../contracts/index.js';
|
|
21
|
+
import { canonicalJson, expandTilde, parseJsonStrict } from '../config-io.js';
|
|
22
|
+
import { knownWindow, outputCap } from './backup.js';
|
|
23
|
+
import { asJsonObject } from './json-tree.js';
|
|
9
24
|
import { registerWriter } from './registry.js';
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
25
|
+
/** Our provider's `name`; Copilot addresses the model as `atomic-chat/<model id>`. */
|
|
26
|
+
export const COPILOT_PROVIDER_NAME = 'atomic-chat';
|
|
27
|
+
const LEGACY_MARKER = '# Atomic Chat - Copilot CLI Config';
|
|
28
|
+
/** Every rc file an earlier release could have written to. */
|
|
29
|
+
const LEGACY_RC_FILES = ['.zshenv', '.bash_profile', '.bashrc'];
|
|
30
|
+
/**
|
|
31
|
+
* `providers.json` where Copilot reads it: `$COPILOT_PROVIDERS_CONFIG`, else
|
|
32
|
+
* `$COPILOT_HOME/providers.json`, else `~/.copilot/providers.json`.
|
|
33
|
+
*/
|
|
34
|
+
export function copilotProvidersPath(env, home) {
|
|
35
|
+
const value = (name) => {
|
|
36
|
+
const raw = env[name]?.trim();
|
|
37
|
+
return raw ? expandTilde(raw, home) : undefined;
|
|
38
|
+
};
|
|
39
|
+
return value('COPILOT_PROVIDERS_CONFIG') ?? `${value('COPILOT_HOME') ?? '.copilot'}/providers.json`;
|
|
40
|
+
}
|
|
41
|
+
const named = (entry, field) => asJsonObject(entry)?.[field] === COPILOT_PROVIDER_NAME;
|
|
42
|
+
/** `root[key]` as a list, created when absent or null (Copilot reads both as empty). */
|
|
43
|
+
function list(root, key, path) {
|
|
44
|
+
const value = root[key];
|
|
45
|
+
if (value === undefined || value === null)
|
|
46
|
+
root[key] = [];
|
|
47
|
+
const out = root[key];
|
|
48
|
+
if (!Array.isArray(out)) {
|
|
49
|
+
throw new AtomicCoreError('IO_ERROR', `\`${key}\` in ${path} is not a list. Fix or remove it and try again.`);
|
|
50
|
+
}
|
|
51
|
+
return out;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* `text` without the blocks an earlier release wrote, or `undefined` when there is nothing it can
|
|
55
|
+
* vouch for.
|
|
56
|
+
*/
|
|
57
|
+
export function stripLegacyCopilotBlock(text) {
|
|
58
|
+
const isMarker = (line) => line.replace(/[\r\n]+$/, '') === LEGACY_MARKER;
|
|
59
|
+
const lines = text.split(/(?<=\n)/);
|
|
60
|
+
if (!lines.some(isMarker))
|
|
61
|
+
return undefined;
|
|
62
|
+
const kept = [];
|
|
63
|
+
let open = false;
|
|
64
|
+
for (const line of lines) {
|
|
65
|
+
if (isMarker(line)) {
|
|
66
|
+
open = !open;
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
if (open) {
|
|
70
|
+
const bare = line.replace(/[\r\n]+$/, '');
|
|
71
|
+
if (bare.trim() !== '' && !bare.startsWith('export COPILOT_'))
|
|
72
|
+
return undefined;
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
kept.push(line);
|
|
76
|
+
}
|
|
77
|
+
return open ? undefined : kept.join('');
|
|
78
|
+
}
|
|
79
|
+
export const configureCopilot = async ({ apiUrl, model, apiKey, fs, env, platform, contextLength, }) => {
|
|
80
|
+
const path = copilotProvidersPath(env, fs.home);
|
|
81
|
+
const text = await fs.read(path);
|
|
82
|
+
const root = asJsonObject(text === undefined ? {} : parseJsonStrict(text, fs.absolute(path)));
|
|
83
|
+
if (!root)
|
|
84
|
+
throw new AtomicCoreError('IO_ERROR', `${fs.absolute(path)} is not a JSON object`);
|
|
85
|
+
const providers = list(root, 'providers', fs.absolute(path));
|
|
86
|
+
const provider = {
|
|
87
|
+
name: COPILOT_PROVIDER_NAME,
|
|
88
|
+
type: 'openai',
|
|
89
|
+
baseUrl: apiUrl,
|
|
90
|
+
...(apiKey ? { apiKey } : {}),
|
|
91
|
+
};
|
|
92
|
+
const at = providers.findIndex((p) => named(p, 'name'));
|
|
93
|
+
if (at >= 0) {
|
|
94
|
+
providers[at] = provider;
|
|
95
|
+
root['providers'] = providers.filter((p, i) => i <= at || !named(p, 'name'));
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
providers.push(provider);
|
|
99
|
+
}
|
|
100
|
+
const models = list(root, 'models', fs.absolute(path));
|
|
101
|
+
const first = models.findIndex((m) => named(m, 'provider'));
|
|
102
|
+
const others = models.filter((m) => !named(m, 'provider'));
|
|
103
|
+
// A known window becomes Copilot's limits: the reply capped at a quarter of it (8192 at most) and
|
|
104
|
+
// the prompt given the rest. Unknown, Copilot assumes 128K for a model it does not know.
|
|
105
|
+
const window = knownWindow(contextLength);
|
|
106
|
+
const ours = {
|
|
107
|
+
id: model,
|
|
108
|
+
provider: COPILOT_PROVIDER_NAME,
|
|
109
|
+
...(window !== undefined
|
|
110
|
+
? {
|
|
111
|
+
maxContextWindowTokens: window,
|
|
112
|
+
maxPromptTokens: window - outputCap(window),
|
|
113
|
+
maxOutputTokens: outputCap(window),
|
|
114
|
+
}
|
|
115
|
+
: {}),
|
|
116
|
+
};
|
|
117
|
+
others.splice(first >= 0 ? Math.min(first, others.length) : others.length, 0, ours);
|
|
118
|
+
root['models'] = others;
|
|
119
|
+
// Plain text keys, the user's own among them.
|
|
120
|
+
await fs.write(path, canonicalJson(root), platform === 'win32' ? {} : { mode: 0o600 });
|
|
121
|
+
for (const rc of LEGACY_RC_FILES) {
|
|
122
|
+
const existing = await fs.read(rc);
|
|
123
|
+
const stripped = existing === undefined ? undefined : stripLegacyCopilotBlock(existing);
|
|
124
|
+
// Written through a symbolic link (dotfile managers link rc files), never over it.
|
|
125
|
+
if (stripped !== undefined)
|
|
126
|
+
await fs.write(await fs.linkTarget(rc), stripped);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
13
129
|
registerWriter('copilot', configureCopilot);
|
|
14
130
|
//# sourceMappingURL=copilot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copilot.js","sourceRoot":"","sources":["../../../src/integrations/configure/copilot.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"copilot.js","sourceRoot":"","sources":["../../../src/integrations/configure/copilot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAE1D,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAC7E,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAE9C,sFAAsF;AACtF,MAAM,CAAC,MAAM,qBAAqB,GAAG,aAAa,CAAA;AAClD,MAAM,aAAa,GAAG,oCAAoC,CAAA;AAC1D,8DAA8D;AAC9D,MAAM,eAAe,GAAG,CAAC,SAAS,EAAE,eAAe,EAAE,SAAS,CAAC,CAAA;AAE/D;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,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E,CAAC,EAAE,QAAQ,CAAC,CAAA;IAC/E,CAAC;AACH,CAAC,CAAA;AAED,cAAc,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAA"}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Factory Droid keeps its BYOK providers in `~/.factory/settings.json` as a `customModels` array
|
|
3
|
-
*
|
|
2
|
+
* Factory Droid keeps its BYOK providers in `~/.factory/settings.json` as a `customModels` array.
|
|
3
|
+
* Twin of `droid_config.rs` in the app.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
5
|
+
* Droid addresses a custom model by its `id`, `custom:<displayName with dashes>-<n>`; our entry
|
|
6
|
+
* carries `id` and `index` explicitly so the selector cannot drift when other entries move, and we
|
|
7
|
+
* upsert by `displayName` (our managed marker) so a rerun replaces it in place. The default for new
|
|
8
|
+
* sessions lives in `sessionDefaultSettings.model`: Droid moves a legacy top-level `model` there only
|
|
9
|
+
* when that key is empty, so the top-level value earlier releases wrote lost to any default the user
|
|
10
|
+
* had. That one is removed; the default the user had before is kept in the backup sidecar for the
|
|
11
|
+
* desktop's Disconnect.
|
|
12
|
+
*
|
|
13
|
+
* A known served window caps the reply at a quarter of it (8192 at most) and gives Droid the rest
|
|
14
|
+
* as `maxContextLimit`; an unknown one writes neither, where earlier releases claimed 16384 output
|
|
15
|
+
* tokens — the whole of a 16K window.
|
|
10
16
|
*/
|
|
11
17
|
import type { ConfigureWriter } from './registry.js';
|
|
12
18
|
export declare const configureDroid: ConfigureWriter;
|
|
@@ -1,47 +1,78 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Factory Droid keeps its BYOK providers in `~/.factory/settings.json` as a `customModels` array
|
|
3
|
-
*
|
|
2
|
+
* Factory Droid keeps its BYOK providers in `~/.factory/settings.json` as a `customModels` array.
|
|
3
|
+
* Twin of `droid_config.rs` in the app.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
5
|
+
* Droid addresses a custom model by its `id`, `custom:<displayName with dashes>-<n>`; our entry
|
|
6
|
+
* carries `id` and `index` explicitly so the selector cannot drift when other entries move, and we
|
|
7
|
+
* upsert by `displayName` (our managed marker) so a rerun replaces it in place. The default for new
|
|
8
|
+
* sessions lives in `sessionDefaultSettings.model`: Droid moves a legacy top-level `model` there only
|
|
9
|
+
* when that key is empty, so the top-level value earlier releases wrote lost to any default the user
|
|
10
|
+
* had. That one is removed; the default the user had before is kept in the backup sidecar for the
|
|
11
|
+
* desktop's Disconnect.
|
|
12
|
+
*
|
|
13
|
+
* A known served window caps the reply at a quarter of it (8192 at most) and gives Droid the rest
|
|
14
|
+
* as `maxContextLimit`; an unknown one writes neither, where earlier releases claimed 16384 output
|
|
15
|
+
* tokens — the whole of a 16K window.
|
|
10
16
|
*/
|
|
11
17
|
import { AtomicCoreError } from '../../contracts/index.js';
|
|
12
18
|
import { canonicalJson, keyOr, parseJsonStrict } from '../config-io.js';
|
|
19
|
+
import { knownWindow, outputCap, readSidecar, sameJson, writeSidecar } from './backup.js';
|
|
13
20
|
import { asJsonArray, asJsonObject } from './json-tree.js';
|
|
14
21
|
import { registerWriter } from './registry.js';
|
|
15
22
|
const DISPLAY_NAME = 'Atomic Chat';
|
|
23
|
+
/** `custom:` + the display name with whitespace runs turned into dashes. */
|
|
24
|
+
const SELECTOR_PREFIX = 'custom:Atomic-Chat-';
|
|
16
25
|
const SETTINGS_PATH = '.factory/settings.json';
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
export const configureDroid = async ({ apiUrl, model, apiKey, fs }) => {
|
|
26
|
+
const SESSION_DEFAULTS = 'sessionDefaultSettings';
|
|
27
|
+
const isOurSelector = (value) => typeof value === 'string' && value.startsWith(SELECTOR_PREFIX);
|
|
28
|
+
export const configureDroid = async ({ apiUrl, model, apiKey, fs, platform, contextLength, }) => {
|
|
20
29
|
const text = await fs.read(SETTINGS_PATH);
|
|
21
30
|
const parsed = text === undefined ? {} : parseJsonStrict(text, fs.absolute(SETTINGS_PATH));
|
|
22
31
|
const root = asJsonObject(parsed);
|
|
23
32
|
if (!root)
|
|
24
33
|
throw new AtomicCoreError('IO_ERROR', 'settings.json is not a JSON object');
|
|
34
|
+
// What the desktop's Disconnect puts back: the default before the first Connect, kept across
|
|
35
|
+
// reconnects while the file still has ours.
|
|
36
|
+
const currentDefault = asJsonObject(root[SESSION_DEFAULTS])?.['model'];
|
|
37
|
+
const backup = await readSidecar(fs, SETTINGS_PATH);
|
|
38
|
+
const previous = backup !== undefined &&
|
|
39
|
+
currentDefault !== undefined &&
|
|
40
|
+
sameJson(asJsonObject(backup['written'])?.['defaultModel'], currentDefault)
|
|
41
|
+
? (backup['previous'] ?? null)
|
|
42
|
+
: {
|
|
43
|
+
defaultModel: currentDefault ?? null,
|
|
44
|
+
sessionDefaultSettings: Object.hasOwn(root, SESSION_DEFAULTS),
|
|
45
|
+
};
|
|
25
46
|
// A `customModels` that is not an array is unusable to Droid anyway, so it is replaced rather than
|
|
26
47
|
// preserved — unlike the individual entries inside it, which are the user's own providers.
|
|
27
48
|
const models = asJsonArray(root['customModels']) ?? [];
|
|
49
|
+
const found = models.findIndex((m) => asJsonObject(m)?.['displayName'] === DISPLAY_NAME);
|
|
50
|
+
const index = found >= 0 ? found : models.length;
|
|
51
|
+
const selector = `${SELECTOR_PREFIX}${index}`;
|
|
52
|
+
const window = knownWindow(contextLength);
|
|
28
53
|
const entry = {
|
|
29
54
|
model,
|
|
55
|
+
id: selector,
|
|
56
|
+
index,
|
|
30
57
|
displayName: DISPLAY_NAME,
|
|
31
58
|
baseUrl: apiUrl,
|
|
32
59
|
// Droid rejects an empty apiKey outright, so a keyless local server still needs a placeholder.
|
|
33
60
|
apiKey: keyOr(apiKey, 'atomic'),
|
|
34
61
|
provider: 'generic-chat-completion-api',
|
|
35
|
-
|
|
62
|
+
...(window !== undefined
|
|
63
|
+
? { maxOutputTokens: outputCap(window), maxContextLimit: window - outputCap(window) }
|
|
64
|
+
: {}),
|
|
36
65
|
};
|
|
37
|
-
|
|
38
|
-
if (index >= 0)
|
|
39
|
-
models[index] = entry;
|
|
40
|
-
else
|
|
41
|
-
index = models.push(entry) - 1;
|
|
66
|
+
models[index] = entry;
|
|
42
67
|
root['customModels'] = models;
|
|
43
|
-
|
|
68
|
+
// Earlier releases selected us through the legacy top-level key.
|
|
69
|
+
if (isOurSelector(root['model']))
|
|
70
|
+
delete root['model'];
|
|
71
|
+
const defaults = asJsonObject(root[SESSION_DEFAULTS]) ?? {};
|
|
72
|
+
defaults['model'] = selector;
|
|
73
|
+
root[SESSION_DEFAULTS] = defaults;
|
|
44
74
|
await fs.write(SETTINGS_PATH, canonicalJson(root));
|
|
75
|
+
await writeSidecar(fs, SETTINGS_PATH, { previous, written: { defaultModel: selector } }, platform);
|
|
45
76
|
};
|
|
46
77
|
registerWriter('droid', configureDroid);
|
|
47
78
|
//# sourceMappingURL=droid.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"droid.js","sourceRoot":"","sources":["../../../src/integrations/configure/droid.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"droid.js","sourceRoot":"","sources":["../../../src/integrations/configure/droid.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAE1D,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACvE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAEzF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE1D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAE9C,MAAM,YAAY,GAAG,aAAa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,CAAA;IACtD,MAAM,QAAQ,GAAG,YAAY,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,IAAI,EAAE,CAAA;IAC3D,QAAQ,CAAC,OAAO,CAAC,GAAG,QAAQ,CAAA;IAC5B,IAAI,CAAC,gBAAgB,CAAC,GAAG,QAAQ,CAAA;IAEjC,MAAM,EAAE,CAAC,KAAK,CAAC,aAAa,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC,CAAA;IAClD,MAAM,YAAY,CAAC,EAAE,EAAE,aAAa,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAA;AACpG,CAAC,CAAA;AAED,cAAc,CAAC,OAAO,EAAE,cAAc,CAAC,CAAA"}
|
|
@@ -1,33 +1,49 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* DeepSeek Harness (`dsh`)
|
|
3
|
-
* the local server is a single upsert of the `llm-pi-ai.providers.atomic` route — no restart needed.
|
|
2
|
+
* DeepSeek Harness (`dsh`). Twin of `configure_dsh_at` in the app's `commands.rs` and `dsh_config.rs`.
|
|
4
3
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* value, so a rejected key cannot leak into a log or a toast.
|
|
4
|
+
* dsh 0.2 dropped the live `$DSH_HOME/settings.yaml` (default `~/.dsh`): settings now live in the
|
|
5
|
+
* active profile's `cordis.patch.yml`, a YAML list of entry overrides (`- id: llm-pi-ai` /
|
|
6
|
+
* `config: …`), and a leftover `settings.yaml` is merged into that profile once and renamed
|
|
7
|
+
* `settings.yaml.imported`. `dsh web`, which `launch` runs, boots the `web` profile, so the `atomic`
|
|
8
|
+
* route goes under its `llm-pi-ai` row's `providers` and its `agent-default-model` row is set to it,
|
|
9
|
+
* so new sessions open on the local model instead of DeepSeek's. dsh picks both up without a restart.
|
|
12
10
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
11
|
+
* The profile patch is the user's (dsh's Settings page edits it, keeping comments and `!!js`
|
|
12
|
+
* expressions), so only our two rows are re-serialized; every other row, comment and blank line is
|
|
13
|
+
* kept byte for byte. A file whose rows cannot be told apart that way is rewritten whole only when
|
|
14
|
+
* nothing but comments would be lost, and refused when it holds `!!js` expressions. The default the
|
|
15
|
+
* user had is kept in the backup sidecar for the desktop's Disconnect.
|
|
16
|
+
*
|
|
17
|
+
* A `settings.yaml` that is still there is read live by dsh before 0.2 and merged over the profile
|
|
18
|
+
* by 0.2+, so it gets the route too (and our default, when it names one); one is never created, and
|
|
19
|
+
* `settings.yaml.imported` is never touched.
|
|
20
|
+
*
|
|
21
|
+
* This writer refuses its input when it would do harm: dsh rejects the ENTIRE `llm-pi-ai` section
|
|
22
|
+
* when one route in it is invalid, taking the user's other providers down with it. A route needs
|
|
23
|
+
* `api`, `baseURL` and a non-empty `models` list, so a blank URL or model is refused before anything
|
|
24
|
+
* is touched. The credential is validated for the same reason: an unquoted dotenv value ends at
|
|
25
|
+
* whitespace or `#`, and a newline would inject a second assignment, so a key carrying any of those
|
|
26
|
+
* is rejected — with a message that names the variable and never the value. The route is replaced
|
|
27
|
+
* WHOLESALE rather than deep-merged: a merge would let a stale `apiKeyEnv` from an earlier keyed run
|
|
28
|
+
* survive a keyless run and break every request with MISSING_CREDENTIAL.
|
|
18
29
|
*/
|
|
19
30
|
import type { ConfigureWriter } from './registry.js';
|
|
20
31
|
type YamlMapping = Record<string, unknown>;
|
|
21
32
|
/** Reject a value no dotenv line can carry. The message names the variable, never the value. */
|
|
22
33
|
export declare function dshValidateEnvValue(name: string, value: string): void;
|
|
23
|
-
/** The `llm-pi-ai.providers.atomic` node. Keyless omits `apiKeyEnv` rather than writing an empty one. */
|
|
24
|
-
export declare function dshRouteNode(apiUrl: string, model: string, withKey: boolean): YamlMapping;
|
|
25
34
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
35
|
+
* The `atomic` route node. Keyless omits `apiKeyEnv` rather than writing an empty one. A model the
|
|
36
|
+
* pi-ai catalog does not ship falls back to a 262144 window and 32768 output tokens; a known served
|
|
37
|
+
* window is declared instead, with a reply of a quarter of it (8192 at most).
|
|
38
|
+
*/
|
|
39
|
+
export declare function dshRouteNode(apiUrl: string, model: string, withKey: boolean, contextLength?: number): YamlMapping;
|
|
40
|
+
/**
|
|
41
|
+
* Upsert our route into an already-parsed legacy `settings.yaml` tree. Pure: no I/O, no environment.
|
|
42
|
+
* Everything outside `llm-pi-ai.providers.atomic` is preserved, including relative order.
|
|
29
43
|
*/
|
|
30
|
-
export declare function applyDshProvider(root: unknown, apiUrl: string, model: string, withKey: boolean): unknown;
|
|
44
|
+
export declare function applyDshProvider(root: unknown, apiUrl: string, model: string, withKey: boolean, contextLength?: number): unknown;
|
|
45
|
+
/** A YAML tag such as `!!js`, which a re-serialization would drop. */
|
|
46
|
+
export declare function hasYamlTag(text: string): boolean;
|
|
31
47
|
/** `$DSH_HOME` when set, else `~/.dsh`. A literal `~` can reach us from a quoted rc-file value. */
|
|
32
48
|
export declare function dshHome(env: NodeJS.ProcessEnv, home: string): string;
|
|
33
49
|
export declare const configureDsh: ConfigureWriter;
|