@josephyan/qingflow-app-user-mcp 0.2.0-beta.1 → 0.2.0-beta.10

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/README.md CHANGED
@@ -3,13 +3,13 @@
3
3
  Install:
4
4
 
5
5
  ```bash
6
- npm install @josephyan/qingflow-app-user-mcp@0.2.0-beta.1
6
+ npm install @josephyan/qingflow-app-user-mcp@0.2.0-beta.10
7
7
  ```
8
8
 
9
9
  Run:
10
10
 
11
11
  ```bash
12
- npx -y -p @josephyan/qingflow-app-user-mcp@0.2.0-beta.1 qingflow-app-user-mcp
12
+ npx -y -p @josephyan/qingflow-app-user-mcp@0.2.0-beta.10 qingflow-app-user-mcp
13
13
  ```
14
14
 
15
15
  Environment:
@@ -19,3 +19,12 @@ Environment:
19
19
  - `QINGFLOW_MCP_HOME`
20
20
 
21
21
  This package bootstraps a local Python runtime on first install and then starts the `qingflow-app-user-mcp` stdio MCP server.
22
+
23
+ Bundled skill:
24
+
25
+ - `skills/qingflow-app-user`
26
+
27
+ Note:
28
+
29
+ - The skill files are included in the npm package.
30
+ - On install, the package copies them to `$CODEX_HOME/skills` (or `~/.codex/skills` if `CODEX_HOME` is unset).
@@ -29,6 +29,43 @@ export function getPackageRoot(metaUrl) {
29
29
  return path.resolve(path.dirname(fileURLToPath(metaUrl)), "..", "..");
30
30
  }
31
31
 
32
+ export function getCodexHome() {
33
+ const configured = process.env.CODEX_HOME?.trim();
34
+ if (configured) {
35
+ return path.resolve(configured);
36
+ }
37
+ const home = process.env.HOME || process.env.USERPROFILE;
38
+ if (!home) {
39
+ throw new Error("Cannot resolve CODEX_HOME because HOME is not set.");
40
+ }
41
+ return path.join(home, ".codex");
42
+ }
43
+
44
+ export function installBundledSkills(packageRoot) {
45
+ const skillsSrc = path.join(packageRoot, "skills");
46
+ if (!fs.existsSync(skillsSrc)) {
47
+ return { installed: [], skipped: true, destination: null };
48
+ }
49
+
50
+ const codexHome = getCodexHome();
51
+ const skillsDestRoot = path.join(codexHome, "skills");
52
+ fs.mkdirSync(skillsDestRoot, { recursive: true });
53
+
54
+ const installed = [];
55
+ for (const entry of fs.readdirSync(skillsSrc, { withFileTypes: true })) {
56
+ if (!entry.isDirectory()) {
57
+ continue;
58
+ }
59
+ const src = path.join(skillsSrc, entry.name);
60
+ const dest = path.join(skillsDestRoot, entry.name);
61
+ fs.rmSync(dest, { recursive: true, force: true });
62
+ fs.cpSync(src, dest, { recursive: true });
63
+ installed.push(entry.name);
64
+ }
65
+
66
+ return { installed, skipped: false, destination: skillsDestRoot };
67
+ }
68
+
32
69
  export function getVenvDir(packageRoot) {
33
70
  return path.join(packageRoot, ".npm-python");
34
71
  }
@@ -1,4 +1,4 @@
1
- import { ensurePythonEnv, getPackageRoot } from "../lib/runtime.mjs";
1
+ import { ensurePythonEnv, getPackageRoot, installBundledSkills } from "../lib/runtime.mjs";
2
2
 
3
3
  const packageRoot = getPackageRoot(import.meta.url);
4
4
 
