clink-cli 0.2.1__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.
- clink/__init__.py +19 -0
- clink/agents/__init__.py +30 -0
- clink/agents/base.py +70 -0
- clink/agents/claude.py +7 -0
- clink/agents/codex.py +7 -0
- clink/agents/gemini.py +7 -0
- clink/allowed_roots.py +356 -0
- clink/backend.py +765 -0
- clink/cli.py +594 -0
- clink/constants.py +78 -0
- clink/contracts.py +167 -0
- clink/files.py +70 -0
- clink/generation.py +274 -0
- clink/generation_capabilities.py +207 -0
- clink/generation_contracts.py +214 -0
- clink/generation_policy.py +174 -0
- clink/models.py +243 -0
- clink/native.py +409 -0
- clink/native_adapters.py +244 -0
- clink/native_contracts.py +68 -0
- clink/native_generation.py +421 -0
- clink/native_generation_claude_policy.py +59 -0
- clink/native_generation_contracts.py +264 -0
- clink/native_generation_families.py +218 -0
- clink/native_generation_family_policy.py +14 -0
- clink/native_generation_files.py +153 -0
- clink/native_generation_policy.py +82 -0
- clink/native_policy.py +86 -0
- clink/parsers/__init__.py +34 -0
- clink/parsers/agy.py +53 -0
- clink/parsers/agy_native.py +161 -0
- clink/parsers/agy_native_generation.py +189 -0
- clink/parsers/base.py +209 -0
- clink/parsers/claude.py +104 -0
- clink/parsers/claude_native.py +113 -0
- clink/parsers/claude_native_generation.py +346 -0
- clink/parsers/codex.py +172 -0
- clink/parsers/codex_generation.py +212 -0
- clink/parsers/codex_native.py +236 -0
- clink/parsers/codex_native_generation.py +367 -0
- clink/parsers/gemini.py +110 -0
- clink/parsers/grok.py +63 -0
- clink/parsers/grok_native.py +91 -0
- clink/parsers/grok_native_generation.py +157 -0
- clink/policy.py +180 -0
- clink/registry.py +544 -0
- clink/resources/CODEX-LICENSE +201 -0
- clink/resources/CODEX-NOTICE +6 -0
- clink/resources/PROVENANCE.md +16 -0
- clink/resources/codex-0.166.0-models-direct.json +1284 -0
- clink/resources/codex-0.166.0-models-generation.json +1269 -0
- clink/resources/native-agy-1.4.12-admission.json +746 -0
- clink/resources/native-claude-2.1.304-admission.json +99 -0
- clink/resources/native-generation-claude-2.1.304-admission.json +277 -0
- clink/resources/native-generation-codex-0.166.0-admission.json +309 -0
- clink/resources/native-generation-grok-1.0.70-admission.json +329 -0
- clink/resources/native-grok-1.0.70-admission.json +644 -0
- clink/runner.py +303 -0
- clink/setup.py +399 -0
- clink/tasks.py +695 -0
- clink_cli-0.2.1.dist-info/METADATA +225 -0
- clink_cli-0.2.1.dist-info/RECORD +141 -0
- clink_cli-0.2.1.dist-info/WHEEL +5 -0
- clink_cli-0.2.1.dist-info/entry_points.txt +3 -0
- clink_cli-0.2.1.dist-info/licenses/LICENSE +197 -0
- clink_cli-0.2.1.dist-info/licenses/clink/resources/CODEX-LICENSE +201 -0
- clink_cli-0.2.1.dist-info/licenses/clink/resources/CODEX-NOTICE +6 -0
- clink_cli-0.2.1.dist-info/top_level.txt +7 -0
- conf/__init__.py +1 -0
- conf/cli_clients/agy.json +40 -0
- conf/cli_clients/claude.json +39 -0
- conf/cli_clients/codex.json +40 -0
- conf/cli_clients/gemini.json +23 -0
- conf/cli_clients/grok.json +40 -0
- config.py +40 -0
- server.py +896 -0
- systemprompts/__init__.py +35 -0
- systemprompts/analyze_prompt.py +87 -0
- systemprompts/chat_prompt.py +57 -0
- systemprompts/clink/codex_codereviewer.txt +8 -0
- systemprompts/clink/default.txt +8 -0
- systemprompts/clink/default_codereviewer.txt +8 -0
- systemprompts/clink/default_planner.txt +7 -0
- systemprompts/clink/native_codereviewer.txt +1 -0
- systemprompts/clink/native_default.txt +1 -0
- systemprompts/clink/native_planner.txt +1 -0
- systemprompts/codereview_prompt.py +91 -0
- systemprompts/consensus_prompt.py +120 -0
- systemprompts/debug_prompt.py +150 -0
- systemprompts/docgen_prompt.py +252 -0
- systemprompts/generate_code_prompt.py +181 -0
- systemprompts/planner_prompt.py +127 -0
- systemprompts/precommit_prompt.py +179 -0
- systemprompts/refactor_prompt.py +323 -0
- systemprompts/secaudit_prompt.py +420 -0
- systemprompts/testgen_prompt.py +133 -0
- systemprompts/thinkdeep_prompt.py +55 -0
- systemprompts/tracer_prompt.py +145 -0
- tools/__init__.py +43 -0
- tools/analyze.py +583 -0
- tools/apilookup.py +97 -0
- tools/challenge.py +198 -0
- tools/chat.py +187 -0
- tools/clink.py +130 -0
- tools/codereview.py +724 -0
- tools/consensus.py +790 -0
- tools/debug.py +573 -0
- tools/docgen.py +577 -0
- tools/listmodels.py +48 -0
- tools/models.py +373 -0
- tools/planner.py +533 -0
- tools/precommit.py +776 -0
- tools/refactor.py +645 -0
- tools/secaudit.py +685 -0
- tools/shared/__init__.py +19 -0
- tools/shared/base_models.py +167 -0
- tools/shared/base_tool.py +659 -0
- tools/shared/exceptions.py +20 -0
- tools/shared/schema_builders.py +159 -0
- tools/simple/__init__.py +18 -0
- tools/simple/base.py +539 -0
- tools/testgen.py +513 -0
- tools/thinkdeep.py +586 -0
- tools/tracer.py +763 -0
- tools/version.py +53 -0
- tools/workflow/__init__.py +22 -0
- tools/workflow/base.py +448 -0
- tools/workflow/schema_builders.py +166 -0
- tools/workflow/workflow_mixin.py +1195 -0
- utils/__init__.py +21 -0
- utils/call_state.py +349 -0
- utils/client_info.py +293 -0
- utils/consensus_manifest.py +131 -0
- utils/conversation_memory.py +582 -0
- utils/env.py +111 -0
- utils/file_types.py +271 -0
- utils/file_utils.py +803 -0
- utils/image_utils.py +94 -0
- utils/security_config.py +163 -0
- utils/storage_backend.py +177 -0
- utils/token_utils.py +54 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Core schema building functionality for PAL MCP tools.
|
|
3
|
+
|
|
4
|
+
This module provides base schema generation functionality for simple tools.
|
|
5
|
+
Workflow-specific schema building is located in workflow/schema_builders.py
|
|
6
|
+
to maintain proper separation of concerns.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from typing import Any
|
|
10
|
+
|
|
11
|
+
from .base_models import COMMON_FIELD_DESCRIPTIONS
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class SchemaBuilder:
|
|
15
|
+
"""
|
|
16
|
+
Base schema builder for simple MCP tools.
|
|
17
|
+
|
|
18
|
+
This class provides static methods to build consistent schemas for simple tools.
|
|
19
|
+
Workflow tools use WorkflowSchemaBuilder in workflow/schema_builders.py.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
# Common field schemas that can be reused across all tool types
|
|
23
|
+
COMMON_FIELD_SCHEMAS = {
|
|
24
|
+
"cli_name": {"type": "string", "description": COMMON_FIELD_DESCRIPTIONS["cli_name"]},
|
|
25
|
+
"role": {"type": "string", "description": COMMON_FIELD_DESCRIPTIONS["role"]},
|
|
26
|
+
"temperature": {
|
|
27
|
+
"type": "number",
|
|
28
|
+
"description": COMMON_FIELD_DESCRIPTIONS["temperature"],
|
|
29
|
+
"minimum": 0.0,
|
|
30
|
+
"maximum": 1.0,
|
|
31
|
+
},
|
|
32
|
+
"thinking_mode": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"enum": ["minimal", "low", "medium", "high", "max"],
|
|
35
|
+
"description": COMMON_FIELD_DESCRIPTIONS["thinking_mode"],
|
|
36
|
+
},
|
|
37
|
+
"continuation_id": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"description": COMMON_FIELD_DESCRIPTIONS["continuation_id"],
|
|
40
|
+
},
|
|
41
|
+
"images": {
|
|
42
|
+
"type": "array",
|
|
43
|
+
"items": {"type": "string"},
|
|
44
|
+
"description": COMMON_FIELD_DESCRIPTIONS["images"],
|
|
45
|
+
},
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
# Simple tool-specific field schemas (workflow tools use relevant_files instead)
|
|
49
|
+
SIMPLE_FIELD_SCHEMAS = {
|
|
50
|
+
"absolute_file_paths": {
|
|
51
|
+
"type": "array",
|
|
52
|
+
"items": {"type": "string"},
|
|
53
|
+
"description": COMMON_FIELD_DESCRIPTIONS["absolute_file_paths"],
|
|
54
|
+
},
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@staticmethod
|
|
58
|
+
def build_schema(
|
|
59
|
+
tool_specific_fields: dict[str, dict[str, Any]] = None,
|
|
60
|
+
required_fields: list[str] = None,
|
|
61
|
+
model_field_schema: dict[str, Any] = None,
|
|
62
|
+
auto_mode: bool = False,
|
|
63
|
+
require_model: bool = False,
|
|
64
|
+
) -> dict[str, Any]:
|
|
65
|
+
"""
|
|
66
|
+
Build complete schema for simple tools.
|
|
67
|
+
|
|
68
|
+
Args:
|
|
69
|
+
tool_specific_fields: Additional fields specific to the tool
|
|
70
|
+
required_fields: List of required field names
|
|
71
|
+
model_field_schema: Schema for the model field
|
|
72
|
+
auto_mode: Whether the tool is in auto mode (affects model requirement)
|
|
73
|
+
|
|
74
|
+
Returns:
|
|
75
|
+
Complete JSON schema for the tool
|
|
76
|
+
"""
|
|
77
|
+
properties = {}
|
|
78
|
+
|
|
79
|
+
# Add common fields (temperature, thinking_mode, etc.)
|
|
80
|
+
properties.update(SchemaBuilder.COMMON_FIELD_SCHEMAS)
|
|
81
|
+
|
|
82
|
+
# Add simple tool-specific fields (files field for simple tools)
|
|
83
|
+
properties.update(SchemaBuilder.SIMPLE_FIELD_SCHEMAS)
|
|
84
|
+
|
|
85
|
+
# Add model field if provided
|
|
86
|
+
if model_field_schema:
|
|
87
|
+
properties["model"] = model_field_schema
|
|
88
|
+
|
|
89
|
+
# Add tool-specific fields if provided
|
|
90
|
+
if tool_specific_fields:
|
|
91
|
+
properties.update(tool_specific_fields)
|
|
92
|
+
|
|
93
|
+
# Build required fields list
|
|
94
|
+
required = list(required_fields) if required_fields else []
|
|
95
|
+
|
|
96
|
+
# Build the complete schema
|
|
97
|
+
schema = {
|
|
98
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
99
|
+
"type": "object",
|
|
100
|
+
"properties": properties,
|
|
101
|
+
"additionalProperties": False,
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if required:
|
|
105
|
+
schema["required"] = required
|
|
106
|
+
|
|
107
|
+
return schema
|
|
108
|
+
|
|
109
|
+
@staticmethod
|
|
110
|
+
def get_common_fields() -> dict[str, dict[str, Any]]:
|
|
111
|
+
"""Get the standard field schemas for simple tools."""
|
|
112
|
+
return SchemaBuilder.COMMON_FIELD_SCHEMAS.copy()
|
|
113
|
+
|
|
114
|
+
@staticmethod
|
|
115
|
+
def create_field_schema(
|
|
116
|
+
field_type: str,
|
|
117
|
+
description: str,
|
|
118
|
+
enum_values: list[str] = None,
|
|
119
|
+
minimum: float = None,
|
|
120
|
+
maximum: float = None,
|
|
121
|
+
items_type: str = None,
|
|
122
|
+
default: Any = None,
|
|
123
|
+
) -> dict[str, Any]:
|
|
124
|
+
"""
|
|
125
|
+
Helper method to create field schemas with common patterns.
|
|
126
|
+
|
|
127
|
+
Args:
|
|
128
|
+
field_type: JSON schema type ("string", "number", "array", etc.)
|
|
129
|
+
description: Human-readable description of the field
|
|
130
|
+
enum_values: For enum fields, list of allowed values
|
|
131
|
+
minimum: For numeric fields, minimum value
|
|
132
|
+
maximum: For numeric fields, maximum value
|
|
133
|
+
items_type: For array fields, type of array items
|
|
134
|
+
default: Default value for the field
|
|
135
|
+
|
|
136
|
+
Returns:
|
|
137
|
+
JSON schema object for the field
|
|
138
|
+
"""
|
|
139
|
+
schema = {
|
|
140
|
+
"type": field_type,
|
|
141
|
+
"description": description,
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if enum_values:
|
|
145
|
+
schema["enum"] = enum_values
|
|
146
|
+
|
|
147
|
+
if minimum is not None:
|
|
148
|
+
schema["minimum"] = minimum
|
|
149
|
+
|
|
150
|
+
if maximum is not None:
|
|
151
|
+
schema["maximum"] = maximum
|
|
152
|
+
|
|
153
|
+
if items_type and field_type == "array":
|
|
154
|
+
schema["items"] = {"type": items_type}
|
|
155
|
+
|
|
156
|
+
if default is not None:
|
|
157
|
+
schema["default"] = default
|
|
158
|
+
|
|
159
|
+
return schema
|
tools/simple/__init__.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Simple tools for PAL MCP.
|
|
3
|
+
|
|
4
|
+
Simple tools follow a basic request → AI model → response pattern.
|
|
5
|
+
They inherit from SimpleTool which provides streamlined functionality
|
|
6
|
+
for tools that don't need multi-step workflows.
|
|
7
|
+
|
|
8
|
+
Available simple tools:
|
|
9
|
+
- chat: General chat and collaborative thinking
|
|
10
|
+
- consensus: Multi-perspective analysis
|
|
11
|
+
- listmodels: Model listing and information
|
|
12
|
+
- testgen: Test generation
|
|
13
|
+
- tracer: Execution tracing
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
from .base import SimpleTool
|
|
17
|
+
|
|
18
|
+
__all__ = ["SimpleTool"]
|