@anchrd/intel-api 0.14.0 → 0.16.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.
Files changed (60) hide show
  1. package/dist/adapters/cloudflare/cloudflare.js +0 -68
  2. package/dist/adapters/cloudflare/cloudflare.types.d.ts +0 -39
  3. package/dist/adapters/db/db-flows.js +3 -2
  4. package/dist/adapters/db/db-grants.d.ts +1 -1
  5. package/dist/adapters/db/db-grants.js +1 -1
  6. package/dist/adapters/db/db.js +16 -113
  7. package/dist/adapters/openid/openid.js +1 -1
  8. package/dist/adapters/remote-tools/remote-tools.js +1 -1
  9. package/dist/bundle/bundle.js +31 -141
  10. package/dist/bundle/bundle.types.d.ts +1 -1
  11. package/dist/cli/cli.js +18 -11
  12. package/dist/flows/flows.d.ts +1 -1
  13. package/dist/flows/flows.js +1 -1
  14. package/dist/flows/flows.types.d.ts +4 -1
  15. package/dist/http/http.js +43 -238
  16. package/dist/http/http.types.d.ts +0 -8
  17. package/dist/indexing/indexing.js +18 -89
  18. package/dist/intel/intel.js +4 -9
  19. package/dist/intel/intel.types.d.ts +0 -6
  20. package/dist/mcp/mcp.js +84 -361
  21. package/dist/mcp/mcp.types.d.ts +2 -7
  22. package/dist/nodes/document-links/document-links.d.ts +6 -8
  23. package/dist/nodes/document-links/document-links.js +8 -31
  24. package/dist/nodes/nodes.js +24 -890
  25. package/dist/nodes/nodes.types.d.ts +14 -173
  26. package/dist/tools/tool-servers/tool-servers.d.ts +1 -1
  27. package/dist/tools/tool-servers/tool-servers.js +1 -1
  28. package/dist/tools/tools.js +37 -148
  29. package/dist/tools/tools.types.d.ts +1 -22
  30. package/migrations/0018_no_context_policy_at_last.sql +13 -6
  31. package/migrations/0019_one_name_for_the_grants.sql +52 -0
  32. package/package.json +2 -2
  33. package/dist/adapters/cloudflare-api/cloudflare-api.d.ts +0 -22
  34. package/dist/adapters/cloudflare-api/cloudflare-api.js +0 -306
  35. package/dist/adapters/cloudflare-api/cloudflare-api.types.d.ts +0 -64
  36. package/dist/adapters/cloudflare-api/cloudflare-api.types.js +0 -1
  37. package/dist/adapters/gate-applications/gate-applications.d.ts +0 -23
  38. package/dist/adapters/gate-applications/gate-applications.js +0 -88
  39. package/dist/adapters/tool-delegation/tool-delegation.d.ts +0 -22
  40. package/dist/adapters/tool-delegation/tool-delegation.js +0 -90
  41. package/dist/agent-costs/agent-costs.d.ts +0 -16
  42. package/dist/agent-costs/agent-costs.js +0 -105
  43. package/dist/agent-costs/agent-costs.types.d.ts +0 -30
  44. package/dist/agent-costs/agent-costs.types.js +0 -1
  45. package/dist/agent-runtime/agent-runtime.d.ts +0 -16
  46. package/dist/agent-runtime/agent-runtime.js +0 -150
  47. package/dist/agent-runtime/agent-runtime.types.d.ts +0 -122
  48. package/dist/agent-runtime/agent-runtime.types.js +0 -1
  49. package/dist/model-catalog/model-catalog.d.ts +0 -2
  50. package/dist/model-catalog/model-catalog.js +0 -99
  51. package/dist/model-catalog/model-catalog.types.d.ts +0 -15
  52. package/dist/model-catalog/model-catalog.types.js +0 -1
  53. package/dist/nodes/board/board.d.ts +0 -61
  54. package/dist/nodes/board/board.js +0 -826
  55. package/dist/nodes/board/board.types.d.ts +0 -38
  56. package/dist/nodes/board/board.types.js +0 -1
  57. package/migrations/0013_agents_in_the_tree.sql +0 -76
  58. package/migrations/0014_agent_applications.sql +0 -25
  59. package/migrations/0015_tools_delegated_from_a_connection.sql +0 -15
  60. package/migrations/0016_boards_in_the_tree.sql +0 -80
@@ -1,6 +1,4 @@
1
1
  import type { Authorized } from "@anchrd/gate-sdk";
2
- import type { AgentCostsService } from "../agent-costs/agent-costs.types.js";
3
- import type { AgentRuntimeService } from "../agent-runtime/agent-runtime.types.js";
4
2
  import type { BundleService } from "../bundle/bundle.types.js";
5
3
  import type { FlowService } from "../flows/flows.types.js";
6
4
  import type { NodeService } from "../nodes/nodes.types.js";
