poe-code 3.0.454 → 4.0.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/commands/test.js +23 -7
- package/dist/cli/commands/test.js.map +1 -1
- package/dist/cli/container.js +2 -9
- package/dist/cli/container.js.map +1 -1
- package/dist/cli/program.js +0 -3
- package/dist/cli/program.js.map +1 -1
- package/dist/index.js +493 -733
- package/dist/index.js.map +4 -4
- package/dist/metafile.json +1 -1
- package/dist/providers/opencode.js +159 -47
- package/dist/providers/opencode.js.map +4 -4
- package/dist/sdk/container.js +2 -10
- package/dist/sdk/container.js.map +1 -1
- package/package.json +1 -4
- package/dist/bin/poe-claude.js +0 -23
- package/dist/bin/poe-codex.js +0 -23
- package/dist/bin/poe-gemini.js +0 -23
- package/dist/bin/poe-goose.js +0 -23
- package/dist/bin/poe-kimi-cli.js +0 -23
- package/dist/bin/poe-opencode.js +0 -23
- package/dist/cli/binary-aliases.d.ts +0 -7
- package/dist/cli/binary-aliases.js +0 -26
- package/dist/cli/binary-aliases.js.map +0 -1
- package/dist/cli/commands/wrap.d.ts +0 -3
- package/dist/cli/commands/wrap.js +0 -71
- package/dist/cli/commands/wrap.js.map +0 -1
- package/dist/cli/isolated-env-runner.d.ts +0 -13
- package/dist/cli/isolated-env-runner.js +0 -50
- package/dist/cli/isolated-env-runner.js.map +0 -1
- package/dist/cli/poe-code-command-runner.d.ts +0 -6
- package/dist/cli/poe-code-command-runner.js +0 -70
- package/dist/cli/poe-code-command-runner.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -22958,30 +22958,6 @@ async function isolatedConfigExists(fs31, configProbePath) {
|
|
|
22958
22958
|
throw error3;
|
|
22959
22959
|
}
|
|
22960
22960
|
}
|
|
22961
|
-
async function applyIsolatedEnvRepairs(input) {
|
|
22962
|
-
const repairs = input.isolated.repairs ?? [];
|
|
22963
|
-
if (repairs.length === 0 || typeof input.fs.chmod !== "function") {
|
|
22964
|
-
return;
|
|
22965
|
-
}
|
|
22966
|
-
const baseDir = input.env.resolveHomePath(".poe-code", input.providerName);
|
|
22967
|
-
for (const repair of repairs) {
|
|
22968
|
-
if (repair.kind !== "chmod") {
|
|
22969
|
-
continue;
|
|
22970
|
-
}
|
|
22971
|
-
if (path17.isAbsolute(repair.relativePath)) {
|
|
22972
|
-
continue;
|
|
22973
|
-
}
|
|
22974
|
-
const repairPath = path17.join(baseDir, repair.relativePath);
|
|
22975
|
-
try {
|
|
22976
|
-
await input.fs.chmod(repairPath, repair.mode);
|
|
22977
|
-
} catch (error3) {
|
|
22978
|
-
if (isNotFound(error3)) {
|
|
22979
|
-
continue;
|
|
22980
|
-
}
|
|
22981
|
-
throw error3;
|
|
22982
|
-
}
|
|
22983
|
-
}
|
|
22984
|
-
}
|
|
22985
22961
|
async function resolveCliSettings(cliSettings, env, activeProvider) {
|
|
22986
22962
|
const result = { ...cliSettings.values };
|
|
22987
22963
|
if (cliSettings.resolved) {
|
|
@@ -37836,13 +37812,13 @@ var init_acp_transport = __esm({
|
|
|
37836
37812
|
cwd,
|
|
37837
37813
|
env,
|
|
37838
37814
|
firstRequestId,
|
|
37839
|
-
spawn:
|
|
37815
|
+
spawn: spawn11 = spawnChildProcess3
|
|
37840
37816
|
} = options;
|
|
37841
37817
|
this.command = command;
|
|
37842
37818
|
this.closed = new Promise((resolve14) => {
|
|
37843
37819
|
this.resolveClosed = resolve14;
|
|
37844
37820
|
});
|
|
37845
|
-
this.child =
|
|
37821
|
+
this.child = spawn11(command, [...args], {
|
|
37846
37822
|
cwd,
|
|
37847
37823
|
env,
|
|
37848
37824
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -68352,11 +68328,6 @@ function createCheckRunner(resources) {
|
|
|
68352
68328
|
});
|
|
68353
68329
|
};
|
|
68354
68330
|
}
|
|
68355
|
-
function listIsolatedServiceIds(container) {
|
|
68356
|
-
return listServiceNames(
|
|
68357
|
-
container.registry.list().filter((provider2) => Boolean(provider2.isolatedEnv))
|
|
68358
|
-
);
|
|
68359
|
-
}
|
|
68360
68331
|
function listServiceNames(services) {
|
|
68361
68332
|
const names = [];
|
|
68362
68333
|
const add = (value) => {
|
|
@@ -70685,535 +70656,6 @@ var init_providers = __esm({
|
|
|
70685
70656
|
}
|
|
70686
70657
|
});
|
|
70687
70658
|
|
|
70688
|
-
// src/utils/cli-settings-merge.ts
|
|
70689
|
-
function extractSettingsFromArgs(args) {
|
|
70690
|
-
const settingsIdx = args.indexOf("--settings");
|
|
70691
|
-
if (settingsIdx === -1 || settingsIdx >= args.length - 1) {
|
|
70692
|
-
return { userSettings: null, argsWithoutSettings: args };
|
|
70693
|
-
}
|
|
70694
|
-
const settingsValue = args[settingsIdx + 1];
|
|
70695
|
-
const argsWithoutSettings = [
|
|
70696
|
-
...args.slice(0, settingsIdx),
|
|
70697
|
-
...args.slice(settingsIdx + 2)
|
|
70698
|
-
];
|
|
70699
|
-
if (settingsValue.startsWith("{")) {
|
|
70700
|
-
return {
|
|
70701
|
-
userSettings: JSON.parse(settingsValue),
|
|
70702
|
-
argsWithoutSettings
|
|
70703
|
-
};
|
|
70704
|
-
}
|
|
70705
|
-
return {
|
|
70706
|
-
userSettings: null,
|
|
70707
|
-
settingsFilePath: settingsValue,
|
|
70708
|
-
argsWithoutSettings
|
|
70709
|
-
};
|
|
70710
|
-
}
|
|
70711
|
-
function mergeCliSettings(userSettings, requiredSettings) {
|
|
70712
|
-
if (!userSettings) {
|
|
70713
|
-
return requiredSettings;
|
|
70714
|
-
}
|
|
70715
|
-
const merged = {
|
|
70716
|
-
...userSettings,
|
|
70717
|
-
...requiredSettings
|
|
70718
|
-
};
|
|
70719
|
-
if (userSettings.env || requiredSettings.env) {
|
|
70720
|
-
merged.env = {
|
|
70721
|
-
...userSettings.env ?? {},
|
|
70722
|
-
...requiredSettings.env ?? {}
|
|
70723
|
-
};
|
|
70724
|
-
}
|
|
70725
|
-
return merged;
|
|
70726
|
-
}
|
|
70727
|
-
function buildArgsWithMergedSettings(args, requiredSettings) {
|
|
70728
|
-
const { userSettings, settingsFilePath, argsWithoutSettings } = extractSettingsFromArgs(args);
|
|
70729
|
-
if (settingsFilePath) {
|
|
70730
|
-
throw new Error(
|
|
70731
|
-
`Cannot merge provider-required settings with --settings file path ${settingsFilePath}. Pass settings as inline JSON or remove --settings.`
|
|
70732
|
-
);
|
|
70733
|
-
}
|
|
70734
|
-
const merged = mergeCliSettings(userSettings, requiredSettings);
|
|
70735
|
-
return [...argsWithoutSettings, "--settings", JSON.stringify(merged)];
|
|
70736
|
-
}
|
|
70737
|
-
var init_cli_settings_merge = __esm({
|
|
70738
|
-
"src/utils/cli-settings-merge.ts"() {
|
|
70739
|
-
"use strict";
|
|
70740
|
-
}
|
|
70741
|
-
});
|
|
70742
|
-
|
|
70743
|
-
// src/cli/commands/configure-payload.ts
|
|
70744
|
-
async function createConfigurePayload(init) {
|
|
70745
|
-
const { container, flags, options, context, adapter, logger: logger2, providerId } = init;
|
|
70746
|
-
const payload = { env: context.env };
|
|
70747
|
-
let provider2;
|
|
70748
|
-
let activeProvider;
|
|
70749
|
-
let resolvedModelChoices;
|
|
70750
|
-
let hasResolvedModelChoices = false;
|
|
70751
|
-
if (providerId) {
|
|
70752
|
-
provider2 = container.providerRegistry.get(providerId);
|
|
70753
|
-
if (!provider2) {
|
|
70754
|
-
throw new Error(`Unknown provider "${providerId}".`);
|
|
70755
|
-
}
|
|
70756
|
-
const explicitShapeBaseUrls = parseProviderShapeBaseUrls(provider2, options.shapeBaseUrl ?? []);
|
|
70757
|
-
const agent3 = resolveAgentDefinition(adapter.name) ?? { id: adapter.name };
|
|
70758
|
-
const apiKey = flags.dryRun ? PREVIEW_API_KEY : providerId === POE_PROVIDER_ID ? await container.options.resolveApiKey({
|
|
70759
|
-
value: options.apiKey,
|
|
70760
|
-
envValue: provider2.auth.kind === "api-key" ? container.env.getVariable(provider2.auth.envVar) : void 0,
|
|
70761
|
-
dryRun: false,
|
|
70762
|
-
assumeYes: flags.assumeYes
|
|
70763
|
-
}) : await container.providerRegistry.resolveCredential(
|
|
70764
|
-
providerId,
|
|
70765
|
-
{ apiKey: options.apiKey },
|
|
70766
|
-
{ envVars: container.env.variables }
|
|
70767
|
-
);
|
|
70768
|
-
const explicitBaseUrl = await resolveConfigureBaseUrl({
|
|
70769
|
-
options
|
|
70770
|
-
});
|
|
70771
|
-
activeProvider = await buildActiveProvider({
|
|
70772
|
-
container,
|
|
70773
|
-
provider: provider2,
|
|
70774
|
-
agent: agent3,
|
|
70775
|
-
credential: apiKey,
|
|
70776
|
-
explicitBaseUrl,
|
|
70777
|
-
explicitShapeBaseUrls,
|
|
70778
|
-
readOnly: flags.dryRun
|
|
70779
|
-
});
|
|
70780
|
-
payload.provider = activeProvider;
|
|
70781
|
-
}
|
|
70782
|
-
const modelPrompt = adapter.configurePrompts?.model;
|
|
70783
|
-
if (modelPrompt) {
|
|
70784
|
-
const configModel = await resolveModel(
|
|
70785
|
-
{
|
|
70786
|
-
fs: container.fs,
|
|
70787
|
-
filePath: container.env.configPath,
|
|
70788
|
-
readOnly: flags.dryRun
|
|
70789
|
-
},
|
|
70790
|
-
adapter.name
|
|
70791
|
-
);
|
|
70792
|
-
const model = provider2?.modelInput?.kind === "freeform" && typeof modelPrompt.choices !== "function" ? await resolveFreeformProviderModel({
|
|
70793
|
-
container,
|
|
70794
|
-
flags,
|
|
70795
|
-
options,
|
|
70796
|
-
label: modelPrompt.label,
|
|
70797
|
-
configModel,
|
|
70798
|
-
provider: provider2,
|
|
70799
|
-
logger: logger2
|
|
70800
|
-
}) : await container.options.resolveModel({
|
|
70801
|
-
value: options.model,
|
|
70802
|
-
assumeDefault: flags.assumeYes,
|
|
70803
|
-
defaultValue: configModel ?? modelPrompt.defaultValue,
|
|
70804
|
-
choices: await resolveChoices(),
|
|
70805
|
-
label: modelPrompt.label,
|
|
70806
|
-
onResolve: (label, value) => logger2.resolved(label, value)
|
|
70807
|
-
});
|
|
70808
|
-
payload.model = model;
|
|
70809
|
-
}
|
|
70810
|
-
const reasoningPrompt = adapter.configurePrompts?.reasoningEffort;
|
|
70811
|
-
if (reasoningPrompt) {
|
|
70812
|
-
const reasoningEffort = await container.options.resolveReasoning({
|
|
70813
|
-
value: options.reasoningEffort,
|
|
70814
|
-
assumeDefault: flags.assumeYes,
|
|
70815
|
-
defaultValue: reasoningPrompt.defaultValue,
|
|
70816
|
-
label: reasoningPrompt.label
|
|
70817
|
-
});
|
|
70818
|
-
payload.reasoningEffort = reasoningEffort;
|
|
70819
|
-
}
|
|
70820
|
-
const extension = flags.dryRun ? void 0 : await adapter.extendConfigurePayload?.({
|
|
70821
|
-
fs: container.fs,
|
|
70822
|
-
env: context.env,
|
|
70823
|
-
httpClient: container.httpClient,
|
|
70824
|
-
logger: logger2,
|
|
70825
|
-
payload,
|
|
70826
|
-
prompts: container.prompts,
|
|
70827
|
-
promptLibrary: container.promptLibrary,
|
|
70828
|
-
assumeYes: flags.assumeYes,
|
|
70829
|
-
commandOptions: options
|
|
70830
|
-
});
|
|
70831
|
-
if (extension) {
|
|
70832
|
-
Object.assign(payload, extension);
|
|
70833
|
-
}
|
|
70834
|
-
return payload;
|
|
70835
|
-
async function resolveChoices() {
|
|
70836
|
-
const choices2 = modelPrompt?.choices;
|
|
70837
|
-
if (!choices2) {
|
|
70838
|
-
return void 0;
|
|
70839
|
-
}
|
|
70840
|
-
if (flags.dryRun && typeof choices2 === "function") {
|
|
70841
|
-
return [{ title: modelPrompt.defaultValue, value: modelPrompt.defaultValue }];
|
|
70842
|
-
}
|
|
70843
|
-
if (typeof choices2 !== "function") {
|
|
70844
|
-
return choices2;
|
|
70845
|
-
}
|
|
70846
|
-
if (hasResolvedModelChoices) {
|
|
70847
|
-
return resolvedModelChoices;
|
|
70848
|
-
}
|
|
70849
|
-
hasResolvedModelChoices = true;
|
|
70850
|
-
resolvedModelChoices = await resolveDynamicModelChoices({
|
|
70851
|
-
choices: choices2,
|
|
70852
|
-
activeProvider,
|
|
70853
|
-
container,
|
|
70854
|
-
adapter,
|
|
70855
|
-
logger: logger2,
|
|
70856
|
-
fallbackModel: modelPrompt.defaultValue
|
|
70857
|
-
});
|
|
70858
|
-
return resolvedModelChoices;
|
|
70859
|
-
}
|
|
70860
|
-
}
|
|
70861
|
-
async function resolveDynamicModelChoices(input) {
|
|
70862
|
-
try {
|
|
70863
|
-
if (!input.activeProvider) {
|
|
70864
|
-
throw new Error("active provider is unavailable");
|
|
70865
|
-
}
|
|
70866
|
-
return await input.choices({
|
|
70867
|
-
httpClient: input.container.httpClient,
|
|
70868
|
-
provider: input.activeProvider,
|
|
70869
|
-
env: input.container.env
|
|
70870
|
-
});
|
|
70871
|
-
} catch (error3) {
|
|
70872
|
-
input.logger.verbose(
|
|
70873
|
-
`Failed to resolve model choices for ${input.adapter.name}: ${formatErrorMessage(
|
|
70874
|
-
error3
|
|
70875
|
-
)}. Using ${input.fallbackModel}.`
|
|
70876
|
-
);
|
|
70877
|
-
return [{ title: input.fallbackModel, value: input.fallbackModel }];
|
|
70878
|
-
}
|
|
70879
|
-
}
|
|
70880
|
-
function formatErrorMessage(error3) {
|
|
70881
|
-
if (error3 instanceof Error && error3.message.trim().length > 0) {
|
|
70882
|
-
return error3.message;
|
|
70883
|
-
}
|
|
70884
|
-
return "unknown error";
|
|
70885
|
-
}
|
|
70886
|
-
async function resolveConfigureBaseUrl(input) {
|
|
70887
|
-
return resolveNonEmpty(input.options.baseUrl);
|
|
70888
|
-
}
|
|
70889
|
-
async function resolveFreeformProviderModel(input) {
|
|
70890
|
-
const explicitModel = resolveNonEmpty(input.options.model);
|
|
70891
|
-
if (explicitModel !== void 0) {
|
|
70892
|
-
input.logger.resolved(input.label, explicitModel);
|
|
70893
|
-
return explicitModel;
|
|
70894
|
-
}
|
|
70895
|
-
const configuredModel = resolveNonEmpty(input.configModel ?? void 0);
|
|
70896
|
-
if (configuredModel !== void 0) {
|
|
70897
|
-
input.logger.resolved(input.label, configuredModel);
|
|
70898
|
-
return configuredModel;
|
|
70899
|
-
}
|
|
70900
|
-
if (input.flags.assumeYes) {
|
|
70901
|
-
throw new Error(
|
|
70902
|
-
`Provider "${input.provider.id}" requires a model for "${input.label}". Pass --model.`
|
|
70903
|
-
);
|
|
70904
|
-
}
|
|
70905
|
-
return await input.container.options.ensure({
|
|
70906
|
-
descriptor: {
|
|
70907
|
-
name: "model",
|
|
70908
|
-
message: input.label,
|
|
70909
|
-
type: "text"
|
|
70910
|
-
}
|
|
70911
|
-
});
|
|
70912
|
-
}
|
|
70913
|
-
var PREVIEW_API_KEY;
|
|
70914
|
-
var init_configure_payload = __esm({
|
|
70915
|
-
"src/cli/commands/configure-payload.ts"() {
|
|
70916
|
-
"use strict";
|
|
70917
|
-
init_src9();
|
|
70918
|
-
init_shared();
|
|
70919
|
-
init_src8();
|
|
70920
|
-
PREVIEW_API_KEY = "<redacted>";
|
|
70921
|
-
}
|
|
70922
|
-
});
|
|
70923
|
-
|
|
70924
|
-
// src/services/mutation-events.ts
|
|
70925
|
-
function createMutationReporter(logger2) {
|
|
70926
|
-
return {
|
|
70927
|
-
onComplete(details, outcome) {
|
|
70928
|
-
logger2.verbose(formatMutationMessage(details, outcome));
|
|
70929
|
-
},
|
|
70930
|
-
onError(details, error3) {
|
|
70931
|
-
logger2.error(
|
|
70932
|
-
`${details.label} failed: ${describeError(error3)}`
|
|
70933
|
-
);
|
|
70934
|
-
}
|
|
70935
|
-
};
|
|
70936
|
-
}
|
|
70937
|
-
function combineMutationObservers(...observers) {
|
|
70938
|
-
const active = observers.filter(
|
|
70939
|
-
(observer) => observer != null
|
|
70940
|
-
);
|
|
70941
|
-
if (active.length === 0) {
|
|
70942
|
-
return void 0;
|
|
70943
|
-
}
|
|
70944
|
-
return {
|
|
70945
|
-
onStart(details) {
|
|
70946
|
-
for (const observer of active) {
|
|
70947
|
-
observer.onStart?.(details);
|
|
70948
|
-
}
|
|
70949
|
-
},
|
|
70950
|
-
onComplete(details, outcome) {
|
|
70951
|
-
for (const observer of active) {
|
|
70952
|
-
observer.onComplete?.(details, outcome);
|
|
70953
|
-
}
|
|
70954
|
-
},
|
|
70955
|
-
onError(details, error3) {
|
|
70956
|
-
for (const observer of active) {
|
|
70957
|
-
observer.onError?.(details, error3);
|
|
70958
|
-
}
|
|
70959
|
-
}
|
|
70960
|
-
};
|
|
70961
|
-
}
|
|
70962
|
-
function formatMutationMessage(details, outcome) {
|
|
70963
|
-
const status = describeOutcome(outcome);
|
|
70964
|
-
return `${details.label}: ${status}`;
|
|
70965
|
-
}
|
|
70966
|
-
function describeOutcome(outcome) {
|
|
70967
|
-
if (outcome.changed) {
|
|
70968
|
-
return outcome.detail ?? outcome.effect;
|
|
70969
|
-
}
|
|
70970
|
-
if (outcome.detail && outcome.detail !== "noop") {
|
|
70971
|
-
return outcome.detail;
|
|
70972
|
-
}
|
|
70973
|
-
return "no changes";
|
|
70974
|
-
}
|
|
70975
|
-
function describeError(error3) {
|
|
70976
|
-
if (error3 instanceof Error) {
|
|
70977
|
-
return error3.message;
|
|
70978
|
-
}
|
|
70979
|
-
return String(error3 ?? "Unknown error");
|
|
70980
|
-
}
|
|
70981
|
-
var init_mutation_events = __esm({
|
|
70982
|
-
"src/services/mutation-events.ts"() {
|
|
70983
|
-
"use strict";
|
|
70984
|
-
}
|
|
70985
|
-
});
|
|
70986
|
-
|
|
70987
|
-
// src/cli/commands/ensure-isolated-config.ts
|
|
70988
|
-
var ensure_isolated_config_exports = {};
|
|
70989
|
-
__export(ensure_isolated_config_exports, {
|
|
70990
|
-
ensureIsolatedConfigForService: () => ensureIsolatedConfigForService
|
|
70991
|
-
});
|
|
70992
|
-
async function ensureIsolatedConfigForService(input) {
|
|
70993
|
-
const { container, adapter } = input;
|
|
70994
|
-
const canonicalService = adapter.name;
|
|
70995
|
-
const isolated = adapter.isolatedEnv;
|
|
70996
|
-
if (!isolated) {
|
|
70997
|
-
return;
|
|
70998
|
-
}
|
|
70999
|
-
const flags = input.flags;
|
|
71000
|
-
const shouldRefresh = input.refresh === true;
|
|
71001
|
-
const resources = createExecutionResources(
|
|
71002
|
-
container,
|
|
71003
|
-
flags,
|
|
71004
|
-
`isolated:${canonicalService}`
|
|
71005
|
-
);
|
|
71006
|
-
const providerContext = buildProviderContext(container, adapter, resources);
|
|
71007
|
-
if (isolated.requiresConfig === false) {
|
|
71008
|
-
return;
|
|
71009
|
-
}
|
|
71010
|
-
const activeProvider = await resolveActiveProviderForService(
|
|
71011
|
-
container,
|
|
71012
|
-
canonicalService,
|
|
71013
|
-
{ readOnly: flags.dryRun }
|
|
71014
|
-
);
|
|
71015
|
-
const details = await resolveIsolatedEnvDetails(
|
|
71016
|
-
container.env,
|
|
71017
|
-
isolated,
|
|
71018
|
-
adapter.name,
|
|
71019
|
-
activeProvider
|
|
71020
|
-
);
|
|
71021
|
-
const hasConfig = await isolatedConfigExists(
|
|
71022
|
-
container.fs,
|
|
71023
|
-
details.configProbePath
|
|
71024
|
-
);
|
|
71025
|
-
if (hasConfig && !shouldRefresh) {
|
|
71026
|
-
return;
|
|
71027
|
-
}
|
|
71028
|
-
const providerId = await resolveIsolatedServiceProvider(container, canonicalService, {
|
|
71029
|
-
readOnly: flags.dryRun
|
|
71030
|
-
});
|
|
71031
|
-
if (!providerId) {
|
|
71032
|
-
return;
|
|
71033
|
-
}
|
|
71034
|
-
const configuredServices = await loadConfiguredServices({
|
|
71035
|
-
fs: container.fs,
|
|
71036
|
-
filePath: container.env.configPath,
|
|
71037
|
-
projectFilePath: container.env.projectConfigPath,
|
|
71038
|
-
readOnly: flags.dryRun
|
|
71039
|
-
});
|
|
71040
|
-
const metadata = configuredServices[canonicalService];
|
|
71041
|
-
const payload = await createConfigurePayload({
|
|
71042
|
-
container,
|
|
71043
|
-
flags: { ...flags, assumeYes: true },
|
|
71044
|
-
options: {
|
|
71045
|
-
model: metadata?.model,
|
|
71046
|
-
reasoningEffort: metadata?.reasoningEffort,
|
|
71047
|
-
baseUrl: metadata?.baseUrl,
|
|
71048
|
-
shapeBaseUrl: metadata?.shapeBaseUrl,
|
|
71049
|
-
...input.options
|
|
71050
|
-
},
|
|
71051
|
-
context: providerContext,
|
|
71052
|
-
adapter,
|
|
71053
|
-
logger: resources.logger,
|
|
71054
|
-
providerId
|
|
71055
|
-
});
|
|
71056
|
-
await container.registry.invoke(canonicalService, "configure", async (entry) => {
|
|
71057
|
-
if (!entry.configure) {
|
|
71058
|
-
throw new Error(`Agent "${canonicalService}" does not support configure.`);
|
|
71059
|
-
}
|
|
71060
|
-
const mutationLogger = createMutationReporter(resources.logger);
|
|
71061
|
-
await applyIsolatedConfiguration({
|
|
71062
|
-
adapter: entry,
|
|
71063
|
-
providerContext,
|
|
71064
|
-
payload,
|
|
71065
|
-
isolated,
|
|
71066
|
-
providerName: adapter.name,
|
|
71067
|
-
observers: mutationLogger
|
|
71068
|
-
});
|
|
71069
|
-
});
|
|
71070
|
-
if (!flags.dryRun) {
|
|
71071
|
-
const refreshed = await isolatedConfigExists(
|
|
71072
|
-
container.fs,
|
|
71073
|
-
details.configProbePath
|
|
71074
|
-
);
|
|
71075
|
-
if (!refreshed) {
|
|
71076
|
-
throw new Error(
|
|
71077
|
-
`${adapter.label} isolated configuration did not create ${details.configProbePath}.`
|
|
71078
|
-
);
|
|
71079
|
-
}
|
|
71080
|
-
}
|
|
71081
|
-
}
|
|
71082
|
-
async function resolveIsolatedServiceProvider(container, serviceName, options = {}) {
|
|
71083
|
-
const configuredServices = await loadConfiguredServices({
|
|
71084
|
-
fs: container.fs,
|
|
71085
|
-
filePath: container.env.configPath,
|
|
71086
|
-
projectFilePath: container.env.projectConfigPath,
|
|
71087
|
-
readOnly: options.readOnly
|
|
71088
|
-
});
|
|
71089
|
-
const metadata = configuredServices[serviceName];
|
|
71090
|
-
if (metadata?.provider) {
|
|
71091
|
-
return metadata.provider;
|
|
71092
|
-
}
|
|
71093
|
-
const agent3 = resolveAgentDefinition(serviceName);
|
|
71094
|
-
if (!agent3) {
|
|
71095
|
-
return void 0;
|
|
71096
|
-
}
|
|
71097
|
-
const providers = container.providerRegistry.forAgent(agent3);
|
|
71098
|
-
const loggedIn = [];
|
|
71099
|
-
for (const provider2 of providers) {
|
|
71100
|
-
if (await isProviderAvailable(container, provider2.id, options)) {
|
|
71101
|
-
loggedIn.push(provider2.id);
|
|
71102
|
-
}
|
|
71103
|
-
}
|
|
71104
|
-
if (loggedIn.length === 1) {
|
|
71105
|
-
return loggedIn[0];
|
|
71106
|
-
}
|
|
71107
|
-
if (providers.length === 1) {
|
|
71108
|
-
return providers[0].id;
|
|
71109
|
-
}
|
|
71110
|
-
return providers[0]?.id;
|
|
71111
|
-
}
|
|
71112
|
-
async function isProviderAvailable(container, providerId, options) {
|
|
71113
|
-
try {
|
|
71114
|
-
return await container.providerRegistry.isLoggedIn(providerId, options);
|
|
71115
|
-
} catch {
|
|
71116
|
-
return false;
|
|
71117
|
-
}
|
|
71118
|
-
}
|
|
71119
|
-
var init_ensure_isolated_config = __esm({
|
|
71120
|
-
"src/cli/commands/ensure-isolated-config.ts"() {
|
|
71121
|
-
"use strict";
|
|
71122
|
-
init_shared();
|
|
71123
|
-
init_isolated_env();
|
|
71124
|
-
init_configure_payload();
|
|
71125
|
-
init_mutation_events();
|
|
71126
|
-
init_config5();
|
|
71127
|
-
}
|
|
71128
|
-
});
|
|
71129
|
-
|
|
71130
|
-
// src/cli/poe-code-command-runner.ts
|
|
71131
|
-
function createPoeCodeCommandRunner(input) {
|
|
71132
|
-
return async (command, args, options) => {
|
|
71133
|
-
const container = input.getContainer();
|
|
71134
|
-
if (command !== "poe-code" || args.length === 0) {
|
|
71135
|
-
return input.baseRunner(command, args, options);
|
|
71136
|
-
}
|
|
71137
|
-
if (args[0] !== "wrap") {
|
|
71138
|
-
return input.baseRunner(command, args, options);
|
|
71139
|
-
}
|
|
71140
|
-
const service = args[1];
|
|
71141
|
-
if (typeof service !== "string" || service.trim() === "") {
|
|
71142
|
-
return input.baseRunner(command, args, options);
|
|
71143
|
-
}
|
|
71144
|
-
const adapter = container.registry.get(service);
|
|
71145
|
-
if (!adapter?.isolatedEnv) {
|
|
71146
|
-
return input.baseRunner(command, args, options);
|
|
71147
|
-
}
|
|
71148
|
-
const activeProvider = await resolveActiveProviderForService(container, adapter.name);
|
|
71149
|
-
const details = await resolveIsolatedEnvDetails(
|
|
71150
|
-
container.env,
|
|
71151
|
-
adapter.isolatedEnv,
|
|
71152
|
-
adapter.name,
|
|
71153
|
-
activeProvider
|
|
71154
|
-
);
|
|
71155
|
-
const runtimeEnv = adapter.runtimeEnv ? await resolveProviderRuntimeEnv(
|
|
71156
|
-
container.env,
|
|
71157
|
-
adapter.runtimeEnv,
|
|
71158
|
-
adapter.name,
|
|
71159
|
-
activeProvider
|
|
71160
|
-
) : {};
|
|
71161
|
-
if (adapter.isolatedEnv.requiresConfig !== false) {
|
|
71162
|
-
const hasConfig = await isolatedConfigExists(container.fs, details.configProbePath);
|
|
71163
|
-
if (!hasConfig) {
|
|
71164
|
-
await ensureIsolatedConfigForService({
|
|
71165
|
-
container,
|
|
71166
|
-
adapter,
|
|
71167
|
-
service,
|
|
71168
|
-
flags: { dryRun: false, assumeYes: true, verbose: false },
|
|
71169
|
-
refresh: true
|
|
71170
|
-
});
|
|
71171
|
-
}
|
|
71172
|
-
}
|
|
71173
|
-
await applyIsolatedEnvRepairs({
|
|
71174
|
-
fs: container.fs,
|
|
71175
|
-
env: container.env,
|
|
71176
|
-
providerName: adapter.name,
|
|
71177
|
-
isolated: adapter.isolatedEnv
|
|
71178
|
-
});
|
|
71179
|
-
let forwarded = args.slice(2);
|
|
71180
|
-
if (forwarded[0] === "--") {
|
|
71181
|
-
forwarded = forwarded.slice(1);
|
|
71182
|
-
}
|
|
71183
|
-
if (adapter.isolatedEnv.cliSettings) {
|
|
71184
|
-
const resolvedSettings = await resolveCliSettings(
|
|
71185
|
-
adapter.isolatedEnv.cliSettings,
|
|
71186
|
-
container.env,
|
|
71187
|
-
activeProvider
|
|
71188
|
-
);
|
|
71189
|
-
forwarded = buildArgsWithMergedSettings(forwarded, resolvedSettings);
|
|
71190
|
-
}
|
|
71191
|
-
const mergedEnv = {
|
|
71192
|
-
...activeProvider?.extraEnv ?? {},
|
|
71193
|
-
...details.env,
|
|
71194
|
-
...runtimeEnv,
|
|
71195
|
-
...options?.env ?? {}
|
|
71196
|
-
};
|
|
71197
|
-
const runOptions = { env: mergedEnv };
|
|
71198
|
-
if (options?.cwd) {
|
|
71199
|
-
runOptions.cwd = options.cwd;
|
|
71200
|
-
}
|
|
71201
|
-
if (options?.stdin != null) {
|
|
71202
|
-
runOptions.stdin = options.stdin;
|
|
71203
|
-
}
|
|
71204
|
-
return input.baseRunner(details.agentBinary, forwarded, runOptions);
|
|
71205
|
-
};
|
|
71206
|
-
}
|
|
71207
|
-
var init_poe_code_command_runner = __esm({
|
|
71208
|
-
"src/cli/poe-code-command-runner.ts"() {
|
|
71209
|
-
"use strict";
|
|
71210
|
-
init_isolated_env();
|
|
71211
|
-
init_cli_settings_merge();
|
|
71212
|
-
init_ensure_isolated_config();
|
|
71213
|
-
init_shared();
|
|
71214
|
-
}
|
|
71215
|
-
});
|
|
71216
|
-
|
|
71217
70659
|
// src/cli/provider-auth-storage.ts
|
|
71218
70660
|
function providerCredentialFileName(provider2) {
|
|
71219
70661
|
return `credentials.${credentialFileSegment(requireApiKeyAuth2(provider2).storageKey)}.enc`;
|
|
@@ -71390,12 +70832,6 @@ function createSdkContainer(options) {
|
|
|
71390
70832
|
for (const adapter of providers) {
|
|
71391
70833
|
registry.register(adapter);
|
|
71392
70834
|
}
|
|
71393
|
-
const baseRunner = runCommand;
|
|
71394
|
-
let container = null;
|
|
71395
|
-
const wrappedRunner = createPoeCodeCommandRunner({
|
|
71396
|
-
getContainer: () => container,
|
|
71397
|
-
baseRunner
|
|
71398
|
-
});
|
|
71399
70835
|
const httpClient = async (url, init) => {
|
|
71400
70836
|
const response = await globalThis.fetch(url, init);
|
|
71401
70837
|
return {
|
|
@@ -71404,7 +70840,7 @@ function createSdkContainer(options) {
|
|
|
71404
70840
|
json: () => response.json()
|
|
71405
70841
|
};
|
|
71406
70842
|
};
|
|
71407
|
-
container = {
|
|
70843
|
+
const container = {
|
|
71408
70844
|
env: environment2,
|
|
71409
70845
|
fs: asyncFs,
|
|
71410
70846
|
prompts: noopPrompts,
|
|
@@ -71416,7 +70852,7 @@ function createSdkContainer(options) {
|
|
|
71416
70852
|
registry,
|
|
71417
70853
|
providerRegistry,
|
|
71418
70854
|
httpClient,
|
|
71419
|
-
commandRunner:
|
|
70855
|
+
commandRunner: runCommand,
|
|
71420
70856
|
providers,
|
|
71421
70857
|
dependencies: {
|
|
71422
70858
|
fs: asyncFs,
|
|
@@ -71449,7 +70885,6 @@ var init_container = __esm({
|
|
|
71449
70885
|
init_src17();
|
|
71450
70886
|
await init_providers();
|
|
71451
70887
|
init_src8();
|
|
71452
|
-
init_poe_code_command_runner();
|
|
71453
70888
|
init_src3();
|
|
71454
70889
|
init_provider_auth_storage();
|
|
71455
70890
|
}
|
|
@@ -71751,8 +71186,8 @@ function createNodeWorktreeDeps2() {
|
|
|
71751
71186
|
};
|
|
71752
71187
|
}
|
|
71753
71188
|
async function defaultSpawnAgent(service, options) {
|
|
71754
|
-
const { spawn:
|
|
71755
|
-
return await
|
|
71189
|
+
const { spawn: spawn11 } = await init_spawn4().then(() => spawn_exports);
|
|
71190
|
+
return await spawn11(service, options).result;
|
|
71756
71191
|
}
|
|
71757
71192
|
var execShell2;
|
|
71758
71193
|
var init_worktree = __esm({
|
|
@@ -85461,7 +84896,7 @@ async function ingestGaslight(options) {
|
|
|
85461
84896
|
const cwd = options.cwd ?? process.cwd();
|
|
85462
84897
|
const homeDir = options.homeDir ?? os18.homedir();
|
|
85463
84898
|
const fs31 = options.fs ?? nodeFs15;
|
|
85464
|
-
const
|
|
84899
|
+
const spawn11 = options.spawn ?? spawn5;
|
|
85465
84900
|
const collectHumanPrompts2 = options.collectHumanPrompts ?? collectHumanPromptsWithStats;
|
|
85466
84901
|
const analysisAgent = requireNonEmptyString3(options.analysisAgent, "analysisAgent");
|
|
85467
84902
|
const model = resolveOptionalNonEmptyString(options.model, "model");
|
|
@@ -85495,7 +84930,7 @@ async function ingestGaslight(options) {
|
|
|
85495
84930
|
agent: analysisAgent,
|
|
85496
84931
|
dataPath: dataPath.absolutePath
|
|
85497
84932
|
});
|
|
85498
|
-
const result = await
|
|
84933
|
+
const result = await spawn11(analysisAgent, {
|
|
85499
84934
|
prompt: buildAnalysisPrompt(dataPath.absolutePath),
|
|
85500
84935
|
cwd,
|
|
85501
84936
|
mode: "read",
|
|
@@ -85634,7 +85069,7 @@ async function runGaslight(options) {
|
|
|
85634
85069
|
const cwd = options.cwd ?? process.cwd();
|
|
85635
85070
|
const homeDir = options.homeDir ?? os19.homedir();
|
|
85636
85071
|
const fs31 = options.fs ?? nodeFs16;
|
|
85637
|
-
const
|
|
85072
|
+
const spawn11 = options.spawn ?? spawn5;
|
|
85638
85073
|
const agent3 = requireNonEmptyString4(options.agent, "agent");
|
|
85639
85074
|
const model = resolveModel2(options.model);
|
|
85640
85075
|
validateInlineConfig(options.prompt, options.followups);
|
|
@@ -85663,7 +85098,7 @@ async function runGaslight(options) {
|
|
|
85663
85098
|
planIndex: planIndex + 1,
|
|
85664
85099
|
totalPlans: planPaths.length
|
|
85665
85100
|
});
|
|
85666
|
-
const result = await
|
|
85101
|
+
const result = await spawn11(agent3, {
|
|
85667
85102
|
prompt,
|
|
85668
85103
|
cwd,
|
|
85669
85104
|
mode: options.mode ?? "auto",
|
|
@@ -100506,12 +99941,7 @@ function createCliContainer(dependencies) {
|
|
|
100506
99941
|
for (const adapter of providers) {
|
|
100507
99942
|
registry.register(adapter);
|
|
100508
99943
|
}
|
|
100509
|
-
|
|
100510
|
-
const wrappedRunner = createPoeCodeCommandRunner({
|
|
100511
|
-
getContainer: () => container,
|
|
100512
|
-
baseRunner: commandRunner
|
|
100513
|
-
});
|
|
100514
|
-
container = {
|
|
99944
|
+
return {
|
|
100515
99945
|
env: environment2,
|
|
100516
99946
|
fs: dependencies.fs,
|
|
100517
99947
|
prompts: dependencies.prompts,
|
|
@@ -100523,7 +99953,7 @@ function createCliContainer(dependencies) {
|
|
|
100523
99953
|
registry,
|
|
100524
99954
|
providerRegistry,
|
|
100525
99955
|
httpClient,
|
|
100526
|
-
commandRunner
|
|
99956
|
+
commandRunner,
|
|
100527
99957
|
providers,
|
|
100528
99958
|
dependencies,
|
|
100529
99959
|
readApiKey,
|
|
@@ -100531,7 +99961,6 @@ function createCliContainer(dependencies) {
|
|
|
100531
99961
|
deleteApiKey,
|
|
100532
99962
|
createPreviewProviderStore
|
|
100533
99963
|
};
|
|
100534
|
-
return container;
|
|
100535
99964
|
}
|
|
100536
99965
|
var init_container2 = __esm({
|
|
100537
99966
|
async "src/cli/container.ts"() {
|
|
@@ -100549,13 +99978,256 @@ var init_container2 = __esm({
|
|
|
100549
99978
|
init_src2();
|
|
100550
99979
|
await init_providers();
|
|
100551
99980
|
init_src8();
|
|
100552
|
-
init_poe_code_command_runner();
|
|
100553
99981
|
init_errors();
|
|
100554
99982
|
init_oauth_login();
|
|
100555
99983
|
init_provider_auth_storage();
|
|
100556
99984
|
}
|
|
100557
99985
|
});
|
|
100558
99986
|
|
|
99987
|
+
// src/services/mutation-events.ts
|
|
99988
|
+
function createMutationReporter(logger2) {
|
|
99989
|
+
return {
|
|
99990
|
+
onComplete(details, outcome) {
|
|
99991
|
+
logger2.verbose(formatMutationMessage(details, outcome));
|
|
99992
|
+
},
|
|
99993
|
+
onError(details, error3) {
|
|
99994
|
+
logger2.error(
|
|
99995
|
+
`${details.label} failed: ${describeError(error3)}`
|
|
99996
|
+
);
|
|
99997
|
+
}
|
|
99998
|
+
};
|
|
99999
|
+
}
|
|
100000
|
+
function combineMutationObservers(...observers) {
|
|
100001
|
+
const active = observers.filter(
|
|
100002
|
+
(observer) => observer != null
|
|
100003
|
+
);
|
|
100004
|
+
if (active.length === 0) {
|
|
100005
|
+
return void 0;
|
|
100006
|
+
}
|
|
100007
|
+
return {
|
|
100008
|
+
onStart(details) {
|
|
100009
|
+
for (const observer of active) {
|
|
100010
|
+
observer.onStart?.(details);
|
|
100011
|
+
}
|
|
100012
|
+
},
|
|
100013
|
+
onComplete(details, outcome) {
|
|
100014
|
+
for (const observer of active) {
|
|
100015
|
+
observer.onComplete?.(details, outcome);
|
|
100016
|
+
}
|
|
100017
|
+
},
|
|
100018
|
+
onError(details, error3) {
|
|
100019
|
+
for (const observer of active) {
|
|
100020
|
+
observer.onError?.(details, error3);
|
|
100021
|
+
}
|
|
100022
|
+
}
|
|
100023
|
+
};
|
|
100024
|
+
}
|
|
100025
|
+
function formatMutationMessage(details, outcome) {
|
|
100026
|
+
const status = describeOutcome(outcome);
|
|
100027
|
+
return `${details.label}: ${status}`;
|
|
100028
|
+
}
|
|
100029
|
+
function describeOutcome(outcome) {
|
|
100030
|
+
if (outcome.changed) {
|
|
100031
|
+
return outcome.detail ?? outcome.effect;
|
|
100032
|
+
}
|
|
100033
|
+
if (outcome.detail && outcome.detail !== "noop") {
|
|
100034
|
+
return outcome.detail;
|
|
100035
|
+
}
|
|
100036
|
+
return "no changes";
|
|
100037
|
+
}
|
|
100038
|
+
function describeError(error3) {
|
|
100039
|
+
if (error3 instanceof Error) {
|
|
100040
|
+
return error3.message;
|
|
100041
|
+
}
|
|
100042
|
+
return String(error3 ?? "Unknown error");
|
|
100043
|
+
}
|
|
100044
|
+
var init_mutation_events = __esm({
|
|
100045
|
+
"src/services/mutation-events.ts"() {
|
|
100046
|
+
"use strict";
|
|
100047
|
+
}
|
|
100048
|
+
});
|
|
100049
|
+
|
|
100050
|
+
// src/cli/commands/configure-payload.ts
|
|
100051
|
+
async function createConfigurePayload(init) {
|
|
100052
|
+
const { container, flags, options, context, adapter, logger: logger2, providerId } = init;
|
|
100053
|
+
const payload = { env: context.env };
|
|
100054
|
+
let provider2;
|
|
100055
|
+
let activeProvider;
|
|
100056
|
+
let resolvedModelChoices;
|
|
100057
|
+
let hasResolvedModelChoices = false;
|
|
100058
|
+
if (providerId) {
|
|
100059
|
+
provider2 = container.providerRegistry.get(providerId);
|
|
100060
|
+
if (!provider2) {
|
|
100061
|
+
throw new Error(`Unknown provider "${providerId}".`);
|
|
100062
|
+
}
|
|
100063
|
+
const explicitShapeBaseUrls = parseProviderShapeBaseUrls(provider2, options.shapeBaseUrl ?? []);
|
|
100064
|
+
const agent3 = resolveAgentDefinition(adapter.name) ?? { id: adapter.name };
|
|
100065
|
+
const apiKey = flags.dryRun ? PREVIEW_API_KEY : providerId === POE_PROVIDER_ID ? await container.options.resolveApiKey({
|
|
100066
|
+
value: options.apiKey,
|
|
100067
|
+
envValue: provider2.auth.kind === "api-key" ? container.env.getVariable(provider2.auth.envVar) : void 0,
|
|
100068
|
+
dryRun: false,
|
|
100069
|
+
assumeYes: flags.assumeYes
|
|
100070
|
+
}) : await container.providerRegistry.resolveCredential(
|
|
100071
|
+
providerId,
|
|
100072
|
+
{ apiKey: options.apiKey },
|
|
100073
|
+
{ envVars: container.env.variables }
|
|
100074
|
+
);
|
|
100075
|
+
const explicitBaseUrl = await resolveConfigureBaseUrl({
|
|
100076
|
+
options
|
|
100077
|
+
});
|
|
100078
|
+
activeProvider = await buildActiveProvider({
|
|
100079
|
+
container,
|
|
100080
|
+
provider: provider2,
|
|
100081
|
+
agent: agent3,
|
|
100082
|
+
credential: apiKey,
|
|
100083
|
+
explicitBaseUrl,
|
|
100084
|
+
explicitShapeBaseUrls,
|
|
100085
|
+
readOnly: flags.dryRun
|
|
100086
|
+
});
|
|
100087
|
+
payload.provider = activeProvider;
|
|
100088
|
+
}
|
|
100089
|
+
const modelPrompt = adapter.configurePrompts?.model;
|
|
100090
|
+
if (modelPrompt) {
|
|
100091
|
+
const configModel = await resolveModel(
|
|
100092
|
+
{
|
|
100093
|
+
fs: container.fs,
|
|
100094
|
+
filePath: container.env.configPath,
|
|
100095
|
+
readOnly: flags.dryRun
|
|
100096
|
+
},
|
|
100097
|
+
adapter.name
|
|
100098
|
+
);
|
|
100099
|
+
const model = provider2?.modelInput?.kind === "freeform" && typeof modelPrompt.choices !== "function" ? await resolveFreeformProviderModel({
|
|
100100
|
+
container,
|
|
100101
|
+
flags,
|
|
100102
|
+
options,
|
|
100103
|
+
label: modelPrompt.label,
|
|
100104
|
+
configModel,
|
|
100105
|
+
provider: provider2,
|
|
100106
|
+
logger: logger2
|
|
100107
|
+
}) : await container.options.resolveModel({
|
|
100108
|
+
value: options.model,
|
|
100109
|
+
assumeDefault: flags.assumeYes,
|
|
100110
|
+
defaultValue: configModel ?? modelPrompt.defaultValue,
|
|
100111
|
+
choices: await resolveChoices(),
|
|
100112
|
+
label: modelPrompt.label,
|
|
100113
|
+
onResolve: (label, value) => logger2.resolved(label, value)
|
|
100114
|
+
});
|
|
100115
|
+
payload.model = model;
|
|
100116
|
+
}
|
|
100117
|
+
const reasoningPrompt = adapter.configurePrompts?.reasoningEffort;
|
|
100118
|
+
if (reasoningPrompt) {
|
|
100119
|
+
const reasoningEffort = await container.options.resolveReasoning({
|
|
100120
|
+
value: options.reasoningEffort,
|
|
100121
|
+
assumeDefault: flags.assumeYes,
|
|
100122
|
+
defaultValue: reasoningPrompt.defaultValue,
|
|
100123
|
+
label: reasoningPrompt.label
|
|
100124
|
+
});
|
|
100125
|
+
payload.reasoningEffort = reasoningEffort;
|
|
100126
|
+
}
|
|
100127
|
+
const extension = flags.dryRun ? void 0 : await adapter.extendConfigurePayload?.({
|
|
100128
|
+
fs: container.fs,
|
|
100129
|
+
env: context.env,
|
|
100130
|
+
httpClient: container.httpClient,
|
|
100131
|
+
logger: logger2,
|
|
100132
|
+
payload,
|
|
100133
|
+
prompts: container.prompts,
|
|
100134
|
+
promptLibrary: container.promptLibrary,
|
|
100135
|
+
assumeYes: flags.assumeYes,
|
|
100136
|
+
commandOptions: options
|
|
100137
|
+
});
|
|
100138
|
+
if (extension) {
|
|
100139
|
+
Object.assign(payload, extension);
|
|
100140
|
+
}
|
|
100141
|
+
return payload;
|
|
100142
|
+
async function resolveChoices() {
|
|
100143
|
+
const choices2 = modelPrompt?.choices;
|
|
100144
|
+
if (!choices2) {
|
|
100145
|
+
return void 0;
|
|
100146
|
+
}
|
|
100147
|
+
if (flags.dryRun && typeof choices2 === "function") {
|
|
100148
|
+
return [{ title: modelPrompt.defaultValue, value: modelPrompt.defaultValue }];
|
|
100149
|
+
}
|
|
100150
|
+
if (typeof choices2 !== "function") {
|
|
100151
|
+
return choices2;
|
|
100152
|
+
}
|
|
100153
|
+
if (hasResolvedModelChoices) {
|
|
100154
|
+
return resolvedModelChoices;
|
|
100155
|
+
}
|
|
100156
|
+
hasResolvedModelChoices = true;
|
|
100157
|
+
resolvedModelChoices = await resolveDynamicModelChoices({
|
|
100158
|
+
choices: choices2,
|
|
100159
|
+
activeProvider,
|
|
100160
|
+
container,
|
|
100161
|
+
adapter,
|
|
100162
|
+
logger: logger2,
|
|
100163
|
+
fallbackModel: modelPrompt.defaultValue
|
|
100164
|
+
});
|
|
100165
|
+
return resolvedModelChoices;
|
|
100166
|
+
}
|
|
100167
|
+
}
|
|
100168
|
+
async function resolveDynamicModelChoices(input) {
|
|
100169
|
+
try {
|
|
100170
|
+
if (!input.activeProvider) {
|
|
100171
|
+
throw new Error("active provider is unavailable");
|
|
100172
|
+
}
|
|
100173
|
+
return await input.choices({
|
|
100174
|
+
httpClient: input.container.httpClient,
|
|
100175
|
+
provider: input.activeProvider,
|
|
100176
|
+
env: input.container.env
|
|
100177
|
+
});
|
|
100178
|
+
} catch (error3) {
|
|
100179
|
+
input.logger.verbose(
|
|
100180
|
+
`Failed to resolve model choices for ${input.adapter.name}: ${formatErrorMessage(
|
|
100181
|
+
error3
|
|
100182
|
+
)}. Using ${input.fallbackModel}.`
|
|
100183
|
+
);
|
|
100184
|
+
return [{ title: input.fallbackModel, value: input.fallbackModel }];
|
|
100185
|
+
}
|
|
100186
|
+
}
|
|
100187
|
+
function formatErrorMessage(error3) {
|
|
100188
|
+
if (error3 instanceof Error && error3.message.trim().length > 0) {
|
|
100189
|
+
return error3.message;
|
|
100190
|
+
}
|
|
100191
|
+
return "unknown error";
|
|
100192
|
+
}
|
|
100193
|
+
async function resolveConfigureBaseUrl(input) {
|
|
100194
|
+
return resolveNonEmpty(input.options.baseUrl);
|
|
100195
|
+
}
|
|
100196
|
+
async function resolveFreeformProviderModel(input) {
|
|
100197
|
+
const explicitModel = resolveNonEmpty(input.options.model);
|
|
100198
|
+
if (explicitModel !== void 0) {
|
|
100199
|
+
input.logger.resolved(input.label, explicitModel);
|
|
100200
|
+
return explicitModel;
|
|
100201
|
+
}
|
|
100202
|
+
const configuredModel = resolveNonEmpty(input.configModel ?? void 0);
|
|
100203
|
+
if (configuredModel !== void 0) {
|
|
100204
|
+
input.logger.resolved(input.label, configuredModel);
|
|
100205
|
+
return configuredModel;
|
|
100206
|
+
}
|
|
100207
|
+
if (input.flags.assumeYes) {
|
|
100208
|
+
throw new Error(
|
|
100209
|
+
`Provider "${input.provider.id}" requires a model for "${input.label}". Pass --model.`
|
|
100210
|
+
);
|
|
100211
|
+
}
|
|
100212
|
+
return await input.container.options.ensure({
|
|
100213
|
+
descriptor: {
|
|
100214
|
+
name: "model",
|
|
100215
|
+
message: input.label,
|
|
100216
|
+
type: "text"
|
|
100217
|
+
}
|
|
100218
|
+
});
|
|
100219
|
+
}
|
|
100220
|
+
var PREVIEW_API_KEY;
|
|
100221
|
+
var init_configure_payload = __esm({
|
|
100222
|
+
"src/cli/commands/configure-payload.ts"() {
|
|
100223
|
+
"use strict";
|
|
100224
|
+
init_src9();
|
|
100225
|
+
init_shared();
|
|
100226
|
+
init_src8();
|
|
100227
|
+
PREVIEW_API_KEY = "<redacted>";
|
|
100228
|
+
}
|
|
100229
|
+
});
|
|
100230
|
+
|
|
100559
100231
|
// src/cli/commands/configure.ts
|
|
100560
100232
|
import path150 from "node:path";
|
|
100561
100233
|
import { randomUUID as randomUUID41 } from "node:crypto";
|
|
@@ -102106,142 +101778,6 @@ var init_spawn_poe_agent = __esm({
|
|
|
102106
101778
|
}
|
|
102107
101779
|
});
|
|
102108
101780
|
|
|
102109
|
-
// src/cli/isolated-env-runner.ts
|
|
102110
|
-
import { spawn as spawn11 } from "node:child_process";
|
|
102111
|
-
async function isolatedEnvRunner(input) {
|
|
102112
|
-
const details = await resolveIsolatedEnvDetails(
|
|
102113
|
-
input.env,
|
|
102114
|
-
input.isolated,
|
|
102115
|
-
input.providerName,
|
|
102116
|
-
input.activeProvider
|
|
102117
|
-
);
|
|
102118
|
-
let args = input.argv.slice(2);
|
|
102119
|
-
if (input.isolated.requiresConfig !== false) {
|
|
102120
|
-
const hasConfig = await configExists(input.fs, details.configProbePath);
|
|
102121
|
-
if (!hasConfig) {
|
|
102122
|
-
throw new Error(
|
|
102123
|
-
`${input.providerName} is not configured. Run 'poe-code login' or 'poe-code configure ${input.providerName}'.`
|
|
102124
|
-
);
|
|
102125
|
-
}
|
|
102126
|
-
}
|
|
102127
|
-
if (input.isolated.cliSettings) {
|
|
102128
|
-
const resolvedSettings = await resolveCliSettings(
|
|
102129
|
-
input.isolated.cliSettings,
|
|
102130
|
-
input.env,
|
|
102131
|
-
input.activeProvider
|
|
102132
|
-
);
|
|
102133
|
-
args = buildArgsWithMergedSettings(args, resolvedSettings);
|
|
102134
|
-
}
|
|
102135
|
-
const child = spawn11(details.agentBinary, args, {
|
|
102136
|
-
stdio: "inherit",
|
|
102137
|
-
env: {
|
|
102138
|
-
...process.env,
|
|
102139
|
-
...details.env
|
|
102140
|
-
}
|
|
102141
|
-
});
|
|
102142
|
-
return await new Promise((_, reject) => {
|
|
102143
|
-
child.on("error", (error3) => {
|
|
102144
|
-
reject(error3);
|
|
102145
|
-
});
|
|
102146
|
-
child.on("close", (code, signal) => {
|
|
102147
|
-
process.exit(code ?? (signal === null ? 0 : 1));
|
|
102148
|
-
});
|
|
102149
|
-
});
|
|
102150
|
-
}
|
|
102151
|
-
async function configExists(fs31, filePath) {
|
|
102152
|
-
if (!fs31) {
|
|
102153
|
-
return true;
|
|
102154
|
-
}
|
|
102155
|
-
try {
|
|
102156
|
-
await fs31.stat(filePath);
|
|
102157
|
-
return true;
|
|
102158
|
-
} catch (error3) {
|
|
102159
|
-
if (isNotFound(error3)) {
|
|
102160
|
-
return false;
|
|
102161
|
-
}
|
|
102162
|
-
throw error3;
|
|
102163
|
-
}
|
|
102164
|
-
}
|
|
102165
|
-
var init_isolated_env_runner = __esm({
|
|
102166
|
-
"src/cli/isolated-env-runner.ts"() {
|
|
102167
|
-
"use strict";
|
|
102168
|
-
init_src6();
|
|
102169
|
-
init_isolated_env();
|
|
102170
|
-
init_cli_settings_merge();
|
|
102171
|
-
}
|
|
102172
|
-
});
|
|
102173
|
-
|
|
102174
|
-
// src/cli/commands/wrap.ts
|
|
102175
|
-
function registerWrapCommand(program, container) {
|
|
102176
|
-
const serviceNames = listIsolatedServiceIds(container);
|
|
102177
|
-
const serviceDescription = `Agent to wrap${formatServiceList(serviceNames)}`;
|
|
102178
|
-
return program.command("wrap").alias("w").description("Run an agent CLI with Poe isolated configuration.").allowUnknownOption(true).allowExcessArguments(true).argument("<agent>", serviceDescription).argument("[agentArgs...]", "Arguments forwarded to the agent").action(async (service, agentArgs = []) => {
|
|
102179
|
-
const requestedService = service;
|
|
102180
|
-
const flags = resolveCommandFlags(program);
|
|
102181
|
-
const adapter = resolveServiceAdapter(container, requestedService);
|
|
102182
|
-
const canonicalService = adapter.name;
|
|
102183
|
-
const isolated = adapter.isolatedEnv;
|
|
102184
|
-
if (!isolated) {
|
|
102185
|
-
throw new Error(
|
|
102186
|
-
`Agent "${requestedService}" does not support isolated configuration wrappers.`
|
|
102187
|
-
);
|
|
102188
|
-
}
|
|
102189
|
-
const argv = process.argv;
|
|
102190
|
-
const wrapIndex = argv.indexOf("wrap");
|
|
102191
|
-
const serviceIndex = wrapIndex >= 0 && argv[wrapIndex + 1] === requestedService ? wrapIndex + 1 : argv.indexOf(requestedService);
|
|
102192
|
-
const startIndex = serviceIndex >= 0 ? serviceIndex + 1 : argv.length;
|
|
102193
|
-
let forwarded = argv.slice(startIndex);
|
|
102194
|
-
if (forwarded[0] === "--") {
|
|
102195
|
-
forwarded = forwarded.slice(1);
|
|
102196
|
-
}
|
|
102197
|
-
if (forwarded.length === 0) {
|
|
102198
|
-
forwarded = agentArgs;
|
|
102199
|
-
}
|
|
102200
|
-
if (isolated.requiresConfig !== false) {
|
|
102201
|
-
await ensureIsolatedConfigForService({
|
|
102202
|
-
container,
|
|
102203
|
-
adapter,
|
|
102204
|
-
service: canonicalService,
|
|
102205
|
-
flags,
|
|
102206
|
-
refresh: false
|
|
102207
|
-
});
|
|
102208
|
-
}
|
|
102209
|
-
if (flags.dryRun) {
|
|
102210
|
-
const resources = createExecutionResources(container, flags, `wrap:${canonicalService}`);
|
|
102211
|
-
resources.logger.dryRun(
|
|
102212
|
-
`Dry run: would run ${[isolated.agentBinary, ...forwarded].join(" ")}.`
|
|
102213
|
-
);
|
|
102214
|
-
resources.context.finalize();
|
|
102215
|
-
return;
|
|
102216
|
-
}
|
|
102217
|
-
const activeProvider = await resolveActiveProviderForService(container, canonicalService);
|
|
102218
|
-
await applyIsolatedEnvRepairs({
|
|
102219
|
-
fs: container.fs,
|
|
102220
|
-
env: container.env,
|
|
102221
|
-
providerName: adapter.name,
|
|
102222
|
-
isolated
|
|
102223
|
-
});
|
|
102224
|
-
await isolatedEnvRunner({
|
|
102225
|
-
env: container.env,
|
|
102226
|
-
fs: container.fs,
|
|
102227
|
-
readApiKey: container.readApiKey,
|
|
102228
|
-
providerName: adapter.name,
|
|
102229
|
-
isolated,
|
|
102230
|
-
activeProvider,
|
|
102231
|
-
argv: ["node", "poe-code", ...forwarded]
|
|
102232
|
-
});
|
|
102233
|
-
});
|
|
102234
|
-
}
|
|
102235
|
-
var init_wrap2 = __esm({
|
|
102236
|
-
"src/cli/commands/wrap.ts"() {
|
|
102237
|
-
"use strict";
|
|
102238
|
-
init_shared();
|
|
102239
|
-
init_isolated_env_runner();
|
|
102240
|
-
init_ensure_isolated_config();
|
|
102241
|
-
init_isolated_env();
|
|
102242
|
-
}
|
|
102243
|
-
});
|
|
102244
|
-
|
|
102245
101781
|
// src/cli/commands/login.ts
|
|
102246
101782
|
function registerLoginCommand(program, container) {
|
|
102247
101783
|
program.command("login").description("Store a Poe API key for reuse across commands.").option("--api-key <key>", "Poe API key").action(async (options) => {
|
|
@@ -103643,6 +103179,204 @@ var init_update2 = __esm({
|
|
|
103643
103179
|
}
|
|
103644
103180
|
});
|
|
103645
103181
|
|
|
103182
|
+
// src/utils/cli-settings-merge.ts
|
|
103183
|
+
function extractSettingsFromArgs(args) {
|
|
103184
|
+
const settingsIdx = args.indexOf("--settings");
|
|
103185
|
+
if (settingsIdx === -1 || settingsIdx >= args.length - 1) {
|
|
103186
|
+
return { userSettings: null, argsWithoutSettings: args };
|
|
103187
|
+
}
|
|
103188
|
+
const settingsValue = args[settingsIdx + 1];
|
|
103189
|
+
const argsWithoutSettings = [
|
|
103190
|
+
...args.slice(0, settingsIdx),
|
|
103191
|
+
...args.slice(settingsIdx + 2)
|
|
103192
|
+
];
|
|
103193
|
+
if (settingsValue.startsWith("{")) {
|
|
103194
|
+
return {
|
|
103195
|
+
userSettings: JSON.parse(settingsValue),
|
|
103196
|
+
argsWithoutSettings
|
|
103197
|
+
};
|
|
103198
|
+
}
|
|
103199
|
+
return {
|
|
103200
|
+
userSettings: null,
|
|
103201
|
+
settingsFilePath: settingsValue,
|
|
103202
|
+
argsWithoutSettings
|
|
103203
|
+
};
|
|
103204
|
+
}
|
|
103205
|
+
function mergeCliSettings(userSettings, requiredSettings) {
|
|
103206
|
+
if (!userSettings) {
|
|
103207
|
+
return requiredSettings;
|
|
103208
|
+
}
|
|
103209
|
+
const merged = {
|
|
103210
|
+
...userSettings,
|
|
103211
|
+
...requiredSettings
|
|
103212
|
+
};
|
|
103213
|
+
if (userSettings.env || requiredSettings.env) {
|
|
103214
|
+
merged.env = {
|
|
103215
|
+
...userSettings.env ?? {},
|
|
103216
|
+
...requiredSettings.env ?? {}
|
|
103217
|
+
};
|
|
103218
|
+
}
|
|
103219
|
+
return merged;
|
|
103220
|
+
}
|
|
103221
|
+
function buildArgsWithMergedSettings(args, requiredSettings) {
|
|
103222
|
+
const { userSettings, settingsFilePath, argsWithoutSettings } = extractSettingsFromArgs(args);
|
|
103223
|
+
if (settingsFilePath) {
|
|
103224
|
+
throw new Error(
|
|
103225
|
+
`Cannot merge provider-required settings with --settings file path ${settingsFilePath}. Pass settings as inline JSON or remove --settings.`
|
|
103226
|
+
);
|
|
103227
|
+
}
|
|
103228
|
+
const merged = mergeCliSettings(userSettings, requiredSettings);
|
|
103229
|
+
return [...argsWithoutSettings, "--settings", JSON.stringify(merged)];
|
|
103230
|
+
}
|
|
103231
|
+
var init_cli_settings_merge = __esm({
|
|
103232
|
+
"src/utils/cli-settings-merge.ts"() {
|
|
103233
|
+
"use strict";
|
|
103234
|
+
}
|
|
103235
|
+
});
|
|
103236
|
+
|
|
103237
|
+
// src/cli/commands/ensure-isolated-config.ts
|
|
103238
|
+
var ensure_isolated_config_exports = {};
|
|
103239
|
+
__export(ensure_isolated_config_exports, {
|
|
103240
|
+
ensureIsolatedConfigForService: () => ensureIsolatedConfigForService
|
|
103241
|
+
});
|
|
103242
|
+
async function ensureIsolatedConfigForService(input) {
|
|
103243
|
+
const { container, adapter } = input;
|
|
103244
|
+
const canonicalService = adapter.name;
|
|
103245
|
+
const isolated = adapter.isolatedEnv;
|
|
103246
|
+
if (!isolated) {
|
|
103247
|
+
return;
|
|
103248
|
+
}
|
|
103249
|
+
const flags = input.flags;
|
|
103250
|
+
const shouldRefresh = input.refresh === true;
|
|
103251
|
+
const resources = createExecutionResources(
|
|
103252
|
+
container,
|
|
103253
|
+
flags,
|
|
103254
|
+
`isolated:${canonicalService}`
|
|
103255
|
+
);
|
|
103256
|
+
const providerContext = buildProviderContext(container, adapter, resources);
|
|
103257
|
+
if (isolated.requiresConfig === false) {
|
|
103258
|
+
return;
|
|
103259
|
+
}
|
|
103260
|
+
const activeProvider = await resolveActiveProviderForService(
|
|
103261
|
+
container,
|
|
103262
|
+
canonicalService,
|
|
103263
|
+
{ readOnly: flags.dryRun }
|
|
103264
|
+
);
|
|
103265
|
+
const details = await resolveIsolatedEnvDetails(
|
|
103266
|
+
container.env,
|
|
103267
|
+
isolated,
|
|
103268
|
+
adapter.name,
|
|
103269
|
+
activeProvider
|
|
103270
|
+
);
|
|
103271
|
+
const hasConfig = await isolatedConfigExists(
|
|
103272
|
+
container.fs,
|
|
103273
|
+
details.configProbePath
|
|
103274
|
+
);
|
|
103275
|
+
if (hasConfig && !shouldRefresh) {
|
|
103276
|
+
return;
|
|
103277
|
+
}
|
|
103278
|
+
const providerId = await resolveIsolatedServiceProvider(container, canonicalService, {
|
|
103279
|
+
readOnly: flags.dryRun
|
|
103280
|
+
});
|
|
103281
|
+
if (!providerId) {
|
|
103282
|
+
return;
|
|
103283
|
+
}
|
|
103284
|
+
const configuredServices = await loadConfiguredServices({
|
|
103285
|
+
fs: container.fs,
|
|
103286
|
+
filePath: container.env.configPath,
|
|
103287
|
+
projectFilePath: container.env.projectConfigPath,
|
|
103288
|
+
readOnly: flags.dryRun
|
|
103289
|
+
});
|
|
103290
|
+
const metadata = configuredServices[canonicalService];
|
|
103291
|
+
const payload = await createConfigurePayload({
|
|
103292
|
+
container,
|
|
103293
|
+
flags: { ...flags, assumeYes: true },
|
|
103294
|
+
options: {
|
|
103295
|
+
model: metadata?.model,
|
|
103296
|
+
reasoningEffort: metadata?.reasoningEffort,
|
|
103297
|
+
baseUrl: metadata?.baseUrl,
|
|
103298
|
+
shapeBaseUrl: metadata?.shapeBaseUrl,
|
|
103299
|
+
...input.options
|
|
103300
|
+
},
|
|
103301
|
+
context: providerContext,
|
|
103302
|
+
adapter,
|
|
103303
|
+
logger: resources.logger,
|
|
103304
|
+
providerId
|
|
103305
|
+
});
|
|
103306
|
+
await container.registry.invoke(canonicalService, "configure", async (entry) => {
|
|
103307
|
+
if (!entry.configure) {
|
|
103308
|
+
throw new Error(`Agent "${canonicalService}" does not support configure.`);
|
|
103309
|
+
}
|
|
103310
|
+
const mutationLogger = createMutationReporter(resources.logger);
|
|
103311
|
+
await applyIsolatedConfiguration({
|
|
103312
|
+
adapter: entry,
|
|
103313
|
+
providerContext,
|
|
103314
|
+
payload,
|
|
103315
|
+
isolated,
|
|
103316
|
+
providerName: adapter.name,
|
|
103317
|
+
observers: mutationLogger
|
|
103318
|
+
});
|
|
103319
|
+
});
|
|
103320
|
+
if (!flags.dryRun) {
|
|
103321
|
+
const refreshed = await isolatedConfigExists(
|
|
103322
|
+
container.fs,
|
|
103323
|
+
details.configProbePath
|
|
103324
|
+
);
|
|
103325
|
+
if (!refreshed) {
|
|
103326
|
+
throw new Error(
|
|
103327
|
+
`${adapter.label} isolated configuration did not create ${details.configProbePath}.`
|
|
103328
|
+
);
|
|
103329
|
+
}
|
|
103330
|
+
}
|
|
103331
|
+
}
|
|
103332
|
+
async function resolveIsolatedServiceProvider(container, serviceName, options = {}) {
|
|
103333
|
+
const configuredServices = await loadConfiguredServices({
|
|
103334
|
+
fs: container.fs,
|
|
103335
|
+
filePath: container.env.configPath,
|
|
103336
|
+
projectFilePath: container.env.projectConfigPath,
|
|
103337
|
+
readOnly: options.readOnly
|
|
103338
|
+
});
|
|
103339
|
+
const metadata = configuredServices[serviceName];
|
|
103340
|
+
if (metadata?.provider) {
|
|
103341
|
+
return metadata.provider;
|
|
103342
|
+
}
|
|
103343
|
+
const agent3 = resolveAgentDefinition(serviceName);
|
|
103344
|
+
if (!agent3) {
|
|
103345
|
+
return void 0;
|
|
103346
|
+
}
|
|
103347
|
+
const providers = container.providerRegistry.forAgent(agent3);
|
|
103348
|
+
const loggedIn = [];
|
|
103349
|
+
for (const provider2 of providers) {
|
|
103350
|
+
if (await isProviderAvailable(container, provider2.id, options)) {
|
|
103351
|
+
loggedIn.push(provider2.id);
|
|
103352
|
+
}
|
|
103353
|
+
}
|
|
103354
|
+
if (loggedIn.length === 1) {
|
|
103355
|
+
return loggedIn[0];
|
|
103356
|
+
}
|
|
103357
|
+
if (providers.length === 1) {
|
|
103358
|
+
return providers[0].id;
|
|
103359
|
+
}
|
|
103360
|
+
return providers[0]?.id;
|
|
103361
|
+
}
|
|
103362
|
+
async function isProviderAvailable(container, providerId, options) {
|
|
103363
|
+
try {
|
|
103364
|
+
return await container.providerRegistry.isLoggedIn(providerId, options);
|
|
103365
|
+
} catch {
|
|
103366
|
+
return false;
|
|
103367
|
+
}
|
|
103368
|
+
}
|
|
103369
|
+
var init_ensure_isolated_config = __esm({
|
|
103370
|
+
"src/cli/commands/ensure-isolated-config.ts"() {
|
|
103371
|
+
"use strict";
|
|
103372
|
+
init_shared();
|
|
103373
|
+
init_isolated_env();
|
|
103374
|
+
init_configure_payload();
|
|
103375
|
+
init_mutation_events();
|
|
103376
|
+
init_config5();
|
|
103377
|
+
}
|
|
103378
|
+
});
|
|
103379
|
+
|
|
103646
103380
|
// src/cli/commands/test.ts
|
|
103647
103381
|
import { Option as Option5 } from "commander";
|
|
103648
103382
|
function registerTestCommand(program, container) {
|
|
@@ -103732,12 +103466,43 @@ async function executeTest(program, container, service, options = {}) {
|
|
|
103732
103466
|
runCheck: async (check) => {
|
|
103733
103467
|
await check.run({
|
|
103734
103468
|
isDryRun: providerContext.logger.context.dryRun,
|
|
103735
|
-
runCommand: (command, args) =>
|
|
103736
|
-
|
|
103737
|
-
|
|
103738
|
-
|
|
103739
|
-
|
|
103740
|
-
|
|
103469
|
+
runCommand: async (command, args, runOptions) => {
|
|
103470
|
+
const activeProvider = await resolveActiveProviderForService(
|
|
103471
|
+
container,
|
|
103472
|
+
canonicalService,
|
|
103473
|
+
{ readOnly: flags.dryRun }
|
|
103474
|
+
);
|
|
103475
|
+
const details = await resolveIsolatedEnvDetails(
|
|
103476
|
+
container.env,
|
|
103477
|
+
adapter.isolatedEnv,
|
|
103478
|
+
canonicalService,
|
|
103479
|
+
activeProvider
|
|
103480
|
+
);
|
|
103481
|
+
const runtimeEnv = adapter.runtimeEnv ? await resolveProviderRuntimeEnv(
|
|
103482
|
+
container.env,
|
|
103483
|
+
adapter.runtimeEnv,
|
|
103484
|
+
canonicalService,
|
|
103485
|
+
activeProvider
|
|
103486
|
+
) : {};
|
|
103487
|
+
let forwarded = args;
|
|
103488
|
+
if (adapter.isolatedEnv?.cliSettings) {
|
|
103489
|
+
const resolvedSettings = await resolveCliSettings(
|
|
103490
|
+
adapter.isolatedEnv.cliSettings,
|
|
103491
|
+
container.env,
|
|
103492
|
+
activeProvider
|
|
103493
|
+
);
|
|
103494
|
+
forwarded = buildArgsWithMergedSettings(args, resolvedSettings);
|
|
103495
|
+
}
|
|
103496
|
+
return resources.context.runCommand(details.agentBinary, forwarded, {
|
|
103497
|
+
...runOptions,
|
|
103498
|
+
env: {
|
|
103499
|
+
...activeProvider?.extraEnv ?? {},
|
|
103500
|
+
...details.env,
|
|
103501
|
+
...runtimeEnv,
|
|
103502
|
+
...runOptions?.env ?? {}
|
|
103503
|
+
}
|
|
103504
|
+
});
|
|
103505
|
+
},
|
|
103741
103506
|
logDryRun: (message2) => providerContext.logger.dryRun(message2),
|
|
103742
103507
|
logWarning: (message2) => providerContext.logger.warn(message2)
|
|
103743
103508
|
});
|
|
@@ -103780,6 +103545,7 @@ var init_test = __esm({
|
|
|
103780
103545
|
init_configure();
|
|
103781
103546
|
init_src2();
|
|
103782
103547
|
init_isolated_env();
|
|
103548
|
+
init_cli_settings_merge();
|
|
103783
103549
|
}
|
|
103784
103550
|
});
|
|
103785
103551
|
|
|
@@ -147312,7 +147078,7 @@ var init_package2 = __esm({
|
|
|
147312
147078
|
"package.json"() {
|
|
147313
147079
|
package_default2 = {
|
|
147314
147080
|
name: "poe-code",
|
|
147315
|
-
version: "
|
|
147081
|
+
version: "4.0.0",
|
|
147316
147082
|
description: "CLI tool to configure Poe API for developer workflows.",
|
|
147317
147083
|
license: "MIT",
|
|
147318
147084
|
type: "module",
|
|
@@ -147410,9 +147176,6 @@ var init_package2 = __esm({
|
|
|
147410
147176
|
poe: "dist/bin.cjs",
|
|
147411
147177
|
"poe-code": "dist/bin.cjs",
|
|
147412
147178
|
"poe-code-configure": "dist/bin.cjs",
|
|
147413
|
-
"poe-claude": "dist/bin/poe-claude.js",
|
|
147414
|
-
"poe-codex": "dist/bin/poe-codex.js",
|
|
147415
|
-
"poe-opencode": "dist/bin/poe-opencode.js",
|
|
147416
147179
|
"poe-agent": "dist/bin/poe-agent.js",
|
|
147417
147180
|
"poe-superintendent-mcp": "packages/superintendent/dist/mcp.js",
|
|
147418
147181
|
"tiny-oauth-test-server": "packages/tiny-oauth-test-server/dist/cli.js",
|
|
@@ -148182,7 +147945,6 @@ function bootstrapProgram(container) {
|
|
|
148182
147945
|
extraServices: ["poe-agent"]
|
|
148183
147946
|
});
|
|
148184
147947
|
registerGaslightCommand(program, container);
|
|
148185
|
-
registerWrapCommand(program, container);
|
|
148186
147948
|
registerTestCommand(program, container);
|
|
148187
147949
|
registerUnconfigureCommand(program, container);
|
|
148188
147950
|
registerLoginCommand(program, container);
|
|
@@ -148317,7 +148079,6 @@ var init_program = __esm({
|
|
|
148317
148079
|
init_agent2();
|
|
148318
148080
|
await init_spawn6();
|
|
148319
148081
|
init_spawn_poe_agent();
|
|
148320
|
-
init_wrap2();
|
|
148321
148082
|
init_login();
|
|
148322
148083
|
init_logout();
|
|
148323
148084
|
init_auth();
|
|
@@ -148360,7 +148121,6 @@ var init_program = __esm({
|
|
|
148360
148121
|
{ path: ["agent"] },
|
|
148361
148122
|
{ path: ["spawn"] },
|
|
148362
148123
|
{ path: ["gaslight"], args: "[plan-path]" },
|
|
148363
|
-
{ path: ["wrap"] },
|
|
148364
148124
|
{ path: ["test"] },
|
|
148365
148125
|
{ path: ["models"] },
|
|
148366
148126
|
{ path: ["pipeline"] },
|