@wrongstack/core 0.306.4 → 0.307.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.js +957 -953
- package/dist/chronicle/metrics-ingest.d.ts +55 -0
- package/dist/chronicle/metrics-schema.d.ts +86 -0
- package/dist/chronicle/metrics-store.d.ts +5 -120
- package/dist/chronicle/project-server.js +1083 -1084
- package/dist/chronicle/sqlite-journal-quota.d.ts +39 -0
- package/dist/chronicle/sqlite-journal-schema.d.ts +25 -0
- package/dist/chronicle/sqlite-journal.d.ts +12 -177
- package/dist/coordination/agents/index.js +1738 -1690
- package/dist/coordination/agents/project-agent-capture.d.ts +48 -0
- package/dist/coordination/agents/project-agent-identity.d.ts +3 -129
- package/dist/coordination/agents/project-agent-roster.d.ts +17 -0
- package/dist/coordination/index.js +6011 -5894
- package/dist/coordination/mail-tools.d.ts +1 -1
- package/dist/coordination/mailbox-http-actor-query.d.ts +16 -0
- package/dist/coordination/mailbox-http-router.d.ts +0 -48
- package/dist/coordination/mailbox-http-sse.d.ts +12 -0
- package/dist/coordination/mailbox-message-types.d.ts +71 -0
- package/dist/coordination/mailbox-predicates.d.ts +13 -0
- package/dist/coordination/mailbox-project-server.js +1 -1
- package/dist/coordination/mailbox-session-sync.d.ts +8 -0
- package/dist/coordination/mailbox-types.d.ts +6 -793
- package/dist/core/agent-loop-context.d.ts +28 -0
- package/dist/core/agent-loop-detector.d.ts +25 -0
- package/dist/core/fallback-doctor.d.ts +72 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1159 -888
- package/dist/defaults/index.js +3579 -3545
- package/dist/execution/autonomy-brain-llm.d.ts +55 -0
- package/dist/execution/autonomy-brain.d.ts +3 -156
- package/dist/execution/compaction-budget.d.ts +38 -0
- package/dist/execution/compaction-core.d.ts +3 -170
- package/dist/execution/compaction-elision.d.ts +58 -0
- package/dist/execution/council-orchestrator-helpers.d.ts +39 -0
- package/dist/execution/council-orchestrator.d.ts +3 -42
- package/dist/execution/council-response-parser.d.ts +56 -0
- package/dist/execution/index.js +2415 -2443
- package/dist/execution/prompt-enhancer.js +11 -3
- package/dist/execution/tool-executor-guard.d.ts +18 -0
- package/dist/execution/tool-executor-runner.d.ts +12 -0
- package/dist/execution/tool-executor.d.ts +0 -75
- package/dist/goal/index.js +19 -6
- package/dist/hq/index.js +8 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +7813 -7292
- package/dist/infrastructure/index.js +3 -1
- package/dist/kernel/events/agent-events.d.ts +2 -0
- package/dist/kernel/events/provider-events.d.ts +13 -0
- package/dist/plugin/index.js +2590 -2561
- package/dist/plugins/auto-review-config.d.ts +53 -0
- package/dist/plugins/auto-review-git.d.ts +19 -0
- package/dist/plugins/auto-review-plugin.d.ts +2 -140
- package/dist/plugins/review-finding-verification.d.ts +7 -0
- package/dist/prompts/index.d.ts +1 -0
- package/dist/prompts/prompt-journal.d.ts +94 -0
- package/dist/security/index.js +627 -652
- package/dist/security/permission-explain.d.ts +19 -0
- package/dist/security/permission-policy.d.ts +0 -101
- package/dist/security/yolo-risk.d.ts +5 -4
- package/dist/session-catalog/index.js +220 -212
- package/dist/session-catalog/project-server.js +227 -219
- package/dist/session-catalog/store-rebuild.d.ts +9 -0
- package/dist/session-catalog/store-schema.d.ts +48 -0
- package/dist/session-catalog/store.d.ts +0 -17
- package/dist/storage/director-state.d.ts +6 -0
- package/dist/storage/file-session-writer.d.ts +2 -58
- package/dist/storage/index.d.ts +2 -1
- package/dist/storage/index.js +2057 -1925
- package/dist/storage/orphan-lock-cleaner.d.ts +15 -0
- package/dist/storage/session-recovery.d.ts +9 -0
- package/dist/storage/session-store/rename-session.d.ts +16 -0
- package/dist/storage/session-store/resume-session.d.ts +26 -0
- package/dist/storage/session-store/session-store-clear.d.ts +11 -0
- package/dist/storage/session-store/session-store-index.d.ts +13 -0
- package/dist/storage/session-store.d.ts +1 -129
- package/dist/storage/session-summary-tracker.d.ts +39 -0
- package/dist/storage/session-write-buffer.d.ts +43 -0
- package/dist/storage/session-writer/session-writer-flush.d.ts +4 -0
- package/dist/storage/session-writer/session-writer-summary-tracker.d.ts +28 -0
- package/dist/tools/fallback-agent-model-assign-tool.d.ts +18 -0
- package/dist/tools/fallback-leader-model-set-tool.d.ts +18 -0
- package/dist/tools/fallback-manage-tools.d.ts +8 -45
- package/dist/tools/fallback-profile-manage-tool.d.ts +16 -0
- package/dist/tools/fallback-provider-key-set-tool.d.ts +17 -0
- package/dist/tools/fallback-provider-manage-tool.d.ts +26 -0
- package/dist/tools/index.js +5070 -5071
- package/dist/types/config/root.d.ts +7 -2
- package/dist/types/default-config.d.ts +1 -1
- package/dist/types/index.d.ts +54 -55
- package/dist/types/index.js +953 -932
- package/dist/types/runtime-capability-manifest.d.ts +5 -5
- package/dist/types/session-markers.d.ts +12 -0
- package/dist/types/session-markers.js +19 -0
- package/dist/worktree/worktree-manager.d.ts +1 -1
- package/instructions/coordination/subagent-baseline.md +2 -2
- package/instructions/llm/prompt-enhancer.md +2 -1
- package/instructions/sections/tool/common-patterns.md +21 -0
- package/instructions/sections/tool/delegation-compact.md +3 -1
- package/instructions/sections/tool/delegation-full.md +5 -1
- package/instructions/system-lite.md +28 -3
- package/instructions/system-pro.md +37 -8
- package/instructions/system.md +4 -2
- package/package.json +5 -5
|
@@ -75,12 +75,12 @@ export declare function makeMailSendTool(opts?: MailToolsOptions): {
|
|
|
75
75
|
required: string[];
|
|
76
76
|
};
|
|
77
77
|
execute(input: unknown, ctx: Context): Promise<{
|
|
78
|
-
summary?: never;
|
|
79
78
|
ok: boolean;
|
|
80
79
|
error: string;
|
|
81
80
|
messageId?: never;
|
|
82
81
|
from?: never;
|
|
83
82
|
to?: never;
|
|
83
|
+
summary?: never;
|
|
84
84
|
} | {
|
|
85
85
|
error?: never;
|
|
86
86
|
ok: boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type MailboxCheckInput } from './mailbox-http-validation.js';
|
|
2
|
+
import type { ActorMailboxMessage, Mailbox, MailboxActorContext, MailboxCapability, MailboxMessage, MailboxMessageType } from './mailbox-types.js';
|
|
3
|
+
export declare function stripAggregateReceiptState(message: MailboxMessage, actorId: string): ActorMailboxMessage;
|
|
4
|
+
export declare function eligibleRecipientsForActor(actor: MailboxActorContext): string[];
|
|
5
|
+
export declare function queryMessagesForActor(mailbox: Mailbox, actor: MailboxActorContext, query: Parameters<Mailbox['query']>[0]): Promise<MailboxMessage[]>;
|
|
6
|
+
export declare function visibleMessageIdsForActor(mailbox: Mailbox, actor: MailboxActorContext, messageIds: readonly string[]): Promise<Set<string>>;
|
|
7
|
+
export declare function unreadCountForActor(mailbox: Mailbox, actor: MailboxActorContext): Promise<number>;
|
|
8
|
+
export declare function isMessageCompletedForActor(message: MailboxMessage, actorId: string): boolean;
|
|
9
|
+
export declare function isMessageVisibleToActor(mailbox: Mailbox, messageId: string, actor: MailboxActorContext): Promise<boolean>;
|
|
10
|
+
export declare function requiredSendCapability(type: MailboxMessageType): MailboxCapability | undefined;
|
|
11
|
+
export declare function requiredCredentialCapability(method: string, path: string): MailboxCapability | undefined;
|
|
12
|
+
export declare function checkMailbox(mailbox: Mailbox, input: MailboxCheckInput, minTimestampIso: string | undefined, includeReceiptState?: boolean, eligibleRecipients?: readonly string[], readerRole?: string): Promise<{
|
|
13
|
+
data: MailboxMessage[];
|
|
14
|
+
count: number;
|
|
15
|
+
}>;
|
|
16
|
+
//# sourceMappingURL=mailbox-http-actor-query.d.ts.map
|
|
@@ -14,63 +14,15 @@ export interface MailboxHttpRouterOptions {
|
|
|
14
14
|
mailbox: Mailbox;
|
|
15
15
|
eventEmitter?: MailboxEventEmitter;
|
|
16
16
|
authorize?: (request: IncomingMessage) => MailboxHttpAccessDecision | Promise<MailboxHttpAccessDecision>;
|
|
17
|
-
/** Identity-scoped credential store for principal-based auth (GM-P0.6). */
|
|
18
17
|
credentialStore?: MailboxCredentialVerifier;
|
|
19
|
-
/** Project ID for credential-based auth project-scoping (GM-P0.9). */
|
|
20
18
|
projectId?: string;
|
|
21
19
|
rateLimiter?: MailboxHttpRateLimiter;
|
|
22
20
|
maxBodyBytes?: number;
|
|
23
|
-
/**
|
|
24
|
-
* Server-default look-back window for mailbox routes that return
|
|
25
|
-
* `MailboxMessage` records (`/mailbox/query`, `/mailbox/check`,
|
|
26
|
-
* `/mailbox/events`).
|
|
27
|
-
*
|
|
28
|
-
* The filter is **opt-in**: leaving `defaultMaxAgeMs` `undefined`
|
|
29
|
-
* (the default) leaves the filter disabled and every retained
|
|
30
|
-
* message is eligible to be returned or streamed. Pass an explicit
|
|
31
|
-
* non-negative integer (e.g. `60 * 60_000` for a 1-hour look-back,
|
|
32
|
-
* or {@link MAILBOX_HTTP_DEFAULT_MAX_AGE_MS}) to activate it.
|
|
33
|
-
*
|
|
34
|
-
* Mail older than the resolved look-back is filtered out of JSON
|
|
35
|
-
* responses and from SSE delivery so polling agents are never
|
|
36
|
-
* flooded with stale mail. The library intentionally does NOT
|
|
37
|
-
* enable a default look-back; host integrators that want the
|
|
38
|
-
* 1-hour server default must opt in explicitly.
|
|
39
|
-
*
|
|
40
|
-
* Per-request override: callers may append `?sinceMs=<ms>` to the
|
|
41
|
-
* request URL (the URL is rewritten by hosts that mount the router
|
|
42
|
-
* below a prefix). `0` opts in to the full retained history (matches
|
|
43
|
-
* the disable semantics of `defaultMaxAgeMs` below) and any positive
|
|
44
|
-
* value above {@link MAILBOX_HTTP_MAX_AGE_CEILING_MS} is silently
|
|
45
|
-
* clamped to that ceiling — this is a soft cap, not a hard rejection.
|
|
46
|
-
*
|
|
47
|
-
* Disabling the filter server-wide: pass `defaultMaxAgeMs` as
|
|
48
|
-
* `undefined` (the default), any negative number (`-1` is the
|
|
49
|
-
* canonical test-suite escape hatch), any non-finite value (`NaN`,
|
|
50
|
-
* `Infinity`, `-Infinity`), or `0`. `0` here is reserved because
|
|
51
|
-
* `now - 0` would otherwise map to the current instant and hide
|
|
52
|
-
* every retained message; `resolveDefault()` therefore treats `0` as
|
|
53
|
-
* equivalent to "disabled" via the same sentinel path as
|
|
54
|
-
* `undefined` / negative / non-finite values. The per-request
|
|
55
|
-
* `?sinceMs=0` URL parameter and the server-side `defaultMaxAgeMs=0`
|
|
56
|
-
* option therefore share identical "no filter" semantics.
|
|
57
|
-
*/
|
|
58
21
|
defaultMaxAgeMs?: number;
|
|
59
22
|
}
|
|
60
23
|
export interface MailboxHttpRouter {
|
|
61
|
-
/**
|
|
62
|
-
* Handle one canonical mailbox HTTP request. `routePath` lets a host mount
|
|
63
|
-
* the protocol below another prefix while preserving the public
|
|
64
|
-
* `/mailbox/*` route contract internally.
|
|
65
|
-
*/
|
|
66
24
|
handle(request: IncomingMessage, response: ServerResponse, routePath?: string): Promise<void>;
|
|
67
|
-
/** Close every active SSE stream owned by this router. Idempotent. */
|
|
68
25
|
close(): void;
|
|
69
|
-
/**
|
|
70
|
-
* True while at least one SSE stream is open. Hosts that cache routers
|
|
71
|
-
* (e.g. HQ's per-project mailbox gateway map) use this to skip evicting a
|
|
72
|
-
* router that still has a live stream — closing it would cut the client.
|
|
73
|
-
*/
|
|
74
26
|
hasActiveStreams(): boolean;
|
|
75
27
|
}
|
|
76
28
|
export declare function createMailboxHttpRouter(options: MailboxHttpRouterOptions): MailboxHttpRouter;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
+
import type { MailboxCredentialVerifier } from './mailbox-credential-store.js';
|
|
3
|
+
import type { MailboxEventEmitter } from './mailbox-events.js';
|
|
4
|
+
import type { MailboxActorContext } from './mailbox-types.js';
|
|
5
|
+
export declare const MAX_SSE_BUFFER_BYTES: number;
|
|
6
|
+
export declare function mailboxEventRecords(event: unknown): Record<string, unknown>[];
|
|
7
|
+
export declare function extractEventTimestamp(event: unknown): string | undefined;
|
|
8
|
+
export declare function isEventOlderThan(event: unknown, minTimestampIso: string): boolean;
|
|
9
|
+
export declare function isMailboxEventVisibleToActor(event: unknown, actor: MailboxActorContext): boolean;
|
|
10
|
+
export declare function createCredentialRevalidator(request: IncomingMessage, store: MailboxCredentialVerifier, actor: MailboxActorContext): () => Promise<boolean>;
|
|
11
|
+
export declare function handleSse(request: IncomingMessage, response: ServerResponse, eventEmitter: MailboxEventEmitter, minTimestampIso: string | undefined, closeSseStreams: Set<() => void>, actor?: MailboxActorContext, revalidateCredential?: () => Promise<boolean>): void;
|
|
12
|
+
//# sourceMappingURL=mailbox-http-sse.d.ts.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared mailbox message DTOs.
|
|
3
|
+
*
|
|
4
|
+
* Dependency leaf consumed by the mailbox helpers (mailbox-predicates,
|
|
5
|
+
* mailbox-session-sync) and re-exported through the mailbox-types facade.
|
|
6
|
+
* Splitting these out of the facade breaks the type-level module SCC the
|
|
7
|
+
* architecture gate (ARCH-CYCLE-TYPE check) reports between the helpers and
|
|
8
|
+
* the facade.
|
|
9
|
+
*/
|
|
10
|
+
import type { MailboxMessageType } from './mailbox-type-properties.js';
|
|
11
|
+
export type MailboxAudience = 'all' | 'leaders';
|
|
12
|
+
export interface ReadReceipts {
|
|
13
|
+
[agentId: string]: string;
|
|
14
|
+
}
|
|
15
|
+
export interface MailboxTaskContext {
|
|
16
|
+
agentRole?: string | undefined;
|
|
17
|
+
agentName?: string | undefined;
|
|
18
|
+
taskId?: string | undefined;
|
|
19
|
+
status?: 'pending' | 'in_progress' | 'completed' | 'failed' | undefined;
|
|
20
|
+
}
|
|
21
|
+
export interface MailboxScopedSessionAffinity {
|
|
22
|
+
sessionId: string;
|
|
23
|
+
reportId?: string | undefined;
|
|
24
|
+
kind?: string | undefined;
|
|
25
|
+
}
|
|
26
|
+
export interface MailboxLegacyReportSessionAffinity {
|
|
27
|
+
sessionId?: undefined;
|
|
28
|
+
reportId: string;
|
|
29
|
+
kind?: string | undefined;
|
|
30
|
+
}
|
|
31
|
+
export type MailboxSessionAffinity = MailboxScopedSessionAffinity | MailboxLegacyReportSessionAffinity;
|
|
32
|
+
export interface MailboxMessage {
|
|
33
|
+
id: string;
|
|
34
|
+
from: string;
|
|
35
|
+
to: string;
|
|
36
|
+
type: MailboxMessageType;
|
|
37
|
+
audience?: MailboxAudience | undefined;
|
|
38
|
+
subject: string;
|
|
39
|
+
body: string;
|
|
40
|
+
priority: 'low' | 'normal' | 'high';
|
|
41
|
+
readBy: ReadReceipts;
|
|
42
|
+
completed: boolean;
|
|
43
|
+
completedBy?: string | undefined;
|
|
44
|
+
outcome?: string | undefined;
|
|
45
|
+
timestamp: string;
|
|
46
|
+
completedAt?: string | undefined;
|
|
47
|
+
deletedAt?: string | undefined;
|
|
48
|
+
deletedBy?: string | undefined;
|
|
49
|
+
replyTo?: string | undefined;
|
|
50
|
+
taskContext?: MailboxTaskContext | undefined;
|
|
51
|
+
senderSessionId?: string | undefined;
|
|
52
|
+
sessionAffinity?: MailboxSessionAffinity | undefined;
|
|
53
|
+
expiresAt?: string | undefined;
|
|
54
|
+
}
|
|
55
|
+
export interface MailboxReceiptRecordV2 {
|
|
56
|
+
__mailboxReceipt: 2;
|
|
57
|
+
messageId: string;
|
|
58
|
+
actorId: string;
|
|
59
|
+
timestamp: string;
|
|
60
|
+
read?: boolean | undefined;
|
|
61
|
+
completed?: boolean | undefined;
|
|
62
|
+
outcome?: string | undefined;
|
|
63
|
+
}
|
|
64
|
+
export interface ActorMailboxMessage extends Omit<MailboxMessage, 'readBy' | 'completed' | 'completedBy' | 'completedAt' | 'outcome'> {
|
|
65
|
+
readByMe: boolean;
|
|
66
|
+
completedByMe: boolean;
|
|
67
|
+
actionRequiredForMe: boolean;
|
|
68
|
+
myOutcome?: string | undefined;
|
|
69
|
+
legacyGlobalCompletion?: boolean | undefined;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=mailbox-message-types.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type MailboxMessageType } from './mailbox-type-properties.js';
|
|
2
|
+
import type { ActorMailboxMessage, MailboxMessage, MailboxReceiptRecordV2 } from './mailbox-message-types.js';
|
|
3
|
+
export declare function mailboxIdentityBase(agentId: string): string;
|
|
4
|
+
export declare function isMailboxLeader(agentId: string, role?: string): boolean;
|
|
5
|
+
export declare function isMailboxSenderInFamily(senderId: string, family: string): boolean;
|
|
6
|
+
export declare function isMailboxMessageVisibleTo(message: Pick<MailboxMessage, 'audience'>, agentId: string, role?: string): boolean;
|
|
7
|
+
export declare function validateSendType(type: MailboxMessageType, to: string): void;
|
|
8
|
+
export declare const SESSION_RECIPIENT_PREFIX = "@session:";
|
|
9
|
+
export declare function sessionRecipient(sessionId: string): string;
|
|
10
|
+
export declare function normalizeRecipient(to: string, sessionId?: string): string;
|
|
11
|
+
export declare function isMailboxReceiptRecordV2(value: unknown): value is MailboxReceiptRecordV2;
|
|
12
|
+
export declare function isActionRequiredForActor(message: Pick<MailboxMessage, 'type' | 'deletedAt' | 'completed'>, projection: Pick<ActorMailboxMessage, 'completedByMe' | 'legacyGlobalCompletion'>): boolean;
|
|
13
|
+
//# sourceMappingURL=mailbox-predicates.d.ts.map
|
|
@@ -1353,7 +1353,7 @@ var AUTO_COMPACT_TYPE_TTL_MS = {
|
|
|
1353
1353
|
// 30 min
|
|
1354
1354
|
};
|
|
1355
1355
|
|
|
1356
|
-
// src/coordination/mailbox-
|
|
1356
|
+
// src/coordination/mailbox-predicates.ts
|
|
1357
1357
|
function mailboxIdentityBase(agentId) {
|
|
1358
1358
|
return agentId.split(/[@#]/, 1)[0].trim().toLowerCase();
|
|
1359
1359
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MailboxMessage } from './mailbox-message-types.js';
|
|
2
|
+
export interface MailboxSessionAffinityContext {
|
|
3
|
+
resolveChimeraReportSessionId?: ((reportId: string) => string | undefined | Promise<string | undefined>) | undefined;
|
|
4
|
+
allowUnscoped?: boolean | undefined;
|
|
5
|
+
}
|
|
6
|
+
export declare function acceptMailboxMessageForSession(message: Pick<MailboxMessage, 'type' | 'sessionAffinity'>, currentSessionId: string | undefined, ctx?: MailboxSessionAffinityContext): Promise<boolean>;
|
|
7
|
+
export declare function acceptMailboxMessageForSessionSync(message: Pick<MailboxMessage, 'type' | 'sessionAffinity'>, currentSessionId: string | undefined, ctx?: MailboxSessionAffinityContext): boolean;
|
|
8
|
+
//# sourceMappingURL=mailbox-session-sync.d.ts.map
|