@dexto/tools-plan 1.6.0 → 1.6.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 (38) hide show
  1. package/dist/errors.cjs +126 -0
  2. package/dist/errors.js +99 -64
  3. package/dist/index.cjs +36 -0
  4. package/dist/index.d.cts +224 -0
  5. package/dist/index.js +9 -12
  6. package/dist/plan-service-getter.cjs +16 -0
  7. package/dist/plan-service-getter.js +0 -1
  8. package/dist/plan-service.cjs +247 -0
  9. package/dist/plan-service.js +201 -215
  10. package/dist/plan-service.test.cjs +227 -0
  11. package/dist/plan-service.test.js +200 -222
  12. package/dist/tool-factory-config.cjs +38 -0
  13. package/dist/tool-factory-config.js +13 -30
  14. package/dist/tool-factory.cjs +71 -0
  15. package/dist/tool-factory.js +39 -35
  16. package/dist/tool-factory.test.cjs +96 -0
  17. package/dist/tool-factory.test.js +90 -95
  18. package/dist/tools/plan-create-tool.cjs +102 -0
  19. package/dist/tools/plan-create-tool.d.ts.map +1 -1
  20. package/dist/tools/plan-create-tool.js +77 -82
  21. package/dist/tools/plan-create-tool.test.cjs +174 -0
  22. package/dist/tools/plan-create-tool.test.js +142 -134
  23. package/dist/tools/plan-read-tool.cjs +65 -0
  24. package/dist/tools/plan-read-tool.d.ts.map +1 -1
  25. package/dist/tools/plan-read-tool.js +39 -41
  26. package/dist/tools/plan-read-tool.test.cjs +109 -0
  27. package/dist/tools/plan-read-tool.test.js +78 -87
  28. package/dist/tools/plan-review-tool.cjs +98 -0
  29. package/dist/tools/plan-review-tool.d.ts.map +1 -1
  30. package/dist/tools/plan-review-tool.js +73 -87
  31. package/dist/tools/plan-update-tool.cjs +92 -0
  32. package/dist/tools/plan-update-tool.d.ts.map +1 -1
  33. package/dist/tools/plan-update-tool.js +65 -73
  34. package/dist/tools/plan-update-tool.test.cjs +203 -0
  35. package/dist/tools/plan-update-tool.test.js +171 -154
  36. package/dist/types.cjs +44 -0
  37. package/dist/types.js +17 -24
  38. package/package.json +8 -7
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var errors_exports = {};
20
+ __export(errors_exports, {
21
+ PlanError: () => PlanError,
22
+ PlanErrorCode: () => PlanErrorCode
23
+ });
24
+ module.exports = __toCommonJS(errors_exports);
25
+ var import_core = require("@dexto/core");
26
+ const PlanErrorCode = {
27
+ /** Plan already exists for session */
28
+ PLAN_ALREADY_EXISTS: "PLAN_ALREADY_EXISTS",
29
+ /** Plan not found for session */
30
+ PLAN_NOT_FOUND: "PLAN_NOT_FOUND",
31
+ /** Invalid plan content */
32
+ INVALID_PLAN_CONTENT: "INVALID_PLAN_CONTENT",
33
+ /** Session ID required */
34
+ SESSION_ID_REQUIRED: "SESSION_ID_REQUIRED",
35
+ /** Invalid session ID (path traversal attempt) */
36
+ INVALID_SESSION_ID: "INVALID_SESSION_ID",
37
+ /** Checkpoint not found */
38
+ CHECKPOINT_NOT_FOUND: "CHECKPOINT_NOT_FOUND",
39
+ /** Storage operation failed */
40
+ STORAGE_ERROR: "STORAGE_ERROR"
41
+ };
42
+ const PlanError = {
43
+ /**
44
+ * Plan already exists for the given session
45
+ */
46
+ planAlreadyExists(sessionId) {
47
+ return new import_core.DextoRuntimeError(
48
+ PlanErrorCode.PLAN_ALREADY_EXISTS,
49
+ "plan",
50
+ import_core.ErrorType.USER,
51
+ `A plan already exists for session '${sessionId}'. Use plan_update to modify it.`,
52
+ { sessionId },
53
+ "Use plan_update to modify the existing plan, or plan_read to view it."
54
+ );
55
+ },
56
+ /**
57
+ * Plan not found for the given session
58
+ */
59
+ planNotFound(sessionId) {
60
+ return new import_core.DextoRuntimeError(
61
+ PlanErrorCode.PLAN_NOT_FOUND,
62
+ "plan",
63
+ import_core.ErrorType.NOT_FOUND,
64
+ `No plan found for session '${sessionId}'.`,
65
+ { sessionId },
66
+ "Use plan_create to create a new plan for this session."
67
+ );
68
+ },
69
+ /**
70
+ * Session ID is required for plan operations
71
+ */
72
+ sessionIdRequired() {
73
+ return new import_core.DextoRuntimeError(
74
+ PlanErrorCode.SESSION_ID_REQUIRED,
75
+ "plan",
76
+ import_core.ErrorType.USER,
77
+ "Session ID is required for plan operations.",
78
+ {},
79
+ "Ensure the tool is called within a valid session context."
80
+ );
81
+ },
82
+ /**
83
+ * Invalid session ID (path traversal attempt)
84
+ */
85
+ invalidSessionId(sessionId) {
86
+ return new import_core.DextoRuntimeError(
87
+ PlanErrorCode.INVALID_SESSION_ID,
88
+ "plan",
89
+ import_core.ErrorType.USER,
90
+ `Invalid session ID: '${sessionId}' contains invalid path characters.`,
91
+ { sessionId },
92
+ 'Session IDs must not contain path traversal characters like "..".'
93
+ );
94
+ },
95
+ /**
96
+ * Checkpoint not found in plan
97
+ */
98
+ checkpointNotFound(checkpointId, sessionId) {
99
+ return new import_core.DextoRuntimeError(
100
+ PlanErrorCode.CHECKPOINT_NOT_FOUND,
101
+ "plan",
102
+ import_core.ErrorType.NOT_FOUND,
103
+ `Checkpoint '${checkpointId}' not found in plan for session '${sessionId}'.`,
104
+ { checkpointId, sessionId },
105
+ "Use plan_read to view available checkpoints."
106
+ );
107
+ },
108
+ /**
109
+ * Storage operation failed
110
+ */
111
+ storageError(operation, sessionId, cause) {
112
+ return new import_core.DextoRuntimeError(
113
+ PlanErrorCode.STORAGE_ERROR,
114
+ "plan",
115
+ import_core.ErrorType.SYSTEM,
116
+ `Failed to ${operation} plan for session '${sessionId}': ${cause?.message || "unknown error"}`,
117
+ { operation, sessionId, cause: cause?.message },
118
+ "Check file system permissions and try again."
119
+ );
120
+ }
121
+ };
122
+ // Annotate the CommonJS export names for ESM import in node:
123
+ 0 && (module.exports = {
124
+ PlanError,
125
+ PlanErrorCode
126
+ });
package/dist/errors.js CHANGED
@@ -1,66 +1,101 @@
1
- /**
2
- * Plan Error Factory
3
- *
4
- * Provides typed errors for plan operations following the DextoRuntimeError pattern.
5
- */
6
- import { DextoRuntimeError, ErrorType } from '@dexto/core';
7
- /**
8
- * Error codes for plan operations
9
- */
10
- export const PlanErrorCode = {
11
- /** Plan already exists for session */
12
- PLAN_ALREADY_EXISTS: 'PLAN_ALREADY_EXISTS',
13
- /** Plan not found for session */
14
- PLAN_NOT_FOUND: 'PLAN_NOT_FOUND',
15
- /** Invalid plan content */
16
- INVALID_PLAN_CONTENT: 'INVALID_PLAN_CONTENT',
17
- /** Session ID required */
18
- SESSION_ID_REQUIRED: 'SESSION_ID_REQUIRED',
19
- /** Invalid session ID (path traversal attempt) */
20
- INVALID_SESSION_ID: 'INVALID_SESSION_ID',
21
- /** Checkpoint not found */
22
- CHECKPOINT_NOT_FOUND: 'CHECKPOINT_NOT_FOUND',
23
- /** Storage operation failed */
24
- STORAGE_ERROR: 'STORAGE_ERROR',
1
+ import { DextoRuntimeError, ErrorType } from "@dexto/core";
2
+ const PlanErrorCode = {
3
+ /** Plan already exists for session */
4
+ PLAN_ALREADY_EXISTS: "PLAN_ALREADY_EXISTS",
5
+ /** Plan not found for session */
6
+ PLAN_NOT_FOUND: "PLAN_NOT_FOUND",
7
+ /** Invalid plan content */
8
+ INVALID_PLAN_CONTENT: "INVALID_PLAN_CONTENT",
9
+ /** Session ID required */
10
+ SESSION_ID_REQUIRED: "SESSION_ID_REQUIRED",
11
+ /** Invalid session ID (path traversal attempt) */
12
+ INVALID_SESSION_ID: "INVALID_SESSION_ID",
13
+ /** Checkpoint not found */
14
+ CHECKPOINT_NOT_FOUND: "CHECKPOINT_NOT_FOUND",
15
+ /** Storage operation failed */
16
+ STORAGE_ERROR: "STORAGE_ERROR"
25
17
  };
26
- /**
27
- * Error factory for plan operations
28
- */
29
- export const PlanError = {
30
- /**
31
- * Plan already exists for the given session
32
- */
33
- planAlreadyExists(sessionId) {
34
- return new DextoRuntimeError(PlanErrorCode.PLAN_ALREADY_EXISTS, 'plan', ErrorType.USER, `A plan already exists for session '${sessionId}'. Use plan_update to modify it.`, { sessionId }, 'Use plan_update to modify the existing plan, or plan_read to view it.');
35
- },
36
- /**
37
- * Plan not found for the given session
38
- */
39
- planNotFound(sessionId) {
40
- return new DextoRuntimeError(PlanErrorCode.PLAN_NOT_FOUND, 'plan', ErrorType.NOT_FOUND, `No plan found for session '${sessionId}'.`, { sessionId }, 'Use plan_create to create a new plan for this session.');
41
- },
42
- /**
43
- * Session ID is required for plan operations
44
- */
45
- sessionIdRequired() {
46
- return new DextoRuntimeError(PlanErrorCode.SESSION_ID_REQUIRED, 'plan', ErrorType.USER, 'Session ID is required for plan operations.', {}, 'Ensure the tool is called within a valid session context.');
47
- },
48
- /**
49
- * Invalid session ID (path traversal attempt)
50
- */
51
- invalidSessionId(sessionId) {
52
- return new DextoRuntimeError(PlanErrorCode.INVALID_SESSION_ID, 'plan', ErrorType.USER, `Invalid session ID: '${sessionId}' contains invalid path characters.`, { sessionId }, 'Session IDs must not contain path traversal characters like "..".');
53
- },
54
- /**
55
- * Checkpoint not found in plan
56
- */
57
- checkpointNotFound(checkpointId, sessionId) {
58
- return new DextoRuntimeError(PlanErrorCode.CHECKPOINT_NOT_FOUND, 'plan', ErrorType.NOT_FOUND, `Checkpoint '${checkpointId}' not found in plan for session '${sessionId}'.`, { checkpointId, sessionId }, 'Use plan_read to view available checkpoints.');
59
- },
60
- /**
61
- * Storage operation failed
62
- */
63
- storageError(operation, sessionId, cause) {
64
- return new DextoRuntimeError(PlanErrorCode.STORAGE_ERROR, 'plan', ErrorType.SYSTEM, `Failed to ${operation} plan for session '${sessionId}': ${cause?.message || 'unknown error'}`, { operation, sessionId, cause: cause?.message }, 'Check file system permissions and try again.');
65
- },
18
+ const PlanError = {
19
+ /**
20
+ * Plan already exists for the given session
21
+ */
22
+ planAlreadyExists(sessionId) {
23
+ return new DextoRuntimeError(
24
+ PlanErrorCode.PLAN_ALREADY_EXISTS,
25
+ "plan",
26
+ ErrorType.USER,
27
+ `A plan already exists for session '${sessionId}'. Use plan_update to modify it.`,
28
+ { sessionId },
29
+ "Use plan_update to modify the existing plan, or plan_read to view it."
30
+ );
31
+ },
32
+ /**
33
+ * Plan not found for the given session
34
+ */
35
+ planNotFound(sessionId) {
36
+ return new DextoRuntimeError(
37
+ PlanErrorCode.PLAN_NOT_FOUND,
38
+ "plan",
39
+ ErrorType.NOT_FOUND,
40
+ `No plan found for session '${sessionId}'.`,
41
+ { sessionId },
42
+ "Use plan_create to create a new plan for this session."
43
+ );
44
+ },
45
+ /**
46
+ * Session ID is required for plan operations
47
+ */
48
+ sessionIdRequired() {
49
+ return new DextoRuntimeError(
50
+ PlanErrorCode.SESSION_ID_REQUIRED,
51
+ "plan",
52
+ ErrorType.USER,
53
+ "Session ID is required for plan operations.",
54
+ {},
55
+ "Ensure the tool is called within a valid session context."
56
+ );
57
+ },
58
+ /**
59
+ * Invalid session ID (path traversal attempt)
60
+ */
61
+ invalidSessionId(sessionId) {
62
+ return new DextoRuntimeError(
63
+ PlanErrorCode.INVALID_SESSION_ID,
64
+ "plan",
65
+ ErrorType.USER,
66
+ `Invalid session ID: '${sessionId}' contains invalid path characters.`,
67
+ { sessionId },
68
+ 'Session IDs must not contain path traversal characters like "..".'
69
+ );
70
+ },
71
+ /**
72
+ * Checkpoint not found in plan
73
+ */
74
+ checkpointNotFound(checkpointId, sessionId) {
75
+ return new DextoRuntimeError(
76
+ PlanErrorCode.CHECKPOINT_NOT_FOUND,
77
+ "plan",
78
+ ErrorType.NOT_FOUND,
79
+ `Checkpoint '${checkpointId}' not found in plan for session '${sessionId}'.`,
80
+ { checkpointId, sessionId },
81
+ "Use plan_read to view available checkpoints."
82
+ );
83
+ },
84
+ /**
85
+ * Storage operation failed
86
+ */
87
+ storageError(operation, sessionId, cause) {
88
+ return new DextoRuntimeError(
89
+ PlanErrorCode.STORAGE_ERROR,
90
+ "plan",
91
+ ErrorType.SYSTEM,
92
+ `Failed to ${operation} plan for session '${sessionId}': ${cause?.message || "unknown error"}`,
93
+ { operation, sessionId, cause: cause?.message },
94
+ "Check file system permissions and try again."
95
+ );
96
+ }
97
+ };
98
+ export {
99
+ PlanError,
100
+ PlanErrorCode
66
101
  };
package/dist/index.cjs ADDED
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var index_exports = {};
20
+ __export(index_exports, {
21
+ PlanError: () => import_errors.PlanError,
22
+ PlanErrorCode: () => import_errors.PlanErrorCode,
23
+ PlanService: () => import_plan_service.PlanService,
24
+ planToolsFactory: () => import_tool_factory.planToolsFactory
25
+ });
26
+ module.exports = __toCommonJS(index_exports);
27
+ var import_tool_factory = require("./tool-factory.js");
28
+ var import_plan_service = require("./plan-service.js");
29
+ var import_errors = require("./errors.js");
30
+ // Annotate the CommonJS export names for ESM import in node:
31
+ 0 && (module.exports = {
32
+ PlanError,
33
+ PlanErrorCode,
34
+ PlanService,
35
+ planToolsFactory
36
+ });
@@ -0,0 +1,224 @@
1
+ import { ToolFactory } from '@dexto/agent-config';
2
+ import { z } from 'zod';
3
+ import { Logger, DextoRuntimeError } from '@dexto/core';
4
+
5
+ /**
6
+ * Plan Tools Factory
7
+ *
8
+ * Provides implementation planning tools:
9
+ * - plan_create: Create a new plan for the session
10
+ * - plan_read: Read the current plan
11
+ * - plan_update: Update the existing plan
12
+ * - plan_review: Request user review of the plan (shows plan content with approval options)
13
+ */
14
+
15
+ /**
16
+ * Configuration schema for Plan tools factory
17
+ */
18
+ declare const PlanToolsConfigSchema: z.ZodObject<{
19
+ type: z.ZodLiteral<"plan-tools">;
20
+ basePath: z.ZodDefault<z.ZodString>;
21
+ enabledTools: z.ZodOptional<z.ZodArray<z.ZodEnum<["plan_create", "plan_read", "plan_update", "plan_review"]>, "many">>;
22
+ }, "strict", z.ZodTypeAny, {
23
+ type: "plan-tools";
24
+ basePath: string;
25
+ enabledTools?: ("plan_create" | "plan_read" | "plan_update" | "plan_review")[] | undefined;
26
+ }, {
27
+ type: "plan-tools";
28
+ basePath?: string | undefined;
29
+ enabledTools?: ("plan_create" | "plan_read" | "plan_update" | "plan_review")[] | undefined;
30
+ }>;
31
+ type PlanToolsConfig = z.output<typeof PlanToolsConfigSchema>;
32
+
33
+ declare const planToolsFactory: ToolFactory<PlanToolsConfig>;
34
+
35
+ /**
36
+ * Plan Types and Schemas
37
+ *
38
+ * Defines the structure of plans and their metadata.
39
+ */
40
+
41
+ /**
42
+ * Plan status values
43
+ */
44
+ declare const PlanStatusSchema: z.ZodEnum<["draft", "approved", "in_progress", "completed", "abandoned"]>;
45
+ type PlanStatus = z.infer<typeof PlanStatusSchema>;
46
+ /**
47
+ * Plan metadata stored alongside the plan content
48
+ */
49
+ declare const PlanMetaSchema: z.ZodObject<{
50
+ sessionId: z.ZodString;
51
+ status: z.ZodDefault<z.ZodEnum<["draft", "approved", "in_progress", "completed", "abandoned"]>>;
52
+ title: z.ZodOptional<z.ZodString>;
53
+ createdAt: z.ZodNumber;
54
+ updatedAt: z.ZodNumber;
55
+ }, "strip", z.ZodTypeAny, {
56
+ status: "draft" | "approved" | "in_progress" | "completed" | "abandoned";
57
+ sessionId: string;
58
+ createdAt: number;
59
+ updatedAt: number;
60
+ title?: string | undefined;
61
+ }, {
62
+ sessionId: string;
63
+ createdAt: number;
64
+ updatedAt: number;
65
+ status?: "draft" | "approved" | "in_progress" | "completed" | "abandoned" | undefined;
66
+ title?: string | undefined;
67
+ }>;
68
+ type PlanMeta = z.infer<typeof PlanMetaSchema>;
69
+ /**
70
+ * Complete plan with content and metadata
71
+ */
72
+ interface Plan {
73
+ content: string;
74
+ meta: PlanMeta;
75
+ }
76
+ /**
77
+ * Options for the plan service
78
+ */
79
+ interface PlanServiceOptions {
80
+ /** Base directory for plan storage */
81
+ basePath: string;
82
+ }
83
+ /**
84
+ * Result of a plan update operation
85
+ */
86
+ interface PlanUpdateResult {
87
+ oldContent: string;
88
+ newContent: string;
89
+ meta: PlanMeta;
90
+ }
91
+
92
+ /**
93
+ * Plan Service
94
+ *
95
+ * Handles storage and retrieval of implementation plans.
96
+ * Plans are stored in .dexto/plans/{sessionId}/ with:
97
+ * - plan.md: The plan content
98
+ * - plan-meta.json: Metadata (status, checkpoints, timestamps)
99
+ */
100
+
101
+ /**
102
+ * Service for managing implementation plans.
103
+ */
104
+ declare class PlanService {
105
+ private basePath;
106
+ private logger;
107
+ constructor(options: PlanServiceOptions, logger: Logger);
108
+ /**
109
+ * Resolves and validates a session directory path.
110
+ * Prevents path traversal attacks by ensuring the resolved path stays within basePath.
111
+ */
112
+ private resolveSessionDir;
113
+ /**
114
+ * Gets the directory path for a session's plan
115
+ */
116
+ private getPlanDir;
117
+ /**
118
+ * Gets the path to the plan content file.
119
+ * Public accessor for tools that need to display the path.
120
+ */
121
+ getPlanPath(sessionId: string): string;
122
+ /**
123
+ * Gets the path to the plan metadata file
124
+ */
125
+ private getMetaPath;
126
+ /**
127
+ * Checks if a plan exists for the given session
128
+ */
129
+ exists(sessionId: string): Promise<boolean>;
130
+ /**
131
+ * Creates a new plan for the session
132
+ *
133
+ * @throws PlanError.planAlreadyExists if plan already exists
134
+ * @throws PlanError.storageError on filesystem errors
135
+ */
136
+ create(sessionId: string, content: string, options?: {
137
+ title?: string;
138
+ }): Promise<Plan>;
139
+ /**
140
+ * Reads the plan for the given session
141
+ *
142
+ * @returns The plan or null if not found
143
+ */
144
+ read(sessionId: string): Promise<Plan | null>;
145
+ /**
146
+ * Updates the plan content for the given session
147
+ *
148
+ * @throws PlanError.planNotFound if plan doesn't exist
149
+ * @throws PlanError.storageError on filesystem errors
150
+ */
151
+ update(sessionId: string, content: string): Promise<PlanUpdateResult>;
152
+ /**
153
+ * Updates the plan metadata (status, title)
154
+ *
155
+ * @throws PlanError.planNotFound if plan doesn't exist
156
+ * @throws PlanError.storageError on filesystem errors
157
+ */
158
+ updateMeta(sessionId: string, updates: Partial<Pick<PlanMeta, 'status' | 'title'>>): Promise<PlanMeta>;
159
+ /**
160
+ * Deletes the plan for the given session
161
+ *
162
+ * @throws PlanError.planNotFound if plan doesn't exist
163
+ * @throws PlanError.storageError on filesystem errors
164
+ */
165
+ delete(sessionId: string): Promise<void>;
166
+ }
167
+
168
+ /**
169
+ * Plan Error Factory
170
+ *
171
+ * Provides typed errors for plan operations following the DextoRuntimeError pattern.
172
+ */
173
+
174
+ /**
175
+ * Error codes for plan operations
176
+ */
177
+ declare const PlanErrorCode: {
178
+ /** Plan already exists for session */
179
+ readonly PLAN_ALREADY_EXISTS: "PLAN_ALREADY_EXISTS";
180
+ /** Plan not found for session */
181
+ readonly PLAN_NOT_FOUND: "PLAN_NOT_FOUND";
182
+ /** Invalid plan content */
183
+ readonly INVALID_PLAN_CONTENT: "INVALID_PLAN_CONTENT";
184
+ /** Session ID required */
185
+ readonly SESSION_ID_REQUIRED: "SESSION_ID_REQUIRED";
186
+ /** Invalid session ID (path traversal attempt) */
187
+ readonly INVALID_SESSION_ID: "INVALID_SESSION_ID";
188
+ /** Checkpoint not found */
189
+ readonly CHECKPOINT_NOT_FOUND: "CHECKPOINT_NOT_FOUND";
190
+ /** Storage operation failed */
191
+ readonly STORAGE_ERROR: "STORAGE_ERROR";
192
+ };
193
+ type PlanErrorCodeType = (typeof PlanErrorCode)[keyof typeof PlanErrorCode];
194
+ /**
195
+ * Error factory for plan operations
196
+ */
197
+ declare const PlanError: {
198
+ /**
199
+ * Plan already exists for the given session
200
+ */
201
+ planAlreadyExists(sessionId: string): DextoRuntimeError;
202
+ /**
203
+ * Plan not found for the given session
204
+ */
205
+ planNotFound(sessionId: string): DextoRuntimeError;
206
+ /**
207
+ * Session ID is required for plan operations
208
+ */
209
+ sessionIdRequired(): DextoRuntimeError;
210
+ /**
211
+ * Invalid session ID (path traversal attempt)
212
+ */
213
+ invalidSessionId(sessionId: string): DextoRuntimeError;
214
+ /**
215
+ * Checkpoint not found in plan
216
+ */
217
+ checkpointNotFound(checkpointId: string, sessionId: string): DextoRuntimeError;
218
+ /**
219
+ * Storage operation failed
220
+ */
221
+ storageError(operation: string, sessionId: string, cause?: Error): DextoRuntimeError;
222
+ };
223
+
224
+ export { type Plan, PlanError, PlanErrorCode, type PlanErrorCodeType, type PlanMeta, PlanService, type PlanServiceOptions, type PlanStatus, type PlanUpdateResult, planToolsFactory };
package/dist/index.js CHANGED
@@ -1,12 +1,9 @@
1
- /**
2
- * @dexto/tools-plan
3
- *
4
- * Implementation planning tools with session-linked plans.
5
- * Provides tools for creating, reading, updating, and tracking plans.
6
- */
7
- // Tool factory (image-compatible)
8
- export { planToolsFactory } from './tool-factory.js';
9
- // Service (for advanced use cases)
10
- export { PlanService } from './plan-service.js';
11
- // Error utilities
12
- export { PlanError, PlanErrorCode } from './errors.js';
1
+ import { planToolsFactory } from "./tool-factory.js";
2
+ import { PlanService } from "./plan-service.js";
3
+ import { PlanError, PlanErrorCode } from "./errors.js";
4
+ export {
5
+ PlanError,
6
+ PlanErrorCode,
7
+ PlanService,
8
+ planToolsFactory
9
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var plan_service_getter_exports = {};
16
+ module.exports = __toCommonJS(plan_service_getter_exports);
@@ -1 +0,0 @@
1
- export {};