@veewo/claw-core 0.2.3 → 0.2.4
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/src/errors.d.ts +1 -1
- package/dist/src/errors.js.map +1 -1
- package/dist/src/focus-transitions.d.ts +158 -0
- package/dist/src/focus-transitions.js +586 -0
- package/dist/src/focus-transitions.js.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/io.d.ts +6 -0
- package/dist/src/io.js +133 -33
- package/dist/src/io.js.map +1 -1
- package/dist/src/knowledge-sidecar.d.ts +4 -1
- package/dist/src/knowledge-sidecar.js +15 -9
- package/dist/src/knowledge-sidecar.js.map +1 -1
- package/dist/src/plan-view.d.ts +2 -1
- package/dist/src/plan-view.js +12 -0
- package/dist/src/plan-view.js.map +1 -1
- package/dist/src/plan.d.ts +3 -0
- package/dist/src/plan.js +54 -30
- package/dist/src/plan.js.map +1 -1
- package/dist/src/resources/delegate-writer/TEMPLATE.json +1 -1
- package/dist/src/resources/knowledge-writer/TEMPLATE.json +1 -1
- package/dist/src/templates/plans/default.js +1 -1
- package/dist/src/types.d.ts +19 -1
- package/dist/src/workflow-guidance.config.json +11 -0
- package/dist/src/workflow-guidance.js +10 -2
- package/dist/src/workflow-guidance.js.map +1 -1
- package/package.json +1 -1
package/dist/src/errors.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type ClawErrorCode = "PROJECT_ROOT_NOT_FOUND" | "CLAW_DIR_NOT_FOUND" | "PROJECT_ALREADY_INITIALIZED" | "PROJECT_CONFIG_INVALID" | "TASK_NOT_FOUND" | "TASK_NAME_INVALID" | "ACTIVE_PLAN_INVALID" | "ACTIVE_PLAN_MISSING" | "PLAN_NOT_FOUND" | "PLAN_ALREADY_EXISTS" | "PLAN_STATUS_INVALID" | "PLAN_STATUS_NOT_SETTABLE" | "PLAN_STATUS_TRANSITION_FORBIDDEN" | "PLAN_STATUS_REOPEN_REQUIRED" | "TASK_STATUS_FORBIDDEN_IN_NON_ACTIVE_PLAN" | "PLAN_WRITE_CONFLICT" | "PLAN_STALE_EDIT" | "RETROSPECTIVE_REQUIRED" | "MEMORY_QUERY_REQUIRED" | "MEMORY_DISABLED" | "MEMORY_STORE_BUSY" | "MEMORY_VECTOR_INDEX_REQUIRED" | "GITNEXUS_REFRESH_FAILED" | "TRUTH_TARGET_INVALID" | "INPUT_REQUIRED";
|
|
1
|
+
export type ClawErrorCode = "PROJECT_ROOT_NOT_FOUND" | "CLAW_DIR_NOT_FOUND" | "PROJECT_ALREADY_INITIALIZED" | "PROJECT_CONFIG_INVALID" | "TASK_NOT_FOUND" | "TASK_NAME_INVALID" | "ACTIVE_PLAN_INVALID" | "ACTIVE_PLAN_MISSING" | "PLAN_NOT_FOUND" | "PLAN_ALREADY_EXISTS" | "PLAN_STATUS_INVALID" | "PLAN_STATUS_NOT_SETTABLE" | "PLAN_STATUS_TRANSITION_FORBIDDEN" | "PLAN_STATUS_REOPEN_REQUIRED" | "TASK_STATUS_FORBIDDEN_IN_NON_ACTIVE_PLAN" | "PLAN_WRITE_CONFLICT" | "PLAN_STALE_EDIT" | "CURRENT_PLAN_REQUIRED" | "PLAN_NOT_RESUMABLE" | "PLAN_FOCUS_CONFLICT" | "PLAN_TRANSITION_CONFLICT" | "FOCUS_RECOVERY_CONFLICT" | "SESSION_IDENTITY_INVALID" | "SESSION_NOT_FOUND" | "SESSION_EXPIRED" | "SESSION_PROTOCOL_UNSUPPORTED" | "SESSION_COMMAND_FAILED" | "SESSION_OPERATION_UNSUPPORTED" | "RETROSPECTIVE_REQUIRED" | "MEMORY_QUERY_REQUIRED" | "MEMORY_DISABLED" | "MEMORY_STORE_BUSY" | "MEMORY_VECTOR_INDEX_REQUIRED" | "GITNEXUS_REFRESH_FAILED" | "TRUTH_TARGET_INVALID" | "INPUT_REQUIRED";
|
|
2
2
|
export declare class ClawError extends Error {
|
|
3
3
|
readonly code: ClawErrorCode;
|
|
4
4
|
readonly details: Record<string, unknown> | undefined;
|
package/dist/src/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAsCA,MAAM,OAAO,SAAU,SAAQ,KAAK;IACzB,IAAI,CAAgB;IACpB,OAAO,CAAsC;IAEtD,YAAY,IAAmB,EAAE,OAAe,EAAE,OAAiC;QACjF,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import type { PlanDocument, PlanLeaveReason, ProjectContext } from "./types.js";
|
|
2
|
+
export type PlanRef = {
|
|
3
|
+
projectRoot: string;
|
|
4
|
+
taskName: string;
|
|
5
|
+
planFile: string;
|
|
6
|
+
};
|
|
7
|
+
export type PlanFocusOwner = {
|
|
8
|
+
sessionKeyHash: string;
|
|
9
|
+
planRef: PlanRef;
|
|
10
|
+
acquiredAt: string;
|
|
11
|
+
updatedAt: string;
|
|
12
|
+
};
|
|
13
|
+
export type PlanFocusRegistry = {
|
|
14
|
+
schemaVersion: 1;
|
|
15
|
+
owners: Record<string, PlanFocusOwner>;
|
|
16
|
+
};
|
|
17
|
+
export type FocusSessionRecord = {
|
|
18
|
+
schemaVersion: 1;
|
|
19
|
+
sessionKeyHash: string;
|
|
20
|
+
currentPlan?: PlanRef;
|
|
21
|
+
updatedAt: string;
|
|
22
|
+
};
|
|
23
|
+
export interface FocusSessionStore {
|
|
24
|
+
read(sessionKeyHash: string): FocusSessionRecord;
|
|
25
|
+
buildPersistedRecord(sessionKeyHash: string, record: FocusSessionRecord): unknown;
|
|
26
|
+
writePersistedAtomic(sessionKeyHash: string, persistedRecord: unknown): void;
|
|
27
|
+
queuePath(sessionKeyHash: string): string;
|
|
28
|
+
resourcePath(sessionKeyHash: string): string;
|
|
29
|
+
}
|
|
30
|
+
export type FocusTransitionKind = "create" | "resume" | "leave" | "end" | "expire" | "subplan_create" | "subplan_complete";
|
|
31
|
+
export type FocusTransitionJournal = {
|
|
32
|
+
schemaVersion: 1;
|
|
33
|
+
transitionId: string;
|
|
34
|
+
kind: FocusTransitionKind;
|
|
35
|
+
sessionKeyHash: string;
|
|
36
|
+
phase: "prepared" | "applying" | "committed";
|
|
37
|
+
createdAt: string;
|
|
38
|
+
updatedAt: string;
|
|
39
|
+
before: {
|
|
40
|
+
sessionRecordHash: string;
|
|
41
|
+
ownerRegistryHash: string;
|
|
42
|
+
sessionCurrentPlan?: PlanRef;
|
|
43
|
+
plans: Array<{
|
|
44
|
+
ref: PlanRef;
|
|
45
|
+
contentHash: string;
|
|
46
|
+
}>;
|
|
47
|
+
};
|
|
48
|
+
after: {
|
|
49
|
+
sessionRecord: unknown;
|
|
50
|
+
ownerRegistry: PlanFocusRegistry;
|
|
51
|
+
sessionCurrentPlan?: PlanRef;
|
|
52
|
+
plans: Array<{
|
|
53
|
+
ref: PlanRef;
|
|
54
|
+
content: PlanDocument;
|
|
55
|
+
}>;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
export type FocusTransitionResult = {
|
|
59
|
+
changed: boolean;
|
|
60
|
+
transitionId?: string;
|
|
61
|
+
previousCurrentPlan?: PlanRef;
|
|
62
|
+
currentPlan?: PlanRef;
|
|
63
|
+
enteredEndPlans: Array<{
|
|
64
|
+
ref: PlanRef;
|
|
65
|
+
plan: PlanDocument;
|
|
66
|
+
endedAt: string;
|
|
67
|
+
}>;
|
|
68
|
+
};
|
|
69
|
+
export type FocusFailurePoint = "after_prepared" | "after_applying" | "after_plan" | "after_owners" | "after_session" | "after_committed";
|
|
70
|
+
export type FocusTransitionTestHooks = {
|
|
71
|
+
failAt?: FocusFailurePoint;
|
|
72
|
+
failAfterPlanWrites?: number;
|
|
73
|
+
};
|
|
74
|
+
export declare class ProjectFocusSessionStore implements FocusSessionStore {
|
|
75
|
+
readonly project: ProjectContext;
|
|
76
|
+
constructor(project: ProjectContext);
|
|
77
|
+
read(sessionKeyHash: string): FocusSessionRecord;
|
|
78
|
+
buildPersistedRecord(sessionKeyHash: string, record: FocusSessionRecord): unknown;
|
|
79
|
+
writePersistedAtomic(sessionKeyHash: string, persistedRecord: unknown): void;
|
|
80
|
+
queuePath(sessionKeyHash: string): string;
|
|
81
|
+
resourcePath(sessionKeyHash: string): string;
|
|
82
|
+
}
|
|
83
|
+
export declare function createPlanRef(project: ProjectContext, taskName: string, planFile?: string): PlanRef;
|
|
84
|
+
export declare function focusSessionKeyHash(sessionKey: string): string;
|
|
85
|
+
export declare function focusTransitionsDirectory(project: ProjectContext): string;
|
|
86
|
+
export declare function focusQueuePath(project: ProjectContext): string;
|
|
87
|
+
export declare function focusOwnersPath(project: ProjectContext): string;
|
|
88
|
+
export declare function readFocusedPlan(project: ProjectContext, sessionKey: string, sessionStore?: FocusSessionStore): PlanRef | undefined;
|
|
89
|
+
export declare function readPlanFocusOwner(project: ProjectContext, ref: PlanRef): PlanFocusOwner | undefined;
|
|
90
|
+
export declare function leaveCurrentPlan(input: {
|
|
91
|
+
project: ProjectContext;
|
|
92
|
+
sessionKey: string;
|
|
93
|
+
reason?: PlanLeaveReason;
|
|
94
|
+
sessionStore?: FocusSessionStore;
|
|
95
|
+
testHooks?: FocusTransitionTestHooks;
|
|
96
|
+
}): Promise<FocusTransitionResult>;
|
|
97
|
+
export declare function releaseCurrentPlanFocus(input: {
|
|
98
|
+
project: ProjectContext;
|
|
99
|
+
sessionKey: string;
|
|
100
|
+
expectedEnd?: boolean;
|
|
101
|
+
kind?: "end" | "expire";
|
|
102
|
+
sessionStore?: FocusSessionStore;
|
|
103
|
+
testHooks?: FocusTransitionTestHooks;
|
|
104
|
+
}): Promise<FocusTransitionResult>;
|
|
105
|
+
export declare function activatePlan(input: {
|
|
106
|
+
project: ProjectContext;
|
|
107
|
+
sessionKey: string;
|
|
108
|
+
target?: PlanRef;
|
|
109
|
+
sessionStore?: FocusSessionStore;
|
|
110
|
+
testHooks?: FocusTransitionTestHooks;
|
|
111
|
+
}): Promise<FocusTransitionResult>;
|
|
112
|
+
export declare function switchCurrentPlan(input: {
|
|
113
|
+
project: ProjectContext;
|
|
114
|
+
sessionKey: string;
|
|
115
|
+
target: PlanRef;
|
|
116
|
+
kind?: FocusTransitionKind;
|
|
117
|
+
additionalPlanUpdates?: Array<{
|
|
118
|
+
ref: PlanRef;
|
|
119
|
+
content: PlanDocument;
|
|
120
|
+
}>;
|
|
121
|
+
preserveTargetStatus?: boolean;
|
|
122
|
+
preserveCurrentEndState?: boolean;
|
|
123
|
+
sessionStore?: FocusSessionStore;
|
|
124
|
+
testHooks?: FocusTransitionTestHooks;
|
|
125
|
+
}): Promise<FocusTransitionResult>;
|
|
126
|
+
export declare function createPlanAndSwitchFocus(input: {
|
|
127
|
+
project: ProjectContext;
|
|
128
|
+
sessionKey: string;
|
|
129
|
+
createdPlan: PlanRef;
|
|
130
|
+
sessionStore?: FocusSessionStore;
|
|
131
|
+
testHooks?: FocusTransitionTestHooks;
|
|
132
|
+
}): Promise<FocusTransitionResult>;
|
|
133
|
+
export declare function createSubplanAndSwitchFocus(input: {
|
|
134
|
+
project: ProjectContext;
|
|
135
|
+
sessionKey: string;
|
|
136
|
+
parentPlan: PlanRef;
|
|
137
|
+
parentAfterLink: PlanDocument;
|
|
138
|
+
childPlan: PlanRef;
|
|
139
|
+
sessionStore?: FocusSessionStore;
|
|
140
|
+
testHooks?: FocusTransitionTestHooks;
|
|
141
|
+
}): Promise<FocusTransitionResult>;
|
|
142
|
+
export declare function completeSubplanAndRestoreParent(input: {
|
|
143
|
+
project: ProjectContext;
|
|
144
|
+
sessionKey: string;
|
|
145
|
+
childPlan: PlanRef;
|
|
146
|
+
completedChild: PlanDocument;
|
|
147
|
+
parentPlan: PlanRef;
|
|
148
|
+
parentTaskId: number;
|
|
149
|
+
sessionStore?: FocusSessionStore;
|
|
150
|
+
testHooks?: FocusTransitionTestHooks;
|
|
151
|
+
}): Promise<FocusTransitionResult>;
|
|
152
|
+
export declare function recoverProjectFocusTransitions(input: {
|
|
153
|
+
project: ProjectContext;
|
|
154
|
+
sessionStore?: FocusSessionStore;
|
|
155
|
+
}): Promise<{
|
|
156
|
+
recovered: string[];
|
|
157
|
+
discarded: string[];
|
|
158
|
+
}>;
|