Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/sim/blocks/blocks/tailscale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ export const TailscaleBlock: BlockConfig = {
if (
params.operation === 'create_auth_key' &&
params.expirySeconds != null &&
params.expirySeconds !== ''
!(typeof params.expirySeconds === 'string' && params.expirySeconds.trim() === '')
) {
const expirySeconds = Number(params.expirySeconds)
if (!Number.isFinite(expirySeconds)) throw new Error('Expiry must be a finite number')
Expand Down
16 changes: 15 additions & 1 deletion apps/sim/lib/workflows/editing/builders.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { TailscaleBlock } from '@/blocks/blocks/tailscale'
import { getAllBlocks, getBlock } from '@/blocks/registry'
import { prepareBlockState } from '@/stores/workflows/prepare-block-state'
import type { BlockState } from '@/stores/workflows/workflow/types'
import { tailscaleAuthorizeDeviceTool } from '@/tools/tailscale'
import { tailscaleAuthorizeDeviceTool, tailscaleCreateAuthKeyTool } from '@/tools/tailscale'

const mockIsIntegrationDeploymentAvailable =
integrationsAvailabilityMockFns.mockIsIntegrationDeploymentAvailableForVisibility
Expand Down Expand Up @@ -214,6 +214,20 @@ describe('createBlockFromParams', () => {
).toMatchObject({ authorized: false })
})

it.each(['', ' ', null, undefined])(
'omits cleared auth-key expiry %j so the provider default applies',
(expirySeconds) => {
const transform = TailscaleBlock.tools?.config?.params
if (!transform) throw new Error('Tailscale has no parameter transform')
const body = tailscaleCreateAuthKeyTool.request.body?.({
apiKey: 'test-token',
tailnet: '-',
...transform({ operation: 'create_auth_key', expirySeconds }),
})
expect(JSON.stringify(body)).not.toContain('"expirySeconds"')
}
)

it('exposes the output ports of the seeded Agent default', () => {
const block = createBlockFromParams(
'agent-research-default',
Expand Down
70 changes: 4 additions & 66 deletions apps/sim/tools/tailscale/get_dns_configuration.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { DNS_CONFIGURATION_OUTPUT } from '@/tools/tailscale/outputs'
import type {
TailscaleBaseParams,
TailscaleDnsConfiguration,
TailscaleGetDnsConfigurationResponse,
} from '@/tools/tailscale/types'
import { assertTailscaleResponse } from '@/tools/tailscale/utils'
import { assertTailscaleResponse, mapTailscaleDnsConfiguration } from '@/tools/tailscale/utils'
import type { ToolConfig } from '@/tools/types'
import { safeUrlPathSegment } from '@/tools/url-path'

Expand Down Expand Up @@ -42,72 +43,9 @@ export const tailscaleGetDnsConfigurationTool: ToolConfig<
return {
success: true,
output: {
dnsConfiguration: {
nameservers: data.nameservers ?? [],
splitDNS: data.splitDNS ?? null,
searchPaths: data.searchPaths ?? [],
preferences: data.preferences ?? null,
},
dnsConfiguration: mapTailscaleDnsConfiguration(data),
},
}
},
outputs: {
dnsConfiguration: {
type: 'json',
description: 'Dns configuration',
properties: {
nameservers: {
type: 'array',
description: 'Global DNS resolvers to use',
items: {
type: 'json',
properties: {
address: {
type: 'string',
description: 'IPv4 or IPv6 address of the DNS resolver',
optional: true,
},
useWithExitNode: {
type: 'boolean',
description:
'If true, this resolver should still be used when a device is configured to use a Tailscale exit node',
optional: true,
},
},
},
},
splitDNS: {
type: 'json',
description:
'Map of DNS name suffixes (domains) to lists of resolvers for Split DNS and advanced routing overlays',
nullable: true,
},
searchPaths: {
type: 'array',
description: 'Search domain paths to apply',
items: {
type: 'string',
},
},
preferences: {
type: 'json',
description: 'Preferences',
properties: {
overrideLocalDNS: {
type: 'boolean',
description:
'If true, resolvers in `nameservers` override the local OS DNS configuration; if false, local resolvers are used',
optional: true,
},
magicDNS: {
type: 'boolean',
description: 'Whether MagicDNS is enabled for this tailnet',
optional: true,
},
},
nullable: true,
},
},
},
},
outputs: DNS_CONFIGURATION_OUTPUT,
}
107 changes: 4 additions & 103 deletions apps/sim/tools/tailscale/get_tailnet_settings.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { TAILNET_SETTINGS_OUTPUT } from '@/tools/tailscale/outputs'
import type {
TailscaleBaseParams,
TailscaleGetTailnetSettingsResponse,
TailscaleTailnetSettings,
} from '@/tools/tailscale/types'
import { assertTailscaleResponse } from '@/tools/tailscale/utils'
import { assertTailscaleResponse, mapTailscaleTailnetSettings } from '@/tools/tailscale/utils'
import type { ToolConfig } from '@/tools/types'
import { safeUrlPathSegment } from '@/tools/url-path'

Expand Down Expand Up @@ -42,109 +43,9 @@ export const tailscaleGetTailnetSettingsTool: ToolConfig<
return {
success: true,
output: {
settings: {
aclsExternallyManagedOn: data.aclsExternallyManagedOn ?? null,
aclsExternalLink: data.aclsExternalLink ?? null,
adminConsoleSessionTimeoutMinutes: data.adminConsoleSessionTimeoutMinutes ?? null,
devicesApprovalOn: data.devicesApprovalOn ?? null,
devicesAutoUpdatesOn: data.devicesAutoUpdatesOn ?? null,
devicesKeyDurationDays: data.devicesKeyDurationDays ?? null,
usersApprovalOn: data.usersApprovalOn ?? null,
usersRoleAllowedToJoinExternalTailnets:
data.usersRoleAllowedToJoinExternalTailnets ?? null,
networkFlowLoggingOn: data.networkFlowLoggingOn ?? null,
regionalRoutingOn: data.regionalRoutingOn ?? null,
routeSelection: data.routeSelection ?? null,
postureIdentityCollectionOn: data.postureIdentityCollectionOn ?? null,
httpsEnabled: data.httpsEnabled ?? null,
},
settings: mapTailscaleTailnetSettings(data),
},
}
},
outputs: {
settings: {
type: 'json',
description: 'Settings for a tailnet',
properties: {
aclsExternallyManagedOn: {
type: 'boolean',
description:
'Prevents users from editing policies in the admin console to avoid conflicts with external management workflows like GitOps or Terraform',
nullable: true,
},
aclsExternalLink: {
type: 'string',
description:
'Link to the external tailnet policy definition or management solution for this tailnet',
nullable: true,
},
adminConsoleSessionTimeoutMinutes: {
type: 'number',
description:
'The [admin console session timeout](/docs/account/admin-console-session-timeout) for members of this tailnet',
nullable: true,
},
devicesApprovalOn: {
type: 'boolean',
description:
'Whether [device approval](/docs/features/access-control/device-management/device-approval) is enabled for the tailnet',
nullable: true,
},
devicesAutoUpdatesOn: {
type: 'boolean',
description:
'Whether [auto updates](/docs/features/client/update#auto-updates) are enabled for devices that belong to this tailnet',
nullable: true,
},
devicesKeyDurationDays: {
type: 'number',
description:
'The [key expiry](/docs/features/access-control/key-expiry) duration for devices on this tailnet',
nullable: true,
},
usersApprovalOn: {
type: 'boolean',
description:
'Whether [user approval](/docs/features/access-control/user-approval) is enabled for this tailnet',
nullable: true,
},
usersRoleAllowedToJoinExternalTailnets: {
type: 'string',
description:
'Which user roles are allowed to [join external tailnets](/docs/features/sharing/how-to/invite-any-user)',
nullable: true,
},
networkFlowLoggingOn: {
type: 'boolean',
description:
'Whether [network flow logs](/docs/features/logging/network-flow-logs) are enabled for the tailnet',
nullable: true,
},
regionalRoutingOn: {
type: 'boolean',
description:
'Whether [regional routing](/docs/features/route-selection#regional-routing) is enabled for the tailnet',
nullable: true,
},
routeSelection: {
type: 'string',
description:
'The [route selection](/docs/features/route-selection) algorithm used by the tailnet: * `active-passive-failover` - Active-passive failover (formerly known as "Failover") * `regional-routing` - Regional routing * `regional-routing-failover` - Regional routing with in-region failover * `magicroute` - MagicRoute A PATCH request must not specify both the `regionalRoutingOn` and `routeSelection` fields',
nullable: true,
},
postureIdentityCollectionOn: {
type: 'boolean',
description:
'Whether [identity collection](/docs/features/access-control/device-management/how-to/manage-identity) is enabled for [device posture](/docs/features/device-posture) integrations for the tailnet',
nullable: true,
},
httpsEnabled: {
type: 'boolean',
description:
'Whether provisioning of [HTTPS certificates](/docs/how-to/set-up-https-certificates) is enabled for this tailnet',
nullable: true,
},
},
},
},
outputs: TAILNET_SETTINGS_OUTPUT,
}
Loading
Loading