@anchrd/intel-api 0.13.0 → 0.15.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.
- package/dist/adapters/cloudflare/cloudflare.js +1 -68
- package/dist/adapters/cloudflare/cloudflare.types.d.ts +0 -39
- package/dist/adapters/db/db-flows.js +1 -1
- package/dist/adapters/db/db-grants.js +1 -1
- package/dist/adapters/db/db-indexing.js +79 -0
- package/dist/adapters/db/db.js +81 -139
- package/dist/adapters/semantic-index/semantic-index.js +97 -17
- package/dist/adapters/semantic-index/semantic-index.types.d.ts +20 -1
- package/dist/bundle/bundle.js +42 -134
- package/dist/cli/cli.js +3 -9
- package/dist/http/http.js +5 -206
- package/dist/http/http.types.d.ts +0 -8
- package/dist/indexing/indexing.js +133 -55
- package/dist/indexing/indexing.types.d.ts +1 -0
- package/dist/intel/intel.js +4 -9
- package/dist/intel/intel.types.d.ts +0 -6
- package/dist/mcp/mcp.js +33 -308
- package/dist/mcp/mcp.types.d.ts +2 -7
- package/dist/nodes/document-links/document-links.d.ts +6 -8
- package/dist/nodes/document-links/document-links.js +8 -31
- package/dist/nodes/nodes.js +92 -826
- package/dist/nodes/nodes.types.d.ts +57 -158
- package/dist/tools/tools.js +37 -148
- package/dist/tools/tools.types.d.ts +0 -21
- package/migrations/0009_no_context_policy.sql +15 -0
- package/migrations/0017_a_vector_per_card.sql +38 -0
- package/migrations/0018_no_context_policy_at_last.sql +97 -0
- package/migrations/0019_one_name_for_the_grants.sql +52 -0
- package/package.json +2 -2
- package/dist/adapters/cloudflare-api/cloudflare-api.d.ts +0 -22
- package/dist/adapters/cloudflare-api/cloudflare-api.js +0 -214
- package/dist/adapters/cloudflare-api/cloudflare-api.types.d.ts +0 -64
- package/dist/adapters/cloudflare-api/cloudflare-api.types.js +0 -1
- package/dist/adapters/gate-applications/gate-applications.d.ts +0 -23
- package/dist/adapters/gate-applications/gate-applications.js +0 -88
- package/dist/adapters/tool-delegation/tool-delegation.d.ts +0 -22
- package/dist/adapters/tool-delegation/tool-delegation.js +0 -90
- package/dist/agent-costs/agent-costs.d.ts +0 -16
- package/dist/agent-costs/agent-costs.js +0 -105
- package/dist/agent-costs/agent-costs.types.d.ts +0 -30
- package/dist/agent-costs/agent-costs.types.js +0 -1
- package/dist/agent-runtime/agent-runtime.d.ts +0 -16
- package/dist/agent-runtime/agent-runtime.js +0 -150
- package/dist/agent-runtime/agent-runtime.types.d.ts +0 -122
- package/dist/agent-runtime/agent-runtime.types.js +0 -1
- package/dist/model-catalog/model-catalog.d.ts +0 -2
- package/dist/model-catalog/model-catalog.js +0 -99
- package/dist/model-catalog/model-catalog.types.d.ts +0 -15
- package/dist/model-catalog/model-catalog.types.js +0 -1
- package/dist/nodes/board/board.d.ts +0 -59
- package/dist/nodes/board/board.js +0 -528
- package/dist/nodes/board/board.types.d.ts +0 -31
- package/dist/nodes/board/board.types.js +0 -1
- package/migrations/0013_agents_in_the_tree.sql +0 -76
- package/migrations/0014_agent_applications.sql +0 -25
- package/migrations/0015_tools_delegated_from_a_connection.sql +0 -15
- package/migrations/0016_boards_in_the_tree.sql +0 -80
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The figures this package knows without asking anybody, and the ONLY place they are written down.
|
|
3
|
-
*
|
|
4
|
-
* ⚠️ It moved here out of `packages/ui` with #257, and the move is the point rather than the
|
|
5
|
-
* tidying. The comment it used to carry accused itself correctly — *"it is a copy and it ages
|
|
6
|
-
* silently"* — and named the reason it stayed a copy: the Cloudflare endpoint needs a token, and a
|
|
7
|
-
* token does not belong in a SPA. It belongs here. What the browser gets is the answer, never the
|
|
8
|
-
* credential, and the Workers AI half of this table is overwritten by the live one on every read.
|
|
9
|
-
*
|
|
10
|
-
* ⚠️ The Anthropic entries have no live source and will not get one. Cloudflare resells those models
|
|
11
|
-
* through Unified Billing and publishes no price list for them, so they stay `builtin` even on a
|
|
12
|
-
* perfectly healthy read — which is exactly why `source` is per entry and not per response.
|
|
13
|
-
*
|
|
14
|
-
* ⚠️ Workers AI models without `function_calling` are deliberately absent from the live merge. An
|
|
15
|
-
* agent is a tool loop; a model that cannot call a tool cannot run one.
|
|
16
|
-
*
|
|
17
|
-
* Collected 2026-08-06 from `GET /accounts/{id}/ai/models/search` and from Anthropic's model list.
|
|
18
|
-
*/
|
|
19
|
-
const builtin = [
|
|
20
|
-
entry("anthropic", "claude-opus-5", "Opus 5", 1_000_000, 5, 25),
|
|
21
|
-
entry("anthropic", "claude-sonnet-5", "Sonnet 5", 1_000_000, 3, 15),
|
|
22
|
-
entry("anthropic", "claude-sonnet-4", "Sonnet 4", 200_000, 3, 15),
|
|
23
|
-
entry("anthropic", "claude-haiku-4-5", "Haiku 4.5", 200_000, 1, 5),
|
|
24
|
-
entry("workers-ai", "@cf/openai/gpt-oss-120b", "GPT-OSS 120B", 128_000, 0.35, 0.75),
|
|
25
|
-
entry("workers-ai", "@cf/openai/gpt-oss-20b", "GPT-OSS 20B", 128_000, 0.2, 0.3),
|
|
26
|
-
entry("workers-ai", "@cf/moonshotai/kimi-k2.6", "Kimi K2.6", 262_144, 0.95, 4),
|
|
27
|
-
entry("workers-ai", "@cf/moonshotai/kimi-k2.7-code", "Kimi K2.7 Code", 262_144, 0.95, 4),
|
|
28
|
-
entry("workers-ai", "@cf/zai-org/glm-5.2", "GLM 5.2", 262_144, 1.4, 4.4),
|
|
29
|
-
entry("workers-ai", "@cf/zai-org/glm-4.7-flash", "GLM 4.7 Flash", 131_072, 0.0605, 0.4),
|
|
30
|
-
entry("workers-ai", "@cf/google/gemma-4-26b-a4b-it", "Gemma 4 26B", 256_000, 0.1, 0.3),
|
|
31
|
-
entry("workers-ai", "@cf/nvidia/nemotron-3-120b-a12b", "Nemotron 3 120B", 256_000, 0.5, 1.5),
|
|
32
|
-
entry("workers-ai", "@cf/meta/llama-4-scout-17b-16e-instruct", "Llama 4 Scout", 131_000, 0.27, 0.85),
|
|
33
|
-
entry("workers-ai", "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "Llama 3.3 70B Fast", 24_000, 0.293, 2.253),
|
|
34
|
-
entry("workers-ai", "@cf/mistralai/mistral-small-3.1-24b-instruct", "Small 3.1 24B", 128_000, 0.351, 0.555),
|
|
35
|
-
entry("workers-ai", "@cf/ibm-granite/granite-4.0-h-micro", "Granite 4.0 Micro", 131_000, 0.017, 0.112),
|
|
36
|
-
entry("workers-ai", "@cf/qwen/qwen3-30b-a3b-fp8", "Qwen3 30B", 32_768, 0.0509, 0.335),
|
|
37
|
-
];
|
|
38
|
-
function entry(provider, model, name, contextTokens, inputPerMillion, outputPerMillion) {
|
|
39
|
-
return {
|
|
40
|
-
provider,
|
|
41
|
-
model,
|
|
42
|
-
name,
|
|
43
|
-
contextTokens,
|
|
44
|
-
price: { inputPerMillion, outputPerMillion },
|
|
45
|
-
source: "builtin",
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* The model's own name, taken from its id rather than invented.
|
|
50
|
-
*
|
|
51
|
-
* A live Workers AI model that is not in the table above has no written-out name anywhere, and
|
|
52
|
-
* "@cf/qwen/qwen3-30b-a3b-fp8" prettified by any rule short enough to write here comes out wrong —
|
|
53
|
-
* so the last segment of the id is used as it stands. A raw name is easier to recognise as raw than
|
|
54
|
-
* a wrong one is to recognise as wrong.
|
|
55
|
-
*/
|
|
56
|
-
function nameFromId(model) {
|
|
57
|
-
const segments = model.split("/");
|
|
58
|
-
return segments[segments.length - 1] ?? model;
|
|
59
|
-
}
|
|
60
|
-
export function createModelCatalog(deps) {
|
|
61
|
-
return {
|
|
62
|
-
async list() {
|
|
63
|
-
if (!deps.cloudflare)
|
|
64
|
-
return { entries: builtin, liveStatus: "not_configured" };
|
|
65
|
-
try {
|
|
66
|
-
const live = await deps.cloudflare.workersAiModels();
|
|
67
|
-
const merged = new Map(builtin.map((known) => [`${known.provider}:${known.model}`, known]));
|
|
68
|
-
for (const model of live) {
|
|
69
|
-
// ⚠️ A model that cannot call a tool is skipped rather than listed without figures. It
|
|
70
|
-
// would be an offer that produces a broken agent for whoever took it.
|
|
71
|
-
if (!model.functionCalling)
|
|
72
|
-
continue;
|
|
73
|
-
const key = `workers-ai:${model.name}`;
|
|
74
|
-
const known = merged.get(key);
|
|
75
|
-
merged.set(key, {
|
|
76
|
-
provider: "workers-ai",
|
|
77
|
-
model: model.name,
|
|
78
|
-
name: known?.name ?? nameFromId(model.name),
|
|
79
|
-
// ⚠️ The live figure wins, and a live figure that is MISSING wins too — falling back to
|
|
80
|
-
// the table for one of the two halves would produce an entry that is half fresh and
|
|
81
|
-
// half years old, labelled fresh. Either the account answered for this model or it did
|
|
82
|
-
// not.
|
|
83
|
-
contextTokens: model.contextTokens,
|
|
84
|
-
price: model.price,
|
|
85
|
-
source: "cloudflare",
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
return { entries: [...merged.values()], liveStatus: "read" };
|
|
89
|
-
}
|
|
90
|
-
catch {
|
|
91
|
-
// ⚠️ Named, not thrown. The select has to render either way — an agent whose model cannot be
|
|
92
|
-
// chosen is an agent nobody can repair from that screen — and the alternative to a stale
|
|
93
|
-
// price here is no price at all, which helps nobody choose. What the caller gets is the
|
|
94
|
-
// table plus the reason it is the table, and the screen says so.
|
|
95
|
-
return { entries: builtin, liveStatus: "unreadable" };
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
};
|
|
99
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { ModelCatalog } from "@anchrd/intel-contract";
|
|
2
|
-
import type { CloudflareAccountApi } from "../adapters/cloudflare-api/cloudflare-api.types.js";
|
|
3
|
-
export interface ModelCatalogDeps {
|
|
4
|
-
/** Absent where the deployment configured no Cloudflare read token. A named state, not an error. */
|
|
5
|
-
cloudflare?: Pick<CloudflareAccountApi, "workersAiModels">;
|
|
6
|
-
}
|
|
7
|
-
export interface ModelCatalogService {
|
|
8
|
-
/**
|
|
9
|
-
* ⚠️ The answer shape lives in `@anchrd/intel-contract`, because the select in the browser parses
|
|
10
|
-
* it. Its `source` field is per ENTRY on purpose: Cloudflare publishes figures for the models it
|
|
11
|
-
* serves itself and none for the Anthropic models it resells, so a healthy read still leaves half
|
|
12
|
-
* the list on a written-out table (#257).
|
|
13
|
-
*/
|
|
14
|
-
list(): Promise<ModelCatalog>;
|
|
15
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { type BoardDocument } from "@anchrd/intel-contract";
|
|
2
|
-
import type { BoardDeps, BoardOperations } from "./board.types.js";
|
|
3
|
-
/**
|
|
4
|
-
* A stored board brought up to the current schema, before it is validated.
|
|
5
|
-
*
|
|
6
|
-
* ⚠️ It runs before `BoardDocument.parse`, on `unknown`, because after that parse a missing field or
|
|
7
|
-
* a repeated id is already a refusal — and `parseStoredBoard` is deliberately loud
|
|
8
|
-
* (`board_unreadable`), so an un-upgraded board would not read as "old", it would read as corrupt.
|
|
9
|
-
*
|
|
10
|
-
* The upgrade is persisted by the next write of any kind, because every write serialises the whole
|
|
11
|
-
* document. Nothing has to be migrated ahead of time and nothing has to be re-migrated.
|
|
12
|
-
*/
|
|
13
|
-
export declare function upgradeStoredBoard(parsed: unknown): unknown;
|
|
14
|
-
/**
|
|
15
|
-
* The first id a board document uses for two different things (anchrd/intel#321).
|
|
16
|
-
*
|
|
17
|
-
* ⚠️ Deliberately NOT a rule on `BoardDocument`, and that is the whole decision. A schema rule would
|
|
18
|
-
* reach every parse of a stored body — `parseStoredBoard`, `indexing.ts`, the link reader — and a
|
|
19
|
-
* board imported before this existed would stop answering with `board_unreadable`: the whole board
|
|
20
|
-
* gone over something that costs one view. It is the trap #311 walked into, and #318 walked into
|
|
21
|
-
* from the other side.
|
|
22
|
-
*
|
|
23
|
-
* ⚠️ And NOT folded in `upgradeStoredBoard` either, which is where the sibling rules of #318 went. A
|
|
24
|
-
* repeated `dependsOn`, label or reference carries no information, so dropping the second mention
|
|
25
|
-
* loses nothing. Two tasks under one id are two whole tasks — titles, dates, descriptions — and a
|
|
26
|
-
* fold on the READ is written back by the next save of any kind, because every write serialises the
|
|
27
|
-
* whole document. That is one task gone for good, for every board, without anybody having asked.
|
|
28
|
-
* The UI folds the same pair for a DRAWING (`orderedTasks`), which costs nothing: the document keeps
|
|
29
|
-
* both, and repairing the pair brings the second card back.
|
|
30
|
-
*
|
|
31
|
-
* ⚠️ What this does NOT rescue, and it is worth knowing: `replaced` matches a task by id, so the
|
|
32
|
-
* first `board_task_update` against such a pair writes the SAME task into both entries. The stored
|
|
33
|
-
* board is then two identical tasks rather than two different ones. That is a consequence of
|
|
34
|
-
* addressing a board by task id at all (#285) and predates this rule; the reason the rule is at the
|
|
35
|
-
* import is to stop the pair from existing, not to make it survivable.
|
|
36
|
-
*
|
|
37
|
-
* So it is asked exactly where there is a caller to answer: the bundle import, the one door a board
|
|
38
|
-
* document written elsewhere comes in through. Everything else mints task ids itself (`deps.id()`)
|
|
39
|
-
* and takes its status list through `ConfigureBoardInput`, which has demanded distinct ids since
|
|
40
|
-
* #285.
|
|
41
|
-
*/
|
|
42
|
-
export declare function repeatedBoardId(document: BoardDocument): {
|
|
43
|
-
list: "statuses" | "tasks";
|
|
44
|
-
id: string;
|
|
45
|
-
} | null;
|
|
46
|
-
/**
|
|
47
|
-
* Every board operation, applied to the document rather than to the file (#285).
|
|
48
|
-
*
|
|
49
|
-
* ⚠️ This module is where a board's rules live, and it is deliberately pure: it takes a document
|
|
50
|
-
* and gives back the next one. The version, R2 and the retry against a racing write are the
|
|
51
|
-
* service's business (`nodes.ts`), and the surfaces have no rules of their own — HTTP, MCP and the
|
|
52
|
-
* UI all arrive here. A second implementation of "may this task depend on that one" is the thing
|
|
53
|
-
* this shape exists to prevent.
|
|
54
|
-
*
|
|
55
|
-
* ⚠️ What it does NOT check is anything that needs the tree: whether a `references` id names a node
|
|
56
|
-
* the writer may see, and whether an `agent` assignee is really an agent. Those are reads against
|
|
57
|
-
* D1 and the ACL, so they happen in the service before the document is touched at all.
|
|
58
|
-
*/
|
|
59
|
-
export declare function createBoard(deps: BoardDeps): BoardOperations;
|