@rowan-agent/agent 0.9.17 → 0.9.18

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/index.d.ts CHANGED
@@ -1876,7 +1876,6 @@ interface OwnedStore {
1876
1876
  executionId?: ExecutionId;
1877
1877
  messageId?: MessageId;
1878
1878
  configToken?: ConfigToken;
1879
- inputContext?: UserInput;
1880
1879
  }): Promise<RunClaim>;
1881
1880
  failQueuedRun(input: {
1882
1881
  runId: RunId;
@@ -2291,7 +2290,6 @@ declare class InMemoryStore implements DurableStore {
2291
2290
  executionId?: ExecutionId;
2292
2291
  messageId?: MessageId;
2293
2292
  configToken?: ConfigToken;
2294
- inputContext?: UserInput;
2295
2293
  }): RunClaim;
2296
2294
  failQueuedRun(lease: OwnerLease, input: {
2297
2295
  runId: RunId;
@@ -2475,7 +2473,6 @@ declare class SqliteStore implements DurableStore {
2475
2473
  executionId?: ExecutionId;
2476
2474
  messageId?: MessageId;
2477
2475
  configToken?: ConfigToken;
2478
- inputContext?: UserInput;
2479
2476
  }): Promise<RunClaim>;
2480
2477
  failQueuedRun(lease: OwnerLease, input: {
2481
2478
  runId: RunId;
package/dist/index.js CHANGED
@@ -46,9 +46,6 @@ function buildContextDescription(contexts) {
46
46
  lines.push("</agent_context>");
47
47
  return lines.join("\n");
48
48
  }
49
- function buildAdditionalContextMessage(contexts) {
50
- return buildContextDescription(contexts);
51
- }
52
49
  function formatResourceOutput(resource) {
53
50
  const parts = [`<${resource.type} name="${escapeXml(resource.name)}" location="${escapeXml(resource.location)}">`];
54
51
  if (resource.baseDir) {
@@ -3426,7 +3423,6 @@ function isContinuation(value) {
3426
3423
  }
3427
3424
 
3428
3425
  // src/runtime/contracts.ts
3429
- var HOST_CONTEXT_MESSAGE_KIND = "host_context";
3430
3426
  var THINKING_LEVELS = [
3431
3427
  "off",
3432
3428
  "minimal",
@@ -3449,7 +3445,7 @@ function thinkingLevelFromMessages(messages) {
3449
3445
  if (message?.role !== "user") continue;
3450
3446
  const metadata = message.metadata;
3451
3447
  const kind = isRecord3(metadata) && typeof metadata.kind === "string" ? metadata.kind : void 0;
3452
- if (kind === "phase_prompt" || kind === "phase_input" || kind === HOST_CONTEXT_MESSAGE_KIND) continue;
3448
+ if (kind === "phase_prompt" || kind === "phase_input") continue;
3453
3449
  return thinkingLevelFromMetadata(metadata);
3454
3450
  }
3455
3451
  return void 0;
@@ -3503,9 +3499,6 @@ function normalizeUserInput(input) {
3503
3499
  assertJsonValue(normalized, "input");
3504
3500
  return normalized;
3505
3501
  }
3506
- function canonicalUserInput(input) {
3507
- return canonicalJson(normalizeUserInput(input));
3508
- }
3509
3502
  function isAssistantMessage(value) {
3510
3503
  return isRecord3(value) && hasOnlyKeys(value, ["id", "agentId", "runId", "messageRevision", "role", "content", "metadata", "sequenceWithinRun", "createdAt", "interrupted"]) && typeof value.id === "string" && typeof value.agentId === "string" && typeof value.runId === "string" && value.role === "assistant" && (value.messageRevision === void 0 || Number.isInteger(value.messageRevision) && value.messageRevision >= 0) && Number.isInteger(value.sequenceWithinRun) && value.sequenceWithinRun >= 0 && typeof value.createdAt === "string" && isAssistantContent(value.content) && (value.metadata === void 0 || isMetadata(value.metadata)) && (value.interrupted === void 0 || typeof value.interrupted === "boolean");
3511
3504
  }
@@ -4186,11 +4179,14 @@ function resolveDefinitionContext(config, assembled = {}) {
4186
4179
  selectNamedResources(config.resources.skills, config.definition.skills, "Skill"),
4187
4180
  config.definition.bundledSkills
4188
4181
  );
4189
- const contexts = selectNamedResources(
4190
- config.resources.contexts ?? [],
4191
- config.definition.contexts,
4192
- "Context"
4193
- );
4182
+ const contexts = [
4183
+ ...selectNamedResources(
4184
+ config.resources.contexts ?? [],
4185
+ config.definition.contexts,
4186
+ "Context"
4187
+ ),
4188
+ ...config.additionalContexts ?? []
4189
+ ];
4194
4190
  const candidateRegistry = assembled.phases ?? config.resources.phases;
4195
4191
  const phaseCandidates = [...candidateRegistry?.phases.values() ?? []];
4196
4192
  const coreNames = /* @__PURE__ */ new Set([DEFAULT_PHASE_ID, STOP_PHASE_ID, COMPACT_PHASE_ID]);
@@ -6201,8 +6197,7 @@ var AgentRuntime = class _AgentRuntime {
6201
6197
  runId: run.id,
6202
6198
  expectedRevision: run.revision,
6203
6199
  executionId,
6204
- configToken: token,
6205
- ...controlKind ? {} : { inputContext: additionalContextInput(config) }
6200
+ configToken: token
6206
6201
  });
6207
6202
  executionRevision = claim.run.revision;
6208
6203
  const controller = new AbortController();
@@ -6672,12 +6667,6 @@ var AgentRuntime = class _AgentRuntime {
6672
6667
  this.heartbeat.unref?.();
6673
6668
  }
6674
6669
  };
6675
- function additionalContextInput(config) {
6676
- const contexts = config.additionalContexts ?? [];
6677
- if (contexts.length === 0) return void 0;
6678
- const content = buildAdditionalContextMessage(contexts);
6679
- return content.length === 0 ? void 0 : { content, metadata: { kind: HOST_CONTEXT_MESSAGE_KIND } };
6680
- }
6681
6670
  var DurableRun = class {
6682
6671
  constructor(runtime, id) {
6683
6672
  this.runtime = runtime;
@@ -7226,13 +7215,11 @@ var InMemoryStore = class _InMemoryStore {
7226
7215
  this.assertOwner(lease);
7227
7216
  const executionId = input.executionId ?? createId("exec");
7228
7217
  const operationKey = `claim:${executionId}`;
7229
- const inputContext = input.inputContext === void 0 ? void 0 : normalizeUserInput(input.inputContext);
7230
7218
  const operationPayload = canonicalJson([
7231
7219
  input.runId,
7232
7220
  input.expectedRevision,
7233
7221
  input.messageId ?? null,
7234
- input.configToken ?? null,
7235
- inputContext ?? null
7222
+ input.configToken ?? null
7236
7223
  ]);
7237
7224
  const replay = this.replayOperation(operationKey, operationPayload);
7238
7225
  if (replay) return clone(replay);
@@ -7250,21 +7237,6 @@ var InMemoryStore = class _InMemoryStore {
7250
7237
  }
7251
7238
  if (!run.pinnedConfigToken && input.configToken) run.pinnedConfigToken = input.configToken;
7252
7239
  const committedMessages = [];
7253
- const existingMessages = this.messagesForRun(run.id);
7254
- if (inputContext && hasUserInput(inputContext) && !isControlRun(run) && !existingMessages.some((message) => message.role === "user" && message.metadata?.kind === HOST_CONTEXT_MESSAGE_KIND && canonicalUserInput({ content: message.content, metadata: message.metadata }) === canonicalUserInput(inputContext))) {
7255
- const contextMessage = {
7256
- id: createId("msg"),
7257
- agentId: run.agentId,
7258
- runId: run.id,
7259
- role: "user",
7260
- content: userInputContent(inputContext),
7261
- ...userInputMetadata(inputContext) ? { metadata: clone(userInputMetadata(inputContext)) } : {},
7262
- sequenceWithinRun: this.nextMessageSequence(run.id),
7263
- createdAt: createTimestamp()
7264
- };
7265
- this.messages.set(contextMessage.id, contextMessage);
7266
- committedMessages.push(contextMessage);
7267
- }
7268
7240
  if (!run.checkpoint && !run.initialMessageId && (!isControlRun(run) || hasUserInput(run.input))) {
7269
7241
  const userInput = normalizeUserInput(run.input);
7270
7242
  const message = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rowan-agent/agent",
3
- "version": "0.9.17",
3
+ "version": "0.9.18",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",