toolcraft 0.0.164 → 0.0.165
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/composition.json +3 -3
- package/dist/composition.json +3 -3
- package/node_modules/@poe-code/config-mutations/dist/execution/apply-mutation.js +1 -3
- package/node_modules/@poe-code/config-mutations/dist/formats/json.js +1 -3
- package/node_modules/@poe-code/config-mutations/dist/formats/toml.js +1 -3
- package/node_modules/@poe-code/config-mutations/dist/formats/yaml.js +1 -3
- package/node_modules/@poe-code/config-mutations/dist/types.js +1 -1
- package/node_modules/@poe-code/task-list/dist/backends/utils.js +32 -37
- package/node_modules/@poe-code/task-list/dist/types.d.ts +1 -0
- package/node_modules/auth-store/dist/provider-store.js +3 -0
- package/node_modules/tiny-http-mcp-server/dist/composition.json +1 -1
- package/node_modules/tiny-http-mcp-server/package.json +1 -1
- package/node_modules/tiny-stdio-mcp-server/dist/composition.json +1 -1
- package/node_modules/toolcraft-design/dist/prompts/interactive/core.d.ts +1 -1
- package/node_modules/toolcraft-design/dist/prompts/interactive/core.js +9 -0
- package/node_modules/toolcraft-schema/package.json +1 -1
- package/package.json +2 -2
package/composition.json
CHANGED
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
100
|
"name": "tiny-http-mcp-server",
|
|
101
|
-
"version": "0.1.
|
|
101
|
+
"version": "0.1.8",
|
|
102
102
|
"license": "MIT"
|
|
103
103
|
},
|
|
104
104
|
{
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
"name": "toolcraft",
|
|
116
|
-
"version": "0.0.
|
|
116
|
+
"version": "0.0.165",
|
|
117
117
|
"license": "MIT"
|
|
118
118
|
},
|
|
119
119
|
{
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
},
|
|
124
124
|
{
|
|
125
125
|
"name": "toolcraft-schema",
|
|
126
|
-
"version": "0.0.
|
|
126
|
+
"version": "0.0.165",
|
|
127
127
|
"license": "MIT"
|
|
128
128
|
},
|
|
129
129
|
{
|
package/dist/composition.json
CHANGED
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
100
|
"name": "tiny-http-mcp-server",
|
|
101
|
-
"version": "0.1.
|
|
101
|
+
"version": "0.1.8",
|
|
102
102
|
"license": "MIT"
|
|
103
103
|
},
|
|
104
104
|
{
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
"name": "toolcraft",
|
|
116
|
-
"version": "0.0.
|
|
116
|
+
"version": "0.0.165",
|
|
117
117
|
"license": "MIT"
|
|
118
118
|
},
|
|
119
119
|
{
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
},
|
|
124
124
|
{
|
|
125
125
|
"name": "toolcraft-schema",
|
|
126
|
-
"version": "0.0.
|
|
126
|
+
"version": "0.0.165",
|
|
127
127
|
"license": "MIT"
|
|
128
128
|
},
|
|
129
129
|
{
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { renderTemplate } from "toolcraft-design";
|
|
4
|
+
import { isConfigObject } from "../types.js";
|
|
4
5
|
import { getConfigFormat, detectFormat } from "../formats/index.js";
|
|
5
6
|
import { cloneConfigObject, setConfigEntry } from "../formats/object.js";
|
|
6
7
|
import { resolvePath } from "./path-utils.js";
|
|
@@ -187,9 +188,6 @@ function pruneKeysByPrefix(table, prefix) {
|
|
|
187
188
|
}
|
|
188
189
|
return result;
|
|
189
190
|
}
|
|
190
|
-
function isConfigObject(value) {
|
|
191
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
192
|
-
}
|
|
193
191
|
function mergeWithPruneByPrefix(base, patch, pruneByPrefix) {
|
|
194
192
|
const result = cloneConfigObject(base);
|
|
195
193
|
const prefixMap = pruneByPrefix ?? {};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import * as jsonc from "jsonc-parser";
|
|
2
|
+
import { isConfigObject } from "../types.js";
|
|
2
3
|
import { cloneConfigObject, hasConfigEntry, setConfigEntry } from "./object.js";
|
|
3
|
-
function isConfigObject(value) {
|
|
4
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5
|
-
}
|
|
6
4
|
function detectIndent(content) {
|
|
7
5
|
const match = content.match(/^[\t ]+/m);
|
|
8
6
|
if (match) {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { parse as parseToml, stringify as stringifyToml } from "smol-toml";
|
|
2
|
+
import { isConfigObject } from "../types.js";
|
|
2
3
|
import { cloneConfigObject, hasConfigEntry, setConfigEntry } from "./object.js";
|
|
3
|
-
function isConfigObject(value) {
|
|
4
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5
|
-
}
|
|
6
4
|
function parse(content) {
|
|
7
5
|
if (!content || content.trim() === "") {
|
|
8
6
|
return {};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
|
|
2
|
+
import { isConfigObject } from "../types.js";
|
|
2
3
|
import { cloneConfigObject, hasConfigEntry, setConfigEntry } from "./object.js";
|
|
3
|
-
function isConfigObject(value) {
|
|
4
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5
|
-
}
|
|
6
4
|
function parse(content) {
|
|
7
5
|
if (!content || content.trim() === "") {
|
|
8
6
|
return {};
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
// Config Object Types
|
|
3
3
|
// ============================================================================
|
|
4
4
|
export function isConfigObject(value) {
|
|
5
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5
|
+
return (typeof value === "object" && value !== null && !Array.isArray(value) && !(value instanceof Date));
|
|
6
6
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
const LOCK_WAIT_MS = 30_000;
|
|
4
|
+
const LOCK_RETRY_MS = 10;
|
|
3
5
|
export function compareCreated(left, right) {
|
|
4
6
|
const leftCreated = typeof left.raw.created === "string" ? left.raw.created : "";
|
|
5
7
|
const rightCreated = typeof right.raw.created === "string" ? right.raw.created : "";
|
|
@@ -10,7 +12,14 @@ export function compareCreated(left, right) {
|
|
|
10
12
|
return 1;
|
|
11
13
|
if (rightCreated === "")
|
|
12
14
|
return -1;
|
|
13
|
-
|
|
15
|
+
const leftTimestamp = Date.parse(leftCreated);
|
|
16
|
+
const rightTimestamp = Date.parse(rightCreated);
|
|
17
|
+
if (Number.isNaN(leftTimestamp)) {
|
|
18
|
+
return Number.isNaN(rightTimestamp) ? leftCreated.localeCompare(rightCreated) : 1;
|
|
19
|
+
}
|
|
20
|
+
if (Number.isNaN(rightTimestamp))
|
|
21
|
+
return -1;
|
|
22
|
+
return leftTimestamp - rightTimestamp;
|
|
14
23
|
}
|
|
15
24
|
export function applyOrder(entries, order) {
|
|
16
25
|
if (order === "alphabetical") {
|
|
@@ -123,62 +132,48 @@ export async function writeAtomically(fs, filePath, content) {
|
|
|
123
132
|
}
|
|
124
133
|
}
|
|
125
134
|
export async function withFileLock(fs, lockPath, operation) {
|
|
135
|
+
await rejectSymbolicLinkComponents(fs, lockPath);
|
|
126
136
|
await fs.mkdir(path.dirname(lockPath), { recursive: true });
|
|
137
|
+
const ownerPath = path.join(lockPath, `${process.pid}-${randomUUID()}`);
|
|
138
|
+
const deadline = Date.now() + LOCK_WAIT_MS;
|
|
127
139
|
for (;;) {
|
|
140
|
+
await rejectSymbolicLinkComponents(fs, lockPath);
|
|
128
141
|
try {
|
|
129
|
-
await fs.
|
|
142
|
+
await fs.mkdir(lockPath);
|
|
130
143
|
break;
|
|
131
144
|
}
|
|
132
145
|
catch (error) {
|
|
133
146
|
if (!hasErrorCode(error, "EEXIST")) {
|
|
134
|
-
await fs.unlink(lockPath).catch(() => undefined);
|
|
135
147
|
throw error;
|
|
136
148
|
}
|
|
137
|
-
if (
|
|
138
|
-
|
|
149
|
+
if (Date.now() >= deadline) {
|
|
150
|
+
throw new Error(`Timed out waiting for task-list lock: ${lockPath}. ` +
|
|
151
|
+
"An abandoned or legacy lock must only be removed after confirming all task-list operations have stopped.");
|
|
139
152
|
}
|
|
140
|
-
await Promise
|
|
153
|
+
await new Promise((done) => setTimeout(done, LOCK_RETRY_MS));
|
|
141
154
|
}
|
|
142
155
|
}
|
|
156
|
+
await rejectSymbolicLinkComponents(fs, ownerPath);
|
|
157
|
+
await fs.mkdir(ownerPath);
|
|
158
|
+
let outcome;
|
|
143
159
|
try {
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
finally {
|
|
147
|
-
await fs.unlink(lockPath);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
async function removeAbandonedLock(fs, lockPath) {
|
|
151
|
-
let content;
|
|
152
|
-
try {
|
|
153
|
-
content = await fs.readFile(lockPath, "utf8");
|
|
160
|
+
outcome = { result: await operation() };
|
|
154
161
|
}
|
|
155
162
|
catch (error) {
|
|
156
|
-
|
|
157
|
-
return true;
|
|
158
|
-
}
|
|
159
|
-
throw error;
|
|
160
|
-
}
|
|
161
|
-
const owner = Number(content);
|
|
162
|
-
if (Number.isInteger(owner) && owner > 0 && isProcessRunning(owner)) {
|
|
163
|
-
return false;
|
|
163
|
+
outcome = { error };
|
|
164
164
|
}
|
|
165
165
|
try {
|
|
166
|
-
await fs
|
|
167
|
-
|
|
166
|
+
await rejectSymbolicLinkComponents(fs, ownerPath);
|
|
167
|
+
await fs.rmdir(ownerPath);
|
|
168
|
+
await fs.rmdir(lockPath);
|
|
168
169
|
}
|
|
169
170
|
catch (error) {
|
|
170
|
-
if (
|
|
171
|
-
|
|
171
|
+
if ("error" in outcome) {
|
|
172
|
+
throw new AggregateError([outcome.error, error], "Task-list operation and lock release failed");
|
|
172
173
|
}
|
|
173
174
|
throw error;
|
|
174
175
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
process.kill(pid, 0);
|
|
179
|
-
return true;
|
|
180
|
-
}
|
|
181
|
-
catch (error) {
|
|
182
|
-
return !hasErrorCode(error, "ESRCH");
|
|
183
|
-
}
|
|
176
|
+
if ("error" in outcome)
|
|
177
|
+
throw outcome.error;
|
|
178
|
+
return outcome.result;
|
|
184
179
|
}
|
|
@@ -73,6 +73,7 @@ export interface TaskListFs {
|
|
|
73
73
|
readFile(path: string, encoding: BufferEncoding): Promise<string>;
|
|
74
74
|
readdir(path: string): Promise<string[]>;
|
|
75
75
|
rename(fromPath: string, toPath: string): Promise<void>;
|
|
76
|
+
rmdir(path: string): Promise<void>;
|
|
76
77
|
stat(path: string): Promise<{
|
|
77
78
|
isDirectory(): boolean;
|
|
78
79
|
isFile(): boolean;
|
|
@@ -48,7 +48,7 @@ export declare class Prompt<Value> extends EventEmitter {
|
|
|
48
48
|
get cursor(): number;
|
|
49
49
|
prompt(): Promise<Value | typeof CANCEL>;
|
|
50
50
|
protected promptNonTty(): Promise<Value | typeof CANCEL>;
|
|
51
|
-
protected readNonTtyLine(): Promise<string>;
|
|
51
|
+
protected readNonTtyLine(): Promise<string | typeof CANCEL>;
|
|
52
52
|
protected setValue(value: Value | undefined): void;
|
|
53
53
|
protected setError(message: string): void;
|
|
54
54
|
protected setUserInput(value: string): void;
|
|
@@ -117,11 +117,20 @@ export class Prompt extends EventEmitter {
|
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
119
119
|
settled = true;
|
|
120
|
+
this.signal?.removeEventListener("abort", onAbort);
|
|
120
121
|
rl.close();
|
|
121
122
|
resolve(value);
|
|
122
123
|
};
|
|
124
|
+
const onAbort = () => {
|
|
125
|
+
this.state = "cancel";
|
|
126
|
+
settle(CANCEL);
|
|
127
|
+
};
|
|
123
128
|
rl.once("line", settle);
|
|
124
129
|
rl.once("close", () => settle(rl.line));
|
|
130
|
+
this.signal?.addEventListener("abort", onAbort, { once: true });
|
|
131
|
+
if (this.signal?.aborted) {
|
|
132
|
+
onAbort();
|
|
133
|
+
}
|
|
125
134
|
});
|
|
126
135
|
}
|
|
127
136
|
setValue(value) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "toolcraft",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.165",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
"yaml"
|
|
159
159
|
],
|
|
160
160
|
"optionalDependencies": {
|
|
161
|
-
"toolcraft-schema": "0.0.
|
|
161
|
+
"toolcraft-schema": "0.0.165",
|
|
162
162
|
"toolcraft-design": "*",
|
|
163
163
|
"@poe-code/frontmatter": "*",
|
|
164
164
|
"@poe-code/agent-mcp-config": "*",
|