@xopcai/xopc 0.0.163 → 0.0.165
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/feishu/src/outbound/media-load.js +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-Xj95LzTv.js → activity-store-DkALQFJT.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-C-QeUFwU.js → agent-avatar-dicebear-CKVX2TyD.js} +1 -1
- package/dist/gateway/static/root/assets/agents-F8749KZ_.js +2 -0
- package/dist/gateway/static/root/assets/{api-BTLmAm1_.js → api-DPIXEcIq.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-zc6Gf-S5.js → app-management-settings-panel-ClToHdDF.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-0fMLnOWn.js → appearance-settings-Ci2jWAkQ.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-DCow0nte.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-DOiR_E21.js → archive-plugin-CKv5A1_M.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-BxmYl1D1.js → attachment-load-LgoN-Vwo.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-BhZOirad.js → automation-suggestion-card-BwnZqDQE.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-DWWHMqCZ.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-DTTKsvgk.js → binary-plugins-WwMRnBdP.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-C7se7iqg.js → block-editor-CThEfJSn.js} +47 -47
- package/dist/gateway/static/root/assets/browser-settings-page-7x8rKLOl.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-kxmStCcv.js → browser-workflow-inputs-DCj9DG0A.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-CwYf9OM_.js → browser-workflows-page-C1k2vHLV.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DIwGIpuS.js +2 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-BZKh2cWX.js → capability-presets-api-C_NVbV7o.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-DBdvIcV0.js +2 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-r7tdbnJE.js → channel-recipient-api-B5rLegwk.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-DU93p9RZ.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-DZZq0upi.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-BpnQYAxA.js → connector-logo-au5xzRMl.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-B9sD56hT.js +2 -0
- package/dist/gateway/static/root/assets/desktop-pet-CaTO9bAV.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-settings-uv8Grtgk.js → desktop-pet-settings-CORq2BIE.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-C4TTvf7p.js → directory-picker-path-field-Daf0tqrN.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-CzJAUPvM.js → dreaming-settings-CJqJpvgc.js} +3 -3
- package/dist/gateway/static/root/assets/{extension-debug-page-Ci2mOYUt.js → extension-debug-page-0XmiUqsm.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DeXdmhXQ.js → extension-page-C_9HSvyu.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-C93vaOsU.js → extension-settings-page-DcmUCmOu.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-C31Hlblp.js → gateway-config-api-CZqfsxJf.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-D3zS6RZh.js → gateway-settings-CzX8TVmO.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CSRvCqxh.js → gateway-startup-retry-ulwTJovP.js} +1 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-Dbj_sgV-.js +1 -0
- package/dist/gateway/static/root/assets/goal-detail-page-BdkiZwW-.js +4 -0
- package/dist/gateway/static/root/assets/{goals-config-api-D4wYNRrf.js → goals-config-api-Cvlq3jyf.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-BD9ztXNA.js +2 -0
- package/dist/gateway/static/root/assets/{goals-settings-Bx2jVvhQ.js → goals-settings-CSGvHJDi.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-BEIF1eXy.js → heartbeat-settings-BvXA7oNN.js} +1 -1
- package/dist/gateway/static/root/assets/{index-HZdBKfk_.js → index-CfOzvGDb.js} +70 -70
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DOEDpvTM.js → keyboard-shortcuts-settings-xb6mna1C.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-DH4nglP_.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-B0OpGpxv.js → local-apps-page-BScdXqMo.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-Ys6RP7Be.js → locale-store-C_ax27uc.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-BBpAWjyF.js +7 -0
- package/dist/gateway/static/root/assets/{markdown-split-CEZwysCH.js → markdown-split-8hnAS25m.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CpGKE7B0.js → media-plugins-DzlHseMD.js} +1 -1
- package/dist/gateway/static/root/assets/{messages-BzI9Wx30.js → messages-C96Zjb0V.js} +2 -2
- package/dist/gateway/static/root/assets/{notes-page-CdiuDZ5a.js → notes-page-DbDHFPiI.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-B-A9whbg.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-BkH5AVV2.js → page-tabs-CXJiygUJ.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-CQai8f9D.js → preview-open-alternatives-Cq6aue5a.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-B2kSdB2b.js → product-open-page-nP8vuNlJ.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-BXrscUbq.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-m0EKUeaY.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-B16uQSY5.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-NGYnO7n7.js → save-bar-controls-BPgnLY1p.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-nLOphnv3.js → schedule-field-rHWpueWl.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-D0e90ndE.js → schema-form-CHKIUrzk.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-C5_qtznc.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-DQlbm1mA.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-X2Sl-EAk.js → settings-form-section-CR4J0N4X.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-DOnUabm7.js → settings-loading-skeleton-B8v-lHKT.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-C4UUNi1n.js → settings-page-BcLf8Rd5.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-C1yYqbT6.js → settings-page-layout-Co31Becn.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BFLA1Fsj.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-Cfy_pH7V.js → share-preview-page-B5vMe8DY.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DL2tKPq6.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-C8jkuLob.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-DAOZXlp5.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-Da81RJ6G.js → system-settings-panel-CHt3FXI8.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-DflSp9o4.js → theme-store-D37XLD_C.js} +1 -1
- package/dist/gateway/static/root/assets/{time-picker-BIkOW-2L.js → time-picker-C9Rr1IUV.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib--HptwFcD.js → typed-models-lib-QMF30Yvh.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-CMHY4ZfW.js → use-channel-catalog-DBh0dOC9.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-D6EEhj-e.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-nvIZerol.js → voice-api-key-field-Gjjs3qih.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-page-CDnL9daG.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-BCoT4p1E.js +1 -0
- package/dist/gateway/static/root/assets/work-page-l8h2Y50w.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-D96MHABy.js → workflow-run-setup-panel-DnOfronD.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-IVbQ83CW.js +11 -0
- package/dist/gateway/static/root/index.html +6 -6
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +3 -3
- package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -1
- package/dist/src/agent/embedded/model-runtime.d.ts +4 -0
- package/dist/src/agent/embedded/model-runtime.js +49 -0
- package/dist/src/agent/embedded/run-turn.js +9 -2
- package/dist/src/agent/embedded/session-runner.js +3 -3
- package/dist/src/agent/goals/post-turn.js +1 -1
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/index.js +1 -1
- package/dist/src/agent/ipc/inbox.js +1 -1
- package/dist/src/agent/memory/dreaming/config.js +1 -1
- package/dist/src/agent/service.js +2 -2
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent-runtime/index.js +1 -1
- package/dist/src/agent-runtime/runtime-profile.js +1 -1
- package/dist/src/auth/credentials.js +46 -3
- package/dist/src/auth/index.js +2 -1
- package/dist/src/auth/oauth/anthropic.js +27 -24
- package/dist/src/auth/oauth/github-copilot.js +20 -15
- package/dist/src/auth/oauth/google-antigravity.js +9 -2
- package/dist/src/auth/oauth/google-gemini-cli.js +9 -2
- package/dist/src/auth/oauth/google-oauth/google-antigravity.js +47 -40
- package/dist/src/auth/oauth/google-oauth/google-gemini-cli.js +48 -41
- package/dist/src/auth/oauth/google-oauth/oauth-page.js +7 -2
- package/dist/src/auth/oauth/google-oauth/pkce.js +4 -1
- package/dist/src/auth/oauth/index.d.ts +2 -0
- package/dist/src/auth/oauth/index.js +24 -10
- package/dist/src/auth/oauth/kimi-coding.js +76 -71
- package/dist/src/auth/oauth/minimax-cn.js +78 -73
- package/dist/src/auth/oauth/minimax.js +78 -73
- package/dist/src/auth/oauth/openai-codex.js +31 -25
- package/dist/src/auth/oauth/pkce.js +4 -1
- package/dist/src/auth/oauth/registry.d.ts +13 -0
- package/dist/src/auth/oauth/registry.js +65 -0
- package/dist/src/auth/oauth/xopc-cloud.d.ts +2 -0
- package/dist/src/auth/oauth/xopc-cloud.js +101 -0
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +6 -1
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/cli/commands/channels.js +1 -1
- package/dist/src/cli/commands/connectors.js +2 -2
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +2 -2
- package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
- package/dist/src/cli/commands/models.js +2 -2
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/commands/update.js +1 -1
- package/dist/src/cli/utils/oauth-providers.d.ts +3 -26
- package/dist/src/cli/utils/oauth-providers.js +6 -80
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/index.js +4 -4
- package/dist/src/config/loader.js +1 -1
- package/dist/src/config/models-json.js +9 -1
- package/dist/src/connectors/connector-memory-sync.js +1 -1
- package/dist/src/connectors/health.js +1 -1
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/extensions/sdk/index.js +1 -1
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/oauth-async.js +3 -19
- package/dist/src/gateway/hono/oauth.js +3 -19
- package/dist/src/gateway/hono/routes/mcp.js +1 -1
- package/dist/src/gateway/hono/routes/models.js +2 -56
- package/dist/src/gateway/hono/routes/update.js +2 -2
- package/dist/src/gateway/index.js +1 -1
- package/dist/src/gateway/run-loop.js +1 -1
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/gateway/service.js +6 -6
- package/dist/src/goals/goal-workflow-judge.js +1 -1
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/infra/gateway-processes.js +1 -1
- package/dist/src/infra/update-restart.js +1 -1
- package/dist/src/infra/update-runner.js +2 -2
- package/dist/src/infra/update-startup.js +1 -1
- package/dist/src/mcp/channel-bridge.js +1 -1
- package/dist/src/notes/service.js +1 -1
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/domestic-presets.d.ts +0 -20
- package/dist/src/providers/domestic-presets.js +0 -25
- package/dist/src/providers/index.js +10 -1
- package/dist/src/providers/model-catalog-store.d.ts +20 -58
- package/dist/src/providers/model-catalog-store.js +18 -57
- package/dist/src/providers/model-catalog-sync-service.d.ts +3 -4
- package/dist/src/providers/model-catalog-sync-service.js +3 -13
- package/dist/src/providers/model-registry.js +1 -3
- package/dist/src/providers/xopc-cloud-model-source.d.ts +30 -0
- package/dist/src/providers/xopc-cloud-model-source.js +68 -0
- package/dist/src/tui/tui-startup-resources.js +2 -2
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/work-discovery/analyzer.js +27 -14
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/agents-DVKlWKJE.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-BZXEJDIV.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-B8CnkoXv.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-BCPWKI9V.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-C7lr_mX2.js +0 -2
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-Ble9kHRu.js +0 -2
- package/dist/gateway/static/root/assets/channels-settings-CtQQQHrv.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-_VirfMKW.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-BXWJSJeY.js +0 -2
- package/dist/gateway/static/root/assets/desktop-pet-B86W4a5c.js +0 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-CWp2b7__.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-Dtm29FxD.js +0 -4
- package/dist/gateway/static/root/assets/goals-page-jMzBJs6e.js +0 -2
- package/dist/gateway/static/root/assets/local-app-workbench-page-CseW9jD3.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-DVqPbth5.js +0 -7
- package/dist/gateway/static/root/assets/notes-workbench-mrc3xtpn.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-CfhPJLkH.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-BfMoKjdm.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CrDtcsZ9.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-D3DbF3dV.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BZp0O2dH.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-84iao4DZ.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-DtcwQvRG.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-L7j5Gc8Z.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-1Ps8PjsP.js +0 -2
- package/dist/gateway/static/root/assets/user-context-page-BYAAs2iW.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-J35JkJ7_.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-C4wYDYqV.js +0 -1
- package/dist/gateway/static/root/assets/work-page-DMvitV6c.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-JMN0nMbM.js +0 -11
- package/dist/src/agent/embedded/xopc-auth-storage.d.ts +0 -19
- package/dist/src/agent/embedded/xopc-auth-storage.js +0 -40
- package/dist/src/providers/xopc-cloud-connection.d.ts +0 -51
- package/dist/src/providers/xopc-cloud-connection.js +0 -196
|
@@ -1,62 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
recommendedModel: z.ZodNullable<z.ZodString>;
|
|
20
|
-
lastSuccessAt: z.ZodNumber;
|
|
21
|
-
models: z.ZodArray<z.ZodObject<{
|
|
22
|
-
id: z.ZodString;
|
|
23
|
-
name: z.ZodString;
|
|
24
|
-
availability: z.ZodEnum<{
|
|
25
|
-
available: "available";
|
|
26
|
-
unavailable: "unavailable";
|
|
27
|
-
}>;
|
|
28
|
-
maxOutputTokens: z.ZodNullable<z.ZodNumber>;
|
|
29
|
-
}, z.core.$strip>>;
|
|
30
|
-
}, z.core.$strip>;
|
|
31
|
-
declare const ModelCatalogSchema: z.ZodObject<{
|
|
32
|
-
sources: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
33
|
-
providerId: z.ZodString;
|
|
34
|
-
baseUrl: z.ZodString;
|
|
35
|
-
api: z.ZodEnum<{
|
|
36
|
-
"openai-completions": "openai-completions";
|
|
37
|
-
"openai-responses": "openai-responses";
|
|
38
|
-
}>;
|
|
39
|
-
etag: z.ZodNullable<z.ZodString>;
|
|
40
|
-
recommendedModel: z.ZodNullable<z.ZodString>;
|
|
41
|
-
lastSuccessAt: z.ZodNumber;
|
|
42
|
-
models: z.ZodArray<z.ZodObject<{
|
|
43
|
-
id: z.ZodString;
|
|
44
|
-
name: z.ZodString;
|
|
45
|
-
availability: z.ZodEnum<{
|
|
46
|
-
available: "available";
|
|
47
|
-
unavailable: "unavailable";
|
|
48
|
-
}>;
|
|
49
|
-
maxOutputTokens: z.ZodNullable<z.ZodNumber>;
|
|
50
|
-
}, z.core.$strip>>;
|
|
51
|
-
}, z.core.$strip>>;
|
|
52
|
-
}, z.core.$strip>;
|
|
53
|
-
export type CatalogModel = z.infer<typeof CatalogModelSchema>;
|
|
54
|
-
export type CatalogSource = z.infer<typeof CatalogSourceSchema>;
|
|
55
|
-
export type ModelCatalogSnapshot = z.infer<typeof ModelCatalogSchema>;
|
|
1
|
+
export interface CatalogModel {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
availability: 'available' | 'unavailable';
|
|
5
|
+
maxOutputTokens: number | null;
|
|
6
|
+
}
|
|
7
|
+
export interface CatalogSource {
|
|
8
|
+
providerId: string;
|
|
9
|
+
baseUrl: string;
|
|
10
|
+
api: 'openai-completions' | 'openai-responses';
|
|
11
|
+
etag: string | null;
|
|
12
|
+
recommendedModel: string | null;
|
|
13
|
+
lastSuccessAt: number;
|
|
14
|
+
models: CatalogModel[];
|
|
15
|
+
}
|
|
16
|
+
export interface ModelCatalogSnapshot {
|
|
17
|
+
sources: Record<string, CatalogSource>;
|
|
18
|
+
}
|
|
56
19
|
export type AvailableCatalogModel = Omit<CatalogModel, 'availability'>;
|
|
57
20
|
export declare class ModelCatalogStore {
|
|
58
|
-
private
|
|
59
|
-
constructor(path?: string);
|
|
21
|
+
private sources;
|
|
60
22
|
load(): ModelCatalogSnapshot;
|
|
61
23
|
getSource(sourceId: string): CatalogSource | undefined;
|
|
62
24
|
saveSource(sourceId: string, source: CatalogSource): void;
|
|
@@ -65,7 +27,7 @@ export declare class ModelCatalogStore {
|
|
|
65
27
|
addedCount: number;
|
|
66
28
|
unavailableCount: number;
|
|
67
29
|
};
|
|
30
|
+
private cloneSource;
|
|
68
31
|
}
|
|
69
32
|
export declare function getModelCatalogStore(): ModelCatalogStore;
|
|
70
33
|
export declare function resetModelCatalogStore(): void;
|
|
71
|
-
export {};
|
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { init_paths_state, resolveStateDir } from "../config/paths-state.js";
|
|
3
|
-
import { createLogger } from "../utils/logger/index.js";
|
|
4
|
-
import { init_logger } from "../utils/logger.js";
|
|
5
|
-
import { init_write_file_atomic, writeTextAtomicSync } from "../infra/write-file-atomic.js";
|
|
6
|
-
import { join } from "node:path";
|
|
7
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
8
|
-
import { z } from "zod";
|
|
9
2
|
//#region src/providers/model-catalog-store.ts
|
|
10
3
|
function getModelCatalogStore() {
|
|
11
4
|
globalModelCatalogStore ??= new ModelCatalogStore();
|
|
@@ -14,65 +7,27 @@ function getModelCatalogStore() {
|
|
|
14
7
|
function resetModelCatalogStore() {
|
|
15
8
|
globalModelCatalogStore = void 0;
|
|
16
9
|
}
|
|
17
|
-
var
|
|
10
|
+
var ModelCatalogStore, globalModelCatalogStore;
|
|
18
11
|
var init_model_catalog_store = __esmMin((() => {
|
|
19
|
-
init_paths_state();
|
|
20
|
-
init_write_file_atomic();
|
|
21
|
-
init_logger();
|
|
22
|
-
log = createLogger("ModelCatalogStore");
|
|
23
|
-
CatalogModelSchema = z.object({
|
|
24
|
-
id: z.string().min(1),
|
|
25
|
-
name: z.string().min(1),
|
|
26
|
-
availability: z.enum(["available", "unavailable"]),
|
|
27
|
-
maxOutputTokens: z.number().positive().nullable()
|
|
28
|
-
});
|
|
29
|
-
CatalogSourceSchema = z.object({
|
|
30
|
-
providerId: z.string().min(1),
|
|
31
|
-
baseUrl: z.string().url(),
|
|
32
|
-
api: z.enum(["openai-completions", "openai-responses"]),
|
|
33
|
-
etag: z.string().nullable(),
|
|
34
|
-
recommendedModel: z.string().nullable(),
|
|
35
|
-
lastSuccessAt: z.number().int().nonnegative(),
|
|
36
|
-
models: z.array(CatalogModelSchema)
|
|
37
|
-
});
|
|
38
|
-
ModelCatalogSchema = z.object({ sources: z.record(z.string(), CatalogSourceSchema) });
|
|
39
12
|
ModelCatalogStore = class {
|
|
40
|
-
|
|
41
|
-
this.path = path;
|
|
42
|
-
}
|
|
13
|
+
sources = {};
|
|
43
14
|
load() {
|
|
44
|
-
|
|
45
|
-
try {
|
|
46
|
-
const parsed = ModelCatalogSchema.safeParse(JSON.parse(readFileSync(this.path, "utf8")));
|
|
47
|
-
if (parsed.success) return parsed.data;
|
|
48
|
-
log.warn({
|
|
49
|
-
path: this.path,
|
|
50
|
-
errorMessage: parsed.error.message
|
|
51
|
-
}, "Ignoring invalid model catalog snapshot");
|
|
52
|
-
} catch (err) {
|
|
53
|
-
log.warn({
|
|
54
|
-
err,
|
|
55
|
-
path: this.path
|
|
56
|
-
}, "Ignoring unreadable model catalog snapshot");
|
|
57
|
-
}
|
|
58
|
-
return { sources: {} };
|
|
15
|
+
return { sources: Object.fromEntries(Object.entries(this.sources).map(([id, source]) => [id, this.cloneSource(source)])) };
|
|
59
16
|
}
|
|
60
17
|
getSource(sourceId) {
|
|
61
|
-
|
|
18
|
+
const source = this.sources[sourceId];
|
|
19
|
+
return source ? this.cloneSource(source) : void 0;
|
|
62
20
|
}
|
|
63
21
|
saveSource(sourceId, source) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
} });
|
|
69
|
-
writeTextAtomicSync(this.path, `${JSON.stringify(next, null, 2)}\n`, { mode: 384 });
|
|
22
|
+
this.sources = {
|
|
23
|
+
...this.sources,
|
|
24
|
+
[sourceId]: this.cloneSource(source)
|
|
25
|
+
};
|
|
70
26
|
}
|
|
71
27
|
removeSource(sourceId) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
writeTextAtomicSync(this.path, `${JSON.stringify({ sources }, null, 2)}\n`, { mode: 384 });
|
|
28
|
+
if (!this.sources[sourceId]) return false;
|
|
29
|
+
const { [sourceId]: _removed, ...sources } = this.sources;
|
|
30
|
+
this.sources = sources;
|
|
76
31
|
return true;
|
|
77
32
|
}
|
|
78
33
|
replaceSourceModels(sourceId, source, models) {
|
|
@@ -95,6 +50,12 @@ var init_model_catalog_store = __esmMin((() => {
|
|
|
95
50
|
unavailableCount: unavailable.length
|
|
96
51
|
};
|
|
97
52
|
}
|
|
53
|
+
cloneSource(source) {
|
|
54
|
+
return {
|
|
55
|
+
...source,
|
|
56
|
+
models: source.models.map((model) => ({ ...model }))
|
|
57
|
+
};
|
|
58
|
+
}
|
|
98
59
|
};
|
|
99
60
|
}));
|
|
100
61
|
//#endregion
|
|
@@ -2,7 +2,7 @@ import type { Config } from '../config/schema.js';
|
|
|
2
2
|
import { type ModelsJsonConfig } from '../config/models-json.js';
|
|
3
3
|
import { type ModelCatalogStore } from './model-catalog-store.js';
|
|
4
4
|
import { discoverProviderModels } from './model-discovery.js';
|
|
5
|
-
import {
|
|
5
|
+
import { XopcCloudModelSource } from './xopc-cloud-model-source.js';
|
|
6
6
|
export interface ModelCatalogSyncStatus {
|
|
7
7
|
running: boolean;
|
|
8
8
|
refreshing: boolean;
|
|
@@ -21,7 +21,7 @@ export declare class ModelCatalogSyncService {
|
|
|
21
21
|
constructor(options?: {
|
|
22
22
|
intervalMs?: number;
|
|
23
23
|
onUpdated?: (modelCount: number) => void;
|
|
24
|
-
xopcCloud?:
|
|
24
|
+
xopcCloud?: XopcCloudModelSource;
|
|
25
25
|
getConfig?: () => Config;
|
|
26
26
|
catalogStore?: ModelCatalogStore;
|
|
27
27
|
loadProviders?: () => ModelsJsonConfig['providers'];
|
|
@@ -32,8 +32,7 @@ export declare class ModelCatalogSyncService {
|
|
|
32
32
|
start(): void;
|
|
33
33
|
stop(): void;
|
|
34
34
|
getStatus(): ModelCatalogSyncStatus;
|
|
35
|
-
|
|
36
|
-
refreshNow(): Promise<Awaited<ReturnType<XopcCloudConnectionService['refreshCatalog']>>>;
|
|
35
|
+
refreshNow(): Promise<Awaited<ReturnType<XopcCloudModelSource['refresh']>>>;
|
|
37
36
|
refreshAll(): Promise<{
|
|
38
37
|
updatedSources: string[];
|
|
39
38
|
}>;
|
|
@@ -4,7 +4,7 @@ import { init_models_json, loadModelsJson } from "../config/models-json.js";
|
|
|
4
4
|
import { getModelCatalogStore, init_model_catalog_store } from "./model-catalog-store.js";
|
|
5
5
|
import { getModelRegistry, init_model_registry } from "./model-registry.js";
|
|
6
6
|
import { discoverProviderModels, isProviderApiDiscoverable } from "./model-discovery.js";
|
|
7
|
-
import {
|
|
7
|
+
import { XopcCloudModelSource } from "./xopc-cloud-model-source.js";
|
|
8
8
|
//#region src/providers/model-catalog-sync-service.ts
|
|
9
9
|
init_logger();
|
|
10
10
|
init_models_json();
|
|
@@ -23,11 +23,7 @@ var ModelCatalogSyncService = class {
|
|
|
23
23
|
};
|
|
24
24
|
constructor(options = {}) {
|
|
25
25
|
this.options = options;
|
|
26
|
-
this.xopcCloud = options.xopcCloud ?? new
|
|
27
|
-
try {
|
|
28
|
-
const lastSuccessAt = getModelCatalogStore().getSource("xopc-cloud")?.lastSuccessAt;
|
|
29
|
-
if (lastSuccessAt !== void 0) this.status.lastSuccessAt = lastSuccessAt;
|
|
30
|
-
} catch {}
|
|
26
|
+
this.xopcCloud = options.xopcCloud ?? new XopcCloudModelSource();
|
|
31
27
|
}
|
|
32
28
|
start() {
|
|
33
29
|
if (this.status.running) return;
|
|
@@ -47,21 +43,15 @@ var ModelCatalogSyncService = class {
|
|
|
47
43
|
getStatus() {
|
|
48
44
|
return { ...this.status };
|
|
49
45
|
}
|
|
50
|
-
getXopcCloudConnection() {
|
|
51
|
-
return this.xopcCloud;
|
|
52
|
-
}
|
|
53
46
|
refreshNow() {
|
|
54
47
|
if (this.refreshPromise) return this.refreshPromise;
|
|
55
48
|
this.status.refreshing = true;
|
|
56
49
|
this.status.lastAttemptAt = Date.now();
|
|
57
|
-
this.refreshPromise = this.xopcCloud.
|
|
50
|
+
this.refreshPromise = this.xopcCloud.refresh().then((result) => {
|
|
58
51
|
if (result.status === "updated") {
|
|
59
52
|
this.status.lastSuccessAt = Date.now();
|
|
60
53
|
this.status.lastError = void 0;
|
|
61
54
|
this.options.onUpdated?.(result.modelCount ?? 0);
|
|
62
|
-
} else if (result.status === "unchanged") {
|
|
63
|
-
this.status.lastSuccessAt = Date.now();
|
|
64
|
-
this.status.lastError = void 0;
|
|
65
55
|
}
|
|
66
56
|
return result;
|
|
67
57
|
}).catch((err) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { createLogger } from "../utils/logger/index.js";
|
|
3
3
|
import { init_logger } from "../utils/logger.js";
|
|
4
|
-
import { resolveModelsJsonPath } from "../config/paths.js";
|
|
5
4
|
import { init_resolve_config_value, resolveConfigValue, resolveHeaders } from "../config/resolve-config-value.js";
|
|
5
|
+
import { resolveModelsJsonPath } from "../config/paths.js";
|
|
6
6
|
import { getDefaultModelValues, init_models_json, validateModelsConfig } from "../config/models-json.js";
|
|
7
7
|
import { getApiKeyFromEnv, init_env_keys } from "./env-keys.js";
|
|
8
8
|
import { getModelCatalogStore, init_model_catalog_store } from "./model-catalog-store.js";
|
|
@@ -313,7 +313,6 @@ var init_model_registry = __esmMin((() => {
|
|
|
313
313
|
const modelOverrides = /* @__PURE__ */ new Map();
|
|
314
314
|
const apiKeyConfigs = /* @__PURE__ */ new Map();
|
|
315
315
|
for (const [providerName, providerConfig] of Object.entries(config.providers)) {
|
|
316
|
-
if (providerName === "xopc-cloud") continue;
|
|
317
316
|
if (providerConfig.baseUrl || providerConfig.headers || providerConfig.apiKey) overrides.set(providerName, {
|
|
318
317
|
baseUrl: providerConfig.baseUrl,
|
|
319
318
|
headers: providerConfig.headers,
|
|
@@ -341,7 +340,6 @@ var init_model_registry = __esmMin((() => {
|
|
|
341
340
|
const models = [];
|
|
342
341
|
const defaults = getDefaultModelValues();
|
|
343
342
|
for (const [providerName, providerConfig] of Object.entries(config.providers)) {
|
|
344
|
-
if (providerName === "xopc-cloud") continue;
|
|
345
343
|
const modelDefs = providerConfig.models ?? [];
|
|
346
344
|
if (modelDefs.length === 0) continue;
|
|
347
345
|
for (const modelDef of modelDefs) {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type CredentialResolver } from '../auth/credentials.js';
|
|
2
|
+
import { type ModelCatalogStore } from './model-catalog-store.js';
|
|
3
|
+
export type XopcCloudModelRefreshResult = {
|
|
4
|
+
status: 'skipped';
|
|
5
|
+
reason: 'not_configured';
|
|
6
|
+
} | {
|
|
7
|
+
status: 'updated';
|
|
8
|
+
modelCount: number;
|
|
9
|
+
models: string[];
|
|
10
|
+
};
|
|
11
|
+
export declare class XopcCloudModelError extends Error {
|
|
12
|
+
readonly status: number;
|
|
13
|
+
readonly code?: string;
|
|
14
|
+
constructor(message: string, status: number, code?: string);
|
|
15
|
+
}
|
|
16
|
+
export declare class XopcCloudModelSource {
|
|
17
|
+
private readonly fetchImpl;
|
|
18
|
+
private readonly routerUrl;
|
|
19
|
+
private readonly credentials;
|
|
20
|
+
private readonly catalogStore;
|
|
21
|
+
private readonly refreshModels;
|
|
22
|
+
constructor(options?: {
|
|
23
|
+
fetchImpl?: typeof fetch;
|
|
24
|
+
routerUrl?: string;
|
|
25
|
+
credentials?: Pick<CredentialResolver, 'resolveApiKey'>;
|
|
26
|
+
catalogStore?: ModelCatalogStore;
|
|
27
|
+
refreshModels?: () => void;
|
|
28
|
+
});
|
|
29
|
+
refresh(): Promise<XopcCloudModelRefreshResult>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { getModelCatalogStore, init_model_catalog_store } from "./model-catalog-store.js";
|
|
2
|
+
import { getModelRegistry, init_model_registry } from "./model-registry.js";
|
|
3
|
+
import { getCredentialResolver, init_credentials } from "../auth/credentials.js";
|
|
4
|
+
//#region src/providers/xopc-cloud-model-source.ts
|
|
5
|
+
init_credentials();
|
|
6
|
+
init_model_catalog_store();
|
|
7
|
+
init_model_registry();
|
|
8
|
+
const DEFAULT_ROUTER_URL = "https://router.xopc.ai/v1";
|
|
9
|
+
var XopcCloudModelError = class extends Error {
|
|
10
|
+
constructor(message, status, code) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.status = status;
|
|
13
|
+
this.code = code;
|
|
14
|
+
this.name = "XopcCloudModelError";
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var XopcCloudModelSource = class {
|
|
18
|
+
fetchImpl;
|
|
19
|
+
routerUrl;
|
|
20
|
+
credentials;
|
|
21
|
+
catalogStore;
|
|
22
|
+
refreshModels;
|
|
23
|
+
constructor(options = {}) {
|
|
24
|
+
this.fetchImpl = options.fetchImpl ?? fetch;
|
|
25
|
+
this.routerUrl = (options.routerUrl ?? process.env.XOPC_MODEL_ROUTER_URL ?? DEFAULT_ROUTER_URL).replace(/\/+$/, "");
|
|
26
|
+
this.credentials = options.credentials ?? getCredentialResolver();
|
|
27
|
+
this.catalogStore = options.catalogStore ?? getModelCatalogStore();
|
|
28
|
+
this.refreshModels = options.refreshModels ?? (() => getModelRegistry().refresh());
|
|
29
|
+
}
|
|
30
|
+
async refresh() {
|
|
31
|
+
const accessToken = await this.credentials.resolveApiKey("xopc-cloud");
|
|
32
|
+
if (!accessToken) return {
|
|
33
|
+
status: "skipped",
|
|
34
|
+
reason: "not_configured"
|
|
35
|
+
};
|
|
36
|
+
const response = await this.fetchImpl(`${this.routerUrl}/models`, {
|
|
37
|
+
headers: {
|
|
38
|
+
authorization: `Bearer ${accessToken}`,
|
|
39
|
+
accept: "application/json"
|
|
40
|
+
},
|
|
41
|
+
signal: AbortSignal.timeout(3e4)
|
|
42
|
+
});
|
|
43
|
+
const body = await response.json().catch(() => null);
|
|
44
|
+
if (!response.ok) throw new XopcCloudModelError(typeof body?.error?.message === "string" ? body.error.message : `XOPC model discovery failed (${response.status})`, response.status, typeof body?.error?.code === "string" ? body.error.code : void 0);
|
|
45
|
+
if (!Array.isArray(body?.data)) throw new XopcCloudModelError("XOPC model discovery returned an invalid response", response.status, "invalid_response");
|
|
46
|
+
const models = [...new Set(body.data.map((model) => model.id).filter((id) => typeof id === "string" && id.length > 0))];
|
|
47
|
+
this.catalogStore.replaceSourceModels("xopc-cloud", {
|
|
48
|
+
providerId: "xopc-cloud",
|
|
49
|
+
baseUrl: this.routerUrl,
|
|
50
|
+
api: "openai-completions",
|
|
51
|
+
etag: response.headers.get("x-xopc-model-catalog-version"),
|
|
52
|
+
recommendedModel: models[0] ?? null,
|
|
53
|
+
lastSuccessAt: Date.now()
|
|
54
|
+
}, models.map((id) => ({
|
|
55
|
+
id,
|
|
56
|
+
name: id,
|
|
57
|
+
maxOutputTokens: null
|
|
58
|
+
})));
|
|
59
|
+
this.refreshModels();
|
|
60
|
+
return {
|
|
61
|
+
status: "updated",
|
|
62
|
+
modelCount: models.length,
|
|
63
|
+
models
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
//#endregion
|
|
68
|
+
export { XopcCloudModelError, XopcCloudModelSource };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { resolveStateDir } from "../config/paths-state.js";
|
|
2
|
-
import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
|
|
3
2
|
import { init_paths, resolveAgentProfileDir, resolveBundledSkillsDir, resolveUserProfilePath } from "../config/paths.js";
|
|
3
|
+
import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
|
|
4
4
|
import { resolveBootstrapFilesSync } from "../agent/bootstrap/bootstrap-files.js";
|
|
5
5
|
import { createSkillConfigManager, isSkillEnabled } from "../agent/skills/config.js";
|
|
6
6
|
import { createWorkflowCatalog } from "../agent/workflow/catalog.js";
|
|
7
7
|
import { loadSkills } from "../agent/skills/index.js";
|
|
8
|
-
import { listConnectorInstances } from "../connectors/instances.js";
|
|
9
8
|
import { getWorkspacePath } from "../config/workspace-path-helpers.js";
|
|
10
9
|
import "../config/index.js";
|
|
10
|
+
import { listConnectorInstances } from "../connectors/instances.js";
|
|
11
11
|
import { basename } from "node:path";
|
|
12
12
|
//#region src/tui/tui-startup-resources.ts
|
|
13
13
|
init_paths();
|
package/dist/src/tui/tui.js
CHANGED
|
@@ -2,10 +2,10 @@ import { version } from "../../package.js";
|
|
|
2
2
|
import { resolveStateDir, resolveXopcDatabasePath } from "../config/paths-state.js";
|
|
3
3
|
import { parseAgentSessionKey } from "../routing/session-key-utils.js";
|
|
4
4
|
import { init_agent_session_key, normalizeAgentId } from "../routing/agent-session-key.js";
|
|
5
|
-
import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
|
|
6
5
|
import { init_paths } from "../config/paths.js";
|
|
7
6
|
import { loadConfig } from "../config/loader.js";
|
|
8
7
|
import { getAllModels, getAllProviders, getApiKey, init_providers, isProviderConfiguredSync } from "../providers/index.js";
|
|
8
|
+
import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
|
|
9
9
|
import { renderWorkflowFinalSummary, renderWorkflowPanel } from "../agent/workflow/snapshot.js";
|
|
10
10
|
import { runViewToSnapshot } from "../workflows/service/run-view-to-snapshot.js";
|
|
11
11
|
import { ProjectTrustStore, hasTrustRequiringProjectResources } from "../project-trust/trust-store.js";
|
|
@@ -7,6 +7,7 @@ init_schema();
|
|
|
7
7
|
init_providers();
|
|
8
8
|
const MAX_MODEL_CONTEXT_CHARS = 12e4;
|
|
9
9
|
const MAX_PERSONAL_CONTEXT_CHARS = 1e5;
|
|
10
|
+
const WORK_ANALYSIS_MAX_TOKENS = 6e3;
|
|
10
11
|
function extractText(content) {
|
|
11
12
|
if (typeof content === "string") return content;
|
|
12
13
|
if (!Array.isArray(content)) return "";
|
|
@@ -17,16 +18,24 @@ function extractText(content) {
|
|
|
17
18
|
}).join("");
|
|
18
19
|
}
|
|
19
20
|
function parseJson(raw) {
|
|
20
|
-
const
|
|
21
|
+
const candidates = [];
|
|
22
|
+
for (const match of raw.matchAll(/```json\s*([\s\S]*?)```/gi)) if (match[1]) candidates.push(match[1]);
|
|
23
|
+
candidates.push(raw.trim());
|
|
24
|
+
for (const match of raw.matchAll(/```(?:[^\n]*)?\s*([\s\S]*?)```/g)) if (match[1]) candidates.push(match[1]);
|
|
21
25
|
const start = raw.indexOf("{");
|
|
22
26
|
const end = raw.lastIndexOf("}");
|
|
23
|
-
|
|
24
|
-
try {
|
|
27
|
+
if (start >= 0 && end > start) candidates.push(raw.slice(start, end + 1));
|
|
28
|
+
for (const candidate of new Set(candidates)) try {
|
|
25
29
|
const value = JSON.parse(candidate);
|
|
26
|
-
|
|
27
|
-
} catch {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
if (value && typeof value === "object" && !Array.isArray(value)) return value;
|
|
31
|
+
} catch {}
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
function invalidJsonError(label, response, raw) {
|
|
35
|
+
const outputChars = raw.length;
|
|
36
|
+
if (response.stopReason === "length") return /* @__PURE__ */ new Error(`${label} response was truncated before completing valid JSON (outputChars=${outputChars})`);
|
|
37
|
+
if (response.stopReason === "error" && typeof response.errorMessage === "string") return /* @__PURE__ */ new Error(`${label} model request failed: ${response.errorMessage}`);
|
|
38
|
+
return /* @__PURE__ */ new Error(`${label} did not return valid JSON (stopReason=${String(response.stopReason)}, outputChars=${outputChars})`);
|
|
30
39
|
}
|
|
31
40
|
function strings(value, max) {
|
|
32
41
|
return Array.isArray(value) ? value.filter((item) => typeof item === "string" && item.trim().length > 0).slice(0, max).map((item) => item.trim()) : [];
|
|
@@ -152,7 +161,7 @@ async function analyzeWorkContext(input) {
|
|
|
152
161
|
};
|
|
153
162
|
const model = resolveModel(modelRef);
|
|
154
163
|
const compactSnapshot = snapshotForModel(input.snapshot);
|
|
155
|
-
const
|
|
164
|
+
const response = await completeWithResolvedCredentials(model, { messages: [{
|
|
156
165
|
role: "user",
|
|
157
166
|
content: [
|
|
158
167
|
"You help a user resume real work in one explicitly selected local folder.",
|
|
@@ -188,11 +197,13 @@ async function analyzeWorkContext(input) {
|
|
|
188
197
|
].join("\n"),
|
|
189
198
|
timestamp: Date.now()
|
|
190
199
|
}] }, {
|
|
191
|
-
maxTokens:
|
|
200
|
+
maxTokens: WORK_ANALYSIS_MAX_TOKENS,
|
|
192
201
|
temperature: .1,
|
|
193
202
|
signal: input.signal
|
|
194
|
-
})
|
|
195
|
-
|
|
203
|
+
});
|
|
204
|
+
const raw = extractText(response.content);
|
|
205
|
+
const parsed = parseJson(raw);
|
|
206
|
+
if (!parsed) throw invalidJsonError("Analysis", response, raw);
|
|
196
207
|
if (parsed.lowConfidence === true) return {
|
|
197
208
|
modelRef,
|
|
198
209
|
result: lowConfidenceResult(input.snapshot, typeof parsed.contextQuestion === "string" ? parsed.contextQuestion.trim().slice(0, 500) : void 0)
|
|
@@ -266,7 +277,7 @@ async function analyzePersonalContext(input) {
|
|
|
266
277
|
input.workContext ? `Work-directory understanding from the same one-shot investigation:\n${JSON.stringify(input.workContext)}` : "",
|
|
267
278
|
JSON.stringify(items)
|
|
268
279
|
].join("\n");
|
|
269
|
-
const
|
|
280
|
+
const response = await completeWithResolvedCredentials(resolveModel(modelRef), { messages: [{
|
|
270
281
|
role: "user",
|
|
271
282
|
content: prompt,
|
|
272
283
|
timestamp: Date.now()
|
|
@@ -274,8 +285,10 @@ async function analyzePersonalContext(input) {
|
|
|
274
285
|
maxTokens: 1500,
|
|
275
286
|
temperature: .1,
|
|
276
287
|
signal: input.signal
|
|
277
|
-
})
|
|
278
|
-
|
|
288
|
+
});
|
|
289
|
+
const raw = extractText(response.content);
|
|
290
|
+
const parsed = parseJson(raw);
|
|
291
|
+
if (!parsed) throw invalidJsonError("Personal context analysis", response, raw);
|
|
279
292
|
const profileCandidates = Array.isArray(parsed.profileCandidates) ? parsed.profileCandidates.map(validateProfileCandidate).filter((value) => Boolean(value)).slice(0, 6) : [];
|
|
280
293
|
const allowedRefs = new Set(items.map((item) => item.ref));
|
|
281
294
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { extractProfileAgentId } from "../../config/agent-profile.js";
|
|
2
1
|
import { init_providers, resolveModel } from "../../providers/index.js";
|
|
2
|
+
import { extractProfileAgentId } from "../../config/agent-profile.js";
|
|
3
3
|
import { publishAutomationProductEvent } from "../../automations/product-events.js";
|
|
4
4
|
import { GoalService } from "../../goals/goal-service.js";
|
|
5
5
|
import "../../goals/index.js";
|
package/package.json
CHANGED