@xopcai/xopc 0.0.161 → 0.0.162
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/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-o7GRljfD.js → activity-store-hpcNv9MZ.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-9R3szLMc.js → agent-avatar-dicebear-Zf9UQEmQ.js} +1 -1
- package/dist/gateway/static/root/assets/agents-DfVkZlHc.js +2 -0
- package/dist/gateway/static/root/assets/{api-jSTqFMq9.js → api-Dnatri09.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-D81cyE76.js → app-management-settings-panel-BBTR9wJP.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-Ct6bZQCV.js → appearance-settings-C2zpLCHD.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-BMtAa4Ra.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-CfD7AZKn.js → archive-plugin-9eR_ODY1.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CP_Gaxt3.js → attachment-load-DPuWYUeX.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-BGKM_NDZ.js → automation-suggestion-card-Dw49OJRl.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-BiSAMYTr.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-IPr2EVnS.js → binary-plugins-BdkJpDFm.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-B6aHEGA6.js → block-editor-CAi7SXYU.js} +47 -47
- package/dist/gateway/static/root/assets/browser-settings-page-DHmaEJS2.js +8 -0
- package/dist/gateway/static/root/assets/browser-workflow-inputs-Dx6wkGz1.js +1 -0
- package/dist/gateway/static/root/assets/browser-workflows-page-Skertc-A.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-B5wSgf4f.js +2 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-CCX9-LjU.js → capability-presets-api-CNFl7dM3.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-DyvFZwBj.js +2 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-MmLMLDWf.js → channel-recipient-api-DYQyGDw4.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-BBKEqDZn.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-Drk110ve.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-BbjzIs87.js → connector-logo-Bng6kxYF.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-HpgaUDQ1.js +2 -0
- package/dist/gateway/static/root/assets/desktop-pet-Bpf6oegd.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DQLqGLc0.js → desktop-pet-settings-BVUyefSd.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-ClsiXhmz.js → directory-picker-path-field-DjSZAPz_.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-CjMPPdzg.js → dreaming-settings-CAZk2AM4.js} +3 -3
- package/dist/gateway/static/root/assets/{extension-debug-page-57eizjhB.js → extension-debug-page-C2F6vTTd.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CsbSb3u1.js → extension-page-AnIt4bn4.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DKA9-lyP.js → extension-settings-page-CLSc6682.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-DIPJuzBZ.js → gateway-config-api-DLFyZv33.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-CDLqAQY7.js → gateway-settings-DnQAA-qq.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DrfSJtvT.js → gateway-startup-retry-DbzLyJ3R.js} +1 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-DrnKFC6M.js +1 -0
- package/dist/gateway/static/root/assets/goal-detail-page-Cw1hpJkZ.js +4 -0
- package/dist/gateway/static/root/assets/{goals-config-api-lGC10UkU.js → goals-config-api-REmr3QCr.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-BDGkTVma.js +2 -0
- package/dist/gateway/static/root/assets/{goals-settings-BWq0pdrA.js → goals-settings-Dz0F3uRO.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-D4o8BJVv.js → heartbeat-settings-CQFY5gYs.js} +1 -1
- package/dist/gateway/static/root/assets/index-C8JkTS6d.js +199 -0
- package/dist/gateway/static/root/assets/index-hmrG55qg.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-6T2QYehS.js → keyboard-shortcuts-settings-BnOQXU5k.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-Bdef1b7F.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-DCjg2K9f.js → local-apps-page-KsOtWOyM.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-Dar-xqQr.js → locale-store-0lpYdNDr.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-CyYCBqym.js → logs-page-CwLPgrWh.js} +3 -3
- package/dist/gateway/static/root/assets/{markdown-split-rt1XO43g.js → markdown-split-D5GRg10r.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Bwo8CJuh.js → media-plugins-C1ryULGs.js} +1 -1
- package/dist/gateway/static/root/assets/messages-BwQ3WssU.js +5 -0
- package/dist/gateway/static/root/assets/{notes-page-Dp-pkX7d.js → notes-page-CIeZ1_DT.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-Cf06q19x.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-CzZ4iKOb.js → page-tabs-Caj1-E_X.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-3E_Qa-58.js → preview-open-alternatives-DKwEce-9.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-B2T48Sbt.js → product-open-page-B90ZskkN.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-SHTurM4t.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-BcC2qUAw.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-6vGefBHv.js +1 -0
- package/dist/gateway/static/root/assets/save-bar-controls-BDYt53uQ.js +1 -0
- package/dist/gateway/static/root/assets/{schedule-field-TkqUL3wm.js → schedule-field-Bcdni4Pj.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-DC-iU5IG.js → schema-form-D7oCARF7.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-C5014a53.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-CDY3ZI1K.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-Dpqth3oA.js → settings-collapsible-section-6eNF8Jey.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-CNqF6IwY.js → settings-form-section-CARTHCxH.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-DkvwitK_.js → settings-loading-skeleton-DEwYqESe.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-B6vVdHeQ.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-layout-DWvNgISx.js → settings-page-layout-D3srt5Bi.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-z-rF0Hdg.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-DGpSPW-n.js → share-preview-page-Ck9SxiXw.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-CHZFXE_d.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-B7p2QNXt.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-ncw3tX9P.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-8TxxSbUw.js → system-settings-panel-DLBUQSk2.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-B5FzMWOx.js → theme-store-C1oaqeD2.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-DEGtSA5h.js → typed-models-lib-Divbg_C4.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-BDU6FneG.js → use-channel-catalog-CP9a_rAf.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-iYfeSLKI.js +1 -0
- package/dist/gateway/static/root/assets/voice-api-key-field-CrwkicvT.js +1 -0
- package/dist/gateway/static/root/assets/work-discovery-page-BQWxyPg8.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-50ZzGay5.js +1 -0
- package/dist/gateway/static/root/assets/work-page-DPqEahx7.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Cwi8Pz7n.js → workflow-run-setup-panel-DbDPYQwB.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-C3eIC5HZ.js +11 -0
- package/dist/gateway/static/root/index.html +7 -7
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.d.ts +1 -0
- package/dist/src/agent/agent-manager.js +1 -0
- package/dist/src/agent/client-error-format.js +3 -3
- package/dist/src/agent/outcomes/task-evaluation.d.ts +20 -0
- package/dist/src/agent/outcomes/task-evaluation.js +48 -0
- package/dist/src/agent/outcomes/task-verifier.d.ts +29 -0
- package/dist/src/agent/outcomes/task-verifier.js +71 -0
- package/dist/src/agent/prompt/memory/index.js +1 -1
- package/dist/src/agent/prompt/service-prompt-builder.js +32 -1
- package/dist/src/agent/service.js +1 -0
- package/dist/src/agent/service.types.d.ts +1 -0
- package/dist/src/agent/tools/browser/tool/browser-use-tool.d.ts +1 -7
- package/dist/src/agent/tools/browser/tool/browser-use-tool.js +2 -73
- package/dist/src/agent/tools/browser/tool/schemas.d.ts +1 -13
- package/dist/src/agent/tools/browser/tool/schemas.js +1 -9
- package/dist/src/agent/tools/browser-recipe-tool.d.ts +12 -0
- package/dist/src/agent/tools/browser-recipe-tool.js +113 -0
- package/dist/src/agent/tools/factory.d.ts +2 -0
- package/dist/src/agent/tools/factory.js +2 -0
- package/dist/src/agent/tools/index.d.ts +1 -0
- package/dist/src/agent/tools/index.js +2 -1
- package/dist/src/automations/domain/types.d.ts +13 -0
- package/dist/src/automations/domain/validation.d.ts +44 -24
- package/dist/src/automations/domain/validation.js +27 -18
- package/dist/src/automations/draft/automation-draft-validator.d.ts +6 -1
- package/dist/src/automations/draft/automation-draft-validator.js +1 -0
- package/dist/src/automations/service/action-executor.d.ts +1 -0
- package/dist/src/automations/service/action-executor.js +22 -0
- package/dist/src/browser/index.d.ts +0 -1
- package/dist/src/browser/index.js +1 -2
- package/dist/src/browser/pipeline/runner.d.ts +9 -2
- package/dist/src/browser/pipeline/runner.js +151 -105
- package/dist/src/browser/pipeline/schema.d.ts +21 -15
- package/dist/src/browser/pipeline/schema.js +93 -99
- package/dist/src/browser/recipes/index.d.ts +3 -0
- package/dist/src/browser/recipes/index.js +3 -0
- package/dist/src/browser/recipes/repository.d.ts +13 -0
- package/dist/src/browser/recipes/repository.js +81 -0
- package/dist/src/browser/recipes/runtime-service.d.ts +6 -0
- package/dist/src/browser/recipes/runtime-service.js +30 -0
- package/dist/src/browser/recipes/service.d.ts +36 -0
- package/dist/src/browser/recipes/service.js +186 -0
- package/dist/src/browser/recipes/types.d.ts +36 -0
- package/dist/src/browser/recipes/types.js +1 -0
- package/dist/src/cli/commands/browser-cli-helpers.js +6 -12
- package/dist/src/cli/commands/browser.js +4 -3
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/schema.d.ts +3 -3
- package/dist/src/config/schema.js +21 -21
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +1 -1
- package/dist/src/gateway/hono/routes/browser-workflows.d.ts +3 -0
- package/dist/src/gateway/hono/routes/browser-workflows.js +78 -0
- package/dist/src/gateway/hono/routes/home.js +1 -0
- package/dist/src/gateway/hono/routes/index.js +4 -0
- package/dist/src/gateway/hono/routes/interaction-state.d.ts +3 -0
- package/dist/src/gateway/hono/routes/interaction-state.js +45 -0
- package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
- package/dist/src/gateway/hono/routes/memory.js +33 -4
- package/dist/src/gateway/hono/routes/task-outcomes.d.ts +3 -0
- package/dist/src/gateway/hono/routes/task-outcomes.js +109 -0
- package/dist/src/gateway/hono/routes/you.d.ts +10 -2
- package/dist/src/gateway/hono/routes/you.js +184 -28
- package/dist/src/gateway/service/run-gateway-agent.js +84 -0
- package/dist/src/gateway/service.d.ts +3 -0
- package/dist/src/gateway/service.js +14 -0
- package/dist/src/proactive/insight-repository.d.ts +2 -0
- package/dist/src/proactive/insight-repository.js +5 -2
- package/dist/src/proactive/run-processor.js +22 -1
- package/dist/src/proactive/types.d.ts +2 -0
- package/dist/src/proactive/value-score.d.ts +13 -0
- package/dist/src/proactive/value-score.js +30 -0
- package/dist/src/share/share-types.js +5 -5
- package/dist/src/share/site-share-types.d.ts +1 -1
- package/dist/src/share/site-share-types.js +5 -5
- package/dist/src/storage/sqlite/index.d.ts +3 -0
- package/dist/src/storage/sqlite/index.js +4 -1
- package/dist/src/storage/sqlite/interaction-state-repository.d.ts +17 -0
- package/dist/src/storage/sqlite/interaction-state-repository.js +60 -0
- package/dist/src/storage/sqlite/memory-records-repository.js +1 -1
- package/dist/src/storage/sqlite/migrations/053_browser_recipes.sql +45 -0
- package/dist/src/storage/sqlite/migrations/054_task_outcomes.sql +24 -0
- package/dist/src/storage/sqlite/migrations/055_relationship_settings.sql +14 -0
- package/dist/src/storage/sqlite/migrations/056_task_verification.sql +6 -0
- package/dist/src/storage/sqlite/migrations/057_interaction_states.sql +11 -0
- package/dist/src/storage/sqlite/migrations/058_proactive_value.sql +3 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/relationship-settings-repository.d.ts +17 -0
- package/dist/src/storage/sqlite/relationship-settings-repository.js +64 -0
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/schema.sql +46 -0
- package/dist/src/storage/sqlite/task-outcome-repository.d.ts +90 -0
- package/dist/src/storage/sqlite/task-outcome-repository.js +138 -0
- package/dist/src/user-context/interaction-state.d.ts +13 -0
- package/dist/src/user-context/interaction-state.js +69 -0
- package/dist/src/user-context/memory-use-audit.d.ts +10 -0
- package/dist/src/user-context/memory-use-audit.js +25 -0
- package/dist/src/user-context/personal-playbook.d.ts +11 -0
- package/dist/src/user-context/personal-playbook.js +41 -0
- package/dist/src/user-context/projection.d.ts +4 -0
- package/dist/src/user-context/projection.js +5 -1
- package/dist/src/user-context/relationship-continuity.d.ts +14 -0
- package/dist/src/user-context/relationship-continuity.js +51 -0
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/action-boundary-settings-panel-BIVBUiNT.js +0 -1
- package/dist/gateway/static/root/assets/agents-_qbUaYbs.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-0sPqD0FK.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-BxWBuBsE.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-C499b9AH.js +0 -8
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-Dva9SiPK.js +0 -2
- package/dist/gateway/static/root/assets/channels-settings-DNAU7u9o.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-CIOH7tgn.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-TwiBp8vY.js +0 -2
- package/dist/gateway/static/root/assets/desktop-pet-CYH5ZSXy.js +0 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-Q3B0E-0s.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-C5VAK04G.js +0 -4
- package/dist/gateway/static/root/assets/goals-page-BJb-5IYw.js +0 -2
- package/dist/gateway/static/root/assets/index-CkUHH170.css +0 -1
- package/dist/gateway/static/root/assets/index-vq_cJZJC.js +0 -199
- package/dist/gateway/static/root/assets/local-app-workbench-page-euH17Kvb.js +0 -2
- package/dist/gateway/static/root/assets/messages-CxySDn9d.js +0 -5
- package/dist/gateway/static/root/assets/models-hub-panel-DObxxjc9.js +0 -2
- package/dist/gateway/static/root/assets/notes-workbench-CCb4RXcZ.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-BvEcriRC.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-B_e79MRJ.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-DGcqnYfR.js +0 -1
- package/dist/gateway/static/root/assets/save-bar-controls-CkeKasGm.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-DQZhrDJ8.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BkdeN99Y.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-qPG7I2zd.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-lwRAh9aw.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-BGj9IVUr.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-B2UBAs5U.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-DdjzFZ8I.js +0 -2
- package/dist/gateway/static/root/assets/user-context-page-BTTZpAGV.js +0 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-DuDQd-WU.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-BUVkVCsW.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-DeEPPu4n.js +0 -1
- package/dist/gateway/static/root/assets/work-page-DQNUyTUq.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-BIy4wrzO.js +0 -11
- package/dist/src/browser/pipeline/source.d.ts +0 -9
- package/dist/src/browser/pipeline/source.js +0 -77
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
//#region src/gateway/hono/routes/browser-workflows.ts
|
|
2
|
+
function presentWorkflow(service, recipe) {
|
|
3
|
+
const inputs = service.validate(recipe.yaml).document?.args ?? {};
|
|
4
|
+
return {
|
|
5
|
+
id: recipe.id,
|
|
6
|
+
name: recipe.name,
|
|
7
|
+
description: recipe.description,
|
|
8
|
+
enabled: recipe.status === "published",
|
|
9
|
+
risk: recipe.risk,
|
|
10
|
+
domains: recipe.domains,
|
|
11
|
+
inputs,
|
|
12
|
+
createdAtMs: recipe.createdAtMs,
|
|
13
|
+
updatedAtMs: recipe.updatedAtMs
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function presentRun(run) {
|
|
17
|
+
return {
|
|
18
|
+
id: run.id,
|
|
19
|
+
workflowId: run.recipeId,
|
|
20
|
+
status: run.status,
|
|
21
|
+
inputs: run.args,
|
|
22
|
+
result: run.result,
|
|
23
|
+
error: run.error,
|
|
24
|
+
createdAtMs: run.createdAtMs,
|
|
25
|
+
startedAtMs: run.startedAtMs,
|
|
26
|
+
endedAtMs: run.endedAtMs,
|
|
27
|
+
durationMs: run.durationMs
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function registerBrowserWorkflowRoutes(authenticated, deps) {
|
|
31
|
+
const service = deps.service.browserRecipes;
|
|
32
|
+
authenticated.get("/api/browser/workflows", (c) => c.json({ workflows: service.list().map((recipe) => presentWorkflow(service, recipe)) }));
|
|
33
|
+
authenticated.get("/api/browser/workflows/:id", (c) => {
|
|
34
|
+
const recipe = service.get(c.req.param("id"));
|
|
35
|
+
return recipe ? c.json({ workflow: presentWorkflow(service, recipe) }) : c.json({ error: "Browser automation not found" }, 404);
|
|
36
|
+
});
|
|
37
|
+
authenticated.patch("/api/browser/workflows/:id", deps.strictRateLimitMiddleware, async (c) => {
|
|
38
|
+
try {
|
|
39
|
+
const current = service.get(c.req.param("id"));
|
|
40
|
+
if (!current) return c.json({ error: "Browser automation not found" }, 404);
|
|
41
|
+
const body = await c.req.json().catch(() => null);
|
|
42
|
+
if (typeof body?.enabled !== "boolean") return c.json({ error: "enabled must be a boolean" }, 400);
|
|
43
|
+
const workflow = service.save({
|
|
44
|
+
yaml: current.yaml,
|
|
45
|
+
status: body.enabled ? "published" : "disabled",
|
|
46
|
+
expectedId: current.id
|
|
47
|
+
});
|
|
48
|
+
return c.json({ workflow: presentWorkflow(service, workflow) });
|
|
49
|
+
} catch (error) {
|
|
50
|
+
return c.json({ error: error instanceof Error ? error.message : String(error) }, 400);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
authenticated.delete("/api/browser/workflows/:id", deps.strictRateLimitMiddleware, (c) => {
|
|
54
|
+
try {
|
|
55
|
+
return c.json({ removed: service.remove(c.req.param("id")) });
|
|
56
|
+
} catch (error) {
|
|
57
|
+
return c.json({ error: error instanceof Error ? error.message : String(error) }, 409);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
authenticated.post("/api/browser/workflows/:id/run", deps.strictRateLimitMiddleware, async (c) => {
|
|
61
|
+
try {
|
|
62
|
+
const body = await c.req.json().catch(() => ({}));
|
|
63
|
+
if (body.inputs !== void 0 && (!body.inputs || typeof body.inputs !== "object" || Array.isArray(body.inputs))) return c.json({ error: "inputs must be an object" }, 400);
|
|
64
|
+
const run = service.startRun(c.req.param("id"), body.inputs ?? {});
|
|
65
|
+
return c.json({ run: presentRun(run) }, 202);
|
|
66
|
+
} catch (error) {
|
|
67
|
+
return c.json({ error: error instanceof Error ? error.message : String(error) }, 400);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
authenticated.get("/api/browser/workflow-runs", (c) => c.json({ runs: service.listRuns(c.req.query("workflowId")).map(presentRun) }));
|
|
71
|
+
authenticated.get("/api/browser/workflow-runs/:id", (c) => {
|
|
72
|
+
const run = service.getRun(c.req.param("id"));
|
|
73
|
+
return run ? c.json({ run: presentRun(run) }) : c.json({ error: "Run not found" }, 404);
|
|
74
|
+
});
|
|
75
|
+
authenticated.post("/api/browser/workflow-runs/:id/cancel", deps.strictRateLimitMiddleware, (c) => c.json({ cancelled: service.cancel(c.req.param("id")) }));
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
export { registerBrowserWorkflowRoutes };
|
|
@@ -59,6 +59,7 @@ function triggerLabel(automation) {
|
|
|
59
59
|
}
|
|
60
60
|
function actionLabel(automation) {
|
|
61
61
|
if (automation.action.kind === "workflow") return `workflow:${automation.action.workflowId}`;
|
|
62
|
+
if (automation.action.kind === "browser_recipe") return `browser-workflow:${automation.action.recipeId}`;
|
|
62
63
|
return automation.action.agentId ? `agent:${automation.action.agentId}` : "agent";
|
|
63
64
|
}
|
|
64
65
|
function toHomeAutomation(automation) {
|
|
@@ -6,6 +6,8 @@ import { registerMemoryRoutes } from "./memory.js";
|
|
|
6
6
|
import { registerProjectsRoutes } from "./projects.js";
|
|
7
7
|
import { registerSearchRoutes } from "./search.js";
|
|
8
8
|
import { registerMobileRoutes } from "./mobile.js";
|
|
9
|
+
import { registerTaskOutcomeRoutes } from "./task-outcomes.js";
|
|
10
|
+
import { registerInteractionStateRoutes } from "./interaction-state.js";
|
|
9
11
|
import { registerLocalAppsRoutes } from "./local-apps.js";
|
|
10
12
|
import { registerWorkDiscoveryRoutes } from "./work-discovery.js";
|
|
11
13
|
import { mountAppLazyRoutePrefixes, registerAuthenticatedLazyRouteFallback } from "./lazy-fallback.js";
|
|
@@ -21,6 +23,8 @@ function registerCoreAuthenticatedRoutes(authenticated, deps) {
|
|
|
21
23
|
registerWorkDiscoveryRoutes(authenticated, deps);
|
|
22
24
|
registerSearchRoutes(authenticated, deps);
|
|
23
25
|
registerMobileRoutes(authenticated, deps);
|
|
26
|
+
registerTaskOutcomeRoutes(authenticated, deps);
|
|
27
|
+
registerInteractionStateRoutes(authenticated, deps);
|
|
24
28
|
}
|
|
25
29
|
function registerAuthenticatedRoutes(app, authenticated, deps) {
|
|
26
30
|
registerCoreAuthenticatedRoutes(authenticated, deps);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { getInteractionState, setInteractionState } from "../../../storage/sqlite/interaction-state-repository.js";
|
|
2
|
+
import "../../../storage/sqlite/index.js";
|
|
3
|
+
//#region src/gateway/hono/routes/interaction-state.ts
|
|
4
|
+
const SUPPORT_NEEDS = new Set([
|
|
5
|
+
"listen",
|
|
6
|
+
"clarify",
|
|
7
|
+
"advise",
|
|
8
|
+
"act",
|
|
9
|
+
"unknown"
|
|
10
|
+
]);
|
|
11
|
+
function registerInteractionStateRoutes(authenticated, deps) {
|
|
12
|
+
authenticated.get("/api/interaction-state", (c) => {
|
|
13
|
+
const sessionKey = c.req.query("sessionKey")?.trim() ?? "";
|
|
14
|
+
if (!sessionKey) return c.json({ error: "sessionKey is required" }, 400);
|
|
15
|
+
const state = getInteractionState(sessionKey);
|
|
16
|
+
return state ? c.json({
|
|
17
|
+
ok: true,
|
|
18
|
+
state
|
|
19
|
+
}) : c.json({
|
|
20
|
+
ok: false,
|
|
21
|
+
error: "Interaction state not found"
|
|
22
|
+
}, 404);
|
|
23
|
+
});
|
|
24
|
+
authenticated.patch("/api/interaction-state", deps.strictRateLimitMiddleware, async (c) => {
|
|
25
|
+
const body = await c.req.json().catch(() => null);
|
|
26
|
+
const sessionKey = body && typeof body === "object" && typeof body.sessionKey === "string" ? body.sessionKey.trim() : "";
|
|
27
|
+
const supportNeed = body && typeof body === "object" && SUPPORT_NEEDS.has(body.supportNeed) ? body.supportNeed : void 0;
|
|
28
|
+
if (!sessionKey || !supportNeed) return c.json({ error: "sessionKey and a valid supportNeed are required" }, 400);
|
|
29
|
+
const state = setInteractionState({
|
|
30
|
+
sessionKey,
|
|
31
|
+
signal: {
|
|
32
|
+
supportNeed,
|
|
33
|
+
confidence: 1,
|
|
34
|
+
source: "explicit",
|
|
35
|
+
repairStatus: "none"
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
return c.json({
|
|
39
|
+
ok: true,
|
|
40
|
+
state
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { registerInteractionStateRoutes };
|
|
@@ -43,6 +43,14 @@ const AUTHENTICATED_LAZY_ROUTE_BUNDLES = [
|
|
|
43
43
|
return { register: registerBrowserInstallRoutes };
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
+
{
|
|
47
|
+
id: "browser-workflows",
|
|
48
|
+
match: (path) => startsWithAny(path, ["/api/browser/workflows", "/api/browser/workflow-runs"]),
|
|
49
|
+
load: async () => {
|
|
50
|
+
const { registerBrowserWorkflowRoutes } = await import("./browser-workflows.js");
|
|
51
|
+
return { register: registerBrowserWorkflowRoutes };
|
|
52
|
+
}
|
|
53
|
+
},
|
|
46
54
|
{
|
|
47
55
|
id: "browser",
|
|
48
56
|
match: (path) => startsWithAny(path, ["/api/browser"]),
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { setInteractionState } from "../../../storage/sqlite/interaction-state-repository.js";
|
|
1
2
|
import { LOCAL_USER_ID } from "../../../user-context/owner.js";
|
|
3
|
+
import { findTaskOutcomeForAssistant, setTaskOutcomeFeedback } from "../../../storage/sqlite/task-outcome-repository.js";
|
|
2
4
|
import { appendMemorySignal, appendMemoryTraceEvent, deleteMemoryRecord, findLatestMemoryInjectTrace, getMemoryRecord, listMemoryRecords, listMemorySignals, listMemoryTraceEvents, searchMemoryRecords, setLatestMemoryInjectFeedback, setMemoryTraceFeedback, summarizeMemoryRecallFeedback, summarizeUserUnderstandingQuality, upsertMemoryRecord } from "../../../storage/sqlite/memory-records-repository.js";
|
|
3
5
|
import { listKnowledgeSourceChanges, listKnowledgeSourceItems, listKnowledgeSyncRuns } from "../../../storage/sqlite/knowledge-repository.js";
|
|
4
6
|
import "../../../storage/sqlite/index.js";
|
|
@@ -10,6 +12,7 @@ import { discoverMemoryPlugins } from "../../../agent/memory/plugin-discovery.js
|
|
|
10
12
|
import { createMemoryManagerFromConfig } from "../../../agent/memory/create-memory-manager.js";
|
|
11
13
|
import { resolveAdaptiveUnderstandingCadence } from "../../../agent/memory/understanding/quality.js";
|
|
12
14
|
import { isUserContextRecord, projectUserContextRecord } from "../../../user-context/projection.js";
|
|
15
|
+
import { summarizeMemoryUseAudit } from "../../../user-context/memory-use-audit.js";
|
|
13
16
|
//#region src/gateway/hono/routes/memory.ts
|
|
14
17
|
init_agent_scope();
|
|
15
18
|
init_config();
|
|
@@ -310,6 +313,13 @@ function registerMemoryRoutes(authenticated, deps) {
|
|
|
310
313
|
});
|
|
311
314
|
return c.json({ traces });
|
|
312
315
|
});
|
|
316
|
+
authenticated.get("/api/user-context/memory-use-audit", (c) => {
|
|
317
|
+
const traces = listMemoryTraceEvents({
|
|
318
|
+
sessionKey: c.req.query("sessionKey") || void 0,
|
|
319
|
+
limit: parseLimit(c.req.query("limit"))
|
|
320
|
+
});
|
|
321
|
+
return c.json({ audit: summarizeMemoryUseAudit(traces) });
|
|
322
|
+
});
|
|
313
323
|
authenticated.patch("/api/user-context/traces/:traceId/feedback", async (c) => {
|
|
314
324
|
const body = await c.req.json().catch(() => ({}));
|
|
315
325
|
const outcome = typeof body.outcome === "string" && MEMORY_TRACE_FEEDBACK_OUTCOMES.has(body.outcome) ? body.outcome : void 0;
|
|
@@ -353,6 +363,24 @@ function registerMemoryRoutes(authenticated, deps) {
|
|
|
353
363
|
const outcome = body.outcome === "helpful" || body.outcome === "not_helpful" ? body.outcome : void 0;
|
|
354
364
|
const reason = typeof body.reason === "string" ? body.reason.trim().slice(0, 160) : "";
|
|
355
365
|
if (!sessionKey || !Number.isFinite(assistantTimestamp) || assistantTimestamp <= 0 || !outcome) return c.json({ error: "sessionKey, assistantTimestamp, and a valid outcome are required" }, 400);
|
|
366
|
+
const taskOutcome = setTaskOutcomeFeedback({
|
|
367
|
+
sessionKey,
|
|
368
|
+
assistantTimestamp,
|
|
369
|
+
outcome,
|
|
370
|
+
reason: reason || void 0,
|
|
371
|
+
needsCorrection: outcome === "not_helpful",
|
|
372
|
+
...outcome === "helpful" ? { supportFit: true } : reason.includes("tone_mismatch") ? { supportFit: false } : {}
|
|
373
|
+
});
|
|
374
|
+
if (outcome === "not_helpful" && reason.includes("tone_mismatch")) setInteractionState({
|
|
375
|
+
sessionKey,
|
|
376
|
+
signal: {
|
|
377
|
+
supportNeed: "unknown",
|
|
378
|
+
confidence: 1,
|
|
379
|
+
source: "explicit",
|
|
380
|
+
repairStatus: "needed",
|
|
381
|
+
repairReason: reason
|
|
382
|
+
}
|
|
383
|
+
});
|
|
356
384
|
const trace = setLatestMemoryInjectFeedback({
|
|
357
385
|
sessionKey,
|
|
358
386
|
beforeMs: assistantTimestamp,
|
|
@@ -363,10 +391,10 @@ function registerMemoryRoutes(authenticated, deps) {
|
|
|
363
391
|
}
|
|
364
392
|
});
|
|
365
393
|
return c.json({
|
|
366
|
-
matched: Boolean(
|
|
394
|
+
matched: Boolean(taskOutcome),
|
|
367
395
|
attributedRecordCount: trace?.selectedRecordIds.length ?? 0,
|
|
368
396
|
personalContext: personalContextForTrace(trace),
|
|
369
|
-
feedback:
|
|
397
|
+
feedback: taskOutcome?.feedback ?? null,
|
|
370
398
|
remediation: trace?.remediation ?? null
|
|
371
399
|
});
|
|
372
400
|
});
|
|
@@ -374,15 +402,16 @@ function registerMemoryRoutes(authenticated, deps) {
|
|
|
374
402
|
const sessionKey = c.req.query("sessionKey")?.trim() ?? "";
|
|
375
403
|
const assistantTimestamp = Number(c.req.query("assistantTimestamp"));
|
|
376
404
|
if (!sessionKey || !Number.isFinite(assistantTimestamp) || assistantTimestamp <= 0) return c.json({ error: "sessionKey and assistantTimestamp are required" }, 400);
|
|
405
|
+
const taskOutcome = findTaskOutcomeForAssistant(sessionKey, assistantTimestamp);
|
|
377
406
|
const trace = findLatestMemoryInjectTrace({
|
|
378
407
|
sessionKey,
|
|
379
408
|
beforeMs: assistantTimestamp
|
|
380
409
|
});
|
|
381
410
|
return c.json({
|
|
382
|
-
matched: Boolean(
|
|
411
|
+
matched: Boolean(taskOutcome),
|
|
383
412
|
attributedRecordCount: trace?.selectedRecordIds.length ?? 0,
|
|
384
413
|
personalContext: personalContextForTrace(trace),
|
|
385
|
-
feedback:
|
|
414
|
+
feedback: taskOutcome?.feedback ?? null
|
|
386
415
|
});
|
|
387
416
|
});
|
|
388
417
|
authenticated.post("/api/user-context/signals", async (c) => {
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { findTaskOutcomeForAssistant, getTaskOutcome, listTaskOutcomes, summarizeTaskOutcomes, updateTaskOutcome } from "../../../storage/sqlite/task-outcome-repository.js";
|
|
2
|
+
import "../../../storage/sqlite/index.js";
|
|
3
|
+
import { replayTaskEvaluation } from "../../../agent/outcomes/task-evaluation.js";
|
|
4
|
+
//#region src/gateway/hono/routes/task-outcomes.ts
|
|
5
|
+
function parseLimit(raw) {
|
|
6
|
+
if (!raw) return void 0;
|
|
7
|
+
const value = Number.parseInt(raw, 10);
|
|
8
|
+
return Number.isFinite(value) ? value : void 0;
|
|
9
|
+
}
|
|
10
|
+
function isStringArray(value) {
|
|
11
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
12
|
+
}
|
|
13
|
+
function isTaskContract(value) {
|
|
14
|
+
if (!value || typeof value !== "object") return false;
|
|
15
|
+
const contract = value;
|
|
16
|
+
return typeof contract.objective === "string" && isStringArray(contract.deliverables) && isStringArray(contract.acceptanceCriteria) && isStringArray(contract.constraints) && isStringArray(contract.approvalRequired);
|
|
17
|
+
}
|
|
18
|
+
function isTaskEvidence(value) {
|
|
19
|
+
return Array.isArray(value) && value.every((item) => {
|
|
20
|
+
if (!item || typeof item !== "object") return false;
|
|
21
|
+
const evidence = item;
|
|
22
|
+
return (evidence.kind === "artifact" || evidence.kind === "test" || evidence.kind === "state" || evidence.kind === "source") && typeof evidence.title === "string" && typeof evidence.summary === "string" && (evidence.uri === void 0 || typeof evidence.uri === "string") && (evidence.verifies === void 0 || isStringArray(evidence.verifies));
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function registerTaskOutcomeRoutes(authenticated, _deps) {
|
|
26
|
+
authenticated.get("/api/task-outcomes", (c) => {
|
|
27
|
+
const items = listTaskOutcomes({
|
|
28
|
+
sessionKey: c.req.query("sessionKey")?.trim() || void 0,
|
|
29
|
+
limit: parseLimit(c.req.query("limit"))
|
|
30
|
+
});
|
|
31
|
+
return c.json({
|
|
32
|
+
ok: true,
|
|
33
|
+
items
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
authenticated.get("/api/task-outcomes/metrics", (c) => {
|
|
37
|
+
return c.json({
|
|
38
|
+
ok: true,
|
|
39
|
+
metrics: summarizeTaskOutcomes()
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
authenticated.get("/api/task-outcomes/evaluation", (c) => {
|
|
43
|
+
const items = listTaskOutcomes({ limit: parseLimit(c.req.query("limit")) ?? 100 });
|
|
44
|
+
return c.json({
|
|
45
|
+
ok: true,
|
|
46
|
+
evaluation: replayTaskEvaluation(items)
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
authenticated.get("/api/task-outcomes/for-assistant", (c) => {
|
|
50
|
+
const sessionKey = c.req.query("sessionKey")?.trim() ?? "";
|
|
51
|
+
const assistantTimestamp = Number(c.req.query("assistantTimestamp"));
|
|
52
|
+
if (!sessionKey || !Number.isFinite(assistantTimestamp) || assistantTimestamp <= 0) return c.json({
|
|
53
|
+
ok: false,
|
|
54
|
+
error: "sessionKey and assistantTimestamp are required"
|
|
55
|
+
}, 400);
|
|
56
|
+
const outcome = findTaskOutcomeForAssistant(sessionKey, assistantTimestamp);
|
|
57
|
+
return outcome ? c.json({
|
|
58
|
+
ok: true,
|
|
59
|
+
outcome
|
|
60
|
+
}) : c.json({
|
|
61
|
+
ok: false,
|
|
62
|
+
error: "Task outcome not found"
|
|
63
|
+
}, 404);
|
|
64
|
+
});
|
|
65
|
+
authenticated.get("/api/task-outcomes/:runId", (c) => {
|
|
66
|
+
const outcome = getTaskOutcome(c.req.param("runId"));
|
|
67
|
+
return outcome ? c.json({
|
|
68
|
+
ok: true,
|
|
69
|
+
outcome
|
|
70
|
+
}) : c.json({
|
|
71
|
+
ok: false,
|
|
72
|
+
error: "Task outcome not found"
|
|
73
|
+
}, 404);
|
|
74
|
+
});
|
|
75
|
+
authenticated.patch("/api/task-outcomes/:runId", async (c) => {
|
|
76
|
+
const body = await c.req.json().catch(() => null);
|
|
77
|
+
if (!body || typeof body !== "object") return c.json({
|
|
78
|
+
ok: false,
|
|
79
|
+
error: "Invalid JSON body"
|
|
80
|
+
}, 400);
|
|
81
|
+
if (body.contract !== void 0 && !isTaskContract(body.contract)) return c.json({
|
|
82
|
+
ok: false,
|
|
83
|
+
error: "Invalid task contract"
|
|
84
|
+
}, 400);
|
|
85
|
+
if (body.evidence !== void 0 && !isTaskEvidence(body.evidence)) return c.json({
|
|
86
|
+
ok: false,
|
|
87
|
+
error: "Invalid task evidence"
|
|
88
|
+
}, 400);
|
|
89
|
+
if (body.summary !== void 0 && typeof body.summary !== "string") return c.json({
|
|
90
|
+
ok: false,
|
|
91
|
+
error: "Invalid task summary"
|
|
92
|
+
}, 400);
|
|
93
|
+
const outcome = updateTaskOutcome({
|
|
94
|
+
runId: c.req.param("runId"),
|
|
95
|
+
...body.contract === void 0 ? {} : { contract: body.contract },
|
|
96
|
+
...body.evidence === void 0 ? {} : { evidence: body.evidence },
|
|
97
|
+
...body.summary === void 0 ? {} : { summary: body.summary }
|
|
98
|
+
});
|
|
99
|
+
return outcome ? c.json({
|
|
100
|
+
ok: true,
|
|
101
|
+
outcome
|
|
102
|
+
}) : c.json({
|
|
103
|
+
ok: false,
|
|
104
|
+
error: "Task outcome not found"
|
|
105
|
+
}, 404);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
//#endregion
|
|
109
|
+
export { registerTaskOutcomeRoutes };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { Hono } from 'hono';
|
|
2
2
|
import type { MemoryRecord } from '../../../agent/memory/types.js';
|
|
3
|
+
import { type PersonalPlaybookContext } from '../../../user-context/personal-playbook.js';
|
|
3
4
|
import type { AuthenticatedRouteDeps } from './deps.js';
|
|
4
5
|
export declare function buildPersonalPlaybooks(records: MemoryRecord[]): {
|
|
5
|
-
id: "
|
|
6
|
+
id: "execution" | "communication" | "routines";
|
|
6
7
|
enabled: boolean;
|
|
7
8
|
rules: {
|
|
8
9
|
id: string;
|
|
@@ -10,6 +11,13 @@ export declare function buildPersonalPlaybooks(records: MemoryRecord[]): {
|
|
|
10
11
|
origin: import("../../../agent/memory/types.js").MemoryExplicitness;
|
|
11
12
|
enabled: boolean;
|
|
12
13
|
order: number;
|
|
14
|
+
context: PersonalPlaybookContext;
|
|
15
|
+
versions: {
|
|
16
|
+
id: string;
|
|
17
|
+
statement: string;
|
|
18
|
+
updatedAt: string;
|
|
19
|
+
current: boolean;
|
|
20
|
+
}[];
|
|
13
21
|
}[];
|
|
14
22
|
updatedAt: string;
|
|
15
23
|
}[];
|
|
@@ -17,7 +25,7 @@ export declare function buildInsightSuggestions(records: MemoryRecord[]): {
|
|
|
17
25
|
id: string;
|
|
18
26
|
insight: string;
|
|
19
27
|
kind: import("../../../agent/memory/types.js").MemoryKind;
|
|
20
|
-
action: "make_repeatable" | "start_progress";
|
|
28
|
+
action: "make_repeatable" | "add_playbook" | "start_progress";
|
|
21
29
|
evidenceCount: number;
|
|
22
30
|
confidence: number;
|
|
23
31
|
sourceName: string;
|