buckyos 0.7.184 → 0.7.185
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/cli/dist/cli.mjs +62 -10
- package/cli/dist/cli.mjs.map +1 -1
- package/cli/modules/aiws.ts +44 -9
- package/cli/modules/pikg_protocol.ts +1 -1
- package/cli/version.ts +1 -1
- package/dist/aiworkspace_client.d.ts +19 -5
- package/dist/aiworkspace_client.d.ts.map +1 -1
- package/dist/{aiws_bind-82bace11.js → aiws_bind-0654c24e.js} +2 -2
- package/dist/aiws_bind-0654c24e.js.map +1 -0
- package/dist/{aiws_bind-3b874f77.mjs → aiws_bind-0885ff99.mjs} +7 -5
- package/dist/aiws_bind-0885ff99.mjs.map +1 -0
- package/dist/aiws_ext.cjs +1 -1
- package/dist/aiws_ext.mjs +1 -1
- package/dist/{aiws_write-ed4f0ec4.mjs → aiws_write-675664eb.mjs} +2 -2
- package/dist/{aiws_write-ed4f0ec4.mjs.map → aiws_write-675664eb.mjs.map} +1 -1
- package/dist/{aiws_write-1c748f36.js → aiws_write-b0333ca1.js} +2 -2
- package/dist/{aiws_write-1c748f36.js.map → aiws_write-b0333ca1.js.map} +1 -1
- package/dist/browser.cjs +1 -1
- package/dist/browser.mjs +4 -4
- package/dist/{content_objid-8a793481.js → content_objid-252bd154.js} +2 -2
- package/dist/{content_objid-8a793481.js.map → content_objid-252bd154.js.map} +1 -1
- package/dist/{content_objid-c25fec12.mjs → content_objid-39f4f273.mjs} +2 -2
- package/dist/{content_objid-c25fec12.mjs.map → content_objid-39f4f273.mjs.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +4 -4
- package/dist/node.cjs +1 -1
- package/dist/node.mjs +3 -3
- package/package.json +1 -1
- package/dist/aiws_bind-3b874f77.mjs.map +0 -1
- package/dist/aiws_bind-82bace11.js.map +0 -1
package/cli/modules/aiws.ts
CHANGED
|
@@ -689,7 +689,7 @@ const infoCommand: CommandDefinition = {
|
|
|
689
689
|
|
|
690
690
|
const runGetCommand: CommandDefinition = {
|
|
691
691
|
verb: 'run-get',
|
|
692
|
-
summary: 'A wish run: state, execution context, the brief an executor starts from,
|
|
692
|
+
summary: 'A wish run: state, progress, execution context, the brief an executor starts from, what it wrote (applied) and the record it added to the wish\'s history (record)',
|
|
693
693
|
options: [WORKSPACE_OPTION, RUN_OPTION],
|
|
694
694
|
inputSchema: workspaceInput({ run_id: { type: 'string', minLength: 1 } }, ['run_id']),
|
|
695
695
|
outputSchema: OBJECT_OUTPUT,
|
|
@@ -832,12 +832,17 @@ function sessionInfer(ctx: CommandContext) {
|
|
|
832
832
|
const client = new AiccLlmClient({ chatCompletionsCreate: (r: unknown) => call('chat.completions.create', r), helperLlmChat: (r: unknown) => call('helper.llm_chat', r) } as never)
|
|
833
833
|
return async (req: { model: string; messages: { role: 'system' | 'user' | 'assistant'; text: string }[]; schema: unknown; max_tokens: number }) => {
|
|
834
834
|
try {
|
|
835
|
-
const r: { message: { content: { type: string; text?: string }[] }; usage?: { output_tokens?: number } } = await client.infer({
|
|
835
|
+
const r: { message: { content: { type: string; text?: string }[] }; usage?: { input_tokens?: number; output_tokens?: number }; extra?: unknown } = await client.infer({
|
|
836
836
|
messages: req.messages.map((m) => ({ role: m.role, content: [{ type: 'text' as const, text: m.text }] })), model_alias: req.model, fallbacks: [], temperature: 0,
|
|
837
837
|
max_completion_tokens: req.max_tokens, force_json: req.schema !== null, ...(req.schema !== null ? { json_schema: req.schema as never } : {}),
|
|
838
838
|
disable_capabilities: [], tool_specs: [], allow_tool_calls: false, signal: ctx.signal,
|
|
839
839
|
})
|
|
840
|
-
|
|
840
|
+
// AICC names the model its route ended at (`extra.model`): the run's record shows it
|
|
841
|
+
const model = (r.extra as { model?: unknown } | undefined)?.model
|
|
842
|
+
return {
|
|
843
|
+
text: r.message.content.map((c) => (c.type === 'text' ? c.text ?? '' : '')).join(''), tokens: r.usage?.output_tokens, input_tokens: r.usage?.input_tokens,
|
|
844
|
+
...(typeof model === 'string' && model ? { model } : {}),
|
|
845
|
+
}
|
|
841
846
|
} catch (error) {
|
|
842
847
|
throw refusalOf(error)
|
|
843
848
|
}
|
|
@@ -1004,18 +1009,25 @@ const runStartCommand: CommandDefinition = {
|
|
|
1004
1009
|
|
|
1005
1010
|
const runReportCommand: CommandDefinition = {
|
|
1006
1011
|
verb: 'run-report',
|
|
1007
|
-
summary: 'End a claimed run: --finished after the stage is done (submit_analysis or finish accepted, or the stored macro handed in), an analysis made elsewhere, or a failure',
|
|
1008
|
-
description: 'The service
|
|
1012
|
+
summary: 'End a claimed run: --finished after the stage is done (submit_analysis or finish accepted, or the stored macro handed in), an analysis made elsewhere, or a failure — with what your model loop used',
|
|
1013
|
+
description: 'The service then checks the stage and writes it at once: an analysis its task contract, coding only the macro, a run its results; each stage adds a record to the wish\'s history, a failure too (and writes nothing else). Results always come from the macro (run-program). --model, --input-tokens, --output-tokens and --calls go into that record as they are: what the model turns of this stage used (leave them out when you called no model, as when you only ran the stored macro). A superseded attempt or a cancelled run gets RUN_REVOKED.',
|
|
1009
1014
|
options: [
|
|
1010
1015
|
WORKSPACE_OPTION, RUN_OPTION, ATTEMPT_OPTION,
|
|
1011
|
-
{ name: 'finished', property: 'finished', description: 'The stage is done:
|
|
1016
|
+
{ name: 'finished', property: 'finished', description: 'The stage is done: the service writes what it produced', type: 'boolean' },
|
|
1012
1017
|
{ name: 'analysis', property: 'analysis', description: 'Analysis JSON (analyze runs, wish.analysis.v3)', type: 'string' },
|
|
1013
1018
|
{ name: 'analysis-file', property: 'analysis_file', description: 'Path of a JSON file holding the analysis', type: 'string' },
|
|
1014
1019
|
{ name: 'summary', property: 'summary', description: 'One paragraph on what was done', type: 'string' },
|
|
1015
1020
|
{ name: 'warning', property: 'warnings', description: 'A warning for the user (repeatable)', type: 'string' },
|
|
1016
1021
|
{ name: 'error', property: 'error', description: 'Report a failure instead: its reason', type: 'string' },
|
|
1022
|
+
{ name: 'model', property: 'model', description: 'The model that answered your last model turn (the stage\'s model when you cannot tell)', type: 'string' },
|
|
1023
|
+
{ name: 'input-tokens', property: 'input_tokens', description: 'Input tokens of all your model turns in this stage', type: 'integer' },
|
|
1024
|
+
{ name: 'output-tokens', property: 'output_tokens', description: 'Output tokens of all your model turns in this stage', type: 'integer' },
|
|
1025
|
+
{ name: 'calls', property: 'calls', description: 'How many model turns this stage took', type: 'integer' },
|
|
1017
1026
|
],
|
|
1018
|
-
inputSchema: workspaceInput({
|
|
1027
|
+
inputSchema: workspaceInput({
|
|
1028
|
+
run_id: { type: 'string', minLength: 1 }, attempt: { type: 'integer', minimum: 1 }, finished: { type: 'boolean' }, analysis: { type: 'string' }, analysis_file: { type: 'string' }, summary: { type: 'string' }, warnings: { type: 'string' }, error: { type: 'string' },
|
|
1029
|
+
model: { type: 'string', minLength: 1 }, input_tokens: { type: 'integer', minimum: 0 }, output_tokens: { type: 'integer', minimum: 0 }, calls: { type: 'integer', minimum: 0 },
|
|
1030
|
+
}, ['run_id', 'attempt']),
|
|
1019
1031
|
outputSchema: OBJECT_OUTPUT,
|
|
1020
1032
|
resultSchemaVersion: 1,
|
|
1021
1033
|
access: { mode: 'fixed', level: 'write' },
|
|
@@ -1023,6 +1035,7 @@ const runReportCommand: CommandDefinition = {
|
|
|
1023
1035
|
requiresSession: true,
|
|
1024
1036
|
examples: [
|
|
1025
1037
|
'buckyos aiws run-report --workspace ws_abc --run run_xyz --attempt 1 --finished',
|
|
1038
|
+
'buckyos aiws run-report --workspace ws_abc --run run_xyz --attempt 1 --finished --model gpt-6-astra --input-tokens 12340 --output-tokens 1205 --calls 7',
|
|
1026
1039
|
'buckyos aiws run-report --workspace ws_abc --run run_xyz --attempt 1 --analysis-file out/analysis.json',
|
|
1027
1040
|
'buckyos aiws run-report --workspace ws_abc --run run_xyz --attempt 1 --error "the input table is empty"',
|
|
1028
1041
|
],
|
|
@@ -1040,10 +1053,32 @@ const runReportCommand: CommandDefinition = {
|
|
|
1040
1053
|
if (summary) params.summary = summary
|
|
1041
1054
|
const warning = inputString(input, 'warnings')
|
|
1042
1055
|
if (warning) params.warnings = [warning]
|
|
1056
|
+
const usage: Record<string, unknown> = {}
|
|
1057
|
+
const model = inputString(input, 'model')
|
|
1058
|
+
if (model) usage.model = model
|
|
1059
|
+
for (const key of ['input_tokens', 'output_tokens', 'calls']) if (typeof input[key] === 'number') usage[key] = input[key]
|
|
1060
|
+
if (Object.keys(usage).length) params.usage = usage
|
|
1043
1061
|
return aiws(ctx, 'proc.report', params)
|
|
1044
1062
|
},
|
|
1045
1063
|
}
|
|
1046
1064
|
|
|
1065
|
+
const runRollbackCommand: CommandDefinition = {
|
|
1066
|
+
verb: 'run-rollback',
|
|
1067
|
+
summary: 'Roll a wish run back: what it wrote (its analysis, its macro or its results) returns to the stage\'s previous version; only the run whose record is current for its stage',
|
|
1068
|
+
description: 'Results the run updated return to what they were before it (a person\'s edits it overwrote included), results it created go with their Blocks; a macro or an analysis returns to the one of the previous record. When what the run wrote was changed since, nothing is written: the answer is `status: needs_confirm` with what would be lost (`lost`, `hidden_lost`); run it again with --confirm to go ahead. Otherwise one Commit: `commit` and the `rollback` record added to the history. Another record than the current one: INVALID_OPERATION / NOT_CURRENT_RECORD. Needs update on the wish.',
|
|
1069
|
+
options: [WORKSPACE_OPTION, RUN_OPTION, { name: 'confirm', property: 'confirm', description: 'Go ahead although the later changes listed by a first try are lost', type: 'boolean' }],
|
|
1070
|
+
inputSchema: workspaceInput({ run_id: { type: 'string', minLength: 1 }, confirm: { type: 'boolean' } }, ['run_id']),
|
|
1071
|
+
outputSchema: OBJECT_OUTPUT,
|
|
1072
|
+
resultSchemaVersion: 1,
|
|
1073
|
+
access: { mode: 'fixed', level: 'write' },
|
|
1074
|
+
asyncMode: 'sync',
|
|
1075
|
+
requiresSession: true,
|
|
1076
|
+
examples: ['buckyos aiws run-rollback --workspace ws_abc --run run_xyz', 'buckyos aiws run-rollback --workspace ws_abc --run run_xyz --confirm'],
|
|
1077
|
+
handler: (ctx, input) => aiws(ctx, 'proc.rollback', {
|
|
1078
|
+
workspace_id: requiredInputString(input, 'workspace_id'), run_id: requiredInputString(input, 'run_id'), ...(input.confirm === true ? { confirm: true } : {}),
|
|
1079
|
+
}),
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1047
1082
|
// Block-controls (a mind map…): the catalogue each control describes itself in, and its exchange formats
|
|
1048
1083
|
// (脑图方案 §8.1). The service dispatches by control kind: `control.*` in buckyos/src/frame/aiworkspace/README.md.
|
|
1049
1084
|
const controlsCommand: CommandDefinition = {
|
|
@@ -1745,7 +1780,7 @@ const templateCommand: CommandDefinition = {
|
|
|
1745
1780
|
export function createAiwsModule(): CommandModule {
|
|
1746
1781
|
return {
|
|
1747
1782
|
name: 'aiws',
|
|
1748
|
-
summary: 'AI Workspace: find and read a workspace by path (ls, find, grep, stat, cat, resolve, read), its permissions (acl, acl-edit), query its tables in SQL (sql), write tables, rich text and common properties (table, text, mv, rename, set-prop), your to-do list and calendar (todo, cal), Block-controls (catalogue, import, export), extension controls (build, pull, export, library, import, upgrade), Workspace templates (list, create, export), and execute wish runs as their executor (claim, heartbeat, report)',
|
|
1749
|
-
commands: [infoCommand, lsCommand, findCommand, grepCommand, statCommand, aclCommand, aclEditCommand, catCommand, resolveCommand, readCommand, sqlCommand, tableCommand, textCommand, mvCommand, renameCommand, setPropCommand, todoCommand, calCommand, placeCommand, controlsCommand, importCommand, exportCommand, buildCommand, pullCommand, extExportCommand, libraryCommand, extImportCommand, extUpgradeCommand, templateCommand, runGetCommand, runClaimCommand, runHeartbeatCommand, runFilesCommand, runToolCommand, runExecCommand, runProgramCommand, runReportCommand, runStartCommand],
|
|
1783
|
+
summary: 'AI Workspace: find and read a workspace by path (ls, find, grep, stat, cat, resolve, read), its permissions (acl, acl-edit), query its tables in SQL (sql), write tables, rich text and common properties (table, text, mv, rename, set-prop), your to-do list and calendar (todo, cal), Block-controls (catalogue, import, export), extension controls (build, pull, export, library, import, upgrade), Workspace templates (list, create, export), and execute wish runs as their executor (claim, heartbeat, report) or roll one back',
|
|
1784
|
+
commands: [infoCommand, lsCommand, findCommand, grepCommand, statCommand, aclCommand, aclEditCommand, catCommand, resolveCommand, readCommand, sqlCommand, tableCommand, textCommand, mvCommand, renameCommand, setPropCommand, todoCommand, calCommand, placeCommand, controlsCommand, importCommand, exportCommand, buildCommand, pullCommand, extExportCommand, libraryCommand, extImportCommand, extUpgradeCommand, templateCommand, runGetCommand, runClaimCommand, runHeartbeatCommand, runFilesCommand, runToolCommand, runExecCommand, runProgramCommand, runReportCommand, runRollbackCommand, runStartCommand],
|
|
1750
1785
|
}
|
|
1751
1786
|
}
|
|
@@ -551,7 +551,7 @@ export const EXT_TOOLS_RESERVED_COMMANDS = [
|
|
|
551
551
|
'agent-session', 'agent_tool', 'ai_provider', 'ai_provider_test', 'ai_quota', 'aicc-tool', 'ask_user', 'buckyos',
|
|
552
552
|
'caption_image', 'detect_image', 'edit_image', 'edit_video', 'enhance_audio', 'extend_video', 'gen_image', 'gen_music',
|
|
553
553
|
'gen_video', 'import_office', 'import_table', 'inpaint_image', 'llm_understand_media', 'materialize_resource',
|
|
554
|
-
'ocr_image', 'remove_bg', 'resume_aicc_task', 'segment_image', 'speech_to_text', 'text_to_speech', 'upscale_image',
|
|
554
|
+
'ocr_image', 'reflow', 'remove_bg', 'resume_aicc_task', 'segment_image', 'speech_to_text', 'text_to_speech', 'upscale_image',
|
|
555
555
|
'upscale_video', 'xagent',
|
|
556
556
|
]
|
|
557
557
|
const MAX_EXT_TOOLS_LAUNCHER_BYTES = 1024 * 1024
|
package/cli/version.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Generated by scripts/generate-cli-version.mjs. Do not edit.
|
|
2
|
-
export const PACKAGE_VERSION = '0.7.
|
|
2
|
+
export const PACKAGE_VERSION = '0.7.185'
|
|
3
3
|
export const TOOL_VERSION = PACKAGE_VERSION
|
|
4
4
|
export const SDK_VERSION = PACKAGE_VERSION
|
|
5
5
|
export const PROTOCOL_VERSION = '1'
|
|
@@ -447,21 +447,30 @@ export interface AiwsExtPackResult {
|
|
|
447
447
|
token: string;
|
|
448
448
|
};
|
|
449
449
|
}
|
|
450
|
-
/** What
|
|
450
|
+
/** What a stage's model loop used, as its executor reports it (`proc.report { usage }`): the model of the last turn,
|
|
451
|
+
* the tokens of all turns, how many turns. A macro's own AI calls are counted by the program host. */
|
|
452
|
+
export interface AiwsRunUsage {
|
|
453
|
+
model?: string;
|
|
454
|
+
input_tokens?: number;
|
|
455
|
+
output_tokens?: number;
|
|
456
|
+
calls?: number;
|
|
457
|
+
}
|
|
458
|
+
/** What an executor outside the service reports for a run (M3): the stage is done, an analysis made elsewhere, or a
|
|
459
|
+
* failure — each with what it used. Results always come from the macro (`proc.program`). */
|
|
451
460
|
export interface AiwsRunReport {
|
|
452
461
|
run_id: string;
|
|
453
462
|
attempt: number;
|
|
454
463
|
progress?: Record<string, unknown>;
|
|
464
|
+
finished?: boolean;
|
|
455
465
|
error?: {
|
|
456
466
|
code: string;
|
|
457
467
|
detail: string;
|
|
458
468
|
};
|
|
459
|
-
results?: Record<string, unknown>[];
|
|
460
|
-
read_set?: Record<string, unknown>[];
|
|
461
469
|
summary?: string;
|
|
462
470
|
warnings?: string[];
|
|
463
471
|
assumptions?: string[];
|
|
464
472
|
analysis?: Record<string, unknown>;
|
|
473
|
+
usage?: AiwsRunUsage;
|
|
465
474
|
}
|
|
466
475
|
/** One request of `doc.stage` / `doc.commit` stays under the service's 8 MiB body limit. */
|
|
467
476
|
export declare const AIWS_COMMIT_PART_BYTES: number;
|
|
@@ -675,7 +684,7 @@ export declare class AiWorkspaceClient {
|
|
|
675
684
|
folder_id?: string;
|
|
676
685
|
}): Promise<AiwsExtBuildResult>;
|
|
677
686
|
runStart(workspace_id: string, program: string, params: Record<string, unknown>, idempotency_key: string): Promise<Record<string, unknown>>;
|
|
678
|
-
runGet(workspace_id: string, run_id: string
|
|
687
|
+
runGet(workspace_id: string, run_id: string): Promise<Record<string, unknown>>;
|
|
679
688
|
runList(workspace_id: string, wish_id?: string, limit?: number): Promise<Record<string, unknown>>;
|
|
680
689
|
runClaim(workspace_id: string, run_id: string, claim_token: string, executor?: Record<string, unknown>): Promise<{
|
|
681
690
|
run_id: string;
|
|
@@ -686,7 +695,12 @@ export declare class AiWorkspaceClient {
|
|
|
686
695
|
}>;
|
|
687
696
|
runHeartbeat(workspace_id: string, run_id: string, attempt: number, progress?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
688
697
|
runReport(workspace_id: string, report: AiwsRunReport): Promise<Record<string, unknown>>;
|
|
689
|
-
|
|
698
|
+
/** Take back what the run wrote: only the record that is current for its stage. When the outcome was changed since,
|
|
699
|
+
* nothing is written and the answer is `status: "needs_confirm"` with what would be `lost`; again with `confirm`. */
|
|
700
|
+
runRollback(workspace_id: string, run_id: string, opts?: {
|
|
701
|
+
confirm?: boolean;
|
|
702
|
+
session_id?: string;
|
|
703
|
+
}): Promise<Record<string, unknown>>;
|
|
690
704
|
runCancel(workspace_id: string, run_id: string): Promise<Record<string, unknown>>;
|
|
691
705
|
}
|
|
692
706
|
//# sourceMappingURL=aiworkspace_client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aiworkspace_client.d.ts","sourceRoot":"","sources":["../src/aiworkspace_client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE/C,eAAO,MAAM,wBAAwB,gBAAgB,CAAA;AAErD,2HAA2H;AAC3H,MAAM,WAAW,SAAS;IAAG,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE;AAClH,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,CAA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IAC3C,OAAO,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM;IAG9D,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;gBACzE,MAAM;iBAAW,MAAM;mBAAa,MAAM;qBAAe,MAAM;kBAAY,MAAM;;IAE9G,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAGtG,SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa;IACrD;yHACqH;IACrH,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,GAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAO;IAGvG,SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAC/C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const e=require("./object_url-8fb5a7bf.js");class t extends Error{constructor(e){super(`${e.code}${e.sub_code?`/${e.sub_code}`:""}: ${e.detail}`),this.name="AiwsFailure",this.code=e.code,this.subCode=e.sub_code,this.data=e.data}}function n(e){return e.startsWith("/")||e.startsWith("~")?{path:e}:{entity_id:e}}const r=6291456,o=33554432,i=5e4,a=new TextEncoder;function s(e){const t=JSON.stringify(e);return t.length+(/[^\x00-\x7f]/.test(t)?a.encode(t).length-t.length:0)}function l(e,t=6291456){const n=[];let r=[],o=2;for(const i of e){const e=s(i)+1;r.length>0&&o+e>t&&(n.push(r),r=[],o=2),r.push(i),o+=e}return(r.length>0||0===n.length)&&n.push(r),n}async function d(e,t,n={}){var o,i;const a=n.method??"doc.commit",s=l(Array.isArray(t.operations)?t.operations:[],n.partBytes??r);if(s.length<=1)return await e(a,t);const{workspace_id:d,epoch:c,idempotency_key:u}=t;for(let r=0;;r++){const l=[];for(let t=0;t<s.length-1;t++){null==(o=n.onPart)||o.call(n,t+1,s.length);const r=await e("doc.stage",{workspace_id:d,epoch:c,idempotency_key:u,part:t,operations:s[t]});if(!r||!1===r.ok||"string"!=typeof r.digest){const e=(null==r?void 0:r.error)??{code:"STORAGE_IO_ERROR",retryable:!0,detail:"doc.stage returned no digest"};return{status:"rejected",code:e.code,retryable:e.retryable,detail:e.detail,...e.sub_code?{sub_code:e.sub_code}:{},errors:[e]}}l.push(r.digest)}null==(i=n.onPart)||i.call(n,s.length,s.length);const y=await e(a,{...t,staged:l,operations:s[s.length-1]});if(0!==r||"rejected"!==(null==y?void 0:y.status)||"STAGED_PARTS_MISSING"!==y.sub_code)return y}}const c=["MO","TU","WE","TH","FR","SA","SU"];class u extends Error{constructor(e){super(e),this.name="RRuleError"}}const y=["DAILY","WEEKLY","MONTHLY","YEARLY"];function p(e,t,n,r,o=!1){if(!/^[+-]?\d{1,3}$/.test(t))throw new u(`${e}: ${t} is not a number`);const i=Number(t);if(i<n||i>r||!o&&0===i)throw new u(`${e}: ${t} is out of range`);return i}function f(e,t,n){const r=t.split(",");if(0===r.length||r.length>n||r.some((e=>""===e)))throw new u(`${e}: at most ${n} comma-separated values`);return r}function h(e){const t=e.startsWith("RRULE:")?e.slice(6):e;if(""===t.trim())throw new u("empty rule");const n=new Set,r={};for(const a of t.split(";")){const e=a.indexOf("=");if(e<=0)throw new u(`${a||"(empty)"}: expected NAME=VALUE`);const t=a.slice(0,e),o=a.slice(e+1);if(t!==t.toUpperCase()||o!==o.toUpperCase())throw new u(`${a}: write the rule in upper case`);if(n.has(t))throw new u(`${t}: given twice`);if(n.add(t),!["FREQ","INTERVAL","COUNT","UNTIL","BYDAY","BYMONTHDAY","BYMONTH","BYSETPOS","WKST"].includes(t))throw new u(`${t}: not supported (supported: FREQ, INTERVAL, COUNT, UNTIL, BYDAY, BYMONTHDAY, BYMONTH, BYSETPOS, WKST)`);if(""===o)throw new u(`${t}: empty value`);r[t]=o}if(!r.FREQ)throw new u("FREQ is required");if(!y.includes(r.FREQ))throw new u(`FREQ: ${r.FREQ} is not supported (DAILY, WEEKLY, MONTHLY, YEARLY)`);const o=r.FREQ,i={freq:o,interval:1,wkst:0};if(void 0!==r.INTERVAL&&(i.interval=p("INTERVAL",r.INTERVAL,1,999)),void 0!==r.COUNT&&void 0!==r.UNTIL)throw new u("COUNT and UNTIL cannot both be given");if(void 0!==r.COUNT&&(i.count=p("COUNT",r.COUNT,1,1e3)),void 0!==r.UNTIL&&(i.until=function(e){let t=/^(\d{4})(\d{2})(\d{2})$/.exec(e);if(t){const n=`${t[1]}-${t[2]}-${t[3]}`;if(!m(n))throw new u(`UNTIL: ${e} is not a date`);return n}if(t=/^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})Z$/.exec(e),t){const n=Date.UTC(+t[1],+t[2]-1,+t[3],+t[4],+t[5],+t[6]);if(!m(`${t[1]}-${t[2]}-${t[3]}`)||+t[4]>23||+t[5]>59||+t[6]>59)throw new u(`UNTIL: ${e} is not a UTC time`);return new Date(n).toISOString()}throw new u(`UNTIL: ${e} must be YYYYMMDD or YYYYMMDDTHHMMSSZ`)}(r.UNTIL)),void 0!==r.BYDAY){i.byDay=f("BYDAY",r.BYDAY,7).map((e=>{const t=/^([+-]?\d)?(MO|TU|WE|TH|FR|SA|SU)$/.exec(e);if(!t)throw new u(`BYDAY: ${e} is not a weekday`);const n=c.indexOf(t[2]);if(void 0===t[1])return{weekday:n};if("MONTHLY"!==o&&"YEARLY"!==o)throw new u(`BYDAY: ${e}: an ordinal needs FREQ=MONTHLY or YEARLY`);return{weekday:n,ordinal:p("BYDAY",t[1],-5,5)}}));const e=i.byDay.map((e=>`${e.ordinal??""}${e.weekday}`));if(new Set(e).size!==e.length)throw new u("BYDAY: repeated day")}if(void 0!==r.BYMONTHDAY){if("MONTHLY"!==o&&"YEARLY"!==o)throw new u("BYMONTHDAY needs FREQ=MONTHLY or YEARLY");if(i.byMonthDay=f("BYMONTHDAY",r.BYMONTHDAY,31).map((e=>p("BYMONTHDAY",e,-1,31))),new Set(i.byMonthDay).size!==i.byMonthDay.length)throw new u("BYMONTHDAY: repeated day")}if(void 0!==r.BYMONTH){if("YEARLY"!==o)throw new u("BYMONTH needs FREQ=YEARLY");if(i.byMonth=f("BYMONTH",r.BYMONTH,12).map((e=>p("BYMONTH",e,1,12))),new Set(i.byMonth).size!==i.byMonth.length)throw new u("BYMONTH: repeated month")}if(void 0!==r.BYSETPOS){if("MONTHLY"!==o||!i.byDay)throw new u("BYSETPOS needs FREQ=MONTHLY and BYDAY");i.bySetPos=p("BYSETPOS",r.BYSETPOS,-5,5)}if(void 0!==r.WKST){const e=c.indexOf(r.WKST);if(e<0)throw new u(`WKST: ${r.WKST} is not a weekday`);i.wkst=e}return i}function _(e){var t,n,r;const o=[`FREQ=${e.freq}`];return e.interval>1&&o.push(`INTERVAL=${e.interval}`),(null==(t=e.byMonth)?void 0:t.length)&&o.push(`BYMONTH=${e.byMonth.join(",")}`),(null==(n=e.byMonthDay)?void 0:n.length)&&o.push(`BYMONTHDAY=${e.byMonthDay.join(",")}`),(null==(r=e.byDay)?void 0:r.length)&&o.push(`BYDAY=${e.byDay.map((e=>`${e.ordinal??""}${c[e.weekday]}`)).join(",")}`),void 0!==e.bySetPos&&o.push(`BYSETPOS=${e.bySetPos}`),void 0!==e.count&&o.push(`COUNT=${e.count}`),void 0!==e.until&&o.push(`UNTIL=${10===e.until.length?e.until.replace(/-/g,""):e.until.replace(/[-:]/g,"").replace(/\.\d{3}/,"")}`),0!==e.wkst&&o.push(`WKST=${c[e.wkst]}`),o.join(";")}function m(e){const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return!1;const n=+t[1],r=+t[2],o=+t[3];return n>=1&&r>=1&&r<=12&&o>=1&&o<=g(n,r)}const w=e=>e%4==0&&e%100!=0||e%400==0;function g(e,t){return[31,w(e)?29:28,31,30,31,30,31,31,30,31,30,31][t-1]}const b=(e,t,n)=>Math.floor(Date.UTC(e,t-1,n)/864e5);function D(e){return b(+e.slice(0,4),+e.slice(5,7),+e.slice(8,10))}function v(e){return new Date(864e5*e).toISOString().slice(0,10)}function x(e){const t=new Date(864e5*e);return{y:t.getUTCFullYear(),m:t.getUTCMonth()+1,d:t.getUTCDate()}}const k=e=>((e+3)%7+7)%7,M=new Map;function O(e){let t=M.get(e);return t||(t=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),M.set(e,t)),t}function $(e){try{return O(e),!0}catch{return!1}}function S(e,t){const n={};for(const r of O(t).formatToParts(new Date(e)))"literal"!==r.type&&(n[r.type]=Number(r.value));return{y:n.year,m:n.month,d:n.day,h:24===n.hour?0:n.hour,mi:n.minute,s:n.second}}function T(e,t){const n=S(e,t);return Date.UTC(n.y,n.m-1,n.d,n.h,n.mi,n.s)-1e3*Math.floor(e/1e3)}function E(e,t,n,r){const o=864e5*e+6e4*t+1e3*n,i=o-T(o,r);return o-T(i,r)}function A(e,t){const n=S(e,t);return b(n.y,n.m,n.d)}function Y(e,t,n){const r=x(n),o=[],i=(e,t,n)=>{for(let r=0;r<t;r++)n.some((t=>void 0===t.ordinal&&t.weekday===k(e+r)))&&o.push(e+r)},a=(e,t,n)=>{const r=[];for(let o=0;o<t;o++)k(e+o)===n.weekday&&r.push(e+o);const i=n.ordinal>0?n.ordinal-1:r.length+n.ordinal;i>=0&&i<r.length&&o.push(r[i])},s=(e,t,n)=>{const r=g(e,t);for(const i of n){const n=i>0?i:r+i+1;n>=1&&n<=r&&o.push(b(e,t,n))}};switch(e.freq){case"DAILY":{const r=n+t*e.interval,{m:i,d:a}=x(r);if(e.byMonth&&!e.byMonth.includes(i))break;if(e.byMonthDay&&!e.byMonthDay.some((e=>e>0?e===a:g(x(r).y,i)+e+1===a)))break;if(e.byDay&&!e.byDay.some((e=>e.weekday===k(r))))break;o.push(r);break}case"WEEKLY":if(i(n-(k(n)-e.wkst+7)%7+t*e.interval*7,7,e.byDay??[{weekday:k(n)}]),e.byMonth)return o.filter((t=>e.byMonth.includes(x(t).m))).sort(((e,t)=>e-t));break;case"MONTHLY":{const n=12*r.y+(r.m-1)+t*e.interval,l=Math.floor(n/12),d=n%12+1,c=b(l,d,1),u=g(l,d);if(e.byMonthDay){if(s(l,d,e.byMonthDay),e.byDay){const t=o.filter((t=>e.byDay.some((e=>e.weekday===k(t)))));o.length=0,o.push(...t)}}else if(e.byDay){i(c,u,e.byDay);for(const t of e.byDay)void 0!==t.ordinal&&a(c,u,t)}else r.d<=u&&o.push(b(l,d,r.d));break}case"YEARLY":{const n=r.y+t*e.interval;if(e.byDay&&!e.byMonth&&!e.byMonthDay){const t=b(n,1,1),r=w(n)?366:365;i(t,r,e.byDay);for(const n of e.byDay)void 0!==n.ordinal&&a(t,r,n);break}const l=e.byMonth??[r.m];for(const t of l)if(e.byMonthDay)s(n,t,e.byMonthDay);else if(e.byDay){const r=b(n,t,1),o=g(n,t);i(r,o,e.byDay);for(const t of e.byDay)void 0!==t.ordinal&&a(r,o,t)}else r.d<=g(n,t)&&o.push(b(n,t,r.d));if(e.byMonthDay&&e.byDay){const t=o.filter((t=>e.byDay.some((e=>e.weekday===k(t)))));o.length=0,o.push(...t)}break}}const l=[...new Set(o)].sort(((e,t)=>e-t));if(void 0!==e.bySetPos){const t=e.bySetPos>0?e.bySetPos-1:l.length+e.bySetPos;return t>=0&&t<l.length?[l[t]]:[]}return l}function I(e,t,n){const r=x(n);switch(e.freq){case"DAILY":return n+t*e.interval;case"WEEKLY":return n-(k(n)-e.wkst+7)%7+t*e.interval*7;case"MONTHLY":{const n=12*r.y+(r.m-1)+t*e.interval;return b(Math.floor(n/12),n%12+1,1)}case"YEARLY":return b(r.y+t*e.interval,1,1)}}function N(e,t,n,r={}){var o;const i=r.limit??2e3,a=new Set(r.exdate??[]),s=[];let l,d,c,u=0,y=0,p="UTC";const f=r.viewerTz??"UTC";if("date"===t.kind)l=D(t.date),d=A(n.fromMs,f)-(r.durationDays??0),c=A(n.toMs-1,f);else{p=t.tz;const e=S(Date.parse(t.utc),p);l=b(e.y,e.m,e.d),u=60*e.h+e.mi,y=e.s,d=A(n.fromMs-(r.durationMs??0),p)-1,c=A(n.toMs,p)+1}const h=10===(null==(o=e.until)?void 0:o.length)?D(e.until):void 0,_=e.until&&e.until.length>10?Date.parse(e.until):void 0;let m=0;const w=o=>{if(void 0!==e.count&&m>=e.count)return!1;if(void 0!==h&&o>h)return!1;let i;if("date"===t.kind){if(void 0!==_&&864e5*o>_)return!1;const e=v(o);i={original:e,date:e}}else{const e=E(o,u,y,p);if(void 0!==_&&e>_)return!1;i={original:new Date(e).toISOString(),startMs:e}}return m+=1,a.has(i.original)||("date"===t.kind?o>=d&&o<=c&&s.push(i):i.startMs+(r.durationMs??0)>n.fromMs&&i.startMs<n.toMs&&s.push(i)),!0};if(l>c||!w(l))return s;let g=void 0===e.count?function(e,t,n){const r=x(t),o=x(n);let i;switch(e.freq){case"DAILY":i=Math.floor((n-t)/e.interval);break;case"WEEKLY":i=Math.floor((n-I(e,0,t))/(7*e.interval));break;case"MONTHLY":i=Math.floor((12*o.y+o.m-(12*r.y+r.m))/e.interval);break;case"YEARLY":i=Math.floor((o.y-r.y)/e.interval)}return Math.max(-1,i-1)}(e,l,d)+1:0;for(let b=0;b<2e5&&s.length<i&&!(I(e,g,l)>c);b++,g++)for(const t of Y(e,g,l))if(!(t<=l)){if(t>c)return s;if(!w(t)||s.length>=i)return s}return s}function L(e,t,n="UTC"){return!0===e.all_day?"string"==typeof e.start_date?{kind:"date",date:e.start_date}:null:"string"==typeof e.start?{kind:"datetime",utc:e.start,tz:t&&$(t)?t:n}:null}function R(e,t){return`${e}@${t}`}const C={1:"第一个",2:"第二个",3:"第三个",4:"第四个",5:"第五个",[-1]:"最后一个",[-2]:"倒数第二个",[-3]:"倒数第三个",[-4]:"倒数第四个",[-5]:"倒数第五个"},B={1:"first",2:"second",3:"third",4:"fourth",5:"fifth",[-1]:"last",[-2]:"second to last",[-3]:"third to last",[-4]:"fourth to last",[-5]:"fifth to last"},U=["周一","周二","周三","周四","周五","周六","周日"],j=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],H=["January","February","March","April","May","June","July","August","September","October","November","December"],F=e=>!!e&&5===e.length&&e.every((e=>void 0===e.ordinal))&&[0,1,2,3,4].every((t=>e.some((e=>e.weekday===t))));const q="buckyos.todo@1",P="buckyos.calendar@1",W="schedule",z="todo",K="calendar",Q="schedule-board",V="done",Z={zh:{title:"标题",status:"状态",due:"截止",order:"顺序",done_at:"完成时间",ext:"扩展",todo:"待办",doing:"进行中",done:"已完成",all_day:"全天",start:"开始",end:"结束",start_date:"开始日期",end_date:"结束日期",confirmed:"已确认",tentative:"暂定",cancelled:"已取消",todo_table:"待办",calendar_table:"日程",workspace:"我的日程",board:"日程"},en:{title:"Title",status:"Status",due:"Due",order:"Order",done_at:"Completed",ext:"Extension",todo:"To do",doing:"In progress",done:"Done",all_day:"All day",start:"Start",end:"End",start_date:"Start date",end_date:"End date",confirmed:"Confirmed",tentative:"Tentative",cancelled:"Cancelled",todo_table:"To-do",calendar_table:"Calendar",workspace:"My schedule",board:"Schedule"}};function J(e,t){return Z[e][t]??Z.en[t]??t}function G(e="zh"){const t=t=>J(e,t);return[{field_id:"title",name:t("title"),type:"text",required:!0},{field_id:"status",name:t("status"),type:"select",required:!0,options:["todo","doing","done"].map((e=>({option_id:e,label:t(e)})))},{field_id:"due",name:t("due"),type:"date",nullable:!0},{field_id:"order",name:t("order"),type:"text",nullable:!0},{field_id:"done_at",name:t("done_at"),type:"datetime",nullable:!0},{field_id:"ext",name:t("ext"),type:"json",nullable:!0}]}function X(e="zh"){const t=t=>J(e,t);return[{field_id:"title",name:t("title"),type:"text",required:!0},{field_id:"all_day",name:t("all_day"),type:"boolean",nullable:!0},{field_id:"start",name:t("start"),type:"datetime",nullable:!0},{field_id:"end",name:t("end"),type:"datetime",nullable:!0},{field_id:"start_date",name:t("start_date"),type:"date",nullable:!0},{field_id:"end_date",name:t("end_date"),type:"date",nullable:!0},{field_id:"status",name:t("status"),type:"select",nullable:!0,options:["confirmed","tentative","cancelled"].map((e=>({option_id:e,label:t(e)})))},{field_id:"ext",name:t("ext"),type:"json",nullable:!0}]}function ee(e,t){const n=t.locale??"zh";return{op:"entity.create",entity_id:t.entity_id,type_id:"buckyos.table-source",parent_id:t.parent_id,order_key:t.order_key,schema_id:"todo"===e?q:P,name:t.name??J(n,"todo"===e?"todo_table":"calendar_table"),payload:{title_field_id:"title",fields:"todo"===e?G(n):X(n)}}}const te="0123456789abcdefghijklmnopqrstuvwxyz";function ne(e){return"string"==typeof e&&e.length>0&&e.length<=64&&/^[0-9a-z]+$/.test(e)&&!e.endsWith("0")}function re(e,t){if(null!==t){let n=0;for(;n<t.length&&(e[n]??"0")===t[n];)n++;if(n>0)return t.slice(0,n)+re(e.length>n?e.slice(n):"",t.slice(n))}const n=e.length?te.indexOf(e[0]):0,r=null!==t?te.indexOf(t[0]):36;return r-n>1?te[Math.floor((n+r+1)/2)]:null!==t&&t.length>1?t[0]:te[n]+re(e.length>1?e.slice(1):"",null)}function oe(e,t){const n=e??null,r=t??null;if(null!==n&&null!==r&&n>=r)throw new Error("orderKeyBetween requires a < b");const o=null!==n&&null===r?function(e){const t=e.padEnd(Math.max(e.length,8),"0").split("");let n=t.length-1;for(;n>=0&&"z"===t[n];)n--;if(n>=0){t[n]=te[te.indexOf(t[n])+1];for(let e=n+1;e<t.length;e++)t[e]="0";return"0"===t[t.length-1]&&(t[t.length-1]="1"),t.join("")}if(t.length>=64)throw new Error("order key space exhausted; rebalance");return t.join("").padEnd(Math.min(t.length+8,64),"0").slice(0,-1)+"1"}(n):re(n??"",r);if(!ne(o))throw new Error("order key space exhausted; rebalance");return o}let ie=0;function ae(e="r"){ie=(ie+1)%1296;const t=Math.floor(Math.random()*36**6).toString(36).padStart(6,"0");return`${e}${Date.now().toString(36)}${ie.toString(36).padStart(2,"0")}${t}`}function se(e,t,n){var r;const o=[],i=[];for(const[s,l]of Object.entries(n)){const e={record_id:t.record_id,field_id:s,expect:{rev:(null==(r=t.revs)?void 0:r[s])??0}};null==l?void 0!==t.values[s]&&null!==t.values[s]&&i.push(e):o.push({...e,value:l})}const a=[];return o.length&&a.push({op:"table.set_values",source_id:e,values:o}),i.length&&a.push({op:"table.unset_values",source_id:e,values:i}),a}function le(e,t){return{op:"table.insert_records",source_id:e,records:t.map((e=>({record_id:e.record_id,values:Object.fromEntries(Object.entries(e.values).filter((([,e])=>null!=e)))})))}}function de(e,t){return{op:"table.delete_records",source_id:e,records:t.map((e=>({record_id:e.record_id,expect:{rev:e.rev??0}})))}}function ce(e){if(m(e))return e;const t=Date.parse(e);return Number.isFinite(t)?new Date(t).toISOString():e}const ue=e=>Array.isArray(e)?e.filter((e=>"string"==typeof e)).map(ce):[],ye=e=>{const t=null==e?void 0:e.values.ext;return t&&"object"==typeof t&&!Array.isArray(t)?{...t}:{}};function pe(e){const t=e.values,n="string"==typeof t.status?t.status:"todo";return{record_id:e.record_id,rev:e.rev,revs:e.revs,values:e.values,title:"string"==typeof t.title?t.title:"",status:n,due:"string"==typeof t.due?t.due:null,order:ne(t.order)?t.order:null,done:n===V,done_at:"string"==typeof t.done_at?t.done_at:null,ext:ye(e)}}function fe(e){return[...e].sort(((e,t)=>e.order===t.order?e.record_id.localeCompare(t.record_id):null===e.order?1:null===t.order||e.order<t.order?-1:1))}function he(e,t,n={}){const r=t.record_id??ae("t");let o=t.order??null;if(!o)if(void 0!==n.after||void 0!==n.before)o=oe(n.after??null,n.before??null);else{o=oe((n.items??[]).map((e=>e.order)).filter(ne).sort().pop()??null,null)}const i=t.status??"todo";return{record_id:r,order:o,ops:[le(e,[{record_id:r,values:{title:t.title,status:i,order:o,due:t.due??void 0,ext:t.ext&&Object.keys(t.ext).length?t.ext:void 0,done_at:i===V?t.done_at??(new Date).toISOString():void 0}}])]}}function _e(e,t,n,r={}){return se(e,t,n?{status:V,done_at:r.now??(new Date).toISOString()}:{status:r.reopenStatus??"todo",done_at:null})}function me(e,t,n,r={}){const o={},i="string"==typeof t.values.status?t.values.status:void 0;return void 0!==n.status&&n.status!==i&&(o.status=n.status,n.status===V?o.done_at=r.now??(new Date).toISOString():i===V&&(o.done_at=null)),void 0!==n.order&&n.order!==t.values.order&&(o.order=n.order),Object.keys(o).length?se(e,t,o):[]}function we(e,t,n){const r={};for(const o of["title","status","due","order","done_at"])void 0!==n[o]&&(r[o]=n[o]);if(void 0!==n.ext&&(r.ext=n.ext&&Object.keys(n.ext).length?n.ext:null),n.ext_merge){const e=ye(t);for(const[t,r]of Object.entries(n.ext_merge))null===r?delete e[t]:e[t]=r;r.ext=Object.keys(e).length?e:null}return void 0!==r.status&&r.status!==t.values.status&&void 0===r.done_at&&(r.status===V?r.done_at=(new Date).toISOString():t.values.status===V&&(r.done_at=null)),se(e,t,r)}function ge(e,t){const n=e.map((e=>e.order)),r=t>0?n[t-1]:null,o=t<n.length?n[t]:null;return null===r||ne(r)?null!==o&&ne(o)&&(null===r||r<o)?oe(r,o):oe(r,null):oe(null,null)}function be(e){const t=e.values;if(!0===t.all_day){if("string"!=typeof t.start_date||!m(t.start_date))return null;const e="string"==typeof t.end_date&&m(t.end_date)&&t.end_date>=t.start_date?t.end_date:t.start_date;return{allDay:!0,startDate:t.start_date,endDate:e}}if("string"!=typeof t.start)return null;const n=Date.parse(t.start);if(!Number.isFinite(n))return null;const r="string"==typeof t.end?Date.parse(t.end):NaN;return{allDay:!1,startMs:n,endMs:Number.isFinite(r)&&r>=n?r:n+36e5}}function De(e,t){return v(D(e)+t)}const ve=(e,t)=>D(t)-D(e);function xe(e,t,n){const r=ye(e);return{id:e.record_id,row:e,title:"string"==typeof e.values.title?e.values.title:"",allDay:t.allDay,startMs:t.startMs,endMs:t.endMs,startDate:t.startDate,endDate:t.endDate,status:"string"==typeof e.values.status?e.values.status:null,ext:r,recurring:!1,override:!1,agentWritten:!1,...n}}function ke(e,t,n){if(!e.allDay)return e.startMs<t.toMs&&Math.max(e.endMs,e.startMs+1)>t.fromMs;const r=Me(t.fromMs,n),o=Me(t.toMs-1,n);return e.startDate<=o&&e.endDate>=r}function Me(e,t){return new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date(e))}function Oe(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function $e(e,t,n={}){const r=n.viewerTz??Oe(),o=[],i=new Map;for(const s of e){const e=ye(s).recurrence_id;e&&"object"==typeof e&&!Array.isArray(e)&&"string"==typeof e.master&&"string"==typeof e.original&&i.set(`${e.master}@${ce(e.original)}`,s)}const a=new Map(e.map((e=>[e.record_id,e])));for(const s of e){const e=be(s);if(!e)continue;const l=ye(s),d=l.recurrence_id;if(d&&"object"==typeof d){const n="string"==typeof d.master?a.get(d.master):void 0,i="string"==typeof d.original?ce(d.original):void 0,l=xe(s,e,{id:n&&i?R(n.record_id,i):s.record_id,master:n,original:i,recurring:Boolean(n),override:!0});ke(l,t,r)&&o.push(l);continue}const c=e.allDay?ve(e.startDate,e.endDate):e.endMs-e.startMs,u=t=>{const n=`${s.record_id}@${t.original}`;return i.has(n)?null:e.allDay?xe(s,{allDay:!0,startDate:t.date,endDate:De(t.date,c)},{id:n,master:s,original:t.original,recurring:!0}):xe(s,{allDay:!1,startMs:t.startMs,endMs:t.startMs+c},{id:n,master:s,original:t.original,recurring:!0})};let y=null;if("string"==typeof l.rrule)try{y=h(l.rrule)}catch{y=null}if(y){const i=L(s.values,"string"==typeof l.tz?l.tz:void 0,r);if(!i)continue;const a=N(y,i,t,{exdate:ue(l.exdate),viewerTz:r,durationMs:e.allDay?void 0:c,durationDays:e.allDay?c:void 0,limit:n.limit});for(const e of a){const t=u(e);t&&o.push(t)}continue}if(Array.isArray(l.occurrences)&&l.occurrences.length>0){const n=new Set(ue(l.exdate));for(const i of l.occurrences){if("string"!=typeof i)continue;const a=ce(i);if(n.has(a))continue;const s=e.allDay?{original:a,date:a}:{original:a,startMs:Date.parse(a)};if(!e.allDay&&!Number.isFinite(s.startMs))continue;if(e.allDay&&!m(a))continue;const l=u(s);l&&ke(l,t,r)&&o.push({...l,agentWritten:!0})}continue}const p=xe(s,e,{});ke(p,t,r)&&o.push(p)}return o.sort(((e,t)=>Se(e)-Se(t)||e.id.localeCompare(t.id)))}const Se=e=>e.allDay?Date.parse(`${e.startDate}T00:00:00Z`):e.startMs;function Te(e,t){const n=t.record_id??ae("e"),r={title:t.title,status:t.status??void 0,ext:t.ext&&Object.keys(t.ext).length?t.ext:void 0};return t.all_day?(r.all_day=!0,r.start_date=t.start_date??void 0,r.end_date=t.end_date&&t.end_date!==t.start_date?t.end_date:void 0):(r.start=t.start??void 0,r.end=t.end??void 0),{record_id:n,ops:[le(e,[{record_id:n,values:r}])]}}function Ee(e){return e.allDay?{all_day:!0,start_date:e.startDate,end_date:e.endDate!==e.startDate?e.endDate:null,start:null,end:null}:{all_day:null,start:e.start,end:e.end,start_date:null,end_date:null}}function Ae(e,t){return e.filter((e=>{const n=ye(e).recurrence_id;return n&&"object"==typeof n&&n.master===t}))}function Ye(e,t,n,r){return t?De(e,r):((e,t)=>new Date(Date.parse(e)+t).toISOString())(e,n)}function Ie(e,t,n,r,o){const i=o.newRecordId??(()=>ae("e")),a=e=>{const t={...n.values};if(n.ext_merge){const r=ye(e);for(const[e,t]of Object.entries(n.ext_merge))null===t?delete r[e]:r[e]=t;t.ext=Object.keys(r).length?r:null}return t},s=t.master;if(!s||t.row!==s&&"one"===r){const r=t.row,o={...a(r),...n.times?Ee(n.times):{}};if(void 0!==n.rrule&&!s){const e={...o.ext??ye(r)??{}};null===n.rrule?delete e.rrule:e.rrule=_(h(n.rrule)),null===n.rrule&&delete e.exdate,o.ext=Object.keys(e).length?e:null}return{ops:se(e,r,o),record_id:r.record_id}}const l=t.original,d=be(s),c=ye(s);if("one"===r){const r=i(),o={...c,recurrence_id:{master:s.record_id,original:l}};delete o.rrule,delete o.exdate,delete o.occurrences,delete o.rule_text,delete o.covered_until,delete o.maintenance;const u={title:s.values.title,status:s.values.status,ext:o},y=n.times??(t.allDay?{allDay:!0,startDate:t.startDate,endDate:De(t.startDate,ve(d.startDate,d.endDate))}:{allDay:!1,start:new Date(t.startMs).toISOString(),end:new Date(t.startMs+(d.endMs-d.startMs)).toISOString()}),p={...u,...a({record_id:r,values:{ext:o}}),...Ee(y)};return p.ext||(p.ext=o),{ops:[le(e,[{record_id:r,values:p}])],record_id:r}}let u=0,y=0,p=d.allDay?0:d.endMs-d.startMs,f=d.allDay?ve(d.startDate,d.endDate):0;if(n.times){if(n.times.allDay!==d.allDay)throw new Error("changing a series between all-day and timed: edit the series itself (scope all) with new times");n.times.allDay?(y=ve(l,n.times.startDate),f=ve(n.times.startDate,n.times.endDate)):(u=Date.parse(n.times.start)-Date.parse(l),y=Math.round(u/864e5),p=Date.parse(n.times.end)-Date.parse(n.times.start))}const m="string"==typeof c.rrule?h(c.rrule):null,w=Ae(o.rows,s.record_id),g=ue(c.exdate),b=d.allDay?l===d.startDate:l===new Date(d.startMs).toISOString(),D=(e,t)=>d.allDay?{allDay:!0,startDate:De(t,y),endDate:De(De(t,y),f)}:{allDay:!1,start:new Date(e+u).toISOString(),end:new Date(e+u+p).toISOString()},v=e=>void 0!==n.rrule?null===n.rrule?null:_(h(n.rrule)):e?_(function(e,t){if(!t)return e;const n={...e};if(e.byDay&&e.byDay.every((e=>void 0===e.ordinal))&&("WEEKLY"===e.freq||"DAILY"===e.freq))n.byDay=e.byDay.map((e=>({weekday:((e.weekday+t)%7+7)%7})));else if(e.byDay&&"MONTHLY"===e.freq&&1===e.byDay.length&&void 0===e.bySetPos&&Math.abs(t)<7)n.byDay=[{...e.byDay[0],weekday:((e.byDay[0].weekday+t)%7+7)%7}];else if(e.byMonthDay&&1===e.byMonthDay.length&&e.byMonthDay[0]>0){const r=e.byMonthDay[0]+t;r>=1&&r<=28&&(n.byMonthDay=[r])}return n}(e,y)):null,x=[];if("all"===r||b){const t=D(d.startMs,d.startDate),n={...c},r=v(m);r?n.rrule=r:(delete n.rrule,delete n.exdate),r&&g.length&&(n.exdate=g.map((e=>Ye(e,d.allDay,u,y))));const o=a({record_id:s.record_id,values:{ext:n}}),i=void 0!==o.ext?o.ext:n;x.push(...se(e,s,{...o,...Ee(t),ext:i&&Object.keys(i).length?i:null}));for(const a of w){const t=ye(a),n=t.recurrence_id;r?(u||y)&&x.push(...se(e,a,{ext:{...t,recurrence_id:{...n,original:Ye(String(n.original),d.allDay,u,y)}}})):x.push(de(e,[a]))}return{ops:x,record_id:s.record_id}}if(!m)throw new Error("not a repeating event");const k=i(),M=e=>d.allDay?e<l:Date.parse(e)<Date.parse(l);let O={...m},$={...m};if(void 0!==m.count){const e=N(m,L(s.values,"string"==typeof c.tz?c.tz:void 0),{fromMs:d.allDay?Date.parse(`${d.startDate}T00:00:00Z`)-1728e5:d.startMs,toMs:d.allDay?Date.parse(`${l}T00:00:00Z`):Date.parse(l)},{viewerTz:"UTC"}).filter((e=>M(e.original))).length;O={...m,count:Math.max(1,e)},$={...m,count:Math.max(1,m.count-e)}}else O={...m,until:d.allDay?De(l,-1):new Date(Date.parse(l)-1e3).toISOString().replace(/\.\d{3}Z$/,".000Z")};const S={...c,rrule:_(O)},T=g.filter(M);T.length?S.exdate=T:delete S.exdate,x.push(...se(e,s,{ext:S}));const E={...c},A=v($);A?E.rrule=A:delete E.rrule;const Y=g.filter((e=>!M(e))).map((e=>Ye(e,d.allDay,u,y)));Y.length&&A?E.exdate=Y:delete E.exdate;const I=D(d.allDay?void 0:Date.parse(l),d.allDay?l:void 0),R=a({record_id:k,values:{ext:E}}),C={title:s.values.title,status:s.values.status,...R,...Ee(I)};C.ext=(void 0!==R.ext?R.ext:E)??void 0,x.push(le(e,[{record_id:k,values:C}]));for(const h of w){const t=ye(h),n=t.recurrence_id;M(String(n.original))||(A?x.push(...se(e,h,{ext:{...t,recurrence_id:{master:k,original:Ye(String(n.original),d.allDay,u,y)}}})):x.push(de(e,[h])))}return{ops:x,record_id:k}}function Ne(e,t,n,r){const o=t.master;if(!o)return[de(e,[t.row])];const i=t.original,a=ye(o),s=be(o),l=Ae(r.rows,o.record_id),d=s.allDay?i===s.startDate:i===new Date(s.startMs).toISOString();if("all"===n||"following"===n&&d)return[de(e,[o,...l])];const c=[];if("one"===n){const t=ue(a.exdate);t.includes(i)||c.push(...se(e,o,{ext:{...a,exdate:[...t,i].sort()}}));const n=l.filter((e=>ce(String(ye(e).recurrence_id.original))===i));return n.length&&c.push(de(e,n)),c}const u="string"==typeof a.rrule?h(a.rrule):null;if(!u)return[de(e,[t.row])];const y=e=>s.allDay?e<i:Date.parse(e)<Date.parse(i),p={...u,count:void 0,until:s.allDay?De(i,-1):new Date(Date.parse(i)-1e3).toISOString()},f={...a,rrule:_(p)};if(Array.isArray(a.exdate)){const e=ue(a.exdate).filter(y);e.length?f.exdate=e:delete f.exdate}c.push(...se(e,o,{ext:f}));const m=l.filter((e=>!y(String(ye(e).recurrence_id.original))));return m.length&&c.push(de(e,m)),c}const Le=1e3;function Re(e){var n,r,o,i;const a=null==(n=e.errors)?void 0:n[0];if("conflict"===e.status){const n=null==(r=e.conflicts)?void 0:r[0];return new t({code:e.code??"REVISION_CONFLICT",retryable:!0,detail:"changed meanwhile, read it again"+(n?`: ${JSON.stringify(n.selector??n)}`:"")})}return new t({code:e.code??(null==(o=e.error)?void 0:o.code)??"REJECTED",sub_code:e.sub_code??(null==a?void 0:a.sub_code),retryable:!1,detail:(null==a?void 0:a.detail)??e.detail??(null==(i=e.error)?void 0:i.detail)??"refused"})}function Ce(e,n){const r=n.indexOf("@"),o=r<0?n:n.slice(0,r),i=r<0?null:ce(n.slice(r+1)),a=e.find((e=>e.record_id===o));if(!a)throw new t({code:"NOT_FOUND",retryable:!1,detail:`event ${o} not found`});if(null===i){const n=be(a);if(!n)throw new t({code:"INVALID_OPERATION",retryable:!1,detail:`event ${o} has no time`});const r=ye(a),i=r.recurrence_id,s=i&&"string"==typeof i.master?e.find((e=>e.record_id===i.master)):void 0;return xe(a,n,s?{master:s,original:String(i.original),recurring:!0,override:!0}:{recurring:"string"==typeof r.rrule,master:"string"==typeof r.rrule?a:void 0,original:"string"==typeof r.rrule?n.allDay?n.startDate:new Date(n.startMs).toISOString():void 0})}const s=e.find((e=>{const t=ye(e).recurrence_id;return t&&t.master===o&&"string"==typeof t.original&&ce(t.original)===ce(i)})),l=be(a);if(!l)throw new t({code:"INVALID_OPERATION",retryable:!1,detail:`event ${o} has no time`});if(s)return xe(s,be(s),{id:n,master:a,original:i,recurring:!0,override:!0});const d=l.allDay,c=d?0:l.endMs-l.startMs,u=d?ve(l.startDate,l.endDate):0;return xe(a,d?{allDay:!0,startDate:i,endDate:De(i,u)}:{allDay:!1,startMs:Date.parse(i),endMs:Date.parse(i)+c},{id:n,master:a,original:i,recurring:!0})}function Be(e="zh"){const t=`${Q}-content`,n=J(e,"board");return[{op:"entity.create",entity_id:t,type_id:"buckyos.container",parent_id:"canvas-content",order_key:"u",name:n,payload:{kind:"folder",title:n,system:"surface_content",surface_id:Q}},{op:"entity.create",entity_id:Q,type_id:"buckyos.container",parent_id:"surfaces",order_key:"a",name:n,payload:{kind:"surface",layout:{mode:"free"},title:n,content_folder_id:t}},{op:"entity.create",entity_id:`${Q}-calendar`,type_id:"buckyos.container",parent_id:Q,order_key:"a",placement:{x:40,y:40,w:880,h:640},payload:{kind:"calendar",layout:{mode:"data"},title:J(e,"calendar_table"),bindings:{events:[{entity_id:K}],todo:[{entity_id:z}]},config:{view:"week"}}},{op:"entity.create",entity_id:`${Q}-todo`,type_id:"buckyos.container",parent_id:Q,order_key:"b",placement:{x:960,y:40,w:420,h:640},payload:{kind:"todo",layout:{mode:"data"},title:J(e,"todo_table"),bindings:{items:{entity_id:z}},config:{mode:"list"}}}]}class Ue extends Error{constructor(e,t,n,r){super(e),this.code=t,this.node=n,this.binding=r}}const je=[q,P],He=e=>void 0===e?[]:Array.isArray(e)?e:[e],Fe=(e,t)=>t.title??e;function qe(e,t){return!(e.accepts&&e.accepts.length>0&&!e.accepts.includes(t.type_id))&&(!e.schema_id||t.schema_id===e.schema_id)}const Pe=e=>{var t;return{...(null==(t=e.accepts)?void 0:t.length)?{accepts:e.accepts}:{},...e.schema_id?{schema_id:e.schema_id}:{}}};function We(){const e=e=>{throw new Ue(`needs a choice: ${e}`,"NEEDS_UI")};return{pickOne:async t=>e(t.title),pickMany:async t=>e(t.title),confirm:async t=>e(t.title)}}let ze=0;const Ke=()=>"ref:"+ ++ze;function Qe(e,t,n){const r=e=>{throw new Ue(`on_bind result: ${e}`,"INVALID",n)},o=e=>"object"==typeof e&&null!==e&&!Array.isArray(e);if(!o(e)||!o(e.bindings))return r("{ bindings, create? } (or null to cancel)");const i=void 0===e.create?[]:e.create;if(!Array.isArray(i)||i.length>16)return r("create: a list of at most 16");const a=new Map,s=i.map(((e,t)=>{const n=`create[${t}]`;if(!o(e)||"string"!=typeof e.ref||!e.ref)return r(`${n}: { ref, kind, … }`);if(a.has(e.ref))return r(`${n}: ref ${e.ref} twice`);const i=Ke();a.set(e.ref,i);const s="string"==typeof e.name&&e.name.trim()&&e.name.length<=128?e.name.trim():null;return"standard"===e.kind?"string"!=typeof e.schema_id?r(`${n}: a standard table names its schema_id`):{ref:i,kind:"standard",schema_id:e.schema_id,name:s??e.schema_id}:s?"table"===e.kind?Array.isArray(e.fields)&&0!==e.fields.length?void 0!==e.title_field_id&&"string"!=typeof e.title_field_id?r(`${n}: title_field_id is a field id`):{ref:i,kind:"table",name:s,fields:e.fields,...e.title_field_id?{title_field_id:e.title_field_id}:{}}:r(`${n}: a table lists its fields`):"dir"===e.kind?{ref:i,kind:"dir",name:s}:r(`${n}: kind standard, table or dir`):r(`${n}: a name (at most 128 characters)`)})),l={},d=new Set;for(const[u,y]of Object.entries(e.bindings)){const e=t[u];if(!e)return r(`${u} is not a declared binding`);if(null==y)continue;const n="string"==typeof y?[y]:Array.isArray(y)&&y.every((e=>"string"==typeof e&&e))?y:r(`${u}: an id, or a list of ids`);if(!e.many&&(Array.isArray(y)||1!==n.length))return r(`${u} takes one`);if(n.length>32||new Set(n).size!==n.length)return r(`${u}: at most 32, each once`);const o=n.map((e=>(a.has(e)&&d.add(e),a.get(e)??e)));e.many?o.length>0&&(l[u]=o):l[u]=o[0]}const c=[...a.keys()].filter((e=>!d.has(e)));return c.length>0?r(`created but not bound: ${c.join(", ")}`):{bindings:l,create:s}}const Ve=async e=>{const t={},n=[],r=e.parent?Object.values(e.parent.bound).flatMap(He):[],o=new Map(e.find({}).map((e=>[e.entity_id,e])));for(const[i,a]of Object.entries(e.decls)){const s=(t,n)=>new Ue(t,n,e.node,i);if("rebind"===e.reason){if(void 0!==e.given[i]&&e.no_ui){t[i]=e.given[i];continue}const r=He(e.given[i]);if(a.many){const o=await Je(i,(()=>e.dialogs.pickMany({title:Fe(i,a),query:Pe(a),preselect:r,allow_new:e.canCreate(a)})));if(null===o)return null;t[i]=o.map((t=>{if("string"==typeof t)return t;const r=Ke();return n.push(Ze(r,a,e.title)),r}))}else{const o=await Je(i,(()=>e.dialogs.pickOne({title:Fe(i,a),query:Pe(a),allow_new:e.canCreate(a),current:r[0]??null})));if(null===o)return null;if("string"==typeof o)t[i]=o;else{const r=Ke();n.push(Ze(r,a,e.title)),t[i]=r}}continue}if(void 0!==e.given[i]){t[i]=a.many?He(e.given[i]):He(e.given[i])[0];continue}const l=r.filter((e=>{const t=o.get(e);return void 0!==t&&qe(a,t)}));if(a.many&&l.length>0){t[i]=l;continue}if(!a.many&&1===l.length){t[i]=l[0];continue}const d=e.find(Pe(a)).filter((e=>qe(a,e)));if(0===d.length){if(!a.required)continue;if(!e.canCreate(a))throw s(`no ${Fe(i,a)} in this Workspace yet`,"NO_DATA");const r=Ke();n.push(Ze(r,a,e.title)),t[i]=a.many?[r]:r}else if(a.many)t[i]=d.map((e=>e.entity_id));else if(1===d.length)t[i]=d[0].entity_id;else if(a.required){const r=await Je(i,(()=>e.dialogs.pickOne({title:Fe(i,a),query:Pe(a),allow_new:e.canCreate(a)})));if(null===r)return null;if("string"==typeof r)t[i]=r;else{const r=Ke();n.push(Ze(r,a,e.title)),t[i]=r}}}return{bindings:t,create:n}};function Ze(e,t,n){return{ref:e,kind:"standard",schema_id:t.schema_id,name:n||t.title||"Table"}}async function Je(e,t){try{return await t()}catch(n){if(n instanceof Ue&&"NEEDS_UI"===n.code)throw new Ue(`binding ${e} needs a choice: give it`,"NEEDS_UI",void 0,e);throw n}}function Ge(e){return async t=>{var n;const r={},o=[];for(const a of e){const e=t.decls[a.binding]??{};if(void 0===t.given[a.binding]||"insert"!==t.reason)if("from_parent"in a){const o=null==(n=t.parent)?void 0:n.bound[a.from_parent];void 0!==o&&(r[a.binding]=e.many?He(o):He(o)[0])}else if("pick"in a){const n=Pe(e),i=a.title??Fe(a.binding,e),s=!1!==a.allow_new&&t.canCreate(e),l=He(t.given[a.binding]);if("all"===a.pick)r[a.binding]=t.find(n).filter((t=>qe(e,t))).map((e=>e.entity_id));else if("many"===a.pick){const d=await Je(a.binding,(()=>t.dialogs.pickMany({title:i,query:n,preselect:l.length?l:"none",allow_new:s})));if(null===d)return null;r[a.binding]=d.map((n=>{if("string"==typeof n)return n;const r=Ke();return o.push(Ze(r,e,t.title)),r}))}else{const d=await Je(a.binding,(()=>t.dialogs.pickOne({title:i,query:n,allow_new:s,current:l[0]??null})));if(null===d)return null;if("string"==typeof d)r[a.binding]=e.many?[d]:d;else{const n=Ke();o.push(Ze(n,e,t.title)),r[a.binding]=e.many?[n]:n}}}else{const n=0===t.find(Pe(e)).filter((t=>qe(e,t))).length;if("missing"===(a.when??"missing")&&!n)continue;const i=Ke(),s=a.create;o.push("standard"in s?{ref:i,kind:"standard",schema_id:s.standard,name:Fe(a.binding,e)}:"table"in s?{ref:i,kind:"table",name:s.table.name,title_field_id:s.table.title_field_id,fields:s.table.fields}:{ref:i,kind:"dir",name:s.dir.name}),r[a.binding]=e.many?[i]:i}else r[a.binding]=t.given[a.binding]}const i=Object.fromEntries(Object.entries(t.decls).filter((([e])=>void 0===r[e])));if(Object.keys(i).length>0){const e=await Ve({...t,decls:i});if(null===e)return null;Object.assign(r,e.bindings),o.push(...e.create)}return{bindings:r,create:o}}}const Xe=async e=>{const t=(n=e.decls,r=e.bound,Object.entries(n).filter((([e,t])=>t.required&&0===He(r[e]).length)).map((([e,t])=>Fe(e,t))));var n,r;if(t.length>0)return`${e.title}: ${t.join(", ")} not bound`;const o=e.children.filter((e=>!e.ready));return!(o.length>0)||`not ready: ${o.map((e=>`${e.title} (${e.missing.join(", ")})`)).join("; ")}`};exports.AIWORKSPACE_SERVICE_NAME="aiworkspace",exports.AIWS_COMMIT_MAX_BYTES=o,exports.AIWS_COMMIT_MAX_OPERATIONS=i,exports.AIWS_COMMIT_PART_BYTES=r,exports.AIWS_PROTOCOL_VERSION="1.2",exports.AiWorkspaceClient=class{constructor(e){this.rpcClient=e,this.raw=(e,t)=>this.rpcClient.call(e,t)}async call(e,n){const r=await this.rpcClient.call(e,n);if(r&&"object"==typeof r&&!1===r.ok)throw new t(r.error);return r}create(e,t={}){return this.call("ws.create",{title:e,...t})}ensure(e,t){return this.call("ws.ensure",{name:e,...void 0===t?{}:{title:t}})}time(){return this.call("ws.time",{})}list(){return this.call("ws.list",{})}info(e){return this.call("ws.get_info",{workspace_id:e})}getUserState(e){return this.call("ws.get_user_state",{workspace_id:e})}setUserState(e,t,n){return this.call("ws.set_user_state",{workspace_id:e,entries:t,...n?{expect:n}:{}})}resolve(e,t){return this.call("doc.resolve",{workspace_id:e,reference:t})}resolvePath(e,t){return this.call("doc.resolve",{workspace_id:e,path:t})}read(e,t,r){return this.call("doc.read",{workspace_id:e,...n(t),...r?{selector:r}:{}})}readMeta(e,t){return this.call("doc.read",{workspace_id:e,...n(t),as:"meta"})}readBody(e,t,r={}){return this.call("doc.read",{workspace_id:e,...n(t),as:"body",...r})}listEntities(e,t={}){return this.call("doc.list",{workspace_id:e,...t})}findEntities(e,t={}){return this.call("doc.find",{workspace_id:e,...t})}textQuery(e,t,n={}){return this.call("doc.query",{workspace_id:e,text:t,...n})}sql(e,t,n={}){return this.call("doc.query",{workspace_id:e,sql:t,...n})}sourceQuery(e,t,n){return this.call("doc.source_query",{workspace_id:e,source_id:t,...n})}outline(e){return this.call("doc.outline",{workspace_id:e})}prepare(e,t){return d(this.raw,{workspace_id:e,...t},{method:"doc.prepare"})}commit(e,t,n={}){return d(this.raw,{workspace_id:e,...t},n)}getSubmission(e,t,n){return this.call("doc.get_submission",{workspace_id:e,epoch:t,idempotency_key:n})}getChanges(e,t,n,r={}){return this.call("doc.get_changes",{workspace_id:e,epoch:t,after_seq:n,...r.limit?{limit:r.limit}:{},...r.touchedOnly?{filter:{detail:"touched"}}:{}})}waitChanges(e,t,n={}){return this.call("doc.wait_changes",{workspace_id:e,after_seq:t,...n})}exportDoc(e,t,n,r){return this.call("doc.export",{workspace_id:e,mode:t,self_contained:n,...void 0===r?{}:{include_notes:r}})}assetImportObject(e,t){return this.call("asset.import_object",{workspace_id:e,...t})}controlsList(){return this.call("control.list",{})}controlsDescribe(e){return this.call("control.describe",{kind:e})}controlsImport(e,t){return this.call("control.import",{workspace_id:e,...t})}controlsExport(e,t,n){return this.call("control.export",{workspace_id:e,entity_id:t,...n?{format:n}:{}})}extBuild(e,t){return this.call("ext.build",{workspace_id:e,...t})}extExport(e,t,n="package"){return this.call("ext.export",{workspace_id:e,entity_ids:t,purpose:n})}extInstall(e){return this.call("ext.install",e)}extPack(e,t,n,r){return this.call("ext.pack",{workspace_id:e,entity_ids:t,package:n,...r?{templates:r}:{}})}extUpgrade(e){return this.call("ext.upgrade",{...e})}extExportTemplate(e){return this.call("ext.export_template",{...e})}extCreateFromTemplate(e){return this.call("ext.create_from_template",e)}extListLibrary(){return this.call("ext.list_library",{})}extUninstall(e){return this.call("ext.uninstall",{pkg_id:e})}extLibraryBundle(e,t){return this.call("ext.library_bundle",{pkg_id:e,...t?{idents:t}:{}})}extImport(e,t,n={}){return this.call("ext.import",{workspace_id:e,items:t,...n})}runStart(e,t,n,r){return this.call("proc.start",{workspace_id:e,program:t,params:n,idempotency_key:r})}runGet(e,t,n){return this.call("proc.get",{workspace_id:e,run_id:t,...n?{choices:n}:{}})}runList(e,t,n){return this.call("proc.list",{workspace_id:e,...t?{wish_id:t}:{},...n?{limit:n}:{}})}runClaim(e,t,n,r){return this.call("proc.claim",{workspace_id:e,run_id:t,claim_token:n,...r?{executor:r}:{}})}runHeartbeat(e,t,n,r){return this.call("proc.heartbeat",{workspace_id:e,run_id:t,attempt:n,...r?{progress:r}:{}})}runReport(e,t){return this.call("proc.report",{workspace_id:e,...t})}runApply(e,t,n,r){return this.call("proc.apply",{workspace_id:e,run_id:t,plan_digest:n,...r?{session_id:r}:{}})}runCancel(e,t){return this.call("proc.cancel",{workspace_id:e,run_id:t})}},exports.AiwsFailure=t,exports.BindFailure=Ue,exports.CALENDAR_SCHEMA_ID=P,exports.RRuleError=u,exports.SCHEDULE_CALENDAR_ID=K,exports.SCHEDULE_SURFACE_ID=Q,exports.SCHEDULE_TODO_ID=z,exports.SCHEDULE_WORKSPACE_NAME=W,exports.STANDARD_SCHEMAS=je,exports.ScheduleClient=class{constructor(e,t={}){this.aiws=e,this.handle=null,this.locale=t.locale??"zh"}async ensure(){var e,t,n;if(this.handle)return this.handle;const r=await this.aiws.call("ws.ensure",{name:W,title:J(this.locale,"workspace")}),o={workspace_id:r.workspace_id,epoch:r.epoch,created:r.created,todo:z,calendar:K},i=new Set;for(const l of[z,K,Q])try{(await this.aiws.call("doc.read",{workspace_id:r.workspace_id,entity_id:l})).deleted||i.add(l)}catch(s){const e=null==s?void 0:s.code;if("NOT_FOUND"!==e&&"TARGET_DELETED"!==e)throw s}const a=[];if(i.has(z)||a.push(ee("todo",{entity_id:z,parent_id:"data",order_key:"u",locale:this.locale})),i.has(K)||a.push(ee("calendar",{entity_id:K,parent_id:"data",order_key:"v",locale:this.locale})),i.has(Q)||a.push(...Be(this.locale)),a.length){const r=await this.commitTo(o,a,"create the schedule","system"),i="ID_CONFLICT"===(r.sub_code??(null==(t=null==(e=r.errors)?void 0:e[0])?void 0:t.sub_code)??(null==(n=r.error)?void 0:n.sub_code));if("accepted"!==r.status&&("rejected"!==r.status||!i))throw Re(r)}return this.handle=o,o}async commitTo(e,t,n,r="agent"){var o;const i=`sched-${ae("k")}`,a=o=>({protocol_version:"1.2",workspace_id:e.workspace_id,epoch:o,idempotency_key:i,origin:r,message:n,operations:t});let s=await this.aiws.call("doc.commit",a(e.epoch));if("rejected"===s.status&&"EPOCH_MISMATCH"===(s.code??(null==(o=s.error)?void 0:o.code))){const t=await this.aiws.call("ws.get_info",{workspace_id:e.workspace_id});e.epoch=t.epoch,s=await this.aiws.call("doc.commit",a(e.epoch))}return s}async commit(e,t){const n=await this.ensure(),r=await this.commitTo(n,e,t);if("accepted"!==r.status)throw Re(r);return r}async rows(e){const t=await this.ensure(),n=[];for(let r=0;r<100;r++){const o=await this.aiws.call("doc.query",{workspace_id:t.workspace_id,sql:'SELECT "_record" FROM t ORDER BY "_id" LIMIT ? OFFSET ?',params:[Le,r*Le],tables:{t:e},max_rows:Le});for(const[e]of o.rows)n.push("string"==typeof e?JSON.parse(e):e);if(o.rows.length<Le)break}return n}async row(e,n){const r=await this.ensure(),o=(await this.aiws.call("doc.read",{workspace_id:r.workspace_id,entity_id:e,selector:{kind:"table_record",record_id:n}})).content;if(!(null==o?void 0:o.record_id))throw new t({code:"NOT_FOUND",retryable:!1,detail:`record ${n} not found`});return o}async todos(e={}){const t=fe((await this.rows(z)).map(pe));return e.includeDone?t:t.filter((e=>!e.done))}async addTodo(e,t={}){var n,r,o,i;const a=fe((await this.rows(z)).map(pe)),s=e=>a.find((t=>t.record_id===e));let l={items:a};if(t.after){const e=a.findIndex((e=>e.record_id===t.after));l={after:(null==(n=s(t.after))?void 0:n.order)??null,before:(null==(r=a[e+1])?void 0:r.order)??null}}else if(t.before){const e=a.findIndex((e=>e.record_id===t.before));l={after:(null==(o=a[e-1])?void 0:o.order)??null,before:(null==(i=s(t.before))?void 0:i.order)??null}}const{record_id:d,ops:c}=he(z,e,l);return await this.commit(c,`add to-do: ${e.title}`),pe(await this.row(z,d))}async completeTodo(e,t=!0){const n=await this.row(z,e),r=_e(z,n,t);r.length&&await this.commit(r,`${t?"complete":"reopen"} to-do ${e}`)}async updateTodo(e,t){const n=await this.row(z,e),r=we(z,n,t);r.length&&await this.commit(r,`update to-do ${e}`)}async moveTodo(e,n){const r=fe((await this.rows(z)).map(pe)),o=r.find((t=>t.record_id===e));if(!o)throw new t({code:"NOT_FOUND",retryable:!1,detail:`to-do ${e} not found`});const i=r.filter((t=>t.record_id!==e));let a;if(n.before||n.after){const e=i.findIndex((e=>e.record_id===(n.before??n.after)));if(e<0)throw new t({code:"NOT_FOUND",retryable:!1,detail:`to-do ${n.before??n.after} not found`});a=ge(i,n.before?e:e+1)}const s=me(z,o,{status:n.status,order:a});s.length&&await this.commit(s,`move to-do ${e}`)}async removeTodos(e){const t=await Promise.all(e.map((e=>this.row(z,e))));await this.commit([de(z,t)],`delete to-do ${e.join(", ")}`)}async events(e,t={}){return $e(await this.rows(K),e,t)}async addEvent(e){var t;void 0!==(null==(t=e.ext)?void 0:t.rrule)&&"string"==typeof e.ext.rrule&&(e={...e,ext:{...e.ext,rrule:_(h(e.ext.rrule))}});const{record_id:n,ops:r}=Te(K,e);return await this.commit(r,`add event: ${e.title}`),n}async occurrence(e){const t=await this.rows(K);return{occ:Ce(t,e),rows:t}}async editEvent(e,t,n="one"){const{occ:r,rows:o}=await this.occurrence(e),{ops:i,record_id:a}=Ie(K,r,t,n,{rows:o});return i.length&&await this.commit(i,`edit event ${e} (${n})`),a}async deleteEvent(e,t="one"){const{occ:n,rows:r}=await this.occurrence(e);await this.commit(Ne(K,n,t,{rows:r}),`delete event ${e} (${t})`)}},exports.TODO_DONE=V,exports.TODO_SCHEMA_ID=q,exports.WEEKDAYS=c,exports.aiwsReferenceUrl=function(t,n){const r=t.workspace_id??n;if(!r)throw new Error("reference names no workspace");const o=[];"fixed"===t.mode&&o.push("mode=fixed"),null!=t.selector&&o.push(`selector=${e.encodeObjQueryComponent(e.canonicalJson(t.selector))}`),null!=t.version&&o.push(`version=${e.encodeObjQueryComponent(e.canonicalJson(t.version))}`);const i=e.objServiceUrl("aiworkspace",[r,"entities",t.entity_id]);return e.normalizeObjectUrl(o.length?`${i}?${o.join("&")}`:i)},exports.aiwsTarget=n,exports.bindingAccepts=qe,exports.bindingsPayload=function(e,t,n){var r;const o={};for(const[i,a]of Object.entries(e)){const e=He(a).map((e=>({entity_id:n[e]??e})));(null==(r=t[i])?void 0:r.many)||Array.isArray(a)?e.length>0&&(o[i]=e):e[0]&&(o[i]=e[0])}return o},exports.boundIds=function(e){return null==e?[]:Array.isArray(e)?e:[e]},exports.calendarFields=X,exports.calendarOccurrences=$e,exports.canonicalOriginal=ce,exports.checkBindResult=Qe,exports.checkBindSteps=function(e,t,n,r){var o,i,a,s;const l=[];if(void 0!==e)if(!Array.isArray(e)||e.length>16)l.push("on_bind: at most 16 steps");else for(const[d,c]of e.entries()){const e=c,t=`on_bind[${d}]`;if(!e||"object"!=typeof e||"string"!=typeof e.binding){l.push(`${t}: names a binding`);continue}const r=n[e.binding];if(!r){l.push(`${t}: ${e.binding} is not a declared binding`);continue}if(1===["pick","from_parent","create"].filter((t=>t in e)).length){if("pick"in e&&!["one","many","all"].includes(String(e.pick))&&l.push(`${t}: pick is one, many or all`),"pick"in e&&"one"!==e.pick&&!r.many&&l.push(`${t}: ${e.binding} takes one`),"from_parent"in e&&"string"!=typeof e.from_parent&&l.push(`${t}: from_parent names a binding of the parent`),"create"in e){const n=e.create,r=n&&"object"==typeof n?["standard","table","dir"].filter((e=>e in n)):[];1!==r.length?l.push(`${t}: create one of standard, table, dir`):"standard"!==r[0]||je.includes(String(n.standard))?"table"!==r[0]||Array.isArray(null==(o=n.table)?void 0:o.fields)&&"string"==typeof(null==(i=n.table)?void 0:i.name)?"dir"===r[0]&&"string"!=typeof(null==(a=n.dir)?void 0:a.name)&&l.push(`${t}: create.dir needs name`):l.push(`${t}: create.table needs name and fields`):l.push(`${t}: no standard table ${String(n.standard)}`),void 0!==e.when&&"missing"!==e.when&&"always"!==e.when&&l.push(`${t}: when is missing or always`)}}else l.push(`${t}: one of pick, from_parent, create`)}if(void 0!==t)if(!Array.isArray(t)||t.length>16)l.push("on_init_control: at most 16 steps");else for(const[d,c]of t.entries()){const e=c,t=`on_init_control[${d}]`;if("children"===(null==e?void 0:e.require))continue;const n=null==(s=null==e?void 0:e.then)?void 0:s.action;"string"!=typeof n?l.push(`${t}: { require: "children" } or { then: { action } }`):r.includes(n)||l.push(`${t}: ${n} is not a declared action`)}return l},exports.commitOverLimit=function(e){if(e.length>i)return{limit:"operations",value:e.length,max:i};let t=2;for(const n of e)t+=s(n)+1;return t+4096>o?{limit:"bytes",value:t,max:o}:null},exports.commitWithParts=d,exports.createOps=function(e,t){const n=[],r={};for(const o of e.values())for(const e of o.create){const o=t.newId();r[e.ref]=o;const i={entity_id:o,parent_id:t.folderId,order_key:t.orderKey(),name:t.freeName(e.name)};if("standard"===e.kind){const r=e.schema_id===q?"todo":e.schema_id===P?"calendar":null;if(!r)throw new Ue(`cannot create a table of ${e.schema_id}`,"INVALID");n.push(ee(r,{...i,locale:t.locale}))}else"table"===e.kind?n.push({op:"entity.create",type_id:"buckyos.table-source",...i,payload:{fields:e.fields,...e.title_field_id?{title_field_id:e.title_field_id}:{}}}):n.push({op:"entity.create",type_id:"buckyos.dir",...i,payload:{members:{}}})}return{ops:n,ids:r}},exports.dateOf=v,exports.dayNumber=b,exports.dayOf=D,exports.daysInMonth=g,exports.defaultOnBind=Ve,exports.defaultOnInit=Xe,exports.deleteRecordsOp=de,exports.describeRRule=function(e,t="zh"){var n;const r="zh"===t,o=e.interval,i=e=>e.map((e=>{const t=r?U[e.weekday]:j[e.weekday];return void 0===e.ordinal?t:r?`${C[e.ordinal]}${t}`:`${B[e.ordinal]} ${t}`})),a=e=>r?e.join("、"):e.length>1?`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`:e.join(""),s=e=>r?-1===e?"最后一天":`${e} 日`:-1===e?"the last day":`day ${e}`;let l;switch(e.freq){case"DAILY":l=r?1===o?"每天":`每 ${o} 天`:1===o?"every day":`every ${o} days`;break;case"WEEKLY":if(F(e.byDay)&&1===o)l=r?"每个工作日":"every weekday";else{const t=e.byDay?a(i(e.byDay)):"";l=r?`${1===o?"每周":`每 ${o} 周的`}${t}`:`${1===o?"every week":`every ${o} weeks`}${t?` on ${t}`:""}`}break;case"MONTHLY":{let t="";e.byMonthDay?t=a(e.byMonthDay.map(s)):e.byDay&&void 0!==e.bySetPos?t=F(e.byDay)?r?`${C[e.bySetPos]}工作日`:`the ${B[e.bySetPos]} weekday`:r?`${C[e.bySetPos]}${a(i(e.byDay))}`:`the ${B[e.bySetPos]} of ${a(i(e.byDay))}`:e.byDay&&(t=r?a(i(e.byDay)):`the ${a(i(e.byDay))}`),l=r?`${1===o?"每月":`每 ${o} 个月的`}${t}`:`${1===o?"every month":`every ${o} months`}${t?` on ${t}`:""}`;break}case"YEARLY":{const t=null==(n=e.byMonth)?void 0:n.map((e=>r?`${e} 月`:H[e-1]));let d=t?a(t):"";e.byMonthDay?d+=r?a(e.byMonthDay.map(s)):` ${a(e.byMonthDay.map((e=>-1===e?"last day":String(e))))}`:e.byDay&&(d+=r?a(i(e.byDay)):` on the ${a(i(e.byDay))}`),l=r?`${1===o?"每年":`每 ${o} 年的`}${d}`:`${1===o?"every year":`every ${o} years`}${d.trim()?` in ${d.trim()}`:""}`;break}}return void 0!==e.count&&(l+=r?`,共 ${e.count} 次`:`, ${e.count} times`),void 0!==e.until&&(l+=r?`,到 ${e.until.slice(0,10)} 为止`:`, until ${e.until.slice(0,10)}`),l},exports.eventAddOps=Te,exports.eventDeleteOps=Ne,exports.eventEditOps=Ie,exports.eventPostponeOps=function(e,t,n,r){return Ie(e,t,{times:t.allDay?{allDay:!0,startDate:De(t.startDate,Math.max(1,Math.round(n/1440))),endDate:De(t.endDate,Math.max(1,Math.round(n/1440)))}:{allDay:!1,start:new Date(t.startMs+6e4*n).toISOString(),end:new Date(t.endMs+6e4*n).toISOString()}},"one",r)},exports.eventSkipOps=(e,t,n)=>Ne(e,t,"one",n),exports.expandSeries=N,exports.findOccurrence=Ce,exports.formatRRule=_,exports.insertRecordOp=le,exports.isDate=m,exports.isLeap=w,exports.isOrderKey=ne,exports.isTimeZone=$,exports.localDate=Me,exports.localDay=A,exports.newRecordId=ae,exports.noUiDialogs=We,exports.occurrenceId=R,exports.orderAt=ge,exports.orderKeyBetween=oe,exports.orderKeysBetween=function(e,t,n){const r=[];let o=e;for(let i=0;i<n;i++)o=oe(o,t),r.push(o);return r},exports.originalOf=function(e){return e.date??new Date(e.startMs).toISOString()},exports.parseAiwsReferenceUrl=function(t){const n=e.parseObjectUrl(t),r=e.objectSegments(n);if("obj"!==n.kind||"aiworkspace"!==n.host.name||3!==r.length||"entities"!==r[1])throw new Error(`${t} is not an AI Workspace entity url`);const o={workspace_id:r[0],entity_id:r[2],mode:"fixed"===n.query.mode?"fixed":"live"};return void 0!==n.query.selector&&(o.selector=JSON.parse(n.query.selector)),void 0!==n.query.version&&(o.version=JSON.parse(n.query.version)),o},exports.parseOccurrenceId=function(e){const t=e.indexOf("@");return t<0?{recordId:e,original:null}:{recordId:e.slice(0,t),original:e.slice(t+1)}},exports.parseRRule=h,exports.recurrencePresets=function(e,t="zh"){const n=D(e),{y:r,m:o,d:i}=x(n),a=k(n),s=Math.floor((i-1)/7)+1,l=i+7>g(r,o),d="zh"===t,u=c[a],y=[{id:"none",label:d?"不重复":"Does not repeat",rrule:null},{id:"daily",label:d?"每天":"Daily",rrule:"FREQ=DAILY"},{id:"weekdays",label:d?"每个工作日(周一至周五)":"Every weekday (Monday to Friday)",rrule:"FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR"},{id:"weekly",label:d?`每周的${U[a]}`:`Weekly on ${j[a]}`,rrule:`FREQ=WEEKLY;BYDAY=${u}`},{id:"monthly_day",label:d?`每月 ${i} 日`:`Monthly on day ${i}`,rrule:`FREQ=MONTHLY;BYMONTHDAY=${i}`}];return s<=4&&y.push({id:"monthly_nth",label:d?`每月${C[s]}${U[a]}`:`Monthly on the ${B[s]} ${j[a]}`,rrule:`FREQ=MONTHLY;BYDAY=${s}${u}`}),l&&y.push({id:"monthly_last",label:d?`每月最后一个${U[a]}`:`Monthly on the last ${j[a]}`,rrule:`FREQ=MONTHLY;BYDAY=-1${u}`}),y.push({id:"yearly",label:d?`每年 ${o} 月 ${i} 日`:`Annually on ${H[o-1]} ${i}`,rrule:`FREQ=YEARLY;BYMONTH=${o};BYMONTHDAY=${i}`}),y},exports.resolveBindings=async function(e,t){const n=t.standardSchemas??je,r=t.no_ui?We():t.dialogs,o=new Map,i=[],a=async(e,s)=>{const l={reason:t.reason,no_ui:t.no_ui,node:e.id,title:e.title,decls:e.decls,given:e.given??{},parent:s,find:t.find,canCreate:e=>Boolean(e.schema_id&&n.includes(e.schema_id)),dialogs:r},d="function"==typeof e.onBind?e.onBind:Array.isArray(e.onBind)?Ge(e.onBind):Ve;let c;try{c=await d(l)}catch(h){if(h instanceof Ue)throw new Ue(h.message,h.code,h.node??e.id,h.binding);throw h}if(null===c)throw new Ue(`${e.title}: cancelled`,"CANCELLED",e.id);c=Qe(c,e.decls,e.id),o.set(e.id,c);const u=[];for(const t of e.children)u.push(await a(t,{decls:e.decls,bound:c.bindings}));const y="function"==typeof e.onInit?e.onInit:Xe,p=Array.isArray(e.onInit)?e.onInit:[],f=await y({reason:t.reason,no_ui:t.no_ui,node:e.id,title:e.title,decls:e.decls,bound:c.bindings,children:u,dialogs:r});if(!0!==f)throw new Ue(f,"NOT_READY",e.id);for(const t of p)"then"in t&&i.push({node:e.id,action:t.then.action});return{node:e.id,title:e.title,ready:!0,missing:[]}};try{return await a(e,t.parent??null),{ok:!0,results:o,then:i}}catch(s){if(s instanceof Ue)return{ok:!1,error:s};throw s}},exports.scheduleBoardOps=Be,exports.scheduleLabel=J,exports.seriesStartOf=L,exports.setValuesOps=se,exports.sortTodos=fe,exports.splitCommitOperations=l,exports.standardTableOp=ee,exports.stepsOnBind=Ge,exports.todoAddOps=he,exports.todoCompleteOps=_e,exports.todoFields=G,exports.todoItem=pe,exports.todoMoveOps=me,exports.todoUpdateOps=we,exports.viewerTimeZone=Oe,exports.weekdayOf=k,exports.ymdOf=x,exports.zonedParts=S,exports.zonedToUtc=E;
|
|
2
|
-
//# sourceMappingURL=aiws_bind-
|
|
1
|
+
"use strict";const e=require("./object_url-8fb5a7bf.js");class t extends Error{constructor(e){super(`${e.code}${e.sub_code?`/${e.sub_code}`:""}: ${e.detail}`),this.name="AiwsFailure",this.code=e.code,this.subCode=e.sub_code,this.data=e.data}}function n(e){return e.startsWith("/")||e.startsWith("~")?{path:e}:{entity_id:e}}const r=6291456,o=33554432,i=5e4,a=new TextEncoder;function s(e){const t=JSON.stringify(e);return t.length+(/[^\x00-\x7f]/.test(t)?a.encode(t).length-t.length:0)}function l(e,t=6291456){const n=[];let r=[],o=2;for(const i of e){const e=s(i)+1;r.length>0&&o+e>t&&(n.push(r),r=[],o=2),r.push(i),o+=e}return(r.length>0||0===n.length)&&n.push(r),n}async function d(e,t,n={}){var o,i;const a=n.method??"doc.commit",s=l(Array.isArray(t.operations)?t.operations:[],n.partBytes??r);if(s.length<=1)return await e(a,t);const{workspace_id:d,epoch:c,idempotency_key:u}=t;for(let r=0;;r++){const l=[];for(let t=0;t<s.length-1;t++){null==(o=n.onPart)||o.call(n,t+1,s.length);const r=await e("doc.stage",{workspace_id:d,epoch:c,idempotency_key:u,part:t,operations:s[t]});if(!r||!1===r.ok||"string"!=typeof r.digest){const e=(null==r?void 0:r.error)??{code:"STORAGE_IO_ERROR",retryable:!0,detail:"doc.stage returned no digest"};return{status:"rejected",code:e.code,retryable:e.retryable,detail:e.detail,...e.sub_code?{sub_code:e.sub_code}:{},errors:[e]}}l.push(r.digest)}null==(i=n.onPart)||i.call(n,s.length,s.length);const y=await e(a,{...t,staged:l,operations:s[s.length-1]});if(0!==r||"rejected"!==(null==y?void 0:y.status)||"STAGED_PARTS_MISSING"!==y.sub_code)return y}}const c=["MO","TU","WE","TH","FR","SA","SU"];class u extends Error{constructor(e){super(e),this.name="RRuleError"}}const y=["DAILY","WEEKLY","MONTHLY","YEARLY"];function f(e,t,n,r,o=!1){if(!/^[+-]?\d{1,3}$/.test(t))throw new u(`${e}: ${t} is not a number`);const i=Number(t);if(i<n||i>r||!o&&0===i)throw new u(`${e}: ${t} is out of range`);return i}function p(e,t,n){const r=t.split(",");if(0===r.length||r.length>n||r.some((e=>""===e)))throw new u(`${e}: at most ${n} comma-separated values`);return r}function h(e){const t=e.startsWith("RRULE:")?e.slice(6):e;if(""===t.trim())throw new u("empty rule");const n=new Set,r={};for(const a of t.split(";")){const e=a.indexOf("=");if(e<=0)throw new u(`${a||"(empty)"}: expected NAME=VALUE`);const t=a.slice(0,e),o=a.slice(e+1);if(t!==t.toUpperCase()||o!==o.toUpperCase())throw new u(`${a}: write the rule in upper case`);if(n.has(t))throw new u(`${t}: given twice`);if(n.add(t),!["FREQ","INTERVAL","COUNT","UNTIL","BYDAY","BYMONTHDAY","BYMONTH","BYSETPOS","WKST"].includes(t))throw new u(`${t}: not supported (supported: FREQ, INTERVAL, COUNT, UNTIL, BYDAY, BYMONTHDAY, BYMONTH, BYSETPOS, WKST)`);if(""===o)throw new u(`${t}: empty value`);r[t]=o}if(!r.FREQ)throw new u("FREQ is required");if(!y.includes(r.FREQ))throw new u(`FREQ: ${r.FREQ} is not supported (DAILY, WEEKLY, MONTHLY, YEARLY)`);const o=r.FREQ,i={freq:o,interval:1,wkst:0};if(void 0!==r.INTERVAL&&(i.interval=f("INTERVAL",r.INTERVAL,1,999)),void 0!==r.COUNT&&void 0!==r.UNTIL)throw new u("COUNT and UNTIL cannot both be given");if(void 0!==r.COUNT&&(i.count=f("COUNT",r.COUNT,1,1e3)),void 0!==r.UNTIL&&(i.until=function(e){let t=/^(\d{4})(\d{2})(\d{2})$/.exec(e);if(t){const n=`${t[1]}-${t[2]}-${t[3]}`;if(!m(n))throw new u(`UNTIL: ${e} is not a date`);return n}if(t=/^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})Z$/.exec(e),t){const n=Date.UTC(+t[1],+t[2]-1,+t[3],+t[4],+t[5],+t[6]);if(!m(`${t[1]}-${t[2]}-${t[3]}`)||+t[4]>23||+t[5]>59||+t[6]>59)throw new u(`UNTIL: ${e} is not a UTC time`);return new Date(n).toISOString()}throw new u(`UNTIL: ${e} must be YYYYMMDD or YYYYMMDDTHHMMSSZ`)}(r.UNTIL)),void 0!==r.BYDAY){i.byDay=p("BYDAY",r.BYDAY,7).map((e=>{const t=/^([+-]?\d)?(MO|TU|WE|TH|FR|SA|SU)$/.exec(e);if(!t)throw new u(`BYDAY: ${e} is not a weekday`);const n=c.indexOf(t[2]);if(void 0===t[1])return{weekday:n};if("MONTHLY"!==o&&"YEARLY"!==o)throw new u(`BYDAY: ${e}: an ordinal needs FREQ=MONTHLY or YEARLY`);return{weekday:n,ordinal:f("BYDAY",t[1],-5,5)}}));const e=i.byDay.map((e=>`${e.ordinal??""}${e.weekday}`));if(new Set(e).size!==e.length)throw new u("BYDAY: repeated day")}if(void 0!==r.BYMONTHDAY){if("MONTHLY"!==o&&"YEARLY"!==o)throw new u("BYMONTHDAY needs FREQ=MONTHLY or YEARLY");if(i.byMonthDay=p("BYMONTHDAY",r.BYMONTHDAY,31).map((e=>f("BYMONTHDAY",e,-1,31))),new Set(i.byMonthDay).size!==i.byMonthDay.length)throw new u("BYMONTHDAY: repeated day")}if(void 0!==r.BYMONTH){if("YEARLY"!==o)throw new u("BYMONTH needs FREQ=YEARLY");if(i.byMonth=p("BYMONTH",r.BYMONTH,12).map((e=>f("BYMONTH",e,1,12))),new Set(i.byMonth).size!==i.byMonth.length)throw new u("BYMONTH: repeated month")}if(void 0!==r.BYSETPOS){if("MONTHLY"!==o||!i.byDay)throw new u("BYSETPOS needs FREQ=MONTHLY and BYDAY");i.bySetPos=f("BYSETPOS",r.BYSETPOS,-5,5)}if(void 0!==r.WKST){const e=c.indexOf(r.WKST);if(e<0)throw new u(`WKST: ${r.WKST} is not a weekday`);i.wkst=e}return i}function _(e){var t,n,r;const o=[`FREQ=${e.freq}`];return e.interval>1&&o.push(`INTERVAL=${e.interval}`),(null==(t=e.byMonth)?void 0:t.length)&&o.push(`BYMONTH=${e.byMonth.join(",")}`),(null==(n=e.byMonthDay)?void 0:n.length)&&o.push(`BYMONTHDAY=${e.byMonthDay.join(",")}`),(null==(r=e.byDay)?void 0:r.length)&&o.push(`BYDAY=${e.byDay.map((e=>`${e.ordinal??""}${c[e.weekday]}`)).join(",")}`),void 0!==e.bySetPos&&o.push(`BYSETPOS=${e.bySetPos}`),void 0!==e.count&&o.push(`COUNT=${e.count}`),void 0!==e.until&&o.push(`UNTIL=${10===e.until.length?e.until.replace(/-/g,""):e.until.replace(/[-:]/g,"").replace(/\.\d{3}/,"")}`),0!==e.wkst&&o.push(`WKST=${c[e.wkst]}`),o.join(";")}function m(e){const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return!1;const n=+t[1],r=+t[2],o=+t[3];return n>=1&&r>=1&&r<=12&&o>=1&&o<=g(n,r)}const w=e=>e%4==0&&e%100!=0||e%400==0;function g(e,t){return[31,w(e)?29:28,31,30,31,30,31,31,30,31,30,31][t-1]}const b=(e,t,n)=>Math.floor(Date.UTC(e,t-1,n)/864e5);function D(e){return b(+e.slice(0,4),+e.slice(5,7),+e.slice(8,10))}function v(e){return new Date(864e5*e).toISOString().slice(0,10)}function x(e){const t=new Date(864e5*e);return{y:t.getUTCFullYear(),m:t.getUTCMonth()+1,d:t.getUTCDate()}}const k=e=>((e+3)%7+7)%7,M=new Map;function O(e){let t=M.get(e);return t||(t=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),M.set(e,t)),t}function $(e){try{return O(e),!0}catch{return!1}}function S(e,t){const n={};for(const r of O(t).formatToParts(new Date(e)))"literal"!==r.type&&(n[r.type]=Number(r.value));return{y:n.year,m:n.month,d:n.day,h:24===n.hour?0:n.hour,mi:n.minute,s:n.second}}function T(e,t){const n=S(e,t);return Date.UTC(n.y,n.m-1,n.d,n.h,n.mi,n.s)-1e3*Math.floor(e/1e3)}function E(e,t,n,r){const o=864e5*e+6e4*t+1e3*n,i=o-T(o,r);return o-T(i,r)}function A(e,t){const n=S(e,t);return b(n.y,n.m,n.d)}function Y(e,t,n){const r=x(n),o=[],i=(e,t,n)=>{for(let r=0;r<t;r++)n.some((t=>void 0===t.ordinal&&t.weekday===k(e+r)))&&o.push(e+r)},a=(e,t,n)=>{const r=[];for(let o=0;o<t;o++)k(e+o)===n.weekday&&r.push(e+o);const i=n.ordinal>0?n.ordinal-1:r.length+n.ordinal;i>=0&&i<r.length&&o.push(r[i])},s=(e,t,n)=>{const r=g(e,t);for(const i of n){const n=i>0?i:r+i+1;n>=1&&n<=r&&o.push(b(e,t,n))}};switch(e.freq){case"DAILY":{const r=n+t*e.interval,{m:i,d:a}=x(r);if(e.byMonth&&!e.byMonth.includes(i))break;if(e.byMonthDay&&!e.byMonthDay.some((e=>e>0?e===a:g(x(r).y,i)+e+1===a)))break;if(e.byDay&&!e.byDay.some((e=>e.weekday===k(r))))break;o.push(r);break}case"WEEKLY":if(i(n-(k(n)-e.wkst+7)%7+t*e.interval*7,7,e.byDay??[{weekday:k(n)}]),e.byMonth)return o.filter((t=>e.byMonth.includes(x(t).m))).sort(((e,t)=>e-t));break;case"MONTHLY":{const n=12*r.y+(r.m-1)+t*e.interval,l=Math.floor(n/12),d=n%12+1,c=b(l,d,1),u=g(l,d);if(e.byMonthDay){if(s(l,d,e.byMonthDay),e.byDay){const t=o.filter((t=>e.byDay.some((e=>e.weekday===k(t)))));o.length=0,o.push(...t)}}else if(e.byDay){i(c,u,e.byDay);for(const t of e.byDay)void 0!==t.ordinal&&a(c,u,t)}else r.d<=u&&o.push(b(l,d,r.d));break}case"YEARLY":{const n=r.y+t*e.interval;if(e.byDay&&!e.byMonth&&!e.byMonthDay){const t=b(n,1,1),r=w(n)?366:365;i(t,r,e.byDay);for(const n of e.byDay)void 0!==n.ordinal&&a(t,r,n);break}const l=e.byMonth??[r.m];for(const t of l)if(e.byMonthDay)s(n,t,e.byMonthDay);else if(e.byDay){const r=b(n,t,1),o=g(n,t);i(r,o,e.byDay);for(const t of e.byDay)void 0!==t.ordinal&&a(r,o,t)}else r.d<=g(n,t)&&o.push(b(n,t,r.d));if(e.byMonthDay&&e.byDay){const t=o.filter((t=>e.byDay.some((e=>e.weekday===k(t)))));o.length=0,o.push(...t)}break}}const l=[...new Set(o)].sort(((e,t)=>e-t));if(void 0!==e.bySetPos){const t=e.bySetPos>0?e.bySetPos-1:l.length+e.bySetPos;return t>=0&&t<l.length?[l[t]]:[]}return l}function I(e,t,n){const r=x(n);switch(e.freq){case"DAILY":return n+t*e.interval;case"WEEKLY":return n-(k(n)-e.wkst+7)%7+t*e.interval*7;case"MONTHLY":{const n=12*r.y+(r.m-1)+t*e.interval;return b(Math.floor(n/12),n%12+1,1)}case"YEARLY":return b(r.y+t*e.interval,1,1)}}function N(e,t,n,r={}){var o;const i=r.limit??2e3,a=new Set(r.exdate??[]),s=[];let l,d,c,u=0,y=0,f="UTC";const p=r.viewerTz??"UTC";if("date"===t.kind)l=D(t.date),d=A(n.fromMs,p)-(r.durationDays??0),c=A(n.toMs-1,p);else{f=t.tz;const e=S(Date.parse(t.utc),f);l=b(e.y,e.m,e.d),u=60*e.h+e.mi,y=e.s,d=A(n.fromMs-(r.durationMs??0),f)-1,c=A(n.toMs,f)+1}const h=10===(null==(o=e.until)?void 0:o.length)?D(e.until):void 0,_=e.until&&e.until.length>10?Date.parse(e.until):void 0;let m=0;const w=o=>{if(void 0!==e.count&&m>=e.count)return!1;if(void 0!==h&&o>h)return!1;let i;if("date"===t.kind){if(void 0!==_&&864e5*o>_)return!1;const e=v(o);i={original:e,date:e}}else{const e=E(o,u,y,f);if(void 0!==_&&e>_)return!1;i={original:new Date(e).toISOString(),startMs:e}}return m+=1,a.has(i.original)||("date"===t.kind?o>=d&&o<=c&&s.push(i):i.startMs+(r.durationMs??0)>n.fromMs&&i.startMs<n.toMs&&s.push(i)),!0};if(l>c||!w(l))return s;let g=void 0===e.count?function(e,t,n){const r=x(t),o=x(n);let i;switch(e.freq){case"DAILY":i=Math.floor((n-t)/e.interval);break;case"WEEKLY":i=Math.floor((n-I(e,0,t))/(7*e.interval));break;case"MONTHLY":i=Math.floor((12*o.y+o.m-(12*r.y+r.m))/e.interval);break;case"YEARLY":i=Math.floor((o.y-r.y)/e.interval)}return Math.max(-1,i-1)}(e,l,d)+1:0;for(let b=0;b<2e5&&s.length<i&&!(I(e,g,l)>c);b++,g++)for(const t of Y(e,g,l))if(!(t<=l)){if(t>c)return s;if(!w(t)||s.length>=i)return s}return s}function L(e,t,n="UTC"){return!0===e.all_day?"string"==typeof e.start_date?{kind:"date",date:e.start_date}:null:"string"==typeof e.start?{kind:"datetime",utc:e.start,tz:t&&$(t)?t:n}:null}function R(e,t){return`${e}@${t}`}const C={1:"第一个",2:"第二个",3:"第三个",4:"第四个",5:"第五个",[-1]:"最后一个",[-2]:"倒数第二个",[-3]:"倒数第三个",[-4]:"倒数第四个",[-5]:"倒数第五个"},B={1:"first",2:"second",3:"third",4:"fourth",5:"fifth",[-1]:"last",[-2]:"second to last",[-3]:"third to last",[-4]:"fourth to last",[-5]:"fifth to last"},U=["周一","周二","周三","周四","周五","周六","周日"],j=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],H=["January","February","March","April","May","June","July","August","September","October","November","December"],F=e=>!!e&&5===e.length&&e.every((e=>void 0===e.ordinal))&&[0,1,2,3,4].every((t=>e.some((e=>e.weekday===t))));const q="buckyos.todo@1",P="buckyos.calendar@1",W="schedule",z="todo",K="calendar",Q="schedule-board",V="done",Z={zh:{title:"标题",status:"状态",due:"截止",order:"顺序",done_at:"完成时间",ext:"扩展",todo:"待办",doing:"进行中",done:"已完成",all_day:"全天",start:"开始",end:"结束",start_date:"开始日期",end_date:"结束日期",confirmed:"已确认",tentative:"暂定",cancelled:"已取消",todo_table:"待办",calendar_table:"日程",workspace:"我的日程",board:"日程"},en:{title:"Title",status:"Status",due:"Due",order:"Order",done_at:"Completed",ext:"Extension",todo:"To do",doing:"In progress",done:"Done",all_day:"All day",start:"Start",end:"End",start_date:"Start date",end_date:"End date",confirmed:"Confirmed",tentative:"Tentative",cancelled:"Cancelled",todo_table:"To-do",calendar_table:"Calendar",workspace:"My schedule",board:"Schedule"}};function J(e,t){return Z[e][t]??Z.en[t]??t}function G(e="zh"){const t=t=>J(e,t);return[{field_id:"title",name:t("title"),type:"text",required:!0},{field_id:"status",name:t("status"),type:"select",required:!0,options:["todo","doing","done"].map((e=>({option_id:e,label:t(e)})))},{field_id:"due",name:t("due"),type:"date",nullable:!0},{field_id:"order",name:t("order"),type:"text",nullable:!0},{field_id:"done_at",name:t("done_at"),type:"datetime",nullable:!0},{field_id:"ext",name:t("ext"),type:"json",nullable:!0}]}function X(e="zh"){const t=t=>J(e,t);return[{field_id:"title",name:t("title"),type:"text",required:!0},{field_id:"all_day",name:t("all_day"),type:"boolean",nullable:!0},{field_id:"start",name:t("start"),type:"datetime",nullable:!0},{field_id:"end",name:t("end"),type:"datetime",nullable:!0},{field_id:"start_date",name:t("start_date"),type:"date",nullable:!0},{field_id:"end_date",name:t("end_date"),type:"date",nullable:!0},{field_id:"status",name:t("status"),type:"select",nullable:!0,options:["confirmed","tentative","cancelled"].map((e=>({option_id:e,label:t(e)})))},{field_id:"ext",name:t("ext"),type:"json",nullable:!0}]}function ee(e,t){const n=t.locale??"zh";return{op:"entity.create",entity_id:t.entity_id,type_id:"buckyos.table-source",parent_id:t.parent_id,order_key:t.order_key,schema_id:"todo"===e?q:P,name:t.name??J(n,"todo"===e?"todo_table":"calendar_table"),payload:{title_field_id:"title",fields:"todo"===e?G(n):X(n)}}}const te="0123456789abcdefghijklmnopqrstuvwxyz";function ne(e){return"string"==typeof e&&e.length>0&&e.length<=64&&/^[0-9a-z]+$/.test(e)&&!e.endsWith("0")}function re(e,t){if(null!==t){let n=0;for(;n<t.length&&(e[n]??"0")===t[n];)n++;if(n>0)return t.slice(0,n)+re(e.length>n?e.slice(n):"",t.slice(n))}const n=e.length?te.indexOf(e[0]):0,r=null!==t?te.indexOf(t[0]):36;return r-n>1?te[Math.floor((n+r+1)/2)]:null!==t&&t.length>1?t[0]:te[n]+re(e.length>1?e.slice(1):"",null)}function oe(e,t){const n=e??null,r=t??null;if(null!==n&&null!==r&&n>=r)throw new Error("orderKeyBetween requires a < b");const o=null!==n&&null===r?function(e){const t=e.padEnd(Math.max(e.length,8),"0").split("");let n=t.length-1;for(;n>=0&&"z"===t[n];)n--;if(n>=0){t[n]=te[te.indexOf(t[n])+1];for(let e=n+1;e<t.length;e++)t[e]="0";return"0"===t[t.length-1]&&(t[t.length-1]="1"),t.join("")}if(t.length>=64)throw new Error("order key space exhausted; rebalance");return t.join("").padEnd(Math.min(t.length+8,64),"0").slice(0,-1)+"1"}(n):re(n??"",r);if(!ne(o))throw new Error("order key space exhausted; rebalance");return o}let ie=0;function ae(e="r"){ie=(ie+1)%1296;const t=Math.floor(Math.random()*36**6).toString(36).padStart(6,"0");return`${e}${Date.now().toString(36)}${ie.toString(36).padStart(2,"0")}${t}`}function se(e,t,n){var r;const o=[],i=[];for(const[s,l]of Object.entries(n)){const e={record_id:t.record_id,field_id:s,expect:{rev:(null==(r=t.revs)?void 0:r[s])??0}};null==l?void 0!==t.values[s]&&null!==t.values[s]&&i.push(e):o.push({...e,value:l})}const a=[];return o.length&&a.push({op:"table.set_values",source_id:e,values:o}),i.length&&a.push({op:"table.unset_values",source_id:e,values:i}),a}function le(e,t){return{op:"table.insert_records",source_id:e,records:t.map((e=>({record_id:e.record_id,values:Object.fromEntries(Object.entries(e.values).filter((([,e])=>null!=e)))})))}}function de(e,t){return{op:"table.delete_records",source_id:e,records:t.map((e=>({record_id:e.record_id,expect:{rev:e.rev??0}})))}}function ce(e){if(m(e))return e;const t=Date.parse(e);return Number.isFinite(t)?new Date(t).toISOString():e}const ue=e=>Array.isArray(e)?e.filter((e=>"string"==typeof e)).map(ce):[],ye=e=>{const t=null==e?void 0:e.values.ext;return t&&"object"==typeof t&&!Array.isArray(t)?{...t}:{}};function fe(e){const t=e.values,n="string"==typeof t.status?t.status:"todo";return{record_id:e.record_id,rev:e.rev,revs:e.revs,values:e.values,title:"string"==typeof t.title?t.title:"",status:n,due:"string"==typeof t.due?t.due:null,order:ne(t.order)?t.order:null,done:n===V,done_at:"string"==typeof t.done_at?t.done_at:null,ext:ye(e)}}function pe(e){return[...e].sort(((e,t)=>e.order===t.order?e.record_id.localeCompare(t.record_id):null===e.order?1:null===t.order||e.order<t.order?-1:1))}function he(e,t,n={}){const r=t.record_id??ae("t");let o=t.order??null;if(!o)if(void 0!==n.after||void 0!==n.before)o=oe(n.after??null,n.before??null);else{o=oe((n.items??[]).map((e=>e.order)).filter(ne).sort().pop()??null,null)}const i=t.status??"todo";return{record_id:r,order:o,ops:[le(e,[{record_id:r,values:{title:t.title,status:i,order:o,due:t.due??void 0,ext:t.ext&&Object.keys(t.ext).length?t.ext:void 0,done_at:i===V?t.done_at??(new Date).toISOString():void 0}}])]}}function _e(e,t,n,r={}){return se(e,t,n?{status:V,done_at:r.now??(new Date).toISOString()}:{status:r.reopenStatus??"todo",done_at:null})}function me(e,t,n,r={}){const o={},i="string"==typeof t.values.status?t.values.status:void 0;return void 0!==n.status&&n.status!==i&&(o.status=n.status,n.status===V?o.done_at=r.now??(new Date).toISOString():i===V&&(o.done_at=null)),void 0!==n.order&&n.order!==t.values.order&&(o.order=n.order),Object.keys(o).length?se(e,t,o):[]}function we(e,t,n){const r={};for(const o of["title","status","due","order","done_at"])void 0!==n[o]&&(r[o]=n[o]);if(void 0!==n.ext&&(r.ext=n.ext&&Object.keys(n.ext).length?n.ext:null),n.ext_merge){const e=ye(t);for(const[t,r]of Object.entries(n.ext_merge))null===r?delete e[t]:e[t]=r;r.ext=Object.keys(e).length?e:null}return void 0!==r.status&&r.status!==t.values.status&&void 0===r.done_at&&(r.status===V?r.done_at=(new Date).toISOString():t.values.status===V&&(r.done_at=null)),se(e,t,r)}function ge(e,t){const n=e.map((e=>e.order)),r=t>0?n[t-1]:null,o=t<n.length?n[t]:null;return null===r||ne(r)?null!==o&&ne(o)&&(null===r||r<o)?oe(r,o):oe(r,null):oe(null,null)}function be(e){const t=e.values;if(!0===t.all_day){if("string"!=typeof t.start_date||!m(t.start_date))return null;const e="string"==typeof t.end_date&&m(t.end_date)&&t.end_date>=t.start_date?t.end_date:t.start_date;return{allDay:!0,startDate:t.start_date,endDate:e}}if("string"!=typeof t.start)return null;const n=Date.parse(t.start);if(!Number.isFinite(n))return null;const r="string"==typeof t.end?Date.parse(t.end):NaN;return{allDay:!1,startMs:n,endMs:Number.isFinite(r)&&r>=n?r:n+36e5}}function De(e,t){return v(D(e)+t)}const ve=(e,t)=>D(t)-D(e);function xe(e,t,n){const r=ye(e);return{id:e.record_id,row:e,title:"string"==typeof e.values.title?e.values.title:"",allDay:t.allDay,startMs:t.startMs,endMs:t.endMs,startDate:t.startDate,endDate:t.endDate,status:"string"==typeof e.values.status?e.values.status:null,ext:r,recurring:!1,override:!1,agentWritten:!1,...n}}function ke(e,t,n){if(!e.allDay)return e.startMs<t.toMs&&Math.max(e.endMs,e.startMs+1)>t.fromMs;const r=Me(t.fromMs,n),o=Me(t.toMs-1,n);return e.startDate<=o&&e.endDate>=r}function Me(e,t){return new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date(e))}function Oe(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function $e(e,t,n={}){const r=n.viewerTz??Oe(),o=[],i=new Map;for(const s of e){const e=ye(s).recurrence_id;e&&"object"==typeof e&&!Array.isArray(e)&&"string"==typeof e.master&&"string"==typeof e.original&&i.set(`${e.master}@${ce(e.original)}`,s)}const a=new Map(e.map((e=>[e.record_id,e])));for(const s of e){const e=be(s);if(!e)continue;const l=ye(s),d=l.recurrence_id;if(d&&"object"==typeof d){const n="string"==typeof d.master?a.get(d.master):void 0,i="string"==typeof d.original?ce(d.original):void 0,l=xe(s,e,{id:n&&i?R(n.record_id,i):s.record_id,master:n,original:i,recurring:Boolean(n),override:!0});ke(l,t,r)&&o.push(l);continue}const c=e.allDay?ve(e.startDate,e.endDate):e.endMs-e.startMs,u=t=>{const n=`${s.record_id}@${t.original}`;return i.has(n)?null:e.allDay?xe(s,{allDay:!0,startDate:t.date,endDate:De(t.date,c)},{id:n,master:s,original:t.original,recurring:!0}):xe(s,{allDay:!1,startMs:t.startMs,endMs:t.startMs+c},{id:n,master:s,original:t.original,recurring:!0})};let y=null;if("string"==typeof l.rrule)try{y=h(l.rrule)}catch{y=null}if(y){const i=L(s.values,"string"==typeof l.tz?l.tz:void 0,r);if(!i)continue;const a=N(y,i,t,{exdate:ue(l.exdate),viewerTz:r,durationMs:e.allDay?void 0:c,durationDays:e.allDay?c:void 0,limit:n.limit});for(const e of a){const t=u(e);t&&o.push(t)}continue}if(Array.isArray(l.occurrences)&&l.occurrences.length>0){const n=new Set(ue(l.exdate));for(const i of l.occurrences){if("string"!=typeof i)continue;const a=ce(i);if(n.has(a))continue;const s=e.allDay?{original:a,date:a}:{original:a,startMs:Date.parse(a)};if(!e.allDay&&!Number.isFinite(s.startMs))continue;if(e.allDay&&!m(a))continue;const l=u(s);l&&ke(l,t,r)&&o.push({...l,agentWritten:!0})}continue}const f=xe(s,e,{});ke(f,t,r)&&o.push(f)}return o.sort(((e,t)=>Se(e)-Se(t)||e.id.localeCompare(t.id)))}const Se=e=>e.allDay?Date.parse(`${e.startDate}T00:00:00Z`):e.startMs;function Te(e,t){const n=t.record_id??ae("e"),r={title:t.title,status:t.status??void 0,ext:t.ext&&Object.keys(t.ext).length?t.ext:void 0};return t.all_day?(r.all_day=!0,r.start_date=t.start_date??void 0,r.end_date=t.end_date&&t.end_date!==t.start_date?t.end_date:void 0):(r.start=t.start??void 0,r.end=t.end??void 0),{record_id:n,ops:[le(e,[{record_id:n,values:r}])]}}function Ee(e){return e.allDay?{all_day:!0,start_date:e.startDate,end_date:e.endDate!==e.startDate?e.endDate:null,start:null,end:null}:{all_day:null,start:e.start,end:e.end,start_date:null,end_date:null}}function Ae(e,t){return e.filter((e=>{const n=ye(e).recurrence_id;return n&&"object"==typeof n&&n.master===t}))}function Ye(e,t,n,r){return t?De(e,r):((e,t)=>new Date(Date.parse(e)+t).toISOString())(e,n)}function Ie(e,t,n,r,o){const i=o.newRecordId??(()=>ae("e")),a=e=>{const t={...n.values};if(n.ext_merge){const r=ye(e);for(const[e,t]of Object.entries(n.ext_merge))null===t?delete r[e]:r[e]=t;t.ext=Object.keys(r).length?r:null}return t},s=t.master;if(!s||t.row!==s&&"one"===r){const r=t.row,o={...a(r),...n.times?Ee(n.times):{}};if(void 0!==n.rrule&&!s){const e={...o.ext??ye(r)??{}};null===n.rrule?delete e.rrule:e.rrule=_(h(n.rrule)),null===n.rrule&&delete e.exdate,o.ext=Object.keys(e).length?e:null}return{ops:se(e,r,o),record_id:r.record_id}}const l=t.original,d=be(s),c=ye(s);if("one"===r){const r=i(),o={...c,recurrence_id:{master:s.record_id,original:l}};delete o.rrule,delete o.exdate,delete o.occurrences,delete o.rule_text,delete o.covered_until,delete o.maintenance;const u={title:s.values.title,status:s.values.status,ext:o},y=n.times??(t.allDay?{allDay:!0,startDate:t.startDate,endDate:De(t.startDate,ve(d.startDate,d.endDate))}:{allDay:!1,start:new Date(t.startMs).toISOString(),end:new Date(t.startMs+(d.endMs-d.startMs)).toISOString()}),f={...u,...a({record_id:r,values:{ext:o}}),...Ee(y)};return f.ext||(f.ext=o),{ops:[le(e,[{record_id:r,values:f}])],record_id:r}}let u=0,y=0,f=d.allDay?0:d.endMs-d.startMs,p=d.allDay?ve(d.startDate,d.endDate):0;if(n.times){if(n.times.allDay!==d.allDay)throw new Error("changing a series between all-day and timed: edit the series itself (scope all) with new times");n.times.allDay?(y=ve(l,n.times.startDate),p=ve(n.times.startDate,n.times.endDate)):(u=Date.parse(n.times.start)-Date.parse(l),y=Math.round(u/864e5),f=Date.parse(n.times.end)-Date.parse(n.times.start))}const m="string"==typeof c.rrule?h(c.rrule):null,w=Ae(o.rows,s.record_id),g=ue(c.exdate),b=d.allDay?l===d.startDate:l===new Date(d.startMs).toISOString(),D=(e,t)=>d.allDay?{allDay:!0,startDate:De(t,y),endDate:De(De(t,y),p)}:{allDay:!1,start:new Date(e+u).toISOString(),end:new Date(e+u+f).toISOString()},v=e=>void 0!==n.rrule?null===n.rrule?null:_(h(n.rrule)):e?_(function(e,t){if(!t)return e;const n={...e};if(e.byDay&&e.byDay.every((e=>void 0===e.ordinal))&&("WEEKLY"===e.freq||"DAILY"===e.freq))n.byDay=e.byDay.map((e=>({weekday:((e.weekday+t)%7+7)%7})));else if(e.byDay&&"MONTHLY"===e.freq&&1===e.byDay.length&&void 0===e.bySetPos&&Math.abs(t)<7)n.byDay=[{...e.byDay[0],weekday:((e.byDay[0].weekday+t)%7+7)%7}];else if(e.byMonthDay&&1===e.byMonthDay.length&&e.byMonthDay[0]>0){const r=e.byMonthDay[0]+t;r>=1&&r<=28&&(n.byMonthDay=[r])}return n}(e,y)):null,x=[];if("all"===r||b){const t=D(d.startMs,d.startDate),n={...c},r=v(m);r?n.rrule=r:(delete n.rrule,delete n.exdate),r&&g.length&&(n.exdate=g.map((e=>Ye(e,d.allDay,u,y))));const o=a({record_id:s.record_id,values:{ext:n}}),i=void 0!==o.ext?o.ext:n;x.push(...se(e,s,{...o,...Ee(t),ext:i&&Object.keys(i).length?i:null}));for(const a of w){const t=ye(a),n=t.recurrence_id;r?(u||y)&&x.push(...se(e,a,{ext:{...t,recurrence_id:{...n,original:Ye(String(n.original),d.allDay,u,y)}}})):x.push(de(e,[a]))}return{ops:x,record_id:s.record_id}}if(!m)throw new Error("not a repeating event");const k=i(),M=e=>d.allDay?e<l:Date.parse(e)<Date.parse(l);let O={...m},$={...m};if(void 0!==m.count){const e=N(m,L(s.values,"string"==typeof c.tz?c.tz:void 0),{fromMs:d.allDay?Date.parse(`${d.startDate}T00:00:00Z`)-1728e5:d.startMs,toMs:d.allDay?Date.parse(`${l}T00:00:00Z`):Date.parse(l)},{viewerTz:"UTC"}).filter((e=>M(e.original))).length;O={...m,count:Math.max(1,e)},$={...m,count:Math.max(1,m.count-e)}}else O={...m,until:d.allDay?De(l,-1):new Date(Date.parse(l)-1e3).toISOString().replace(/\.\d{3}Z$/,".000Z")};const S={...c,rrule:_(O)},T=g.filter(M);T.length?S.exdate=T:delete S.exdate,x.push(...se(e,s,{ext:S}));const E={...c},A=v($);A?E.rrule=A:delete E.rrule;const Y=g.filter((e=>!M(e))).map((e=>Ye(e,d.allDay,u,y)));Y.length&&A?E.exdate=Y:delete E.exdate;const I=D(d.allDay?void 0:Date.parse(l),d.allDay?l:void 0),R=a({record_id:k,values:{ext:E}}),C={title:s.values.title,status:s.values.status,...R,...Ee(I)};C.ext=(void 0!==R.ext?R.ext:E)??void 0,x.push(le(e,[{record_id:k,values:C}]));for(const h of w){const t=ye(h),n=t.recurrence_id;M(String(n.original))||(A?x.push(...se(e,h,{ext:{...t,recurrence_id:{master:k,original:Ye(String(n.original),d.allDay,u,y)}}})):x.push(de(e,[h])))}return{ops:x,record_id:k}}function Ne(e,t,n,r){const o=t.master;if(!o)return[de(e,[t.row])];const i=t.original,a=ye(o),s=be(o),l=Ae(r.rows,o.record_id),d=s.allDay?i===s.startDate:i===new Date(s.startMs).toISOString();if("all"===n||"following"===n&&d)return[de(e,[o,...l])];const c=[];if("one"===n){const t=ue(a.exdate);t.includes(i)||c.push(...se(e,o,{ext:{...a,exdate:[...t,i].sort()}}));const n=l.filter((e=>ce(String(ye(e).recurrence_id.original))===i));return n.length&&c.push(de(e,n)),c}const u="string"==typeof a.rrule?h(a.rrule):null;if(!u)return[de(e,[t.row])];const y=e=>s.allDay?e<i:Date.parse(e)<Date.parse(i),f={...u,count:void 0,until:s.allDay?De(i,-1):new Date(Date.parse(i)-1e3).toISOString()},p={...a,rrule:_(f)};if(Array.isArray(a.exdate)){const e=ue(a.exdate).filter(y);e.length?p.exdate=e:delete p.exdate}c.push(...se(e,o,{ext:p}));const m=l.filter((e=>!y(String(ye(e).recurrence_id.original))));return m.length&&c.push(de(e,m)),c}const Le=1e3;function Re(e){var n,r,o,i;const a=null==(n=e.errors)?void 0:n[0];if("conflict"===e.status){const n=null==(r=e.conflicts)?void 0:r[0];return new t({code:e.code??"REVISION_CONFLICT",retryable:!0,detail:"changed meanwhile, read it again"+(n?`: ${JSON.stringify(n.selector??n)}`:"")})}return new t({code:e.code??(null==(o=e.error)?void 0:o.code)??"REJECTED",sub_code:e.sub_code??(null==a?void 0:a.sub_code),retryable:!1,detail:(null==a?void 0:a.detail)??e.detail??(null==(i=e.error)?void 0:i.detail)??"refused"})}function Ce(e,n){const r=n.indexOf("@"),o=r<0?n:n.slice(0,r),i=r<0?null:ce(n.slice(r+1)),a=e.find((e=>e.record_id===o));if(!a)throw new t({code:"NOT_FOUND",retryable:!1,detail:`event ${o} not found`});if(null===i){const n=be(a);if(!n)throw new t({code:"INVALID_OPERATION",retryable:!1,detail:`event ${o} has no time`});const r=ye(a),i=r.recurrence_id,s=i&&"string"==typeof i.master?e.find((e=>e.record_id===i.master)):void 0;return xe(a,n,s?{master:s,original:String(i.original),recurring:!0,override:!0}:{recurring:"string"==typeof r.rrule,master:"string"==typeof r.rrule?a:void 0,original:"string"==typeof r.rrule?n.allDay?n.startDate:new Date(n.startMs).toISOString():void 0})}const s=e.find((e=>{const t=ye(e).recurrence_id;return t&&t.master===o&&"string"==typeof t.original&&ce(t.original)===ce(i)})),l=be(a);if(!l)throw new t({code:"INVALID_OPERATION",retryable:!1,detail:`event ${o} has no time`});if(s)return xe(s,be(s),{id:n,master:a,original:i,recurring:!0,override:!0});const d=l.allDay,c=d?0:l.endMs-l.startMs,u=d?ve(l.startDate,l.endDate):0;return xe(a,d?{allDay:!0,startDate:i,endDate:De(i,u)}:{allDay:!1,startMs:Date.parse(i),endMs:Date.parse(i)+c},{id:n,master:a,original:i,recurring:!0})}function Be(e="zh"){const t=`${Q}-content`,n=J(e,"board");return[{op:"entity.create",entity_id:t,type_id:"buckyos.container",parent_id:"canvas-content",order_key:"u",name:n,payload:{kind:"folder",title:n,system:"surface_content",surface_id:Q}},{op:"entity.create",entity_id:Q,type_id:"buckyos.container",parent_id:"surfaces",order_key:"a",name:n,payload:{kind:"surface",layout:{mode:"free"},title:n,content_folder_id:t}},{op:"entity.create",entity_id:`${Q}-calendar`,type_id:"buckyos.container",parent_id:Q,order_key:"a",placement:{x:40,y:40,w:880,h:640},payload:{kind:"calendar",layout:{mode:"data"},title:J(e,"calendar_table"),bindings:{events:[{entity_id:K}],todo:[{entity_id:z}]},config:{view:"week"}}},{op:"entity.create",entity_id:`${Q}-todo`,type_id:"buckyos.container",parent_id:Q,order_key:"b",placement:{x:960,y:40,w:420,h:640},payload:{kind:"todo",layout:{mode:"data"},title:J(e,"todo_table"),bindings:{items:{entity_id:z}},config:{mode:"list"}}}]}class Ue extends Error{constructor(e,t,n,r){super(e),this.code=t,this.node=n,this.binding=r}}const je=[q,P],He=e=>void 0===e?[]:Array.isArray(e)?e:[e],Fe=(e,t)=>t.title??e;function qe(e,t){return!(e.accepts&&e.accepts.length>0&&!e.accepts.includes(t.type_id))&&(!e.schema_id||t.schema_id===e.schema_id)}const Pe=e=>{var t;return{...(null==(t=e.accepts)?void 0:t.length)?{accepts:e.accepts}:{},...e.schema_id?{schema_id:e.schema_id}:{}}};function We(){const e=e=>{throw new Ue(`needs a choice: ${e}`,"NEEDS_UI")};return{pickOne:async t=>e(t.title),pickMany:async t=>e(t.title),confirm:async t=>e(t.title)}}let ze=0;const Ke=()=>"ref:"+ ++ze;function Qe(e,t,n){const r=e=>{throw new Ue(`on_bind result: ${e}`,"INVALID",n)},o=e=>"object"==typeof e&&null!==e&&!Array.isArray(e);if(!o(e)||!o(e.bindings))return r("{ bindings, create? } (or null to cancel)");const i=void 0===e.create?[]:e.create;if(!Array.isArray(i)||i.length>16)return r("create: a list of at most 16");const a=new Map,s=i.map(((e,t)=>{const n=`create[${t}]`;if(!o(e)||"string"!=typeof e.ref||!e.ref)return r(`${n}: { ref, kind, … }`);if(a.has(e.ref))return r(`${n}: ref ${e.ref} twice`);const i=Ke();a.set(e.ref,i);const s="string"==typeof e.name&&e.name.trim()&&e.name.length<=128?e.name.trim():null;return"standard"===e.kind?"string"!=typeof e.schema_id?r(`${n}: a standard table names its schema_id`):{ref:i,kind:"standard",schema_id:e.schema_id,name:s??e.schema_id}:s?"table"===e.kind?Array.isArray(e.fields)&&0!==e.fields.length?void 0!==e.title_field_id&&"string"!=typeof e.title_field_id?r(`${n}: title_field_id is a field id`):{ref:i,kind:"table",name:s,fields:e.fields,...e.title_field_id?{title_field_id:e.title_field_id}:{}}:r(`${n}: a table lists its fields`):"dir"===e.kind?{ref:i,kind:"dir",name:s}:r(`${n}: kind standard, table or dir`):r(`${n}: a name (at most 128 characters)`)})),l={},d=new Set;for(const[u,y]of Object.entries(e.bindings)){const e=t[u];if(!e)return r(`${u} is not a declared binding`);if(null==y)continue;const n="string"==typeof y?[y]:Array.isArray(y)&&y.every((e=>"string"==typeof e&&e))?y:r(`${u}: an id, or a list of ids`);if(!e.many&&(Array.isArray(y)||1!==n.length))return r(`${u} takes one`);if(n.length>32||new Set(n).size!==n.length)return r(`${u}: at most 32, each once`);const o=n.map((e=>(a.has(e)&&d.add(e),a.get(e)??e)));e.many?o.length>0&&(l[u]=o):l[u]=o[0]}const c=[...a.keys()].filter((e=>!d.has(e)));return c.length>0?r(`created but not bound: ${c.join(", ")}`):{bindings:l,create:s}}const Ve=async e=>{const t={},n=[],r=e.parent?Object.values(e.parent.bound).flatMap(He):[],o=new Map(e.find({}).map((e=>[e.entity_id,e])));for(const[i,a]of Object.entries(e.decls)){const s=(t,n)=>new Ue(t,n,e.node,i);if("rebind"===e.reason){if(void 0!==e.given[i]&&e.no_ui){t[i]=e.given[i];continue}const r=He(e.given[i]);if(a.many){const o=await Je(i,(()=>e.dialogs.pickMany({title:Fe(i,a),query:Pe(a),preselect:r,allow_new:e.canCreate(a)})));if(null===o)return null;t[i]=o.map((t=>{if("string"==typeof t)return t;const r=Ke();return n.push(Ze(r,a,e.title)),r}))}else{const o=await Je(i,(()=>e.dialogs.pickOne({title:Fe(i,a),query:Pe(a),allow_new:e.canCreate(a),current:r[0]??null})));if(null===o)return null;if("string"==typeof o)t[i]=o;else{const r=Ke();n.push(Ze(r,a,e.title)),t[i]=r}}continue}if(void 0!==e.given[i]){t[i]=a.many?He(e.given[i]):He(e.given[i])[0];continue}const l=r.filter((e=>{const t=o.get(e);return void 0!==t&&qe(a,t)}));if(a.many&&l.length>0){t[i]=l;continue}if(!a.many&&1===l.length){t[i]=l[0];continue}const d=e.find(Pe(a)).filter((e=>qe(a,e)));if(0===d.length){if(!a.required)continue;if(!e.canCreate(a))throw s(`no ${Fe(i,a)} in this Workspace yet`,"NO_DATA");const r=Ke();n.push(Ze(r,a,e.title)),t[i]=a.many?[r]:r}else if(a.many)t[i]=d.map((e=>e.entity_id));else if(1===d.length)t[i]=d[0].entity_id;else if(a.required){const r=await Je(i,(()=>e.dialogs.pickOne({title:Fe(i,a),query:Pe(a),allow_new:e.canCreate(a)})));if(null===r)return null;if("string"==typeof r)t[i]=r;else{const r=Ke();n.push(Ze(r,a,e.title)),t[i]=r}}}return{bindings:t,create:n}};function Ze(e,t,n){return{ref:e,kind:"standard",schema_id:t.schema_id,name:n||t.title||"Table"}}async function Je(e,t){try{return await t()}catch(n){if(n instanceof Ue&&"NEEDS_UI"===n.code)throw new Ue(`binding ${e} needs a choice: give it`,"NEEDS_UI",void 0,e);throw n}}function Ge(e){return async t=>{var n;const r={},o=[];for(const a of e){const e=t.decls[a.binding]??{};if(void 0===t.given[a.binding]||"insert"!==t.reason)if("from_parent"in a){const o=null==(n=t.parent)?void 0:n.bound[a.from_parent];void 0!==o&&(r[a.binding]=e.many?He(o):He(o)[0])}else if("pick"in a){const n=Pe(e),i=a.title??Fe(a.binding,e),s=!1!==a.allow_new&&t.canCreate(e),l=He(t.given[a.binding]);if("all"===a.pick)r[a.binding]=t.find(n).filter((t=>qe(e,t))).map((e=>e.entity_id));else if("many"===a.pick){const d=await Je(a.binding,(()=>t.dialogs.pickMany({title:i,query:n,preselect:l.length?l:"none",allow_new:s})));if(null===d)return null;r[a.binding]=d.map((n=>{if("string"==typeof n)return n;const r=Ke();return o.push(Ze(r,e,t.title)),r}))}else{const d=await Je(a.binding,(()=>t.dialogs.pickOne({title:i,query:n,allow_new:s,current:l[0]??null})));if(null===d)return null;if("string"==typeof d)r[a.binding]=e.many?[d]:d;else{const n=Ke();o.push(Ze(n,e,t.title)),r[a.binding]=e.many?[n]:n}}}else{const n=0===t.find(Pe(e)).filter((t=>qe(e,t))).length;if("missing"===(a.when??"missing")&&!n)continue;const i=Ke(),s=a.create;o.push("standard"in s?{ref:i,kind:"standard",schema_id:s.standard,name:Fe(a.binding,e)}:"table"in s?{ref:i,kind:"table",name:s.table.name,title_field_id:s.table.title_field_id,fields:s.table.fields}:{ref:i,kind:"dir",name:s.dir.name}),r[a.binding]=e.many?[i]:i}else r[a.binding]=t.given[a.binding]}const i=Object.fromEntries(Object.entries(t.decls).filter((([e])=>void 0===r[e])));if(Object.keys(i).length>0){const e=await Ve({...t,decls:i});if(null===e)return null;Object.assign(r,e.bindings),o.push(...e.create)}return{bindings:r,create:o}}}const Xe=async e=>{const t=(n=e.decls,r=e.bound,Object.entries(n).filter((([e,t])=>t.required&&0===He(r[e]).length)).map((([e,t])=>Fe(e,t))));var n,r;if(t.length>0)return`${e.title}: ${t.join(", ")} not bound`;const o=e.children.filter((e=>!e.ready));return!(o.length>0)||`not ready: ${o.map((e=>`${e.title} (${e.missing.join(", ")})`)).join("; ")}`};exports.AIWORKSPACE_SERVICE_NAME="aiworkspace",exports.AIWS_COMMIT_MAX_BYTES=o,exports.AIWS_COMMIT_MAX_OPERATIONS=i,exports.AIWS_COMMIT_PART_BYTES=r,exports.AIWS_PROTOCOL_VERSION="1.2",exports.AiWorkspaceClient=class{constructor(e){this.rpcClient=e,this.raw=(e,t)=>this.rpcClient.call(e,t)}async call(e,n){const r=await this.rpcClient.call(e,n);if(r&&"object"==typeof r&&!1===r.ok)throw new t(r.error);return r}create(e,t={}){return this.call("ws.create",{title:e,...t})}ensure(e,t){return this.call("ws.ensure",{name:e,...void 0===t?{}:{title:t}})}time(){return this.call("ws.time",{})}list(){return this.call("ws.list",{})}info(e){return this.call("ws.get_info",{workspace_id:e})}getUserState(e){return this.call("ws.get_user_state",{workspace_id:e})}setUserState(e,t,n){return this.call("ws.set_user_state",{workspace_id:e,entries:t,...n?{expect:n}:{}})}resolve(e,t){return this.call("doc.resolve",{workspace_id:e,reference:t})}resolvePath(e,t){return this.call("doc.resolve",{workspace_id:e,path:t})}read(e,t,r){return this.call("doc.read",{workspace_id:e,...n(t),...r?{selector:r}:{}})}readMeta(e,t){return this.call("doc.read",{workspace_id:e,...n(t),as:"meta"})}readBody(e,t,r={}){return this.call("doc.read",{workspace_id:e,...n(t),as:"body",...r})}listEntities(e,t={}){return this.call("doc.list",{workspace_id:e,...t})}findEntities(e,t={}){return this.call("doc.find",{workspace_id:e,...t})}textQuery(e,t,n={}){return this.call("doc.query",{workspace_id:e,text:t,...n})}sql(e,t,n={}){return this.call("doc.query",{workspace_id:e,sql:t,...n})}sourceQuery(e,t,n){return this.call("doc.source_query",{workspace_id:e,source_id:t,...n})}outline(e){return this.call("doc.outline",{workspace_id:e})}prepare(e,t){return d(this.raw,{workspace_id:e,...t},{method:"doc.prepare"})}commit(e,t,n={}){return d(this.raw,{workspace_id:e,...t},n)}getSubmission(e,t,n){return this.call("doc.get_submission",{workspace_id:e,epoch:t,idempotency_key:n})}getChanges(e,t,n,r={}){return this.call("doc.get_changes",{workspace_id:e,epoch:t,after_seq:n,...r.limit?{limit:r.limit}:{},...r.touchedOnly?{filter:{detail:"touched"}}:{}})}waitChanges(e,t,n={}){return this.call("doc.wait_changes",{workspace_id:e,after_seq:t,...n})}exportDoc(e,t,n,r){return this.call("doc.export",{workspace_id:e,mode:t,self_contained:n,...void 0===r?{}:{include_notes:r}})}assetImportObject(e,t){return this.call("asset.import_object",{workspace_id:e,...t})}controlsList(){return this.call("control.list",{})}controlsDescribe(e){return this.call("control.describe",{kind:e})}controlsImport(e,t){return this.call("control.import",{workspace_id:e,...t})}controlsExport(e,t,n){return this.call("control.export",{workspace_id:e,entity_id:t,...n?{format:n}:{}})}extBuild(e,t){return this.call("ext.build",{workspace_id:e,...t})}extExport(e,t,n="package"){return this.call("ext.export",{workspace_id:e,entity_ids:t,purpose:n})}extInstall(e){return this.call("ext.install",e)}extPack(e,t,n,r){return this.call("ext.pack",{workspace_id:e,entity_ids:t,package:n,...r?{templates:r}:{}})}extUpgrade(e){return this.call("ext.upgrade",{...e})}extExportTemplate(e){return this.call("ext.export_template",{...e})}extCreateFromTemplate(e){return this.call("ext.create_from_template",e)}extListLibrary(){return this.call("ext.list_library",{})}extUninstall(e){return this.call("ext.uninstall",{pkg_id:e})}extLibraryBundle(e,t){return this.call("ext.library_bundle",{pkg_id:e,...t?{idents:t}:{}})}extImport(e,t,n={}){return this.call("ext.import",{workspace_id:e,items:t,...n})}runStart(e,t,n,r){return this.call("proc.start",{workspace_id:e,program:t,params:n,idempotency_key:r})}runGet(e,t){return this.call("proc.get",{workspace_id:e,run_id:t})}runList(e,t,n){return this.call("proc.list",{workspace_id:e,...t?{wish_id:t}:{},...n?{limit:n}:{}})}runClaim(e,t,n,r){return this.call("proc.claim",{workspace_id:e,run_id:t,claim_token:n,...r?{executor:r}:{}})}runHeartbeat(e,t,n,r){return this.call("proc.heartbeat",{workspace_id:e,run_id:t,attempt:n,...r?{progress:r}:{}})}runReport(e,t){return this.call("proc.report",{workspace_id:e,...t})}runRollback(e,t,n={}){return this.call("proc.rollback",{workspace_id:e,run_id:t,...n.confirm?{confirm:!0}:{},...n.session_id?{session_id:n.session_id}:{}})}runCancel(e,t){return this.call("proc.cancel",{workspace_id:e,run_id:t})}},exports.AiwsFailure=t,exports.BindFailure=Ue,exports.CALENDAR_SCHEMA_ID=P,exports.RRuleError=u,exports.SCHEDULE_CALENDAR_ID=K,exports.SCHEDULE_SURFACE_ID=Q,exports.SCHEDULE_TODO_ID=z,exports.SCHEDULE_WORKSPACE_NAME=W,exports.STANDARD_SCHEMAS=je,exports.ScheduleClient=class{constructor(e,t={}){this.aiws=e,this.handle=null,this.locale=t.locale??"zh"}async ensure(){var e,t,n;if(this.handle)return this.handle;const r=await this.aiws.call("ws.ensure",{name:W,title:J(this.locale,"workspace")}),o={workspace_id:r.workspace_id,epoch:r.epoch,created:r.created,todo:z,calendar:K},i=new Set;for(const l of[z,K,Q])try{(await this.aiws.call("doc.read",{workspace_id:r.workspace_id,entity_id:l})).deleted||i.add(l)}catch(s){const e=null==s?void 0:s.code;if("NOT_FOUND"!==e&&"TARGET_DELETED"!==e)throw s}const a=[];if(i.has(z)||a.push(ee("todo",{entity_id:z,parent_id:"data",order_key:"u",locale:this.locale})),i.has(K)||a.push(ee("calendar",{entity_id:K,parent_id:"data",order_key:"v",locale:this.locale})),i.has(Q)||a.push(...Be(this.locale)),a.length){const r=await this.commitTo(o,a,"create the schedule","system"),i="ID_CONFLICT"===(r.sub_code??(null==(t=null==(e=r.errors)?void 0:e[0])?void 0:t.sub_code)??(null==(n=r.error)?void 0:n.sub_code));if("accepted"!==r.status&&("rejected"!==r.status||!i))throw Re(r)}return this.handle=o,o}async commitTo(e,t,n,r="agent"){var o;const i=`sched-${ae("k")}`,a=o=>({protocol_version:"1.2",workspace_id:e.workspace_id,epoch:o,idempotency_key:i,origin:r,message:n,operations:t});let s=await this.aiws.call("doc.commit",a(e.epoch));if("rejected"===s.status&&"EPOCH_MISMATCH"===(s.code??(null==(o=s.error)?void 0:o.code))){const t=await this.aiws.call("ws.get_info",{workspace_id:e.workspace_id});e.epoch=t.epoch,s=await this.aiws.call("doc.commit",a(e.epoch))}return s}async commit(e,t){const n=await this.ensure(),r=await this.commitTo(n,e,t);if("accepted"!==r.status)throw Re(r);return r}async rows(e){const t=await this.ensure(),n=[];for(let r=0;r<100;r++){const o=await this.aiws.call("doc.query",{workspace_id:t.workspace_id,sql:'SELECT "_record" FROM t ORDER BY "_id" LIMIT ? OFFSET ?',params:[Le,r*Le],tables:{t:e},max_rows:Le});for(const[e]of o.rows)n.push("string"==typeof e?JSON.parse(e):e);if(o.rows.length<Le)break}return n}async row(e,n){const r=await this.ensure(),o=(await this.aiws.call("doc.read",{workspace_id:r.workspace_id,entity_id:e,selector:{kind:"table_record",record_id:n}})).content;if(!(null==o?void 0:o.record_id))throw new t({code:"NOT_FOUND",retryable:!1,detail:`record ${n} not found`});return o}async todos(e={}){const t=pe((await this.rows(z)).map(fe));return e.includeDone?t:t.filter((e=>!e.done))}async addTodo(e,t={}){var n,r,o,i;const a=pe((await this.rows(z)).map(fe)),s=e=>a.find((t=>t.record_id===e));let l={items:a};if(t.after){const e=a.findIndex((e=>e.record_id===t.after));l={after:(null==(n=s(t.after))?void 0:n.order)??null,before:(null==(r=a[e+1])?void 0:r.order)??null}}else if(t.before){const e=a.findIndex((e=>e.record_id===t.before));l={after:(null==(o=a[e-1])?void 0:o.order)??null,before:(null==(i=s(t.before))?void 0:i.order)??null}}const{record_id:d,ops:c}=he(z,e,l);return await this.commit(c,`add to-do: ${e.title}`),fe(await this.row(z,d))}async completeTodo(e,t=!0){const n=await this.row(z,e),r=_e(z,n,t);r.length&&await this.commit(r,`${t?"complete":"reopen"} to-do ${e}`)}async updateTodo(e,t){const n=await this.row(z,e),r=we(z,n,t);r.length&&await this.commit(r,`update to-do ${e}`)}async moveTodo(e,n){const r=pe((await this.rows(z)).map(fe)),o=r.find((t=>t.record_id===e));if(!o)throw new t({code:"NOT_FOUND",retryable:!1,detail:`to-do ${e} not found`});const i=r.filter((t=>t.record_id!==e));let a;if(n.before||n.after){const e=i.findIndex((e=>e.record_id===(n.before??n.after)));if(e<0)throw new t({code:"NOT_FOUND",retryable:!1,detail:`to-do ${n.before??n.after} not found`});a=ge(i,n.before?e:e+1)}const s=me(z,o,{status:n.status,order:a});s.length&&await this.commit(s,`move to-do ${e}`)}async removeTodos(e){const t=await Promise.all(e.map((e=>this.row(z,e))));await this.commit([de(z,t)],`delete to-do ${e.join(", ")}`)}async events(e,t={}){return $e(await this.rows(K),e,t)}async addEvent(e){var t;void 0!==(null==(t=e.ext)?void 0:t.rrule)&&"string"==typeof e.ext.rrule&&(e={...e,ext:{...e.ext,rrule:_(h(e.ext.rrule))}});const{record_id:n,ops:r}=Te(K,e);return await this.commit(r,`add event: ${e.title}`),n}async occurrence(e){const t=await this.rows(K);return{occ:Ce(t,e),rows:t}}async editEvent(e,t,n="one"){const{occ:r,rows:o}=await this.occurrence(e),{ops:i,record_id:a}=Ie(K,r,t,n,{rows:o});return i.length&&await this.commit(i,`edit event ${e} (${n})`),a}async deleteEvent(e,t="one"){const{occ:n,rows:r}=await this.occurrence(e);await this.commit(Ne(K,n,t,{rows:r}),`delete event ${e} (${t})`)}},exports.TODO_DONE=V,exports.TODO_SCHEMA_ID=q,exports.WEEKDAYS=c,exports.aiwsReferenceUrl=function(t,n){const r=t.workspace_id??n;if(!r)throw new Error("reference names no workspace");const o=[];"fixed"===t.mode&&o.push("mode=fixed"),null!=t.selector&&o.push(`selector=${e.encodeObjQueryComponent(e.canonicalJson(t.selector))}`),null!=t.version&&o.push(`version=${e.encodeObjQueryComponent(e.canonicalJson(t.version))}`);const i=e.objServiceUrl("aiworkspace",[r,"entities",t.entity_id]);return e.normalizeObjectUrl(o.length?`${i}?${o.join("&")}`:i)},exports.aiwsTarget=n,exports.bindingAccepts=qe,exports.bindingsPayload=function(e,t,n){var r;const o={};for(const[i,a]of Object.entries(e)){const e=He(a).map((e=>({entity_id:n[e]??e})));(null==(r=t[i])?void 0:r.many)||Array.isArray(a)?e.length>0&&(o[i]=e):e[0]&&(o[i]=e[0])}return o},exports.boundIds=function(e){return null==e?[]:Array.isArray(e)?e:[e]},exports.calendarFields=X,exports.calendarOccurrences=$e,exports.canonicalOriginal=ce,exports.checkBindResult=Qe,exports.checkBindSteps=function(e,t,n,r){var o,i,a,s;const l=[];if(void 0!==e)if(!Array.isArray(e)||e.length>16)l.push("on_bind: at most 16 steps");else for(const[d,c]of e.entries()){const e=c,t=`on_bind[${d}]`;if(!e||"object"!=typeof e||"string"!=typeof e.binding){l.push(`${t}: names a binding`);continue}const r=n[e.binding];if(!r){l.push(`${t}: ${e.binding} is not a declared binding`);continue}if(1===["pick","from_parent","create"].filter((t=>t in e)).length){if("pick"in e&&!["one","many","all"].includes(String(e.pick))&&l.push(`${t}: pick is one, many or all`),"pick"in e&&"one"!==e.pick&&!r.many&&l.push(`${t}: ${e.binding} takes one`),"from_parent"in e&&"string"!=typeof e.from_parent&&l.push(`${t}: from_parent names a binding of the parent`),"create"in e){const n=e.create,r=n&&"object"==typeof n?["standard","table","dir"].filter((e=>e in n)):[];1!==r.length?l.push(`${t}: create one of standard, table, dir`):"standard"!==r[0]||je.includes(String(n.standard))?"table"!==r[0]||Array.isArray(null==(o=n.table)?void 0:o.fields)&&"string"==typeof(null==(i=n.table)?void 0:i.name)?"dir"===r[0]&&"string"!=typeof(null==(a=n.dir)?void 0:a.name)&&l.push(`${t}: create.dir needs name`):l.push(`${t}: create.table needs name and fields`):l.push(`${t}: no standard table ${String(n.standard)}`),void 0!==e.when&&"missing"!==e.when&&"always"!==e.when&&l.push(`${t}: when is missing or always`)}}else l.push(`${t}: one of pick, from_parent, create`)}if(void 0!==t)if(!Array.isArray(t)||t.length>16)l.push("on_init_control: at most 16 steps");else for(const[d,c]of t.entries()){const e=c,t=`on_init_control[${d}]`;if("children"===(null==e?void 0:e.require))continue;const n=null==(s=null==e?void 0:e.then)?void 0:s.action;"string"!=typeof n?l.push(`${t}: { require: "children" } or { then: { action } }`):r.includes(n)||l.push(`${t}: ${n} is not a declared action`)}return l},exports.commitOverLimit=function(e){if(e.length>i)return{limit:"operations",value:e.length,max:i};let t=2;for(const n of e)t+=s(n)+1;return t+4096>o?{limit:"bytes",value:t,max:o}:null},exports.commitWithParts=d,exports.createOps=function(e,t){const n=[],r={};for(const o of e.values())for(const e of o.create){const o=t.newId();r[e.ref]=o;const i={entity_id:o,parent_id:t.folderId,order_key:t.orderKey(),name:t.freeName(e.name)};if("standard"===e.kind){const r=e.schema_id===q?"todo":e.schema_id===P?"calendar":null;if(!r)throw new Ue(`cannot create a table of ${e.schema_id}`,"INVALID");n.push(ee(r,{...i,locale:t.locale}))}else"table"===e.kind?n.push({op:"entity.create",type_id:"buckyos.table-source",...i,payload:{fields:e.fields,...e.title_field_id?{title_field_id:e.title_field_id}:{}}}):n.push({op:"entity.create",type_id:"buckyos.dir",...i,payload:{members:{}}})}return{ops:n,ids:r}},exports.dateOf=v,exports.dayNumber=b,exports.dayOf=D,exports.daysInMonth=g,exports.defaultOnBind=Ve,exports.defaultOnInit=Xe,exports.deleteRecordsOp=de,exports.describeRRule=function(e,t="zh"){var n;const r="zh"===t,o=e.interval,i=e=>e.map((e=>{const t=r?U[e.weekday]:j[e.weekday];return void 0===e.ordinal?t:r?`${C[e.ordinal]}${t}`:`${B[e.ordinal]} ${t}`})),a=e=>r?e.join("、"):e.length>1?`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`:e.join(""),s=e=>r?-1===e?"最后一天":`${e} 日`:-1===e?"the last day":`day ${e}`;let l;switch(e.freq){case"DAILY":l=r?1===o?"每天":`每 ${o} 天`:1===o?"every day":`every ${o} days`;break;case"WEEKLY":if(F(e.byDay)&&1===o)l=r?"每个工作日":"every weekday";else{const t=e.byDay?a(i(e.byDay)):"";l=r?`${1===o?"每周":`每 ${o} 周的`}${t}`:`${1===o?"every week":`every ${o} weeks`}${t?` on ${t}`:""}`}break;case"MONTHLY":{let t="";e.byMonthDay?t=a(e.byMonthDay.map(s)):e.byDay&&void 0!==e.bySetPos?t=F(e.byDay)?r?`${C[e.bySetPos]}工作日`:`the ${B[e.bySetPos]} weekday`:r?`${C[e.bySetPos]}${a(i(e.byDay))}`:`the ${B[e.bySetPos]} of ${a(i(e.byDay))}`:e.byDay&&(t=r?a(i(e.byDay)):`the ${a(i(e.byDay))}`),l=r?`${1===o?"每月":`每 ${o} 个月的`}${t}`:`${1===o?"every month":`every ${o} months`}${t?` on ${t}`:""}`;break}case"YEARLY":{const t=null==(n=e.byMonth)?void 0:n.map((e=>r?`${e} 月`:H[e-1]));let d=t?a(t):"";e.byMonthDay?d+=r?a(e.byMonthDay.map(s)):` ${a(e.byMonthDay.map((e=>-1===e?"last day":String(e))))}`:e.byDay&&(d+=r?a(i(e.byDay)):` on the ${a(i(e.byDay))}`),l=r?`${1===o?"每年":`每 ${o} 年的`}${d}`:`${1===o?"every year":`every ${o} years`}${d.trim()?` in ${d.trim()}`:""}`;break}}return void 0!==e.count&&(l+=r?`,共 ${e.count} 次`:`, ${e.count} times`),void 0!==e.until&&(l+=r?`,到 ${e.until.slice(0,10)} 为止`:`, until ${e.until.slice(0,10)}`),l},exports.eventAddOps=Te,exports.eventDeleteOps=Ne,exports.eventEditOps=Ie,exports.eventPostponeOps=function(e,t,n,r){return Ie(e,t,{times:t.allDay?{allDay:!0,startDate:De(t.startDate,Math.max(1,Math.round(n/1440))),endDate:De(t.endDate,Math.max(1,Math.round(n/1440)))}:{allDay:!1,start:new Date(t.startMs+6e4*n).toISOString(),end:new Date(t.endMs+6e4*n).toISOString()}},"one",r)},exports.eventSkipOps=(e,t,n)=>Ne(e,t,"one",n),exports.expandSeries=N,exports.findOccurrence=Ce,exports.formatRRule=_,exports.insertRecordOp=le,exports.isDate=m,exports.isLeap=w,exports.isOrderKey=ne,exports.isTimeZone=$,exports.localDate=Me,exports.localDay=A,exports.newRecordId=ae,exports.noUiDialogs=We,exports.occurrenceId=R,exports.orderAt=ge,exports.orderKeyBetween=oe,exports.orderKeysBetween=function(e,t,n){const r=[];let o=e;for(let i=0;i<n;i++)o=oe(o,t),r.push(o);return r},exports.originalOf=function(e){return e.date??new Date(e.startMs).toISOString()},exports.parseAiwsReferenceUrl=function(t){const n=e.parseObjectUrl(t),r=e.objectSegments(n);if("obj"!==n.kind||"aiworkspace"!==n.host.name||3!==r.length||"entities"!==r[1])throw new Error(`${t} is not an AI Workspace entity url`);const o={workspace_id:r[0],entity_id:r[2],mode:"fixed"===n.query.mode?"fixed":"live"};return void 0!==n.query.selector&&(o.selector=JSON.parse(n.query.selector)),void 0!==n.query.version&&(o.version=JSON.parse(n.query.version)),o},exports.parseOccurrenceId=function(e){const t=e.indexOf("@");return t<0?{recordId:e,original:null}:{recordId:e.slice(0,t),original:e.slice(t+1)}},exports.parseRRule=h,exports.recurrencePresets=function(e,t="zh"){const n=D(e),{y:r,m:o,d:i}=x(n),a=k(n),s=Math.floor((i-1)/7)+1,l=i+7>g(r,o),d="zh"===t,u=c[a],y=[{id:"none",label:d?"不重复":"Does not repeat",rrule:null},{id:"daily",label:d?"每天":"Daily",rrule:"FREQ=DAILY"},{id:"weekdays",label:d?"每个工作日(周一至周五)":"Every weekday (Monday to Friday)",rrule:"FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR"},{id:"weekly",label:d?`每周的${U[a]}`:`Weekly on ${j[a]}`,rrule:`FREQ=WEEKLY;BYDAY=${u}`},{id:"monthly_day",label:d?`每月 ${i} 日`:`Monthly on day ${i}`,rrule:`FREQ=MONTHLY;BYMONTHDAY=${i}`}];return s<=4&&y.push({id:"monthly_nth",label:d?`每月${C[s]}${U[a]}`:`Monthly on the ${B[s]} ${j[a]}`,rrule:`FREQ=MONTHLY;BYDAY=${s}${u}`}),l&&y.push({id:"monthly_last",label:d?`每月最后一个${U[a]}`:`Monthly on the last ${j[a]}`,rrule:`FREQ=MONTHLY;BYDAY=-1${u}`}),y.push({id:"yearly",label:d?`每年 ${o} 月 ${i} 日`:`Annually on ${H[o-1]} ${i}`,rrule:`FREQ=YEARLY;BYMONTH=${o};BYMONTHDAY=${i}`}),y},exports.resolveBindings=async function(e,t){const n=t.standardSchemas??je,r=t.no_ui?We():t.dialogs,o=new Map,i=[],a=async(e,s)=>{const l={reason:t.reason,no_ui:t.no_ui,node:e.id,title:e.title,decls:e.decls,given:e.given??{},parent:s,find:t.find,canCreate:e=>Boolean(e.schema_id&&n.includes(e.schema_id)),dialogs:r},d="function"==typeof e.onBind?e.onBind:Array.isArray(e.onBind)?Ge(e.onBind):Ve;let c;try{c=await d(l)}catch(h){if(h instanceof Ue)throw new Ue(h.message,h.code,h.node??e.id,h.binding);throw h}if(null===c)throw new Ue(`${e.title}: cancelled`,"CANCELLED",e.id);c=Qe(c,e.decls,e.id),o.set(e.id,c);const u=[];for(const t of e.children)u.push(await a(t,{decls:e.decls,bound:c.bindings}));const y="function"==typeof e.onInit?e.onInit:Xe,f=Array.isArray(e.onInit)?e.onInit:[],p=await y({reason:t.reason,no_ui:t.no_ui,node:e.id,title:e.title,decls:e.decls,bound:c.bindings,children:u,dialogs:r});if(!0!==p)throw new Ue(p,"NOT_READY",e.id);for(const t of f)"then"in t&&i.push({node:e.id,action:t.then.action});return{node:e.id,title:e.title,ready:!0,missing:[]}};try{return await a(e,t.parent??null),{ok:!0,results:o,then:i}}catch(s){if(s instanceof Ue)return{ok:!1,error:s};throw s}},exports.scheduleBoardOps=Be,exports.scheduleLabel=J,exports.seriesStartOf=L,exports.setValuesOps=se,exports.sortTodos=pe,exports.splitCommitOperations=l,exports.standardTableOp=ee,exports.stepsOnBind=Ge,exports.todoAddOps=he,exports.todoCompleteOps=_e,exports.todoFields=G,exports.todoItem=fe,exports.todoMoveOps=me,exports.todoUpdateOps=we,exports.viewerTimeZone=Oe,exports.weekdayOf=k,exports.ymdOf=x,exports.zonedParts=S,exports.zonedToUtc=E;
|
|
2
|
+
//# sourceMappingURL=aiws_bind-0654c24e.js.map
|