@codelia/runtime 0.1.34 → 0.1.35
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/index.cjs +33 -26
- package/dist/index.js +33 -26
- package/package.json +9 -9
package/dist/index.cjs
CHANGED
|
@@ -5150,24 +5150,10 @@ var getTodoStats = (todos) => ({
|
|
|
5150
5150
|
inProgress: todos.filter((todo) => todo.status === "in_progress").length,
|
|
5151
5151
|
completed: todos.filter((todo) => todo.status === "completed").length
|
|
5152
5152
|
});
|
|
5153
|
-
var statusOrder = {
|
|
5154
|
-
in_progress: 0,
|
|
5155
|
-
pending: 1,
|
|
5156
|
-
completed: 2
|
|
5157
|
-
};
|
|
5158
|
-
var sortTodosForDisplay = (todos) => todos.map((todo, index) => ({ todo, index })).sort((a, b) => {
|
|
5159
|
-
const statusDiff = statusOrder[a.todo.status] - statusOrder[b.todo.status];
|
|
5160
|
-
if (statusDiff !== 0) return statusDiff;
|
|
5161
|
-
const priorityDiff = a.todo.priority - b.todo.priority;
|
|
5162
|
-
if (priorityDiff !== 0) return priorityDiff;
|
|
5163
|
-
return a.index - b.index;
|
|
5164
|
-
}).map((entry) => entry.todo);
|
|
5165
5153
|
var pickNextTodo = (todos) => {
|
|
5166
5154
|
const inProgress = todos.find((todo) => todo.status === "in_progress");
|
|
5167
5155
|
if (inProgress) return inProgress;
|
|
5168
|
-
const pending =
|
|
5169
|
-
(todo) => todo.status === "pending"
|
|
5170
|
-
);
|
|
5156
|
+
const pending = todos.find((todo) => todo.status === "pending");
|
|
5171
5157
|
return pending ?? null;
|
|
5172
5158
|
};
|
|
5173
5159
|
var todoStore = /* @__PURE__ */ new Map();
|
|
@@ -5188,28 +5174,25 @@ var createTodoReadTool = (sandboxKey, sessionContextKey) => (0, import_core14.de
|
|
|
5188
5174
|
const todoSessionId = sessionContext?.sessionId && sessionContext.sessionId.length > 0 ? sessionContext.sessionId : sandbox.sessionId;
|
|
5189
5175
|
const todos = getTodosForSession(todoSessionId);
|
|
5190
5176
|
if (!todos.length) return "Todo list is empty";
|
|
5191
|
-
const
|
|
5177
|
+
const displayedTodos = [...todos];
|
|
5192
5178
|
const lines = ["Todo plan:"];
|
|
5193
|
-
for (const [index, todo] of
|
|
5179
|
+
for (const [index, todo] of displayedTodos.entries()) {
|
|
5194
5180
|
const label = todo.status === "in_progress" && todo.activeForm ? todo.activeForm : todo.content;
|
|
5195
5181
|
lines.push(
|
|
5196
5182
|
`${index + 1}. ${statusSymbol[todo.status]} [${todo.id}] (p${todo.priority}) ${label}`
|
|
5197
5183
|
);
|
|
5198
|
-
if (todo.notes) {
|
|
5199
|
-
lines.push(` note: ${todo.notes}`);
|
|
5200
|
-
}
|
|
5201
5184
|
}
|
|
5202
|
-
const stats = getTodoStats(
|
|
5203
|
-
const nextTodo = pickNextTodo(
|
|
5185
|
+
const stats = getTodoStats(displayedTodos);
|
|
5186
|
+
const nextTodo = pickNextTodo(displayedTodos);
|
|
5204
5187
|
lines.push(
|
|
5205
5188
|
`Summary: ${stats.pending} pending, ${stats.inProgress} in progress, ${stats.completed} completed`
|
|
5206
5189
|
);
|
|
5207
5190
|
if (nextTodo) {
|
|
5208
|
-
lines.push(`Next: [${nextTodo.id}]
|
|
5191
|
+
lines.push(`Next: [${nextTodo.id}]`);
|
|
5209
5192
|
} else {
|
|
5210
5193
|
lines.push("Next: none");
|
|
5211
5194
|
}
|
|
5212
|
-
const inProgressCount = countInProgressTodos(
|
|
5195
|
+
const inProgressCount = countInProgressTodos(displayedTodos);
|
|
5213
5196
|
if (inProgressCount > 1) {
|
|
5214
5197
|
lines.push(
|
|
5215
5198
|
`Warning: ${inProgressCount} items are in_progress (expected at most 1).`
|
|
@@ -5297,12 +5280,36 @@ var todoWriteInputSchema = import_zod14.z.object({
|
|
|
5297
5280
|
});
|
|
5298
5281
|
}
|
|
5299
5282
|
});
|
|
5283
|
+
var statusSymbol2 = {
|
|
5284
|
+
pending: "[ ]",
|
|
5285
|
+
in_progress: "[>]",
|
|
5286
|
+
completed: "[x]"
|
|
5287
|
+
};
|
|
5300
5288
|
var loadSessionTodos = (sessionId) => getTodosForSession(sessionId);
|
|
5301
5289
|
var formatSuccess = (mode, todos) => {
|
|
5302
5290
|
const stats = getTodoStats(todos);
|
|
5303
5291
|
const nextTodo = pickNextTodo(todos);
|
|
5304
|
-
const nextHint = nextTodo ? ` Next: [${nextTodo.id}]
|
|
5305
|
-
|
|
5292
|
+
const nextHint = nextTodo ? ` Next: [${nextTodo.id}].` : " Next: none.";
|
|
5293
|
+
const summary = `Updated todos (${mode}): ${stats.pending} pending, ${stats.inProgress} in progress, ${stats.completed} completed.${nextHint}`;
|
|
5294
|
+
if (todos.length === 0) {
|
|
5295
|
+
return summary;
|
|
5296
|
+
}
|
|
5297
|
+
const lines = [summary, "Todo plan:"];
|
|
5298
|
+
for (const [index, todo] of todos.entries()) {
|
|
5299
|
+
const label = todo.status === "in_progress" && todo.activeForm ? todo.activeForm : todo.content;
|
|
5300
|
+
lines.push(
|
|
5301
|
+
`${index + 1}. ${statusSymbol2[todo.status]} [${todo.id}] (p${todo.priority}) ${label}`
|
|
5302
|
+
);
|
|
5303
|
+
}
|
|
5304
|
+
lines.push(
|
|
5305
|
+
`Summary: ${stats.pending} pending, ${stats.inProgress} in progress, ${stats.completed} completed`
|
|
5306
|
+
);
|
|
5307
|
+
if (nextTodo) {
|
|
5308
|
+
lines.push(`Next: [${nextTodo.id}]`);
|
|
5309
|
+
} else {
|
|
5310
|
+
lines.push("Next: none");
|
|
5311
|
+
}
|
|
5312
|
+
return lines.join("\n");
|
|
5306
5313
|
};
|
|
5307
5314
|
var withPatchApplied = (currentTodos, updates) => {
|
|
5308
5315
|
const normalizedUpdates = updates.map((update) => ({
|
package/dist/index.js
CHANGED
|
@@ -5149,24 +5149,10 @@ var getTodoStats = (todos) => ({
|
|
|
5149
5149
|
inProgress: todos.filter((todo) => todo.status === "in_progress").length,
|
|
5150
5150
|
completed: todos.filter((todo) => todo.status === "completed").length
|
|
5151
5151
|
});
|
|
5152
|
-
var statusOrder = {
|
|
5153
|
-
in_progress: 0,
|
|
5154
|
-
pending: 1,
|
|
5155
|
-
completed: 2
|
|
5156
|
-
};
|
|
5157
|
-
var sortTodosForDisplay = (todos) => todos.map((todo, index) => ({ todo, index })).sort((a, b) => {
|
|
5158
|
-
const statusDiff = statusOrder[a.todo.status] - statusOrder[b.todo.status];
|
|
5159
|
-
if (statusDiff !== 0) return statusDiff;
|
|
5160
|
-
const priorityDiff = a.todo.priority - b.todo.priority;
|
|
5161
|
-
if (priorityDiff !== 0) return priorityDiff;
|
|
5162
|
-
return a.index - b.index;
|
|
5163
|
-
}).map((entry) => entry.todo);
|
|
5164
5152
|
var pickNextTodo = (todos) => {
|
|
5165
5153
|
const inProgress = todos.find((todo) => todo.status === "in_progress");
|
|
5166
5154
|
if (inProgress) return inProgress;
|
|
5167
|
-
const pending =
|
|
5168
|
-
(todo) => todo.status === "pending"
|
|
5169
|
-
);
|
|
5155
|
+
const pending = todos.find((todo) => todo.status === "pending");
|
|
5170
5156
|
return pending ?? null;
|
|
5171
5157
|
};
|
|
5172
5158
|
var todoStore = /* @__PURE__ */ new Map();
|
|
@@ -5187,28 +5173,25 @@ var createTodoReadTool = (sandboxKey, sessionContextKey) => defineTool12({
|
|
|
5187
5173
|
const todoSessionId = sessionContext?.sessionId && sessionContext.sessionId.length > 0 ? sessionContext.sessionId : sandbox.sessionId;
|
|
5188
5174
|
const todos = getTodosForSession(todoSessionId);
|
|
5189
5175
|
if (!todos.length) return "Todo list is empty";
|
|
5190
|
-
const
|
|
5176
|
+
const displayedTodos = [...todos];
|
|
5191
5177
|
const lines = ["Todo plan:"];
|
|
5192
|
-
for (const [index, todo] of
|
|
5178
|
+
for (const [index, todo] of displayedTodos.entries()) {
|
|
5193
5179
|
const label = todo.status === "in_progress" && todo.activeForm ? todo.activeForm : todo.content;
|
|
5194
5180
|
lines.push(
|
|
5195
5181
|
`${index + 1}. ${statusSymbol[todo.status]} [${todo.id}] (p${todo.priority}) ${label}`
|
|
5196
5182
|
);
|
|
5197
|
-
if (todo.notes) {
|
|
5198
|
-
lines.push(` note: ${todo.notes}`);
|
|
5199
|
-
}
|
|
5200
5183
|
}
|
|
5201
|
-
const stats = getTodoStats(
|
|
5202
|
-
const nextTodo = pickNextTodo(
|
|
5184
|
+
const stats = getTodoStats(displayedTodos);
|
|
5185
|
+
const nextTodo = pickNextTodo(displayedTodos);
|
|
5203
5186
|
lines.push(
|
|
5204
5187
|
`Summary: ${stats.pending} pending, ${stats.inProgress} in progress, ${stats.completed} completed`
|
|
5205
5188
|
);
|
|
5206
5189
|
if (nextTodo) {
|
|
5207
|
-
lines.push(`Next: [${nextTodo.id}]
|
|
5190
|
+
lines.push(`Next: [${nextTodo.id}]`);
|
|
5208
5191
|
} else {
|
|
5209
5192
|
lines.push("Next: none");
|
|
5210
5193
|
}
|
|
5211
|
-
const inProgressCount = countInProgressTodos(
|
|
5194
|
+
const inProgressCount = countInProgressTodos(displayedTodos);
|
|
5212
5195
|
if (inProgressCount > 1) {
|
|
5213
5196
|
lines.push(
|
|
5214
5197
|
`Warning: ${inProgressCount} items are in_progress (expected at most 1).`
|
|
@@ -5296,12 +5279,36 @@ var todoWriteInputSchema = z14.object({
|
|
|
5296
5279
|
});
|
|
5297
5280
|
}
|
|
5298
5281
|
});
|
|
5282
|
+
var statusSymbol2 = {
|
|
5283
|
+
pending: "[ ]",
|
|
5284
|
+
in_progress: "[>]",
|
|
5285
|
+
completed: "[x]"
|
|
5286
|
+
};
|
|
5299
5287
|
var loadSessionTodos = (sessionId) => getTodosForSession(sessionId);
|
|
5300
5288
|
var formatSuccess = (mode, todos) => {
|
|
5301
5289
|
const stats = getTodoStats(todos);
|
|
5302
5290
|
const nextTodo = pickNextTodo(todos);
|
|
5303
|
-
const nextHint = nextTodo ? ` Next: [${nextTodo.id}]
|
|
5304
|
-
|
|
5291
|
+
const nextHint = nextTodo ? ` Next: [${nextTodo.id}].` : " Next: none.";
|
|
5292
|
+
const summary = `Updated todos (${mode}): ${stats.pending} pending, ${stats.inProgress} in progress, ${stats.completed} completed.${nextHint}`;
|
|
5293
|
+
if (todos.length === 0) {
|
|
5294
|
+
return summary;
|
|
5295
|
+
}
|
|
5296
|
+
const lines = [summary, "Todo plan:"];
|
|
5297
|
+
for (const [index, todo] of todos.entries()) {
|
|
5298
|
+
const label = todo.status === "in_progress" && todo.activeForm ? todo.activeForm : todo.content;
|
|
5299
|
+
lines.push(
|
|
5300
|
+
`${index + 1}. ${statusSymbol2[todo.status]} [${todo.id}] (p${todo.priority}) ${label}`
|
|
5301
|
+
);
|
|
5302
|
+
}
|
|
5303
|
+
lines.push(
|
|
5304
|
+
`Summary: ${stats.pending} pending, ${stats.inProgress} in progress, ${stats.completed} completed`
|
|
5305
|
+
);
|
|
5306
|
+
if (nextTodo) {
|
|
5307
|
+
lines.push(`Next: [${nextTodo.id}]`);
|
|
5308
|
+
} else {
|
|
5309
|
+
lines.push("Next: none");
|
|
5310
|
+
}
|
|
5311
|
+
return lines.join("\n");
|
|
5305
5312
|
};
|
|
5306
5313
|
var withPatchApplied = (currentTodos, updates) => {
|
|
5307
5314
|
const normalizedUpdates = updates.map((update) => ({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codelia/runtime",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.35",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20 <25"
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"typecheck": "tsc --noEmit"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@codelia/config": "0.1.
|
|
27
|
-
"@codelia/config-loader": "0.1.
|
|
28
|
-
"@codelia/core": "0.1.
|
|
29
|
-
"@codelia/logger": "0.1.
|
|
30
|
-
"@codelia/model-metadata": "0.1.
|
|
31
|
-
"@codelia/protocol": "0.1.
|
|
32
|
-
"@codelia/shared-types": "0.1.
|
|
33
|
-
"@codelia/storage": "0.1.
|
|
26
|
+
"@codelia/config": "0.1.35",
|
|
27
|
+
"@codelia/config-loader": "0.1.35",
|
|
28
|
+
"@codelia/core": "0.1.35",
|
|
29
|
+
"@codelia/logger": "0.1.35",
|
|
30
|
+
"@codelia/model-metadata": "0.1.35",
|
|
31
|
+
"@codelia/protocol": "0.1.35",
|
|
32
|
+
"@codelia/shared-types": "0.1.35",
|
|
33
|
+
"@codelia/storage": "0.1.35",
|
|
34
34
|
"eventsource-parser": "^3.0.6",
|
|
35
35
|
"oauth4webapi": "^3.8.4",
|
|
36
36
|
"zod": "^4.3.5"
|