python-hwpx 3.0.0__py3-none-any.whl → 3.1.0__py3-none-any.whl

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.
hwpx/agent/__init__.py CHANGED
@@ -18,6 +18,20 @@ from .model import (
18
18
  from .catalog import agent_catalog, agent_json_schemas, catalog_hash, human_help, node_help
19
19
  from .commands import apply_document_commands
20
20
  from .document import HwpxAgentDocument, NodeRecord
21
+ from .form_plan import (
22
+ MIXED_FORM_COMPILED_PLAN_SCHEMA,
23
+ MIXED_FORM_LOCATOR_KINDS,
24
+ MIXED_FORM_PLAN_SCHEMA,
25
+ MIXED_FORM_REQUEST_SCHEMA,
26
+ MixedFormPlan,
27
+ MixedFormResolution,
28
+ apply_mixed_form_fill,
29
+ apply_mixed_form_plan,
30
+ mixed_form_json_schemas,
31
+ plan_mixed_form_fill,
32
+ validate_mixed_form_plan,
33
+ validate_mixed_form_request,
34
+ )
21
35
  from .path import PathSegment, SemanticPath, canonicalize_path, parse_path
22
36
  from .query import QueryResult, SemanticSelector, parse_selector
23
37
  from .blueprint import (
@@ -52,6 +66,10 @@ __all__ = [
52
66
  "AGENT_COMMAND_SCHEMA",
53
67
  "AGENT_ERROR_SCHEMA",
54
68
  "AGENT_NODE_SCHEMA",
69
+ "MIXED_FORM_COMPILED_PLAN_SCHEMA",
70
+ "MIXED_FORM_LOCATOR_KINDS",
71
+ "MIXED_FORM_PLAN_SCHEMA",
72
+ "MIXED_FORM_REQUEST_SCHEMA",
55
73
  "BLUEPRINT_CATALOG_SCHEMA",
56
74
  "BLUEPRINT_REPLAY_RESULT_SCHEMA",
57
75
  "BLUEPRINT_REPLAY_SCHEMA",
@@ -65,6 +83,8 @@ __all__ = [
65
83
  "BlueprintBundle",
66
84
  "BlueprintDumpResult",
67
85
  "HwpxAgentDocument",
86
+ "MixedFormPlan",
87
+ "MixedFormResolution",
68
88
  "NodeRecord",
69
89
  "PathSegment",
70
90
  "QueryResult",
@@ -74,6 +94,8 @@ __all__ = [
74
94
  "agent_json_schemas",
75
95
  "agent_contract_manifest",
76
96
  "apply_document_commands",
97
+ "apply_mixed_form_fill",
98
+ "apply_mixed_form_plan",
77
99
  "blueprint_catalog",
78
100
  "blueprint_catalog_hash",
79
101
  "blueprint_hash",
@@ -84,15 +106,19 @@ __all__ = [
84
106
  "canonicalize_path",
85
107
  "catalog_hash",
86
108
  "human_help",
109
+ "mixed_form_json_schemas",
87
110
  "node_help",
88
111
  "parse_path",
89
112
  "parse_selector",
113
+ "plan_mixed_form_fill",
90
114
  "dump_document_blueprint",
91
115
  "read_blueprint_bundle",
92
116
  "repack_blueprint_bundle",
93
117
  "replay_document_blueprint",
94
118
  "validate_agent_batch",
95
119
  "validate_agent_command",
120
+ "validate_mixed_form_plan",
121
+ "validate_mixed_form_request",
96
122
  "validate_blueprint_manifest",
97
123
  "validate_replay_request",
98
124
  "write_blueprint_bundle",
hwpx/agent/catalog.py CHANGED
@@ -9,10 +9,16 @@ from copy import deepcopy
9
9
  from typing import Any
10
10
 
11
11
  from .model import (
12
+ AGENT_BATCH_SCHEMA,
12
13
  AGENT_CATALOG_SCHEMA,
14
+ MAX_COMMANDS,
13
15
  AgentContractError,
14
16
  NODE_KINDS,
15
17
  NODE_PROPERTY_CATALOG_V1,
18
+ QUALITY_KEYS,
19
+ QUALITY_MODES,
20
+ REVISION_PATTERN,
21
+ VERIFICATION_REQUIREMENTS,
16
22
  agent_contract_manifest,
17
23
  )
18
24
 
@@ -78,6 +84,22 @@ def agent_json_schemas() -> dict[str, Any]:
78
84
  "properties": {key: value for key, value in properties.items() if key in allowed},
79
85
  }
80
86
  )
87
+ quality_object = {
88
+ "type": "object",
89
+ "additionalProperties": False,
90
+ "properties": {
91
+ "mode": {"enum": list(QUALITY_MODES)},
92
+ "renderCheck": {"enum": ["off", "auto", "required"]},
93
+ "xsdMode": {"enum": ["off", "lint"]},
94
+ "overflowPolicy": {"enum": ["fail", "warn", "truncate"]},
95
+ "layoutLint": {"enum": ["off", "warn", "strict"]},
96
+ "preserveUnmodifiedParts": {"type": "boolean"},
97
+ "requireReferenceIntegrity": {"type": "boolean"},
98
+ },
99
+ }
100
+ if set(quality_object["properties"]) != set(QUALITY_KEYS): # pragma: no cover
101
+ raise AssertionError("quality JSON Schema drifted from QUALITY_KEYS")
102
+
81
103
  return {
82
104
  "node": {
83
105
  "$schema": "https://json-schema.org/draft/2020-12/schema",
@@ -113,6 +135,69 @@ def agent_json_schemas() -> dict[str, Any]:
113
135
  "title": "HwpxAgentCommand v1",
114
136
  "oneOf": command_variants,
115
137
  },
138
+ "batch": {
139
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
140
+ "title": "HwpxAgentBatch v1",
141
+ "type": "object",
142
+ "required": [
143
+ "schemaVersion",
144
+ "input",
145
+ "output",
146
+ "commands",
147
+ "expectedRevision",
148
+ "idempotencyKey",
149
+ "dryRun",
150
+ "quality",
151
+ "verificationRequirements",
152
+ ],
153
+ "additionalProperties": False,
154
+ "properties": {
155
+ "schemaVersion": {"const": AGENT_BATCH_SCHEMA},
156
+ "input": {
157
+ "type": "object",
158
+ "required": ["filename"],
159
+ "additionalProperties": False,
160
+ "properties": {"filename": {"type": "string", "minLength": 1}},
161
+ },
162
+ "output": {
163
+ "type": "object",
164
+ "required": ["filename", "overwrite"],
165
+ "additionalProperties": False,
166
+ "properties": {
167
+ "filename": {"type": "string", "minLength": 1},
168
+ "overwrite": {"type": "boolean"},
169
+ },
170
+ },
171
+ "commands": {
172
+ "type": "array",
173
+ "minItems": 1,
174
+ "maxItems": MAX_COMMANDS,
175
+ "items": {"oneOf": deepcopy(command_variants)},
176
+ },
177
+ "expectedRevision": {
178
+ "type": ["string", "null"],
179
+ "pattern": REVISION_PATTERN.pattern,
180
+ },
181
+ "idempotencyKey": {
182
+ "type": ["string", "null"],
183
+ "minLength": 1,
184
+ "maxLength": 128,
185
+ },
186
+ "dryRun": {"type": "boolean"},
187
+ "quality": {
188
+ "oneOf": [
189
+ {"enum": list(QUALITY_MODES)},
190
+ deepcopy(quality_object),
191
+ {"type": "null"},
192
+ ]
193
+ },
194
+ "verificationRequirements": {
195
+ "type": "array",
196
+ "items": {"enum": list(VERIFICATION_REQUIREMENTS)},
197
+ "uniqueItems": True,
198
+ },
199
+ },
200
+ },
116
201
  "queryInput": {
117
202
  "$schema": "https://json-schema.org/draft/2020-12/schema",
118
203
  "type": "object",