@ai-matrx/agents 0.25.4 → 0.28.0

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.
@@ -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,7 +748,9 @@ function ContextDeliveredValue({
738
748
  row,
739
749
  className
740
750
  }) {
741
- if (!row.delivered && !row.onRequest) 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
756
  row.onRequest ? /* @__PURE__ */ jsx5(DeliveredBlock, { title: "Returned on request", text: row.onRequest }) : null