@tickernelz/paperclip-pro-server 2026.926.1 → 2026.926.3
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/build-info.json +1 -1
- package/dist/routes/agents.d.ts.map +1 -1
- package/dist/routes/agents.js +134 -5
- package/dist/routes/agents.js.map +1 -1
- package/dist/routes/issues.d.ts.map +1 -1
- package/dist/routes/issues.js +86 -6
- package/dist/routes/issues.js.map +1 -1
- package/dist/routes/openapi.d.ts.map +1 -1
- package/dist/routes/openapi.js +50 -8
- package/dist/routes/openapi.js.map +1 -1
- package/dist/routes/paperclip-mcp.d.ts.map +1 -1
- package/dist/routes/paperclip-mcp.js +23 -2
- package/dist/routes/paperclip-mcp.js.map +1 -1
- package/dist/services/adapter-config-field-value.d.ts +12 -0
- package/dist/services/adapter-config-field-value.d.ts.map +1 -0
- package/dist/services/adapter-config-field-value.js +31 -0
- package/dist/services/adapter-config-field-value.js.map +1 -0
- package/dist/services/agent-adapter-config-batch.d.ts +26 -0
- package/dist/services/agent-adapter-config-batch.d.ts.map +1 -0
- package/dist/services/agent-adapter-config-batch.js +174 -0
- package/dist/services/agent-adapter-config-batch.js.map +1 -0
- package/dist/services/heartbeat.d.ts +4 -4
- package/dist/services/issue-model-override-inheritance.d.ts +13 -0
- package/dist/services/issue-model-override-inheritance.d.ts.map +1 -0
- package/dist/services/issue-model-override-inheritance.js +68 -0
- package/dist/services/issue-model-override-inheritance.js.map +1 -0
- package/dist/services/issue-run-model-override.d.ts +19 -4
- package/dist/services/issue-run-model-override.d.ts.map +1 -1
- package/dist/services/issue-run-model-override.js +71 -22
- package/dist/services/issue-run-model-override.js.map +1 -1
- package/dist/services/issues.d.ts +5 -0
- package/dist/services/issues.d.ts.map +1 -1
- package/dist/services/issues.js +36 -1
- package/dist/services/issues.js.map +1 -1
- package/dist/services/native-runtime/native-session-executor.d.ts +1 -1
- package/dist/services/native-runtime/native-session-executor.d.ts.map +1 -1
- package/node_modules/micromark/dev/lib/compile.d.ts.map +1 -1
- package/node_modules/micromark/dev/lib/compile.js +14 -4
- package/node_modules/micromark/dev/lib/create-tokenizer.d.ts.map +1 -1
- package/node_modules/micromark/dev/lib/create-tokenizer.js +7 -6
- package/node_modules/micromark/dev/lib/initialize/document.js +25 -21
- package/node_modules/micromark/dev/lib/initialize/text.d.ts.map +1 -1
- package/node_modules/micromark/dev/lib/initialize/text.js +10 -6
- package/node_modules/micromark/dev/lib/preprocess.d.ts.map +1 -1
- package/node_modules/micromark/dev/lib/preprocess.js +19 -21
- package/node_modules/micromark/lib/compile.d.ts.map +1 -1
- package/node_modules/micromark/lib/compile.js +37 -29
- package/node_modules/micromark/lib/create-tokenizer.d.ts.map +1 -1
- package/node_modules/micromark/lib/create-tokenizer.js +37 -35
- package/node_modules/micromark/lib/initialize/document.js +21 -13
- package/node_modules/micromark/lib/initialize/text.d.ts.map +1 -1
- package/node_modules/micromark/lib/initialize/text.js +7 -3
- package/node_modules/micromark/lib/preprocess.d.ts.map +1 -1
- package/node_modules/micromark/lib/preprocess.js +16 -19
- package/node_modules/micromark/package.json +2 -15
- package/node_modules/micromark-core-commonmark/dev/lib/attention.js +18 -24
- package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.js +1 -43
- package/node_modules/micromark-core-commonmark/dev/lib/code-indented.js +19 -43
- package/node_modules/micromark-core-commonmark/dev/lib/heading-atx.js +2 -6
- package/node_modules/micromark-core-commonmark/dev/lib/html-flow.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/html-flow.js +2 -53
- package/node_modules/micromark-core-commonmark/dev/lib/label-end.js +14 -12
- package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.js +14 -5
- package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.js +14 -5
- package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.d.ts +4 -0
- package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.d.ts.map +1 -0
- package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.js +67 -0
- package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.js +8 -5
- package/node_modules/micromark-core-commonmark/lib/attention.js +14 -24
- package/node_modules/micromark-core-commonmark/lib/code-fenced.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/code-fenced.js +1 -39
- package/node_modules/micromark-core-commonmark/lib/code-indented.js +11 -29
- package/node_modules/micromark-core-commonmark/lib/heading-atx.js +2 -6
- package/node_modules/micromark-core-commonmark/lib/html-flow.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/html-flow.js +2 -51
- package/node_modules/micromark-core-commonmark/lib/label-end.js +11 -10
- package/node_modules/micromark-core-commonmark/lib/label-start-image.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/label-start-image.js +11 -3
- package/node_modules/micromark-core-commonmark/lib/label-start-link.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/label-start-link.js +11 -3
- package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.d.ts +4 -0
- package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.d.ts.map +1 -0
- package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.js +61 -0
- package/node_modules/micromark-core-commonmark/lib/setext-underline.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/setext-underline.js +7 -5
- package/node_modules/micromark-core-commonmark/package.json +4 -16
- package/node_modules/micromark-factory-space/dev/index.d.ts +24 -1
- package/node_modules/micromark-factory-space/dev/index.d.ts.map +1 -1
- package/node_modules/micromark-factory-space/dev/index.js +58 -3
- package/node_modules/micromark-factory-space/index.d.ts +24 -1
- package/node_modules/micromark-factory-space/index.d.ts.map +1 -1
- package/node_modules/micromark-factory-space/index.js +55 -3
- package/node_modules/micromark-factory-space/package.json +1 -10
- package/node_modules/micromark-factory-space/readme.md +25 -25
- package/node_modules/micromark-util-edit-map/dev/index.d.ts +78 -0
- package/node_modules/micromark-util-edit-map/dev/index.d.ts.map +1 -0
- package/node_modules/micromark-util-edit-map/dev/index.js +237 -0
- package/node_modules/micromark-util-edit-map/index.d.ts +78 -0
- package/node_modules/micromark-util-edit-map/index.d.ts.map +1 -0
- package/node_modules/micromark-util-edit-map/index.js +225 -0
- package/node_modules/micromark-util-edit-map/license +22 -0
- package/node_modules/micromark-util-edit-map/package.json +48 -0
- package/node_modules/micromark-util-edit-map/readme.md +234 -0
- package/node_modules/micromark-util-types/index.d.ts +6 -3
- package/node_modules/micromark-util-types/package.json +2 -36
- package/node_modules/ws/lib/websocket.js +17 -3
- package/node_modules/ws/package.json +1 -1
- package/package.json +20 -20
- package/skills/paperclip/references/api-reference.md +2 -2
- package/ui-dist/assets/{AgentAvatar-CWNp7Eqe.js → AgentAvatar-CnpBTXF0.js} +1 -1
- package/ui-dist/assets/{AgentIdentity-Bqzrcghn.js → AgentIdentity-CV55DQtR.js} +1 -1
- package/ui-dist/assets/{Agents.production-Cs7mMvAL.js → Agents.production-BGeWxNtU.js} +2 -2
- package/ui-dist/assets/{CompanyActivity.production-4bljbHSU.js → CompanyActivity.production-9gzPo_M_.js} +1 -1
- package/ui-dist/assets/{CompanyExport-CBh7R3lQ.js → CompanyExport-CwCAJj2l.js} +1 -1
- package/ui-dist/assets/{CompanySkills.production-DEleeGzs.js → CompanySkills.production-CiTG4koz.js} +1 -1
- package/ui-dist/assets/{Costs.production-Dm5j2nxX.js → Costs.production-CFn4Pjkh.js} +1 -1
- package/ui-dist/assets/{EmptyState-D62UDLDa.js → EmptyState-DeVTy8IU.js} +1 -1
- package/ui-dist/assets/{MarkdownBody-DfGkmx3G.js → MarkdownBody-Da7yUIDf.js} +1 -1
- package/ui-dist/assets/{MarkdownEditor-ZwstkvWb.js → MarkdownEditor-7JCtdEaZ.js} +1 -1
- package/ui-dist/assets/{OrgChart.production-BWKofGdO.js → OrgChart.production-U1cB4YS_.js} +1 -1
- package/ui-dist/assets/{PageSkeleton-C0pPO_Gb.js → PageSkeleton-DRRnaWWU.js} +1 -1
- package/ui-dist/assets/{RoutineDetail.production-_auZa0K9.js → RoutineDetail.production-oI3mHlKM.js} +1 -1
- package/ui-dist/assets/RoutineRunVariablesDialog-Bj-Q_Ua3.js +5 -0
- package/ui-dist/assets/{Routines.production-D8R6Ujt6.js → Routines.production-sl1FiAYd.js} +1 -1
- package/ui-dist/assets/{SidebarContext-B3vvFvTk.js → SidebarContext-CxjppFTY.js} +1 -1
- package/ui-dist/assets/{StatusIcon-BYqGFWup.js → StatusIcon-j05cEqDO.js} +1 -1
- package/ui-dist/assets/agents-ZcIBncVi.js +1 -0
- package/ui-dist/assets/{badge-CW7lQ_Zd.js → badge-B4sBXDQo.js} +1 -1
- package/ui-dist/assets/{bot-DIsSOxfs.js → bot-CcFVz40n.js} +1 -1
- package/ui-dist/assets/{button-BYQHEF4e.js → button-LkWt40cm.js} +1 -1
- package/ui-dist/assets/{card-CFXZOYds.js → card-DbvoJZ3K.js} +1 -1
- package/ui-dist/assets/{check-Cniv3It0.js → check-CgfxcCMv.js} +1 -1
- package/ui-dist/assets/{checkbox-MLVUJCCS.js → checkbox-CLAkJpms.js} +1 -1
- package/ui-dist/assets/{chevron-down-Dq0fsCvv.js → chevron-down-CpKmud_n.js} +1 -1
- package/ui-dist/assets/{chevron-right-C4o2Lqna.js → chevron-right-IZydUoW5.js} +1 -1
- package/ui-dist/assets/{clipboard-CfEDu5my.js → clipboard-CjMs5cp9.js} +1 -1
- package/ui-dist/assets/{company-members-tdITTHFY.js → company-members-Dyq_pnza.js} +1 -1
- package/ui-dist/assets/createLucideIcon-CZEG6UJ7.js +92 -0
- package/ui-dist/assets/{definition-B5Yyiufk.js → definition-DrGsWdJY.js} +1 -1
- package/ui-dist/assets/{dist-DCpDFPbp.js → dist-Cqh7BG-j.js} +1 -1
- package/ui-dist/assets/{dist-bQQ2HFhw.js → dist-pDmgIRxg.js} +1 -1
- package/ui-dist/assets/{environments-awDXeIDD.js → environments-xbdxVBLT.js} +1 -1
- package/ui-dist/assets/{external-link-3uv6Ak2X.js → external-link-BbeUY6zf.js} +1 -1
- package/ui-dist/assets/{file-text-DWMD8a2i.js → file-text-BMJQ4LZs.js} +1 -1
- package/ui-dist/assets/{health-DY_y3c9e.js → health-Bj6kLXe5.js} +1 -1
- package/ui-dist/assets/{heartbeats-BQipXQOf.js → heartbeats-DFiFf4Zf.js} +1 -1
- package/ui-dist/assets/index-GCNIGBzC.css +1 -0
- package/ui-dist/assets/{index-N4w1Oco1.js → index-cwemnRTq.js} +162 -162
- package/ui-dist/assets/{input-B7ODc-rR.js → input-a7SggR2b.js} +1 -1
- package/ui-dist/assets/label-Dnc69R1W.js +5 -0
- package/ui-dist/assets/{loader-circle-DA6xS_rG.js → loader-circle-Cu72DKdC.js} +1 -1
- package/ui-dist/assets/{mention-chips-r4UB4Eiw.js → mention-chips-BEaOTvHT.js} +1 -1
- package/ui-dist/assets/{octagon-alert-DsI0y-RL.js → octagon-alert-DfqJ6RjK.js} +1 -1
- package/ui-dist/assets/{rotate-ccw-D6pz3VoJ.js → rotate-ccw-DiFaj3XM.js} +1 -1
- package/ui-dist/assets/{router-DcMYq5w_.js → router-G1KztA90.js} +1 -1
- package/ui-dist/assets/{save-CvrYa2yq.js → save-D9PtvKKu.js} +1 -1
- package/ui-dist/assets/{select-CV7s_3g2.js → select-DSr2hsz2.js} +1 -1
- package/ui-dist/assets/{sheet-CrBXG9pk.js → sheet-H27vJn3G.js} +1 -1
- package/ui-dist/assets/{skeleton-efW_R0t3.js → skeleton-CPVPMT4g.js} +1 -1
- package/ui-dist/assets/{tabs-4RdauNv3.js → tabs-D8G3-AL7.js} +1 -1
- package/ui-dist/assets/{triangle-alert-DQUol3t5.js → triangle-alert-DiD4Atur.js} +1 -1
- package/ui-dist/assets/{use-adapter-capabilities-pFfW1mOk.js → use-adapter-capabilities-D_QCYxa2.js} +1 -1
- package/ui-dist/assets/{useHiddenSettings-b1eurTXV.js → useHiddenSettings-vbDpbX0U.js} +1 -1
- package/ui-dist/assets/{zap-CKzX0hdL.js → zap-CCqZhqc3.js} +1 -1
- package/ui-dist/index.html +46 -46
- package/ui-dist/sw.js +1 -1
- package/ui-dist/assets/RoutineRunVariablesDialog-CUcwhS7L.js +0 -5
- package/ui-dist/assets/agents-CNina7HI.js +0 -1
- package/ui-dist/assets/createLucideIcon-CINAT48M.js +0 -92
- package/ui-dist/assets/index-BAoNTaz4.css +0 -1
- package/ui-dist/assets/label-BnqmTeef.js +0 -5
package/dist/build-info.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/routes/agents.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/routes/agents.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAkFvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAiEhF,OAAO,EACL,wBAAwB,EAWxB,KAAK,sBAAsB,EAE3B,KAAK,sBAAsB,EAC3B,KAAK,6BAA6B,EAClC,KAAK,sBAAsB,EAK5B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EACV,cAAc,EAUf,MAAM,kCAAkC,CAAC;AA2P1C,wBAAgB,WAAW,CACzB,EAAE,EAAE,EAAE,EACN,OAAO,GAAE;IACP,cAAc,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,2BAA2B,GAAG,2BAA2B,CAAC,CAAC;IACrG,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,6EAA6E;IAC7E,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;;;;OAIG;IACH,0BAA0B,CAAC,EAAE,MAAM,EAAE,CAAC;IACtC;;;;;OAKG;IACH,6BAA6B,CAAC,EAAE,OAAO,CAAC;IACxC;;;OAGG;IACH,wBAAwB,CAAC,EAAE,CAAC,OAAO,EAAE,wBAAwB,KAAK,IAAI,CAAC;IACvE;;;;;;;;OAQG;IACH,eAAe,CAAC,EAAE;QAChB,OAAO,EAAE,6BAA6B,CAAC;QACvC,MAAM,EAAE,sBAAsB,CAAC;QAC/B,yEAAyE;QACzE,KAAK,CAAC,EAAE,sBAAsB,CAAC;QAC/B;;;WAGG;QACH,kBAAkB,CAAC,EAAE,sBAAsB,CAAC;KAC7C,CAAC;CACE,8CAygOP"}
|
package/dist/routes/agents.js
CHANGED
|
@@ -18,12 +18,13 @@ import path from "node:path";
|
|
|
18
18
|
import { activityLog, agents as agentsTable, chatConversations, companies, heartbeatRuns, issues as issuesTable, projects as projectsTable } from "@tickernelz/paperclip-pro-db";
|
|
19
19
|
import { and, desc, eq, inArray, not, sql } from "drizzle-orm";
|
|
20
20
|
import { sha256Digest } from "../services/feedback-redaction.js";
|
|
21
|
-
import { agentSkillSyncSchema, agentMineInboxQuerySchema, ADAPTER_AGNOSTIC_KEYS, AGENT_DEFAULT_MAX_CONCURRENT_RUNS, createAgentKeySchema, createAgentHireSchema, createAgentSchema, deriveAgentUrlKey, isUuidLike, normalizeIssueIdentifier, resetAgentSessionSchema, testAdapterEnvironmentSchema, upsertAgentInstructionsFileSchema, updateAgentInstructionsBundleSchema, updateAgentPermissionsSchema, updateAgentInstructionsPathSchema, wakeAgentSchema, updateAgentSchema, supportedEnvironmentDriversForAdapter, LOW_TRUST_REVIEW_PRESET, startAdapterAuthSessionRequestSchema, startClaudeSetupTokenSessionRequestSchema, submitBrowserCodeRequestSchema, toAccountHandle, } from "@tickernelz/paperclip-pro-shared";
|
|
21
|
+
import { agentAdapterConfigBatchPreviewSchema, agentAdapterConfigBatchUpdateSchema, agentSkillSyncSchema, agentMineInboxQuerySchema, ADAPTER_AGNOSTIC_KEYS, AGENT_DEFAULT_MAX_CONCURRENT_RUNS, createAgentKeySchema, createAgentHireSchema, createAgentSchema, deriveAgentUrlKey, isUuidLike, normalizeIssueIdentifier, resetAgentSessionSchema, testAdapterEnvironmentSchema, upsertAgentInstructionsFileSchema, updateAgentInstructionsBundleSchema, updateAgentPermissionsSchema, updateAgentInstructionsPathSchema, wakeAgentSchema, updateAgentSchema, supportedEnvironmentDriversForAdapter, LOW_TRUST_REVIEW_PRESET, startAdapterAuthSessionRequestSchema, startClaudeSetupTokenSessionRequestSchema, submitBrowserCodeRequestSchema, toAccountHandle, } from "@tickernelz/paperclip-pro-shared";
|
|
22
22
|
import { isForbiddenConfigEnvKey, normalizePaperclipRunnerAdapterConfig, PAPERCLIP_OPERATIONAL_SKILL_KEY, parseObject, resolvePaperclipInstanceRootForAdapter, readPaperclipSkillSyncPreference, writePaperclipSkillSyncPreference, } from "@tickernelz/paperclip-pro-adapter-utils/server-utils";
|
|
23
23
|
import { trackAgentCreated } from "@tickernelz/paperclip-pro-shared/telemetry";
|
|
24
24
|
import { validate } from "../middleware/validate.js";
|
|
25
25
|
import { inheritNativeRunnerAdapterConfig } from "../services/native-runtime/native-agent-runtime-inheritance.js";
|
|
26
26
|
import { agentInstructionsBundleMode } from "../services/agent-instructions.js";
|
|
27
|
+
import { buildAgentAdapterConfigBatchPreview, planAgentAdapterConfigBatch, } from "../services/agent-adapter-config-batch.js";
|
|
27
28
|
import { agentService, agentInstructionsService, accessService, approvalService, builtInAgentService, companySkillService, budgetService, heartbeatService, ISSUE_LIST_DEFAULT_LIMIT, issueApprovalService, issueRecoveryActionService, issueService, logActivity, syncInstructionsBundleConfigFromFilePath, workspaceOperationService, } from "../services/index.js";
|
|
28
29
|
import { badRequest, conflict, forbidden, HttpError, notFound, unprocessable } from "../errors.js";
|
|
29
30
|
import { ONBOARDING_FIRST_TASK_SKILL_KEY, PAPERCLIP_CORE_SKILL_KEYS } from "../services/company-skills.js";
|
|
@@ -2470,6 +2471,12 @@ export function agentRoutes(db, options = {}) {
|
|
|
2470
2471
|
runtimeConfig: {},
|
|
2471
2472
|
};
|
|
2472
2473
|
}
|
|
2474
|
+
function toCompactAgentListRow(agent) {
|
|
2475
|
+
if (!agent)
|
|
2476
|
+
return null;
|
|
2477
|
+
const { orgChainHealth: _orgChainHealth, appearance: _appearance, avatarUrl: _avatarUrl, ...rest } = agent;
|
|
2478
|
+
return rest;
|
|
2479
|
+
}
|
|
2473
2480
|
// Single presenter for every response that emits a raw agent row. Restricted
|
|
2474
2481
|
// views blank the config wholesale for authorization reasons; this runs for
|
|
2475
2482
|
// config-reading (board) callers too, so plaintext `adapterConfig.env` values
|
|
@@ -3240,7 +3247,12 @@ export function agentRoutes(db, options = {}) {
|
|
|
3240
3247
|
router.get("/companies/:companyId/agents", async (req, res) => {
|
|
3241
3248
|
const companyId = req.params.companyId;
|
|
3242
3249
|
assertCompanyAccess(req, companyId);
|
|
3243
|
-
const
|
|
3250
|
+
const view = req.query.view;
|
|
3251
|
+
if (view !== undefined && view !== "compact") {
|
|
3252
|
+
res.status(400).json({ error: "view must be 'compact' when provided" });
|
|
3253
|
+
return;
|
|
3254
|
+
}
|
|
3255
|
+
const unsupportedQueryParams = Object.keys(req.query).filter((key) => key !== "view").sort();
|
|
3244
3256
|
if (unsupportedQueryParams.length > 0) {
|
|
3245
3257
|
res.status(400).json({
|
|
3246
3258
|
error: `Unsupported query parameter${unsupportedQueryParams.length === 1 ? "" : "s"}: ${unsupportedQueryParams.join(", ")}`,
|
|
@@ -3249,11 +3261,14 @@ export function agentRoutes(db, options = {}) {
|
|
|
3249
3261
|
}
|
|
3250
3262
|
const result = await filterAgentsForActor(req, await svc.list(companyId));
|
|
3251
3263
|
const canReadConfigs = await actorCanReadConfigurationsForCompany(req, companyId);
|
|
3252
|
-
|
|
3253
|
-
|
|
3264
|
+
const rows = canReadConfigs
|
|
3265
|
+
? result.map((agent) => redactAgentRowForResponse(agent))
|
|
3266
|
+
: result.map((agent) => redactForRestrictedAgentView(agent));
|
|
3267
|
+
if (view === "compact") {
|
|
3268
|
+
res.json(rows.map((agent) => toCompactAgentListRow(agent)));
|
|
3254
3269
|
return;
|
|
3255
3270
|
}
|
|
3256
|
-
res.json(
|
|
3271
|
+
res.json(rows);
|
|
3257
3272
|
});
|
|
3258
3273
|
router.get("/instance/scheduler-heartbeats", async (req, res) => {
|
|
3259
3274
|
assertInstanceAdmin(req);
|
|
@@ -4220,6 +4235,120 @@ export function agentRoutes(db, options = {}) {
|
|
|
4220
4235
|
});
|
|
4221
4236
|
res.json(result.bundle);
|
|
4222
4237
|
});
|
|
4238
|
+
async function loadAgentBatchTargets(req, res, agentIds) {
|
|
4239
|
+
const seen = {};
|
|
4240
|
+
const loaded = [];
|
|
4241
|
+
for (const agentId of agentIds) {
|
|
4242
|
+
if (seen[agentId])
|
|
4243
|
+
continue;
|
|
4244
|
+
seen[agentId] = true;
|
|
4245
|
+
const agent = await getAccessibleResource(req, res, svc.getById(agentId), "Agent not found");
|
|
4246
|
+
if (!agent)
|
|
4247
|
+
return null;
|
|
4248
|
+
loaded.push(agent);
|
|
4249
|
+
}
|
|
4250
|
+
const companyIds = new Set(loaded.map((agent) => agent.companyId));
|
|
4251
|
+
if (companyIds.size > 1) {
|
|
4252
|
+
throw forbidden("A batch cannot span companies");
|
|
4253
|
+
}
|
|
4254
|
+
const companyId = loaded[0].companyId;
|
|
4255
|
+
assertBoardOrAgentAuthority(req, "company:agents", companyId);
|
|
4256
|
+
return loaded;
|
|
4257
|
+
}
|
|
4258
|
+
router.post("/agents/batch/adapter-config/preview", validate(agentAdapterConfigBatchPreviewSchema), async (req, res) => {
|
|
4259
|
+
const targets = await loadAgentBatchTargets(req, res, req.body.agentIds);
|
|
4260
|
+
if (!targets)
|
|
4261
|
+
return;
|
|
4262
|
+
for (const agent of targets)
|
|
4263
|
+
await assertCanReadAgent(req, agent);
|
|
4264
|
+
res.json(await buildAgentAdapterConfigBatchPreview(targets.map((agent) => ({
|
|
4265
|
+
id: agent.id,
|
|
4266
|
+
name: agent.name,
|
|
4267
|
+
adapterType: agent.adapterType,
|
|
4268
|
+
adapterConfig: (asRecord(agent.adapterConfig) ?? {}),
|
|
4269
|
+
}))));
|
|
4270
|
+
});
|
|
4271
|
+
router.post("/agents/batch/adapter-config", validate(agentAdapterConfigBatchUpdateSchema), async (req, res) => {
|
|
4272
|
+
const targets = await loadAgentBatchTargets(req, res, req.body.agentIds);
|
|
4273
|
+
if (!targets)
|
|
4274
|
+
return;
|
|
4275
|
+
const values = req.body.values;
|
|
4276
|
+
assertNoAgentAdapterConfigMutation(req, values, "values");
|
|
4277
|
+
for (const agent of targets) {
|
|
4278
|
+
assertExternalInstructionsAdmin(req, agent);
|
|
4279
|
+
await assertCanUpdateAgent(req, agent);
|
|
4280
|
+
}
|
|
4281
|
+
const plan = await planAgentAdapterConfigBatch(targets.map((agent) => ({
|
|
4282
|
+
id: agent.id,
|
|
4283
|
+
name: agent.name,
|
|
4284
|
+
adapterType: agent.adapterType,
|
|
4285
|
+
adapterConfig: (asRecord(agent.adapterConfig) ?? {}),
|
|
4286
|
+
})), values);
|
|
4287
|
+
if (!plan.ok) {
|
|
4288
|
+
res.status(422).json({
|
|
4289
|
+
error: "No agent was changed: some values are invalid for their adapter.",
|
|
4290
|
+
failures: plan.failures,
|
|
4291
|
+
});
|
|
4292
|
+
return;
|
|
4293
|
+
}
|
|
4294
|
+
const actor = getActorInfo(req);
|
|
4295
|
+
const results = [];
|
|
4296
|
+
for (const entry of plan.entries) {
|
|
4297
|
+
if (entry.changedKeys.length === 0) {
|
|
4298
|
+
results.push({
|
|
4299
|
+
agentId: entry.agent.id,
|
|
4300
|
+
name: entry.agent.name,
|
|
4301
|
+
status: "unchanged",
|
|
4302
|
+
changedKeys: [],
|
|
4303
|
+
});
|
|
4304
|
+
continue;
|
|
4305
|
+
}
|
|
4306
|
+
const normalizedAdapterConfig = await normalizeMediatedAdapterConfigForPersistence({
|
|
4307
|
+
companyId: targets[0].companyId,
|
|
4308
|
+
adapterType: entry.agent.adapterType,
|
|
4309
|
+
adapterConfig: entry.adapterConfig,
|
|
4310
|
+
});
|
|
4311
|
+
const updated = await svc.update(entry.agent.id, { adapterConfig: normalizedAdapterConfig }, {
|
|
4312
|
+
recordRevision: {
|
|
4313
|
+
createdByAgentId: actor.agentId,
|
|
4314
|
+
createdByUserId: actor.actorType === "user" ? actor.actorId : null,
|
|
4315
|
+
source: "adapter_config_batch",
|
|
4316
|
+
},
|
|
4317
|
+
});
|
|
4318
|
+
if (!updated) {
|
|
4319
|
+
res.status(404).json({ error: "Agent not found" });
|
|
4320
|
+
return;
|
|
4321
|
+
}
|
|
4322
|
+
await logActivity(db, {
|
|
4323
|
+
companyId: updated.companyId,
|
|
4324
|
+
actorType: actor.actorType,
|
|
4325
|
+
actorId: actor.actorId,
|
|
4326
|
+
agentId: actor.agentId,
|
|
4327
|
+
runId: actor.runId,
|
|
4328
|
+
agentApiKeyId: actor.agentApiKeyId,
|
|
4329
|
+
action: "agent.updated",
|
|
4330
|
+
entityType: "agent",
|
|
4331
|
+
entityId: updated.id,
|
|
4332
|
+
details: {
|
|
4333
|
+
changedTopLevelKeys: ["adapterConfig"],
|
|
4334
|
+
changedAdapterConfigKeys: entry.changedKeys,
|
|
4335
|
+
batch: true,
|
|
4336
|
+
batchSize: plan.entries.length,
|
|
4337
|
+
},
|
|
4338
|
+
});
|
|
4339
|
+
results.push({
|
|
4340
|
+
agentId: entry.agent.id,
|
|
4341
|
+
name: entry.agent.name,
|
|
4342
|
+
status: "updated",
|
|
4343
|
+
changedKeys: entry.changedKeys,
|
|
4344
|
+
});
|
|
4345
|
+
}
|
|
4346
|
+
res.json({
|
|
4347
|
+
updated: results.filter((entry) => entry.status === "updated").length,
|
|
4348
|
+
unchanged: results.filter((entry) => entry.status === "unchanged").length,
|
|
4349
|
+
results,
|
|
4350
|
+
});
|
|
4351
|
+
});
|
|
4223
4352
|
router.patch("/agents/:id", validate(updateAgentSchema), async (req, res) => {
|
|
4224
4353
|
const id = req.params.id;
|
|
4225
4354
|
const existing = await getAccessibleResource(req, res, svc.getById(id), "Agent not found");
|