@skillstate/core 2.0.3 → 2.0.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 +1 -1
- package/dist/instrumentation.d.ts +1 -1
- package/dist/instrumentation.js +1 -1
- package/dist/provider.d.ts +5 -5
- package/dist/provider.js +4 -4
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +1 -1
- package/dist/schemas/generic-procedure.d.ts +11 -0
- package/dist/schemas/generic-procedure.d.ts.map +1 -0
- package/dist/schemas/generic-procedure.js +64 -0
- package/dist/schemas/generic-procedure.js.map +1 -0
- package/dist/schemas/index.d.ts +1 -0
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +3 -1
- package/dist/schemas/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/@skillstate/core)
|
|
8
8
|
[](https://www.npmjs.com/package/@skillstate/core)
|
|
9
|
-
[](https://github.com/vitalykuzyaev/skillstate)
|
|
10
10
|
[](https://github.com/vitalykuzyaev/skillstate/blob/main/LICENSE)
|
|
11
11
|
|
|
12
12
|
</div>
|
|
@@ -14,7 +14,7 @@ export interface TokenCounter {
|
|
|
14
14
|
count(text: string): number;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
* @non-paper
|
|
17
|
+
* @non-paper rough heuristic: 1 token ≈ 4 chars, rounded up.
|
|
18
18
|
*
|
|
19
19
|
* Kept for backward compatibility of ad-hoc estimates only. Do NOT use it
|
|
20
20
|
* for paper §4.3 metrics — those are measured in chars (see `TokenTracker`).
|
package/dist/instrumentation.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* paper-exact baseline in `./token-tracker.js`.
|
|
10
10
|
*/
|
|
11
11
|
/**
|
|
12
|
-
* @non-paper
|
|
12
|
+
* @non-paper rough heuristic: 1 token ≈ 4 chars, rounded up.
|
|
13
13
|
*
|
|
14
14
|
* Kept for backward compatibility of ad-hoc estimates only. Do NOT use it
|
|
15
15
|
* for paper §4.3 metrics — those are measured in chars (see `TokenTracker`).
|
package/dist/provider.d.ts
CHANGED
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
* - `LLMProvider.call(prompt, opts?)` resolves `{ text, usage? }` where
|
|
9
9
|
* `usage.promptChars` / `usage.completionChars` are RAW STRING CHARS
|
|
10
10
|
* (§4.3) reported by the caller — never tokenizer output;
|
|
11
|
-
* - `fromLLMFn(fn)` wraps a
|
|
11
|
+
* - `fromLLMFn(fn)` wraps a plain `LLMFn` function into an `LLMProvider`
|
|
12
12
|
* (backwards compatibility; `LLMFn` itself is NOT removed);
|
|
13
13
|
* - `isLLMProvider(v)` distinguishes `LLMFn | LLMProvider` at runtime
|
|
14
|
-
* (function =
|
|
14
|
+
* (plain function = fn form, object with a `call` function = provider).
|
|
15
15
|
*
|
|
16
16
|
* The runtime accepts `llm: LLMFn | LLMProvider`: with a provider it
|
|
17
17
|
* prefers `usage` over measuring strings, otherwise it measures exactly
|
|
@@ -27,7 +27,7 @@ export interface LLMCallOptions {
|
|
|
27
27
|
/**
|
|
28
28
|
* @non-paper usage reported by the provider, in raw string CHARS (§4.3).
|
|
29
29
|
* Both fields are optional: missing values fall back to measuring the
|
|
30
|
-
* corresponding string, exactly the
|
|
30
|
+
* corresponding string, exactly the plain `LLMFn` behavior.
|
|
31
31
|
*/
|
|
32
32
|
export interface LLMUsage {
|
|
33
33
|
/** Raw chars of the prompt as sent (overrides `prompt.length`). */
|
|
@@ -49,11 +49,11 @@ export interface LLMProvider {
|
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
51
|
* @non-paper runtime guard: an object with a callable `call` is a
|
|
52
|
-
* provider; anything else passed as `llm` is treated as a
|
|
52
|
+
* provider; anything else passed as `llm` is treated as a plain `LLMFn`.
|
|
53
53
|
*/
|
|
54
54
|
export declare function isLLMProvider(value: unknown): value is LLMProvider;
|
|
55
55
|
/**
|
|
56
|
-
* @non-paper
|
|
56
|
+
* @non-paper adapter: wrap a plain `LLMFn` function
|
|
57
57
|
* into an `LLMProvider`. The wrapper honors an already-aborted `signal`
|
|
58
58
|
* (rejects with `signal.reason`) and otherwise delegates verbatim —
|
|
59
59
|
* no usage is synthesized, so the runtime measures strings as before.
|
package/dist/provider.js
CHANGED
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
* - `LLMProvider.call(prompt, opts?)` resolves `{ text, usage? }` where
|
|
9
9
|
* `usage.promptChars` / `usage.completionChars` are RAW STRING CHARS
|
|
10
10
|
* (§4.3) reported by the caller — never tokenizer output;
|
|
11
|
-
* - `fromLLMFn(fn)` wraps a
|
|
11
|
+
* - `fromLLMFn(fn)` wraps a plain `LLMFn` function into an `LLMProvider`
|
|
12
12
|
* (backwards compatibility; `LLMFn` itself is NOT removed);
|
|
13
13
|
* - `isLLMProvider(v)` distinguishes `LLMFn | LLMProvider` at runtime
|
|
14
|
-
* (function =
|
|
14
|
+
* (plain function = fn form, object with a `call` function = provider).
|
|
15
15
|
*
|
|
16
16
|
* The runtime accepts `llm: LLMFn | LLMProvider`: with a provider it
|
|
17
17
|
* prefers `usage` over measuring strings, otherwise it measures exactly
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
*/
|
|
20
20
|
/**
|
|
21
21
|
* @non-paper runtime guard: an object with a callable `call` is a
|
|
22
|
-
* provider; anything else passed as `llm` is treated as a
|
|
22
|
+
* provider; anything else passed as `llm` is treated as a plain `LLMFn`.
|
|
23
23
|
*/
|
|
24
24
|
export function isLLMProvider(value) {
|
|
25
25
|
if (typeof value !== 'object' || value === null) {
|
|
@@ -28,7 +28,7 @@ export function isLLMProvider(value) {
|
|
|
28
28
|
return typeof value.call === 'function';
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
|
-
* @non-paper
|
|
31
|
+
* @non-paper adapter: wrap a plain `LLMFn` function
|
|
32
32
|
* into an `LLMProvider`. The wrapper honors an already-aborted `signal`
|
|
33
33
|
* (rejects with `signal.reason`) and otherwise delegates verbatim —
|
|
34
34
|
* no usage is synthesized, so the runtime measures strings as before.
|
package/dist/runtime.d.ts
CHANGED
|
@@ -183,7 +183,7 @@ export declare class SkillStateRuntime {
|
|
|
183
183
|
/**
|
|
184
184
|
* @non-paper LLM dispatch (Wave 4 DX, additive).
|
|
185
185
|
*
|
|
186
|
-
* Paper path: `llm` is a
|
|
186
|
+
* Paper path: `llm` is a plain `LLMFn` function — called verbatim with the
|
|
187
187
|
* prompt, exactly as before. Provider path: `llm.call(prompt, opts?)`
|
|
188
188
|
* is used instead, forwarding the runtime `signal?` so aborts reach
|
|
189
189
|
* the provider; both paths stay inside `invokeResilient`, so the
|
package/dist/runtime.js
CHANGED
|
@@ -134,7 +134,7 @@ export class SkillStateRuntime {
|
|
|
134
134
|
/**
|
|
135
135
|
* @non-paper LLM dispatch (Wave 4 DX, additive).
|
|
136
136
|
*
|
|
137
|
-
* Paper path: `llm` is a
|
|
137
|
+
* Paper path: `llm` is a plain `LLMFn` function — called verbatim with the
|
|
138
138
|
* prompt, exactly as before. Provider path: `llm.call(prompt, opts?)`
|
|
139
139
|
* is used instead, forwarding the runtime `signal?` so aborts reach
|
|
140
140
|
* the provider; both paths stay inside `invokeResilient`, so the
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default neutral spec for `skillstate init` — domain-agnostic state-based
|
|
3
|
+
* execution. Projects differ; the task spec is the user's concern
|
|
4
|
+
* (`skillstate init --spec <path>`). This schema only fixes the universal
|
|
5
|
+
* bookkeeping fields every stateful procedure needs.
|
|
6
|
+
*
|
|
7
|
+
* The CTF example remains available explicitly via `skillstate init --example ctf`.
|
|
8
|
+
*/
|
|
9
|
+
import type { ProceduralSpec } from '../types.js';
|
|
10
|
+
export declare const GENERIC_PROCEDURE_SPEC: ProceduralSpec;
|
|
11
|
+
//# sourceMappingURL=generic-procedure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generic-procedure.d.ts","sourceRoot":"","sources":["../../src/schemas/generic-procedure.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,eAAO,MAAM,sBAAsB,EAAE,cA8DpC,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export const GENERIC_PROCEDURE_SPEC = {
|
|
2
|
+
id: 'generic-procedure',
|
|
3
|
+
name: 'State-based Execution',
|
|
4
|
+
version: '1.0.0',
|
|
5
|
+
instructions: [
|
|
6
|
+
'You are operating in state-based execution mode on an arbitrary task.',
|
|
7
|
+
'',
|
|
8
|
+
'Your execution state is persisted externally and restored between',
|
|
9
|
+
'steps. Conversation history is trimmed automatically: never rely on',
|
|
10
|
+
'it to carry information. Anything you need later MUST go into',
|
|
11
|
+
'state_patch this step.',
|
|
12
|
+
'',
|
|
13
|
+
'Process for every step:',
|
|
14
|
+
'1. Read the current state and the latest observation.',
|
|
15
|
+
'2. Reason about the single next action that makes the most progress',
|
|
16
|
+
' toward the goal.',
|
|
17
|
+
'3. Emit a JSON block with exactly two keys:',
|
|
18
|
+
' { "state_patch": { ... }, "action": "<what you are doing next>" }',
|
|
19
|
+
'',
|
|
20
|
+
'State discipline:',
|
|
21
|
+
'- Keep `goal` accurate; refine it as understanding improves.',
|
|
22
|
+
'- Move finished work into `progress`; keep `next_steps` current.',
|
|
23
|
+
'- Record produced or modified files in `artifacts`.',
|
|
24
|
+
'- Track unknowns and obstacles in `blockers` instead of memory.',
|
|
25
|
+
'- Use `notes` for anything else worth persisting.',
|
|
26
|
+
'- Set a key to null in state_patch to delete it.',
|
|
27
|
+
'',
|
|
28
|
+
'Iterate observation -> reasoning -> state_patch -> action until the',
|
|
29
|
+
'goal is achieved and `progress` reflects it.',
|
|
30
|
+
].join('\n'),
|
|
31
|
+
schema: {
|
|
32
|
+
goal: {
|
|
33
|
+
type: 'string',
|
|
34
|
+
default: '',
|
|
35
|
+
description: 'What the current procedure is trying to achieve',
|
|
36
|
+
},
|
|
37
|
+
progress: {
|
|
38
|
+
type: 'array',
|
|
39
|
+
default: [],
|
|
40
|
+
description: 'Completed steps or milestones',
|
|
41
|
+
},
|
|
42
|
+
next_steps: {
|
|
43
|
+
type: 'array',
|
|
44
|
+
default: [],
|
|
45
|
+
description: 'Planned next actions',
|
|
46
|
+
},
|
|
47
|
+
artifacts: {
|
|
48
|
+
type: 'array',
|
|
49
|
+
default: [],
|
|
50
|
+
description: 'Files or paths produced or modified so far',
|
|
51
|
+
},
|
|
52
|
+
blockers: {
|
|
53
|
+
type: 'array',
|
|
54
|
+
default: [],
|
|
55
|
+
description: 'Current obstacles or unknowns',
|
|
56
|
+
},
|
|
57
|
+
notes: {
|
|
58
|
+
type: 'string',
|
|
59
|
+
default: '',
|
|
60
|
+
description: 'Free-form working notes persisted between steps',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=generic-procedure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generic-procedure.js","sourceRoot":"","sources":["../../src/schemas/generic-procedure.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,sBAAsB,GAAmB;IACpD,EAAE,EAAE,mBAAmB;IACvB,IAAI,EAAE,uBAAuB;IAC7B,OAAO,EAAE,OAAO;IAChB,YAAY,EAAE;QACZ,uEAAuE;QACvE,EAAE;QACF,mEAAmE;QACnE,qEAAqE;QACrE,+DAA+D;QAC/D,wBAAwB;QACxB,EAAE;QACF,yBAAyB;QACzB,uDAAuD;QACvD,qEAAqE;QACrE,qBAAqB;QACrB,6CAA6C;QAC7C,sEAAsE;QACtE,EAAE;QACF,mBAAmB;QACnB,8DAA8D;QAC9D,kEAAkE;QAClE,qDAAqD;QACrD,iEAAiE;QACjE,mDAAmD;QACnD,kDAAkD;QAClD,EAAE;QACF,qEAAqE;QACrE,8CAA8C;KAC/C,CAAC,IAAI,CAAC,IAAI,CAAC;IACZ,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE;YACX,WAAW,EAAE,iDAAiD;SAC/D;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,EAAE;YACX,WAAW,EAAE,+BAA+B;SAC7C;QACD,UAAU,EAAE;YACV,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,EAAE;YACX,WAAW,EAAE,sBAAsB;SACpC;QACD,SAAS,EAAE;YACT,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,EAAE;YACX,WAAW,EAAE,4CAA4C;SAC1D;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,EAAE;YACX,WAAW,EAAE,+BAA+B;SAC7C;QACD,KAAK,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE;YACX,WAAW,EAAE,iDAAiD;SAC/D;KACF;CACF,CAAC"}
|
package/dist/schemas/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAEA,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC"}
|
package/dist/schemas/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
// Canonical procedural specifications (paper §3.1 datasets)
|
|
1
|
+
// Canonical procedural specifications (paper §3.1 datasets) plus the
|
|
2
|
+
// neutral default used by `skillstate init` (domain-agnostic).
|
|
2
3
|
export * from './intercode-ctf.js';
|
|
4
|
+
export * from './generic-procedure.js';
|
|
3
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,+DAA+D;AAC/D,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC"}
|