@absolutejs/rag 0.0.31 → 0.1.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/manifest.js +112 -17
- package/dist/manifest.js.map +4 -4
- package/dist/manifest.json +77 -2
- package/dist/src/manifest.d.ts +13 -1
- package/package.json +3 -3
package/dist/manifest.js
CHANGED
|
@@ -33,14 +33,19 @@ var defineImplementation = () => (implementation) => {
|
|
|
33
33
|
const defined = implementation;
|
|
34
34
|
return defined;
|
|
35
35
|
};
|
|
36
|
-
var defineManifest = () => (manifest) =>
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
var defineManifest = () => (manifest) => manifest;
|
|
37
|
+
var literal = (value) => value;
|
|
38
|
+
var RUNTIME_KIND = literal("runtime");
|
|
39
|
+
var WORKSPACE_KIND = literal("workspace");
|
|
40
|
+
var toolFactory = () => {
|
|
41
|
+
function runtime(definition) {
|
|
42
|
+
return { kind: RUNTIME_KIND, ...definition };
|
|
43
|
+
}
|
|
44
|
+
function workspace(definition) {
|
|
45
|
+
return { kind: WORKSPACE_KIND, ...definition };
|
|
46
|
+
}
|
|
47
|
+
return { runtime, workspace };
|
|
39
48
|
};
|
|
40
|
-
var toolFactory = () => ({
|
|
41
|
-
runtime: (definition) => ({ kind: "runtime", ...definition }),
|
|
42
|
-
workspace: (definition) => ({ kind: "workspace", ...definition })
|
|
43
|
-
});
|
|
44
49
|
function IsAsyncIterator(value) {
|
|
45
50
|
return IsObject(value) && globalThis.Symbol.asyncIterator in value;
|
|
46
51
|
}
|
|
@@ -778,7 +783,7 @@ function String2(options) {
|
|
|
778
783
|
function* FromUnion(syntax) {
|
|
779
784
|
const trim = syntax.trim().replace(/"|'/g, "");
|
|
780
785
|
return trim === "boolean" ? yield Boolean() : trim === "number" ? yield Number2() : trim === "bigint" ? yield BigInt2() : trim === "string" ? yield String2() : yield (() => {
|
|
781
|
-
const literals = trim.split("|").map((
|
|
786
|
+
const literals = trim.split("|").map((literal2) => Literal(literal2.trim()));
|
|
782
787
|
return literals.length === 0 ? Never() : literals.length === 1 ? literals[0] : UnionEvaluated(literals);
|
|
783
788
|
})();
|
|
784
789
|
}
|
|
@@ -3486,10 +3491,10 @@ function ScoreUnion(schema, references, value) {
|
|
|
3486
3491
|
const keys = Object.getOwnPropertyNames(value);
|
|
3487
3492
|
const entries = Object.entries(object.properties);
|
|
3488
3493
|
return entries.reduce((acc, [key, schema2]) => {
|
|
3489
|
-
const
|
|
3494
|
+
const literal2 = schema2[Kind] === "Literal" && schema2.const === value[key] ? 100 : 0;
|
|
3490
3495
|
const checks = Check(schema2, references, value[key]) ? 10 : 0;
|
|
3491
3496
|
const exists = keys.includes(key) ? 1 : 0;
|
|
3492
|
-
return acc + (
|
|
3497
|
+
return acc + (literal2 + checks + exists);
|
|
3493
3498
|
}, 0);
|
|
3494
3499
|
} else if (schema[Kind] === "Union") {
|
|
3495
3500
|
const schemas = schema.anyOf.map((schema2) => Deref(schema2, references));
|
|
@@ -5826,7 +5831,13 @@ var wiringSnippet = Type.Object({
|
|
|
5826
5831
|
Type.Literal("server-plugin")
|
|
5827
5832
|
]))
|
|
5828
5833
|
});
|
|
5829
|
-
var clientFrameworks = [
|
|
5834
|
+
var clientFrameworks = [
|
|
5835
|
+
"angular",
|
|
5836
|
+
"client",
|
|
5837
|
+
"react",
|
|
5838
|
+
"svelte",
|
|
5839
|
+
"vue"
|
|
5840
|
+
];
|
|
5830
5841
|
var wiringRecipe = Type.Object({
|
|
5831
5842
|
client: Type.Optional(Type.Partial(Type.Object(Object.fromEntries(clientFrameworks.map((framework) => [framework, wiringSnippet]))))),
|
|
5832
5843
|
description: Type.Optional(Type.String()),
|
|
@@ -5891,8 +5902,47 @@ var toolAnnotations = Type.Object({
|
|
|
5891
5902
|
readOnlyHint: Type.Optional(Type.Boolean()),
|
|
5892
5903
|
title: Type.Optional(Type.String())
|
|
5893
5904
|
});
|
|
5905
|
+
var toolAuthorization = Type.Object({
|
|
5906
|
+
approval: Type.Union([
|
|
5907
|
+
Type.Literal("always"),
|
|
5908
|
+
Type.Literal("never"),
|
|
5909
|
+
Type.Literal("policy")
|
|
5910
|
+
]),
|
|
5911
|
+
audience: Type.Union([
|
|
5912
|
+
Type.Literal("admin"),
|
|
5913
|
+
Type.Literal("authenticated"),
|
|
5914
|
+
Type.Literal("owner"),
|
|
5915
|
+
Type.Literal("public")
|
|
5916
|
+
]),
|
|
5917
|
+
compensatingTool: Type.Optional(Type.String({ pattern: TOOL_NAME_PATTERN.source })),
|
|
5918
|
+
destinationFields: Type.Optional(Type.Array(Type.String({ minLength: 1 }), { minItems: 1 })),
|
|
5919
|
+
destinations: Type.Optional(Type.Array(Type.String({ minLength: 1 }), { minItems: 1 })),
|
|
5920
|
+
effects: Type.Array(Type.String({ minLength: 1 }), { minItems: 1 }),
|
|
5921
|
+
idempotency: Type.Optional(Type.Union([
|
|
5922
|
+
Type.Object({
|
|
5923
|
+
field: Type.String({ minLength: 1 }),
|
|
5924
|
+
mode: Type.Literal("field")
|
|
5925
|
+
}),
|
|
5926
|
+
Type.Object({ mode: Type.Literal("host") }),
|
|
5927
|
+
Type.Object({ mode: Type.Literal("resource") })
|
|
5928
|
+
])),
|
|
5929
|
+
requiredScopes: Type.Optional(Type.Array(Type.String({ minLength: 1 }), { minItems: 1 })),
|
|
5930
|
+
resource: Type.Optional(Type.Object({
|
|
5931
|
+
idField: Type.Optional(Type.String({ minLength: 1 })),
|
|
5932
|
+
ownerIdField: Type.Optional(Type.String({ minLength: 1 })),
|
|
5933
|
+
tenantIdField: Type.Optional(Type.String({ minLength: 1 })),
|
|
5934
|
+
type: Type.String({ minLength: 1 })
|
|
5935
|
+
})),
|
|
5936
|
+
reversible: Type.Optional(Type.Boolean()),
|
|
5937
|
+
spend: Type.Optional(Type.Object({
|
|
5938
|
+
amountMinorField: Type.String({ minLength: 1 }),
|
|
5939
|
+
currencyField: Type.String({ minLength: 1 }),
|
|
5940
|
+
maximumAmountMinor: Type.Optional(Type.Integer({ minimum: 0 }))
|
|
5941
|
+
}))
|
|
5942
|
+
});
|
|
5894
5943
|
var serializedTool = Type.Object({
|
|
5895
5944
|
annotations: Type.Optional(toolAnnotations),
|
|
5945
|
+
authorization: Type.Optional(toolAuthorization),
|
|
5896
5946
|
capabilities: Type.Optional(Type.Array(Type.Union([
|
|
5897
5947
|
Type.Literal("exec"),
|
|
5898
5948
|
Type.Literal("glob"),
|
|
@@ -5904,7 +5954,15 @@ var serializedTool = Type.Object({
|
|
|
5904
5954
|
kind: Type.Union([Type.Literal("runtime"), Type.Literal("workspace")])
|
|
5905
5955
|
});
|
|
5906
5956
|
var manifestSchema = Type.Object({
|
|
5907
|
-
contract: Type.Literal(1),
|
|
5957
|
+
contract: Type.Union([Type.Literal(1), Type.Literal(2)]),
|
|
5958
|
+
discovery: Type.Optional(Type.Object({
|
|
5959
|
+
audiences: Type.Optional(Type.Array(Type.String({ minLength: 1 }))),
|
|
5960
|
+
certificationUrl: Type.Optional(Type.String()),
|
|
5961
|
+
intents: Type.Optional(Type.Array(Type.String({ minLength: 1 }))),
|
|
5962
|
+
keywords: Type.Optional(Type.Array(Type.String({ minLength: 1 }))),
|
|
5963
|
+
protocols: Type.Optional(Type.Array(Type.String({ minLength: 1 }))),
|
|
5964
|
+
url: Type.Optional(Type.String())
|
|
5965
|
+
})),
|
|
5908
5966
|
identity: Type.Object({
|
|
5909
5967
|
accent: Type.Optional(Type.String({ pattern: "^#[0-9a-fA-F]{3,8}$" })),
|
|
5910
5968
|
category: Type.String({ minLength: 1 }),
|
|
@@ -5914,7 +5972,9 @@ var manifestSchema = Type.Object({
|
|
|
5914
5972
|
svg: Type.Optional(Type.String()),
|
|
5915
5973
|
url: Type.Optional(Type.String())
|
|
5916
5974
|
})),
|
|
5917
|
-
name: Type.String({
|
|
5975
|
+
name: Type.String({
|
|
5976
|
+
pattern: "^(@[a-z0-9-~][a-z0-9-._~]*/)?[a-z0-9-~][a-z0-9-._~]*$"
|
|
5977
|
+
}),
|
|
5918
5978
|
tagline: Type.String({ minLength: 1 })
|
|
5919
5979
|
}),
|
|
5920
5980
|
implements: Type.Optional(Type.Array(adapterImplementation)),
|
|
@@ -6887,7 +6947,7 @@ function String3(options) {
|
|
|
6887
6947
|
function* FromUnion21(syntax) {
|
|
6888
6948
|
const trim = syntax.trim().replace(/"|'/g, "");
|
|
6889
6949
|
return trim === "boolean" ? yield Boolean2() : trim === "number" ? yield Number3() : trim === "bigint" ? yield BigInt3() : trim === "string" ? yield String3() : yield (() => {
|
|
6890
|
-
const literals = trim.split("|").map((
|
|
6950
|
+
const literals = trim.split("|").map((literal2) => Literal2(literal2.trim()));
|
|
6891
6951
|
return literals.length === 0 ? Never2() : literals.length === 1 ? literals[0] : UnionEvaluated2(literals);
|
|
6892
6952
|
})();
|
|
6893
6953
|
}
|
|
@@ -8489,7 +8549,7 @@ var EXCERPT_LENGTH = 300;
|
|
|
8489
8549
|
var MAX_TOP_K = 100;
|
|
8490
8550
|
var MAX_DIMENSIONS = 8192;
|
|
8491
8551
|
var manifest = defineManifest()({
|
|
8492
|
-
contract:
|
|
8552
|
+
contract: 2,
|
|
8493
8553
|
identity: {
|
|
8494
8554
|
accent: "#10b981",
|
|
8495
8555
|
category: "ai",
|
|
@@ -8775,6 +8835,12 @@ var manifest = defineManifest()({
|
|
|
8775
8835
|
tools: {
|
|
8776
8836
|
ingest_status: tool.runtime({
|
|
8777
8837
|
annotations: { readOnlyHint: true },
|
|
8838
|
+
authorization: {
|
|
8839
|
+
approval: "never",
|
|
8840
|
+
audience: "owner",
|
|
8841
|
+
effects: ["read"],
|
|
8842
|
+
requiredScopes: ["rag:read"]
|
|
8843
|
+
},
|
|
8778
8844
|
description: "Report the vector store backing this collection: backend, vector mode, dimensions, and capabilities (persistence, native vector search, server-side filtering). Not every store reports status.",
|
|
8779
8845
|
handler: (_input, collection) => {
|
|
8780
8846
|
const status = collection.getStatus?.();
|
|
@@ -8788,6 +8854,16 @@ var manifest = defineManifest()({
|
|
|
8788
8854
|
}),
|
|
8789
8855
|
ingest_text: tool.runtime({
|
|
8790
8856
|
annotations: { idempotentHint: true },
|
|
8857
|
+
authorization: {
|
|
8858
|
+
approval: "policy",
|
|
8859
|
+
audience: "owner",
|
|
8860
|
+
destinations: ["configured-embedding-provider", "configured-vector-store"],
|
|
8861
|
+
effects: ["write", "external-network"],
|
|
8862
|
+
idempotency: { mode: "resource" },
|
|
8863
|
+
requiredScopes: ["rag:write"],
|
|
8864
|
+
resource: { idField: "sourceId", type: "rag-source" },
|
|
8865
|
+
reversible: false
|
|
8866
|
+
},
|
|
8791
8867
|
description: "Add (or replace) one text document in the search index under a stable sourceId. Re-ingesting the same sourceId replaces its previous chunks, so it is safe to repeat.",
|
|
8792
8868
|
handler: async ({ sourceId, text, title }, collection) => {
|
|
8793
8869
|
const result = await collection.ingestSource({
|
|
@@ -8807,6 +8883,16 @@ var manifest = defineManifest()({
|
|
|
8807
8883
|
}),
|
|
8808
8884
|
remove_source: tool.runtime({
|
|
8809
8885
|
annotations: { destructiveHint: true, idempotentHint: true },
|
|
8886
|
+
authorization: {
|
|
8887
|
+
approval: "always",
|
|
8888
|
+
audience: "owner",
|
|
8889
|
+
destinations: ["configured-vector-store"],
|
|
8890
|
+
effects: ["delete", "external-network"],
|
|
8891
|
+
idempotency: { mode: "resource" },
|
|
8892
|
+
requiredScopes: ["rag:delete"],
|
|
8893
|
+
resource: { idField: "sourceId", type: "rag-source" },
|
|
8894
|
+
reversible: false
|
|
8895
|
+
},
|
|
8810
8896
|
description: "Delete every indexed chunk previously ingested under a sourceId. Removing an unknown sourceId deletes nothing and succeeds.",
|
|
8811
8897
|
handler: async ({ chunkCount, sourceId }, collection) => {
|
|
8812
8898
|
const result = await collection.removeSource({
|
|
@@ -8824,7 +8910,16 @@ var manifest = defineManifest()({
|
|
|
8824
8910
|
})
|
|
8825
8911
|
}),
|
|
8826
8912
|
search_content: tool.runtime({
|
|
8827
|
-
annotations: {
|
|
8913
|
+
annotations: { idempotentHint: true, openWorldHint: true },
|
|
8914
|
+
authorization: {
|
|
8915
|
+
approval: "policy",
|
|
8916
|
+
audience: "owner",
|
|
8917
|
+
destinations: ["configured-embedding-provider", "configured-vector-store"],
|
|
8918
|
+
effects: ["read", "external-network"],
|
|
8919
|
+
idempotency: { mode: "host" },
|
|
8920
|
+
requiredScopes: ["rag:read"],
|
|
8921
|
+
reversible: false
|
|
8922
|
+
},
|
|
8828
8923
|
description: "Search the indexed content and return the best-matching passages with scores, titles, and sources. Use this to ground answers in the site's own content.",
|
|
8829
8924
|
handler: async ({ query, scoreThreshold, topK }, collection) => {
|
|
8830
8925
|
const results = await collection.search({
|
|
@@ -8900,5 +8995,5 @@ export {
|
|
|
8900
8995
|
manifest
|
|
8901
8996
|
};
|
|
8902
8997
|
|
|
8903
|
-
//# debugId=
|
|
8998
|
+
//# debugId=36FE7B69F2E9DC5464756E2164756E21
|
|
8904
8999
|
//# sourceMappingURL=manifest.js.map
|