@@ -8,15 +6,12 @@ import type { ToolService } from "../tools/tools.types.js";
8
6
  export interface McpDeps {
9
7
  authorization: Authorized;
10
8
  /**
11
- * The bearer this call was authorized with, forwarded to the agent runtime so a run is driven by
12
- * the caller and not by Intel. Nothing else reads it, and nothing writes it anywhere.
9
+ * The bearer this call was authorized with, passed on where Intel has to speak to Gate as the
10
+ * person asking rather than as itself. Nothing else reads it, and nothing writes it anywhere.
13
11
  */
14
12
  bearer: string;
15
13
  nodes: NodeService;
16
14
  flows: FlowService;
17
15
  tools: ToolService;
18
16
  bundle: BundleService;
19
- agents: AgentRuntimeService;
20
- /** What an agent has cost, out of the AI Gateway log — the MCP half of the profile's figures (#251). */
21
- agentCosts: AgentCostsService;
22
17
  }
@@ -9,14 +9,12 @@
9
9
  * newer editor wrote; a strict parse would turn "I do not recognise this block" into "this document
10
10
  * cannot be saved". What it does not recognise contributes no link, which is the safe half.
11
11
  *
12
- * ⚠️ A board reaches the same link graph, through the same `text` origin (#285). Its links are not
13
- * inline elements but the `references` of its tasks, which is a difference in where they are
14
- * written and not in what they are: somebody put a node id into a body, and the graph has to see it
15
- * from the other side. Reading it here rather than in the board service is what keeps ONE answer to
16
- * "what does this body point at" — the writer (`reconcileTextLinks`) asks this function and does
17
- * not care which kind it is holding.
12
+ * ⚠️ ONE answer to "what does this body point at", whatever kind holds the body: the writer
13
+ * (`reconcileTextLinks`) asks this function and does not care. Until #390 a board answered here
14
+ * too, through the `references` of its tasks a difference in where the ids were written and not
15
+ * in what they were.
18
16
  *
19
- * Content that is neither has no links at all: an attachment, a CSV table or plain markdown carries
20
- * nothing to read.
17
+ * Content that is not a BlockNote document has no links at all: an attachment, a CSV table or plain
18
+ * markdown carries nothing to read.
21
19
  */
22
20
  export declare function documentLinkTargets(mediaType: string, content: string): string[];
@@ -1,5 +1,4 @@
1
- import { BlockNoteDocument, BlockNoteMediaType, BoardDocument, BoardMediaType, DocumentLinkInlineType, } from "@anchrd/intel-contract";
2
- import { upgradeStoredBoard } from "../board/board.js";
1
+ import { BlockNoteDocument, BlockNoteMediaType, DocumentLinkInlineType, } from "@anchrd/intel-contract/node";
3
2
  function isRecord(value) {
4
3
  return typeof value === "object" && value !== null;
5
4
  }
@@ -31,18 +30,16 @@ function collect(value, found) {
31
30
  * newer editor wrote; a strict parse would turn "I do not recognise this block" into "this document
32
31
  * cannot be saved". What it does not recognise contributes no link, which is the safe half.
33
32
  *
34
- * ⚠️ A board reaches the same link graph, through the same `text` origin (#285). Its links are not
35
- * inline elements but the `references` of its tasks, which is a difference in where they are
36
- * written and not in what they are: somebody put a node id into a body, and the graph has to see it
37
- * from the other side. Reading it here rather than in the board service is what keeps ONE answer to
38
- * "what does this body point at" — the writer (`reconcileTextLinks`) asks this function and does
39
- * not care which kind it is holding.
33
+ * ⚠️ ONE answer to "what does this body point at", whatever kind holds the body: the writer
34
+ * (`reconcileTextLinks`) asks this function and does not care. Until #390 a board answered here
35
+ * too, through the `references` of its tasks a difference in where the ids were written and not
36
+ * in what they were.
40
37
  *
41
- * Content that is neither has no links at all: an attachment, a CSV table or plain markdown carries
42
- * nothing to read.
38
+ * Content that is not a BlockNote document has no links at all: an attachment, a CSV table or plain
39
+ * markdown carries nothing to read.
43
40
  */
44
41
  export function documentLinkTargets(mediaType, content) {
45
- if (mediaType !== BlockNoteMediaType && mediaType !== BoardMediaType)
42
+ if (mediaType !== BlockNoteMediaType)
46
43
  return [];
47
44
  let parsed;
48
45
  try {
@@ -52,26 +49,6 @@ export function documentLinkTargets(mediaType, content) {
52
49
  return [];
53
50
  }
54
51
  const found = new Set();
55
- if (mediaType === BoardMediaType) {
56
- /**
57
- * ⚠️ Upgraded first, like `parseStoredBoard` and `indexing.ts` — this is the FOURTH place a
58
- * board body is parsed, and the only one that cannot complain (anchrd/intel#321).
59
- *
60
- * A board it fails to parse simply has no links, which reads exactly like a board that points
61
- * at nothing — and the reconciliation this feeds removes the links a body no longer names, so
62
- * an unparsed old board would quietly leave the link graph. Every caller hands it a body written
63
- * moments earlier today, so it has never met one; the upgrade is what keeps that from being the
64
- * only reason.
65
- */
66
- const board = BoardDocument.safeParse(upgradeStoredBoard(parsed));
67
- if (!board.success)
68
- return [];
69
- for (const task of board.data.tasks) {
70
- for (const reference of task.references)
71
- found.add(reference);
72
- }
73
- return [...found];
74
- }
75
52
  const document = BlockNoteDocument.safeParse(parsed);
76
53
  if (!document.success)
77
54
  return [];