thincoder 0.12.26 → 0.12.27
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/package.json +1 -1
- package/src/agent/setup.mjs +16 -13
package/package.json
CHANGED
package/src/agent/setup.mjs
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* agent/setup.mjs — runAgent pre-flight setup: context injection, system prompt construction, tool injection
|
|
3
3
|
*/
|
|
4
|
+
/** Local time, second precision, for the per-run transient reminder. */
|
|
5
|
+
function timeNowLocal() {
|
|
6
|
+
return new Date().toLocaleString("sv-SE")
|
|
7
|
+
}
|
|
8
|
+
|
|
4
9
|
import { search as memorySearch, docSearch } from "../memory.mjs"
|
|
5
10
|
import { pushReal } from "../context.mjs"
|
|
6
11
|
import { toOpenAISchema } from "../tools/index.mjs"
|
|
@@ -119,12 +124,14 @@ export async function prepareRun(agent, input, callbacks, {
|
|
|
119
124
|
})
|
|
120
125
|
}
|
|
121
126
|
}
|
|
127
|
+
// Time grounding for EVERY agent depth (subagents are short-lived; they also need
|
|
128
|
+
// to know "now"). Transient — dropped on persist, fresh at every run start.
|
|
129
|
+
agent.history.push({
|
|
130
|
+
role: "user",
|
|
131
|
+
content: `[System reminder: current time is ${timeNowLocal()} (local; timezone ${Intl.DateTimeFormat().resolvedOptions().timeZone || "local"}).]`,
|
|
132
|
+
transient: true,
|
|
133
|
+
})
|
|
122
134
|
if (depth === 0) {
|
|
123
|
-
agent.history.push({
|
|
124
|
-
role: "user",
|
|
125
|
-
content: `[System reminder: current time is ${new Date().toISOString()}.]`,
|
|
126
|
-
transient: true,
|
|
127
|
-
})
|
|
128
135
|
// Checklist injection: inject pending + in_progress items from .thincoder/checklist.md
|
|
129
136
|
try {
|
|
130
137
|
const { pendingItems } = await import("../tools/checklist.mjs")
|
|
@@ -221,14 +228,10 @@ export async function prepareRun(agent, input, callbacks, {
|
|
|
221
228
|
? `${base}\n\n${mainOverlay}`
|
|
222
229
|
: base
|
|
223
230
|
|
|
224
|
-
//
|
|
225
|
-
//
|
|
226
|
-
//
|
|
227
|
-
//
|
|
228
|
-
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone || "local"
|
|
229
|
-
const now = new Date()
|
|
230
|
-
const mins = String(now.getMinutes()).padStart(2, "0")
|
|
231
|
-
systemPrompt += `\n\nCurrent time: ${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, "0")}-${String(now.getDate()).padStart(2, "0")} ${String(now.getHours()).padStart(2, "0")}:${mins} (${timeZone}).`
|
|
231
|
+
// Time injection deliberately does NOT live here: system prompts must be byte-identical
|
|
232
|
+
// across runs (provider prefix caches). The time rides a transient user reminder per turn
|
|
233
|
+
// (see the current-time injection below) — variable content belongs in the history, not
|
|
234
|
+
// the cached prefix.
|
|
232
235
|
|
|
233
236
|
const projectRules = await loadProjectInstructions(agent.cwd)
|
|
234
237
|
if (projectRules) {
|