@wrongstack/core 0.4.1 → 0.5.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/{agent-bridge-DaOnnHNW.d.ts → agent-bridge-BkjOkSkD.d.ts} +1 -1
- package/dist/{compactor-CFky6JKM.d.ts → compactor-CTHjZAwf.d.ts} +1 -1
- package/dist/{config-RlhKLjme.d.ts → config-DO2eCKgq.d.ts} +1 -1
- package/dist/{context-B1kBj1lY.d.ts → context-P207fTpo.d.ts} +11 -0
- package/dist/coordination/index.d.ts +10 -891
- package/dist/coordination/index.js +407 -236
- package/dist/coordination/index.js.map +1 -1
- package/dist/defaults/index.d.ts +19 -18
- package/dist/defaults/index.js +2139 -284
- package/dist/defaults/index.js.map +1 -1
- package/dist/{events-BBaKeMfb.d.ts → events-DYAbU84e.d.ts} +41 -1
- package/dist/execution/index.d.ts +19 -13
- package/dist/execution/index.js +15 -6
- package/dist/execution/index.js.map +1 -1
- package/dist/extension/index.d.ts +6 -6
- package/dist/index-BHL8QDCL.d.ts +899 -0
- package/dist/{index-meJRuQtc.d.ts → index-BNzUUDVR.d.ts} +8 -6
- package/dist/index.d.ts +30 -27
- package/dist/index.js +3764 -1446
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +6 -6
- package/dist/infrastructure/index.js +67 -2
- package/dist/infrastructure/index.js.map +1 -1
- package/dist/kernel/index.d.ts +10 -9
- package/dist/kernel/index.js.map +1 -1
- package/dist/{mcp-servers-Cf4-bJnd.d.ts → mcp-servers-CLkhKdnF.d.ts} +18 -3
- package/dist/models/index.d.ts +2 -2
- package/dist/models/index.js +106 -0
- package/dist/models/index.js.map +1 -1
- package/dist/{multi-agent-D5m66hzB.d.ts → multi-agent-B1Nn9eC0.d.ts} +71 -16
- package/dist/observability/index.d.ts +2 -2
- package/dist/{path-resolver-Bg4OP5fi.d.ts → path-resolver-mPccVA0l.d.ts} +9 -2
- package/dist/{provider-runner-CU9gnU2E.d.ts → provider-runner-D7lHu07L.d.ts} +3 -3
- package/dist/{skill-DayhFUBb.d.ts → retry-policy-CnYVKGPv.d.ts} +2 -28
- package/dist/sdd/index.d.ts +419 -5
- package/dist/sdd/index.js +1580 -1
- package/dist/sdd/index.js.map +1 -1
- package/dist/{secret-scrubber-Dyh5LVYL.d.ts → secret-scrubber-BSgec8CU.d.ts} +1 -1
- package/dist/{secret-scrubber-DyUAWS09.d.ts → secret-scrubber-Buo9zLGs.d.ts} +1 -1
- package/dist/security/index.d.ts +8 -4
- package/dist/security/index.js +8 -0
- package/dist/security/index.js.map +1 -1
- package/dist/{selector-DBEiwXBk.d.ts → selector-B-CGOshv.d.ts} +1 -1
- package/dist/{session-reader-D-z0AgHs.d.ts → session-reader-DmOEmSkq.d.ts} +1 -1
- package/dist/skill-CxuWrsKK.d.ts +29 -0
- package/dist/skills/index.d.ts +136 -0
- package/dist/skills/index.js +478 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/storage/index.d.ts +5 -5
- package/dist/{system-prompt-DNetCecu.d.ts → system-prompt-CzY1zrbC.d.ts} +1 -1
- package/dist/{tool-executor-B5bgmEgE.d.ts → tool-executor-CYe5cp5U.d.ts} +4 -4
- package/dist/types/index.d.ts +16 -15
- package/dist/types/index.js +116 -0
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.d.ts +35 -2
- package/dist/utils/index.js +49 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +5 -1
- package/skills/sdd/SKILL.md +93 -6
- package/skills/skill-creator/SKILL.md +98 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { U as Usage, a0 as Context, y as ToolProgressEvent, u as Tool } from './context-
|
|
1
|
+
import { U as Usage, a0 as Context, y as ToolProgressEvent, u as Tool } from './context-P207fTpo.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* EventBus — observe-only typed event bus.
|
|
@@ -163,6 +163,33 @@ interface EventMap {
|
|
|
163
163
|
used: number;
|
|
164
164
|
limit: number;
|
|
165
165
|
};
|
|
166
|
+
/**
|
|
167
|
+
* Fired when the subagent budget hits a soft limit and the coordinator
|
|
168
|
+
* is being asked for an extension. The coordinator should call `extend()`
|
|
169
|
+
* to grant more budget, or the promise auto-resolves to `deny` after
|
|
170
|
+
* `timeoutMs` (default 30s), treating it as a hard stop.
|
|
171
|
+
*
|
|
172
|
+
* This event lets the CLI/TUI observe budget pressure in real time,
|
|
173
|
+
* surface extension requests to users, and give the coordinator a
|
|
174
|
+
* hook to implement custom extension policy without coupling to the
|
|
175
|
+
* runner/budget classes.
|
|
176
|
+
*/
|
|
177
|
+
'budget.threshold_reached': {
|
|
178
|
+
kind: 'iterations' | 'tool_calls' | 'tokens' | 'cost';
|
|
179
|
+
used: number;
|
|
180
|
+
limit: number;
|
|
181
|
+
/** Call to grant more of the same budget type. */
|
|
182
|
+
extend: (extra: Partial<{
|
|
183
|
+
maxIterations: number;
|
|
184
|
+
maxToolCalls: number;
|
|
185
|
+
maxTokens: number;
|
|
186
|
+
maxCostUsd: number;
|
|
187
|
+
}>) => void;
|
|
188
|
+
/** Call to deny the extension — subagent will stop. */
|
|
189
|
+
deny: () => void;
|
|
190
|
+
/** Auto-resolves to deny after timeout. */
|
|
191
|
+
timeoutMs: number;
|
|
192
|
+
};
|
|
166
193
|
'context.repaired': {
|
|
167
194
|
ctx: Context;
|
|
168
195
|
changed: boolean;
|
|
@@ -218,6 +245,19 @@ interface EventMap {
|
|
|
218
245
|
taskId: string;
|
|
219
246
|
description?: string;
|
|
220
247
|
};
|
|
248
|
+
/**
|
|
249
|
+
* Fired by `MultiAgentHost` when a subagent hits a soft budget limit
|
|
250
|
+
* and the coordinator is auto-extending. TUI renders this as a
|
|
251
|
+
* status-line notice: "⚡ agent#name hitting kind limit (used/limit) — extending".
|
|
252
|
+
* After the auto-extend the task either continues or the coordinator
|
|
253
|
+
* denies the extension and the task ends with 'budget_exhausted'.
|
|
254
|
+
*/
|
|
255
|
+
'subagent.budget_warning': {
|
|
256
|
+
subagentId: string;
|
|
257
|
+
kind: string;
|
|
258
|
+
used: number;
|
|
259
|
+
limit: number;
|
|
260
|
+
};
|
|
221
261
|
/**
|
|
222
262
|
* Per-tool-call event re-emitted from a subagent's own EventBus
|
|
223
263
|
* onto the host EventBus, so the TUI / non-director surfaces can
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, T as ToolExecutor } from '../tool-executor-
|
|
2
|
-
import { g as Provider, a0 as Context } from '../context-
|
|
3
|
-
import { a as Compactor, C as CompactReport } from '../compactor-
|
|
4
|
-
import { M as MessageSelector } from '../selector-
|
|
5
|
-
import { E as EventBus } from '../events-
|
|
6
|
-
import { c as MiddlewareHandler } from '../system-prompt-
|
|
7
|
-
import { e as ContextWindowAggressiveOn, i as ContextWindowPolicy } from '../config-
|
|
8
|
-
import { r as Agent, R as RunResult } from '../index-
|
|
9
|
-
import { D as DoneCondition } from '../multi-agent-
|
|
10
|
-
import { a as SkillLoader, b as SkillManifest, S as SkillEntry } from '../skill-
|
|
1
|
+
export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, T as ToolExecutor } from '../tool-executor-CYe5cp5U.js';
|
|
2
|
+
import { g as Provider, a0 as Context } from '../context-P207fTpo.js';
|
|
3
|
+
import { a as Compactor, C as CompactReport } from '../compactor-CTHjZAwf.js';
|
|
4
|
+
import { M as MessageSelector } from '../selector-B-CGOshv.js';
|
|
5
|
+
import { E as EventBus } from '../events-DYAbU84e.js';
|
|
6
|
+
import { c as MiddlewareHandler } from '../system-prompt-CzY1zrbC.js';
|
|
7
|
+
import { e as ContextWindowAggressiveOn, i as ContextWindowPolicy } from '../config-DO2eCKgq.js';
|
|
8
|
+
import { r as Agent, R as RunResult } from '../index-BNzUUDVR.js';
|
|
9
|
+
import { D as DoneCondition } from '../multi-agent-B1Nn9eC0.js';
|
|
10
|
+
import { a as SkillLoader, b as SkillManifest, S as SkillEntry } from '../skill-CxuWrsKK.js';
|
|
11
11
|
import { a as WstackPaths } from '../wstack-paths-BGu2INTm.js';
|
|
12
|
+
import '../retry-policy-CnYVKGPv.js';
|
|
12
13
|
import '../models-registry-Y2xbog0E.js';
|
|
13
14
|
import '../logger-BMQgxvdy.js';
|
|
14
15
|
import '../observability-BhnVLBLS.js';
|
|
15
|
-
import '../secret-scrubber-
|
|
16
|
+
import '../secret-scrubber-Buo9zLGs.js';
|
|
16
17
|
|
|
17
18
|
interface SkillLoaderOptions {
|
|
18
19
|
paths: WstackPaths;
|
|
@@ -33,6 +34,7 @@ declare class DefaultSkillLoader implements SkillLoader {
|
|
|
33
34
|
find(name: string): Promise<SkillManifest | undefined>;
|
|
34
35
|
manifestText(): Promise<string>;
|
|
35
36
|
listEntries(): Promise<SkillEntry[]>;
|
|
37
|
+
invalidateCache(): void;
|
|
36
38
|
readBody(name: string): Promise<string>;
|
|
37
39
|
}
|
|
38
40
|
|
|
@@ -187,11 +189,12 @@ interface AutoCompactionOptions {
|
|
|
187
189
|
declare class AutoCompactionMiddleware {
|
|
188
190
|
readonly name = "AutoCompaction";
|
|
189
191
|
private readonly compactor;
|
|
192
|
+
private readonly estimator;
|
|
190
193
|
private readonly warnThreshold;
|
|
191
194
|
private readonly softThreshold;
|
|
192
195
|
private readonly hardThreshold;
|
|
193
|
-
|
|
194
|
-
private
|
|
196
|
+
/** Writable so model-switch can update the denominator without re-registering the middleware. */
|
|
197
|
+
private _maxContext;
|
|
195
198
|
private readonly aggressiveOn;
|
|
196
199
|
private readonly events?;
|
|
197
200
|
private readonly failureMode;
|
|
@@ -212,6 +215,9 @@ declare class AutoCompactionMiddleware {
|
|
|
212
215
|
soft: number;
|
|
213
216
|
hard: number;
|
|
214
217
|
}, optsOrAggressiveOn?: AutoCompactionOptions | ContextWindowAggressiveOn, events?: EventBus);
|
|
218
|
+
/** Allow callers (e.g. model-switch in WebUI) to update the context window
|
|
219
|
+
* denominator when the active model changes. */
|
|
220
|
+
setMaxContext(maxContext: number): void;
|
|
215
221
|
handler(): MiddlewareHandler<Context>;
|
|
216
222
|
private compact;
|
|
217
223
|
}
|
package/dist/execution/index.js
CHANGED
|
@@ -926,11 +926,12 @@ function toWrongStackError(err, code = "AGENT_RUN_FAILED") {
|
|
|
926
926
|
var AutoCompactionMiddleware = class {
|
|
927
927
|
name = "AutoCompaction";
|
|
928
928
|
compactor;
|
|
929
|
+
estimator;
|
|
929
930
|
warnThreshold;
|
|
930
931
|
softThreshold;
|
|
931
932
|
hardThreshold;
|
|
932
|
-
|
|
933
|
-
|
|
933
|
+
/** Writable so model-switch can update the denominator without re-registering the middleware. */
|
|
934
|
+
_maxContext;
|
|
934
935
|
aggressiveOn;
|
|
935
936
|
events;
|
|
936
937
|
failureMode;
|
|
@@ -949,7 +950,7 @@ var AutoCompactionMiddleware = class {
|
|
|
949
950
|
constructor(compactor, maxContext, estimator, thresholds, optsOrAggressiveOn = {}, events) {
|
|
950
951
|
const opts = typeof optsOrAggressiveOn === "string" ? { aggressiveOn: optsOrAggressiveOn, events } : optsOrAggressiveOn;
|
|
951
952
|
this.compactor = compactor;
|
|
952
|
-
this.
|
|
953
|
+
this._maxContext = maxContext;
|
|
953
954
|
this.estimator = estimator;
|
|
954
955
|
this.warnThreshold = thresholds.warn;
|
|
955
956
|
this.softThreshold = thresholds.soft;
|
|
@@ -959,10 +960,15 @@ var AutoCompactionMiddleware = class {
|
|
|
959
960
|
this.failureMode = opts.failureMode ?? "throw_on_hard";
|
|
960
961
|
this.policyProvider = opts.policyProvider;
|
|
961
962
|
}
|
|
963
|
+
/** Allow callers (e.g. model-switch in WebUI) to update the context window
|
|
964
|
+
* denominator when the active model changes. */
|
|
965
|
+
setMaxContext(maxContext) {
|
|
966
|
+
this._maxContext = maxContext;
|
|
967
|
+
}
|
|
962
968
|
handler() {
|
|
963
969
|
return async (ctx, next) => {
|
|
964
970
|
const tokens = this.estimator(ctx);
|
|
965
|
-
const load = tokens / this.
|
|
971
|
+
const load = tokens / this._maxContext;
|
|
966
972
|
const policy = this.policyProvider?.(ctx);
|
|
967
973
|
const thresholds = policy?.thresholds ?? {
|
|
968
974
|
warn: this.warnThreshold,
|
|
@@ -991,7 +997,7 @@ var AutoCompactionMiddleware = class {
|
|
|
991
997
|
aggressive,
|
|
992
998
|
level: pressure.level,
|
|
993
999
|
tokens: pressure.tokens,
|
|
994
|
-
maxContext: this.
|
|
1000
|
+
maxContext: this._maxContext,
|
|
995
1001
|
load: pressure.load,
|
|
996
1002
|
fatal
|
|
997
1003
|
});
|
|
@@ -1003,7 +1009,7 @@ var AutoCompactionMiddleware = class {
|
|
|
1003
1009
|
context: {
|
|
1004
1010
|
level: pressure.level,
|
|
1005
1011
|
tokens: pressure.tokens,
|
|
1006
|
-
maxContext: this.
|
|
1012
|
+
maxContext: this._maxContext
|
|
1007
1013
|
},
|
|
1008
1014
|
cause: err
|
|
1009
1015
|
});
|
|
@@ -1765,6 +1771,9 @@ var DefaultSkillLoader = class {
|
|
|
1765
1771
|
}
|
|
1766
1772
|
return entries;
|
|
1767
1773
|
}
|
|
1774
|
+
invalidateCache() {
|
|
1775
|
+
this.cache = void 0;
|
|
1776
|
+
}
|
|
1768
1777
|
async readBody(name) {
|
|
1769
1778
|
const m = await this.find(name);
|
|
1770
1779
|
if (!m) throw new Error(`Skill "${name}" not found`);
|