@myagentroam/node 0.9.147 → 0.9.148

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.
@@ -480,7 +480,8 @@ export class MarAgentManagedRunController {
480
480
  const hostConfiguration = await resolveMarAgentHostRuntimeConfiguration(input.secretEnvironment);
481
481
  if (this.#disposed)
482
482
  throw new Error('MAR_AGENT_RUN_CONTROLLER_DISPOSED');
483
- const fingerprint = sessionRuntimeFingerprint(input, hostConfiguration);
483
+ const fingerprint = sessionHostFingerprint(input, hostConfiguration);
484
+ const modelFingerprint = sessionModelFingerprint(input);
484
485
  const creationKeys = [...new Set([sessionKey, input.sessionId])];
485
486
  const pending = creationKeys
486
487
  .map((key) => this.#runtimeCreations.get(key))
@@ -496,7 +497,9 @@ export class MarAgentManagedRunController {
496
497
  if (!existing.released &&
497
498
  existing.release === undefined &&
498
499
  existing.fingerprint === fingerprint) {
499
- if (existing.dynamicCredentials) {
500
+ if (existing.modelFingerprint !== modelFingerprint ||
501
+ input.models.some((model) => model.credential?.type === 'RUNTIME_TICKET' ||
502
+ model.imageGeneration?.credential?.type === 'RUNTIME_TICKET')) {
500
503
  const models = this.#modelFactory.create(input.models, {
501
504
  ...(input.runtimeScopeId === undefined
502
505
  ? {}
@@ -509,12 +512,18 @@ export class MarAgentManagedRunController {
509
512
  defaultModelId: input.model.id
510
513
  });
511
514
  existing.models = models;
515
+ existing.modelFingerprint = modelFingerprint;
512
516
  }
513
517
  catch (error) {
514
518
  await closeModelCredentialProviders(models);
515
519
  throw error;
516
520
  }
517
521
  }
522
+ const personalInstructions = input.personalInstructions ?? '';
523
+ if (existing.personalInstructions !== personalInstructions) {
524
+ existing.agent.setSystemInstruction(personalInstructions || undefined);
525
+ existing.personalInstructions = personalInstructions;
526
+ }
518
527
  this.#retainRuntime(sessionKey);
519
528
  return existing;
520
529
  }
@@ -538,8 +547,6 @@ export class MarAgentManagedRunController {
538
547
  }
539
548
  }
540
549
  async #createRuntime(input, sessionKey, fingerprint, hostConfiguration) {
541
- const dynamicCredentials = input.models.some((model) => model.credential?.type === 'RUNTIME_TICKET' ||
542
- model.imageGeneration?.credential?.type === 'RUNTIME_TICKET');
543
550
  const sharedMcpServers = input.mcpServers.filter((server) => !isExecutionScopedMcp(server));
544
551
  const mcpLease = await this.#mcpClients.acquire(sharedMcpServers, input.cwd, {
545
552
  // Native Session IDs are assigned after the first lease; do not let that promotion
@@ -588,9 +595,10 @@ export class MarAgentManagedRunController {
588
595
  host: localHost,
589
596
  normalizer: new MarAgentConversationNormalizer(),
590
597
  mcpLease,
591
- dynamicCredentials,
592
598
  automaticTitleEnabled: input.externalSessionId === undefined,
593
599
  models,
600
+ modelFingerprint: sessionModelFingerprint(input),
601
+ personalInstructions: input.personalInstructions ?? '',
594
602
  released: false
595
603
  };
596
604
  this.#sessionRuntimes.set(sessionKey, runtime);
@@ -755,13 +763,10 @@ function isExecutionScopedMcp(server) {
755
763
  return (server.lifecycle === 'EXECUTION' ||
756
764
  (server.transport === 'STDIO' && server.environment?.['MAR_CTL_USER_TOKEN'] !== undefined));
757
765
  }
758
- function sessionRuntimeFingerprint(input, hostConfiguration) {
766
+ function sessionHostFingerprint(input, hostConfiguration) {
759
767
  return createHash('sha256')
760
768
  .update(JSON.stringify({
761
769
  cwd: input.cwd,
762
- defaultModelId: input.model.id,
763
- models: input.models.map(runtimeModelFingerprint),
764
- personalInstructions: input.personalInstructions ?? '',
765
770
  mcpServers: input.mcpServers.filter((server) => !isExecutionScopedMcp(server)),
766
771
  environment: Object.entries(hostConfiguration.environment)
767
772
  .filter((entry) => entry[1] !== undefined)
@@ -770,6 +775,14 @@ function sessionRuntimeFingerprint(input, hostConfiguration) {
770
775
  }))
771
776
  .digest('hex');
772
777
  }
778
+ function sessionModelFingerprint(input) {
779
+ return createHash('sha256')
780
+ .update(JSON.stringify({
781
+ defaultModelId: input.model.id,
782
+ models: input.models.map(runtimeModelFingerprint)
783
+ }))
784
+ .digest('hex');
785
+ }
773
786
  export function allowsUntrustedWebFetchTls(environment) {
774
787
  return environment['MAR_AGENT_WEB_FETCH_ALLOW_UNTRUSTED_TLS'] !== '0';
775
788
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myagentroam/node",
3
- "version": "0.9.147",
3
+ "version": "0.9.148",
4
4
  "description": "MyAgentRoam Node runtime CLI.",
5
5
  "license": "Apache-2.0 AND GPL-2.0-or-later",
6
6
  "type": "module",
@@ -36,8 +36,8 @@
36
36
  "zod": "4.4.3",
37
37
  "@myagentroam/marctl": "0.9.120",
38
38
  "@myagentroam/code-navigation": "0.9.129",
39
- "@myagentroam/agent": "0.9.147",
40
- "@myagentroam/protocol": "0.9.147"
39
+ "@myagentroam/agent": "0.9.148",
40
+ "@myagentroam/protocol": "0.9.148"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/ws": "^8.18.1"