opencode-matrixx 2.6.5 → 2.6.7
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/agents/oracle/behavioral-summary.d.ts +1 -1
- package/dist/agents/oracle/high-accuracy-mode.d.ts +1 -1
- package/dist/agents/oracle/interview-mode.d.ts +1 -1
- package/dist/agents/oracle/plan-generation.d.ts +1 -1
- package/dist/agents/oracle/plan-template.d.ts +1 -1
- package/dist/agents/oracle/system-prompt.d.ts +1 -1
- package/dist/cli.js +65 -10
- package/dist/config/schema/background-task.d.ts +37 -0
- package/dist/config/schema/dcp.d.ts +46 -0
- package/dist/config/schema/hooks.d.ts +1 -0
- package/dist/config/schema/matrixx-config.d.ts +33 -0
- package/dist/create-hooks.d.ts +1 -0
- package/dist/features/background-agent/admission.d.ts +24 -0
- package/dist/features/background-agent/concurrency.d.ts +9 -0
- package/dist/features/background-agent/constants.d.ts +13 -0
- package/dist/features/background-agent/handle-index.d.ts +75 -0
- package/dist/features/background-agent/handle-index.test.d.ts +1 -0
- package/dist/features/background-agent/index.d.ts +1 -0
- package/dist/features/background-agent/manager-handles.test.d.ts +1 -0
- package/dist/features/background-agent/manager.d.ts +69 -2
- package/dist/features/background-agent/notification-builder.d.ts +1 -0
- package/dist/features/background-agent/reconcile.d.ts +33 -0
- package/dist/features/background-agent/revive.d.ts +39 -0
- package/dist/features/background-agent/session-output.d.ts +40 -0
- package/dist/features/background-agent/task-history.d.ts +20 -0
- package/dist/features/background-agent/types.d.ts +21 -1
- package/dist/features/background-agent/wake-scheduler.d.ts +47 -0
- package/dist/features/background-agent/wallclock.d.ts +37 -0
- package/dist/features/bdd/schema.d.ts +5 -5
- package/dist/hooks/background-task-blocker/hook.d.ts +10 -0
- package/dist/hooks/background-task-blocker/index.d.ts +1 -0
- package/dist/hooks/context-mode-enforcer/constants.d.ts +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/index.js +2037 -620
- package/dist/matrixx.schema.json +166 -3
- package/dist/plugin/hooks/create-core-hooks.d.ts +1 -0
- package/dist/plugin/hooks/create-tool-guard-hooks.d.ts +2 -1
- package/dist/plugin-handlers/agent-config-handler.d.ts +2 -1
- package/dist/shared/context-mode-enforcement.d.ts +35 -0
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/revive-outcome.d.ts +15 -0
- package/dist/shared/saturated-outcome.d.ts +18 -0
- package/dist/shared/wallclock-outcome.d.ts +18 -0
- package/dist/tools/background-task/constants.d.ts +1 -1
- package/dist/tools/background-task/create-background-revive.d.ts +3 -0
- package/dist/tools/background-task/index.d.ts +1 -1
- package/dist/tools/background-task/tools.d.ts +1 -1
- package/dist/tools/background-task/types.d.ts +9 -5
- package/dist/tools/dcp-switch-profile/tools.d.ts +1 -0
- package/dist/tools/delegate-task/sync-task.test.d.ts +1 -0
- package/dist/tools/delegate-task/timing.test.d.ts +1 -0
- package/dist/tools/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/tools/background-task/create-background-task.d.ts +0 -3
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Revive eligibility classification for background tasks.
|
|
3
|
+
*
|
|
4
|
+
* Pure logic: decides whether a persisted handle may be revived into a new
|
|
5
|
+
* session. No I/O, no manager access, no client imports.
|
|
6
|
+
*/
|
|
7
|
+
import type { BgHandle } from "./handle-index";
|
|
8
|
+
import type { BackgroundTask } from "./types";
|
|
9
|
+
export declare const REVIVABLE_STATUSES: readonly ["cancelled", "stopped", "interrupt", "error", "completed"];
|
|
10
|
+
export declare function isRevivableStatus(status: string): boolean;
|
|
11
|
+
export type ReviveBlockReason = "active" | "uncertain" | "no-session" | "unknown-task" | "expired";
|
|
12
|
+
export type ReviveEligibility = {
|
|
13
|
+
eligible: true;
|
|
14
|
+
} | {
|
|
15
|
+
eligible: false;
|
|
16
|
+
reason: ReviveBlockReason;
|
|
17
|
+
};
|
|
18
|
+
export declare function classifyRevivable(handle: {
|
|
19
|
+
status: string;
|
|
20
|
+
sessionID?: string;
|
|
21
|
+
terminalReason?: string;
|
|
22
|
+
}, opts?: {
|
|
23
|
+
force?: boolean;
|
|
24
|
+
}): ReviveEligibility;
|
|
25
|
+
/**
|
|
26
|
+
* Locate a revivable handle by task id or session id. `taskId` wins when
|
|
27
|
+
* both are supplied. Returns `undefined` when neither matches.
|
|
28
|
+
*/
|
|
29
|
+
export declare function findRevivableHandle(handles: BgHandle[], opts: {
|
|
30
|
+
taskId?: string;
|
|
31
|
+
sessionId?: string;
|
|
32
|
+
}): BgHandle | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Rehydrate a pre-admission `BackgroundTask` from a persisted handle with a
|
|
35
|
+
* NEW prompt. Mirrors `restoreTaskFromHandle` except `prompt` comes from the
|
|
36
|
+
* caller and `status` restarts at `"pending"`; `startedAt` is left unset (it
|
|
37
|
+
* is assigned on admission) and `completedAt`/`error` are cleared.
|
|
38
|
+
*/
|
|
39
|
+
export declare function toReviveTask(handle: BgHandle, prompt: string): BackgroundTask;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface SessionOutputClient {
|
|
2
|
+
session: {
|
|
3
|
+
messages: (args: {
|
|
4
|
+
path: {
|
|
5
|
+
id: string;
|
|
6
|
+
};
|
|
7
|
+
}) => Promise<unknown>;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
interface SessionMessagePart {
|
|
11
|
+
type?: string;
|
|
12
|
+
text?: string;
|
|
13
|
+
content?: string | unknown[];
|
|
14
|
+
}
|
|
15
|
+
export interface SessionMessage {
|
|
16
|
+
info?: {
|
|
17
|
+
role?: string;
|
|
18
|
+
error?: unknown;
|
|
19
|
+
};
|
|
20
|
+
parts?: SessionMessagePart[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Fetch the raw messages for a session. Throws on transport failure so callers
|
|
24
|
+
* can decide between fail-open (legacy) and fail-safe (reconciliation).
|
|
25
|
+
*/
|
|
26
|
+
export declare function fetchSessionMessages(client: SessionOutputClient, sessionID: string): Promise<SessionMessage[]>;
|
|
27
|
+
/**
|
|
28
|
+
* True when the session produced real assistant/tool output with content.
|
|
29
|
+
* Shared by `validateSessionHasOutput` (manager) and `reconcileHandle`.
|
|
30
|
+
*/
|
|
31
|
+
export declare function messagesHaveAssistantOutput(messages: SessionMessage[], sessionID?: string): boolean;
|
|
32
|
+
/** True when any assistant message carries a recorded provider/abort error. */
|
|
33
|
+
export declare function messagesHaveRecordedError(messages: SessionMessage[]): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Validate that a session has actual assistant/tool output before marking
|
|
36
|
+
* complete. Fail-open: transport errors return true so a flaky lookup cannot
|
|
37
|
+
* block the existing polling/idle completion path.
|
|
38
|
+
*/
|
|
39
|
+
export declare function validateSessionHasOutput(client: SessionOutputClient, sessionID: string): Promise<boolean>;
|
|
40
|
+
export {};
|
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
import type { BackgroundTaskStatus } from "./types";
|
|
2
|
+
export type JobBoardStrategy = "latest" | "checkpoint-compatible";
|
|
3
|
+
export interface JobBoardRow {
|
|
4
|
+
agent: string;
|
|
5
|
+
category?: string;
|
|
6
|
+
status: BackgroundTaskStatus;
|
|
7
|
+
description: string;
|
|
8
|
+
session?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface JobBoardSnapshot {
|
|
11
|
+
strategy: JobBoardStrategy;
|
|
12
|
+
block: string;
|
|
13
|
+
retained?: string[];
|
|
14
|
+
}
|
|
15
|
+
export interface BuildJobBoardSnapshotOpts {
|
|
16
|
+
strategy?: JobBoardStrategy;
|
|
17
|
+
maxRetained?: number;
|
|
18
|
+
previous?: string[];
|
|
19
|
+
}
|
|
2
20
|
export interface TaskHistoryEntry {
|
|
3
21
|
id: string;
|
|
4
22
|
sessionID?: string;
|
|
@@ -15,4 +33,6 @@ export declare class TaskHistory {
|
|
|
15
33
|
getByParentSession(parentSessionID: string): TaskHistoryEntry[];
|
|
16
34
|
clearSession(parentSessionID: string): void;
|
|
17
35
|
formatForCompaction(parentSessionID: string): string | null;
|
|
36
|
+
getJobBoardEntries(parentSessionID: string): JobBoardRow[];
|
|
37
|
+
buildJobBoardSnapshot(parentSessionID: string, opts?: BuildJobBoardSnapshotOpts): JobBoardSnapshot | null;
|
|
18
38
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export type BackgroundTaskStatus = "pending" | "running" | "completed" | "error" | "cancelled" | "interrupt";
|
|
1
|
+
export type BackgroundTaskStatus = "pending" | "running" | "completed" | "error" | "cancelled" | "interrupt" | "stopped" | "statusUncertain";
|
|
2
|
+
/** Why a background task reached a terminal state (persisted on the handle). */
|
|
3
|
+
export type BackgroundTerminalReason = "queue-saturated" | "no-output" | "uncertain" | "aborted" | "stale" | "nested-depth-exceeded" | "wall-clock-timeout";
|
|
2
4
|
export interface ToolCallWindow {
|
|
3
5
|
lastSignature: string;
|
|
4
6
|
consecutiveCount: number;
|
|
@@ -54,6 +56,10 @@ export interface BackgroundTask {
|
|
|
54
56
|
lastMsgCount?: number;
|
|
55
57
|
/** Number of consecutive polls with stable message count */
|
|
56
58
|
stablePolls?: number;
|
|
59
|
+
/** Why the task reached a terminal state (e.g. stopped/statusUncertain) */
|
|
60
|
+
terminalReason?: BackgroundTerminalReason;
|
|
61
|
+
/** Compressed result payload for handoff to parent session (set by tryCompleteTask) */
|
|
62
|
+
compactedResult?: string;
|
|
57
63
|
}
|
|
58
64
|
export interface LaunchInput {
|
|
59
65
|
description: string;
|
|
@@ -90,4 +96,18 @@ export interface ResumeInput {
|
|
|
90
96
|
parentAgent?: string;
|
|
91
97
|
parentTools?: Record<string, boolean>;
|
|
92
98
|
}
|
|
99
|
+
export interface ReviveInput {
|
|
100
|
+
taskId?: string;
|
|
101
|
+
sessionId?: string;
|
|
102
|
+
prompt: string;
|
|
103
|
+
parentSessionID: string;
|
|
104
|
+
parentMessageID: string;
|
|
105
|
+
parentModel?: {
|
|
106
|
+
providerID: string;
|
|
107
|
+
modelID: string;
|
|
108
|
+
};
|
|
109
|
+
parentAgent?: string;
|
|
110
|
+
parentTools?: Record<string, boolean>;
|
|
111
|
+
force?: boolean;
|
|
112
|
+
}
|
|
93
113
|
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export interface WakeSchedulerConfig {
|
|
2
|
+
enabled?: boolean;
|
|
3
|
+
intervalMs?: number;
|
|
4
|
+
}
|
|
5
|
+
export interface WakeParentState {
|
|
6
|
+
hasPendingChildren: boolean;
|
|
7
|
+
hasUndeliveredNotifications: boolean;
|
|
8
|
+
hasUnfinishedTodos?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const WAKE_REMINDER_TEXT = "<system-reminder>\n[BACKGROUND WAKE]\n\nOne or more background tasks for this session are still running or have undelivered results.\nUse background_output with the task ID to retrieve results when ready.\nDo NOT poll - continue productive work.\n</system-reminder>";
|
|
11
|
+
export declare function isWakeSchedulerEnabled(cfg?: WakeSchedulerConfig): boolean;
|
|
12
|
+
export declare function resolveWakeIntervalMs(cfg?: WakeSchedulerConfig): number;
|
|
13
|
+
export declare function shouldWakeForParent(state: WakeParentState): boolean;
|
|
14
|
+
export declare function nextWakeDelay(lastWakeAtMs: number, intervalMs: number, nowMs?: number): number;
|
|
15
|
+
export declare class WakeTracker {
|
|
16
|
+
private stagnantByParent;
|
|
17
|
+
recordWake(parentSessionID: string, progressed: boolean): boolean;
|
|
18
|
+
resetOnActivity(parentSessionID: string): void;
|
|
19
|
+
stagnantCount(parentSessionID: string): number;
|
|
20
|
+
}
|
|
21
|
+
export type WakeTimerHandle = ReturnType<typeof setTimeout>;
|
|
22
|
+
export type WakeScheduleTimer = (callback: () => void, delayMs: number) => WakeTimerHandle;
|
|
23
|
+
export type WakeClearTimer = (handle: WakeTimerHandle) => void;
|
|
24
|
+
export interface WakeRegistration {
|
|
25
|
+
intervalMs: number;
|
|
26
|
+
readState: () => WakeParentState;
|
|
27
|
+
deliverWake: () => void | Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
export declare class WakeScheduler {
|
|
30
|
+
private timers;
|
|
31
|
+
private registrations;
|
|
32
|
+
private snapshots;
|
|
33
|
+
private readonly tracker;
|
|
34
|
+
private readonly scheduleTimer;
|
|
35
|
+
private readonly clearTimer;
|
|
36
|
+
constructor(deps?: {
|
|
37
|
+
scheduleTimer?: WakeScheduleTimer;
|
|
38
|
+
clearTimer?: WakeClearTimer;
|
|
39
|
+
});
|
|
40
|
+
private armTimer;
|
|
41
|
+
schedule(parentSessionID: string, registration: WakeRegistration): void;
|
|
42
|
+
clear(parentSessionID: string): void;
|
|
43
|
+
dispose(): void;
|
|
44
|
+
hasScheduledWake(parentSessionID: string): boolean;
|
|
45
|
+
private clearTimerFor;
|
|
46
|
+
private tick;
|
|
47
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wall-clock supervisor: fire-once elapsed-time bound for running background tasks.
|
|
3
|
+
*
|
|
4
|
+
* Staleness is activity-based; this module is elapsed-time-based. Each armed entry
|
|
5
|
+
* fires its callback exactly once when `startedAtMs + timeoutMs` passes, no matter
|
|
6
|
+
* how busy or productive the task looks. A timeout of `0` or `undefined` means OFF
|
|
7
|
+
* and arms nothing.
|
|
8
|
+
*
|
|
9
|
+
* Grace contract (manager-owned, pinned here): on fire the manager aborts the
|
|
10
|
+
* session once, waits `wallClockAbortGraceMs`, then marks the task terminal —
|
|
11
|
+
* unless the task completed naturally during grace, in which case the natural
|
|
12
|
+
* outcome wins and the pending mark is cancelled.
|
|
13
|
+
*
|
|
14
|
+
* This module must not import from manager/client/fs — pure timers only. It mirrors
|
|
15
|
+
* the settled-flag lifecycle of `acquireWithDeadline` in `concurrency.ts`.
|
|
16
|
+
*/
|
|
17
|
+
/** Maximum delay accepted by `setTimeout` (2^31-1 ms); enforced by schema max too. */
|
|
18
|
+
export declare const MAX_WALLCLOCK_TIMEOUT_MS = 2147483647;
|
|
19
|
+
/** Context delivered to the fire callback exactly once per armed deadline. */
|
|
20
|
+
export interface WallclockFireContext {
|
|
21
|
+
taskId: string;
|
|
22
|
+
elapsedMs: number;
|
|
23
|
+
limitMs: number;
|
|
24
|
+
}
|
|
25
|
+
export type WallclockFireCallback = (ctx: WallclockFireContext) => void;
|
|
26
|
+
/** Pure remaining-time math: deadline minus now (negative when already expired). */
|
|
27
|
+
export declare function remainingMs(startedAtMs: number, timeoutMs: number, nowMs?: number): number;
|
|
28
|
+
/** OFF (`0`/`undefined`) never arms; any other value is an active elapsed-time bound. */
|
|
29
|
+
export declare function isWallclockEnabled(timeoutMs: number | undefined): timeoutMs is number;
|
|
30
|
+
export declare class WallclockSupervisor {
|
|
31
|
+
private entries;
|
|
32
|
+
arm(taskId: string, startedAtMs: number, timeoutMs: number | undefined, onFire: WallclockFireCallback): void;
|
|
33
|
+
disarm(taskId: string): boolean;
|
|
34
|
+
disarmAll(): void;
|
|
35
|
+
size(): number;
|
|
36
|
+
getDeadlineAt(taskId: string): number | undefined;
|
|
37
|
+
}
|
|
@@ -86,8 +86,8 @@ export declare const HttpMethodSchema: z.ZodEnum<{
|
|
|
86
86
|
}>;
|
|
87
87
|
export declare const ResponseFormatSchema: z.ZodEnum<{
|
|
88
88
|
binary: "binary";
|
|
89
|
-
json: "json";
|
|
90
89
|
text: "text";
|
|
90
|
+
json: "json";
|
|
91
91
|
html: "html";
|
|
92
92
|
xml: "xml";
|
|
93
93
|
}>;
|
|
@@ -118,8 +118,8 @@ export declare const ApiResponseSchema: z.ZodObject<{
|
|
|
118
118
|
status: z.ZodNumber;
|
|
119
119
|
format: z.ZodEnum<{
|
|
120
120
|
binary: "binary";
|
|
121
|
-
json: "json";
|
|
122
121
|
text: "text";
|
|
122
|
+
json: "json";
|
|
123
123
|
html: "html";
|
|
124
124
|
xml: "xml";
|
|
125
125
|
}>;
|
|
@@ -174,8 +174,8 @@ export declare const ApiAnnotationsSchema: z.ZodObject<{
|
|
|
174
174
|
status: z.ZodNumber;
|
|
175
175
|
format: z.ZodEnum<{
|
|
176
176
|
binary: "binary";
|
|
177
|
-
json: "json";
|
|
178
177
|
text: "text";
|
|
178
|
+
json: "json";
|
|
179
179
|
html: "html";
|
|
180
180
|
xml: "xml";
|
|
181
181
|
}>;
|
|
@@ -236,8 +236,8 @@ export declare const ContractAnnotationsSchema: z.ZodObject<{
|
|
|
236
236
|
status: z.ZodNumber;
|
|
237
237
|
format: z.ZodEnum<{
|
|
238
238
|
binary: "binary";
|
|
239
|
-
json: "json";
|
|
240
239
|
text: "text";
|
|
240
|
+
json: "json";
|
|
241
241
|
html: "html";
|
|
242
242
|
xml: "xml";
|
|
243
243
|
}>;
|
|
@@ -366,8 +366,8 @@ export declare const ContractSchema: z.ZodObject<{
|
|
|
366
366
|
status: z.ZodNumber;
|
|
367
367
|
format: z.ZodEnum<{
|
|
368
368
|
binary: "binary";
|
|
369
|
-
json: "json";
|
|
370
369
|
text: "text";
|
|
370
|
+
json: "json";
|
|
371
371
|
html: "html";
|
|
372
372
|
xml: "xml";
|
|
373
373
|
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createBackgroundTaskBlockerHook } from "./hook";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const HOOK_NAME = "context-mode-enforcer";
|
|
2
2
|
export declare const WARN_MESSAGE_READ = "Use ctx_search / ctx_batch_execute / ctx_execute for analysis \u2014 raw read/grep/glob bypasses FTS5 sandbox and pollutes context. Use Read only with hashline IDs for Edit (non-plan paths; .matrixx/plans/*.md must use plan_read/plan_update).";
|
|
3
|
-
export declare const BLOCK_MESSAGE_GREP_GLOB
|
|
3
|
+
export declare const BLOCK_MESSAGE_GREP_GLOB: string;
|
|
4
4
|
export declare const WARN_MESSAGE_BASH_READ = "Use ctx_* / Read tool instead of `cat`/`head`/`tail`/`grep` via bash for analysis. Raw bash file reads bypass sandbox.";
|
|
5
5
|
export declare const DEFAULT_BLOCKED_TOOLS: readonly ["grep", "glob"];
|
|
6
6
|
export declare const WARN_ONLY_TOOLS: readonly ["read"];
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { createArchitectHook } from "./architect";
|
|
|
3
3
|
export { createAutoSlashCommandHook } from "./auto-slash-command";
|
|
4
4
|
export { createAutoUpdateCheckerHook } from "./auto-update-checker";
|
|
5
5
|
export { createBackgroundNotificationHook } from "./background-notification";
|
|
6
|
+
export { createBackgroundTaskBlockerHook } from "./background-task-blocker";
|
|
6
7
|
export { createBashFileReadGuardHook } from "./bash-file-read-guard";
|
|
7
8
|
export { createCategorySkillReminderHook } from "./category-skill-reminder";
|
|
8
9
|
export { createCommentCheckerHooks } from "./comment-checker";
|