openloops 0.2.7 → 0.2.8

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 (37) hide show
  1. package/dist/db/index.d.ts +1 -0
  2. package/dist/db/index.js +22 -0
  3. package/dist/db/index.mjs +1 -0
  4. package/dist/db/indexes/agent-actions.d.ts +2 -0
  5. package/dist/db/indexes/agent-actions.js +30 -0
  6. package/dist/db/indexes/agent-actions.mjs +7 -0
  7. package/dist/db/indexes/agent-tasks.d.ts +2 -0
  8. package/dist/db/indexes/agent-tasks.js +30 -0
  9. package/dist/db/indexes/agent-tasks.mjs +7 -0
  10. package/dist/db/indexes/agent-traces.d.ts +2 -0
  11. package/dist/db/indexes/agent-traces.js +30 -0
  12. package/dist/db/indexes/agent-traces.mjs +7 -0
  13. package/dist/db/indexes/agentic-job-runs.d.ts +2 -0
  14. package/dist/db/indexes/agentic-job-runs.js +32 -0
  15. package/dist/db/indexes/agentic-job-runs.mjs +9 -0
  16. package/dist/db/indexes/agentic-jobs.d.ts +2 -0
  17. package/dist/db/indexes/agentic-jobs.js +31 -0
  18. package/dist/db/indexes/agentic-jobs.mjs +8 -0
  19. package/dist/db/indexes/chats.d.ts +2 -0
  20. package/dist/db/indexes/chats.js +30 -0
  21. package/dist/db/indexes/chats.mjs +7 -0
  22. package/dist/db/indexes/index.d.ts +3 -0
  23. package/dist/db/indexes/index.js +56 -0
  24. package/dist/db/indexes/index.mjs +32 -0
  25. package/dist/db/indexes/llm-calls.d.ts +2 -0
  26. package/dist/db/indexes/llm-calls.js +32 -0
  27. package/dist/db/indexes/llm-calls.mjs +9 -0
  28. package/dist/db/indexes/mcp-servers.d.ts +2 -0
  29. package/dist/db/indexes/mcp-servers.js +30 -0
  30. package/dist/db/indexes/mcp-servers.mjs +7 -0
  31. package/dist/db/indexes/workspace-items.d.ts +2 -0
  32. package/dist/db/indexes/workspace-items.js +30 -0
  33. package/dist/db/indexes/workspace-items.mjs +7 -0
  34. package/docs/agentic-jobs.md +1 -1
  35. package/docs/configuration.md +16 -0
  36. package/docs/integration-guide.md +2 -1
  37. package/package.json +5 -1
