@xopcai/xopc 0.0.150 → 0.0.152
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-B3YP7y9d.js → activity-store-uu1xu9Pl.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BaP05tRU.js → agent-avatar-dicebear-CXe2KDZj.js} +1 -1
- package/dist/gateway/static/root/assets/agents-BjLxhsVX.js +2 -0
- package/dist/gateway/static/root/assets/{api-BirUfJgj.js → api-CwL38LEV.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-D5Cg_a6I.js → app-management-settings-panel-DekP2_hC.js} +1 -1
- package/dist/gateway/static/root/assets/appearance-settings-Cfd5YavF.js +1 -0
- package/dist/gateway/static/root/assets/apps-page-PS-uUoSk.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-D3OmrvFx.js → archive-plugin-DWglUgbp.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-Cgkm_5mb.js → attachment-load-BJdxo2Vn.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-CHvxSz-t.js → automation-suggestion-card-B-TfxjJF.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-CtNevo3y.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-dJR5UuzL.js → binary-plugins-DwrYsL8l.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-v4_7o92L.js → block-editor-CIxjL5Kp.js} +46 -46
- package/dist/gateway/static/root/assets/browser-settings-page-QncZ-2vS.js +8 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-BcTjPLiD.js → capability-presets-api-ChR2rMfo.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-CddBf58y.js → capability-presets-settings-panel-_JBmJl5A.js} +2 -2
- package/dist/gateway/static/root/assets/{channel-recipient-api-BbDlMRm5.js → channel-recipient-api-DYLBAhFF.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-Bz3tyWpH.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-CZuEsO5b.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-BNthqff-.js → connector-logo-KsRvub5G.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-_pT0aE0S.js +2 -0
- package/dist/gateway/static/root/assets/desktop-pet-CRCERvWy.js +1 -0
- package/dist/gateway/static/root/assets/desktop-pet-settings-vGrxshsU.js +1 -0
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BdWd7m-p.js → directory-picker-path-field-BGPYrtx6.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-CXDhu3Me.js → dreaming-settings-B5pzvNgs.js} +3 -3
- package/dist/gateway/static/root/assets/{extension-debug-page-CLJTGozU.js → extension-debug-page-BaCko1XU.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-ClxpGfzA.js → extension-page-TTXKCMtb.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CDA3ZJ8k.js → extension-settings-page-CEMb3uXY.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-DpXL78pS.js → gateway-config-api-Bf37OGhQ.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-cu-vyeNk.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-D0SU7dte.js → gateway-startup-retry-BM_xvzl0.js} +1 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-C-bL8rj8.js +1 -0
- package/dist/gateway/static/root/assets/goal-detail-page-p5zPrlTq.js +4 -0
- package/dist/gateway/static/root/assets/{goals-config-api-r71aDqix.js → goals-config-api-D2pEoiiO.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-D-H2u2-J.js +2 -0
- package/dist/gateway/static/root/assets/{goals-settings-CZOLhkTH.js → goals-settings-BVZaBqPa.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-F9S1gIFo.js → heartbeat-settings-B-AC_uwa.js} +1 -1
- package/dist/gateway/static/root/assets/index-DIlxvrlG.css +1 -0
- package/dist/gateway/static/root/assets/index-DSydVlxZ.js +196 -0
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-w0yIP0UB.js +1 -0
- package/dist/gateway/static/root/assets/local-app-workbench-page-CTq0TIH4.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-n7YJfRkU.js → local-apps-page-srIyxJuy.js} +1 -1
- package/dist/gateway/static/root/assets/locale-store-GfSwnwIZ.js +1 -0
- package/dist/gateway/static/root/assets/logs-page-MQB6-NKt.js +7 -0
- package/dist/gateway/static/root/assets/{markdown-split-1mnXr-JA.js → markdown-split-Du5yPuDb.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-D2bcxXrT.js → media-plugins-Cd1Rmw15.js} +1 -1
- package/dist/gateway/static/root/assets/{messages-BH7paqYt.js → messages-B0B40tpO.js} +2 -2
- package/dist/gateway/static/root/assets/models-hub-panel-BMg_Xqd9.js +2 -0
- package/dist/gateway/static/root/assets/{notes-page-Wjc2utlj.js → notes-page-DhfrFd89.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-CwJk-D7Y.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-vdljrKuG.js → page-tabs-HACawonJ.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-BHki0l-E.js → preview-open-alternatives-CjEZt_F5.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-Dut_micj.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-sTRlCEZ5.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-Fx81YH7S.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-Vy4EmvEh.js → save-bar-controls-CbktHUqt.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-CVcwC7k_.js → schedule-field-BGx_Nb45.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-DhMA1vkR.js → schema-form-Cg-LJVvG.js} +1 -1
- package/dist/gateway/static/root/assets/schemas-DgQq6Z5S.js +64 -0
- package/dist/gateway/static/root/assets/sessions-page-DFnmyBpj.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BlWxQ6Ea.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-C0xcL0vB.js → settings-collapsible-section-yYK4O-5E.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-Cgj4iVpx.js → settings-form-section-DPSA8tG8.js} +1 -1
- package/dist/gateway/static/root/assets/settings-loading-skeleton-ClHNJwRL.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-B7_JZ2rM.js → settings-page-lPM7md10.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-CKuQT4SG.js → settings-page-layout-B_-VepeK.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-hORJvGAQ.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-BmVw-6SJ.js → share-preview-page-DyzplAEL.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DO3IIgcC.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-C9BqzDjZ.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-CvOIrcCJ.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-D6d8VAk8.js → system-settings-panel-eIyklo0K.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-EbMQ3TYi.js → theme-store-Bi6hMBDb.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-D63hJX-S.js → typed-models-lib-BgOpEx3h.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-D-I-qki9.js → use-channel-catalog-f8A-PVuq.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-BG_1IrIJ.js +1 -0
- package/dist/gateway/static/root/assets/{user-profile-fields-editor-CPaoS8Zl.js → user-profile-fields-editor-CfLUK6MT.js} +1 -1
- package/dist/gateway/static/root/assets/{user-profile-settings-panel-Bs13qcx1.js → user-profile-settings-panel-BmzPREhJ.js} +1 -1
- package/dist/gateway/static/root/assets/{utils-3mnkFvPw.js → utils-DbFnvDPi.js} +1 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-1xyza74n.js +1 -0
- package/dist/gateway/static/root/assets/work-discovery-page-Dhyk4LHJ.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-CxBRnWeQ.js +1 -0
- package/dist/gateway/static/root/assets/work-page-Btq3YeCH.js +1 -0
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-8HLqUALq.js +3 -0
- package/dist/gateway/static/root/assets/workflows-page-D48bPgLI.js +11 -0
- package/dist/gateway/static/root/index.html +8 -7
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/product-delivery.js +63 -0
- package/dist/src/agent/agent-manager.d.ts +1 -0
- package/dist/src/agent/agent-manager.js +1 -0
- package/dist/src/agent/code-intelligence/tool-gating.d.ts +5 -0
- package/dist/src/agent/code-intelligence/tool-gating.js +6 -0
- package/dist/src/agent/service.js +1 -0
- package/dist/src/agent/service.types.d.ts +2 -0
- package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
- package/dist/src/agent/tool-manuals/xopc-use.js +41 -2
- package/dist/src/agent/tools/automation-tool.js +45 -6
- package/dist/src/agent/tools/factory.d.ts +2 -0
- package/dist/src/agent/tools/factory.js +5 -3
- package/dist/src/agent/tools/goal-tool.d.ts +7 -1
- package/dist/src/agent/tools/goal-tool.js +34 -5
- package/dist/src/agent/tools/workflow-tool.js +32 -2
- package/dist/src/agent/tools/write.js +23 -3
- package/dist/src/agent/tools/xopc-use-tool.d.ts +6 -2
- package/dist/src/agent/tools/xopc-use-tool.js +216 -6
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/hono/routes/status.d.ts +8 -0
- package/dist/src/gateway/hono/routes/status.js +71 -1
- package/dist/src/gateway/service.js +1 -0
- package/package.json +11 -2
- package/dist/gateway/static/root/assets/agents-QArUBYV7.js +0 -2
- package/dist/gateway/static/root/assets/appearance-settings-BBsAkJ56.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-D1uAUndU.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-BWQk03Vu.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-SruFGuBP.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-WI5tQ5tn.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-Dt2EROlf.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DavHJ6rR.js +0 -2
- package/dist/gateway/static/root/assets/desktop-pet-CVajXkdj.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-SHI66eIi.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-Co-mXFP_.js +0 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-BO6G--Ec.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-DK8eog4h.js +0 -4
- package/dist/gateway/static/root/assets/goals-page-AcROW97U.js +0 -2
- package/dist/gateway/static/root/assets/index-C46C7Xee.css +0 -1
- package/dist/gateway/static/root/assets/index-IPmCli0N.js +0 -259
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-B3CUVfZ8.js +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-HVq6NUvQ.js +0 -2
- package/dist/gateway/static/root/assets/locale-store-BvcHGPHU.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-Dgko6r04.js +0 -7
- package/dist/gateway/static/root/assets/models-hub-panel-DD0cEfmR.js +0 -2
- package/dist/gateway/static/root/assets/notes-workbench-BkA2yg9K.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-CXwVNLgg.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-DlfvNcLh.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BQyEX2Ui.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-CqQEW8oT.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-M8fleFSc.js +0 -1
- package/dist/gateway/static/root/assets/settings-loading-skeleton-CC_NmD69.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-DvR8Y5YN.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-C0JYYhGx.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DBFBczqN.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-KAI9qBDD.js +0 -2
- package/dist/gateway/static/root/assets/user-context-page-Cuft-EbR.js +0 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-C716UEi9.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-CFSkHa0v.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-DaapBdoZ.js +0 -1
- package/dist/gateway/static/root/assets/work-page-DMtX92vs.js +0 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-B9FnZNWZ.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-BgvE0_Iv.js +0 -11
|
@@ -2,6 +2,7 @@ import { runWithActivityContext } from "../../activity/context.js";
|
|
|
2
2
|
import { getSessionMetadata } from "../../storage/sqlite/session-repository.js";
|
|
3
3
|
import "../../storage/sqlite/index.js";
|
|
4
4
|
import "../../activity/index.js";
|
|
5
|
+
import { appendProductDeliveryText } from "../../../packages/gateway-contract/src/product-delivery.js";
|
|
5
6
|
import { isValidProjectAgentId, normalizeProjectAgentId } from "../../projects/project-agent.js";
|
|
6
7
|
import "../../projects/index.js";
|
|
7
8
|
import { Type } from "@sinclair/typebox";
|
|
@@ -10,9 +11,11 @@ const XopcUseToolSchema = Type.Object({
|
|
|
10
11
|
mode: Type.Union([
|
|
11
12
|
Type.Literal("project"),
|
|
12
13
|
Type.Literal("note"),
|
|
13
|
-
Type.Literal("work_item")
|
|
14
|
+
Type.Literal("work_item"),
|
|
15
|
+
Type.Literal("local_app"),
|
|
16
|
+
Type.Literal("settings")
|
|
14
17
|
]),
|
|
15
|
-
command: Type.String({ description: "Object command. Supports project list/get/create/update/resolve_workspace, note list/get/create/append/update/preview_edit,
|
|
18
|
+
command: Type.String({ description: "Object command. Supports project list/get/create/update/resolve_workspace, note list/get/create/append/update/preview_edit, work_item list/get/create/update, local_app list/get/create/validate, and settings open." }),
|
|
16
19
|
args: Type.Optional(Type.Record(Type.String(), Type.Any())),
|
|
17
20
|
dryRun: Type.Optional(Type.Boolean({ description: "Validate and preview the action without mutating xopc state." }))
|
|
18
21
|
});
|
|
@@ -56,7 +59,7 @@ function okText(details) {
|
|
|
56
59
|
return {
|
|
57
60
|
content: [{
|
|
58
61
|
type: "text",
|
|
59
|
-
text: JSON.stringify(details.result ?? {}, null, 2)
|
|
62
|
+
text: appendProductDeliveryText(JSON.stringify(details.result ?? {}, null, 2), details.delivery)
|
|
60
63
|
}],
|
|
61
64
|
details
|
|
62
65
|
};
|
|
@@ -113,6 +116,120 @@ function nullableNumber(value) {
|
|
|
113
116
|
function ensureArgs(input) {
|
|
114
117
|
return input.args && typeof input.args === "object" && !Array.isArray(input.args) ? input.args : {};
|
|
115
118
|
}
|
|
119
|
+
function record(value) {
|
|
120
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
121
|
+
}
|
|
122
|
+
function deliveryText(value) {
|
|
123
|
+
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
124
|
+
}
|
|
125
|
+
function deliveryRevision(value) {
|
|
126
|
+
if (typeof value === "number" && Number.isFinite(value)) return String(value);
|
|
127
|
+
return deliveryText(value);
|
|
128
|
+
}
|
|
129
|
+
function deliverySummary(...values) {
|
|
130
|
+
const value = values.map(deliveryText).find(Boolean);
|
|
131
|
+
if (!value) return void 0;
|
|
132
|
+
return value.length > 180 ? `${value.slice(0, 177)}…` : value;
|
|
133
|
+
}
|
|
134
|
+
function deliveryForXopcResult(mode, command, result, dryRun) {
|
|
135
|
+
if (dryRun || command === "list") return void 0;
|
|
136
|
+
const resultRecord = record(result);
|
|
137
|
+
if (!resultRecord || resultRecord.ok === false) return void 0;
|
|
138
|
+
let source;
|
|
139
|
+
let primary;
|
|
140
|
+
if (mode === "project") {
|
|
141
|
+
const match = record(resultRecord.match);
|
|
142
|
+
source = record(resultRecord.project) ?? record(match?.project) ?? match;
|
|
143
|
+
const id = deliveryText(source?.id);
|
|
144
|
+
if (id) primary = {
|
|
145
|
+
kind: "project",
|
|
146
|
+
id,
|
|
147
|
+
title: deliveryText(source?.name) ?? "Project",
|
|
148
|
+
summary: deliverySummary(source?.description, source?.brief),
|
|
149
|
+
status: deliveryText(source?.status),
|
|
150
|
+
revision: deliveryRevision(source?.updatedAt),
|
|
151
|
+
capabilities: [
|
|
152
|
+
"open",
|
|
153
|
+
"edit",
|
|
154
|
+
"continue_in_chat"
|
|
155
|
+
]
|
|
156
|
+
};
|
|
157
|
+
} else if (mode === "note") {
|
|
158
|
+
source = record(resultRecord.note);
|
|
159
|
+
const id = deliveryText(source?.id);
|
|
160
|
+
if (id) primary = {
|
|
161
|
+
kind: "note",
|
|
162
|
+
id,
|
|
163
|
+
title: deliveryText(source?.title) ?? "Untitled note",
|
|
164
|
+
summary: deliverySummary(source?.markdown),
|
|
165
|
+
status: deliveryText(source?.status),
|
|
166
|
+
revision: deliveryRevision(source?.localVersion) ?? deliveryRevision(source?.updatedAt),
|
|
167
|
+
capabilities: [
|
|
168
|
+
"open",
|
|
169
|
+
"preview",
|
|
170
|
+
"edit",
|
|
171
|
+
"continue_in_chat",
|
|
172
|
+
"share"
|
|
173
|
+
]
|
|
174
|
+
};
|
|
175
|
+
} else if (mode === "work_item") {
|
|
176
|
+
source = record(resultRecord.item);
|
|
177
|
+
const id = deliveryText(source?.id);
|
|
178
|
+
if (id) primary = {
|
|
179
|
+
kind: "work_item",
|
|
180
|
+
id,
|
|
181
|
+
title: deliveryText(source?.title) ?? "Work item",
|
|
182
|
+
summary: deliverySummary(source?.description, source?.nextAction),
|
|
183
|
+
status: deliveryText(source?.status),
|
|
184
|
+
revision: deliveryRevision(source?.updatedAt),
|
|
185
|
+
projectId: deliveryText(source?.projectId),
|
|
186
|
+
capabilities: [
|
|
187
|
+
"open",
|
|
188
|
+
"edit",
|
|
189
|
+
"continue_in_chat"
|
|
190
|
+
]
|
|
191
|
+
};
|
|
192
|
+
} else if (mode === "local_app") {
|
|
193
|
+
source = record(resultRecord.app);
|
|
194
|
+
const id = deliveryText(source?.id);
|
|
195
|
+
if (id) primary = {
|
|
196
|
+
kind: "local_app",
|
|
197
|
+
id,
|
|
198
|
+
title: deliveryText(source?.name) ?? "Local app",
|
|
199
|
+
summary: deliverySummary(source?.description, source?.idea),
|
|
200
|
+
status: deliveryText(source?.installationState) ?? deliveryText(source?.status),
|
|
201
|
+
revision: deliveryRevision(source?.updatedAt),
|
|
202
|
+
projectId: deliveryText(source?.projectId),
|
|
203
|
+
capabilities: [
|
|
204
|
+
"open",
|
|
205
|
+
"preview",
|
|
206
|
+
"edit",
|
|
207
|
+
"continue_in_chat",
|
|
208
|
+
"run"
|
|
209
|
+
]
|
|
210
|
+
};
|
|
211
|
+
} else {
|
|
212
|
+
source = record(resultRecord.settings);
|
|
213
|
+
const id = deliveryText(source?.section);
|
|
214
|
+
if (id) primary = {
|
|
215
|
+
kind: "settings",
|
|
216
|
+
id,
|
|
217
|
+
title: deliveryText(source?.title) ?? "Settings",
|
|
218
|
+
summary: deliverySummary(source?.summary),
|
|
219
|
+
capabilities: [
|
|
220
|
+
"open",
|
|
221
|
+
"configure",
|
|
222
|
+
"continue_in_chat"
|
|
223
|
+
]
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
if (!primary) return void 0;
|
|
227
|
+
return {
|
|
228
|
+
version: 1,
|
|
229
|
+
operation: command === "create" ? "created" : command === "get" || command === "resolve_workspace" || mode === "settings" ? "opened" : command === "validate" ? "completed" : "updated",
|
|
230
|
+
primary
|
|
231
|
+
};
|
|
232
|
+
}
|
|
116
233
|
function currentProjectId(args, deps) {
|
|
117
234
|
const explicit = trimString(args.projectId);
|
|
118
235
|
if (explicit) return explicit;
|
|
@@ -578,11 +695,103 @@ async function handleWorkItem(command, args, deps, dryRun) {
|
|
|
578
695
|
error: `Unsupported work_item command: ${command}`
|
|
579
696
|
};
|
|
580
697
|
}
|
|
698
|
+
async function handleLocalApp(command, args, deps, dryRun) {
|
|
699
|
+
const localApps = deps.getLocalAppService?.();
|
|
700
|
+
if (!localApps) return {
|
|
701
|
+
ok: false,
|
|
702
|
+
error: "Local app service is unavailable"
|
|
703
|
+
};
|
|
704
|
+
if (command === "list") return {
|
|
705
|
+
ok: true,
|
|
706
|
+
apps: localApps.list()
|
|
707
|
+
};
|
|
708
|
+
const id = trimString(args.localAppId) ?? trimString(args.id);
|
|
709
|
+
if (command === "get") {
|
|
710
|
+
if (!id) return {
|
|
711
|
+
ok: false,
|
|
712
|
+
error: "localAppId is required"
|
|
713
|
+
};
|
|
714
|
+
const app = localApps.get(id);
|
|
715
|
+
return app ? {
|
|
716
|
+
ok: true,
|
|
717
|
+
app
|
|
718
|
+
} : {
|
|
719
|
+
ok: false,
|
|
720
|
+
error: `Local app not found: ${id}`
|
|
721
|
+
};
|
|
722
|
+
}
|
|
723
|
+
if (command === "create") {
|
|
724
|
+
const name = trimString(args.name);
|
|
725
|
+
const idea = trimString(args.idea);
|
|
726
|
+
if (!name) return {
|
|
727
|
+
ok: false,
|
|
728
|
+
error: "name is required"
|
|
729
|
+
};
|
|
730
|
+
if (!idea) return {
|
|
731
|
+
ok: false,
|
|
732
|
+
error: "idea is required"
|
|
733
|
+
};
|
|
734
|
+
const input = {
|
|
735
|
+
name,
|
|
736
|
+
idea,
|
|
737
|
+
description: trimString(args.description)
|
|
738
|
+
};
|
|
739
|
+
if (dryRun) return {
|
|
740
|
+
ok: true,
|
|
741
|
+
dryRun: true,
|
|
742
|
+
action: "create_local_app",
|
|
743
|
+
input
|
|
744
|
+
};
|
|
745
|
+
return {
|
|
746
|
+
ok: true,
|
|
747
|
+
app: localApps.create(input)
|
|
748
|
+
};
|
|
749
|
+
}
|
|
750
|
+
if (command === "validate") {
|
|
751
|
+
if (!id) return {
|
|
752
|
+
ok: false,
|
|
753
|
+
error: "localAppId is required"
|
|
754
|
+
};
|
|
755
|
+
const app = localApps.get(id);
|
|
756
|
+
if (!app) return {
|
|
757
|
+
ok: false,
|
|
758
|
+
error: `Local app not found: ${id}`
|
|
759
|
+
};
|
|
760
|
+
return {
|
|
761
|
+
ok: true,
|
|
762
|
+
app,
|
|
763
|
+
validation: localApps.validate(id)
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
return {
|
|
767
|
+
ok: false,
|
|
768
|
+
error: `Unsupported local_app command: ${command}`
|
|
769
|
+
};
|
|
770
|
+
}
|
|
771
|
+
function handleSettings(command, args) {
|
|
772
|
+
if (command !== "open") return {
|
|
773
|
+
ok: false,
|
|
774
|
+
error: `Unsupported settings command: ${command}`
|
|
775
|
+
};
|
|
776
|
+
const section = trimString(args.section) ?? "overview";
|
|
777
|
+
if (!/^[a-z0-9][a-z0-9/_-]*$/i.test(section) || section.includes("..")) return {
|
|
778
|
+
ok: false,
|
|
779
|
+
error: "Invalid settings section"
|
|
780
|
+
};
|
|
781
|
+
return {
|
|
782
|
+
ok: true,
|
|
783
|
+
settings: {
|
|
784
|
+
section,
|
|
785
|
+
title: trimString(args.title) ?? "Settings",
|
|
786
|
+
summary: trimString(args.summary)
|
|
787
|
+
}
|
|
788
|
+
};
|
|
789
|
+
}
|
|
581
790
|
function createXopcUseTool(deps) {
|
|
582
791
|
return {
|
|
583
792
|
name: "xopc_use",
|
|
584
793
|
label: "XOPC Use",
|
|
585
|
-
description: "Operate first-class xopc objects through one safe entry point. Use for projects, notes,
|
|
794
|
+
description: "Operate first-class xopc objects through one safe entry point. Use for projects, notes, project work items, local apps, and exact settings jump targets instead of editing storage files directly. For non-trivial object changes, load the built-in manual first with tool_manual({ tool: \"xopc_use\" }).",
|
|
586
795
|
parameters: XopcUseToolSchema,
|
|
587
796
|
mutatesWorkspace: true,
|
|
588
797
|
mutationScope: "external",
|
|
@@ -616,13 +825,14 @@ function createXopcUseTool(deps) {
|
|
|
616
825
|
kind: "xopc_use",
|
|
617
826
|
toolCallId
|
|
618
827
|
}
|
|
619
|
-
}, async () => mode === "project" ? await handleProject(command, args, deps, dryRun) : mode === "note" ? await handleNote(command, args, deps, dryRun) : mode === "work_item" ? await handleWorkItem(command, args, deps, dryRun) : {
|
|
828
|
+
}, async () => mode === "project" ? await handleProject(command, args, deps, dryRun) : mode === "note" ? await handleNote(command, args, deps, dryRun) : mode === "work_item" ? await handleWorkItem(command, args, deps, dryRun) : mode === "local_app" ? await handleLocalApp(command, args, deps, dryRun) : mode === "settings" ? handleSettings(command, args) : {
|
|
620
829
|
ok: false,
|
|
621
830
|
error: `Unsupported mode: ${String(mode)}`
|
|
622
831
|
});
|
|
623
832
|
return okText({
|
|
624
833
|
...details,
|
|
625
|
-
result
|
|
834
|
+
result,
|
|
835
|
+
delivery: deliveryForXopcResult(mode, command, result, dryRun)
|
|
626
836
|
});
|
|
627
837
|
} catch (err) {
|
|
628
838
|
return errorText(err instanceof Error ? err.message : String(err), details);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { init_agent_scope, normalizeAgentId, resolveAgentWorkspaceDir } from "../agent/agent-scope.js";
|
|
2
1
|
import { resolveEffectiveAgentManifest } from "../agent-manifest/resolver.js";
|
|
3
2
|
import "../agent-manifest/index.js";
|
|
3
|
+
import { init_agent_scope, normalizeAgentId, resolveAgentWorkspaceDir } from "../agent/agent-scope.js";
|
|
4
4
|
import { init_session_key, parseSessionKey } from "../routing/session-key.js";
|
|
5
5
|
import { agentExists, getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
6
6
|
//#region src/config/agent-profile.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveAgentDir, resolveAgentProfileDir, resolveAgentWorkspaceDir, resolveDefaultAgentId, resolveUserPath, validateAgentIdForNewAgent } from "../agent/agent-scope.js";
|
|
2
1
|
import { resolveEffectiveAgentManifest } from "../agent-manifest/resolver.js";
|
|
2
|
+
import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveAgentDir, resolveAgentProfileDir, resolveAgentWorkspaceDir, resolveDefaultAgentId, resolveUserPath, validateAgentIdForNewAgent } from "../agent/agent-scope.js";
|
|
3
3
|
import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
|
|
4
4
|
import { WORKSPACE_FILES, init_paths, resolveUserProfilePath } from "../config/paths.js";
|
|
5
5
|
import { AGENT_PROFILE_MARKDOWN_SYSTEM_FILES, REQUIRED_AGENT_PROFILE_MARKDOWN_FILE_SET } from "../agent/context/workspace.js";
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import type { Hono } from 'hono';
|
|
2
2
|
import type { AuthenticatedRouteDeps } from './deps.js';
|
|
3
|
+
export declare function buildEvalRuntimeIdentity(service: AuthenticatedRouteDeps['service'], agentId: string): {
|
|
4
|
+
ok: true;
|
|
5
|
+
payload: Record<string, unknown>;
|
|
6
|
+
} | {
|
|
7
|
+
ok: false;
|
|
8
|
+
error: string;
|
|
9
|
+
status: number;
|
|
10
|
+
};
|
|
3
11
|
export declare function registerStatusRoutes(authenticated: Hono, deps: AuthenticatedRouteDeps): void;
|
|
@@ -2,8 +2,62 @@ import { getDefaultModelSync, init_providers, resolveModel } from "../../../prov
|
|
|
2
2
|
import { isSTTAvailable } from "../../../voice/stt/availability.js";
|
|
3
3
|
import "../../../voice/stt/index.js";
|
|
4
4
|
import { mergeSttConfigFromAppConfig } from "../../../channels/attachments/voice-stt-webchat.js";
|
|
5
|
+
import { getGatewayAgentEffectiveManifest } from "../../agents-admin.js";
|
|
6
|
+
import { createHash } from "node:crypto";
|
|
5
7
|
//#region src/gateway/hono/routes/status.ts
|
|
6
8
|
init_providers();
|
|
9
|
+
function stableValue(value) {
|
|
10
|
+
if (Array.isArray(value)) return value.map(stableValue);
|
|
11
|
+
if (!value || typeof value !== "object") return value;
|
|
12
|
+
return Object.fromEntries(Object.entries(value).sort(([left], [right]) => left.localeCompare(right)).map(([key, child]) => [key, stableValue(child)]));
|
|
13
|
+
}
|
|
14
|
+
function contentHash(value) {
|
|
15
|
+
return createHash("sha256").update(JSON.stringify(stableValue(value))).digest("hex");
|
|
16
|
+
}
|
|
17
|
+
function asRecord(value) {
|
|
18
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
19
|
+
}
|
|
20
|
+
function buildEvalRuntimeIdentity(service, agentId) {
|
|
21
|
+
const config = service.currentConfig;
|
|
22
|
+
if (!config) return {
|
|
23
|
+
ok: false,
|
|
24
|
+
error: "Gateway configuration is unavailable",
|
|
25
|
+
status: 503
|
|
26
|
+
};
|
|
27
|
+
const effective = getGatewayAgentEffectiveManifest(config, agentId);
|
|
28
|
+
if ("error" in effective) return {
|
|
29
|
+
ok: false,
|
|
30
|
+
error: effective.error,
|
|
31
|
+
status: effective.status ?? 400
|
|
32
|
+
};
|
|
33
|
+
const manifest = asRecord(effective.data.manifest);
|
|
34
|
+
const models = asRecord(manifest.models);
|
|
35
|
+
const tools = asRecord(manifest.tools);
|
|
36
|
+
const skills = manifest.skills ?? [];
|
|
37
|
+
const codeIntelligence = config.codeIntelligence;
|
|
38
|
+
return {
|
|
39
|
+
ok: true,
|
|
40
|
+
payload: {
|
|
41
|
+
schemaVersion: 1,
|
|
42
|
+
version: service.getHealth().version,
|
|
43
|
+
buildCommit: process.env.XOPC_BUILD_COMMIT?.trim() || process.env.GITHUB_SHA?.trim() || null,
|
|
44
|
+
agentId,
|
|
45
|
+
modelRef: models.primary ?? null,
|
|
46
|
+
thinkingLevel: manifest.thinkingDefault ?? null,
|
|
47
|
+
manifestHash: contentHash(effective.data.manifest),
|
|
48
|
+
systemPromptConfigHash: contentHash(manifest.systemPrompt ?? null),
|
|
49
|
+
toolPolicyHash: contentHash(tools),
|
|
50
|
+
skillPolicyHash: contentHash(skills),
|
|
51
|
+
codeIntelligence: {
|
|
52
|
+
enabled: codeIntelligence?.enabled === true,
|
|
53
|
+
configuredForAgent: codeIntelligence?.agentIds?.includes(agentId) === true,
|
|
54
|
+
indexMode: codeIntelligence?.indexMode ?? null,
|
|
55
|
+
configHash: contentHash(codeIntelligence ?? null)
|
|
56
|
+
},
|
|
57
|
+
presetChain: effective.data.sources
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
7
61
|
function isRefineAvailable(config) {
|
|
8
62
|
if (!config) return false;
|
|
9
63
|
for (const candidate of [
|
|
@@ -53,6 +107,22 @@ function registerStatusRoutes(authenticated, deps) {
|
|
|
53
107
|
const handler = (c) => c.json(buildStatusPayload(service));
|
|
54
108
|
authenticated.get("/status", handler);
|
|
55
109
|
authenticated.get("/api/status", handler);
|
|
110
|
+
authenticated.get("/api/eval/runtime-identity", (c) => {
|
|
111
|
+
const agentId = c.req.query("agentId")?.trim();
|
|
112
|
+
if (!agentId) return c.json({
|
|
113
|
+
ok: false,
|
|
114
|
+
error: "agentId is required"
|
|
115
|
+
}, 400);
|
|
116
|
+
const result = buildEvalRuntimeIdentity(service, agentId);
|
|
117
|
+
if ("error" in result) {
|
|
118
|
+
const status = result.status === 404 ? 404 : result.status === 503 ? 503 : 400;
|
|
119
|
+
return c.json({
|
|
120
|
+
ok: false,
|
|
121
|
+
error: result.error
|
|
122
|
+
}, status);
|
|
123
|
+
}
|
|
124
|
+
return c.json(result);
|
|
125
|
+
});
|
|
56
126
|
/**
|
|
57
127
|
* POST /api/gateway/restart — respawn gateway process when supported (foreground `xopc gateway`).
|
|
58
128
|
*/
|
|
@@ -70,4 +140,4 @@ function registerStatusRoutes(authenticated, deps) {
|
|
|
70
140
|
});
|
|
71
141
|
}
|
|
72
142
|
//#endregion
|
|
73
|
-
export { registerStatusRoutes };
|
|
143
|
+
export { buildEvalRuntimeIdentity, registerStatusRoutes };
|
|
@@ -318,6 +318,7 @@ var GatewayService = class {
|
|
|
318
318
|
getNotesService: () => this.notesService,
|
|
319
319
|
getProjectService: () => this.projects,
|
|
320
320
|
getWorkItemService: () => new WorkItemService(),
|
|
321
|
+
getLocalAppService: () => this.localApps,
|
|
321
322
|
getWorkflowRunService: () => this.createWorkflowRunService(),
|
|
322
323
|
sourceContextResolver: async (binding) => {
|
|
323
324
|
if (binding.kind === "note") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xopcai/xopc",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.152",
|
|
4
4
|
"description": "Local-first AI system that remembers context, coordinates AI, and sustains long-term progress.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -103,7 +103,8 @@
|
|
|
103
103
|
"undici": "^8.5.0",
|
|
104
104
|
"uuid": "^14.0.0",
|
|
105
105
|
"ws": "^8.21.0",
|
|
106
|
-
"zod": "^4.4.3"
|
|
106
|
+
"zod": "^4.4.3",
|
|
107
|
+
"@xopcai/gateway-contract": "0.0.0"
|
|
107
108
|
},
|
|
108
109
|
"peerDependencies": {
|
|
109
110
|
"@composio/core": "0.14.0",
|
|
@@ -218,6 +219,14 @@
|
|
|
218
219
|
"test:startup:gateway": "node --import tsx scripts/bench-gateway-startup.ts",
|
|
219
220
|
"test:startup:gateway:check": "node --import tsx scripts/bench-gateway-startup.ts --runs 2 --warmup 0 --ready-budget-ms 20000",
|
|
220
221
|
"test:startup:imports": "node scripts/check-cli-bootstrap-imports.mjs",
|
|
222
|
+
"eval:coder": "tsx evals/coder/apps/cli/src/main.ts",
|
|
223
|
+
"eval:coder:check": "pnpm -C evals/coder run check",
|
|
224
|
+
"eval:coder:smoke": "pnpm -C evals/coder run smoke",
|
|
225
|
+
"eval:coder:web": "tsx evals/coder/apps/web/src/server.ts",
|
|
226
|
+
"eval:coder:xopc:prepare": "tsx evals/coder/scripts/prepare-xopc-cbm-config.ts",
|
|
227
|
+
"eval:coder:xopc:pilot-checks": "tsx evals/coder/scripts/check-xopc-cbm-hidden.ts",
|
|
228
|
+
"eval:coder:xopc:fixture-check": "tsx evals/coder/scripts/check-xopc-cbm-fixtures.ts",
|
|
229
|
+
"eval:coder:github:experiment": "tsx evals/coder/scripts/prepare-github-experiment.ts",
|
|
221
230
|
"tunnel:broker-tls:verify": "node scripts/tunnel-broker-tls-verify.mjs",
|
|
222
231
|
"release:patch": "bash scripts/release-patch.sh",
|
|
223
232
|
"growth:snapshot": "node scripts/growth-snapshot.mjs",
|