netizen-cli 0.10.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.
- netizen_cli/__init__.py +3 -0
- netizen_cli/__main__.py +4 -0
- netizen_cli/admin/__init__.py +1 -0
- netizen_cli/admin/auth.py +928 -0
- netizen_cli/admin/errors.py +9 -0
- netizen_cli/admin/port_config.py +115 -0
- netizen_cli/admin/presentation.py +257 -0
- netizen_cli/admin/queries.py +337 -0
- netizen_cli/admin/static/admin.css +260 -0
- netizen_cli/admin/static/admin.js +2898 -0
- netizen_cli/admin/static/index.html +327 -0
- netizen_cli/admin/transport.py +935 -0
- netizen_cli/admin/web.py +2717 -0
- netizen_cli/bindings.py +3215 -0
- netizen_cli/builtin_skills.py +93 -0
- netizen_cli/cards/__init__.py +105 -0
- netizen_cli/cards/callbacks.py +565 -0
- netizen_cli/cards/controls.py +2273 -0
- netizen_cli/cards/defaults.py +213 -0
- netizen_cli/cards/model_info.py +80 -0
- netizen_cli/cards/questions.py +220 -0
- netizen_cli/cards/reply.py +2247 -0
- netizen_cli/cards/scheduled.py +836 -0
- netizen_cli/channel/__init__.py +1 -0
- netizen_cli/channel/completion_mentions.py +60 -0
- netizen_cli/channel/input_preparation.py +644 -0
- netizen_cli/channel/messages.py +57 -0
- netizen_cli/channel/ports.py +52 -0
- netizen_cli/channel/question_inputs.py +51 -0
- netizen_cli/channel/reactions.py +293 -0
- netizen_cli/channel/reply_presenter.py +1505 -0
- netizen_cli/channel/topics.py +70 -0
- netizen_cli/channel_app.py +6593 -0
- netizen_cli/cli.py +287 -0
- netizen_cli/cli_data.py +536 -0
- netizen_cli/cli_packages.py +526 -0
- netizen_cli/cli_services.py +651 -0
- netizen_cli/cli_setup.py +242 -0
- netizen_cli/cli_update.py +303 -0
- netizen_cli/cli_update_restore.py +53 -0
- netizen_cli/cli_update_worker.py +333 -0
- netizen_cli/codex_runtime.py +7125 -0
- netizen_cli/completion_mention.py +16 -0
- netizen_cli/database_migrations.py +218 -0
- netizen_cli/defaults/__init__.py +5 -0
- netizen_cli/defaults/models.py +39 -0
- netizen_cli/defaults/service.py +232 -0
- netizen_cli/defaults/store.py +260 -0
- netizen_cli/deployment/__init__.py +1 -0
- netizen_cli/deployment/restart_worker.py +134 -0
- netizen_cli/deployment/update_executor.py +258 -0
- netizen_cli/deployment/update_protocol.py +281 -0
- netizen_cli/domain.py +416 -0
- netizen_cli/error_messages.py +124 -0
- netizen_cli/experience.py +531 -0
- netizen_cli/feishu_app_onboarding.py +187 -0
- netizen_cli/feishu_app_permissions.py +123 -0
- netizen_cli/git_status.py +63 -0
- netizen_cli/image_inputs.py +579 -0
- netizen_cli/instance.py +84 -0
- netizen_cli/lark_app.py +125 -0
- netizen_cli/main.py +903 -0
- netizen_cli/management/__init__.py +83 -0
- netizen_cli/management/blocking_io.py +352 -0
- netizen_cli/management/chat_labels.py +266 -0
- netizen_cli/management/coordination.py +32 -0
- netizen_cli/management/service.py +2187 -0
- netizen_cli/management/updates.py +214 -0
- netizen_cli/markdown_images.py +78 -0
- netizen_cli/message_content.py +786 -0
- netizen_cli/message_history.py +643 -0
- netizen_cli/message_preparation.py +60 -0
- netizen_cli/message_projection.py +923 -0
- netizen_cli/migrations/__init__.py +1 -0
- netizen_cli/migrations/schema.py +103 -0
- netizen_cli/migrations/v14.py +438 -0
- netizen_cli/model_settings.py +269 -0
- netizen_cli/package_resources.py +22 -0
- netizen_cli/projects.py +327 -0
- netizen_cli/prompt_projection.py +327 -0
- netizen_cli/quoted_context.py +312 -0
- netizen_cli/resources/config.example.yaml +35 -0
- netizen_cli/resources/skills/netizen-lark/SKILL.md +64 -0
- netizen_cli/resources/skills/netizen-user-guide/SKILL.md +37 -0
- netizen_cli/resources/skills/netizen-user-guide/references/user-guide.md +842 -0
- netizen_cli/result_images.py +123 -0
- netizen_cli/runtime/__init__.py +1 -0
- netizen_cli/runtime/contracts.py +792 -0
- netizen_cli/runtime/name_writes.py +67 -0
- netizen_cli/runtime/thread_naming.py +451 -0
- netizen_cli/schedules/__init__.py +1 -0
- netizen_cli/schedules/mcp.py +535 -0
- netizen_cli/schedules/models.py +394 -0
- netizen_cli/schedules/scheduler.py +374 -0
- netizen_cli/schedules/service.py +766 -0
- netizen_cli/schedules/store.py +771 -0
- netizen_cli/sdk_gap_adapter.py +1151 -0
- netizen_cli/service_launcher.py +583 -0
- netizen_cli/session_settings.py +126 -0
- netizen_cli/settings.py +216 -0
- netizen_cli/skill_references.py +40 -0
- netizen_cli/terminal_cleanup.py +155 -0
- netizen_cli/turn_activity.py +688 -0
- netizen_cli/turn_files.py +812 -0
- netizen_cli/turn_patch_children.py +254 -0
- netizen_cli/turn_plan_observer.py +315 -0
- netizen_cli/user_questions.py +106 -0
- netizen_cli-0.10.0.dist-info/METADATA +18 -0
- netizen_cli-0.10.0.dist-info/RECORD +112 -0
- netizen_cli-0.10.0.dist-info/WHEEL +5 -0
- netizen_cli-0.10.0.dist-info/entry_points.txt +2 -0
- netizen_cli-0.10.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"""Locate and validate package-local Skills without touching user Codex state."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from urllib.parse import unquote, urlsplit
|
|
7
|
+
|
|
8
|
+
from markdown_it import MarkdownIt
|
|
9
|
+
import yaml
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
BUILTIN_SKILL_NAMES = ("netizen-user-guide", "netizen-lark")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class BuiltinSkillError(RuntimeError):
|
|
16
|
+
"""The imported installation cannot provide its complete built-in Skills."""
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def builtin_skill_root(
|
|
20
|
+
*,
|
|
21
|
+
package_file: Path | None = None,
|
|
22
|
+
) -> Path:
|
|
23
|
+
"""Resolve from the actual imported package, never cwd, PATH or an instance.
|
|
24
|
+
|
|
25
|
+
Wheels contain their resources beside the modules. An explicit source-tree
|
|
26
|
+
import (including an editable install) uses the canonical repository tree.
|
|
27
|
+
An incomplete installed resource tree fails instead of using another copy.
|
|
28
|
+
"""
|
|
29
|
+
module = (package_file or Path(__file__)).resolve()
|
|
30
|
+
source = module.parent / "resources"
|
|
31
|
+
if source.exists() or source.is_symlink():
|
|
32
|
+
if source.is_symlink():
|
|
33
|
+
raise BuiltinSkillError(f"package resources directory is a symlink: {source}")
|
|
34
|
+
return validate_builtin_skills(source)
|
|
35
|
+
source = module.parent.parent
|
|
36
|
+
if module.parent.name != "netizen_cli" or not (source / "pyproject.toml").is_file():
|
|
37
|
+
raise BuiltinSkillError("cannot identify the installed Netizen resources")
|
|
38
|
+
return validate_builtin_skills(source)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def validate_builtin_skills(source_root: Path) -> Path:
|
|
42
|
+
"""Require both self-contained Skill trees, including referenced resources."""
|
|
43
|
+
raw_root = source_root.resolve() / "skills"
|
|
44
|
+
if raw_root.is_symlink() or not raw_root.is_dir():
|
|
45
|
+
raise BuiltinSkillError(f"built-in Skills directory is unavailable: {raw_root}")
|
|
46
|
+
for name in BUILTIN_SKILL_NAMES:
|
|
47
|
+
skill = raw_root / name
|
|
48
|
+
if skill.is_symlink() or not skill.is_dir():
|
|
49
|
+
raise BuiltinSkillError(f"built-in Skill is unavailable: {skill}")
|
|
50
|
+
entry = skill / "SKILL.md"
|
|
51
|
+
if entry.is_symlink():
|
|
52
|
+
raise BuiltinSkillError(f"built-in Skill contains a symlink: {entry}")
|
|
53
|
+
try:
|
|
54
|
+
text = entry.read_text(encoding="utf-8")
|
|
55
|
+
sections = text.split("---", 2)
|
|
56
|
+
metadata = yaml.safe_load(sections[1]) if text.startswith("---\n") else None
|
|
57
|
+
except (OSError, IndexError, UnicodeError, yaml.YAMLError) as error:
|
|
58
|
+
raise BuiltinSkillError(f"invalid built-in Skill: {entry}") from error
|
|
59
|
+
if (
|
|
60
|
+
not isinstance(metadata, dict)
|
|
61
|
+
or metadata.get("name") != name
|
|
62
|
+
or not isinstance(metadata.get("description"), str)
|
|
63
|
+
or not metadata["description"].strip()
|
|
64
|
+
):
|
|
65
|
+
raise BuiltinSkillError(f"invalid built-in Skill metadata: {entry}")
|
|
66
|
+
for path in skill.rglob("*"):
|
|
67
|
+
if path.is_symlink():
|
|
68
|
+
raise BuiltinSkillError(f"built-in Skill contains a symlink: {path}")
|
|
69
|
+
if path.is_file():
|
|
70
|
+
try:
|
|
71
|
+
if not path.read_bytes():
|
|
72
|
+
raise BuiltinSkillError(f"built-in Skill contains an empty file: {path}")
|
|
73
|
+
if path.suffix.lower() == ".md":
|
|
74
|
+
_validate_resources(skill, path)
|
|
75
|
+
except (OSError, UnicodeError) as error:
|
|
76
|
+
raise BuiltinSkillError(f"built-in Skill resource is unreadable: {path}") from error
|
|
77
|
+
return raw_root
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def _validate_resources(skill: Path, document: Path) -> None:
|
|
81
|
+
for block in MarkdownIt().parse(document.read_text(encoding="utf-8")):
|
|
82
|
+
for token in block.children or ():
|
|
83
|
+
target = token.attrGet("href") or token.attrGet("src")
|
|
84
|
+
if not target:
|
|
85
|
+
continue
|
|
86
|
+
url = urlsplit(target)
|
|
87
|
+
if url.scheme or url.netloc or not url.path:
|
|
88
|
+
continue
|
|
89
|
+
resource = (document.parent / unquote(url.path)).resolve()
|
|
90
|
+
if not resource.is_relative_to(skill) or not resource.exists():
|
|
91
|
+
raise BuiltinSkillError(
|
|
92
|
+
f"built-in Skill reference is missing or outside its tree: {document} -> {target}"
|
|
93
|
+
)
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"""Stable public entry points for Channel cards and callback decoding."""
|
|
2
|
+
|
|
3
|
+
from .callbacks import (
|
|
4
|
+
ACTION_VERSION,
|
|
5
|
+
CardActionError,
|
|
6
|
+
MAX_ENCODED_MODEL_ID_CHARS,
|
|
7
|
+
MAX_MODEL_ID_CHARS,
|
|
8
|
+
REPLY_CARD_ACTION_VERSION,
|
|
9
|
+
SettingsCardActionError,
|
|
10
|
+
TURN_FILE_ACTION_VERSION,
|
|
11
|
+
TurnFileCardLimitError,
|
|
12
|
+
fetched_card_topic_id,
|
|
13
|
+
goal_generation,
|
|
14
|
+
scope_from_fetched_card,
|
|
15
|
+
)
|
|
16
|
+
from .reply import (
|
|
17
|
+
TURN_FILE_CARD_JSON_LIMIT_BYTES,
|
|
18
|
+
TURN_FILE_MANIFEST_LIMIT,
|
|
19
|
+
activity_step_display,
|
|
20
|
+
decode_turn_file_action,
|
|
21
|
+
is_turn_file_action,
|
|
22
|
+
reply_card,
|
|
23
|
+
reply_card_from_manifest,
|
|
24
|
+
turn_files_card,
|
|
25
|
+
turn_files_card_from_manifest,
|
|
26
|
+
turn_progress_card,
|
|
27
|
+
turn_progress_card_from_manifest,
|
|
28
|
+
)
|
|
29
|
+
from .controls import (
|
|
30
|
+
ArchivedSessionCardItem,
|
|
31
|
+
MAX_SETTING_ID_CHARS,
|
|
32
|
+
MAX_THREAD_NAME_CHARS,
|
|
33
|
+
SESSIONS_PAGE_SIZE,
|
|
34
|
+
SessionCardItem,
|
|
35
|
+
archive_binding_card,
|
|
36
|
+
archived_sessions_card,
|
|
37
|
+
archived_sessions_delete_binding_card,
|
|
38
|
+
binding_configured_card,
|
|
39
|
+
binding_created_card,
|
|
40
|
+
binding_lifecycle_result_card,
|
|
41
|
+
config_card,
|
|
42
|
+
context_mode_display,
|
|
43
|
+
decode_button_action,
|
|
44
|
+
decode_card_form,
|
|
45
|
+
decode_settings_form,
|
|
46
|
+
delete_binding_card,
|
|
47
|
+
error_card,
|
|
48
|
+
goal_card,
|
|
49
|
+
new_binding_card,
|
|
50
|
+
rename_binding_card,
|
|
51
|
+
sessions_card,
|
|
52
|
+
sessions_delete_binding_card,
|
|
53
|
+
settings_card,
|
|
54
|
+
side_topic_card,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
__all__ = [
|
|
58
|
+
"ACTION_VERSION",
|
|
59
|
+
"ArchivedSessionCardItem",
|
|
60
|
+
"CardActionError",
|
|
61
|
+
"MAX_ENCODED_MODEL_ID_CHARS",
|
|
62
|
+
"MAX_MODEL_ID_CHARS",
|
|
63
|
+
"MAX_SETTING_ID_CHARS",
|
|
64
|
+
"MAX_THREAD_NAME_CHARS",
|
|
65
|
+
"REPLY_CARD_ACTION_VERSION",
|
|
66
|
+
"SESSIONS_PAGE_SIZE",
|
|
67
|
+
"SessionCardItem",
|
|
68
|
+
"SettingsCardActionError",
|
|
69
|
+
"TURN_FILE_ACTION_VERSION",
|
|
70
|
+
"TURN_FILE_CARD_JSON_LIMIT_BYTES",
|
|
71
|
+
"TURN_FILE_MANIFEST_LIMIT",
|
|
72
|
+
"TurnFileCardLimitError",
|
|
73
|
+
"activity_step_display",
|
|
74
|
+
"archive_binding_card",
|
|
75
|
+
"archived_sessions_card",
|
|
76
|
+
"archived_sessions_delete_binding_card",
|
|
77
|
+
"binding_configured_card",
|
|
78
|
+
"binding_created_card",
|
|
79
|
+
"binding_lifecycle_result_card",
|
|
80
|
+
"config_card",
|
|
81
|
+
"context_mode_display",
|
|
82
|
+
"decode_button_action",
|
|
83
|
+
"decode_card_form",
|
|
84
|
+
"decode_settings_form",
|
|
85
|
+
"decode_turn_file_action",
|
|
86
|
+
"delete_binding_card",
|
|
87
|
+
"error_card",
|
|
88
|
+
"fetched_card_topic_id",
|
|
89
|
+
"goal_card",
|
|
90
|
+
"goal_generation",
|
|
91
|
+
"is_turn_file_action",
|
|
92
|
+
"new_binding_card",
|
|
93
|
+
"rename_binding_card",
|
|
94
|
+
"reply_card",
|
|
95
|
+
"reply_card_from_manifest",
|
|
96
|
+
"scope_from_fetched_card",
|
|
97
|
+
"sessions_card",
|
|
98
|
+
"sessions_delete_binding_card",
|
|
99
|
+
"settings_card",
|
|
100
|
+
"side_topic_card",
|
|
101
|
+
"turn_files_card",
|
|
102
|
+
"turn_files_card_from_manifest",
|
|
103
|
+
"turn_progress_card",
|
|
104
|
+
"turn_progress_card_from_manifest",
|
|
105
|
+
]
|