@@ -0,0 +1 @@
1
+ export * from './indexes';
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+ var db_exports = {};
17
+ module.exports = __toCommonJS(db_exports);
18
+ __reExport(db_exports, require("./indexes"), module.exports);
19
+ // Annotate the CommonJS export names for ESM import in node:
20
+ 0 && (module.exports = {
21
+ ...require("./indexes")
22
+ });
@@ -0,0 +1 @@
1
+ export * from "./indexes";
@@ -0,0 +1,2 @@
1
+ import { IndexDescription } from 'mongodb';
2
+ export declare const agentActions: IndexDescription[];
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var agent_actions_exports = {};
20
+ __export(agent_actions_exports, {
21
+ agentActions: () => agentActions
22
+ });
23
+ module.exports = __toCommonJS(agent_actions_exports);
24
+ const agentActions = [
25
+ { key: { ownerId: 1, taskId: 1 } }
26
+ ];
27
+ // Annotate the CommonJS export names for ESM import in node:
28
+ 0 && (module.exports = {
29
+ agentActions
30
+ });
@@ -0,0 +1,7 @@
1
+ import "../../chunk-CF3WOMB3.mjs";
2
+ const agentActions = [
3
+ { key: { ownerId: 1, taskId: 1 } }
4
+ ];
5
+ export {
6
+ agentActions
7
+ };
@@ -0,0 +1,2 @@
1
+ import { IndexDescription } from 'mongodb';
2
+ export declare const agentTasks: IndexDescription[];
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var agent_tasks_exports = {};
20
+ __export(agent_tasks_exports, {
21
+ agentTasks: () => agentTasks
22
+ });
23
+ module.exports = __toCommonJS(agent_tasks_exports);
24
+ const agentTasks = [
25
+ { key: { ownerId: 1, chatId: 1 } }
26
+ ];
27
+ // Annotate the CommonJS export names for ESM import in node:
28
+ 0 && (module.exports = {
29
+ agentTasks
30
+ });
@@ -0,0 +1,7 @@
1
+ import "../../chunk-CF3WOMB3.mjs";
2
+ const agentTasks = [
3
+ { key: { ownerId: 1, chatId: 1 } }
4
+ ];
5
+ export {
6
+ agentTasks
7
+ };
@@ -0,0 +1,2 @@
1
+ import { IndexDescription } from 'mongodb';
2
+ export declare const agentTraces: IndexDescription[];
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var agent_traces_exports = {};
20
+ __export(agent_traces_exports, {
21
+ agentTraces: () => agentTraces
22
+ });
23
+ module.exports = __toCommonJS(agent_traces_exports);
24
+ const agentTraces = [
25
+ { key: { ownerId: 1, chatId: 1 } }
26
+ ];
27
+ // Annotate the CommonJS export names for ESM import in node:
28
+ 0 && (module.exports = {
29
+ agentTraces
30
+ });
@@ -0,0 +1,7 @@
1
+ import "../../chunk-CF3WOMB3.mjs";
2
+ const agentTraces = [
3
+ { key: { ownerId: 1, chatId: 1 } }
4
+ ];
5
+ export {
6
+ agentTraces
7
+ };
@@ -0,0 +1,2 @@
1
+ import { IndexDescription } from 'mongodb';
2
+ export declare const agenticJobRuns: IndexDescription[];
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var agentic_job_runs_exports = {};
20
+ __export(agentic_job_runs_exports, {
21
+ agenticJobRuns: () => agenticJobRuns
22
+ });
23
+ module.exports = __toCommonJS(agentic_job_runs_exports);
24
+ const agenticJobRuns = [
25
+ { key: { jobId: 1, createdAt: -1 } },
26
+ { key: { ownerId: 1, createdAt: -1 } },
27
+ { key: { status: 1, createdAt: 1 } }
28
+ ];
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ agenticJobRuns
32
+ });
@@ -0,0 +1,9 @@
1
+ import "../../chunk-CF3WOMB3.mjs";
2
+ const agenticJobRuns = [
3
+ { key: { jobId: 1, createdAt: -1 } },
4
+ { key: { ownerId: 1, createdAt: -1 } },
5
+ { key: { status: 1, createdAt: 1 } }
6
+ ];
7
+ export {
8
+ agenticJobRuns
9
+ };
@@ -0,0 +1,2 @@
1
+ import { IndexDescription } from 'mongodb';
2
+ export declare const agenticJobs: IndexDescription[];
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var agentic_jobs_exports = {};
20
+ __export(agentic_jobs_exports, {
21
+ agenticJobs: () => agenticJobs
22
+ });
23
+ module.exports = __toCommonJS(agentic_jobs_exports);
24
+ const agenticJobs = [
25
+ { key: { enabled: 1, nextRunAt: 1 } },
26
+ { key: { ownerId: 1, createdAt: -1 } }
27
+ ];
28
+ // Annotate the CommonJS export names for ESM import in node:
29
+ 0 && (module.exports = {
30
+ agenticJobs
31
+ });
@@ -0,0 +1,8 @@
1
+ import "../../chunk-CF3WOMB3.mjs";
2
+ const agenticJobs = [
3
+ { key: { enabled: 1, nextRunAt: 1 } },
4
+ { key: { ownerId: 1, createdAt: -1 } }
5
+ ];
6
+ export {
7
+ agenticJobs
8
+ };
@@ -0,0 +1,2 @@
1
+ import { IndexDescription } from 'mongodb';
2
+ export declare const chats: IndexDescription[];
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var chats_exports = {};
20
+ __export(chats_exports, {
21
+ chats: () => chats
22
+ });
23
+ module.exports = __toCommonJS(chats_exports);
24
+ const chats = [
25
+ { key: { ownerId: 1, updatedAt: -1 } }
26
+ ];
27
+ // Annotate the CommonJS export names for ESM import in node:
28
+ 0 && (module.exports = {
29
+ chats
30
+ });
@@ -0,0 +1,7 @@
1
+ import "../../chunk-CF3WOMB3.mjs";
2
+ const chats = [
3
+ { key: { ownerId: 1, updatedAt: -1 } }
4
+ ];
5
+ export {
6
+ chats
7
+ };
@@ -0,0 +1,3 @@
1
+ import { Db, IndexDescription } from 'mongodb';
2
+ export declare const indexes: Record<string, IndexDescription[]>;
3
+ export declare function ensureIndexes(db: Db): Promise<Record<string, string[]>>;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var indexes_exports = {};
20
+ __export(indexes_exports, {
21
+ ensureIndexes: () => ensureIndexes,
22
+ indexes: () => indexes
23
+ });
24
+ module.exports = __toCommonJS(indexes_exports);
25
+ var import_llm_calls = require("./llm-calls");
26
+ var import_chats = require("./chats");
27
+ var import_agent_tasks = require("./agent-tasks");
28
+ var import_agent_actions = require("./agent-actions");
29
+ var import_agent_traces = require("./agent-traces");
30
+ var import_workspace_items = require("./workspace-items");
31
+ var import_mcp_servers = require("./mcp-servers");
32
+ var import_agentic_jobs = require("./agentic-jobs");
33
+ var import_agentic_job_runs = require("./agentic-job-runs");
34
+ const indexes = {
35
+ llm_calls: import_llm_calls.llmCalls,
36
+ chats: import_chats.chats,
37
+ agent_tasks: import_agent_tasks.agentTasks,
38
+ agent_actions: import_agent_actions.agentActions,
39
+ agent_traces: import_agent_traces.agentTraces,
40
+ workspace_items: import_workspace_items.workspaceItems,
41
+ mcp_servers: import_mcp_servers.mcpServers,
42
+ agentic_jobs: import_agentic_jobs.agenticJobs,
43
+ agentic_job_runs: import_agentic_job_runs.agenticJobRuns
44
+ };
45
+ async function ensureIndexes(db) {
46
+ const created = {};
47
+ for (const [name, definitions] of Object.entries(indexes)) {
48
+ created[name] = await db.collection(name).createIndexes(definitions);
49
+ }
50
+ return created;
51
+ }
52
+ // Annotate the CommonJS export names for ESM import in node:
53
+ 0 && (module.exports = {
54
+ ensureIndexes,
55
+ indexes
56
+ });
@@ -0,0 +1,32 @@
1
+ import "../../chunk-CF3WOMB3.mjs";
2
+ import { llmCalls } from "./llm-calls";
3
+ import { chats } from "./chats";
4
+ import { agentTasks } from "./agent-tasks";
5
+ import { agentActions } from "./agent-actions";
6
+ import { agentTraces } from "./agent-traces";
7
+ import { workspaceItems } from "./workspace-items";
8
+ import { mcpServers } from "./mcp-servers";
9
+ import { agenticJobs } from "./agentic-jobs";
10
+ import { agenticJobRuns } from "./agentic-job-runs";
11
+ const indexes = {
12
+ llm_calls: llmCalls,
13
+ chats,
14
+ agent_tasks: agentTasks,
15
+ agent_actions: agentActions,
16
+ agent_traces: agentTraces,
17
+ workspace_items: workspaceItems,
18
+ mcp_servers: mcpServers,
19
+ agentic_jobs: agenticJobs,
20
+ agentic_job_runs: agenticJobRuns
21
+ };
22
+ async function ensureIndexes(db) {
23
+ const created = {};
24
+ for (const [name, definitions] of Object.entries(indexes)) {
25
+ created[name] = await db.collection(name).createIndexes(definitions);
26
+ }
27
+ return created;
28
+ }
29
+ export {
30
+ ensureIndexes,
31
+ indexes
32
+ };
@@ -0,0 +1,2 @@
1
+ import { IndexDescription } from 'mongodb';
2
+ export declare const llmCalls: IndexDescription[];
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var llm_calls_exports = {};
20
+ __export(llm_calls_exports, {
21
+ llmCalls: () => llmCalls
22
+ });
23
+ module.exports = __toCommonJS(llm_calls_exports);
24
+ const llmCalls = [
25
+ { key: { ownerId: 1, createdAt: -1 } },
26
+ { key: { sessionId: 1 } },
27
+ { key: { answerId: 1 }, sparse: true }
28
+ ];
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ llmCalls
32
+ });
@@ -0,0 +1,9 @@
1
+ import "../../chunk-CF3WOMB3.mjs";
2
+ const llmCalls = [
3
+ { key: { ownerId: 1, createdAt: -1 } },
4
+ { key: { sessionId: 1 } },
5
+ { key: { answerId: 1 }, sparse: true }
6
+ ];
7
+ export {
8
+ llmCalls
9
+ };
@@ -0,0 +1,2 @@
1
+ import { IndexDescription } from 'mongodb';
2
+ export declare const mcpServers: IndexDescription[];
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var mcp_servers_exports = {};
20
+ __export(mcp_servers_exports, {
21
+ mcpServers: () => mcpServers
22
+ });
23
+ module.exports = __toCommonJS(mcp_servers_exports);
24
+ const mcpServers = [
25
+ { key: { ownerId: 1 } }
26
+ ];
27
+ // Annotate the CommonJS export names for ESM import in node:
28
+ 0 && (module.exports = {
29
+ mcpServers
30
+ });
@@ -0,0 +1,7 @@
1
+ import "../../chunk-CF3WOMB3.mjs";
2
+ const mcpServers = [
3
+ { key: { ownerId: 1 } }
4
+ ];
5
+ export {
6
+ mcpServers
7
+ };
@@ -0,0 +1,2 @@
1
+ import { IndexDescription } from 'mongodb';
2
+ export declare const workspaceItems: IndexDescription[];
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var workspace_items_exports = {};
20
+ __export(workspace_items_exports, {
21
+ workspaceItems: () => workspaceItems
22
+ });
23
+ module.exports = __toCommonJS(workspace_items_exports);
24
+ const workspaceItems = [
25
+ { key: { ownerId: 1, chatId: 1 } }
26
+ ];
27
+ // Annotate the CommonJS export names for ESM import in node:
28
+ 0 && (module.exports = {
29
+ workspaceItems
30
+ });
@@ -0,0 +1,7 @@
1
+ import "../../chunk-CF3WOMB3.mjs";
2
+ const workspaceItems = [
3
+ { key: { ownerId: 1, chatId: 1 } }
4
+ ];
5
+ export {
6
+ workspaceItems
7
+ };
@@ -207,7 +207,7 @@ Someone answers a paused run in the chat, outside the runner. The runner checks
207
207
 
