| author | |
| committer | |
| log | 0671e34279d42faf69fccfd46ceae305ccfa7c6d |
| tree | e68a97cccbbae8b45dee704f2c47b1d2c6020ec0 |
| parent | d0f855bfa91b1d961a17a02ec3e383f9671caba1 |
| signature | Signed by PGP key B5690EEEBB952194 |
13 files changed, 16 insertions(+), 93 deletions(-)
apps/web/src/sourceControlPresentation.ts-2| ... | @@ -3,8 +3,6 @@ import type { ElementType } from "react"; | ... | @@ -3,8 +3,6 @@ import type { ElementType } from "react"; |
| 3 | import type { SourceControlProviderInfo, SourceControlProviderKind } from "@t3tools/contracts"; | 3 | import type { SourceControlProviderInfo, SourceControlProviderKind } from "@t3tools/contracts"; |
| 4 | export { | 4 | export { |
| 5 | DEFAULT_CHANGE_REQUEST_TERMINOLOGY, | 5 | DEFAULT_CHANGE_REQUEST_TERMINOLOGY, |
| 6 | formatChangeRequestAction, | ||
| 7 | formatCreateChangeRequestPhrase, | ||
| 8 | getChangeRequestTerminology, | 6 | getChangeRequestTerminology, |
| 9 | resolveChangeRequestPresentation, | 7 | resolveChangeRequestPresentation, |
| 10 | type ChangeRequestPresentation, | 8 | type ChangeRequestPresentation, |
packages/shared/src/Net.ts+1| ... | @@ -63,6 +63,7 @@ export class NetService extends Context.Service<NetService, NetServiceShape>()( | ... | @@ -63,6 +63,7 @@ export class NetService extends Context.Service<NetService, NetServiceShape>()( |
| 63 | "@t3tools/shared/Net/NetService", | 63 | "@t3tools/shared/Net/NetService", |
| 64 | ) {} | 64 | ) {} |
| 65 | 65 | ||
| 66 | /** @public Service construction is part of the canonical Effect module API. */ | ||
| 66 | export const make = () => { | 67 | export const make = () => { |
| 67 | /** | 68 | /** |
| 68 | * Returns true when a TCP server can bind to {host, port}. | 69 | * Returns true when a TCP server can bind to {host, port}. |
packages/shared/src/agentAwareness.ts+1-1| ... | @@ -43,7 +43,7 @@ export interface ProjectThreadAwarenessInput { | ... | @@ -43,7 +43,7 @@ export interface ProjectThreadAwarenessInput { |
| 43 | >; | 43 | >; |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | export function buildAgentAwarenessDeepLink(input: { | 46 | function buildAgentAwarenessDeepLink(input: { |
| 47 | readonly environmentId: EnvironmentId; | 47 | readonly environmentId: EnvironmentId; |
| 48 | readonly threadId: ThreadId; | 48 | readonly threadId: ThreadId; |
| 49 | }): string { | 49 | }): string { |
packages/shared/src/composerTrigger.ts-12| ... | @@ -115,18 +115,6 @@ export function detectComposerTrigger( | ... | @@ -115,18 +115,6 @@ export function detectComposerTrigger( |
| 115 | }; | 115 | }; |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | export function parseStandaloneComposerSlashCommand( | ||
| 119 | text: string, | ||
| 120 | ): Exclude<ComposerSlashCommand, "model"> | null { | ||
| 121 | const match = /^\/(plan|default)\s*$/i.exec(text.trim()); | ||
| 122 | if (!match) { | ||
| 123 | return null; | ||
| 124 | } | ||
| 125 | const command = match[1]?.toLowerCase(); | ||
| 126 | if (command === "plan") return "plan"; | ||
| 127 | return "default"; | ||
| 128 | } | ||
| 129 | |||
| 130 | export function replaceTextRange( | 118 | export function replaceTextRange( |
| 131 | text: string, | 119 | text: string, |
| 132 | rangeStart: number, | 120 | rangeStart: number, |
packages/shared/src/httpReadiness.ts+1-1| ... | @@ -5,7 +5,7 @@ import * as Ref from "effect/Ref"; | ... | @@ -5,7 +5,7 @@ import * as Ref from "effect/Ref"; |
| 5 | import * as Schedule from "effect/Schedule"; | 5 | import * as Schedule from "effect/Schedule"; |
| 6 | import { HttpClient, HttpClientRequest } from "effect/unstable/http"; | 6 | import { HttpClient, HttpClientRequest } from "effect/unstable/http"; |
| 7 | 7 | ||
| 8 | export const DEFAULT_HTTP_READY_PROBE_TIMEOUT_MS = 1_000; | 8 | const DEFAULT_HTTP_READY_PROBE_TIMEOUT_MS = 1_000; |
| 9 | 9 | ||
| 10 | /** | 10 | /** |
| 11 | * Normalizes an arbitrary readiness probe failure into a plain, structured value | 11 | * Normalizes an arbitrary readiness probe failure into a plain, structured value |
packages/shared/src/model.ts+2-7| ... | @@ -35,7 +35,7 @@ function getRawSelectionValueById( | ... | @@ -35,7 +35,7 @@ function getRawSelectionValueById( |
| 35 | return selection?.value; | 35 | return selection?.value; |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | export function getProviderOptionSelectionValue( | 38 | function getProviderOptionSelectionValue( |
| 39 | selections: ReadonlyArray<ProviderOptionSelection> | null | undefined, | 39 | selections: ReadonlyArray<ProviderOptionSelection> | null | undefined, |
| 40 | id: string, | 40 | id: string, |
| 41 | ): string | boolean | undefined { | 41 | ): string | boolean | undefined { |
| ... | @@ -298,11 +298,6 @@ export function readCustomModelEntries(value: unknown): CustomModelDefinition[] | ... | @@ -298,11 +298,6 @@ export function readCustomModelEntries(value: unknown): CustomModelDefinition[] |
| 298 | return entries; | 298 | return entries; |
| 299 | } | 299 | } |
| 300 | 300 | ||
| 301 | /** Slugs of a `customModels` setting, in stored order. */ | ||
| 302 | export function readCustomModelSlugs(value: unknown): string[] { | ||
| 303 | return readCustomModelEntries(value).map((entry) => entry.slug); | ||
| 304 | } | ||
| 305 | |||
| 306 | /** | 301 | /** |
| 307 | * Write a definition back to the compact stored shape: a bare slug when it | 302 | * Write a definition back to the compact stored shape: a bare slug when it |
| 308 | * carries nothing custom, otherwise an entry with only the set fields. | 303 | * carries nothing custom, otherwise an entry with only the set fields. |
| ... | @@ -361,7 +356,7 @@ export function resolveSelectableModel( | ... | @@ -361,7 +356,7 @@ export function resolveSelectableModel( |
| 361 | } | 356 | } |
| 362 | 357 | ||
| 363 | /** Trim a string, returning null for empty/missing values. */ | 358 | /** Trim a string, returning null for empty/missing values. */ |
| 364 | export function trimOrNull<T extends string>(value: T | null | undefined): T | null { | 359 | function trimOrNull<T extends string>(value: T | null | undefined): T | null { |
| 365 | if (typeof value !== "string") return null; | 360 | if (typeof value !== "string") return null; |
| 366 | const trimmed = value.trim() as T; | 361 | const trimmed = value.trim() as T; |
| 367 | return trimmed || null; | 362 | return trimmed || null; |
packages/shared/src/observability.ts+1-1| ... | @@ -303,7 +303,7 @@ export function truncateTraceAttributes(attributes: TraceAttributes): TraceAttri | ... | @@ -303,7 +303,7 @@ export function truncateTraceAttributes(attributes: TraceAttributes): TraceAttri |
| 303 | return truncated ?? attributes; | 303 | return truncated ?? attributes; |
| 304 | } | 304 | } |
| 305 | 305 | ||
| 306 | export function spanToTraceRecord(span: SerializableSpan): EffectTraceRecord { | 306 | function spanToTraceRecord(span: SerializableSpan): EffectTraceRecord { |
| 307 | const status = span.status as Extract<Tracer.SpanStatus, { _tag: "Ended" }>; | 307 | const status = span.status as Extract<Tracer.SpanStatus, { _tag: "Ended" }>; |
| 308 | const parentSpanId = Option.getOrUndefined(span.parent)?.spanId; | 308 | const parentSpanId = Option.getOrUndefined(span.parent)?.spanId; |
| 309 | 309 |
packages/shared/src/orchestrationTiming.ts+1-1| ... | @@ -28,7 +28,7 @@ export function formatDuration(durationMs: number): string { | ... | @@ -28,7 +28,7 @@ export function formatDuration(durationMs: number): string { |
| 28 | return parts.join(" "); | 28 | return parts.join(" "); |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | export function isLatestTurnSettled( | 31 | function isLatestTurnSettled( |
| 32 | latestTurn: LatestTurnTiming | null, | 32 | latestTurn: LatestTurnTiming | null, |
| 33 | session: SessionActivityState | null, | 33 | session: SessionActivityState | null, |
| 34 | ): boolean { | 34 | ): boolean { |
packages/shared/src/relayClient.ts+1-1| ... | @@ -20,7 +20,7 @@ import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process"; | ... | @@ -20,7 +20,7 @@ import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process"; |
| 20 | import { HostProcessArchitecture, HostProcessPlatform } from "./hostProcess.ts"; | 20 | import { HostProcessArchitecture, HostProcessPlatform } from "./hostProcess.ts"; |
| 21 | 21 | ||
| 22 | export const CLOUDFLARED_VERSION = "2026.5.2"; | 22 | export const CLOUDFLARED_VERSION = "2026.5.2"; |
| 23 | export const CLOUDFLARED_PATH_ENV_NAME = "T3CODE_CLOUDFLARED_PATH"; | 23 | const CLOUDFLARED_PATH_ENV_NAME = "T3CODE_CLOUDFLARED_PATH"; |
| 24 | 24 | ||
| 25 | export type RelayClientExecutableSource = "override" | "managed" | "path"; | 25 | export type RelayClientExecutableSource = "override" | "managed" | "path"; |
| 26 | 26 |
packages/shared/src/schemaJson.ts+2-2| ... | @@ -199,12 +199,12 @@ const parseLenientJsonGetter = SchemaGetter.onSome((input: string) => { | ... | @@ -199,12 +199,12 @@ const parseLenientJsonGetter = SchemaGetter.onSome((input: string) => { |
| 199 | * strips trailing commas and JS-style comments before parsing. | 199 | * strips trailing commas and JS-style comments before parsing. |
| 200 | * Encoding produces strict JSON via `JSON.stringify`. | 200 | * Encoding produces strict JSON via `JSON.stringify`. |
| 201 | */ | 201 | */ |
| 202 | export const fromLenientJsonString = new SchemaTransformation.Transformation( | 202 | const fromLenientJsonString = new SchemaTransformation.Transformation( |
| 203 | parseLenientJsonGetter, | 203 | parseLenientJsonGetter, |
| 204 | SchemaGetter.stringifyJson(), | 204 | SchemaGetter.stringifyJson(), |
| 205 | ); | 205 | ); |
| 206 | 206 | ||
| 207 | export const prettyJsonString = SchemaGetter.parseJson<string>().compose( | 207 | const prettyJsonString = SchemaGetter.parseJson<string>().compose( |
| 208 | SchemaGetter.stringifyJson({ space: 2 }), | 208 | SchemaGetter.stringifyJson({ space: 2 }), |
| 209 | ); | 209 | ); |
| 210 | 210 |
packages/shared/src/schemaYaml.ts+4-52| ... | @@ -32,32 +32,8 @@ function formatYamlParseError(error: unknown): string { | ... | @@ -32,32 +32,8 @@ function formatYamlParseError(error: unknown): string { |
| 32 | return `Invalid YAML (code=${error.code}${location}).`; | 32 | return `Invalid YAML (code=${error.code}${location}).`; |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | /** | 35 | /** Parses YAML during decoding, reporting parse failures as InvalidValue issues. */ |
| 36 | * Parses a YAML string into a value. | 36 | function parseYaml<E extends string>(options?: YamlParseOptions): SchemaGetter.Getter<unknown, E> { |
| 37 | * | ||
| 38 | * **When to use** | ||
| 39 | * | ||
| 40 | * Use when you need a schema getter to parse a present encoded YAML string | ||
| 41 | * during decoding. | ||
| 42 | * | ||
| 43 | * **Details** | ||
| 44 | * | ||
| 45 | * Parse failures become `SchemaIssue.InvalidValue` values. | ||
| 46 | * | ||
| 47 | * **Example** (Parse YAML) | ||
| 48 | * | ||
| 49 | * ```ts | ||
| 50 | * import { parseYaml } from "@t3tools/shared/schemaYaml" | ||
| 51 | * | ||
| 52 | * const parse = parseYaml<string>() | ||
| 53 | * // Getter<unknown, string> | ||
| 54 | * ``` | ||
| 55 | * | ||
| 56 | * @see {@link stringifyYaml} for the inverse operation | ||
| 57 | */ | ||
| 58 | export function parseYaml<E extends string>( | ||
| 59 | options?: YamlParseOptions, | ||
| 60 | ): SchemaGetter.Getter<unknown, E> { | ||
| 61 | return SchemaGetter.transformOrFail((input: E) => | 37 | return SchemaGetter.transformOrFail((input: E) => |
| 62 | Effect.try({ | 38 | Effect.try({ |
| 63 | try: () => parseYamlString(input, options) as unknown, | 39 | try: () => parseYamlString(input, options) as unknown, |
| ... | @@ -66,32 +42,8 @@ export function parseYaml<E extends string>( | ... | @@ -66,32 +42,8 @@ export function parseYaml<E extends string>( |
| 66 | ); | 42 | ); |
| 67 | } | 43 | } |
| 68 | 44 | ||
| 69 | /** | 45 | /** Serializes YAML during encoding, reporting stringify failures as InvalidValue issues. */ |
| 70 | * Stringifies a present value as YAML. | 46 | function stringifyYaml(options?: YamlStringifyOptions): SchemaGetter.Getter<string, unknown> { |
| 71 | * | ||
| 72 | * **When to use** | ||
| 73 | * | ||
| 74 | * Use when you need a schema getter to serialize a present decoded value to | ||
| 75 | * YAML text during encoding. | ||
| 76 | * | ||
| 77 | * **Details** | ||
| 78 | * | ||
| 79 | * Stringify failures become `SchemaIssue.InvalidValue` values. | ||
| 80 | * | ||
| 81 | * **Example** (Stringify YAML) | ||
| 82 | * | ||
| 83 | * ```ts | ||
| 84 | * import { stringifyYaml } from "@t3tools/shared/schemaYaml" | ||
| 85 | * | ||
| 86 | * const stringify = stringifyYaml() | ||
| 87 | * // Getter<string, unknown> | ||
| 88 | * ``` | ||
| 89 | * | ||
| 90 | * @see {@link parseYaml} for the inverse operation | ||
| 91 | */ | ||
| 92 | export function stringifyYaml( | ||
| 93 | options?: YamlStringifyOptions, | ||
| 94 | ): SchemaGetter.Getter<string, unknown> { | ||
| 95 | return SchemaGetter.transformOrFail((input: unknown) => | 47 | return SchemaGetter.transformOrFail((input: unknown) => |
| 96 | Effect.try({ | 48 | Effect.try({ |
| 97 | try: () => stringifyYamlValue(input, options), | 49 | try: () => stringifyYamlValue(input, options), |
packages/shared/src/sourceControl.ts+1-12| ... | @@ -92,23 +92,12 @@ export function resolveChangeRequestPresentation( | ... | @@ -92,23 +92,12 @@ export function resolveChangeRequestPresentation( |
| 92 | } | 92 | } |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | export function resolveChangeRequestPresentationForKind( | 95 | function resolveChangeRequestPresentationForKind( |
| 96 | kind: SourceControlProviderKind, | 96 | kind: SourceControlProviderKind, |
| 97 | ): ChangeRequestPresentation { | 97 | ): ChangeRequestPresentation { |
| 98 | return resolveChangeRequestPresentation({ kind, name: "", baseUrl: "" }); | 98 | return resolveChangeRequestPresentation({ kind, name: "", baseUrl: "" }); |
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | export function formatChangeRequestAction( | ||
| 102 | verb: "View" | "Create", | ||
| 103 | presentation: ChangeRequestPresentation, | ||
| 104 | ): string { | ||
| 105 | return `${verb} ${presentation.shortName}`; | ||
| 106 | } | ||
| 107 | |||
| 108 | export function formatCreateChangeRequestPhrase(presentation: ChangeRequestPresentation): string { | ||
| 109 | return `create ${presentation.shortName}`; | ||
| 110 | } | ||
| 111 | |||
| 112 | export function getChangeRequestTerminology( | 101 | export function getChangeRequestTerminology( |
| 113 | provider: SourceControlProviderInfo | null | undefined, | 102 | provider: SourceControlProviderInfo | null | undefined, |
| 114 | ): ChangeRequestTerminology { | 103 | ): ChangeRequestTerminology { |
packages/shared/src/usageLimits.ts+1-1| ... | @@ -161,7 +161,7 @@ export function limitsNotice(limits: ServerProviderUsageLimits): string | null { | ... | @@ -161,7 +161,7 @@ export function limitsNotice(limits: ServerProviderUsageLimits): string | null { |
| 161 | return limits.windows.length === 0 ? "No limits reported." : null; | 161 | return limits.windows.length === 0 ? "No limits reported." : null; |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | export function resetMillis(window: ServerProviderUsageWindow): number | null { | 164 | function resetMillis(window: ServerProviderUsageWindow): number | null { |
| 165 | if (window.resetsAt === undefined) return null; | 165 | if (window.resetsAt === undefined) return null; |
| 166 | const at = Date.parse(window.resetsAt); | 166 | const at = Date.parse(window.resetsAt); |
| 167 | return Number.isFinite(at) ? at : null; | 167 | return Number.isFinite(at) ? at : null; |