@shipfox/client-workflows 22.0.2 → 22.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shipfox/client-workflows",
3
3
  "license": "MIT",
4
- "version": "22.0.2",
4
+ "version": "22.0.3",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/ShipfoxHQ/shipfox.git",
@@ -29,14 +29,14 @@
29
29
  "date-fns": "^4.1.0",
30
30
  "@shipfox/annotations-dto": "12.3.0",
31
31
  "@shipfox/api-definitions-dto": "12.3.0",
32
- "@shipfox/api-workflows-dto": "13.0.0",
32
+ "@shipfox/api-workflows-dto": "13.1.0",
33
33
  "@shipfox/client-api": "6.0.1",
34
- "@shipfox/client-logs": "22.0.2",
35
- "@shipfox/client-projects": "22.0.2",
36
- "@shipfox/client-shell": "22.0.2",
37
- "@shipfox/client-triggers": "22.0.2",
38
- "@shipfox/client-ui": "22.0.2",
39
- "@shipfox/react-ui": "2.1.1"
34
+ "@shipfox/client-logs": "22.0.3",
35
+ "@shipfox/client-projects": "22.0.3",
36
+ "@shipfox/client-shell": "22.0.3",
37
+ "@shipfox/client-triggers": "22.0.3",
38
+ "@shipfox/client-ui": "22.0.3",
39
+ "@shipfox/react-ui": "2.2.0"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@tanstack/react-query": "^5.101.0",
@@ -83,6 +83,19 @@ const errorCases: Array<{
83
83
  category: 'user',
84
84
  },
85
85
  },
86
+ {
87
+ label: 'Managed-only policy',
88
+ error: {
89
+ message: 'This instance only supports provider `shipfox`.',
90
+ code: 'workspace-providers-disabled',
91
+ managedProviderId: 'shipfox',
92
+ exitCode: null,
93
+ signal: undefined,
94
+ reason: 'agent_config_invalid',
95
+ agentConfigIssue: 'provider_unsupported',
96
+ category: 'user',
97
+ },
98
+ },
86
99
  ];
87
100
 
88
101
  export const Playground: Story = {};
@@ -113,6 +126,22 @@ export const TestProviderUnsupported: Story = {
113
126
  play: assertCallout('Choose a supported model provider', false),
114
127
  };
115
128
 
