kernl 0.6.1 → 0.6.2
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/.turbo/turbo-build.log +4 -5
- package/CHANGELOG.md +6 -0
- package/dist/kernl.d.ts +0 -9
- package/dist/kernl.d.ts.map +1 -1
- package/dist/kernl.js +0 -22
- package/package.json +1 -1
- package/src/kernl.ts +0 -25
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
|
|
2
|
+
> kernl@0.6.1 build /Users/andjones/Documents/projects/kernl/packages/kernl
|
|
3
|
+
> tsc && tsc-alias --resolve-full-paths
|
|
4
|
+
|
package/CHANGELOG.md
CHANGED
package/dist/kernl.d.ts
CHANGED
|
@@ -19,7 +19,6 @@ export declare class Kernl extends KernlHooks<UnknownContext, AgentResponseType>
|
|
|
19
19
|
private models;
|
|
20
20
|
readonly storage: KernlStorage;
|
|
21
21
|
athreads: Map<string, Thread<any, any>>;
|
|
22
|
-
private initPromise;
|
|
23
22
|
readonly threads: RThreads;
|
|
24
23
|
constructor(options?: KernlOptions);
|
|
25
24
|
/**
|
|
@@ -48,13 +47,5 @@ export declare class Kernl extends KernlHooks<UnknownContext, AgentResponseType>
|
|
|
48
47
|
* Schedule an existing thread - streaming execution
|
|
49
48
|
*/
|
|
50
49
|
scheduleStream<TContext, TResponse extends AgentResponseType>(thread: Thread<TContext, TResponse>): AsyncIterable<ThreadStreamEvent>;
|
|
51
|
-
/**
|
|
52
|
-
* Ensure the underlying storage backend has been initialized.
|
|
53
|
-
*
|
|
54
|
-
* This is called lazily on first use so that callers do not need to worry
|
|
55
|
-
* about calling storage.init() themselves. Safe and idempotent to call
|
|
56
|
-
* multiple times; concurrent calls share the same initialization promise.
|
|
57
|
-
*/
|
|
58
|
-
private ensureInitialized;
|
|
59
50
|
}
|
|
60
51
|
//# sourceMappingURL=kernl.d.ts.map
|
package/dist/kernl.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kernl.d.ts","sourceRoot":"","sources":["../src/kernl.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD;;;;;GAKG;AACH,qBAAa,KAAM,SAAQ,UAAU,CAAC,cAAc,EAAE,iBAAiB,CAAC;IACtE,OAAO,CAAC,MAAM,CAAiC;IAC/C,OAAO,CAAC,MAAM,CAAyC;IAEvD,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAa;
|
|
1
|
+
{"version":3,"file":"kernl.d.ts","sourceRoot":"","sources":["../src/kernl.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,MAA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,SAAS,iBAAiB,EAC9D,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,GAClC,aAAa,CAAC,iBAAiB,CAAC;IASnC;;;;OAIG;IACI,cAAc,CAAC,QAAQ,EAAE,SAAS,SAAS,iBAAiB,EACjE,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,GAClC,aAAa,CAAC,iBAAiB,CAAC;CAQpC"}
|
package/dist/kernl.js
CHANGED
|
@@ -12,7 +12,6 @@ export class Kernl extends KernlHooks {
|
|
|
12
12
|
models = new Map();
|
|
13
13
|
storage;
|
|
14
14
|
athreads = new Map(); /* active threads */
|
|
15
|
-
initPromise = null;
|
|
16
15
|
// --- public API ---
|
|
17
16
|
threads; /* Threads resource */
|
|
18
17
|
constructor(options = {}) {
|
|
@@ -39,7 +38,6 @@ export class Kernl extends KernlHooks {
|
|
|
39
38
|
* Spawn a new thread - blocking execution
|
|
40
39
|
*/
|
|
41
40
|
async spawn(thread) {
|
|
42
|
-
await this.ensureInitialized();
|
|
43
41
|
this.athreads.set(thread.tid, thread);
|
|
44
42
|
try {
|
|
45
43
|
return await thread.execute();
|
|
@@ -54,7 +52,6 @@ export class Kernl extends KernlHooks {
|
|
|
54
52
|
* NOTE: just blocks for now
|
|
55
53
|
*/
|
|
56
54
|
async schedule(thread) {
|
|
57
|
-
await this.ensureInitialized();
|
|
58
55
|
this.athreads.set(thread.tid, thread);
|
|
59
56
|
try {
|
|
60
57
|
return await thread.execute();
|
|
@@ -69,7 +66,6 @@ export class Kernl extends KernlHooks {
|
|
|
69
66
|
* Spawn a new thread - streaming execution
|
|
70
67
|
*/
|
|
71
68
|
async *spawnStream(thread) {
|
|
72
|
-
await this.ensureInitialized();
|
|
73
69
|
this.athreads.set(thread.tid, thread);
|
|
74
70
|
try {
|
|
75
71
|
yield* thread.stream();
|
|
@@ -84,7 +80,6 @@ export class Kernl extends KernlHooks {
|
|
|
84
80
|
* Schedule an existing thread - streaming execution
|
|
85
81
|
*/
|
|
86
82
|
async *scheduleStream(thread) {
|
|
87
|
-
await this.ensureInitialized();
|
|
88
83
|
this.athreads.set(thread.tid, thread);
|
|
89
84
|
try {
|
|
90
85
|
yield* thread.stream();
|
|
@@ -93,21 +88,4 @@ export class Kernl extends KernlHooks {
|
|
|
93
88
|
this.athreads.delete(thread.tid);
|
|
94
89
|
}
|
|
95
90
|
}
|
|
96
|
-
/**
|
|
97
|
-
* Ensure the underlying storage backend has been initialized.
|
|
98
|
-
*
|
|
99
|
-
* This is called lazily on first use so that callers do not need to worry
|
|
100
|
-
* about calling storage.init() themselves. Safe and idempotent to call
|
|
101
|
-
* multiple times; concurrent calls share the same initialization promise.
|
|
102
|
-
*/
|
|
103
|
-
async ensureInitialized() {
|
|
104
|
-
if (!this.initPromise) {
|
|
105
|
-
this.initPromise = this.storage.init().catch((error) => {
|
|
106
|
-
// allow a retry if initialization fails.
|
|
107
|
-
this.initPromise = null;
|
|
108
|
-
throw error;
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
await this.initPromise;
|
|
112
|
-
}
|
|
113
91
|
}
|
package/package.json
CHANGED
package/src/kernl.ts
CHANGED
|
@@ -25,8 +25,6 @@ export class Kernl extends KernlHooks<UnknownContext, AgentResponseType> {
|
|
|
25
25
|
readonly storage: KernlStorage;
|
|
26
26
|
athreads: Map<string, Thread<any, any>> = new Map(); /* active threads */
|
|
27
27
|
|
|
28
|
-
private initPromise: Promise<void> | null = null;
|
|
29
|
-
|
|
30
28
|
// --- public API ---
|
|
31
29
|
readonly threads: RThreads; /* Threads resource */
|
|
32
30
|
|
|
@@ -59,7 +57,6 @@ export class Kernl extends KernlHooks<UnknownContext, AgentResponseType> {
|
|
|
59
57
|
async spawn<TContext, TResponse extends AgentResponseType>(
|
|
60
58
|
thread: Thread<TContext, TResponse>,
|
|
61
59
|
): Promise<ThreadExecuteResult<ResolvedAgentResponse<TResponse>>> {
|
|
62
|
-
await this.ensureInitialized();
|
|
63
60
|
this.athreads.set(thread.tid, thread);
|
|
64
61
|
try {
|
|
65
62
|
return await thread.execute();
|
|
@@ -76,7 +73,6 @@ export class Kernl extends KernlHooks<UnknownContext, AgentResponseType> {
|
|
|
76
73
|
async schedule<TContext, TResponse extends AgentResponseType>(
|
|
77
74
|
thread: Thread<TContext, TResponse>,
|
|
78
75
|
): Promise<ThreadExecuteResult<ResolvedAgentResponse<TResponse>>> {
|
|
79
|
-
await this.ensureInitialized();
|
|
80
76
|
this.athreads.set(thread.tid, thread);
|
|
81
77
|
try {
|
|
82
78
|
return await thread.execute();
|
|
@@ -93,7 +89,6 @@ export class Kernl extends KernlHooks<UnknownContext, AgentResponseType> {
|
|
|
93
89
|
async *spawnStream<TContext, TResponse extends AgentResponseType>(
|
|
94
90
|
thread: Thread<TContext, TResponse>,
|
|
95
91
|
): AsyncIterable<ThreadStreamEvent> {
|
|
96
|
-
await this.ensureInitialized();
|
|
97
92
|
this.athreads.set(thread.tid, thread);
|
|
98
93
|
try {
|
|
99
94
|
yield* thread.stream();
|
|
@@ -110,7 +105,6 @@ export class Kernl extends KernlHooks<UnknownContext, AgentResponseType> {
|
|
|
110
105
|
async *scheduleStream<TContext, TResponse extends AgentResponseType>(
|
|
111
106
|
thread: Thread<TContext, TResponse>,
|
|
112
107
|
): AsyncIterable<ThreadStreamEvent> {
|
|
113
|
-
await this.ensureInitialized();
|
|
114
108
|
this.athreads.set(thread.tid, thread);
|
|
115
109
|
try {
|
|
116
110
|
yield* thread.stream();
|
|
@@ -118,23 +112,4 @@ export class Kernl extends KernlHooks<UnknownContext, AgentResponseType> {
|
|
|
118
112
|
this.athreads.delete(thread.tid);
|
|
119
113
|
}
|
|
120
114
|
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Ensure the underlying storage backend has been initialized.
|
|
124
|
-
*
|
|
125
|
-
* This is called lazily on first use so that callers do not need to worry
|
|
126
|
-
* about calling storage.init() themselves. Safe and idempotent to call
|
|
127
|
-
* multiple times; concurrent calls share the same initialization promise.
|
|
128
|
-
*/
|
|
129
|
-
private async ensureInitialized(): Promise<void> {
|
|
130
|
-
if (!this.initPromise) {
|
|
131
|
-
this.initPromise = this.storage.init().catch((error) => {
|
|
132
|
-
// allow a retry if initialization fails.
|
|
133
|
-
this.initPromise = null;
|
|
134
|
-
throw error;
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
await this.initPromise;
|
|
139
|
-
}
|
|
140
115
|
}
|