@blockrun/franklin 3.34.2 → 3.34.3
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/agent/loop.js +1 -0
- package/dist/agent/types.d.ts +8 -0
- package/dist/memory/store.js +13 -2
- package/dist/tools/trade-plan.js +4 -1
- package/package.json +1 -1
package/dist/agent/loop.js
CHANGED
|
@@ -1331,6 +1331,7 @@ export async function interactiveSession(config, getUserInput, onEvent, onAbortR
|
|
|
1331
1331
|
abortSignal: abort.signal,
|
|
1332
1332
|
onAskUser: config.onAskUser,
|
|
1333
1333
|
onApproval: config.approvalPromptFn,
|
|
1334
|
+
sessionId,
|
|
1334
1335
|
parentContext: {
|
|
1335
1336
|
goal: lastUserInput?.slice(0, 200),
|
|
1336
1337
|
recentFiles: [...readFileCache].slice(-10),
|
package/dist/agent/types.d.ts
CHANGED
|
@@ -94,6 +94,14 @@ export interface ExecutionScope {
|
|
|
94
94
|
* anything that requires an explicit decision.
|
|
95
95
|
*/
|
|
96
96
|
onApproval?: import('./approvals.js').ApprovalPromptFn;
|
|
97
|
+
/**
|
|
98
|
+
* The executing session's id. Threaded so session-scoped tools (TradePlan)
|
|
99
|
+
* bind to THIS session rather than a process-global slot — required for
|
|
100
|
+
* correctness when one serve process hosts multiple concurrent agents
|
|
101
|
+
* (AgentHost). Absent in older/library callers; tools fall back to the
|
|
102
|
+
* module-global session then.
|
|
103
|
+
*/
|
|
104
|
+
sessionId?: string;
|
|
97
105
|
/** Context from parent agent — helps sub-agents avoid duplicate work */
|
|
98
106
|
parentContext?: {
|
|
99
107
|
goal?: string;
|
package/dist/memory/store.js
CHANGED
|
@@ -36,8 +36,17 @@ export function globalMemoryPath() {
|
|
|
36
36
|
function slugify(text) {
|
|
37
37
|
return text.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 32) || 'workspace';
|
|
38
38
|
}
|
|
39
|
+
// Memoized per workDir: repoIdentity is called several times per memory
|
|
40
|
+
// search (workspaceMemoryPath + sessionLogsDir + workspaceDir), and each call
|
|
41
|
+
// otherwise spawns `git remote get-url origin`. The origin remote doesn't
|
|
42
|
+
// change within a session, so cache it. `null` (not a repo) is cached too.
|
|
43
|
+
const repoIdentityCache = new Map();
|
|
39
44
|
/** org/repo from the git origin remote, or null outside a repo. */
|
|
40
45
|
export function repoIdentity(workDir) {
|
|
46
|
+
const cached = repoIdentityCache.get(workDir);
|
|
47
|
+
if (cached !== undefined)
|
|
48
|
+
return cached;
|
|
49
|
+
let identity = null;
|
|
41
50
|
try {
|
|
42
51
|
const url = execFileSync('git', ['-C', workDir, 'remote', 'get-url', 'origin'], {
|
|
43
52
|
encoding: 'utf-8',
|
|
@@ -45,11 +54,13 @@ export function repoIdentity(workDir) {
|
|
|
45
54
|
stdio: ['ignore', 'pipe', 'ignore'],
|
|
46
55
|
}).trim();
|
|
47
56
|
const m = url.match(/[:/]([^/:]+\/[^/]+?)(?:\.git)?$/);
|
|
48
|
-
|
|
57
|
+
identity = m ? m[1] : url || null;
|
|
49
58
|
}
|
|
50
59
|
catch {
|
|
51
|
-
|
|
60
|
+
identity = null;
|
|
52
61
|
}
|
|
62
|
+
repoIdentityCache.set(workDir, identity);
|
|
63
|
+
return identity;
|
|
53
64
|
}
|
|
54
65
|
export function workspaceKey(workDir) {
|
|
55
66
|
const identity = repoIdentity(workDir) ?? workDir;
|
package/dist/tools/trade-plan.js
CHANGED
|
@@ -52,7 +52,10 @@ export function createTradePlanCapability() {
|
|
|
52
52
|
concurrent: false,
|
|
53
53
|
execute: async (input, ctx) => {
|
|
54
54
|
const action = String(input.action || '');
|
|
55
|
-
|
|
55
|
+
// Bind to THIS session (threaded via the execution scope) so concurrent
|
|
56
|
+
// hosted agents each propose/query under their own id. Falls back to the
|
|
57
|
+
// process-global slot for callers that don't populate the scope.
|
|
58
|
+
const sessionId = ctx.sessionId ?? getSchedulerSessionId();
|
|
56
59
|
if (action === 'status') {
|
|
57
60
|
const active = activeTradePlan(sessionId);
|
|
58
61
|
if (active) {
|
package/package.json
CHANGED