@kaoruisaac/pedelec 0.3.4 → 0.3.5
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/README.md +14 -5
- package/dist/index.d.ts +15 -11
- package/dist/index.js +42 -5
- package/dist/index.type-test.js +10 -0
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -318,19 +318,28 @@ const session = await pedelec.createSession({
|
|
|
318
318
|
const defaultSession = await pedelec.createSession({ effortLevel: "low" });
|
|
319
319
|
```
|
|
320
320
|
|
|
321
|
-
The SDK
|
|
321
|
+
The SDK supports two mutually exclusive session configuration modes. In Desktop profile mode, `effortLevel` selects the complete Desktop profile, including its configured model and native effort arguments. An omitted level means `default`:
|
|
322
322
|
|
|
323
323
|
```ts
|
|
324
|
-
const
|
|
324
|
+
const profileSession = await pedelec.createSession({
|
|
325
325
|
provider: "codex",
|
|
326
326
|
effortLevel: "high",
|
|
327
|
+
});
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
In explicit model mode, `model` selects the provider-native model directly and does not read or inherit any Desktop profile. The optional `effort` is provider-native and uses `low`, `medium`, `high`, `xhigh`, or `max`:
|
|
331
|
+
|
|
332
|
+
```ts
|
|
333
|
+
const modelSession = await pedelec.createSession({
|
|
334
|
+
provider: "codex",
|
|
327
335
|
model: "gpt-x",
|
|
336
|
+
effort: "max",
|
|
328
337
|
});
|
|
329
338
|
```
|
|
330
339
|
|
|
331
|
-
|
|
340
|
+
Model-only requests are valid and use the provider's default effort behavior. `effort` requires `model`; `model` cannot be combined with `effortLevel`. The SDK does not expose or maintain a model catalog, and it does not translate the identifier into provider CLI flags. Model validity, effort support, and account entitlement remain provider-dependent, so an invalid or unavailable configuration may fail when the provider starts.
|
|
332
341
|
|
|
333
|
-
|
|
342
|
+
Explicit model requests require an `explicitModelConfigApplied` acknowledgment from Core before the SDK exposes the session or starts Deno Module setup. If the connected Extension/Desktop is too old to provide that acknowledgment, the SDK aborts the newly created setup and reports a compatibility error instead of silently using a different configuration.
|
|
334
343
|
|
|
335
344
|
Currently supported provider codes in the SDK:
|
|
336
345
|
|
|
@@ -343,6 +352,6 @@ Currently supported provider codes in the SDK:
|
|
|
343
352
|
| Claude Code | `claude` |
|
|
344
353
|
| Ollama | `ollama` |
|
|
345
354
|
|
|
346
|
-
Ollama sessions are executed by the bundled `pedelec-agent`.
|
|
355
|
+
Ollama sessions are executed by the bundled `pedelec-agent`. In profile mode, the selected Ollama effort profile must contain a model; otherwise Core returns `MODEL_REQUIRED`. In explicit model mode, `{ model }` supplies the model directly. Ollama currently does not accept an explicit `effort`. Low and high profiles are optional, but there is no fallback between profiles.
|
|
347
356
|
|
|
348
357
|
`getSettings()` returns only `{ defaultProvider }`. It never exposes provider settings, effort arguments, credentials, or model names.
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export type PedelecOptions = {
|
|
|
3
3
|
};
|
|
4
4
|
export type ProviderCode = "codex" | "antigravity" | "opencode" | "cursor" | "claude" | "ollama";
|
|
5
5
|
export type EffortLevel = "default" | "low" | "high";
|
|
6
|
+
export type Effort = "low" | "medium" | "high" | "xhigh" | "max";
|
|
6
7
|
export type JsonPrimitive = string | number | boolean | null;
|
|
7
8
|
export type JsonValue = JsonPrimitive | JsonValue[] | {
|
|
8
9
|
[key: string]: JsonValue;
|
|
@@ -106,23 +107,26 @@ export interface WorkspaceFolderPickerResult {
|
|
|
106
107
|
isEmptyFolder: boolean;
|
|
107
108
|
hasWorkspaceConfig: boolean;
|
|
108
109
|
}
|
|
109
|
-
type
|
|
110
|
-
provider: ProviderCode;
|
|
111
|
-
model?: string;
|
|
112
|
-
effortLevel?: EffortLevel;
|
|
110
|
+
type CreateSessionSharedInput<TTools extends readonly ToolDefinition[] = readonly ToolDefinition[]> = {
|
|
113
111
|
skills?: SkillsInput<TTools>;
|
|
114
112
|
workspace?: CreateSessionWorkspaceInput;
|
|
115
113
|
autoEndOnDisconnect?: boolean;
|
|
116
114
|
};
|
|
117
|
-
type
|
|
118
|
-
|
|
119
|
-
|
|
115
|
+
type ProfileSessionConfiguration = {
|
|
116
|
+
model?: never;
|
|
117
|
+
effort?: never;
|
|
120
118
|
effortLevel?: EffortLevel;
|
|
121
|
-
skills?: SkillsInput<TTools>;
|
|
122
|
-
workspace?: CreateSessionWorkspaceInput;
|
|
123
|
-
autoEndOnDisconnect?: boolean;
|
|
124
119
|
};
|
|
125
|
-
|
|
120
|
+
type ExplicitModelSessionConfiguration = {
|
|
121
|
+
model: string;
|
|
122
|
+
effort?: Effort;
|
|
123
|
+
effortLevel?: never;
|
|
124
|
+
};
|
|
125
|
+
export type CreateSessionInput<TTools extends readonly ToolDefinition[] = readonly ToolDefinition[]> = (CreateSessionSharedInput<TTools> & {
|
|
126
|
+
provider?: ProviderCode;
|
|
127
|
+
} & ProfileSessionConfiguration) | (CreateSessionSharedInput<TTools> & {
|
|
128
|
+
provider?: ProviderCode;
|
|
129
|
+
} & ExplicitModelSessionConfiguration);
|
|
126
130
|
export type ProviderInfo = {
|
|
127
131
|
name: string;
|
|
128
132
|
code: ProviderCode;
|
package/dist/index.js
CHANGED
|
@@ -218,6 +218,7 @@ export class Pedelec {
|
|
|
218
218
|
input: {
|
|
219
219
|
provider: resolvedInput.provider,
|
|
220
220
|
model: resolvedInput.model,
|
|
221
|
+
effort: resolvedInput.effort,
|
|
221
222
|
effortLevel: resolvedInput.effortLevel,
|
|
222
223
|
skills: resolvedInput.skills,
|
|
223
224
|
workspace: resolvedInput.workspace,
|
|
@@ -227,8 +228,8 @@ export class Pedelec {
|
|
|
227
228
|
if (!result.sessionId) {
|
|
228
229
|
throw makeError("SDK_PROTOCOL_ERROR", "create_session response did not include sessionId");
|
|
229
230
|
}
|
|
230
|
-
if (resolvedInput.model !== undefined && result.
|
|
231
|
-
const error = makeError("SDK_PROTOCOL_ERROR", "The connected Pedelec Extension/Desktop does not support
|
|
231
|
+
if (resolvedInput.model !== undefined && result.explicitModelConfigApplied !== true) {
|
|
232
|
+
const error = makeError("SDK_PROTOCOL_ERROR", "The connected Pedelec Extension/Desktop does not support explicit model configuration. Update Pedelec components and try again.", { feature: "explicitModelConfig" });
|
|
232
233
|
await this.abortSessionSetup(result.sessionId);
|
|
233
234
|
throw error;
|
|
234
235
|
}
|
|
@@ -506,6 +507,31 @@ export class Pedelec {
|
|
|
506
507
|
const provider = typeof raw.provider === "string" ? raw.provider.trim() : "";
|
|
507
508
|
const hasProvider = provider.length > 0;
|
|
508
509
|
const model = normalizeCreateSessionModelInput(raw.model);
|
|
510
|
+
if (model !== undefined) {
|
|
511
|
+
if (raw.effortLevel !== undefined) {
|
|
512
|
+
throw makeError("INVALID_INPUT", "effortLevel cannot be combined with model");
|
|
513
|
+
}
|
|
514
|
+
const effort = normalizeCreateSessionEffortInput(raw.effort);
|
|
515
|
+
const autoEndOnDisconnect = raw.autoEndOnDisconnect !== false;
|
|
516
|
+
const normalizedSkills = normalizeSkillsInput(raw.skills);
|
|
517
|
+
const workspace = normalizeCreateSessionWorkspaceInput(raw.workspace);
|
|
518
|
+
if (!hasProvider) {
|
|
519
|
+
return this.resolveDefaultCreateSessionInput(model, effort, undefined, normalizedSkills, workspace, autoEndOnDisconnect);
|
|
520
|
+
}
|
|
521
|
+
return {
|
|
522
|
+
provider: provider,
|
|
523
|
+
model,
|
|
524
|
+
effort,
|
|
525
|
+
skills: normalizedSkills.manifest,
|
|
526
|
+
workspace,
|
|
527
|
+
inlineToolHandlers: normalizedSkills.handlers,
|
|
528
|
+
denoModules: normalizedSkills.denoModules,
|
|
529
|
+
autoEndOnDisconnect,
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
if (raw.effort !== undefined) {
|
|
533
|
+
throw makeError("INVALID_INPUT", "effort requires model");
|
|
534
|
+
}
|
|
509
535
|
const effortLevel = raw.effortLevel === undefined ? "default" : raw.effortLevel;
|
|
510
536
|
if (!isEffortLevel(effortLevel)) {
|
|
511
537
|
throw makeError("INVALID_INPUT", "effortLevel must be one of default, low, or high");
|
|
@@ -514,11 +540,10 @@ export class Pedelec {
|
|
|
514
540
|
const normalizedSkills = normalizeSkillsInput(raw.skills);
|
|
515
541
|
const workspace = normalizeCreateSessionWorkspaceInput(raw.workspace);
|
|
516
542
|
if (!hasProvider) {
|
|
517
|
-
return this.resolveDefaultCreateSessionInput(
|
|
543
|
+
return this.resolveDefaultCreateSessionInput(undefined, undefined, effortLevel, normalizedSkills, workspace, autoEndOnDisconnect);
|
|
518
544
|
}
|
|
519
545
|
return {
|
|
520
546
|
provider: provider,
|
|
521
|
-
model,
|
|
522
547
|
effortLevel,
|
|
523
548
|
skills: normalizedSkills.manifest,
|
|
524
549
|
workspace,
|
|
@@ -579,7 +604,7 @@ export class Pedelec {
|
|
|
579
604
|
};
|
|
580
605
|
}
|
|
581
606
|
}
|
|
582
|
-
async resolveDefaultCreateSessionInput(model, effortLevel, normalizedSkills, workspace, autoEndOnDisconnect) {
|
|
607
|
+
async resolveDefaultCreateSessionInput(model, effort, effortLevel, normalizedSkills, workspace, autoEndOnDisconnect) {
|
|
583
608
|
const settings = await this.getSettings();
|
|
584
609
|
if (!settings.defaultProvider) {
|
|
585
610
|
throw makeError("DEFAULT_PROVIDER_NOT_SET", "Default provider is not set. Open the Pedelec desktop app Settings page and choose a default provider.");
|
|
@@ -588,6 +613,7 @@ export class Pedelec {
|
|
|
588
613
|
return {
|
|
589
614
|
provider: settings.defaultProvider,
|
|
590
615
|
model,
|
|
616
|
+
effort,
|
|
591
617
|
effortLevel,
|
|
592
618
|
skills: normalizedSkills.manifest,
|
|
593
619
|
workspace,
|
|
@@ -763,6 +789,14 @@ function normalizeCreateSessionModelInput(value) {
|
|
|
763
789
|
}
|
|
764
790
|
return value.trim();
|
|
765
791
|
}
|
|
792
|
+
function normalizeCreateSessionEffortInput(value) {
|
|
793
|
+
if (value === undefined)
|
|
794
|
+
return undefined;
|
|
795
|
+
if (!isEffort(value)) {
|
|
796
|
+
throw makeError("INVALID_INPUT", "effort must be one of low, medium, high, xhigh, or max");
|
|
797
|
+
}
|
|
798
|
+
return value;
|
|
799
|
+
}
|
|
766
800
|
export class PedelecSession {
|
|
767
801
|
client;
|
|
768
802
|
sessionId;
|
|
@@ -1569,6 +1603,9 @@ function isProviderCode(value) {
|
|
|
1569
1603
|
function isEffortLevel(value) {
|
|
1570
1604
|
return value === "default" || value === "low" || value === "high";
|
|
1571
1605
|
}
|
|
1606
|
+
function isEffort(value) {
|
|
1607
|
+
return value === "low" || value === "medium" || value === "high" || value === "xhigh" || value === "max";
|
|
1608
|
+
}
|
|
1572
1609
|
function isPlainObject(value) {
|
|
1573
1610
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
1574
1611
|
}
|
package/dist/index.type-test.js
CHANGED
|
@@ -147,7 +147,17 @@ async function effortLevelPublicTypeContract() {
|
|
|
147
147
|
// @ts-expect-error the removed sandbox picker is not part of the public contract
|
|
148
148
|
pedelec.sandboxFolderPicker();
|
|
149
149
|
await pedelec.createSession({ model: "gpt-5" });
|
|
150
|
+
await pedelec.createSession({ provider: "codex", model: "gpt-5", effort: "max" });
|
|
151
|
+
const explicitEffort = "xhigh";
|
|
152
|
+
await pedelec.createSession({ provider: "codex", model: "gpt-5", effort: explicitEffort });
|
|
153
|
+
// @ts-expect-error explicit model mode cannot select a Desktop effort profile
|
|
150
154
|
await pedelec.createSession({ provider: "codex", model: "gpt-5", effortLevel: "high" });
|
|
155
|
+
// @ts-expect-error explicit effort requires an explicit model
|
|
156
|
+
await pedelec.createSession({ provider: "codex", effort: "high" });
|
|
157
|
+
// @ts-expect-error explicit model, effort, and Desktop profile are mutually exclusive
|
|
158
|
+
await pedelec.createSession({ model: "gpt-5", effort: "max", effortLevel: "low" });
|
|
159
|
+
// @ts-expect-error unsupported provider-native effort value
|
|
160
|
+
await pedelec.createSession({ model: "gpt-5", effort: "default" });
|
|
151
161
|
// @ts-expect-error session no longer exposes provider model
|
|
152
162
|
session.model;
|
|
153
163
|
// @ts-expect-error unsupported effort level
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.3.
|
|
1
|
+
export declare const SDK_VERSION = "0.3.5";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated from sdk/package.json. Do not edit manually.
|
|
2
|
-
export const SDK_VERSION = "0.3.
|
|
2
|
+
export const SDK_VERSION = "0.3.5";
|