@felan-ai/ext-discretestack 0.0.0-stage → 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Felan contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/NOTICE ADDED
@@ -0,0 +1,6 @@
1
+ @felan-ai/ext-discretestack
2
+
3
+ Copyright (c) 2026 Felan contributors
4
+
5
+ This package is original Felan code licensed under the MIT License included in
6
+ this package. It has no third-party runtime dependencies.
package/README.md CHANGED
@@ -1,3 +1,31 @@
1
- # Temporary Holding Version
1
+ # DiscreteStack for Felan
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ This extension registers the Felan-managed DiscreteStack provider channel. It
4
+ sends requests to the provider's OpenAI-compatible `/chat/completions` endpoint.
5
+
6
+ ## Models
7
+
8
+ Prices are in USD per million tokens.
9
+
10
+ | Model | Input | Output | Cache read | Cache write |
11
+ | --- | ---: | ---: | ---: | ---: |
12
+ | DiscreteStack Max (`deepseek-v4.1-flash-1017`) | $0.07 | $0.18 | $0.002 | $0 |
13
+ | DiscreteStack Compact (`glm-5.3-flash`) | $0.05 | $0.20 | $0.015 | $0 |
14
+
15
+ Both models accept text and images. Their supported thinking levels are `off`,
16
+ `minimal`, `low`, `high`, and `max`. The gateway has no minimal effort, so
17
+ `minimal` sends no reasoning, the same as `off`.
18
+
19
+ The gateway rejects a request when its prompt plus `max_tokens` exceeds
20
+ 1,048,576 tokens. Each model therefore reports a 131,072-token output limit and
21
+ a 917,504-token context window, so sessions compact before a request can exceed
22
+ the gateway limit.
23
+
24
+ ## Configuration
25
+
26
+ Run `/login`, select **DiscreteStack**, and enter your API key. For environments
27
+ where interactive login is not available, set `DISCRETESTACK_API_KEY`. A saved
28
+ login takes precedence over the environment variable.
29
+
30
+ When retries are enabled, Pi retries HTTP 429 responses under load through its
31
+ normal session retry policy.
@@ -0,0 +1,5 @@
1
+ import type { ExtensionFactory } from '@felan-ai/agent-core';
2
+ export declare function createDiscreteStackExtension(): ExtensionFactory;
3
+ declare const _default: ExtensionFactory;
4
+ export default _default;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG7D,wBAAgB,4BAA4B,IAAI,gBAAgB,CAI/D;;AAED,wBAA8C"}
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ import { DISCRETESTACK_PROVIDER, DISCRETESTACK_PROVIDER_ID } from './provider.js';
2
+ export function createDiscreteStackExtension() {
3
+ return (pi) => {
4
+ pi.registerProvider(DISCRETESTACK_PROVIDER_ID, DISCRETESTACK_PROVIDER);
5
+ };
6
+ }
7
+ export default createDiscreteStackExtension();
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAElF,MAAM,UAAU,4BAA4B;IAC1C,OAAO,CAAC,EAAE,EAAE,EAAE;QACZ,EAAE,CAAC,gBAAgB,CAAC,yBAAyB,EAAE,sBAAsB,CAAC,CAAC;IACzE,CAAC,CAAC;AACJ,CAAC;AAED,eAAe,4BAA4B,EAAE,CAAC"}
@@ -0,0 +1,39 @@
1
+ export declare const DISCRETESTACK_PROVIDER_ID = "discretestack";
2
+ export declare const DISCRETESTACK_API_KEY_ENV = "DISCRETESTACK_API_KEY";
3
+ export declare const DISCRETESTACK_PROVIDER: {
4
+ name: string;
5
+ baseUrl: string;
6
+ api: "openai-completions";
7
+ apiKey: string;
8
+ models: {
9
+ id: string;
10
+ name: string;
11
+ cost: {
12
+ input: number;
13
+ output: number;
14
+ cacheRead: number;
15
+ cacheWrite: number;
16
+ };
17
+ type: "chat";
18
+ reasoning: true;
19
+ input: ("image" | "text")[];
20
+ contextWindow: number;
21
+ maxTokens: number;
22
+ thinkingLevelMap: {
23
+ off: string;
24
+ minimal: string;
25
+ low: string;
26
+ medium: null;
27
+ high: string;
28
+ xhigh: null;
29
+ max: string;
30
+ };
31
+ compat: {
32
+ supportsStore: false;
33
+ supportsDeveloperRole: false;
34
+ supportsReasoningEffort: true;
35
+ maxTokensField: "max_tokens";
36
+ };
37
+ }[];
38
+ };
39
+ //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,yBAAyB,kBAAkB,CAAC;AACzD,eAAO,MAAM,yBAAyB,0BAA0B,CAAC;AA2BjE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmBT,CAAC"}
@@ -0,0 +1,45 @@
1
+ export const DISCRETESTACK_PROVIDER_ID = 'discretestack';
2
+ export const DISCRETESTACK_API_KEY_ENV = 'DISCRETESTACK_API_KEY';
3
+ // The gateway rejects a request whose prompt plus max_tokens exceeds 1,048,576 tokens instead of
4
+ // clamping the output. Pi sends maxTokens on every request and compacts against contextWindow, so
5
+ // the advertised window leaves room for a full response.
6
+ const GATEWAY_CONTEXT_TOKENS = 1_048_576;
7
+ const MAX_OUTPUT_TOKENS = 131_072;
8
+ // Small budgeted requests such as session titles ask for minimal reasoning. The gateway has no
9
+ // minimal effort, and Pi would otherwise round it up to low, which DeepSeek can spend entirely on
10
+ // reasoning before writing any text.
11
+ const chatModel = {
12
+ type: 'chat',
13
+ reasoning: true,
14
+ input: ['text', 'image'],
15
+ contextWindow: GATEWAY_CONTEXT_TOKENS - MAX_OUTPUT_TOKENS,
16
+ maxTokens: MAX_OUTPUT_TOKENS,
17
+ thinkingLevelMap: { off: 'none', minimal: 'none', low: 'low', medium: null, high: 'high', xhigh: null, max: 'max' },
18
+ compat: {
19
+ supportsStore: false,
20
+ supportsDeveloperRole: false,
21
+ supportsReasoningEffort: true,
22
+ maxTokensField: 'max_tokens',
23
+ },
24
+ };
25
+ export const DISCRETESTACK_PROVIDER = {
26
+ name: 'DiscreteStack',
27
+ baseUrl: 'https://api.discretestack.eu/provider/v1',
28
+ api: 'openai-completions',
29
+ apiKey: `\${${DISCRETESTACK_API_KEY_ENV}}`,
30
+ models: [
31
+ {
32
+ ...chatModel,
33
+ id: 'deepseek-v4.1-flash-1017',
34
+ name: 'DiscreteStack Max',
35
+ cost: { input: 0.07, output: 0.18, cacheRead: 0.002, cacheWrite: 0 },
36
+ },
37
+ {
38
+ ...chatModel,
39
+ id: 'glm-5.3-flash',
40
+ name: 'DiscreteStack Compact',
41
+ cost: { input: 0.05, output: 0.2, cacheRead: 0.015, cacheWrite: 0 },
42
+ },
43
+ ],
44
+ };
45
+ //# sourceMappingURL=provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,yBAAyB,GAAG,eAAe,CAAC;AACzD,MAAM,CAAC,MAAM,yBAAyB,GAAG,uBAAuB,CAAC;AAEjE,iGAAiG;AACjG,kGAAkG;AAClG,yDAAyD;AACzD,MAAM,sBAAsB,GAAG,SAAS,CAAC;AACzC,MAAM,iBAAiB,GAAG,OAAO,CAAC;AAElC,+FAA+F;AAC/F,kGAAkG;AAClG,qCAAqC;AAErC,MAAM,SAAS,GAAG;IAChB,IAAI,EAAE,MAAM;IACZ,SAAS,EAAE,IAAI;IACf,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,sBAAsB,GAAG,iBAAiB;IACzD,SAAS,EAAE,iBAAiB;IAC5B,gBAAgB,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE;IACnH,MAAM,EAAE;QACN,aAAa,EAAE,KAAK;QACpB,qBAAqB,EAAE,KAAK;QAC5B,uBAAuB,EAAE,IAAI;QAC7B,cAAc,EAAE,YAAY;KAC7B;CACsD,CAAC;AAE1D,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,IAAI,EAAE,eAAe;IACrB,OAAO,EAAE,0CAA0C;IACnD,GAAG,EAAE,oBAAoB;IACzB,MAAM,EAAE,MAAM,yBAAyB,GAAG;IAC1C,MAAM,EAAE;QACN;YACE,GAAG,SAAS;YACZ,EAAE,EAAE,0BAA0B;YAC9B,IAAI,EAAE,mBAAmB;YACzB,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,EAAE;SACrE;QACD;YACE,GAAG,SAAS;YACZ,EAAE,EAAE,eAAe;YACnB,IAAI,EAAE,uBAAuB;YAC7B,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,EAAE;SACpE;KACF;CACuB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,46 @@
1
1
  {
2
2
  "name": "@felan-ai/ext-discretestack",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "DiscreteStack LLM provider for Felan",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/felan-ai/felan.git",
10
+ "directory": "packages/ext-discretestack"
11
+ },
12
+ "engines": {
13
+ "node": ">=22.19.0"
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "LICENSE",
18
+ "NOTICE",
19
+ "README.md"
20
+ ],
21
+ "exports": {
22
+ ".": {
23
+ "types": "./dist/index.d.ts",
24
+ "import": "./dist/index.js"
25
+ },
26
+ "./provider": {
27
+ "types": "./dist/provider.d.ts",
28
+ "import": "./dist/provider.js"
29
+ }
30
+ },
31
+ "peerDependencies": {
32
+ "@felan-ai/agent-core": "^0.16.0"
33
+ },
34
+ "devDependencies": {
35
+ "@felan-ai/agent-core": "0.16.0"
36
+ },
37
+ "publishConfig": {
38
+ "access": "public",
39
+ "provenance": true
40
+ },
41
+ "scripts": {
42
+ "build": "rm -rf dist && tsc -p tsconfig.build.json",
43
+ "type-check": "tsc -p tsconfig.json --noEmit",
44
+ "test": "vitest run"
45
+ }
6
46
  }