@ai-matrx/agents 0.27.0 → 0.28.1

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.
@@ -83,8 +83,6 @@ interface ResolvedContextRow extends Omit<ContextRuleResult, "delivery"> {
83
83
  delivered?: ContextDeliveredText;
84
84
  /** Display-only, from a receipt: what the `context` tool returns for it. */
85
85
  onRequest?: ContextDeliveredText;
86
- /** Display-only, from a receipt: the server's own statement of it, also read. */
87
- serverRendered?: ContextDeliveredText;
88
86
  key: string;
89
87
  label: string;
90
88
  surfaceKey: string;
@@ -223,11 +221,12 @@ declare function InlineMaxInput({ value, inherited, cap, onCommit, disabled, lab
223
221
  * What the model READ for one value — the receipt's `delivered` (its own
224
222
  * element in the rendered context block) and, for an on-request value, what
225
223
  * the `context` tool returns (`on_request`). Verbatim; never the client's copy.
226
- * Renders nothing when the receipt carries neither (the host may then show
227
- * the value the page will send, labelled so). RULES.md §5.
224
+ * With no receipt yet: a server-authoritative value (RULES.md §5a) says the
225
+ * server fills it — never the client's guess; anything else renders nothing
226
+ * (the host may then show the value the page will send, labelled so). §5.
228
227
  */
229
228
  declare function ContextDeliveredValue({ row, className, }: {
230
- row: Pick<ResolvedContextRow, "delivered" | "onRequest" | "serverRendered">;
229
+ row: Pick<ResolvedContextRow, "key" | "delivered" | "onRequest">;
231
230
  className?: string;
232
231
  }): react.JSX.Element | null;
233
232
 
@@ -13,6 +13,15 @@ import {
13
13
  // context/index.ts
14
14
  var DEFAULT_INLINE_MAX_CHARS = 200;
15
15
  var DEFAULT_INLINE_CAP = 5e4;
16
+ var SERVER_AUTHORITATIVE_KEYS = {
17
+ user: "manifest",
18
+ client: "manifest",
19
+ organization: "active_context",
20
+ active_scopes: "active_context"
21
+ };
22
+ function isServerAuthoritativeKey(key) {
23
+ return Object.prototype.hasOwnProperty.call(SERVER_AUTHORITATIVE_KEYS, key);
24
+ }
16
25
  var isNum = (v) => typeof v === "number" && Number.isFinite(v);
17
26
  var isValidLimit = (v) => typeof v === "number" && Number.isInteger(v) && v >= 0;
18
27
  function resolveContextRule(input) {
@@ -21,9 +30,10 @@ function resolveContextRule(input) {
21
30
  const user = input.user ?? null;
22
31
  const cap = isNum(input.cap) ? input.cap : DEFAULT_INLINE_CAP;
23
32
  const agentDeclared = agent?.declared === true;
33
+ const identity = input.identity === true;
24
34
  let include = true;
25
35
  let includeBy = "default";
26
- if (surface?.declared === true && surface.auto_context === false) {
36
+ if (!identity && surface?.declared === true && surface.auto_context === false) {
27
37
  if (agentDeclared) {
28
38
  include = true;
29
39
  includeBy = "agent";
@@ -32,7 +42,7 @@ function resolveContextRule(input) {
32
42
  includeBy = "page";
33
43
  }
34
44
  }
35
- if (agent?.kill_switch === true && !agentDeclared) {
45
+ if (!identity && agent?.kill_switch === true && !agentDeclared) {
36
46
  include = false;
37
47
  includeBy = "agent";
38
48
  }
@@ -738,11 +748,12 @@ function ContextDeliveredValue({
738
748
  row,
739
749
  className
740
750
  }) {
741
- if (!row.delivered && !row.onRequest && !row.serverRendered) return null;
751
+ if (!row.delivered && !row.onRequest) {
752
+ return isServerAuthoritativeKey(row.key) ? /* @__PURE__ */ jsx5("p", { "data-testid": "context-server-fills", className: cn4("text-xs text-muted-foreground", className), children: "Filled in by the server" }) : null;
753
+ }
742
754
  return /* @__PURE__ */ jsxs5("div", { className: cn4("flex flex-col gap-3", className), children: [
743
755
  row.delivered ? /* @__PURE__ */ jsx5(DeliveredBlock, { title: "Agent received", text: row.delivered }) : null,
744
- row.onRequest ? /* @__PURE__ */ jsx5(DeliveredBlock, { title: "Returned on request", text: row.onRequest }) : null,
745
- row.serverRendered ? /* @__PURE__ */ jsx5(DeliveredBlock, { title: "Agent also received", text: row.serverRendered }) : null
756
+ row.onRequest ? /* @__PURE__ */ jsx5(DeliveredBlock, { title: "Returned on request", text: row.onRequest }) : null
746
757
  ] });
747
758
  }
748
759
  function DeliveredBlock({ title, text }) {