dknowc-dsh 2.2.1 → 2.3.1
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 +10 -38
- package/package.json +2 -2
- package/skills/dknowc-official-doc-writer/README.md +34 -31
- package/skills/dknowc-official-doc-writer/SKILL.md +87 -373
- package/skills/dknowc-official-doc-writer/reference/anti_ai_patterns.md +1 -1
- package/skills/dknowc-official-doc-writer/reference/fact_discipline.md +17 -2
- package/skills/dknowc-official-doc-writer/reference/genre_writing_notes.md +116 -0
- package/skills/dknowc-official-doc-writer/reference/initialization.md +69 -0
- package/skills/dknowc-official-doc-writer/reference/local_memory_guide.md +7 -7
- package/skills/dknowc-official-doc-writer/reference/material_usage_guidance.md +7 -0
- package/skills/dknowc-official-doc-writer/reference/materials_pipeline.md +42 -0
- package/skills/dknowc-official-doc-writer/reference/onboarding_scripts.md +44 -33
- package/skills/dknowc-official-doc-writer/reference/outline_rules.md +36 -0
- package/skills/dknowc-official-doc-writer/reference/output_guide.md +80 -12
- package/skills/dknowc-official-doc-writer/reference/research_notes.md +6 -4
- package/skills/dknowc-official-doc-writer/reference/review_checklist.md +24 -0
- package/skills/dknowc-official-doc-writer/reference/revision_workflow.md +2 -2
- package/skills/dknowc-official-doc-writer/reference/sample_trace_report.html +3 -3
- package/skills/dknowc-official-doc-writer/reference/search_guide.md +35 -33
- package/skills/dknowc-official-doc-writer/reference/search_intro.md +4 -4
- package/skills/dknowc-official-doc-writer/reference/search_policy.md +27 -19
- package/skills/dknowc-official-doc-writer/reference/standards/00_index.md +64 -78
- package/skills/dknowc-official-doc-writer/reference/standards/29_research.md +7 -0
- package/skills/dknowc-official-doc-writer/reference/standards/99_expressions.md +3 -2
- package/skills/dknowc-official-doc-writer/reference/task_router.md +3 -3
- package/skills/dknowc-official-doc-writer/reference/working_principles.md +32 -0
- package/skills/dknowc-official-doc-writer/reference/writing_rules.md +83 -0
- package/skills/dknowc-official-doc-writer/scripts/api_key.py +9 -2
- package/skills/dknowc-official-doc-writer/scripts/attribution.py +1 -1
- package/skills/dknowc-official-doc-writer/scripts/build_trace_json.py +43 -11
- package/skills/dknowc-official-doc-writer/scripts/check_materials.py +123 -14
- package/skills/dknowc-official-doc-writer/scripts/deep_convert.py +17 -14
- package/skills/dknowc-official-doc-writer/scripts/deep_query.py +3 -3
- package/skills/dknowc-official-doc-writer/scripts/dkag_search.py +133 -55
- package/skills/dknowc-official-doc-writer/scripts/extract_reference.py +1 -1
- package/skills/dknowc-official-doc-writer/scripts/format_document.py +43 -23
- package/skills/dknowc-official-doc-writer/scripts/initialize.py +15 -7
- package/skills/dknowc-official-doc-writer/scripts/mcp_direct.py +2 -3
- package/skills/dknowc-official-doc-writer/scripts/merge_search_results.py +36 -13
- package/skills/dknowc-official-doc-writer/scripts/outline_reference.py +1 -1
- package/skills/dknowc-official-doc-writer/scripts/prose_lint.py +7 -2
- package/skills/dknowc-official-doc-writer/scripts/register.mjs +540 -207
- package/skills/dknowc-official-doc-writer/scripts/render_trace_html.py +247 -44
- package/skills/dknowc-official-doc-writer/scripts/review_document.py +1 -1
- package/skills/dknowc-official-doc-writer/scripts/source_note_html.py +20 -8
- package/skills/dknowc-official-doc-writer/scripts/template_generator.py +1 -1
- package/skills/dknowc-ppt-assistant/README.md +21 -6
- package/skills/dknowc-ppt-assistant/SKILL.md +23 -68
- package/skills/dknowc-ppt-assistant/THIRD_PARTY_NOTICES.md +3 -2
- package/skills/dknowc-ppt-assistant/references/initialization.md +106 -0
- package/skills/dknowc-ppt-assistant/references/material_usage.md +12 -8
- package/skills/dknowc-ppt-assistant/references/onboarding_scripts.md +48 -17
- package/skills/dknowc-ppt-assistant/references/svg-authoring.md +3 -3
- package/skills/dknowc-ppt-assistant/references/upstream-example/README.md +2 -0
- package/skills/dknowc-ppt-assistant/scripts/api_key.py +7 -0
- package/skills/dknowc-ppt-assistant/scripts/attribution.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/compact_svg_coordinates.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/config.py +9 -9
- package/skills/dknowc-ppt-assistant/scripts/console_encoding.py +1 -2
- package/skills/dknowc-ppt-assistant/scripts/error_helper.py +3 -3
- package/skills/dknowc-ppt-assistant/scripts/hyperlink_contract.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/initialize.py +11 -13
- package/skills/dknowc-ppt-assistant/scripts/language_tags.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/mcp_convert.py +17 -15
- package/skills/dknowc-ppt-assistant/scripts/mcp_direct.py +3 -2
- package/skills/dknowc-ppt-assistant/scripts/native_payloads.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/pptx_animations.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/__init__.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/errors.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/formula.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/loader.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/models.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/registry.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/semantic_hash.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/semantics.py +3 -3
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/animation_import.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/formula_import.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/hyperlinks.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/preset_authoring.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/preset_registry_to_svg.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/preset_svg_markup.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/slide_to_svg.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/transition_import.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/pptx_transitions.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/preset_shape_svg.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/preview_slide_html.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/project_utils.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/register_key.mjs +710 -322
- package/skills/dknowc-ppt-assistant/scripts/render_trace_html.py +207 -40
- package/skills/dknowc-ppt-assistant/scripts/resource_paths.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/shape_boolean_svg.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/slide_roster.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/svg_finalize/__init__.py +2 -9
- package/skills/dknowc-ppt-assistant/scripts/svg_finalize/align_embed_images.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/svg_finalize/crop_images.py +3 -3
- package/skills/dknowc-ppt-assistant/scripts/svg_quality/__init__.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/svg_quality/checker.py +9 -10
- package/skills/dknowc-ppt-assistant/scripts/svg_quality/cli.py +4 -4
- package/skills/dknowc-ppt-assistant/scripts/svg_quality/svg_contracts.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/svg_quality/xml_support.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/svg_quality_checker.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/hyperlinks.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/theme_colors.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/theme_fonts.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/geometry_properties.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula_ast.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula_compiler.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula_omml.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula_parser.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula_profile.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula_run_properties.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/inline_formula.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/builder.py +9 -11
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/cli.py +7 -5
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/template_structure.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/template_validation.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/semantic_markers.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/shape_boolean.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/text_outline.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx.py +1 -1
- package/skills/dknowc-ppt-assistant/scripts/trusted_search.py +63 -11
- package/skills/dknowc-ppt-assistant/scripts/update_spec.py +25 -1
- package/skills/dknowc-ppt-assistant/workflows/generate-pptx.md +30 -16
- package/skills/dknowc-ppt-assistant/workflows/routing.md +1 -1
- package/skills/dknowc-trusted-search/README.md +13 -13
- package/skills/dknowc-trusted-search/SKILL.md +96 -56
- package/skills/dknowc-trusted-search/reference/onboarding_scripts.md +40 -15
- package/skills/dknowc-trusted-search/scripts/api_key.py +11 -26
- package/skills/dknowc-trusted-search/scripts/attribution.py +1 -1
- package/skills/dknowc-trusted-search/scripts/deep_query.py +4 -2
- package/skills/dknowc-trusted-search/scripts/initialize.py +10 -10
- package/skills/dknowc-trusted-search/scripts/mcp_direct.py +3 -2
- package/skills/dknowc-trusted-search/scripts/merge_search_results.py +68 -10
- package/skills/dknowc-trusted-search/scripts/register_key.mjs +617 -275
- package/skills/dknowc-trusted-search/scripts/render_trace_html.py +87 -19
- package/skills/dknowc-trusted-search/scripts/trusted_search.py +109 -44
- package/skills/dknowc-official-doc-writer/scripts/mcp_convert.py +0 -272
- package/skills/dknowc-ppt-assistant/references/upstream-docs/svg-pipeline.md +0 -842
- package/skills/dknowc-ppt-assistant/scripts/finalize_svg.py +0 -507
- package/skills/dknowc-ppt-assistant/scripts/svg_finalize/svg_rect_to_path.py +0 -346
- package/skills/dknowc-trusted-search/scripts/mcp_convert.py +0 -198
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
-
"""PPT
|
|
2
|
+
"""深知可信PPT stateless SVG contract checks.
|
|
3
3
|
|
|
4
4
|
Validates the SVG property surface shared with the native DrawingML exporter.
|
|
5
5
|
Each check receives an explicit XML root or source string and appends findings
|
|
@@ -12,7 +12,7 @@ Examples:
|
|
|
12
12
|
from svg_quality.svg_contracts import check_paint_compatibility
|
|
13
13
|
|
|
14
14
|
Dependencies:
|
|
15
|
-
Standard library plus local PPT
|
|
15
|
+
Standard library plus local 深知可信PPT SVG-to-PPTX modules.
|
|
16
16
|
"""
|
|
17
17
|
|
|
18
18
|
import copy
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""
|
|
3
|
-
PPT
|
|
3
|
+
深知可信PPT - DrawingML Hyperlink Lowering
|
|
4
4
|
|
|
5
5
|
Register native PowerPoint hyperlink relationships and attach click actions to
|
|
6
6
|
text runs or clickable leaf shapes produced by the SVG converter.
|
|
@@ -13,7 +13,7 @@ Examples:
|
|
|
13
13
|
linked = apply_shape_hyperlink(result, ctx, "#slide-2")
|
|
14
14
|
|
|
15
15
|
Dependencies:
|
|
16
|
-
PPT
|
|
16
|
+
深知可信PPT hyperlink contract and DrawingML conversion context.
|
|
17
17
|
"""
|
|
18
18
|
|
|
19
19
|
from __future__ import annotations
|
|
@@ -250,7 +250,7 @@ def apply_theme_color_spec(extract_dir: Path, spec: ThemeColorSpec) -> None:
|
|
|
250
250
|
color_scheme = tree.getroot().find(f".//{{{DML_NS}}}clrScheme")
|
|
251
251
|
if color_scheme is None:
|
|
252
252
|
raise ThemeColorError(f"Theme has no clrScheme: {theme_path}")
|
|
253
|
-
color_scheme.set("name", "PPT
|
|
253
|
+
color_scheme.set("name", "深知可信PPT")
|
|
254
254
|
for slot, color in spec.slots.items():
|
|
255
255
|
_set_scheme_color(color_scheme, slot, color)
|
|
256
256
|
tree.write(theme_path, encoding="utf-8", xml_declaration=True)
|
|
@@ -204,7 +204,7 @@ def apply_theme_font_spec(extract_dir: Path, spec: ThemeFontSpec) -> None:
|
|
|
204
204
|
minor = font_scheme.find(f"{{{DML_NS}}}minorFont")
|
|
205
205
|
if major is None or minor is None:
|
|
206
206
|
raise ThemeFontError(f"Theme has no major/minor font collection: {theme_path}")
|
|
207
|
-
font_scheme.set("name", "PPT
|
|
207
|
+
font_scheme.set("name", "深知可信PPT")
|
|
208
208
|
_patch_font_collection(major, spec.major)
|
|
209
209
|
_patch_font_collection(minor, spec.minor)
|
|
210
210
|
tree.write(theme_path, encoding="utf-8", xml_declaration=True)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Materialize the supported inline SVG geometry-property subset.
|
|
2
2
|
|
|
3
|
-
SVG 2 lets selected geometry values participate in CSS. PPT
|
|
3
|
+
SVG 2 lets selected geometry values participate in CSS. 深知可信PPT does not
|
|
4
4
|
run a CSS engine, but it can safely compile literal per-element ``style``
|
|
5
5
|
declarations into the equivalent XML geometry attributes before any existing
|
|
6
6
|
SVG post-processing or DrawingML conversion runs.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""
|
|
3
|
-
PPT
|
|
3
|
+
深知可信PPT - Native Formula Shape Builder
|
|
4
4
|
|
|
5
5
|
Build editable PowerPoint formula shapes from explicit LaTeX markers.
|
|
6
6
|
|
|
@@ -13,7 +13,7 @@ Examples:
|
|
|
13
13
|
from svg_to_pptx.native_objects.formula import build_native_formula
|
|
14
14
|
|
|
15
15
|
Dependencies:
|
|
16
|
-
None (only uses standard library and local PPT
|
|
16
|
+
None (only uses standard library and local 深知可信PPT modules)
|
|
17
17
|
"""
|
|
18
18
|
|
|
19
19
|
from __future__ import annotations
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
r"""
|
|
3
|
-
PPT
|
|
3
|
+
深知可信PPT - Native Formula Compiler
|
|
4
4
|
|
|
5
5
|
Compile the documented Microsoft 365 LaTeX input profile into editable block
|
|
6
6
|
or inline Office Math XML.
|
|
@@ -15,7 +15,7 @@ Examples:
|
|
|
15
15
|
compile_latex_to_omml(r"\frac{-b \pm \sqrt{b^2-4ac}}{2a}")
|
|
16
16
|
|
|
17
17
|
Dependencies:
|
|
18
|
-
None (only uses standard library and local PPT
|
|
18
|
+
None (only uses standard library and local 深知可信PPT modules)
|
|
19
19
|
"""
|
|
20
20
|
|
|
21
21
|
from __future__ import annotations
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""
|
|
3
|
-
PPT
|
|
3
|
+
深知可信PPT - Native Formula OMML Emitter
|
|
4
4
|
|
|
5
5
|
Emit the Microsoft 365 LaTeX profile AST as editable Office Math XML and
|
|
6
6
|
validate the narrow XML vocabulary produced by this module.
|
|
@@ -14,7 +14,7 @@ Examples:
|
|
|
14
14
|
emit_omml(expression, display=True)
|
|
15
15
|
|
|
16
16
|
Dependencies:
|
|
17
|
-
None (only uses standard library and local PPT
|
|
17
|
+
None (only uses standard library and local 深知可信PPT modules)
|
|
18
18
|
"""
|
|
19
19
|
|
|
20
20
|
from __future__ import annotations
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
r"""
|
|
3
|
-
PPT
|
|
3
|
+
深知可信PPT - Microsoft 365 LaTeX Formula Parser
|
|
4
4
|
|
|
5
5
|
Parse the documented Microsoft 365 LaTeX import profile into the internal
|
|
6
6
|
native-formula AST. Unknown commands remain fail-closed.
|
|
@@ -14,7 +14,7 @@ Examples:
|
|
|
14
14
|
parse_latex_formula(r"\binom{n}{k}", display=True)
|
|
15
15
|
|
|
16
16
|
Dependencies:
|
|
17
|
-
None (only uses standard library and local PPT
|
|
17
|
+
None (only uses standard library and local 深知可信PPT modules)
|
|
18
18
|
"""
|
|
19
19
|
|
|
20
20
|
from __future__ import annotations
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""
|
|
3
|
-
PPT
|
|
3
|
+
深知可信PPT - Native Inline Formula Contract
|
|
4
4
|
|
|
5
5
|
Validate SVG inline-formula markers and build editable PowerPoint math runs.
|
|
6
6
|
|
|
@@ -13,7 +13,7 @@ Examples:
|
|
|
13
13
|
<tspan data-pptx-inline-formula="x_i^2">xᵢ²</tspan>
|
|
14
14
|
|
|
15
15
|
Dependencies:
|
|
16
|
-
None (only uses standard library and local PPT
|
|
16
|
+
None (only uses standard library and local 深知可信PPT modules)
|
|
17
17
|
"""
|
|
18
18
|
|
|
19
19
|
from __future__ import annotations
|
|
@@ -3948,20 +3948,18 @@ def _create_writable_work_dir(output_path: Path) -> Path:
|
|
|
3948
3948
|
)
|
|
3949
3949
|
|
|
3950
3950
|
|
|
3951
|
-
def
|
|
3952
|
-
"""
|
|
3951
|
+
def _restrict_output_permissions(output_path: Path) -> list[str]:
|
|
3952
|
+
"""Restrict exported files to the owner (no group/other access)."""
|
|
3953
3953
|
warnings: list[str] = []
|
|
3954
3954
|
|
|
3955
3955
|
try:
|
|
3956
3956
|
current_mode = output_path.stat().st_mode
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
| stat.S_IRUSR
|
|
3960
|
-
| stat.
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
)
|
|
3964
|
-
os.chmod(output_path, readable_mode)
|
|
3957
|
+
# 显式清除组/其他读位:umask 决定创建权限(常见 644),仅"不追加"不足以收紧
|
|
3958
|
+
owner_only_mode = (
|
|
3959
|
+
(current_mode | stat.S_IRUSR | stat.S_IWUSR)
|
|
3960
|
+
& ~(stat.S_IRGRP | stat.S_IROTH | stat.S_IWGRP | stat.S_IWOTH)
|
|
3961
|
+
)
|
|
3962
|
+
os.chmod(output_path, owner_only_mode)
|
|
3965
3963
|
except OSError as exc:
|
|
3966
3964
|
warnings.append(f"chmod skipped for {output_path}: {exc}")
|
|
3967
3965
|
|
|
@@ -6233,7 +6231,7 @@ def create_pptx_with_native_svg(
|
|
|
6233
6231
|
f'PPTX animation package validation failed: {exc}'
|
|
6234
6232
|
) from exc
|
|
6235
6233
|
shutil.move(str(temp_output_path), str(output_path))
|
|
6236
|
-
permission_warnings =
|
|
6234
|
+
permission_warnings = _restrict_output_permissions(output_path)
|
|
6237
6235
|
|
|
6238
6236
|
if conversion_trace_path and conversion_trace is not None:
|
|
6239
6237
|
conversion_trace_path.parent.mkdir(parents=True, exist_ok=True)
|
|
@@ -633,7 +633,7 @@ def _print_structure_contract_error(
|
|
|
633
633
|
print(
|
|
634
634
|
" A legacy lock without pptx_structure.mode defaults only to flat. "
|
|
635
635
|
"Mirror/layout reuse must first create a current template workspace "
|
|
636
|
-
"
|
|
636
|
+
"following references/svg-authoring.md, then generate "
|
|
637
637
|
"new structured SVG pages.",
|
|
638
638
|
file=sys.stderr,
|
|
639
639
|
)
|
|
@@ -648,7 +648,7 @@ def _print_structure_contract_error(
|
|
|
648
648
|
" A legacy lock with no pptx_structure.mode defaults to flat. "
|
|
649
649
|
"Explicit legacy or unknown values are not inferred. Mirror/layout reuse "
|
|
650
650
|
"must first create a current template workspace "
|
|
651
|
-
"
|
|
651
|
+
"following references/svg-authoring.md, then generate "
|
|
652
652
|
"new structured SVG pages.",
|
|
653
653
|
file=sys.stderr,
|
|
654
654
|
)
|
|
@@ -811,7 +811,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
811
811
|
animation_choices = ['none', *ANIMATIONS, 'auto', 'mixed', 'random']
|
|
812
812
|
|
|
813
813
|
parser = argparse.ArgumentParser(
|
|
814
|
-
description='PPT
|
|
814
|
+
description='深知可信PPT - SVG to native DrawingML PPTX Tool',
|
|
815
815
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
816
816
|
epilog=f'''
|
|
817
817
|
Examples:
|
|
@@ -1346,7 +1346,7 @@ Recorded narration:
|
|
|
1346
1346
|
)
|
|
1347
1347
|
quick_flag = ' --quick-generate' if args.quick_generate else ''
|
|
1348
1348
|
print(
|
|
1349
|
-
"Run: python3
|
|
1349
|
+
"Run: python3 scripts/svg_quality_checker.py "
|
|
1350
1350
|
f'"{project_path}"{quick_flag} --stage final --json',
|
|
1351
1351
|
file=sys.stderr,
|
|
1352
1352
|
)
|
|
@@ -1453,7 +1453,9 @@ Recorded narration:
|
|
|
1453
1453
|
|
|
1454
1454
|
backup_dir: Path | None = None
|
|
1455
1455
|
if args.output:
|
|
1456
|
+
# 显式 -o:使用调用方给定的固定文件名,同时保留 svg_output 备份(与默认分支一致)
|
|
1456
1457
|
native_path = Path(args.output)
|
|
1458
|
+
backup_dir = project_path / "backup" / timestamp
|
|
1457
1459
|
else:
|
|
1458
1460
|
exports_dir = project_path / "exports"
|
|
1459
1461
|
exports_dir.mkdir(parents=True, exist_ok=True)
|
|
@@ -1954,7 +1956,7 @@ Recorded narration:
|
|
|
1954
1956
|
)
|
|
1955
1957
|
|
|
1956
1958
|
if verbose:
|
|
1957
|
-
print("PPT
|
|
1959
|
+
print("深知可信PPT - SVG to native DrawingML PPTX Tool")
|
|
1958
1960
|
print("=" * 50)
|
|
1959
1961
|
print(f" Project path: {project_path}")
|
|
1960
1962
|
print(f" SVG directory: {native_source_dir}")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""
|
|
3
|
-
PPT
|
|
3
|
+
深知可信PPT - Shape Boolean Core
|
|
4
4
|
|
|
5
5
|
Resolve closed SVG or text-outline operands into SVG-root-coordinate paths and
|
|
6
6
|
apply PowerPoint-compatible merge-shapes operations without mutating the source.
|
|
@@ -19,7 +19,7 @@ Examples:
|
|
|
19
19
|
)
|
|
20
20
|
|
|
21
21
|
Dependencies:
|
|
22
|
-
skia-pathops, local PPT
|
|
22
|
+
skia-pathops, local 深知可信PPT modules, and uharfbuzz for text operands
|
|
23
23
|
"""
|
|
24
24
|
|
|
25
25
|
from __future__ import annotations
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""
|
|
3
|
-
PPT
|
|
3
|
+
深知可信PPT - Text Outline Materialization
|
|
4
4
|
|
|
5
5
|
Resolve one supported SVG ``<text>`` operand into closed glyph-outline path
|
|
6
6
|
commands for the Shape Boolean geometry pipeline.
|
|
@@ -9,7 +9,7 @@ Usage:
|
|
|
9
9
|
Import text_element_to_path_commands from svg_to_pptx.text_outline.
|
|
10
10
|
|
|
11
11
|
Dependencies:
|
|
12
|
-
uharfbuzz and local PPT
|
|
12
|
+
uharfbuzz and local 深知可信PPT modules
|
|
13
13
|
"""
|
|
14
14
|
|
|
15
15
|
from __future__ import annotations
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""深知可信搜索可信搜索调用脚本。
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
调用可信搜索 V2 接口 /open-api/maas/dependable/v2/search,返回权威材料召回结果。
|
|
5
|
+
V2 要点(2026-10-23 起,沿用同源规范 定档):searchType 必填且每次调用
|
|
6
|
+
单值(多类来源并行调用后合并,混传会稀释结果名额);segmentCount=4 /
|
|
7
|
+
MaterialLength=18000 为受控实测定档;成功判定 ret==0 且 content.code==200;
|
|
8
|
+
返回顶层带 tid 便于平台排查。
|
|
5
9
|
"""
|
|
6
10
|
|
|
7
11
|
import argparse
|
|
@@ -17,7 +21,32 @@ from pathlib import Path
|
|
|
17
21
|
from typing import Any, Dict, Iterable, List, Optional
|
|
18
22
|
|
|
19
23
|
|
|
20
|
-
DEFAULT_ENDPOINT = "https://open.dknowc.cn/dependable/search"
|
|
24
|
+
DEFAULT_ENDPOINT = "https://open.dknowc.cn/open-api/maas/dependable/v2/search"
|
|
25
|
+
|
|
26
|
+
# 端点域名白名单:默认仅官方 HTTPS 域名,防止 --endpoint 把 API Key 发往任意主机。
|
|
27
|
+
# 本地测试(mock 服务)可用 DKNOWC_ALLOW_ANY_ENDPOINT=1 显式放开。
|
|
28
|
+
ALLOWED_ENDPOINT_HOSTS = {"open.dknowc.cn", "platform.dknowc.cn"}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def assert_endpoint_allowed(raw_url: str, flag_name: str = "--endpoint") -> str:
|
|
32
|
+
raw = str(raw_url or "").strip()
|
|
33
|
+
if os.environ.get("DKNOWC_ALLOW_ANY_ENDPOINT") == "1":
|
|
34
|
+
return raw
|
|
35
|
+
parsed = urllib.parse.urlparse(raw)
|
|
36
|
+
if parsed.scheme != "https" or parsed.hostname not in ALLOWED_ENDPOINT_HOSTS:
|
|
37
|
+
raise ValueError(
|
|
38
|
+
f"{flag_name} 指向非官方主机({parsed.scheme}://{parsed.hostname}):仅允许 HTTPS 的 "
|
|
39
|
+
"open.dknowc.cn / platform.dknowc.cn。如确需自定义端点,请设置 DKNOWC_ALLOW_ANY_ENDPOINT=1。"
|
|
40
|
+
)
|
|
41
|
+
return raw
|
|
42
|
+
# V2 必填:每次调用只传一个 searchType(默认 policy);多值直接报错——
|
|
43
|
+
# 混传会共用结果名额、显著稀释政策文件与文号覆盖(同源规范 实测)。
|
|
44
|
+
SEARCH_TYPES = ("policy", "govSite", "affair", "qa", "private")
|
|
45
|
+
DEFAULT_SEARCH_TYPE = "policy"
|
|
46
|
+
# 参数定档(第一轮受控实测,沿用同源规范):4 段/篇 + 18000 字上限,
|
|
47
|
+
# 双主题相关率最高、边际新增质量最好;可经 --segment-count / --material-length 调整。
|
|
48
|
+
DEFAULT_SEGMENT_COUNT = 4
|
|
49
|
+
DEFAULT_MATERIAL_LENGTH = 18000
|
|
21
50
|
SKILL_ROOT = Path(__file__).resolve().parent.parent
|
|
22
51
|
# 工作区根:dsh 场景通过环境变量 DKNWOC_WS_ROOT 指向会话工作区,未设置时回退到 cwd
|
|
23
52
|
import os as _os
|
|
@@ -99,16 +128,31 @@ def _validate_service_area(value: str) -> str:
|
|
|
99
128
|
|
|
100
129
|
|
|
101
130
|
def _build_payload(args: argparse.Namespace) -> Dict[str, Any]:
|
|
131
|
+
# V2:searchType 必填单值(多值报错;需要多类来源就分路调用后合并)
|
|
132
|
+
search_type = (args.search_type or DEFAULT_SEARCH_TYPE).strip()
|
|
133
|
+
for part in re.split(r"[,,\s]+", search_type):
|
|
134
|
+
if part and part not in SEARCH_TYPES:
|
|
135
|
+
raise SystemExit(f"错误:searchType 仅允许单值({' / '.join(SEARCH_TYPES)}),收到:{search_type}")
|
|
136
|
+
if len([p for p in re.split(r"[,,\s]+", search_type) if p]) > 1:
|
|
137
|
+
raise SystemExit(f"错误:V2 每次调用只传一个 searchType(混传会稀释结果名额);"
|
|
138
|
+
f"需要多类来源请分路调用后合并。收到:{search_type}")
|
|
139
|
+
material_length = args.material_length if args.material_length else DEFAULT_MATERIAL_LENGTH
|
|
140
|
+
if int(material_length) <= 0:
|
|
141
|
+
raise SystemExit("错误:--material-length 必须为正整数")
|
|
102
142
|
payload: Dict[str, Any] = {
|
|
103
143
|
"query": args.query,
|
|
144
|
+
"searchType": [search_type],
|
|
104
145
|
"policy": False if args.no_policy else True,
|
|
105
146
|
"item": False if args.no_item else True,
|
|
106
147
|
"knowBase": False if args.no_know_base else True,
|
|
107
148
|
"return_full_content": args.return_full_content,
|
|
108
|
-
|
|
149
|
+
# simplified 默认 False:True 会丢每篇材料的存档快照 screenShotPath(接口 2026-10-20 实测),
|
|
150
|
+
# 快照是报告的附加回看入口;需要精炼输出时显式传 --simplified。
|
|
151
|
+
"simplified": True if args.simplified else False,
|
|
152
|
+
"MaterialLength": int(material_length),
|
|
109
153
|
}
|
|
110
154
|
|
|
111
|
-
segment_count = args.segment_count if args.segment_count is not None else
|
|
155
|
+
segment_count = args.segment_count if args.segment_count is not None else DEFAULT_SEGMENT_COUNT
|
|
112
156
|
if segment_count not in (None, ""):
|
|
113
157
|
payload["segmentCount"] = int(segment_count)
|
|
114
158
|
|
|
@@ -277,13 +321,18 @@ def _bail_if_biz_error(body: Dict[str, Any]) -> None:
|
|
|
277
321
|
content = _content(body)
|
|
278
322
|
code = content.get("code")
|
|
279
323
|
msg = content.get("msg")
|
|
280
|
-
|
|
324
|
+
# V2 成功判定:ret==0 且 content.code==200;ret 非 0 也按业务错误处理
|
|
325
|
+
ret = body.get("ret") if isinstance(body, dict) else None
|
|
326
|
+
if (code and code != 200) or (ret is not None and ret != 0):
|
|
281
327
|
quota = detect_quota_exhausted(None, msg)
|
|
282
|
-
|
|
328
|
+
err_label = f"ret={ret}" if (ret is not None and ret != 0 and not (code and code != 200)) else code
|
|
329
|
+
print(f"错误:可信搜索接口返回 {err_label} {msg or ''}".strip())
|
|
283
330
|
print(json.dumps({
|
|
284
331
|
"status": "error",
|
|
285
332
|
"stage": "biz",
|
|
286
333
|
"biz_code": code,
|
|
334
|
+
"ret": ret,
|
|
335
|
+
"tid": body.get("tid") if isinstance(body, dict) else None,
|
|
287
336
|
"quota_exhausted": quota,
|
|
288
337
|
"retry_forbidden": quota,
|
|
289
338
|
"user_message": user_message_for_error(None if code != 500 else 500, quota),
|
|
@@ -361,9 +410,12 @@ def main() -> None:
|
|
|
361
410
|
parser.add_argument("--know-base", action="store_true", help="返回知识专库链接")
|
|
362
411
|
parser.add_argument("--no-know-base", action="store_true", help="不返回知识专库链接")
|
|
363
412
|
parser.add_argument("--return-full-content", action="store_true", help="返回资料全文")
|
|
364
|
-
parser.add_argument("--segment-count", type=int, help="
|
|
365
|
-
parser.add_argument("--
|
|
366
|
-
|
|
413
|
+
parser.add_argument("--segment-count", type=int, help="每篇材料最多返回段落数(默认 4,V2 定档)")
|
|
414
|
+
parser.add_argument("--search-type", help="V2 必填单值:policy / govSite / affair / qa / private(默认 policy;"
|
|
415
|
+
"多值报错——多类来源分路调用后合并)")
|
|
416
|
+
parser.add_argument("--material-length", type=int, help="返回材料总字符上限(默认 18000,V2 定档)")
|
|
417
|
+
parser.add_argument("--simplified", action="store_true", help="精炼输出(会丢存档快照 screenShotPath,默认关闭)")
|
|
418
|
+
parser.add_argument("--no-simplified", action="store_true", help="兼容保留:默认已不精炼,无需传此参数")
|
|
367
419
|
parser.add_argument("--max-articles", type=int, default=3, help="摘要最多展示材料数")
|
|
368
420
|
parser.add_argument("--max-paragraphs", type=int, default=1, help="每篇材料最多展示段落数")
|
|
369
421
|
parser.add_argument("--paragraph-chars", type=int, default=1200, help="每段最多展示字符数")
|
|
@@ -374,12 +426,12 @@ def main() -> None:
|
|
|
374
426
|
parser.add_argument("--timeout", type=int, default=60, help="请求超时秒数")
|
|
375
427
|
args = parser.parse_args()
|
|
376
428
|
|
|
377
|
-
endpoint = _pick(
|
|
429
|
+
endpoint = assert_endpoint_allowed(_pick(
|
|
378
430
|
args.endpoint,
|
|
379
431
|
os.environ.get("DKNOWC_TRUSTED_SEARCH_ENDPOINT"),
|
|
380
432
|
os.environ.get("DKNOWC_KNOW_SEARCH_ENDPOINT"),
|
|
381
433
|
DEFAULT_ENDPOINT,
|
|
382
|
-
)
|
|
434
|
+
))
|
|
383
435
|
api_key = _pick(
|
|
384
436
|
_resolve_key(),
|
|
385
437
|
)
|
|
@@ -33,7 +33,31 @@ import tempfile
|
|
|
33
33
|
from pathlib import Path
|
|
34
34
|
|
|
35
35
|
from console_encoding import configure_utf8_stdio
|
|
36
|
-
|
|
36
|
+
import re as _re
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def parse_lock(lock_path) -> dict:
|
|
40
|
+
"""解析 spec_lock.md:`## 分节` + `- key: value` 列表 -> {分节: {key: value}}。
|
|
41
|
+
|
|
42
|
+
最小实现,覆盖本脚本与导出链路需要的 canvas / typography / communication 等分节;
|
|
43
|
+
忽略注释与空行,值按原样保留字符串。
|
|
44
|
+
"""
|
|
45
|
+
path = Path(lock_path)
|
|
46
|
+
text = path.read_text(encoding="utf-8")
|
|
47
|
+
sections: dict = {}
|
|
48
|
+
current = None
|
|
49
|
+
for line in text.splitlines():
|
|
50
|
+
m = _re.match(r"^##\s+(.+?)\s*$", line)
|
|
51
|
+
if m:
|
|
52
|
+
current = m.group(1).strip().lower()
|
|
53
|
+
sections.setdefault(current, {})
|
|
54
|
+
continue
|
|
55
|
+
m = _re.match(r"^-\s+([A-Za-z0-9_\-]+)\s*:\s*(.*)$", line)
|
|
56
|
+
if m and current is not None:
|
|
57
|
+
sections[current][m.group(1)] = m.group(2).strip()
|
|
58
|
+
if not sections:
|
|
59
|
+
raise ValueError(f"spec_lock has no sections: {path}")
|
|
60
|
+
return sections
|
|
37
61
|
|
|
38
62
|
configure_utf8_stdio()
|
|
39
63
|
|