129
+ export const TestManagedOnlyPolicy: Story = {
130
+ args: {
131
+ error: {
132
+ message: 'This instance only supports provider `shipfox`.',
133
+ code: 'workspace-providers-disabled',
134
+ managedProviderId: 'shipfox',
135
+ exitCode: null,
136
+ signal: undefined,
137
+ reason: 'agent_config_invalid',
138
+ agentConfigIssue: 'provider_unsupported',
139
+ category: 'user',
140
+ },
141
+ },
142
+ play: assertCallout('Use shipfox for this instance', false),
143
+ };
144
+
116
145
  function makeError(agentConfigIssue: AgentConfigIssueValue): StepError {
117
146
  return {
118
147
  message: 'Agent configuration is invalid',
@@ -9,6 +9,8 @@ import {Button} from '@shipfox/react-ui/button';
9
9
  import {Link} from '@tanstack/react-router';
10
10
  import type {AgentStepConfig, StepError} from '#core/workflow-run.js';
11
11
 
12
+ const MANAGED_ONLY_PROVIDER_CODE = 'workspace-providers-disabled';
13
+
12
14
  export function AgentConfigFailureCallout({
13
15
  workspaceSlug,
14
16
  config,
@@ -47,6 +49,15 @@ function agentConfigFailureCopy(
47
49
  config: AgentStepConfig | null,
48
50
  error: StepError | null,
49
51
  ): {title: string; description: string; showProviderCta: boolean} {
52
+ const managedOnlyProvider = managedOnlyProviderFromError(error);
53
+ if (managedOnlyProvider) {
54
+ return {
55
+ title: `Use ${managedOnlyProvider} for this instance`,
56
+ description: `This instance only supports provider \`${managedOnlyProvider}\`. Update this step to use \`${managedOnlyProvider}\`, or remove its provider field to use the managed default.`,
57
+ showProviderCta: false,
58
+ };
59
+ }
60
+
50
61
  const provider = configValue(config?.provider, 'the selected provider');
51
62
  const model = configValue(config?.model, 'the selected model');
52
63
 
@@ -92,6 +103,13 @@ function agentConfigFailureCopy(
92
103
  }
93
104
  }
94
105
 
106
+ function managedOnlyProviderFromError(error: StepError | null): string | undefined {
107
+ if (error?.code !== MANAGED_ONLY_PROVIDER_CODE && error?.managedProviderId === undefined) {
108
+ return undefined;
109
+ }
110
+ return error.managedProviderId ?? 'the managed provider';
111
+ }
112
+
95
113
  function configValue(value: string | null | undefined, fallback: string): string {
96
114
  return value ?? fallback;
97
115
  }
@@ -1,3 +1,4 @@
1
+ import type {Step} from '#core/workflow-run.js';
1
2
  import {
2
3
  workflowJob,
3
4
  workflowJobExecutionDto,
@@ -9,6 +10,7 @@ import {
9
10
  jobSucceededSummary,
10
11
  outputFailureDescriptionForExecution,
11
12
  skippedJobDescription,
13
+ toSelectedAttemptError,
12
14
  } from './job-empty-states.js';
13
15
 
14
16
  describe('jobSucceededSummary', () => {
@@ -32,6 +34,25 @@ describe('jobSucceededSummary', () => {
32
34
  });
33
35
  });
34
36
 
37
+ describe('toSelectedAttemptError', () => {
38
+ test('preserves managed-provider metadata from a historical attempt', () => {
39
+ const error = toSelectedAttemptError({type: 'agent'} as Step, {
40
+ message: 'This instance only supports provider `shipfox`.',
41
+ code: 'workspace-providers-disabled',
42
+ managedProviderId: 'shipfox',
43
+ reason: 'agent_config_invalid',
44
+ agentConfigIssue: 'provider_unsupported',
45
+ });
46
+
47
+ expect(error).toMatchObject({
48
+ code: 'workspace-providers-disabled',
49
+ managedProviderId: 'shipfox',
50
+ reason: 'agent_config_invalid',
51
+ agentConfigIssue: 'provider_unsupported',
52
+ });
53
+ });
54
+ });
55
+
35
56
  describe('skippedJobDescription', () => {
36
57
  test('explains when materialized output exceeds the configured size limit', () => {
37
58
  expect(skippedJobDescription('output_too_large')).toBe(
@@ -292,8 +292,18 @@ export function toSelectedAttemptError(
292
292
 
293
293
  if (resolvedReason === undefined) return null;
294
294
 
295
+ const code = typeof error.code === 'string' ? error.code : undefined;
296
+ const managedProviderId =
297
+ typeof error.managedProviderId === 'string'
298
+ ? error.managedProviderId
299
+ : typeof error.managed_provider_id === 'string'
300
+ ? error.managed_provider_id
301
+ : undefined;
302
+
295
303
  return {
296
304
  message: typeof error.message === 'string' ? error.message : '',
305
+ ...(code === undefined ? {} : {code}),
306
+ ...(managedProviderId === undefined ? {} : {managedProviderId}),
297
307
  exitCode: exitCode === null || typeof exitCode === 'number' ? exitCode : null,
298
308
  signal: typeof error.signal === 'string' ? error.signal : undefined,
299
309
  reason: resolvedReason,
@@ -51,6 +51,8 @@ export interface StepSourceLocation {
51
51
 
52
52
  export interface StepError {
53
53
  message: string;
54
+ code?: string | undefined;
55
+ managedProviderId?: string | undefined;
54
56
  exitCode: number | null;
55
57
  signal: string | undefined;
56
58
  reason: StepErrorReason | undefined;
@@ -217,6 +217,10 @@ export function toStep(dto: WorkflowRunStepDetailDto): Step {
217
217
  error: dto.error
218
218
  ? {
219
219
  message: dto.error.message,
220
+ ...(dto.error.code === undefined ? {} : {code: dto.error.code}),
221
+ ...(dto.error.managed_provider_id === undefined
222
+ ? {}
223
+ : {managedProviderId: dto.error.managed_provider_id}),
220
224
  exitCode: dto.error.exit_code ?? null,
221
225
  signal: dto.error.signal,
222
226
  reason: dto.error.reason,