openmates 0.15.0-alpha.21 → 0.15.0-alpha.22
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/dist/{chunk-GTFUGLRD.js → chunk-47BFVCB4.js} +142 -3
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +82 -9
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -14601,6 +14601,110 @@ var OpenMatesTasks = class {
|
|
|
14601
14601
|
this.client = client;
|
|
14602
14602
|
}
|
|
14603
14603
|
async list(filters = {}) {
|
|
14604
|
+
return (await this.listInternal(filters)).map(toPublicTask);
|
|
14605
|
+
}
|
|
14606
|
+
async listDecrypted(filters = {}) {
|
|
14607
|
+
return this.list(filters);
|
|
14608
|
+
}
|
|
14609
|
+
async show(id, filters = {}) {
|
|
14610
|
+
return toPublicTask(await this.resolve(id, filters));
|
|
14611
|
+
}
|
|
14612
|
+
async create(input) {
|
|
14613
|
+
const masterKey = await this.client.masterKey();
|
|
14614
|
+
const created = await this.createRaw(await buildCreateUserTaskInput(masterKey, input));
|
|
14615
|
+
return toPublicTask(await decryptUserTask(created, masterKey));
|
|
14616
|
+
}
|
|
14617
|
+
async update(id, input, filters = {}) {
|
|
14618
|
+
let task = await this.resolve(id, filters);
|
|
14619
|
+
const masterKey = await this.client.masterKey();
|
|
14620
|
+
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
14621
|
+
try {
|
|
14622
|
+
const updated = await this.updateRaw(task.taskId, await buildUpdateUserTaskInput(task, masterKey, input));
|
|
14623
|
+
return toPublicTask(await decryptUserTask(updated, masterKey));
|
|
14624
|
+
} catch (error) {
|
|
14625
|
+
if (attempt > 0 || !isTaskVersionConflict(error)) throw error;
|
|
14626
|
+
await delay(1e3);
|
|
14627
|
+
task = await this.resolve(id, filters);
|
|
14628
|
+
}
|
|
14629
|
+
}
|
|
14630
|
+
throw new OpenMatesConfigError("Task update retry failed unexpectedly");
|
|
14631
|
+
}
|
|
14632
|
+
async edit(id, input, filters = {}) {
|
|
14633
|
+
return this.update(id, input, filters);
|
|
14634
|
+
}
|
|
14635
|
+
async start(id, filters = {}) {
|
|
14636
|
+
let task = await this.resolve(id, filters);
|
|
14637
|
+
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
14638
|
+
try {
|
|
14639
|
+
const started = await this.startAIRaw(task.taskId, {
|
|
14640
|
+
version: task.version,
|
|
14641
|
+
primary_chat_id: task.primaryChatId ?? void 0,
|
|
14642
|
+
linked_project_ids: task.linkedProjectIds,
|
|
14643
|
+
plaintext_title: task.title,
|
|
14644
|
+
plaintext_description: task.description,
|
|
14645
|
+
plaintext_latest_instruction: task.latestInstruction
|
|
14646
|
+
});
|
|
14647
|
+
return toPublicTask(await decryptUserTask(started, await this.client.masterKey()));
|
|
14648
|
+
} catch (error) {
|
|
14649
|
+
if (attempt > 0 || !isTaskVersionConflict(error)) throw error;
|
|
14650
|
+
await delay(1e3);
|
|
14651
|
+
task = await this.resolve(id, filters);
|
|
14652
|
+
}
|
|
14653
|
+
}
|
|
14654
|
+
throw new OpenMatesConfigError("Task start retry failed unexpectedly");
|
|
14655
|
+
}
|
|
14656
|
+
async startAI(id, filters = {}) {
|
|
14657
|
+
return this.start(id, filters);
|
|
14658
|
+
}
|
|
14659
|
+
async delete(id, options = {}) {
|
|
14660
|
+
requireConfirmed(options, "Deleting a task");
|
|
14661
|
+
let task = await this.resolve(id, options.filters ?? {});
|
|
14662
|
+
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
14663
|
+
try {
|
|
14664
|
+
return await this.client.delete(`/v1/user-tasks/${encodeURIComponent(task.taskId)}?version=${encodeURIComponent(String(task.version))}`);
|
|
14665
|
+
} catch (error) {
|
|
14666
|
+
if (attempt > 0 || !isTaskVersionConflict(error)) throw error;
|
|
14667
|
+
await delay(1e3);
|
|
14668
|
+
task = await this.resolve(id, options.filters ?? {});
|
|
14669
|
+
}
|
|
14670
|
+
}
|
|
14671
|
+
throw new OpenMatesConfigError("Task delete retry failed unexpectedly");
|
|
14672
|
+
}
|
|
14673
|
+
async done(id, filters = {}) {
|
|
14674
|
+
return this.actionById(id, "complete", {}, filters);
|
|
14675
|
+
}
|
|
14676
|
+
async complete(id, filters = {}) {
|
|
14677
|
+
return this.done(id, filters);
|
|
14678
|
+
}
|
|
14679
|
+
async block(id, reason, filters = {}) {
|
|
14680
|
+
return this.actionById(id, "block", { blocked_reason_code: reason }, filters);
|
|
14681
|
+
}
|
|
14682
|
+
async unblock(id, filters = {}) {
|
|
14683
|
+
return this.actionById(id, "unblock", {}, filters);
|
|
14684
|
+
}
|
|
14685
|
+
async skip(id, filters = {}) {
|
|
14686
|
+
return this.actionById(id, "skip", {}, filters);
|
|
14687
|
+
}
|
|
14688
|
+
async reorder(id, move, filters = {}) {
|
|
14689
|
+
let task = await this.resolve(id, filters);
|
|
14690
|
+
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
14691
|
+
try {
|
|
14692
|
+
const response = await this.client.request("/v1/user-tasks/reorder", {
|
|
14693
|
+
moves: [{ ...move, task_id: task.taskId, version: task.version }]
|
|
14694
|
+
});
|
|
14695
|
+
return (await decryptUserTasks(response.tasks ?? [], await this.client.masterKey())).map(toPublicTask);
|
|
14696
|
+
} catch (error) {
|
|
14697
|
+
if (attempt > 0 || !isTaskVersionConflict(error)) throw error;
|
|
14698
|
+
await delay(1e3);
|
|
14699
|
+
task = await this.resolve(id, filters);
|
|
14700
|
+
}
|
|
14701
|
+
}
|
|
14702
|
+
throw new OpenMatesConfigError("Task reorder retry failed unexpectedly");
|
|
14703
|
+
}
|
|
14704
|
+
async move(id, move, filters = {}) {
|
|
14705
|
+
return this.reorder(id, move, filters);
|
|
14706
|
+
}
|
|
14707
|
+
async listRaw(filters = {}) {
|
|
14604
14708
|
const response = await this.client.get(withQuery("/v1/user-tasks", {
|
|
14605
14709
|
status: filters.status,
|
|
14606
14710
|
chat_id: filters.chatId,
|
|
@@ -14608,22 +14712,57 @@ var OpenMatesTasks = class {
|
|
|
14608
14712
|
}));
|
|
14609
14713
|
return response.tasks ?? [];
|
|
14610
14714
|
}
|
|
14611
|
-
async
|
|
14715
|
+
async createRaw(input) {
|
|
14612
14716
|
const response = await this.client.request("/v1/user-tasks", input);
|
|
14613
14717
|
if (!response.task) throw new OpenMatesApiError(500, { detail: "User task response missing task" });
|
|
14614
14718
|
return response.task;
|
|
14615
14719
|
}
|
|
14616
|
-
async
|
|
14720
|
+
async updateRaw(taskId, input) {
|
|
14617
14721
|
const response = await this.client.patch(`/v1/user-tasks/${encodeURIComponent(taskId)}`, input);
|
|
14618
14722
|
if (!response.task) throw new OpenMatesApiError(500, { detail: "User task response missing task" });
|
|
14619
14723
|
return response.task;
|
|
14620
14724
|
}
|
|
14621
|
-
async
|
|
14725
|
+
async startAIRaw(taskId, input) {
|
|
14622
14726
|
const response = await this.client.request(`/v1/user-tasks/${encodeURIComponent(taskId)}/start-ai`, input);
|
|
14623
14727
|
if (!response.task) throw new OpenMatesApiError(500, { detail: "User task response missing task" });
|
|
14624
14728
|
return response.task;
|
|
14625
14729
|
}
|
|
14730
|
+
async listInternal(filters) {
|
|
14731
|
+
return decryptUserTasks(await this.listRaw(filters), await this.client.masterKey());
|
|
14732
|
+
}
|
|
14733
|
+
async resolve(id, filters) {
|
|
14734
|
+
return findTask(await this.listInternal(filters), id);
|
|
14735
|
+
}
|
|
14736
|
+
async actionRaw(taskId, action, input) {
|
|
14737
|
+
const response = await this.client.request(`/v1/user-tasks/${encodeURIComponent(taskId)}/${encodeURIComponent(action)}`, input);
|
|
14738
|
+
if (!response.task) throw new OpenMatesApiError(500, { detail: "User task response missing task" });
|
|
14739
|
+
return response.task;
|
|
14740
|
+
}
|
|
14741
|
+
async actionById(id, action, patch, filters) {
|
|
14742
|
+
let task = await this.resolve(id, filters);
|
|
14743
|
+
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
14744
|
+
try {
|
|
14745
|
+
const updated = await this.actionRaw(task.taskId, action, { version: task.version, ...patch });
|
|
14746
|
+
return toPublicTask(await decryptUserTask(updated, await this.client.masterKey()));
|
|
14747
|
+
} catch (error) {
|
|
14748
|
+
if (attempt > 0 || !isTaskVersionConflict(error)) throw error;
|
|
14749
|
+
await delay(1e3);
|
|
14750
|
+
task = await this.resolve(id, filters);
|
|
14751
|
+
}
|
|
14752
|
+
}
|
|
14753
|
+
throw new OpenMatesConfigError("Task action retry failed unexpectedly");
|
|
14754
|
+
}
|
|
14626
14755
|
};
|
|
14756
|
+
function toPublicTask(task) {
|
|
14757
|
+
const { encrypted: _encrypted, ...publicTask } = task;
|
|
14758
|
+
return publicTask;
|
|
14759
|
+
}
|
|
14760
|
+
function isTaskVersionConflict(error) {
|
|
14761
|
+
return error instanceof OpenMatesApiError && error.status === 409 && String(JSON.stringify(error.data)).includes("TASK_VERSION_CONFLICT");
|
|
14762
|
+
}
|
|
14763
|
+
function delay(ms) {
|
|
14764
|
+
return new Promise((resolve7) => setTimeout(resolve7, ms));
|
|
14765
|
+
}
|
|
14627
14766
|
var OpenMatesPlans = class {
|
|
14628
14767
|
client;
|
|
14629
14768
|
constructor(client) {
|
package/dist/cli.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -4800,6 +4800,50 @@ declare class GeneratedAppSkills {
|
|
|
4800
4800
|
readonly workflows: WorkflowsAppSkills;
|
|
4801
4801
|
}
|
|
4802
4802
|
|
|
4803
|
+
interface DecryptedUserTask {
|
|
4804
|
+
taskId: string;
|
|
4805
|
+
source?: string;
|
|
4806
|
+
shortId: string;
|
|
4807
|
+
title: string;
|
|
4808
|
+
description: string;
|
|
4809
|
+
tags: string[];
|
|
4810
|
+
latestInstruction: string;
|
|
4811
|
+
status: UserTaskStatus;
|
|
4812
|
+
assigneeType: UserTaskAssigneeType;
|
|
4813
|
+
assigneeHash: string | null;
|
|
4814
|
+
primaryChatId: string | null;
|
|
4815
|
+
linkedProjectIds: string[];
|
|
4816
|
+
planId: string | null;
|
|
4817
|
+
dueAt: number | null;
|
|
4818
|
+
priority: number;
|
|
4819
|
+
position: number;
|
|
4820
|
+
queueState: string;
|
|
4821
|
+
blockedReasonCode: string | null;
|
|
4822
|
+
aiExecutionState: string | null;
|
|
4823
|
+
readOnly?: boolean;
|
|
4824
|
+
version: number;
|
|
4825
|
+
encrypted: UserTaskRecord;
|
|
4826
|
+
}
|
|
4827
|
+
interface TaskCreateOptions {
|
|
4828
|
+
title: string;
|
|
4829
|
+
description?: string;
|
|
4830
|
+
status?: UserTaskStatus;
|
|
4831
|
+
assign?: string;
|
|
4832
|
+
chatId?: string | null;
|
|
4833
|
+
projectIds?: string[];
|
|
4834
|
+
planId?: string | null;
|
|
4835
|
+
dueAt?: number | null;
|
|
4836
|
+
}
|
|
4837
|
+
interface TaskUpdateOptions {
|
|
4838
|
+
title?: string;
|
|
4839
|
+
description?: string;
|
|
4840
|
+
status?: UserTaskStatus;
|
|
4841
|
+
assign?: string;
|
|
4842
|
+
chatId?: string | null;
|
|
4843
|
+
projectIds?: string[];
|
|
4844
|
+
planId?: string | null;
|
|
4845
|
+
}
|
|
4846
|
+
|
|
4803
4847
|
interface OpenMatesOptions {
|
|
4804
4848
|
apiKey?: string;
|
|
4805
4849
|
apiUrl?: string;
|
|
@@ -4913,6 +4957,14 @@ interface DraftRecord extends EncryptedDraftRecord {
|
|
|
4913
4957
|
markdown: string;
|
|
4914
4958
|
preview: string | null;
|
|
4915
4959
|
}
|
|
4960
|
+
type TaskListFilters = {
|
|
4961
|
+
status?: UserTaskStatus;
|
|
4962
|
+
chatId?: string;
|
|
4963
|
+
projectId?: string;
|
|
4964
|
+
};
|
|
4965
|
+
type TaskPlainCreateOptions = TaskCreateOptions;
|
|
4966
|
+
type TaskPlainUpdateOptions = TaskUpdateOptions;
|
|
4967
|
+
type TaskRecord = Omit<DecryptedUserTask, "encrypted">;
|
|
4916
4968
|
interface SdkSessionResponse {
|
|
4917
4969
|
user?: {
|
|
4918
4970
|
id?: string;
|
|
@@ -5147,14 +5199,35 @@ declare class OpenMatesProjects {
|
|
|
5147
5199
|
declare class OpenMatesTasks {
|
|
5148
5200
|
private readonly client;
|
|
5149
5201
|
constructor(client: OpenMates);
|
|
5150
|
-
list(filters?:
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
startAI(
|
|
5202
|
+
list(filters?: TaskListFilters): Promise<TaskRecord[]>;
|
|
5203
|
+
listDecrypted(filters?: TaskListFilters): Promise<TaskRecord[]>;
|
|
5204
|
+
show(id: string, filters?: TaskListFilters): Promise<TaskRecord>;
|
|
5205
|
+
create(input: TaskPlainCreateOptions): Promise<TaskRecord>;
|
|
5206
|
+
update(id: string, input: TaskPlainUpdateOptions, filters?: TaskListFilters): Promise<TaskRecord>;
|
|
5207
|
+
edit(id: string, input: TaskPlainUpdateOptions, filters?: TaskListFilters): Promise<TaskRecord>;
|
|
5208
|
+
start(id: string, filters?: TaskListFilters): Promise<TaskRecord>;
|
|
5209
|
+
startAI(id: string, filters?: TaskListFilters): Promise<TaskRecord>;
|
|
5210
|
+
delete(id: string, options?: ConfirmedMutationOptions & {
|
|
5211
|
+
filters?: TaskListFilters;
|
|
5212
|
+
}): Promise<{
|
|
5213
|
+
deleted?: boolean;
|
|
5214
|
+
task_id?: string;
|
|
5215
|
+
}>;
|
|
5216
|
+
done(id: string, filters?: TaskListFilters): Promise<TaskRecord>;
|
|
5217
|
+
complete(id: string, filters?: TaskListFilters): Promise<TaskRecord>;
|
|
5218
|
+
block(id: string, reason: string, filters?: TaskListFilters): Promise<TaskRecord>;
|
|
5219
|
+
unblock(id: string, filters?: TaskListFilters): Promise<TaskRecord>;
|
|
5220
|
+
skip(id: string, filters?: TaskListFilters): Promise<TaskRecord>;
|
|
5221
|
+
reorder(id: string, move: Omit<UserTaskReorderInput["moves"][number], "task_id" | "version">, filters?: TaskListFilters): Promise<TaskRecord[]>;
|
|
5222
|
+
move(id: string, move: Omit<UserTaskReorderInput["moves"][number], "task_id" | "version">, filters?: TaskListFilters): Promise<TaskRecord[]>;
|
|
5223
|
+
private listRaw;
|
|
5224
|
+
private createRaw;
|
|
5225
|
+
private updateRaw;
|
|
5226
|
+
private startAIRaw;
|
|
5227
|
+
private listInternal;
|
|
5228
|
+
private resolve;
|
|
5229
|
+
private actionRaw;
|
|
5230
|
+
private actionById;
|
|
5158
5231
|
}
|
|
5159
5232
|
declare class OpenMatesPlans {
|
|
5160
5233
|
private readonly client;
|
|
@@ -5324,4 +5397,4 @@ type AssistantFeedbackDecision = {
|
|
|
5324
5397
|
};
|
|
5325
5398
|
declare function buildAssistantFeedbackDecision(rating: number): AssistantFeedbackDecision;
|
|
5326
5399
|
|
|
5327
|
-
export { APP_SKILL_METADATA, ASSISTANT_FEEDBACK_REPORT_TITLE, ASSISTANT_FEEDBACK_THANKS, type ApiKeyCreateOptions, type ApiKeyCreateResult, type ApiKeyRecord, type AssistantFeedbackDecision, type AuthMethodsStatus, type AuthoritativeChatReconciliation, type BackupCodesResult, type BankTransferOrderDetails, type BankTransferStatus, type CachedChat, type CachedNewChatSuggestion, type ChatCreateOptions, type ChatListOptions, type ChatListPage, type ChatResponse, type CliSignupResult, type DecryptedDraft, type DecryptedEmbed, type DecryptedMemoryEntry, type DecryptedMessage, type DecryptedNewChatSuggestion, type DocsFile, type DocsFolder, type DocsSearchResult, type DocsTree, type DraftRecord, type EncryptedChatMetadata, type EncryptedDraft, type EncryptedDraftRecord, type FocusModeSelection, type GiftCardBankTransferStatus, INTEREST_TAG_IDS, type InterestTagId, MATE_NAMES, MEMORY_TYPE_REGISTRY, type MemoryFieldDef, type MemoryTypeDef, OpenMates, OpenMatesApiError, OpenMatesClient, type OpenMatesClientOptions, OpenMatesConfigError, type OpenMatesOptions, type OpenMatesSession, type ProjectSourceCapability, type ProjectSourceCreateInput, type ProjectSourceRecord, type ProjectSourceStatus, type ProjectSourceType, SUPPORT_URL, type SyncCache, type TopicPreferencesPayload, type TotpSetupStartResult, type WorkflowCapability, type WorkflowDetail, type WorkflowEdge, type WorkflowGraph, type WorkflowNode, type WorkflowNodeRun, type WorkflowNodeType, type WorkflowRunContentRetention, type WorkflowRunContentStorage, type WorkflowRunDetail, type WorkflowSummary, buildAssistantFeedbackDecision, defaultCloneBranchForVersion, deriveAppUrl, normalizeInterestTagIds, reconcileAuthoritativeChats, renderSupportInfo };
|
|
5400
|
+
export { APP_SKILL_METADATA, ASSISTANT_FEEDBACK_REPORT_TITLE, ASSISTANT_FEEDBACK_THANKS, type ApiKeyCreateOptions, type ApiKeyCreateResult, type ApiKeyRecord, type AssistantFeedbackDecision, type AuthMethodsStatus, type AuthoritativeChatReconciliation, type BackupCodesResult, type BankTransferOrderDetails, type BankTransferStatus, type CachedChat, type CachedNewChatSuggestion, type ChatCreateOptions, type ChatListOptions, type ChatListPage, type ChatResponse, type CliSignupResult, type DecryptedDraft, type DecryptedEmbed, type DecryptedMemoryEntry, type DecryptedMessage, type DecryptedNewChatSuggestion, type DecryptedUserTask, type DocsFile, type DocsFolder, type DocsSearchResult, type DocsTree, type DraftRecord, type EncryptedChatMetadata, type EncryptedDraft, type EncryptedDraftRecord, type FocusModeSelection, type GiftCardBankTransferStatus, INTEREST_TAG_IDS, type InterestTagId, MATE_NAMES, MEMORY_TYPE_REGISTRY, type MemoryFieldDef, type MemoryTypeDef, OpenMates, OpenMatesApiError, OpenMatesClient, type OpenMatesClientOptions, OpenMatesConfigError, type OpenMatesOptions, type OpenMatesSession, type ProjectSourceCapability, type ProjectSourceCreateInput, type ProjectSourceRecord, type ProjectSourceStatus, type ProjectSourceType, SUPPORT_URL, type SyncCache, type TaskListFilters, type TaskPlainCreateOptions, type TaskPlainUpdateOptions, type TaskRecord, type TopicPreferencesPayload, type TotpSetupStartResult, type WorkflowCapability, type WorkflowDetail, type WorkflowEdge, type WorkflowGraph, type WorkflowNode, type WorkflowNodeRun, type WorkflowNodeType, type WorkflowRunContentRetention, type WorkflowRunContentStorage, type WorkflowRunDetail, type WorkflowSummary, buildAssistantFeedbackDecision, defaultCloneBranchForVersion, deriveAppUrl, normalizeInterestTagIds, reconcileAuthoritativeChats, renderSupportInfo };
|
package/dist/index.js
CHANGED