@ai-matrx/coding-sessions 0.1.86 → 0.1.87
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/CHANGELOG.md +6 -0
- package/dist/engine/index.cjs +28 -14
- package/dist/engine/index.cjs.map +1 -1
- package/dist/engine/index.d.cts +1 -1
- package/dist/engine/index.d.ts +1 -1
- package/dist/engine/index.js +28 -14
- package/dist/engine/index.js.map +1 -1
- package/dist/{index-aavbdzSo.d.cts → index-CDeDKQHe.d.cts} +2 -0
- package/dist/{index-aavbdzSo.d.ts → index-CDeDKQHe.d.ts} +2 -0
- package/dist/index.cjs +16 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +16 -16
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +2 -0
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.js +1 -1
- package/dist/react/index.js.map +1 -1
- package/dist/server/index.cjs +28 -14
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +2 -2
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.js +28 -14
- package/dist/server/index.js.map +1 -1
- package/dist/ui/assets/{index-XIcCZr8A.js → index-crORYlzR.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @ai-matrx/coding-sessions
|
|
2
2
|
|
|
3
|
+
## 0.1.87
|
|
4
|
+
|
|
5
|
+
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
|
6
|
+
`git diff npm/coding-sessions/v0.1.86..npm/coding-sessions/v0.1.87 -- apps/shared/coding-sessions`).
|
|
7
|
+
No source changes intended and no consumer action required.
|
|
8
|
+
|
|
3
9
|
## 0.1.86
|
|
4
10
|
|
|
5
11
|
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
package/dist/engine/index.cjs
CHANGED
|
@@ -182,6 +182,7 @@ function stripAgentBlock(text) {
|
|
|
182
182
|
// src/engine/agent-attach.ts
|
|
183
183
|
var AGENT_MCP_SERVER_NAME = "matrx-agent";
|
|
184
184
|
var AGENT_PLUGIN_NAME = "matrx-agent";
|
|
185
|
+
var CODEX_REPLACEMENT_CLAUSE = "If a later message in this chat begins with an <ai_matrx_agent> block, that block replaces these AI Matrx agent instructions from then on; an <ai_matrx_agent_removed> block withdraws them.";
|
|
185
186
|
function escapeAttr(value) {
|
|
186
187
|
return value.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<");
|
|
187
188
|
}
|
|
@@ -230,9 +231,12 @@ function renderCodexSkillsList(bundle, skillsRoot) {
|
|
|
230
231
|
];
|
|
231
232
|
return lines.join("\n");
|
|
232
233
|
}
|
|
233
|
-
function renderFallbackBlock(bundle, skillsRoot) {
|
|
234
|
+
function renderFallbackBlock(bundle, skillsRoot, options = {}) {
|
|
234
235
|
const skills = renderCodexSkillsList(bundle, skillsRoot);
|
|
235
|
-
const
|
|
236
|
+
const lead = options.replaces ? `These instructions REPLACE the earlier AI Matrx agent "${options.replaces}" from this message on. Where they differ from anything said before \u2014 including how earlier replies ended \u2014 follow these.` : "The instructions below are your AI Matrx agent for this chat from now on; they replace any AI Matrx agent instructions given earlier.";
|
|
237
|
+
const body = renderAgentInstructions(bundle).trim().replace(/^(<ai_matrx_agent [^>]*>)/, `$1
|
|
238
|
+
|
|
239
|
+
${lead}`);
|
|
236
240
|
return skills ? `${body}
|
|
237
241
|
|
|
238
242
|
${skills}
|
|
@@ -301,10 +305,16 @@ async function writeAgentAttachment(dir, bundle, options) {
|
|
|
301
305
|
pluginDir,
|
|
302
306
|
mcpConfigFile,
|
|
303
307
|
mcpUrl,
|
|
304
|
-
// Same order as Claude's: the skills list first, the agent's words last
|
|
305
|
-
|
|
308
|
+
// Same order as Claude's: the skills list first, the agent's words last —
|
|
309
|
+
// then the one sentence that lets a later block replace them. Codex ranks
|
|
310
|
+
// developer instructions above a user message, so without this permission
|
|
311
|
+
// a mid-chat switch or update is ignored (measured live: the v2 block was
|
|
312
|
+
// delivered and Codex kept ending with v1's line).
|
|
313
|
+
codexInstructions: `${skillsList ? `${skillsList}
|
|
306
314
|
|
|
307
|
-
|
|
315
|
+
` : ""}${instructions}
|
|
316
|
+
${CODEX_REPLACEMENT_CLAUSE}
|
|
317
|
+
`
|
|
308
318
|
};
|
|
309
319
|
}
|
|
310
320
|
function agentArgsFor(provider, attachment, options) {
|
|
@@ -362,7 +372,7 @@ function sessionAgentRecord(bundle, options) {
|
|
|
362
372
|
...options.variables ? { variables: options.variables } : {}
|
|
363
373
|
};
|
|
364
374
|
}
|
|
365
|
-
var AGENT_REMOVED_BLOCK = "<ai_matrx_agent_removed>The AI Matrx agent instructions given earlier in this chat no longer apply.</ai_matrx_agent_removed>\n\n";
|
|
375
|
+
var AGENT_REMOVED_BLOCK = "<ai_matrx_agent_removed>The AI Matrx agent instructions given earlier in this chat no longer apply \u2014 including any rule about how replies end. Answer normally from this message on.</ai_matrx_agent_removed>\n\n";
|
|
366
376
|
async function codexCompactionDroppedAgent(rolloutFile, sinceIso) {
|
|
367
377
|
const text = await import_promises2.default.readFile(rolloutFile, "utf8").catch(() => "");
|
|
368
378
|
if (!text.includes('"type":"compacted"')) return false;
|
|
@@ -694,7 +704,7 @@ function createClaudeNormalizer() {
|
|
|
694
704
|
if (typeof content === "string") {
|
|
695
705
|
if (isSyntheticClaudeUserText(content) || content.trim().length === 0) return [];
|
|
696
706
|
userCounter += 1;
|
|
697
|
-
return [{ kind: "user", id: str(entry.uuid) ?? `user-${userCounter}`, text: content, at }];
|
|
707
|
+
return [{ kind: "user", id: str(entry.uuid) ?? `user-${userCounter}`, text: stripAgentBlock(content), at }];
|
|
698
708
|
}
|
|
699
709
|
if (!Array.isArray(content)) return [];
|
|
700
710
|
const items = [];
|
|
@@ -718,7 +728,7 @@ function createClaudeNormalizer() {
|
|
|
718
728
|
items.unshift({
|
|
719
729
|
kind: "user",
|
|
720
730
|
id: str(entry.uuid) ?? `user-${userCounter}`,
|
|
721
|
-
text: typed.join("\n\n"),
|
|
731
|
+
text: stripAgentBlock(typed.join("\n\n")),
|
|
722
732
|
at
|
|
723
733
|
});
|
|
724
734
|
}
|
|
@@ -2537,7 +2547,7 @@ async function createCodingSessionsEngine(options = {}) {
|
|
|
2537
2547
|
let cliPrompt = prompt;
|
|
2538
2548
|
let delivered = null;
|
|
2539
2549
|
if (!session.agent && session.agentRemovedDue) {
|
|
2540
|
-
|
|
2550
|
+
cliPrompt = `${AGENT_REMOVED_BLOCK}${prompt}`;
|
|
2541
2551
|
delivered = { agentRemovedDue: false };
|
|
2542
2552
|
}
|
|
2543
2553
|
if (session.agent) {
|
|
@@ -2557,8 +2567,8 @@ async function createCodingSessionsEngine(options = {}) {
|
|
|
2557
2567
|
mcpUrl: await agents.mcpUrlFor(session.id)
|
|
2558
2568
|
});
|
|
2559
2569
|
agentArgs = agentArgsFor(provider, attachment, { resuming: session.providerSessionId !== null });
|
|
2560
|
-
if (
|
|
2561
|
-
cliPrompt = `${renderFallbackBlock(bundle, import_node_path9.default.join(attachment.dir, "skills"))}${prompt}`;
|
|
2570
|
+
if (session.agent.blockDue) {
|
|
2571
|
+
cliPrompt = `${renderFallbackBlock(bundle, import_node_path9.default.join(attachment.dir, "skills"), { replaces: session.agent.replaces })}${prompt}`;
|
|
2562
2572
|
}
|
|
2563
2573
|
delivered = { agent: { ...session.agent, blockDue: false, deliveredAt: run.startedAt } };
|
|
2564
2574
|
}
|
|
@@ -2763,7 +2773,8 @@ async function createCodingSessionsEngine(options = {}) {
|
|
|
2763
2773
|
variables: selection.variables ?? {}
|
|
2764
2774
|
}),
|
|
2765
2775
|
blockDue: options2.blockDue,
|
|
2766
|
-
deliveredAt: null
|
|
2776
|
+
deliveredAt: null,
|
|
2777
|
+
replaces: options2.replaces ?? null
|
|
2767
2778
|
};
|
|
2768
2779
|
}
|
|
2769
2780
|
function killGroup(liveRun) {
|
|
@@ -3058,11 +3069,14 @@ async function createCodingSessionsEngine(options = {}) {
|
|
|
3058
3069
|
const session = index.session(String(sessionId ?? ""));
|
|
3059
3070
|
if (!session) throw new Error("This session is not in the list anymore.");
|
|
3060
3071
|
if (!selection) {
|
|
3061
|
-
const told = session.
|
|
3072
|
+
const told = session.agent?.deliveredAt != null;
|
|
3062
3073
|
return saveSession({ ...session, agent: null, agentRemovedDue: told });
|
|
3063
3074
|
}
|
|
3075
|
+
const previous = session.agent && session.agent.deliveredAt != null ? session.agent : null;
|
|
3076
|
+
const started = session.providerSessionId !== null;
|
|
3064
3077
|
const agent = await attachAgent(session.id, selection, {
|
|
3065
|
-
blockDue:
|
|
3078
|
+
blockDue: started,
|
|
3079
|
+
replaces: previous ? `${previous.name}${previous.versionNumber !== null ? ` v${previous.versionNumber}` : ""}` : null
|
|
3066
3080
|
});
|
|
3067
3081
|
return saveSession({ ...session, agent, agentRemovedDue: false });
|
|
3068
3082
|
},
|