@codeworksh/harness 0.9.0-canary.167.1.g6ddcc8db → 0.9.0-canary.169.1.g71f19429

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/effect.d.mts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { s as index_d_exports$1 } from "./index-Bh-JSvU4.mjs";
2
2
  import { s as index_d_exports$2 } from "./index-NOtBwGrV.mjs";
3
3
  import { Actor } from "@codeworksh/schema/actor";
4
+ import * as Connector from "@codeworksh/plugin/connector";
5
+ import { BrokerInterface } from "@codeworksh/plugin/connector";
4
6
  import { Config as Config$1, Daemon, Events, Plugin, PluginOptions, PluginRef, PluginRegistry, PromptResolver, SharedPluginContext } from "@codeworksh/plugin/plugin";
5
7
  import { Cause, Config, Context, DateTime, Duration, Effect, JsonSchema, Layer, Option, PubSub, Ref, Schema, Scope, Stream } from "effect";
6
8
  import { Delivery, InterruptReason, PromptConflictError, RelinkError, RelinkReason, SessionLinkedSpaceNotFoundError, SessionNotFoundError } from "@codeworksh/schema/session";
@@ -31532,6 +31534,8 @@ declare const layer$7: (options: {
31532
31534
  readonly home: string;
31533
31535
  /** Where provider logins are read for `auth.provider`; see {@link ModelCatalog.Credentials}. */
31534
31536
  readonly authFile?: string | undefined;
31537
+ /** Optional host connector broker for `auth.connection` and broker-backed provider tokens. */
31538
+ readonly broker?: BrokerInterface | undefined;
31535
31539
  /** How long an instance no drain holds stays open. Default: 10 minutes. */
31536
31540
  readonly idleTimeout?: Duration.Input | undefined;
31537
31541
  }) => Layer.Layer<Service$8, never, ChildProcessSpawner.ChildProcessSpawner | Service$20>;
