flowly-code 1.0.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.
Files changed (86) hide show
  1. flowly_code/__init__.py +30 -0
  2. flowly_code/__main__.py +8 -0
  3. flowly_code/activity/__init__.py +1 -0
  4. flowly_code/activity/bus.py +91 -0
  5. flowly_code/activity/events.py +40 -0
  6. flowly_code/agent/__init__.py +8 -0
  7. flowly_code/agent/context.py +485 -0
  8. flowly_code/agent/loop.py +1349 -0
  9. flowly_code/agent/memory.py +109 -0
  10. flowly_code/agent/skills.py +259 -0
  11. flowly_code/agent/subagent.py +249 -0
  12. flowly_code/agent/tools/__init__.py +6 -0
  13. flowly_code/agent/tools/base.py +55 -0
  14. flowly_code/agent/tools/delegate.py +194 -0
  15. flowly_code/agent/tools/dispatch.py +840 -0
  16. flowly_code/agent/tools/docker.py +609 -0
  17. flowly_code/agent/tools/filesystem.py +280 -0
  18. flowly_code/agent/tools/mcp.py +85 -0
  19. flowly_code/agent/tools/message.py +235 -0
  20. flowly_code/agent/tools/registry.py +257 -0
  21. flowly_code/agent/tools/screenshot.py +444 -0
  22. flowly_code/agent/tools/shell.py +166 -0
  23. flowly_code/agent/tools/spawn.py +65 -0
  24. flowly_code/agent/tools/system.py +917 -0
  25. flowly_code/agent/tools/trello.py +420 -0
  26. flowly_code/agent/tools/web.py +139 -0
  27. flowly_code/agent/tools/x.py +399 -0
  28. flowly_code/bus/__init__.py +6 -0
  29. flowly_code/bus/events.py +37 -0
  30. flowly_code/bus/queue.py +81 -0
  31. flowly_code/channels/__init__.py +6 -0
  32. flowly_code/channels/base.py +121 -0
  33. flowly_code/channels/manager.py +135 -0
  34. flowly_code/channels/telegram.py +1132 -0
  35. flowly_code/cli/__init__.py +1 -0
  36. flowly_code/cli/commands.py +1831 -0
  37. flowly_code/cli/setup.py +1356 -0
  38. flowly_code/compaction/__init__.py +39 -0
  39. flowly_code/compaction/estimator.py +88 -0
  40. flowly_code/compaction/pruning.py +223 -0
  41. flowly_code/compaction/service.py +297 -0
  42. flowly_code/compaction/summarizer.py +384 -0
  43. flowly_code/compaction/types.py +71 -0
  44. flowly_code/config/__init__.py +6 -0
  45. flowly_code/config/loader.py +102 -0
  46. flowly_code/config/schema.py +324 -0
  47. flowly_code/exec/__init__.py +39 -0
  48. flowly_code/exec/approvals.py +288 -0
  49. flowly_code/exec/executor.py +184 -0
  50. flowly_code/exec/safety.py +247 -0
  51. flowly_code/exec/types.py +88 -0
  52. flowly_code/gateway/__init__.py +5 -0
  53. flowly_code/gateway/server.py +103 -0
  54. flowly_code/heartbeat/__init__.py +5 -0
  55. flowly_code/heartbeat/service.py +130 -0
  56. flowly_code/multiagent/README.md +248 -0
  57. flowly_code/multiagent/__init__.py +1 -0
  58. flowly_code/multiagent/invoke.py +210 -0
  59. flowly_code/multiagent/orchestrator.py +156 -0
  60. flowly_code/multiagent/router.py +156 -0
  61. flowly_code/multiagent/setup.py +171 -0
  62. flowly_code/pairing/__init__.py +21 -0
  63. flowly_code/pairing/store.py +343 -0
  64. flowly_code/providers/__init__.py +6 -0
  65. flowly_code/providers/base.py +69 -0
  66. flowly_code/providers/litellm_provider.py +178 -0
  67. flowly_code/providers/transcription.py +64 -0
  68. flowly_code/session/__init__.py +5 -0
  69. flowly_code/session/manager.py +249 -0
  70. flowly_code/skills/README.md +24 -0
  71. flowly_code/skills/compact/SKILL.md +27 -0
  72. flowly_code/skills/github/SKILL.md +48 -0
  73. flowly_code/skills/skill-creator/SKILL.md +371 -0
  74. flowly_code/skills/summarize/SKILL.md +67 -0
  75. flowly_code/skills/tmux/SKILL.md +121 -0
  76. flowly_code/skills/tmux/scripts/find-sessions.sh +112 -0
  77. flowly_code/skills/tmux/scripts/wait-for-text.sh +83 -0
  78. flowly_code/skills/weather/SKILL.md +49 -0
  79. flowly_code/utils/__init__.py +5 -0
  80. flowly_code/utils/helpers.py +91 -0
  81. flowly_code-1.0.0.dist-info/METADATA +724 -0
  82. flowly_code-1.0.0.dist-info/RECORD +86 -0
  83. flowly_code-1.0.0.dist-info/WHEEL +4 -0
  84. flowly_code-1.0.0.dist-info/entry_points.txt +2 -0
  85. flowly_code-1.0.0.dist-info/licenses/LICENSE +191 -0
  86. flowly_code-1.0.0.dist-info/licenses/NOTICE +74 -0
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ usage() {
5
+ cat <<'USAGE'
6
+ Usage: wait-for-text.sh -t target -p pattern [options]
7
+
8
+ Poll a tmux pane for text and exit when found.
9
+
10
+ Options:
11
+ -t, --target tmux target (session:window.pane), required
12
+ -p, --pattern regex pattern to look for, required
13
+ -F, --fixed treat pattern as a fixed string (grep -F)
14
+ -T, --timeout seconds to wait (integer, default: 15)
15
+ -i, --interval poll interval in seconds (default: 0.5)
16
+ -l, --lines number of history lines to inspect (integer, default: 1000)
17
+ -h, --help show this help
18
+ USAGE
19
+ }
20
+
21
+ target=""
22
+ pattern=""
23
+ grep_flag="-E"
24
+ timeout=15
25
+ interval=0.5
26
+ lines=1000
27
+
28
+ while [[ $# -gt 0 ]]; do
29
+ case "$1" in
30
+ -t|--target) target="${2-}"; shift 2 ;;
31
+ -p|--pattern) pattern="${2-}"; shift 2 ;;
32
+ -F|--fixed) grep_flag="-F"; shift ;;
33
+ -T|--timeout) timeout="${2-}"; shift 2 ;;
34
+ -i|--interval) interval="${2-}"; shift 2 ;;
35
+ -l|--lines) lines="${2-}"; shift 2 ;;
36
+ -h|--help) usage; exit 0 ;;
37
+ *) echo "Unknown option: $1" >&2; usage; exit 1 ;;
38
+ esac
39
+ done
40
+
41
+ if [[ -z "$target" || -z "$pattern" ]]; then
42
+ echo "target and pattern are required" >&2
43
+ usage
44
+ exit 1
45
+ fi
46
+
47
+ if ! [[ "$timeout" =~ ^[0-9]+$ ]]; then
48
+ echo "timeout must be an integer number of seconds" >&2
49
+ exit 1
50
+ fi
51
+
52
+ if ! [[ "$lines" =~ ^[0-9]+$ ]]; then
53
+ echo "lines must be an integer" >&2
54
+ exit 1
55
+ fi
56
+
57
+ if ! command -v tmux >/dev/null 2>&1; then
58
+ echo "tmux not found in PATH" >&2
59
+ exit 1
60
+ fi
61
+
62
+ # End time in epoch seconds (integer, good enough for polling)
63
+ start_epoch=$(date +%s)
64
+ deadline=$((start_epoch + timeout))
65
+
66
+ while true; do
67
+ # -J joins wrapped lines, -S uses negative index to read last N lines
68
+ pane_text="$(tmux capture-pane -p -J -t "$target" -S "-${lines}" 2>/dev/null || true)"
69
+
70
+ if printf '%s\n' "$pane_text" | grep $grep_flag -- "$pattern" >/dev/null 2>&1; then
71
+ exit 0
72
+ fi
73
+
74
+ now=$(date +%s)
75
+ if (( now >= deadline )); then
76
+ echo "Timed out after ${timeout}s waiting for pattern: $pattern" >&2
77
+ echo "Last ${lines} lines from $target:" >&2
78
+ printf '%s\n' "$pane_text" >&2
79
+ exit 1
80
+ fi
81
+
82
+ sleep "$interval"
83
+ done
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: weather
3
+ description: Get current weather and forecasts (no API key required).
4
+ homepage: https://wttr.in/:help
5
+ metadata: {"flowly":{"emoji":"🌤️","requires":{"bins":["curl"]}}}
6
+ ---
7
+
8
+ # Weather
9
+
10
+ Two free services, no API keys needed.
11
+
12
+ ## wttr.in (primary)
13
+
14
+ Quick one-liner:
15
+ ```bash
16
+ curl -s "wttr.in/London?format=3"
17
+ # Output: London: ⛅️ +8°C
18
+ ```
19
+
20
+ Compact format:
21
+ ```bash
22
+ curl -s "wttr.in/London?format=%l:+%c+%t+%h+%w"
23
+ # Output: London: ⛅️ +8°C 71% ↙5km/h
24
+ ```
25
+
26
+ Full forecast:
27
+ ```bash
28
+ curl -s "wttr.in/London?T"
29
+ ```
30
+
31
+ Format codes: `%c` condition · `%t` temp · `%h` humidity · `%w` wind · `%l` location · `%m` moon
32
+
33
+ Tips:
34
+ - URL-encode spaces: `wttr.in/New+York`
35
+ - Airport codes: `wttr.in/JFK`
36
+ - Units: `?m` (metric) `?u` (USCS)
37
+ - Today only: `?1` · Current only: `?0`
38
+ - PNG: `curl -s "wttr.in/Berlin.png" -o /tmp/weather.png`
39
+
40
+ ## Open-Meteo (fallback, JSON)
41
+
42
+ Free, no key, good for programmatic use:
43
+ ```bash
44
+ curl -s "https://api.open-meteo.com/v1/forecast?latitude=51.5&longitude=-0.12&current_weather=true"
45
+ ```
46
+
47
+ Find coordinates for a city, then query. Returns JSON with temp, windspeed, weathercode.
48
+
49
+ Docs: https://open-meteo.com/en/docs
@@ -0,0 +1,5 @@
1
+ """Utility functions for flowly."""
2
+
3
+ from flowly_code.utils.helpers import ensure_dir, get_workspace_path, get_data_path
4
+
5
+ __all__ = ["ensure_dir", "get_workspace_path", "get_data_path"]
@@ -0,0 +1,91 @@
1
+ """Utility functions for flowly."""
2
+
3
+ from pathlib import Path
4
+ from datetime import datetime
5
+
6
+
7
+ def ensure_dir(path: Path) -> Path:
8
+ """Ensure a directory exists, creating it if necessary."""
9
+ path.mkdir(parents=True, exist_ok=True)
10
+ return path
11
+
12
+
13
+ def get_data_path() -> Path:
14
+ """Get the flowly data directory (~/.flowly)."""
15
+ return ensure_dir(Path.home() / ".flowly")
16
+
17
+
18
+ def get_workspace_path(workspace: str | None = None) -> Path:
19
+ """
20
+ Get the workspace path.
21
+
22
+ Args:
23
+ workspace: Optional workspace path. Defaults to ~/.flowly/workspace.
24
+
25
+ Returns:
26
+ Expanded and ensured workspace path.
27
+ """
28
+ if workspace:
29
+ path = Path(workspace).expanduser()
30
+ else:
31
+ path = Path.home() / ".flowly" / "workspace"
32
+ return ensure_dir(path)
33
+
34
+
35
+ def get_sessions_path() -> Path:
36
+ """Get the sessions storage directory."""
37
+ return ensure_dir(get_data_path() / "sessions")
38
+
39
+
40
+ def get_memory_path(workspace: Path | None = None) -> Path:
41
+ """Get the memory directory within the workspace."""
42
+ ws = workspace or get_workspace_path()
43
+ return ensure_dir(ws / "memory")
44
+
45
+
46
+ def get_skills_path(workspace: Path | None = None) -> Path:
47
+ """Get the skills directory within the workspace."""
48
+ ws = workspace or get_workspace_path()
49
+ return ensure_dir(ws / "skills")
50
+
51
+
52
+ def today_date() -> str:
53
+ """Get today's date in YYYY-MM-DD format."""
54
+ return datetime.now().strftime("%Y-%m-%d")
55
+
56
+
57
+ def timestamp() -> str:
58
+ """Get current timestamp in ISO format."""
59
+ return datetime.now().isoformat()
60
+
61
+
62
+ def truncate_string(s: str, max_len: int = 100, suffix: str = "...") -> str:
63
+ """Truncate a string to max length, adding suffix if truncated."""
64
+ if len(s) <= max_len:
65
+ return s
66
+ return s[: max_len - len(suffix)] + suffix
67
+
68
+
69
+ def safe_filename(name: str) -> str:
70
+ """Convert a string to a safe filename."""
71
+ # Replace unsafe characters
72
+ unsafe = '<>:"/\\|?*'
73
+ for char in unsafe:
74
+ name = name.replace(char, "_")
75
+ return name.strip()
76
+
77
+
78
+ def parse_session_key(key: str) -> tuple[str, str]:
79
+ """
80
+ Parse a session key into channel and chat_id.
81
+
82
+ Args:
83
+ key: Session key in format "channel:chat_id"
84
+
85
+ Returns:
86
+ Tuple of (channel, chat_id)
87
+ """
88
+ parts = key.split(":", 1)
89
+ if len(parts) != 2:
90
+ raise ValueError(f"Invalid session key: {key}")
91
+ return parts[0], parts[1]