appback-remoteagent 0.13.12 → 0.13.14
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.
|
@@ -2,7 +2,7 @@ import fs from "node:fs/promises";
|
|
|
2
2
|
import fsSync from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { createHash, randomUUID } from "node:crypto";
|
|
5
|
-
const MAX_CONTEXT_CHARS =
|
|
5
|
+
const MAX_CONTEXT_CHARS = 1200;
|
|
6
6
|
export class AgentMemoryService {
|
|
7
7
|
dataDir;
|
|
8
8
|
rootDir;
|
|
@@ -350,56 +350,27 @@ export class AgentMemoryService {
|
|
|
350
350
|
].join("\n");
|
|
351
351
|
}
|
|
352
352
|
async formatProviderContext(session) {
|
|
353
|
-
const
|
|
354
|
-
const todo = await this.readTodo(session);
|
|
355
|
-
const history = await this.readRecentHistory(session, 5);
|
|
356
|
-
const docs = Object.values(await this.readDocs()).slice(0, 30);
|
|
357
|
-
const secrets = Object.keys(await this.readSecrets()).sort();
|
|
358
|
-
const artifacts = (await this.readJson(this.artifactsPath, []))
|
|
359
|
-
.filter((artifact) => artifact.sessionId === session.sessionId || artifact.sessionPublicId === session.publicId)
|
|
360
|
-
.sort((a, b) => b.createdAt.localeCompare(a.createdAt))
|
|
361
|
-
.slice(0, 8);
|
|
353
|
+
const docs = Object.values(await this.readDocs()).slice(0, 8);
|
|
362
354
|
const lines = [
|
|
363
355
|
"RemoteAgent managed context:",
|
|
364
356
|
[
|
|
365
357
|
"Session work locations:",
|
|
366
358
|
`- workspace: ${session.workspace}`,
|
|
367
359
|
`- memory: ${this.sessionDir(session)}`,
|
|
368
|
-
"- docs: use
|
|
360
|
+
"- docs: use document pins only when relevant.",
|
|
369
361
|
].join("\n"),
|
|
370
362
|
[
|
|
371
363
|
"Harness execution rules:",
|
|
372
364
|
"- Treat the user message as the active instruction unless the user explicitly says otherwise.",
|
|
373
|
-
"- RemoteAgent state is
|
|
374
|
-
"-
|
|
365
|
+
"- RemoteAgent state is not authority. Prefer current files and the current user message.",
|
|
366
|
+
"- Do not revive stale TODOs, old notes, or previous work unless the user explicitly asks.",
|
|
375
367
|
"- Do not claim external delivery, dashboard access, deployment, or file transfer without concrete evidence.",
|
|
376
368
|
"- RemoteAgent sends normal provider text and TELEGRAM_FILE attachments to the current incoming chat.",
|
|
377
|
-
"-
|
|
378
|
-
"- If the same action or progress repeats 3 times, stop, mark the blocker, and report the exact blocker.",
|
|
379
|
-
"- A final report must include concrete evidence: changed files, relevant line references, git diff/status, command output, or log path.",
|
|
369
|
+
"- Use `node \"$REMOTEAGENT_SECRET_BIN\" get <KEY>` only when the current task needs a named secret. Never print secret values.",
|
|
380
370
|
].join("\n"),
|
|
381
|
-
todo.items.length > 0
|
|
382
|
-
? ["Legacy task notes:", this.formatTodoSummary(todo, true, true)].join("\n")
|
|
383
|
-
: undefined,
|
|
384
|
-
current.trim() ? ["Current task note:", this.truncate(current.trim(), 700)].join("\n") : undefined,
|
|
385
|
-
history.length > 0 ? ["Recent session history:", ...history.map((entry) => `- ${entry}`)].join("\n") : undefined,
|
|
386
371
|
docs.length > 0
|
|
387
372
|
? ["Document index:", ...docs.map((doc) => `- ${doc.keyword}: ${doc.targetPath}${doc.note ? ` (${doc.note})` : ""}`)].join("\n")
|
|
388
373
|
: undefined,
|
|
389
|
-
secrets.length > 0
|
|
390
|
-
? [
|
|
391
|
-
"Secret keys available through `node \"$REMOTEAGENT_SECRET_BIN\" get <KEY>`:",
|
|
392
|
-
...secrets.map((key) => `- ${key}`),
|
|
393
|
-
"If you generate a new secret value such as an OAuth refresh token, store it without printing it:",
|
|
394
|
-
"`printf '%s' \"$VALUE\" | node \"$REMOTEAGENT_SECRET_BIN\" set <KEY>`",
|
|
395
|
-
].join("\n")
|
|
396
|
-
: [
|
|
397
|
-
"Secrets can be stored without printing values:",
|
|
398
|
-
"`printf '%s' \"$VALUE\" | node \"$REMOTEAGENT_SECRET_BIN\" set <KEY>`",
|
|
399
|
-
].join("\n"),
|
|
400
|
-
artifacts.length > 0
|
|
401
|
-
? ["Recent session artifacts:", ...artifacts.map((artifact) => `- ${artifact.id} ${artifact.kind}: ${artifact.path}`)].join("\n")
|
|
402
|
-
: undefined,
|
|
403
374
|
].filter(Boolean).join("\n\n");
|
|
404
375
|
return this.truncate(lines, MAX_CONTEXT_CHARS);
|
|
405
376
|
}
|
|
@@ -661,6 +632,12 @@ export class AgentMemoryService {
|
|
|
661
632
|
if (!normalized) {
|
|
662
633
|
return false;
|
|
663
634
|
}
|
|
635
|
+
if (normalized.length > 80 || /[\r\n]/.test(normalized)) {
|
|
636
|
+
return false;
|
|
637
|
+
}
|
|
638
|
+
if (/(진행|정리|구현|수정|제거|삭제|추가|작성|테스트|검증|커밋|푸시|배포|문서로|완료되면|필수|전담|담당|작업\s*폴더)/.test(normalized)) {
|
|
639
|
+
return false;
|
|
640
|
+
}
|
|
664
641
|
return [
|
|
665
642
|
/최근\s*(작업|진행|히스토리|기록)/,
|
|
666
643
|
/현재\s*(작업|진행|상태|세션)/,
|