208
208
  ## Indexes
209
209
 
210
- The collections are `agentic_jobs` and `agentic_job_runs`. For the queries of the runner and of the lists, create these indexes:
210
+ The collections are `agentic_jobs` and `agentic_job_runs`. `ensureIndexes` from `openloops/db` creates the indexes of the queries of the runner and of the lists (see [configuration](configuration.md#indexes)). They are:
211
211
 
212
212
  - `agentic_jobs`: `{ enabled: 1, nextRunAt: 1 }` and `{ ownerId: 1, createdAt: -1 }`.
213
213
  - `agentic_job_runs`: `{ jobId: 1, createdAt: -1 }`, `{ ownerId: 1, createdAt: -1 }` and `{ status: 1, createdAt: 1 }`.
@@ -79,6 +79,22 @@ The provider and the model go together: sending only one of them is an error. Th
79
79
 
80
80
  The model call goes through a single client that retries, cancels and repeats an attempt that does not answer in time, waits when the provider asks to slow down, drops a temperature setting the model rejects and turns provider errors into messages that are safe to show to the user.
81
81
 
82
+ ## Indexes
83
+
84
+ The collections of the package are queried by owner, chat, task and date, so they need indexes. Without them every query reads the whole collection. Create them once per deployment, and again after upgrading the package, with the helper that lists them all:
85
+
86
+ ```ts
87
+ import { MongoClient } from 'mongodb'
88
+ import { ensureIndexes } from 'openloops/db'
89
+
90
+ const client = new MongoClient(process.env.OPENLOOPS_DB_URI as string)
91
+ await client.connect()
92
+ console.log(await ensureIndexes(client.db(process.env.OPENLOOPS_DB_NAME || 'openloops')))
93
+ await client.close()
94
+ ```
95
+
96
+ It covers `llm_calls`, `chats`, `agent_tasks`, `agent_actions`, `agent_traces`, `workspace_items`, `mcp_servers`, `agentic_jobs` and `agentic_job_runs`. It is safe to run again: an index that already exists is left as it is. Collections of your own application are not included.
97
+
82
98
  ## What is recorded
83
99
 
84
100
  - Every LLM call, with its response, tokens and cost. See [usage](usage.md).
@@ -115,7 +115,7 @@ runner.start()
115
115
 
116
116
  - It is safe to start the worker in several instances: a due job is taken by one of them.
117
117
  - Stop it with `runner.stop()` when the process receives `SIGTERM`.
118
- - Create the indexes listed in [agentic jobs](agentic-jobs.md#indexes).
118
+ - Create the indexes with `ensureIndexes` from `openloops/db`, see [configuration](configuration.md#indexes). The ones of the jobs are listed in [agentic jobs](agentic-jobs.md#indexes).
119
119
  - A job that needs the user (a destructive tool, an unapproved server, a question) pauses its run, and the user answers in the chat of that run. Show those runs, which you can list with `listAgenticJobRunsByUser({ status: 'paused' })`.
120
120
 
121
121
  ## Security checklist
@@ -136,3 +136,4 @@ runner.start()
136
136
  - Treating `error` as an exception that is thrown. It is returned.
137
137
  - Forgetting that a run in `awaiting_user_confirmation` is waiting for the next message of the user, and that the next message is the answer.
138
138
  - Starting the scheduled jobs worker without creating its indexes.
139
+ - Running the package on a real database without calling `ensureIndexes`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openloops",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "Open source harness for AI agents: a TypeScript runtime with persistence, tools, MCP trust, approvals and autonomous jobs, where the loop is pluggable",
5
5
  "author": {
6
6
  "name": "Jose Barcos",
@@ -70,6 +70,10 @@
70
70
  "./users": {
71
71
  "types": "./dist/services/users/index.d.ts",
72
72
  "default": "./dist/services/users/index.js"
73
+ },
74
+ "./db": {
75
+ "types": "./dist/db/index.d.ts",
76
+ "default": "./dist/db/index.js"
73
77
  }
74
78
  },
75
79
  "files": [