@@ -31667,6 +31671,7 @@ declare const models: Effect.Effect<Partial<Record<string, Record<string, {
31667
31671
  declare const providers: Effect.Effect<string[], ModelCatalogError, never>;
31668
31672
  declare const Credentials_base: Context.ServiceClass<Credentials, "@codeworksh/harness/model/catalog/Credentials", {
31669
31673
  readonly authFile: string | undefined;
31674
+ readonly broker?: BrokerInterface | undefined;
31670
31675
  }>;
31671
31676
  /**
31672
31677
  * Where this process reads OAuth logins: `<home>/aikit/auth.json` when a home was chosen,
@@ -31692,7 +31697,7 @@ declare const oauthCredentials: (protocol: string, authFile: string | undefined)
31692
31697
  * The credential a model call to `provider` sends: its OAuth login token, else its API key from
31693
31698
  * the environment. Undefined when it has neither, or the catalog does not know the provider.
31694
31699
  */
31695
- declare const providerToken: (provider: string, authFile: string | undefined) => Effect.Effect<string | undefined, ModelCatalogError, never>;
31700
+ declare const providerToken: (provider: string, authFile: string | undefined, broker?: BrokerInterface | undefined) => Effect.Effect<string | undefined, ModelCatalogError, never>;
31696
31701
  /**
31697
31702
  * A settings entry as the catalog reads it. Settings entries are read exactly like generated ones;
31698
31703
  * the one difference is `provider.key`, written `"${NAME}"`, which becomes the variable name aikit
@@ -32449,12 +32454,25 @@ declare const systemMessage: <T>(messageId: string, created: number, changes: {
32449
32454
  };
32450
32455
  /** A message's parts; a system message has none. */
32451
32456
  declare const parts: (message: Message.Message) => ({
32457
+ type: "text";
32458
+ text: string;
32459
+ textSignature?: string;
32460
+ } | {
32461
+ type: "image";
32462
+ data: string;
32463
+ mimeType: string;
32464
+ } | {
32465
+ type: "thinking";
32466
+ thinking: string;
32467
+ thinkingSignature?: string;
32468
+ redacted?: boolean;
32469
+ } | {
32452
32470
  arguments: Record<string, any>;
32453
32471
  callID: string;
32454
32472
  name: string;
32455
32473
  namespace?: string;
32456
- result: {
32457
- content: ({
32474
+ partial?: {
32475
+ content?: ({
32458
32476
  type: "text";
32459
32477
  text: string;
32460
32478
  textSignature?: string;
@@ -32464,9 +32482,8 @@ declare const parts: (message: Message.Message) => ({
32464
32482
  mimeType: string;
32465
32483
  })[];
32466
32484
  details?: any;
32467
- isError: false;
32468
32485
  };
32469
- status: "completed";
32486
+ status: "running";
32470
32487
  thoughtSignature?: string;
32471
32488
  time: {
32472
32489
  start: number;
@@ -32489,9 +32506,9 @@ declare const parts: (message: Message.Message) => ({
32489
32506
  mimeType: string;
32490
32507
  })[];
32491
32508
  details?: any;
32492
- isError: true;
32509
+ isError: false;
32493
32510
  };
32494
- status: "error";
32511
+ status: "completed";
32495
32512
  thoughtSignature?: string;
32496
32513
  time: {
32497
32514
  start: number;
@@ -32516,7 +32533,7 @@ declare const parts: (message: Message.Message) => ({
32516
32533
  details?: any;
32517
32534
  isError: true;
32518
32535
  };
32519
- status: "skipped";
32536
+ status: "error";
32520
32537
  thoughtSignature?: string;
32521
32538
  time: {
32522
32539
  start: number;
@@ -32541,33 +32558,20 @@ declare const parts: (message: Message.Message) => ({
32541
32558
  details?: any;
32542
32559
  isError: true;
32543
32560
  };
32544
- status: "aborted";
32561
+ status: "skipped";
32545
32562
  thoughtSignature?: string;
32546
32563
  time: {
32547
32564
  start: number;
32548
32565
  end: number;
32549
32566
  };
32550
32567
  type: "toolCall";
32551
- } | {
32552
- type: "text";
32553
- text: string;
32554
- textSignature?: string;
32555
- } | {
32556
- type: "image";
32557
- data: string;
32558
- mimeType: string;
32559
- } | {
32560
- type: "thinking";
32561
- thinking: string;
32562
- thinkingSignature?: string;
32563
- redacted?: boolean;
32564
32568
  } | {
32565
32569
  arguments: Record<string, any>;
32566
32570
  callID: string;
32567
32571
  name: string;
32568
32572
  namespace?: string;
32569
- partial?: {
32570
- content?: ({
32573
+ result: {
32574
+ content: ({
32571
32575
  type: "text";
32572
32576
  text: string;
32573
32577
  textSignature?: string;
@@ -32577,8 +32581,9 @@ declare const parts: (message: Message.Message) => ({
32577
32581
  mimeType: string;
32578
32582
  })[];
32579
32583
  details?: any;
32584
+ isError: true;
32580
32585
  };
32581
- status: "running";
32586
+ status: "aborted";
32582
32587
  thoughtSignature?: string;
32583
32588
  time: {
32584
32589
  start: number;
@@ -32754,12 +32759,25 @@ declare const decodeMessage: (hydrated: HydratedEntry) => Effect.Effect<{
32754
32759
  completed: number;
32755
32760
  };
32756
32761
  parts: ({
32762
+ type: "text";
32763
+ text: string;
32764
+ textSignature?: string;
32765
+ } | {
32766
+ type: "image";
32767
+ data: string;
32768
+ mimeType: string;
32769
+ } | {
32770
+ type: "thinking";
32771
+ thinking: string;
32772
+ thinkingSignature?: string;
32773
+ redacted?: boolean;
32774
+ } | {
32757
32775
  arguments: Record<string, any>;
32758
32776
  callID: string;
32759
32777
  name: string;
32760
32778
  namespace?: string;
32761
- result: {
32762
- content: ({
32779
+ partial?: {
32780
+ content?: ({
32763
32781
  type: "text";
32764
32782
  text: string;
32765
32783
  textSignature?: string;
@@ -32769,9 +32787,8 @@ declare const decodeMessage: (hydrated: HydratedEntry) => Effect.Effect<{
32769
32787
  mimeType: string;
32770
32788
  })[];
32771
32789
  details?: any;
32772
- isError: false;
32773
32790
  };
32774
- status: "completed";
32791
+ status: "running";
32775
32792
  thoughtSignature?: string;
32776
32793
  time: {
32777
32794
  start: number;
@@ -32794,9 +32811,9 @@ declare const decodeMessage: (hydrated: HydratedEntry) => Effect.Effect<{
32794
32811
  mimeType: string;
32795
32812
  })[];
32796
32813
  details?: any;
32797
- isError: true;
32814
+ isError: false;
32798
32815
  };
32799
- status: "error";
32816
+ status: "completed";
32800
32817
  thoughtSignature?: string;
32801
32818
  time: {
32802
32819
  start: number;
@@ -32821,7 +32838,7 @@ declare const decodeMessage: (hydrated: HydratedEntry) => Effect.Effect<{
32821
32838
  details?: any;
32822
32839
  isError: true;
32823
32840
  };
32824
- status: "skipped";
32841
+ status: "error";
32825
32842
  thoughtSignature?: string;
32826
32843
  time: {
32827
32844
  start: number;
@@ -32846,33 +32863,20 @@ declare const decodeMessage: (hydrated: HydratedEntry) => Effect.Effect<{
32846
32863
  details?: any;
32847
32864
  isError: true;
32848
32865
  };
32849
- status: "aborted";
32866
+ status: "skipped";
32850
32867
  thoughtSignature?: string;
32851
32868
  time: {
32852
32869
  start: number;
32853
32870
  end: number;
32854
32871
  };
32855
32872
  type: "toolCall";
32856
- } | {
32857
- type: "text";
32858
- text: string;
32859
- textSignature?: string;
32860
- } | {
32861
- type: "image";
32862
- data: string;
32863
- mimeType: string;
32864
- } | {
32865
- type: "thinking";
32866
- thinking: string;
32867
- thinkingSignature?: string;
32868
- redacted?: boolean;
32869
32873
  } | {
32870
32874
  arguments: Record<string, any>;
32871
32875
  callID: string;
32872
32876
  name: string;
32873
32877
  namespace?: string;
32874
- partial?: {
32875
- content?: ({
32878
+ result: {
32879
+ content: ({
32876
32880
  type: "text";
32877
32881
  text: string;
32878
32882
  textSignature?: string;
@@ -32882,8 +32886,9 @@ declare const decodeMessage: (hydrated: HydratedEntry) => Effect.Effect<{
32882
32886
  mimeType: string;
32883
32887
  })[];
32884
32888
  details?: any;
32889
+ isError: true;
32885
32890
  };
32886
- status: "running";
32891
+ status: "aborted";
32887
32892
  thoughtSignature?: string;
32888
32893
  time: {
32889
32894
  start: number;
@@ -32907,6 +32912,21 @@ declare const decodeMessage: (hydrated: HydratedEntry) => Effect.Effect<{
32907
32912
  responseId?: string;
32908
32913
  responseModel?: string;
32909
32914
  messageId: string;
32915
+ } | {
32916
+ messageId: string;
32917
+ role: "user";
32918
+ time: {
32919
+ created: number;
32920
+ };
32921
+ parts: ({
32922
+ type: "text";
32923
+ text: string;
32924
+ textSignature?: string;
32925
+ } | {
32926
+ type: "image";
32927
+ data: string;
32928
+ mimeType: string;
32929
+ })[];
32910
32930
  } | {
32911
32931
  messageId: string;
32912
32932
  role: "system";
@@ -32934,21 +32954,6 @@ declare const decodeMessage: (hydrated: HydratedEntry) => Effect.Effect<{
32934
32954
  name: string;
32935
32955
  }[];
32936
32956
  metadata?: Record<string, unknown>;
32937
- } | {
32938
- messageId: string;
32939
- role: "user";
32940
- time: {
32941
- created: number;
32942
- };
32943
- parts: ({
32944
- type: "text";
32945
- text: string;
32946
- textSignature?: string;
32947
- } | {
32948
- type: "image";
32949
- data: string;
32950
- mimeType: string;
32951
- })[];
32952
32957
  }, ContextDecodeError, never>;
32953
32958
  declare namespace context_d_exports {
32954
32959
  export { ContextDecodeError, ContextEncodeError, ContextMessage, ContextReadError, EncodedMessage, Interface$2 as Interface, Service$2 as Service, Snapshot, assembleLine, decodeMessage, decodeSyntheticMessage, encodeMessage, encodePart, layer$2 as layer, parts, systemMessage };
@@ -33584,6 +33589,8 @@ interface OpenOptions {
33584
33589
  * environment variable. Omitted, aikit resolves its own default location.
33585
33590
  */
33586
33591
  readonly authFile?: string;
33592
+ /** Optional host connector broker; when present, resolves workspace/actor provider credentials first. */
33593
+ readonly broker?: BrokerInterface;
33587
33594
  }
33588
33595
  type Request = (input: RequestInput) => Effect.Effect<Terminal, ModelCatalogError | ModelNotFoundError | ProviderError | LLMStreamError>;
33589
33596
  declare const runtimeOptions: (input: Input, model: Model$1.Info, signal: AbortSignal) => {
@@ -33699,6 +33706,8 @@ interface Options$1 {
33699
33706
  readonly mcpIdleTimeout?: Duration.Input;
33700
33707
  /** Space daemon timings: the handover after a space's last drain, and the idle stop. */
33701
33708
  readonly daemons?: Pick<Options$3, "handover" | "idleTimeout">;
33709
+ /** Optional host connector broker for workspace/actor provider and MCP credential resolution. */
33710
+ readonly broker?: BrokerInterface;
33702
33711
  }
33703
33712
  declare const layer: (options?: Options$1) => Layer.Layer<Controller | Credentials | Registry | Service$23 | Service$20 | Service$11 | Service$22 | Service$10 | Service$21 | Service$19 | Service$18 | Service$9 | Service$7 | Service$6 | Service$8 | Service$4 | Service$1 | Service$3 | Service$2 | SqlClient$1.SqlClient | import("@effect/sql-sqlite-node/SqliteClient").SqliteClient, import("effect/Config").ConfigError | EventRegistrationError | InstallError | LoadError | OutdatedError | import("@codeworksh/schema/sandbox/errors").SandboxDriverLoadError | import("@codeworksh/schema/sandbox/errors").SandboxDriverRegistrationError | SettingsError | SourceError | StoreError, never>;
33704
33713
  declare namespace sandbox_d_exports {
@@ -34749,7 +34758,10 @@ interface Challenge {
34749
34758
  }
34750
34759
  /** What is stored for one server. */
34751
34760
  interface State {
34761
+ /** Dynamically registered client (`redirect_uris` present). CIMD URLs are never stored here. */
34752
34762
  readonly clientInformation?: OAuthClientInformationMixed;
34763
+ /** CIMD URL that issued `tokens`, kept separate so future sign-ins always re-decide from discovery. */
34764
+ readonly tokenClientId?: string;
34753
34765
  readonly tokens?: OAuthTokens;
34754
34766
  /** When the access token expires, in milliseconds since the epoch, from `expires_in` when it was saved. */
34755
34767
  readonly tokensExpireAt?: number;
@@ -34836,6 +34848,62 @@ declare const login: (input: {
34836
34848
  }, OAuthError, ChildProcessSpawner.ChildProcessSpawner>;
34837
34849
  /** Remove the server's stored credentials. Returns whether there were any. */
34838
34850
  declare const signOut: (store: Store, server: Pick<Server, "name" | "url">) => Effect.Effect<boolean, OAuthError, never>;
34851
+ declare namespace cimd_d_exports {
34852
+ export { CALLBACK_HOST, CALLBACK_PATH, CIMD_BASE_URL, CLIENT_NAME, CLIENT_URI, CimdServerMetadata, ClientMetadataDocumentChoice, DEFAULT_REDIRECT_URL, LOGO_URI, callbackId, listsRedirectUrl, matchCallbackRedirect, offersClientMetadataDocument, selectClientMetadataDocument, serverSpecificPath };
34853
+ }
34854
+ /**
34855
+ * Client ID Metadata Document (CIMD) identity rules shared by MCP sign-in and Connectors.
34856
+ *
34857
+ * When an authorization server supports CIMD for public clients, CodeWork identifies itself with
34858
+ * `https://codework.sh/oauth/client.json` (or a per-resource document when the server does not
34859
+ * advertise RFC 9207 `iss` in authorization responses, isolating callback paths per RFC 9700 §4.4.2.2).
34860
+ */
34861
+ declare const CLIENT_NAME = "CodeWork";
34862
+ declare const CLIENT_URI = "https://codework.sh";
34863
+ declare const LOGO_URI = "https://codework.sh/brand/icon.png";
34864
+ declare const CIMD_BASE_URL = "https://codework.sh/oauth";
34865
+ declare const CALLBACK_HOST = "127.0.0.1";
34866
+ declare const CALLBACK_PATH = "/oauth/callback";
34867
+ declare const DEFAULT_REDIRECT_URL = "http://127.0.0.1/oauth/callback";
34868
+ interface CimdServerMetadata {
34869
+ readonly client_id_metadata_document_supported?: boolean | undefined;
34870
+ readonly token_endpoint_auth_methods_supported?: ReadonlyArray<string> | undefined;
34871
+ readonly authorization_response_iss_parameter_supported?: boolean | undefined;
34872
+ }
34873
+ interface ClientMetadataDocumentChoice {
34874
+ readonly clientId: string;
34875
+ readonly redirectUrl: string;
34876
+ }
34877
+ /** 12-character base64url fingerprint identifying a resource URL in per-server CIMD and callback paths. */
34878
+ declare const callbackId: (resourceUrl: string) => string;
34879
+ /** Path of a per-server CIMD redirect URI: `<path>/<callbackId>`. */
34880
+ declare const serverSpecificPath: (path: string, resourceUrl: string) => string;
34881
+ /** Whether CodeWork's hosted CIMD lists `redirectUrl` (RFC 8252 §7.3 allows any loopback port). */
34882
+ declare const listsRedirectUrl: (redirectUrl: string) => boolean;
34883
+ /**
34884
+ * Whether a sign-in may identify via CodeWork's CIMD rather than a pre-registered client or DCR.
34885
+ * Any configured `clientId`, custom `clientName`, or unlisted redirect URI disables CIMD.
34886
+ */
34887
+ declare const offersClientMetadataDocument: (input: {
34888
+ readonly clientId?: string | undefined;
34889
+ readonly clientName?: string | undefined;
34890
+ readonly redirectUrl: string;
34891
+ }) => boolean;
34892
+ /**
34893
+ * Selects the shared or per-server CIMD when the authorization server supports public CIMD clients,
34894
+ * otherwise returns `undefined` to fall back to Dynamic Client Registration.
34895
+ */
34896
+ declare const selectClientMetadataDocument: (input: {
34897
+ readonly resourceUrl: string;
34898
+ readonly redirectUrl: string;
34899
+ readonly metadata: CimdServerMetadata | undefined;
34900
+ }) => ClientMetadataDocumentChoice | undefined;
34901
+ /**
34902
+ * Validates that an observed callback URL matches the expected redirect URI (exact protocol, port,
34903
+ * and path; allows `127.0.0.1` -> `localhost` rewrite by servers such as Clerk). Returns the exact
34904
+ * observed `redirect_uri` without query/hash for the token exchange, or `undefined` on mismatch.
34905
+ */
34906
+ declare const matchCallbackRedirect: (actualUrl: URL, expectedRedirectUrl: URL) => string | undefined;
34839
34907
  //#endregion
34840
34908
  //#region src/util/home.d.ts
34841
34909
  /**
@@ -35078,8 +35146,8 @@ declare const update: <A>(target: Fetchable, cache: string, options: {
35078
35146
  readonly probe: Probe;
35079
35147
  readonly from: string;
35080
35148
  }) => Effect.Effect<{
35081
- readonly _tag: "not-installed";
35082
35149
  readonly entry?: never;
35150
+ readonly _tag: "not-installed";
35083
35151
  } | {
35084
35152
  readonly _tag: "unchanged";
35085
35153
  readonly entry: Entry;
@@ -35118,5 +35186,5 @@ type DateTimeUtcFromMillis = import__codeworksh_plugin_schema.DateTimeUtcFromMil
35118
35186
  type EventSchema = import__codeworksh_plugin_event.EventSchema;
35119
35187
  type SandboxError = import__codeworksh_schema_sandbox_errors.SandboxError;
35120
35188
  type optional = import__codeworksh_plugin_schema.optional;
35121
- export { Actor, control_d_exports as Control, host_d_exports as DaemonHost, db_d_exports as Database, DateTimeUtcFromMillis, schema_d_exports as DocumentSchema, event_d_exports as Event, list_d_exports as EventList, registry_d_exports as EventRegistry, EventSchema, git_d_exports as Git, git_d_exports$1 as GitDaemon, global_d_exports as Global, harness_d_exports as Harness, location_d_exports as Location, mcp_d_exports as Mcp, config_d_exports as McpConfig, error_d_exports as McpError, oauth_d_exports as McpOAuth, catalog_d_exports as ModelCatalog, index_d_exports as Plugin, project_d_exports as Project, schema_d_exports$1 as PromptSchema, run_d_exports as Runner, sandbox_d_exports as Sandbox, SandboxError, session_d_exports as Session, session_d_exports$1 as SessionStore, settings_d_exports as Settings, file_d_exports as SettingsFile, skills_d_exports as SkillsDaemon, state_d_exports as State, store_d_exports as Store, sync_d_exports as Sync, schema_d_exports$2 as ThreadSchema, thread_d_exports as ThreadStore, tool_d_exports as Tool, usage_d_exports as Usage, schema_d_exports$3 as UsageSchema, optional };
35189
+ export { Actor, Connector, control_d_exports as Control, host_d_exports as DaemonHost, db_d_exports as Database, DateTimeUtcFromMillis, schema_d_exports as DocumentSchema, event_d_exports as Event, list_d_exports as EventList, registry_d_exports as EventRegistry, EventSchema, git_d_exports as Git, git_d_exports$1 as GitDaemon, global_d_exports as Global, harness_d_exports as Harness, location_d_exports as Location, mcp_d_exports as Mcp, config_d_exports as McpConfig, error_d_exports as McpError, oauth_d_exports as McpOAuth, catalog_d_exports as ModelCatalog, cimd_d_exports as OAuthCimd, index_d_exports as Plugin, project_d_exports as Project, schema_d_exports$1 as PromptSchema, run_d_exports as Runner, sandbox_d_exports as Sandbox, SandboxError, session_d_exports as Session, session_d_exports$1 as SessionStore, settings_d_exports as Settings, file_d_exports as SettingsFile, skills_d_exports as SkillsDaemon, state_d_exports as State, store_d_exports as Store, sync_d_exports as Sync, schema_d_exports$2 as ThreadSchema, thread_d_exports as ThreadStore, tool_d_exports as Tool, usage_d_exports as Usage, schema_d_exports$3 as UsageSchema, optional };
35122
35190
  //# sourceMappingURL=effect.d.mts.map