@yuriai/web 0.2.27-beta.8 → 0.2.27
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/assets/{AgentAvatar-BJ42lGZD.js → AgentAvatar-DNm_jMna.js} +1 -1
- package/dist/assets/AssistantContactStatus-BPRpgMFh.js +3 -0
- package/dist/assets/{AssistantUnreadBadge-QwhBfXpC.js → AssistantUnreadBadge-BssH-RvV.js} +1 -1
- package/dist/assets/{AssistantView-D7ryIKL0.js → AssistantView-CxQv-9Ms.js} +1 -1
- package/dist/assets/{DiagramView-ERrGEBDp.js → DiagramView-DPpG0fwx.js} +1 -1
- package/dist/assets/{FadeInOnReveal-Bu2GvaM9.js → FadeInOnReveal-S6UbimjB.js} +1 -1
- package/dist/assets/{GuiPluginSurface-MzQgEZNr.js → GuiPluginSurface-BOf0JA1T.js} +1 -1
- package/dist/assets/{GuiPluginWindow-DZMmlQzx.js → GuiPluginWindow-OrYkfQ4m.js} +1 -1
- package/dist/assets/{Icon-Dj4CCqCP.js → Icon-BE4mEwzV.js} +1 -1
- package/dist/assets/{ImageLoadingPlaceholder-BnFXgUuO.js → ImageLoadingPlaceholder-CBFJC_KD.js} +1 -1
- package/dist/assets/{LoadingImage-PBnivDKv.js → LoadingImage-NLq7_P-i.js} +1 -1
- package/dist/assets/MarkdownRenderer-BaMotAOQ.js +2 -0
- package/dist/assets/{MarkdownRendererImpl-CfyXL4rg.js → MarkdownRendererImpl-Cv6UnGG7.js} +1 -1
- package/dist/assets/{MarkstreamRendererImpl-BGadklK1.js → MarkstreamRendererImpl-Rb9O6wkW.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-DqajQdB4.js → MobileDetailNavigation-CK4KbkeS.js} +1 -1
- package/dist/assets/{MobileResizableSheet-BvdUgwA3.js → MobileResizableSheet-Deidw1br.js} +1 -1
- package/dist/assets/{MobileShareBridge-3oPoYnry.js → MobileShareBridge-CO_OWEfq.js} +2 -2
- package/dist/assets/MobileTabPageHeader-DbC8L6A4.js +2 -0
- package/dist/assets/{MultiRunWindow-yhs0Ih5_.js → MultiRunWindow-DtVW9NTV.js} +1 -1
- package/dist/assets/{OnboardingScreen-Bi1VWFQC.js → OnboardingScreen-C8ld4wO7.js} +1 -1
- package/dist/assets/{OverlayScrollbar-BBDwGvGO.js → OverlayScrollbar-B3auC2WH.js} +1 -1
- package/dist/assets/{SettingsView-BSf-SJUA.js → SettingsView-Cm7woZWl.js} +14 -14
- package/dist/assets/{SettingsWindow-BvSXVMTm.js → SettingsWindow-CdL4PFxW.js} +1 -1
- package/dist/assets/{TerminalView-DhL01N7e.js → TerminalView-CwRB6Yyr.js} +1 -1
- package/dist/assets/{ToolOutputDialog-C8lnH4Ky.js → ToolOutputDialog-B4BfmoVH.js} +1 -1
- package/dist/assets/{YuriLogo-D8asj1CS.js → YuriLogo-BOx0s0Ue.js} +1 -1
- package/dist/assets/{appThemeRegistry-C-maYSdv.js → appThemeRegistry-B6woJIX5.js} +1 -1
- package/dist/assets/{button-vXOdzd8x.js → button-BXxwtxsG.js} +1 -1
- package/dist/assets/{capgoAdapter-DJ_h2x5D.js → capgoAdapter-C5HFS-rx.js} +1 -1
- package/dist/assets/{collapsible-DwDQs3Wa.js → collapsible-BEm0787p.js} +1 -1
- package/dist/assets/{context-menu-BabBujQ-.js → context-menu-DUwvVUDY.js} +1 -1
- package/dist/assets/device-BcRP6Tjd.js +2 -0
- package/dist/assets/{diagram-HwgrQxY5.js → diagram-DyY8dxjZ.js} +1 -1
- package/dist/assets/{dialog-Dnf626tb.js → dialog-CLca6ojn.js} +1 -1
- package/dist/assets/{dropdown-menu.styles-CBc_a-Nv.js → dropdown-menu.styles-DGaALKP0.js} +1 -1
- package/dist/assets/{es-BQkO-Odr.js → es-CrsHvgue.js} +2 -2
- package/dist/assets/fileMentionAutocompleteState-BZJqfgae.js +2 -0
- package/dist/assets/{fileMentionTouchSelection-CKPnEetl.js → fileMentionTouchSelection-C4dvP8GY.js} +2 -2
- package/dist/assets/{fileReferenceActions-g7KZLi_G.js → fileReferenceActions-CrIAce3K.js} +1 -1
- package/dist/assets/{fr-C852roK5.js → fr-CEgiRlfa.js} +2 -2
- package/dist/assets/{gitApi-CVq5oKCd.js → gitApi-D2G9ny2O.js} +1 -1
- package/dist/assets/{gitApiHttp-BYOIbYIh.js → gitApiHttp-B7vYwgBh.js} +4 -4
- package/dist/assets/{gui-M_Rbwkyu.js → gui-CJjEj3l4.js} +1 -1
- package/dist/assets/host-CnVx34Dh.js +1 -0
- package/dist/assets/{input-BtM712b1.js → input-D59Q2pm8.js} +1 -1
- package/dist/assets/insertionBoundaries-CedfTSM5.js +1 -0
- package/dist/assets/{ja-BqC39qK6.js → ja-CX-_p9jZ.js} +2 -2
- package/dist/assets/{ko-BMaChAWh.js → ko-D5xlLYJM.js} +2 -2
- package/dist/assets/main-CxpUooVS.js +2 -0
- package/dist/assets/{main-Mey7bCWf.js → main-Dpm4KxWX.js} +12 -12
- package/dist/assets/{markdownHeightCache-Bf8iisO4.js → markdownHeightCache-D2VWb_4E.js} +1 -1
- package/dist/assets/{mcpQueries-DpXqegX5.js → mcpQueries-DQ3KthDF.js} +1 -1
- package/dist/assets/miniChat-CTdj8Ug9.js +2 -0
- package/dist/assets/mobile-ChbA3Q8j.js +2 -0
- package/dist/assets/{mobileBackNavigation-DZcI7aZg.js → mobileBackNavigation-BJqt3oHk.js} +1 -1
- package/dist/assets/{multirun-hzspPepd.js → multirun-BILeETbd.js} +1 -1
- package/dist/assets/{native-H7K64Ulc.js → native-BYMhr-xH.js} +1 -1
- package/dist/assets/{native-config-CddZtLQ1.js → native-config-BIY0Cr-l.js} +1 -1
- package/dist/assets/{persistence-BT8045Ue.js → persistence-CWuLIq1J.js} +2 -2
- package/dist/assets/{pl-Ubs8p28T.js → pl-BjH81A_q.js} +2 -2
- package/dist/assets/{projectMeta-CEf0QPmD.js → projectMeta-B9_Uh8YH.js} +1 -1
- package/dist/assets/{pt-BR-8rAOjJrs.js → pt-BR-Dp5oK2x3.js} +2 -2
- package/dist/assets/queue-abort-optimistic-CS5jTJq-.js +1 -0
- package/dist/assets/{readiness-Dyr7314z.js → readiness-BNIgH81X.js} +1 -1
- package/dist/assets/renderElectronMiniChatApp-asOqV7FB.js +2 -0
- package/dist/assets/renderMobileApp-DAfque7-.js +28 -0
- package/dist/assets/{runtimeConfig-B8VHHNxj.js → runtimeConfig-BX8JirIc.js} +1 -1
- package/dist/assets/runtimeEndpointReset-CFQgUiUr.js +149 -0
- package/dist/assets/{scheduledTaskNavigation-Zm87Nydi.js → scheduledTaskNavigation-EomDNVu2.js} +1 -1
- package/dist/assets/sessionLookup-BxAaxPOw.js +1 -0
- package/dist/assets/{sortable-tabs-strip-D4pVoodN.js → sortable-tabs-strip-DpbW5MqX.js} +1 -1
- package/dist/assets/{speechSettingsQueries-RlCLMBtr.js → speechSettingsQueries-CC0fusUo.js} +2 -2
- package/dist/assets/src-BMKjN2ip.css +2 -0
- package/dist/assets/{store-ME7oHni1.js → store-CkIHVrmT.js} +4 -3
- package/dist/assets/{terminalApi-BSaclMDJ.js → terminalApi-rl9mZAlB.js} +1 -1
- package/dist/assets/{textarea-B98rsLs7.js → textarea-7eTptEtD.js} +1 -1
- package/dist/assets/{tooltip-B9810jbK.js → tooltip-BPwoSTzO.js} +1 -1
- package/dist/assets/types-CUtSV1V8.js +2 -0
- package/dist/assets/{uk-LzwzUApL.js → uk-BEfkaLtM.js} +2 -2
- package/dist/assets/{useAppFontEffects-D2C1sBYM.js → useAppFontEffects-Ck2PdQRx.js} +37 -37
- package/dist/assets/{useAssistantUIStore-TUN_ycy5.js → useAssistantUIStore-CfaQV3ID.js} +1 -1
- package/dist/assets/useDesktopWindowControlsLayout-DxxOUZj1.js +1 -0
- package/dist/assets/useEffectiveDirectory-CNCQfN_x.js +1 -0
- package/dist/assets/{useFontPreferences-BlhlCJCX.js → useFontPreferences-DeqW9nRx.js} +1 -1
- package/dist/assets/useMobileNavigationStore-BmVr5a5c.js +17 -0
- package/dist/assets/{useUIStore-DRx6OgCp.js → useUIStore-C6CE42oh.js} +1 -1
- package/dist/assets/{useWorkerHighlightedLines-D093jNsH.js → useWorkerHighlightedLines-CN_RGaSw.js} +1 -1
- package/dist/assets/{vendor-effect-DV9F8PTZ.js → vendor-effect-X1Hqc7ba.js} +13 -13
- package/dist/assets/vendor-opencode-client-cQ47ywrT.js +23 -0
- package/dist/assets/{vendor-opencode-plugin-BBOP6WNx.js → vendor-opencode-plugin-BmdTE4Te.js} +1 -1
- package/dist/assets/vendor-opencode-schema-DWT45VBX.js +1 -0
- package/dist/assets/vendor-solid-js-D98iXT7C.js +1 -0
- package/dist/assets/vendor-zod-DZzbCm1s.js +55 -0
- package/dist/assets/{zh-CN-D-FVCeks.js → zh-CN-DipfA56P.js} +2 -2
- package/dist/assets/{zh-TW-B9iH_NXL.js → zh-TW-B7pXMVjt.js} +2 -2
- package/dist/index.html +12 -12
- package/dist/mini-chat.html +12 -12
- package/dist/mobile.html +12 -12
- package/package.json +1 -1
- package/server/index.js +2 -145
- package/server/lib/assistants/DOCUMENTATION.md +56 -10
- package/server/lib/assistants/cards.js +1 -1
- package/server/lib/assistants/channel-image.js +92 -0
- package/server/lib/assistants/channel-image.test.js +76 -0
- package/server/lib/assistants/channel-output-store.test.js +41 -0
- package/server/lib/assistants/channel-output.integration.test.js +114 -0
- package/server/lib/assistants/channel-output.js +90 -0
- package/server/lib/assistants/channel-output.test.js +79 -0
- package/server/lib/assistants/channels/DOCUMENTATION.md +52 -14
- package/server/lib/assistants/channels/PROTOCOLS.md +23 -1
- package/server/lib/assistants/channels/dingtalk-chat-adapter.js +19 -7
- package/server/lib/assistants/channels/dingtalk-chat-adapter.test.js +8 -0
- package/server/lib/assistants/channels/routes.js +12 -0
- package/server/lib/assistants/channels/routes.test.js +34 -0
- package/server/lib/assistants/channels/runtime.js +117 -26
- package/server/lib/assistants/channels/runtime.test.js +179 -5
- package/server/lib/assistants/channels/sdk-adapters.js +15 -3
- package/server/lib/assistants/channels/sdk-adapters.test.js +17 -0
- package/server/lib/assistants/channels/store.js +9 -6
- package/server/lib/assistants/channels/store.test.js +21 -11
- package/server/lib/assistants/channels/transport.js +2 -1
- package/server/lib/assistants/channels/wecom-chat-adapter.js +16 -2
- package/server/lib/assistants/channels/wecom-chat-adapter.test.js +21 -0
- package/server/lib/assistants/contact-store.js +9 -3
- package/server/lib/assistants/contact-store.test.js +27 -0
- package/server/lib/assistants/contact-tools.js +65 -75
- package/server/lib/assistants/contact-tools.test.js +114 -22
- package/server/lib/assistants/harness.js +79 -34
- package/server/lib/assistants/harness.test.js +52 -20
- package/server/lib/assistants/resource-reference.integration.test.js +284 -0
- package/server/lib/assistants/routes.js +0 -3
- package/server/lib/assistants/service.js +116 -69
- package/server/lib/assistants/service.test.js +31 -17
- package/server/lib/assistants/weixin/DOCUMENTATION.md +34 -9
- package/server/lib/assistants/weixin/api.js +43 -1
- package/server/lib/assistants/weixin/api.test.js +28 -0
- package/server/lib/assistants/weixin/chat-adapter.js +8 -2
- package/server/lib/assistants/weixin/inbound.js +5 -3
- package/server/lib/assistants/weixin/inbound.test.js +20 -0
- package/server/lib/assistants/weixin/runtime.js +27 -18
- package/server/lib/assistants/weixin/runtime.test.js +36 -0
- package/server/lib/assistants/weixin/store.js +8 -4
- package/server/lib/assistants/weixin/store.test.js +21 -0
- package/server/lib/assistants/yuri-project.http.test.js +9 -3
- package/server/lib/notifications/DOCUMENTATION.md +6 -0
- package/server/lib/notifications/runtime.js +26 -15
- package/server/lib/notifications/runtime.test.js +14 -13
- package/server/lib/opencode/DOCUMENTATION.md +9 -0
- package/server/lib/opencode/auth.d.ts +6 -2
- package/server/lib/opencode/core-routes.js +0 -1
- package/server/lib/opencode/feature-routes-runtime.js +0 -24
- package/server/lib/opencode/location-release.d.ts +5 -1
- package/server/lib/opencode/managed-capabilities/scheduled-task.js +1 -1
- package/server/lib/opencode/managed-capabilities-runtime.test.js +1 -1
- package/server/lib/opencode/native-goal.js +15 -0
- package/server/lib/opencode/native-goal.test.js +17 -0
- package/server/lib/opencode/settings-helpers.js +0 -6
- package/server/lib/opencode/shutdown-runtime.js +0 -2
- package/server/lib/projects/project-config.js +3 -6
- package/server/lib/scheduled-tasks/DOCUMENTATION.md +10 -35
- package/server/lib/scheduled-tasks/managed-tool-route.js +1 -30
- package/server/lib/scheduled-tasks/routes.js +0 -26
- package/server/lib/scheduled-tasks/runtime.js +33 -257
- package/server/lib/scheduled-tasks/runtime.test.js +24 -65
- package/server/lib/session-metadata/DOCUMENTATION.md +9 -12
- package/server/lib/session-metadata/routes.js +4 -38
- package/server/lib/session-metadata/routes.test.js +2 -2
- package/dist/assets/AssistantContactStatus-dtkObamV.js +0 -3
- package/dist/assets/MarkdownRenderer-BajF4gUU.js +0 -2
- package/dist/assets/MobileTabPageHeader-B6cRyIRH.js +0 -2
- package/dist/assets/device-BjRYYXNT.js +0 -2
- package/dist/assets/host-BW3FEJdU.js +0 -1
- package/dist/assets/insertionBoundaries-Dx3WAY6i.js +0 -1
- package/dist/assets/main-9uP2z1qT.js +0 -2
- package/dist/assets/miniChat-DqZvVkme.js +0 -2
- package/dist/assets/mobile-DXAWjYcN.js +0 -2
- package/dist/assets/renderElectronMiniChatApp-DoOq8Cuo.js +0 -2
- package/dist/assets/renderMobileApp-TTxtOb8b.js +0 -28
- package/dist/assets/runtimeEndpointReset-BC6XWntz.js +0 -149
- package/dist/assets/sessionLookup-De53jDwM.js +0 -1
- package/dist/assets/src-lE4uqaHS.css +0 -2
- package/dist/assets/types-DFf9vd1b.js +0 -2
- package/dist/assets/useDesktopWindowControlsLayout-BjKaHN0x.js +0 -1
- package/dist/assets/useEffectiveDirectory-TEvyiQSC.js +0 -1
- package/dist/assets/useMobileNavigationStore-DTvJV9s-.js +0 -23
- package/dist/assets/vendor-opencode-client-ZeOZ4Efz.js +0 -23
- package/dist/assets/vendor-solid-js-9wmPZH9g.js +0 -1
- package/dist/assets/vendor-zod-Dzk5kdUU.js +0 -39
- package/server/lib/session-goal/DOCUMENTATION.md +0 -371
- package/server/lib/session-goal/capability.js +0 -57
- package/server/lib/session-goal/capability.test.js +0 -33
- package/server/lib/session-goal/objectives.js +0 -61
- package/server/lib/session-goal/routes.js +0 -274
- package/server/lib/session-goal/routes.test.js +0 -211
- package/server/lib/session-goal/runtime.js +0 -2452
- package/server/lib/session-goal/runtime.test.js +0 -2125
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { registerFsRoutes } from '../fs/routes.js';
|
|
2
2
|
import { registerQuotaRoutes } from '../quota/routes.js';
|
|
3
3
|
import { registerSmallModelRoutes } from '../small-model/routes.js';
|
|
4
|
-
import { registerSessionGoalRoutes } from '../session-goal/routes.js';
|
|
5
4
|
import { registerSessionMetadataRoutes } from '../session-metadata/routes.js';
|
|
6
5
|
import { registerGitHubRoutes } from '../github/routes.js';
|
|
7
6
|
import { registerGitRoutes } from '../git/routes.js';
|
|
@@ -153,7 +152,6 @@ export const createFeatureRoutesRuntime = (dependencies) => {
|
|
|
153
152
|
sessionMetadataStore = null,
|
|
154
153
|
sessionArchiveService = null,
|
|
155
154
|
onSessionMetadataWritten = null,
|
|
156
|
-
persistSessionGoal = null,
|
|
157
155
|
persistSessionMetadata = null,
|
|
158
156
|
onSystemSessionPersisted = null,
|
|
159
157
|
readSessionMetadata = null,
|
|
@@ -456,28 +454,6 @@ export const createFeatureRoutesRuntime = (dependencies) => {
|
|
|
456
454
|
throw new Error('Small model service is not configured');
|
|
457
455
|
});
|
|
458
456
|
registerSmallModelRoutes(app, { getSmallModelService });
|
|
459
|
-
registerSessionGoalRoutes(app, {
|
|
460
|
-
// Reuse the index-provided store seam — do not invent a second store.
|
|
461
|
-
persistSessionGoal: typeof persistSessionGoal === 'function'
|
|
462
|
-
? persistSessionGoal
|
|
463
|
-
: (sessionMetadataStore
|
|
464
|
-
? async (sessionId, _directory, goal) => {
|
|
465
|
-
const metadata = await sessionMetadataStore.setSessionMetadata(sessionId, {
|
|
466
|
-
yuri: { goal },
|
|
467
|
-
});
|
|
468
|
-
return metadata;
|
|
469
|
-
}
|
|
470
|
-
: null),
|
|
471
|
-
readSessionMetadata: typeof readSessionMetadata === 'function'
|
|
472
|
-
? readSessionMetadata
|
|
473
|
-
: (sessionMetadataStore
|
|
474
|
-
? (sessionId) => sessionMetadataStore.get(sessionId)
|
|
475
|
-
: null),
|
|
476
|
-
// Same arm path as PUT /api/yuri/sessions/:id/metadata.
|
|
477
|
-
onGoalPersisted: typeof onSessionMetadataWritten === 'function'
|
|
478
|
-
? onSessionMetadataWritten
|
|
479
|
-
: null,
|
|
480
|
-
});
|
|
481
457
|
if (sessionMetadataStore) {
|
|
482
458
|
registerSessionMetadataRoutes(app, {
|
|
483
459
|
sessionMetadataStore,
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import type { OpenCodeClient } from '@opencode/client';
|
|
2
2
|
|
|
3
|
+
type LocationReleaseClient = {
|
|
4
|
+
debug: { location: Pick<OpenCodeClient['debug']['location'], 'evict'> };
|
|
5
|
+
};
|
|
6
|
+
|
|
3
7
|
export type LocationReleaseResult = { state: 'released' | 'timeout' | 'failed' | 'unavailable' };
|
|
4
8
|
export function releaseDeletedWorktreeLocation(input: {
|
|
5
|
-
getClient: () =>
|
|
9
|
+
getClient: () => LocationReleaseClient | null;
|
|
6
10
|
directory: string;
|
|
7
11
|
timeoutMs?: number;
|
|
8
12
|
}): Promise<LocationReleaseResult>;
|
|
@@ -32,7 +32,7 @@ export default async function scheduledTaskPlugin() {
|
|
|
32
32
|
description: 'Scheduled prompt and execution settings. providerID and modelID default to the current session model.',
|
|
33
33
|
additionalProperties: false,
|
|
34
34
|
properties: {
|
|
35
|
-
prompt: { type: 'string' }, providerID: { type: 'string' }, modelID: { type: 'string' }, agent: { type: 'string' }, variant: { type: 'string' }, goalEnabled: { type: 'boolean' },
|
|
35
|
+
prompt: { type: 'string' }, providerID: { type: 'string' }, modelID: { type: 'string' }, agent: { type: 'string' }, variant: { type: 'string' }, goalEnabled: { type: 'boolean' },
|
|
36
36
|
},
|
|
37
37
|
},
|
|
38
38
|
},
|
|
@@ -88,7 +88,7 @@ describe('scheduled_task plugin', () => {
|
|
|
88
88
|
expect(runSchema.required).toEqual(['operation', 'taskId']);
|
|
89
89
|
expect(plugin.tool.scheduled_task.args.request.properties.schedule.properties).toEqual(expect.objectContaining({ kind: expect.any(Object), time: expect.any(Object), times: expect.any(Object), weekdays: expect.any(Object), date: expect.any(Object), cron: expect.any(Object), timezone: expect.any(Object) }));
|
|
90
90
|
expect(plugin.tool.scheduled_task.args.request.properties.schedule.properties.at).toBeUndefined();
|
|
91
|
-
expect(plugin.tool.scheduled_task.args.request.properties.execution).toMatchObject({ additionalProperties: false, properties: expect.objectContaining({ prompt: expect.any(Object), providerID: expect.any(Object), modelID: expect.any(Object), agent: expect.any(Object), variant: expect.any(Object), goalEnabled: expect.any(Object)
|
|
91
|
+
expect(plugin.tool.scheduled_task.args.request.properties.execution).toMatchObject({ additionalProperties: false, properties: expect.objectContaining({ prompt: expect.any(Object), providerID: expect.any(Object), modelID: expect.any(Object), agent: expect.any(Object), variant: expect.any(Object), goalEnabled: expect.any(Object) }) });
|
|
92
92
|
const defaultConfig = {};
|
|
93
93
|
await plugin.config(defaultConfig);
|
|
94
94
|
expect(defaultConfig.permission).toEqual({ scheduled_task: 'ask' });
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Goal } from '@opencode/schema/goal';
|
|
2
|
+
import { Schema } from 'effect';
|
|
3
|
+
|
|
4
|
+
const decodeGoal = Schema.decodeUnknownSync(Schema.NullOr(Goal.State));
|
|
5
|
+
|
|
6
|
+
export async function getNativeSessionGoal(client, sessionID, directory, signal) {
|
|
7
|
+
try {
|
|
8
|
+
const goal = await client.rpc(Goal.Definition).get({ sessionID }, { ...(directory ? { location: { directory } } : {}), ...(signal ? { signal } : {}) });
|
|
9
|
+
return decodeGoal(goal);
|
|
10
|
+
} catch (error) {
|
|
11
|
+
// A server without this plugin cannot own a goal. Transport/auth failures remain unknown.
|
|
12
|
+
if (error?.type === 'rpc.unavailable' || error?.type === 'rpc.method_not_found') return null;
|
|
13
|
+
throw error;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { OpenCode } from '@opencode/client';
|
|
2
|
+
import { expect, test } from 'vitest';
|
|
3
|
+
import { getNativeSessionGoal } from './native-goal.js';
|
|
4
|
+
|
|
5
|
+
test('native goal adapter uses the official RPC envelope and scoped request, with no Host state', async () => {
|
|
6
|
+
const requests = [];
|
|
7
|
+
const goal = { id: 'g', objective: 'ship', status: 'complete', rounds: 2, maxRounds: 50, boot: 'boot', updatedAt: 1 };
|
|
8
|
+
const client = OpenCode.make({ baseUrl: 'http://native.test', fetch: async (input, init) => {
|
|
9
|
+
const request = new Request(input, init);
|
|
10
|
+
requests.push({ url: request.url, body: await request.json() });
|
|
11
|
+
return Response.json({ output: goal });
|
|
12
|
+
} });
|
|
13
|
+
expect(await getNativeSessionGoal(client, 'ses_a', '/repo', new AbortController().signal)).toEqual(goal);
|
|
14
|
+
expect(requests).toHaveLength(1);
|
|
15
|
+
expect(new URL(requests[0].url).pathname).toBe('/api/rpc/opencode.goal/get');
|
|
16
|
+
expect(requests[0].body).toMatchObject({ input: { sessionID: 'ses_a' } });
|
|
17
|
+
});
|
|
@@ -330,12 +330,6 @@ export const createSettingsHelpers = (dependencies) => {
|
|
|
330
330
|
if (typeof candidate.questionAutoDelegateEnabled === 'boolean') {
|
|
331
331
|
result.questionAutoDelegateEnabled = candidate.questionAutoDelegateEnabled;
|
|
332
332
|
}
|
|
333
|
-
if (typeof candidate.sessionGoalDefaultBudgetEnabled === 'boolean') {
|
|
334
|
-
result.sessionGoalDefaultBudgetEnabled = candidate.sessionGoalDefaultBudgetEnabled;
|
|
335
|
-
}
|
|
336
|
-
if (typeof candidate.sessionGoalDefaultBudget === 'number' && Number.isFinite(candidate.sessionGoalDefaultBudget) && candidate.sessionGoalDefaultBudget > 0) {
|
|
337
|
-
result.sessionGoalDefaultBudget = Math.floor(candidate.sessionGoalDefaultBudget);
|
|
338
|
-
}
|
|
339
333
|
if (typeof candidate.collapsibleThinkingBlocks === 'boolean') {
|
|
340
334
|
result.collapsibleThinkingBlocks = candidate.collapsibleThinkingBlocks;
|
|
341
335
|
}
|
|
@@ -11,7 +11,6 @@ export const createGracefulShutdownRuntime = (dependencies) => {
|
|
|
11
11
|
openCodeWatcherRuntime,
|
|
12
12
|
sessionRuntime,
|
|
13
13
|
sessionTitleRuntime,
|
|
14
|
-
sessionGoalRuntime,
|
|
15
14
|
questionAutoDelegateRuntime,
|
|
16
15
|
scheduledTasksRuntime,
|
|
17
16
|
getHealthCheckInterval,
|
|
@@ -45,7 +44,6 @@ export const createGracefulShutdownRuntime = (dependencies) => {
|
|
|
45
44
|
openCodeWatcherRuntime.stop();
|
|
46
45
|
sessionRuntime.dispose();
|
|
47
46
|
sessionTitleRuntime?.stop?.();
|
|
48
|
-
sessionGoalRuntime?.stop?.();
|
|
49
47
|
questionAutoDelegateRuntime?.dispose?.();
|
|
50
48
|
// Stop timers/queue only. Keep the process-lifetime run history store open so
|
|
51
49
|
// in-flight attach/finalize can still write, and so exitProcess:false restarts
|
|
@@ -282,15 +282,13 @@ const normalizeExecution = (value) => {
|
|
|
282
282
|
const variant = asNonEmptyString(value.variant);
|
|
283
283
|
const agent = asNonEmptyString(value.agent);
|
|
284
284
|
const goalEnabled = value.goalEnabled === true;
|
|
285
|
-
const goalTokenBudget = typeof value.goalTokenBudget === 'number'
|
|
286
|
-
&& Number.isFinite(value.goalTokenBudget)
|
|
287
|
-
&& value.goalTokenBudget > 0
|
|
288
|
-
? Math.floor(value.goalTokenBudget)
|
|
289
|
-
: undefined;
|
|
290
285
|
|
|
291
286
|
if (!prompt) {
|
|
292
287
|
throw new Error('execution.prompt is required');
|
|
293
288
|
}
|
|
289
|
+
if (goalEnabled && (prompt.length > 4000 || ['pause', 'resume', 'clear'].includes(prompt.toLowerCase()))) {
|
|
290
|
+
throw new Error('execution.prompt is invalid for a native goal (1–4000 characters, not pause/resume/clear)');
|
|
291
|
+
}
|
|
294
292
|
if (!providerID) {
|
|
295
293
|
throw new Error('execution.providerID is required');
|
|
296
294
|
}
|
|
@@ -305,7 +303,6 @@ const normalizeExecution = (value) => {
|
|
|
305
303
|
...(variant ? { variant } : {}),
|
|
306
304
|
...(agent ? { agent } : {}),
|
|
307
305
|
...(goalEnabled ? { goalEnabled: true } : {}),
|
|
308
|
-
...(goalEnabled && goalTokenBudget ? { goalTokenBudget } : {}),
|
|
309
306
|
};
|
|
310
307
|
};
|
|
311
308
|
|
|
@@ -329,17 +329,10 @@ Every actual run (timer or manual):
|
|
|
329
329
|
- metadata: `yuri.scheduledTask = { projectID, taskID, runID, name }`
|
|
330
330
|
- SDK/HTTP calls receive `{ signal }` as the second request-options argument
|
|
331
331
|
(`client.session.create(params, { signal })`, same for `prompt` /
|
|
332
|
-
`command` / `command.list
|
|
333
|
-
pass `signal` in `RequestInit`).
|
|
332
|
+
`command` / `command.list` and native goal RPC reads).
|
|
334
333
|
5. `attachSession(runID, sessionID)` immediately after create.
|
|
335
334
|
- If attach fails, the runtime fails the run without prompting.
|
|
336
|
-
6. When `goalEnabled
|
|
337
|
-
`persistSessionGoal` is not injected; otherwise write objective file,
|
|
338
|
-
persist an active goal into the Host session-metadata store, optionally
|
|
339
|
-
notify `onGoalPersisted` to arm the goal loop, then command or
|
|
340
|
-
`session.prompt`. Non-cancellable async gaps (small-model distill,
|
|
341
|
-
objective file write) check `signal.throwIfAborted()` before continuing so
|
|
342
|
-
a timed-out run never prompts.
|
|
335
|
+
6. When `goalEnabled`, validate the native objective (1–4000 characters, not a control word), then execute `session.command({ sessionID, name: 'goal', text: prompt })`. No objective file, Host goal metadata, small-model distillation or extra prompt is written. OpenCode owns kickoff, auditing and continuation.
|
|
343
336
|
**Admission is not completion:** `session.prompt` / command return when the
|
|
344
337
|
turn is accepted, not when the agent finishes.
|
|
345
338
|
7. Wait for the real session outcome (bounded by the same watchdog):
|
|
@@ -379,9 +372,9 @@ Every actual run (timer or manual):
|
|
|
379
372
|
deleted sessions. Transport failures never match.
|
|
380
373
|
- Assistant `error` (and terminal finish `error` / `length` /
|
|
381
374
|
`content-filter`) finalizes as `error`.
|
|
382
|
-
- Goal-enabled runs:
|
|
383
|
-
|
|
384
|
-
|
|
375
|
+
- Goal-enabled runs: read native `opencode.goal` state. Only `complete`
|
|
376
|
+
succeeds; `paused` fails with its native reason. Failed or absent reads
|
|
377
|
+
stay unknown, never first-turn success.
|
|
385
378
|
- `durationMs` / `finishedAt` are wall-clock from run start through this
|
|
386
379
|
settlement — not the prompt admission latency.
|
|
387
380
|
8. On watchdog timeout after a session exists: immediately throw the canonical
|
|
@@ -476,24 +469,9 @@ is already `success`, or if the snapshot is still error/busy/unknown
|
|
|
476
469
|
(`session.active` failure and goal-unsupported goal tasks stay unknown).
|
|
477
470
|
Observer failures are logged and must not throw out of the event bus.
|
|
478
471
|
|
|
479
|
-
## Goal
|
|
472
|
+
## Native Goal execution
|
|
480
473
|
|
|
481
|
-
|
|
482
|
-
`packages/web/server/lib/session-goal/capability.js` as `{ supported: true }`.
|
|
483
|
-
Goal records live in the Yuri session-metadata store (same seam as
|
|
484
|
-
manual UI / `session-goal` runtime). Scheduled runs inject
|
|
485
|
-
`persistSessionGoal`, `readSessionMetadata`, and optional `onGoalPersisted`
|
|
486
|
-
from `server/index.js`.
|
|
487
|
-
|
|
488
|
-
| Path | Behavior |
|
|
489
|
-
|---|---|
|
|
490
|
-
| `PUT` scheduled task / managed-tool create·update with `execution.goalEnabled` | Allowed when capability supported |
|
|
491
|
-
| Existing `goalEnabled` task due or manual run | Requires `persistSessionGoal`; without it fail **before** OpenCode ready / session create / objective write / prompt; with it write objective + active goal then prompt |
|
|
492
|
-
| Ordinary non-goal task | Unchanged |
|
|
493
|
-
| Post-run observer on a goal-enabled task | Prefer Host store goal terminal status; never invent success from assistant-tail idle alone when goal is active |
|
|
494
|
-
|
|
495
|
-
Do not treat objective-file hints or first-turn assistant idle as a registered
|
|
496
|
-
goal success without a store-backed goal record.
|
|
474
|
+
Goal runs use OpenCode's `goal` command and `client.rpc(Goal.Definition).get` via `opencode/native-goal.js`. Once live execution is inactive, native `complete` means success and `paused` means error with the native reason; active, absent or failed goal reads never become first-turn assistant success. Recovery and post-run observation use the same native authority. Old task Token-budget fields are no longer emitted or enforced; OpenCode owns its round limits. Existing `goalEnabled` tasks retain their setting and use the native command on their next run. Old Host goal metadata and objective files are not imported or executed.
|
|
497
475
|
|
|
498
476
|
Run start also emits `scheduled-task-ran` with `status: running` as soon as
|
|
499
477
|
task state is persisted, so the outer task list can show in-progress before
|
|
@@ -504,12 +482,11 @@ the session is attached.
|
|
|
504
482
|
- Timeout path: abort the per-run signal → cancel in-flight cancellable
|
|
505
483
|
SDK/HTTP → start best-effort OpenCode `session.interrupt` via the create-time
|
|
506
484
|
abort listener (independent of whether the current await is cancellable) →
|
|
507
|
-
|
|
508
|
-
`writeObjective`) to finish → history and task state finalize as `error`
|
|
485
|
+
**do not wait** for non-cancellable work to finish → history and task state finalize as `error`
|
|
509
486
|
with `schedule run timed out` within the watchdog bound. The detached
|
|
510
487
|
`runPromise` is settled with a catch so late rejections are not unhandled.
|
|
511
488
|
- When uncancellable helper work eventually finishes, post-await
|
|
512
|
-
`throwIfAborted` gates stop
|
|
489
|
+
`throwIfAborted` gates stop command / `session.prompt`.
|
|
513
490
|
- Non-timeout failures: no timeout abort; no forced `session.interrupt` from the
|
|
514
491
|
watchdog.
|
|
515
492
|
- Runtime `stop()` clears timers, project-sync retries, and the queue, and aborts
|
|
@@ -517,9 +494,7 @@ the session is attached.
|
|
|
517
494
|
- Remaining non-cancellable edges: work already fully admitted and completed
|
|
518
495
|
HTTP-wise before timeout cannot be rolled back by aborting the HTTP request
|
|
519
496
|
alone; `session.interrupt` is the upstream stop for admitted command/prompt
|
|
520
|
-
execution.
|
|
521
|
-
a signal; the watchdog does not await them, and abort gates block later
|
|
522
|
-
stages after they complete.
|
|
497
|
+
execution. The Host no longer performs Goal distillation or objective-file writes.
|
|
523
498
|
|
|
524
499
|
## Shutdown
|
|
525
500
|
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getSessionGoalCapability,
|
|
3
|
-
isSessionGoalSupported,
|
|
4
|
-
sessionGoalUnavailableMessage,
|
|
5
|
-
} from '../session-goal/capability.js';
|
|
6
1
|
import { MANAGED_SCHEDULED_TASK_TOOL_PATH } from './managed-tool-contract.js';
|
|
7
2
|
|
|
8
3
|
const MAX_ID_LENGTH = 512;
|
|
@@ -157,12 +152,11 @@ const validateTaskInputFields = (input) => {
|
|
|
157
152
|
}
|
|
158
153
|
if (input.execution !== undefined) {
|
|
159
154
|
const execution = asObject(input.execution, 'input.execution');
|
|
160
|
-
hasOnlyKeys(execution, new Set(['prompt', 'providerID', 'modelID', 'agent', 'variant', 'goalEnabled'
|
|
155
|
+
hasOnlyKeys(execution, new Set(['prompt', 'providerID', 'modelID', 'agent', 'variant', 'goalEnabled']), 'input.execution');
|
|
161
156
|
for (const key of ['prompt', 'providerID', 'modelID', 'agent', 'variant']) {
|
|
162
157
|
if (execution[key] !== undefined) asString(execution[key], `input.execution.${key}`, key === 'prompt' ? MAX_PROMPT_LENGTH : MAX_ID_LENGTH);
|
|
163
158
|
}
|
|
164
159
|
if (execution.goalEnabled !== undefined && typeof execution.goalEnabled !== 'boolean') throw new Error('input.execution.goalEnabled is invalid');
|
|
165
|
-
if (execution.goalTokenBudget !== undefined && (!Number.isFinite(execution.goalTokenBudget) || execution.goalTokenBudget <= 0)) throw new Error('input.execution.goalTokenBudget is invalid');
|
|
166
160
|
}
|
|
167
161
|
};
|
|
168
162
|
|
|
@@ -268,17 +262,6 @@ export const registerScheduledTaskToolRoute = (app, dependencies) => {
|
|
|
268
262
|
: new Set(['taskId', 'name', 'enabled', 'schedule', 'execution']), 'input');
|
|
269
263
|
validateTaskInputFields(input);
|
|
270
264
|
|
|
271
|
-
const refuseGoalExecution = (execution) => {
|
|
272
|
-
if (execution?.goalEnabled !== true || isSessionGoalSupported()) {
|
|
273
|
-
return null;
|
|
274
|
-
}
|
|
275
|
-
const capability = getSessionGoalCapability();
|
|
276
|
-
const error = new Error(sessionGoalUnavailableMessage(capability));
|
|
277
|
-
error.statusCode = 501;
|
|
278
|
-
error.capability = capability;
|
|
279
|
-
return error;
|
|
280
|
-
};
|
|
281
|
-
|
|
282
265
|
if (operation === 'update') {
|
|
283
266
|
const patch = {
|
|
284
267
|
...(input.name === undefined ? {} : { name: input.name }),
|
|
@@ -286,8 +269,6 @@ export const registerScheduledTaskToolRoute = (app, dependencies) => {
|
|
|
286
269
|
...(input.schedule === undefined ? {} : { schedule: input.schedule }),
|
|
287
270
|
...(input.execution === undefined ? {} : { execution: input.execution }),
|
|
288
271
|
};
|
|
289
|
-
const goalRefusal = refuseGoalExecution(patch.execution);
|
|
290
|
-
if (goalRefusal) throw goalRefusal;
|
|
291
272
|
const patched = await projectConfigRuntime.patchScheduledTask(project.id, taskID, patch);
|
|
292
273
|
if (!patched?.task) return res.status(404).json({ error: 'Schedule not found' });
|
|
293
274
|
const schedulerSynced = await syncAfterMutation(project.id, operation);
|
|
@@ -303,8 +284,6 @@ export const registerScheduledTaskToolRoute = (app, dependencies) => {
|
|
|
303
284
|
if (operation === 'create' && (!execution.providerID || !execution.modelID)) {
|
|
304
285
|
throw new Error('execution.providerID and execution.modelID are required from the user message or input');
|
|
305
286
|
}
|
|
306
|
-
const goalRefusal = refuseGoalExecution(execution);
|
|
307
|
-
if (goalRefusal) throw goalRefusal;
|
|
308
287
|
const taskInput = {
|
|
309
288
|
...(input.name === undefined ? {} : { name: input.name }),
|
|
310
289
|
...(input.enabled === undefined ? {} : { enabled: input.enabled }),
|
|
@@ -319,14 +298,6 @@ export const registerScheduledTaskToolRoute = (app, dependencies) => {
|
|
|
319
298
|
if (statusCode >= 500 && statusCode !== 501) {
|
|
320
299
|
logger.error?.('[ScheduledTaskTool] request failed', { operation: req.body?.operation, statusCode });
|
|
321
300
|
}
|
|
322
|
-
if (statusCode === 501) {
|
|
323
|
-
const capability = error?.capability || getSessionGoalCapability();
|
|
324
|
-
return res.status(501).json({
|
|
325
|
-
error: error?.message || sessionGoalUnavailableMessage(capability),
|
|
326
|
-
reason: capability.reason,
|
|
327
|
-
capability,
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
301
|
return res.status(statusCode).json({ error: statusCode >= 500 ? 'Failed to manage schedule' : (error?.message || 'Invalid schedule request') });
|
|
331
302
|
}
|
|
332
303
|
});
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { OpenCode } from '@opencode/client';
|
|
2
2
|
import { isConnectedModel, loadConnectedCatalog } from '../llm/catalog.js';
|
|
3
3
|
import { SCHEDULE_CONFLICT_CODE, scheduledTaskWriteGuard } from '../projects/project-config.js';
|
|
4
|
-
import {
|
|
5
|
-
getSessionGoalCapability,
|
|
6
|
-
isSessionGoalSupported,
|
|
7
|
-
sessionGoalUnavailableMessage,
|
|
8
|
-
} from '../session-goal/capability.js';
|
|
9
4
|
|
|
10
5
|
const asNonEmptyString = (value) => {
|
|
11
6
|
if (typeof value !== 'string') {
|
|
@@ -15,22 +10,6 @@ const asNonEmptyString = (value) => {
|
|
|
15
10
|
return trimmed.length > 0 ? trimmed : null;
|
|
16
11
|
};
|
|
17
12
|
|
|
18
|
-
/** Reject create/edit that enables goal when Host goal state is unavailable. */
|
|
19
|
-
const rejectUnsupportedGoalExecution = (taskInput) => {
|
|
20
|
-
if (taskInput?.execution?.goalEnabled !== true) {
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
if (isSessionGoalSupported()) {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
const capability = getSessionGoalCapability();
|
|
27
|
-
return {
|
|
28
|
-
error: sessionGoalUnavailableMessage(capability),
|
|
29
|
-
reason: capability.reason,
|
|
30
|
-
capability,
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
|
|
34
13
|
const parseProjectID = (req) => asNonEmptyString(req?.params?.projectId);
|
|
35
14
|
const parseTaskID = (req) => asNonEmptyString(req?.params?.taskId);
|
|
36
15
|
|
|
@@ -281,11 +260,6 @@ export const registerScheduledTaskRoutes = (app, dependencies) => {
|
|
|
281
260
|
return res.status(404).json({ error: 'Project not found' });
|
|
282
261
|
}
|
|
283
262
|
|
|
284
|
-
const goalRefusal = rejectUnsupportedGoalExecution(taskInput);
|
|
285
|
-
if (goalRefusal) {
|
|
286
|
-
return res.status(501).json(goalRefusal);
|
|
287
|
-
}
|
|
288
|
-
|
|
289
263
|
const taskID = asNonEmptyString(taskInput.id);
|
|
290
264
|
const existingTask = taskID ? await readExistingTask(projectID, taskID) : null;
|
|
291
265
|
const partial = req.method === 'PATCH';
|