@codeworksh/harness 0.9.0-canary.165.2.g336229f9 → 0.9.0-canary.167.1.g6ddcc8db

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,5 +1,6 @@
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
+ import { Actor } from "@codeworksh/schema/actor";
3
4
  import { Config as Config$1, Daemon, Events, Plugin, PluginOptions, PluginRef, PluginRegistry, PromptResolver, SharedPluginContext } from "@codeworksh/plugin/plugin";
4
5
  import { Cause, Config, Context, DateTime, Duration, Effect, JsonSchema, Layer, Option, PubSub, Ref, Schema, Scope, Stream } from "effect";
5
6
  import { Delivery, InterruptReason, PromptConflictError, RelinkError, RelinkReason, SessionLinkedSpaceNotFoundError, SessionNotFoundError } from "@codeworksh/schema/session";
@@ -32448,25 +32449,12 @@ declare const systemMessage: <T>(messageId: string, created: number, changes: {
32448
32449
  };
32449
32450
  /** A message's parts; a system message has none. */
32450
32451
  declare const parts: (message: Message.Message) => ({
32451
- type: "text";
32452
- text: string;
32453
- textSignature?: string;
32454
- } | {
32455
- type: "image";
32456
- data: string;
32457
- mimeType: string;
32458
- } | {
32459
- type: "thinking";
32460
- thinking: string;
32461
- thinkingSignature?: string;
32462
- redacted?: boolean;
32463
- } | {
32464
32452
  arguments: Record<string, any>;
32465
32453
  callID: string;
32466
32454
  name: string;
32467
32455
  namespace?: string;
32468
- partial?: {
32469
- content?: ({
32456
+ result: {
32457
+ content: ({
32470
32458
  type: "text";
32471
32459
  text: string;
32472
32460
  textSignature?: string;
@@ -32476,8 +32464,9 @@ declare const parts: (message: Message.Message) => ({
32476
32464
  mimeType: string;
32477
32465
  })[];
32478
32466
  details?: any;
32467
+ isError: false;
32479
32468
  };
32480
- status: "running";
32469
+ status: "completed";
32481
32470
  thoughtSignature?: string;
32482
32471
  time: {
32483
32472
  start: number;
@@ -32500,9 +32489,9 @@ declare const parts: (message: Message.Message) => ({
32500
32489
  mimeType: string;
32501
32490
  })[];
32502
32491
  details?: any;
32503
- isError: false;
32492
+ isError: true;
32504
32493
  };
32505
- status: "completed";
32494
+ status: "error";
32506
32495
  thoughtSignature?: string;
32507
32496
  time: {
32508
32497
  start: number;
@@ -32527,7 +32516,7 @@ declare const parts: (message: Message.Message) => ({
32527
32516
  details?: any;
32528
32517
  isError: true;
32529
32518
  };
32530
- status: "error";
32519
+ status: "skipped";
32531
32520
  thoughtSignature?: string;
32532
32521
  time: {
32533
32522
  start: number;
@@ -32552,20 +32541,33 @@ declare const parts: (message: Message.Message) => ({
32552
32541
  details?: any;
32553
32542
  isError: true;
32554
32543
  };
32555
- status: "skipped";
32544
+ status: "aborted";
32556
32545
  thoughtSignature?: string;
32557
32546
  time: {
32558
32547
  start: number;
32559
32548
  end: number;
32560
32549
  };
32561
32550
  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;
32562
32564
  } | {
32563
32565
  arguments: Record<string, any>;
32564
32566
  callID: string;
32565
32567
  name: string;
32566
32568
  namespace?: string;
32567
- result: {
32568
- content: ({
32569
+ partial?: {
32570
+ content?: ({
32569
32571
  type: "text";
32570
32572
  text: string;
32571
32573
  textSignature?: string;
@@ -32575,9 +32577,8 @@ declare const parts: (message: Message.Message) => ({
32575
32577
  mimeType: string;
32576
32578
  })[];
32577
32579
  details?: any;
32578
- isError: true;
32579
32580
  };
32580
- status: "aborted";
32581
+ status: "running";
32581
32582
  thoughtSignature?: string;
32582
32583
  time: {
32583
32584
  start: number;
@@ -32753,25 +32754,12 @@ declare const decodeMessage: (hydrated: HydratedEntry) => Effect.Effect<{
32753
32754
  completed: number;
32754
32755
  };
32755
32756
  parts: ({
32756
- type: "text";
32757
- text: string;
32758
- textSignature?: string;
32759
- } | {
32760
- type: "image";
32761
- data: string;
32762
- mimeType: string;
32763
- } | {
32764
- type: "thinking";
32765
- thinking: string;
32766
- thinkingSignature?: string;
32767
- redacted?: boolean;
32768
- } | {
32769
32757
  arguments: Record<string, any>;
32770
32758
  callID: string;
32771
32759
  name: string;
32772
32760
  namespace?: string;
32773
- partial?: {
32774
- content?: ({
32761
+ result: {
32762
+ content: ({
32775
32763
  type: "text";
32776
32764
  text: string;
32777
32765
  textSignature?: string;
@@ -32781,8 +32769,9 @@ declare const decodeMessage: (hydrated: HydratedEntry) => Effect.Effect<{
32781
32769
  mimeType: string;
32782
32770
  })[];
32783
32771
  details?: any;
32772
+ isError: false;
32784
32773
  };
32785
- status: "running";
32774
+ status: "completed";
32786
32775
  thoughtSignature?: string;
32787
32776
  time: {
32788
32777
  start: number;
@@ -32805,9 +32794,9 @@ declare const decodeMessage: (hydrated: HydratedEntry) => Effect.Effect<{
32805
32794
  mimeType: string;
32806
32795
  })[];
32807
32796
  details?: any;
32808
- isError: false;
32797
+ isError: true;
32809
32798
  };
32810
- status: "completed";
32799
+ status: "error";
32811
32800
  thoughtSignature?: string;
32812
32801
  time: {
32813
32802
  start: number;
@@ -32832,7 +32821,7 @@ declare const decodeMessage: (hydrated: HydratedEntry) => Effect.Effect<{
32832
32821
  details?: any;
32833
32822
  isError: true;
32834
32823
  };
32835
- status: "error";
32824
+ status: "skipped";
32836
32825
  thoughtSignature?: string;
32837
32826
  time: {
32838
32827
  start: number;
@@ -32857,20 +32846,33 @@ declare const decodeMessage: (hydrated: HydratedEntry) => Effect.Effect<{
32857
32846
  details?: any;
32858
32847
  isError: true;
32859
32848
  };
32860
- status: "skipped";
32849
+ status: "aborted";
32861
32850
  thoughtSignature?: string;
32862
32851
  time: {
32863
32852
  start: number;
32864
32853
  end: number;
32865
32854
  };
32866
32855
  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;
32867
32869
  } | {
32868
32870
  arguments: Record<string, any>;
32869
32871
  callID: string;
32870
32872
  name: string;
32871
32873
  namespace?: string;
32872
- result: {
32873
- content: ({
32874
+ partial?: {
32875
+ content?: ({
32874
32876
  type: "text";
32875
32877
  text: string;
32876
32878
  textSignature?: string;
@@ -32880,9 +32882,8 @@ declare const decodeMessage: (hydrated: HydratedEntry) => Effect.Effect<{
32880
32882
  mimeType: string;
32881
32883
  })[];
32882
32884
  details?: any;
32883
- isError: true;
32884
32885
  };
32885
- status: "aborted";
32886
+ status: "running";
32886
32887
  thoughtSignature?: string;
32887
32888
  time: {
32888
32889
  start: number;
@@ -35117,5 +35118,5 @@ type DateTimeUtcFromMillis = import__codeworksh_plugin_schema.DateTimeUtcFromMil
35117
35118
  type EventSchema = import__codeworksh_plugin_event.EventSchema;
35118
35119
  type SandboxError = import__codeworksh_schema_sandbox_errors.SandboxError;
35119
35120
  type optional = import__codeworksh_plugin_schema.optional;
35120
- export { 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 };
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 };
35121
35122
  //# sourceMappingURL=effect.d.mts.map
package/effect.mjs CHANGED
@@ -4,6 +4,7 @@ import { a as decode, c as importModule, d as share, l as lendResolve, n as dime
4
4
  import "./daytona-20WBBhAP.mjs";
5
5
  import "./vercel-CBQ-y-SG.mjs";
6
6
  import { createRequire } from "node:module";
7
+ import { Actor, Actor as Actor$1 } from "@codeworksh/schema/actor";
7
8
  import { Daemon } from "@codeworksh/plugin/plugin";
8
9
  import { quote } from "@codeworksh/plugin/sandbox/shell";
9
10
  import { Cause, Clock, Config, Context, Crypto, Data, DateTime, Deferred, Duration, Effect, Exit, Fiber, FiberSet, FileSystem, Layer, LayerMap, Metric, Option, Path, Predicate, PubSub, Queue, Random, RcMap, Ref, References, Result, Schedule, Schema, SchemaIssue, Scope, Semaphore, Stream, String as String$1 } from "effect";
@@ -11906,8 +11907,16 @@ const layer$9 = Layer.effect(Service$5, Effect.gen(function* () {
11906
11907
  });
11907
11908
  return admitted;
11908
11909
  });
11909
- const prompt = Effect.fn("Control.prompt")((input) => Effect.uninterruptible(admit(input).pipe(Effect.tap((admitted) => wake(admitted.threadId)))));
11910
+ const annotateActor = Effect.gen(function* () {
11911
+ const actor = yield* Actor$1.Current;
11912
+ yield* Effect.annotateCurrentSpan({
11913
+ "codework.actor.id": actor.id,
11914
+ "codework.actor.scope": actor.scope
11915
+ });
11916
+ });
11917
+ const prompt = Effect.fn("Control.prompt")((input) => Effect.uninterruptible(annotateActor.pipe(Effect.andThen(admit(input)), Effect.tap((admitted) => wake(admitted.threadId)))));
11910
11918
  const run = Effect.fn("Control.run")((input) => Effect.uninterruptibleMask((restore) => Effect.gen(function* () {
11919
+ yield* annotateActor;
11911
11920
  const admitted = yield* admit(input);
11912
11921
  yield* wake(admitted.threadId);
11913
11922
  yield* restore(execution.awaitIdle(admitted.threadId));
@@ -11949,6 +11958,7 @@ const layer$9 = Layer.effect(Service$5, Effect.gen(function* () {
11949
11958
  }).pipe(Effect.catchDefect((defect) => isThreadNotFound(defect) ? Effect.void : Effect.die(defect)));
11950
11959
  });
11951
11960
  const interrupt = Effect.fn("Control.interrupt")((threadId, options) => Effect.uninterruptible(Effect.gen(function* () {
11961
+ yield* annotateActor;
11952
11962
  const reason = options?.reason ?? "user";
11953
11963
  if (reason === "user") yield* requestStop(threadId);
11954
11964
  if (yield* execution.interrupt(threadId, reason)) {
@@ -17624,10 +17634,13 @@ const layer$3 = (options = {}) => Layer.effect(Service$10, Effect.gen(function*
17624
17634
  const hasSteer = yield* inputs.hasPending(input.threadId, "steer");
17625
17635
  const hasFollowUp = yield* inputs.hasPending(input.threadId, "followUp");
17626
17636
  if (!input.force && !hasSteer && !hasFollowUp) return "drained";
17637
+ const actor = yield* Actor$1.Current;
17627
17638
  yield* Effect.annotateCurrentSpan({
17628
17639
  "gen_ai.operation.name": "invoke_agent",
17629
17640
  "gen_ai.agent.name": "codework",
17630
- "gen_ai.conversation.id": input.threadId
17641
+ "gen_ai.conversation.id": input.threadId,
17642
+ "codework.actor.id": actor.id,
17643
+ "codework.actor.scope": actor.scope
17631
17644
  });
17632
17645
  let promotion = (input.recovered === true || input.force) && hasFollowUp && (yield* context.assemble(input.threadId).pipe(Effect.map((assembled) => assembled.messages.length > 0 && !leafAnswered(assembled)))) ? "postTools" : hasSteer || hasFollowUp ? "final" : void 0;
17633
17646
  /** The steers and the oldest follow-up, in admission order: what a run promotes first. */
@@ -18880,6 +18893,6 @@ var DateTimeUtcFromMillis = schema_exports$12.DateTimeUtcFromMillis;
18880
18893
  var EventSchema = schema_exports$9.EventSchema;
18881
18894
  var SandboxError = errors_exports.SandboxError;
18882
18895
  var optional = schema_exports$12.optional;
18883
- export { control_exports as Control, host_exports as DaemonHost, db_exports as Database, DateTimeUtcFromMillis, schema_exports as DocumentSchema, event_exports as Event, list_exports as EventList, registry_exports as EventRegistry, EventSchema, git_exports as Git, git_exports$1 as GitDaemon, global_exports as Global, harness_exports as Harness, location_exports as Location, mcp_exports as Mcp, config_exports as McpConfig, error_exports as McpError, oauth_exports as McpOAuth, catalog_exports as ModelCatalog, plugin_exports as Plugin, project_exports as Project, schema_exports$1 as PromptSchema, run_exports as Runner, sandbox_exports as Sandbox, SandboxError, session_exports as Session, session_exports$1 as SessionStore, settings_exports as Settings, file_exports as SettingsFile, skills_exports as SkillsDaemon, state_exports as State, store_exports as Store, sync_exports as Sync, schema_exports$2 as ThreadSchema, thread_exports as ThreadStore, tool_exports as Tool, usage_exports as Usage, schema_exports$3 as UsageSchema, expandTilde, optional };
18896
+ export { Actor, control_exports as Control, host_exports as DaemonHost, db_exports as Database, DateTimeUtcFromMillis, schema_exports as DocumentSchema, event_exports as Event, list_exports as EventList, registry_exports as EventRegistry, EventSchema, git_exports as Git, git_exports$1 as GitDaemon, global_exports as Global, harness_exports as Harness, location_exports as Location, mcp_exports as Mcp, config_exports as McpConfig, error_exports as McpError, oauth_exports as McpOAuth, catalog_exports as ModelCatalog, plugin_exports as Plugin, project_exports as Project, schema_exports$1 as PromptSchema, run_exports as Runner, sandbox_exports as Sandbox, SandboxError, session_exports as Session, session_exports$1 as SessionStore, settings_exports as Settings, file_exports as SettingsFile, skills_exports as SkillsDaemon, state_exports as State, store_exports as Store, sync_exports as Sync, schema_exports$2 as ThreadSchema, thread_exports as ThreadStore, tool_exports as Tool, usage_exports as Usage, schema_exports$3 as UsageSchema, expandTilde, optional };
18884
18897
 
18885
18898
  //# sourceMappingURL=effect.mjs.map