@wrongstack/core 0.299.0 → 0.301.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/chronicle/index.d.ts +2 -0
- package/dist/chronicle/index.js +297 -10
- package/dist/chronicle/project-server.js +253 -15
- package/dist/chronicle/sqlite-compaction.d.ts +20 -0
- package/dist/chronicle/sqlite-journal.d.ts +57 -0
- package/dist/coordination/agents/capability-manifest.d.ts +7 -0
- package/dist/coordination/agents/index.d.ts +3 -2
- package/dist/coordination/agents/index.js +818 -570
- package/dist/coordination/agents/project-agent-identity.d.ts +6 -6
- package/dist/coordination/agents/role-skills.d.ts +1 -1
- package/dist/coordination/agents/types.d.ts +6 -0
- package/dist/coordination/director.d.ts +10 -2
- package/dist/coordination/fleet-manager.d.ts +48 -3
- package/dist/coordination/ifleet-manager.d.ts +2 -0
- package/dist/coordination/index.js +6880 -6440
- package/dist/coordination/mail-tools.d.ts +3 -3
- package/dist/coordination/mailbox-project-server.js +3 -4
- package/dist/coordination/mailbox-types.d.ts +6 -0
- package/dist/coordination/multi-agent-coordinator.d.ts +1 -0
- package/dist/core/agent-response.d.ts +5 -1
- package/dist/core/agent-tools.d.ts +3 -0
- package/dist/core/context.d.ts +20 -0
- package/dist/core/fallback-model.d.ts +48 -0
- package/dist/core/index.d.ts +11 -9
- package/dist/core/index.js +1119 -310
- package/dist/core/instruction-template.d.ts +83 -0
- package/dist/core/next-steps-slot.d.ts +88 -0
- package/dist/core/system-prompt-blocks.d.ts +10 -1
- package/dist/core/system-prompt-builder.d.ts +40 -4
- package/dist/core/system-prompt-memory-skills.d.ts +1 -0
- package/dist/core/system-prompt-skill-bodies.d.ts +3 -3
- package/dist/defaults/index.js +9805 -8767
- package/dist/design/index.js +11 -3
- package/dist/execution/auto-compaction-middleware.d.ts +17 -0
- package/dist/execution/autonomy-brain.d.ts +15 -2
- package/dist/execution/brain-runtime.d.ts +3 -1
- package/dist/execution/compaction-core.d.ts +41 -2
- package/dist/execution/council-brain.d.ts +47 -1
- package/dist/execution/council-orchestrator.d.ts +25 -6
- package/dist/execution/council-prompts.d.ts +12 -1
- package/dist/execution/index.d.ts +11 -10
- package/dist/execution/index.js +10507 -9189
- package/dist/execution/tool-executor.d.ts +4 -1
- package/dist/execution/topic-shift-advisor.d.ts +53 -0
- package/dist/extension/index.js +8 -2
- package/dist/extension/registry.d.ts +8 -1
- package/dist/fleet-notifier.d.ts +9 -2
- package/dist/goal/index.js +11 -3
- package/dist/hooks/index.js +50 -13
- package/dist/hooks/runner.d.ts +12 -1
- package/dist/hq/index.js +59 -21
- package/dist/hq/protocol/fleet.d.ts +20 -0
- package/dist/hq/protocol.js +10 -0
- package/dist/hq/publisher.d.ts +21 -3
- package/dist/index.d.ts +22 -20
- package/dist/index.js +12211 -8572
- package/dist/infrastructure/index.js +108 -21
- package/dist/kernel/events/brain-events.d.ts +9 -0
- package/dist/kernel/events/provider-events.d.ts +42 -1
- package/dist/kernel/events/session-events.d.ts +13 -0
- package/dist/kernel/events/tool-events.d.ts +3 -3
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.js +18 -1
- package/dist/models/provider-credentials.d.ts +54 -0
- package/dist/plugin/api.d.ts +6 -0
- package/dist/plugin/config.d.ts +55 -0
- package/dist/plugin/index.d.ts +2 -1
- package/dist/plugin/index.js +2179 -544
- package/dist/plugins/auto-review-plugin.d.ts +3 -0
- package/dist/plugins/cloud-config-sync-plugin.d.ts +22 -0
- package/dist/plugins/review-claim-registry.d.ts +23 -8
- package/dist/plugins/review-types.d.ts +2 -0
- package/dist/registry/index.js +109 -74
- package/dist/registry/tool-registry.d.ts +15 -0
- package/dist/security/capabilities.d.ts +2 -0
- package/dist/security/index.d.ts +2 -2
- package/dist/security/index.js +166 -44
- package/dist/security/permission-helpers.d.ts +23 -6
- package/dist/security/permission-policy.d.ts +16 -0
- package/dist/security/readonly-permission-policy.d.ts +20 -0
- package/dist/security/totp.d.ts +14 -0
- package/dist/session-registry-atomic-file.d.ts +32 -5
- package/dist/skills/frontmatter.d.ts +6 -0
- package/dist/skills/index.js +22 -5
- package/dist/storage/cloud-config-sync/sanitize.d.ts +54 -0
- package/dist/storage/cloud-config-sync.d.ts +87 -0
- package/dist/storage/director-state.d.ts +7 -0
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/index.js +887 -74
- package/dist/tools/fallback-system-config-view-tool.d.ts +1 -1
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.js +898 -335
- package/dist/tools/one-shot-llm-tool.d.ts +1 -0
- package/dist/tools/plugin-manager.d.ts +27 -0
- package/dist/types/config/mcp-features.d.ts +18 -11
- package/dist/types/config/root.d.ts +8 -1
- package/dist/types/config/runtime.d.ts +20 -6
- package/dist/types/config/skills-fleet-brain.d.ts +12 -4
- package/dist/types/config/tools.d.ts +16 -0
- package/dist/types/context-window.d.ts +1 -0
- package/dist/types/council.d.ts +11 -0
- package/dist/types/hooks.d.ts +14 -0
- package/dist/types/index.d.ts +3 -3
- package/dist/types/index.js +1 -0
- package/dist/types/multi-agent.d.ts +12 -0
- package/dist/types/one-shot-llm.d.ts +25 -0
- package/dist/types/plugin.d.ts +28 -0
- package/dist/types/provider.d.ts +16 -0
- package/dist/types/runtime-capability-manifest.d.ts +168 -0
- package/dist/types/skill.d.ts +5 -0
- package/dist/types/system-prompt.d.ts +3 -1
- package/dist/types/tool-executor.d.ts +8 -1
- package/dist/utils/context-breakdown.d.ts +8 -2
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +141 -31
- package/dist/utils/regex-guard.d.ts +16 -2
- package/dist/utils/sage-output-block.d.ts +7 -10
- package/dist/utils/wstack-paths.d.ts +11 -3
- package/dist/worktree/index.js +4 -4
- package/instructions/agents/browser.md +1 -4
- package/instructions/agents/e2e.md +17 -15
- package/instructions/agents/ios.md +3 -3
- package/instructions/agents/search.md +1 -1
- package/instructions/autonomy/goal-preamble.md +4 -4
- package/instructions/coordination/director-preamble.md +2 -3
- package/instructions/coordination/subagent-baseline.md +3 -1
- package/instructions/leader-after-task.md +12 -0
- package/instructions/llm/chimera-review.md +1 -1
- package/instructions/modes/audit-lite.md +1 -1
- package/instructions/sections/tool/common-patterns.md +18 -2
- package/instructions/sections/tool/mailbox-compact.md +1 -1
- package/instructions/sections/tool/mailbox-full.md +1 -1
- package/instructions/system-lite.md +91 -3
- package/instructions/system-pro.md +296 -102
- package/instructions/system.md +248 -92
- package/package.json +3 -3
- package/skills/api-design/SKILL.md +3 -0
- package/skills/audit-log/SKILL.md +2 -0
- package/skills/auto-review/SKILL.md +6 -1
- package/skills/bug-hunter/SKILL.md +4 -1
- package/skills/chimera/SKILL.md +3 -0
- package/skills/data-governance/SKILL.md +3 -0
- package/skills/design-system/SKILL.md +5 -2
- package/skills/docker-deploy/SKILL.md +2 -0
- package/skills/git-flow/SKILL.md +2 -0
- package/skills/mailbox-bridge/SKILL.md +3 -0
- package/skills/mnemosyne/SKILL.md +2 -0
- package/skills/multi-agent/SKILL.md +4 -1
- package/skills/node-modern/SKILL.md +4 -1
- package/skills/observability/SKILL.md +3 -0
- package/skills/output-standards/SKILL.md +2 -0
- package/skills/plugin-author/SKILL.md +4 -1
- package/skills/prompt-engineering/SKILL.md +3 -1
- package/skills/react-modern/SKILL.md +6 -3
- package/skills/refactor-planner/SKILL.md +2 -0
- package/skills/research-web/SKILL.md +3 -0
- package/skills/sdd/SKILL.md +3 -1
- package/skills/security-scanner/SKILL.md +3 -0
- package/skills/skill-creator/SKILL.md +2 -0
- package/skills/tech-stack/SKILL.md +3 -0
- package/skills/testing/SKILL.md +4 -1
- package/skills/typescript-strict/SKILL.md +4 -1
- package/skills/wrongstack-kanban/SKILL.md +6 -3
- package/skills/wrongstack-mailbox/SKILL.md +4 -1
- package/skills/wrongstack-mailbox-mcp/SKILL.md +10 -8
|
@@ -15,6 +15,8 @@ export interface AutoReviewConfig {
|
|
|
15
15
|
* omitted), and the remaining entries form the fallback chain.
|
|
16
16
|
*/
|
|
17
17
|
fallbackProfile?: string | undefined;
|
|
18
|
+
/** How each review chooses its starting model from the resolved profile pool. */
|
|
19
|
+
modelSelection?: 'round-robin' | 'random' | undefined;
|
|
18
20
|
/** Debounce window in ms — wait for quiet before firing review (default 15000). */
|
|
19
21
|
debounceMs?: number | undefined;
|
|
20
22
|
/** Max files per review batch (default 15). */
|
|
@@ -40,6 +42,7 @@ export interface ResolvedAutoReviewConfig {
|
|
|
40
42
|
provider: string;
|
|
41
43
|
model: string;
|
|
42
44
|
fallbackModels: string[];
|
|
45
|
+
modelSelection: 'round-robin' | 'random';
|
|
43
46
|
debounceMs: number;
|
|
44
47
|
maxFilesPerBatch: number;
|
|
45
48
|
maxConcurrentReviews: number;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ConfigStore } from '../types/config.js';
|
|
2
|
+
import type { Plugin } from '../types/plugin.js';
|
|
3
|
+
import type { SecretVault } from '../types/secret-vault.js';
|
|
4
|
+
import type { WstackPaths } from '../utils/wstack-paths.js';
|
|
5
|
+
interface CloudConfigSyncPluginOptions {
|
|
6
|
+
paths?: WstackPaths | undefined;
|
|
7
|
+
configStore?: ConfigStore | undefined;
|
|
8
|
+
vault?: SecretVault | undefined;
|
|
9
|
+
appVersion?: string | undefined;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* CloudConfigSyncPlugin — background config synchronization with my.wrongstack.com.
|
|
13
|
+
*
|
|
14
|
+
* Registers `/cloudsync` and, while enabled, runs a pull-then-push pass every
|
|
15
|
+
* `cloudSync.intervalSeconds` (default 300). Distinct from `wstack-sync` (the legacy
|
|
16
|
+
* GitHub category sync): this speaks the portal's namespaced, schema-validated,
|
|
17
|
+
* secret-free sync API v1 and never uploads credential material — the sanitizer in
|
|
18
|
+
* `storage/cloud-config-sync/sanitize.ts` is the client half of the server's contract.
|
|
19
|
+
*/
|
|
20
|
+
export declare function createCloudConfigSyncPlugin(opts?: CloudConfigSyncPluginOptions): Plugin;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=cloud-config-sync-plugin.d.ts.map
|
|
@@ -1,24 +1,39 @@
|
|
|
1
1
|
import type { EventBus } from '../kernel/events.js';
|
|
2
2
|
import type { PluginAPI } from '../types/plugin.js';
|
|
3
3
|
import type { ReviewContextBundle } from './review-types.js';
|
|
4
|
+
export interface ClaimStoreOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Override the shared claim-ledger directory. Defaults to `<cwd>/.wrongstack`
|
|
7
|
+
* (git-ignored, shared by every session on the same working tree). Tests
|
|
8
|
+
* inject a temp dir; two EventBuses sharing one dir dedupe like two hosts.
|
|
9
|
+
*/
|
|
10
|
+
storeDir?: string | undefined;
|
|
11
|
+
/** Claim lifetime in ms before it is treated as stale (default 30 min). */
|
|
12
|
+
ttlMs?: number | undefined;
|
|
13
|
+
/** Ledger compaction threshold in lines (default 10,000). Test override. */
|
|
14
|
+
maxLedgerLines?: number | undefined;
|
|
15
|
+
}
|
|
16
|
+
export declare function breakStaleLock(lockPath: string): Promise<boolean>;
|
|
4
17
|
/**
|
|
5
18
|
* Record review events emitted outside the automatic plugin paths, such as
|
|
6
19
|
* `/review`, so the post-session pass also avoids repeating those files.
|
|
7
20
|
*/
|
|
8
|
-
export declare function recordStartedReview(events: EventBus, payload: unknown): void
|
|
21
|
+
export declare function recordStartedReview(events: EventBus, payload: unknown, opts?: ClaimStoreOptions | undefined): Promise<void>;
|
|
9
22
|
/**
|
|
10
23
|
* Release the exact claims associated with a completed review bundle. Bundle
|
|
11
24
|
* identity prevents an older completion from removing newer in-flight claims.
|
|
12
25
|
*/
|
|
13
|
-
export declare function recordCompletedReview(events: EventBus, payload: unknown): void
|
|
26
|
+
export declare function recordCompletedReview(events: EventBus, payload: unknown): Promise<void>;
|
|
14
27
|
/**
|
|
15
28
|
* Atomically claim review inputs and emit only files whose exact content does
|
|
16
|
-
* not already have a review in progress
|
|
17
|
-
* claimed files and may be a
|
|
29
|
+
* not already have a review in progress — across every session sharing the
|
|
30
|
+
* working tree. The returned bundle contains only claimed files and may be a
|
|
31
|
+
* strict subset of the input.
|
|
18
32
|
*
|
|
19
|
-
* Claims are installed
|
|
20
|
-
* concurrent mid/post-session handlers
|
|
21
|
-
*
|
|
33
|
+
* Claims are installed in the shared ledger (under its exclusive lock) before
|
|
34
|
+
* the event emission, so concurrent mid/post-session handlers — in this
|
|
35
|
+
* process or another — cannot enqueue the same content twice. A synchronous
|
|
36
|
+
* emit failure rolls the claims back.
|
|
22
37
|
*/
|
|
23
|
-
export declare function emitReviewIfChanged(api: Pick<PluginAPI, 'events' | 'emitCustom'>, bundle: ReviewContextBundle): ReviewContextBundle | null
|
|
38
|
+
export declare function emitReviewIfChanged(api: Pick<PluginAPI, 'events' | 'emitCustom'>, bundle: ReviewContextBundle, opts?: ClaimStoreOptions | undefined): Promise<ReviewContextBundle | null>;
|
|
24
39
|
//# sourceMappingURL=review-claim-registry.d.ts.map
|
|
@@ -45,6 +45,8 @@ export interface ReviewContextBundle {
|
|
|
45
45
|
* Absent for ordinary Chimera and manual review triggers.
|
|
46
46
|
*/
|
|
47
47
|
reviewFallbackModels?: string[] | undefined;
|
|
48
|
+
/** Selection policy for the resolved auto-review profile pool. */
|
|
49
|
+
reviewModelSelection?: 'round-robin' | 'random' | undefined;
|
|
48
50
|
/**
|
|
49
51
|
* Cascade severity threshold from the auto-review plugin config.
|
|
50
52
|
* When the review subagent finds findings at or above this level, a
|
package/dist/registry/index.js
CHANGED
|
@@ -269,80 +269,6 @@ function formatContext(ctx) {
|
|
|
269
269
|
return parts.length > 0 ? `[${parts.join(" ")}]` : "";
|
|
270
270
|
}
|
|
271
271
|
|
|
272
|
-
// src/utils/tool-description-mode.ts
|
|
273
|
-
var ORIGINAL_TOOL_DESCRIPTION = /* @__PURE__ */ Symbol.for("wrongstack.tool.originalDescription");
|
|
274
|
-
function normalizeToolDescriptionMode(value) {
|
|
275
|
-
if (typeof value !== "string") return void 0;
|
|
276
|
-
const raw = value.trim().toLowerCase();
|
|
277
|
-
if (raw === "extend" || raw === "extended" || raw === "full") return "extend";
|
|
278
|
-
if (raw === "simple" || raw === "short" || raw === "brief") return "simple";
|
|
279
|
-
return void 0;
|
|
280
|
-
}
|
|
281
|
-
function simplifyToolDescription(text, opts = {}) {
|
|
282
|
-
const maxSentences = Math.max(1, opts.maxSentences ?? 2);
|
|
283
|
-
const maxChars = Math.max(40, opts.maxChars ?? 180);
|
|
284
|
-
const normalized = text.replace(/\r\n?/g, "\n").split("\n").map((line) => line.trim()).filter(Boolean).join(" ").replace(/\s+/g, " ").trim();
|
|
285
|
-
if (normalized.length <= maxChars) return normalized;
|
|
286
|
-
const sentences = normalized.match(/[^.!?]+[.!?]+(?=\s|$)|[^.!?]+$/g) ?? [normalized];
|
|
287
|
-
const selected = [];
|
|
288
|
-
for (const sentence of sentences) {
|
|
289
|
-
selected.push(sentence.trim());
|
|
290
|
-
const candidate = selected.join(" ");
|
|
291
|
-
if (selected.length >= maxSentences || candidate.length >= maxChars) break;
|
|
292
|
-
}
|
|
293
|
-
const summary = selected.join(" ").trim() || normalized;
|
|
294
|
-
if (summary.length <= maxChars) return summary;
|
|
295
|
-
const hardLimit = maxChars - 4;
|
|
296
|
-
const boundary = findWordBoundary(summary, hardLimit);
|
|
297
|
-
return `${summary.slice(0, boundary > 0 ? boundary : hardLimit).trimEnd()} ...`;
|
|
298
|
-
}
|
|
299
|
-
function applyToolDescriptionModeToTool(tool, mode) {
|
|
300
|
-
const existingOriginal = getOriginalDescription(tool);
|
|
301
|
-
if (mode === "extend" && !existingOriginal) return tool;
|
|
302
|
-
const original = existingOriginal ?? {
|
|
303
|
-
description: tool.description,
|
|
304
|
-
usageHint: tool.usageHint
|
|
305
|
-
};
|
|
306
|
-
const next = mode === "simple" ? withDescription(tool, {
|
|
307
|
-
description: simplifyToolDescription(original.description),
|
|
308
|
-
usageHint: original.usageHint === void 0 ? void 0 : simplifyToolDescription(original.usageHint)
|
|
309
|
-
}) : withDescription(tool, original);
|
|
310
|
-
return attachOriginalDescription(next, original);
|
|
311
|
-
}
|
|
312
|
-
function getOriginalDescription(tool) {
|
|
313
|
-
return tool[ORIGINAL_TOOL_DESCRIPTION];
|
|
314
|
-
}
|
|
315
|
-
function attachOriginalDescription(tool, original) {
|
|
316
|
-
Object.defineProperty(tool, ORIGINAL_TOOL_DESCRIPTION, {
|
|
317
|
-
configurable: true,
|
|
318
|
-
enumerable: false,
|
|
319
|
-
value: original,
|
|
320
|
-
writable: true
|
|
321
|
-
});
|
|
322
|
-
return tool;
|
|
323
|
-
}
|
|
324
|
-
function withDescription(tool, next) {
|
|
325
|
-
const copy = {
|
|
326
|
-
...tool,
|
|
327
|
-
description: next.description,
|
|
328
|
-
usageHint: next.usageHint
|
|
329
|
-
};
|
|
330
|
-
if (next.usageHint === void 0) {
|
|
331
|
-
delete copy.usageHint;
|
|
332
|
-
}
|
|
333
|
-
return copy;
|
|
334
|
-
}
|
|
335
|
-
function findWordBoundary(text, limit) {
|
|
336
|
-
const semantic = Math.max(
|
|
337
|
-
text.lastIndexOf(". ", limit),
|
|
338
|
-
text.lastIndexOf("; ", limit),
|
|
339
|
-
text.lastIndexOf(", ", limit)
|
|
340
|
-
);
|
|
341
|
-
if (semantic > 40) return semantic + 1;
|
|
342
|
-
const space = text.lastIndexOf(" ", limit);
|
|
343
|
-
return space > 40 ? space : limit;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
272
|
// src/utils/tool-wire-compact.ts
|
|
347
273
|
var TOOL_DESCRIPTION_MAX_CHARS = 400;
|
|
348
274
|
var SCHEMA_DESCRIPTION_MAX_CHARS = 120;
|
|
@@ -462,6 +388,80 @@ function estimateToolDefTokens(tool) {
|
|
|
462
388
|
return RoughTokenEstimate(tool.name) + RoughTokenEstimate(compact.description) + RoughTokenEstimate(JSON.stringify(compact.inputSchema));
|
|
463
389
|
}
|
|
464
390
|
|
|
391
|
+
// src/utils/tool-description-mode.ts
|
|
392
|
+
var ORIGINAL_TOOL_DESCRIPTION = /* @__PURE__ */ Symbol.for("wrongstack.tool.originalDescription");
|
|
393
|
+
function normalizeToolDescriptionMode(value) {
|
|
394
|
+
if (typeof value !== "string") return void 0;
|
|
395
|
+
const raw = value.trim().toLowerCase();
|
|
396
|
+
if (raw === "extend" || raw === "extended" || raw === "full") return "extend";
|
|
397
|
+
if (raw === "simple" || raw === "short" || raw === "brief") return "simple";
|
|
398
|
+
return void 0;
|
|
399
|
+
}
|
|
400
|
+
function simplifyToolDescription(text, opts = {}) {
|
|
401
|
+
const maxSentences = Math.max(1, opts.maxSentences ?? 2);
|
|
402
|
+
const maxChars = Math.max(40, opts.maxChars ?? 180);
|
|
403
|
+
const normalized = text.replace(/\r\n?/g, "\n").split("\n").map((line) => line.trim()).filter(Boolean).join(" ").replace(/\s+/g, " ").trim();
|
|
404
|
+
if (normalized.length <= maxChars) return normalized;
|
|
405
|
+
const sentences = normalized.match(/[^.!?]+[.!?]+(?=\s|$)|[^.!?]+$/g) ?? [normalized];
|
|
406
|
+
const selected = [];
|
|
407
|
+
for (const sentence of sentences) {
|
|
408
|
+
selected.push(sentence.trim());
|
|
409
|
+
const candidate = selected.join(" ");
|
|
410
|
+
if (selected.length >= maxSentences || candidate.length >= maxChars) break;
|
|
411
|
+
}
|
|
412
|
+
const summary = selected.join(" ").trim() || normalized;
|
|
413
|
+
if (summary.length <= maxChars) return summary;
|
|
414
|
+
const hardLimit = maxChars - 4;
|
|
415
|
+
const boundary = findWordBoundary(summary, hardLimit);
|
|
416
|
+
return `${summary.slice(0, boundary > 0 ? boundary : hardLimit).trimEnd()} ...`;
|
|
417
|
+
}
|
|
418
|
+
function applyToolDescriptionModeToTool(tool, mode) {
|
|
419
|
+
const existingOriginal = getOriginalDescription(tool);
|
|
420
|
+
if (mode === "extend" && !existingOriginal) return tool;
|
|
421
|
+
const original = existingOriginal ?? {
|
|
422
|
+
description: tool.description,
|
|
423
|
+
usageHint: tool.usageHint
|
|
424
|
+
};
|
|
425
|
+
const next = mode === "simple" ? withDescription(tool, {
|
|
426
|
+
description: simplifyToolDescription(original.description),
|
|
427
|
+
usageHint: original.usageHint === void 0 ? void 0 : simplifyToolDescription(original.usageHint)
|
|
428
|
+
}) : withDescription(tool, original);
|
|
429
|
+
return attachOriginalDescription(next, original);
|
|
430
|
+
}
|
|
431
|
+
function getOriginalDescription(tool) {
|
|
432
|
+
return tool[ORIGINAL_TOOL_DESCRIPTION];
|
|
433
|
+
}
|
|
434
|
+
function attachOriginalDescription(tool, original) {
|
|
435
|
+
Object.defineProperty(tool, ORIGINAL_TOOL_DESCRIPTION, {
|
|
436
|
+
configurable: true,
|
|
437
|
+
enumerable: false,
|
|
438
|
+
value: original,
|
|
439
|
+
writable: true
|
|
440
|
+
});
|
|
441
|
+
return tool;
|
|
442
|
+
}
|
|
443
|
+
function withDescription(tool, next) {
|
|
444
|
+
const copy = {
|
|
445
|
+
...tool,
|
|
446
|
+
description: next.description,
|
|
447
|
+
usageHint: next.usageHint
|
|
448
|
+
};
|
|
449
|
+
if (next.usageHint === void 0) {
|
|
450
|
+
delete copy.usageHint;
|
|
451
|
+
}
|
|
452
|
+
return copy;
|
|
453
|
+
}
|
|
454
|
+
function findWordBoundary(text, limit) {
|
|
455
|
+
const semantic = Math.max(
|
|
456
|
+
text.lastIndexOf(". ", limit),
|
|
457
|
+
text.lastIndexOf("; ", limit),
|
|
458
|
+
text.lastIndexOf(", ", limit)
|
|
459
|
+
);
|
|
460
|
+
if (semantic > 40) return semantic + 1;
|
|
461
|
+
const space = text.lastIndexOf(" ", limit);
|
|
462
|
+
return space > 40 ? space : limit;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
465
|
// src/registry/tool-registry.ts
|
|
466
466
|
var ToolRegistry = class _ToolRegistry {
|
|
467
467
|
tools = /* @__PURE__ */ new Map();
|
|
@@ -477,6 +477,15 @@ var ToolRegistry = class _ToolRegistry {
|
|
|
477
477
|
/** Cached `list()` result, frozen after build. Invalidated on _version change. */
|
|
478
478
|
_listSnapshot;
|
|
479
479
|
_listSnapshotVersion = -1;
|
|
480
|
+
/**
|
|
481
|
+
* Optional direct provider surface. `undefined` preserves the legacy
|
|
482
|
+
* behaviour (every enabled catalog tool is direct); when set, `list()` still
|
|
483
|
+
* exposes the complete executable catalog while `listForProvider()` returns
|
|
484
|
+
* only these names. This keeps lazy tools discoverable by tool_search/tool_use.
|
|
485
|
+
*/
|
|
486
|
+
_providerToolNames;
|
|
487
|
+
_providerListSnapshot;
|
|
488
|
+
_providerListSnapshotVersion = -1;
|
|
480
489
|
/** Pre-compute tool definition token estimate once at registration time. */
|
|
481
490
|
_stampDefTokens(tool) {
|
|
482
491
|
if (tool._estDefTokens === void 0) {
|
|
@@ -726,6 +735,30 @@ var ToolRegistry = class _ToolRegistry {
|
|
|
726
735
|
this._listSnapshotVersion = this._version;
|
|
727
736
|
return arr;
|
|
728
737
|
}
|
|
738
|
+
/** Replace the direct provider surface. Pass `undefined` to expose the catalog. */
|
|
739
|
+
setProviderToolNames(names) {
|
|
740
|
+
this._providerToolNames = names ? new Set(names) : void 0;
|
|
741
|
+
this._version++;
|
|
742
|
+
}
|
|
743
|
+
/** Add registered or future tool names to the direct provider surface. */
|
|
744
|
+
exposeToProvider(names) {
|
|
745
|
+
if (!this._providerToolNames) return;
|
|
746
|
+
for (const name of typeof names === "string" ? [names] : names) {
|
|
747
|
+
this._providerToolNames.add(name);
|
|
748
|
+
}
|
|
749
|
+
this._version++;
|
|
750
|
+
}
|
|
751
|
+
/** Tools serialized into provider requests and described by the system prompt. */
|
|
752
|
+
listForProvider() {
|
|
753
|
+
if (!this._providerToolNames) return this.list();
|
|
754
|
+
if (this._providerListSnapshot && this._version === this._providerListSnapshotVersion) {
|
|
755
|
+
return this._providerListSnapshot;
|
|
756
|
+
}
|
|
757
|
+
const arr = Array.from(this.tools.entries()).filter(([name]) => !this._disabled.has(name) && this._providerToolNames?.has(name) === true).map(([, entry]) => entry.tool);
|
|
758
|
+
this._providerListSnapshot = arr;
|
|
759
|
+
this._providerListSnapshotVersion = this._version;
|
|
760
|
+
return arr;
|
|
761
|
+
}
|
|
729
762
|
/**
|
|
730
763
|
* Group tools by their `category` field. Tools without a category
|
|
731
764
|
* are placed under the key `""` (empty string). Returns a Map of
|
|
@@ -752,6 +785,7 @@ var ToolRegistry = class _ToolRegistry {
|
|
|
752
785
|
this.tools.clear();
|
|
753
786
|
this.descriptionModes.clear();
|
|
754
787
|
this._disabled.clear();
|
|
788
|
+
this._providerToolNames = void 0;
|
|
755
789
|
this._version++;
|
|
756
790
|
}
|
|
757
791
|
/**
|
|
@@ -770,6 +804,7 @@ var ToolRegistry = class _ToolRegistry {
|
|
|
770
804
|
for (const name of this._disabled) {
|
|
771
805
|
copy._disabled.add(name);
|
|
772
806
|
}
|
|
807
|
+
copy._providerToolNames = this._providerToolNames ? new Set(this._providerToolNames) : void 0;
|
|
773
808
|
copy._version = this._version;
|
|
774
809
|
return copy;
|
|
775
810
|
}
|
|
@@ -36,6 +36,15 @@ export declare class ToolRegistry {
|
|
|
36
36
|
/** Cached `list()` result, frozen after build. Invalidated on _version change. */
|
|
37
37
|
private _listSnapshot;
|
|
38
38
|
private _listSnapshotVersion;
|
|
39
|
+
/**
|
|
40
|
+
* Optional direct provider surface. `undefined` preserves the legacy
|
|
41
|
+
* behaviour (every enabled catalog tool is direct); when set, `list()` still
|
|
42
|
+
* exposes the complete executable catalog while `listForProvider()` returns
|
|
43
|
+
* only these names. This keeps lazy tools discoverable by tool_search/tool_use.
|
|
44
|
+
*/
|
|
45
|
+
private _providerToolNames;
|
|
46
|
+
private _providerListSnapshot;
|
|
47
|
+
private _providerListSnapshotVersion;
|
|
39
48
|
/** Pre-compute tool definition token estimate once at registration time. */
|
|
40
49
|
private _stampDefTokens;
|
|
41
50
|
/** Apply the description mode transform and stamp token estimates. */
|
|
@@ -134,6 +143,12 @@ export declare class ToolRegistry {
|
|
|
134
143
|
owner: string;
|
|
135
144
|
}[];
|
|
136
145
|
list(): Tool[];
|
|
146
|
+
/** Replace the direct provider surface. Pass `undefined` to expose the catalog. */
|
|
147
|
+
setProviderToolNames(names: readonly string[] | undefined): void;
|
|
148
|
+
/** Add registered or future tool names to the direct provider surface. */
|
|
149
|
+
exposeToProvider(names: string | readonly string[]): void;
|
|
150
|
+
/** Tools serialized into provider requests and described by the system prompt. */
|
|
151
|
+
listForProvider(): Tool[];
|
|
137
152
|
/**
|
|
138
153
|
* Group tools by their `category` field. Tools without a category
|
|
139
154
|
* are placed under the key `""` (empty string). Returns a Map of
|
|
@@ -45,6 +45,8 @@ export declare const ToolCapabilities: {
|
|
|
45
45
|
readonly NET_OUTBOUND: 'net.outbound';
|
|
46
46
|
/** Can mutate in-memory session todos only. */
|
|
47
47
|
readonly SESSION_TODO: 'session.todo';
|
|
48
|
+
/** Can park after-task `<nextsteps>` suggestions for the current turn. */
|
|
49
|
+
readonly SESSION_NEXTSTEPS: 'session.nextsteps';
|
|
48
50
|
/** Can mutate in-memory session mode only. */
|
|
49
51
|
readonly SESSION_MODE: 'session.mode';
|
|
50
52
|
/** Can inspect registered tool metadata. */
|
package/dist/security/index.d.ts
CHANGED
|
@@ -8,9 +8,9 @@ export { restrictDirPermissions, restrictFilePermissions, SECRET_DIR_MODE, SECRE
|
|
|
8
8
|
export { evaluateToolKanbanBoundary, type ToolKanbanBoundaryEvaluation, } from './kanban-boundary.js';
|
|
9
9
|
export { AutoApprovePermissionPolicy, alwaysAllowUnavailableReason, DefaultPermissionPolicy, type PermissionPolicyOptions, } from './permission-policy.js';
|
|
10
10
|
export { TRUST_POLICY_JSON_SCHEMA, TRUST_POLICY_LIMITS, TRUST_POLICY_SCHEMA_VERSION, type TrustPolicyDiagnostic, type TrustPolicyDiagnosticCode, type TrustPolicyValidationResult, validateTrustPolicy, } from './permission-policy-schema.js';
|
|
11
|
-
export { ReadOnlyPermissionPolicy } from './readonly-permission-policy.js';
|
|
11
|
+
export { ReadOnlyPermissionPolicy, toolMutates } from './readonly-permission-policy.js';
|
|
12
12
|
export { DefaultSecretScrubber } from './secret-scrubber.js';
|
|
13
|
-
export { base32Decode, base32Encode, buildOtpAuthUri, generateRecoveryCodes, generateTotpSecret, generateTotp, hashRecoveryCode, verifyRecoveryCode, verifyTotp, } from './totp.js';
|
|
13
|
+
export { base32Decode, base32Encode, buildOtpAuthUri, generateRecoveryCodes, generateTotpSecret, generateTotp, hashRecoveryCode, verifyRecoveryCode, verifyTotp, verifyTotpCounter, } from './totp.js';
|
|
14
14
|
export { DefaultSecretVault, migratePlaintextSecrets, rewriteConfigEncrypted, rotateConfigKeys, type SecretVaultOptions, } from './secret-vault.js';
|
|
15
15
|
export type { CompatibilityTrustBoundaryOptions, TrustActor, TrustActorKind, TrustAllowDecision, TrustAttribute, TrustAuthContext, TrustAuthMethod, TrustBoundary, TrustBoundaryAuditEntry, TrustBoundaryDecision, TrustBoundaryRequest, TrustConfirmDecision, TrustDecodeIssue, TrustDecodeResult, TrustDenyDecision, TrustRisk, TrustScope, TrustScopedTokenDecision, TrustSubject, TrustSurface, } from './trust-boundary.js';
|
|
16
16
|
export { createCompatibilityTrustBoundary, decodeTrustBoundaryDecision, decodeTrustBoundaryRequest, isTrustDecisionAllowed, TRUST_BOUNDARY_VERSION, } from './trust-boundary.js';
|