@myagentroam/node 0.10.44 → 0.10.46

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.
@@ -1,7 +1,26 @@
1
- import { parseComposerTags, serializeComposerTag } from '@myagentroam/protocol';
1
+ import { parseComposerTags, serializeComposerTag, sessionMessageOriginSchema } from '@myagentroam/protocol';
2
2
  import { relative, resolve } from 'node:path';
3
3
  import { homedir } from 'node:os';
4
4
  import { SkillDirectoryService } from './skill-directory-service.js';
5
+ /** Keep the admitted source snapshot beside message and Goal markup. */
6
+ export function withSessionMessageOrigin(input, origin) {
7
+ if (origin === undefined)
8
+ return input;
9
+ const tag = serializeComposerTag('mar_session_origin', sessionMessageOriginSchema.parse(origin));
10
+ const parts = parseComposerTags(input);
11
+ const first = parts[0];
12
+ const goal = first?.kind === 'mar_goal_start' || first?.kind === 'mar_goal_continue' ? first : undefined;
13
+ const content = parts
14
+ .map((part) => part === goal || part.kind === 'mar_session_origin'
15
+ ? ''
16
+ : part.kind === 'text'
17
+ ? part.text
18
+ : part.raw)
19
+ .join('');
20
+ return [goal?.raw, tag, goal === undefined ? content : content.trimStart()]
21
+ .filter(Boolean)
22
+ .join('\n');
23
+ }
5
24
  export function composerResourceInputTags(input) {
6
25
  return parseComposerTags(input)
7
26
  .filter((part) => part.kind === 'mar_skills' ||
@@ -248,6 +248,7 @@ export class SessionLifecycleService {
248
248
  sessionId: messageSessionId,
249
249
  clientMessageId: input.clientMessageId,
250
250
  content: input.content,
251
+ ...(input.__marctlOrigin === undefined ? {} : { __marctlOrigin: input.__marctlOrigin }),
251
252
  ...(input.__suppressNotifications === true ? { __suppressNotifications: true } : {}),
252
253
  ...(input.__requestUserId === undefined ? {} : { __requestUserId: input.__requestUserId }),
253
254
  ...(input.__usageGrant === undefined ? {} : { __usageGrant: input.__usageGrant }),
@@ -7,7 +7,7 @@ import { safeErrorCode } from '../util/safe-error.js';
7
7
  import { publicGoalStartText } from './goal-runtime.js';
8
8
  import { serializeComposerTag, composerVisibleText, steerComposerMessage } from '@myagentroam/protocol';
9
9
  import { relative } from 'node:path';
10
- import { prepareComposerResourceInput, composerResourceInputTags, validateComposerSkills } from './composer-message-input.js';
10
+ import { prepareComposerResourceInput, composerResourceInputTags, withSessionMessageOrigin, validateComposerSkills } from './composer-message-input.js';
11
11
  const INTERNAL_GOAL = Symbol('internalGoal');
12
12
  const INTERNAL_SCHEDULE = Symbol('internalSchedule');
13
13
  const INTERNAL_RESTORE = Symbol('internalRestore');
@@ -139,15 +139,19 @@ export class SessionMessageService {
139
139
  idempotent: true,
140
140
  auditReceipt: auditReceipt(session, existing.kind === 'queue' ? 'QUEUE' : 'SEND', existing.kind === 'queue' ? existing.item.id : existing.run.id, existing.kind === 'queue' ? existing.item.id : undefined)
141
141
  };
142
+ const sourceContent = withSessionMessageOrigin(content, input.__marctlOrigin);
142
143
  const goalMessage = internalGoal || internalSchedule || internalRestore
143
144
  ? undefined
144
145
  : this.options.goalMessage(session, content, requestedIntent);
145
- const runnerContent = goalMessage?.runnerContent ?? internalRunnerContent;
146
+ const executionContent = goalMessage?.runnerContent ?? internalRunnerContent;
147
+ const runnerContent = executionContent === content
148
+ ? sourceContent
149
+ : withSessionMessageOrigin(executionContent, input.__marctlOrigin);
146
150
  const publicContent = goalMessage?.activated === true
147
- ? [publicGoalStartText(composerVisibleText(content)), composerResourceInputTags(content)]
151
+ ? withSessionMessageOrigin([publicGoalStartText(composerVisibleText(content)), composerResourceInputTags(content)]
148
152
  .filter(Boolean)
149
- .join('\n')
150
- : content;
153
+ .join('\n'), input.__marctlOrigin)
154
+ : sourceContent;
151
155
  const intent = goalMessage?.activated === true ? 'REPLACE_CURRENT' : requestedIntent;
152
156
  const releasePreparation = this.options.attachments.protectSession(session.id);
153
157
  const operation = (async () => {
@@ -242,7 +246,7 @@ export class SessionMessageService {
242
246
  this.options.runtime.updateQueueItemAttachments(created.queueItem.id, attachments, displayInput);
243
247
  this.options.coordinator.prepare(submissionId, {
244
248
  restartMessage: {
245
- content,
249
+ content: sourceContent,
246
250
  attachments,
247
251
  ...(Number.isSafeInteger(input.__requestUserId)
248
252
  ? { initiatedByUserId: input.__requestUserId }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myagentroam/node",
3
- "version": "0.10.44",
3
+ "version": "0.10.46",
4
4
  "description": "MyAgentRoam Node runtime CLI.",
5
5
  "license": "Apache-2.0 AND GPL-2.0-or-later",
6
6
  "type": "module",
@@ -37,10 +37,10 @@
37
37
  "playwright": "1.62.1",
38
38
  "ws": "^8.21.3",
39
39
  "zod": "4.4.3",
40
- "@myagentroam/protocol": "0.10.44",
40
+ "@myagentroam/marctl": "0.10.8",
41
41
  "@myagentroam/code-navigation": "0.10.1",
42
- "@myagentroam/agent": "0.10.44",
43
- "@myagentroam/marctl": "0.10.7"
42
+ "@myagentroam/protocol": "0.10.46",
43
+ "@myagentroam/agent": "0.10.46"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/ws": "^8.18.1"