@wrongstack/core 0.305.1 → 0.306.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.
Files changed (60) hide show
  1. package/dist/chronicle/index.js +6 -1
  2. package/dist/chronicle/project-server.js +13 -3
  3. package/dist/coordination/agents/index.js +3 -2
  4. package/dist/coordination/agents/types.d.ts +1 -1
  5. package/dist/coordination/index.d.ts +1 -0
  6. package/dist/coordination/index.js +165 -59
  7. package/dist/coordination/mailbox-codecs.d.ts +29 -10
  8. package/dist/coordination/mailbox-constants.d.ts +30 -16
  9. package/dist/coordination/mailbox-health.d.ts +16 -0
  10. package/dist/coordination/mailbox-http-validation.d.ts +2 -1
  11. package/dist/coordination/mailbox-parse-state.d.ts +28 -10
  12. package/dist/coordination/mailbox-project-server.js +98 -4
  13. package/dist/coordination/mailbox-types.d.ts +44 -6
  14. package/dist/coordination/package-outdated-watcher.d.ts +15 -1
  15. package/dist/coordination/sqlite-mailbox-credentials.d.ts +26 -0
  16. package/dist/coordination/sqlite-mailbox.d.ts +25 -0
  17. package/dist/coordination/techstack-mailbox-consumer.d.ts +17 -0
  18. package/dist/core/index.d.ts +2 -1
  19. package/dist/core/index.js +2793 -2634
  20. package/dist/core/system-prompt-blocks.d.ts +1 -1
  21. package/dist/core/system-prompt-builder.d.ts +7 -1
  22. package/dist/core/system-prompt-glossary.d.ts +0 -23
  23. package/dist/defaults/index.js +9 -41
  24. package/dist/execution/index.js +9 -3
  25. package/dist/hq/index.js +6 -39
  26. package/dist/index.d.ts +1 -1
  27. package/dist/index.js +1053 -626
  28. package/dist/infrastructure/index.js +6 -39
  29. package/dist/observability/index.js +7 -3
  30. package/dist/plugin/index.d.ts +4 -3
  31. package/dist/plugin/index.js +595 -145
  32. package/dist/plugins/auto-review-plugin.d.ts +14 -7
  33. package/dist/plugins/chimera-plugin.d.ts +15 -1
  34. package/dist/plugins/review-finding-integration.d.ts +15 -3
  35. package/dist/plugins/review-finding-parser.d.ts +36 -0
  36. package/dist/plugins/review-finding-types.d.ts +46 -0
  37. package/dist/plugins/review-finding-verification.d.ts +53 -0
  38. package/dist/plugins/review-report-integration.d.ts +1 -0
  39. package/dist/plugins/review-report-store.d.ts +7 -0
  40. package/dist/plugins/review-report-types.d.ts +14 -0
  41. package/dist/plugins/review-types.d.ts +74 -0
  42. package/dist/replay/replay-provider-runner.d.ts +5 -4
  43. package/dist/security/file-permissions.d.ts +12 -35
  44. package/dist/security/index.js +6 -50
  45. package/dist/session-catalog/project-server.js +6 -39
  46. package/dist/storage/index.js +6 -1
  47. package/dist/tools/fallback-manage-tool-options.d.ts +9 -0
  48. package/dist/tools/index.js +91 -38
  49. package/dist/tools/one-shot-llm-tool.d.ts +6 -0
  50. package/dist/types/blocks.d.ts +10 -0
  51. package/dist/utils/index.d.ts +1 -0
  52. package/dist/utils/index.js +30 -9
  53. package/dist/utils/memory-evidence-fence.d.ts +47 -0
  54. package/instructions/agents/browser.md +1 -0
  55. package/instructions/agents/e2e.md +2 -0
  56. package/instructions/llm/chimera-review.md +52 -1
  57. package/instructions/system-lite.md +17 -6
  58. package/instructions/system-pro.md +25 -20
  59. package/instructions/system.md +25 -12
  60. package/package.json +3 -3
@@ -18,7 +18,7 @@ import { type InstructionTemplateContext } from './instruction-template.js';
18
18
  * `getContextBreakdown()` to attribute real token counts per category in the
19
19
  * `/context` display.
20
20
  */
