@archastro/sdk
    Preparing search index...

    Class UserThreadResource

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Create a thread for a user Creates a new thread owned by the specified user. The authenticated caller must have access to the target user's account; a 403 is returned otherwise. An automatic welcome message is sent into the thread upon creation unless skip_welcome_message is set to true. The thread is immediately visible to the owning user and any members added at creation time.

      Parameters

      • user: string

        User ID (usr_...) whose threads should be listed.

      • input: {
            skip_welcome_message?: boolean;
            thread: {
                acl?: {
                    add?: {
                        actions: string[];
                        principal?: string;
                        principal_type: string;
                    }[];
                    add_denies?: {
                        actions: string[];
                        principal?: string;
                        principal_type: string;
                    }[];
                    denies?: {
                        actions: string[];
                        principal?: string;
                        principal_type: string;
                    }[];
                    grants?: {
                        actions: string[];
                        principal?: string;
                        principal_type: string;
                    }[];
                    preserve_denies?: boolean;
                    remove?: { principal?: string; principal_type: string }[];
                    remove_denies?: { principal?: string; principal_type: string }[];
                };
                create_legacy_agent?: boolean;
                description?: string;
                is_unlisted?: boolean;
                key?: string;
                kind?: "personal"
                | "feed";
                members?: { id: string; type: "user" | "agent" }[];
                metadata?: Record<string, unknown>;
                muted?: boolean;
                org_id?: string;
                profile_picture?: { data?: string; filename?: string; mime_type?: string };
                settings?: { agent_enabled?: boolean | null };
                slug?: string;
                title?: string;
                visibility?: "org" | "team" | "private" | "restricted";
            };
        }

        Request body.

        • Optionalskip_welcome_message?: boolean

          When true, suppresses the automatic welcome message that is otherwise sent into the thread on creation. Defaults to false.

        • thread: {
              acl?: {
                  add?: { actions: string[]; principal?: string; principal_type: string }[];
                  add_denies?: {
                      actions: string[];
                      principal?: string;
                      principal_type: string;
                  }[];
                  denies?: { actions: string[]; principal?: string; principal_type: string }[];
                  grants?: { actions: string[]; principal?: string; principal_type: string }[];
                  preserve_denies?: boolean;
                  remove?: { principal?: string; principal_type: string }[];
                  remove_denies?: { principal?: string; principal_type: string }[];
              };
              create_legacy_agent?: boolean;
              description?: string;
              is_unlisted?: boolean;
              key?: string;
              kind?: "personal"
              | "feed";
              members?: { id: string; type: "user" | "agent" }[];
              metadata?: Record<string, unknown>;
              muted?: boolean;
              org_id?: string;
              profile_picture?: { data?: string; filename?: string; mime_type?: string };
              settings?: { agent_enabled?: boolean | null };
              slug?: string;
              title?: string;
              visibility?: "org" | "team" | "private" | "restricted";
          }

          Attributes for the new thread. See ThreadCreateParams for the full set of accepted fields.

      Returns Promise<Thread>

      The newly created thread object.

    • Create a private thread from a template Creates a private thread, installs the template's agent once per user, and atomically adds its members and a dedicated E2B computer. Requires devbox_access. The computer starts pending and provisions asynchronously. key is prefixed by the template namespace and is unique for the user. Replays return 200 and never provision another computer or resend the first message; creation returns 201. Initial-message delivery occurs after commit; a delivery failure is returned as first_message_error so the caller can resend it. computer is optional and applies on creation only: a replay with the same key returns the original thread and computer, ignoring any different computer, exactly like title and first_message. Invalid computer input returns 422 invalid_parameters before anything is created; a provider this deployment has no credentials for returns 422 provider_unavailable. tags is optional and is written in the same transaction that creates the thread, so a thread never exists without them; a replay returns the stored tags and ignores tags in its body. Invalid tags return 422 invalid_parameters before anything is created. Unknown templates return 422 unknown_thread_template; installation failures return 502 agent_install_failed. Computer config and credentials are never returned. Personal templates retain their existing behavior. Standard, private templates require shared-thread creation to be enabled and may supply discovery/join ACL grants. Without grants, the thread stays closed to discovery and self-join. Their new computers use the organization's GitHub App for any repository its installation can reach, including permission to push branches and create pull requests. computer.repositories chooses the checkouts made at setup, not which repositories the computer can reach. They receive model-only ArchDev workspace authentication and do not inherit personal GitHub credentials, Intern access or repository environment bundles. Shared computers do not currently support the devbox provider.

      Parameters

      • user: string

        User ID (usr_...) whose threads should be listed.

      • input: {
            computer?: Record<string, unknown>;
            first_message?: string;
            key?: string;
            tags?: string[];
            template: string;
            title?: string;
        }

        Request body.

        • Optionalcomputer?: Record<string, unknown>

          Optional computer choice, applied on creation only: provider (sprites, vercel, e2b or devbox; defaults to the template's) and repositories (0 to 16 {repository: owner/name, ref: optional}; the first is the primary working directory and may instead carry create: {private: boolean} to create an initialized GitHub repository asynchronously as the owner; private defaults to true; create cannot accompany ref).

        • Optionalfirst_message?: string

          Optional first user message, posted only on creation.

        • Optionalkey?: string

          Required nonempty client idempotency key.

        • Optionaltags?: string[]

          Optional tags stored with the thread on creation, in the same transaction (0 to 20; the format of POST /threads/:thread/tags, so a project id such as prj_… is a valid tag). Ignored on replay: the stored tags are returned.

        • template: string

          Thread template lookup key.

        • Optionaltitle?: string

          Title for the new thread.

      Returns Promise<Record<string, unknown>>

      Thread fields plus agent and computers summaries, and optional first_message_error.

    • List threads for a user Returns all threads visible to the specified user. The authenticated caller must have access to the target user's account; a 403 is returned otherwise. Pass one or more agent IDs to narrow results to threads where at least one of the listed agents is also a member — useful for displaying every thread a user shares with a particular agent. Pass a structured metadata expression to narrow results by thread metadata; it supports nested paths, contains, exists, and and / or / not composition. The older filter objects match one top-level metadata key/value pair each and are still accepted. Pass one or more tags to keep only threads carrying at least one of them. All narrowings may be combined in a single request. Results are returned as a flat array; no cursor-based pagination is applied. Threads are ordered with default threads first, then by most recent activity (newest first), each carrying a last_activity timestamp.

      Parameters

      • user: string

        User ID (usr_...) whose threads should be listed.

      • Optionalparams: {
            agent?: string[];
            filter?: { key: string; type: string; value: string }[];
            include?: "work_summary"[];
            metadata?: {
                clause?: Record<string, unknown>;
                clauses?: Record<string, unknown>[];
                key?: string;
                operator?: "and" | "or" | "eq" | "contains" | "exists" | "not";
                path?: string[];
                type?: string;
                value?: unknown;
            };
            tags?: string[];
        }

        Query parameters.

        • Optionalagent?: string[]

          Array of agent user IDs (usr_...). When provided, only threads where at least one of the listed agents is also a member are returned. Omit or pass an empty array to return all threads regardless of agent membership.

        • Optionalfilter?: { key: string; type: string; value: string }[]

          Array of metadata filter objects. Each filter matches threads whose metadata map contains the specified key/value pair. All filters must match (logical AND). Omit to return threads regardless of metadata.

        • Optionalinclude?: "work_summary"[]

          Optional enrichments. work_summary returns viewer-visible hand-off counts for owned threads.

        • Optionalmetadata?: {
              clause?: Record<string, unknown>;
              clauses?: Record<string, unknown>[];
              key?: string;
              operator?: "and" | "or" | "eq" | "contains" | "exists" | "not";
              path?: string[];
              type?: string;
              value?: unknown;
          }

          Structured metadata filter expression, JSON-encoded. Only threads whose metadata satisfies the expression are returned.

        • Optionaltags?: string[]

          Optional: only return threads tagged with at least one of these tags (OR-match). Repeated query params, e.g. ?tags[]=blocked&tags[]=needs-review.

      Returns Promise<
          {
              data: {
                  acl?: | {
                      add?: {
                          actions: string[];
                          principal?: string;
                          principal_type: string;
                      }[];
                      add_denies?: {
                          actions: string[];
                          principal?: string;
                          principal_type: string;
                      }[];
                      denies?: {
                          actions: string[];
                          principal?: string;
                          principal_type: string;
                      }[];
                      grants?: {
                          actions: string[];
                          principal?: string;
                          principal_type: string;
                      }[];
                      preserve_denies?: boolean;
                      remove?: { principal?: string; principal_type: string }[];
                      remove_denies?: { principal?: string; principal_type: string }[];
                  }
                  | null;
                  agent_user?: string
                  | null;
                  created_at?: string;
                  creator?:
                      | string
                      | {
                          alias?: string
                          | null;
                          app?: string | null;
                          app_name?: string | null;
                          created_by_agent_user?: string | null;
                          created_by_developer?: string | null;
                          created_by_org?: string | null;
                          created_by_team?: string | null;
                          created_by_user?: string | null;
                          email?: string | null;
                          id: string;
                          is_system_user?: boolean;
                          metadata?: Record<string, unknown>;
                          name?: string | null;
                          org?: string | null;
                          org_name?: string | null;
                          org_role?: string | null;
                          org_slug?: string | null;
                          sandbox?: string | null;
                          sandbox_name?: string | null;
                      }
                      | null;
                  description?: string
                  | null;
                  id: string;
                  is_channel?: boolean;
                  is_default?: boolean;
                  is_transient?: boolean;
                  is_unlisted?: boolean;
                  key?: string | null;
                  kind?: string | null;
                  last_activity?: string | null;
                  last_message_preview?: string | null;
                  last_message_sender?: string | null;
                  latest_plan?: { id: string; title: string } | null;
                  metadata?: Record<string, unknown> | null;
                  muted?: boolean;
                  org?: string | null;
                  parent_message?:
                      | {
                          acl?: | {
                              add?: { actions: ...; principal?: ...; principal_type: ... }[];
                              add_denies?: { actions: ...; principal?: ...; principal_type: ... }[];
                              denies?: { actions: ...; principal?: ...; principal_type: ... }[];
                              grants?: { actions: ...; principal?: ...; principal_type: ... }[];
                              preserve_denies?: boolean;
                              remove?: { principal?: ...; principal_type: ... }[];
                              remove_denies?: { principal?: ...; principal_type: ... }[];
                          }
                          | null;
                          actors?: {
                              alias?: string
                              | null;
                              id?: string | null;
                              name?: string | null;
                              profile_picture?:
                                  | {
                                      content_url?: ...;
                                      file?: ...;
                                      height?: ...;
                                      media?: ...;
                                      mime_type?: ...;
                                      refresh_url?: ...;
                                      url?: ...;
                                      width?: ...;
                                  }
                                  | null;
                          }[];
                          agent?: string
                          | null;
                          agent_mode?: "cli" | "embedded" | null;
                          attachments?: {
                              content_type?: string | null;
                              description?: string | null;
                              filename?: string | null;
                              height?: number | null;
                              id: string;
                              image_height?: number | null;
                              image_source?:
                                  | {
                                      content_url?: ...;
                                      file?: ...;
                                      height?: ...;
                                      media?: ...;
                                      mime_type?: ...;
                                      refresh_url?: ...;
                                      url?: ...;
                                      width?: ...;
                                  }
                                  | null;
                              image_url?: string
                              | null;
                              image_width?: number | null;
                              key?: string | null;
                              media_type?: string;
                              name?: string | null;
                              object?: Record<(...), (...)>;
                              title?: string | null;
                              type: string;
                              url?: string | null;
                              variants?: (...)[];
                              version?: number | null;
                              width?: number | null;
                          }[];
                          branched_thread?: string
                          | null;
                          content?: string | null;
                          context?: {
                              attributes?: Record<(...), (...)>;
                              content?: string | null;
                              title?: string | null;
                              type: string;
                          }[];
                          created_at?: string;
                          has_replies?: boolean;
                          id: string;
                          idempotency_key?: string
                          | null;
                          is_deleted?: boolean;
                          legacy_agent?: string | null;
                          metadata?: Record<string, unknown>;
                          org?: string | null;
                          reactions?: {
                              payload?: Record<(...), (...)>;
                              type: string;
                              user?: string;
                          }[];
                          rendering_mode?: string
                          | null;
                          replies?: Record<string, unknown>[];
                          replies_after_cursor?: string | null;
                          replies_before_cursor?: string | null;
                          reply_count?: number;
                          reply_to?: Record<string, unknown> | null;
                          root_message_id?: string | null;
                          sandbox?: string | null;
                          team?: string | null;
                          thread?: string;
                          type?: string | null;
                          user?:
                              | string
                              | {
                                  alias?: string
                                  | null;
                                  app?: string | null;
                                  app_name?: string | null;
                                  created_by_agent_user?: string | null;
                                  created_by_developer?: string | null;
                                  created_by_org?: string | null;
                                  created_by_team?: string | null;
                                  created_by_user?: string | null;
                                  email?: string | null;
                                  id: string;
                                  is_system_user?: boolean;
                                  metadata?: Record<string, unknown>;
                                  name?: string | null;
                                  org?: string | null;
                                  org_name?: string | null;
                                  org_role?: string | null;
                                  org_slug?: string | null;
                                  sandbox?: string | null;
                                  sandbox_name?: string | null;
                              }
                              | null;
                          visibility?: "default"
                          | "private";
                      }
                      | null;
                  participant?: string[];
                  participants?: {
                      alias?: string
                      | null;
                      app?: string | null;
                      app_name?: string | null;
                      created_by_agent_user?: string | null;
                      created_by_developer?: string | null;
                      created_by_org?: string | null;
                      created_by_team?: string | null;
                      created_by_user?: string | null;
                      email?: string | null;
                      id: string;
                      is_system_user?: boolean;
                      metadata?: Record<string, unknown>;
                      name?: string | null;
                      org?: string | null;
                      org_name?: string | null;
                      org_role?: string | null;
                      org_slug?: string | null;
                      sandbox?: string | null;
                      sandbox_name?: string | null;
                  }[];
                  participating_actor?: string[];
                  participating_agents?: | {
                      acl?: | {
                          add?: (...)[];
                          add_denies?: (...)[];
                          denies?: (...)[];
                          grants?: (...)[];
                          preserve_denies?: boolean;
                          remove?: (...)[];
                          remove_denies?: (...)[];
                      }
                      | null;
                      app?: string;
                      created_at?: string;
                      default_model?: string
                      | null;
                      description?: string | null;
                      email?: string | null;
                      id: string;
                      identity?: string | null;
                      last_applied_template_config?: string | null;
                      lookup_key?: string | null;
                      metadata?: Record<string, unknown>;
                      name?: string;
                      org?: string | null;
                      org_name?: string | null;
                      originator?: string | null;
                      phone_number?: string | null;
                      sandbox?: string | null;
                      source_solution?:
                          | {
                              current_solution?: {
                                  category_keys?: ...;
                                  created_at?: ...;
                                  description?: ...;
                                  events?: ...;
                                  id: ...;
                                  image_url?: ...;
                                  installed_config_ids: ...;
                                  kind: ...;
                                  latest_solution?: ...;
                                  latest_version?: ...;
                                  lookup_key?: ...;
                                  metadata?: ...;
                                  name?: ...;
                                  org?: ...;
                                  org_logo?: ...;
                                  org_name?: ...;
                                  org_slug?: ...;
                                  owners: ...;
                                  readme_url?: ...;
                                  screenshot_urls?: ...;
                                  solution_id?: ...;
                                  solution_version?: ...;
                                  tag_keys?: ...;
                                  template_kind?: ...;
                                  templates: ...;
                                  updated_at?: ...;
                                  upgrade_available: ...;
                                  virtual_path?: ...;
                              };
                              solution: {
                                  category_keys?: (...)
                                  | (...);
                                  created_at?: (...) | (...);
                                  description?: (...) | (...) | (...);
                                  events?: (...) | (...);
                                  id: string;
                                  image_url?: (...) | (...) | (...);
                                  installed_config_ids: (...)[];
                                  kind: string;
                                  latest_solution?: (...) | (...) | (...);
                                  latest_version?: (...) | (...) | (...);
                                  lookup_key?: (...) | (...) | (...);
                                  metadata?: (...) | (...);
                                  name?: (...) | (...) | (...);
                                  org?: (...) | (...) | (...);
                                  org_logo?: (...) | (...) | (...);
                                  org_name?: (...) | (...) | (...);
                                  org_slug?: (...) | (...) | (...);
                                  owners: (...)[];
                                  readme_url?: (...) | (...) | (...);
                                  screenshot_urls?: (...) | (...);
                                  solution_id?: (...) | (...) | (...);
                                  solution_version?: (...) | (...) | (...);
                                  tag_keys?: (...) | (...);
                                  template_kind?: (...) | (...) | (...);
                                  templates: (...)[];
                                  updated_at?: (...) | (...);
                                  upgrade_available: boolean;
                                  virtual_path?: (...) | (...) | (...);
                              };
                              template: {
                                  created_at?: (...)
                                  | (...);
                                  description?: (...) | (...) | (...);
                                  display_name?: (...) | (...) | (...);
                                  id: string;
                                  kind: string;
                                  lookup_key?: (...) | (...) | (...);
                                  name?: (...) | (...) | (...);
                                  updated_at?: (...) | (...);
                                  virtual_path?: (...) | (...) | (...);
                              };
                          }
                          | null;
                      team?: string
                      | null;
                      template_upgrade_available?: boolean | null;
                      updated_at?: string;
                      user?: string | null;
                  }[]
                  | null;
                  role?: string
                  | null;
                  sandbox?: string | null;
                  settings?: { agent_enabled?: boolean | null };
                  slug?: string | null;
                  sub_threads?: Record<string, unknown>[] | null;
                  tags?: string[];
                  team?: string | null;
                  thread_template_key?: string | null;
                  title?: string | null;
                  ttl?: string | null;
                  unread_count?: number | null;
                  updated_at?: string;
                  user?: string | null;
                  visibility: "org" | "team" | "private" | "restricted";
                  work_summary?: Record<string, unknown>;
              }[];
          },
      >

      Successful response