@@ -6,6 +6,10 @@ try {
6
6
  console.log("[qingflow-mcp] Bootstrapping Python runtime...");
7
7
  ensurePythonEnv(packageRoot, { commandName: "qingflow-app-user-mcp" });
8
8
  console.log("[qingflow-mcp] Python runtime is ready.");
9
+ const skills = installBundledSkills(packageRoot);
10
+ if (!skills.skipped) {
11
+ console.log(`[qingflow-mcp] Installed skills to ${skills.destination}: ${skills.installed.join(", ")}`);
12
+ }
9
13
  } catch (error) {
10
14
  console.error(`[qingflow-mcp] postinstall failed: ${error.message}`);
11
15
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@josephyan/qingflow-app-user-mcp",
3
- "version": "0.2.0-beta.1",
3
+ "version": "0.2.0-beta.10",
4
4
  "description": "Operational end-user MCP for Qingflow records, tasks, comments, and directory workflows.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -18,7 +18,8 @@
18
18
  "src/qingflow_mcp/py.typed",
19
19
  "qingflow-app-user-mcp",
20
20
  "npm/",
21
- "docs/local-agent-install.md"
21
+ "docs/local-agent-install.md",
22
+ "skills/"
22
23
  ],
23
24
  "engines": {
24
25
  "node": ">=16.16.0"
package/pyproject.toml CHANGED
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "qingflow-mcp"
7
- version = "0.2.0b1"
7
+ version = "0.2.0b10"
8
8
  description = "User-authenticated MCP server for Qingflow"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -0,0 +1,158 @@
1
+ ---
2
+ name: qingflow-app-user
3
+ description: Use Qingflow apps as an operational end user after the MCP is already connected and authenticated. Use when the user wants to create, search, read, update, or delete business records, inspect or manage task-center work, add comments, or perform workflow usage actions inside an existing app. Do not use this skill to design apps, modify schemas, or build a brand new SolutionSpec.
4
+ metadata:
5
+ short-description: Use Qingflow apps for business data and task operations
6
+ ---
7
+
8
+ # Qingflow App User
9
+
10
+ ## Overview
11
+
12
+ This skill is for business-user operations inside existing Qingflow apps. It focuses on records, task-center usage, comments, and usage-side workflow actions, not app design or system configuration. If the task is about building or changing app structure, switch to `$qingflow-app-builder`.
13
+
14
+ Before operating on data, identify whether the task targets `test` or `prod` and read [references/environments.md](references/environments.md). If the user did not specify one, default to `prod`.
15
+ When the task is in `prod`, browser parity matters, or the user says "the page has data but MCP does not", restate the expected `base_url` and `qf_version`, then prefer tools that expose `request_route` so you can confirm the live route before concluding.
16
+
17
+ ## Tool Scope
18
+
19
+ Primary record and data tools:
20
+
21
+ - `record_query`
22
+ - `record_query_plan`
23
+ - `record_write_plan`
24
+ - `record_field_resolve`
25
+ - `record_aggregate`
26
+ - `record_create`
27
+ - `record_get`
28
+ - `record_update`
29
+ - `record_delete`
30
+
31
+ Directory and organization lookup tools when the user is asking about internal members, departments, org structure, ownership, approver candidates, or wants full contact exports:
32
+
33
+ - `directory_search`
34
+ - `directory_list_internal_users`
35
+ - `directory_list_all_internal_users`
36
+ - `directory_list_internal_departments`
37
+ - `directory_list_all_departments`
38
+ - `directory_list_sub_departments`
39
+ - `directory_list_external_members`
40
+
41
+ Usage-side collaboration and flow tools when needed:
42
+
43
+ - `record_comment_*`
44
+ - `task_approve`
45
+ - `task_reject`
46
+ - `task_rollback*`
47
+ - `task_transfer*`
48
+
49
+ Task-center and inbox tools when the user is asking about pending work, processed work, cc, or workflow workload:
50
+
51
+ - `task_list`
52
+ - `task_list_grouped`
53
+ - `task_statistics`
54
+ - `task_urge`
55
+
56
+ Do not use builder-side tools here:
57
+
58
+ - `app_*`
59
+ - `view_*`
60
+ - `workflow_*`
61
+ - `portal_*`
62
+ - `navigation_*`
63
+ - `package_*`
64
+ - `solution_*`
65
+
66
+ ## Standard Operating Order
67
+
68
+ 1. Ensure auth exists
69
+ 2. Ensure workspace is selected
70
+ 3. Confirm target app, task scope, and operation type
71
+ 4. For org, member, department, approver, or ownership questions, start with `directory_*`
72
+ 5. For inbox, pending, processed, cc, or workload questions, start with `task_statistics`, `task_list`, or `task_list_grouped`
73
+ 6. When a task query identifies the target record, switch to `record_get` or `record_query` for business data details
74
+ 7. For non-trivial record reads, start with `record_query` and use `record_query_plan` first when field ids, filters, or scan scope are uncertain
75
+ 8. For non-trivial writes, start with `record_write_plan`, especially when using `fields`
76
+ 9. Prefer read-first when changing existing records
77
+ 10. Report the affected task ids, record ids, member ids, department ids, or counts after actions
78
+ 11. For `prod`, complex forms, attachments, or any unfamiliar schema, prefer `record_create(..., verify_write=true)` or read back immediately after create/update
79
+
80
+ ## Data Rules
81
+
82
+ - Prefer `record_query` as the default read entry
83
+ - Treat `record_query(list)` as the default wide-table browse and export endpoint; pass explicit `select_columns`, do not expect raw answer arrays there, and let the tool auto-batch columns when the backend per-request field cap is hit
84
+ - Use `request_route` from tool responses to verify the active `base_url` and `qf_version` whenever route mismatches are plausible
85
+ - Use `directory_search` for fuzzy internal lookup across both members and departments
86
+ - Use `directory_list_all_internal_users` when the user explicitly wants a complete internal member list within the current workspace or within a specific department or role
87
+ - Use `directory_list_all_departments` when the user explicitly wants the full department tree or all departments under a root
88
+ - Use `directory_list_internal_departments` for keyword-based department search, not full exports
89
+ - Use `task_statistics` before `task_list` when the user only needs counts
90
+ - Use `task_list_grouped` when worksheet or group buckets matter
91
+ - Use `task_urge` only when the user clearly wants a reminder sent for a pending task
92
+ - Use `record_query_plan` before final statistics or when field selectors are ambiguous
93
+ - For precise record lookup, use `record_get` when `apply_id` is known
94
+ - Use `record_field_resolve` when the user gives field titles and you are not fully sure about the exact schema; do not guess ambiguous fields silently
95
+ - Treat field selectors as schema-first and platform-generic. Prefer exact field titles, then neutral aliases such as `创建时间`, `新增时间`, `负责人`, `部门`, `时间`, or `阶段` only when the tool resolves them clearly. Do not assume CRM shorthand like `销售`, `商机阶段`, `客户全称`, or similar domain shortcuts apply across arbitrary Qingflow apps
96
+ - For updates, inspect current data first unless the user already provided the exact target and patch
97
+ - For deletes, confirm the exact record scope and report the deleted ids
98
+ - When validating business data volume, use `effective_count` over raw backend totals
99
+ - For summary or aggregate conclusions, prefer `strict_full=true`
100
+ - In `prod`, prefer read-first even more strictly and avoid deletes unless the record scope is explicit in the conversation
101
+ - For attachments, first run `file_upload_local`, then pass the returned `attachment_value` into `record_create` or `record_update`; do not try to write local file paths directly into attachment fields
102
+ - For relation fields, first query the target app and resolve the referenced record `apply_id`; do not assume titles, numbers, or business keys can be written directly into a relation field
103
+ - For subtable fields, write a list of row objects keyed by the subfield titles. When updating existing rows, include `rowId` / `row_id` / `__row_id__` only if the source record already exposes it
104
+ - Treat `14/34/35/36` as unsupported direct-write field types in app-user flows:
105
+ - `14`: time range
106
+ - `34`: image recognition
107
+ - `35`: image generation
108
+ - `36`: document parsing
109
+ - For those unsupported types, stop and explain the limitation instead of inventing payloads
110
+ - Use `record_write_plan` to inspect `write_format.support_level` before non-trivial writes:
111
+ - `full`: generic scalar/select/date writes are directly supported
112
+ - `restricted`: member/department/attachment/relation/subtable writes need the documented presteps
113
+ - `unsupported`: stop and explain the limitation
114
+ - For relation-heavy, attachment, subtable, or production writes, default to `verify_write=true` so field drops are surfaced immediately instead of being reported as success
115
+
116
+ ## Mock and Demo Data
117
+
118
+ When the user asks for demo data, seed, smoke data, or mock data:
119
+
120
+ - default to at least `5` records for the relevant entity unless the user asks for fewer
121
+ - keep titles realistic and business-like
122
+ - vary statuses, dates, and categories enough to make views and charts useful
123
+ - if the task is `prod`, do not create mock or smoke data unless the user explicitly asks for it
124
+
125
+ ## Response Interpretation
126
+
127
+ - low-level list totals from the backend may report `0` while rows are present; prefer `record_query(summary)` or `record_aggregate` for final conclusions
128
+ - `record_query(summary)` and `record_aggregate` expose `completeness`; do not treat partial scans as final conclusions
129
+ - `record_write_plan` is static preflight, not a guarantee that submit will pass runtime linkage or visibility checks
130
+ - `record_create` now returns integer `apply_id`; you can pass that id directly into `record_get`, `record_update`, or `record_delete`
131
+ - `verify_write=true` means the tool read the record back and compared the written fields; if it returns `status=verification_failed` or `ok=false`, do not report the create or update as successful
132
+ - Relation writes are `apply_id`-based; if the user only gives a title, number, or business key, query the target app first and resolve the real record id before writing
133
+ - Task counts and record counts are not interchangeable; a task query reflects task-center workload, not the underlying record total
134
+ - When reporting task results, include the task dimension that was used, such as pending, processed, cc, node, or worksheet
135
+ - Prefer summarizing titles and counts instead of dumping raw answer arrays
136
+ - When records reference other entities, verify references are coherent before reporting success
137
+ - `file_upload_local` may transparently change `effective_upload_kind` and `upload_protocol`; surface those fields when debugging production upload behavior instead of assuming all uploads are direct `PUT`
138
+
139
+ ## Practical Patterns
140
+
141
+ - Bulk mock data creation: query current data first, run `record_write_plan`, then create missing records
142
+ - Data correction: query, inspect, preflight, update, and re-read
143
+ - Inbox triage: use `task_statistics` first, then `task_list` or `task_list_grouped`, then switch to `record_*` for the underlying record when needed
144
+ - Bottleneck analysis: start with `task_statistics` and `task_list_grouped` before drilling into specific records
145
+ - Workflow collaboration: comment, transfer, or reassign only after identifying the exact record
146
+ - Approval actions: identify the exact record and current node first, then use `task_approve` or `task_reject`; do not guess `nodeId`
147
+ - Demo validation: create at least `5` rows and confirm they are queryable
148
+ - Org export: use `directory_list_all_internal_users` for full member exports and `directory_list_all_departments` for full org-tree exports before mapping owners or departments into record operations
149
+ - Attachment write: upload first, write the returned URL object second, and prefer `verify_write=true`
150
+ - Relation write: query the target app first, capture the referenced record `apply_id`, then write the relation field and verify the readback
151
+ - Production discrepancy triage: compare the response `request_route` with the browser environment before assuming the data query is wrong
152
+
153
+ ## Resources
154
+
155
+ - Environment switching: [references/environments.md](references/environments.md)
156
+ - Record operation patterns: [references/record-patterns.md](references/record-patterns.md)
157
+ - Workflow usage actions: [references/workflow-usage.md](references/workflow-usage.md)
158
+ - Data gotchas: [references/data-gotchas.md](references/data-gotchas.md)
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Qingflow App User"
3
+ short_description: "Use Qingflow apps for business data and task operations"
4
+ default_prompt: "Use $qingflow-app-user to query members or departments, inspect workload, and safely create, query, update, validate, approve, reject, or otherwise operate records in an existing Qingflow app, paying attention to request_route, verify_write, nodeId accuracy, and attachment upload flows when needed."
@@ -0,0 +1,49 @@
1
+ # Data Gotchas
2
+
3
+ ## Counts
4
+
5
+ - Prefer `effective_count`
6
+ - For `record_query(summary)` and `record_aggregate`, inspect `completeness` before concluding
7
+ - If the browser and MCP disagree, compare `request_route.base_url` and `request_route.qf_version` first
8
+
9
+ ## Record titles
10
+
11
+ - Do not dump raw answer arrays to the user unless needed
12
+ - Prefer concise business titles and counts
13
+
14
+ ## Preflight
15
+
16
+ - `record_write_plan` is static preflight only; linked visibility and runtime required rules can still reject writes
17
+ - `record_write_plan` now exposes `write_format.support_level`; check `full / restricted / unsupported` before attempting non-trivial writes
18
+ - Use `record_field_resolve` when field titles are uncertain instead of guessing ids
19
+ - Prefer `strict_full=true` for final statistics or business conclusions
20
+ - `record_create` and `record_update` can do post-write verification with `verify_write=true`; use that for complex, subtable, or production writes
21
+ - `apply_id` is normalized to an integer; pass it directly into later record tools
22
+
23
+ ## Mock data
24
+
25
+ - Default to at least `5` rows per relevant entity unless the user asked for fewer
26
+ - Avoid identical titles and identical statuses across all rows
27
+ - Keep relation references valid
28
+
29
+ ## Attachments
30
+
31
+ - Attachment fields are two-step: upload first, then write the returned URL object into the record
32
+ - `file_upload_local` may report `effective_upload_kind=login` even when the requested kind was `attachment`; this is an implementation fallback, not necessarily an error
33
+ - When debugging uploads, surface both `effective_upload_kind` and `upload_protocol`
34
+
35
+ ## Subtables
36
+
37
+ - Subtable fields accept row objects keyed by subfield title, or native `tableValues`
38
+ - Use the current form schema's subfield titles; do not guess nested ids
39
+ - When updating existing subtable rows, preserve `rowId` if the source record returns it
40
+ - Nested subtable writes are still unsupported
41
+
42
+ ## Unsupported direct-write fields
43
+
44
+ - `14` time range
45
+ - `34` image recognition
46
+ - `35` image generation
47
+ - `36` document parsing
48
+
49
+ Do not fake values for these fields in app-user writes. Stop and explain the limitation.
@@ -0,0 +1,63 @@
1
+ # Environment Switching
2
+
3
+ Use this reference before any data creation, update, delete, or workflow usage action.
4
+
5
+ ## Step 1: Resolve the active environment
6
+
7
+ Decide explicitly whether the task targets:
8
+
9
+ - `test`: demo, mock data, smoke usage validation, training scenarios
10
+ - `prod`: real operational data and live workflow actions
11
+
12
+ If the user did not specify an environment, default to `prod`.
13
+
14
+ ## Test Environment
15
+
16
+ Use test for:
17
+
18
+ - mock or smoke data entry
19
+ - business flow walkthroughs
20
+ - user acceptance demos
21
+ - data correction rehearsals
22
+
23
+ Test behavior:
24
+
25
+ - creating demo data is acceptable
26
+ - default to at least `5` records for mock or smoke datasets unless the user asks for fewer
27
+ - destructive cleanup is acceptable only when the record scope is explicit
28
+
29
+ Known current test backend:
30
+
31
+ - use an explicitly provided non-production backend
32
+
33
+ ## Production Environment
34
+
35
+ Use production for:
36
+
37
+ - live data entry
38
+ - live business record updates
39
+ - comments and workflow actions on real records
40
+ - controlled data correction or deletion
41
+
42
+ Production behavior:
43
+
44
+ - prefer search or get before any write
45
+ - restate the exact app and record scope before update or delete
46
+ - do not create mock, smoke, or demo data unless the user explicitly asks for it
47
+ - for bulk changes, summarize the target count before execution and the affected ids after execution
48
+ - destructive actions need explicit confirmation in the conversation context
49
+
50
+ Production guardrails:
51
+
52
+ - never assume a record id, app id, or workspace id
53
+ - treat `record_delete` as high risk
54
+ - if the task can be answered read-only, do not write
55
+
56
+ ## Reporting Rule
57
+
58
+ For app-user operations, always report:
59
+
60
+ - active environment
61
+ - target app
62
+ - operation type: read, create, update, delete, or workflow action
63
+ - affected record count or ids
@@ -0,0 +1,69 @@
1
+ # Record Patterns
2
+
3
+ ## Query first
4
+
5
+ Use `record_query` first when:
6
+
7
+ - the user only gives a title or business key
8
+ - the target record id is unknown
9
+ - updates or deletes need confirmation
10
+ - summary analysis or final counts are needed
11
+
12
+ Use `record_query_plan` first when:
13
+
14
+ - field titles may be ambiguous
15
+ - filters are still in natural-language shape
16
+ - the result may be used as a final conclusion
17
+ - scan scope or completeness is unclear
18
+
19
+ ## Create pattern
20
+
21
+ 1. Confirm target app
22
+ 2. Resolve fields with `record_field_resolve` if needed. Prefer exact schema titles first; only rely on platform-neutral aliases such as `创建时间`, `负责人`, or `部门` when they resolve cleanly, and do not assume business-domain shorthand like `销售` is portable across apps
23
+ 3. Run `record_write_plan` for non-trivial payloads or any `fields`-based write
24
+ 4. For relation fields, query the target app first and resolve the referenced record `apply_id`
25
+ 5. For attachments, call `file_upload_local` first and reuse the returned `attachment_value`
26
+ 6. For subtable fields, pass a list of row objects keyed by subfield title. When updating existing rows, include `rowId` / `row_id` / `__row_id__` only if the current record already exposes it
27
+ 7. Inspect `record_write_plan.data.support_matrix` or each field's `write_format.support_level` before submit:
28
+ - `full`: direct write is supported
29
+ - `restricted`: follow the documented presteps first
30
+ - `unsupported`: stop and explain the limitation
31
+ 8. For complex forms, production writes, attachments, relation-heavy payloads, or subtables, create with `verify_write=true`
32
+ 9. If verification fails, treat the write as not yet successful and inspect the missing or empty fields before reporting back
33
+ 10. Re-query or fetch the record when validation matters
34
+
35
+ ## Update pattern
36
+
37
+ 1. Query the target records
38
+ 2. Resolve exact `apply_id`
39
+ 3. Run `record_write_plan`
40
+ 4. Update only the intended fields
41
+ 5. Prefer `verify_write=true` for attachment, relation, subtable, or production updates
42
+ 6. Re-read the record if the change is important, attachment-related, subtable-related, or the form has linkage
43
+
44
+ ## Delete pattern
45
+
46
+ 1. Query or fetch the exact record first
47
+ 2. Confirm the target ids
48
+ 3. Delete
49
+ 4. Report affected ids and remaining count when relevant
50
+
51
+ ## Unsupported direct writes
52
+
53
+ Do not attempt direct app-user writes for these field types:
54
+
55
+ - `14` time range
56
+ - `34` image recognition
57
+ - `35` image generation
58
+ - `36` document parsing
59
+
60
+ If the payload includes them, stop at `record_write_plan` and explain that the tool does not build a reliable native payload for those fields yet.
61
+
62
+ ## Relation fields
63
+
64
+ Relation fields are record-id based.
65
+
66
+ - Query the referenced app first
67
+ - Resolve the target record `apply_id`
68
+ - Write the relation field with that id
69
+ - Do not write relation fields with display titles, business keys, or guessed identifiers unless they have already been resolved to the real record id
@@ -0,0 +1,24 @@
1
+ # Workflow and Task Usage Actions
2
+
3
+ Use these when the user is operating inside an existing process, not redesigning it.
4
+
5
+ Examples:
6
+
7
+ - add a comment to a record
8
+ - approve or reject a workflow task
9
+ - transfer a task
10
+ - roll back a record
11
+ - list pending, processed, or cc tasks
12
+ - urge a pending task
13
+
14
+ Rules:
15
+
16
+ - if the user starts from inbox, todo, workload, cc, or bottleneck language, use `task_*` first
17
+ - use `task_statistics` for counts and `task_list` or `task_list_grouped` for browsing
18
+ - use `task_list_grouped` when grouped workload browsing matters
19
+ - treat task counts as task-center counts, not record counts
20
+ - switch to `record_*` after locating the exact business record behind a task
21
+ - identify the exact record first
22
+ - for approve or reject, identify the exact `nodeId` first; prefer task-center results or audit info, then use `task_approve` or `task_reject`
23
+ - avoid usage-side flow actions on ambiguous records
24
+ - summarize the final action and target task ids or record ids
@@ -2,4 +2,4 @@ from __future__ import annotations
2
2
 
3
3
  __all__ = ["__version__"]
4
4
 
5
- __version__ = "0.2.0b1"
5
+ __version__ = "0.2.0b10"
@@ -43,6 +43,24 @@ FIELD_TYPE_ALIASES: dict[str, PublicFieldType] = {
43
43
  "departments": PublicFieldType.department,
44
44
  }
45
45
 
46
+ FIELD_TYPE_ID_ALIASES: dict[int, PublicFieldType] = {
47
+ 2: PublicFieldType.text,
48
+ 3: PublicFieldType.long_text,
49
+ 4: PublicFieldType.date,
50
+ 5: PublicFieldType.member,
51
+ 6: PublicFieldType.email,
52
+ 7: PublicFieldType.phone,
53
+ 8: PublicFieldType.number,
54
+ 10: PublicFieldType.boolean,
55
+ 11: PublicFieldType.single_select,
56
+ 12: PublicFieldType.multi_select,
57
+ 13: PublicFieldType.attachment,
58
+ 18: PublicFieldType.subtable,
59
+ 21: PublicFieldType.address,
60
+ 22: PublicFieldType.department,
61
+ 25: PublicFieldType.relation,
62
+ }
63
+
46
64
 
47
65
  class PublicViewType(str, Enum):
48
66
  table = "table"
@@ -201,6 +219,10 @@ class ViewUpsertPatch(StrictModel):
201
219
  payload = dict(value)
202
220
  if "fields" in payload and "columns" not in payload:
203
221
  payload["columns"] = payload.pop("fields")
222
+ if "column_names" in payload and "columns" not in payload:
223
+ payload["columns"] = payload.pop("column_names")
224
+ if "columnNames" in payload and "columns" not in payload:
225
+ payload["columns"] = payload.pop("columnNames")
204
226
  raw_type = payload.get("type")
205
227
  if isinstance(raw_type, str):
206
228
  normalized = raw_type.strip().lower()
@@ -303,6 +325,17 @@ class FlowPlanRequest(StrictModel):
303
325
  payload = dict(value)
304
326
  if str(payload.get("mode") or "").strip().lower() == "overwrite":
305
327
  payload["mode"] = "replace"
328
+ raw_preset = payload.get("preset")
329
+ if isinstance(raw_preset, str):
330
+ normalized_preset = raw_preset.strip().lower()
331
+ preset_aliases = {
332
+ "default_approval": FlowPreset.basic_approval.value,
333
+ "approval": FlowPreset.basic_approval.value,
334
+ "default_fill_then_approve": FlowPreset.basic_fill_then_approve.value,
335
+ "default-fill-then-approve": FlowPreset.basic_fill_then_approve.value,
336
+ }
337
+ if normalized_preset in preset_aliases:
338
+ payload["preset"] = preset_aliases[normalized_preset]
306
339
  return payload
307
340
 
308
341
 
@@ -332,7 +365,14 @@ def _normalize_field_payload(value: Any) -> Any:
332
365
  if not isinstance(value, dict):
333
366
  return value
334
367
  payload = dict(value)
368
+ if "fields" in payload and "subfields" not in payload:
369
+ payload["subfields"] = payload.pop("fields")
335
370
  raw_type = payload.get("type")
371
+ if isinstance(raw_type, int):
372
+ normalized_from_id = FIELD_TYPE_ID_ALIASES.get(raw_type)
373
+ if normalized_from_id is not None:
374
+ payload["type"] = normalized_from_id.value
375
+ return payload
336
376
  if isinstance(raw_type, str):
337
377
  normalized = FIELD_TYPE_ALIASES.get(raw_type.strip().lower())
338
378
  if normalized is not None: