openloops 0.7.2 → 0.7.5
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/CHANGELOG.md +7 -1
- package/dist/common/base/current-user.js +1 -1
- package/dist/common/base/current-user.mjs +1 -1
- package/dist/loops/agi/loop.js +1 -1
- package/dist/loops/agi/loop.mjs +1 -1
- package/dist/services/mcp-servers/admin/use-cases/create-internal-mcp.use-case.d.ts +1 -1
- package/dist/services/mcp-servers/admin/use-cases/create-internal-mcp.use-case.js +2 -2
- package/dist/services/mcp-servers/admin/use-cases/create-internal-mcp.use-case.mjs +2 -2
- package/dist/services/mcp-servers/admin/use-cases/update-internal-mcp.use-case.d.ts +1 -1
- package/dist/services/mcp-servers/admin/use-cases/update-internal-mcp.use-case.js +2 -2
- package/dist/services/mcp-servers/admin/use-cases/update-internal-mcp.use-case.mjs +2 -2
- package/dist/services/mcp-servers/entities/mcpserver.entity.d.ts +1 -3
- package/dist/services/mcp-servers/entities/mcpserver.entity.js +3 -8
- package/dist/services/mcp-servers/entities/mcpserver.entity.mjs +3 -8
- package/dist/services/mcp-servers/internal.d.ts +0 -1
- package/dist/services/mcp-servers/internal.js +1 -1
- package/dist/services/mcp-servers/internal.mjs +1 -1
- package/dist/services/mcp-servers/use-cases/update-mcpserver.use-case.js +1 -1
- package/dist/services/mcp-servers/use-cases/update-mcpserver.use-case.mjs +1 -1
- package/dist/services/tasks/entities/agent-action.entity.d.ts +3 -1
- package/dist/services/tasks/entities/agent-action.entity.js +8 -3
- package/dist/services/tasks/entities/agent-action.entity.mjs +8 -3
- package/dist/services/tasks/entities/agent-task.entity.js +1 -1
- package/dist/services/tasks/entities/agent-task.entity.mjs +1 -1
- package/dist/services/users/repositories/user.repository.js +1 -1
- package/dist/services/users/repositories/user.repository.mjs +1 -1
- package/dist/tools/core/fetch-url/fetch-url.tool.d.ts +2 -0
- package/dist/tools/core/fetch-url/fetch-url.tool.js +184 -0
- package/dist/tools/core/fetch-url/fetch-url.tool.mjs +150 -0
- package/dist/tools/core/fetch-url/html-to-text.d.ts +1 -0
- package/dist/tools/core/fetch-url/html-to-text.js +137 -0
- package/dist/tools/core/fetch-url/html-to-text.mjs +113 -0
- package/dist/tools/core/fetch-url/index.d.ts +1 -0
- package/dist/tools/core/fetch-url/index.js +22 -0
- package/dist/tools/core/fetch-url/index.mjs +1 -0
- package/dist/tools/core/fetch-url/network-guard.d.ts +1 -0
- package/dist/tools/core/fetch-url/network-guard.js +62 -0
- package/dist/tools/core/fetch-url/network-guard.mjs +38 -0
- package/dist/tools/core/index.d.ts +1 -0
- package/dist/tools/core/index.js +2 -0
- package/dist/tools/core/index.mjs +1 -0
- package/dist/tools/core/web-search/web-search.tool.js +3 -1
- package/dist/tools/core/web-search/web-search.tool.mjs +3 -1
- package/dist/tools/tool.js +1 -1
- package/dist/tools/tool.mjs +1 -1
- package/docs/automations.md +1 -0
- package/docs/mcp-servers.md +3 -4
- package/docs/tools.md +34 -1
- package/examples/authentication/login.ts +5 -0
- package/examples/automations/create-automation.ts +5 -0
- package/examples/automations/create-event-automation.ts +5 -0
- package/examples/automations/list-automation-runs.ts +6 -0
- package/examples/automations/list-automations.ts +3 -0
- package/examples/automations/preview-automation-runs.ts +3 -0
- package/examples/automations/receive-automation-event.ts +5 -0
- package/examples/automations/revoke-automation-event-token.ts +6 -0
- package/examples/automations/run-automation-now.ts +3 -0
- package/examples/automations/run-automation-worker.ts +7 -0
- package/examples/automations/update-automation.ts +6 -0
- package/examples/chats/delete-chat.ts +6 -0
- package/examples/chats/get-chat-by-id.ts +6 -0
- package/examples/chats/list-autonomous-chats.ts +3 -0
- package/examples/chats/list-chats.ts +3 -0
- package/examples/guardrails/custom-guard.ts +5 -0
- package/examples/loops/custom-loop.ts +8 -0
- package/examples/mcps/create-mcp.ts +5 -0
- package/examples/mcps/decide-mcp.ts +6 -0
- package/examples/mcps/delete-mcp.ts +6 -0
- package/examples/mcps/get-mcp-by-id.ts +3 -0
- package/examples/mcps/internal-mcp-admin.ts +24 -1
- package/examples/mcps/internal-mcp.ts +14 -0
- package/examples/mcps/list-all-mcps.ts +3 -0
- package/examples/mcps/list-user-mcps.ts +3 -0
- package/examples/mcps/update-mcp.ts +5 -0
- package/examples/mcps/verify-mcp.ts +3 -0
- package/examples/run-agent/interrupt-agent.ts +3 -0
- package/examples/run-agent/run-agent-autonomous.ts +3 -0
- package/examples/run-agent/run-agent-strict-mode.ts +3 -0
- package/examples/run-agent/run-agent-with-confirmation.ts +6 -0
- package/examples/run-agent/run-agent-with-fallback-model.ts +3 -0
- package/examples/run-agent/run-agent-with-fetch-url.ts +34 -0
- package/examples/run-agent/run-agent-with-guards.ts +3 -0
- package/examples/run-agent/run-agent-with-hooks.ts +6 -0
- package/examples/run-agent/run-agent-with-identity.ts +3 -0
- package/examples/run-agent/run-agent-with-model.ts +3 -0
- package/examples/run-agent/run-agent-with-slack.ts +3 -0
- package/examples/run-agent/run-agent-with-tools.ts +3 -0
- package/examples/tools/basic-tool.ts +3 -0
- package/examples/tools/destructive-tool.ts +3 -0
- package/examples/tools/web-search-tool.ts +3 -0
- package/examples/usage/get-chat-usage.ts +3 -0
- package/examples/usage/get-message-usage.ts +3 -0
- package/examples/usage/get-usage-stats-by-range.ts +3 -0
- package/examples/usage/get-usage-stats.ts +3 -0
- package/examples/users/create-user.ts +3 -0
- package/examples/users/delete-user.ts +6 -0
- package/examples/users/get-user-by-id.ts +3 -0
- package/examples/users/list-users.ts +3 -0
- package/examples/users/set-default-model.ts +6 -0
- package/examples/users/update-user.ts +3 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,10 +8,11 @@ This version breaks the API of the internal MCP servers in automations. Before,
|
|
|
8
8
|
|
|
9
9
|
### Added
|
|
10
10
|
|
|
11
|
+
- `fetchUrlTool` in `openloops/tools`, a basic `curl` for the model: GET to an `http` or `https` URL, HTML converted to text with no dependencies. It refuses private and internal addresses, has fixed limits and does not run JavaScript. Opt-in with `agent.addTool(fetchUrlTool)`. Read [tools](docs/tools.md#fetchurltool).
|
|
11
12
|
- **Internal MCP servers stored in the database**, managed from a back office. `createInternalMcp`, `updateInternalMcp`, `getInternalMcpById`, `listInternalMcps` and `deleteInternalMcp` in the new entry point `openloops/mcps/admin`, all for admins only. The agent loads the enabled ones in every run next to the ones declared in code, with the same rules: trusted, no manifest review, destructive tools still ask. `{{token}}` in a header uses the token of the run, a token written in the header is sent as it is. Read [MCP servers](docs/mcp-servers.md#internal-servers-stored-in-the-database).
|
|
12
13
|
- `internal` and `enabled` in `McpServerProps`. A record without them is a normal server, so no migration is needed.
|
|
13
14
|
- A unique index on the name of the internal servers: run `ensureIndexes`.
|
|
14
|
-
- `autonomousToken` in the internal MCP servers
|
|
15
|
+
- `autonomousToken` in the internal MCP servers declared in code (`InternalMcp`), not in the stored ones. It is the token of a service account, used for `{{token}}` only in an autonomous run that brings no token for that server, and then the agent sends the id of the user in `X-User-Id`. An interactive run never uses it. It is temporary, until the integrations give the runner the token of the owner.
|
|
15
16
|
- `environment` in `McpServerProps`, an optional text for every MCP server, internal or not, to say which environment it belongs to. It is only a label. The functions of `openloops/mcps` and of `openloops/mcps/admin` accept it, and a blank text removes it.
|
|
16
17
|
|
|
17
18
|
### Removed
|
|
@@ -20,9 +21,14 @@ This version breaks the API of the internal MCP servers in automations. Before,
|
|
|
20
21
|
|
|
21
22
|
### Changed
|
|
22
23
|
|
|
24
|
+
- The `notice` of a tool now goes in every observation of its results, next to `output`, in the turns that follow and in failed calls too, so the model sees it as long as the content is in its context. Before, it only showed when a tool was described by `search_tools`, and a local tool never showed it. The agent saves it in the new `notice` field of `AgentAction` when it runs the tool, an action saved earlier has none. The AgiLoop is now 1.9.0. Read [tools](docs/tools.md#notice).
|
|
25
|
+
- The notice of the tools of external MCP servers, of `webSearchTool` and of `fetchUrlTool` is shorter, because it repeats in every observation.
|
|
26
|
+
- `webSearchTool` tells the model that its results are snippets that can be outdated and use many tokens, and to read a source it already knows first when it has a tool to read pages. It also carries a `notice`, because the results come from the internet.
|
|
23
27
|
- The functions of `openloops/mcps` never see an internal server, not even for an admin, and ignore `internal` and `enabled` in the payload of a user.
|
|
24
28
|
- `listMcpServersByUser` failed because it sent no scope to the repository, now it lists the servers of the user.
|
|
25
29
|
- The connection errors of an internal server mask the values of its headers in the logs.
|
|
30
|
+
- `CurrentUser.isFreePlan()` always returned `false`, now it is `true` for a user that is not premium.
|
|
31
|
+
- `login` and `issuePasswordResetToken` find the user whatever the case of the email or the username, and ignore spaces around it.
|
|
26
32
|
|
|
27
33
|
## 0.7.0
|
|
28
34
|
|
package/dist/loops/agi/loop.js
CHANGED
package/dist/loops/agi/loop.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { BaseUseCase, BaseUseCaseParams } from '../../../../common/base/base.use
|
|
|
2
2
|
import { McpServerProps } from '../../entities';
|
|
3
3
|
import { McpServerRepository } from '../../repositories';
|
|
4
4
|
export interface Params extends BaseUseCaseParams {
|
|
5
|
-
payload?: Pick<McpServerProps, 'name' | 'url' | 'headers' | 'enabled' | 'environment'
|
|
5
|
+
payload?: Pick<McpServerProps, 'name' | 'url' | 'headers' | 'enabled' | 'environment'>;
|
|
6
6
|
}
|
|
7
7
|
export type Output = McpServerProps;
|
|
8
8
|
export declare class CreateInternalMcpUseCase extends BaseUseCase<Params, Output> {
|
|
@@ -38,8 +38,8 @@ class CreateInternalMcpUseCase extends import_base.BaseUseCase {
|
|
|
38
38
|
if (await this.mcpServerRepository.findInternalByName(payload.name, scope)) {
|
|
39
39
|
this.throwHttpError({ statusCode: 409, errorMessage: `There is already an internal MCP named "${payload.name}"` });
|
|
40
40
|
}
|
|
41
|
-
const { name, url, headers, enabled, environment
|
|
42
|
-
const mcpServer = import_entities.McpServer.fromJSON({ name, url, headers, enabled, environment,
|
|
41
|
+
const { name, url, headers, enabled, environment } = payload;
|
|
42
|
+
const mcpServer = import_entities.McpServer.fromJSON({ name, url, headers, enabled, environment, type: "http" }).initializeInternal();
|
|
43
43
|
await this.mcpServerRepository.create(mcpServer, scope);
|
|
44
44
|
return mcpServer.toJSON();
|
|
45
45
|
}
|
|
@@ -15,8 +15,8 @@ class CreateInternalMcpUseCase extends BaseUseCase {
|
|
|
15
15
|
if (await this.mcpServerRepository.findInternalByName(payload.name, scope)) {
|
|
16
16
|
this.throwHttpError({ statusCode: 409, errorMessage: `There is already an internal MCP named "${payload.name}"` });
|
|
17
17
|
}
|
|
18
|
-
const { name, url, headers, enabled, environment
|
|
19
|
-
const mcpServer = McpServer.fromJSON({ name, url, headers, enabled, environment,
|
|
18
|
+
const { name, url, headers, enabled, environment } = payload;
|
|
19
|
+
const mcpServer = McpServer.fromJSON({ name, url, headers, enabled, environment, type: "http" }).initializeInternal();
|
|
20
20
|
await this.mcpServerRepository.create(mcpServer, scope);
|
|
21
21
|
return mcpServer.toJSON();
|
|
22
22
|
}
|
|
@@ -3,7 +3,7 @@ import { McpServerProps } from '../../entities';
|
|
|
3
3
|
import { McpServerRepository } from '../../repositories';
|
|
4
4
|
export interface Params extends BaseUseCaseParams {
|
|
5
5
|
id: string;
|
|
6
|
-
payload?: Pick<McpServerProps, 'name' | 'url' | 'headers' | 'enabled' | 'environment' | '
|
|
6
|
+
payload?: Pick<McpServerProps, 'name' | 'url' | 'headers' | 'enabled' | 'environment' | '__v'>;
|
|
7
7
|
}
|
|
8
8
|
export type Output = McpServerProps;
|
|
9
9
|
export declare class UpdateInternalMcpUseCase extends BaseUseCase<Params, Output> {
|
|
@@ -46,8 +46,8 @@ class UpdateInternalMcpUseCase extends import_base.BaseUseCase {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
if (payload.url !== void 0 && !payload.url) this.throwHttpError({ statusCode: 400, errorMessage: "An internal MCP needs a name and a url" });
|
|
49
|
-
const { name, url, headers, enabled, environment
|
|
50
|
-
const mcpServer = import_entities.McpServer.fromJSON({ ...existing, ...name !== void 0 && { name }, ...url !== void 0 && { url }, ...headers !== void 0 && { headers }, ...enabled !== void 0 && { enabled }, ...environment !== void 0 && { environment },
|
|
49
|
+
const { name, url, headers, enabled, environment } = payload;
|
|
50
|
+
const mcpServer = import_entities.McpServer.fromJSON({ ...existing, ...name !== void 0 && { name }, ...url !== void 0 && { url }, ...headers !== void 0 && { headers }, ...enabled !== void 0 && { enabled }, ...environment !== void 0 && { environment }, _id: id, internal: true });
|
|
51
51
|
const result = await this.mcpServerRepository.update(mcpServer, scope, { expectedVersion: existing.__v });
|
|
52
52
|
if (!result) this.throwHttpError({ statusCode: 404, errorMessage: "{{resource_not_found}}" });
|
|
53
53
|
return result;
|
|
@@ -23,8 +23,8 @@ class UpdateInternalMcpUseCase extends BaseUseCase {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
if (payload.url !== void 0 && !payload.url) this.throwHttpError({ statusCode: 400, errorMessage: "An internal MCP needs a name and a url" });
|
|
26
|
-
const { name, url, headers, enabled, environment
|
|
27
|
-
const mcpServer = McpServer.fromJSON({ ...existing, ...name !== void 0 && { name }, ...url !== void 0 && { url }, ...headers !== void 0 && { headers }, ...enabled !== void 0 && { enabled }, ...environment !== void 0 && { environment },
|
|
26
|
+
const { name, url, headers, enabled, environment } = payload;
|
|
27
|
+
const mcpServer = McpServer.fromJSON({ ...existing, ...name !== void 0 && { name }, ...url !== void 0 && { url }, ...headers !== void 0 && { headers }, ...enabled !== void 0 && { enabled }, ...environment !== void 0 && { environment }, _id: id, internal: true });
|
|
28
28
|
const result = await this.mcpServerRepository.update(mcpServer, scope, { expectedVersion: existing.__v });
|
|
29
29
|
if (!result) this.throwHttpError({ statusCode: 404, errorMessage: "{{resource_not_found}}" });
|
|
30
30
|
return result;
|
|
@@ -17,7 +17,6 @@ export interface McpServerProps extends BaseEntityProps {
|
|
|
17
17
|
internal?: boolean;
|
|
18
18
|
enabled?: boolean;
|
|
19
19
|
environment?: string;
|
|
20
|
-
autonomousToken?: string;
|
|
21
20
|
}
|
|
22
21
|
export declare class McpServer extends BaseEntity {
|
|
23
22
|
private readonly props;
|
|
@@ -33,10 +32,9 @@ export declare class McpServer extends BaseEntity {
|
|
|
33
32
|
internal?: boolean | undefined;
|
|
34
33
|
enabled?: boolean | undefined;
|
|
35
34
|
environment?: string | undefined;
|
|
36
|
-
autonomousToken?: string | undefined;
|
|
37
35
|
mcpClient?: Client;
|
|
38
36
|
static fromJSON(props: McpServerProps): McpServer;
|
|
39
|
-
constructor(props: McpServerProps, name?: string | undefined, url?: string | undefined, type?: McpType | undefined, headers?: Record<string, string> | undefined, trust?: McpTrust | undefined, approvedHash?: string | null | undefined, history?: McpManifest[] | undefined, status?: McpStatus | undefined, lastError?: string | null | undefined, internal?: boolean | undefined, enabled?: boolean | undefined, environment?: string | undefined
|
|
37
|
+
constructor(props: McpServerProps, name?: string | undefined, url?: string | undefined, type?: McpType | undefined, headers?: Record<string, string> | undefined, trust?: McpTrust | undefined, approvedHash?: string | null | undefined, history?: McpManifest[] | undefined, status?: McpStatus | undefined, lastError?: string | null | undefined, internal?: boolean | undefined, enabled?: boolean | undefined, environment?: string | undefined);
|
|
40
38
|
toJSON(): McpServerProps;
|
|
41
39
|
get latest(): McpManifest | undefined;
|
|
42
40
|
get approved(): McpManifest | undefined;
|
|
@@ -30,7 +30,7 @@ __reExport(mcpserver_entity_exports, require("./mcp-manifest"), module.exports);
|
|
|
30
30
|
const MAX_HISTORY = 5;
|
|
31
31
|
const MAX_ERROR_CHARS = 300;
|
|
32
32
|
class McpServer extends import_base.BaseEntity {
|
|
33
|
-
constructor(props, name, url, type, headers, trust, approvedHash, history, status, lastError, internal, enabled, environment
|
|
33
|
+
constructor(props, name, url, type, headers, trust, approvedHash, history, status, lastError, internal, enabled, environment) {
|
|
34
34
|
super(props);
|
|
35
35
|
this.props = props;
|
|
36
36
|
this.name = name;
|
|
@@ -45,7 +45,6 @@ class McpServer extends import_base.BaseEntity {
|
|
|
45
45
|
this.internal = internal;
|
|
46
46
|
this.enabled = enabled;
|
|
47
47
|
this.environment = environment;
|
|
48
|
-
this.autonomousToken = autonomousToken;
|
|
49
48
|
}
|
|
50
49
|
props;
|
|
51
50
|
name;
|
|
@@ -60,7 +59,6 @@ class McpServer extends import_base.BaseEntity {
|
|
|
60
59
|
internal;
|
|
61
60
|
enabled;
|
|
62
61
|
environment;
|
|
63
|
-
autonomousToken;
|
|
64
62
|
mcpClient;
|
|
65
63
|
static fromJSON(props) {
|
|
66
64
|
return new McpServer(
|
|
@@ -76,8 +74,7 @@ class McpServer extends import_base.BaseEntity {
|
|
|
76
74
|
props.lastError,
|
|
77
75
|
props.internal,
|
|
78
76
|
props.enabled,
|
|
79
|
-
props.environment
|
|
80
|
-
props.autonomousToken
|
|
77
|
+
props.environment
|
|
81
78
|
);
|
|
82
79
|
}
|
|
83
80
|
toJSON() {
|
|
@@ -94,8 +91,7 @@ class McpServer extends import_base.BaseEntity {
|
|
|
94
91
|
lastError: this.lastError,
|
|
95
92
|
internal: this.internal,
|
|
96
93
|
enabled: this.enabled,
|
|
97
|
-
environment: this.environment
|
|
98
|
-
autonomousToken: this.autonomousToken
|
|
94
|
+
environment: this.environment
|
|
99
95
|
};
|
|
100
96
|
}
|
|
101
97
|
get latest() {
|
|
@@ -115,7 +111,6 @@ class McpServer extends import_base.BaseEntity {
|
|
|
115
111
|
this.lastError = null;
|
|
116
112
|
this.internal = void 0;
|
|
117
113
|
this.enabled = void 0;
|
|
118
|
-
this.autonomousToken = void 0;
|
|
119
114
|
return this;
|
|
120
115
|
}
|
|
121
116
|
initializeInternal() {
|
|
@@ -6,7 +6,7 @@ export * from "./mcp-manifest";
|
|
|
6
6
|
const MAX_HISTORY = 5;
|
|
7
7
|
const MAX_ERROR_CHARS = 300;
|
|
8
8
|
class McpServer extends BaseEntity {
|
|
9
|
-
constructor(props, name, url, type, headers, trust, approvedHash, history, status, lastError, internal, enabled, environment
|
|
9
|
+
constructor(props, name, url, type, headers, trust, approvedHash, history, status, lastError, internal, enabled, environment) {
|
|
10
10
|
super(props);
|
|
11
11
|
this.props = props;
|
|
12
12
|
this.name = name;
|
|
@@ -21,7 +21,6 @@ class McpServer extends BaseEntity {
|
|
|
21
21
|
this.internal = internal;
|
|
22
22
|
this.enabled = enabled;
|
|
23
23
|
this.environment = environment;
|
|
24
|
-
this.autonomousToken = autonomousToken;
|
|
25
24
|
}
|
|
26
25
|
props;
|
|
27
26
|
name;
|
|
@@ -36,7 +35,6 @@ class McpServer extends BaseEntity {
|
|
|
36
35
|
internal;
|
|
37
36
|
enabled;
|
|
38
37
|
environment;
|
|
39
|
-
autonomousToken;
|
|
40
38
|
mcpClient;
|
|
41
39
|
static fromJSON(props) {
|
|
42
40
|
return new McpServer(
|
|
@@ -52,8 +50,7 @@ class McpServer extends BaseEntity {
|
|
|
52
50
|
props.lastError,
|
|
53
51
|
props.internal,
|
|
54
52
|
props.enabled,
|
|
55
|
-
props.environment
|
|
56
|
-
props.autonomousToken
|
|
53
|
+
props.environment
|
|
57
54
|
);
|
|
58
55
|
}
|
|
59
56
|
toJSON() {
|
|
@@ -70,8 +67,7 @@ class McpServer extends BaseEntity {
|
|
|
70
67
|
lastError: this.lastError,
|
|
71
68
|
internal: this.internal,
|
|
72
69
|
enabled: this.enabled,
|
|
73
|
-
environment: this.environment
|
|
74
|
-
autonomousToken: this.autonomousToken
|
|
70
|
+
environment: this.environment
|
|
75
71
|
};
|
|
76
72
|
}
|
|
77
73
|
get latest() {
|
|
@@ -91,7 +87,6 @@ class McpServer extends BaseEntity {
|
|
|
91
87
|
this.lastError = null;
|
|
92
88
|
this.internal = void 0;
|
|
93
89
|
this.enabled = void 0;
|
|
94
|
-
this.autonomousToken = void 0;
|
|
95
90
|
return this;
|
|
96
91
|
}
|
|
97
92
|
initializeInternal() {
|
|
@@ -24,7 +24,7 @@ module.exports = __toCommonJS(internal_exports);
|
|
|
24
24
|
var import_repositories = require("./repositories");
|
|
25
25
|
async function listActiveInternalMcps() {
|
|
26
26
|
const items = await new import_repositories.McpServerRepository().findActiveInternals();
|
|
27
|
-
return items.flatMap((item) => item.name && item.url ? [{ name: item.name, url: item.url, ...item.headers ? { headers: item.headers } : {}
|
|
27
|
+
return items.flatMap((item) => item.name && item.url ? [{ name: item.name, url: item.url, ...item.headers ? { headers: item.headers } : {} }] : []);
|
|
28
28
|
}
|
|
29
29
|
// Annotate the CommonJS export names for ESM import in node:
|
|
30
30
|
0 && (module.exports = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { McpServerRepository } from "./repositories";
|
|
2
2
|
async function listActiveInternalMcps() {
|
|
3
3
|
const items = await new McpServerRepository().findActiveInternals();
|
|
4
|
-
return items.flatMap((item) => item.name && item.url ? [{ name: item.name, url: item.url, ...item.headers ? { headers: item.headers } : {}
|
|
4
|
+
return items.flatMap((item) => item.name && item.url ? [{ name: item.name, url: item.url, ...item.headers ? { headers: item.headers } : {} }] : []);
|
|
5
5
|
}
|
|
6
6
|
export {
|
|
7
7
|
listActiveInternalMcps
|
|
@@ -48,7 +48,7 @@ class UpdateMcpServerUseCase extends import_base.BaseUseCase {
|
|
|
48
48
|
}
|
|
49
49
|
const endpointChanged = payload.url !== void 0 && payload.url !== existing.url || payload.type !== void 0 && payload.type !== existing.type;
|
|
50
50
|
const headersChanged = payload.headers !== void 0 && JSON.stringify(payload.headers) !== JSON.stringify(existing.headers);
|
|
51
|
-
const mcpServer = import_entities.McpServer.fromJSON({ ...existing, ...payload, _id: id, trust: existing.trust, approvedHash: existing.approvedHash, status: existing.status, lastError: existing.lastError, history: existing.history, internal: existing.internal, enabled: existing.enabled
|
|
51
|
+
const mcpServer = import_entities.McpServer.fromJSON({ ...existing, ...payload, _id: id, trust: existing.trust, approvedHash: existing.approvedHash, status: existing.status, lastError: existing.lastError, history: existing.history, internal: existing.internal, enabled: existing.enabled });
|
|
52
52
|
if (endpointChanged) {
|
|
53
53
|
mcpServer.lockForNewEndpoint();
|
|
54
54
|
}
|
|
@@ -25,7 +25,7 @@ class UpdateMcpServerUseCase extends BaseUseCase {
|
|
|
25
25
|
}
|
|
26
26
|
const endpointChanged = payload.url !== void 0 && payload.url !== existing.url || payload.type !== void 0 && payload.type !== existing.type;
|
|
27
27
|
const headersChanged = payload.headers !== void 0 && JSON.stringify(payload.headers) !== JSON.stringify(existing.headers);
|
|
28
|
-
const mcpServer = McpServer.fromJSON({ ...existing, ...payload, _id: id, trust: existing.trust, approvedHash: existing.approvedHash, status: existing.status, lastError: existing.lastError, history: existing.history, internal: existing.internal, enabled: existing.enabled
|
|
28
|
+
const mcpServer = McpServer.fromJSON({ ...existing, ...payload, _id: id, trust: existing.trust, approvedHash: existing.approvedHash, status: existing.status, lastError: existing.lastError, history: existing.history, internal: existing.internal, enabled: existing.enabled });
|
|
29
29
|
if (endpointChanged) {
|
|
30
30
|
mcpServer.lockForNewEndpoint();
|
|
31
31
|
}
|
|
@@ -26,6 +26,7 @@ export interface AgentActionProps extends BaseEntityProps {
|
|
|
26
26
|
outputStub?: Record<string, any>;
|
|
27
27
|
requestedName?: string;
|
|
28
28
|
reviewedHash?: string;
|
|
29
|
+
notice?: string;
|
|
29
30
|
callId?: string;
|
|
30
31
|
turn?: number;
|
|
31
32
|
startedAt?: Date;
|
|
@@ -64,10 +65,11 @@ export declare class AgentAction extends BaseEntity {
|
|
|
64
65
|
outputStub?: Record<string, any> | undefined;
|
|
65
66
|
requestedName?: string | undefined;
|
|
66
67
|
reviewedHash?: string | undefined;
|
|
68
|
+
notice?: string | undefined;
|
|
67
69
|
private logger;
|
|
68
70
|
static factory(action: AgentActionProps): AgentAction;
|
|
69
71
|
static fromJSON(props: AgentActionProps): AgentAction;
|
|
70
|
-
constructor(props: AgentActionProps, chatId?: ObjectId | undefined, taskId?: ObjectId | undefined, name?: string | undefined, stepId?: string | undefined, args?: Record<string, any> | undefined, dependsOn?: string[] | undefined, status?: ActionStatus | undefined, output?: any | undefined, error?: ActionErrorProps | undefined, reasoning?: string | undefined, retries?: number | undefined, author?: string | undefined, approved?: boolean | undefined, outputRef?: string | undefined, outputChars?: number | undefined, startedAt?: Date | undefined, completedAt?: Date | undefined, answerId?: ObjectId | undefined, callId?: string | undefined, turn?: number | undefined, outputStub?: Record<string, any> | undefined, requestedName?: string | undefined, reviewedHash?: string | undefined);
|
|
72
|
+
constructor(props: AgentActionProps, chatId?: ObjectId | undefined, taskId?: ObjectId | undefined, name?: string | undefined, stepId?: string | undefined, args?: Record<string, any> | undefined, dependsOn?: string[] | undefined, status?: ActionStatus | undefined, output?: any | undefined, error?: ActionErrorProps | undefined, reasoning?: string | undefined, retries?: number | undefined, author?: string | undefined, approved?: boolean | undefined, outputRef?: string | undefined, outputChars?: number | undefined, startedAt?: Date | undefined, completedAt?: Date | undefined, answerId?: ObjectId | undefined, callId?: string | undefined, turn?: number | undefined, outputStub?: Record<string, any> | undefined, requestedName?: string | undefined, reviewedHash?: string | undefined, notice?: string | undefined);
|
|
71
73
|
toJSON(): AgentActionProps;
|
|
72
74
|
get id(): string;
|
|
73
75
|
get isReady(): boolean;
|
|
@@ -36,7 +36,7 @@ function truncateForPrompt(value, maxChars = 3e3) {
|
|
|
36
36
|
return { truncated: true, total_chars: text.length, preview: text.slice(0, maxChars) };
|
|
37
37
|
}
|
|
38
38
|
class AgentAction extends import_base.BaseEntity {
|
|
39
|
-
constructor(props, chatId, taskId, name, stepId, args, dependsOn, status, output, error, reasoning, retries, author, approved, outputRef, outputChars, startedAt, completedAt, answerId, callId, turn, outputStub, requestedName, reviewedHash) {
|
|
39
|
+
constructor(props, chatId, taskId, name, stepId, args, dependsOn, status, output, error, reasoning, retries, author, approved, outputRef, outputChars, startedAt, completedAt, answerId, callId, turn, outputStub, requestedName, reviewedHash, notice) {
|
|
40
40
|
super(props);
|
|
41
41
|
this.props = props;
|
|
42
42
|
this.chatId = chatId;
|
|
@@ -62,6 +62,7 @@ class AgentAction extends import_base.BaseEntity {
|
|
|
62
62
|
this.outputStub = outputStub;
|
|
63
63
|
this.requestedName = requestedName;
|
|
64
64
|
this.reviewedHash = reviewedHash;
|
|
65
|
+
this.notice = notice;
|
|
65
66
|
}
|
|
66
67
|
props;
|
|
67
68
|
chatId;
|
|
@@ -87,6 +88,7 @@ class AgentAction extends import_base.BaseEntity {
|
|
|
87
88
|
outputStub;
|
|
88
89
|
requestedName;
|
|
89
90
|
reviewedHash;
|
|
91
|
+
notice;
|
|
90
92
|
logger = new import_logger.Logger();
|
|
91
93
|
static factory(action) {
|
|
92
94
|
const actionId = action._id && import_mongodb.ObjectId.isValid(action._id) ? new import_mongodb.ObjectId(action._id) : new import_mongodb.ObjectId();
|
|
@@ -117,7 +119,8 @@ class AgentAction extends import_base.BaseEntity {
|
|
|
117
119
|
props.turn,
|
|
118
120
|
props.outputStub,
|
|
119
121
|
props.requestedName,
|
|
120
|
-
props.reviewedHash
|
|
122
|
+
props.reviewedHash,
|
|
123
|
+
props.notice
|
|
121
124
|
);
|
|
122
125
|
}
|
|
123
126
|
toJSON() {
|
|
@@ -145,7 +148,8 @@ class AgentAction extends import_base.BaseEntity {
|
|
|
145
148
|
turn: this.turn,
|
|
146
149
|
outputStub: this.outputStub,
|
|
147
150
|
requestedName: this.requestedName,
|
|
148
|
-
reviewedHash: this.reviewedHash
|
|
151
|
+
reviewedHash: this.reviewedHash,
|
|
152
|
+
notice: this.notice
|
|
149
153
|
};
|
|
150
154
|
}
|
|
151
155
|
get id() {
|
|
@@ -258,6 +262,7 @@ class AgentAction extends import_base.BaseEntity {
|
|
|
258
262
|
tool: tool.name,
|
|
259
263
|
args
|
|
260
264
|
}, "[Agent Action] Running tool");
|
|
265
|
+
this.notice = tool.notice;
|
|
261
266
|
this.markRunning();
|
|
262
267
|
try {
|
|
263
268
|
const result = await tool.run({ ...args, ...baseParams });
|
|
@@ -12,7 +12,7 @@ function truncateForPrompt(value, maxChars = 3e3) {
|
|
|
12
12
|
return { truncated: true, total_chars: text.length, preview: text.slice(0, maxChars) };
|
|
13
13
|
}
|
|
14
14
|
class AgentAction extends BaseEntity {
|
|
15
|
-
constructor(props, chatId, taskId, name, stepId, args, dependsOn, status, output, error, reasoning, retries, author, approved, outputRef, outputChars, startedAt, completedAt, answerId, callId, turn, outputStub, requestedName, reviewedHash) {
|
|
15
|
+
constructor(props, chatId, taskId, name, stepId, args, dependsOn, status, output, error, reasoning, retries, author, approved, outputRef, outputChars, startedAt, completedAt, answerId, callId, turn, outputStub, requestedName, reviewedHash, notice) {
|
|
16
16
|
super(props);
|
|
17
17
|
this.props = props;
|
|
18
18
|
this.chatId = chatId;
|
|
@@ -38,6 +38,7 @@ class AgentAction extends BaseEntity {
|
|
|
38
38
|
this.outputStub = outputStub;
|
|
39
39
|
this.requestedName = requestedName;
|
|
40
40
|
this.reviewedHash = reviewedHash;
|
|
41
|
+
this.notice = notice;
|
|
41
42
|
}
|
|
42
43
|
props;
|
|
43
44
|
chatId;
|
|
@@ -63,6 +64,7 @@ class AgentAction extends BaseEntity {
|
|
|
63
64
|
outputStub;
|
|
64
65
|
requestedName;
|
|
65
66
|
reviewedHash;
|
|
67
|
+
notice;
|
|
66
68
|
logger = new Logger();
|
|
67
69
|
static factory(action) {
|
|
68
70
|
const actionId = action._id && ObjectId.isValid(action._id) ? new ObjectId(action._id) : new ObjectId();
|
|
@@ -93,7 +95,8 @@ class AgentAction extends BaseEntity {
|
|
|
93
95
|
props.turn,
|
|
94
96
|
props.outputStub,
|
|
95
97
|
props.requestedName,
|
|
96
|
-
props.reviewedHash
|
|
98
|
+
props.reviewedHash,
|
|
99
|
+
props.notice
|
|
97
100
|
);
|
|
98
101
|
}
|
|
99
102
|
toJSON() {
|
|
@@ -121,7 +124,8 @@ class AgentAction extends BaseEntity {
|
|
|
121
124
|
turn: this.turn,
|
|
122
125
|
outputStub: this.outputStub,
|
|
123
126
|
requestedName: this.requestedName,
|
|
124
|
-
reviewedHash: this.reviewedHash
|
|
127
|
+
reviewedHash: this.reviewedHash,
|
|
128
|
+
notice: this.notice
|
|
125
129
|
};
|
|
126
130
|
}
|
|
127
131
|
get id() {
|
|
@@ -234,6 +238,7 @@ class AgentAction extends BaseEntity {
|
|
|
234
238
|
tool: tool.name,
|
|
235
239
|
args
|
|
236
240
|
}, "[Agent Action] Running tool");
|
|
241
|
+
this.notice = tool.notice;
|
|
237
242
|
this.markRunning();
|
|
238
243
|
try {
|
|
239
244
|
const result = await tool.run({ ...args, ...baseParams });
|
|
@@ -478,7 +478,7 @@ class AgentTask extends import_base.BaseEntity {
|
|
|
478
478
|
OBSERVATIONS: actions.map((action) => {
|
|
479
479
|
const ref = action.stepId ?? action.id;
|
|
480
480
|
const routed = routeNote(action);
|
|
481
|
-
const note = routed ? { note: routed } : {};
|
|
481
|
+
const note = { ...routed ? { note: routed } : {}, ...action.notice ? { notice: action.notice } : {} };
|
|
482
482
|
if (action.status === "skipped") return { ref, tool: action.name, status: "skipped", ...note };
|
|
483
483
|
return action.status === "failed" ? { ref, tool: action.name, status: "failed", error: action.error?.message, ...note } : { ref, tool: action.name, status: "completed", output: action.observationOutput(stale, TOOL_RESULT_CHARS), ...note };
|
|
484
484
|
})
|
|
@@ -443,7 +443,7 @@ class AgentTask extends BaseEntity {
|
|
|
443
443
|
OBSERVATIONS: actions.map((action) => {
|
|
444
444
|
const ref = action.stepId ?? action.id;
|
|
445
445
|
const routed = routeNote(action);
|
|
446
|
-
const note = routed ? { note: routed } : {};
|
|
446
|
+
const note = { ...routed ? { note: routed } : {}, ...action.notice ? { notice: action.notice } : {} };
|
|
447
447
|
if (action.status === "skipped") return { ref, tool: action.name, status: "skipped", ...note };
|
|
448
448
|
return action.status === "failed" ? { ref, tool: action.name, status: "failed", error: action.error?.message, ...note } : { ref, tool: action.name, status: "completed", output: action.observationOutput(stale, TOOL_RESULT_CHARS), ...note };
|
|
449
449
|
})
|
|
@@ -73,7 +73,7 @@ class UserRepository {
|
|
|
73
73
|
return await this._.findManyPaginated({ scope, where, select: { password: 0 }, options });
|
|
74
74
|
}
|
|
75
75
|
async findByEmailOrUsernameWithPassword(emailOrUsername, scope) {
|
|
76
|
-
const input = this._.cleanInput(emailOrUsername);
|
|
76
|
+
const input = this._.cleanInput(emailOrUsername)?.trim().toLowerCase();
|
|
77
77
|
const user = await this._.findOne({
|
|
78
78
|
scope,
|
|
79
79
|
where: { $or: [{ email: input }, { username: input }] }
|
|
@@ -50,7 +50,7 @@ class UserRepository {
|
|
|
50
50
|
return await this._.findManyPaginated({ scope, where, select: { password: 0 }, options });
|
|
51
51
|
}
|
|
52
52
|
async findByEmailOrUsernameWithPassword(emailOrUsername, scope) {
|
|
53
|
-
const input = this._.cleanInput(emailOrUsername);
|
|
53
|
+
const input = this._.cleanInput(emailOrUsername)?.trim().toLowerCase();
|
|
54
54
|
const user = await this._.findOne({
|
|
55
55
|
scope,
|
|
56
56
|
where: { $or: [{ email: input }, { username: input }] }
|