21
- export type SystemBlockSource = 'identity' | 'tool-usage' | 'environment' | 'skills' | 'mode' | 'plan' | 'leader-after-task' | 'contributor' | 'ledger' | 'glossary' | 'nextsteps';
21
+ export type SystemBlockSource = 'identity' | 'tool-usage' | 'environment' | 'skills' | 'mode' | 'plan' | 'leader-after-task' | 'contributor' | 'ledger' | 'glossary' | 'peers' | 'nextsteps';
22
22
  /**
23
23
  * Side-table mapping each system-prompt TextBlock to the section it came from.
24
24
  * Kept as a WeakMap rather than a field on TextBlock so the label never reaches
@@ -147,7 +147,13 @@ export declare class DefaultSystemPromptBuilder implements SystemPromptBuilder {
147
147
  private _lastCatalogTools?;
148
148
  /** Cached rendered online agents string, keyed by content fingerprint. */
149
149
  private _lastOnlineAgents?;
150
- /** Cached full buildToolUsage output — keyed by tools array ref + agents fingerprint + tier. */
150
+ /**
151
+ * Cached full buildToolUsage output — keyed by tools array ref + tier.
152
+ * Deliberately NOT keyed by the online-agents fingerprint: the live peer
153
+ * snapshot moved out of this layer into the `peers` volatile block, so
154
+ * layer2 stays byte-stable (and provider-cache-friendly) while agents
155
+ * join, leave, or change status.
156
+ */
151
157
  private _toolsUsageCache?;
152
158
  private _instructionBundle?;
153
159
  /**
@@ -32,12 +32,6 @@ export interface DomainGlossaryOptions {
32
32
  /** Max chars per bullet line (after the **Term** header). Default 80. */
33
33
  maxEntryChars?: number | undefined;
34
34
  }
35
- export interface DomainGlossary {
36
- /** The extractor port shape we depend on. */
37
- readonly memory: MemoryStore;
38
- /** Render the block, or `null` when no glossary entries exist. */
39
- readonly formatGlossaryBlock: () => Promise<string | null>;
40
- }
41
35
  /**
42
36
  * Build the minimal `[Project Jargon Dictionary]` block.
43
37
  *
@@ -53,21 +47,4 @@ export interface DomainGlossary {
53
47
  * parity (`domain-term`).
54
48
  */
55
49
  export declare function renderDomainGlossary(ctx: BuildContext, memory: MemoryStore | undefined, options?: DomainGlossaryOptions): Promise<string | null>;
56
- /**
57
- * Wire a glossary block into a `DefaultSystemPromptBuilder` via the
58
- * existing `contributors` channel (see `system-prompt-contributor.ts`).
59
- *
60
- * Use from the host (CLI/TUI/WebUI) like this:
61
- *
62
- * const builder = new DefaultSystemPromptBuilder({
63
- * ...other opts,
64
- * contributors: [
65
- * ...DefaultSystemPromptBuilder.defaultContributors({ projectRoot }),
66
- * makeDomainGlossaryContributor({ memory: sagePort }),
67
- * ],
68
- * });
69
- *
70
- * The contributor returns `[]` for non-SAGE stores so the prompt stays clean.
71
- */
72
- export declare function makeDomainGlossaryContributor(glossary: DomainGlossary): (ctx: BuildContext) => Promise<import('../types/blocks.js').TextBlock[]>;
73
50
  //# sourceMappingURL=system-prompt-glossary.d.ts.map
@@ -2693,6 +2693,7 @@ var TOOLS = {
2693
2693
  "glob",
2694
2694
  "search",
2695
2695
  "tree",
2696
+ "diff",
2696
2697
  "write",
2697
2698
  "edit",
2698
2699
  "replace",
@@ -3724,7 +3725,7 @@ var VERIFY_AGENTS = [
3724
3725
  id: "e2e",
3725
3726
  name: "E2E",
3726
3727
  role: "e2e",
3727
- tools: [...TOOLS.build, "fetch", ...SPECIALIST_TOOLS.browser],
3728
+ tools: [...TOOLS.build, "fetch", "e2e_plan", ...SPECIALIST_TOOLS.browser],
3728
3729
  prompt: agentPrompt("e2e")
3729
3730
  },
3730
3731
  budget: HEAVY_BUDGET,
@@ -4237,7 +4238,7 @@ var DOMAIN_AGENTS = [
4237
4238
  id: "designer",
4238
4239
  name: "Designer",
4239
4240
  role: "designer",
4240
- tools: [...TOOLS.docs],
4241
+ tools: [...TOOLS.docs, "design"],
4241
4242
  prompt: agentPrompt("designer")
4242
4243
  },
4243
4244
  budget: MEDIUM_BUDGET,
@@ -9819,45 +9820,12 @@ import * as fsp17 from "node:fs/promises";
9819
9820
  import * as path23 from "node:path";
9820
9821
 
9821
9822
  // src/security/file-permissions.ts
9822
- import { chmod } from "node:fs/promises";
9823
- var SECRET_FILE_MODE = 384;
9824
- async function restrictFilePermissions(filePath, opts) {
9825
- const label = opts?.label ?? "file-permissions";
9826
- const warn = opts?.warn ?? ((msg) => console.warn(msg));
9827
- if (process.platform === "win32") {
9828
- try {
9829
- const { execFile: execFile2 } = await import("node:child_process");
9830
- const { promisify: promisify2 } = await import("node:util");
9831
- const execFileAsync = promisify2(execFile2);
9832
- const user = windowsAccountName();
9833
- if (!user) {
9834
- warn(
9835
- `[${label}] Could not determine the current Windows user for ${filePath}; skipping icacls hardening.`
9836
- );
9837
- return;
9838
- }
9839
- await execFileAsync("icacls", [filePath, "/inheritance:r", "/grant:r", `${user}:(F)`], {
9840
- windowsHide: true
9841
- });
9842
- } catch {
9843
- warn(
9844
- `[${label}] Could not restrict permissions on ${filePath} \u2014 it may be readable by other users on this system.`
9845
- );
9846
- }
9847
- } else {
9848
- try {
9849
- await chmod(filePath, SECRET_FILE_MODE);
9850
- } catch {
9851
- }
9852
- }
9853
- }
9854
- function windowsAccountName() {
9855
- const username = process.env.USERNAME || process.env.USER;
9856
- if (!username || username.includes("\0")) return void 0;
9857
- const domain = process.env.USERDOMAIN;
9858
- if (domain && !domain.includes("\0")) return `${domain}\\${username}`;
9859
- return username;
9860
- }
9823
+ import {
9824
+ restrictDirPermissions,
9825
+ restrictFilePermissions,
9826
+ SECRET_DIR_MODE,
9827
+ SECRET_FILE_MODE
9828
+ } from "@wrongstack/persistence";
9861
9829
 
9862
9830
  // src/security/secret-scrubber.ts
9863
9831
  var PATTERNS = [
@@ -7270,7 +7270,12 @@ import { dirname as dirname3 } from "node:path";
7270
7270
  import { createInterface } from "node:readline";
7271
7271
 
7272
7272
  // src/security/file-permissions.ts
7273
- var SECRET_FILE_MODE = 384;
7273
+ import {
7274
+ restrictDirPermissions,
7275
+ restrictFilePermissions,
7276
+ SECRET_DIR_MODE,
7277
+ SECRET_FILE_MODE
7278
+ } from "@wrongstack/persistence";
7274
7279
 
7275
7280
  // src/coordination/brain-ledger.ts
7276
7281
  var QUESTION_MAX = 200;
@@ -14031,6 +14036,7 @@ var TOOLS = {
14031
14036
  "glob",
14032
14037
  "search",
14033
14038
  "tree",
14039
+ "diff",
14034
14040
  "write",
14035
14041
  "edit",
14036
14042
  "replace",
@@ -15062,7 +15068,7 @@ var VERIFY_AGENTS = [
15062
15068
  id: "e2e",
15063
15069
  name: "E2E",
15064
15070
  role: "e2e",
15065
- tools: [...TOOLS.build, "fetch", ...SPECIALIST_TOOLS.browser],
15071
+ tools: [...TOOLS.build, "fetch", "e2e_plan", ...SPECIALIST_TOOLS.browser],
15066
15072
  prompt: agentPrompt("e2e")
15067
15073
  },
15068
15074
  budget: HEAVY_BUDGET,
@@ -15575,7 +15581,7 @@ var DOMAIN_AGENTS = [
15575
15581
  id: "designer",
15576
15582
  name: "Designer",
15577
15583
  role: "designer",
15578
- tools: [...TOOLS.docs],
15584
+ tools: [...TOOLS.docs, "design"],
15579
15585
  prompt: agentPrompt("designer")
15580
15586
  },
15581
15587
  budget: MEDIUM_BUDGET,
package/dist/hq/index.js CHANGED
@@ -2050,45 +2050,12 @@ import * as fs3 from "node:fs/promises";
2050
2050
  import * as path4 from "node:path";
2051
2051
 
2052
2052
  // src/security/file-permissions.ts
2053
- import { chmod } from "node:fs/promises";
2054
- var SECRET_FILE_MODE = 384;
2055
- async function restrictFilePermissions(filePath, opts) {
2056
- const label = opts?.label ?? "file-permissions";
2057
- const warn = opts?.warn ?? ((msg) => console.warn(msg));
2058
- if (process.platform === "win32") {
2059
- try {
2060
- const { execFile } = await import("node:child_process");
2061
- const { promisify } = await import("node:util");
2062
- const execFileAsync = promisify(execFile);
2063
- const user = windowsAccountName();
2064
- if (!user) {
2065
- warn(
2066
- `[${label}] Could not determine the current Windows user for ${filePath}; skipping icacls hardening.`
2067
- );
2068
- return;
2069
- }
2070
- await execFileAsync("icacls", [filePath, "/inheritance:r", "/grant:r", `${user}:(F)`], {
2071
- windowsHide: true
2072
- });
2073
- } catch {
2074
- warn(
2075
- `[${label}] Could not restrict permissions on ${filePath} \u2014 it may be readable by other users on this system.`
2076
- );
2077
- }
2078
- } else {
2079
- try {
2080
- await chmod(filePath, SECRET_FILE_MODE);
2081
- } catch {
2082
- }
2083
- }
2084
- }
2085
- function windowsAccountName() {
2086
- const username = process.env.USERNAME || process.env.USER;
2087
- if (!username || username.includes("\0")) return void 0;
2088
- const domain = process.env.USERDOMAIN;
2089
- if (domain && !domain.includes("\0")) return `${domain}\\${username}`;
2090
- return username;
2091
- }
2053
+ import {
2054
+ restrictDirPermissions,
2055
+ restrictFilePermissions,
2056
+ SECRET_DIR_MODE,
2057
+ SECRET_FILE_MODE
2058
+ } from "@wrongstack/persistence";
2092
2059
 
2093
2060
  // src/utils/pid.ts
2094
2061
  function isPidAlive(pid) {
package/dist/index.d.ts CHANGED
@@ -60,7 +60,7 @@ export { runProviderWithRetry } from './core/provider-runner.js';
60
60
  export { buildQueuedMessagesBlock, consumeQueuedMessagesUpdate, peekQueuedMessages, setQueuedMessagesSnapshot, } from './core/queued-messages.js';
61
61
  export { extractRunEnv, type RunEnv } from './core/run-env.js';
62
62
  export { DefaultSystemPromptBuilder, type DefaultSystemPromptBuilderOptions, LAYER_1_IDENTITY, SYSTEM_BLOCK_SOURCE, type SystemBlockSource, } from './core/system-prompt-builder.js';
63
- export { type DomainGlossary, type DomainGlossaryOptions, makeDomainGlossaryContributor, renderDomainGlossary, } from './core/system-prompt-glossary.js';
63
+ export { type DomainGlossaryOptions, renderDomainGlossary, } from './core/system-prompt-glossary.js';
64
64
  export * from './defaults/index.js';
65
65
  export { AutoCompactionMiddleware, type CompactorOptions, type CompactorStrategy, createStrategyCompactor, HybridCompactor, IntelligentCompactor, type IntelligentCompactorOptions, installSubagentAutoCompaction, SelectiveCompactor, type SelectiveCompactorOptions, type StrategyCompactorOptions, } from './defaults/index.js';
66
66
  export { type AutonomyBrainOptions, type BrainAutoRisk, type BrainLlmTarget, buildBrainUserMessage, completeBrainLlm, createAutonomyBrain, createTieredBrainArbiter, formatDecisionSummary, parseOptionDecision, type TieredBrainArbiterOptions, } from './execution/autonomy-brain.js';